cortex-react-components 2.23.0 → 2.23.2
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/{chunk-ZEPEWKBV.mjs → chunk-B7AXSCTN.mjs} +1 -1
- package/dist/{chunk-Q2QAFOWG.mjs → chunk-CQAMS7RZ.mjs} +1 -1
- package/dist/{chunk-NGL6K2L5.mjs → chunk-GSSW663E.mjs} +1 -1
- package/dist/{chunk-THOBCTIL.mjs → chunk-GZ7FGBTR.mjs} +1 -1
- package/dist/{chunk-WVSUPHRY.mjs → chunk-JPLBPV7J.mjs} +1 -1
- package/dist/chunk-JTMIQ7MK.mjs +4 -0
- package/dist/{chunk-RQLUMNJE.mjs → chunk-L5NPH5RX.mjs} +1 -1
- package/dist/{chunk-I4GYQZGM.mjs → chunk-QY3UXH77.mjs} +1 -1
- package/dist/{chunk-HSQAHQNP.mjs → chunk-TKCFCYEQ.mjs} +1 -1
- package/dist/{chunk-HTMQGMYL.mjs → chunk-TSFX33PR.mjs} +1 -1
- package/dist/{chunk-AGDKFAMN.mjs → chunk-UECG3SCG.mjs} +1 -1
- package/dist/{chunk-QKOBOCKK.mjs → chunk-XJKRA2AE.mjs} +1 -1
- package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +1 -1
- package/dist/components/DigitalColleagues/Views/index.mjs +1 -1
- package/dist/components/DigitalColleagues/index.mjs +1 -1
- package/dist/components/Foundary/Pages/dashboardpage.js +1 -1
- package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
- package/dist/components/Foundary/Views/KnowledgeView.js +1 -1
- package/dist/components/Foundary/Views/KnowledgeView.mjs +1 -1
- package/dist/components/Foundary/Views/index.js +1 -1
- package/dist/components/Foundary/Views/index.mjs +1 -1
- package/dist/components/Foundary/document-edit.js +1 -1
- package/dist/components/Foundary/document-edit.mjs +1 -1
- package/dist/components/Foundary/document-preview-examples.js +4 -4
- package/dist/components/Foundary/document-preview-examples.mjs +1 -1
- package/dist/components/Foundary/document-preview.js +1 -1
- package/dist/components/Foundary/document-preview.mjs +1 -1
- package/dist/components/Foundary/index.js +1 -1
- package/dist/components/Foundary/index.mjs +1 -1
- package/dist/components/Foundary/knowledge-browser.js +1 -1
- package/dist/components/Foundary/knowledge-browser.mjs +1 -1
- package/dist/components/Foundary/test-data.js +1 -1
- package/dist/components/Foundary/test-data.mjs +1 -1
- package/dist/components/Foundary/types.d.ts +42 -0
- package/dist/components/Heros/RenderHero.mjs +1 -1
- package/dist/components/Heros/index.mjs +1 -1
- package/dist/components/Projects/KanbanBoardView.mjs +1 -1
- package/dist/components/Projects/ProjectPage.mjs +1 -1
- package/dist/components/Projects/ProjectView.mjs +1 -1
- package/dist/components/Projects/ProjectsIndexView.mjs +1 -1
- package/dist/components/Projects/index.mjs +1 -1
- package/dist/components/dc-temp/index.mjs +1 -1
- package/dist/components/index.js +8 -8
- package/dist/components/index.mjs +1 -1
- package/dist/index.js +11 -11
- package/dist/index.mjs +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/pages/LandingPage.mjs +1 -1
- package/dist/pages/Page.mjs +1 -1
- package/dist/pages/Publish.mjs +1 -1
- package/dist/pages/Website.mjs +1 -1
- package/dist/sections/PageSections.mjs +1 -1
- package/dist/sections/ServiceSection.mjs +1 -1
- package/dist/sections/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-ACGCNGIH.mjs +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
"use strict";"use client";var Ar=Object.create;var bt=Object.defineProperty;var Er=Object.getOwnPropertyDescriptor;var Lr=Object.getOwnPropertyNames;var Hr=Object.getPrototypeOf,Kr=Object.prototype.hasOwnProperty;var Or=(e,t)=>{for(var o in t)bt(e,o,{get:t[o],enumerable:!0})},Yt=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Lr(t))!Kr.call(e,n)&&n!==o&&bt(e,n,{get:()=>t[n],enumerable:!(r=Er(t,n))||r.enumerable});return e};var Q=(e,t,o)=>(o=e!=null?Ar(Hr(e)):{},Yt(t||!e||!e.__esModule?bt(o,"default",{value:e,enumerable:!0}):o,e)),Br=e=>Yt(bt({},"__esModule",{value:!0}),e);var Ba={};Or(Ba,{default:()=>Ir});module.exports=Br(Ba);var Qe=require("react");var Xe=require("motion/react"),Ne=require("lucide-react");var co=Q(require("react"));var lo=require("clsx");var It="-",Vr=e=>{let t=_r(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{let l=a.split(It);return l[0]===""&&l.length!==1&&l.shift(),oo(l,t)||zr(a)},getConflictingClassGroupIds:(a,l)=>{let g=o[a]||[];return l&&r[a]?[...g,...r[a]]:g}}},oo=(e,t)=>{if(e.length===0)return t.classGroupId;let o=e[0],r=t.nextPart.get(o),n=r?oo(e.slice(1),r):void 0;if(n)return n;if(t.validators.length===0)return;let i=e.join(It);return t.validators.find(({validator:a})=>a(i))?.classGroupId},eo=/^\[(.+)\]$/,zr=e=>{if(eo.test(e)){let t=eo.exec(e)[1],o=t?.substring(0,t.indexOf(":"));if(o)return"arbitrary.."+o}},_r=e=>{let{theme:t,prefix:o}=e,r={nextPart:new Map,validators:[]};return Fr(Object.entries(e.classGroups),o).forEach(([i,a])=>{Tt(a,r,i,t)}),r},Tt=(e,t,o,r)=>{e.forEach(n=>{if(typeof n=="string"){let i=n===""?t:to(t,n);i.classGroupId=o;return}if(typeof n=="function"){if(Ur(n)){Tt(n(r),t,o,r);return}t.validators.push({validator:n,classGroupId:o});return}Object.entries(n).forEach(([i,a])=>{Tt(a,to(t,i),o,r)})})},to=(e,t)=>{let o=e;return t.split(It).forEach(r=>{o.nextPart.has(r)||o.nextPart.set(r,{nextPart:new Map,validators:[]}),o=o.nextPart.get(r)}),o},Ur=e=>e.isThemeGetter,Fr=(e,t)=>t?e.map(([o,r])=>{let n=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,l])=>[t+a,l])):i);return[o,n]}):e,$r=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=new Map,r=new Map,n=(i,a)=>{o.set(i,a),t++,t>e&&(t=0,r=o,o=new Map)};return{get(i){let a=o.get(i);if(a!==void 0)return a;if((a=r.get(i))!==void 0)return n(i,a),a},set(i,a){o.has(i)?o.set(i,a):n(i,a)}}},ro="!",jr=e=>{let{separator:t,experimentalParseClassName:o}=e,r=t.length===1,n=t[0],i=t.length,a=l=>{let g=[],P=0,y=0,m;for(let s=0;s<l.length;s++){let u=l[s];if(P===0){if(u===n&&(r||l.slice(s,s+i)===t)){g.push(l.slice(y,s)),y=s+i;continue}if(u==="/"){m=s;continue}}u==="["?P++:u==="]"&&P--}let M=g.length===0?l:l.substring(y),S=M.startsWith(ro),x=S?M.substring(1):M,d=m&&m>y?m-y:void 0;return{modifiers:g,hasImportantModifier:S,baseClassName:x,maybePostfixModifierPosition:d}};return o?l=>o({className:l,parseClassName:a}):a},Gr=e=>{if(e.length<=1)return e;let t=[],o=[];return e.forEach(r=>{r[0]==="["?(t.push(...o.sort(),r),o=[]):o.push(r)}),t.push(...o.sort()),t},Wr=e=>({cache:$r(e.cacheSize),parseClassName:jr(e),...Vr(e)}),Zr=/\s+/,Jr=(e,t)=>{let{parseClassName:o,getClassGroupId:r,getConflictingClassGroupIds:n}=t,i=[],a=e.trim().split(Zr),l="";for(let g=a.length-1;g>=0;g-=1){let P=a[g],{modifiers:y,hasImportantModifier:m,baseClassName:M,maybePostfixModifierPosition:S}=o(P),x=!!S,d=r(x?M.substring(0,S):M);if(!d){if(!x){l=P+(l.length>0?" "+l:l);continue}if(d=r(M),!d){l=P+(l.length>0?" "+l:l);continue}x=!1}let s=Gr(y).join(":"),u=m?s+ro:s,h=u+d;if(i.includes(h))continue;i.push(h);let k=n(d,x);for(let N=0;N<k.length;++N){let z=k[N];i.push(u+z)}l=P+(l.length>0?" "+l:l)}return l};function Xr(){let e=0,t,o,r="";for(;e<arguments.length;)(t=arguments[e++])&&(o=ao(t))&&(r&&(r+=" "),r+=o);return r}var ao=e=>{if(typeof e=="string")return e;let t,o="";for(let r=0;r<e.length;r++)e[r]&&(t=ao(e[r]))&&(o&&(o+=" "),o+=t);return o};function qr(e,...t){let o,r,n,i=a;function a(g){let P=t.reduce((y,m)=>m(y),e());return o=Wr(P),r=o.cache.get,n=o.cache.set,i=l,l(g)}function l(g){let P=r(g);if(P)return P;let y=Jr(g,o);return n(g,y),y}return function(){return i(Xr.apply(null,arguments))}}var $=e=>{let t=o=>o[e]||[];return t.isThemeGetter=!0,t},no=/^\[(?:([a-z-]+):)?(.+)\]$/i,Qr=/^\d+\/\d+$/,Yr=new Set(["px","full","screen"]),ea=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ta=/\d+(%|px|r?em|[sdl]?mo([hwib]|min|max)|mo|pc|in|cm|mm|cap|ch|ex|r?lh|cq(mo|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,oa=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,ra=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,aa=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Re=e=>Ye(e)||Yr.has(e)||Qr.test(e),Ie=e=>et(e,"length",ua),Ye=e=>!!e&&!Number.isNaN(Number(e)),kt=e=>et(e,"number",Ye),it=e=>!!e&&Number.isInteger(Number(e)),na=e=>e.endsWith("%")&&Ye(e.slice(0,-1)),E=e=>no.test(e),Ae=e=>ea.test(e),ia=new Set(["length","size","percentage"]),sa=e=>et(e,ia,io),la=e=>et(e,"position",io),da=new Set(["image","url"]),ca=e=>et(e,da,fa),ma=e=>et(e,"",pa),st=()=>!0,et=(e,t,o)=>{let r=no.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):o(r[2]):!1},ua=e=>ta.test(e)&&!oa.test(e),io=()=>!1,pa=e=>ra.test(e),fa=e=>aa.test(e);var ga=()=>{let e=$("colors"),t=$("spacing"),o=$("blur"),r=$("brightness"),n=$("borderColor"),i=$("borderRadius"),a=$("borderSpacing"),l=$("borderWidth"),g=$("contrast"),P=$("grayscale"),y=$("hueRotate"),m=$("invert"),M=$("gap"),S=$("gradientColorStops"),x=$("gradientColorStopPositions"),d=$("inset"),s=$("margin"),u=$("opacity"),h=$("padding"),k=$("saturate"),N=$("scale"),z=$("sepia"),j=$("skew"),U=$("space"),I=$("translate"),G=()=>["auto","contain","none"],J=()=>["auto","hidden","clip","visible","scroll"],se=()=>["auto",E,t],H=()=>[E,t],fe=()=>["",Re,Ie],Se=()=>["auto",Ye,E],C=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],_=()=>["solid","dashed","dotted","double","none"],f=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>["start","end","center","between","around","evenly","stretch"],ce=()=>["","0",E],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>[Ye,E];return{cacheSize:500,separator:":",theme:{colors:[st],spacing:[Re,Ie],blur:["none","",Ae,E],brightness:R(),borderColor:[e],borderRadius:["none","","full",Ae,E],borderSpacing:H(),borderWidth:fe(),contrast:R(),grayscale:ce(),hueRotate:R(),invert:ce(),gap:H(),gradientColorStops:[e],gradientColorStopPositions:[na,Ie],inset:se(),margin:se(),opacity:R(),padding:H(),saturate:R(),scale:R(),sepia:ce(),skew:R(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",E]}],container:["container"],columns:[{columns:[Ae]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...C(),E]}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[d]}],"inset-x":[{"inset-x":[d]}],"inset-y":[{"inset-y":[d]}],start:[{start:[d]}],end:[{end:[d]}],top:[{top:[d]}],right:[{right:[d]}],bottom:[{bottom:[d]}],left:[{left:[d]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",it,E]}],basis:[{basis:se()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",E]}],grow:[{grow:ce()}],shrink:[{shrink:ce()}],order:[{order:["first","last","none",it,E]}],"grid-cols":[{"grid-cols":[st]}],"col-start-end":[{col:["auto",{span:["full",it,E]},E]}],"col-start":[{"col-start":Se()}],"col-end":[{"col-end":Se()}],"grid-rows":[{"grid-rows":[st]}],"row-start-end":[{row:["auto",{span:[it,E]},E]}],"row-start":[{"row-start":Se()}],"row-end":[{"row-end":Se()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",E]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",E]}],gap:[{gap:[M]}],"gap-x":[{"gap-x":[M]}],"gap-y":[{"gap-y":[M]}],"justify-content":[{justify:["normal",...de()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...de(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...de(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],mo:[{mo:[h]}],px:[{px:[h]}],py:[{py:[h]}],ps:[{ps:[h]}],Qe:[{Qe:[h]}],mo:[{mo:[h]}],pr:[{pr:[h]}],pb:[{pb:[h]}],pl:[{pl:[h]}],m:[{m:[s]}],mx:[{mx:[s]}],my:[{my:[s]}],ms:[{ms:[s]}],Qe:[{Qe:[s]}],mt:[{mt:[s]}],mr:[{mr:[s]}],mb:[{mb:[s]}],ml:[{ml:[s]}],"space-x":[{"space-x":[U]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[U]}],"space-y-reverse":["space-y-reverse"],mo:[{mo:["auto","min","max","fit","svw","lvw","dvw",E,t]}],"min-mo":[{"min-mo":[E,t,"min","max","fit"]}],"max-mo":[{"max-mo":[E,t,"none","full","min","max","fit","prose",{screen:[Ae]},Ae]}],h:[{h:[E,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[E,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[E,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[E,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ae,Ie]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",kt]}],"font-family":[{font:[st]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",E]}],"line-clamp":[{"line-clamp":["none",Ye,kt]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Re,E]}],"list-image":[{"list-image":["none",E]}],"list-style-type":[{list:["none","disc","decimal",E]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[u]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[u]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[..._(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Re,Ie]}],"underline-offset":[{"underline-offset":["auto",Re,E]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",E]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",E]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[u]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...C(),la]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",sa]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","ir","b","bl","l","tl"]},ca]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[S]}],"gradient-via":[{via:[S]}],"gradient-to":[{to:[S]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-mo":[{"rounded-mo":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-ir":[{"rounded-ir":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-mo":[{border:[l]}],"border-mo-x":[{"border-x":[l]}],"border-mo-y":[{"border-y":[l]}],"border-mo-s":[{"border-s":[l]}],"border-mo-e":[{"border-e":[l]}],"border-mo-t":[{"border-t":[l]}],"border-mo-r":[{"border-r":[l]}],"border-mo-b":[{"border-b":[l]}],"border-mo-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[u]}],"border-style":[{border:[..._(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[u]}],"divide-style":[{divide:_()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",..._()]}],"outline-offset":[{"outline-offset":[Re,E]}],"outline-mo":[{outline:[Re,Ie]}],"outline-color":[{outline:[e]}],"ring-mo":[{ring:fe()}],"ring-mo-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[u]}],"ring-offset-mo":[{"ring-offset":[Re,Ie]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ae,ma]}],"shadow-color":[{shadow:[st]}],opacity:[{opacity:[u]}],"mix-blend":[{"mix-blend":[...f(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":f()}],filter:[{filter:["","none"]}],blur:[{blur:[o]}],brightness:[{brightness:[r]}],contrast:[{contrast:[g]}],"drop-shadow":[{"drop-shadow":["","none",Ae,E]}],grayscale:[{grayscale:[P]}],"hue-rotate":[{"hue-rotate":[y]}],invert:[{invert:[m]}],saturate:[{saturate:[k]}],sepia:[{sepia:[z]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[o]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[g]}],"backdrop-grayscale":[{"backdrop-grayscale":[P]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[y]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[u]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[z]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",E]}],duration:[{duration:R()}],ease:[{ease:["linear","in","out","in-out",E]}],delay:[{delay:R()}],animate:[{animate:["none","spin","ping","pulse","bounce",E]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[N]}],"scale-x":[{"scale-x":[N]}],"scale-y":[{"scale-y":[N]}],rotate:[{rotate:[it,E]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[j]}],"skew-y":[{"skew-y":[j]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",E]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","mo-resize","mo-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",E]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-Qe":[{"scroll-Qe":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-mo":[{"scroll-mo":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-Qe":[{"scroll-Qe":H()}],"scroll-mo":[{"scroll-mo":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",E]}],fill:[{fill:[e,"none"]}],"stroke-mo":[{stroke:[Re,Ie,kt]}],stroke:[{stroke:[e,"none"]}],gr:["gr-only","not-gr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],mo:["px","py","ps","Qe","mo","pr","pb","pl"],px:["pr","pl"],py:["mo","pb"],m:["mx","my","ms","Qe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["mo","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-mo","rounded-es","rounded-tl","rounded-tr","rounded-ir","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-mo"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-ir"],"rounded-b":["rounded-ir","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-mo":["border-mo-s","border-mo-e","border-mo-t","border-mo-r","border-mo-b","border-mo-l"],"border-mo-x":["border-mo-r","border-mo-l"],"border-mo-y":["border-mo-t","border-mo-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-Qe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-mo":["scroll-px","scroll-py","scroll-ps","scroll-Qe","scroll-mo","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-mo","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var so=qr(ga);function T(...e){return so((0,lo.clsx)(e))}var mo=require("react/jsx-runtime"),Y=co.forwardRef(({className:e,type:t,...o},r)=>(0,mo.jsx)("input",{type:t,className:T("flex h-9 mo-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...o}));Y.displayName="Input";var At=Q(require("react")),ve=Q(require("@radix-ui/react-scroll-area"));var tt=At.forwardRef(({className:e,children:t,...o},r)=>(0,mo.jsxs)(ve.Root,{ref:r,className:T("relative overflow-hidden",e),...o,children:[(0,mo.jsx)(ve.Viewport,{className:"h-full mo-full rounded-[inherit]",children:t}),(0,mo.jsx)(uo,{}),(0,mo.jsx)(ve.Corner,{})]}));tt.displayName=ve.Root.displayName;var uo=At.forwardRef(({className:e,orientation:t="vertical",...o},r)=>(0,mo.jsx)(ve.ScrollAreaScrollbar,{ref:r,orientation:t,className:T("flex touch-none select-none transition-colors",t==="vertical"&&"h-full mo-2.5 border-l border-l-transparent mo-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent mo-[1px]",e),...o,children:(0,mo.jsx)(ve.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));uo.displayName=ve.ScrollAreaScrollbar.displayName;var po=require("@radix-ui/react-slot"),fo=require("class-variance-authority"),go=Q(require("react")),ho=(0,fo.cva)("inline-flex items-center justify-center whitespace-nowrap rounded text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{defaultVariants:{size:"default",variant:"default"},variants:{size:{clear:"",default:"h-10 px-4 py-2",icon:"h-10 mo-10",lg:"h-11 rounded px-8",sm:"h-9 rounded px-3"},variant:{default:"bg-accent text-accent-foreground hover:bg-background hover:text-accent hover:border-accent hover:border",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",ghost:"hover:bg-card hover:text-accent",link:"text-primary items-start justify-start underline-offset-4 hover:underline",outline:"border border-border bg-background hover:bg-card hover:text-accent",secondary:"bg-secondary text-secondary-foreground hover:bg-accent"}}}),F=go.forwardRef(({asChild:e=!1,className:t,size:o,variant:r,...n},i)=>(0,mo.jsx)(e?po.Slot:"button",{className:T(ho({className:t,size:o,variant:r})),ref:i,...n}));F.displayName="Button";var lt=Q(require("react")),re=Q(require("@radix-ui/react-dialog"));var Pe=re.Root;var vt=re.Portal;var dt=lt.forwardRef(({className:e,...t},o)=>(0,mo.jsx)(re.Overlay,{ref:o,className:T("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));dt.displayName=re.Overlay.displayName;var Le=lt.forwardRef(({className:e,children:t,...o},r)=>(0,mo.jsxs)(vt,{children:[(0,mo.jsx)(dt,{}),(0,mo.jsxs)(re.Content,{ref:r,className:T("fixed left-[50%] top-[50%] z-50 grid mo-full max-mo-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background mo-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...o,children:[t,(0,mo.jsxs)(re.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,mo.jsx)(Ne.X,{className:"h-4 mo-4"}),(0,mo.jsx)("span",{className:"gr-only",children:"Close"})]})]})]}));Le.displayName=re.Content.displayName;var He=({className:e,...t})=>(0,mo.jsx)("div",{className:T("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});He.displayName="DialogHeader";var xo=({className:e,...t})=>(0,mo.jsx)("div",{className:T("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});xo.displayName="DialogFooter";var Ke=lt.forwardRef(({className:e,...t},o)=>(0,mo.jsx)(re.Title,{ref:o,className:T("text-lg font-semibold leading-none tracking-tight",e),...t}));Ke.displayName=re.Title.displayName;var wo=lt.forwardRef(({className:e,...t},o)=>(0,mo.jsx)(re.Description,{ref:o,className:T("text-sm text-muted-foreground",e),...t}));wo.displayName=re.Description.displayName;var wr=Q(require("@radix-ui/react-dialog"));var yo=Q(require("react")),$e=yo.forwardRef(({className:e,...t},o)=>(0,mo.jsx)("textarea",{className:T("flex min-h-[80px] mo-full rounded border border-border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...t}));$e.displayName="Textarea";var O=Q(require("@radix-ui/react-select")),Oe=Q(require("react")),Ge=O.Root;var We=O.Value,Be=Oe.forwardRef(({children:e,className:t,...o},r)=>(0,mo.jsxs)(O.Trigger,{className:T("flex h-10 mo-full items-center justify-between rounded border border-input bg-background px-3 py-2 text-inherit ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),ref:r,...o,children:[e,(0,mo.jsx)(O.Icon,{asChild:!0,children:(0,mo.jsx)(Ne.ChevronDown,{className:"h-4 mo-4 opacity-50"})})]}));Be.displayName=O.Trigger.displayName;var No=Oe.forwardRef(({className:e,...t},o)=>(0,mo.jsx)(O.ScrollUpButton,{className:T("flex cursor-default items-center justify-center py-1",e),ref:o,...t,children:(0,mo.jsx)(Ne.ChevronUp,{className:"h-4 mo-4"})}));No.displayName=O.ScrollUpButton.displayName;var So=Oe.forwardRef(({className:e,...t},o)=>(0,mo.jsx)(O.ScrollDownButton,{className:T("flex cursor-default items-center justify-center py-1",e),ref:o,...t,children:(0,mo.jsx)(Ne.ChevronDown,{className:"h-4 mo-4"})}));So.displayName=O.ScrollDownButton.displayName;var Ve=Oe.forwardRef(({children:e,className:t,position:o="popper",...r},n)=>(0,mo.jsx)(O.Portal,{children:(0,mo.jsxs)(O.Content,{className:T("relative z-50 max-h-96 min-mo-[8rem] overflow-hidden rounded border bg-card text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:o,ref:n,...r,children:[(0,mo.jsx)(No,{}),(0,mo.jsx)(O.Viewport,{className:T("mo-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] mo-full min-mo-[var(--radix-select-trigger-width)]"),children:e}),(0,mo.jsx)(So,{})]})}));Ve.displayName=O.Content.displayName;var ha=Oe.forwardRef(({className:e,...t},o)=>(0,mo.jsx)(O.Label,{className:T("py-1.5 pl-8 pr-2 text-sm font-semibold",e),ref:o,...t}));ha.displayName=O.Label.displayName;var xe=Oe.forwardRef(({children:e,className:t,...o},r)=>(0,mo.jsxs)(O.Item,{className:T("relative flex mo-full cursor-default select-none items-center rounded py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),ref:r,...o,children:[(0,mo.jsx)("span",{className:"absolute left-2 flex h-3.5 mo-3.5 items-center justify-center",children:(0,mo.jsx)(O.ItemIndicator,{children:(0,mo.jsx)(Ne.Check,{className:"h-4 mo-4"})})}),(0,mo.jsx)(O.ItemText,{children:e})]}));xe.displayName=O.Item.displayName;var ba=Oe.forwardRef(({className:e,...t},o)=>(0,mo.jsx)(O.Separator,{className:T("-mx-1 my-1 h-px bg-muted",e),ref:o,...t}));ba.displayName=O.Separator.displayName;var Do=Q(require("react")),Et=Q(require("@radix-ui/react-label"));var va=(0,fo.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ue=Do.forwardRef(({className:e,...t},o)=>(0,mo.jsx)(Et.Root,{ref:o,className:T(va(),e),...t}));ue.displayName=Et.Root.displayName;var Ht=({fieldName:e,value:t,label:o,multiline:r=!1,onSave:n,className:i="",disabled:a=!1})=>{let[l,g]=(0,Qe.useState)(!1),[P,y]=(0,Qe.useState)(""),m=()=>{a||(g(!0),y(t))},M=async()=>{P!==t&&await n(e,P),g(!1)},S=x=>{x.key==="Enter"&&!r||x.key==="Enter"&&x.ctrlKey&&r?M():x.key==="Escape"&&(g(!1),y(""))};return(0,mo.jsxs)("div",{className:`space-y-2 ${i}`,children:[(0,mo.jsx)(ue,{children:o}),l?r?(0,mo.jsx)($e,{value:P,onChange:x=>y(x.target.value),onBlur:M,onKeyDown:S,autoFocus:!0,rows:4,className:"resize-none"}):(0,mo.jsx)(Y,{value:P,onChange:x=>y(x.target.value),onBlur:M,onKeyPress:S,autoFocus:!0,className:"text-lg font-medium"}):(0,mo.jsxs)("div",{onClick:m,className:`${a?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted/50 mo-2 rounded border border-transparent hover:border-border transition-colors group ${r?"min-h-[100px]":"min-h-[40px]"} flex items-start gap-2`,children:[(0,mo.jsx)("span",{className:r?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click to edit..."}),!a&&(0,mo.jsx)(Ne.Edit,{className:"h-4 mo-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var lr=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),dr=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),cr=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),mr=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),ur=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),pr=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),fr=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),St=require("@payloadcms/richtext-lexical/lexical/list"),gr=require("@payloadcms/richtext-lexical/lexical/rich-text"),hr=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var ir=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),ft=require("@payloadcms/richtext-lexical/lexical/utils"),L=require("@payloadcms/richtext-lexical/lexical"),Gt=require("@payloadcms/richtext-lexical/lexical/selection");var Vo=require("@radix-ui/react-dialog"),Ct=require("@payloadcms/richtext-lexical/client");var Ot=Q(require("bson-objectid"));var To=require("@payloadcms/ui");var ko=Q(require("react")),we=Q(require("@radix-ui/react-tooltip"));var xt=we.Provider,wt=we.Root,yt=we.Trigger,ct=ko.forwardRef(({className:e,sideOffset:t=4,...o},r)=>(0,mo.jsx)(we.Portal,{children:(0,mo.jsx)(we.Content,{ref:r,sideOffset:t,className:T("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));ct.displayName=we.Content.displayName;var xa=e=>{let{data:{relationTo:t,value:o},nodeKey:r}=e,[n]=(0,ir.useLexicalComposerContext)(),[i,a]=(0,Qe.useState)(""),[l,g]=(0,Qe.useState)(""),[P,y]=(0,Qe.useState)(""),m=async s=>{console.log("fetchMedia",s)};(0,Qe.useEffect)(()=>{typeof o=="string"?o.length===24?m(o):(a(o||""),y(d(x())),g(S()||"")):typeof o=="object"&&(a(`${process.env.NEXT_PUBLIC_API_URL}${o.url}`||""),y(d(o.filesize)),g(o.mimeType?.split("/")[1]||""))},[]);let M=(0,Qe.useCallback)(()=>{n.update(()=>{(0,L.$getNodeByKey)(r)?.remove()})},[n,r]),S=()=>{let s=e.data.value;return typeof s=="string"?s.split(";base64")[0]?.split("image/")[1]:""},x=()=>{let s=e.data.value;if(typeof s=="string"){let u=s.split(",")[1]?.length||0;return 4*Math.ceil(u/3)*.5624896334383812/1e3}return 0};function d(s){if(s>=1e6){let h=s/1e6;return`${h>=10?Math.round(h).toString():h.toFixed(1)} MB`}return`${Math.floor(s/1e3)} KB`}return(0,mo.jsx)("div",{className:"my-2",contentEditable:!1,children:(0,mo.jsxs)("div",{className:"border border-slate-800 rounded-xl overflow-clip mo-60 flex flex-col gap-2 bg-[#222222]",children:[(0,mo.jsxs)("div",{className:"flex gap-2 border-b border-b-slate-100/10",children:[(0,mo.jsx)("div",{className:"flex-1",children:e.data.value?(0,mo.jsx)("img",{className:"object-cover m-0 mo-full min-mo-[115px] min-h-[105px]","data-lexical-upload-id":o,"data-lexical-upload-relation-to":t,src:i}):(0,mo.jsx)(To.File,{})}),(0,mo.jsx)(xt,{children:(0,mo.jsxs)(wt,{children:[(0,mo.jsxs)(yt,{className:"flex-1 flex justify-center items-center text-[#b5b5b5]",children:[(0,mo.jsx)("span",{className:"font-medium text-sm",children:"Media"}),(0,mo.jsx)("button",{onClick:s=>{s.preventDefault(),M()},className:"flex-1 flex justify-center items-center",children:(0,mo.jsx)(Ne.X,{width:24,height:24,strokeWidth:1})})]}),(0,mo.jsx)(ct,{children:(0,mo.jsx)("span",{children:"Remove image"})})]})})]}),(0,mo.jsxs)("div",{className:"flex items-center justify-center gap-4 py-3 flex-1 text-xs font-bold",children:[(0,mo.jsx)("span",{className:"",children:l?.toLocaleUpperCase()}),(0,mo.jsx)("span",{children:P})]})]})})},Lo=xa;function wa(e){if(e.hasAttribute("data-lexical-upload-relation-to")&&e.hasAttribute("data-lexical-upload-id")){let o=e.getAttribute("data-lexical-upload-id");if(o)return{node:ot({fields:{},relationTo:"media",value:o})}}return e.src.startsWith("file:///"),null}var mt=class extends Ct.UploadNode{static importDOM(){return{img:()=>({conversion:wa,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new Ot.default().toHexString(),t.version=3);let o={id:t.id??new Ot.default().toHexString(),fields:t.fields,relationTo:"media",value:t.value},r=ot(o);return r.setFormat?.(t.format),r}decorate(){return(0,mo.jsx)(Lo,{data:this.__data,nodeKey:this.getKey()})}};function ot(e){return new mt({data:e})}var ya=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ca=e=>ya?(e||window).getSelection():null,kn=(0,L.createCommand)("INSERT_UPLOAD_WITH_DRAWER_COMMAND"),Bt=(0,L.createCommand)("INSERT_UPLOAD_COMMAND");function zo({activeEditor:e,onClose:t,isOpen:o=!1}){let r=(0,Qe.useRef)(!1),[n,i]=(0,Qe.useState)(!0),[a,l]=(0,Qe.useState)(""),[g,P]=(0,Qe.useState)(""),[y,m]=(0,Qe.useState)(!1),[M,S]=(0,Qe.useState)("left"),x=a==="",d=N=>{m(N.target.checked)},s=N=>{S(N.target.value)},u=N=>{let z=new FileReader;z.onload=function(){return typeof z.result=="string"&&l(z.result),""},N!==null&&N[0]&&z.readAsDataURL(N[0])};(0,Qe.useEffect)(()=>{r.current=!1;let N=z=>{r.current=z.altKey};return document.addEventListener("keydown",N),()=>{document.removeEventListener("keydown",N)}},[e]),(0,Qe.useEffect)(()=>{n||t()},[n]),(0,Qe.useEffect)(()=>{i(o)},[o]);let h=({editor:N,relationTo:z,replaceNodeKey:j,value:U})=>{if(j)N.update(()=>{let I=(0,L.$getNodeByKey)(j);I&&I.replace(ot({id:"",fields:{},relationTo:"media",value:U}))});else{let I=N.dispatchCommand(Bt,{fields:null,relationTo:"media",value:U})}},k=()=>{h({editor:e,relationTo:"media",replaceNodeKey:null,value:{altText:g,src:a,showCaption:y,position:M}.src}),i(!1),t()};return(0,mo.jsx)(Pe,{open:n,onOpenChange:N=>i(N),children:(0,mo.jsxs)(Le,{children:[(0,mo.jsxs)(He,{children:[(0,mo.jsx)(Ke,{children:"Upload Image"}),(0,mo.jsx)(Vo.DialogDescription,{children:"Description"})]}),(0,mo.jsxs)("div",{className:"",children:[(0,mo.jsx)("div",{style:{marginBottom:"1em"},children:(0,mo.jsx)(Y,{type:"file",onChange:N=>u(N.target.files),accept:"image/*","data-test-id":"image-modal-file-upload"})}),(0,mo.jsx)("div",{style:{marginBottom:"1em"},children:(0,mo.jsx)(Y,{"aria-label":"Alt Text",placeholder:"Descriptive alternative text",onChange:N=>P(N.currentTarget.value),value:g,"data-test-id":"image-modal-alt-text-input"})}),(0,mo.jsx)(F,{"data-test-id":"image-modal-file-upload-btn",disabled:x,onClick:()=>k(),children:"Confirm"})]})]})})}function Vt({captionsEnabled:e}){let[t]=(0,ir.useLexicalComposerContext)();return(0,Qe.useEffect)(()=>{if(!t.hasNodes([Ct.UploadNode]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return(0,ft.mergeRegister)(t.registerCommand(L.DRAGSTART_COMMAND,o=>Na(o),L.COMMAND_PRIORITY_HIGH),t.registerCommand(L.DRAGOVER_COMMAND,o=>Sa(o),L.COMMAND_PRIORITY_LOW),t.registerCommand(L.DROP_COMMAND,o=>Da(o,t),L.COMMAND_PRIORITY_HIGH))},[e,t]),null}function Na(e){if(!zt())return!1;let o=e.dataTransfer;return o?(o.setData("text/plain","_"),!0):!1}function Sa(e){return zt()?(_o(e)||e.preventDefault(),!0):!1}function Da(e,t){let o=zt();if(!o)return!1;if(e.preventDefault(),_o(e)){let r=Ra(e);o.remove();let n=(0,L.$createRangeSelection)();r!=null&&n.applyDOMRange(r),(0,L.$setSelection)(n)}return!0}function zt(){let e=(0,L.$getSelection)();if(!(0,L.$isNodeSelection)(e))return null;let o=e.getNodes()[0];return(0,Ct.$isUploadNode)(o)?o:null}function _o(e){let t=e.target;return!!(t&&t instanceof HTMLElement&&!t.closest("code, span.editor-image")&&t.parentElement&&t.parentElement.closest("div.ContentEditable__root"))}function Ra(e){let t,o=e.target,r=o==null?null:o.nodeType===9?o.defaultView:o.ownerDocument.defaultView,n=Ca(r);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(e.clientX,e.clientY);else if(e.rangeParent&&n!==null)n.collapse(e.rangeParent,e.rangeOffset||0),t=n.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}var Pa=()=>(0,mo.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,mo.jsx)("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})}),Uo=Pa;var Ma=()=>(0,mo.jsx)("svg",{"aria-hidden":"true",className:"",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,mo.jsx)("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})}),Fo=Ma;var ka=()=>(0,mo.jsxs)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,mo.jsx)("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),(0,mo.jsx)("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),$o=ka;var Ta=()=>(0,mo.jsxs)("svg",{"aria-hidden":"true",className:"",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,mo.jsx)("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),(0,mo.jsx)("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),jo=Ta;var Ia=()=>(0,mo.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,mo.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})}),Go=Ia;var Aa=()=>(0,$t.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,$t.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})}),Wo=Aa;var Zo=()=>(0,mo.jsx)("svg",{"aria-hidden":"true",className:"mo-5 size-5",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,mo.jsx)("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})}),Jo=()=>(0,mo.jsx)("svg",{"aria-hidden":"true",className:"mo-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,mo.jsx)("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})}),Xo=()=>(0,mo.jsx)("svg",{"aria-hidden":"true",className:"mo-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,mo.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})}),qo=()=>(0,mo.jsx)("svg",{"aria-hidden":"true",className:"mo-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,mo.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})}),Qo=()=>(0,mo.jsx)("svg",{"aria-hidden":"true",className:"mo-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,mo.jsx)("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});var ke=Q(require("react")),B=Q(require("@radix-ui/react-dropdown-menu")),rt=require("@radix-ui/react-icons");var Ze=B.Root,Je=B.Trigger;var Yo=ke.forwardRef(({className:e,inset:t,children:o,...r},n)=>(0,mo.jsxs)(B.SubTrigger,{ref:n,className:T("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[o,(0,mo.jsx)(rt.ChevronRightIcon,{className:"ml-auto"})]}));Yo.displayName=B.SubTrigger.displayName;var er=ke.forwardRef(({className:e,...t},o)=>(0,mo.jsx)(B.SubContent,{ref:o,className:T("z-50 min-mo-[8rem] overflow-hidden rounded-md border bg-popover mo-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));er.displayName=B.SubContent.displayName;var _e=ke.forwardRef(({className:e,sideOffset:t=4,...o},r)=>(0,mo.jsx)(B.Portal,{children:(0,mo.jsx)(B.Content,{ref:r,sideOffset:t,className:T("z-50 min-mo-[8rem] overflow-hidden rounded-md border bg-popover mo-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));_e.displayName=B.Content.displayName;var Te=ke.forwardRef(({className:e,inset:t,...o},r)=>(0,mo.jsx)(B.Item,{ref:r,className:T("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...o}));Te.displayName=B.Item.displayName;var tr=ke.forwardRef(({className:e,children:t,checked:o,...r},n)=>(0,mo.jsxs)(B.CheckboxItem,{ref:n,className:T("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:o,...r,children:[(0,mo.jsx)("span",{className:"absolute left-2 flex h-3.5 mo-3.5 items-center justify-center",children:(0,mo.jsx)(B.ItemIndicator,{children:(0,mo.jsx)(rt.CheckIcon,{className:"h-4 mo-4"})})}),t]}));tr.displayName=B.CheckboxItem.displayName;var or=ke.forwardRef(({className:e,children:t,...o},r)=>(0,mo.jsxs)(B.RadioItem,{ref:r,className:T("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...o,children:[(0,mo.jsx)("span",{className:"absolute left-2 flex h-3.5 mo-3.5 items-center justify-center",children:(0,mo.jsx)(B.ItemIndicator,{children:(0,mo.jsx)(rt.DotFilledIcon,{className:"h-4 mo-4 fill-current"})})}),t]}));or.displayName=B.RadioItem.displayName;var rr=ke.forwardRef(({className:e,inset:t,...o},r)=>(0,mo.jsx)(B.Label,{ref:r,className:T("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...o}));rr.displayName=B.Label.displayName;var ar=ke.forwardRef(({className:e,...t},o)=>(0,mo.jsx)(B.Separator,{ref:o,className:T("-mx-1 my-1 h-px bg-muted",e),...t}));ar.displayName=B.Separator.displayName;var nr=({className:e,...t})=>(0,mo.jsx)("span",{className:T("ml-auto text-xs tracking-widest opacity-60",e),...t});nr.displayName="DropdownMenuShortcut";var jt=1;function Ea(){return(0,mo.jsx)("span",{className:"border border-[#222222]"})}function Wt(){let[e]=(0,ir.useLexicalComposerContext)(),t=(0,Qe.useRef)(null),[o,r]=(0,Qe.useState)(!1),[n,i]=(0,Qe.useState)(!1),[a,l]=(0,Qe.useState)(!1),[g,P]=(0,Qe.useState)(!1),[y,m]=(0,Qe.useState)(!1),[M,S]=(0,Qe.useState)(!1),[x,d]=(0,Qe.useState)(!1),[s,u]=(0,Qe.useState)(!1),[h,k]=(0,Qe.useState)(!1),[N,z]=(0,Qe.useState)("left"),[j,U]=(0,Qe.useState)("mo"),I=C=>{e.update(()=>{let _=(0,L.$getSelection)();(0,L.$isRangeSelection)(_)&&(C==="mo"?(0,Gt.$setBlocksType)(_,()=>(0,L.$createParagraphNode)()):(0,Gt.$setBlocksType)(_,()=>(0,gr.$createHeadingNode)(C)))})},G=(0,Qe.useCallback)(()=>{let C=(0,L.$getSelection)();if((0,L.$isRangeSelection)(C)){l(C.hasFormat("bold")),P(C.hasFormat("italic")),m(C.hasFormat("underline")),S(C.hasFormat("strikethrough")),d(C.hasFormat("subscript")),u(C.hasFormat("superscript"));let _=C.anchor.getNode(),f=_;for(;f&&!(0,L.$isParagraphNode)(f)&&f!==(0,L.$getRoot)();){let ce=f.getParent();ce&&(f=ce)}if(f){let ce=f.getFormatType();z(ce||"left")}let de=_.getTopLevelElement()?.__tag;U(de||"mo")}},[]);(0,Qe.useEffect)(()=>(0,ft.mergeRegister)(e.registerUpdateListener(({editorState:C})=>{C.read(()=>{G()})}),e.registerCommand(L.SELECTION_CHANGE_COMMAND,(C,_)=>(G(),!1),jt),e.registerCommand(L.CAN_UNDO_COMMAND,C=>(r(C),!1),jt),e.registerCommand(L.CAN_REDO_COMMAND,C=>(i(C),!1),jt),(0,ft.mergeRegister)(e.registerCommand(Bt,C=>(e.update(()=>{let _=(0,L.$getSelection)()||(0,L.$getPreviousSelection)();if((0,L.$isRangeSelection)(_)){let f=ot({id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}),{focus:de}=_,ce=de.getNode();(0,ft.$insertNodeToNearestRoot)(f),(0,L.$isParagraphNode)(ce)&&!ce.__first&&ce.remove()}}),!0),L.COMMAND_PRIORITY_EDITOR))),[e,G]);let J=[[{label:"Undo",icon:(0,mo.jsx)(Ne.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(L.UNDO_COMMAND,void 0)},disabled:!o},{label:"Redo",icon:(0,mo.jsx)(Ne.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(L.UNDO_COMMAND,void 0)},disabled:!n}],[{label:"Bold",icon:(0,mo.jsx)(Uo,{}),onClick:()=>{e.dispatchCommand(L.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:a},{label:"Italic",icon:(0,mo.jsx)(Fo,{}),onClick:()=>{e.dispatchCommand(L.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:g},{label:"Underline",icon:(0,mo.jsx)($o,{}),onClick:()=>{e.dispatchCommand(L.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:y},{label:"Strikethrough",icon:(0,mo.jsx)(jo,{}),onClick:()=>{e.dispatchCommand(L.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:M},{label:"Subscript",icon:(0,mo.jsx)(Go,{}),onClick:()=>{e.dispatchCommand(L.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:x},{label:"Superscript",icon:(0,mo.jsx)(Wo,{}),onClick:()=>{e.dispatchCommand(L.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:s}]],se=[{label:"Left Align",direction:"left",icon:(0,mo.jsx)(Ne.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(L.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,mo.jsx)(Ne.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(L.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,mo.jsx)(Ne.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(L.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,mo.jsx)(Ne.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(L.FORMAT_ELEMENT_COMMAND,"justify")}}],fe=[{label:"Normal Text",value:"mo",icon:(0,mo.jsx)(Zo,{}),onClick:()=>I("mo")},{label:"Heading 1",value:"h1",icon:(0,mo.jsx)(Jo,{}),onClick:()=>I("h1")},{label:"Heading 2",value:"h2",icon:(0,mo.jsx)(Xo,{}),onClick:()=>I("h2")},{label:"Heading 3",value:"h3",icon:(0,mo.jsx)(qo,{}),onClick:()=>I("h3")},{label:"Heading 4",value:"h4",icon:(0,mo.jsx)(Qo,{}),onClick:()=>I("h4")},...[{label:"Unordered List",value:"ul",icon:(0,mo.jsx)(Ne.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(St.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,mo.jsx)(Ne.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(St.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],Se=[{label:"Insert Image",icon:(0,mo.jsx)(Ne.ImageUp,{width:15,height:15}),onClick:()=>{k(!0)},disabled:!1}];return(0,mo.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2 sticky top-0 bg-black z-50",children:(0,mo.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[J.map((C,_)=>(0,mo.jsxs)(Qe.Fragment,{children:[(0,mo.jsx)("div",{className:"flex items-center gap-2",children:C.map((f,de)=>(0,mo.jsx)("div",{role:"button","aria-disabled":f.disabled||!1,onClick:f.onClick,className:T("mo-1 transition-all flex items-center justify-center rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",f.active&&"bg-[#3c3c3c]"),"aria-label":f.label,children:(0,mo.jsx)(xt,{children:(0,mo.jsxs)(wt,{children:[(0,mo.jsx)(yt,{className:"text-[#b5b5b5]",children:f.icon}),(0,mo.jsx)(ct,{children:(0,mo.jsx)("mo",{children:f.label})})]})})},de))}),(0,mo.jsx)(Ea,{})]},`toolbar-option-${C.length}-${_}`)),(0,mo.jsxs)(Ze,{children:[(0,mo.jsxs)(Je,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[se.find(C=>C.direction===N)?.icon,se.find(C=>C.direction===N)?.label,(0,mo.jsx)(Ne.ChevronDown,{width:15,height:15})]}),(0,mo.jsx)(_e,{className:"bg-black hover:bg-black",children:se.map((C,_)=>(0,mo.jsxs)(Te,{onClick:C.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,mo.jsx)("span",{children:C.icon}),(0,mo.jsx)("span",{children:C.label})]},`${C.label}-${_}`))})]}),(0,mo.jsxs)(Ze,{children:[(0,mo.jsxs)(Je,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[fe.find(C=>C.value===j)?.icon,fe.find(C=>C.value===j)?.label,(0,mo.jsx)(Ne.ChevronDown,{width:15,height:15})]}),(0,mo.jsx)(_e,{className:"bg-black hover:bg-black",children:fe.map((C,_)=>(0,mo.jsxs)(Te,{onClick:C.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,mo.jsx)("span",{children:C.icon}),(0,mo.jsx)("span",{children:C.label})]},`heading-option-${C.label}-${_}`))})]}),(0,mo.jsxs)(Ze,{children:[(0,mo.jsxs)(Je,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[(0,mo.jsx)(Ne.Plus,{width:15,height:15}),(0,mo.jsx)(Ne.ChevronDown,{width:15,height:15})]}),(0,mo.jsx)(_e,{className:"bg-black hover:bg-black",children:Se.map((C,_)=>(0,mo.jsxs)(Te,{onClick:C.onClick,disabled:C.disabled,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,mo.jsx)("span",{children:C.icon}),(0,mo.jsx)("span",{children:C.label})]},_))})]}),h&&(0,mo.jsx)(zo,{activeEditor:e,onClose:()=>{k(!1)},isOpen:h})]})})}var La=({setValue:e,value:t,name:o,editable:r=!0})=>{let[n]=(0,ir.useLexicalComposerContext)(),i=a=>{a.read(()=>{let l=a.toJSON();e?.(()=>l)})};return(0,Qe.useEffect)(()=>{n.setEditable(r)},[r]),(0,Qe.useEffect)(()=>{t&&n.update(()=>{n.setEditorState(n.parseEditorState(t))})},[]),(0,mo.jsx)("div",{className:"mo-full",children:(0,mo.jsxs)("div",{className:" ",children:[r&&(0,mo.jsx)(Wt,{}),(0,mo.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,mo.jsx)(pr.RichTextPlugin,{contentEditable:(0,mo.jsx)(cr.ContentEditable,{name:o,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-h-40"}),ErrorBoundary:mr.LexicalErrorBoundary}),r&&(0,mo.jsxs)(mo.Fragment,{children:[(0,mo.jsx)(ur.HistoryPlugin,{}),(0,mo.jsx)(lr.AutoFocusPlugin,{}),(0,mo.jsx)(fr.ListPlugin,{}),(0,mo.jsx)(hr.OnChangePlugin,{onChange:i}),(0,mo.jsx)(Vt,{})]})]})]})})},Ha=({setValue:e,value:t,name:o,editable:r=!0})=>(0,mo.jsx)(dr.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[St.ListNode,St.ListItemNode,gr.HeadingNode,mt],onError(i){throw console.error("Lexical error:",i),i},theme:{code:"editor-code",heading:{h1:"text-4xl text-primary",h2:"text-3xl",h3:"text-2xl",h4:"text-lg",h5:"text-sm"},image:"editor-image",link:"editor-link",list:{listitem:"editor-listitem",nested:{listitem:"editor-nested-listitem"},ol:"list-decimal",ul:"list-disc"},ltr:"ltr",paragraph:"editor-paragraph",placeholder:"editor-placeholder",quote:"editor-quote",rtl:"rtl",text:{bold:"editor-text-bold font-bold",code:"editor-text-code",hashtag:"editor-text-hashtag",italic:"editor-text-italic italic",overflowed:"editor-text-overflowed",strikethrough:"editor-text-strikethrough line-through",underline:"editor-text-underline underline",underlineStrikethrough:"underline line-through"}}},children:(0,mo.jsx)(La,{value:t,setValue:e,name:o,editable:r})}),Dt=Ha;function vr({document:e,onSave:t,mode:o="edit",onCancel:r,availableDocuments:n=[],knowledgeContexts:i=[]}){let[a,l]=(0,Qe.useState)({...e,updatedAt:new Date}),[g,P]=(0,Qe.useState)(!1),[y,m]=(0,Qe.useState)(a.richTextContent),[M,S]=(0,Qe.useState)(!1),x=(0,Qe.useRef)(null),d=(0,Qe.useRef)(""),s=(0,Qe.useRef)(null),u=(0,Qe.useRef)(null),h=b=>{let R=new WeakSet,K=X=>X&&typeof X=="object"?R.has(X)?null:(R.add(X),Array.isArray(X)?X.map(K):Object.keys(X).sort().reduce((oe,Fe)=>(oe[Fe]=K(X[Fe]),oe),{})):X;return JSON.stringify(K(b))},k=b=>b?b.replace(/\s+/g," ").trim():"",N=b=>{if(!b)return{};let R={};return Object.keys(b).sort().forEach(K=>{R[K]=String(b[K]??"").trim()}),R},z=()=>a.format==="richText"?h(y):k(a.content),j=()=>{let b={title:k(a.title),description:k(a.description),format:a.format,metadata:N(a.metadata),content:z()},R=h(b),K=5381;for(let X=0;X<R.length;X++)K=K*33^R.charCodeAt(X);return(K>>>0).toString(16)},U=(b,R)=>{if(b===R)return!1;if(a.format!=="richText"){let K=G(b),X=z();if(K==null)return!0;let oe=K.length,Fe=X.length,nt=Math.abs(Fe-oe),ht=oe===0?1:nt/oe;return k(K)===k(X)&&nt<3?!1:nt>=10||ht>=.02}return!0},I=(0,Qe.useRef)(new Map),G=b=>{let R=I.current.get(b);return R==null?null:"x".repeat(R)};(0,Qe.useEffect)(()=>(u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{let b=j(),R=d.current;if(U(R,b)&&(S(!0),t({...a,richTextContent:y},"autosave"),d.current=b,a.format!=="richText")){let K=z();I.current.set(b,K.length)}},800),()=>{u.current&&clearTimeout(u.current)}),[a.title,a.description,a.format,a.content,a.metadata,y]),(0,Qe.useEffect)(()=>{let b=()=>{let R=j();R!==d.current&&(t({...a,richTextContent:y},"autosave"),d.current=R)};return window.addEventListener("pagehide",b),window.addEventListener("beforeunload",b),()=>{window.removeEventListener("pagehide",b),window.removeEventListener("beforeunload",b)}},[a,y]),(0,Qe.useEffect)(()=>(M&&(s.current=setTimeout(()=>{S(!1)},2e3)),()=>{s.current&&clearTimeout(s.current)}),[M]),(0,Qe.useEffect)(()=>{l(e)},[e]);let J=b=>{switch(b){case"markdown":case"mdx":return(0,mo.jsx)(Ne.FileText,{className:"h-6 mo-6 text-primary"});case"richText":return(0,mo.jsx)(Ne.File,{className:"h-6 mo-6 text-success"});case"text":return(0,mo.jsx)(Ne.Type,{className:"h-6 mo-6 text-muted-foreground"});default:return(0,mo.jsx)(Ne.File,{className:"h-6 mo-6 text-muted-foreground"})}},se=b=>{switch(b){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},H=()=>{let b=new Set,R=new Set;return i.forEach(K=>{K.menuConfig.groupBy.forEach(X=>b.add(X))}),n.forEach(K=>{K.metadata&&Object.keys(K.metadata).forEach(X=>R.add(X))}),{contextKeys:Array.from(b).sort(),documentKeys:Array.from(R).sort(),allKeys:Array.from(new Set([...b,...R])).sort()}},fe=b=>{let R=new Set;return n.forEach(K=>{K.metadata?.[b]&&R.add(String(K.metadata[b]))}),Array.from(R).sort()},Se=H(),C=()=>{t({...a,richTextContent:y},"autosave")},_=(b,R)=>{l(K=>({...K,metadata:{...K.metadata,[b]:R}}))},f=(b,R)=>{R==="__custom__"?_(b,""):_(b,R)},de=()=>{_("","")},ce=b=>{l(R=>{let K={...R.metadata};return delete K[b],{...R,metadata:K}})};return(0,mo.jsxs)(Xe.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,mo.jsxs)("div",{className:"border-b border-border bg-card mo-8 pb-6",children:[(0,mo.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,mo.jsx)("div",{className:"flex items-start gap-4 flex-1 min-mo-0",children:(0,mo.jsxs)("div",{className:"flex-1 min-mo-0",children:[(0,mo.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,mo.jsx)("div",{className:"flex-1 min-mo-0",children:(0,mo.jsx)(Ht,{fieldName:"title",value:a.title,label:"",onSave:(b,R)=>l(K=>({...K,title:R})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:mo-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),(0,mo.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${se(a.format)} flex-shrink-0 mt-1`,children:a.format.toUpperCase()})]}),(0,mo.jsx)("div",{className:"mt-2",children:(0,mo.jsx)(Ht,{fieldName:"description",value:a.description||"Click to add description...",label:"",multiline:!0,onSave:(b,R)=>l(K=>({...K,description:R})),className:"[&>div:last-child]:text-muted-foreground [&>div:last-child]:text-lg [&>div:last-child]:leading-relaxed [&>div:last-child]:mo-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})})]})}),(0,mo.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,mo.jsxs)(F,{variant:"ghost",size:"sm",onClick:()=>P(!g),className:"gap-2",children:[(0,mo.jsx)(Ne.Info,{className:"h-4 mo-4"}),"Metadata",a.metadata&&Object.keys(a.metadata).length>0&&(0,mo.jsx)("span",{className:"inline-flex items-center justify-center mo-5 h-5 text-xs font-medium bg-primary/10 text-primary rounded-full",children:Object.keys(a.metadata).length}),g?(0,mo.jsx)(Ne.ChevronDown,{className:"h-4 mo-4"}):(0,mo.jsx)(Ne.ChevronRight,{className:"h-4 mo-4"})]}),(0,mo.jsxs)(F,{variant:"outline",size:"sm",onClick:r,className:"gap-2",children:[(0,mo.jsx)(Ne.X,{className:"h-4 mo-4"}),"Close"]}),(0,mo.jsxs)(F,{size:"sm",onClick:C,className:"gap-2",disabled:M,children:[M?(0,mo.jsx)(Ne.Loader2,{className:"h-4 mo-4 animate-spin"}):(0,mo.jsx)(Ne.Save,{className:"h-4 mo-4"}),M?"Auto-saving...":"Save"]})]})]}),(0,mo.jsx)(Xe.motion.div,{initial:!1,animate:{height:g?"auto":0,opacity:g?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden h-full max-h-full",children:(0,mo.jsxs)("div",{className:"mo-4 border-t border-border mt-4 h-screen max-h-full flex",children:[(0,mo.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,mo.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,mo.jsx)(Ne.Info,{className:"h-4 mo-4"}),"Document Metadata"]}),(0,mo.jsxs)(F,{type:"button",variant:"outline",size:"sm",onClick:de,className:"gap-1 h-8",children:[(0,mo.jsx)(Ne.Plus,{className:"h-3 mo-3"}),"Add Field"]})]}),(0,mo.jsx)("div",{className:"bg-muted rounded-lg mo-4 border border-border",children:a.metadata&&Object.keys(a.metadata).length>0?(0,mo.jsx)("div",{className:"space-y-2",children:Object.entries(a.metadata).map(([b,R],K)=>{let X=fe(b);return(0,mo.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,mo.jsx)(Y,{value:b,onChange:oe=>{let Fe=oe.target.value||"",nt=a.metadata?.[b];l(ht=>{let Mt={...ht.metadata};return delete Mt[b],Fe&&(Mt[Fe]=nt||""),{...ht,metadata:Mt}})},placeholder:"Key",className:"mo-32 h-8 text-sm",list:`metadata-keys-${b}`}),(0,mo.jsx)("datalist",{id:`metadata-keys-${b}`,children:Se.allKeys.map(oe=>(0,mo.jsx)("option",{value:oe},oe))}),(0,mo.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),X.length>0?(0,mo.jsxs)(Ge,{value:String(R||""),onValueChange:oe=>f(b,oe),children:[(0,mo.jsx)(Be,{className:"flex-1 h-8 text-sm",children:(0,mo.jsx)(We,{placeholder:"Value"})}),(0,mo.jsxs)(Ve,{children:[X.map(oe=>(0,mo.jsx)(xe,{value:oe,children:oe},oe)),(0,mo.jsx)(xe,{value:"__custom__",children:(0,mo.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,mo.jsx)(Y,{value:String(R||""),onChange:oe=>_(b,oe.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,mo.jsx)(F,{type:"button",variant:"ghost",size:"sm",onClick:()=>ce(b),className:"h-8 mo-8 mo-0 text-muted-foreground hover:text-destructive",children:(0,mo.jsx)(Ne.X,{className:"h-3 mo-3"})})]},`metadata-key-${K}`)})}):(0,mo.jsxs)("div",{className:"text-center py-4",children:[(0,mo.jsx)("mo",{className:"text-sm text-muted-foreground mb-2",children:"No metadata fields"}),(0,mo.jsx)("mo",{className:"text-xs text-muted-foreground",children:'Click "Add Field" to create metadata'})]})})]})})]}),(0,mo.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,mo.jsx)("div",{className:"mo-8 mo-0 h-full max-h-full overflow-auto",children:a.format==="richText"?(0,mo.jsx)(Dt,{setValue:m,value:y,name:"richTextContent"}):(0,mo.jsx)($e,{value:a.content||"",onChange:b=>l(R=>({...R,content:b.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})]})}var yr=Q(require("react-markdown")),Cr=Q(require("remark-gfm"));var Nr=e=>(0,mo.jsx)(yr.default,{remarkPlugins:[Cr.default],components:{h1:({children:t})=>(0,mo.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,mo.jsx)("h2",{className:"text-xl font-bold",children:t}),h3:({children:t})=>(0,mo.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,mo.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,mo.jsx)("ol",{className:"list-decimal",children:t}),ul:({children:t})=>(0,mo.jsx)("ul",{className:"list-disc",children:t}),li:({children:t})=>(0,mo.jsx)("li",{className:"ml-4",children:t}),mo:({children:t})=>(0,mo.jsx)("mo",{className:"mb-4",children:t}),a:({children:t,href:o})=>(0,mo.jsx)("a",{href:o,className:"text-blue-500",children:t}),img:({src:t,alt:o})=>(0,mo.jsx)("img",{src:t,alt:o,className:"mb-4"}),blockquote:({children:t})=>(0,mo.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),xr=e=>(0,mo.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),Ka=e=>(0,mo.jsx)("div",{className:"prose prose-slate dark:prose-invert max-mo-none",children:e&&(0,mo.jsx)(Dt,{value:JSON.stringify(e),editable:!1,name:"richTextContent"},JSON.stringify(e))}),Oa=e=>(0,mo.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-mo-none",children:[(0,mo.jsx)("div",{className:"bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg mo-4 mb-4",children:(0,mo.jsxs)("mo",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,mo.jsx)("strong",{children:"MDX Renderer:"})," This is a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),Nr(e)]});function Sr({document:e,onDocumentUpdate:t,editable:o=!0,mode:r="view",renderers:n,availableDocuments:i=[],knowledgeContexts:a=[]}){let[l,g]=(0,Qe.useState)(!1),[P,y]=(0,Qe.useState)(!1),[m,M]=(0,Qe.useState)(e),[S,x]=(0,Qe.useState)(!1),d=(0,Qe.useRef)(null),s=m.format==="richText"?m.richTextContent:m.content,u=(0,Qe.useMemo)(()=>`${m.format}:${JSON.stringify(s)}`,[m.format,s]);(0,Qe.useEffect)(()=>{M(e)},[e]);let h=I=>{switch(I){case"markdown":case"mdx":return(0,mo.jsx)(Ne.FileText,{className:"h-6 mo-6 text-primary"});case"richText":return(0,mo.jsx)(Ne.File,{className:"h-6 mo-6 text-success"});case"text":return(0,mo.jsx)(Ne.Type,{className:"h-6 mo-6 text-muted-foreground"});default:return(0,mo.jsx)(Ne.File,{className:"h-6 mo-6 text-muted-foreground"})}},k=I=>{switch(I){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},N=(I,G)=>{let J={markdown:Nr,mdx:Oa,text:xr},se=n?.[G]||J[G];if(G==="richText"&&typeof I=="object")return Ka(I);if(se&&typeof I=="string")return se(I);if(typeof I=="string")return xr(I)},z=async(I,G="save")=>{G==="save"&&x(!0),d.current=m,(0,Qe.startTransition)(()=>{M({...I,richTextContent:I.richTextContent?structuredClone(I.richTextContent):void 0})});try{let J=await t?.(I);if(G==="save"&&x(!1),!J)throw new Error("save failed")}catch{d.current&&(0,Qe.startTransition)(()=>M(d.current))}},j=()=>{g(!1)};return(0,mo.jsxs)(mo.Fragment,{children:[(0,mo.jsx)(Pe,{open:l||r==="create",onOpenChange:I=>!I&&j(),children:(0,mo.jsxs)(vt,{children:[(0,mo.jsx)(dt,{}),(0,mo.jsxs)(wr.Content,{className:T("fixed inset-0 z-50 bg-background mo-0 m-0 border-0","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"),children:[S&&(0,mo.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center",children:(0,mo.jsx)(Ne.Loader2,{className:"h-8 mo-8 animate-spin text-primary"})}),(0,mo.jsx)(vr,{mode:r==="create"?"create":"edit",document:m,onSave:z,onCancel:j,availableDocuments:i,knowledgeContexts:a})]})]})}),(0,mo.jsxs)(Xe.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,mo.jsxs)("div",{className:"border-b border-border bg-card mo-8 pb-6",children:[(0,mo.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,mo.jsx)("div",{className:"flex items-start gap-4 flex-1 min-mo-0",children:(0,mo.jsxs)("div",{className:"flex-1 min-mo-0",children:[(0,mo.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[m.title,(0,mo.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${k(m.format)}`,children:m.format.toUpperCase()})]}),m.description&&(0,mo.jsx)("mo",{className:"text-muted-foreground text-lg leading-relaxed",children:m.description})]})}),(0,mo.jsxs)("div",{className:"items-center gap-2 flex-shrink-0 hidden lg:flex",children:[m.metadata&&Object.keys(m.metadata).length>0&&(0,mo.jsxs)(F,{variant:"ghost",size:"sm",onClick:()=>y(!P),className:"gap-2",children:[(0,mo.jsx)(Ne.Info,{className:"h-4 mo-4"}),"Metadata",P?(0,mo.jsx)(Ne.ChevronDown,{className:"h-4 mo-4"}):(0,mo.jsx)(Ne.ChevronRight,{className:"h-4 mo-4"})]}),o&&(0,mo.jsxs)(F,{variant:"outline",size:"sm",onClick:()=>g(!0),className:"gap-2",children:[(0,mo.jsx)(Ne.Edit3,{className:"h-4 mo-4"}),"Edit"]})]})]}),m.metadata&&Object.keys(m.metadata).length>0&&(0,mo.jsx)(Xe.motion.div,{initial:!1,animate:{height:P?"auto":0,opacity:P?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,mo.jsxs)("div",{className:"mo-4 border-t border-border mt-4",children:[(0,mo.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,mo.jsx)(Ne.Info,{className:"h-4 mo-4"}),"Document Metadata"]}),(0,mo.jsx)("div",{className:"bg-muted rounded-lg mo-4 border border-border",children:(0,mo.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-2 text-sm",children:Object.entries(m.metadata).map(([I,G])=>(0,mo.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,mo.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:I.replace(/([mo-Ne])/g," $1").trim()}),(0,mo.jsx)("span",{className:"text-foreground font-medium",children:String(G)})]},I))})})]})})]}),(0,mo.jsx)("div",{className:"flex-1 ",children:(0,mo.jsx)("div",{className:"py-4 h-full",children:(0,mo.jsx)("div",{className:"space-y-4",children:m.content||m.richTextContent?(0,mo.jsx)("div",{className:"relative",children:(0,mo.jsx)("div",{className:"bg-background px-8 overflow-hidden h-full flex-1",children:N(m.format==="richText"?m.richTextContent:m.content,m.format)})},u):(0,mo.jsxs)("div",{className:"text-center mo-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,mo.jsx)("div",{className:"mo-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,mo.jsx)(Ne.FileText,{className:"h-8 mo-8 text-muted-foreground"})}),(0,mo.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"No content available"}),(0,mo.jsx)("mo",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})]})}function qt({label:e,documents:t,children:o,level:r,onDocumentClick:n,selectedDocumentId:i,showDocumentCount:a=!0}){let[l,g]=(0,Qe.useState)(r===0),P=o&&Object.keys(o).length>0,y=t.length+(o?Object.values(o).reduce((S,x)=>S+x.documents.length,0):0),m=S=>{switch(S){case"markdown":case"mdx":return(0,mo.jsx)(Ne.FileText,{className:"h-3.5 mo-3.5 text-muted-foreground"});case"richText":return(0,mo.jsx)(Ne.File,{className:"h-3.5 mo-3.5 text-muted-foreground"});default:return(0,mo.jsx)(Ne.File,{className:"h-3.5 mo-3.5 text-muted-foreground"})}},M=S=>{let x=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return x[S%x.length]};return(0,mo.jsxs)("div",{className:"space-y-1",children:[(P||t.length>0)&&(0,mo.jsxs)(Xe.motion.div,{className:`group flex items-center gap-3 mo-3 rounded-xl cursor-pointer transition-all duration-200 ${l?"bg-card shadow-sm border border-border":"hover:bg-muted/50 hover:shadow-sm"}`,style:{marginLeft:`${r*20}px`},onClick:()=>g(!l),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,mo.jsx)("div",{className:`mo-1 h-6 rounded-full ${M(r)}`}),(0,mo.jsx)(Xe.motion.div,{animate:{rotate:l?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,mo.jsx)(Ne.ChevronRight,{className:"h-4 mo-4 text-muted-foreground"})}),(0,mo.jsxs)("div",{className:"flex-1 flex items-center justify-between min-mo-0",children:[(0,mo.jsx)("div",{className:"flex items-center gap-2 min-mo-0",children:(0,mo.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),a&&y>0&&(0,mo.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,mo.jsx)("span",{className:"inline-flex items-center justify-center mo-6 h-6 text-xs font-medium bg-muted text-muted-foreground rounded-full",children:y})})]})]}),(0,mo.jsx)(Xe.motion.div,{initial:!1,animate:{height:l?"auto":0,opacity:l?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,mo.jsxs)("div",{className:"mo-2 space-y-1",children:[t.map((S,x)=>(0,mo.jsxs)(Xe.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.05,duration:.2},className:`group flex items-center gap-3 mo-2.5 mx-2 rounded-lg cursor-pointer transition-all duration-150 ${i===S.id?"bg-primary/10 border-l-2 border-primary shadow-sm":"hover:bg-muted/50 hover:translate-x-1"}`,style:{marginLeft:`${r*20+20}px`},onClick:()=>n?.(S),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,mo.jsx)("div",{className:"flex-shrink-0",children:m(S.format)}),(0,mo.jsxs)("div",{className:"flex-1 min-mo-0",children:[(0,mo.jsx)("mo",{className:`text-sm truncate transition-colors ${i===S.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:S.title}),S.description&&(0,mo.jsx)("mo",{className:"text-xs text-muted-foreground truncate mt-0.5",children:S.description})]}),S.tags&&S.tags.length>0&&(0,mo.jsx)("div",{className:"flex-shrink-0",children:(0,mo.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-muted text-muted-foreground group-hover:bg-muted/80 transition-colors",children:S.tags[0]})})]},S.id)),o&&Object.entries(o).map(([S,x])=>(0,mo.jsx)(qt,{label:S,documents:x.documents,children:x.children,level:r+1,onDocumentClick:n,selectedDocumentId:i,showDocumentCount:a},S))]})})]})}function Dr({documents:e,menuConfig:t,onDocumentClick:o,onDocumentShare:r,onDocumentUpdate:n,selectedDocumentId:i,className:a,editable:l=!0}){let[g,P]=(0,Qe.useState)(""),[y,m]=(0,Qe.useState)(null),[M,S]=(0,Qe.useState)(e);(0,Qe.useEffect)(()=>{S(e)},[e]),(0,Qe.useEffect)(()=>{if(y?.id){let u=M.find(h=>h.id===y.id);u&&m(u)}},[M]);let x=(0,Qe.useMemo)(()=>g?M.filter(u=>u.title.toLowerCase().includes(g.toLowerCase())||u.description?.toLowerCase().includes(g.toLowerCase())||u.tags?.some(h=>h.toLowerCase().includes(g.toLowerCase()))||Object.values(u.metadata||{}).some(h=>String(h).toLowerCase().includes(g.toLowerCase()))):M,[M,g]),d=(0,Qe.useMemo)(()=>{let u=(h,k)=>{if(k.length===0)return{};let[N,...z]=k;return h.reduce((U,I)=>{let G=I.metadata?.[N]||"Uncategorized",J=String(G);if(U[J]||(U[J]={documents:[],children:{}}),z.length===0)U[J].documents.push(I);else{let se=u([I],z),H=Object.keys(se)[0];H&&(U[J].children||(U[J].children={}),U[J].children[H]?U[J].children[H].documents.push(...se[H].documents):U[J].children[H]=se[H])}return U},{})};return u(x,t.groupBy)},[x,t.groupBy]),s=u=>{m(u),o?.(u)};return(0,mo.jsxs)("div",{className:`flex h-full ${a||""}`,children:[(0,mo.jsxs)("div",{className:"mo-1/3 border-r border-border bg-muted/20",children:[(0,mo.jsx)("div",{className:"mo-6 border-b border-border",children:(0,mo.jsxs)("div",{className:"relative",children:[(0,mo.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,mo.jsx)(Ne.Search,{className:"h-4 mo-4 text-muted-foreground"})}),(0,mo.jsx)(Y,{placeholder:"Search knowledge base...",value:g,onChange:u=>P(u.target.value),className:"pl-10 bg-background/80 border-border focus:border-primary/50 focus:ring-primary/20 rounded-xl h-11 text-sm placeholder:text-muted-foreground"})]})}),(0,mo.jsx)(tt,{className:"h-[calc(100%-100px)]",children:(0,mo.jsx)("div",{className:"mo-4 space-y-3",children:t.groupBy.length===0?(0,mo.jsx)(mo.Fragment,{children:(0,mo.jsx)(qt,{label:"Document",documents:x,level:0,onDocumentClick:s,selectedDocumentId:i,showDocumentCount:t.showDocumentCount},"Document")}):(0,mo.jsxs)(mo.Fragment,{children:[Object.entries(d).map(([u,h])=>(0,mo.jsx)(qt,{label:u,documents:h.documents,children:h.children,level:0,onDocumentClick:s,selectedDocumentId:i,showDocumentCount:t.showDocumentCount},u)),Object.keys(d).length===0&&(0,mo.jsxs)(Xe.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,mo.jsx)("div",{className:"mo-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,mo.jsx)(Ne.FileText,{className:"h-8 mo-8 text-muted-foreground"})}),(0,mo.jsx)("mo",{className:"text-sm font-medium",children:"No documents found"}),(0,mo.jsx)("mo",{className:"text-xs mt-1",children:"Try adjusting your search terms"})]})]})})})]}),(0,mo.jsx)("div",{className:"flex-1 bg-background overflow-scroll",children:y?(0,mo.jsx)(Sr,{document:y,onDocumentUpdate:n,editable:l}):(0,mo.jsx)("div",{className:"h-full flex items-center justify-center text-center",children:(0,mo.jsxs)(Xe.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-mo-sm",children:[(0,mo.jsx)("div",{className:"mo-20 h-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,mo.jsx)(Ne.FileText,{className:"h-10 mo-10 text-primary"})}),(0,mo.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Select a document"}),(0,mo.jsx)("mo",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}var gt=Q(require("@radix-ui/react-checkbox")),Pr=Q(require("react")),Qt=Pr.forwardRef(({className:e,...t},o)=>(0,mo.jsx)(gt.Root,{className:T("peer h-4 mo-4 shrink-0 rounded border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),ref:o,...t,children:(0,mo.jsx)(gt.Indicator,{className:T("flex items-center justify-center text-current"),children:(0,mo.jsx)(Ne.Check,{className:"h-4 mo-4"})})}));Qt.displayName=gt.Root.displayName;var kr=({isOpen:e,onClose:t,onAddKnowledge:o,knowledgeContexts:r})=>{let n=()=>{let d=new Set;return r.forEach(s=>{s.menuConfig.groupBy.forEach(u=>d.add(u))}),{contextKeys:Array.from(d).sort(),allKeys:Array.from(d).sort()}},[i,a]=(0,Qe.useState)(()=>{let d=n();return{name:"",description:"",metadata:d.contextKeys.length>0?d.contextKeys.map(s=>({key:s,value:""})):[{key:"",value:""}]}}),l=d=>{if(d.preventDefault(),!i.name)return;let s=i.metadata.filter(h=>h.key&&h.key.trim()&&h.value&&h.value.trim());o({name:i.name,description:i.description,metadata:s,source:"payload",visibility:"public",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()});let u=n();a({name:"",description:"",metadata:u.contextKeys.length>0?u.contextKeys.map(h=>({key:h,value:""})):[{key:"",value:""}]}),t()},g=()=>{let d=n();a({name:"",description:"",metadata:d.contextKeys.length>0?d.contextKeys.map(s=>({key:s,value:""})):[{key:"",value:""}]}),t()},P=n(),y=d=>{let s=new Set;return Array.from(s).sort()},m=(d,s)=>{a(u=>{let h=u.metadata.find(k=>k.key===d);return h&&(h.value=s),{...u,metadata:[...u.metadata.filter(k=>k.key!==d),{key:d,value:s}]}})},M=(d,s)=>{s==="__custom__"?m(d,""):m(d,s)},S=()=>{m(" ","")},x=d=>{a(s=>{let u=[...s.metadata],h=u.findIndex(k=>k.key===d);return h!==-1&&u.splice(h,1),{...s,metadata:u}})};return(0,mo.jsx)(Pe,{open:e,onOpenChange:g,children:(0,mo.jsxs)(Le,{className:"sm:max-mo-md",children:[(0,mo.jsx)(He,{children:(0,mo.jsx)(Ke,{children:"Add New Knowledge source"})}),(0,mo.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,mo.jsxs)("div",{className:"space-y-2",children:[(0,mo.jsxs)("div",{children:[(0,mo.jsx)(ue,{htmlFor:"name",children:"Name *"}),(0,mo.jsx)(Y,{id:"name",value:i.name,onChange:d=>a(s=>({...s,name:d.target.value})),required:!0})]}),(0,mo.jsxs)("div",{children:[(0,mo.jsx)(ue,{htmlFor:"name",children:"Description"}),(0,mo.jsx)(Y,{id:"name",value:i.description,onChange:d=>a(s=>({...s,description:d.target.value})),required:!0})]}),(0,mo.jsxs)("div",{className:"space-y-2",children:[(0,mo.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,mo.jsxs)("div",{children:[(0,mo.jsx)(ue,{htmlFor:"metadata",children:"Metadata"}),P.contextKeys.length>0?(0,mo.jsxs)("mo",{className:"text-xs text-muted-foreground",children:["Context keys: ",P.contextKeys.slice(0,4).join(", "),P.contextKeys.length>4&&` +${P.contextKeys.length-4} more`," ","\u2022 Fill in values or add more fields"]}):(0,mo.jsx)("mo",{className:"text-xs text-muted-foreground",children:"Add key-value metadata to organize and categorize your knowledge"})]}),(0,mo.jsxs)(F,{type:"button",variant:"outline",size:"sm",onClick:S,className:"gap-1 h-8",children:[(0,mo.jsx)(Ne.Plus,{className:"h-3 mo-3"}),"Add"]})]}),(0,mo.jsx)("div",{className:"space-y-2",children:i.metadata.map(({key:d,value:s},u)=>{let h=y(d);return(0,mo.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,mo.jsx)(Y,{value:d,onChange:k=>{let N=k.target.value||" ",z=i.metadata.find(j=>j.key===d)?.value;a(j=>{let U=[...j.metadata],I=U.findIndex(G=>G.key===d);return I!==-1&&U.splice(I,1),N&&U.push({key:N,value:z||""}),{...j,metadata:U}}),k.target.focus()},placeholder:P.allKeys.length>0?`e.g., ${P.allKeys[0]}`:"Key",className:"mo-32 h-8 text-sm",list:`metadata-keys-${d}`}),(0,mo.jsx)("datalist",{id:`metadata-keys-${d}`,children:P.allKeys.map(k=>(0,mo.jsx)("option",{value:k},k))}),(0,mo.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),h.length>0?(0,mo.jsxs)(Ge,{value:String(s||""),onValueChange:k=>M(d,k),children:[(0,mo.jsx)(Be,{className:"flex-1 h-8 text-sm",children:(0,mo.jsx)(We,{placeholder:"Value"})}),(0,mo.jsxs)(Ve,{children:[h.map(k=>(0,mo.jsx)(xe,{value:k,children:k},k)),(0,mo.jsx)(xe,{value:"__custom__",children:(0,mo.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,mo.jsx)(Y,{value:String(s||""),onChange:k=>m(d,k.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,mo.jsx)(F,{type:"button",variant:"ghost",size:"sm",onClick:()=>x(d),className:"h-8 mo-8 mo-0 text-muted-foreground hover:text-destructive",children:(0,mo.jsx)(Ne.X,{className:"h-3 mo-3"})})]},`metadata-key-${u}`)})})]})]}),(0,mo.jsxs)("div",{className:"flex justify-end gap-3 mo-4",children:[(0,mo.jsxs)(F,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,mo.jsx)(Ne.X,{className:"h-4 mo-4"}),"Cancel"]}),(0,mo.jsxs)(F,{type:"submit",children:[(0,mo.jsx)(Ne.Save,{className:"h-4 mo-4"}),"Create"]})]})]})]})})};var at=require("sonner");var Tr=({isOpen:e,onClose:t,knowledgeSources:o,onCreate:r,onUpdate:n,onDelete:i})=>{let[a,l]=(0,Qe.useState)(""),[g,P]=(0,Qe.useState)(null),[y,m]=(0,Qe.useState)(""),[M,S]=(0,Qe.useState)(""),[x,d]=(0,Qe.useState)([]),[s,u]=(0,Qe.useState)(""),[h,k]=(0,Qe.useState)("name"),[N,z]=(0,Qe.useState)("asc"),[j,U]=(0,Qe.useState)(!0),I=o.filter(f=>f.label.toLowerCase().includes(a.toLowerCase())||f.description?.toLowerCase().includes(a.toLowerCase())),G=f=>{P(f),m(f.label),S(f.description||""),d(f.menuConfig?.groupBy||[]),k(f.menuConfig?.sortBy||"name"),z(f.menuConfig?.sortOrder||"asc"),U(f.menuConfig?.showDocumentCount||!0)},J=()=>{s.trim()&&!x.includes(s.trim())&&(d([...x,s.trim()]),u(""))},se=f=>{d(x.filter(de=>de!==f))},H=f=>{f.key==="Enter"&&(f.preventDefault(),J())},fe=()=>{P(null),m(""),S(""),d([]),u(""),k("name"),z("asc"),U(!0)},Se=()=>{if(!y.trim()){at.toast.error("Label is required");return}r?.({id:y.trim(),label:y.trim(),description:M.trim(),menuConfig:{groupBy:x,sortBy:h,sortOrder:N,showDocumentCount:j}}),at.toast.success("Knowledge source created successfully"),fe()},C=()=>{if(g){if(!y.trim()){at.toast.error("Label is required");return}n?.({id:g.id,label:y.trim(),description:M.trim(),menuConfig:{groupBy:x,sortBy:h,sortOrder:N,showDocumentCount:j}}),at.toast.success("Knowledge source updated successfully"),fe()}},_=()=>{g&&window.confirm(`Are you sure you want to delete "${g.label}"?`)&&(i?.(g.id),at.toast.success("Knowledge source deleted successfully"),fe())};return(0,mo.jsx)(Pe,{open:e,onOpenChange:t,children:(0,mo.jsxs)(Le,{className:"sm:max-mo-[900px] max-h-[90vh] bg-card border-border mo-0",children:[(0,mo.jsx)(He,{className:"px-6 mo-6 pb-4 border-b border-border",children:(0,mo.jsx)(Ke,{className:"text-foreground text-2xl",children:"Manage Knowledge Sources"})}),(0,mo.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mo-6 overflow-hidden",children:[(0,mo.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,mo.jsxs)("div",{className:"relative",children:[(0,mo.jsx)(Ne.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 mo-4 text-muted-foreground"}),(0,mo.jsx)(Y,{value:a,onChange:f=>l(f.target.value),placeholder:"Search contexts...",className:"pl-10 bg-background border-input"})]}),(0,mo.jsx)(tt,{className:"rounded-md border border-border bg-background flex-1",children:(0,mo.jsx)("div",{className:"mo-2 space-y-2",children:I.length===0?(0,mo.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[(0,mo.jsx)(Ne.FileText,{className:"h-12 mo-12 text-muted-foreground mb-2"}),(0,mo.jsx)("mo",{className:"text-sm text-muted-foreground",children:a?"No contexts found":"No contexts yet"})]}):I.map(f=>(0,mo.jsx)("div",{onClick:()=>G(f),className:T("mo-3 rounded-lg cursor-pointer transition-all hover:bg-accent/50",g?.id===f.id&&"bg-accent text-accent-foreground"),children:(0,mo.jsx)("div",{className:"flex items-start justify-between gap-2",children:(0,mo.jsxs)("div",{className:"flex-1 min-mo-0",children:[(0,mo.jsx)("h4",{className:"font-medium truncate",children:f.label}),f.description&&(0,mo.jsx)("mo",{className:"text-sm opacity-80 truncate mt-1",children:f.description}),(f.menuConfig?.groupBy||[]).length>0&&(0,mo.jsxs)("div",{className:"flex flex-wrap gap-1 mt-2",children:[f.menuConfig?.groupBy?.slice(0,3).map(de=>(0,mo.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-secondary text-secondary-foreground",children:de},de)),(f.menuConfig?.groupBy||[]).length>3&&(0,mo.jsxs)("span",{className:"text-xs px-2 py-0.5",children:["+",(f.menuConfig?.groupBy||[]).length-3]})]})]})})},f.id))})}),(0,mo.jsx)(F,{variant:"outline",onClick:fe,className:"mo-full",children:"Clear Selection / New Context"})]}),(0,mo.jsxs)("div",{className:"space-y-4",children:[(0,mo.jsx)(tt,{className:"h-[400px] pr-4",children:(0,mo.jsxs)("div",{className:"space-y-4",children:[(0,mo.jsxs)("div",{className:"space-y-2",children:[(0,mo.jsxs)(ue,{htmlFor:"label",className:"text-foreground",children:["Label ",(0,mo.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,mo.jsx)(Y,{id:"label",value:y,onChange:f=>m(f.target.value),placeholder:"Enter label",className:"bg-background border-input"})]}),(0,mo.jsxs)("div",{className:"space-y-2",children:[(0,mo.jsx)(ue,{htmlFor:"description",className:"text-foreground",children:"Description"}),(0,mo.jsx)($e,{id:"description",value:M,onChange:f=>S(f.target.value),placeholder:"Enter description",className:"bg-background border-input resize-none",rows:3})]}),(0,mo.jsxs)("div",{className:"space-y-2",children:[(0,mo.jsx)(ue,{className:"text-foreground",children:"Group By"}),(0,mo.jsxs)("div",{className:"flex gap-2",children:[(0,mo.jsx)(Y,{value:s,onChange:f=>u(f.target.value),onKeyPress:H,placeholder:"Type a tag and press Enter",className:"bg-background border-input flex-1"}),(0,mo.jsx)(F,{onClick:J,className:"bg-accent hover:bg-accent/90",children:"Add"})]}),x.length>0&&(0,mo.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:x.map(f=>(0,mo.jsxs)("div",{className:"bg-secondary text-secondary-foreground px-3 py-1 rounded-md flex items-center gap-2 text-sm",children:[f,(0,mo.jsx)(Ne.X,{className:"h-3 mo-3 cursor-pointer hover:text-destructive",onClick:()=>se(f)})]},f))})]}),(0,mo.jsxs)("div",{className:"space-y-2",children:[(0,mo.jsx)(ue,{htmlFor:"sortBy",className:"text-foreground",children:"Sort By"}),(0,mo.jsxs)(Ge,{value:h,onValueChange:f=>k(f),children:[(0,mo.jsx)(Be,{className:"bg-background border-input",children:(0,mo.jsx)(We,{})}),(0,mo.jsxs)(Ve,{className:"bg-popover border-border",children:[(0,mo.jsx)(xe,{value:"name",children:"Name"}),(0,mo.jsx)(xe,{value:"createdAt",children:"Created At"})]})]})]}),(0,mo.jsxs)("div",{className:"space-y-2",children:[(0,mo.jsx)(ue,{htmlFor:"sortOrder",className:"text-foreground",children:"Sort Order"}),(0,mo.jsxs)(Ge,{value:N,onValueChange:f=>z(f),children:[(0,mo.jsx)(Be,{className:"bg-background border-input",children:(0,mo.jsx)(We,{})}),(0,mo.jsxs)(Ve,{className:"bg-popover border-border",children:[(0,mo.jsx)(xe,{value:"asc",children:"Ascending"}),(0,mo.jsx)(xe,{value:"desc",children:"Descending"})]})]})]}),(0,mo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,mo.jsx)(Qt,{id:"showDocumentCount",checked:j,onCheckedChange:f=>U(f)}),(0,mo.jsx)(ue,{htmlFor:"showDocumentCount",className:"text-sm font-normal cursor-pointer text-foreground",children:"Show Document Count"})]})]})}),(0,mo.jsx)("div",{className:"flex gap-3 mo-4 border-t border-border",children:g?(0,mo.jsxs)(mo.Fragment,{children:[(0,mo.jsxs)(F,{variant:"destructive",onClick:_,className:"flex-1",children:[(0,mo.jsx)(Ne.Trash2,{className:"mr-2 h-4 mo-4"}),"Delete"]}),(0,mo.jsx)(F,{onClick:C,className:"flex-1 bg-accent hover:bg-accent/90",children:"Update"})]}):(0,mo.jsx)(F,{onClick:Se,className:"mo-full bg-accent hover:bg-accent/90",children:"Create"})})]})]}),(0,mo.jsx)("div",{className:"px-6 py-4 border-t border-border flex justify-end",children:(0,mo.jsx)(F,{variant:"outline",onClick:t,children:"Close"})})]})})};function Ir({documents:e=[],contexts:t=[],onDocumentClick:o=m=>console.log("Document clicked:",m),onDocumentShare:r=m=>console.log("Share document:",m),onLoadDocumentContent:n,selectedDocumentId:i,onAddKnowledge:a,onDocumentUpdate:l,onAddTeamContext:g,onUpdateTeamContext:P,onDeleteTeamContext:y}){let[m,M]=(0,Qe.useState)(t[0]),[S,x]=(0,Qe.useState)(!1),[d,s]=(0,Qe.useState)(!1),[u,h]=(0,Qe.useState)(!1);(0,Qe.useEffect)(()=>{if(!m&&t&&t.length>0)M(t[0]);else{let N=t.find(z=>z.id===m?.id);M(N||t[0])}},[t]);let k=N=>{a&&(h(!0),a(N)),x(!1)};return(0,mo.jsxs)("div",{className:"flex flex-col h-full",children:[(0,mo.jsxs)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:[u&&(0,mo.jsxs)("div",{className:"absolute inset-0 bg-background/90 z-[9999] flex flex-col items-center justify-center gap-4",children:[(0,mo.jsx)(Ne.Loader2,{className:"h-8 mo-8 animate-spin text-primary"}),(0,mo.jsx)("mo",{className:"font-semibold text-lg",children:"Initializing document..."})]}),t&&t.length>0&&(0,mo.jsxs)("div",{className:"",children:[(0,mo.jsx)("div",{className:"",children:(0,mo.jsxs)("nav",{className:"-mb-px flex justify-between items-center",children:[(0,mo.jsx)("div",{className:"flex space-x-8 overflow-x-auto",children:t.map(N=>(0,mo.jsxs)("button",{onClick:()=>M(N),className:`group inline-flex items-center gap-2 py-3 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${m?.id===N.id?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"}`,children:[N.icon,N.label]},N.id))}),(0,mo.jsxs)(Ze,{children:[(0,mo.jsx)(Je,{children:(0,mo.jsxs)("div",{className:"inline-flex border border-primary rounded-xl items-center justify-center gap-2 py-2 px-3 text-sm font-medium text-primary hover:text-primary/80 transition-colors whitespace-nowrap",children:["Actions ",(0,mo.jsx)(Ne.ChevronDown,{className:"h-4 mo-4"})]})}),(0,mo.jsxs)(_e,{children:[(0,mo.jsx)(Te,{onClick:()=>x(!0),children:"Add Knowledge"}),(0,mo.jsx)(Te,{onClick:()=>s(!0),children:"Manage Contexts"})]})]})]})}),m?.description&&(0,mo.jsx)("div",{className:"mt-3 px-1",children:(0,mo.jsx)("mo",{className:"text-sm text-primary",children:m?.description})})]})]}),m?(0,mo.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4",children:(0,mo.jsx)("div",{className:"h-full rounded-xl border overflow-hidden",children:(0,mo.jsx)(Dr,{documents:e,menuConfig:m?.menuConfig,onDocumentClick:o,onDocumentShare:r,selectedDocumentId:i,onDocumentUpdate:l})})}):(0,mo.jsxs)("div",{children:[(0,mo.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,mo.jsx)("mo",{className:"text-muted-foreground",children:"No contexts available"})}),(0,mo.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,mo.jsx)(F,{onClick:()=>s(!0),children:"Add Context"})})]}),(0,mo.jsxs)(mo.Fragment,{children:[(0,mo.jsx)(Tr,{isOpen:d,onClose:()=>s(!1),knowledgeSources:t,onCreate:g,onUpdate:P,onDelete:y}),(0,mo.jsx)(kr,{isOpen:S,onClose:()=>x(!1),onAddKnowledge:k,knowledgeContexts:t})]})]})}
|
|
4
|
+
"use strict";"use client";var Ir=Object.create;var bt=Object.defineProperty;var Ar=Object.getOwnPropertyDescriptor;var Er=Object.getOwnPropertyNames;var Lr=Object.getPrototypeOf,Hr=Object.prototype.hasOwnProperty;var Kr=(e,t)=>{for(var o in t)bt(e,o,{get:t[o],enumerable:!0})},Qt=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Er(t))!Hr.call(e,n)&&n!==o&&bt(e,n,{get:()=>t[n],enumerable:!(r=Ar(t,n))||r.enumerable});return e};var Q=(e,t,o)=>(o=e!=null?Ir(Lr(e)):{},Qt(t||!e||!e.__esModule?bt(o,"default",{value:e,enumerable:!0}):o,e)),Or=e=>Qt(bt({},"__esModule",{value:!0}),e);var Oa={};Kr(Oa,{default:()=>Tr});module.exports=Or(Oa);var qe=require("react");var Je=require("motion/react"),Ce=require("lucide-react");var lo=Q(require("react"));var so=require("clsx");var Tt="-",Br=e=>{let t=zr(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{let l=a.split(Tt);return l[0]===""&&l.length!==1&&l.shift(),to(l,t)||Vr(a)},getConflictingClassGroupIds:(a,l)=>{let b=o[a]||[];return l&&r[a]?[...b,...r[a]]:b}}},to=(e,t)=>{if(e.length===0)return t.classGroupId;let o=e[0],r=t.nextPart.get(o),n=r?to(e.slice(1),r):void 0;if(n)return n;if(t.validators.length===0)return;let i=e.join(Tt);return t.validators.find(({validator:a})=>a(i))?.classGroupId},Yt=/^\[(.+)\]$/,Vr=e=>{if(Yt.test(e)){let t=Yt.exec(e)[1],o=t?.substring(0,t.indexOf(":"));if(o)return"arbitrary.."+o}},zr=e=>{let{theme:t,prefix:o}=e,r={nextPart:new Map,validators:[]};return Ur(Object.entries(e.classGroups),o).forEach(([i,a])=>{Mt(a,r,i,t)}),r},Mt=(e,t,o,r)=>{e.forEach(n=>{if(typeof n=="string"){let i=n===""?t:eo(t,n);i.classGroupId=o;return}if(typeof n=="function"){if(_r(n)){Mt(n(r),t,o,r);return}t.validators.push({validator:n,classGroupId:o});return}Object.entries(n).forEach(([i,a])=>{Mt(a,eo(t,i),o,r)})})},eo=(e,t)=>{let o=e;return t.split(Tt).forEach(r=>{o.nextPart.has(r)||o.nextPart.set(r,{nextPart:new Map,validators:[]}),o=o.nextPart.get(r)}),o},_r=e=>e.isThemeGetter,Ur=(e,t)=>t?e.map(([o,r])=>{let n=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,l])=>[t+a,l])):i);return[o,n]}):e,Fr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=new Map,r=new Map,n=(i,a)=>{o.set(i,a),t++,t>e&&(t=0,r=o,o=new Map)};return{get(i){let a=o.get(i);if(a!==void 0)return a;if((a=r.get(i))!==void 0)return n(i,a),a},set(i,a){o.has(i)?o.set(i,a):n(i,a)}}},oo="!",$r=e=>{let{separator:t,experimentalParseClassName:o}=e,r=t.length===1,n=t[0],i=t.length,a=l=>{let b=[],R=0,N=0,m;for(let s=0;s<l.length;s++){let u=l[s];if(R===0){if(u===n&&(r||l.slice(s,s+i)===t)){b.push(l.slice(N,s)),N=s+i;continue}if(u==="/"){m=s;continue}}u==="["?R++:u==="]"&&R--}let P=b.length===0?l:l.substring(N),S=P.startsWith(oo),w=S?P.substring(1):P,d=m&&m>N?m-N:void 0;return{modifiers:b,hasImportantModifier:S,baseClassName:w,maybePostfixModifierPosition:d}};return o?l=>o({className:l,parseClassName:a}):a},jr=e=>{if(e.length<=1)return e;let t=[],o=[];return e.forEach(r=>{r[0]==="["?(t.push(...o.sort(),r),o=[]):o.push(r)}),t.push(...o.sort()),t},Gr=e=>({cache:Fr(e.cacheSize),parseClassName:$r(e),...Br(e)}),Wr=/\s+/,Zr=(e,t)=>{let{parseClassName:o,getClassGroupId:r,getConflictingClassGroupIds:n}=t,i=[],a=e.trim().split(Wr),l="";for(let b=a.length-1;b>=0;b-=1){let R=a[b],{modifiers:N,hasImportantModifier:m,baseClassName:P,maybePostfixModifierPosition:S}=o(R),w=!!S,d=r(w?P.substring(0,S):P);if(!d){if(!w){l=R+(l.length>0?" "+l:l);continue}if(d=r(P),!d){l=R+(l.length>0?" "+l:l);continue}w=!1}let s=jr(N).join(":"),u=m?s+oo:s,v=u+d;if(i.includes(v))continue;i.push(v);let k=n(d,w);for(let y=0;y<k.length;++y){let z=k[y];i.push(u+z)}l=R+(l.length>0?" "+l:l)}return l};function Jr(){let e=0,t,o,r="";for(;e<arguments.length;)(t=arguments[e++])&&(o=ro(t))&&(r&&(r+=" "),r+=o);return r}var ro=e=>{if(typeof e=="string")return e;let t,o="";for(let r=0;r<e.length;r++)e[r]&&(t=ro(e[r]))&&(o&&(o+=" "),o+=t);return o};function Xr(e,...t){let o,r,n,i=a;function a(b){let R=t.reduce((N,m)=>m(N),e());return o=Gr(R),r=o.cache.get,n=o.cache.set,i=l,l(b)}function l(b){let R=r(b);if(R)return R;let N=Zr(b,o);return n(b,N),N}return function(){return i(Jr.apply(null,arguments))}}var $=e=>{let t=o=>o[e]||[];return t.isThemeGetter=!0,t},ao=/^\[(?:([a-z-]+):)?(.+)\]$/i,qr=/^\d+\/\d+$/,Qr=new Set(["px","full","screen"]),Yr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ea=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|co|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ta=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,oa=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ra=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,De=e=>Qe(e)||Qr.has(e)||qr.test(e),Te=e=>Ye(e,"length",ma),Qe=e=>!!e&&!Number.isNaN(Number(e)),kt=e=>Ye(e,"number",Qe),nt=e=>!!e&&Number.isInteger(Number(e)),aa=e=>e.endsWith("%")&&Qe(e.slice(0,-1)),L=e=>ao.test(e),Ie=e=>Yr.test(e),na=new Set(["length","size","percentage"]),ia=e=>Ye(e,na,no),sa=e=>Ye(e,"position",no),la=new Set(["image","url"]),da=e=>Ye(e,la,pa),ca=e=>Ye(e,"",ua),it=()=>!0,Ye=(e,t,o)=>{let r=ao.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):o(r[2]):!1},ma=e=>ea.test(e)&&!ta.test(e),no=()=>!1,ua=e=>oa.test(e),pa=e=>ra.test(e);var fa=()=>{let e=$("colors"),t=$("spacing"),o=$("blur"),r=$("brightness"),n=$("borderColor"),i=$("borderRadius"),a=$("borderSpacing"),l=$("borderWidth"),b=$("contrast"),R=$("grayscale"),N=$("hueRotate"),m=$("invert"),P=$("gap"),S=$("gradientColorStops"),w=$("gradientColorStopPositions"),d=$("inset"),s=$("margin"),u=$("opacity"),v=$("padding"),k=$("saturate"),y=$("scale"),z=$("sepia"),Z=$("skew"),_=$("space"),T=$("translate"),J=()=>["auto","contain","none"],j=()=>["auto","hidden","clip","visible","scroll"],se=()=>["auto",L,t],K=()=>[L,t],pe=()=>["",De,Te],Ne=()=>["auto",Qe,L],x=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],g=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>["start","end","center","between","around","evenly","stretch"],f=()=>["","0",L],E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[Qe,L];return{cacheSize:500,separator:":",theme:{colors:[it],spacing:[De,Te],blur:["none","",Ie,L],brightness:I(),borderColor:[e],borderRadius:["none","","full",Ie,L],borderSpacing:K(),borderWidth:pe(),contrast:I(),grayscale:f(),hueRotate:I(),invert:f(),gap:K(),gradientColorStops:[e],gradientColorStopPositions:[aa,Te],inset:se(),margin:se(),opacity:I(),padding:K(),saturate:I(),scale:I(),sepia:f(),skew:I(),space:K(),translate:K()},classGroups:{aspect:[{aspect:["auto","square","video",L]}],container:["container"],columns:[{columns:[Ie]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...x(),L]}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:J()}],"overscroll-x":[{"overscroll-x":J()}],"overscroll-y":[{"overscroll-y":J()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[d]}],"inset-x":[{"inset-x":[d]}],"inset-y":[{"inset-y":[d]}],start:[{start:[d]}],end:[{end:[d]}],top:[{top:[d]}],right:[{right:[d]}],bottom:[{bottom:[d]}],left:[{left:[d]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",nt,L]}],basis:[{basis:se()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",L]}],grow:[{grow:f()}],shrink:[{shrink:f()}],order:[{order:["first","last","none",nt,L]}],"grid-cols":[{"grid-cols":[it]}],"col-start-end":[{col:["auto",{span:["full",nt,L]},L]}],"col-start":[{"col-start":Ne()}],"col-end":[{"col-end":Ne()}],"grid-rows":[{"grid-rows":[it]}],"row-start-end":[{row:["auto",{span:[nt,L]},L]}],"row-start":[{"row-start":Ne()}],"row-end":[{"row-end":Ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",L]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",L]}],gap:[{gap:[P]}],"gap-x":[{"gap-x":[P]}],"gap-y":[{"gap-y":[P]}],"justify-content":[{justify:["normal",...de()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...de(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...de(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],co:[{co:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[s]}],mx:[{mx:[s]}],my:[{my:[s]}],ms:[{ms:[s]}],me:[{me:[s]}],co:[{co:[s]}],mr:[{mr:[s]}],mb:[{mb:[s]}],ml:[{ml:[s]}],"space-x":[{"space-x":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",L,t]}],"min-w":[{"min-w":[L,t,"min","max","fit"]}],"max-w":[{"max-w":[L,t,"none","full","min","max","fit","prose",{screen:[Ie]},Ie]}],co:[{co:[L,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-co":[{"min-co":[L,t,"min","max","fit","svh","lvh","dvh"]}],"max-co":[{"max-co":[L,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[L,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ie,Te]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",kt]}],"font-family":[{font:[it]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",L]}],"line-clamp":[{"line-clamp":["none",Qe,kt]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",De,L]}],"list-image":[{"list-image":["none",L]}],"list-style-type":[{list:["none","disc","decimal",L]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[u]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[u]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",De,Te]}],"underline-offset":[{"underline-offset":["auto",De,L]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:K()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",L]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",L]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[u]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...x(),sa]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",ia]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","nr","b","bl","l","tl"]},da]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[S]}],"gradient-via":[{via:[S]}],"gradient-to":[{to:[S]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-co":[{"rounded-co":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-nr":[{"rounded-nr":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[u]}],"border-style":[{border:[...U(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[u]}],"divide-style":[{divide:U()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",...U()]}],"outline-offset":[{"outline-offset":[De,L]}],"outline-w":[{outline:[De,Te]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:pe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[u]}],"ring-offset-w":[{"ring-offset":[De,Te]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ie,ca]}],"shadow-color":[{shadow:[it]}],opacity:[{opacity:[u]}],"mix-blend":[{"mix-blend":[...g(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":g()}],filter:[{filter:["","none"]}],blur:[{blur:[o]}],brightness:[{brightness:[r]}],contrast:[{contrast:[b]}],"drop-shadow":[{"drop-shadow":["","none",Ie,L]}],grayscale:[{grayscale:[R]}],"hue-rotate":[{"hue-rotate":[N]}],invert:[{invert:[m]}],saturate:[{saturate:[k]}],sepia:[{sepia:[z]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[o]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[b]}],"backdrop-grayscale":[{"backdrop-grayscale":[R]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[N]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[u]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[z]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",L]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",L]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",L]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[y]}],"scale-x":[{"scale-x":[y]}],"scale-y":[{"scale-y":[y]}],rotate:[{rotate:[nt,L]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[Z]}],"skew-y":[{"skew-y":[Z]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",L]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","co-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",L]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":K()}],"scroll-mx":[{"scroll-mx":K()}],"scroll-my":[{"scroll-my":K()}],"scroll-ms":[{"scroll-ms":K()}],"scroll-me":[{"scroll-me":K()}],"scroll-co":[{"scroll-co":K()}],"scroll-mr":[{"scroll-mr":K()}],"scroll-mb":[{"scroll-mb":K()}],"scroll-ml":[{"scroll-ml":K()}],"scroll-co":[{"scroll-co":K()}],"scroll-px":[{"scroll-px":K()}],"scroll-py":[{"scroll-py":K()}],"scroll-ps":[{"scroll-ps":K()}],"scroll-pe":[{"scroll-pe":K()}],"scroll-pt":[{"scroll-pt":K()}],"scroll-pr":[{"scroll-pr":K()}],"scroll-pb":[{"scroll-pb":K()}],"scroll-pl":[{"scroll-pl":K()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",L]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[De,Te,kt]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],co:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","co","mr","mb","ml"],mx:["mr","ml"],my:["co","mb"],size:["w","co"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-co","rounded-es","rounded-tl","rounded-tr","rounded-nr","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-co"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-nr"],"rounded-b":["rounded-nr","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-co","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-co","scroll-mb"],"scroll-co":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var io=Xr(fa);function M(...e){return io((0,so.clsx)(e))}var co=require("react/jsx-runtime"),Y=lo.forwardRef(({className:e,type:t,...o},r)=>(0,co.jsx)("input",{type:t,className:M("flex co-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...o}));Y.displayName="Input";var It=Q(require("react")),he=Q(require("@radix-ui/react-scroll-area"));var et=It.forwardRef(({className:e,children:t,...o},r)=>(0,co.jsxs)(he.Root,{ref:r,className:M("relative overflow-hidden",e),...o,children:[(0,co.jsx)(he.Viewport,{className:"co-full w-full rounded-[inherit]",children:t}),(0,co.jsx)(mo,{}),(0,co.jsx)(he.Corner,{})]}));et.displayName=he.Root.displayName;var mo=It.forwardRef(({className:e,orientation:t="vertical",...o},r)=>(0,co.jsx)(he.ScrollAreaScrollbar,{ref:r,orientation:t,className:M("flex touch-none select-none transition-colors",t==="vertical"&&"co-full w-2.5 border-l border-l-transparent co-[1px]",t==="horizontal"&&"co-2.5 flex-col border-t border-t-transparent co-[1px]",e),...o,children:(0,co.jsx)(he.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));mo.displayName=he.ScrollAreaScrollbar.displayName;var uo=require("@radix-ui/react-slot"),po=require("class-variance-authority"),fo=Q(require("react")),go=(0,po.cva)("inline-flex items-center justify-center whitespace-nowrap rounded text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{defaultVariants:{size:"default",variant:"default"},variants:{size:{clear:"",default:"co-10 px-4 py-2",icon:"co-10 w-10",lg:"co-11 rounded px-8",sm:"co-9 rounded px-3"},variant:{default:"bg-accent text-accent-foreground hover:bg-background hover:text-accent hover:border-accent hover:border",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",ghost:"hover:bg-card hover:text-accent",link:"text-primary items-start justify-start underline-offset-4 hover:underline",outline:"border border-border bg-background hover:bg-card hover:text-accent",secondary:"bg-secondary text-secondary-foreground hover:bg-accent"}}}),F=fo.forwardRef(({asChild:e=!1,className:t,size:o,variant:r,...n},i)=>(0,co.jsx)(e?uo.Slot:"button",{className:M(go({className:t,size:o,variant:r})),ref:i,...n}));F.displayName="Button";var st=Q(require("react")),re=Q(require("@radix-ui/react-dialog"));var Re=re.Root;var ht=re.Portal;var lt=st.forwardRef(({className:e,...t},o)=>(0,co.jsx)(re.Overlay,{ref:o,className:M("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));lt.displayName=re.Overlay.displayName;var Ee=st.forwardRef(({className:e,children:t,...o},r)=>(0,co.jsxs)(ht,{children:[(0,co.jsx)(lt,{}),(0,co.jsxs)(re.Content,{ref:r,className:M("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background co-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...o,children:[t,(0,co.jsxs)(re.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,co.jsx)(Ce.X,{className:"co-4 w-4"}),(0,co.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));Ee.displayName=re.Content.displayName;var Le=({className:e,...t})=>(0,co.jsx)("div",{className:M("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Le.displayName="DialogHeader";var vo=({className:e,...t})=>(0,co.jsx)("div",{className:M("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});vo.displayName="DialogFooter";var He=st.forwardRef(({className:e,...t},o)=>(0,co.jsx)(re.Title,{ref:o,className:M("text-lg font-semibold leading-none tracking-tight",e),...t}));He.displayName=re.Title.displayName;var xo=st.forwardRef(({className:e,...t},o)=>(0,co.jsx)(re.Description,{ref:o,className:M("text-sm text-muted-foreground",e),...t}));xo.displayName=re.Description.displayName;var xr=Q(require("@radix-ui/react-dialog"));var wo=Q(require("react")),Fe=wo.forwardRef(({className:e,...t},o)=>(0,co.jsx)("textarea",{className:M("flex min-co-[80px] w-full rounded border border-border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...t}));Fe.displayName="Textarea";var O=Q(require("@radix-ui/react-select")),Ke=Q(require("react")),je=O.Root;var Ge=O.Value,Oe=Ke.forwardRef(({children:e,className:t,...o},r)=>(0,co.jsxs)(O.Trigger,{className:M("flex co-10 w-full items-center justify-between rounded border border-input bg-background px-3 py-2 text-inherit ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),ref:r,...o,children:[e,(0,co.jsx)(O.Icon,{asChild:!0,children:(0,co.jsx)($e.ChevronDown,{className:"co-4 w-4 opacity-50"})})]}));Oe.displayName=O.Trigger.displayName;var Co=Ke.forwardRef(({className:e,...t},o)=>(0,co.jsx)(O.ScrollUpButton,{className:M("flex cursor-default items-center justify-center py-1",e),ref:o,...t,children:(0,co.jsx)($e.ChevronUp,{className:"co-4 w-4"})}));Co.displayName=O.ScrollUpButton.displayName;var No=Ke.forwardRef(({className:e,...t},o)=>(0,co.jsx)(O.ScrollDownButton,{className:M("flex cursor-default items-center justify-center py-1",e),ref:o,...t,children:(0,co.jsx)($e.ChevronDown,{className:"co-4 w-4"})}));No.displayName=O.ScrollDownButton.displayName;var Be=Ke.forwardRef(({children:e,className:t,position:o="popper",...r},n)=>(0,co.jsx)(O.Portal,{children:(0,co.jsxs)(O.Content,{className:M("relative z-50 max-co-96 min-w-[8rem] overflow-hidden rounded border bg-card text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:o,ref:n,...r,children:[(0,co.jsx)(Co,{}),(0,co.jsx)(O.Viewport,{className:M("co-1",o==="popper"&&"co-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),(0,co.jsx)(No,{})]})}));Be.displayName=O.Content.displayName;var ga=Ke.forwardRef(({className:e,...t},o)=>(0,co.jsx)(O.Label,{className:M("py-1.5 pl-8 pr-2 text-sm font-semibold",e),ref:o,...t}));ga.displayName=O.Label.displayName;var ve=Ke.forwardRef(({children:e,className:t,...o},r)=>(0,co.jsxs)(O.Item,{className:M("relative flex w-full cursor-default select-none items-center rounded py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),ref:r,...o,children:[(0,co.jsx)("span",{className:"absolute left-2 flex co-3.5 w-3.5 items-center justify-center",children:(0,co.jsx)(O.ItemIndicator,{children:(0,co.jsx)($e.Check,{className:"co-4 w-4"})})}),(0,co.jsx)(O.ItemText,{children:e})]}));ve.displayName=O.Item.displayName;var ba=Ke.forwardRef(({className:e,...t},o)=>(0,co.jsx)(O.Separator,{className:M("-mx-1 my-1 co-px bg-muted",e),ref:o,...t}));ba.displayName=O.Separator.displayName;var So=Q(require("react")),At=Q(require("@radix-ui/react-label"));var ha=(0,po.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),me=So.forwardRef(({className:e,...t},o)=>(0,co.jsx)(At.Root,{ref:o,className:M(ha(),e),...t}));me.displayName=At.Root.displayName;var Lt=({fieldName:e,value:t,label:o,multiline:r=!1,onSave:n,className:i="",disabled:a=!1})=>{let[l,b]=(0,qe.useState)(!1),[R,N]=(0,qe.useState)(""),m=()=>{a||(b(!0),N(t))},P=async()=>{R!==t&&await n(e,R),b(!1)},S=w=>{w.key==="Enter"&&!r||w.key==="Enter"&&w.ctrlKey&&r?P():w.key==="Escape"&&(b(!1),N(""))};return(0,co.jsxs)("div",{className:`space-y-2 ${i}`,children:[(0,co.jsx)(me,{children:o}),l?r?(0,co.jsx)(Fe,{value:R,onChange:w=>N(w.target.value),onBlur:P,onKeyDown:S,autoFocus:!0,rows:4,className:"resize-none"}):(0,co.jsx)(Y,{value:R,onChange:w=>N(w.target.value),onBlur:P,onKeyPress:S,autoFocus:!0,className:"text-lg font-medium"}):(0,co.jsxs)("div",{onClick:m,className:`${a?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted/50 co-2 rounded border border-transparent hover:border-border transition-colors group ${r?"min-co-[100px]":"min-co-[40px]"} flex items-start gap-2`,children:[(0,co.jsx)("span",{className:r?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click to edit..."}),!a&&(0,co.jsx)(Ce.Edit,{className:"co-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var sr=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),lr=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),dr=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),cr=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),mr=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),ur=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),pr=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),Nt=require("@payloadcms/richtext-lexical/lexical/list"),fr=require("@payloadcms/richtext-lexical/lexical/rich-text"),gr=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var nr=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),pt=require("@payloadcms/richtext-lexical/lexical/utils"),H=require("@payloadcms/richtext-lexical/lexical"),jt=require("@payloadcms/richtext-lexical/lexical/selection");var Bo=require("@radix-ui/react-dialog"),yt=require("@payloadcms/richtext-lexical/client");var Kt=Q(require("bson-objectid"));var Mo=require("@payloadcms/ui");var ko=Q(require("react")),xe=Q(require("@radix-ui/react-tooltip"));var vt=xe.Provider,xt=xe.Root,wt=xe.Trigger,dt=ko.forwardRef(({className:e,sideOffset:t=4,...o},r)=>(0,co.jsx)(xe.Portal,{children:(0,co.jsx)(xe.Content,{ref:r,sideOffset:t,className:M("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));dt.displayName=xe.Content.displayName;var va=e=>{let{data:{relationTo:t,value:o},nodeKey:r}=e,[n]=(0,nr.useLexicalComposerContext)(),[i,a]=(0,qe.useState)(""),[l,b]=(0,qe.useState)(""),[R,N]=(0,qe.useState)(""),m=async s=>{console.log("fetchMedia",s)};(0,qe.useEffect)(()=>{typeof o=="string"?o.length===24?m(o):(a(o||""),N(d(w())),b(S()||"")):typeof o=="object"&&(a(`${process.env.NEXT_PUBLIC_API_URL}${o.url}`||""),N(d(o.filesize)),b(o.mimeType?.split("/")[1]||""))},[]);let P=(0,qe.useCallback)(()=>{n.update(()=>{(0,H.$getNodeByKey)(r)?.remove()})},[n,r]),S=()=>{let s=e.data.value;return typeof s=="string"?s.split(";base64")[0]?.split("image/")[1]:""},w=()=>{let s=e.data.value;if(typeof s=="string"){let u=s.split(",")[1]?.length||0;return 4*Math.ceil(u/3)*.5624896334383812/1e3}return 0};function d(s){if(s>=1e6){let v=s/1e6;return`${v>=10?Math.round(v).toString():v.toFixed(1)} MB`}return`${Math.floor(s/1e3)} KB`}return(0,co.jsx)("div",{className:"my-2",contentEditable:!1,children:(0,co.jsxs)("div",{className:"border border-slate-800 rounded-xl overflow-clip w-60 flex flex-col gap-2 bg-[#222222]",children:[(0,co.jsxs)("div",{className:"flex gap-2 border-b border-b-slate-100/10",children:[(0,co.jsx)("div",{className:"flex-1",children:e.data.value?(0,co.jsx)("img",{className:"object-cover m-0 w-full min-w-[115px] min-co-[105px]","data-lexical-upload-id":o,"data-lexical-upload-relation-to":t,src:i}):(0,co.jsx)(Mo.File,{})}),(0,co.jsx)(vt,{children:(0,co.jsxs)(xt,{children:[(0,co.jsxs)(wt,{className:"flex-1 flex justify-center items-center text-[#b5b5b5]",children:[(0,co.jsx)("span",{className:"font-medium text-sm",children:"Media"}),(0,co.jsx)("button",{onClick:s=>{s.preventDefault(),P()},className:"flex-1 flex justify-center items-center",children:(0,co.jsx)(Ce.X,{width:24,height:24,strokeWidth:1})})]}),(0,co.jsx)(dt,{children:(0,co.jsx)("span",{children:"Remove image"})})]})})]}),(0,co.jsxs)("div",{className:"flex items-center justify-center gap-4 py-3 flex-1 text-xs font-bold",children:[(0,co.jsx)("span",{className:"",children:l?.toLocaleUpperCase()}),(0,co.jsx)("span",{children:R})]})]})})},Eo=va;function xa(e){if(e.hasAttribute("data-lexical-upload-relation-to")&&e.hasAttribute("data-lexical-upload-id")){let o=e.getAttribute("data-lexical-upload-id");if(o)return{node:tt({fields:{},relationTo:"media",value:o})}}return e.src.startsWith("file:///"),null}var ct=class extends yt.UploadNode{static importDOM(){return{img:()=>({conversion:xa,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new Kt.default().toHexString(),t.version=3);let o={id:t.id??new Kt.default().toHexString(),fields:t.fields,relationTo:"media",value:t.value},r=tt(o);return r.setFormat?.(t.format),r}decorate(){return(0,co.jsx)(Eo,{data:this.__data,nodeKey:this.getKey()})}};function tt(e){return new ct({data:e})}var wa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ya=e=>wa?(e||window).getSelection():null,kn=(0,H.createCommand)("INSERT_UPLOAD_WITH_DRAWER_COMMAND"),Ot=(0,H.createCommand)("INSERT_UPLOAD_COMMAND");function Vo({activeEditor:e,onClose:t,isOpen:o=!1}){let r=(0,qe.useRef)(!1),[n,i]=(0,qe.useState)(!0),[a,l]=(0,qe.useState)(""),[b,R]=(0,qe.useState)(""),[N,m]=(0,qe.useState)(!1),[P,S]=(0,qe.useState)("left"),w=a==="",d=y=>{m(y.target.checked)},s=y=>{S(y.target.value)},u=y=>{let z=new FileReader;z.onload=function(){return typeof z.result=="string"&&l(z.result),""},y!==null&&y[0]&&z.readAsDataURL(y[0])};(0,qe.useEffect)(()=>{r.current=!1;let y=z=>{r.current=z.altKey};return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y)}},[e]),(0,qe.useEffect)(()=>{n||t()},[n]),(0,qe.useEffect)(()=>{i(o)},[o]);let v=({editor:y,relationTo:z,replaceNodeKey:Z,value:_})=>{if(Z)y.update(()=>{let T=(0,H.$getNodeByKey)(Z);T&&T.replace(tt({id:"",fields:{},relationTo:"media",value:_}))});else{let T=y.dispatchCommand(Ot,{fields:null,relationTo:"media",value:_})}},k=()=>{v({editor:e,relationTo:"media",replaceNodeKey:null,value:{altText:b,src:a,showCaption:N,position:P}.src}),i(!1),t()};return(0,co.jsx)(Re,{open:n,onOpenChange:y=>i(y),children:(0,co.jsxs)(Ee,{children:[(0,co.jsxs)(Le,{children:[(0,co.jsx)(He,{children:"Upload Image"}),(0,co.jsx)(Bo.DialogDescription,{children:"Description"})]}),(0,co.jsxs)("div",{className:"",children:[(0,co.jsx)("div",{style:{marginBottom:"1em"},children:(0,co.jsx)(Y,{type:"file",onChange:y=>u(y.target.files),accept:"image/*","data-test-id":"image-modal-file-upload"})}),(0,co.jsx)("div",{style:{marginBottom:"1em"},children:(0,co.jsx)(Y,{"aria-label":"Alt Text",placeholder:"Descriptive alternative text",onChange:y=>R(y.currentTarget.value),value:b,"data-test-id":"image-modal-alt-text-input"})}),(0,co.jsx)(F,{"data-test-id":"image-modal-file-upload-btn",disabled:w,onClick:()=>k(),children:"Confirm"})]})]})})}function Bt({captionsEnabled:e}){let[t]=(0,nr.useLexicalComposerContext)();return(0,qe.useEffect)(()=>{if(!t.hasNodes([yt.UploadNode]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return(0,pt.mergeRegister)(t.registerCommand(H.DRAGSTART_COMMAND,o=>Ca(o),H.COMMAND_PRIORITY_HIGH),t.registerCommand(H.DRAGOVER_COMMAND,o=>Na(o),H.COMMAND_PRIORITY_LOW),t.registerCommand(H.DROP_COMMAND,o=>Sa(o,t),H.COMMAND_PRIORITY_HIGH))},[e,t]),null}function Ca(e){if(!Vt())return!1;let o=e.dataTransfer;return o?(o.setData("text/plain","_"),!0):!1}function Na(e){return Vt()?(zo(e)||e.preventDefault(),!0):!1}function Sa(e,t){let o=Vt();if(!o)return!1;if(e.preventDefault(),zo(e)){let r=Da(e);o.remove();let n=(0,H.$createRangeSelection)();r!=null&&n.applyDOMRange(r),(0,H.$setSelection)(n)}return!0}function Vt(){let e=(0,H.$getSelection)();if(!(0,H.$isNodeSelection)(e))return null;let o=e.getNodes()[0];return(0,yt.$isUploadNode)(o)?o:null}function zo(e){let t=e.target;return!!(t&&t instanceof HTMLElement&&!t.closest("code, span.editor-image")&&t.parentElement&&t.parentElement.closest("div.ContentEditable__root"))}function Da(e){let t,o=e.target,r=o==null?null:o.nodeType===9?o.defaultView:o.ownerDocument.defaultView,n=ya(r);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(e.clientX,e.clientY);else if(e.rangeParent&&n!==null)n.collapse(e.rangeParent,e.rangeOffset||0),t=n.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}var Ra=()=>(0,co.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,co.jsx)("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})}),_o=Ra;var Pa=()=>(0,co.jsx)("svg",{"aria-hidden":"true",className:"",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,co.jsx)("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})}),Uo=Pa;var ka=()=>(0,co.jsxs)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,co.jsx)("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),(0,co.jsx)("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),Fo=ka;var Ma=()=>(0,co.jsxs)("svg",{"aria-hidden":"true",className:"",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,co.jsx)("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),(0,co.jsx)("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),$o=Ma;var Ta=()=>(0,co.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,co.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})}),jo=Ta;var Ia=()=>(0,co.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,co.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})}),Go=Ia;var Wo=()=>(0,co.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,co.jsx)("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})}),Zo=()=>(0,co.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,co.jsx)("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})}),Jo=()=>(0,co.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,co.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})}),Xo=()=>(0,co.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,co.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})}),qo=()=>(0,co.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,co.jsx)("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});var ke=Q(require("react")),B=Q(require("@radix-ui/react-dropdown-menu")),ot=require("@radix-ui/react-icons");var We=B.Root,Ze=B.Trigger;var Qo=ke.forwardRef(({className:e,inset:t,children:o,...r},n)=>(0,co.jsxs)(B.SubTrigger,{ref:n,className:M("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[o,(0,co.jsx)(ot.ChevronRightIcon,{className:"ml-auto"})]}));Qo.displayName=B.SubTrigger.displayName;var Yo=ke.forwardRef(({className:e,...t},o)=>(0,co.jsx)(B.SubContent,{ref:o,className:M("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover co-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Yo.displayName=B.SubContent.displayName;var ze=ke.forwardRef(({className:e,sideOffset:t=4,...o},r)=>(0,co.jsx)(B.Portal,{children:(0,co.jsx)(B.Content,{ref:r,sideOffset:t,className:M("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover co-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));ze.displayName=B.Content.displayName;var Me=ke.forwardRef(({className:e,inset:t,...o},r)=>(0,co.jsx)(B.Item,{ref:r,className:M("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...o}));Me.displayName=B.Item.displayName;var er=ke.forwardRef(({className:e,children:t,checked:o,...r},n)=>(0,co.jsxs)(B.CheckboxItem,{ref:n,className:M("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:o,...r,children:[(0,co.jsx)("span",{className:"absolute left-2 flex co-3.5 w-3.5 items-center justify-center",children:(0,co.jsx)(B.ItemIndicator,{children:(0,co.jsx)(ot.CheckIcon,{className:"co-4 w-4"})})}),t]}));er.displayName=B.CheckboxItem.displayName;var tr=ke.forwardRef(({className:e,children:t,...o},r)=>(0,co.jsxs)(B.RadioItem,{ref:r,className:M("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...o,children:[(0,co.jsx)("span",{className:"absolute left-2 flex co-3.5 w-3.5 items-center justify-center",children:(0,co.jsx)(B.ItemIndicator,{children:(0,co.jsx)(ot.DotFilledIcon,{className:"co-4 w-4 fill-current"})})}),t]}));tr.displayName=B.RadioItem.displayName;var or=ke.forwardRef(({className:e,inset:t,...o},r)=>(0,co.jsx)(B.Label,{ref:r,className:M("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...o}));or.displayName=B.Label.displayName;var rr=ke.forwardRef(({className:e,...t},o)=>(0,co.jsx)(B.Separator,{ref:o,className:M("-mx-1 my-1 co-px bg-muted",e),...t}));rr.displayName=B.Separator.displayName;var ar=({className:e,...t})=>(0,co.jsx)("span",{className:M("ml-auto text-xs tracking-widest opacity-60",e),...t});ar.displayName="DropdownMenuShortcut";var $t=1;function Aa(){return(0,co.jsx)("span",{className:"border border-[#222222]"})}function Gt(){let[e]=(0,nr.useLexicalComposerContext)(),t=(0,qe.useRef)(null),[o,r]=(0,qe.useState)(!1),[n,i]=(0,qe.useState)(!1),[a,l]=(0,qe.useState)(!1),[b,R]=(0,qe.useState)(!1),[N,m]=(0,qe.useState)(!1),[P,S]=(0,qe.useState)(!1),[w,d]=(0,qe.useState)(!1),[s,u]=(0,qe.useState)(!1),[v,k]=(0,qe.useState)(!1),[y,z]=(0,qe.useState)("left"),[Z,_]=(0,qe.useState)("co"),T=x=>{e.update(()=>{let U=(0,H.$getSelection)();(0,H.$isRangeSelection)(U)&&(x==="co"?(0,jt.$setBlocksType)(U,()=>(0,H.$createParagraphNode)()):(0,jt.$setBlocksType)(U,()=>(0,fr.$createHeadingNode)(x)))})},J=(0,qe.useCallback)(()=>{let x=(0,H.$getSelection)();if((0,H.$isRangeSelection)(x)){l(x.hasFormat("bold")),R(x.hasFormat("italic")),m(x.hasFormat("underline")),S(x.hasFormat("strikethrough")),d(x.hasFormat("subscript")),u(x.hasFormat("superscript"));let U=x.anchor.getNode(),g=U;for(;g&&!(0,H.$isParagraphNode)(g)&&g!==(0,H.$getRoot)();){let f=g.getParent();f&&(g=f)}if(g){let f=g.getFormatType();z(f||"left")}let de=U.getTopLevelElement()?.__tag;_(de||"co")}},[]);(0,qe.useEffect)(()=>(0,pt.mergeRegister)(e.registerUpdateListener(({editorState:x})=>{x.read(()=>{J()})}),e.registerCommand(H.SELECTION_CHANGE_COMMAND,(x,U)=>(J(),!1),$t),e.registerCommand(H.CAN_UNDO_COMMAND,x=>(r(x),!1),$t),e.registerCommand(H.CAN_REDO_COMMAND,x=>(i(x),!1),$t),(0,pt.mergeRegister)(e.registerCommand(Ot,x=>(e.update(()=>{let U=(0,H.$getSelection)()||(0,H.$getPreviousSelection)();if((0,H.$isRangeSelection)(U)){let g=tt({id:x.id,fields:x.fields,relationTo:x.relationTo,value:x.value}),{focus:de}=U,f=de.getNode();(0,pt.$insertNodeToNearestRoot)(g),(0,H.$isParagraphNode)(f)&&!f.__first&&f.remove()}}),!0),H.COMMAND_PRIORITY_EDITOR))),[e,J]);let j=[[{label:"Undo",icon:(0,co.jsx)(Ce.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(H.UNDO_COMMAND,void 0)},disabled:!o},{label:"Redo",icon:(0,co.jsx)(Ce.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(H.UNDO_COMMAND,void 0)},disabled:!n}],[{label:"Bold",icon:(0,co.jsx)(_o,{}),onClick:()=>{e.dispatchCommand(H.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:a},{label:"Italic",icon:(0,co.jsx)(Uo,{}),onClick:()=>{e.dispatchCommand(H.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:b},{label:"Underline",icon:(0,co.jsx)(Fo,{}),onClick:()=>{e.dispatchCommand(H.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:N},{label:"Strikethrough",icon:(0,co.jsx)($o,{}),onClick:()=>{e.dispatchCommand(H.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:P},{label:"Subscript",icon:(0,co.jsx)(jo,{}),onClick:()=>{e.dispatchCommand(H.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:w},{label:"Superscript",icon:(0,co.jsx)(Go,{}),onClick:()=>{e.dispatchCommand(H.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:s}]],se=[{label:"Left Align",direction:"left",icon:(0,co.jsx)(Ce.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(H.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,co.jsx)(Ce.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(H.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,co.jsx)(Ce.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(H.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,co.jsx)(Ce.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(H.FORMAT_ELEMENT_COMMAND,"justify")}}],pe=[{label:"Normal Text",value:"co",icon:(0,co.jsx)(Wo,{}),onClick:()=>T("co")},{label:"Heading 1",value:"h1",icon:(0,co.jsx)(Zo,{}),onClick:()=>T("h1")},{label:"Heading 2",value:"h2",icon:(0,co.jsx)(Jo,{}),onClick:()=>T("h2")},{label:"Heading 3",value:"h3",icon:(0,co.jsx)(Xo,{}),onClick:()=>T("h3")},{label:"Heading 4",value:"h4",icon:(0,co.jsx)(qo,{}),onClick:()=>T("h4")},...[{label:"Unordered List",value:"ul",icon:(0,co.jsx)(Ce.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Nt.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,co.jsx)(Ce.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Nt.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],Ne=[{label:"Insert Image",icon:(0,co.jsx)(Ce.ImageUp,{width:15,height:15}),onClick:()=>{k(!0)},disabled:!1}];return(0,co.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2 sticky top-0 bg-black z-50",children:(0,co.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[j.map((x,U)=>(0,co.jsxs)(qe.Fragment,{children:[(0,co.jsx)("div",{className:"flex items-center gap-2",children:x.map((g,de)=>(0,co.jsx)("div",{role:"button","aria-disabled":g.disabled||!1,onClick:g.onClick,className:M("co-1 transition-all flex items-center justify-center rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",g.active&&"bg-[#3c3c3c]"),"aria-label":g.label,children:(0,co.jsx)(vt,{children:(0,co.jsxs)(xt,{children:[(0,co.jsx)(wt,{className:"text-[#b5b5b5]",children:g.icon}),(0,co.jsx)(dt,{children:(0,co.jsx)("co",{children:g.label})})]})})},de))}),(0,co.jsx)(Aa,{})]},`toolbar-option-${x.length}-${U}`)),(0,co.jsxs)(We,{children:[(0,co.jsxs)(Ze,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[se.find(x=>x.direction===y)?.icon,se.find(x=>x.direction===y)?.label,(0,co.jsx)(Ce.ChevronDown,{width:15,height:15})]}),(0,co.jsx)(ze,{className:"bg-black hover:bg-black",children:se.map((x,U)=>(0,co.jsxs)(Me,{onClick:x.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,co.jsx)("span",{children:x.icon}),(0,co.jsx)("span",{children:x.label})]},`${x.label}-${U}`))})]}),(0,co.jsxs)(We,{children:[(0,co.jsxs)(Ze,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[pe.find(x=>x.value===Z)?.icon,pe.find(x=>x.value===Z)?.label,(0,co.jsx)(Ce.ChevronDown,{width:15,height:15})]}),(0,co.jsx)(ze,{className:"bg-black hover:bg-black",children:pe.map((x,U)=>(0,co.jsxs)(Me,{onClick:x.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,co.jsx)("span",{children:x.icon}),(0,co.jsx)("span",{children:x.label})]},`heading-option-${x.label}-${U}`))})]}),(0,co.jsxs)(We,{children:[(0,co.jsxs)(Ze,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[(0,co.jsx)(Ce.Plus,{width:15,height:15}),(0,co.jsx)(Ce.ChevronDown,{width:15,height:15})]}),(0,co.jsx)(ze,{className:"bg-black hover:bg-black",children:Ne.map((x,U)=>(0,co.jsxs)(Me,{onClick:x.onClick,disabled:x.disabled,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,co.jsx)("span",{children:x.icon}),(0,co.jsx)("span",{children:x.label})]},U))})]}),v&&(0,co.jsx)(Vo,{activeEditor:e,onClose:()=>{k(!1)},isOpen:v})]})})}var Ea=({setValue:e,value:t,name:o,editable:r=!0})=>{let[n]=(0,nr.useLexicalComposerContext)(),i=a=>{a.read(()=>{let l=a.toJSON();e?.(()=>l)})};return(0,qe.useEffect)(()=>{n.setEditable(r)},[r]),(0,qe.useEffect)(()=>{t&&n.update(()=>{n.setEditorState(n.parseEditorState(t))})},[]),(0,co.jsx)("div",{className:"w-full",children:(0,co.jsxs)("div",{className:" ",children:[r&&(0,co.jsx)(Gt,{}),(0,co.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,co.jsx)(ur.RichTextPlugin,{contentEditable:(0,co.jsx)(dr.ContentEditable,{name:o,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-co-40"}),ErrorBoundary:cr.LexicalErrorBoundary}),r&&(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)(mr.HistoryPlugin,{}),(0,co.jsx)(sr.AutoFocusPlugin,{}),(0,co.jsx)(pr.ListPlugin,{}),(0,co.jsx)(gr.OnChangePlugin,{onChange:i}),(0,co.jsx)(Bt,{})]})]})]})})},La=({setValue:e,value:t,name:o,editable:r=!0})=>(0,co.jsx)(lr.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[Nt.ListNode,Nt.ListItemNode,fr.HeadingNode,ct],onError(i){throw console.error("Lexical error:",i),i},theme:{code:"editor-code",heading:{h1:"text-4xl text-primary",h2:"text-3xl",h3:"text-2xl",h4:"text-lg",h5:"text-sm"},image:"editor-image",link:"editor-link",list:{listitem:"editor-listitem",nested:{listitem:"editor-nested-listitem"},ol:"list-decimal",ul:"list-disc"},ltr:"ltr",paragraph:"editor-paragraph",placeholder:"editor-placeholder",quote:"editor-quote",rtl:"rtl",text:{bold:"editor-text-bold font-bold",code:"editor-text-code",hashtag:"editor-text-hashtag",italic:"editor-text-italic italic",overflowed:"editor-text-overflowed",strikethrough:"editor-text-strikethrough line-through",underline:"editor-text-underline underline",underlineStrikethrough:"underline line-through"}}},children:(0,co.jsx)(Ea,{value:t,setValue:e,name:o,editable:r})}),St=La;function hr({document:e,onSave:t,mode:o="edit",onCancel:r,availableDocuments:n=[],knowledgeContexts:i=[]}){let[a,l]=(0,qe.useState)({...e,updatedAt:new Date}),[b,R]=(0,qe.useState)(!1),[N,m]=(0,qe.useState)(a.richTextContent),[P,S]=(0,qe.useState)(!1),w=(0,qe.useRef)(null),d=(0,qe.useRef)(""),s=(0,qe.useRef)(null),u=(0,qe.useRef)(null),v=f=>{let E=new WeakSet,I=X=>X&&typeof X=="object"?E.has(X)?null:(E.add(X),Array.isArray(X)?X.map(I):Object.keys(X).sort().reduce((oe,Ue)=>(oe[Ue]=I(X[Ue]),oe),{})):X;return JSON.stringify(I(f))},k=f=>f?f.replace(/\s+/g," ").trim():"",y=()=>a.format==="richText"?v(N):k(a.content),z=()=>{let f={title:k(a.title),description:k(a.description),format:a.format,content:y()},E=v(f),I=5381;for(let X=0;X<E.length;X++)I=I*33^E.charCodeAt(X);return(I>>>0).toString(16)},Z=(f,E)=>{if(f===E)return!1;if(a.format!=="richText"){let I=T(f),X=y();if(I==null)return!0;let oe=I.length,Ue=X.length,at=Math.abs(Ue-oe),gt=oe===0?1:at/oe;return k(I)===k(X)&&at<3?!1:at>=10||gt>=.02}return!0},_=(0,qe.useRef)(new Map),T=f=>{let E=_.current.get(f);return E==null?null:"x".repeat(E)};(0,qe.useEffect)(()=>(u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{let f=z(),E=d.current;if(Z(E,f)&&(S(!0),t({...a,richTextContent:N},"autosave"),d.current=f,a.format!=="richText")){let I=y();_.current.set(f,I.length)}},800),()=>{u.current&&clearTimeout(u.current)}),[a.title,a.description,a.format,a.content,a.metadata,N]),(0,qe.useEffect)(()=>{let f=()=>{let E=z();E!==d.current&&(t({...a,richTextContent:N},"autosave"),d.current=E)};return window.addEventListener("pagehide",f),window.addEventListener("beforeunload",f),()=>{window.removeEventListener("pagehide",f),window.removeEventListener("beforeunload",f)}},[a,N]),(0,qe.useEffect)(()=>(P&&(s.current=setTimeout(()=>{S(!1)},2e3)),()=>{s.current&&clearTimeout(s.current)}),[P]),(0,qe.useEffect)(()=>{l(e)},[e]);let J=f=>{switch(f){case"markdown":case"mdx":return(0,co.jsx)(Ce.FileText,{className:"co-6 w-6 text-primary"});case"richText":return(0,co.jsx)(Ce.File,{className:"co-6 w-6 text-success"});case"text":return(0,co.jsx)(Ce.Type,{className:"co-6 w-6 text-muted-foreground"});default:return(0,co.jsx)(Ce.File,{className:"co-6 w-6 text-muted-foreground"})}},j=f=>{switch(f){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},se=()=>{let f=new Set,E=new Set;return i.forEach(I=>{I.menuConfig.groupBy.forEach(X=>f.add(X))}),n.forEach(I=>{I.metadata&&Object.keys(I.metadata).forEach(X=>E.add(X))}),{contextKeys:Array.from(f).sort(),documentKeys:Array.from(E).sort(),allKeys:Array.from(new Set([...f,...E])).sort()}},K=f=>{let E=new Set;return n.forEach(I=>{I.metadata?.[f]&&E.add(String(I.metadata[f]))}),Array.from(E).sort()},pe=se(),Ne=()=>{t({...a,richTextContent:N},"autosave")},x=(f,E)=>{l(I=>({...I,metadata:{...I.metadata,[f]:E}}))},U=(f,E)=>{E==="__custom__"?x(f,""):x(f,E)},g=()=>{x("","")},de=f=>{l(E=>{let I={...E.metadata};return delete I[f],{...E,metadata:I}})};return(0,co.jsxs)(Je.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"co-screen flex flex-col",children:[(0,co.jsxs)("div",{className:"border-b border-border bg-card co-8 pb-6",children:[(0,co.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,co.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,co.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,co.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,co.jsx)("div",{className:"flex-1 min-w-0",children:(0,co.jsx)(Lt,{fieldName:"title",value:a.title,label:"",onSave:(f,E)=>l(I=>({...I,title:E})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:co-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-co-0"})}),(0,co.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${j(a.format)} flex-shrink-0 co-1`,children:a.format.toUpperCase()})]}),(0,co.jsx)("div",{className:"co-2",children:(0,co.jsx)(Lt,{fieldName:"description",value:a.description||"Click to add description...",label:"",multiline:!0,onSave:(f,E)=>l(I=>({...I,description:E})),className:"[&>div:last-child]:text-muted-foreground [&>div:last-child]:text-lg [&>div:last-child]:leading-relaxed [&>div:last-child]:co-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-co-0"})})]})}),(0,co.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,co.jsxs)(F,{variant:"ghost",size:"sm",onClick:()=>R(!b),className:"gap-2",children:[(0,co.jsx)(Ce.Info,{className:"co-4 w-4"}),"Metadata",a.metadata&&Object.keys(a.metadata).length>0&&(0,co.jsx)("span",{className:"inline-flex items-center justify-center w-5 co-5 text-xs font-medium bg-primary/10 text-primary rounded-full",children:Object.keys(a.metadata).length}),b?(0,co.jsx)(Ce.ChevronDown,{className:"co-4 w-4"}):(0,co.jsx)(Ce.ChevronRight,{className:"co-4 w-4"})]}),(0,co.jsxs)(F,{variant:"outline",size:"sm",onClick:r,className:"gap-2",children:[(0,co.jsx)(Ce.X,{className:"co-4 w-4"}),"Close"]}),(0,co.jsxs)(F,{size:"sm",onClick:Ne,className:"gap-2",disabled:P,children:[P?(0,co.jsx)(Ce.Loader2,{className:"co-4 w-4 animate-spin"}):(0,co.jsx)(Ce.Save,{className:"co-4 w-4"}),P?"Auto-saving...":"Save"]})]})]}),(0,co.jsx)(Je.motion.div,{initial:!1,animate:{height:b?"auto":0,opacity:b?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden co-full max-co-full",children:(0,co.jsxs)("div",{className:"pt-4 border-t border-border co-4 max-co-full flex gap-2",children:[(0,co.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,co.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,co.jsx)(Ce.Info,{className:"co-4 w-4"}),"Document Metadata"]})}),(0,co.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,co.jsx)("div",{className:"bg-muted rounded-lg co-4 border border-border",children:a.metadata&&Object.keys(a.metadata).length>0?(0,co.jsx)("div",{className:"space-y-2",children:Object.entries(a.metadata).map(([f,E],I)=>{let X=K(f);return(0,co.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,co.jsx)(Y,{value:f,onChange:oe=>{let Ue=oe.target.value||"",at=a.metadata?.[f];l(gt=>{let Pt={...gt.metadata};return delete Pt[f],Ue&&(Pt[Ue]=at||""),{...gt,metadata:Pt}})},placeholder:"Key",className:"w-32 co-8 text-sm",list:`metadata-keys-${f}`}),(0,co.jsx)("datalist",{id:`metadata-keys-${f}`,children:pe.allKeys.map(oe=>(0,co.jsx)("option",{value:oe},oe))}),(0,co.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),X.length>0?(0,co.jsxs)(je,{value:String(E||""),onValueChange:oe=>U(f,oe),children:[(0,co.jsx)(Oe,{className:"flex-1 co-8 text-sm",children:(0,co.jsx)(Ge,{placeholder:"Value"})}),(0,co.jsxs)(Be,{children:[X.map(oe=>(0,co.jsx)(ve,{value:oe,children:oe},oe)),(0,co.jsx)(ve,{value:"__custom__",children:(0,co.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,co.jsx)(Y,{value:String(E||""),onChange:oe=>x(f,oe.target.value),placeholder:"Value",className:"flex-1 co-8 text-sm"}),(0,co.jsx)(F,{type:"button",variant:"ghost",size:"sm",onClick:()=>de(f),className:"co-8 w-8 co-0 text-muted-foreground hover:text-destructive",children:(0,co.jsx)(Ce.X,{className:"co-3 w-3"})})]},`metadata-key-${I}`)})}):(0,co.jsxs)("div",{className:"text-center py-4",children:[(0,co.jsx)("co",{className:"text-sm text-muted-foreground mb-2",children:"No metadata fields"}),(0,co.jsx)("co",{className:"text-xs text-muted-foreground",children:'Click "Add Field" to create metadata'})]})}),(0,co.jsxs)(F,{type:"button",variant:"outline",size:"sm",onClick:g,className:"gap-1 co-8",children:[(0,co.jsx)(Ce.Plus,{className:"co-3 w-3"}),"Add Field"]})]})]})})]}),(0,co.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,co.jsx)("div",{className:"co-8 pt-0 co-full max-co-full overflow-auto",children:a.format==="richText"?(0,co.jsx)(St,{setValue:m,value:N,name:"richTextContent"}):(0,co.jsx)(Fe,{value:a.content||"",onChange:f=>l(E=>({...E,content:f.target.value})),placeholder:"Document content...",className:"min-co-[400px] font-mono text-sm",style:{resize:"vertical"}})})})]})}var wr=Q(require("react-markdown")),yr=Q(require("remark-gfm"));var Cr=e=>(0,co.jsx)(wr.default,{remarkPlugins:[yr.default],components:{h1:({children:t})=>(0,co.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,co.jsx)("h2",{className:"text-xl font-bold",children:t}),h3:({children:t})=>(0,co.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,co.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,co.jsx)("ol",{className:"list-decimal",children:t}),ul:({children:t})=>(0,co.jsx)("ul",{className:"list-disc",children:t}),li:({children:t})=>(0,co.jsx)("li",{className:"ml-4",children:t}),co:({children:t})=>(0,co.jsx)("co",{className:"mb-4",children:t}),a:({children:t,href:o})=>(0,co.jsx)("a",{href:o,className:"text-blue-500",children:t}),img:({src:t,alt:o})=>(0,co.jsx)("img",{src:t,alt:o,className:"mb-4"}),blockquote:({children:t})=>(0,co.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),vr=e=>(0,co.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),Ha=e=>(0,co.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:e&&(0,co.jsx)(St,{value:JSON.stringify(e),editable:!1,name:"richTextContent"},JSON.stringify(e))}),Ka=e=>(0,co.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,co.jsx)("div",{className:"bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg co-4 mb-4",children:(0,co.jsxs)("co",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,co.jsx)("strong",{children:"MDX Renderer:"})," This is a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),Cr(e)]});function Nr({document:e,onDocumentUpdate:t,editable:o=!0,mode:r="view",renderers:n,availableDocuments:i=[],knowledgeContexts:a=[]}){let[l,b]=(0,qe.useState)(!1),[R,N]=(0,qe.useState)(!1),[m,P]=(0,qe.useState)(e),[S,w]=(0,qe.useState)(!1),d=(0,qe.useRef)(null),s=m.format==="richText"?m.richTextContent:m.content,u=(0,qe.useMemo)(()=>`${m.format}:${JSON.stringify(s)}`,[m.format,s]);(0,qe.useEffect)(()=>{P(e)},[e]);let v=T=>{switch(T){case"markdown":case"mdx":return(0,co.jsx)(Ce.FileText,{className:"co-6 w-6 text-primary"});case"richText":return(0,co.jsx)(Ce.File,{className:"co-6 w-6 text-success"});case"text":return(0,co.jsx)(Ce.Type,{className:"co-6 w-6 text-muted-foreground"});default:return(0,co.jsx)(Ce.File,{className:"co-6 w-6 text-muted-foreground"})}},k=T=>{switch(T){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},y=(T,J)=>{let j={markdown:Cr,mdx:Ka,text:vr},se=n?.[J]||j[J];if(J==="richText"&&typeof T=="object")return Ha(T);if(se&&typeof T=="string")return se(T);if(typeof T=="string")return vr(T)},z=async(T,J="save")=>{J==="save"&&w(!0),d.current=m,(0,qe.startTransition)(()=>{P({...T,richTextContent:T.richTextContent?structuredClone(T.richTextContent):void 0})});try{let j=await t?.(T);if(J==="save"&&w(!1),!j)throw new Error("save failed")}catch{d.current&&(0,qe.startTransition)(()=>P(d.current))}},Z=()=>{b(!1)};return(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)(Re,{open:l||r==="create",onOpenChange:T=>!T&&Z(),children:(0,co.jsxs)(ht,{children:[(0,co.jsx)(lt,{}),(0,co.jsxs)(xr.Content,{className:M("fixed inset-0 z-50 bg-background co-0 m-0 border-0","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"),children:[S&&(0,co.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center",children:(0,co.jsx)(Ce.Loader2,{className:"co-8 w-8 animate-spin text-primary"})}),(0,co.jsx)(hr,{mode:r==="create"?"create":"edit",document:m,onSave:z,onCancel:Z,availableDocuments:i,knowledgeContexts:a})]})]})}),(0,co.jsxs)(Je.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"co-full flex flex-col",children:[(0,co.jsxs)("div",{className:"border-b border-border bg-card co-8 pb-6",children:[(0,co.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,co.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,co.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,co.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[m.title,(0,co.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${k(m.format)}`,children:m.format.toUpperCase()})]}),m.description&&(0,co.jsx)("co",{className:"text-muted-foreground text-lg leading-relaxed",children:m.description})]})}),(0,co.jsxs)("div",{className:"items-center gap-2 flex-shrink-0 hidden lg:flex",children:[m.metadata&&Object.keys(m.metadata).length>0&&(0,co.jsxs)(F,{variant:"ghost",size:"sm",onClick:()=>N(!R),className:"gap-2",children:[(0,co.jsx)(Ce.Info,{className:"co-4 w-4"}),"Metadata",R?(0,co.jsx)(Ce.ChevronDown,{className:"co-4 w-4"}):(0,co.jsx)(Ce.ChevronRight,{className:"co-4 w-4"})]}),o&&(0,co.jsxs)(F,{variant:"outline",size:"sm",onClick:()=>b(!0),className:"gap-2",children:[(0,co.jsx)(Ce.Edit3,{className:"co-4 w-4"}),"Edit"]})]})]}),m.metadata&&Object.keys(m.metadata).length>0&&(0,co.jsx)(Je.motion.div,{initial:!1,animate:{height:R?"auto":0,opacity:R?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,co.jsxs)("div",{className:"pt-4 border-t border-border co-4",children:[(0,co.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,co.jsx)(Ce.Info,{className:"co-4 w-4"}),"Document Metadata"]}),(0,co.jsx)("div",{className:"bg-muted rounded-lg co-4 border border-border",children:(0,co.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-2 text-sm",children:Object.entries(m.metadata).map(([T,J])=>(0,co.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,co.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:T.replace(/([co-Z])/g," $1").trim()}),(0,co.jsx)("span",{className:"text-foreground font-medium",children:String(J)})]},T))})})]})})]}),(0,co.jsx)("div",{className:"flex-1 ",children:(0,co.jsx)("div",{className:"py-4 co-full",children:(0,co.jsx)("div",{className:"space-y-4",children:m.content||m.richTextContent?(0,co.jsx)("div",{className:"relative",children:(0,co.jsx)("div",{className:"bg-background px-8 overflow-hidden co-full flex-1",children:y(m.format==="richText"?m.richTextContent:m.content,m.format)})},u):(0,co.jsxs)("div",{className:"text-center co-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,co.jsx)("div",{className:"w-16 co-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,co.jsx)(Ce.FileText,{className:"co-8 w-8 text-muted-foreground"})}),(0,co.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"No content available"}),(0,co.jsx)("co",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})]})}function Xt({label:e,documents:t,children:o,level:r,onDocumentClick:n,selectedDocumentId:i,showDocumentCount:a=!0}){let[l,b]=(0,qe.useState)(r===0),R=o&&Object.keys(o).length>0,N=t.length+(o?Object.values(o).reduce((S,w)=>S+w.documents.length,0):0),m=S=>{switch(S){case"markdown":case"mdx":return(0,co.jsx)(Ce.FileText,{className:"co-3.5 w-3.5 text-muted-foreground"});case"richText":return(0,co.jsx)(Ce.File,{className:"co-3.5 w-3.5 text-muted-foreground"});default:return(0,co.jsx)(Ce.File,{className:"co-3.5 w-3.5 text-muted-foreground"})}},P=S=>{let w=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return w[S%w.length]};return(0,co.jsxs)("div",{className:"space-y-1",children:[(R||t.length>0)&&(0,co.jsxs)(Je.motion.div,{className:`group flex items-center gap-3 co-3 rounded-xl cursor-pointer transition-all duration-200 ${l?"bg-card shadow-sm border border-border":"hover:bg-muted/50 hover:shadow-sm"}`,style:{marginLeft:`${r*20}px`},onClick:()=>b(!l),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,co.jsx)("div",{className:`w-1 co-6 rounded-full ${P(r)}`}),(0,co.jsx)(Je.motion.div,{animate:{rotate:l?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,co.jsx)(Ce.ChevronRight,{className:"co-4 w-4 text-muted-foreground"})}),(0,co.jsxs)("div",{className:"flex-1 flex items-center justify-between min-w-0",children:[(0,co.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,co.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),a&&N>0&&(0,co.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,co.jsx)("span",{className:"inline-flex items-center justify-center w-6 co-6 text-xs font-medium bg-muted text-muted-foreground rounded-full",children:N})})]})]}),(0,co.jsx)(Je.motion.div,{initial:!1,animate:{height:l?"auto":0,opacity:l?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,co.jsxs)("div",{className:"pt-2 space-y-1",children:[t.map((S,w)=>(0,co.jsxs)(Je.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:w*.05,duration:.2},className:`group flex items-center gap-3 co-2.5 mx-2 rounded-lg cursor-pointer transition-all duration-150 ${i===S.id?"bg-primary/10 border-l-2 border-primary shadow-sm":"hover:bg-muted/50 hover:translate-x-1"}`,style:{marginLeft:`${r*20+20}px`},onClick:()=>n?.(S),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,co.jsx)("div",{className:"flex-shrink-0",children:m(S.format)}),(0,co.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,co.jsx)("co",{className:`text-sm truncate transition-colors ${i===S.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:S.title}),S.description&&(0,co.jsx)("co",{className:"text-xs text-muted-foreground truncate co-0.5",children:S.description})]}),S.tags&&S.tags.length>0&&(0,co.jsx)("div",{className:"flex-shrink-0",children:(0,co.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-muted text-muted-foreground group-hover:bg-muted/80 transition-colors",children:S.tags[0]})})]},S.id)),o&&Object.entries(o).map(([S,w])=>(0,co.jsx)(Xt,{label:S,documents:w.documents,children:w.children,level:r+1,onDocumentClick:n,selectedDocumentId:i,showDocumentCount:a},S))]})})]})}function Sr({documents:e,menuConfig:t,onDocumentClick:o,onDocumentShare:r,onDocumentUpdate:n,selectedDocumentId:i,className:a,editable:l=!0}){let[b,R]=(0,qe.useState)(""),[N,m]=(0,qe.useState)(null),[P,S]=(0,qe.useState)(e);(0,qe.useEffect)(()=>{S(e)},[e]),(0,qe.useEffect)(()=>{if(N?.id){let u=P.find(v=>v.id===N.id);u&&m(u)}},[P]);let w=(0,qe.useMemo)(()=>b?P.filter(u=>u.title.toLowerCase().includes(b.toLowerCase())||u.description?.toLowerCase().includes(b.toLowerCase())||u.tags?.some(v=>v.toLowerCase().includes(b.toLowerCase()))||Object.values(u.metadata||{}).some(v=>String(v).toLowerCase().includes(b.toLowerCase()))):P,[P,b]),d=(0,qe.useMemo)(()=>{let u=(v,k)=>{if(k.length===0)return{};let[y,...z]=k;return v.reduce((_,T)=>{let J=T.metadata?.[y]||"Uncategorized",j=String(J);if(_[j]||(_[j]={documents:[],children:{}}),z.length===0)_[j].documents.push(T);else{let se=u([T],z),K=Object.keys(se)[0];K&&(_[j].children||(_[j].children={}),_[j].children[K]?_[j].children[K].documents.push(...se[K].documents):_[j].children[K]=se[K])}return _},{})};return u(w,t.groupBy)},[w,t.groupBy]),s=u=>{m(u),o?.(u)};return(0,co.jsxs)("div",{className:`flex co-full ${a||""}`,children:[(0,co.jsxs)("div",{className:"w-1/3 border-r border-border bg-muted/20",children:[(0,co.jsx)("div",{className:"co-6 border-b border-border",children:(0,co.jsxs)("div",{className:"relative",children:[(0,co.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,co.jsx)(Ce.Search,{className:"co-4 w-4 text-muted-foreground"})}),(0,co.jsx)(Y,{placeholder:"Search knowledge base...",value:b,onChange:u=>R(u.target.value),className:"pl-10 bg-background/80 border-border focus:border-primary/50 focus:ring-primary/20 rounded-xl co-11 text-sm placeholder:text-muted-foreground"})]})}),(0,co.jsx)(et,{className:"co-[calc(100%-100px)]",children:(0,co.jsx)("div",{className:"co-4 space-y-3",children:t.groupBy.length===0?(0,co.jsx)(co.Fragment,{children:(0,co.jsx)(Xt,{label:"Document",documents:w,level:0,onDocumentClick:s,selectedDocumentId:i,showDocumentCount:t.showDocumentCount},"Document")}):(0,co.jsxs)(co.Fragment,{children:[Object.entries(d).map(([u,v])=>(0,co.jsx)(Xt,{label:u,documents:v.documents,children:v.children,level:0,onDocumentClick:s,selectedDocumentId:i,showDocumentCount:t.showDocumentCount},u)),Object.keys(d).length===0&&(0,co.jsxs)(Je.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,co.jsx)("div",{className:"w-16 co-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,co.jsx)(Ce.FileText,{className:"co-8 w-8 text-muted-foreground"})}),(0,co.jsx)("co",{className:"text-sm font-medium",children:"No documents found"}),(0,co.jsx)("co",{className:"text-xs co-1",children:"Try adjusting your search terms"})]})]})})})]}),(0,co.jsx)("div",{className:"flex-1 bg-background overflow-scroll",children:N?(0,co.jsx)(Nr,{document:N,onDocumentUpdate:n,editable:l}):(0,co.jsx)("div",{className:"co-full flex items-center justify-center text-center",children:(0,co.jsxs)(Je.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-w-sm",children:[(0,co.jsx)("div",{className:"w-20 co-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,co.jsx)(Ce.FileText,{className:"co-10 w-10 text-primary"})}),(0,co.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Select a document"}),(0,co.jsx)("co",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}var ft=Q(require("@radix-ui/react-checkbox")),Rr=Q(require("react")),qt=Rr.forwardRef(({className:e,...t},o)=>(0,co.jsx)(ft.Root,{className:M("peer co-4 w-4 shrink-0 rounded border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),ref:o,...t,children:(0,co.jsx)(ft.Indicator,{className:M("flex items-center justify-center text-current"),children:(0,co.jsx)(Ce.Check,{className:"co-4 w-4"})})}));qt.displayName=ft.Root.displayName;var kr=({isOpen:e,onClose:t,onAddKnowledge:o,knowledgeContexts:r})=>{let n=()=>{let d=new Set;return r.forEach(s=>{s.menuConfig.groupBy.forEach(u=>d.add(u))}),{contextKeys:Array.from(d).sort(),allKeys:Array.from(d).sort()}},[i,a]=(0,qe.useState)(()=>{let d=n();return{name:"",description:"",metadata:d.contextKeys.length>0?d.contextKeys.map(s=>({key:s,value:""})):[{key:"",value:""}]}}),l=d=>{if(d.preventDefault(),!i.name)return;let s=i.metadata.filter(v=>v.key&&v.key.trim()&&v.value&&v.value.trim());o({name:i.name,description:i.description,metadata:s,source:"payload",visibility:"public",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()});let u=n();a({name:"",description:"",metadata:u.contextKeys.length>0?u.contextKeys.map(v=>({key:v,value:""})):[{key:"",value:""}]}),t()},b=()=>{let d=n();a({name:"",description:"",metadata:d.contextKeys.length>0?d.contextKeys.map(s=>({key:s,value:""})):[{key:"",value:""}]}),t()},R=n(),N=d=>{let s=new Set;return Array.from(s).sort()},m=(d,s)=>{a(u=>{let v=u.metadata.find(k=>k.key===d);return v&&(v.value=s),{...u,metadata:[...u.metadata.filter(k=>k.key!==d),{key:d,value:s}]}})},P=(d,s)=>{s==="__custom__"?m(d,""):m(d,s)},S=()=>{m(" ","")},w=d=>{a(s=>{let u=[...s.metadata],v=u.findIndex(k=>k.key===d);return v!==-1&&u.splice(v,1),{...s,metadata:u}})};return(0,co.jsx)(Re,{open:e,onOpenChange:b,children:(0,co.jsxs)(Ee,{className:"sm:max-w-md",children:[(0,co.jsx)(Le,{children:(0,co.jsx)(He,{children:"Add New Knowledge source"})}),(0,co.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,co.jsxs)("div",{className:"space-y-2",children:[(0,co.jsxs)("div",{children:[(0,co.jsx)(me,{htmlFor:"name",children:"Name *"}),(0,co.jsx)(Y,{id:"name",value:i.name,onChange:d=>a(s=>({...s,name:d.target.value})),required:!0})]}),(0,co.jsxs)("div",{children:[(0,co.jsx)(me,{htmlFor:"name",children:"Description"}),(0,co.jsx)(Y,{id:"name",value:i.description,onChange:d=>a(s=>({...s,description:d.target.value})),required:!0})]}),(0,co.jsxs)("div",{className:"space-y-2",children:[(0,co.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,co.jsxs)("div",{children:[(0,co.jsx)(me,{htmlFor:"metadata",children:"Metadata"}),R.contextKeys.length>0?(0,co.jsxs)("co",{className:"text-xs text-muted-foreground",children:["Context keys: ",R.contextKeys.slice(0,4).join(", "),R.contextKeys.length>4&&` +${R.contextKeys.length-4} more`," ","\u2022 Fill in values or add more fields"]}):(0,co.jsx)("co",{className:"text-xs text-muted-foreground",children:"Add key-value metadata to organize and categorize your knowledge"})]}),(0,co.jsxs)(F,{type:"button",variant:"outline",size:"sm",onClick:S,className:"gap-1 co-8",children:[(0,co.jsx)(Ce.Plus,{className:"co-3 w-3"}),"Add"]})]}),(0,co.jsx)("div",{className:"space-y-2",children:i.metadata.map(({key:d,value:s},u)=>{let v=N(d);return(0,co.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,co.jsx)(Y,{value:d,onChange:k=>{let y=k.target.value||" ",z=i.metadata.find(Z=>Z.key===d)?.value;a(Z=>{let _=[...Z.metadata],T=_.findIndex(J=>J.key===d);return T!==-1&&_.splice(T,1),y&&_.push({key:y,value:z||""}),{...Z,metadata:_}}),k.target.focus()},placeholder:R.allKeys.length>0?`e.g., ${R.allKeys[0]}`:"Key",className:"w-32 co-8 text-sm",list:`metadata-keys-${d}`}),(0,co.jsx)("datalist",{id:`metadata-keys-${d}`,children:R.allKeys.map(k=>(0,co.jsx)("option",{value:k},k))}),(0,co.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),v.length>0?(0,co.jsxs)(je,{value:String(s||""),onValueChange:k=>P(d,k),children:[(0,co.jsx)(Oe,{className:"flex-1 co-8 text-sm",children:(0,co.jsx)(Ge,{placeholder:"Value"})}),(0,co.jsxs)(Be,{children:[v.map(k=>(0,co.jsx)(ve,{value:k,children:k},k)),(0,co.jsx)(ve,{value:"__custom__",children:(0,co.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,co.jsx)(Y,{value:String(s||""),onChange:k=>m(d,k.target.value),placeholder:"Value",className:"flex-1 co-8 text-sm"}),(0,co.jsx)(F,{type:"button",variant:"ghost",size:"sm",onClick:()=>w(d),className:"co-8 w-8 co-0 text-muted-foreground hover:text-destructive",children:(0,co.jsx)(Ce.X,{className:"co-3 w-3"})})]},`metadata-key-${u}`)})})]})]}),(0,co.jsxs)("div",{className:"flex justify-end gap-3 pt-4",children:[(0,co.jsxs)(F,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,co.jsx)(Ce.X,{className:"co-4 w-4"}),"Cancel"]}),(0,co.jsxs)(F,{type:"submit",children:[(0,co.jsx)(Ce.Save,{className:"co-4 w-4"}),"Create"]})]})]})]})})};var rt=require("sonner");var Mr=({isOpen:e,onClose:t,knowledgeSources:o,onCreate:r,onUpdate:n,onDelete:i})=>{let[a,l]=(0,qe.useState)(""),[b,R]=(0,qe.useState)(null),[N,m]=(0,qe.useState)(""),[P,S]=(0,qe.useState)(""),[w,d]=(0,qe.useState)([]),[s,u]=(0,qe.useState)(""),[v,k]=(0,qe.useState)("name"),[y,z]=(0,qe.useState)("asc"),[Z,_]=(0,qe.useState)(!0),T=o.filter(g=>g.label.toLowerCase().includes(a.toLowerCase())||g.description?.toLowerCase().includes(a.toLowerCase())),J=g=>{R(g),m(g.label),S(g.description||""),d(g.menuConfig?.groupBy||[]),k(g.menuConfig?.sortBy||"name"),z(g.menuConfig?.sortOrder||"asc"),_(g.menuConfig?.showDocumentCount||!0)},j=()=>{s.trim()&&!w.includes(s.trim())&&(d([...w,s.trim()]),u(""))},se=g=>{d(w.filter(de=>de!==g))},K=g=>{g.key==="Enter"&&(g.preventDefault(),j())},pe=()=>{R(null),m(""),S(""),d([]),u(""),k("name"),z("asc"),_(!0)},Ne=()=>{if(!N.trim()){rt.toast.error("Label is required");return}r?.({id:N.trim(),label:N.trim(),description:P.trim(),menuConfig:{groupBy:w,sortBy:v,sortOrder:y,showDocumentCount:Z}}),rt.toast.success("Knowledge source created successfully"),pe()},x=()=>{if(b){if(!N.trim()){rt.toast.error("Label is required");return}n?.({id:b.id,label:N.trim(),description:P.trim(),menuConfig:{groupBy:w,sortBy:v,sortOrder:y,showDocumentCount:Z}}),rt.toast.success("Knowledge source updated successfully"),pe()}},U=()=>{b&&window.confirm(`Are you sure you want to delete "${b.label}"?`)&&(i?.(b.id),rt.toast.success("Knowledge source deleted successfully"),pe())};return(0,co.jsx)(Re,{open:e,onOpenChange:t,children:(0,co.jsxs)(Ee,{className:"sm:max-w-[900px] max-co-[90vh] bg-card border-border co-0",children:[(0,co.jsx)(Le,{className:"px-6 pt-6 pb-4 border-b border-border",children:(0,co.jsx)(He,{className:"text-foreground text-2xl",children:"Manage Knowledge Sources"})}),(0,co.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 co-6 overflow-hidden",children:[(0,co.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,co.jsxs)("div",{className:"relative",children:[(0,co.jsx)(Ce.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 co-4 w-4 text-muted-foreground"}),(0,co.jsx)(Y,{value:a,onChange:g=>l(g.target.value),placeholder:"Search contexts...",className:"pl-10 bg-background border-input"})]}),(0,co.jsx)(et,{className:"rounded-md border border-border bg-background flex-1",children:(0,co.jsx)("div",{className:"co-2 space-y-2",children:T.length===0?(0,co.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[(0,co.jsx)(Ce.FileText,{className:"co-12 w-12 text-muted-foreground mb-2"}),(0,co.jsx)("co",{className:"text-sm text-muted-foreground",children:a?"No contexts found":"No contexts yet"})]}):T.map(g=>(0,co.jsx)("div",{onClick:()=>J(g),className:M("co-3 rounded-lg cursor-pointer transition-all hover:bg-accent/50",b?.id===g.id&&"bg-accent text-accent-foreground"),children:(0,co.jsx)("div",{className:"flex items-start justify-between gap-2",children:(0,co.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,co.jsx)("h4",{className:"font-medium truncate",children:g.label}),g.description&&(0,co.jsx)("co",{className:"text-sm opacity-80 truncate co-1",children:g.description}),(g.menuConfig?.groupBy||[]).length>0&&(0,co.jsxs)("div",{className:"flex flex-wrap gap-1 co-2",children:[g.menuConfig?.groupBy?.slice(0,3).map(de=>(0,co.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-secondary text-secondary-foreground",children:de},de)),(g.menuConfig?.groupBy||[]).length>3&&(0,co.jsxs)("span",{className:"text-xs px-2 py-0.5",children:["+",(g.menuConfig?.groupBy||[]).length-3]})]})]})})},g.id))})}),(0,co.jsx)(F,{variant:"outline",onClick:pe,className:"w-full",children:"Clear Selection / New Context"})]}),(0,co.jsxs)("div",{className:"space-y-4",children:[(0,co.jsx)(et,{className:"co-[400px] pr-4",children:(0,co.jsxs)("div",{className:"space-y-4",children:[(0,co.jsxs)("div",{className:"space-y-2",children:[(0,co.jsxs)(me,{htmlFor:"label",className:"text-foreground",children:["Label ",(0,co.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,co.jsx)(Y,{id:"label",value:N,onChange:g=>m(g.target.value),placeholder:"Enter label",className:"bg-background border-input"})]}),(0,co.jsxs)("div",{className:"space-y-2",children:[(0,co.jsx)(me,{htmlFor:"description",className:"text-foreground",children:"Description"}),(0,co.jsx)(Fe,{id:"description",value:P,onChange:g=>S(g.target.value),placeholder:"Enter description",className:"bg-background border-input resize-none",rows:3})]}),(0,co.jsxs)("div",{className:"space-y-2",children:[(0,co.jsx)(me,{className:"text-foreground",children:"Group By"}),(0,co.jsxs)("div",{className:"flex gap-2",children:[(0,co.jsx)(Y,{value:s,onChange:g=>u(g.target.value),onKeyPress:K,placeholder:"Type a tag and press Enter",className:"bg-background border-input flex-1"}),(0,co.jsx)(F,{onClick:j,className:"bg-accent hover:bg-accent/90",children:"Add"})]}),w.length>0&&(0,co.jsx)("div",{className:"flex flex-wrap gap-2 co-2",children:w.map(g=>(0,co.jsxs)("div",{className:"bg-secondary text-secondary-foreground px-3 py-1 rounded-md flex items-center gap-2 text-sm",children:[g,(0,co.jsx)(Ce.X,{className:"co-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>se(g)})]},g))})]}),(0,co.jsxs)("div",{className:"space-y-2",children:[(0,co.jsx)(me,{htmlFor:"sortBy",className:"text-foreground",children:"Sort By"}),(0,co.jsxs)(je,{value:v,onValueChange:g=>k(g),children:[(0,co.jsx)(Oe,{className:"bg-background border-input",children:(0,co.jsx)(Ge,{})}),(0,co.jsxs)(Be,{className:"bg-popover border-border",children:[(0,co.jsx)(ve,{value:"name",children:"Name"}),(0,co.jsx)(ve,{value:"createdAt",children:"Created At"})]})]})]}),(0,co.jsxs)("div",{className:"space-y-2",children:[(0,co.jsx)(me,{htmlFor:"sortOrder",className:"text-foreground",children:"Sort Order"}),(0,co.jsxs)(je,{value:y,onValueChange:g=>z(g),children:[(0,co.jsx)(Oe,{className:"bg-background border-input",children:(0,co.jsx)(Ge,{})}),(0,co.jsxs)(Be,{className:"bg-popover border-border",children:[(0,co.jsx)(ve,{value:"asc",children:"Ascending"}),(0,co.jsx)(ve,{value:"desc",children:"Descending"})]})]})]}),(0,co.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,co.jsx)(qt,{id:"showDocumentCount",checked:Z,onCheckedChange:g=>_(g)}),(0,co.jsx)(me,{htmlFor:"showDocumentCount",className:"text-sm font-normal cursor-pointer text-foreground",children:"Show Document Count"})]})]})}),(0,co.jsx)("div",{className:"flex gap-3 pt-4 border-t border-border",children:b?(0,co.jsxs)(co.Fragment,{children:[(0,co.jsxs)(F,{variant:"destructive",onClick:U,className:"flex-1",children:[(0,co.jsx)(Ce.Trash2,{className:"mr-2 co-4 w-4"}),"Delete"]}),(0,co.jsx)(F,{onClick:x,className:"flex-1 bg-accent hover:bg-accent/90",children:"Update"})]}):(0,co.jsx)(F,{onClick:Ne,className:"w-full bg-accent hover:bg-accent/90",children:"Create"})})]})]}),(0,co.jsx)("div",{className:"px-6 py-4 border-t border-border flex justify-end",children:(0,co.jsx)(F,{variant:"outline",onClick:t,children:"Close"})})]})})};function Tr({documents:e=[],contexts:t=[],onDocumentClick:o=m=>console.log("Document clicked:",m),onDocumentShare:r=m=>console.log("Share document:",m),onLoadDocumentContent:n,selectedDocumentId:i,onAddKnowledge:a,onDocumentUpdate:l,onAddTeamContext:b,onUpdateTeamContext:R,onDeleteTeamContext:N}){let[m,P]=(0,qe.useState)(t[0]),[S,w]=(0,qe.useState)(!1),[d,s]=(0,qe.useState)(!1),[u,v]=(0,qe.useState)(!1);(0,qe.useEffect)(()=>{if(!m&&t&&t.length>0)P(t[0]);else{let y=t.find(z=>z.id===m?.id);P(y||t[0])}},[t]);let k=y=>{a&&(v(!0),a(y)),w(!1)};return(0,co.jsxs)("div",{className:"flex flex-col co-full",children:[(0,co.jsxs)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:[u&&(0,co.jsxs)("div",{className:"absolute inset-0 bg-background/90 z-[9999] flex flex-col items-center justify-center gap-4",children:[(0,co.jsx)(Ce.Loader2,{className:"co-8 w-8 animate-spin text-primary"}),(0,co.jsx)("co",{className:"font-semibold text-lg",children:"Initializing document..."})]}),t&&t.length>0&&(0,co.jsxs)("div",{className:"",children:[(0,co.jsx)("div",{className:"",children:(0,co.jsxs)("nav",{className:"-mb-px flex justify-between items-center",children:[(0,co.jsx)("div",{className:"flex space-x-8 overflow-x-auto",children:t.map(y=>(0,co.jsxs)("button",{onClick:()=>P(y),className:`group inline-flex items-center gap-2 py-3 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${m?.id===y.id?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"}`,children:[y.icon,y.label]},y.id))}),(0,co.jsxs)(We,{children:[(0,co.jsx)(Ze,{children:(0,co.jsxs)("div",{className:"inline-flex border border-primary rounded-xl items-center justify-center gap-2 py-2 px-3 text-sm font-medium text-primary hover:text-primary/80 transition-colors whitespace-nowrap",children:["Actions ",(0,co.jsx)(Ce.ChevronDown,{className:"co-4 w-4"})]})}),(0,co.jsxs)(ze,{children:[(0,co.jsx)(Me,{onClick:()=>w(!0),children:"Add Knowledge"}),(0,co.jsx)(Me,{onClick:()=>s(!0),children:"Manage Contexts"})]})]})]})}),m?.description&&(0,co.jsx)("div",{className:"co-3 px-1",children:(0,co.jsx)("co",{className:"text-sm text-primary",children:m?.description})})]})]}),m?(0,co.jsx)("div",{className:"flex-1 min-co-0 px-2 md:px-4 pb-4",children:(0,co.jsx)("div",{className:"co-full rounded-xl border overflow-hidden",children:(0,co.jsx)(Sr,{documents:e,menuConfig:m?.menuConfig,onDocumentClick:o,onDocumentShare:r,selectedDocumentId:i,onDocumentUpdate:l})})}):(0,co.jsxs)("div",{children:[(0,co.jsx)("div",{className:"flex-1 min-co-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,co.jsx)("co",{className:"text-muted-foreground",children:"No contexts available"})}),(0,co.jsx)("div",{className:"flex-1 min-co-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,co.jsx)(F,{onClick:()=>s(!0),children:"Add Context"})})]}),(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)(Mr,{isOpen:d,onClose:()=>s(!1),knowledgeSources:t,onCreate:b,onUpdate:R,onDelete:N}),(0,co.jsx)(kr,{isOpen:S,onClose:()=>w(!1),onAddKnowledge:k,knowledgeContexts:t})]})]})}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";import{a}from"../../../chunk-
|
|
2
|
+
"use strict";import{a}from"../../../chunk-TSFX33PR.mjs";import"../../../chunk-I6XKBCH4.mjs";import"../../../chunk-WLI2YTOQ.mjs";import"../../../chunk-GZ7FGBTR.mjs";import"../../../chunk-XJKRA2AE.mjs";import"../../../chunk-JTMIQ7MK.mjs";import"../../../chunk-PZFYJ5FS.mjs";import"../../../chunk-LEUI66J6.mjs";import"../../../chunk-HFEN3KJC.mjs";import"../../../chunk-L2UJOICL.mjs";import"../../../chunk-T3F3RQIC.mjs";import"../../../chunk-UP67R64J.mjs";import"../../../chunk-6QERRKM4.mjs";import"../../../chunk-VSU7LYXZ.mjs";import"../../../chunk-RKS7CWAP.mjs";import"../../../chunk-BZEGLKRZ.mjs";import"../../../chunk-K7N3FRGH.mjs";import"../../../chunk-IPRG56MW.mjs";import"../../../chunk-DFIXTV2M.mjs";import"../../../chunk-Q5Q3DJWU.mjs";import"../../../chunk-U5PBLRRV.mjs";import"../../../chunk-4QRKVSTE.mjs";import"../../../chunk-E4TE4NV6.mjs";import"../../../chunk-JFFTEK6Z.mjs";import"../../../chunk-JHNVX4UB.mjs";import"../../../chunk-7BXIU4ZM.mjs";import"../../../chunk-YFAZQYK4.mjs";import"../../../chunk-INCYANPB.mjs";import"../../../chunk-B4H6T2GP.mjs";import"../../../chunk-TVZOULLL.mjs";import"../../../chunk-RLVKIMGU.mjs";import"../../../chunk-OCPX4QPC.mjs";import"../../../chunk-FT3AE7L2.mjs";import"../../../chunk-76M7JE4D.mjs";import"../../../chunk-3UMMMQEH.mjs";import"../../../chunk-OYZDAMCS.mjs";import"../../../chunk-5NRGSTPV.mjs";import"../../../chunk-ZFUP5NVF.mjs";import"../../../chunk-4UIARERB.mjs";import"../../../chunk-D4IMQTVU.mjs";import"../../../chunk-7GSXNSLD.mjs";import"../../../chunk-YNCJATT7.mjs";import"../../../chunk-L5JPAKPM.mjs";import"../../../chunk-KY7WQYN4.mjs";import"../../../chunk-ZUA4KNIR.mjs";import"../../../chunk-SOLZ4VQH.mjs";import"../../../chunk-CSBGSBEU.mjs";import"../../../chunk-YO3GQYRJ.mjs";import"../../../chunk-QTW33JYG.mjs";import"../../../chunk-MDJREBVI.mjs";import"../../../chunk-ZWHGOTSF.mjs";import"../../../chunk-Q3G5UAAD.mjs";import"../../../chunk-XGRRLABA.mjs";import"../../../chunk-FRWX5YES.mjs";import"../../../chunk-CV7PH2KH.mjs";import"../../../chunk-YEKQJ4YC.mjs";export{a as default};
|