cortex-react-components 2.23.0 → 2.23.1

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.
Files changed (111) hide show
  1. package/dist/{chunk-SCBDVNHG.mjs → chunk-AF3FLXBA.mjs} +1 -1
  2. package/dist/{chunk-WVSUPHRY.mjs → chunk-AHMDJQZI.mjs} +1 -1
  3. package/dist/{chunk-ZEPEWKBV.mjs → chunk-B7AXSCTN.mjs} +1 -1
  4. package/dist/{chunk-Q2QAFOWG.mjs → chunk-CQAMS7RZ.mjs} +1 -1
  5. package/dist/{chunk-THOBCTIL.mjs → chunk-GZ7FGBTR.mjs} +1 -1
  6. package/dist/{chunk-LJOWXPWW.mjs → chunk-I2GNNRFH.mjs} +1 -1
  7. package/dist/{chunk-NGL6K2L5.mjs → chunk-IAFKJKBN.mjs} +1 -1
  8. package/dist/{chunk-GPFPTU7U.mjs → chunk-INBT5E6T.mjs} +1 -1
  9. package/dist/chunk-JTMIQ7MK.mjs +4 -0
  10. package/dist/{chunk-RQLUMNJE.mjs → chunk-L5NPH5RX.mjs} +1 -1
  11. package/dist/{chunk-S7MFNEEY.mjs → chunk-OWC4BAX6.mjs} +1 -1
  12. package/dist/{chunk-HSQAHQNP.mjs → chunk-TKCFCYEQ.mjs} +1 -1
  13. package/dist/{chunk-HTMQGMYL.mjs → chunk-TSFX33PR.mjs} +1 -1
  14. package/dist/{chunk-AGDKFAMN.mjs → chunk-UECG3SCG.mjs} +1 -1
  15. package/dist/{chunk-UTJZH3X5.mjs → chunk-W4OD5UUE.mjs} +1 -1
  16. package/dist/{chunk-QKOBOCKK.mjs → chunk-XJKRA2AE.mjs} +1 -1
  17. package/dist/{chunk-CBIULUZQ.mjs → chunk-XKGBG5FX.mjs} +1 -1
  18. package/dist/components/Blocks/Banner.mjs +1 -1
  19. package/dist/components/Blocks/CallToAction.mjs +1 -1
  20. package/dist/components/Blocks/CollapsibleArea.mjs +1 -1
  21. package/dist/components/Blocks/Content.mjs +1 -1
  22. package/dist/components/Blocks/FeaturesBlock.mjs +1 -1
  23. package/dist/components/Blocks/RelatedPosts.mjs +1 -1
  24. package/dist/components/Blocks/RenderBlocks.mjs +1 -1
  25. package/dist/components/Blocks/ReusableContentBlock.mjs +1 -1
  26. package/dist/components/Blocks/index.mjs +1 -1
  27. package/dist/components/CRM/index.mjs +1 -1
  28. package/dist/components/Cards/ContentCard.mjs +1 -1
  29. package/dist/components/Cards/FeatureCard.mjs +1 -1
  30. package/dist/components/Cards/index.mjs +1 -1
  31. package/dist/components/Chat/ChatInterface.mjs +1 -1
  32. package/dist/components/Chat/CopilotInterface.mjs +1 -1
  33. package/dist/components/Chat/PartTypes/MessageHandler.mjs +1 -1
  34. package/dist/components/Chat/PartTypes/index.mjs +1 -1
  35. package/dist/components/Chat/demo-long-messages.mjs +1 -1
  36. package/dist/components/Chat/demo-tests.mjs +1 -1
  37. package/dist/components/Chat/demo.mjs +1 -1
  38. package/dist/components/Chat/example-usage.mjs +1 -1
  39. package/dist/components/Chat/example-with-vercel-ai.mjs +1 -1
  40. package/dist/components/Chat/index.mjs +1 -1
  41. package/dist/components/DigitalColleagues/MainPage.mjs +1 -1
  42. package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +1 -1
  43. package/dist/components/DigitalColleagues/Views/index.mjs +1 -1
  44. package/dist/components/DigitalColleagues/index.mjs +1 -1
  45. package/dist/components/Foundary/MainPage.mjs +1 -1
  46. package/dist/components/Foundary/Pages/dashboardpage.js +1 -1
  47. package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
  48. package/dist/components/Foundary/Views/ColleaguesView.mjs +1 -1
  49. package/dist/components/Foundary/Views/KnowledgeView.js +1 -1
  50. package/dist/components/Foundary/Views/KnowledgeView.mjs +1 -1
  51. package/dist/components/Foundary/Views/index.js +1 -1
  52. package/dist/components/Foundary/Views/index.mjs +1 -1
  53. package/dist/components/Foundary/document-edit.js +1 -1
  54. package/dist/components/Foundary/document-edit.mjs +1 -1
  55. package/dist/components/Foundary/document-preview-examples.js +4 -4
  56. package/dist/components/Foundary/document-preview-examples.mjs +1 -1
  57. package/dist/components/Foundary/document-preview.js +1 -1
  58. package/dist/components/Foundary/document-preview.mjs +1 -1
  59. package/dist/components/Foundary/index.js +1 -1
  60. package/dist/components/Foundary/index.mjs +1 -1
  61. package/dist/components/Foundary/knowledge-browser.js +1 -1
  62. package/dist/components/Foundary/knowledge-browser.mjs +1 -1
  63. package/dist/components/HeaderFooter/SectionHeading.mjs +1 -1
  64. package/dist/components/HeaderFooter/VideoHeader.mjs +1 -1
  65. package/dist/components/HeaderFooter/index.mjs +1 -1
  66. package/dist/components/Heros/HighImpact/index.mjs +1 -1
  67. package/dist/components/Heros/LowImpact/index.mjs +1 -1
  68. package/dist/components/Heros/MediumImpact/index.mjs +1 -1
  69. package/dist/components/Heros/RenderHero.mjs +1 -1
  70. package/dist/components/Heros/SectionHero/index.mjs +1 -1
  71. package/dist/components/Heros/index.mjs +1 -1
  72. package/dist/components/Layouts/OutputHeaderFooter.mjs +1 -1
  73. package/dist/components/Layouts/Print.mjs +1 -1
  74. package/dist/components/Layouts/SlideShow.mjs +1 -1
  75. package/dist/components/Layouts/index.mjs +1 -1
  76. package/dist/components/Other/index.mjs +1 -1
  77. package/dist/components/Payload/RichText/index.mjs +1 -1
  78. package/dist/components/Payload/RichText/serialize.mjs +1 -1
  79. package/dist/components/Payload/index.mjs +1 -1
  80. package/dist/components/Projects/KanbanBoardView.mjs +1 -1
  81. package/dist/components/Projects/ProjectPage.mjs +1 -1
  82. package/dist/components/Projects/ProjectView.mjs +1 -1
  83. package/dist/components/Projects/ProjectsIndexView.mjs +1 -1
  84. package/dist/components/Projects/index.mjs +1 -1
  85. package/dist/components/dc-temp/index.mjs +1 -1
  86. package/dist/components/index.js +8 -8
  87. package/dist/components/index.mjs +1 -1
  88. package/dist/index.js +11 -11
  89. package/dist/index.mjs +1 -1
  90. package/dist/metafile-cjs.json +1 -1
  91. package/dist/metafile-esm.json +1 -1
  92. package/dist/pages/Blog.mjs +1 -1
  93. package/dist/pages/Documentation.mjs +1 -1
  94. package/dist/pages/IndexPage.mjs +1 -1
  95. package/dist/pages/Intranet.mjs +1 -1
  96. package/dist/pages/LandingPage.mjs +1 -1
  97. package/dist/pages/Page.mjs +1 -1
  98. package/dist/pages/Publish.mjs +1 -1
  99. package/dist/pages/Website.mjs +1 -1
  100. package/dist/sections/AboutSection.mjs +1 -1
  101. package/dist/sections/BlogDetail.mjs +1 -1
  102. package/dist/sections/BlogList.mjs +1 -1
  103. package/dist/sections/ContactSection.mjs +1 -1
  104. package/dist/sections/PageSections.mjs +1 -1
  105. package/dist/sections/PricingSection.mjs +1 -1
  106. package/dist/sections/ServiceDetail.mjs +1 -1
  107. package/dist/sections/ServiceDetailSection.mjs +1 -1
  108. package/dist/sections/ServiceSection.mjs +1 -1
  109. package/dist/sections/index.mjs +1 -1
  110. package/package.json +1 -1
  111. 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 Go=Object.create;var Fe=Object.defineProperty;var jo=Object.getOwnPropertyDescriptor;var Zo=Object.getOwnPropertyNames;var Jo=Object.getPrototypeOf,Xo=Object.prototype.hasOwnProperty;var qo=(e,t)=>{for(var o in t)Fe(e,o,{get:t[o],enumerable:!0})},kt=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Zo(t))!Xo.call(e,a)&&a!==o&&Fe(e,a,{get:()=>t[a],enumerable:!(r=jo(t,a))||r.enumerable});return e};var Y=(e,t,o)=>(o=e!=null?Go(Jo(e)):{},kt(t||!e||!e.__esModule?Fe(o,"default",{value:e,enumerable:!0}):o,e)),Yo=e=>kt(Fe({},"__esModule",{value:!0}),e);var dn={};qo(dn,{DocumentPreview:()=>cn});module.exports=Yo(dn);var Tt=require("motion/react"),J=require("lucide-react"),oe=require("react");var _t=require("clsx");var nt="-",Qo=e=>{let t=tr(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:n=>{let l=n.split(nt);return l[0]===""&&l.length!==1&&l.shift(),Ht(l,t)||er(n)},getConflictingClassGroupIds:(n,l)=>{let v=o[n]||[];return l&&r[n]?[...v,...r[n]]:v}}},Ht=(e,t)=>{if(e.length===0)return t.classGroupId;let o=e[0],r=t.nextPart.get(o),a=r?Ht(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;let i=e.join(nt);return t.validators.find(({validator:n})=>n(i))?.classGroupId},Et=/^\[(.+)\]$/,er=e=>{if(Et.test(e)){let t=Et.exec(e)[1],o=t?.substring(0,t.indexOf(":"));if(o)return"arbitrary.."+o}},tr=e=>{let{theme:t,prefix:o}=e,r={nextPart:new Map,validators:[]};return rr(Object.entries(e.classGroups),o).forEach(([i,n])=>{rt(n,r,i,t)}),r},rt=(e,t,o,r)=>{e.forEach(a=>{if(typeof a=="string"){let i=a===""?t:It(t,a);i.classGroupId=o;return}if(typeof a=="function"){if(or(a)){rt(a(r),t,o,r);return}t.validators.push({validator:a,classGroupId:o});return}Object.entries(a).forEach(([i,n])=>{rt(n,It(t,i),o,r)})})},It=(e,t)=>{let o=e;return t.split(nt).forEach(r=>{o.nextPart.has(r)||o.nextPart.set(r,{nextPart:new Map,validators:[]}),o=o.nextPart.get(r)}),o},or=e=>e.isThemeGetter,rr=(e,t)=>t?e.map(([o,r])=>{let a=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([n,l])=>[t+n,l])):i);return[o,a]}):e,nr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=new Map,r=new Map,a=(i,n)=>{o.set(i,n),t++,t>e&&(t=0,r=o,o=new Map)};return{get(i){let n=o.get(i);if(n!==void 0)return n;if((n=r.get(i))!==void 0)return a(i,n),n},set(i,n){o.has(i)?o.set(i,n):a(i,n)}}},Lt="!",ar=e=>{let{separator:t,experimentalParseClassName:o}=e,r=t.length===1,a=t[0],i=t.length,n=l=>{let v=[],D=0,w=0,f;for(let g=0;g<l.length;g++){let T=l[g];if(D===0){if(T===a&&(r||l.slice(g,g+i)===t)){v.push(l.slice(w,g)),w=g+i;continue}if(T==="/"){f=g;continue}}T==="["?D++:T==="]"&&D--}let S=v.length===0?l:l.substring(w),V=S.startsWith(Lt),k=V?S.substring(1):S,M=f&&f>w?f-w:void 0;return{modifiers:v,hasImportantModifier:V,baseClassName:k,maybePostfixModifierPosition:M}};return o?l=>o({className:l,parseClassName:n}):n},ir=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},sr=e=>({cache:nr(e.cacheSize),parseClassName:ar(e),...Qo(e)}),lr=/\$t+/,cr=(e,t)=>{let{parseClassName:o,getClassGroupId:r,getConflictingClassGroupIds:a}=t,i=[],n=e.trim().split(lr),l="";for(let v=n.length-1;v>=0;v-=1){let D=n[v],{modifiers:w,hasImportantModifier:f,baseClassName:S,maybePostfixModifierPosition:V}=o(D),k=!!V,M=r(k?S.substring(0,V):S);if(!M){if(!k){l=D+(l.length>0?" "+l:l);continue}if(M=r(S),!M){l=D+(l.length>0?" "+l:l);continue}k=!1}let g=ir(w).join(":"),T=f?g+Lt:g,H=T+M;if(i.includes(H))continue;i.push(H);let F=a(M,k);for(let P=0;P<F.length;++P){let $=F[P];i.push(T+$)}l=D+(l.length>0?" "+l:l)}return l};function dr(){let e=0,t,o,r="";for(;e<arguments.length;)(t=arguments[e++])&&(o=At(t))&&(r&&(r+=" "),r+=o);return r}var At=e=>{if(typeof e=="string")return e;let t,o="";for(let r=0;r<e.length;r++)e[r]&&(t=At(e[r]))&&(o&&(o+=" "),o+=t);return o};function mr(e,...t){let o,r,a,i=n;function n(v){let D=t.reduce((w,f)=>f(w),e());return o=sr(D),r=o.cache.get,a=o.cache.set,i=l,l(v)}function l(v){let D=r(v);if(D)return D;let w=cr(v,o);return a(v,w),w}return function(){return i(dr.apply(null,arguments))}}var L=e=>{let t=o=>o[e]||[];return t.isThemeGetter=!0,t},Ot=/^\[(?:([a-z-]+):)?(.+)\]$/i,pr=/^\$t+\/\$t+$/,ur=new Set(["px","full","screen"]),fr=/^(\$t+(\.\$t+)?)?(xs|sm|md|lg|xl)$/,gr=/\$t+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,hr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,br=/^(inset_)?-?((\$t+)?\.?(\$t+)[a-z]+|0)J-?((\$t+)?\.?(\$t+)[a-z]+|0)/,vr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ue=e=>Pe(e)||ur.has(e)||pr.test(e),xe=e=>De(e,"length",Dr),Pe=e=>!!e&&!Number.isNaN(Number(e)),ot=e=>De(e,"number",Pe),ke=e=>!!e&&Number.isInteger(Number(e)),xr=e=>e.endsWith("%")&&Pe(e.slice(0,-1)),h=e=>Ot.test(e),we=e=>fr.test(e),wr=new Set(["length","size","percentage"]),yr=e=>De(e,wr,Vt),Cr=e=>De(e,"position",Vt),Nr=new Set(["image","url"]),Rr=e=>De(e,Nr,Mr),Pr=e=>De(e,"",Sr),Ee=()=>!0,De=(e,t,o)=>{let r=Ot.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):o(r[2]):!1},Dr=e=>gr.test(e)&&!hr.test(e),Vt=()=>!1,Sr=e=>br.test(e),Mr=e=>vr.test(e);var Tr=()=>{let e=L("colors"),t=L("spacing"),o=L("blur"),r=L("brightness"),a=L("borderColor"),i=L("borderRadius"),n=L("borderSpacing"),l=L("borderWidth"),v=L("contrast"),D=L("grayscale"),w=L("hueRotate"),f=L("invert"),S=L("gap"),V=L("gradientColorStops"),k=L("gradientColorStopPositions"),M=L("inset"),g=L("margin"),T=L("opacity"),H=L("padding"),F=L("saturate"),P=L("scale"),$=L("sepia"),te=L("skew"),pe=L("space"),y=L("translate"),X=()=>["auto","contain","none"],le=()=>["auto","hidden","clip","visible","scroll"],ie=()=>["auto",h,t],I=()=>[h,t],be=()=>["",ue,xe],ve=()=>["auto",Pe,h],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],E=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>["start","end","center","between","around","evenly","stretch"],Q=()=>["","0",h],c=()=>["auto","avoid","all","avoid-page","page","left","right","column"],u=()=>[Pe,h];return{cacheSize:500,separator:":",theme:{colors:[Ee],spacing:[ue,xe],blur:["none","",we,h],brightness:u(),borderColor:[e],borderRadius:["none","","full",we,h],borderSpacing:I(),borderWidth:be(),contrast:u(),grayscale:Q(),hueRotate:u(),invert:Q(),gap:I(),gradientColorStops:[e],gradientColorStopPositions:[xr,xe],inset:ie(),margin:ie(),opacity:u(),padding:I(),saturate:u(),scale:u(),sepia:Q(),skew:u(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",h]}],container:["container"],columns:[{columns:[we]}],"break-after":[{"break-after":c()}],"break-before":[{"break-before":c()}],"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:[...p(),h]}],overflow:[{overflow:le()}],"overflow-x":[{"overflow-x":le()}],"overflow-y":[{"overflow-y":le()}],overscroll:[{overscroll:X()}],"overscroll-x":[{"overscroll-x":X()}],"overscroll-y":[{"overscroll-y":X()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[M]}],"inset-x":[{"inset-x":[M]}],"inset-y":[{"inset-y":[M]}],start:[{start:[M]}],end:[{end:[M]}],top:[{top:[M]}],right:[{right:[M]}],bottom:[{bottom:[M]}],left:[{left:[M]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ke,h]}],basis:[{basis:ie()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",h]}],grow:[{grow:Q()}],shrink:[{shrink:Q()}],order:[{order:["first","last","none",ke,h]}],"grid-cols":[{"grid-cols":[Ee]}],"col-start-end":[{col:["auto",{span:["full",ke,h]},h]}],"col-start":[{"col-start":ve()}],"col-end":[{"col-end":ve()}],"grid-rows":[{"grid-rows":[Ee]}],"row-start-end":[{row:["auto",{span:[ke,h]},h]}],"row-start":[{"row-start":ve()}],"row-end":[{"row-end":ve()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",h]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",h]}],gap:[{gap:[S]}],"gap-x":[{"gap-x":[S]}],"gap-y":[{"gap-y":[S]}],"justify-content":[{justify:["normal",...ce()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ce(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ce(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[H]}],px:[{px:[H]}],py:[{py:[H]}],ps:[{ps:[H]}],pe:[{pe:[H]}],pt:[{pt:[H]}],pr:[{pr:[H]}],pb:[{pb:[H]}],pl:[{pl:[H]}],$t:[{$t:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],$t:[{$t:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[pe]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[pe]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",h,t]}],"min-w":[{"min-w":[h,t,"min","max","fit"]}],"max-w":[{"max-w":[h,t,"none","full","min","max","fit","prose",{screen:[we]},we]}],h:[{h:[h,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[h,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[h,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[h,t,"auto","min","max","fit"]}],"font-size":[{text:["base",we,xe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ot]}],"font-family":[{font:[Ee]}],"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",h]}],"line-clamp":[{"line-clamp":["none",Pe,ot]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ue,h]}],"list-image":[{"list-image":["none",h]}],"list-style-type":[{list:["none","disc","decimal",h]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[T]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[T]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...E(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ue,xe]}],"underline-offset":[{"underline-offset":["auto",ue,h]}],"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:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",h]}],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",h]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[T]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),Cr]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",yr]}],"bg-image":[{bg:["none",{"gradient-$t":["t","tr","r","br","b","bl","l","tl"]},Rr]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[k]}],"gradient-via-pos":[{via:[k]}],"gradient-$t-pos":[{$t:[k]}],"gradient-from":[{from:[V]}],"gradient-via":[{via:[V]}],"gradient-$t":[{$t:[V]}],rounded:[{rounded:[i]}],"rounded-$t":[{"rounded-$t":[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-oe":[{"rounded-oe":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-$t":[{"border-$t":[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":[T]}],"border-style":[{border:[...E(),"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":[T]}],"divide-style":[{divide:E()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-$t":[{"border-$t":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...E()]}],"outline-offset":[{"outline-offset":[ue,h]}],"outline-w":[{outline:[ue,xe]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[T]}],"ring-offset-w":[{"ring-offset":[ue,xe]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",we,Pr]}],"shadow-color":[{shadow:[Ee]}],opacity:[{opacity:[T]}],"mix-blend":[{"mix-blend":[...U(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[o]}],brightness:[{brightness:[r]}],contrast:[{contrast:[v]}],"drop-shadow":[{"drop-shadow":["","none",we,h]}],grayscale:[{grayscale:[D]}],"hue-rotate":[{"hue-rotate":[w]}],invert:[{invert:[f]}],saturate:[{saturate:[F]}],sepia:[{sepia:[$]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[o]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[v]}],"backdrop-grayscale":[{"backdrop-grayscale":[D]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[w]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[T]}],"backdrop-saturate":[{"backdrop-saturate":[F]}],"backdrop-sepia":[{"backdrop-sepia":[$]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[n]}],"border-spacing-x":[{"border-spacing-x":[n]}],"border-spacing-y":[{"border-spacing-y":[n]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",h]}],duration:[{duration:u()}],ease:[{ease:["linear","in","out","in-out",h]}],delay:[{delay:u()}],animate:[{animate:["none","spin","ping","pulse","bounce",h]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[ke,h]}],"translate-x":[{"translate-x":[y]}],"translate-y":[{"translate-y":[y]}],"skew-x":[{"skew-x":[te]}],"skew-y":[{"skew-y":[te]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",h]}],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","$t-resize","w-resize","$t-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",h]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-$t":[{"scroll-$t":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-$t":[{"scroll-$t":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"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",h]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ue,xe,ot]}],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"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],$t:["mx","my","ms","$t","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","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-$t","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-oe","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-$t":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-oe"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-$t","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-$t","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-$t":["scroll-mx","scroll-my","scroll-ms","scroll-$t","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["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 zt=mr(Tr);function b(...e){return zt((0,_t.clsx)(e))}var Ut=require("@radix-ui/react-slot"),Bt=require("class-variance-authority"),Ft=Y(require("react")),$t=require("react/jsx-runtime"),kr=(0,Bt.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 w-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"}}}),se=Ft.forwardRef(({asChild:e=!1,className:t,size:o,variant:r,...a},i)=>(0,$t.jsx)(e?Ut.Slot:"button",{className:b(kr({className:t,size:o,variant:r})),ref:i,...a}));se.displayName="Button";var Ie=Y(require("react")),G=Y(require("@radix-ui/react-dialog"));var $e=G.Root;var at=G.Portal;var Ke=Ie.forwardRef(({className:e,...t},o)=>(0,$t.jsx)(G.Overlay,{ref:o,className:b("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}));Ke.displayName=G.Overlay.displayName;var it=Ie.forwardRef(({className:e,children:t,...o},r)=>(0,$t.jsxs)(at,{children:[(0,$t.jsx)(Ke,{}),(0,$t.jsxs)(G.Content,{ref:r,className:b("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-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-$t-left-1/2 data-[state=closed]:slide-out-$t-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,$t.jsxs)(G.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,$t.jsx)(J.X,{className:"h-4 w-4"}),(0,$t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));it.displayName=G.Content.displayName;var st=({className:e,...t})=>(0,$t.jsx)("div",{className:b("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});st.displayName="DialogHeader";var Er=({className:e,...t})=>(0,$t.jsx)("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Er.displayName="DialogFooter";var lt=Ie.forwardRef(({className:e,...t},o)=>(0,$t.jsx)(G.Title,{ref:o,className:b("text-lg font-semibold leading-none tracking-tight",e),...t}));lt.displayName=G.Title.displayName;var Ir=Ie.forwardRef(({className:e,...t},o)=>(0,$t.jsx)(G.Description,{ref:o,className:b("text-sm text-muted-foreground",e),...t}));Ir.displayName=G.Description.displayName;var Fo=Y(require("@radix-ui/react-dialog"));var Wt=Y(require("react")),He=Wt.forwardRef(({className:e,...t},o)=>(0,$t.jsx)("textarea",{className:b("flex min-h-[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}));He.displayName="Textarea";var jt=Y(require("react"));var fe=jt.forwardRef(({className:e,type:t,...o},r)=>(0,$t.jsx)("input",{type:t,className:b("flex h-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}));fe.displayName="Input";var N=Y(require("@radix-ui/react-select")),ye=Y(require("react")),Jt=N.Root;var Xt=N.Value,ct=ye.forwardRef(({children:e,className:t,...o},r)=>(0,$t.jsxs)(N.Trigger,{className:b("flex h-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,$t.jsx)(N.Icon,{asChild:!0,children:(0,$t.jsx)(J.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));ct.displayName=N.Trigger.displayName;var qt=ye.forwardRef(({className:e,...t},o)=>(0,$t.jsx)(N.ScrollUpButton,{className:b("flex cursor-default items-center justify-center py-1",e),ref:o,...t,children:(0,$t.jsx)(J.ChevronUp,{className:"h-4 w-4"})}));qt.displayName=N.ScrollUpButton.displayName;var Yt=ye.forwardRef(({className:e,...t},o)=>(0,$t.jsx)(N.ScrollDownButton,{className:b("flex cursor-default items-center justify-center py-1",e),ref:o,...t,children:(0,$t.jsx)(J.ChevronDown,{className:"h-4 w-4"})}));Yt.displayName=N.ScrollDownButton.displayName;var dt=ye.forwardRef(({children:e,className:t,position:o="popper",...r},a)=>(0,$t.jsx)(N.Portal,{children:(0,$t.jsxs)(N.Content,{className:b("relative z-50 max-h-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:a,...r,children:[(0,$t.jsx)(qt,{}),(0,$t.jsx)(N.Viewport,{className:b("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),(0,$t.jsx)(Yt,{})]})}));dt.displayName=N.Content.displayName;var Hr=ye.forwardRef(({className:e,...t},o)=>(0,$t.jsx)(N.Label,{className:b("py-1.5 pl-8 pr-2 text-sm font-semibold",e),ref:o,...t}));Hr.displayName=N.Label.displayName;var We=ye.forwardRef(({children:e,className:t,...o},r)=>(0,$t.jsxs)(N.Item,{className:b("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,$t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,$t.jsx)(N.ItemIndicator,{children:(0,$t.jsx)(J.Check,{className:"h-4 w-4"})})}),(0,$t.jsx)(N.ItemText,{children:e})]}));We.displayName=N.Item.displayName;var Lr=ye.forwardRef(({className:e,...t},o)=>(0,$t.jsx)(N.Separator,{className:b("-mx-1 my-1 h-px bg-muted",e),ref:o,...t}));Lr.displayName=N.Separator.displayName;var Qt=Y(require("react")),mt=Y(require("@radix-ui/react-label"));var Ar=(0,Bt.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),pt=Qt.forwardRef(({className:e,...t},o)=>(0,$t.jsx)(mt.Root,{ref:o,className:b(Ar(),e),...t}));pt.displayName=mt.Root.displayName;var ft=({fieldName:e,value:t,label:o,multiline:r=!1,onSave:a,className:i="",disabled:n=!1})=>{let[l,v]=(0,oe.useState)(!1),[D,w]=(0,oe.useState)(""),f=()=>{n||(v(!0),w(t))},S=async()=>{D!==t&&await a(e,D),v(!1)},V=k=>{k.key==="Enter"&&!r||k.key==="Enter"&&k.ctrlKey&&r?S():k.key==="Escape"&&(v(!1),w(""))};return(0,$t.jsxs)("div",{className:`space-y-2 ${i}`,children:[(0,$t.jsx)(pt,{children:o}),l?r?(0,$t.jsx)(He,{value:D,onChange:k=>w(k.target.value),onBlur:S,onKeyDown:V,autoFocus:!0,rows:4,className:"resize-none"}):(0,$t.jsx)(fe,{value:D,onChange:k=>w(k.target.value),onBlur:S,onKeyPress:V,autoFocus:!0,className:"text-lg font-medium"}):(0,$t.jsxs)("div",{onClick:f,className:`${n?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted/50 p-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,$t.jsx)("span",{className:r?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click $t edit..."}),!n&&(0,$t.jsx)(J.Edit,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var ko=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),Eo=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),Io=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),Ho=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),Lo=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),Ao=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),Oo=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),Qe=require("@payloadcms/richtext-lexical/lexical/list"),Vo=require("@payloadcms/richtext-lexical/lexical/rich-text"),zo=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var Mo=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),Ue=require("@payloadcms/richtext-lexical/lexical/utils"),x=require("@payloadcms/richtext-lexical/lexical"),Pt=require("@payloadcms/richtext-lexical/lexical/selection");var fo=require("@radix-ui/react-dialog"),Je=require("@payloadcms/richtext-lexical/client");var ht=Y(require("bson-objectid"));var no=require("@payloadcms/ui");var ro=Y(require("react")),de=Y(require("@radix-ui/react-tooltip"));var Ge=de.Provider,je=de.Root,Ze=de.Trigger,Le=ro.forwardRef(({className:e,sideOffset:t=4,...o},r)=>(0,$t.jsx)(de.Portal,{children:(0,$t.jsx)(de.Content,{ref:r,sideOffset:t,className:b("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})}));Le.displayName=de.Content.displayName;var Or=e=>{let{data:{relationTo:t,value:o},nodeKey:r}=e,[a]=(0,Mo.useLexicalComposerContext)(),[i,n]=(0,oe.useState)(""),[l,v]=(0,oe.useState)(""),[D,w]=(0,oe.useState)(""),f=async g=>{console.log("fetchMedia",g)};(0,oe.useEffect)(()=>{typeof o=="string"?o.length===24?f(o):(n(o||""),w(M(k())),v(V()||"")):typeof o=="object"&&(n(`${process.env.NEXT_PUBLIC_API_URL}${o.url}`||""),w(M(o.filesize)),v(o.mimeType?.split("/")[1]||""))},[]);let S=(0,oe.useCallback)(()=>{a.update(()=>{(0,x.$getNodeByKey)(r)?.remove()})},[a,r]),V=()=>{let g=e.data.value;return typeof g=="string"?g.split(";base64")[0]?.split("image/")[1]:""},k=()=>{let g=e.data.value;if(typeof g=="string"){let T=g.split(",")[1]?.length||0;return 4*Math.ceil(T/3)*.5624896334383812/1e3}return 0};function M(g){if(g>=1e6){let H=g/1e6;return`${H>=10?Math.round(H).toString():H.toFixed(1)} MB`}return`${Math.floor(g/1e3)} KB`}return(0,$t.jsx)("div",{className:"my-2",contentEditable:!1,children:(0,$t.jsxs)("div",{className:"border border-slate-800 rounded-xl overflow-clip w-60 flex flex-col gap-2 bg-[#222222]",children:[(0,$t.jsxs)("div",{className:"flex gap-2 border-b border-b-slate-100/10",children:[(0,$t.jsx)("div",{className:"flex-1",children:e.data.value?(0,$t.jsx)("img",{className:"object-cover $t-0 w-full min-w-[115px] min-h-[105px]","data-lexical-upload-id":o,"data-lexical-upload-relation-$t":t,src:i}):(0,$t.jsx)(no.File,{})}),(0,$t.jsx)(Ge,{children:(0,$t.jsxs)(je,{children:[(0,$t.jsxs)(Ze,{className:"flex-1 flex justify-center items-center text-[#b5b5b5]",children:[(0,$t.jsx)("span",{className:"font-medium text-sm",children:"Media"}),(0,$t.jsx)("button",{onClick:g=>{g.preventDefault(),S()},className:"flex-1 flex justify-center items-center",children:(0,$t.jsx)(J.X,{width:24,height:24,strokeWidth:1})})]}),(0,$t.jsx)(Le,{children:(0,$t.jsx)("span",{children:"Remove image"})})]})})]}),(0,$t.jsxs)("div",{className:"flex items-center justify-center gap-4 py-3 flex-1 text-xs font-bold",children:[(0,$t.jsx)("span",{className:"",children:l?.toLocaleUpperCase()}),(0,$t.jsx)("span",{children:D})]})]})})},lo=Or;function Vr(e){if(e.hasAttribute("data-lexical-upload-relation-$t")&&e.hasAttribute("data-lexical-upload-id")){let o=e.getAttribute("data-lexical-upload-id");if(o)return{node:Se({fields:{},relationTo:"media",value:o})}}return e.src.startsWith("file:///"),null}var Ae=class extends Je.UploadNode{static importDOM(){return{img:()=>({conversion:Vr,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new ht.default().toHexString(),t.version=3);let o={id:t.id??new ht.default().toHexString(),fields:t.fields,relationTo:"media",value:t.value},r=Se(o);return r.setFormat?.(t.format),r}decorate(){return(0,$t.jsx)(lo,{data:this.__data,nodeKey:this.getKey()})}};function Se(e){return new Ae({data:e})}var zr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",_r=e=>zr?(e||window).getSelection():null,Yn=(0,x.createCommand)("INSERT_UPLOAD_WITH_DRAWER_COMMAND"),bt=(0,x.createCommand)("INSERT_UPLOAD_COMMAND");function go({activeEditor:e,onClose:t,isOpen:o=!1}){let r=(0,oe.useRef)(!1),[a,i]=(0,oe.useState)(!0),[n,l]=(0,oe.useState)(""),[v,D]=(0,oe.useState)(""),[w,f]=(0,oe.useState)(!1),[S,V]=(0,oe.useState)("left"),k=n==="",M=P=>{f(P.target.checked)},g=P=>{V(P.target.value)},T=P=>{let $=new FileReader;$.onload=function(){return typeof $.result=="string"&&l($.result),""},P!==null&&P[0]&&$.readAsDataURL(P[0])};(0,oe.useEffect)(()=>{r.current=!1;let P=$=>{r.current=$.altKey};return document.addEventListener("keydown",P),()=>{document.removeEventListener("keydown",P)}},[e]),(0,oe.useEffect)(()=>{a||t()},[a]),(0,oe.useEffect)(()=>{i(o)},[o]);let H=({editor:P,relationTo:$,replaceNodeKey:te,value:pe})=>{if(te)P.update(()=>{let y=(0,x.$getNodeByKey)(te);y&&y.replace(Se({id:"",fields:{},relationTo:"media",value:pe}))});else{let y=P.dispatchCommand(bt,{fields:null,relationTo:"media",value:pe})}},F=()=>{H({editor:e,relationTo:"media",replaceNodeKey:null,value:{altText:v,src:n,showCaption:w,position:S}.src}),i(!1),t()};return(0,$t.jsx)($e,{open:a,onOpenChange:P=>i(P),children:(0,$t.jsxs)(it,{children:[(0,$t.jsxs)(st,{children:[(0,$t.jsx)(lt,{children:"Upload Image"}),(0,$t.jsx)(fo.DialogDescription,{children:"Description"})]}),(0,$t.jsxs)("div",{className:"",children:[(0,$t.jsx)("div",{style:{marginBottom:"1em"},children:(0,$t.jsx)(fe,{type:"file",onChange:P=>T(P.target.files),accept:"image/*","data-test-id":"image-modal-file-upload"})}),(0,$t.jsx)("div",{style:{marginBottom:"1em"},children:(0,$t.jsx)(fe,{"aria-label":"Alt Text",placeholder:"Descriptive alternative text",onChange:P=>D(P.currentTarget.value),value:v,"data-test-id":"image-modal-alt-text-input"})}),(0,$t.jsx)(se,{"data-test-id":"image-modal-file-upload-btn",disabled:k,onClick:()=>F(),children:"Confirm"})]})]})})}function vt({captionsEnabled:e}){let[t]=(0,Mo.useLexicalComposerContext)();return(0,oe.useEffect)(()=>{if(!t.hasNodes([Je.UploadNode]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return(0,Ue.mergeRegister)(t.registerCommand(x.DRAGSTART_COMMAND,o=>Ur(o),x.COMMAND_PRIORITY_HIGH),t.registerCommand(x.DRAGOVER_COMMAND,o=>Br(o),x.COMMAND_PRIORITY_LOW),t.registerCommand(x.DROP_COMMAND,o=>Fr(o,t),x.COMMAND_PRIORITY_HIGH))},[e,t]),null}function Ur(e){if(!xt())return!1;let o=e.dataTransfer;return o?(o.setData("text/plain","J"),!0):!1}function Br(e){return xt()?(ho(e)||e.preventDefault(),!0):!1}function Fr(e,t){let o=xt();if(!o)return!1;if(e.preventDefault(),ho(e)){let r=$r(e);o.remove();let a=(0,x.$createRangeSelection)();r!=null&&a.applyDOMRange(r),(0,x.$setSelection)(a)}return!0}function xt(){let e=(0,x.$getSelection)();if(!(0,x.$isNodeSelection)(e))return null;let o=e.getNodes()[0];return(0,Je.$isUploadNode)(o)?o:null}function ho(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 $r(e){let t,o=e.target,r=o==null?null:o.nodeType===9?o.defaultView:o.ownerDocument.defaultView,a=_r(r);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(e.clientX,e.clientY);else if(e.rangeParent&&a!==null)a.collapse(e.rangeParent,e.rangeOffset||0),t=a.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}var Kr=()=>(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",{$t:"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"})}),bo=Kr;var Wr=()=>(0,$t.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,$t.jsx)("path",{$t:"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"})}),vo=Wr;var Gr=()=>(0,$t.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,$t.jsx)("path",{$t:"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,$t.jsx)("path",{$t:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),xo=Gr;var jr=()=>(0,$t.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,$t.jsx)("path",{$t:"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,$t.jsx)("path",{$t:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),wo=jr;var Zr=()=>(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",{$t:"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"})}),yo=Zr;var Jr=()=>(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",{$t:"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"})}),Co=Jr;var No=()=>(0,$t.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,$t.jsx)("path",{$t:"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"})}),Ro=()=>(0,$t.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,$t.jsx)("path",{$t:"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"})}),Po=()=>(0,$t.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,$t.jsx)("path",{$t:"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"})}),Do=()=>(0,$t.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,$t.jsx)("path",{$t:"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"})}),So=()=>(0,$t.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,$t.jsx)("path",{$t:"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 he=Y(require("react")),R=Y(require("@radix-ui/react-dropdown-menu")),Me=require("@radix-ui/react-icons");var Xe=R.Root,qe=R.Trigger;var Xr=he.forwardRef(({className:e,inset:t,children:o,...r},a)=>(0,$t.jsxs)(R.SubTrigger,{ref:a,className:b("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,$t.jsx)(Me.ChevronRightIcon,{className:"ml-auto"})]}));Xr.displayName=R.SubTrigger.displayName;var qr=he.forwardRef(({className:e,...t},o)=>(0,$t.jsx)(R.SubContent,{ref:o,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-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}));qr.displayName=R.SubContent.displayName;var ze=he.forwardRef(({className:e,sideOffset:t=4,...o},r)=>(0,$t.jsx)(R.Portal,{children:(0,$t.jsx)(R.Content,{ref:r,sideOffset:t,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-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=R.Content.displayName;var _e=he.forwardRef(({className:e,inset:t,...o},r)=>(0,$t.jsx)(R.Item,{ref:r,className:b("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}));_e.displayName=R.Item.displayName;var Yr=he.forwardRef(({className:e,children:t,checked:o,...r},a)=>(0,$t.jsxs)(R.CheckboxItem,{ref:a,className:b("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,$t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,$t.jsx)(R.ItemIndicator,{children:(0,$t.jsx)(Me.CheckIcon,{className:"h-4 w-4"})})}),t]}));Yr.displayName=R.CheckboxItem.displayName;var Qr=he.forwardRef(({className:e,children:t,...o},r)=>(0,$t.jsxs)(R.RadioItem,{ref:r,className:b("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,$t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,$t.jsx)(R.ItemIndicator,{children:(0,$t.jsx)(Me.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));Qr.displayName=R.RadioItem.displayName;var en=he.forwardRef(({className:e,inset:t,...o},r)=>(0,$t.jsx)(R.Label,{ref:r,className:b("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...o}));en.displayName=R.Label.displayName;var tn=he.forwardRef(({className:e,...t},o)=>(0,$t.jsx)(R.Separator,{ref:o,className:b("-mx-1 my-1 h-px bg-muted",e),...t}));tn.displayName=R.Separator.displayName;var on=({className:e,...t})=>(0,$t.jsx)("span",{className:b("ml-auto text-xs tracking-widest opacity-60",e),...t});on.displayName="DropdownMenuShortcut";var Rt=1;function rn(){return(0,$t.jsx)("span",{className:"border border-[#222222]"})}function Dt(){let[e]=(0,Mo.useLexicalComposerContext)(),t=(0,oe.useRef)(null),[o,r]=(0,oe.useState)(!1),[a,i]=(0,oe.useState)(!1),[n,l]=(0,oe.useState)(!1),[v,D]=(0,oe.useState)(!1),[w,f]=(0,oe.useState)(!1),[S,V]=(0,oe.useState)(!1),[k,M]=(0,oe.useState)(!1),[g,T]=(0,oe.useState)(!1),[H,F]=(0,oe.useState)(!1),[P,$]=(0,oe.useState)("left"),[te,pe]=(0,oe.useState)("p"),y=p=>{e.update(()=>{let E=(0,x.$getSelection)();(0,x.$isRangeSelection)(E)&&(p==="p"?(0,Pt.$setBlocksType)(E,()=>(0,x.$createParagraphNode)()):(0,Pt.$setBlocksType)(E,()=>(0,Vo.$createHeadingNode)(p)))})},X=(0,oe.useCallback)(()=>{let p=(0,x.$getSelection)();if((0,x.$isRangeSelection)(p)){l(p.hasFormat("bold")),D(p.hasFormat("italic")),f(p.hasFormat("underline")),V(p.hasFormat("strikethrough")),M(p.hasFormat("subscript")),T(p.hasFormat("superscript"));let E=p.anchor.getNode(),U=E;for(;U&&!(0,x.$isParagraphNode)(U)&&U!==(0,x.$getRoot)();){let Q=U.getParent();Q&&(U=Q)}if(U){let Q=U.getFormatType();$(Q||"left")}let ce=E.getTopLevelElement()?.__tag;pe(ce||"p")}},[]);(0,oe.useEffect)(()=>(0,Ue.mergeRegister)(e.registerUpdateListener(({editorState:p})=>{p.read(()=>{X()})}),e.registerCommand(x.SELECTION_CHANGE_COMMAND,(p,E)=>(X(),!1),Rt),e.registerCommand(x.CAN_UNDO_COMMAND,p=>(r(p),!1),Rt),e.registerCommand(x.CAN_REDO_COMMAND,p=>(i(p),!1),Rt),(0,Ue.mergeRegister)(e.registerCommand(bt,p=>(e.update(()=>{let E=(0,x.$getSelection)()||(0,x.$getPreviousSelection)();if((0,x.$isRangeSelection)(E)){let U=Se({id:p.id,fields:p.fields,relationTo:p.relationTo,value:p.value}),{focus:ce}=E,Q=ce.getNode();(0,Ue.$insertNodeToNearestRoot)(U),(0,x.$isParagraphNode)(Q)&&!Q.__first&&Q.remove()}}),!0),x.COMMAND_PRIORITY_EDITOR))),[e,X]);let le=[[{label:"Undo",icon:(0,$t.jsx)(J.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(x.UNDO_COMMAND,void 0)},disabled:!o},{label:"Redo",icon:(0,$t.jsx)(J.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(x.UNDO_COMMAND,void 0)},disabled:!a}],[{label:"Bold",icon:(0,$t.jsx)(bo,{}),onClick:()=>{e.dispatchCommand(x.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:n},{label:"Italic",icon:(0,$t.jsx)(vo,{}),onClick:()=>{e.dispatchCommand(x.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:v},{label:"Underline",icon:(0,$t.jsx)(xo,{}),onClick:()=>{e.dispatchCommand(x.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:w},{label:"Strikethrough",icon:(0,$t.jsx)(wo,{}),onClick:()=>{e.dispatchCommand(x.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:S},{label:"Subscript",icon:(0,$t.jsx)(yo,{}),onClick:()=>{e.dispatchCommand(x.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:k},{label:"Superscript",icon:(0,$t.jsx)(Co,{}),onClick:()=>{e.dispatchCommand(x.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:g}]],ie=[{label:"Left Align",direction:"left",icon:(0,$t.jsx)(J.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(x.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,$t.jsx)(J.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(x.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,$t.jsx)(J.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(x.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,$t.jsx)(J.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(x.FORMAT_ELEMENT_COMMAND,"justify")}}],be=[{label:"Normal Text",value:"p",icon:(0,$t.jsx)(No,{}),onClick:()=>y("p")},{label:"Heading 1",value:"h1",icon:(0,$t.jsx)(Ro,{}),onClick:()=>y("h1")},{label:"Heading 2",value:"h2",icon:(0,$t.jsx)(Po,{}),onClick:()=>y("h2")},{label:"Heading 3",value:"h3",icon:(0,$t.jsx)(Do,{}),onClick:()=>y("h3")},{label:"Heading 4",value:"h4",icon:(0,$t.jsx)(So,{}),onClick:()=>y("h4")},...[{label:"Unordered List",value:"ul",icon:(0,$t.jsx)(J.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Qe.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,$t.jsx)(J.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Qe.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],ve=[{label:"Insert Image",icon:(0,$t.jsx)(J.ImageUp,{width:15,height:15}),onClick:()=>{F(!0)},disabled:!1}];return(0,$t.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2 sticky top-0 bg-black z-50",children:(0,$t.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[le.map((p,E)=>(0,$t.jsxs)(oe.Fragment,{children:[(0,$t.jsx)("div",{className:"flex items-center gap-2",children:p.map((U,ce)=>(0,$t.jsx)("div",{role:"button","aria-disabled":U.disabled||!1,onClick:U.onClick,className:b("p-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]",U.active&&"bg-[#3c3c3c]"),"aria-label":U.label,children:(0,$t.jsx)(Ge,{children:(0,$t.jsxs)(je,{children:[(0,$t.jsx)(Ze,{className:"text-[#b5b5b5]",children:U.icon}),(0,$t.jsx)(Le,{children:(0,$t.jsx)("p",{children:U.label})})]})})},ce))}),(0,$t.jsx)(rn,{})]},`toolbar-option-${p.length}-${E}`)),(0,$t.jsxs)(Xe,{children:[(0,$t.jsxs)(qe,{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:[ie.find(p=>p.direction===P)?.icon,ie.find(p=>p.direction===P)?.label,(0,$t.jsx)(J.ChevronDown,{width:15,height:15})]}),(0,$t.jsx)(ze,{className:"bg-black hover:bg-black",children:ie.map((p,E)=>(0,$t.jsxs)(_e,{onClick:p.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,$t.jsx)("span",{children:p.icon}),(0,$t.jsx)("span",{children:p.label})]},`${p.label}-${E}`))})]}),(0,$t.jsxs)(Xe,{children:[(0,$t.jsxs)(qe,{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:[be.find(p=>p.value===te)?.icon,be.find(p=>p.value===te)?.label,(0,$t.jsx)(J.ChevronDown,{width:15,height:15})]}),(0,$t.jsx)(ze,{className:"bg-black hover:bg-black",children:be.map((p,E)=>(0,$t.jsxs)(_e,{onClick:p.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,$t.jsx)("span",{children:p.icon}),(0,$t.jsx)("span",{children:p.label})]},`heading-option-${p.label}-${E}`))})]}),(0,$t.jsxs)(Xe,{children:[(0,$t.jsxs)(qe,{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,$t.jsx)(J.Plus,{width:15,height:15}),(0,$t.jsx)(J.ChevronDown,{width:15,height:15})]}),(0,$t.jsx)(ze,{className:"bg-black hover:bg-black",children:ve.map((p,E)=>(0,$t.jsxs)(_e,{onClick:p.onClick,disabled:p.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,$t.jsx)("span",{children:p.icon}),(0,$t.jsx)("span",{children:p.label})]},E))})]}),H&&(0,$t.jsx)(go,{activeEditor:e,onClose:()=>{F(!1)},isOpen:H})]})})}var nn=({setValue:e,value:t,name:o,editable:r=!0})=>{let[a]=(0,Mo.useLexicalComposerContext)(),i=n=>{n.read(()=>{let l=n.toJSON();e?.(()=>l)})};return(0,oe.useEffect)(()=>{a.setEditable(r)},[r]),(0,oe.useEffect)(()=>{t&&a.update(()=>{a.setEditorState(a.parseEditorState(t))})},[]),(0,$t.jsx)("div",{className:"w-full",children:(0,$t.jsxs)("div",{className:" ",children:[r&&(0,$t.jsx)(Dt,{}),(0,$t.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,$t.jsx)(Ao.RichTextPlugin,{contentEditable:(0,$t.jsx)(Io.ContentEditable,{name:o,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-h-40"}),ErrorBoundary:Ho.LexicalErrorBoundary}),r&&(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(Lo.HistoryPlugin,{}),(0,$t.jsx)(ko.AutoFocusPlugin,{}),(0,$t.jsx)(Oo.ListPlugin,{}),(0,$t.jsx)(zo.OnChangePlugin,{onChange:i}),(0,$t.jsx)(vt,{})]})]})]})})},an=({setValue:e,value:t,name:o,editable:r=!0})=>(0,$t.jsx)(Eo.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[Qe.ListNode,Qe.ListItemNode,Vo.HeadingNode,Ae],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,$t.jsx)(nn,{value:t,setValue:e,name:o,editable:r})}),et=an;function Uo({document:e,onSave:t,mode:o="edit",onCancel:r,availableDocuments:a=[],knowledgeContexts:i=[]}){let[n,l]=(0,oe.useState)({...e,updatedAt:new Date}),[v,D]=(0,oe.useState)(!1),[w,f]=(0,oe.useState)(n.richTextContent),[S,V]=(0,oe.useState)(!1),k=(0,oe.useRef)(null),M=(0,oe.useRef)(""),g=(0,oe.useRef)(null),T=(0,oe.useRef)(null),H=c=>{let u=new WeakSet,C=z=>z&&typeof z=="object"?u.has(z)?null:(u.add(z),Array.isArray(z)?z.map(C):Object.keys(z).sort().reduce((W,Ne)=>(W[Ne]=C(z[Ne]),W),{})):z;return JSON.stringify(C(c))},F=c=>c?c.replace(/\$t+/g," ").trim():"",P=c=>{if(!c)return{};let u={};return Object.keys(c).sort().forEach(C=>{u[C]=String(c[C]??"").trim()}),u},$=()=>n.format==="richText"?H(w):F(n.content),te=()=>{let c={title:F(n.title),description:F(n.description),format:n.format,metadata:P(n.metadata),content:$()},u=H(c),C=5381;for(let z=0;z<u.length;z++)C=C*33^u.charCodeAt(z);return(C>>>0).toString(16)},pe=(c,u)=>{if(c===u)return!1;if(n.format!=="richText"){let C=X(c),z=$();if(C==null)return!0;let W=C.length,Ne=z.length,Te=Math.abs(Ne-W),Be=W===0?1:Te/W;return F(C)===F(z)&&Te<3?!1:Te>=10||Be>=.02}return!0},y=(0,oe.useRef)(new Map),X=c=>{let u=y.current.get(c);return u==null?null:"x".repeat(u)};(0,oe.useEffect)(()=>(T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{let c=te(),u=M.current;if(pe(u,c)&&(V(!0),t({...n,richTextContent:w},"autosave"),M.current=c,n.format!=="richText")){let C=$();y.current.set(c,C.length)}},800),()=>{T.current&&clearTimeout(T.current)}),[n.title,n.description,n.format,n.content,n.metadata,w]),(0,oe.useEffect)(()=>{let c=()=>{let u=te();u!==M.current&&(t({...n,richTextContent:w},"autosave"),M.current=u)};return window.addEventListener("pagehide",c),window.addEventListener("beforeunload",c),()=>{window.removeEventListener("pagehide",c),window.removeEventListener("beforeunload",c)}},[n,w]),(0,oe.useEffect)(()=>(S&&(g.current=setTimeout(()=>{V(!1)},2e3)),()=>{g.current&&clearTimeout(g.current)}),[S]),(0,oe.useEffect)(()=>{l(e)},[e]);let le=c=>{switch(c){case"markdown":case"mdx":return(0,$t.jsx)(J.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,$t.jsx)(J.File,{className:"h-6 w-6 text-success"});case"text":return(0,$t.jsx)(J.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,$t.jsx)(J.File,{className:"h-6 w-6 text-muted-foreground"})}},ie=c=>{switch(c){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"}},I=()=>{let c=new Set,u=new Set;return i.forEach(C=>{C.menuConfig.groupBy.forEach(z=>c.add(z))}),a.forEach(C=>{C.metadata&&Object.keys(C.metadata).forEach(z=>u.add(z))}),{contextKeys:Array.from(c).sort(),documentKeys:Array.from(u).sort(),allKeys:Array.from(new Set([...c,...u])).sort()}},be=c=>{let u=new Set;return a.forEach(C=>{C.metadata?.[c]&&u.add(String(C.metadata[c]))}),Array.from(u).sort()},ve=I(),p=()=>{t({...n,richTextContent:w},"autosave")},E=(c,u)=>{l(C=>({...C,metadata:{...C.metadata,[c]:u}}))},U=(c,u)=>{u==="__custom__"?E(c,""):E(c,u)},ce=()=>{E("","")},Q=c=>{l(u=>{let C={...u.metadata};return delete C[c],{...u,metadata:C}})};return(0,$t.jsxs)(Tt.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,$t.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,$t.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,$t.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,$t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,$t.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,$t.jsx)("div",{className:"flex-1 min-w-0",children:(0,$t.jsx)(ft,{fieldName:"title",value:n.title,label:"",onSave:(c,u)=>l(C=>({...C,title:u})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:p-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),(0,$t.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${ie(n.format)} flex-shrink-0 mt-1`,children:n.format.toUpperCase()})]}),(0,$t.jsx)("div",{className:"mt-2",children:(0,$t.jsx)(ft,{fieldName:"description",value:n.description||"Click $t add description...",label:"",multiline:!0,onSave:(c,u)=>l(C=>({...C,description:u})),className:"[&>div:last-child]:text-muted-foreground [&>div:last-child]:text-lg [&>div:last-child]:leading-relaxed [&>div:last-child]:p-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})})]})}),(0,$t.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,$t.jsxs)(se,{variant:"ghost",size:"sm",onClick:()=>D(!v),className:"gap-2",children:[(0,$t.jsx)(J.Info,{className:"h-4 w-4"}),"Metadata",n.metadata&&Object.keys(n.metadata).length>0&&(0,$t.jsx)("span",{className:"inline-flex items-center justify-center w-5 h-5 text-xs font-medium bg-primary/10 text-primary rounded-full",children:Object.keys(n.metadata).length}),v?(0,$t.jsx)(J.ChevronDown,{className:"h-4 w-4"}):(0,$t.jsx)(J.ChevronRight,{className:"h-4 w-4"})]}),(0,$t.jsxs)(se,{variant:"outline",size:"sm",onClick:r,className:"gap-2",children:[(0,$t.jsx)(J.X,{className:"h-4 w-4"}),"Close"]}),(0,$t.jsxs)(se,{size:"sm",onClick:p,className:"gap-2",disabled:S,children:[S?(0,$t.jsx)(J.Loader2,{className:"h-4 w-4 animate-spin"}):(0,$t.jsx)(J.Save,{className:"h-4 w-4"}),S?"Auto-saving...":"Save"]})]})]}),(0,$t.jsx)(Tt.motion.div,{initial:!1,animate:{height:v?"auto":0,opacity:v?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden h-full max-h-full",children:(0,$t.jsxs)("div",{className:"pt-4 border-t border-border mt-4 h-screen max-h-full flex",children:[(0,$t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,$t.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,$t.jsx)(J.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,$t.jsxs)(se,{type:"button",variant:"outline",size:"sm",onClick:ce,className:"gap-1 h-8",children:[(0,$t.jsx)(J.Plus,{className:"h-3 w-3"}),"Add Field"]})]}),(0,$t.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:n.metadata&&Object.keys(n.metadata).length>0?(0,$t.jsx)("div",{className:"space-y-2",children:Object.entries(n.metadata).map(([c,u],C)=>{let z=be(c);return(0,$t.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,$t.jsx)(fe,{value:c,onChange:W=>{let Ne=W.target.value||"",Te=n.metadata?.[c];l(Be=>{let tt={...Be.metadata};return delete tt[c],Ne&&(tt[Ne]=Te||""),{...Be,metadata:tt}})},placeholder:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${c}`}),(0,$t.jsx)("datalist",{id:`metadata-keys-${c}`,children:ve.allKeys.map(W=>(0,$t.jsx)("option",{value:W},W))}),(0,$t.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),z.length>0?(0,$t.jsxs)(Jt,{value:String(u||""),onValueChange:W=>U(c,W),children:[(0,$t.jsx)(ct,{className:"flex-1 h-8 text-sm",children:(0,$t.jsx)(Xt,{placeholder:"Value"})}),(0,$t.jsxs)(dt,{children:[z.map(W=>(0,$t.jsx)(We,{value:W,children:W},W)),(0,$t.jsx)(We,{value:"__custom__",children:(0,$t.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,$t.jsx)(fe,{value:String(u||""),onChange:W=>E(c,W.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,$t.jsx)(se,{type:"button",variant:"ghost",size:"sm",onClick:()=>Q(c),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,$t.jsx)(J.X,{className:"h-3 w-3"})})]},`metadata-key-${C}`)})}):(0,$t.jsxs)("div",{className:"text-center py-4",children:[(0,$t.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"No metadata fields"}),(0,$t.jsx)("p",{className:"text-xs text-muted-foreground",children:'Click "Add Field" $t create metadata'})]})})]})})]}),(0,$t.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,$t.jsx)("div",{className:"p-8 pt-0 h-full max-h-full overflow-auto",children:n.format==="richText"?(0,$t.jsx)(et,{setValue:f,value:w,name:"richTextContent"}):(0,$t.jsx)(He,{value:n.content||"",onChange:c=>l(u=>({...u,content:c.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})]})}var $o=Y(require("react-markdown")),Ko=Y(require("remark-gfm"));var Wo=e=>(0,$t.jsx)($o.default,{remarkPlugins:[Ko.default],components:{h1:({children:t})=>(0,$t.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,$t.jsx)("h2",{className:"text-xl font-bold",children:t}),h3:({children:t})=>(0,$t.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,$t.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,$t.jsx)("ol",{className:"list-decimal",children:t}),ul:({children:t})=>(0,$t.jsx)("ul",{className:"list-disc",children:t}),li:({children:t})=>(0,$t.jsx)("li",{className:"ml-4",children:t}),p:({children:t})=>(0,$t.jsx)("p",{className:"mb-4",children:t}),a:({children:t,href:o})=>(0,$t.jsx)("a",{href:o,className:"text-blue-500",children:t}),img:({src:t,alt:o})=>(0,$t.jsx)("img",{src:t,alt:o,className:"mb-4"}),blockquote:({children:t})=>(0,$t.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),Bo=e=>(0,$t.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),sn=e=>(0,$t.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:e&&(0,$t.jsx)(et,{value:JSON.stringify(e),editable:!1,name:"richTextContent"},JSON.stringify(e))}),ln=e=>(0,$t.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,$t.jsx)("div",{className:"bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4 mb-4",children:(0,$t.jsxs)("p",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,$t.jsx)("strong",{children:"MDX Renderer:"})," This is a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),Wo(e)]});function cn({document:e,onDocumentUpdate:t,editable:o=!0,mode:r="view",renderers:a,availableDocuments:i=[],knowledgeContexts:n=[]}){let[l,v]=(0,oe.useState)(!1),[D,w]=(0,oe.useState)(!1),[f,S]=(0,oe.useState)(e),[V,k]=(0,oe.useState)(!1),M=(0,oe.useRef)(null),g=f.format==="richText"?f.richTextContent:f.content,T=(0,oe.useMemo)(()=>`${f.format}:${JSON.stringify(g)}`,[f.format,g]);(0,oe.useEffect)(()=>{S(e)},[e]);let H=y=>{switch(y){case"markdown":case"mdx":return(0,$t.jsx)(J.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,$t.jsx)(J.File,{className:"h-6 w-6 text-success"});case"text":return(0,$t.jsx)(J.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,$t.jsx)(J.File,{className:"h-6 w-6 text-muted-foreground"})}},F=y=>{switch(y){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"}},P=(y,X)=>{let le={markdown:Wo,mdx:ln,text:Bo},ie=a?.[X]||le[X];if(X==="richText"&&typeof y=="object")return sn(y);if(ie&&typeof y=="string")return ie(y);if(typeof y=="string")return Bo(y)},$=async(y,X="save")=>{X==="save"&&k(!0),M.current=f,(0,oe.startTransition)(()=>{S({...y,richTextContent:y.richTextContent?structuredClone(y.richTextContent):void 0})});try{let le=await t?.(y);if(X==="save"&&k(!1),!le)throw new Error("save failed")}catch{M.current&&(0,oe.startTransition)(()=>S(M.current))}},te=()=>{v(!1)};return(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)($e,{open:l||r==="create",onOpenChange:y=>!y&&te(),children:(0,$t.jsxs)(at,{children:[(0,$t.jsx)(Ke,{}),(0,$t.jsxs)(Fo.Content,{className:b("fixed inset-0 z-50 bg-background p-0 $t-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:[V&&(0,$t.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center",children:(0,$t.jsx)(J.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),(0,$t.jsx)(Uo,{mode:r==="create"?"create":"edit",document:f,onSave:$,onCancel:te,availableDocuments:i,knowledgeContexts:n})]})]})}),(0,$t.jsxs)(Tt.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,$t.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,$t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,$t.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,$t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,$t.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[f.title,(0,$t.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${F(f.format)}`,children:f.format.toUpperCase()})]}),f.description&&(0,$t.jsx)("p",{className:"text-muted-foreground text-lg leading-relaxed",children:f.description})]})}),(0,$t.jsxs)("div",{className:"items-center gap-2 flex-shrink-0 hidden lg:flex",children:[f.metadata&&Object.keys(f.metadata).length>0&&(0,$t.jsxs)(se,{variant:"ghost",size:"sm",onClick:()=>w(!D),className:"gap-2",children:[(0,$t.jsx)(J.Info,{className:"h-4 w-4"}),"Metadata",D?(0,$t.jsx)(J.ChevronDown,{className:"h-4 w-4"}):(0,$t.jsx)(J.ChevronRight,{className:"h-4 w-4"})]}),o&&(0,$t.jsxs)(se,{variant:"outline",size:"sm",onClick:()=>v(!0),className:"gap-2",children:[(0,$t.jsx)(J.Edit3,{className:"h-4 w-4"}),"Edit"]})]})]}),f.metadata&&Object.keys(f.metadata).length>0&&(0,$t.jsx)(Tt.motion.div,{initial:!1,animate:{height:D?"auto":0,opacity:D?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,$t.jsxs)("div",{className:"pt-4 border-t border-border mt-4",children:[(0,$t.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,$t.jsx)(J.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,$t.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:(0,$t.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(f.metadata).map(([y,X])=>(0,$t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,$t.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:y.replace(/([x-$t])/g," $1").trim()}),(0,$t.jsx)("span",{className:"text-foreground font-medium",children:String(X)})]},y))})})]})})]}),(0,$t.jsx)("div",{className:"flex-1 ",children:(0,$t.jsx)("div",{className:"py-4 h-full",children:(0,$t.jsx)("div",{className:"space-y-4",children:f.content||f.richTextContent?(0,$t.jsx)("div",{className:"relative",children:(0,$t.jsx)("div",{className:"bg-background px-8 overflow-hidden h-full flex-1",children:P(f.format==="richText"?f.richTextContent:f.content,f.format)})},T):(0,$t.jsxs)("div",{className:"text-center p-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,$t.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,$t.jsx)(J.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,$t.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"No content available"}),(0,$t.jsx)("p",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})]})}0&&(module.exports={DocumentPreview});
4
+ "use strict";"use client";var Wo=Object.create;var Be=Object.defineProperty;var Go=Object.getOwnPropertyDescriptor;var jo=Object.getOwnPropertyNames;var Zo=Object.getPrototypeOf,Jo=Object.prototype.hasOwnProperty;var Xo=(e,t)=>{for(var o in t)Be(e,o,{get:t[o],enumerable:!0})},Tt=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of jo(t))!Jo.call(e,a)&&a!==o&&Be(e,a,{get:()=>t[a],enumerable:!(r=Go(t,a))||r.enumerable});return e};var Y=(e,t,o)=>(o=e!=null?Wo(Zo(e)):{},Tt(t||!e||!e.__esModule?Be(o,"default",{value:e,enumerable:!0}):o,e)),qo=e=>Tt(Be({},"__esModule",{value:!0}),e);var cn={};Xo(cn,{DocumentPreview:()=>ln});module.exports=qo(cn);var Mt=require("motion/react"),J=require("lucide-react"),ee=require("react");var zt=require("clsx");var rt="-",Yo=e=>{let t=er(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:n=>{let c=n.split(rt);return c[0]===""&&c.length!==1&&c.shift(),It(c,t)||Qo(n)},getConflictingClassGroupIds:(n,c)=>{let x=o[n]||[];return c&&r[n]?[...x,...r[n]]:x}}},It=(e,t)=>{if(e.length===0)return t.classGroupId;let o=e[0],r=t.nextPart.get(o),a=r?It(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;let i=e.join(rt);return t.validators.find(({validator:n})=>n(i))?.classGroupId},kt=/^\[(.+)\]$/,Qo=e=>{if(kt.test(e)){let t=kt.exec(e)[1],o=t?.substring(0,t.indexOf(":"));if(o)return"arbitrary.."+o}},er=e=>{let{theme:t,prefix:o}=e,r={nextPart:new Map,validators:[]};return or(Object.entries(e.classGroups),o).forEach(([i,n])=>{ot(n,r,i,t)}),r},ot=(e,t,o,r)=>{e.forEach(a=>{if(typeof a=="string"){let i=a===""?t:Et(t,a);i.classGroupId=o;return}if(typeof a=="function"){if(tr(a)){ot(a(r),t,o,r);return}t.validators.push({validator:a,classGroupId:o});return}Object.entries(a).forEach(([i,n])=>{ot(n,Et(t,i),o,r)})})},Et=(e,t)=>{let o=e;return t.split(rt).forEach(r=>{o.nextPart.has(r)||o.nextPart.set(r,{nextPart:new Map,validators:[]}),o=o.nextPart.get(r)}),o},tr=e=>e.isThemeGetter,or=(e,t)=>t?e.map(([o,r])=>{let a=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([n,c])=>[t+n,c])):i);return[o,a]}):e,rr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=new Map,r=new Map,a=(i,n)=>{o.set(i,n),t++,t>e&&(t=0,r=o,o=new Map)};return{get(i){let n=o.get(i);if(n!==void 0)return n;if((n=r.get(i))!==void 0)return a(i,n),n},set(i,n){o.has(i)?o.set(i,n):a(i,n)}}},Ht="!",nr=e=>{let{separator:t,experimentalParseClassName:o}=e,r=t.length===1,a=t[0],i=t.length,n=c=>{let x=[],D=0,y=0,u;for(let f=0;f<c.length;f++){let T=c[f];if(D===0){if(T===a&&(r||c.slice(f,f+i)===t)){x.push(c.slice(y,f)),y=f+i;continue}if(T==="/"){u=f;continue}}T==="["?D++:T==="]"&&D--}let S=x.length===0?c:c.substring(y),V=S.startsWith(Ht),k=V?S.substring(1):S,M=u&&u>y?u-y:void 0;return{modifiers:x,hasImportantModifier:V,baseClassName:k,maybePostfixModifierPosition:M}};return o?c=>o({className:c,parseClassName:n}):n},ar=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},ir=e=>({cache:rr(e.cacheSize),parseClassName:nr(e),...Yo(e)}),sr=/\Ft+/,lr=(e,t)=>{let{parseClassName:o,getClassGroupId:r,getConflictingClassGroupIds:a}=t,i=[],n=e.trim().split(sr),c="";for(let x=n.length-1;x>=0;x-=1){let D=n[x],{modifiers:y,hasImportantModifier:u,baseClassName:S,maybePostfixModifierPosition:V}=o(D),k=!!V,M=r(k?S.substring(0,V):S);if(!M){if(!k){c=D+(c.length>0?" "+c:c);continue}if(M=r(S),!M){c=D+(c.length>0?" "+c:c);continue}k=!1}let f=ar(y).join(":"),T=u?f+Ht:f,I=T+M;if(i.includes(I))continue;i.push(I);let F=a(M,k);for(let C=0;C<F.length;++C){let K=F[C];i.push(T+K)}c=D+(c.length>0?" "+c:c)}return c};function cr(){let e=0,t,o,r="";for(;e<arguments.length;)(t=arguments[e++])&&(o=Lt(t))&&(r&&(r+=" "),r+=o);return r}var Lt=e=>{if(typeof e=="string")return e;let t,o="";for(let r=0;r<e.length;r++)e[r]&&(t=Lt(e[r]))&&(o&&(o+=" "),o+=t);return o};function dr(e,...t){let o,r,a,i=n;function n(x){let D=t.reduce((y,u)=>u(y),e());return o=ir(D),r=o.cache.get,a=o.cache.set,i=c,c(x)}function c(x){let D=r(x);if(D)return D;let y=lr(x,o);return a(x,y),y}return function(){return i(cr.apply(null,arguments))}}var L=e=>{let t=o=>o[e]||[];return t.isThemeGetter=!0,t},At=/^\[(?:([a-z-]+):)?(.+)\]$/i,mr=/^\Ft+\/\Ft+$/,pr=new Set(["px","full","screen"]),ur=/^(\Ft+(\.\Ft+)?)?(xs|sm|md|lg|xl)$/,fr=/\Ft+(%|px|r?em|[sdl]?v([hwib]|min|max)|ee|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,gr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,hr=/^(inset_)?-?((\Ft+)?\.?(\Ft+)[a-z]+|0)J-?((\Ft+)?\.?(\Ft+)[a-z]+|0)/,br=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pe=e=>Re(e)||pr.has(e)||mr.test(e),ve=e=>Pe(e,"length",Pr),Re=e=>!!e&&!Number.isNaN(Number(e)),tt=e=>Pe(e,"number",Re),Te=e=>!!e&&Number.isInteger(Number(e)),vr=e=>e.endsWith("%")&&Re(e.slice(0,-1)),b=e=>At.test(e),xe=e=>ur.test(e),xr=new Set(["length","size","percentage"]),wr=e=>Pe(e,xr,Ot),yr=e=>Pe(e,"position",Ot),Cr=new Set(["image","url"]),Nr=e=>Pe(e,Cr,Sr),Rr=e=>Pe(e,"",Dr),ke=()=>!0,Pe=(e,t,o)=>{let r=At.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):o(r[2]):!1},Pr=e=>fr.test(e)&&!gr.test(e),Ot=()=>!1,Dr=e=>hr.test(e),Sr=e=>br.test(e);var Mr=()=>{let e=L("colors"),t=L("spacing"),o=L("blur"),r=L("brightness"),a=L("borderColor"),i=L("borderRadius"),n=L("borderSpacing"),c=L("borderWidth"),x=L("contrast"),D=L("grayscale"),y=L("hueRotate"),u=L("invert"),S=L("gap"),V=L("gradientColorStops"),k=L("gradientColorStopPositions"),M=L("inset"),f=L("margin"),T=L("opacity"),I=L("padding"),F=L("saturate"),C=L("scale"),K=L("sepia"),te=L("skew"),le=L("space"),P=L("translate"),q=()=>["auto","contain","none"],ae=()=>["auto","hidden","clip","visible","scroll"],ie=()=>["auto",b,t],E=()=>[b,t],he=()=>["",pe,ve],be=()=>["auto",Re,b],m=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>["start","end","center","between","around","evenly","stretch"],l=()=>["","0",b],h=()=>["auto","avoid","all","avoid-page","page","left","right","column"],g=()=>[Re,b];return{cacheSize:500,separator:":",theme:{colors:[ke],spacing:[pe,ve],blur:["none","",xe,b],brightness:g(),borderColor:[e],borderRadius:["none","","full",xe,b],borderSpacing:E(),borderWidth:he(),contrast:g(),grayscale:l(),hueRotate:g(),invert:l(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[vr,ve],inset:ie(),margin:ie(),opacity:g(),padding:E(),saturate:g(),scale:g(),sepia:l(),skew:g(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",b]}],container:["container"],columns:[{columns:[xe]}],"break-after":[{"break-after":h()}],"break-before":[{"break-before":h()}],"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:[...m(),b]}],overflow:[{overflow:ae()}],"overflow-x":[{"overflow-x":ae()}],"overflow-y":[{"overflow-y":ae()}],overscroll:[{overscroll:q()}],"overscroll-x":[{"overscroll-x":q()}],"overscroll-y":[{"overscroll-y":q()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[M]}],"inset-x":[{"inset-x":[M]}],"inset-y":[{"inset-y":[M]}],start:[{start:[M]}],end:[{end:[M]}],top:[{top:[M]}],right:[{right:[M]}],bottom:[{bottom:[M]}],left:[{left:[M]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Te,b]}],basis:[{basis:ie()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",b]}],grow:[{grow:l()}],shrink:[{shrink:l()}],order:[{order:["first","last","none",Te,b]}],"grid-cols":[{"grid-cols":[ke]}],"col-start-end":[{col:["auto",{span:["full",Te,b]},b]}],"col-start":[{"col-start":be()}],"col-end":[{"col-end":be()}],"grid-rows":[{"grid-rows":[ke]}],"row-start-end":[{row:["auto",{span:[Te,b]},b]}],"row-start":[{"row-start":be()}],"row-end":[{"row-end":be()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",b]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",b]}],gap:[{gap:[S]}],"gap-x":[{"gap-x":[S]}],"gap-y":[{"gap-y":[S]}],"justify-content":[{justify:["normal",...ce()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ce(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ce(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],Ft:[{Ft:[I]}],px:[{px:[I]}],py:[{py:[I]}],ps:[{ps:[I]}],pe:[{pe:[I]}],ee:[{ee:[I]}],pr:[{pr:[I]}],pb:[{pb:[I]}],pl:[{pl:[I]}],m:[{m:[f]}],mx:[{mx:[f]}],my:[{my:[f]}],ms:[{ms:[f]}],Ft:[{Ft:[f]}],mt:[{mt:[f]}],mr:[{mr:[f]}],mb:[{mb:[f]}],ml:[{ml:[f]}],"space-x":[{"space-x":[le]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[le]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",b,t]}],"min-w":[{"min-w":[b,t,"min","max","fit"]}],"max-w":[{"max-w":[b,t,"none","full","min","max","fit","prose",{screen:[xe]},xe]}],h:[{h:[b,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[b,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[b,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[b,t,"auto","min","max","fit"]}],"font-size":[{text:["base",xe,ve]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",tt]}],"font-family":[{font:[ke]}],"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",b]}],"line-clamp":[{"line-clamp":["none",Re,tt]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",pe,b]}],"list-image":[{"list-image":["none",b]}],"list-style-type":[{list:["none","disc","decimal",b]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[T]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[T]}],"text-decoration":["underline","overline","line-through","So-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",pe,ve]}],"underline-offset":[{"underline-offset":["auto",pe,b]}],"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:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",b]}],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",b]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[T]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...m(),yr]}],"bg-repeat":[{bg:["So-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",wr]}],"bg-image":[{bg:["none",{"gradient-J":["t","tr","r","br","b","bl","l","tl"]},Nr]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[k]}],"gradient-via-pos":[{via:[k]}],"gradient-J-pos":[{J:[k]}],"gradient-from":[{from:[V]}],"gradient-via":[{via:[V]}],"gradient-J":[{J:[V]}],rounded:[{rounded:[i]}],"rounded-Ft":[{"rounded-Ft":[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-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-Ft":[{"border-Ft":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[T]}],"border-style":[{border:[...H(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[T]}],"divide-style":[{divide:H()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-Ft":[{"border-Ft":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...H()]}],"outline-offset":[{"outline-offset":[pe,b]}],"outline-w":[{outline:[pe,ve]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[T]}],"ring-offset-w":[{"ring-offset":[pe,ve]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",xe,Rr]}],"shadow-color":[{shadow:[ke]}],opacity:[{opacity:[T]}],"mix-blend":[{"mix-blend":[...U(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[o]}],brightness:[{brightness:[r]}],contrast:[{contrast:[x]}],"drop-shadow":[{"drop-shadow":["","none",xe,b]}],grayscale:[{grayscale:[D]}],"hue-rotate":[{"hue-rotate":[y]}],invert:[{invert:[u]}],saturate:[{saturate:[F]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[o]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[x]}],"backdrop-grayscale":[{"backdrop-grayscale":[D]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[y]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[T]}],"backdrop-saturate":[{"backdrop-saturate":[F]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[n]}],"border-spacing-x":[{"border-spacing-x":[n]}],"border-spacing-y":[{"border-spacing-y":[n]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",b]}],duration:[{duration:g()}],ease:[{ease:["linear","in","out","in-out",b]}],delay:[{delay:g()}],animate:[{animate:["none","spin","ping","pulse","bounce",b]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[Te,b]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[te]}],"skew-y":[{"skew-y":[te]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",b]}],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","So-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","Ft-resize","w-resize","ee-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",b]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-Ft":[{"scroll-Ft":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-Ft":[{"scroll-Ft":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-ee":[{"scroll-ee":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"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",b]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[pe,ve,tt]}],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"],Ft:["px","py","ps","pe","ee","pr","pb","pl"],px:["pr","pl"],py:["ee","pb"],m:["mx","my","ms","Ft","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","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-Ft","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-Ft":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-Ft","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-Ft","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-Ft","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-Ft":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-ee","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-ee","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var Vt=dr(Mr);function v(...e){return Vt((0,zt.clsx)(e))}var _t=require("@radix-ui/react-slot"),Ut=require("class-variance-authority"),Bt=Y(require("react")),Ft=require("react/jsx-runtime"),Tr=(0,Ut.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 w-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"}}}),se=Bt.forwardRef(({asChild:e=!1,className:t,size:o,variant:r,...a},i)=>(0,Ft.jsx)(e?_t.Slot:"button",{className:v(Tr({className:t,size:o,variant:r})),ref:i,...a}));se.displayName="Button";var Ee=Y(require("react")),G=Y(require("@radix-ui/react-dialog"));var Fe=G.Root;var nt=G.Portal;var $e=Ee.forwardRef(({className:e,...t},o)=>(0,Ft.jsx)(G.Overlay,{ref:o,className:v("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}));$e.displayName=G.Overlay.displayName;var at=Ee.forwardRef(({className:e,children:t,...o},r)=>(0,Ft.jsxs)(nt,{children:[(0,Ft.jsx)($e,{}),(0,Ft.jsxs)(G.Content,{ref:r,className:v("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background Ft-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-J-left-1/2 data-[state=closed]:slide-out-J-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,Ft.jsxs)(G.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,Ft.jsx)($t.Ft,{className:"h-4 w-4"}),(0,Ft.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));at.displayName=G.Content.displayName;var it=({className:e,...t})=>(0,Ft.jsx)("div",{className:v("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});it.displayName="DialogHeader";var kr=({className:e,...t})=>(0,Ft.jsx)("div",{className:v("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});kr.displayName="DialogFooter";var st=Ee.forwardRef(({className:e,...t},o)=>(0,Ft.jsx)(G.Title,{ref:o,className:v("text-lg font-semibold leading-none tracking-tight",e),...t}));st.displayName=G.Title.displayName;var Er=Ee.forwardRef(({className:e,...t},o)=>(0,Ft.jsx)(G.Description,{ref:o,className:v("text-sm text-muted-foreground",e),...t}));Er.displayName=G.Description.displayName;var Bo=Y(require("@radix-ui/react-dialog"));var Kt=Y(require("react")),Ie=Kt.forwardRef(({className:e,...t},o)=>(0,Ft.jsx)("textarea",{className:v("flex min-h-[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}));Ie.displayName="Textarea";var Gt=Y(require("react"));var ue=Gt.forwardRef(({className:e,type:t,...o},r)=>(0,Ft.jsx)("input",{type:t,className:v("flex h-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}));ue.displayName="Input";var N=Y(require("@radix-ui/react-select")),we=Y(require("react")),Zt=N.Root;var Jt=N.Value,lt=we.forwardRef(({children:e,className:t,...o},r)=>(0,Ft.jsxs)(N.Trigger,{className:v("flex h-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,Ft.jsx)(N.Icon,{asChild:!0,children:(0,Ft.jsx)(J.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));lt.displayName=N.Trigger.displayName;var Xt=we.forwardRef(({className:e,...t},o)=>(0,Ft.jsx)(N.ScrollUpButton,{className:v("flex cursor-default items-center justify-center py-1",e),ref:o,...t,children:(0,Ft.jsx)(J.ChevronUp,{className:"h-4 w-4"})}));Xt.displayName=N.ScrollUpButton.displayName;var qt=we.forwardRef(({className:e,...t},o)=>(0,Ft.jsx)(N.ScrollDownButton,{className:v("flex cursor-default items-center justify-center py-1",e),ref:o,...t,children:(0,Ft.jsx)(J.ChevronDown,{className:"h-4 w-4"})}));qt.displayName=N.ScrollDownButton.displayName;var ct=we.forwardRef(({children:e,className:t,position:o="popper",...r},a)=>(0,Ft.jsx)(N.Portal,{children:(0,Ft.jsxs)(N.Content,{className:v("relative z-50 max-h-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:a,...r,children:[(0,Ft.jsx)(Xt,{}),(0,Ft.jsx)(N.Viewport,{className:v("Ft-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),(0,Ft.jsx)(qt,{})]})}));ct.displayName=N.Content.displayName;var Ir=we.forwardRef(({className:e,...t},o)=>(0,Ft.jsx)(N.Label,{className:v("py-1.5 pl-8 pr-2 text-sm font-semibold",e),ref:o,...t}));Ir.displayName=N.Label.displayName;var Ke=we.forwardRef(({children:e,className:t,...o},r)=>(0,Ft.jsxs)(N.Item,{className:v("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,Ft.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,Ft.jsx)(N.ItemIndicator,{children:(0,Ft.jsx)(J.Check,{className:"h-4 w-4"})})}),(0,Ft.jsx)(N.ItemText,{children:e})]}));Ke.displayName=N.Item.displayName;var Hr=we.forwardRef(({className:e,...t},o)=>(0,Ft.jsx)(N.Separator,{className:v("-mx-1 my-1 h-px bg-muted",e),ref:o,...t}));Hr.displayName=N.Separator.displayName;var Yt=Y(require("react")),dt=Y(require("@radix-ui/react-label"));var Lr=(0,Ut.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),mt=Yt.forwardRef(({className:e,...t},o)=>(0,Ft.jsx)(dt.Root,{ref:o,className:v(Lr(),e),...t}));mt.displayName=dt.Root.displayName;var ut=({fieldName:e,value:t,label:o,multiline:r=!1,onSave:a,className:i="",disabled:n=!1})=>{let[c,x]=(0,ee.useState)(!1),[D,y]=(0,ee.useState)(""),u=()=>{n||(x(!0),y(t))},S=async()=>{D!==t&&await a(e,D),x(!1)},V=k=>{k.key==="Enter"&&!r||k.key==="Enter"&&k.ctrlKey&&r?S():k.key==="Escape"&&(x(!1),y(""))};return(0,Ft.jsxs)("div",{className:`space-y-2 ${i}`,children:[(0,Ft.jsx)(mt,{children:o}),c?r?(0,Ft.jsx)(Ie,{value:D,onChange:k=>y(k.target.value),onBlur:S,onKeyDown:V,autoFocus:!0,rows:4,className:"resize-none"}):(0,Ft.jsx)(ue,{value:D,onChange:k=>y(k.target.value),onBlur:S,onKeyPress:V,autoFocus:!0,className:"text-lg font-medium"}):(0,Ft.jsxs)("div",{onClick:u,className:`${n?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted/50 Ft-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,Ft.jsx)("span",{className:r?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click J edit..."}),!n&&(0,Ft.jsx)(J.Edit,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var To=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),ko=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),Eo=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),Io=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),Ho=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),Lo=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),Ao=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),Ye=require("@payloadcms/richtext-lexical/lexical/list"),Oo=require("@payloadcms/richtext-lexical/lexical/rich-text"),Vo=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var So=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),_e=require("@payloadcms/richtext-lexical/lexical/utils"),w=require("@payloadcms/richtext-lexical/lexical"),Rt=require("@payloadcms/richtext-lexical/lexical/selection");var uo=require("@radix-ui/react-dialog"),Ze=require("@payloadcms/richtext-lexical/client");var gt=Y(require("bson-objectid"));var ro=require("@payloadcms/ui");var oo=Y(require("react")),de=Y(require("@radix-ui/react-tooltip"));var We=de.Provider,Ge=de.Root,je=de.Trigger,He=oo.forwardRef(({className:e,sideOffset:t=4,...o},r)=>(0,Ft.jsx)(de.Portal,{children:(0,Ft.jsx)(de.Content,{ref:r,sideOffset:t,className:v("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})}));He.displayName=de.Content.displayName;var Ar=e=>{let{data:{relationTo:t,value:o},nodeKey:r}=e,[a]=(0,So.useLexicalComposerContext)(),[i,n]=(0,ee.useState)(""),[c,x]=(0,ee.useState)(""),[D,y]=(0,ee.useState)(""),u=async f=>{console.log("fetchMedia",f)};(0,ee.useEffect)(()=>{typeof o=="string"?o.length===24?u(o):(n(o||""),y(M(k())),x(V()||"")):typeof o=="object"&&(n(`${process.env.NEXT_PUBLIC_API_URL}${o.url}`||""),y(M(o.filesize)),x(o.mimeType?.split("/")[1]||""))},[]);let S=(0,ee.useCallback)(()=>{a.update(()=>{(0,w.$getNodeByKey)(r)?.remove()})},[a,r]),V=()=>{let f=e.data.value;return typeof f=="string"?f.split(";base64")[0]?.split("image/")[1]:""},k=()=>{let f=e.data.value;if(typeof f=="string"){let T=f.split(",")[1]?.length||0;return 4*Math.ceil(T/3)*.5624896334383812/1e3}return 0};function M(f){if(f>=1e6){let I=f/1e6;return`${I>=10?Math.round(I).toString():I.toFixed(1)} MB`}return`${Math.floor(f/1e3)} KB`}return(0,Ft.jsx)("div",{className:"my-2",contentEditable:!1,children:(0,Ft.jsxs)("div",{className:"border border-slate-800 rounded-xl overflow-clip w-60 flex flex-col gap-2 bg-[#222222]",children:[(0,Ft.jsxs)("div",{className:"flex gap-2 border-b border-b-slate-100/10",children:[(0,Ft.jsx)("div",{className:"flex-1",children:e.data.value?(0,Ft.jsx)("img",{className:"object-cover m-0 w-full min-w-[115px] min-h-[105px]","data-lexical-upload-id":o,"data-lexical-upload-relation-J":t,src:i}):(0,Ft.jsx)(ro.File,{})}),(0,Ft.jsx)(We,{children:(0,Ft.jsxs)(Ge,{children:[(0,Ft.jsxs)(je,{className:"flex-1 flex justify-center items-center text-[#b5b5b5]",children:[(0,Ft.jsx)("span",{className:"font-medium text-sm",children:"Media"}),(0,Ft.jsx)("button",{onClick:f=>{f.preventDefault(),S()},className:"flex-1 flex justify-center items-center",children:(0,Ft.jsx)(J.Ft,{width:24,height:24,strokeWidth:1})})]}),(0,Ft.jsx)(He,{children:(0,Ft.jsx)("span",{children:"Remove image"})})]})})]}),(0,Ft.jsxs)("div",{className:"flex items-center justify-center gap-4 py-3 flex-1 text-xs font-bold",children:[(0,Ft.jsx)("span",{className:"",children:c?.toLocaleUpperCase()}),(0,Ft.jsx)("span",{children:D})]})]})})},so=Ar;function Or(e){if(e.hasAttribute("data-lexical-upload-relation-J")&&e.hasAttribute("data-lexical-upload-id")){let o=e.getAttribute("data-lexical-upload-id");if(o)return{node:De({fields:{},relationTo:"media",value:o})}}return e.src.startsWith("file:///"),null}var Le=class extends Ze.UploadNode{static importDOM(){return{img:()=>({conversion:Or,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new gt.default().toHexString(),t.version=3);let o={id:t.id??new gt.default().toHexString(),fields:t.fields,relationTo:"media",value:t.value},r=De(o);return r.setFormat?.(t.format),r}decorate(){return(0,Ft.jsx)(so,{data:this.__data,nodeKey:this.getKey()})}};function De(e){return new Le({data:e})}var Vr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",zr=e=>Vr?(e||window).getSelection():null,qn=(0,w.createCommand)("INSERT_UPLOAD_WITH_DRAWER_COMMAND"),ht=(0,w.createCommand)("INSERT_UPLOAD_COMMAND");function fo({activeEditor:e,onClose:t,isOpen:o=!1}){let r=(0,ee.useRef)(!1),[a,i]=(0,ee.useState)(!0),[n,c]=(0,ee.useState)(""),[x,D]=(0,ee.useState)(""),[y,u]=(0,ee.useState)(!1),[S,V]=(0,ee.useState)("left"),k=n==="",M=C=>{u(C.target.checked)},f=C=>{V(C.target.value)},T=C=>{let K=new FileReader;K.onload=function(){return typeof K.result=="string"&&c(K.result),""},C!==null&&C[0]&&K.readAsDataURL(C[0])};(0,ee.useEffect)(()=>{r.current=!1;let C=K=>{r.current=K.altKey};return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C)}},[e]),(0,ee.useEffect)(()=>{a||t()},[a]),(0,ee.useEffect)(()=>{i(o)},[o]);let I=({editor:C,relationTo:K,replaceNodeKey:te,value:le})=>{if(te)C.update(()=>{let P=(0,w.$getNodeByKey)(te);P&&P.replace(De({id:"",fields:{},relationTo:"media",value:le}))});else{let P=C.dispatchCommand(ht,{fields:null,relationTo:"media",value:le})}},F=()=>{I({editor:e,relationTo:"media",replaceNodeKey:null,value:{altText:x,src:n,showCaption:y,position:S}.src}),i(!1),t()};return(0,Ft.jsx)(Fe,{open:a,onOpenChange:C=>i(C),children:(0,Ft.jsxs)(at,{children:[(0,Ft.jsxs)(it,{children:[(0,Ft.jsx)(st,{children:"Upload Image"}),(0,Ft.jsx)(uo.DialogDescription,{children:"Description"})]}),(0,Ft.jsxs)("div",{className:"",children:[(0,Ft.jsx)("div",{style:{marginBottom:"1em"},children:(0,Ft.jsx)(ue,{type:"file",onChange:C=>T(C.target.files),accept:"image/*","data-test-id":"image-modal-file-upload"})}),(0,Ft.jsx)("div",{style:{marginBottom:"1em"},children:(0,Ft.jsx)(ue,{"aria-label":"Alt Text",placeholder:"Descriptive alternative text",onChange:C=>D(C.currentTarget.value),value:x,"data-test-id":"image-modal-alt-text-input"})}),(0,Ft.jsx)(se,{"data-test-id":"image-modal-file-upload-btn",disabled:k,onClick:()=>F(),children:"Confirm"})]})]})})}function bt({captionsEnabled:e}){let[t]=(0,So.useLexicalComposerContext)();return(0,ee.useEffect)(()=>{if(!t.hasNodes([Ze.UploadNode]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return(0,_e.mergeRegister)(t.registerCommand(w.DRAGSTART_COMMAND,o=>_r(o),w.COMMAND_PRIORITY_HIGH),t.registerCommand(w.DRAGOVER_COMMAND,o=>Ur(o),w.COMMAND_PRIORITY_LOW),t.registerCommand(w.DROP_COMMAND,o=>Br(o,t),w.COMMAND_PRIORITY_HIGH))},[e,t]),null}function _r(e){if(!vt())return!1;let o=e.dataTransfer;return o?(o.setData("text/plain","J"),!0):!1}function Ur(e){return vt()?(go(e)||e.preventDefault(),!0):!1}function Br(e,t){let o=vt();if(!o)return!1;if(e.preventDefault(),go(e)){let r=Fr(e);o.remove();let a=(0,w.$createRangeSelection)();r!=null&&a.applyDOMRange(r),(0,w.$setSelection)(a)}return!0}function vt(){let e=(0,w.$getSelection)();if(!(0,w.$isNodeSelection)(e))return null;let o=e.getNodes()[0];return(0,Ze.$isUploadNode)(o)?o:null}function go(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 Fr(e){let t,o=e.target,r=o==null?null:o.nodeType===9?o.defaultView:o.ownerDocument.defaultView,a=zr(r);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(e.clientX,e.clientY);else if(e.rangeParent&&a!==null)a.collapse(e.rangeParent,e.rangeOffset||0),t=a.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}var $r=()=>(0,Ft.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,Ft.jsx)("path",{Ft:"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"})}),ho=$r;var Kr=()=>(0,Ft.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,Ft.jsx)("path",{Ft:"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"})}),bo=Kr;var Wr=()=>(0,Ft.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,Ft.jsx)("path",{Ft:"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,Ft.jsx)("path",{Ft:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),vo=Wr;var Gr=()=>(0,Ft.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,Ft.jsx)("path",{Ft:"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,Ft.jsx)("path",{Ft:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),xo=Gr;var jr=()=>(0,Ft.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,Ft.jsx)("path",{Ft:"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"})}),wo=jr;var Zr=()=>(0,Ft.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,Ft.jsx)("path",{Ft:"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"})}),yo=Zr;var Co=()=>(0,Ft.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,Ft.jsx)("path",{Ft:"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"})}),No=()=>(0,Ft.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,Ft.jsx)("path",{Ft:"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"})}),Ro=()=>(0,Ft.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,Ft.jsx)("path",{Ft:"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"})}),Po=()=>(0,Ft.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,Ft.jsx)("path",{Ft:"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"})}),Do=()=>(0,Ft.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,Ft.jsx)("path",{Ft:"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 ge=Y(require("react")),R=Y(require("@radix-ui/react-dropdown-menu")),Se=require("@radix-ui/react-icons");var Je=R.Root,Xe=R.Trigger;var Jr=ge.forwardRef(({className:e,inset:t,children:o,...r},a)=>(0,Ft.jsxs)(R.SubTrigger,{ref:a,className:v("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,Ft.jsx)(Se.ChevronRightIcon,{className:"ml-auto"})]}));Jr.displayName=R.SubTrigger.displayName;var Xr=ge.forwardRef(({className:e,...t},o)=>(0,Ft.jsx)(R.SubContent,{ref:o,className:v("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover Ft-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}));Xr.displayName=R.SubContent.displayName;var Ve=ge.forwardRef(({className:e,sideOffset:t=4,...o},r)=>(0,Ft.jsx)(R.Portal,{children:(0,Ft.jsx)(R.Content,{ref:r,sideOffset:t,className:v("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover Ft-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})}));Ve.displayName=R.Content.displayName;var ze=ge.forwardRef(({className:e,inset:t,...o},r)=>(0,Ft.jsx)(R.Item,{ref:r,className:v("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}));ze.displayName=R.Item.displayName;var qr=ge.forwardRef(({className:e,children:t,checked:o,...r},a)=>(0,Ft.jsxs)(R.CheckboxItem,{ref:a,className:v("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,Ft.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,Ft.jsx)(R.ItemIndicator,{children:(0,Ft.jsx)(Se.CheckIcon,{className:"h-4 w-4"})})}),t]}));qr.displayName=R.CheckboxItem.displayName;var Yr=ge.forwardRef(({className:e,children:t,...o},r)=>(0,Ft.jsxs)(R.RadioItem,{ref:r,className:v("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,Ft.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,Ft.jsx)(R.ItemIndicator,{children:(0,Ft.jsx)(Se.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));Yr.displayName=R.RadioItem.displayName;var Qr=ge.forwardRef(({className:e,inset:t,...o},r)=>(0,Ft.jsx)(R.Label,{ref:r,className:v("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...o}));Qr.displayName=R.Label.displayName;var en=ge.forwardRef(({className:e,...t},o)=>(0,Ft.jsx)(R.Separator,{ref:o,className:v("-mx-1 my-1 h-px bg-muted",e),...t}));en.displayName=R.Separator.displayName;var tn=({className:e,...t})=>(0,Ft.jsx)("span",{className:v("ml-auto text-xs tracking-widest opacity-60",e),...t});tn.displayName="DropdownMenuShortcut";var Nt=1;function on(){return(0,Ft.jsx)("span",{className:"border border-[#222222]"})}function Pt(){let[e]=(0,So.useLexicalComposerContext)(),t=(0,$.useRef)(null),[o,r]=(0,$.useState)(!1),[a,i]=(0,$.useState)(!1),[n,c]=(0,$.useState)(!1),[x,D]=(0,$.useState)(!1),[y,u]=(0,$.useState)(!1),[S,V]=(0,$.useState)(!1),[k,M]=(0,$.useState)(!1),[f,T]=(0,$.useState)(!1),[I,F]=(0,$.useState)(!1),[C,K]=(0,$.useState)("left"),[te,le]=(0,$.useState)("Ft"),P=m=>{e.update(()=>{let H=(0,w.$getSelection)();(0,w.$isRangeSelection)(H)&&(m==="Ft"?(0,Rt.$setBlocksType)(H,()=>(0,w.$createParagraphNode)()):(0,Rt.$setBlocksType)(H,()=>(0,Oo.$createHeadingNode)(m)))})},q=(0,$.useCallback)(()=>{let m=(0,w.$getSelection)();if((0,w.$isRangeSelection)(m)){c(m.hasFormat("bold")),D(m.hasFormat("italic")),u(m.hasFormat("underline")),V(m.hasFormat("strikethrough")),M(m.hasFormat("subscript")),T(m.hasFormat("superscript"));let H=m.anchor.getNode(),U=H;for(;U&&!(0,w.$isParagraphNode)(U)&&U!==(0,w.$getRoot)();){let l=U.getParent();l&&(U=l)}if(U){let l=U.getFormatType();K(l||"left")}let ce=H.getTopLevelElement()?.__tag;le(ce||"Ft")}},[]);(0,$.useEffect)(()=>(0,_e.mergeRegister)(e.registerUpdateListener(({editorState:m})=>{m.read(()=>{q()})}),e.registerCommand(w.SELECTION_CHANGE_COMMAND,(m,H)=>(q(),!1),Nt),e.registerCommand(w.CAN_UNDO_COMMAND,m=>(r(m),!1),Nt),e.registerCommand(w.CAN_REDO_COMMAND,m=>(i(m),!1),Nt),(0,_e.mergeRegister)(e.registerCommand(ht,m=>(e.update(()=>{let H=(0,w.$getSelection)()||(0,w.$getPreviousSelection)();if((0,w.$isRangeSelection)(H)){let U=De({id:m.id,fields:m.fields,relationTo:m.relationTo,value:m.value}),{focus:ce}=H,l=ce.getNode();(0,_e.$insertNodeToNearestRoot)(U),(0,w.$isParagraphNode)(l)&&!l.__first&&l.remove()}}),!0),w.COMMAND_PRIORITY_EDITOR))),[e,q]);let ae=[[{label:"Undo",icon:(0,Ft.jsx)(J.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(w.UNDO_COMMAND,void 0)},disabled:!o},{label:"Redo",icon:(0,Ft.jsx)(J.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(w.UNDO_COMMAND,void 0)},disabled:!a}],[{label:"Bold",icon:(0,Ft.jsx)(ho,{}),onClick:()=>{e.dispatchCommand(w.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:n},{label:"Italic",icon:(0,Ft.jsx)(bo,{}),onClick:()=>{e.dispatchCommand(w.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:x},{label:"Underline",icon:(0,Ft.jsx)(vo,{}),onClick:()=>{e.dispatchCommand(w.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:y},{label:"Strikethrough",icon:(0,Ft.jsx)(xo,{}),onClick:()=>{e.dispatchCommand(w.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:S},{label:"Subscript",icon:(0,Ft.jsx)(wo,{}),onClick:()=>{e.dispatchCommand(w.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:k},{label:"Superscript",icon:(0,Ft.jsx)(yo,{}),onClick:()=>{e.dispatchCommand(w.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:f}]],ie=[{label:"Left Align",direction:"left",icon:(0,Ft.jsx)(J.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(w.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,Ft.jsx)(J.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(w.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,Ft.jsx)(J.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(w.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,Ft.jsx)(J.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(w.FORMAT_ELEMENT_COMMAND,"justify")}}],he=[{label:"Normal Text",value:"Ft",icon:(0,Ft.jsx)(Co,{}),onClick:()=>P("Ft")},{label:"Heading 1",value:"h1",icon:(0,Ft.jsx)(No,{}),onClick:()=>P("h1")},{label:"Heading 2",value:"h2",icon:(0,Ft.jsx)(Ro,{}),onClick:()=>P("h2")},{label:"Heading 3",value:"h3",icon:(0,Ft.jsx)(Po,{}),onClick:()=>P("h3")},{label:"Heading 4",value:"h4",icon:(0,Ft.jsx)(Do,{}),onClick:()=>P("h4")},...[{label:"Unordered List",value:"ul",icon:(0,Ft.jsx)(J.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ye.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,Ft.jsx)(J.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ye.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],be=[{label:"Insert Image",icon:(0,Ft.jsx)(J.ImageUp,{width:15,height:15}),onClick:()=>{F(!0)},disabled:!1}];return(0,Ft.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2 sticky top-0 bg-black z-50",children:(0,Ft.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[ae.map((m,H)=>(0,Ft.jsxs)($.Fragment,{children:[(0,Ft.jsx)("div",{className:"flex items-center gap-2",children:m.map((U,ce)=>(0,Ft.jsx)("div",{role:"button","aria-disabled":U.disabled||!1,onClick:U.onClick,className:v("Ft-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]",U.active&&"bg-[#3c3c3c]"),"aria-label":U.label,children:(0,Ft.jsx)(We,{children:(0,Ft.jsxs)(Ge,{children:[(0,Ft.jsx)(je,{className:"text-[#b5b5b5]",children:U.icon}),(0,Ft.jsx)(He,{children:(0,Ft.jsx)("Ft",{children:U.label})})]})})},ce))}),(0,Ft.jsx)(on,{})]},`toolbar-option-${m.length}-${H}`)),(0,Ft.jsxs)(Je,{children:[(0,Ft.jsxs)(Xe,{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:[ie.find(m=>m.direction===C)?.icon,ie.find(m=>m.direction===C)?.label,(0,Ft.jsx)(J.ChevronDown,{width:15,height:15})]}),(0,Ft.jsx)(Ve,{className:"bg-black hover:bg-black",children:ie.map((m,H)=>(0,Ft.jsxs)(ze,{onClick:m.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,Ft.jsx)("span",{children:m.icon}),(0,Ft.jsx)("span",{children:m.label})]},`${m.label}-${H}`))})]}),(0,Ft.jsxs)(Je,{children:[(0,Ft.jsxs)(Xe,{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:[he.find(m=>m.value===te)?.icon,he.find(m=>m.value===te)?.label,(0,Ft.jsx)(J.ChevronDown,{width:15,height:15})]}),(0,Ft.jsx)(Ve,{className:"bg-black hover:bg-black",children:he.map((m,H)=>(0,Ft.jsxs)(ze,{onClick:m.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,Ft.jsx)("span",{children:m.icon}),(0,Ft.jsx)("span",{children:m.label})]},`heading-option-${m.label}-${H}`))})]}),(0,Ft.jsxs)(Je,{children:[(0,Ft.jsxs)(Xe,{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,Ft.jsx)(J.Plus,{width:15,height:15}),(0,Ft.jsx)(J.ChevronDown,{width:15,height:15})]}),(0,Ft.jsx)(Ve,{className:"bg-black hover:bg-black",children:be.map((m,H)=>(0,Ft.jsxs)(ze,{onClick:m.onClick,disabled:m.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,Ft.jsx)("span",{children:m.icon}),(0,Ft.jsx)("span",{children:m.label})]},H))})]}),I&&(0,Ft.jsx)(fo,{activeEditor:e,onClose:()=>{F(!1)},isOpen:I})]})})}var rn=({setValue:e,value:t,name:o,editable:r=!0})=>{let[a]=(0,So.useLexicalComposerContext)(),i=n=>{n.read(()=>{let c=n.toJSON();e?.(()=>c)})};return(0,ee.useEffect)(()=>{a.setEditable(r)},[r]),(0,ee.useEffect)(()=>{t&&a.update(()=>{a.setEditorState(a.parseEditorState(t))})},[]),(0,Ft.jsx)("div",{className:"w-full",children:(0,Ft.jsxs)("div",{className:" ",children:[r&&(0,Ft.jsx)(Pt,{}),(0,Ft.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,Ft.jsx)(Lo.RichTextPlugin,{contentEditable:(0,Ft.jsx)(Eo.ContentEditable,{name:o,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-h-40"}),ErrorBoundary:Io.LexicalErrorBoundary}),r&&(0,Ft.jsxs)(Ft.Fragment,{children:[(0,Ft.jsx)(Ho.HistoryPlugin,{}),(0,Ft.jsx)(To.AutoFocusPlugin,{}),(0,Ft.jsx)(Ao.ListPlugin,{}),(0,Ft.jsx)(Vo.OnChangePlugin,{onChange:i}),(0,Ft.jsx)(bt,{})]})]})]})})},nn=({setValue:e,value:t,name:o,editable:r=!0})=>(0,Ft.jsx)(ko.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[Ye.ListNode,Ye.ListItemNode,Oo.HeadingNode,Le],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,Ft.jsx)(rn,{value:t,setValue:e,name:o,editable:r})}),Qe=nn;function _o({document:e,onSave:t,mode:o="edit",onCancel:r,availableDocuments:a=[],knowledgeContexts:i=[]}){let[n,c]=(0,ee.useState)({...e,updatedAt:new Date}),[x,D]=(0,ee.useState)(!1),[y,u]=(0,ee.useState)(n.richTextContent),[S,V]=(0,ee.useState)(!1),k=(0,ee.useRef)(null),M=(0,ee.useRef)(""),f=(0,ee.useRef)(null),T=(0,ee.useRef)(null),I=l=>{let h=new WeakSet,g=z=>z&&typeof z=="object"?h.has(z)?null:(h.add(z),Array.isArray(z)?z.map(g):Object.keys(z).sort().reduce((W,Ce)=>(W[Ce]=g(z[Ce]),W),{})):z;return JSON.stringify(g(l))},F=l=>l?l.replace(/\Ft+/g," ").trim():"",C=()=>n.format==="richText"?I(y):F(n.content),K=()=>{let l={title:F(n.title),description:F(n.description),format:n.format,content:C()},h=I(l),g=5381;for(let z=0;z<h.length;z++)g=g*33^h.charCodeAt(z);return(g>>>0).toString(16)},te=(l,h)=>{if(l===h)return!1;if(n.format!=="richText"){let g=P(l),z=C();if(g==null)return!0;let W=g.length,Ce=z.length,Me=Math.abs(Ce-W),Ue=W===0?1:Me/W;return F(g)===F(z)&&Me<3?!1:Me>=10||Ue>=.02}return!0},le=(0,ee.useRef)(new Map),P=l=>{let h=le.current.get(l);return h==null?null:"x".repeat(h)};(0,ee.useEffect)(()=>(T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{let l=K(),h=M.current;if(te(h,l)&&(V(!0),t({...n,richTextContent:y},"autosave"),M.current=l,n.format!=="richText")){let g=C();le.current.set(l,g.length)}},800),()=>{T.current&&clearTimeout(T.current)}),[n.title,n.description,n.format,n.content,n.metadata,y]),(0,ee.useEffect)(()=>{let l=()=>{let h=K();h!==M.current&&(t({...n,richTextContent:y},"autosave"),M.current=h)};return window.addEventListener("pagehide",l),window.addEventListener("beforeunload",l),()=>{window.removeEventListener("pagehide",l),window.removeEventListener("beforeunload",l)}},[n,y]),(0,ee.useEffect)(()=>(S&&(f.current=setTimeout(()=>{V(!1)},2e3)),()=>{f.current&&clearTimeout(f.current)}),[S]),(0,ee.useEffect)(()=>{c(e)},[e]);let q=l=>{switch(l){case"markdown":case"mdx":return(0,Ft.jsx)(J.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,Ft.jsx)(J.File,{className:"h-6 w-6 text-success"});case"text":return(0,Ft.jsx)(J.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,Ft.jsx)(J.File,{className:"h-6 w-6 text-muted-foreground"})}},ae=l=>{switch(l){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"}},ie=()=>{let l=new Set,h=new Set;return i.forEach(g=>{g.menuConfig.groupBy.forEach(z=>l.add(z))}),a.forEach(g=>{g.metadata&&Object.keys(g.metadata).forEach(z=>h.add(z))}),{contextKeys:Array.from(l).sort(),documentKeys:Array.from(h).sort(),allKeys:Array.from(new Set([...l,...h])).sort()}},E=l=>{let h=new Set;return a.forEach(g=>{g.metadata?.[l]&&h.add(String(g.metadata[l]))}),Array.from(h).sort()},he=ie(),be=()=>{t({...n,richTextContent:y},"autosave")},m=(l,h)=>{c(g=>({...g,metadata:{...g.metadata,[l]:h}}))},H=(l,h)=>{h==="__custom__"?m(l,""):m(l,h)},U=()=>{m("","")},ce=l=>{c(h=>{let g={...h.metadata};return delete g[l],{...h,metadata:g}})};return(0,Ft.jsxs)(Mt.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,Ft.jsxs)("div",{className:"border-b border-border bg-card Ft-8 pb-6",children:[(0,Ft.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,Ft.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,Ft.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Ft.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,Ft.jsx)("div",{className:"flex-1 min-w-0",children:(0,Ft.jsx)(ut,{fieldName:"title",value:n.title,label:"",onSave:(l,h)=>c(g=>({...g,title:h})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:Ft-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),(0,Ft.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${ae(n.format)} flex-shrink-0 mt-1`,children:n.format.toUpperCase()})]}),(0,Ft.jsx)("div",{className:"mt-2",children:(0,Ft.jsx)(ut,{fieldName:"description",value:n.description||"Click J add description...",label:"",multiline:!0,onSave:(l,h)=>c(g=>({...g,description:h})),className:"[&>div:last-child]:text-muted-foreground [&>div:last-child]:text-lg [&>div:last-child]:leading-relaxed [&>div:last-child]:Ft-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})})]})}),(0,Ft.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,Ft.jsxs)(se,{variant:"ghost",size:"sm",onClick:()=>D(!x),className:"gap-2",children:[(0,Ft.jsx)(J.Info,{className:"h-4 w-4"}),"Metadata",n.metadata&&Object.keys(n.metadata).length>0&&(0,Ft.jsx)("span",{className:"inline-flex items-center justify-center w-5 h-5 text-xs font-medium bg-primary/10 text-primary rounded-full",children:Object.keys(n.metadata).length}),x?(0,Ft.jsx)(J.ChevronDown,{className:"h-4 w-4"}):(0,Ft.jsx)(J.ChevronRight,{className:"h-4 w-4"})]}),(0,Ft.jsxs)(se,{variant:"outline",size:"sm",onClick:r,className:"gap-2",children:[(0,Ft.jsx)(J.Ft,{className:"h-4 w-4"}),"Close"]}),(0,Ft.jsxs)(se,{size:"sm",onClick:be,className:"gap-2",disabled:S,children:[S?(0,Ft.jsx)(J.Loader2,{className:"h-4 w-4 animate-spin"}):(0,Ft.jsx)(J.Save,{className:"h-4 w-4"}),S?"Auto-saving...":"Save"]})]})]}),(0,Ft.jsx)(Mt.motion.div,{initial:!1,animate:{height:x?"auto":0,opacity:x?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden h-full max-h-full",children:(0,Ft.jsxs)("div",{className:"ee-4 border-t border-border mt-4 max-h-full flex gap-2",children:[(0,Ft.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,Ft.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,Ft.jsx)(J.Info,{className:"h-4 w-4"}),"Document Metadata"]})}),(0,Ft.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,Ft.jsx)("div",{className:"bg-muted rounded-lg Ft-4 border border-border",children:n.metadata&&Object.keys(n.metadata).length>0?(0,Ft.jsx)("div",{className:"space-y-2",children:Object.entries(n.metadata).map(([l,h],g)=>{let z=E(l);return(0,Ft.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,Ft.jsx)(ue,{value:l,onChange:W=>{let Ce=W.target.value||"",Me=n.metadata?.[l];c(Ue=>{let et={...Ue.metadata};return delete et[l],Ce&&(et[Ce]=Me||""),{...Ue,metadata:et}})},placeholder:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${l}`}),(0,Ft.jsx)("datalist",{id:`metadata-keys-${l}`,children:he.allKeys.map(W=>(0,Ft.jsx)("option",{value:W},W))}),(0,Ft.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),z.length>0?(0,Ft.jsxs)(Zt,{value:String(h||""),onValueChange:W=>H(l,W),children:[(0,Ft.jsx)(lt,{className:"flex-1 h-8 text-sm",children:(0,Ft.jsx)(Jt,{placeholder:"Value"})}),(0,Ft.jsxs)(ct,{children:[z.map(W=>(0,Ft.jsx)(Ke,{value:W,children:W},W)),(0,Ft.jsx)(Ke,{value:"__custom__",children:(0,Ft.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,Ft.jsx)(ue,{value:String(h||""),onChange:W=>m(l,W.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,Ft.jsx)(se,{type:"button",variant:"ghost",size:"sm",onClick:()=>ce(l),className:"h-8 w-8 Ft-0 text-muted-foreground hover:text-destructive",children:(0,Ft.jsx)(J.Ft,{className:"h-3 w-3"})})]},`metadata-key-${g}`)})}):(0,Ft.jsxs)("div",{className:"text-center py-4",children:[(0,Ft.jsx)("Ft",{className:"text-sm text-muted-foreground mb-2",children:"No metadata fields"}),(0,Ft.jsx)("Ft",{className:"text-xs text-muted-foreground",children:'Click "Add Field" J create metadata'})]})}),(0,Ft.jsxs)(se,{type:"button",variant:"outline",size:"sm",onClick:U,className:"gap-1 h-8",children:[(0,Ft.jsx)(J.Plus,{className:"h-3 w-3"}),"Add Field"]})]})]})})]}),(0,Ft.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,Ft.jsx)("div",{className:"Ft-8 ee-0 h-full max-h-full overflow-auto",children:n.format==="richText"?(0,Ft.jsx)(Qe,{setValue:u,value:y,name:"richTextContent"}):(0,Ft.jsx)(Ie,{value:n.content||"",onChange:l=>c(h=>({...h,content:l.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})]})}var Fo=Y(require("react-markdown")),$o=Y(require("remark-gfm"));var Ko=e=>(0,Ft.jsx)(Fo.default,{remarkPlugins:[$o.default],components:{h1:({children:t})=>(0,Ft.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,Ft.jsx)("h2",{className:"text-xl font-bold",children:t}),h3:({children:t})=>(0,Ft.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,Ft.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,Ft.jsx)("ol",{className:"list-decimal",children:t}),ul:({children:t})=>(0,Ft.jsx)("ul",{className:"list-disc",children:t}),li:({children:t})=>(0,Ft.jsx)("li",{className:"ml-4",children:t}),Ft:({children:t})=>(0,Ft.jsx)("Ft",{className:"mb-4",children:t}),a:({children:t,href:o})=>(0,Ft.jsx)("a",{href:o,className:"text-blue-500",children:t}),img:({src:t,alt:o})=>(0,Ft.jsx)("img",{src:t,alt:o,className:"mb-4"}),blockquote:({children:t})=>(0,Ft.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),Uo=e=>(0,Ft.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),an=e=>(0,Ft.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:e&&(0,Ft.jsx)(Qe,{value:JSON.stringify(e),editable:!1,name:"richTextContent"},JSON.stringify(e))}),sn=e=>(0,Ft.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,Ft.jsx)("div",{className:"bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg Ft-4 mb-4",children:(0,Ft.jsxs)("Ft",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,Ft.jsx)("strong",{children:"MDX Renderer:"})," This is a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),Ko(e)]});function ln({document:e,onDocumentUpdate:t,editable:o=!0,mode:r="view",renderers:a,availableDocuments:i=[],knowledgeContexts:n=[]}){let[c,x]=(0,ee.useState)(!1),[D,y]=(0,ee.useState)(!1),[u,S]=(0,ee.useState)(e),[V,k]=(0,ee.useState)(!1),M=(0,ee.useRef)(null),f=u.format==="richText"?u.richTextContent:u.content,T=(0,ee.useMemo)(()=>`${u.format}:${JSON.stringify(f)}`,[u.format,f]);(0,ee.useEffect)(()=>{S(e)},[e]);let I=P=>{switch(P){case"markdown":case"mdx":return(0,Ft.jsx)(J.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,Ft.jsx)(J.File,{className:"h-6 w-6 text-success"});case"text":return(0,Ft.jsx)(J.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,Ft.jsx)(J.File,{className:"h-6 w-6 text-muted-foreground"})}},F=P=>{switch(P){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"}},C=(P,q)=>{let ae={markdown:Ko,mdx:sn,text:Uo},ie=a?.[q]||ae[q];if(q==="richText"&&typeof P=="object")return an(P);if(ie&&typeof P=="string")return ie(P);if(typeof P=="string")return Uo(P)},K=async(P,q="save")=>{q==="save"&&k(!0),M.current=u,(0,ee.startTransition)(()=>{S({...P,richTextContent:P.richTextContent?structuredClone(P.richTextContent):void 0})});try{let ae=await t?.(P);if(q==="save"&&k(!1),!ae)throw new Error("save failed")}catch{M.current&&(0,ee.startTransition)(()=>S(M.current))}},te=()=>{x(!1)};return(0,Ft.jsxs)(Ft.Fragment,{children:[(0,Ft.jsx)(Fe,{open:c||r==="create",onOpenChange:P=>!P&&te(),children:(0,Ft.jsxs)(nt,{children:[(0,Ft.jsx)($e,{}),(0,Ft.jsxs)(Bo.Content,{className:v("fixed inset-0 z-50 bg-background Ft-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:[V&&(0,Ft.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center",children:(0,Ft.jsx)(J.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),(0,Ft.jsx)(_o,{mode:r==="create"?"create":"edit",document:u,onSave:K,onCancel:te,availableDocuments:i,knowledgeContexts:n})]})]})}),(0,Ft.jsxs)(Mt.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,Ft.jsxs)("div",{className:"border-b border-border bg-card Ft-8 pb-6",children:[(0,Ft.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,Ft.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,Ft.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Ft.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[u.title,(0,Ft.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${F(u.format)}`,children:u.format.toUpperCase()})]}),u.description&&(0,Ft.jsx)("Ft",{className:"text-muted-foreground text-lg leading-relaxed",children:u.description})]})}),(0,Ft.jsxs)("div",{className:"items-center gap-2 flex-shrink-0 hidden lg:flex",children:[u.metadata&&Object.keys(u.metadata).length>0&&(0,Ft.jsxs)(se,{variant:"ghost",size:"sm",onClick:()=>y(!D),className:"gap-2",children:[(0,Ft.jsx)(J.Info,{className:"h-4 w-4"}),"Metadata",D?(0,Ft.jsx)(J.ChevronDown,{className:"h-4 w-4"}):(0,Ft.jsx)(J.ChevronRight,{className:"h-4 w-4"})]}),o&&(0,Ft.jsxs)(se,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[(0,Ft.jsx)(J.Edit3,{className:"h-4 w-4"}),"Edit"]})]})]}),u.metadata&&Object.keys(u.metadata).length>0&&(0,Ft.jsx)(Mt.motion.div,{initial:!1,animate:{height:D?"auto":0,opacity:D?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,Ft.jsxs)("div",{className:"ee-4 border-t border-border mt-4",children:[(0,Ft.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,Ft.jsx)(J.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,Ft.jsx)("div",{className:"bg-muted rounded-lg Ft-4 border border-border",children:(0,Ft.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(u.metadata).map(([P,q])=>(0,Ft.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,Ft.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:P.replace(/([w-Ft])/g," $1").trim()}),(0,Ft.jsx)("span",{className:"text-foreground font-medium",children:String(q)})]},P))})})]})})]}),(0,Ft.jsx)("div",{className:"flex-1 ",children:(0,Ft.jsx)("div",{className:"py-4 h-full",children:(0,Ft.jsx)("div",{className:"space-y-4",children:u.content||u.richTextContent?(0,Ft.jsx)("div",{className:"relative",children:(0,Ft.jsx)("div",{className:"bg-background px-8 overflow-hidden h-full flex-1",children:C(u.format==="richText"?u.richTextContent:u.content,u.format)})},T):(0,Ft.jsxs)("div",{className:"text-center Ft-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,Ft.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,Ft.jsx)(J.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,Ft.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"No content available"}),(0,Ft.jsx)("Ft",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})]})}0&&(module.exports={DocumentPreview});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";import{a}from"../../chunk-QKOBOCKK.mjs";import"../../chunk-ACGCNGIH.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-YFAZQYK4.mjs";import"../../chunk-B4H6T2GP.mjs";import"../../chunk-TVZOULLL.mjs";import"../../chunk-OCPX4QPC.mjs";import"../../chunk-3UMMMQEH.mjs";import"../../chunk-L5JPAKPM.mjs";import"../../chunk-KY7WQYN4.mjs";import"../../chunk-ZUA4KNIR.mjs";import"../../chunk-QTW33JYG.mjs";import"../../chunk-MDJREBVI.mjs";import"../../chunk-ZWHGOTSF.mjs";import"../../chunk-Q3G5UAAD.mjs";import"../../chunk-XGRRLABA.mjs";import"../../chunk-YEKQJ4YC.mjs";export{a as DocumentPreview};
2
+ "use strict";import{a}from"../../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-YFAZQYK4.mjs";import"../../chunk-B4H6T2GP.mjs";import"../../chunk-TVZOULLL.mjs";import"../../chunk-OCPX4QPC.mjs";import"../../chunk-3UMMMQEH.mjs";import"../../chunk-L5JPAKPM.mjs";import"../../chunk-KY7WQYN4.mjs";import"../../chunk-ZUA4KNIR.mjs";import"../../chunk-QTW33JYG.mjs";import"../../chunk-MDJREBVI.mjs";import"../../chunk-ZWHGOTSF.mjs";import"../../chunk-Q3G5UAAD.mjs";import"../../chunk-XGRRLABA.mjs";import"../../chunk-YEKQJ4YC.mjs";export{a as DocumentPreview};