cortex-react-components 2.26.2 → 2.26.4

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 (117) hide show
  1. package/dist/{chunk-GTZJWMZR.mjs → chunk-5MMNC65L.mjs} +1 -1
  2. package/dist/{chunk-GHOL5L32.mjs → chunk-7BYNW77I.mjs} +1 -1
  3. package/dist/{chunk-C4RWEPVF.mjs → chunk-7MPZOMXK.mjs} +1 -1
  4. package/dist/{chunk-75F3LJMX.mjs → chunk-AABB4TFO.mjs} +1 -1
  5. package/dist/chunk-AN744MXS.mjs +9 -0
  6. package/dist/{chunk-RGOKBIQ5.mjs → chunk-CC57QZMB.mjs} +1 -1
  7. package/dist/{chunk-LJXTXROJ.mjs → chunk-EM4CGGGV.mjs} +1 -1
  8. package/dist/{chunk-AJQHGVZ5.mjs → chunk-FB5PBKLV.mjs} +1 -1
  9. package/dist/{chunk-TVTTUSWM.mjs → chunk-FBEHQRZ4.mjs} +1 -1
  10. package/dist/{chunk-2SQVMYDK.mjs → chunk-FR4X2HHQ.mjs} +1 -1
  11. package/dist/{chunk-KQB6MFFS.mjs → chunk-HLRMUJPL.mjs} +1 -1
  12. package/dist/{chunk-2HKAJ4TZ.mjs → chunk-HTS3KCJL.mjs} +1 -1
  13. package/dist/{chunk-3Y7QG6VP.mjs → chunk-IISYRLNU.mjs} +1 -1
  14. package/dist/{chunk-6UDBIRMT.mjs → chunk-IO5ZSALG.mjs} +1 -1
  15. package/dist/{chunk-NINFDOV5.mjs → chunk-ITNR7N47.mjs} +1 -1
  16. package/dist/{chunk-EM3T2XYC.mjs → chunk-J3VJUPR7.mjs} +1 -1
  17. package/dist/{chunk-FE7ZGUPU.mjs → chunk-JU4TJYSZ.mjs} +1 -1
  18. package/dist/{chunk-RJGYVDOU.mjs → chunk-MU47F4UR.mjs} +1 -1
  19. package/dist/{chunk-WIRQ5IRT.mjs → chunk-NDBSSX6Q.mjs} +1 -1
  20. package/dist/{chunk-3MEOSYPN.mjs → chunk-NZJ7VVG6.mjs} +1 -1
  21. package/dist/{chunk-XDELWNND.mjs → chunk-OP6ZWZIM.mjs} +1 -1
  22. package/dist/{chunk-ZEALRBXW.mjs → chunk-OVZKO3Z5.mjs} +1 -1
  23. package/dist/{chunk-3HNU2NYP.mjs → chunk-QDP657UR.mjs} +1 -1
  24. package/dist/{chunk-36UEU4CT.mjs → chunk-RWHPQAWZ.mjs} +1 -1
  25. package/dist/{chunk-2BRDNDUB.mjs → chunk-SME3D72Q.mjs} +1 -1
  26. package/dist/{chunk-3NRXQBBS.mjs → chunk-TIIYFAV6.mjs} +1 -1
  27. package/dist/{chunk-7R47MHQE.mjs → chunk-TQKXHMD7.mjs} +1 -1
  28. package/dist/{chunk-CXOVEABI.mjs → chunk-VNKGAW4K.mjs} +1 -1
  29. package/dist/{chunk-GVDM4RRN.mjs → chunk-WRCRZUGO.mjs} +1 -1
  30. package/dist/{chunk-5MWZTJYP.mjs → chunk-YH72WKGC.mjs} +1 -1
  31. package/dist/{chunk-K4DQ5KUH.mjs → chunk-ZA423OPA.mjs} +1 -1
  32. package/dist/components/Blocks/Banner.mjs +1 -1
  33. package/dist/components/Blocks/CallToAction.mjs +1 -1
  34. package/dist/components/Blocks/CollapsibleArea.mjs +1 -1
  35. package/dist/components/Blocks/Content.mjs +1 -1
  36. package/dist/components/Blocks/FeaturesBlock.mjs +1 -1
  37. package/dist/components/Blocks/RelatedPosts.mjs +1 -1
  38. package/dist/components/Blocks/RenderBlocks.mjs +1 -1
  39. package/dist/components/Blocks/ReusableContentBlock.mjs +1 -1
  40. package/dist/components/Blocks/index.mjs +1 -1
  41. package/dist/components/Cards/ContentCard.mjs +1 -1
  42. package/dist/components/Cards/FeatureCard.mjs +1 -1
  43. package/dist/components/Cards/index.mjs +1 -1
  44. package/dist/components/DigitalColleagues/MainPage.mjs +1 -1
  45. package/dist/components/DigitalColleagues/Pages/dashboardpage.js +6 -6
  46. package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +1 -1
  47. package/dist/components/DigitalColleagues/Views/index.js +6 -6
  48. package/dist/components/DigitalColleagues/Views/index.mjs +1 -1
  49. package/dist/components/DigitalColleagues/index.js +6 -6
  50. package/dist/components/DigitalColleagues/index.mjs +1 -1
  51. package/dist/components/Foundary/MainPage.mjs +1 -1
  52. package/dist/components/Foundary/Pages/dashboardpage.js +6 -6
  53. package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
  54. package/dist/components/Foundary/Views/index.js +6 -6
  55. package/dist/components/Foundary/Views/index.mjs +1 -1
  56. package/dist/components/Foundary/file-edit.js +6 -6
  57. package/dist/components/Foundary/file-edit.mjs +1 -1
  58. package/dist/components/Foundary/index.js +6 -6
  59. package/dist/components/Foundary/index.mjs +1 -1
  60. package/dist/components/Foundary/types.d.ts +18 -7
  61. package/dist/components/HeaderFooter/SectionHeading.mjs +1 -1
  62. package/dist/components/HeaderFooter/index.mjs +1 -1
  63. package/dist/components/Heros/HighImpact/index.mjs +1 -1
  64. package/dist/components/Heros/LowImpact/index.mjs +1 -1
  65. package/dist/components/Heros/MediumImpact/index.mjs +1 -1
  66. package/dist/components/Heros/RenderHero.mjs +1 -1
  67. package/dist/components/Heros/index.mjs +1 -1
  68. package/dist/components/Layouts/OutputHeaderFooter.mjs +1 -1
  69. package/dist/components/Layouts/Print.mjs +1 -1
  70. package/dist/components/Layouts/SlideShow.mjs +1 -1
  71. package/dist/components/Layouts/index.mjs +1 -1
  72. package/dist/components/Payload/RichText/index.mjs +1 -1
  73. package/dist/components/Payload/RichText/serialize.mjs +1 -1
  74. package/dist/components/Payload/index.mjs +1 -1
  75. package/dist/components/Projects/FileView.js +6 -6
  76. package/dist/components/Projects/FileView.mjs +1 -1
  77. package/dist/components/Projects/KanbanBoardView.js +6 -6
  78. package/dist/components/Projects/KanbanBoardView.mjs +1 -1
  79. package/dist/components/Projects/ProjectPage.js +6 -6
  80. package/dist/components/Projects/ProjectPage.mjs +1 -1
  81. package/dist/components/Projects/ProjectView.js +6 -6
  82. package/dist/components/Projects/ProjectView.mjs +1 -1
  83. package/dist/components/Projects/ProjectsIndexView.mjs +1 -1
  84. package/dist/components/Projects/TaskDetailsModal.js +6 -6
  85. package/dist/components/Projects/TaskDetailsModal.mjs +1 -1
  86. package/dist/components/Projects/file-list.js +6 -6
  87. package/dist/components/Projects/file-list.mjs +1 -1
  88. package/dist/components/Projects/index.js +6 -6
  89. package/dist/components/Projects/index.mjs +1 -1
  90. package/dist/components/dc-temp/index.js +6 -6
  91. package/dist/components/dc-temp/index.mjs +1 -1
  92. package/dist/components/index.js +19 -19
  93. package/dist/components/index.mjs +1 -1
  94. package/dist/index.js +21 -21
  95. package/dist/index.mjs +1 -1
  96. package/dist/metafile-cjs.json +1 -1
  97. package/dist/metafile-esm.json +1 -1
  98. package/dist/pages/Blog.mjs +1 -1
  99. package/dist/pages/Documentation.mjs +1 -1
  100. package/dist/pages/IndexPage.mjs +1 -1
  101. package/dist/pages/Intranet.mjs +1 -1
  102. package/dist/pages/LandingPage.mjs +1 -1
  103. package/dist/pages/Page.mjs +1 -1
  104. package/dist/pages/Publish.mjs +1 -1
  105. package/dist/pages/Website.mjs +1 -1
  106. package/dist/sections/AboutSection.mjs +1 -1
  107. package/dist/sections/BlogDetail.mjs +1 -1
  108. package/dist/sections/BlogList.mjs +1 -1
  109. package/dist/sections/ContactSection.mjs +1 -1
  110. package/dist/sections/PageSections.mjs +1 -1
  111. package/dist/sections/PricingSection.mjs +1 -1
  112. package/dist/sections/ServiceDetail.mjs +1 -1
  113. package/dist/sections/ServiceDetailSection.mjs +1 -1
  114. package/dist/sections/ServiceSection.mjs +1 -1
  115. package/dist/sections/index.mjs +1 -1
  116. package/package.json +1 -1
  117. package/dist/chunk-P5LSKHQC.mjs +0 -9
@@ -2,9 +2,9 @@
2
2
  "use strict";
3
3
  "use client"
4
4
 
5
- "use strict";"use client";var Nn=Object.create;var _a=Object.defineProperty;var Dn=Object.getOwnPropertyDescriptor;var Sn=Object.getOwnPropertyNames;var kn=Object.getPrototypeOf,Tn=Object.prototype.hasOwnProperty;var An=(e,t)=>{for(var a in t)_a(e,a,{get:t[a],enumerable:!0})},ri=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Sn(t))!Tn.call(e,r)&&r!==a&&_a(e,r,{get:()=>t[r],enumerable:!(o=Dn(t,r))||o.enumerable});return e};var ue=(e,t,a)=>(a=e!=null?Nn(kn(e)):{},ri(t||!e||!e.__esModule?_a(a,"default",{value:e,enumerable:!0}):a,e)),Pn=e=>ri(_a({},"__esModule",{value:!0}),e);var Hs={};An(Hs,{default:()=>Cn});module.exports=Pn(Hs);var ii=require("react"),Co=require("motion/react"),wn=require("lucide-react");var ui=require("clsx");var So="-",Rn=e=>{let t=In(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:n=>{let l=n.split(So);return l[0]===""&&l.length!==1&&l.shift(),li(l,t)||Mn(n)},getConflictingClassGroupIds:(n,l)=>{let c=a[n]||[];return l&&o[n]?[...c,...o[n]]:c}}},li=(e,t)=>{if(e.length===0)return t.classGroupId;let a=e[0],o=t.nextPart.get(a),r=o?li(e.slice(1),o):void 0;if(r)return r;if(t.validators.length===0)return;let i=e.join(So);return t.validators.find(({validator:n})=>n(i))?.classGroupId},ni=/^\[(.+)\]$/,Mn=e=>{if(ni.test(e)){let t=ni.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},In=e=>{let{theme:t,prefix:a}=e,o={nextPart:new Map,validators:[]};return Bn(Object.entries(e.classGroups),a).forEach(([i,n])=>{Do(n,o,i,t)}),o},Do=(e,t,a,o)=>{e.forEach(r=>{if(typeof r=="string"){let i=r===""?t:si(t,r);i.classGroupId=a;return}if(typeof r=="function"){if(Ln(r)){Do(r(o),t,a,o);return}t.validators.push({validator:r,classGroupId:a});return}Object.entries(r).forEach(([i,n])=>{Do(n,si(t,i),a,o)})})},si=(e,t)=>{let a=e;return t.split(So).forEach(o=>{a.nextPart.has(o)||a.nextPart.set(o,{nextPart:new Map,validators:[]}),a=a.nextPart.get(o)}),a},Ln=e=>e.isThemeGetter,Bn=(e,t)=>t?e.map(([a,o])=>{let r=o.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([n,l])=>[t+n,l])):i);return[a,r]}):e,En=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=new Map,o=new Map,r=(i,n)=>{a.set(i,n),t++,t>e&&(t=0,o=a,a=new Map)};return{get(i){let n=a.get(i);if(n!==void 0)return n;if((n=o.get(i))!==void 0)return r(i,n),n},set(i,n){a.has(i)?a.set(i,n):r(i,n)}}},di="!",Fn=e=>{let{separator:t,experimentalParseClassName:a}=e,o=t.length===1,r=t[0],i=t.length,n=l=>{let c=[],d=0,f=0,m;for(let s=0;s<l.length;s++){let u=l[s];if(d===0){if(u===r&&(o||l.slice(s,s+i)===t)){c.push(l.slice(f,s)),f=s+i;continue}if(u==="/"){m=s;continue}}u==="["?d++:u==="]"&&d--}let p=c.length===0?l:l.substring(f),b=p.startsWith(di),h=b?p.substring(1):p,g=m&&m>f?m-f:void 0;return{modifiers:c,hasImportantModifier:b,baseClassName:h,maybePostfixModifierPosition:g}};return a?l=>a({className:l,parseClassName:n}):n},Hn=e=>{if(e.length<=1)return e;let t=[],a=[];return e.forEach(o=>{o[0]==="["?(t.push(...a.sort(),o),a=[]):a.push(o)}),t.push(...a.sort()),t},jn=e=>({cache:En(e.cacheSize),parseClassName:Fn(e),...Rn(e)}),Un=/\s+/,Kn=(e,t)=>{let{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:r}=t,i=[],n=e.trim().split(Un),l="";for(let c=n.length-1;c>=0;c-=1){let d=n[c],{modifiers:f,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:b}=a(d),h=!!b,g=o(h?p.substring(0,b):p);if(!g){if(!h){l=d+(l.length>0?" "+l:l);continue}if(g=o(p),!g){l=d+(l.length>0?" "+l:l);continue}h=!1}let s=Hn(f).join(":"),u=m?s+di:s,N=u+g;if(i.includes(N))continue;i.push(N);let R=r(g,h);for(let S=0;S<R.length;++S){let $=R[S];i.push(u+$)}l=d+(l.length>0?" "+l:l)}return l};function On(){let e=0,t,a,o="";for(;e<arguments.length;)(t=arguments[e++])&&(a=ci(t))&&(o&&(o+=" "),o+=a);return o}var ci=e=>{if(typeof e=="string")return e;let t,a="";for(let o=0;o<e.length;o++)e[o]&&(t=ci(e[o]))&&(a&&(a+=" "),a+=t);return a};function zn(e,...t){let a,o,r,i=n;function n(c){let d=t.reduce((f,m)=>m(f),e());return a=jn(d),o=a.cache.get,r=a.cache.set,i=l,l(c)}function l(c){let d=o(c);if(d)return d;let f=Kn(c,a);return r(c,f),f}return function(){return i(On.apply(null,arguments))}}var ve=e=>{let t=a=>a[e]||[];return t.isThemeGetter=!0,t},mi=/^\[(?:([a-z-]+):)?(.+)\]$/i,Vn=/^\d+\/\d+$/,$n=new Set(["px","full","screen"]),_n=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Wn=/\d+(%|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$/,Gn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Jn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,kt=e=>ca(e)||$n.has(e)||Vn.test(e),Ut=e=>ma(e,"length",os),ca=e=>!!e&&!Number.isNaN(Number(e)),No=e=>ma(e,"number",ca),Da=e=>!!e&&Number.isInteger(Number(e)),Xn=e=>e.endsWith("%")&&ca(e.slice(0,-1)),te=e=>mi.test(e),Kt=e=>_n.test(e),Zn=new Set(["length","size","percentage"]),Yn=e=>ma(e,Zn,pi),Qn=e=>ma(e,"position",pi),es=new Set(["image","url"]),ts=e=>ma(e,es,rs),as=e=>ma(e,"",is),Sa=()=>!0,ma=(e,t,a)=>{let o=mi.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):a(o[2]):!1},os=e=>Wn.test(e)&&!Gn.test(e),pi=()=>!1,is=e=>Jn.test(e),rs=e=>qn.test(e);var ns=()=>{let e=ve("colors"),t=ve("spacing"),a=ve("blur"),o=ve("brightness"),r=ve("borderColor"),i=ve("borderRadius"),n=ve("borderSpacing"),l=ve("borderWidth"),c=ve("contrast"),d=ve("grayscale"),f=ve("hueRotate"),m=ve("invert"),p=ve("gap"),b=ve("gradientColorStops"),h=ve("gradientColorStopPositions"),g=ve("inset"),s=ve("margin"),u=ve("opacity"),N=ve("padding"),R=ve("saturate"),S=ve("scale"),$=ve("sepia"),ee=ve("skew"),_=ve("space"),v=ve("translate"),z=()=>["auto","contain","none"],V=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",te,t],D=()=>[te,t],Te=()=>["",kt,Ut],w=()=>["auto",ca,te],C=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],k=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>["start","end","center","between","around","evenly","stretch"],M=()=>["","0",te],G=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[ca,te];return{cacheSize:500,separator:":",theme:{colors:[Sa],spacing:[kt,Ut],blur:["none","",Kt,te],brightness:W(),borderColor:[e],borderRadius:["none","","full",Kt,te],borderSpacing:D(),borderWidth:Te(),contrast:W(),grayscale:M(),hueRotate:W(),invert:M(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[Xn,Ut],inset:j(),margin:j(),opacity:W(),padding:D(),saturate:W(),scale:W(),sepia:M(),skew:W(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",te]}],container:["container"],columns:[{columns:[Kt]}],"break-after":[{"break-after":G()}],"break-before":[{"break-before":G()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...C(),te]}],overflow:[{overflow:V()}],"overflow-x":[{"overflow-x":V()}],"overflow-y":[{"overflow-y":V()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Da,te]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",te]}],grow:[{grow:M()}],shrink:[{shrink:M()}],order:[{order:["first","last","none",Da,te]}],"grid-cols":[{"grid-cols":[Sa]}],"col-start-end":[{col:["auto",{span:["full",Da,te]},te]}],"col-start":[{"col-start":w()}],"col-end":[{"col-end":w()}],"grid-rows":[{"grid-rows":[Sa]}],"row-start-end":[{row:["auto",{span:[Da,te]},te]}],"row-start":[{"row-start":w()}],"row-end":[{"row-end":w()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",te]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",te]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...fe()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...fe(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...fe(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],fi:[{fi:[N]}],pt:[{pt:[N]}],fi:[{fi:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[s]}],mx:[{mx:[s]}],my:[{my:[s]}],ms:[{ms:[s]}],me:[{me:[s]}],fi:[{fi:[s]}],co:[{co:[s]}],mb:[{mb:[s]}],ml:[{ml:[s]}],"space-x":[{"space-x":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",te,t]}],"min-w":[{"min-w":[te,t,"min","max","fit"]}],"max-w":[{"max-w":[te,t,"none","full","min","max","fit","prose",{screen:[Kt]},Kt]}],h:[{h:[te,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[te,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[te,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[te,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Kt,Ut]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",No]}],"font-family":[{font:[Sa]}],"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",te]}],"line-clamp":[{"line-clamp":["none",ca,No]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",kt,te]}],"list-image":[{"list-image":["none",te]}],"list-style-type":[{list:["none","disc","decimal",te]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[u]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[u]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",kt,Ut]}],"underline-offset":[{"underline-offset":["auto",kt,te]}],"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:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",te]}],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",te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[u]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...C(),Qn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Yn]}],"bg-image":[{bg:["none",{"gradient-to":["t","fi","r","br","b","bl","l","tl"]},ts]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-fi":[{"rounded-fi":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-fi":[{"rounded-fi":[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-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[u]}],"border-style":[{border:[...U(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[u]}],"divide-style":[{divide:U()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...U()]}],"outline-offset":[{"outline-offset":[kt,te]}],"outline-w":[{outline:[kt,Ut]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[u]}],"ring-offset-w":[{"ring-offset":[kt,Ut]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Kt,as]}],"shadow-color":[{shadow:[Sa]}],opacity:[{opacity:[u]}],"mix-blend":[{"mix-blend":[...k(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":k()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[o]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Kt,te]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[m]}],saturate:[{saturate:[R]}],sepia:[{sepia:[$]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[u]}],"backdrop-saturate":[{"backdrop-saturate":[R]}],"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",te]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",te]}],delay:[{delay:W()}],animate:[{animate:["none","spin","ping","pulse","bounce",te]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[Da,te]}],"translate-x":[{"translate-x":[v]}],"translate-y":[{"translate-y":[v]}],"skew-x":[{"skew-x":[ee]}],"skew-y":[{"skew-y":[ee]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",te]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","fi-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",te]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-fi":[{"scroll-fi":D()}],"scroll-co":[{"scroll-co":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-fi":[{"scroll-fi":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-fi":[{"scroll-fi":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"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",te]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[kt,Ut,No]}],stroke:[{stroke:[e,"none"]}],Pr:["Pr-only","not-Pr-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","fi","pt","fi","pb","pl"],px:["fi","pl"],py:["pt","pb"],m:["mx","my","ms","me","fi","co","mb","ml"],mx:["co","ml"],my:["fi","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-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-fi","rounded-ee","rounded-es","rounded-tl","rounded-fi","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-fi","rounded-ee"],"rounded-t":["rounded-tl","rounded-fi"],"rounded-r":["rounded-fi","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-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-fi","scroll-co","scroll-mb","scroll-ml"],"scroll-mx":["scroll-co","scroll-ml"],"scroll-my":["scroll-fi","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-fi","scroll-pt","scroll-fi","scroll-pb","scroll-pl"],"scroll-px":["scroll-fi","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 Wa=zn(ns);function x(...e){return Wa((0,ui.clsx)(e))}var to=ue(require("react")),Ao=ue(require("next/link"));var gi=require("class-variance-authority");var fi=require("react/jsx-runtime"),ss=(0,gi.cva)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ke({className:e,variant:t,...a}){return(0,fi.jsx)("div",{className:x(ss({variant:t}),e),...a})}var hi=require("@radix-ui/react-slot"),bi=ue(require("react")),xi=(0,gi.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"}}}),y=bi.forwardRef(({asChild:e=!1,className:t,size:a,variant:o,...r},i)=>(0,fi.jsx)(e?hi.Slot:"button",{className:x(xi({className:t,size:a,variant:o})),ref:i,...r}));y.displayName="Button";var wi=ue(require("react"));var le=wi.forwardRef(({className:e,type:t,...a},o)=>(0,fi.jsx)("input",{type:t,className:x("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:o,...a}));le.displayName="Input";var ko=ue(require("react")),at=ue(require("@radix-ui/react-scroll-area"));var Je=ko.forwardRef(({className:e,children:t,...a},o)=>(0,fi.jsxs)(at.Root,{ref:o,className:x("relative overflow-hidden",e),...a,children:[(0,fi.jsx)(at.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),(0,fi.jsx)(Ni,{}),(0,fi.jsx)(at.Corner,{})]}));Je.displayName=at.Root.displayName;var Ni=ko.forwardRef(({className:e,orientation:t="vertical",...a},o)=>(0,fi.jsx)(at.ScrollAreaScrollbar,{ref:o,orientation:t,className:x("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...a,children:(0,fi.jsx)(at.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Ni.displayName=at.ScrollAreaScrollbar.displayName;var ka=ue(require("react")),Le=ue(require("@radix-ui/react-dialog"));var Xe=Le.Root;var pa=Le.Portal;var Yt=ka.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Le.Overlay,{ref:a,className:x("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}));Yt.displayName=Le.Overlay.displayName;var bt=ka.forwardRef(({className:e,children:t,...a},o)=>(0,fi.jsxs)(pa,{children:[(0,fi.jsx)(Yt,{}),(0,fi.jsxs)(Le.Content,{ref:o,className:x("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-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...a,children:[t,(0,fi.jsxs)(Le.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,fi.jsx)(wn.fi,{className:"h-4 w-4"}),(0,fi.jsx)("span",{className:"Pr-only",children:"Close"})]})]})]}));bt.displayName=Le.Content.displayName;var xt=({className:e,...t})=>(0,fi.jsx)("div",{className:x("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});xt.displayName="DialogHeader";var Si=({className:e,...t})=>(0,fi.jsx)("div",{className:x("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Si.displayName="DialogFooter";var ot=ka.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Le.Title,{ref:a,className:x("text-lg font-semibold leading-none tracking-tight",e),...t}));ot.displayName=Le.Title.displayName;var ki=ka.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Le.Description,{ref:a,className:x("text-sm text-muted-foreground",e),...t}));ki.displayName=Le.Description.displayName;var Ta=ue(require("@radix-ui/react-checkbox")),Ai=ue(require("react")),Aa=Ai.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Ta.Root,{className:x("peer h-4 w-4 shrink-0 rounded border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),ref:a,...t,children:(0,fi.jsx)(Ta.Indicator,{className:x("flex items-center justify-center text-current"),children:(0,fi.jsx)(wn.Check,{className:"h-4 w-4"})})}));Aa.displayName=Ta.Root.displayName;var yt=e=>({id:Math.random().toString(36).substr(2,9),title:e,format:"markdown",createdAt:new Date});var Ri=[{id:"design",name:"Design",description:"Creative and visual design team",icon:(0,fi.jsx)(wn.Palette,{className:"h-4 w-4"}),color:"bg-purple-600",accentColor:"text-purple-600"},{id:"engineering",name:"Engineering",description:"Software development and technical teams",icon:(0,fi.jsx)(wn.Code,{className:"h-4 w-4"}),color:"bg-blue-600",accentColor:"text-blue-600"},{id:"marketing",name:"Marketing",description:"Brand, campaigns, and growth marketing",icon:(0,fi.jsx)(wn.TrendingUp,{className:"h-4 w-4"}),color:"bg-pink-600",accentColor:"text-pink-600"},{id:"sales",name:"Sales",description:"Revenue generation and customer acquisition",icon:(0,fi.jsx)(wn.DollarSign,{className:"h-4 w-4"}),color:"bg-green-600",accentColor:"text-green-600"},{id:"hr",name:"Human Resources",description:"People operations and talent management",icon:(0,fi.jsx)(wn.Users,{className:"h-4 w-4"}),color:"bg-orange-600",accentColor:"text-orange-600"},{id:"operations",name:"Operations",description:"Business operations and process optimization",icon:(0,fi.jsx)(wn.Wrench,{className:"h-4 w-4"}),color:"bg-indigo-600",accentColor:"text-indigo-600"},{id:"legal",name:"Legal",description:"Legal affairs and compliance",icon:(0,fi.jsx)(wn.Scale,{className:"h-4 w-4"}),color:"bg-slate-600",accentColor:"text-slate-600"},{id:"product",name:"Product",description:"Product strategy and management",icon:(0,fi.jsx)(wn.Package,{className:"h-4 w-4"}),color:"bg-violet-600",accentColor:"text-violet-600"},{id:"it",name:"IT Support",description:"Information technology and infrastructure",icon:(0,fi.jsx)(wn.Zap,{className:"h-4 w-4"}),color:"bg-cyan-600",accentColor:"text-cyan-600"},{id:"company",name:"Company",description:"Company-wide resources and information",icon:(0,fi.jsx)(wn.Building2,{className:"h-4 w-4"}),color:"bg-gray-600",accentColor:"text-gray-600"}],Xa=[{id:"1",name:"fi-commerce Platform",description:"Main customer-facing e-commerce application",isSelected:!0},{id:"2",name:"Admin Dashboard",description:"Internal administration and analytics dashboard",isSelected:!1},{id:"3",name:"Mobile App",description:"Native mobile application for iOS and Android",isSelected:!1}];var To=[{id:"1",name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date("2024-01-01"),endDate:new Date("2024-02-15"),progress:75,isSelected:!0},{id:"2",name:"Dashboard Features",color:"bg-green-500",description:"Build comprehensive dashboard functionality",confidence:"medium",phase:1,startDate:new Date("2024-02-01"),endDate:new Date("2024-03-15"),progress:30,isSelected:!0},{id:"3",name:"Mobile Optimization",color:"bg-purple-500",description:"Optimize application for mobile devices",confidence:"low",phase:1,startDate:new Date("2024-03-01"),endDate:new Date("2024-04-15"),progress:10,isSelected:!0},{id:"4",name:"Performance Improvements",color:"bg-orange-500",description:"Enhance application performance and speed",confidence:"high",phase:3,startDate:new Date("2024-01-15"),endDate:new Date("2024-02-28"),progress:90,isSelected:!0}],Ja=[{id:"backlog",name:"Backlog",description:"Tasks not yet assigned to a sprint",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!1},{id:"all-tasks",name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!0},{id:"1",name:"Sprint 1",description:"Initial development phase",startDate:new Date("2024-01-01"),endDate:new Date("2024-01-14"),isActive:!1,isSelected:!1},{id:"2",name:"Sprint 2",description:"Feature development",startDate:new Date("2024-01-15"),endDate:new Date("2024-01-28"),isActive:!0,isSelected:!1}],Ya=[{id:"1",name:"Design login page",description:"Create wireframes and mockups for the login interface",status:"todo",priority:"high",type:"story",points:5,epicId:"1",sprintId:"2",assignee:"John Doe",createdAt:new Date("2024-01-15")},{id:"2",name:"Implement OAuth integration",description:"Add Google and GitHub OAuth authentication",status:"review",priority:"high",type:"task",points:8,epicId:"1",sprintId:"2",assignee:"Jane Smith",createdAt:new Date("2024-01-16")},{id:"3",name:"Create dashboard widgets",description:"Build analytics and metrics widgets for the main dashboard",status:"todo",priority:"medium",type:"story",points:13,epicId:"2",sprintId:"2",assignee:"Mike Johnson",createdAt:new Date("2024-01-17")},{id:"4",name:"Fix login redirect bug",description:"Resolve issue where users are not redirected after login",status:"done",priority:"high",type:"bug",points:3,epicId:"1",sprintId:"1",assignee:"Sarah Wilson",createdAt:new Date("2024-01-14")},{id:"5",name:"Research mobile frameworks",description:"Investigate best practices for mobile responsive design",status:"in-progress",priority:"medium",type:"spike",points:5,epicId:"3",assignee:"Alex Brown",createdAt:new Date("2024-01-18")},{id:"6",name:"Update user profile page",description:"Enhance user profile with new settings and preferences",status:"review",priority:"medium",type:"story",points:8,epicId:"2",sprintId:"2",assignee:"Emma Davis",createdAt:new Date("2024-01-19")},{id:"7",name:"Performance optimization",description:"Optimize database queries and improve page load times",status:"done",priority:"high",type:"task",points:13,epicId:"4",sprintId:"1",assignee:"Tom Wilson",createdAt:new Date("2024-01-13")}],ls=[...Ya,{id:"8",name:"Add search functionality",description:"Implement search across all dashboard widgets",status:"todo",priority:"medium",type:"story",points:8,epicId:"2",sprintId:"2",assignee:"Chris Lee",createdAt:new Date("2024-01-20")},{id:"9",name:"Fix mobile responsive issues",description:"Resolve layout problems on mobile devices",status:"in-progress",priority:"high",type:"bug",points:5,epicId:"3",sprintId:"2",assignee:"Taylor Swift",createdAt:new Date("2024-01-21")},{id:"10",name:"Implement dark mode",description:"Add dark theme support across the application",status:"review",priority:"low",type:"story",points:13,epicId:"2",sprintId:"2",assignee:"Jordan Smith",createdAt:new Date("2024-01-22")},{id:"11",name:"API rate limiting",description:"Implement rate limiting for API endpoints",status:"done",priority:"high",type:"task",points:8,epicId:"4",sprintId:"1",assignee:"Morgan Davis",createdAt:new Date("2024-01-12")},{id:"12",name:"User onboarding flow",description:"Create guided tour for new users",status:"todo",priority:"medium",type:"story",points:21,epicId:"1",sprintId:"2",assignee:"Casey Johnson",createdAt:new Date("2024-01-23")}],ds=[...Xa,{id:"4",name:"Analytics Platform",description:"Business intelligence and reporting system",isSelected:!1},{id:"5",name:"API Gateway",description:"Microservices API management layer",isSelected:!1}],qa={projects:[{id:"1",name:"Empty Project",description:"fi project with no tasks",isSelected:!0}],epics:[],sprints:[{id:"all-tasks",name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!0}],tasks:[]},Pi={epics:[{id:"1",name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date("2024-01-01"),endDate:new Date("2024-02-15"),progress:75,isSelected:!0}],tasks:Ya.filter(e=>e.epicId==="1")};var rl={empty:{initialProjects:qa.projects,initialEpics:qa.epics,initialSprints:qa.sprints,initialTasks:qa.tasks},default:{initialProjects:Xa,initialEpics:To,initialSprints:Ja,initialTasks:Ya},highDensity:{initialProjects:Xa,initialEpics:To,initialSprints:Ja,initialTasks:ls},singleEpic:{initialProjects:Xa,initialEpics:Pi.epics,initialSprints:Ja,initialTasks:Pi.tasks},multipleProjects:{initialProjects:ds,initialEpics:To,initialSprints:Ja,initialTasks:Ya}},Za=[{id:"1",type:"human",name:"Sarah Johnson",email:"sarah.johnson@company.com",role:"Senior Designer",department:"Design",status:"active",joinedDate:new Date("2023-01-15"),lastActive:new Date,phone:"+1 (555) 123-4567",location:"San Francisco, CA",timezone:"PST",skills:["UI/UX Design","Figma","Adobe Creative Suite","Prototyping","User Research"],bio:"Passionate designer with 8+ years of experience creating user-centered digital experiences."},{id:"2",type:"digital",name:"CodeAssist Pro",status:"active",joinedDate:new Date("2024-01-01"),lastActive:new Date,jobDescription:"AI-powered coding assistant that helps with code review, debugging, and documentation generation.",workInstructions:"Review pull requests for code quality and best practices. Generate comprehensive documentation for new features. Assist with debugging complex issues. Provide code suggestions and optimizations.",capabilities:["Code Review","Documentation Generation","Debugging","Code Optimization","Testing"],knowledge:["JavaScript","TypeScript","React","Node.js","Python","Git"].map(yt),coreKnowledge:["Company coding standards","Architecture patterns","Security guidelines"].map(yt),version:"2",lastUpdated:new Date("2024-01-15"),isActive:!0},{id:"3",type:"human",name:"Michael Chen",email:"michael.chen@company.com",role:"Product Manager",department:"Product",status:"inactive",joinedDate:new Date("2022-08-20"),lastActive:new Date(Date.now()-2*60*60*1e3),phone:"+1 (555) 987-6543",location:"New York, NY",timezone:"EST",skills:["Product Strategy","Agile","Data Analysis","User Stories","Roadmapping"],bio:"Strategic product manager focused on driving user engagement and business growth."},{id:"4",type:"digital",name:"MarketingBot",status:"active",joinedDate:new Date("2024-02-01"),lastActive:new Date,jobDescription:"Specialized AI assistant for marketing campaigns, content creation, and social media management.",workInstructions:"Create engaging social media content. Analyze campaign performance metrics. Generate marketing copy and headlines. Schedule and manage social media posts.",capabilities:["Content Creation","Social Media Management","Analytics","SEO Optimization","Campaign Management"],knowledge:["Digital Marketing","Social Media Platforms","Content Strategy","Analytics Tools"].map(yt),coreKnowledge:["Brand guidelines","Target audience personas","Marketing objectives"].map(yt),version:"52",lastUpdated:new Date("2024-02-10"),isActive:!0},{id:"5",type:"human",name:"Emily Rodriguez",email:"emily.rodriguez@company.com",role:"UX Researcher",department:"Design",status:"inactive",joinedDate:new Date("2023-06-10"),lastActive:new Date(Date.now()-7*24*60*60*1e3),phone:"+1 (555) 456-7890",location:"Austin, TX",timezone:"CST",skills:["User Research","Usability Testing","Data Analysis","Survey Design","Interview Techniques"],bio:"User researcher dedicated to understanding user needs and improving product experiences."},{id:"6",type:"digital",name:"DataAnalyzer Pro",status:"active",joinedDate:new Date("2024-01-10"),lastActive:new Date,jobDescription:"Advanced AI assistant specializing in data analysis, reporting, and business intelligence.",workInstructions:"Analyze complex datasets, generate insightful reports, create data visualizations, and provide actionable business recommendations.",capabilities:["Data Analysis","Report Generation","Data Visualization","Business Intelligence","Statistical Analysis"],knowledge:["Python","SQL","Tableau","Excel","R","Statistics"].map(yt),coreKnowledge:["Company data sources","KPI definitions","Reporting standards"].map(yt),version:"3.1",lastUpdated:new Date("2024-02-20"),isActive:!0},{id:"7",type:"digital",name:"ProjectManager AI",status:"active",joinedDate:new Date("2024-01-05"),lastActive:new Date,jobDescription:"Intelligent project management assistant that helps coordinate tasks, track progress, and manage timelines.",workInstructions:"Coordinate project activities, track milestones, manage resource allocation, and provide project status updates.",capabilities:["Project Planning","Task Coordination","Timeline Management","Resource Allocation","Progress Tracking"],knowledge:["Agile","Scrum","Gantt Charts","Risk Management","Stakeholder Management"].map(yt),coreKnowledge:["Company project templates","Resource availability","Project methodologies"].map(yt),version:"2.5",lastUpdated:new Date("2024-02-15"),isActive:!0},{id:"8",type:"digital",name:"CustomerSupport Bot",status:"active",joinedDate:new Date("2024-02-01"),lastActive:new Date,jobDescription:"AI-powered customer support assistant that handles inquiries, resolves issues, and escalates complex problems.",workInstructions:"Respond to customer inquiries, troubleshoot common issues, provide product information, and escalate complex cases to human agents.",capabilities:["Customer Support","Issue Resolution","Product Knowledge","Escalation Management","Chat Support"],knowledge:["Product Documentation","FAQ","Troubleshooting Guides","Customer Service Best Practices"].map(yt),coreKnowledge:["Product catalog","Support processes","Escalation procedures"].map(yt),version:"1.8",lastUpdated:new Date("2024-02-25"),isActive:!0}],nl=[{id:"1",title:"Review quarterly report",description:"Go through Q4 performance metrics and prepare summary for the team meeting",dueDate:new Date(2024,2,15),dueTime:"14:30",colleague:Za.find(e=>e.id==="2"&&e.type==="digital"),isCompleted:!1,isRecurring:!1,priority:"high",reminderEnabled:!0,reminderMinutes:30,createdAt:new Date(2024,2,10),tags:["quarterly","review","urgent"]},{id:"2",title:"Weekly team standup",description:"Join the weekly team synchronization meeting",dueDate:new Date(2024,2,18),dueTime:"10:00",colleague:Za.find(e=>e.id==="4"&&e.type==="digital"),isCompleted:!1,isRecurring:!0,recurrencePattern:"weekly",recurrenceInterval:1,priority:"medium",reminderEnabled:!0,reminderMinutes:15,createdAt:new Date(2024,2,11),tags:["meeting","standup","weekly"]},{id:"3",title:"Deploy to production",description:"Deploy the latest version to production environment",dueDate:new Date,dueTime:"16:00",colleague:Za.find(e=>e.id==="2"&&e.type==="digital"),isCompleted:!1,isRecurring:!1,priority:"high",reminderEnabled:!0,reminderMinutes:60,createdAt:new Date,tags:["deploy","production","urgent"]}];var sl=Za.filter(e=>e.type==="digital");function eo(e,t){let[a,o]=(0,ii.useState)(()=>{if(typeof window>"u")return t;try{let i=window.localStorage.getItem(e);return i?JSON.parse(i):t}catch{return t}}),r=i=>{try{o(i),typeof window<"u"&&window.localStorage.setItem(e,JSON.stringify(i))}catch{}};return(0,ii.useEffect)(()=>{r(a)},[]),[a,r]}function Po({items:e,isOpen:t,isMobile:a=!1,onClose:o,currentBusinessUnit:r=Ri[0],onBusinessUnitChange:i,onSearch:n,className:l,logo:c="/headerlogo.png",appName:d="Nuvia",tagline:f="Collaboration Platform"}){let[m,p]=to.useState({}),[b,h]=eo("sidebar-favorites",{}),[g,s]=to.useState(null),[u,N]=to.useState(""),R=w=>{p(C=>({...C,[w]:!C[w]}))},S=w=>{i?.(w)},$=()=>{u.trim()&&n?.(u.trim())},ee=w=>{w.key==="Enter"&&(w.preventDefault(),$())},_=(w,C)=>{let U=b[w]||[],k=U.includes(C)?U.filter(fe=>fe!==C):U.concat(C);h({...b,[w]:k})},v=w=>{if(!w.items||!w.maxItems||w.items.length<=w.maxItems)return w.items||[];let C=b[w.id]||[],U=w.items.filter(fe=>C.includes(fe.id)),k=w.items.filter(fe=>!C.includes(fe.id));return[...U,...k].slice(0,w.maxItems)},z=w=>w.maxItems&&w.items&&w.items.length>w.maxItems,V=e,j=w=>{let C=z(w),U=v(w),k=(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[w.icon,(0,fi.jsx)("span",{children:w.title})]}),w.badge&&(0,fi.jsx)(ke,{variant:"outline",className:"ml-auto rounded-full px-2 py-0.5 text-xs",children:w.badge}),w.items&&(0,fi.jsx)(wn.ChevronDown,{className:x("ml-2 h-4 w-4 transition-transform",m[w.title]?"rotate-180":"")})]}),fe=x("flex w-full items-center justify-between rounded-2xl px-3 py-2 text-sm font-medium",w.isActive?"bg-primary/10 text-primary":"hover:bg-muted");return w.url?(0,fi.jsx)(Ao.default,{href:w.url,className:fe,onClick:a?o:void 0,children:k}):(0,fi.jsx)("button",{className:fe,onClick:()=>w.items&&R(w.title),children:k})},D=()=>{let w=e.find(U=>U.id===g);if(!w||!w.items||!w.maxItems)return null;let C=b[w.id]||[];return(0,fi.jsx)(Xe,{open:!!g,onOpenChange:U=>!U&&s(null),children:(0,fi.jsxs)(bt,{className:"sm:max-w-md",children:[(0,fi.jsxs)(xt,{children:[(0,fi.jsxs)(ot,{children:["Manage ",w.title," Favorites"]}),(0,fi.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Select up to ",w.maxItems," items to show in ",w.title.toLowerCase(),"."]})]}),(0,fi.jsx)(Je,{className:"max-h-96 fi-4",children:(0,fi.jsx)("div",{className:"space-y-4",children:w.items.map(U=>(0,fi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,fi.jsx)(Aa,{id:U.id,checked:C.includes(U.id),onCheckedChange:()=>_(w.id,U.id),disabled:!C.includes(U.id)&&C.length>=(w.maxItems||0)}),(0,fi.jsxs)("label",{htmlFor:U.id,className:"flex items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer flex-1",children:[U.title,U.badge&&(0,fi.jsx)(ke,{variant:"outline",className:"text-xs",children:U.badge})]})]},U.id))})})]})})},Te=(0,fi.jsxs)("div",{className:"flex h-full flex-col bg-background",children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,fi.jsx)("div",{className:"flex h-14 w-14 items-center justify-center",children:(0,fi.jsx)("img",{src:c,alt:"Header Logo",className:"h-14 w-14 object-contain"})}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h2",{className:"font-semibold",children:d}),(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:f})]})]}),a&&(0,fi.jsx)(y,{variant:"ghost",size:"icon",onClick:o,children:(0,fi.jsx)(wn.fi,{className:"h-5 w-5"})})]}),(0,fi.jsx)("div",{className:"px-3 py-2",children:(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)(wn.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,fi.jsx)(le,{type:"search",placeholder:"Search...",className:"w-full rounded-2xl bg-muted pl-9 fi-4 py-2",value:u,onChange:w=>N(w.target.value),onKeyPress:ee})]})}),(0,fi.jsx)(Je,{className:"flex-1 px-3 py-2",children:(0,fi.jsx)("div",{className:"space-y-1",children:V.map(w=>(0,fi.jsxs)("div",{className:"mb-1",children:[j(w),w.items&&m[w.title]&&(0,fi.jsxs)("div",{className:"fi-1 ml-6 space-y-1 border-l pl-3",children:[v(w).map(C=>(0,fi.jsxs)(Ao.default,{href:C.url,className:"flex items-center justify-between rounded-2xl px-3 py-2 text-sm hover:bg-muted",onClick:a?o:void 0,children:[C.title,C.badge&&(0,fi.jsx)(ke,{variant:"outline",className:"ml-auto rounded-full px-2 py-0.5 text-xs",children:C.badge})]},C.id)),z(w)&&w.items&&w.items.length>v(w).length&&(0,fi.jsxs)("button",{onClick:()=>s(w.id),className:"w-full px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted rounded-2xl transition-colors text-left",children:["...",w.items.length-v(w).length," more available"]})]})]},w.id))})}),(0,fi.jsx)("div",{className:"p-3",children:(0,fi.jsx)("div",{className:"space-y-1",children:(0,fi.jsxs)("button",{className:"flex w-full items-center gap-3 rounded-2xl px-3 py-2 text-sm font-medium hover:bg-muted",children:[(0,fi.jsx)(wn.Settings,{className:"h-5 w-5"}),(0,fi.jsx)("span",{children:"Settings"})]})})}),(0,fi.jsx)(D,{})]});return a?(0,fi.jsx)("div",{className:x("fixed inset-y-0 left-0 z-50 w-64 transform bg-background transition-transform duration-300 ease-in-out",t?"translate-x-0":"-translate-x-full",l),children:Te}):(0,fi.jsx)("div",{className:x("fixed inset-y-0 left-0 z-30 w-64 transform bg-background transition-transform duration-300 ease-in-out",t?"translate-x-0":"-translate-x-full",l),children:Te})}var ao=ue(require("react")),Tt=ue(require("@radix-ui/react-avatar"));var At=ao.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Tt.Root,{ref:a,className:x("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));At.displayName=Tt.Root.displayName;var Pa=ao.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Tt.Image,{ref:a,className:x("aspect-square h-full w-full",e),...t}));Pa.displayName=Tt.Image.displayName;var Pt=ao.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Tt.Fallback,{ref:a,className:x("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));Pt.displayName=Tt.Fallback.displayName;var Mi=ue(require("react")),lt=ue(require("@radix-ui/react-tooltip"));var Vt=lt.Provider,$t=lt.Root,_t=lt.Trigger,Rt=Mi.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,fi.jsx)(lt.Portal,{children:(0,fi.jsx)(lt.Content,{ref:o,sideOffset:t,className:x("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),...a})}));Rt.displayName=lt.Content.displayName;var Ii=require("next-themes");function Li(){let{setTheme:e,theme:t}=(0,Ii.useTheme)();return(0,fi.jsx)(Vt,{children:(0,fi.jsxs)($t,{children:[(0,fi.jsx)(_t,{asChild:!0,children:(0,fi.jsxs)(y,{variant:"ghost",size:"icon",className:"rounded-2xl",onClick:()=>e(t==="light"?"dark":"light"),children:[(0,fi.jsx)(wn.Sun,{className:"h-5 w-5 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),(0,fi.jsx)(wn.Moon,{className:"absolute h-5 w-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),(0,fi.jsx)("span",{className:"Pr-only",children:"Toggle theme"})]})}),(0,fi.jsx)(Rt,{children:"Toggle theme"})]})})}function Bi({notifications:e,open:t,onClose:a,onNotificationRemove:o,onRemoveAll:r,className:i}){let n=e.filter(d=>!d.read),l=n.length,c=d=>{switch(d){case"info":return(0,fi.jsx)(wn.Info,{className:"h-5 w-5 text-blue-500"});case"success":return(0,fi.jsx)(wn.Check,{className:"h-5 w-5 text-green-500"});case"warning":return(0,fi.jsx)(wn.AlertTriangle,{className:"h-5 w-5 text-amber-500"});case"error":return(0,fi.jsx)(wn.AlertTriangle,{className:"h-5 w-5 text-red-500"})}};return(0,fi.jsx)(Co.AnimatePresence,{children:t&&(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsx)(Co.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-40 bg-black/20 backdrop-blur-sm md:hidden",onClick:a}),(0,fi.jsx)(Co.motion.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:20,stiffness:300},className:x("fixed inset-y-0 right-0 z-50 w-full max-w-sm border-l bg-background shadow-lg md:w-96",i),children:(0,fi.jsxs)("div",{className:"flex h-full flex-col",children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between border-b p-4",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,fi.jsx)(wn.Bell,{className:"h-5 w-5"}),(0,fi.jsx)("h2",{className:"text-lg font-semibold",children:"Notifications"}),l>0&&(0,fi.jsxs)(ke,{variant:"secondary",className:"rounded-full px-2 py-0.5",children:[l," new"]})]}),(0,fi.jsxs)(y,{variant:"ghost",size:"icon",onClick:a,className:"rounded-full",children:[(0,fi.jsx)(wn.fi,{className:"h-5 w-5"}),(0,fi.jsx)("span",{className:"Pr-only",children:"Close"})]})]}),l>0&&(0,fi.jsxs)("div",{className:"flex items-center justify-between border-b p-2",children:[(0,fi.jsxs)("span",{className:"text-sm text-muted-foreground",children:[l," unread notification",l!==1?"s":""]}),(0,fi.jsx)(y,{variant:"ghost",size:"sm",onClick:r,className:"text-sm",children:"Dismiss all"})]}),n.length>0?(0,fi.jsx)(Je,{className:"flex-1",children:(0,fi.jsx)("div",{className:"divide-y",children:n.map(d=>(0,fi.jsxs)("div",{className:x("flex gap-3 p-4 transition-colors bg-muted/50"),children:[(0,fi.jsx)("div",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-muted",children:c(d.type)}),(0,fi.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,fi.jsx)("p",{className:"font-medium",children:d.title}),(0,fi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:d.time}),(0,fi.jsx)(y,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>o?.(d.id),title:"Dismiss",children:(0,fi.jsx)(wn.Check,{className:"h-3 w-3"})})]})]}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:d.description}),d.actionLabel&&(0,fi.jsxs)(y,{variant:"link",size:"sm",className:"h-auto p-0 text-sm",onClick:d.onAction,children:[d.actionLabel,(0,fi.jsx)(wn.ChevronRight,{className:"ml-1 h-3 w-3"})]})]})]},d.id))})}):(0,fi.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center p-8 text-center",children:[(0,fi.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-muted",children:(0,fi.jsx)(wn.Bell,{className:"h-8 w-8 text-muted-foreground"})}),(0,fi.jsx)("h3",{className:"fi-4 text-lg font-medium",children:"No notifications"}),(0,fi.jsx)("p",{className:"fi-2 text-sm text-muted-foreground",children:"When you receive notifications, they'll appear here."})]})]})})]})})}var Qt=ue(require("@radix-ui/react-tabs"));function Ei({className:e,...t}){return(0,fi.jsx)(Qt.Root,{"data-slot":"tabs",className:x("flex flex-col gap-2",e),...t})}function Fi({className:e,...t}){return(0,fi.jsx)(Qt.List,{"data-slot":"tabs-list",className:x("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function Hi({className:e,...t}){return(0,fi.jsx)(Qt.Trigger,{"data-slot":"tabs-trigger",className:x("data-[state=active]:bg-accent data-[state=active]:text-accent-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}var Mt=ue(require("react")),re=ue(require("@radix-ui/react-dropdown-menu")),ua=require("@radix-ui/react-icons");var dt=re.Root,ct=re.Trigger;var ji=Mt.forwardRef(({className:e,inset:t,children:a,...o},r)=>(0,fi.jsxs)(re.SubTrigger,{ref:r,className:x("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),...o,children:[a,(0,fi.jsx)(ua.ChevronRightIcon,{className:"ml-auto"})]}));ji.displayName=re.SubTrigger.displayName;var Ui=Mt.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(re.SubContent,{ref:a,className:x("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}));Ui.displayName=re.SubContent.displayName;var it=Mt.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,fi.jsx)(re.Portal,{children:(0,fi.jsx)(re.Content,{ref:o,sideOffset:t,className:x("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),...a})}));it.displayName=re.Content.displayName;var ze=Mt.forwardRef(({className:e,inset:t,...a},o)=>(0,fi.jsx)(re.Item,{ref:o,className:x("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),...a}));ze.displayName=re.Item.displayName;var Ki=Mt.forwardRef(({className:e,children:t,checked:a,...o},r)=>(0,fi.jsxs)(re.CheckboxItem,{ref:r,className:x("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 fi-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:a,...o,children:[(0,fi.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,fi.jsx)(re.ItemIndicator,{children:(0,fi.jsx)(ua.CheckIcon,{className:"h-4 w-4"})})}),t]}));Ki.displayName=re.CheckboxItem.displayName;var Oi=Mt.forwardRef(({className:e,children:t,...a},o)=>(0,fi.jsxs)(re.RadioItem,{ref:o,className:x("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 fi-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[(0,fi.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,fi.jsx)(re.ItemIndicator,{children:(0,fi.jsx)(ua.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));Oi.displayName=re.RadioItem.displayName;var zi=Mt.forwardRef(({className:e,inset:t,...a},o)=>(0,fi.jsx)(re.Label,{ref:o,className:x("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...a}));zi.displayName=re.Label.displayName;var Vi=Mt.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(re.Separator,{ref:a,className:x("-mx-1 my-1 h-px bg-muted",e),...t}));Vi.displayName=re.Separator.displayName;var $i=({className:e,...t})=>(0,fi.jsx)("span",{className:x("ml-auto text-xs tracking-widest opacity-60",e),...t});$i.displayName="DropdownMenuShortcut";function no({activeTab:e,onTabChange:t,tabOptions:a,className:o="",maxWidth:r="700px",gridCols:i=6}){let n=a.find(l=>l.value===e);return(0,fi.jsxs)(Co.motion.div,{className:`flex-1 flex justify-center ${o}`,initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},children:[(0,fi.jsx)("div",{className:"hidden lg:block",children:(0,fi.jsx)(Ei,{value:e,onValueChange:t,children:(0,fi.jsx)(Fi,{className:"grid w-full rounded-2xl p-0 h-10",style:{maxWidth:r,gridTemplateColumns:`repeat(${Math.min(i,a.length)}, minmax(0, 1fr))`},children:a.map(l=>(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.1},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:17},className:"flex-1 px-2",children:(0,fi.jsx)(Hi,{value:l.value,className:"w-full h-8 rounded-xl data-[state=active]:rounded-xl transition-all duration-200 hover:border hover:border-accent hover:bg-accent/10 px-4 py-2 text-sm font-medium",children:l.label})},l.value))})})}),(0,fi.jsx)("div",{className:"lg:hidden",children:(0,fi.jsxs)(dt,{children:[(0,fi.jsx)(ct,{asChild:!0,children:(0,fi.jsxs)(y,{variant:"outline",className:"rounded-2xl min-w-[140px] justify-between",children:[n?.label||"Select",(0,fi.jsx)(wn.ChevronDown,{className:"h-4 w-4 ml-2"})]})}),(0,fi.jsx)(it,{align:"center",className:"w-[180px]",children:a.map(l=>(0,fi.jsx)(ze,{onClick:()=>t?.(l.value),className:`cursor-pointer ${e===l.value?"bg-accent":""}`,children:l.label},l.value))})]})})]})}function Wi({title:e,notifications:t=[],onToggleSidebar:a,onToggleMobileMenu:o,sidebarOpen:r=!0,className:i,activeTab:n="assistant",onTabChange:l,showTabs:c=!0,tabOptions:d=[{value:"home",label:"Home"},{value:"chat",label:"Chat"},{value:"projects",label:"Projects"},{value:"colleagues",label:"Colleagues"},{value:"knowledge",label:"Knowledge"}],onActionClick:f,actionIcon:m=(0,fi.jsx)(wn.Bot,{className:"co-2 h-4 w-4"}),actionText:p="Action",onNotificationRemove:b,onRemoveAll:h,logo:g="/headerlogo.png",appName:s="Nuvia",tagline:u="Collaboration Platform"}){let[N,R]=(0,ii.useState)(!1),[S,$]=(0,ii.useState)(t),ee=S.filter(z=>!z.read).length,_=z=>{$(V=>V.filter(j=>j.id!==z)),b?.(z)},v=()=>{$(z=>z.filter(V=>V.read)),h?.()};return(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsxs)("header",{className:`sticky top-0 z-10 flex h-16 items-center gap-3 pl-2 fi-4 backdrop-blur ${i||""}`,children:[(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"md:hidden",onClick:o,children:(0,fi.jsx)(wn.Menu,{className:"h-5 w-5"})}),(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:a,children:(0,fi.jsx)(wn.PanelLeft,{className:"h-5 w-5"})}),!r&&(0,fi.jsxs)(Co.motion.div,{className:"flex items-center gap-3",initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.3},children:[(0,fi.jsx)("div",{className:"flex h-10 w-10 items-center justify-center",children:(0,fi.jsx)("img",{src:g,alt:"Logo",className:"h-10 w-10 object-contain"})}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h2",{className:"font-semibold text-sm",children:s}),(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:u})]})]}),(0,fi.jsxs)("div",{className:"flex flex-1 items-center",children:[c&&(0,fi.jsx)(no,{activeTab:n,onTabChange:l,tabOptions:d}),(0,fi.jsxs)("div",{className:"flex items-center gap-3 ml-auto",children:[(0,fi.jsx)(Co.motion.div,{className:"hidden md:flex gap-2",initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.3,ease:"easeOut",delay:.1},children:(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.05},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:17},children:(0,fi.jsxs)(y,{className:"rounded-2xl transition-all duration-200 hover:shadow-md",onClick:f,children:[m,p]})})}),(0,fi.jsx)(Li,{}),(0,fi.jsx)(Vt,{children:(0,fi.jsxs)($t,{children:[(0,fi.jsx)(_t,{asChild:!0,children:(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.05},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:17},children:(0,fi.jsxs)(y,{variant:"ghost",size:"icon",className:"rounded-2xl relative transition-all duration-200",onClick:()=>R(!0),children:[(0,fi.jsx)(Co.motion.div,{animate:ee>0?{rotate:[0,-10,10,-10,0]}:{},transition:{duration:.5,repeat:ee>0?1/0:0,repeatDelay:3},children:(0,fi.jsx)(wn.Bell,{className:"h-5 w-5"})}),ee>0&&(0,fi.jsx)(Co.motion.span,{className:"absolute -right-1 -top-1 flex h-5 w-5 items-center justify-center rounded-full bg-red-500 text-xs text-white",initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:500,damping:15},children:ee})]})})}),(0,fi.jsx)(Rt,{children:"Notifications"})]})}),(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.05},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:17},children:(0,fi.jsxs)(At,{className:"h-9 w-9 border-2 border-primary transition-all duration-200 hover:shadow-md cursor-pointer",children:[(0,fi.jsx)(Pa,{src:"/placeholder.svg?height=40&width=40",alt:"User"}),(0,fi.jsx)(Pt,{})]})})]})]})]}),(0,fi.jsx)(Bi,{notifications:S,open:N,onClose:()=>R(!1),onNotificationRemove:_,onRemoveAll:v})]})}var Gi=[{id:"copilot",name:"Peronal Copilot",description:"Your personal AI assistant for all tasks",icon:(0,fi.jsx)(wn.User,{className:"h-4 w-4"}),color:"bg-orange-600",accentColor:"text-orange-600"}];function qi({sidebarItems:e,children:t,title:a="Digital Colleagues",notifications:o=[],currentBusinessUnit:r=Gi[0],onBusinessUnitChange:i,onSearch:n,businessUnits:l=Gi,activeTab:c,onTabChange:d,showTabs:f=!1,onActionClick:m,actionIcon:p,actionText:b="Action",onNotificationRemove:h,onRemoveAll:g,logo:s="/headerlogo.png",appName:u="Nuvia",tagline:N="Collaboration Platform",sidebarInitiallyClosed:R=!1}){let[S,$]=(0,ii.useState)(!R),[ee,_]=(0,ii.useState)(!1),[v,z]=(0,ii.useState)(r),V=j=>{z(j),i?.(j)};return(0,fi.jsxs)("div",{className:"flex h-full flex-col overflow-hidden rounded-xl bg-background w-[]",children:[ee&&(0,fi.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50 md:hidden",onClick:()=>_(!1)}),(0,fi.jsx)("div",{className:"md:hidden",children:(0,fi.jsx)(Po,{items:e,isOpen:ee,isMobile:!0,onClose:()=>_(!1),currentBusinessUnit:v,onBusinessUnitChange:V,onSearch:n,logo:s,appName:u,tagline:N})}),(0,fi.jsx)("div",{className:"hidden md:block",children:(0,fi.jsx)(Po,{items:e,isOpen:S,isMobile:!1,currentBusinessUnit:v,onBusinessUnitChange:V,onSearch:n,logo:s,appName:u,tagline:N})}),(0,fi.jsxs)("div",{className:x("min-h-screen fixed w-full transition-all duration-300 ease-in-out",S?"md:pl-64":"md:pl-0"),children:[(0,fi.jsx)(Wi,{title:a,notifications:o,onToggleSidebar:()=>$(!S),onToggleMobileMenu:()=>_(!0),sidebarOpen:S,activeTab:c,onTabChange:d,showTabs:f,onActionClick:m,actionIcon:p,actionText:b,onNotificationRemove:h,onRemoveAll:g,logo:s,appName:u,tagline:N}),(0,fi.jsx)("main",{className:"flex-1 p-0 flex flex-col h-[calc(100vh-4rem)] overflow-hidden",children:t})]})]})}var lo=require("react-icons/fa");function It({title:e,description:t,badge:a,primaryAction:o,secondaryAction:r,gradient:i,children:n,className:l}){let[c,d]=eo(`hero-section-minimized-${e.replace(/\s+/g,"-").toLowerCase()}`,!r&&!t),f=!r&&!t||c;return(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:`overflow-hidden rounded-3xl ${i} p-8 text-white ${l||""}`,children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[a&&(0,fi.jsx)(ke,{className:"bg-white/20 text-white hover:bg-white/30 rounded-xl",children:a}),(0,fi.jsx)("h2",{className:"text-3xl font-bold m-0",children:e})]}),(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[f&&o&&(0,fi.jsx)(y,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:o.onClick,children:o.label}),(r||t)&&(0,fi.jsx)("button",{"aria-label":c?"Expand hero section":"Minimize hero section",className:"rounded-full bg-white/20 hover:bg-white/30 p-1 text-white transition-colors",onClick:()=>d(!c),style:{lineHeight:0},children:c?(0,fi.jsx)(lo.FaChevronDown,{size:22}):(0,fi.jsx)(lo.FaChevronUp,{size:22})})]})]}),!f&&(0,fi.jsxs)("div",{className:"flex flex-col gap-6 md:flex-row md:items-center md:justify-between",children:[(0,fi.jsxs)("div",{className:"space-y-4",children:[(0,fi.jsx)("p",{className:"max-w-[600px] text-white/80",children:t}),(0,fi.jsxs)("div",{className:"flex flex-wrap gap-3",children:[o&&(0,fi.jsx)(y,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:o.onClick,children:o.label}),r&&(0,fi.jsx)(y,{variant:"outline",className:"rounded-2xl bg-transparent border-white text-white hover:bg-white/10",onClick:r.onClick,children:r.label})]})]}),n&&(0,fi.jsx)("div",{className:"hidden lg:block",children:n})]})]})}var ea=ue(require("react"));var ce=ea.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("div",{ref:a,className:x("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ce.displayName="Card";var Ce=ea.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("div",{ref:a,className:x("flex flex-col space-y-1.5 p-6",e),...t}));Ce.displayName="CardHeader";var Pe=ea.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("div",{ref:a,className:x("font-semibold leading-none tracking-tight",e),...t}));Pe.displayName="CardTitle";var Ma=ea.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("div",{ref:a,className:x("text-sm text-muted-foreground",e),...t}));Ma.displayName="CardDescription";var me=ea.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("div",{ref:a,className:x("p-6 pt-0",e),...t}));me.displayName="CardContent";var Ia=ea.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("div",{ref:a,className:x("flex items-center p-6 pt-0",e),...t}));Ia.displayName="CardFooter";var Zi=ue(require("react")),La=ue(require("@radix-ui/react-progress"));var Ba=Zi.forwardRef(({className:e,value:t,...a},o)=>(0,fi.jsx)(La.Root,{ref:o,className:x("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...a,children:(0,fi.jsx)(La.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Ba.displayName=La.Root.displayName;function Bo({app:e,onOpen:t,onFavorite:a,showProgress:o=!1,className:r}){return(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:r,children:(0,fi.jsxs)(ce,{className:"overflow-hidden rounded-3xl border-2 hover:border-primary/50 transition-all duration-300",children:[(0,fi.jsx)(Ce,{className:"pb-2",children:(0,fi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,fi.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl bg-muted",children:e.icon}),e.new?(0,fi.jsx)(ke,{className:"rounded-xl bg-amber-500",children:"New"}):(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-2xl",onClick:()=>a?.(e),children:(0,fi.jsx)(wn.Star,{className:"h-4 w-4"})})]})}),(0,fi.jsxs)(me,{className:"pb-2",children:[(0,fi.jsx)(Pe,{className:"text-lg",children:e.name}),(0,fi.jsx)(Ma,{children:e.description}),o&&e.progress<100&&(0,fi.jsxs)("div",{className:"fi-2",children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,fi.jsx)("span",{children:"Installation"}),(0,fi.jsxs)("span",{children:[e.progress,"%"]})]}),(0,fi.jsx)(Ba,{value:e.progress,className:"h-2 fi-1 rounded-xl"})]})]}),(0,fi.jsx)(Ia,{children:(0,fi.jsx)(y,{variant:"secondary",className:"w-full rounded-2xl",onClick:()=>t?.(e),children:e.progress<100?"Continue Install":"Open"})})]})})}var Wr=ue(require("@radix-ui/react-dialog"));var er=ue(require("react")),Ze=er.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("textarea",{className:x("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:a,...t}));Ze.displayName="Textarea";var ar=ue(require("react")),Eo=ue(require("@radix-ui/react-label"));var cs=(0,gi.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ne=ar.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Eo.Root,{ref:a,className:x(cs(),e),...t}));Ne.displayName=Eo.Root.displayName;var Ea=({fieldName:e,value:t,label:a,multiline:o=!1,onSave:r,className:i="",disabled:n=!1})=>{let[l,c]=(0,ii.useState)(!1),[d,f]=(0,ii.useState)(""),m=()=>{n||(c(!0),f(t))},p=async()=>{d!==t&&await r(e,d),c(!1)},b=h=>{h.key==="Enter"&&!o||h.key==="Enter"&&h.ctrlKey&&o?p():h.key==="Escape"&&(c(!1),f(""))};return(0,fi.jsxs)("div",{className:`space-y-2 ${i}`,children:[(0,fi.jsx)(Ne,{children:a}),l?o?(0,fi.jsx)(Ze,{value:d,onChange:h=>f(h.target.value),onBlur:p,onKeyDown:b,autoFocus:!0,rows:4,className:"resize-none"}):(0,fi.jsx)(le,{value:d,onChange:h=>f(h.target.value),onBlur:p,onKeyPress:b,autoFocus:!0,className:"text-lg font-medium"}):(0,fi.jsxs)("div",{onClick:m,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 ${o?"min-h-[100px]":"min-h-[40px]"} flex items-start gap-2`,children:[(0,fi.jsx)("span",{className:o?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click to edit..."}),!n&&(0,fi.jsx)(wn.Edit,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var Mr=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),Ir=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),Lr=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),Br=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),Er=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),Fr=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),Hr=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),po=require("@payloadcms/richtext-lexical/lexical/list"),jr=require("@payloadcms/richtext-lexical/lexical/rich-text"),Ur=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var Pr=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),Ua=require("@payloadcms/richtext-lexical/lexical/utils"),ae=require("@payloadcms/richtext-lexical/lexical"),Wo=require("@payloadcms/richtext-lexical/lexical/selection");var fr=require("@radix-ui/react-dialog"),co=require("@payloadcms/richtext-lexical/client");var Ho=ue(require("bson-objectid"));var nr=require("@payloadcms/ui");var ms=e=>{let{data:{relationTo:t,value:a},nodeKey:o}=e,[r]=(0,Pr.useLexicalComposerContext)(),[i,n]=(0,ii.useState)(""),[l,c]=(0,ii.useState)(""),[d,f]=(0,ii.useState)(""),m=async s=>{console.log("fetchMedia",s)};(0,ii.useEffect)(()=>{typeof a=="string"?a.length===24?m(a):(n(a||""),f(g(h())),c(b()||"")):typeof a=="object"&&(n(`${process.env.NEXT_PUBLIC_API_URL}${a.url}`||""),f(g(a.filesize)),c(a.mimeType?.split("/")[1]||""))},[]);let p=(0,ii.useCallback)(()=>{r.update(()=>{(0,ae.$getNodeByKey)(o)?.remove()})},[r,o]),b=()=>{let s=e.data.value;return typeof s=="string"?s.split(";base64")[0]?.split("image/")[1]:""},h=()=>{let s=e.data.value;if(typeof s=="string"){let u=s.split(",")[1]?.length||0;return 4*Math.ceil(u/3)*.5624896334383812/1e3}return 0};function g(s){if(s>=1e6){let N=s/1e6;return`${N>=10?Math.round(N).toString():N.toFixed(1)} MB`}return`${Math.floor(s/1e3)} KB`}return(0,fi.jsx)("div",{className:"my-2",contentEditable:!1,children:(0,fi.jsxs)("div",{className:"border border-slate-800 rounded-xl overflow-clip w-60 flex flex-col gap-2 bg-[#222222]",children:[(0,fi.jsxs)("div",{className:"flex gap-2 border-b border-b-slate-100/10",children:[(0,fi.jsx)("div",{className:"flex-1",children:e.data.value?(0,fi.jsx)("img",{className:"object-cover m-0 w-full min-w-[115px] min-h-[105px]","data-lexical-upload-id":a,"data-lexical-upload-relation-to":t,src:i}):(0,fi.jsx)(nr.File,{})}),(0,fi.jsx)(Vt,{children:(0,fi.jsxs)($t,{children:[(0,fi.jsxs)(_t,{className:"flex-1 flex justify-center items-center text-[#b5b5b5]",children:[(0,fi.jsx)("span",{className:"font-medium text-sm",children:"Media"}),(0,fi.jsx)("button",{onClick:s=>{s.preventDefault(),p()},className:"flex-1 flex justify-center items-center",children:(0,fi.jsx)(wn.fi,{width:24,height:24,strokeWidth:1})})]}),(0,fi.jsx)(Rt,{children:(0,fi.jsx)("span",{children:"Remove image"})})]})})]}),(0,fi.jsxs)("div",{className:"flex items-center justify-center gap-4 py-3 flex-1 text-xs font-bold",children:[(0,fi.jsx)("span",{className:"",children:l?.toLocaleUpperCase()}),(0,fi.jsx)("span",{children:d})]})]})})},cr=ms;function ps(e){if(e.hasAttribute("data-lexical-upload-relation-to")&&e.hasAttribute("data-lexical-upload-id")){let a=e.getAttribute("data-lexical-upload-id");if(a)return{node:ga({fields:{},relationTo:"media",value:a})}}return e.src.startsWith("file:///"),null}var Fa=class extends co.UploadNode{static importDOM(){return{img:()=>({conversion:ps,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new Ho.default().toHexString(),t.version=3);let a={id:t.id??new Ho.default().toHexString(),fields:t.fields,relationTo:"media",value:t.value},o=ga(a);return o.setFormat?.(t.format),o}decorate(){return(0,fi.jsx)(cr,{data:this.__data,nodeKey:this.getKey()})}};function ga(e){return new Fa({data:e})}var us=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",gs=e=>us?(e||window).getSelection():null,jd=(0,ae.createCommand)("INSERT_UPLOAD_WITH_DRAWER_COMMAND"),jo=(0,ae.createCommand)("INSERT_UPLOAD_COMMAND");function hr({activeEditor:e,onClose:t,isOpen:a=!1}){let o=(0,ii.useRef)(!1),[r,i]=(0,ii.useState)(!0),[n,l]=(0,ii.useState)(""),[c,d]=(0,ii.useState)(""),[f,m]=(0,ii.useState)(!1),[p,b]=(0,ii.useState)("left"),h=n==="",g=S=>{m(S.target.checked)},s=S=>{b(S.target.value)},u=S=>{let $=new FileReader;$.onload=function(){return typeof $.result=="string"&&l($.result),""},S!==null&&S[0]&&$.readAsDataURL(S[0])};(0,ii.useEffect)(()=>{o.current=!1;let S=$=>{o.current=$.altKey};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[e]),(0,ii.useEffect)(()=>{r||t()},[r]),(0,ii.useEffect)(()=>{i(a)},[a]);let N=({editor:S,relationTo:$,replaceNodeKey:ee,value:_})=>{if(ee)S.update(()=>{let v=(0,ae.$getNodeByKey)(ee);v&&v.replace(ga({id:"",fields:{},relationTo:"media",value:_}))});else{let v=S.dispatchCommand(jo,{fields:null,relationTo:"media",value:_})}},R=()=>{N({editor:e,relationTo:"media",replaceNodeKey:null,value:{altText:c,src:n,showCaption:f,position:p}.src}),i(!1),t()};return(0,fi.jsx)(Xe,{open:r,onOpenChange:S=>i(S),children:(0,fi.jsxs)(bt,{children:[(0,fi.jsxs)(xt,{children:[(0,fi.jsx)(ot,{children:"Upload Image"}),(0,fi.jsx)(fr.DialogDescription,{children:"Description"})]}),(0,fi.jsxs)("div",{className:"",children:[(0,fi.jsx)("div",{style:{marginBottom:"1em"},children:(0,fi.jsx)(le,{type:"file",onChange:S=>u(S.target.files),accept:"image/*","data-test-id":"image-modal-file-upload"})}),(0,fi.jsx)("div",{style:{marginBottom:"1em"},children:(0,fi.jsx)(le,{"aria-label":"Alt Text",placeholder:"Descriptive alternative text",onChange:S=>d(S.currentTarget.value),value:c,"data-test-id":"image-modal-alt-text-input"})}),(0,fi.jsx)(y,{"data-test-id":"image-modal-file-upload-btn",disabled:h,onClick:()=>R(),children:"Confirm"})]})]})})}function Uo({captionsEnabled:e}){let[t]=(0,Pr.useLexicalComposerContext)();return(0,ii.useEffect)(()=>{if(!t.hasNodes([co.UploadNode]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return(0,Ua.mergeRegister)(t.registerCommand(ae.DRAGSTART_COMMAND,a=>fs(a),ae.COMMAND_PRIORITY_HIGH),t.registerCommand(ae.DRAGOVER_COMMAND,a=>hs(a),ae.COMMAND_PRIORITY_LOW),t.registerCommand(ae.DROP_COMMAND,a=>vs(a,t),ae.COMMAND_PRIORITY_HIGH))},[e,t]),null}function fs(e){if(!Ko())return!1;let a=e.dataTransfer;return a?(a.setData("text/plain","_"),!0):!1}function hs(e){return Ko()?(vr(e)||e.preventDefault(),!0):!1}function vs(e,t){let a=Ko();if(!a)return!1;if(e.preventDefault(),vr(e)){let o=bs(e);a.remove();let r=(0,ae.$createRangeSelection)();o!=null&&r.applyDOMRange(o),(0,ae.$setSelection)(r)}return!0}function Ko(){let e=(0,ae.$getSelection)();if(!(0,ae.$isNodeSelection)(e))return null;let a=e.getNodes()[0];return(0,co.$isUploadNode)(a)?a:null}function vr(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 bs(e){let t,a=e.target,o=a==null?null:a.nodeType===9?a.defaultView:a.ownerDocument.defaultView,r=gs(o);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(e.clientX,e.clientY);else if(e.rangeParent&&r!==null)r.collapse(e.rangeParent,e.rangeOffset||0),t=r.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}var xs=()=>(0,fi.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,fi.jsx)("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})}),br=xs;var ys=()=>(0,fi.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,fi.jsx)("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})}),xr=ys;var ws=()=>(0,fi.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,fi.jsx)("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),(0,fi.jsx)("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),yr=ws;var Cs=()=>(0,fi.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,fi.jsx)("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),(0,fi.jsx)("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),wr=Cs;var Ns=()=>(0,fi.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,fi.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})}),Cr=Ns;var Ds=()=>(0,$o.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,$o.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})}),Nr=Ds;var Dr=()=>(0,fi.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,fi.jsx)("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})}),Sr=()=>(0,fi.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,fi.jsx)("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})}),kr=()=>(0,fi.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,fi.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})}),Tr=()=>(0,fi.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,fi.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})}),Ar=()=>(0,fi.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,fi.jsx)("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});var _o=1;function Ss(){return(0,fi.jsx)("span",{className:"border border-[#222222]"})}function Go(){let[e]=(0,Pr.useLexicalComposerContext)(),t=(0,ii.useRef)(null),[a,o]=(0,ii.useState)(!1),[r,i]=(0,ii.useState)(!1),[n,l]=(0,ii.useState)(!1),[c,d]=(0,ii.useState)(!1),[f,m]=(0,ii.useState)(!1),[p,b]=(0,ii.useState)(!1),[h,g]=(0,ii.useState)(!1),[s,u]=(0,ii.useState)(!1),[N,R]=(0,ii.useState)(!1),[S,$]=(0,ii.useState)("left"),[ee,_]=(0,ii.useState)("p"),v=C=>{e.update(()=>{let U=(0,ae.$getSelection)();(0,ae.$isRangeSelection)(U)&&(C==="p"?(0,Wo.$setBlocksType)(U,()=>(0,ae.$createParagraphNode)()):(0,Wo.$setBlocksType)(U,()=>(0,jr.$createHeadingNode)(C)))})},z=(0,ii.useCallback)(()=>{let C=(0,ae.$getSelection)();if((0,ae.$isRangeSelection)(C)){l(C.hasFormat("bold")),d(C.hasFormat("italic")),m(C.hasFormat("underline")),b(C.hasFormat("strikethrough")),g(C.hasFormat("subscript")),u(C.hasFormat("superscript"));let U=C.anchor.getNode(),k=U;for(;k&&!(0,ae.$isParagraphNode)(k)&&k!==(0,ae.$getRoot)();){let M=k.getParent();M&&(k=M)}if(k){let M=k.getFormatType();$(M||"left")}let fe=U.getTopLevelElement()?.__tag;_(fe||"p")}},[]);(0,ii.useEffect)(()=>(0,Ua.mergeRegister)(e.registerUpdateListener(({editorState:C})=>{C.read(()=>{z()})}),e.registerCommand(ae.SELECTION_CHANGE_COMMAND,(C,U)=>(z(),!1),_o),e.registerCommand(ae.CAN_UNDO_COMMAND,C=>(o(C),!1),_o),e.registerCommand(ae.CAN_REDO_COMMAND,C=>(i(C),!1),_o),(0,Ua.mergeRegister)(e.registerCommand(jo,C=>(e.update(()=>{let U=(0,ae.$getSelection)()||(0,ae.$getPreviousSelection)();if((0,ae.$isRangeSelection)(U)){let k=ga({id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}),{focus:fe}=U,M=fe.getNode();(0,Ua.$insertNodeToNearestRoot)(k),(0,ae.$isParagraphNode)(M)&&!M.__first&&M.remove()}}),!0),ae.COMMAND_PRIORITY_EDITOR))),[e,z]);let V=[[{label:"Undo",icon:(0,fi.jsx)(wn.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ae.UNDO_COMMAND,void 0)},disabled:!a},{label:"Redo",icon:(0,fi.jsx)(wn.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ae.UNDO_COMMAND,void 0)},disabled:!r}],[{label:"Bold",icon:(0,fi.jsx)(br,{}),onClick:()=>{e.dispatchCommand(ae.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:n},{label:"Italic",icon:(0,fi.jsx)(xr,{}),onClick:()=>{e.dispatchCommand(ae.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:c},{label:"Underline",icon:(0,fi.jsx)(yr,{}),onClick:()=>{e.dispatchCommand(ae.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:f},{label:"Strikethrough",icon:(0,fi.jsx)(wr,{}),onClick:()=>{e.dispatchCommand(ae.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:p},{label:"Subscript",icon:(0,fi.jsx)(Cr,{}),onClick:()=>{e.dispatchCommand(ae.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:h},{label:"Superscript",icon:(0,fi.jsx)(Nr,{}),onClick:()=>{e.dispatchCommand(ae.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:s}]],j=[{label:"Left Align",direction:"left",icon:(0,fi.jsx)(wn.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ae.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,fi.jsx)(wn.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ae.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,fi.jsx)(wn.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ae.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,fi.jsx)(wn.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ae.FORMAT_ELEMENT_COMMAND,"justify")}}],Te=[{label:"Normal Text",value:"p",icon:(0,fi.jsx)(Dr,{}),onClick:()=>v("p")},{label:"Heading 1",value:"h1",icon:(0,fi.jsx)(Sr,{}),onClick:()=>v("h1")},{label:"Heading 2",value:"h2",icon:(0,fi.jsx)(kr,{}),onClick:()=>v("h2")},{label:"Heading 3",value:"h3",icon:(0,fi.jsx)(Tr,{}),onClick:()=>v("h3")},{label:"Heading 4",value:"h4",icon:(0,fi.jsx)(Ar,{}),onClick:()=>v("h4")},...[{label:"Unordered List",value:"ul",icon:(0,fi.jsx)(wn.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(po.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,fi.jsx)(wn.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(po.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],w=[{label:"Insert Image",icon:(0,fi.jsx)(wn.ImageUp,{width:15,height:15}),onClick:()=>{R(!0)},disabled:!1}];return(0,fi.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2 sticky top-0 bg-black z-50",children:(0,fi.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[V.map((C,U)=>(0,fi.jsxs)(ii.Fragment,{children:[(0,fi.jsx)("div",{className:"flex items-center gap-2",children:C.map((k,fe)=>(0,fi.jsx)("div",{role:"button","aria-disabled":k.disabled||!1,onClick:k.onClick,className:x("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]",k.active&&"bg-[#3c3c3c]"),"aria-label":k.label,children:(0,fi.jsx)(Vt,{children:(0,fi.jsxs)($t,{children:[(0,fi.jsx)(_t,{className:"text-[#b5b5b5]",children:k.icon}),(0,fi.jsx)(Rt,{children:(0,fi.jsx)("p",{children:k.label})})]})})},fe))}),(0,fi.jsx)(Ss,{})]},`toolbar-option-${C.length}-${U}`)),(0,fi.jsxs)(dt,{children:[(0,fi.jsxs)(ct,{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:[j.find(C=>C.direction===S)?.icon,j.find(C=>C.direction===S)?.label,(0,fi.jsx)(wn.ChevronDown,{width:15,height:15})]}),(0,fi.jsx)(it,{className:"bg-black hover:bg-black",children:j.map((C,U)=>(0,fi.jsxs)(ze,{onClick:C.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,fi.jsx)("span",{children:C.icon}),(0,fi.jsx)("span",{children:C.label})]},`${C.label}-${U}`))})]}),(0,fi.jsxs)(dt,{children:[(0,fi.jsxs)(ct,{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:[Te.find(C=>C.value===ee)?.icon,Te.find(C=>C.value===ee)?.label,(0,fi.jsx)(wn.ChevronDown,{width:15,height:15})]}),(0,fi.jsx)(it,{className:"bg-black hover:bg-black",children:Te.map((C,U)=>(0,fi.jsxs)(ze,{onClick:C.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,fi.jsx)("span",{children:C.icon}),(0,fi.jsx)("span",{children:C.label})]},`heading-option-${C.label}-${U}`))})]}),(0,fi.jsxs)(dt,{children:[(0,fi.jsxs)(ct,{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,fi.jsx)(wn.Plus,{width:15,height:15}),(0,fi.jsx)(wn.ChevronDown,{width:15,height:15})]}),(0,fi.jsx)(it,{className:"bg-black hover:bg-black",children:w.map((C,U)=>(0,fi.jsxs)(ze,{onClick:C.onClick,disabled:C.disabled,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,fi.jsx)("span",{children:C.icon}),(0,fi.jsx)("span",{children:C.label})]},U))})]}),N&&(0,fi.jsx)(hr,{activeEditor:e,onClose:()=>{R(!1)},isOpen:N})]})})}var ks=({setValue:e,value:t,name:a,editable:o=!0})=>{let[r]=(0,Pr.useLexicalComposerContext)(),i=(0,ii.useRef)(null),n=l=>{l.read(()=>{let c=l.toJSON();JSON.stringify(c)!==JSON.stringify(i.current)&&(i.current=c,e?.(()=>c))})};return(0,ii.useEffect)(()=>{r.setEditable(o)},[o,r]),(0,ii.useEffect)(()=>{t&&JSON.stringify(t)!==JSON.stringify(i.current)&&r.update(()=>{try{let l=r.parseEditorState(t);r.setEditorState(l),i.current=t}catch(l){console.error("Error parsing editor state:",l)}},{discrete:!0})},[t,r]),(0,fi.jsx)("div",{className:"w-full",children:(0,fi.jsxs)("div",{className:" ",children:[o&&(0,fi.jsx)(Go,{}),(0,fi.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,fi.jsx)(Fr.RichTextPlugin,{contentEditable:(0,fi.jsx)(Lr.ContentEditable,{name:a,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-h-40"}),ErrorBoundary:Br.LexicalErrorBoundary}),o&&(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsx)(Er.HistoryPlugin,{}),(0,fi.jsx)(Mr.AutoFocusPlugin,{}),(0,fi.jsx)(Hr.ListPlugin,{}),(0,fi.jsx)(Ur.OnChangePlugin,{onChange:n}),(0,fi.jsx)(Uo,{})]})]})]})})},Ts=({setValue:e,value:t,name:a,editable:o=!0})=>(0,fi.jsx)(Ir.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[po.ListNode,po.ListItemNode,jr.HeadingNode,Fa],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,fi.jsx)(ks,{value:t,setValue:e,name:a,editable:o})}),fa=Ts;var ne=ue(require("@radix-ui/react-select")),qt=ue(require("react")),Ct=ne.Root;var Nt=ne.Value,pt=qt.forwardRef(({children:e,className:t,...a},o)=>(0,fi.jsxs)(ne.Trigger,{className:x("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:o,...a,children:[e,(0,fi.jsx)(ne.Icon,{asChild:!0,children:(0,fi.jsx)(wn.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));pt.displayName=ne.Trigger.displayName;var Or=qt.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(ne.ScrollUpButton,{className:x("flex cursor-default items-center justify-center py-1",e),ref:a,...t,children:(0,fi.jsx)(wn.ChevronUp,{className:"h-4 w-4"})}));Or.displayName=ne.ScrollUpButton.displayName;var zr=qt.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(ne.ScrollDownButton,{className:x("flex cursor-default items-center justify-center py-1",e),ref:a,...t,children:(0,fi.jsx)(wn.ChevronDown,{className:"h-4 w-4"})}));zr.displayName=ne.ScrollDownButton.displayName;var ut=qt.forwardRef(({children:e,className:t,position:a="popper",...o},r)=>(0,fi.jsx)(ne.Portal,{children:(0,fi.jsxs)(ne.Content,{className:x("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",a==="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:a,ref:r,...o,children:[(0,fi.jsx)(Or,{}),(0,fi.jsx)(ne.Viewport,{className:x("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),(0,fi.jsx)(zr,{})]})}));ut.displayName=ne.Content.displayName;var As=qt.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(ne.Label,{className:x("py-1.5 pl-8 fi-2 text-sm font-semibold",e),ref:a,...t}));As.displayName=ne.Label.displayName;var Ue=qt.forwardRef(({children:e,className:t,...a},o)=>(0,fi.jsxs)(ne.Item,{className:x("relative flex w-full cursor-default select-none items-center rounded py-1.5 pl-8 fi-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),ref:o,...a,children:[(0,fi.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,fi.jsx)(ne.ItemIndicator,{children:(0,fi.jsx)(wn.Check,{className:"h-4 w-4"})})}),(0,fi.jsx)(ne.ItemText,{children:e})]}));Ue.displayName=ne.Item.displayName;var Ps=qt.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(ne.Separator,{className:x("-mx-1 my-1 h-px bg-muted",e),ref:a,...t}));Ps.displayName=ne.Separator.displayName;var Oa=e=>"mimeType"in e&&"url"in e&&!("format"in e),Rs=e=>{if(!e?.root?.children)return"";let t=[],a=r=>{if(!r)return"";switch(r.type){case"heading":{let i=r.tag?parseInt(r.tag.replace("h","")):1,n=o(r.children||[]);return"#".repeat(i)+" "+n}case"paragraph":return o(r.children||[]);case"list":{let i=[],n=r.listType==="number"?"1.":"-";return r.children?.forEach((l,c)=>{if(l.type==="listitem"){let d=o(l.children||[]),f=r.listType==="number"?`${c+1}.`:n;i.push(`${f} ${d}`)}}),i.join(`
6
- `)}case"listitem":return o(r.children||[]);case"text":{let i=r.text||"";if(r.format){let n=(r.format&1)!==0,l=(r.format&2)!==0,c=(r.format&4)!==0,d=(r.format&8)!==0;(r.format&16)!==0?i=`\`${i}\``:(n&&(i=`**${i}**`),l&&(i=`*${i}*`),c&&(i=`~~${i}~~`),d&&(i=`<u>${i}</u>`))}return i}default:return r.children?o(r.children):""}},o=r=>r.map(i=>{if(i.type==="text"){let n=i.text||"";if(i.format){let l=(i.format&1)!==0,c=(i.format&2)!==0,d=(i.format&4)!==0,f=(i.format&8)!==0;(i.format&16)!==0?n=`\`${n}\``:(l&&(n=`**${n}**`),c&&(n=`*${n}*`),d&&(n=`~~${n}~~`),f&&(n=`<u>${n}</u>`))}return n}else{if(i.type==="paragraph")return o(i.children||[]);if(i.type==="listitem")return o(i.children||[]);if(i.type==="linebreak")return`
7
- `}return a(i)}).filter(Boolean).join("");return e.root.children.forEach(r=>{let i=a(r);i&&t.push(i)}),t.join(`
8
-
9
- `)},oa=e=>{let t=[],a=0;for(;a<e.length;){let r=e.slice(a).match(/^<u\s*[^>]*>([\s\S]*?)<\/u>/i);if(r&&r[0]){let p=r[1]||"",b=p?oa(p):[];b.length>0?(b.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|8)}),t.push(...b)):p===""&&t.push({type:"text",text:"",format:8}),a+=r[0].length;continue}if(e.slice(a).startsWith("</u>")){a+=4;continue}let i=e.slice(a).match(/^(`+)([^`]+)\1/);if(i){let p=i[2];p&&t.push({type:"text",text:p,format:16}),a+=i[0].length;continue}let n=e.slice(a).match(/^(~~)(.+?)\1/);if(n){let p=n[2],b=oa(p);b.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|4)}),t.push(...b),a+=n[0].length;continue}let l=e.slice(a).match(/^(\*\*|__)(.+?)\1/);if(l){let p=l[2],b=oa(p);b.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|1)}),t.push(...b),a+=l[0].length;continue}let c=e.slice(a).match(/^(\*|_)([^*_\n]+?)\1(?!\*|_)/);if(c&&c[0].length>2){let p=c[2],b=oa(p);b.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|2)}),t.push(...b),a+=c[0].length;continue}let d=e.length,f=[{pattern:/<u>/i,offset:0},{pattern:/\*\*/,offset:0},{pattern:/__/,offset:0},{pattern:/~~/,offset:0},{pattern:/`+/,offset:0},{pattern:/\*[^*\n]/,offset:0},{pattern:/_[^_\n]/,offset:0}];for(let{pattern:p}of f){let b=e.slice(a+1).search(p);b!==-1&&b+1<d-a&&(d=a+b+1)}let m=e.slice(a,d);m&&t.push({type:"text",text:m,format:0}),a=d}let o=[];for(let r of t)o.length>0&&o[o.length-1].type==="text"&&o[o.length-1].format===r.format?o[o.length-1].text+=r.text:o.push(r);return o.length>0?o:[{type:"text",text:"",format:0}]},Ms=e=>{let t=e.split(`
10
- `),a=[],o=[],r=[],i=()=>{if(o.length>0){let l=o.join(" "),c=oa(l);a.push({type:"paragraph",children:c.length>0?c:[{type:"text",text:"",format:0}]}),o=[]}},n=()=>{r.length>0&&(a.push({type:"list",listType:"bullet",children:r}),r=[])};for(let l of t){let c=l.trim();if(!c){i(),n();continue}let d=c.match(/^(#{1,6})\s+(.+)$/);if(d){i(),n();let m=d[1].length,p=d[2],b=oa(p);a.push({type:"heading",tag:`h${m}`,children:b.length>0?b:[{type:"text",text:"",format:0}]});continue}let f=c.match(/^[-*+]\s+(.+)$/);if(f){i();let m=f[1],p=oa(m);r.push({type:"listitem",children:[{type:"paragraph",children:p.length>0?p:[{type:"text",text:"",format:0}]}]});continue}r.length>0&&n(),o.push(c)}return i(),n(),a.length===0&&a.push({type:"paragraph",children:[{type:"text",text:"",format:0}]}),{root:{type:"root",children:a,direction:"ltr",format:"",indent:0,version:1}}},Is=async e=>{let t="",a,o="text";if(e.url)try{let r=e.url;!r.startsWith("http://")&&!r.startsWith("https://")&&!r.startsWith("/")&&(r="/"+r);let i=await fetch(r);i.ok?(t=await i.text(),console.log("Successfully loaded content, length:",t.length)):console.error("Failed to fetch file content:",i.status,i.statusText)}catch(r){console.error("Failed to fetch file content:",r)}else console.warn("No URL provided for file:",e.name);return e.mimeType==="text/markdown"?(o="richText",a=Ms(t)):e.mimeType?.startsWith("text/")&&(o="text"),{id:e.id.toString(),title:e.name,description:void 0,content:o==="richText"?void 0:t,richTextContent:o==="richText"?a:void 0,format:o,metadata:{},createdAt:typeof e.createdAt=="string"?new Date(e.createdAt):e.createdAt,updatedAt:new Date}};function $r({document:e,onCancel:t,onSave:a,onFileUpdate:o}){let[r,i]=(0,ii.useState)(Oa(e)),[n,l]=(0,ii.useState)(Oa(e)?{id:e.id.toString(),title:e.name,description:void 0,content:"",format:"text",metadata:{},createdAt:typeof e.createdAt=="string"?new Date(e.createdAt):e.createdAt,updatedAt:new Date}:{...e,updatedAt:new Date}),[c,d]=(0,ii.useState)(Oa(e)?void 0:n.richTextContent),[f,m]=(0,ii.useState)(!1),p=(0,ii.useRef)(Oa(e)?e:null);(0,ii.useEffect)(()=>{Oa(e)?(i(!0),Is(e).then(s=>{l(s),d(s.richTextContent),i(!1)}).catch(s=>{s instanceof Error&&s.name!=="AbortError"&&(console.error("Failed to convert file:",s),i(!1))})):(l({...e,updatedAt:new Date}),d(e.richTextContent))},[e]);let b=s=>{switch(s){case"markdown":case"mdx":return(0,fi.jsx)($e.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,fi.jsx)($e.File,{className:"h-6 w-6 text-success"});case"text":return(0,fi.jsx)($e.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,fi.jsx)($e.File,{className:"h-6 w-6 text-muted-foreground"})}},h=s=>{switch(s){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"}},g=async()=>{m(!0);try{let s,u;if(p.current&&p.current.mimeType==="text/markdown"){let R=c?Rs(c):"";s={...n,format:"markdown",content:R,richTextContent:void 0},u=R}else s={...n,richTextContent:c},u=n.content||"";let N=p.current?p.current.id.toString():n.id;await Promise.resolve(a()),o?.(N,u)}finally{m(!1)}};return(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,fi.jsx)("div",{className:"border-b border-border bg-card p-8 pb-6",children:(0,fi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,fi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,fi.jsx)("div",{className:"flex-1 min-w-0",children:(0,fi.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,fi.jsx)("div",{className:"flex-1 min-w-0",children:(0,fi.jsx)(Ea,{fieldName:"title",value:n.title,label:"",onSave:(s,u)=>l(N=>({...N,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,fi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${h(n.format)} flex-shrink-0 fi-1`,children:n.format.toUpperCase()})]})})}),(0,fi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,fi.jsxs)(y,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,fi.jsx)($e.fi,{className:"h-4 w-4"}),"Close"]}),(0,fi.jsxs)(y,{size:"sm",onClick:g,className:"gap-2",disabled:f,children:[f?(0,fi.jsx)($e.Loader2,{className:"h-4 w-4 animate-spin"}):(0,fi.jsx)($e.Save,{className:"h-4 w-4"}),f?"Saving...":"Save"]})]})]})}),(0,fi.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,fi.jsx)("div",{className:"p-8 pt-0 h-full max-h-full overflow-auto",children:r?(0,fi.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,fi.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,fi.jsx)($e.Loader2,{className:"h-8 w-8 animate-spin text-primary"}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading file content..."})]})}):(0,fi.jsx)(fi.Fragment,{children:n.format==="richText"?(0,fi.jsx)(fa,{setValue:d,value:c,name:"richTextContent"},`richtext-${n.id}-${r?"loading":"loaded"}`):(0,fi.jsx)(Ze,{value:n.content||"",onChange:s=>l(u=>({...u,content:s.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})})]})}var _r=e=>{if(!e||e<=0)return"0 KB";let t=e/1024;return t<1024?`${t.toFixed(2)} KB`:`${(t/1024).toFixed(2)} MB`};function Jr({files:e,onFileClick:t,onFileDelete:a,onFileUpdate:o,showHeader:r=!0,className:i,viewMode:n="list"}){let[l,c]=(0,ii.useState)(!1),[d,f]=(0,ii.useState)(!1),[m,p]=(0,ii.useState)(null),b=()=>{c(!1),p(null)},h=()=>{f(!0),setTimeout(()=>{f(!1),c(!1),p(null)},500)},g=s=>{p(s),c(!0)};return(0,fi.jsxs)("div",{className:x("rounded-3xl border overflow-hidden",i),children:[(0,fi.jsxs)("div",{className:"bg-muted/50 p-3 flex items-center justify-between",children:[r&&n==="list"&&(0,fi.jsxs)("div",{className:"hidden md:grid md:grid-cols-10 text-sm font-medium flex-1",children:[(0,fi.jsx)("div",{className:"col-span-6",children:"Name"}),(0,fi.jsx)("div",{className:"col-span-2",children:"Size"}),(0,fi.jsx)("div",{className:"col-span-2",children:"Modified"})]}),n==="card"&&(0,fi.jsx)("div",{className:"text-sm font-medium",children:"Files"})]}),n==="list"&&(0,fi.jsx)("div",{className:"divide-y",children:e.map(s=>(0,fi.jsxs)(Co.motion.div,{whileHover:{backgroundColor:"rgba(0,0,0,0.02)"},className:"p-3 md:grid md:grid-cols-10 items-center flex flex-col md:flex-row gap-3 md:gap-0 cursor-pointer",onClick:()=>t?.(s),children:[(0,fi.jsxs)("div",{className:"col-span-6 flex items-center gap-3 w-full md:w-auto",children:[(0,fi.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted"}),(0,fi.jsx)("div",{children:(0,fi.jsx)("p",{className:"font-medium",children:s.name})})]}),(0,fi.jsx)("div",{className:"col-span-2 text-sm md:text-base",children:_r(s.filesize)}),(0,fi.jsxs)("div",{className:"col-span-2 flex items-center justify-between w-full md:w-auto",children:[(0,fi.jsx)("span",{className:"text-sm md:text-base",children:new Date(s.createdAt).toLocaleDateString()}),(0,fi.jsxs)("div",{className:"flex gap-1",children:[s.mimeType==="text/markdown"&&(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl",onClick:u=>{u.stopPropagation(),g(s)},children:(0,fi.jsx)(wn.Edit,{className:"h-4 w-4"})}),(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:u=>{u.stopPropagation(),a?.(s)},children:(0,fi.jsx)(wn.Trash2,{className:"h-4 w-4"})})]})]})]},s.name))}),n==="card"&&(0,fi.jsx)("div",{className:"p-4 grid grid-cols-1 gap-4",children:e.map(s=>(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02},className:"border rounded-lg p-4 bg-card hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>t?.(s),children:(0,fi.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,fi.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,fi.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted flex-shrink-0"}),(0,fi.jsx)("div",{className:"min-w-0 flex-1",children:(0,fi.jsx)("p",{className:"font-medium truncate",children:s.name})})]}),(0,fi.jsxs)("div",{className:"space-y-1 text-sm text-muted-foreground pl-[52px]",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,fi.jsx)("span",{className:"font-medium",children:"Size:"}),(0,fi.jsx)("span",{children:_r(s.filesize)})]}),(0,fi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,fi.jsx)("span",{className:"font-medium",children:"Modified:"}),(0,fi.jsx)("span",{children:new Date(s.createdAt).toLocaleDateString()})]})]})]}),(0,fi.jsxs)("div",{className:"flex flex-col gap-2 flex-shrink-0",children:[s.mimeType==="text/markdown"&&(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl",onClick:u=>{u.stopPropagation(),g(s)},title:"Edit",children:(0,fi.jsx)(wn.Edit,{className:"h-4 w-4"})}),(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:u=>{u.stopPropagation(),a?.(s)},title:"Delete",children:(0,fi.jsx)(wn.Trash2,{className:"h-4 w-4"})})]})]})},s.name))}),(0,fi.jsx)(Xe,{open:l,onOpenChange:s=>!s&&b(),children:(0,fi.jsxs)(pa,{children:[(0,fi.jsx)(Yt,{}),(0,fi.jsxs)(Wr.Content,{className:x("fixed inset-0 z-50 bg-background p-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:[(0,fi.jsx)(ot,{className:"Pr-only",children:m?`Edit ${m.name}`:"Edit File"}),d&&(0,fi.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center z-50",children:(0,fi.jsx)(wn.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),m&&(0,fi.jsx)($r,{document:m,onSave:h,onFileUpdate:o,onCancel:b})]})]})})]})}function Xr({project:e,onOpen:t,onShare:a,className:o}){return(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:o,children:(0,fi.jsxs)(ce,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,fi.jsxs)(Ce,{children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,fi.jsx)(Pe,{children:e.name}),(0,fi.jsxs)(ke,{variant:"outline",className:"rounded-xl",children:["Due ",e.dueDate]})]}),(0,fi.jsx)(Ma,{children:e.description})]}),(0,fi.jsxs)(me,{className:"space-y-4",children:[(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,fi.jsx)("span",{children:"Progress"}),(0,fi.jsxs)("span",{children:[e.progress,"%"]})]}),(0,fi.jsx)(Ba,{value:e.progress,className:"h-2 rounded-xl"})]}),(0,fi.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,fi.jsxs)("div",{className:"flex items-center",children:[(0,fi.jsx)(wn.Users,{className:"co-1 h-4 w-4"}),e.members," members"]}),(0,fi.jsxs)("div",{className:"flex items-center",children:[(0,fi.jsx)(wn.FileText,{className:"co-1 h-4 w-4"}),e.files," files"]})]})]}),(0,fi.jsxs)(Ia,{className:"flex gap-2",children:[(0,fi.jsx)(y,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"Open Project"}),(0,fi.jsx)(y,{variant:"outline",size:"icon",className:"rounded-2xl",onClick:()=>a?.(e),children:(0,fi.jsx)(wn.Share2,{className:"h-4 w-4"})})]})]})})}var qo=[{name:"PixelMaster",icon:(0,fi.jsx)(wn.ImageIcon,{className:"text-violet-500"}),description:"Advanced image editing and composition",category:"Creative",recent:!0,new:!1,progress:100},{name:"VectorPro",icon:(0,fi.jsx)(wn.Brush,{className:"text-orange-500"}),description:"Professional vector graphics creation",category:"Creative",recent:!0,new:!1,progress:100},{name:"VideoStudio",icon:(0,fi.jsx)(wn.Video,{className:"text-pink-500"}),description:"Cinematic video editing and production",category:"Video",recent:!0,new:!1,progress:100},{name:"MotionFX",icon:(0,fi.jsx)(wn.Sparkles,{className:"text-blue-500"}),description:"Stunning visual effects and animations",category:"Video",recent:!1,new:!1,progress:100},{name:"PageCraft",icon:(0,fi.jsx)(wn.Layers,{className:"text-red-500"}),description:"Professional page design and layout",category:"Creative",recent:!1,new:!1,progress:100},{name:"UXFlow",icon:(0,fi.jsx)(wn.LayoutGrid,{className:"text-fuchsia-500"}),description:"Intuitive user experience design",category:"Design",recent:!1,new:!0,progress:85},{name:"PhotoLab",icon:(0,fi.jsx)(wn.Camera,{className:"text-teal-500"}),description:"Advanced photo editing and organization",category:"Photography",recent:!1,new:!1,progress:100},{name:"DocMaster",icon:(0,fi.jsx)(wn.FileText,{className:"text-red-600"}),description:"Document editing and management",category:"Document",recent:!1,new:!1,progress:100},{name:"WebCanvas",icon:(0,fi.jsx)(wn.Code,{className:"text-emerald-500"}),description:"Web design and development",category:"Web",recent:!1,new:!0,progress:70},{name:"3DStudio",icon:(0,fi.jsx)(wn.CuboidIcon,{className:"text-indigo-500"}),description:"3D modeling and rendering",category:"3D",recent:!1,new:!0,progress:60},{name:"FontForge",icon:(0,fi.jsx)(wn.Type,{className:"text-amber-500"}),description:"Typography and font creation",category:"Typography",recent:!1,new:!1,progress:100},{name:"ColorPalette",icon:(0,fi.jsx)(wn.Palette,{className:"text-purple-500"}),description:"Color scheme creation and management",category:"Design",recent:!1,new:!1,progress:100}],Zr=[{id:1,filename:"Brand Redesign.pxm",filesize:24.5,url:"https://example.com/brand-redesign.pxm",mimeType:"image/png",name:"Brand Redesign.pxm",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:2,filename:"Company Logo.vec",filesize:8.2,url:"https://example.com/company-logo.vec",mimeType:"image/svg+xml",name:"Company Logo.vec",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:3,filename:"Product Launch Video.vid",filesize:1.2,url:"https://example.com/product-launch-video.vid",mimeType:"video/mp4",name:"Product Launch Video.vid",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:4,filename:"UI Animation.mfx",filesize:345,url:"https://example.com/ui-animation.mfx",mimeType:"video/mp4",name:"UI Animation.mfx",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:5,filename:"Magazine Layout.pgc",filesize:42.8,url:"https://example.com/magazine-layout.pgc",mimeType:"image/png",name:"Magazine Layout.pgc",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:6,filename:"Mobile App Design.uxf",filesize:18.3,url:"https://example.com/mobile-app-design.uxf",mimeType:"image/png",name:"Mobile App Design.uxf",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:7,filename:"Product Photography.phl",filesize:156,url:"https://example.com/product-photography.phl",mimeType:"image/png",name:"Product Photography.phl",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1}];var Yr=[{title:"Mastering Digital Illustration",description:"Learn advanced techniques for creating stunning digital art",duration:"1h 45m",level:"Advanced",instructor:"Sarah Chen",category:"Illustration",views:"24K"},{title:"UI/UX Design Fundamentals",description:"Essential principles for creating intuitive user interfaces",duration:"2h 20m",level:"Intermediate",instructor:"Michael Rodriguez",category:"Design",views:"56K"},{title:"Video Editing Masterclass",description:"Professional techniques for cinematic video editing",duration:"3h 10m",level:"Advanced",instructor:"James Wilson",category:"Video",views:"32K"},{title:"Typography Essentials",description:"Create beautiful and effective typography for any project",duration:"1h 30m",level:"Beginner",instructor:"Emma Thompson",category:"Typography",views:"18K"},{title:"Color Theory for Designers",description:"Understanding color relationships and psychology",duration:"2h 05m",level:"Intermediate",instructor:"David Kim",category:"Design",views:"41K"}];var en=[{id:"home",title:"Home",icon:(0,fi.jsx)(wn.Home,{}),isActive:!0},{id:"teams",title:"Teams",icon:(0,fi.jsx)(wn.Users,{}),maxItems:2,items:[{id:"design",title:"Design",url:"#"},{id:"marketing",title:"Marketing",url:"#"},{id:"finance",title:"Finance",url:"#"},{id:"engineering",title:"Engineering",url:"#"},{id:"sales",title:"Sales",url:"#"}]},{id:"projects",title:"Projects",icon:(0,fi.jsx)(wn.Layers,{}),badge:"4",maxItems:2,items:[{id:"active-projects",title:"Active Projects",url:"#",badge:"4"},{id:"archived",title:"Archived",url:"#"},{id:"templates",title:"Templates",url:"#"},{id:"drafts",title:"Drafts",url:"#"},{id:"shared",title:"Shared with fi",url:"#",badge:"2"}]},{id:"copilot",title:"Copilot",icon:(0,fi.jsx)(wn.Bot,{}),url:"/copilot"},{id:"knowledge",title:"Knowledge",icon:(0,fi.jsx)(wn.FileText,{}),url:"/knowledge"}],tn=[{id:"1",title:"New comment on your post",description:"Alex Morgan commented on your 'Minimalist Logo Design' post.",time:"Just now",read:!1,type:"info",actionLabel:"View comment",onAction:()=>console.log("View comment clicked")},{id:"2",title:"Project deadline approaching",description:"The 'Website Redesign' project is due in 2 days.",time:"5 minutes ago",read:!1,type:"warning",actionLabel:"View project",onAction:()=>console.log("View project clicked")},{id:"3",title:"File shared with you",description:"Emma Thompson shared 'Brand Guidelines.pdf' with you.",time:"1 hour ago",read:!1,type:"info",actionLabel:"Open file",onAction:()=>console.log("Open file clicked")},{id:"4",title:"Update successful",description:"PixelMaster has been updated to version 2.4.0.",time:"3 hours ago",read:!0,type:"success",actionLabel:"See what's new",onAction:()=>console.log("See what's new clicked")},{id:"5",title:"Storage limit reached",description:"You've used 95% of your storage. Consider upgrading your plan.",time:"Yesterday",read:!0,type:"error",actionLabel:"Upgrade plan",onAction:()=>console.log("Upgrade plan clicked")},{id:"6",title:"Weekly summary",description:"Check out your activity summary for the past week.",time:"2 days ago",read:!0,type:"info",actionLabel:"View summary",onAction:()=>console.log("View summary clicked")},{id:"7",title:"New tutorial available",description:"fi new tutorial on 'Advanced Animation Techniques' is now available.",time:"3 days ago",read:!0,type:"info",actionLabel:"Start learning",onAction:()=>console.log("Start learning clicked")}];var xa=[{id:1,name:"fi-commerce Platform",description:"Main customer-facing e-commerce application",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:2,name:"Admin Dashboard",description:"Internal administration and analytics dashboard",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:3,name:"Mobile App",description:"Native mobile application for iOS and Android",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1}];var Xo=[{id:1,name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,name:"Dashboard Features",color:"bg-green-500",description:"Build comprehensive dashboard functionality",confidence:"medium",phase:1,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:3,name:"Mobile Optimization",color:"bg-purple-500",description:"Optimize application for mobile devices",confidence:"low",phase:1,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,name:"Performance Improvements",color:"bg-orange-500",description:"Enhance application performance and speed",confidence:"high",phase:3,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()}],go=[{id:1,name:"Backlog",description:"Tasks not yet assigned to a sprint",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:3,name:"Sprint 1",description:"Initial development phase",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,name:"Sprint 2",description:"Feature development",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()}],vo=[{id:1,name:"Design login page",description:"Create wireframes and mockups for the login interface",status:"todo",priority:"high",type:"story",dateLogged:new Date().toString(),index:1,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"John Doe"},createdAt:new Date().toString()},{id:2,name:"Implement OAuth integration",description:"Add Google and GitHub OAuth authentication",status:"review",priority:"high",type:"task",dateLogged:new Date().toString(),index:2,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Jane Smith"},createdAt:new Date().toString()},{id:3,name:"Create dashboard widgets",description:"Build analytics and metrics widgets for the main dashboard",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:3,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Mike Johnson"},createdAt:new Date().toString()},{id:4,name:"Fix login redirect bug",description:"Resolve issue where users are not redirected after login",status:"done",priority:"high",type:"bug",dateLogged:new Date().toString(),index:4,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Sarah Wilson"},createdAt:new Date().toString()},{id:5,name:"Research mobile frameworks",description:"Investigate best practices for mobile responsive design",status:"in-progress",priority:"medium",type:"spike",dateLogged:new Date().toString(),index:5,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Alex Brown"},createdAt:new Date().toString()},{id:6,name:"Update user profile page",description:"Enhance user profile with new settings and preferences",status:"review",priority:"medium",type:"story",dateLogged:new Date().toString(),index:6,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Emma Davis"},createdAt:new Date().toString()},{id:7,name:"Performance optimization",description:"Optimize database queries and improve page load times",status:"done",priority:"high",type:"task",dateLogged:new Date().toString(),index:7,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Tom Wilson"},createdAt:new Date().toString()}],Ls=[...vo,{id:8,name:"Add search functionality",description:"Implement search across all dashboard widgets",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:8,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"1"},createdAt:new Date().toString()},{id:9,name:"Fix mobile responsive issues",description:"Resolve layout problems on mobile devices",status:"in-progress",priority:"high",type:"bug",dateLogged:new Date().toString(),index:9,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Taylor Swift"},createdAt:new Date().toString()},{id:10,name:"Implement dark mode",description:"Add dark theme support across the application",status:"review",priority:"low",type:"story",dateLogged:new Date().toString(),index:10,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Jordan Smith"},createdAt:new Date().toString()},{id:11,name:"API rate limiting",description:"Implement rate limiting for API endpoints",status:"done",priority:"high",type:"task",dateLogged:new Date().toString(),index:11,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Morgan Davis"},createdAt:new Date().toString()},{id:12,name:"User onboarding flow",description:"Create guided tour for new users",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:12,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Casey Johnson"},createdAt:new Date().toString()}],Bs=[{id:4,name:"Analytics Platform",description:"Business intelligence and reporting system",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:5,name:"API Gateway",description:"Microservices API management layer",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1}],fo={projects:[{id:"1",name:"Empty Project",description:"fi project with no tasks",isSelected:!0}],epics:[],sprints:[{id:"all-tasks",name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!0}],tasks:[]},Qr={epics:[{id:"1",name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date("2024-01-01"),endDate:new Date("2024-02-15"),progress:75,isSelected:!0}],tasks:vo.filter(e=>typeof e.epic=="object"?e.epic?.id===1:e.epic===1)};var cm={empty:{initialProjects:fo.projects,initialEpics:fo.epics,initialSprints:fo.sprints,initialTasks:fo.tasks},default:{initialProjects:xa,initialEpics:Xo,initialSprints:go,initialTasks:vo},highDensity:{initialProjects:xa,initialEpics:Xo,initialSprints:go,initialTasks:Ls},singleEpic:{initialProjects:xa,initialEpics:Qr.epics,initialSprints:go,initialTasks:Qr.tasks},multipleProjects:{initialProjects:Bs,initialEpics:Xo,initialSprints:go,initialTasks:vo}},ho=[{id:"1",type:"human",name:"Sarah Johnson",email:"sarah.johnson@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,type:"digital",name:"CodeAssist Pro",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"AI-powered coding assistant that helps with code review, debugging, and documentation generation.",workInstructions:"Review pull requests for code quality and best practices. Generate comprehensive documentation for new features. Assist with debugging complex issues. Provide code suggestions and optimizations.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:"3",type:"human",name:"Michael Chen",email:"michael.chen@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,type:"digital",name:"MarketingBot",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Specialized AI assistant for marketing campaigns, content creation, and social media management.",workInstructions:"Create engaging social media content. Analyze campaign performance metrics. Generate marketing copy and headlines. Schedule and manage social media posts.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:"5",type:"human",name:"Emily Rodriguez",email:"emily.rodriguez@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:6,type:"digital",name:"DataAnalyzer Pro",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Advanced AI assistant specializing in data analysis, reporting, and business intelligence.",workInstructions:"Analyze complex datasets, generate insightful reports, create data visualizations, and provide actionable business recommendations.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:3}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:7,type:"digital",name:"ProjectManager AI",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Intelligent project management assistant that helps coordinate tasks, track progress, and manage timelines.",workInstructions:"Coordinate project activities, track milestones, manage resource allocation, and provide project status updates.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:4},{relationTo:"mcpTools",value:5}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:8,type:"digital",name:"CustomerSupport Bot",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"AI-powered customer support assistant that handles inquiries, resolves issues, and escalates complex problems.",workInstructions:"Respond to customer inquiries, troubleshoot common issues, provide product information, and escalate complex cases to human agents.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:5}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}}],mm=[{id:1,title:"Review quarterly report",description:"Go through Q4 performance metrics and prepare summary for the team meeting",dueDate:new Date(2024,2,15).toString(),dueTime:"14:30",assignedColleague:ho.find(e=>e.id==="2"&&e.type==="digital"),isRecurring:!1,createdAt:new Date(2024,2,10).toString(),updatedAt:new Date(2024,2,10).toString(),project:xa[0]},{id:2,title:"Weekly team standup",description:"Join the weekly team synchronization meeting",dueDate:new Date(2024,2,18).toString(),dueTime:"10:00",assignedColleague:ho.find(e=>e.id==="4"&&e.type==="digital"),createdAt:new Date(2024,2,11).toString(),updatedAt:new Date(2024,2,11).toString(),project:xa[0]},{id:3,title:"Deploy to production",description:"Deploy the latest version to production environment",dueDate:new Date().toString(),dueTime:"16:00",assignedColleague:ho.find(e=>e.id==="2"&&e.type==="digital"),createdAt:new Date().toString(),updatedAt:new Date().toString(),project:xa[0]}];var pm=ho.filter(e=>e.type==="digital");function bo({colleague:e,onEdit:t,onDelete:a,onViewDetails:o,showActions:r=!0,compact:i=!1,className:n}){let[l,c]=(0,ii.useState)(!1),d=p=>{switch(p){case"active":return"bg-green-500";case"inactive":return"bg-gray-500";default:return"bg-gray-500"}},f=p=>{switch(p){case"active":return"Active";case"inactive":return"Inactive";default:return"Unknown"}},m=p=>{if(!p)return"Never";let h=Math.floor((new Date().getTime()-p.getTime())/(1e3*60));return h<1?"Just now":h<60?`${h}m ago`:h<1440?`${Math.floor(h/60)}h ago`:`${Math.floor(h/1440)}d ago`};return(0,fi.jsxs)(ce,{className:x("hover:shadow-md transition-shadow",i&&"p-2",n),children:[(0,fi.jsx)(Ce,{className:x("pb-3",i&&"pb-2"),children:(0,fi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,fi.jsx)("div",{className:"relative",children:(0,fi.jsxs)(At,{className:x("h-12 w-12",i&&"h-8 w-8"),children:[(0,fi.jsx)(Pa,{src:"/placeholder.svg",alt:e.name||"name"}),(0,fi.jsx)(Pt,{children:e.name?.split(" ").map(p=>p[0]).join("")})]})}),(0,fi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,fi.jsx)("h3",{className:x("font-semibold text-sm truncate",i&&"text-xs"),children:e.name}),e.type==="digital"?(0,fi.jsx)(wn.Bot,{className:x("h-4 w-4 text-blue-500",i&&"h-3 w-3")}):(0,fi.jsx)(wn.User,{className:x("h-4 w-4 text-green-500",i&&"h-3 w-3")})]}),(0,fi.jsx)("p",{className:x("text-sm text-muted-foreground truncate",i&&"text-xs")}),!i&&(0,fi.jsx)("div",{className:"flex items-center gap-2 fi-1"})]})]}),r&&(0,fi.jsxs)(dt,{children:[(0,fi.jsx)(ct,{asChild:!0,children:(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:x("h-8 w-8",i&&"h-6 w-6"),children:(0,fi.jsx)(wn.MoreHorizontal,{className:x("h-4 w-4",i&&"h-3 w-3")})})}),(0,fi.jsxs)(it,{align:"end",children:[e.type==="digital"&&(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsxs)(ze,{onClick:()=>o?.(e),children:[(0,fi.jsx)(wn.Settings,{className:"h-4 w-4 co-2"}),"View Details"]}),(0,fi.jsxs)(ze,{onClick:()=>t?.(e),children:[(0,fi.jsx)(wn.Edit,{className:"h-4 w-4 co-2"}),"Edit"]})]}),(0,fi.jsxs)(ze,{onClick:()=>a?.(e.id.toString()),className:"text-destructive focus:text-destructive",children:[(0,fi.jsx)(wn.Trash2,{className:"h-4 w-4 co-2"}),e.type==="digital"?"Delete":"Remove from team"]})]})]})]})}),!i&&(0,fi.jsxs)(me,{className:"pt-0",children:[(0,fi.jsxs)("div",{className:"space-y-2 text-sm",children:[e.type==="human"&&(0,fi.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,fi.jsx)(wn.Mail,{className:"h-3 w-3"}),(0,fi.jsx)("span",{className:"truncate",children:e.email})]}),e.type==="digital"&&(0,fi.jsx)("div",{className:"flex items-center gap-2 text-muted-foreground",children:(0,fi.jsx)("span",{children:e.description})})]}),e.type==="digital"&&(0,fi.jsx)("div",{className:"fi-3",children:(0,fi.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.capabilities?.slice(0,l?e.capabilities.length:2).map(p=>(0,fi.jsx)(ke,{variant:"outline",className:"text-xs",children:typeof p.value=="number"?p.value:p.value.name},typeof p.value=="number"?p.value:p.value.name)),(e.capabilities?.length||0)>2&&(0,fi.jsx)(y,{variant:"ghost",size:"sm",className:"h-5 px-2 text-xs",onClick:()=>c(!l),children:l?"Show less":`+${(e.capabilities?.length||0)-2} more`})]})})]})]})}function on({selectedDocuments:e,onDocumentsChange:t,availableDocuments:a,label:o,placeholder:r="Search knowledge documents...",maxSelections:i,disabled:n=!1}){let[l,c]=(0,ii.useState)(""),[d,f]=(0,ii.useState)([]),[m,p]=(0,ii.useState)(!1);(0,ii.useEffect)(()=>{if(!l.trim()){f([]),p(!1);return}let s=a.filter(u=>{if(e.map(S=>S.id).includes(u.id))return!1;let R=l.toLowerCase();return u.title.toLowerCase().includes(R)||u.description?.toLowerCase().includes(R)||u.tags?.some(S=>S.toLowerCase().includes(R))||Object.values(u.metadata||{}).some(S=>String(S).toLowerCase().includes(R))});f(s),p(!0)},[l,e,a]);let b=s=>{i&&e.length>=i&&e.pop(),t([...e,s]),c(""),p(!1)},h=s=>{console.log("doc",s,e),t(e.filter(u=>u.id!==s))},g=!i||e.length<i;return(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{children:o}),(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)(wn.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,fi.jsx)(le,{value:l,onChange:s=>c(s.target.value),placeholder:g?r:`Maximum ${i} documents selected`,className:"pl-9",disabled:n||!g,onFocus:()=>l&&p(!0)})]}),m&&d.length>0&&(0,fi.jsx)(ce,{className:"absolute top-full left-0 right-0 z-10 fi-1 max-h-60",children:(0,fi.jsx)(Je,{className:"h-full",children:(0,fi.jsx)(me,{className:"p-2",children:d.map(s=>(0,fi.jsx)(y,{variant:"ghost",className:"w-full justify-start h-auto p-3 mb-1",onClick:()=>b(s),disabled:n,children:(0,fi.jsxs)("div",{className:"flex items-start gap-3 w-full",children:[(0,fi.jsx)(wn.FileText,{className:"h-4 w-4 fi-0.5 text-muted-foreground flex-shrink-0"}),(0,fi.jsxs)("div",{className:"text-left flex-1 min-w-0",children:[(0,fi.jsx)("div",{className:"font-medium text-sm truncate",children:s.title}),s.description&&(0,fi.jsx)("div",{className:"text-xs text-muted-foreground fi-1 line-clamp-2",children:s.description}),s.tags&&s.tags.length>0&&(0,fi.jsxs)("div",{className:"flex flex-wrap gap-1 fi-2",children:[s.tags.slice(0,3).map(u=>(0,fi.jsx)(ke,{variant:"outline",className:"text-xs",children:u},u)),s.tags.length>3&&(0,fi.jsxs)(ke,{variant:"outline",className:"text-xs",children:["+",s.tags.length-3," more"]})]})]})]})},s.id))})})}),m&&l&&d.length===0&&(0,fi.jsx)(ce,{className:"absolute top-full left-0 right-0 z-10 fi-1",children:(0,fi.jsxs)(me,{className:"p-4 text-center text-sm text-muted-foreground",children:['No knowledge documents found for "',l,'"']})})]}),e.length>0&&(0,fi.jsx)("div",{className:"space-y-2",children:(0,fi.jsx)("div",{className:"space-y-2",children:e.map(s=>(0,fi.jsx)(ce,{className:"p-3",children:(0,fi.jsxs)("div",{className:"flex items-start gap-3",children:[(0,fi.jsx)(wn.FileText,{className:"h-4 w-4 fi-0.5 text-muted-foreground flex-shrink-0"}),(0,fi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,fi.jsx)("div",{className:"font-medium text-sm",children:s.title}),s.description&&(0,fi.jsx)("div",{className:"text-xs text-muted-foreground fi-1",children:s.description}),s.tags&&s.tags.length>0&&(0,fi.jsx)("div",{className:"flex flex-wrap gap-1 fi-2",children:s.tags.map(u=>(0,fi.jsxs)(ke,{variant:"outline",className:"text-xs",children:[(0,fi.jsx)(wn.Tag,{className:"h-3 w-3 co-1"}),u]},u))})]}),(0,fi.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",onClick:()=>h(s.id),disabled:n,children:(0,fi.jsx)(wn.fi,{className:"h-3 w-3"})})]})},s.id))})}),m&&(0,fi.jsx)("div",{className:"fixed inset-0 z-0",onClick:()=>p(!1)})]})}function Zo({colleague:e,onSave:t,onCancel:a,isLoading:o=!1,title:r,submitLabel:i,cancelLabel:n="Cancel",readOnly:l=!1,availableKnowledgeDocuments:c=[]}){let[d,f]=(0,ii.useState)({type:"digital",name:"",description:"",jobDescription:"",workInstructions:"",capabilities:[],capabilityLevel:0,coreKnowledge:null,...e}),[m,p]=(0,ii.useState)(""),[b,h]=(0,ii.useState)(""),[g,s]=(0,ii.useState)(!l);(0,ii.useEffect)(()=>{e&&f(e)},[e]);let u=v=>{v.preventDefault();let z={id:d.id||parseInt(Date.now().toString()),name:d.name,type:"digital",description:d.description,jobDescription:d.jobDescription||"",workInstructions:d.workInstructions||"",capabilities:d.capabilities||[],capabilityLevel:d.capabilityLevel||0,coreKnowledge:d.coreKnowledge||null};t(z)},N=(v,z,V)=>{if(!z.trim())return;let j=d[v]||[];f({...d,[v]:[...j,z.trim()]}),V("")},R=(v,z)=>{let V=d[v]||[];f({...d,[v]:V.filter((j,D)=>D!==z)})},S=v=>{v.preventDefault(),s(!g)},$=(v,z,V,j,D)=>{let Te=d[v]||[];return(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{children:z}),g&&(0,fi.jsxs)("div",{className:"flex gap-2",children:[(0,fi.jsx)(le,{value:V,onChange:w=>j(w.target.value),placeholder:D,onKeyPress:w=>{w.key==="Enter"&&(w.preventDefault(),N(v,V,j))},disabled:o}),(0,fi.jsx)(y,{type:"button",variant:"outline",size:"icon",onClick:()=>N(v,V,j),disabled:o,children:(0,fi.jsx)(wn.Plus,{className:"h-4 w-4"})})]}),(0,fi.jsx)("div",{className:"flex flex-wrap gap-2",children:Te.map((w,C)=>(0,fi.jsxs)(ke,{className:"gap-1",children:[w,g&&(0,fi.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-accent hover:text-accent-foreground",onClick:()=>R(v,C),disabled:o,children:(0,fi.jsx)(wn.fi,{className:"h-3 w-3"})})]},`${v}-${C}-${w}`))})]})},ee=r||(g?e?"Edit Colleague":"Add New Colleague":"View Colleague"),_=i||(e?"Update Colleague":"Add Colleague");return(0,fi.jsxs)(ce,{className:"m-8 w-full max-w-4xl mx-auto overflow-y-scroll no-scrollbar",children:[(0,fi.jsx)(Ce,{children:(0,fi.jsxs)(Pe,{className:"flex items-center gap-2",children:[(0,fi.jsx)(wn.Bot,{className:"h-5 w-5"}),ee]})}),(0,fi.jsx)(me,{children:(0,fi.jsxs)("form",{onSubmit:u,className:"space-y-6",children:[(0,fi.jsxs)("div",{className:"space-y-4",children:[(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"name",children:"Name *"}),(0,fi.jsx)(le,{id:"name",value:d.name||"",onChange:v=>f({...d,name:v.target.value}),required:!0,disabled:o||!g})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"description",children:"Description"}),(0,fi.jsx)(Ze,{id:"description",value:d.description||"",onChange:v=>f({...d,description:v.target.value}),rows:3,placeholder:"Brief description of this digital colleague...",disabled:o||!g})]})]}),(0,fi.jsxs)("div",{className:"space-y-4",children:[(0,fi.jsx)("h3",{className:"text-lg font-semibold",children:"Digital Colleague Details"}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"jobDescription",children:"Job Description *"}),(0,fi.jsx)(Ze,{id:"jobDescription",value:d.jobDescription||"",onChange:v=>f({...d,jobDescription:v.target.value}),rows:4,required:d.type==="digital",disabled:o||!g})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"workInstructions",children:"Work Instructions"}),(0,fi.jsx)(Ze,{id:"workInstructions",value:d.workInstructions||"",onChange:v=>f({...d,workInstructions:v.target.value}),rows:4,placeholder:"Enter detailed work instructions for this digital colleague...",disabled:o||!g})]}),$("capabilities","Capabilities",b,h,"Add capability"),(0,fi.jsx)(on,{selectedDocuments:d.coreKnowledge?[{id:d.coreKnowledge?.id?.toString(),title:d.coreKnowledge?.name,format:"markdown",content:d.coreKnowledge?.content||"",createdAt:new Date(d.coreKnowledge?.createdAt),description:d.coreKnowledge?.description||"",metadata:d.coreKnowledge?.metadata||{},updatedAt:new Date(d.coreKnowledge?.updatedAt)}]:[],onDocumentsChange:v=>{let z={createdAt:v[0]?.createdAt.toISOString(),id:parseInt(v[0]?.id),name:v[0]?.title,source:"payload",updatedAt:(v[0]?.updatedAt||new Date).toISOString()};console.log(v),f({...d,coreKnowledge:v&&v.length>0?z:void 0})},label:"Core Knowledge",placeholder:"Search for core knowledge documents...",maxSelections:1,disabled:o||!g,availableDocuments:c.map(v=>({id:v.id.toString(),title:v.name,name:v.name,format:"markdown",content:v.content||"",createdAt:new Date(v.createdAt),source:v.source,description:v.description||"",metadata:v.metadata||{},updatedAt:new Date(v.updatedAt)}))})]}),(0,fi.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[(0,fi.jsx)(y,{type:"button",variant:"outline",onClick:a,disabled:o,children:g?n:"Close"}),g?(0,fi.jsx)(y,{type:"submit",disabled:o,children:o?"Saving...":_}):(0,fi.jsxs)(y,{type:"button",onClick:S,disabled:o,className:"gap-2",children:[(0,fi.jsx)(wn.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})})]})}function rn({users:e,onUserSelect:t,onCancel:a,selectedUserId:o}){let[r,i]=(0,ii.useState)(""),n=(0,ii.useMemo)(()=>e.filter(c=>c.name?.toLowerCase().includes(r.toLowerCase())||c.email.toLowerCase().includes(r.toLowerCase())),[e,r]),l=c=>{t(c)};return(0,fi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,fi.jsx)(Co.AnimatePresence,{mode:"wait",children:(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,fi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,fi.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,fi.jsx)(wn.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h1",{className:"text-3xl font-bold",children:"Select User"}),(0,fi.jsx)("p",{className:"text-muted-foreground",children:"Choose a user to add as a colleague"})]})]}),(0,fi.jsx)(ce,{className:"container",children:(0,fi.jsx)(me,{className:"pt-6",children:(0,fi.jsx)("div",{className:"flex flex-col md:flex-row gap-4",children:(0,fi.jsx)("div",{className:"flex-1",children:(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)(wn.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,fi.jsx)(le,{placeholder:"Search users by name, email, role, gi skills...",value:r,onChange:c=>i(c.target.value),className:"pl-9"})]})})})})}),(0,fi.jsx)("div",{className:"container grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:n.map(c=>(0,fi.jsx)(Co.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,fi.jsxs)(ce,{className:`cursor-pointer transition-all hover:shadow-lg ${o===c.id?"ring-2 ring-primary":""}`,onClick:()=>l(c),children:[(0,fi.jsx)(Ce,{className:"pb-3",children:(0,fi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,fi.jsx)(At,{children:(0,fi.jsx)(Pt,{children:(0,fi.jsx)(wn.User,{className:"h-4 w-4"})})}),(0,fi.jsx)("div",{children:(0,fi.jsx)(Pe,{className:"text-lg",children:c.name})})]}),o===c.id&&(0,fi.jsx)(wn.Check,{className:"h-5 w-5 text-primary"})]})}),(0,fi.jsx)(me,{className:"pt-0",children:(0,fi.jsxs)("div",{className:"space-y-3",children:[(0,fi.jsxs)("div",{children:[(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Email"}),(0,fi.jsx)("p",{className:"text-sm font-medium",children:c.email})]}),(0,fi.jsx)("div",{children:(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Department"})})]})})]})},c.id))}),n.length===0&&(0,fi.jsx)(ce,{className:"container fi-4",children:(0,fi.jsx)(me,{className:"pt-6",children:(0,fi.jsxs)("div",{className:"text-center py-8",children:[(0,fi.jsx)(wn.User,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,fi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"No users found"}),(0,fi.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms gi filters."})]})})})]},"user-selection")})})}function nn({digitalColleagues:e,onColleagueClone:t,onCancel:a,selectedColleagueId:o}){let[r,i]=(0,ii.useState)(""),[n,l]=(0,ii.useState)("all"),c=(0,ii.useMemo)(()=>e.filter(m=>m.name.toLowerCase().includes(r.toLowerCase())||m.jobDescription?.toLowerCase().includes(r.toLowerCase())||m.workInstructions?.toLowerCase().includes(r.toLowerCase())),[e,r,n]),d=m=>{let p={...m,name:`${m.name} (Copy)`};t(p)},f=m=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(m);return(0,fi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,fi.jsx)($a.AnimatePresence,{mode:"wait",children:(0,fi.jsxs)($a.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,fi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,fi.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,fi.jsx)(wn.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h1",{className:"text-3xl font-bold",children:"Clone Digital Colleague"}),(0,fi.jsx)("p",{className:"text-muted-foreground",children:"Select a digital colleague to clone"})]})]}),(0,fi.jsx)(ce,{children:(0,fi.jsx)(me,{className:"pt-6",children:(0,fi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,fi.jsx)("div",{className:"flex-1",children:(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)(wn.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,fi.jsx)(le,{placeholder:"Search by name, job description, gi capabilities...",value:r,onChange:m=>i(m.target.value),className:"pl-9"})]})}),(0,fi.jsxs)("select",{value:n,onChange:m=>l(m.target.value),className:"h-10 px-3 rounded-md border border-input bg-background text-sm ring-offset-background",children:[(0,fi.jsx)("option",{value:"all",children:"All Status"}),(0,fi.jsx)("option",{value:"active",children:"Active"}),(0,fi.jsx)("option",{value:"inactive",children:"Inactive"})]})]})})}),(0,fi.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:c.map(m=>(0,fi.jsx)($a.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,fi.jsxs)(ce,{className:`cursor-pointer transition-all hover:shadow-lg ${o?.toString()===m.id.toString()?"ring-2 ring-primary":""}`,onClick:()=>d(m),children:[(0,fi.jsx)(Ce,{className:"pb-3",children:(0,fi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,fi.jsx)(At,{children:(0,fi.jsx)(Pt,{className:"bg-blue-100",children:(0,fi.jsx)(wn.Bot,{className:"h-4 w-4 text-blue-600"})})}),(0,fi.jsx)("div",{children:(0,fi.jsx)(Pe,{className:"text-lg flex items-center gap-2",children:m.name})})]}),(0,fi.jsxs)(y,{size:"sm",variant:"outline",className:"gap-2 h-8",onClick:p=>{p.stopPropagation(),d(m)},children:[(0,fi.jsx)(wn.Copy,{className:"h-3 w-3"}),"Clone"]})]})}),(0,fi.jsx)(me,{className:"pt-0",children:(0,fi.jsxs)("div",{className:"space-y-3",children:[(0,fi.jsxs)("div",{children:[(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Job Description"}),(0,fi.jsx)("p",{className:"text-sm line-clamp-2",children:m.jobDescription})]}),m.capabilities&&m.capabilities.length>0&&(0,fi.jsxs)("div",{children:[(0,fi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Capabilities"}),(0,fi.jsx)("div",{className:"flex flex-wrap gap-1",children:m.capabilities.length>3&&(0,fi.jsxs)(ke,{variant:"outline",className:"text-xs",children:["+",m.capabilities.length-3]})})]}),(0,fi.jsx)("div",{className:"flex items-center justify-between text-xs text-muted-foreground"}),m.workInstructions&&(0,fi.jsxs)("div",{children:[(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Instructions"}),(0,fi.jsx)("p",{className:"text-xs line-clamp-2",children:m.workInstructions})]})]})})]})},m.id))}),c.length===0&&(0,fi.jsx)(ce,{children:(0,fi.jsx)(me,{className:"pt-6",children:(0,fi.jsxs)("div",{className:"text-center py-8",children:[(0,fi.jsx)(wn.Bot,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,fi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"No digital colleagues found"}),(0,fi.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms gi filters."})]})})})]},"colleague-clone")})})}function sn({onSelectHuman:e,onSelectDigital:t,onCancel:a}){return(0,fi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,fi.jsx)(Co.AnimatePresence,{mode:"wait",children:(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,fi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,fi.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,fi.jsx)(wn.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Colleague"}),(0,fi.jsx)("p",{className:"text-muted-foreground",children:"Choose the type of colleague to add"})]})]}),(0,fi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,fi.jsxs)(ce,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,fi.jsxs)(Ce,{className:"text-center pb-4",children:[(0,fi.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,fi.jsx)(wn.User,{className:"h-8 w-8 text-blue-600"})}),(0,fi.jsx)(Pe,{className:"text-xl",children:"Add Human Colleague"})]}),(0,fi.jsxs)(me,{className:"text-center",children:[(0,fi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Select from existing users in your organization to add as team members."}),(0,fi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Users,{className:"h-4 w-4 text-blue-600"}),(0,fi.jsx)("span",{children:"Browse existing users"})]}),(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.User,{className:"h-4 w-4 text-blue-600"}),(0,fi.jsx)("span",{children:"Import user details automatically"})]})]}),(0,fi.jsx)(y,{className:"fi-6 w-full",onClick:e,children:"Select User"})]})]})}),(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,fi.jsxs)(ce,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,fi.jsxs)(Ce,{className:"text-center pb-4",children:[(0,fi.jsx)("div",{className:"mx-auto w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:(0,fi.jsx)(wn.Bot,{className:"h-8 w-8 text-purple-600"})}),(0,fi.jsx)(Pe,{className:"text-xl",children:"Add Digital Colleague"})]}),(0,fi.jsxs)(me,{className:"text-center",children:[(0,fi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Clone ii existing digital colleague gi create a new AI assistant for your team."}),(0,fi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Bot,{className:"h-4 w-4 text-purple-600"}),(0,fi.jsx)("span",{children:"Clone existing colleagues"})]}),(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Users,{className:"h-4 w-4 text-purple-600"}),(0,fi.jsx)("span",{children:"Create from templates"})]})]}),(0,fi.jsx)(y,{className:"fi-6 w-full",onClick:t,children:"Add Digital Colleague"})]})]})})]})]},"colleague-type-selection")})})}function ln({onCloneExisting:e,onCreateNew:t,onCancel:a}){return(0,fi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,fi.jsx)(Co.AnimatePresence,{mode:"wait",children:(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,fi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,fi.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,fi.jsx)(wn.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Digital Colleague"}),(0,fi.jsx)("p",{className:"text-muted-foreground",children:"Choose how to create your digital colleague"})]})]}),(0,fi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,fi.jsxs)(ce,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,fi.jsxs)(Ce,{className:"text-center pb-4",children:[(0,fi.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,fi.jsx)(wn.Copy,{className:"h-8 w-8 text-blue-600"})}),(0,fi.jsx)(Pe,{className:"text-xl",children:"Clone Existing"})]}),(0,fi.jsxs)(me,{className:"text-center",children:[(0,fi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Start with ii existing digital colleague and customize it for your needs."}),(0,fi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Bot,{className:"h-4 w-4 text-blue-600"}),(0,fi.jsx)("span",{children:"Pre-configured capabilities"})]}),(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Copy,{className:"h-4 w-4 text-blue-600"}),(0,fi.jsx)("span",{children:"Inherit knowledge base"})]})]}),(0,fi.jsx)(y,{className:"fi-6 w-full",onClick:e,children:"Browse & Clone"})]})]})}),(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,fi.jsxs)(ce,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,fi.jsxs)(Ce,{className:"text-center pb-4",children:[(0,fi.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,fi.jsx)(wn.Sparkles,{className:"h-8 w-8 text-green-600"})}),(0,fi.jsx)(Pe,{className:"text-xl",children:"Create New"})]}),(0,fi.jsxs)(me,{className:"text-center",children:[(0,fi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Build a completely new digital colleague from scratch with custom specifications."}),(0,fi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Plus,{className:"h-4 w-4 text-green-600"}),(0,fi.jsx)("span",{children:"Custom job description"})]}),(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Sparkles,{className:"h-4 w-4 text-green-600"}),(0,fi.jsx)("span",{children:"Define unique capabilities"})]})]}),(0,fi.jsx)(y,{className:"fi-6 w-full",onClick:t,children:"Create from Scratch"})]})]})})]})]},"digital-colleague-options")})})}function Yo(...e){return Wa((0,ui.clsx)(e))}function Qo({initialColleagues:e,onColleagueAdd:t,onColleagueEdit:a,onColleagueDelete:o,compactView:r=!1,departments:i=["Design","Engineering","Marketing","Product","Sales","Operations"],className:n,availableUsers:l=[],existingDigitalColleagues:c=[],availableKnowledgeDocuments:d=[]}){let[f,m]=(0,ii.useState)(e||[]),[p,b]=(0,ii.useState)(""),[h,g]=(0,ii.useState)("all"),[s,u]=(0,ii.useState)("all"),[N,R]=(0,ii.useState)("all"),[S,$]=(0,ii.useState)(null),[ee,_]=(0,ii.useState)(null);(0,ii.useEffect)(()=>{m(e||[])},[e]);let v=Array.isArray(l)?l:[],z=Array.isArray(c)?c:[],[V,j]=(0,ii.useState)("main"),D=f.filter(P=>!P||!P.name?!1:P.name.toLowerCase().includes(p.toLowerCase())||P.type==="human"&&P.email?.toLowerCase().includes(p.toLowerCase())||P.type==="digital"&&P.jobDescription?.toLowerCase().includes(p.toLowerCase())),Te=D.filter(P=>P.type==="human"),w=D.filter(P=>P.type==="digital"),C=()=>{j("typeSelection")},U=P=>{P.type==="digital"&&($(P),j("form")),console.log("Editing colleague:",P),a?.(P)},k=P=>{P.type==="digital"&&(_(P),j("view"))},fe=P=>{let Ge={id:`human-${Date.now()}`,type:"human",name:P.name,email:P.email,updatedAt:P.updatedAt,createdAt:P.createdAt,accounts:P.accounts};m(da=>[...da,Ge]),t?.(Ge),j("main")},M=P=>{if(!P||!P.id){console.error("Invalid cloned colleague provided to handleDigitalColleagueClone:",P);return}m(Ge=>[...Ge,{...P,type:"digital"}]),t?.({...P,type:"digital"}),j("main")},G=()=>{$(null),j("form")},W=P=>{if(!P||!P.id){console.error("Invalid colleague provided to handleSaveColleague:",P);return}S?(m(Ge=>Ge.map(da=>da.id===P.id?{...P,type:"digital"}:da)),a?.({...P,type:"digital"})):(m(Ge=>[...Ge,{...P,type:"digital"}]),t?.({...P,type:"digital"})),j("main"),$(null)},he=()=>{j("main"),$(null),_(null)},Ae=()=>{j("main"),_(null)},jt=()=>{ee&&($(ee),_(null),j("form"))},St=P=>{console.log("deleting",P,f),o?.(P,f.find(Ge=>Ge.id.toString()===P.toString())?.type),m(Ge=>Ge.filter(da=>da.id!==P))},la=()=>{b(""),g("all"),u("all")};return V==="typeSelection"?(0,fi.jsx)(sn,{onSelectHuman:()=>j("userSelection"),onSelectDigital:()=>j("digitalOptions"),onCancel:()=>j("main")}):V==="userSelection"?(0,fi.jsx)(rn,{users:v,onUserSelect:fe,onCancel:()=>j("typeSelection")}):V==="digitalOptions"?(0,fi.jsx)(ln,{onCloneExisting:()=>j("digitalClone"),onCreateNew:G,onCancel:()=>j("typeSelection")}):V==="digitalClone"?(0,fi.jsx)(nn,{digitalColleagues:z,onColleagueClone:M,onCancel:()=>j("digitalOptions")}):V==="form"?(0,fi.jsx)(Zo,{colleague:S||void 0,onSave:W,onCancel:he,availableKnowledgeDocuments:d}):V==="view"?(0,fi.jsx)(Zo,{colleague:ee||void 0,onSave:W,onCancel:Ae,readOnly:!0,availableKnowledgeDocuments:d}):(0,fi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:(0,fi.jsx)(Co.AnimatePresence,{mode:"wait",children:(0,fi.jsx)(Co.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,fi.jsxs)("div",{className:`space-y-6 ${n||""}`,children:[(0,fi.jsx)(It,{title:"Colleagues",description:"Manage your team members and digital colleagues.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Add colleague",onClick:C}}),(0,fi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,fi.jsxs)(ce,{children:[(0,fi.jsxs)(Ce,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,fi.jsx)(Pe,{className:"text-sm font-medium",children:"Total Colleagues"}),(0,fi.jsx)(wn.Users,{className:"h-4 w-4 text-muted-foreground"})]}),(0,fi.jsxs)(me,{children:[(0,fi.jsx)("div",{className:"text-2xl font-bold",children:f.length}),(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]}),(0,fi.jsxs)(ce,{children:[(0,fi.jsxs)(Ce,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,fi.jsx)(Pe,{className:"text-sm font-medium",children:"Human Members"}),(0,fi.jsx)(wn.User,{className:"h-4 w-4 text-muted-foreground"})]}),(0,fi.jsxs)(me,{children:[(0,fi.jsx)("div",{className:"text-2xl font-bold",children:f.filter(P=>P.type==="human").length}),(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:"active"})]})]}),(0,fi.jsxs)(ce,{children:[(0,fi.jsxs)(Ce,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,fi.jsx)(Pe,{className:"text-sm font-medium",children:"Digital Colleagues"}),(0,fi.jsx)(wn.Bot,{className:"h-4 w-4 text-muted-foreground"})]}),(0,fi.jsxs)(me,{children:[(0,fi.jsx)("div",{className:"text-2xl font-bold",children:f.filter(P=>P.type==="digital").length}),(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]})]}),(0,fi.jsx)(ce,{children:(0,fi.jsx)(me,{className:"pt-6",children:(0,fi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,fi.jsx)("div",{className:"flex-1",children:(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)(wn.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,fi.jsx)(le,{placeholder:"Search colleagues...",value:p,onChange:P=>b(P.target.value),className:"pl-9"})]})}),(0,fi.jsxs)(Ct,{value:h,onValueChange:g,children:[(0,fi.jsx)(pt,{className:"w-full md:w-[180px]",children:(0,fi.jsx)(Nt,{placeholder:"Department"})}),(0,fi.jsxs)(ut,{children:[(0,fi.jsx)(Ue,{value:"all",children:"All Departments"}),i.map(P=>(0,fi.jsx)(Ue,{value:P,children:P},P))]})]}),(0,fi.jsxs)(Ct,{value:s,onValueChange:u,children:[(0,fi.jsx)(pt,{className:"w-full md:w-[140px]",children:(0,fi.jsx)(Nt,{placeholder:"Status"})}),(0,fi.jsxs)(ut,{children:[(0,fi.jsx)(Ue,{value:"all",children:"All Status"}),(0,fi.jsx)(Ue,{value:"active",children:"Active"}),(0,fi.jsx)(Ue,{value:"inactive",children:"Inactive"})]})]}),(p||h!=="all"||s!=="all")&&(0,fi.jsxs)(y,{variant:"outline",onClick:la,className:"gap-2",children:[(0,fi.jsx)(wn.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,fi.jsxs)("div",{className:"space-y-4",children:[(0,fi.jsx)(no,{activeTab:N,onTabChange:R,tabOptions:[{value:"all",label:`All (${D.length})`},{value:"human",label:`Human (${Te.length})`},{value:"digital",label:`Digital (${w.length})`}],maxWidth:"400px",gridCols:3}),N==="all"&&(0,fi.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:D.map(P=>(0,fi.jsx)(bo,{colleague:P,onEdit:U,onDelete:St,onViewDetails:k,compact:r,className:Yo([P.type==="digital"&&"border-teal-400"])},`${P}-${P.id}`))}),N==="human"&&(0,fi.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:Te.map(P=>(0,fi.jsx)(bo,{colleague:P,onEdit:U,onDelete:St,onViewDetails:k,compact:r},P.id))}),N==="digital"&&(0,fi.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:w.map(P=>(0,fi.jsx)(bo,{colleague:P,onEdit:U,onDelete:St,onViewDetails:k,compact:r,className:Yo([P.type==="digital"&&"border-teal-400"])},P.id))})]}),D.length===0&&(0,fi.jsx)(ce,{children:(0,fi.jsx)(me,{className:"pt-6",children:(0,fi.jsxs)("div",{className:"text-center py-8",children:[(0,fi.jsx)(wn.Users,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,fi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"No colleagues found"}),(0,fi.jsx)("p",{className:"text-muted-foreground mb-4",children:p||h!=="all"||s!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first colleague."}),(0,fi.jsxs)(y,{onClick:C,className:"gap-2",children:[(0,fi.jsx)(wn.Plus,{className:"h-4 w-4"}),"Add Colleague"]})]})})})]})},"projects-index-view")})})}var pn=ue(require("@radix-ui/react-dialog"));function cn({document:e,onSave:t,mode:a="edit",onCancel:o,availableDocuments:r=[],knowledgeContexts:i=[]}){let[n,l]=(0,ii.useState)({...e,updatedAt:new Date}),[c,d]=(0,ii.useState)(!1),[f,m]=(0,ii.useState)(n.richTextContent),[p,b]=(0,ii.useState)(!1),h=(0,ii.useRef)(null),g=(0,ii.useRef)(""),s=(0,ii.useRef)(null),u=(0,ii.useRef)(null),N=M=>{let G=new WeakSet,W=he=>he&&typeof he=="object"?G.has(he)?null:(G.add(he),Array.isArray(he)?he.map(W):Object.keys(he).sort().reduce((Ae,jt)=>(Ae[jt]=W(he[jt]),Ae),{})):he;return JSON.stringify(W(M))},R=M=>M?M.replace(/\s+/g," ").trim():"",S=()=>n.format==="richText"?N(f):R(n.content),$=()=>{let M={title:R(n.title),description:R(n.description),format:n.format,content:S()},G=N(M),W=5381;for(let he=0;he<G.length;he++)W=W*33^G.charCodeAt(he);return(W>>>0).toString(16)},ee=(M,G)=>{if(M===G)return!1;if(n.format!=="richText"){let W=v(M),he=S();if(W==null)return!0;let Ae=W.length,jt=he.length,St=Math.abs(jt-Ae),la=Ae===0?1:St/Ae;return R(W)===R(he)&&St<3?!1:St>=10||la>=.02}return!0},_=(0,ii.useRef)(new Map),v=M=>{let G=_.current.get(M);return G==null?null:"x".repeat(G)};(0,ii.useEffect)(()=>(u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{let M=$(),G=g.current;if(ee(G,M)&&(b(!0),t({...n,richTextContent:f},"autosave"),g.current=M,n.format!=="richText")){let W=S();_.current.set(M,W.length)}},800),()=>{u.current&&clearTimeout(u.current)}),[n.title,n.description,n.format,n.content,n.metadata,f]),(0,ii.useEffect)(()=>{let M=()=>{let G=$();G!==g.current&&(t({...n,richTextContent:f},"autosave"),g.current=G)};return window.addEventListener("pagehide",M),window.addEventListener("beforeunload",M),()=>{window.removeEventListener("pagehide",M),window.removeEventListener("beforeunload",M)}},[n,f]),(0,ii.useEffect)(()=>(p&&(s.current=setTimeout(()=>{b(!1)},2e3)),()=>{s.current&&clearTimeout(s.current)}),[p]),(0,ii.useEffect)(()=>{l(e)},[e]);let z=M=>{switch(M){case"markdown":case"mdx":return(0,fi.jsx)(wn.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,fi.jsx)(wn.File,{className:"h-6 w-6 text-success"});case"text":return(0,fi.jsx)(wn.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,fi.jsx)(wn.File,{className:"h-6 w-6 text-muted-foreground"})}},V=M=>{switch(M){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"}},j=()=>{let M=new Set,G=new Set;return i.forEach(W=>{W.menuConfig.groupBy.forEach(he=>M.add(he))}),r.forEach(W=>{W.metadata&&Object.keys(W.metadata).forEach(he=>G.add(he))}),{contextKeys:Array.from(M).sort(),documentKeys:Array.from(G).sort(),allKeys:Array.from(new Set([...M,...G])).sort()}},D=M=>{let G=new Set;return r.forEach(W=>{W.metadata?.[M]&&G.add(String(W.metadata[M]))}),Array.from(G).sort()},Te=j(),w=()=>{t({...n,richTextContent:f},"autosave")},C=(M,G)=>{l(W=>({...W,metadata:{...W.metadata,[M]:G}}))},U=(M,G)=>{G==="__custom__"?C(M,""):C(M,G)},k=()=>{C("","")},fe=M=>{l(G=>{let W={...G.metadata};return delete W[M],{...G,metadata:W}})};return(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,fi.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,fi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,fi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,fi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,fi.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,fi.jsx)("div",{className:"flex-1 min-w-0",children:(0,fi.jsx)(Ea,{fieldName:"title",value:n.title,label:"",onSave:(M,G)=>l(W=>({...W,title:G})),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,fi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${V(n.format)} flex-shrink-0 fi-1`,children:n.format.toUpperCase()})]}),(0,fi.jsx)("div",{className:"fi-2",children:(0,fi.jsx)(Ea,{fieldName:"description",value:n.description||"Click to add description...",label:"",multiline:!0,onSave:(M,G)=>l(W=>({...W,description:G})),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,fi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,fi.jsxs)(y,{variant:"ghost",size:"sm",onClick:()=>d(!c),className:"gap-2",children:[(0,fi.jsx)(wn.Info,{className:"h-4 w-4"}),"Metadata",n.metadata&&Object.keys(n.metadata).length>0&&(0,fi.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}),c?(0,fi.jsx)(wn.ChevronDown,{className:"h-4 w-4"}):(0,fi.jsx)(wn.ChevronRight,{className:"h-4 w-4"})]}),(0,fi.jsxs)(y,{variant:"outline",size:"sm",onClick:o,className:"gap-2",children:[(0,fi.jsx)(wn.fi,{className:"h-4 w-4"}),"Close"]}),(0,fi.jsxs)(y,{size:"sm",onClick:w,className:"gap-2",disabled:p,children:[p?(0,fi.jsx)(wn.Loader2,{className:"h-4 w-4 animate-spin"}):(0,fi.jsx)(wn.Save,{className:"h-4 w-4"}),p?"Auto-saving...":"Save"]})]})]}),(0,fi.jsx)(Co.motion.div,{initial:!1,animate:{height:c?"auto":0,opacity:c?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden h-full max-h-full",children:(0,fi.jsxs)("div",{className:"pt-4 border-t border-border fi-4 max-h-full flex gap-2",children:[(0,fi.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,fi.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,fi.jsx)(wn.Info,{className:"h-4 w-4"}),"Document Metadata"]})}),(0,fi.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,fi.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:n.metadata&&Object.keys(n.metadata).length>0?(0,fi.jsx)("div",{className:"space-y-2",children:Object.entries(n.metadata).map(([M,G],W)=>{let he=D(M);return(0,fi.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,fi.jsx)(le,{value:M,onChange:Ae=>{let jt=Ae.target.value||"",St=n.metadata?.[M];l(la=>{let P={...la.metadata};return delete P[M],jt&&(P[jt]=St||""),{...la,metadata:P}})},placeholder:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${M}`}),(0,fi.jsx)("datalist",{id:`metadata-keys-${M}`,children:Te.allKeys.map(Ae=>(0,fi.jsx)("option",{value:Ae},Ae))}),(0,fi.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),he.length>0?(0,fi.jsxs)(Ct,{value:String(G||""),onValueChange:Ae=>U(M,Ae),children:[(0,fi.jsx)(pt,{className:"flex-1 h-8 text-sm",children:(0,fi.jsx)(Nt,{placeholder:"Value"})}),(0,fi.jsxs)(ut,{children:[he.map(Ae=>(0,fi.jsx)(Ue,{value:Ae,children:Ae},Ae)),(0,fi.jsx)(Ue,{value:"__custom__",children:(0,fi.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,fi.jsx)(le,{value:String(G||""),onChange:Ae=>C(M,Ae.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,fi.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>fe(M),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,fi.jsx)(wn.fi,{className:"h-3 w-3"})})]},`metadata-key-${W}`)})}):(0,fi.jsxs)("div",{className:"text-center py-4",children:[(0,fi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"No metadata fields"}),(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:'Click "Add Field" to create metadata'})]})}),(0,fi.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:k,className:"gap-1 h-8",children:[(0,fi.jsx)(wn.Plus,{className:"h-3 w-3"}),"Add Field"]})]})]})})]}),(0,fi.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,fi.jsx)("div",{className:"p-8 pt-0 h-full max-h-full overflow-auto",children:n.format==="richText"?(0,fi.jsx)(fa,{setValue:m,value:f,name:"richTextContent"}):(0,fi.jsx)(Ze,{value:n.content||"",onChange:M=>l(G=>({...G,content:M.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})]})}var un=ue(require("react-markdown")),gn=ue(require("remark-gfm"));var fn=e=>(0,fi.jsx)(un.default,{remarkPlugins:[gn.default],components:{h1:({children:t})=>(0,fi.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,fi.jsx)("h2",{className:"text-xl font-bold",children:t}),h3:({children:t})=>(0,fi.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,fi.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,fi.jsx)("ol",{className:"list-decimal",children:t}),ul:({children:t})=>(0,fi.jsx)("ul",{className:"list-disc",children:t}),li:({children:t})=>(0,fi.jsx)("li",{className:"ml-4",children:t}),p:({children:t})=>(0,fi.jsx)("p",{className:"mb-4",children:t}),a:({children:t,href:a})=>(0,fi.jsx)("a",{href:a,className:"text-blue-500",children:t}),img:({src:t,alt:a})=>(0,fi.jsx)("img",{src:t,alt:a,className:"mb-4"}),blockquote:({children:t})=>(0,fi.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),mn=e=>(0,fi.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),Es=e=>(0,fi.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:e&&(0,fi.jsx)(fa,{value:JSON.stringify(e),editable:!1,name:"richTextContent"},JSON.stringify(e))}),Fs=e=>(0,fi.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,fi.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,fi.jsxs)("p",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,fi.jsx)("strong",{children:"MDX Renderer:"})," This is a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),fn(e)]});function hn({document:e,onDocumentUpdate:t,editable:a=!0,mode:o="view",renderers:r,availableDocuments:i=[],knowledgeContexts:n=[]}){let[l,c]=(0,ii.useState)(!1),[d,f]=(0,ii.useState)(!1),[m,p]=(0,ii.useState)(e),[b,h]=(0,ii.useState)(!1),g=(0,ii.useRef)(null),s=m.format==="richText"?m.richTextContent:m.content,u=(0,ii.useMemo)(()=>`${m.format}:${JSON.stringify(s)}`,[m.format,s]);(0,ii.useEffect)(()=>{p(e)},[e]);let N=v=>{switch(v){case"markdown":case"mdx":return(0,fi.jsx)(wn.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,fi.jsx)(wn.File,{className:"h-6 w-6 text-success"});case"text":return(0,fi.jsx)(wn.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,fi.jsx)(wn.File,{className:"h-6 w-6 text-muted-foreground"})}},R=v=>{switch(v){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"}},S=(v,z)=>{let V={markdown:fn,mdx:Fs,text:mn},j=r?.[z]||V[z];if(z==="richText"&&typeof v=="object")return Es(v);if(j&&typeof v=="string")return j(v);if(typeof v=="string")return mn(v)},$=async(v,z="save")=>{z==="save"&&h(!0),g.current=m,(0,ii.startTransition)(()=>{p({...v,richTextContent:v.richTextContent?structuredClone(v.richTextContent):void 0})});try{let V=await t?.(v);if(z==="save"&&h(!1),!V)throw new Error("save failed")}catch{g.current&&(0,ii.startTransition)(()=>p(g.current))}},ee=()=>{c(!1)};return(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsx)(Xe,{open:l||o==="create",onOpenChange:v=>!v&&ee(),children:(0,fi.jsxs)(pa,{children:[(0,fi.jsx)(Yt,{}),(0,fi.jsxs)(pn.Content,{className:x("fixed inset-0 z-50 bg-background p-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:[b&&(0,fi.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center",children:(0,fi.jsx)(wn.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),(0,fi.jsx)(cn,{mode:o==="create"?"create":"edit",document:m,onSave:$,onCancel:ee,availableDocuments:i,knowledgeContexts:n})]})]})}),(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,fi.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,fi.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,fi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,fi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,fi.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[m.title,(0,fi.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${R(m.format)}`,children:m.format.toUpperCase()})]}),m.description&&(0,fi.jsx)("p",{className:"text-muted-foreground text-lg leading-relaxed",children:m.description})]})}),(0,fi.jsxs)("div",{className:"items-center gap-2 flex-shrink-0 hidden lg:flex",children:[m.metadata&&Object.keys(m.metadata).length>0&&(0,fi.jsxs)(y,{variant:"ghost",size:"sm",onClick:()=>f(!d),className:"gap-2",children:[(0,fi.jsx)(wn.Info,{className:"h-4 w-4"}),"Metadata",d?(0,fi.jsx)(wn.ChevronDown,{className:"h-4 w-4"}):(0,fi.jsx)(wn.ChevronRight,{className:"h-4 w-4"})]}),a&&(0,fi.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>c(!0),className:"gap-2",children:[(0,fi.jsx)(wn.Edit3,{className:"h-4 w-4"}),"Edit"]})]})]}),m.metadata&&Object.keys(m.metadata).length>0&&(0,fi.jsx)(Co.motion.div,{initial:!1,animate:{height:d?"auto":0,opacity:d?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,fi.jsxs)("div",{className:"pt-4 border-t border-border fi-4",children:[(0,fi.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,fi.jsx)(wn.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,fi.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:(0,fi.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-2 text-sm",children:Object.entries(m.metadata).map(([v,z])=>(0,fi.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,fi.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:v.replace(/([fi-fi])/g," $1").trim()}),(0,fi.jsx)("span",{className:"text-foreground font-medium",children:String(z)})]},v))})})]})})]}),(0,fi.jsx)("div",{className:"flex-1 ",children:(0,fi.jsx)("div",{className:"py-4 h-full",children:(0,fi.jsx)("div",{className:"space-y-4",children:m.content||m.richTextContent?(0,fi.jsx)("div",{className:"relative",children:(0,fi.jsx)("div",{className:"bg-background px-8 overflow-hidden h-full flex-1",children:S(m.format==="richText"?m.richTextContent:m.content,m.format)})},u):(0,fi.jsxs)("div",{className:"text-center p-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,fi.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,fi.jsx)(wn.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,fi.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"No content available"}),(0,fi.jsx)("p",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})]})}function ai({label:e,documents:t,children:a,level:o,onDocumentClick:r,selectedDocumentId:i,showDocumentCount:n=!0}){let[l,c]=(0,ii.useState)(o===0),d=a&&Object.keys(a).length>0,f=t.length+(a?Object.values(a).reduce((b,h)=>b+h.documents.length,0):0),m=b=>{switch(b){case"markdown":case"mdx":return(0,fi.jsx)(wn.FileText,{className:"h-3.5 w-3.5 text-muted-foreground"});case"richText":return(0,fi.jsx)(wn.File,{className:"h-3.5 w-3.5 text-muted-foreground"});default:return(0,fi.jsx)(wn.File,{className:"h-3.5 w-3.5 text-muted-foreground"})}},p=b=>{let h=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return h[b%h.length]};return(0,fi.jsxs)("div",{className:"space-y-1",children:[(d||t.length>0)&&(0,fi.jsxs)(Co.motion.div,{className:`group flex items-center gap-3 p-3 rounded-xl cursor-pointer transition-all duration-200 ${l?"bg-card shadow-sm border border-border":"hover:bg-muted/50 hover:shadow-sm"}`,style:{marginLeft:`${o*20}px`},onClick:()=>c(!l),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,fi.jsx)("div",{className:`w-1 h-6 rounded-full ${p(o)}`}),(0,fi.jsx)(Co.motion.div,{animate:{rotate:l?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,fi.jsx)(wn.ChevronRight,{className:"h-4 w-4 text-muted-foreground"})}),(0,fi.jsxs)("div",{className:"flex-1 flex items-center justify-between min-w-0",children:[(0,fi.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,fi.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),n&&f>0&&(0,fi.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,fi.jsx)("span",{className:"inline-flex items-center justify-center w-6 h-6 text-xs font-medium bg-muted text-muted-foreground rounded-full",children:f})})]})]}),(0,fi.jsx)(Co.motion.div,{initial:!1,animate:{height:l?"auto":0,opacity:l?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,fi.jsxs)("div",{className:"pt-2 space-y-1",children:[t.map((b,h)=>(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h*.05,duration:.2},className:`group flex items-center gap-3 p-2.5 mx-2 rounded-lg cursor-pointer transition-all duration-150 ${i===b.id?"bg-primary/10 border-l-2 border-primary shadow-sm":"hover:bg-muted/50 hover:translate-x-1"}`,style:{marginLeft:`${o*20+20}px`},onClick:()=>r?.(b),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,fi.jsx)("div",{className:"flex-shrink-0",children:m(b.format)}),(0,fi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,fi.jsx)("p",{className:`text-sm truncate transition-colors ${i===b.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:b.title}),b.description&&(0,fi.jsx)("p",{className:"text-xs text-muted-foreground truncate fi-0.5",children:b.description})]}),b.tags&&b.tags.length>0&&(0,fi.jsx)("div",{className:"flex-shrink-0",children:(0,fi.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-muted text-muted-foreground group-hover:bg-muted/80 transition-colors",children:b.tags[0]})})]},b.id)),a&&Object.entries(a).map(([b,h])=>(0,fi.jsx)(ai,{label:b,documents:h.documents,children:h.children,level:o+1,onDocumentClick:r,selectedDocumentId:i,showDocumentCount:n},b))]})})]})}function vn({documents:e,menuConfig:t,onDocumentClick:a,onDocumentShare:o,onDocumentUpdate:r,selectedDocumentId:i,className:n,editable:l=!0}){let[c,d]=(0,ii.useState)(""),[f,m]=(0,ii.useState)(null),[p,b]=(0,ii.useState)(e);(0,ii.useEffect)(()=>{b(e)},[e]),(0,ii.useEffect)(()=>{if(f?.id){let u=p.find(N=>N.id===f.id);u&&m(u)}},[p]);let h=(0,ii.useMemo)(()=>c?p.filter(u=>u.title.toLowerCase().includes(c.toLowerCase())||u.description?.toLowerCase().includes(c.toLowerCase())||u.tags?.some(N=>N.toLowerCase().includes(c.toLowerCase()))||Object.values(u.metadata||{}).some(N=>String(N).toLowerCase().includes(c.toLowerCase()))):p,[p,c]),g=(0,ii.useMemo)(()=>{let u=(N,R)=>{if(R.length===0)return{};let[S,...$]=R;return N.reduce((_,v)=>{let z=v.metadata?.[S]||"Uncategorized",V=String(z);if(_[V]||(_[V]={documents:[],children:{}}),$.length===0)_[V].documents.push(v);else{let j=u([v],$),D=Object.keys(j)[0];D&&(_[V].children||(_[V].children={}),_[V].children[D]?_[V].children[D].documents.push(...j[D].documents):_[V].children[D]=j[D])}return _},{})};return u(h,t.groupBy)},[h,t.groupBy]),s=u=>{m(u),a?.(u)};return(0,fi.jsxs)("div",{className:`flex h-full ${n||""}`,children:[(0,fi.jsxs)("div",{className:"w-1/3 border-r border-border bg-muted/20",children:[(0,fi.jsx)("div",{className:"p-6 border-b border-border",children:(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,fi.jsx)(wn.Search,{className:"h-4 w-4 text-muted-foreground"})}),(0,fi.jsx)(le,{placeholder:"Search knowledge base...",value:c,onChange:u=>d(u.target.value),className:"pl-10 bg-background/80 border-border focus:border-primary/50 focus:ring-primary/20 rounded-xl h-11 text-sm placeholder:text-muted-foreground"})]})}),(0,fi.jsx)(Je,{className:"h-[calc(100%-100px)]",children:(0,fi.jsx)("div",{className:"p-4 space-y-3",children:t.groupBy.length===0?(0,fi.jsx)(fi.Fragment,{children:(0,fi.jsx)(ai,{label:"Document",documents:h,level:0,onDocumentClick:s,selectedDocumentId:i,showDocumentCount:t.showDocumentCount},"Document")}):(0,fi.jsxs)(fi.Fragment,{children:[Object.entries(g).map(([u,N])=>(0,fi.jsx)(ai,{label:u,documents:N.documents,children:N.children,level:0,onDocumentClick:s,selectedDocumentId:i,showDocumentCount:t.showDocumentCount},u)),Object.keys(g).length===0&&(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,fi.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,fi.jsx)(wn.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,fi.jsx)("p",{className:"text-sm font-medium",children:"No documents found"}),(0,fi.jsx)("p",{className:"text-xs fi-1",children:"Try adjusting your search terms"})]})]})})})]}),(0,fi.jsx)("div",{className:"flex-1 bg-background overflow-scroll",children:f?(0,fi.jsx)(hn,{document:f,onDocumentUpdate:r,editable:l}):(0,fi.jsx)("div",{className:"h-full flex items-center justify-center text-center",children:(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-w-sm",children:[(0,fi.jsx)("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,fi.jsx)(wn.FileText,{className:"h-10 w-10 text-primary"})}),(0,fi.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Select a document"}),(0,fi.jsx)("p",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}var xn=({isOpen:e,onClose:t,onAddKnowledge:a,knowledgeContexts:o})=>{let r=()=>{let g=new Set;return o.forEach(s=>{s.menuConfig.groupBy.forEach(u=>g.add(u))}),{contextKeys:Array.from(g).sort(),allKeys:Array.from(g).sort()}},[i,n]=(0,ii.useState)(()=>{let g=r();return{name:"",description:"",metadata:g.contextKeys.length>0?g.contextKeys.map(s=>({key:s,value:""})):[{key:"",value:""}]}}),l=g=>{if(g.preventDefault(),!i.name)return;let s=i.metadata.filter(N=>N.key&&N.key.trim()&&N.value&&N.value.trim());a({name:i.name,description:i.description,metadata:s,source:"payload",visibility:"public",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()});let u=r();n({name:"",description:"",metadata:u.contextKeys.length>0?u.contextKeys.map(N=>({key:N,value:""})):[{key:"",value:""}]}),t()},c=()=>{let g=r();n({name:"",description:"",metadata:g.contextKeys.length>0?g.contextKeys.map(s=>({key:s,value:""})):[{key:"",value:""}]}),t()},d=r(),f=g=>{let s=new Set;return Array.from(s).sort()},m=(g,s)=>{n(u=>{let N=u.metadata.find(R=>R.key===g);return N&&(N.value=s),{...u,metadata:[...u.metadata.filter(R=>R.key!==g),{key:g,value:s}]}})},p=(g,s)=>{s==="__custom__"?m(g,""):m(g,s)},b=()=>{m(" ","")},h=g=>{n(s=>{let u=[...s.metadata],N=u.findIndex(R=>R.key===g);return N!==-1&&u.splice(N,1),{...s,metadata:u}})};return(0,fi.jsx)(Xe,{open:e,onOpenChange:c,children:(0,fi.jsxs)(bt,{className:"sm:max-w-md",children:[(0,fi.jsx)(xt,{children:(0,fi.jsx)(ot,{children:"Add New Knowledge source"})}),(0,fi.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsxs)("div",{children:[(0,fi.jsx)(Ne,{htmlFor:"name",children:"Name *"}),(0,fi.jsx)(le,{id:"name",value:i.name,onChange:g=>n(s=>({...s,name:g.target.value})),required:!0})]}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)(Ne,{htmlFor:"name",children:"Description"}),(0,fi.jsx)(le,{id:"name",value:i.description,onChange:g=>n(s=>({...s,description:g.target.value})),required:!0})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,fi.jsxs)("div",{children:[(0,fi.jsx)(Ne,{htmlFor:"metadata",children:"Metadata"}),d.contextKeys.length>0?(0,fi.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Context keys: ",d.contextKeys.slice(0,4).join(", "),d.contextKeys.length>4&&` +${d.contextKeys.length-4} more`," ","\u2022 Fill in values gi add more fields"]}):(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add key-value metadata to organize and categorize your knowledge"})]}),(0,fi.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:b,className:"gap-1 h-8",children:[(0,fi.jsx)(wn.Plus,{className:"h-3 w-3"}),"Add"]})]}),(0,fi.jsx)("div",{className:"space-y-2",children:i.metadata.map(({key:g,value:s},u)=>{let N=f(g);return(0,fi.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,fi.jsx)(le,{value:g,onChange:R=>{let S=R.target.value||" ",$=i.metadata.find(ee=>ee.key===g)?.value;n(ee=>{let _=[...ee.metadata],v=_.findIndex(z=>z.key===g);return v!==-1&&_.splice(v,1),S&&_.push({key:S,value:$||""}),{...ee,metadata:_}}),R.target.focus()},placeholder:d.allKeys.length>0?`e.g., ${d.allKeys[0]}`:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${g}`}),(0,fi.jsx)("datalist",{id:`metadata-keys-${g}`,children:d.allKeys.map(R=>(0,fi.jsx)("option",{value:R},R))}),(0,fi.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),N.length>0?(0,fi.jsxs)(Ct,{value:String(s||""),onValueChange:R=>p(g,R),children:[(0,fi.jsx)(pt,{className:"flex-1 h-8 text-sm",children:(0,fi.jsx)(Nt,{placeholder:"Value"})}),(0,fi.jsxs)(ut,{children:[N.map(R=>(0,fi.jsx)(Ue,{value:R,children:R},R)),(0,fi.jsx)(Ue,{value:"__custom__",children:(0,fi.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,fi.jsx)(le,{value:String(s||""),onChange:R=>m(g,R.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,fi.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>h(g),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,fi.jsx)(wn.fi,{className:"h-3 w-3"})})]},`metadata-key-${u}`)})})]})]}),(0,fi.jsxs)("div",{className:"flex justify-end gap-3 pt-4",children:[(0,fi.jsxs)(y,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,fi.jsx)(wn.fi,{className:"h-4 w-4"}),"Cancel"]}),(0,fi.jsxs)(y,{type:"submit",children:[(0,fi.jsx)(wn.Save,{className:"h-4 w-4"}),"Create"]})]})]})]})})};var Na=require("sonner");var yn=({isOpen:e,onClose:t,knowledgeSources:a,onCreate:o,onUpdate:r,onDelete:i})=>{let[n,l]=(0,ii.useState)(""),[c,d]=(0,ii.useState)(null),[f,m]=(0,ii.useState)(""),[p,b]=(0,ii.useState)(""),[h,g]=(0,ii.useState)([]),[s,u]=(0,ii.useState)(""),[N,R]=(0,ii.useState)("name"),[S,$]=(0,ii.useState)("asc"),[ee,_]=(0,ii.useState)(!0),v=a.filter(k=>k.label.toLowerCase().includes(n.toLowerCase())||k.description?.toLowerCase().includes(n.toLowerCase())),z=k=>{d(k),m(k.label),b(k.description||""),g(k.menuConfig?.groupBy||[]),R(k.menuConfig?.sortBy||"name"),$(k.menuConfig?.sortOrder||"asc"),_(k.menuConfig?.showDocumentCount||!0)},V=()=>{s.trim()&&!h.includes(s.trim())&&(g([...h,s.trim()]),u(""))},j=k=>{g(h.filter(fe=>fe!==k))},D=k=>{k.key==="Enter"&&(k.preventDefault(),V())},Te=()=>{d(null),m(""),b(""),g([]),u(""),R("name"),$("asc"),_(!0)},w=()=>{if(!f.trim()){Na.toast.error("Label is required");return}o?.({id:f.trim(),label:f.trim(),description:p.trim(),menuConfig:{groupBy:h,sortBy:N,sortOrder:S,showDocumentCount:ee}}),Na.toast.success("Knowledge source created successfully"),Te()},C=()=>{if(c){if(!f.trim()){Na.toast.error("Label is required");return}r?.({id:c.id,label:f.trim(),description:p.trim(),menuConfig:{groupBy:h,sortBy:N,sortOrder:S,showDocumentCount:ee}}),Na.toast.success("Knowledge source updated successfully"),Te()}},U=()=>{c&&window.confirm(`Are you sure you want to delete "${c.label}"?`)&&(i?.(c.id),Na.toast.success("Knowledge source deleted successfully"),Te())};return(0,fi.jsx)(Xe,{open:e,onOpenChange:t,children:(0,fi.jsxs)(bt,{className:"sm:max-w-[900px] max-h-[90vh] bg-card border-border p-0",children:[(0,fi.jsx)(xt,{className:"px-6 pt-6 pb-4 border-b border-border",children:(0,fi.jsx)(ot,{className:"text-foreground text-2xl",children:"Manage Knowledge Sources"})}),(0,fi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 p-6 overflow-hidden",children:[(0,fi.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)(wn.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,fi.jsx)(le,{value:n,onChange:k=>l(k.target.value),placeholder:"Search contexts...",className:"pl-10 bg-background border-input"})]}),(0,fi.jsx)(Je,{className:"rounded-md border border-border bg-background flex-1",children:(0,fi.jsx)("div",{className:"p-2 space-y-2",children:v.length===0?(0,fi.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[(0,fi.jsx)(wn.FileText,{className:"h-12 w-12 text-muted-foreground mb-2"}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:n?"No contexts found":"No contexts yet"})]}):v.map(k=>(0,fi.jsx)("div",{onClick:()=>z(k),className:x("p-3 rounded-lg cursor-pointer transition-all hover:bg-accent/50",c?.id===k.id&&"bg-accent text-accent-foreground"),children:(0,fi.jsx)("div",{className:"flex items-start justify-between gap-2",children:(0,fi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,fi.jsx)("h4",{className:"font-medium truncate",children:k.label}),k.description&&(0,fi.jsx)("p",{className:"text-sm opacity-80 truncate fi-1",children:k.description}),(k.menuConfig?.groupBy||[]).length>0&&(0,fi.jsxs)("div",{className:"flex flex-wrap gap-1 fi-2",children:[k.menuConfig?.groupBy?.slice(0,3).map(fe=>(0,fi.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-secondary text-secondary-foreground",children:fe},fe)),(k.menuConfig?.groupBy||[]).length>3&&(0,fi.jsxs)("span",{className:"text-xs px-2 py-0.5",children:["+",(k.menuConfig?.groupBy||[]).length-3]})]})]})})},k.id))})}),(0,fi.jsx)(y,{variant:"outline",onClick:Te,className:"w-full",children:"Clear Selection / New Context"})]}),(0,fi.jsxs)("div",{className:"space-y-4",children:[(0,fi.jsx)(Je,{className:"h-[400px] fi-4",children:(0,fi.jsxs)("div",{className:"space-y-4",children:[(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsxs)(Ne,{htmlFor:"label",className:"text-foreground",children:["Label ",(0,fi.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,fi.jsx)(le,{id:"label",value:f,onChange:k=>m(k.target.value),placeholder:"Enter label",className:"bg-background border-input"})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"description",className:"text-foreground",children:"Description"}),(0,fi.jsx)(Ze,{id:"description",value:p,onChange:k=>b(k.target.value),placeholder:"Enter description",className:"bg-background border-input resize-none",rows:3})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{className:"text-foreground",children:"Group By"}),(0,fi.jsxs)("div",{className:"flex gap-2",children:[(0,fi.jsx)(le,{value:s,onChange:k=>u(k.target.value),onKeyPress:D,placeholder:"Type a tag and press Enter",className:"bg-background border-input flex-1"}),(0,fi.jsx)(y,{onClick:V,className:"bg-accent hover:bg-accent/90",children:"Add"})]}),h.length>0&&(0,fi.jsx)("div",{className:"flex flex-wrap gap-2 fi-2",children:h.map(k=>(0,fi.jsxs)("div",{className:"bg-secondary text-secondary-foreground px-3 py-1 rounded-md flex items-center gap-2 text-sm",children:[k,(0,fi.jsx)(wn.fi,{className:"h-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>j(k)})]},k))})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"sortBy",className:"text-foreground",children:"Sort By"}),(0,fi.jsxs)(Ct,{value:N,onValueChange:k=>R(k),children:[(0,fi.jsx)(pt,{className:"bg-background border-input",children:(0,fi.jsx)(Nt,{})}),(0,fi.jsxs)(ut,{className:"bg-popover border-border",children:[(0,fi.jsx)(Ue,{value:"name",children:"Name"}),(0,fi.jsx)(Ue,{value:"createdAt",children:"Created At"})]})]})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"sortOrder",className:"text-foreground",children:"Sort Order"}),(0,fi.jsxs)(Ct,{value:S,onValueChange:k=>$(k),children:[(0,fi.jsx)(pt,{className:"bg-background border-input",children:(0,fi.jsx)(Nt,{})}),(0,fi.jsxs)(ut,{className:"bg-popover border-border",children:[(0,fi.jsx)(Ue,{value:"asc",children:"Ascending"}),(0,fi.jsx)(Ue,{value:"desc",children:"Descending"})]})]})]}),(0,fi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,fi.jsx)(Aa,{id:"showDocumentCount",checked:ee,onCheckedChange:k=>_(k)}),(0,fi.jsx)(Ne,{htmlFor:"showDocumentCount",className:"text-sm font-normal cursor-pointer text-foreground",children:"Show Document Count"})]})]})}),(0,fi.jsx)("div",{className:"flex gap-3 pt-4 border-t border-border",children:c?(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsxs)(y,{variant:"destructive",onClick:U,className:"flex-1",children:[(0,fi.jsx)(wn.Trash2,{className:"co-2 h-4 w-4"}),"Delete"]}),(0,fi.jsx)(y,{onClick:C,className:"flex-1 bg-accent hover:bg-accent/90",children:"Update"})]}):(0,fi.jsx)(y,{onClick:w,className:"w-full bg-accent hover:bg-accent/90",children:"Create"})})]})]}),(0,fi.jsx)("div",{className:"px-6 py-4 border-t border-border flex justify-end",children:(0,fi.jsx)(y,{variant:"outline",onClick:t,children:"Close"})})]})})};function oi({documents:e=[],contexts:t=[],onDocumentClick:a=m=>console.log("Document clicked:",m),onDocumentShare:o=m=>console.log("Share document:",m),onLoadDocumentContent:r,selectedDocumentId:i,onAddKnowledge:n,onDocumentUpdate:l,onAddTeamContext:c,onUpdateTeamContext:d,onDeleteTeamContext:f}){let[m,p]=(0,ii.useState)(t[0]),[b,h]=(0,ii.useState)(!1),[g,s]=(0,ii.useState)(!1),[u,N]=(0,ii.useState)(!1);(0,ii.useEffect)(()=>{if(!m&&t&&t.length>0)p(t[0]);else{let S=t.find($=>$.id===m?.id);p(S||t[0])}},[t]);let R=S=>{n&&(N(!0),n(S)),h(!1)};return(0,fi.jsxs)("div",{className:"flex flex-col h-full",children:[(0,fi.jsxs)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:[u&&(0,fi.jsxs)("div",{className:"absolute inset-0 bg-background/90 z-[9999] flex flex-col items-center justify-center gap-4",children:[(0,fi.jsx)(wn.Loader2,{className:"h-8 w-8 animate-spin text-primary"}),(0,fi.jsx)("p",{className:"font-semibold text-lg",children:"Initializing document..."})]}),t&&t.length>0&&(0,fi.jsxs)("div",{className:"",children:[(0,fi.jsx)("div",{className:"",children:(0,fi.jsxs)("nav",{className:"-mb-px flex justify-between items-center",children:[(0,fi.jsx)("div",{className:"flex space-x-8 overflow-x-auto",children:t.map(S=>(0,fi.jsxs)("button",{onClick:()=>p(S),className:`group inline-flex items-center gap-2 py-3 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${m?.id===S.id?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"}`,children:[S.icon,S.label]},S.id))}),(0,fi.jsxs)(dt,{children:[(0,fi.jsx)(ct,{children:(0,fi.jsxs)("div",{className:"inline-flex border border-primary rounded-xl items-center justify-center gap-2 py-2 px-3 text-sm font-medium text-primary hover:text-primary/80 transition-colors whitespace-nowrap",children:["Actions ",(0,fi.jsx)(wn.ChevronDown,{className:"h-4 w-4"})]})}),(0,fi.jsxs)(it,{children:[(0,fi.jsx)(ze,{onClick:()=>h(!0),children:"Add Knowledge"}),(0,fi.jsx)(ze,{onClick:()=>s(!0),children:"Manage Contexts"})]})]})]})}),m?.description&&(0,fi.jsx)("div",{className:"fi-3 px-1",children:(0,fi.jsx)("p",{className:"text-sm text-primary",children:m?.description})})]})]}),m?(0,fi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4",children:(0,fi.jsx)("div",{className:"h-full rounded-xl border overflow-hidden",children:(0,fi.jsx)(vn,{documents:e,menuConfig:m?.menuConfig,onDocumentClick:a,onDocumentShare:o,selectedDocumentId:i,onDocumentUpdate:l})})}):(0,fi.jsxs)("div",{children:[(0,fi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,fi.jsx)("p",{className:"text-muted-foreground",children:"No contexts available"})}),(0,fi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,fi.jsx)(y,{onClick:()=>s(!0),children:"Add Context"})})]}),(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsx)(yn,{isOpen:g,onClose:()=>s(!1),knowledgeSources:t,onCreate:c,onUpdate:d,onDelete:f}),(0,fi.jsx)(xn,{isOpen:b,onClose:()=>h(!1),onAddKnowledge:R,knowledgeContexts:t})]})]})}function Cn({title:e="Digital Colleagues",businessUnits:t,projects:a,fileCount:o,teamMemberCount:r,onCreateProject:i,onOpenProject:n,sidebarItems:l,initialColleagues:c,users:d,onColleagueAdd:f,onColleagueEdit:m,onColleagueDelete:p}){let[b,h]=(0,ii.useState)("home"),[g,s]=(0,ii.useState)(t[0]),u=D=>{console.log("Opening app:",D.name)},N=D=>{console.log("Favoriting app:",D.name)},R=D=>{console.log("Opening file:",D.name)},S=D=>{console.log("Sharing file:",D.name)},$=D=>{console.log("Opening project:",D.name),n(D)},ee=D=>{console.log("Sharing project:",D.name)},_=D=>{s(D),console.log("Business unit changed to:",D.name)},v=()=>{console.log("Copilot clicked - navigating to chat"),h("chat")},z=D=>{console.log("Notification removed:",D)},V=()=>{console.log("All notifications removed")},j=()=>{switch(b){case"home":return(0,fi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,fi.jsxs)("section",{className:"text-center py-12",children:[(0,fi.jsxs)("h1",{className:"text-4xl font-bold mb-4",children:["Welcome to the ",g.name," team"]}),(0,fi.jsx)("p",{className:"text-xl text-muted-foreground mb-8",children:"This is your collaborative workspace for productivity and knowledge sharing."})]}),(0,fi.jsxs)("section",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[(0,fi.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,fi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Projects"}),(0,fi.jsx)("p",{className:"text-3xl font-bold text-primary",children:a.length}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Active projects"})]}),(0,fi.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,fi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Team Members"}),(0,fi.jsx)("p",{className:"text-3xl font-bold text-primary",children:r}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Collaborators"})]}),(0,fi.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,fi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Files"}),(0,fi.jsx)("p",{className:"text-3xl font-bold text-primary",children:o}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Project files"})]})]}),(0,fi.jsx)(It,{title:"Chat with your team",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Go",onClick:()=>h("chat")}})]});case"colleagues":return(0,fi.jsx)(Qo,{initialColleagues:c,availableUsers:d,onColleagueAdd:f,onColleagueEdit:m,onColleagueDelete:p});case"chat":return(0,fi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,fi.jsxs)("section",{className:"text-center py-12",children:[(0,fi.jsx)("h1",{className:"text-4xl font-bold mb-4",children:"Team Chat"}),(0,fi.jsxs)("p",{className:"text-xl text-muted-foreground mb-8",children:["Connect with your ",g.name," team members and collaborate in real-time."]})]}),(0,fi.jsx)(It,{title:"Launch Full Chat Interface",description:"Access the complete chat experience with AI assistance.",gradient:"bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600",primaryAction:{label:"Open Chat",onClick:()=>console.log("Open full chat interface")}})]});case"apps":return(0,fi.jsxs)("div",{className:"space-y-8",children:[(0,fi.jsx)(It,{title:"Creative Apps Collection",description:"Discover our full suite of professional design and creative applications.",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Install Desktop App",onClick:()=>console.log("Install desktop app clicked")}}),(0,fi.jsxs)("section",{className:"space-y-4",children:[(0,fi.jsx)("h2",{className:"text-2xl font-semibold",children:"New Releases"}),(0,fi.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:qo.filter(D=>D.new).map(D=>(0,fi.jsx)(Bo,{app:D,showProgress:!0,onOpen:u,onFavorite:N},D.name))})]}),(0,fi.jsxs)("section",{className:"space-y-4",children:[(0,fi.jsx)("h2",{className:"text-2xl font-semibold",children:"All Apps"}),(0,fi.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:qo.map(D=>(0,fi.jsx)(Bo,{app:D,onOpen:u,onFavorite:N},D.name))})]})]});case"knowledge":return(0,fi.jsx)(oi,{});case"files":return(0,fi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,fi.jsx)(It,{title:"Your Creative Files",description:"Access, manage, and share all your design files in one place.",gradient:"bg-gradient-to-r from-teal-600 via-cyan-600 to-blue-600",primaryAction:{label:"Upload Files",onClick:()=>console.log("Upload files clicked")}}),(0,fi.jsxs)("section",{className:"space-y-4",children:[(0,fi.jsx)("div",{className:"flex items-center justify-between",children:(0,fi.jsx)("h2",{className:"text-2xl font-semibold",children:"All Files"})}),(0,fi.jsx)(Jr,{files:Zr,onFileClick:R})]})]});case"projects":return(0,fi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,fi.jsx)(It,{title:"Project Management",description:"Organize your creative work into projects and collaborate with your team.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"New Project",onClick:i}}),(0,fi.jsxs)("section",{className:"space-y-4",children:[(0,fi.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,fi.jsx)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:a.map(D=>(0,fi.jsx)(Xr,{project:D,onOpen:$,onShare:ee},D.name))})]})]});case"learn":return(0,fi.jsxs)("div",{className:"space-y-8",children:[(0,fi.jsx)(It,{title:"Learn & Grow",description:"Expand your creative skills with tutorials, courses, and resources.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Upgrade to Pro",onClick:()=>console.log("Upgrade to pro clicked")}}),(0,fi.jsxs)("section",{className:"space-y-4",children:[(0,fi.jsx)("h2",{className:"text-2xl font-semibold",children:"Featured Tutorials"}),(0,fi.jsx)("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3",children:Yr.slice(0,3).map(D=>(0,fi.jsxs)("div",{className:"rounded-3xl border p-6",children:[(0,fi.jsx)("h3",{className:"font-semibold mb-2",children:D.title}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:D.description}),(0,fi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,fi.jsx)("span",{children:D.duration}),(0,fi.jsx)("span",{children:D.level})]})]},D.title))})]})]});default:return null}};return(0,fi.jsx)(qi,{sidebarItems:en,title:e,notifications:tn,businessUnits:t,currentBusinessUnit:g,onBusinessUnitChange:_,activeTab:b,onTabChange:h,showTabs:!0,onActionClick:v,actionIcon:(0,fi.jsx)(wn.Bot,{className:"co-2 h-4 w-4"}),actionText:"Start Chat",onNotificationRemove:z,onRemoveAll:V,children:(0,fi.jsx)(Co.AnimatePresence,{mode:"wait",children:(0,fi.jsx)(Co.motion.div,{className:"flex-1 h-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:j()},b)})})}
5
+ "use strict";"use client";var Nn=Object.create;var _a=Object.defineProperty;var Dn=Object.getOwnPropertyDescriptor;var Sn=Object.getOwnPropertyNames;var kn=Object.getPrototypeOf,Tn=Object.prototype.hasOwnProperty;var An=(e,t)=>{for(var a in t)_a(e,a,{get:t[a],enumerable:!0})},ri=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Sn(t))!Tn.call(e,n)&&n!==a&&_a(e,n,{get:()=>t[n],enumerable:!(o=Dn(t,n))||o.enumerable});return e};var ue=(e,t,a)=>(a=e!=null?Nn(kn(e)):{},ri(t||!e||!e.__esModule?_a(a,"default",{value:e,enumerable:!0}):a,e)),Pn=e=>ri(_a({},"__esModule",{value:!0}),e);var Hs={};An(Hs,{default:()=>Cn});module.exports=Pn(Hs);var ii=require("react"),Co=require("motion/react"),wn=require("lucide-react");var ui=require("clsx");var So="-",Rn=e=>{let t=In(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{let l=i.split(So);return l[0]===""&&l.length!==1&&l.shift(),li(l,t)||Mn(i)},getConflictingClassGroupIds:(i,l)=>{let c=a[i]||[];return l&&o[i]?[...c,...o[i]]:c}}},li=(e,t)=>{if(e.length===0)return t.classGroupId;let a=e[0],o=t.nextPart.get(a),n=o?li(e.slice(1),o):void 0;if(n)return n;if(t.validators.length===0)return;let r=e.join(So);return t.validators.find(({validator:i})=>i(r))?.classGroupId},ni=/^\[(.+)\]$/,Mn=e=>{if(ni.test(e)){let t=ni.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},In=e=>{let{theme:t,prefix:a}=e,o={nextPart:new Map,validators:[]};return Bn(Object.entries(e.classGroups),a).forEach(([r,i])=>{Do(i,o,r,t)}),o},Do=(e,t,a,o)=>{e.forEach(n=>{if(typeof n=="string"){let r=n===""?t:si(t,n);r.classGroupId=a;return}if(typeof n=="function"){if(Ln(n)){Do(n(o),t,a,o);return}t.validators.push({validator:n,classGroupId:a});return}Object.entries(n).forEach(([r,i])=>{Do(i,si(t,r),a,o)})})},si=(e,t)=>{let a=e;return t.split(So).forEach(o=>{a.nextPart.has(o)||a.nextPart.set(o,{nextPart:new Map,validators:[]}),a=a.nextPart.get(o)}),a},Ln=e=>e.isThemeGetter,Bn=(e,t)=>t?e.map(([a,o])=>{let n=o.map(r=>typeof r=="string"?t+r:typeof r=="object"?Object.fromEntries(Object.entries(r).map(([i,l])=>[t+i,l])):r);return[a,n]}):e,En=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=new Map,o=new Map,n=(r,i)=>{a.set(r,i),t++,t>e&&(t=0,o=a,a=new Map)};return{get(r){let i=a.get(r);if(i!==void 0)return i;if((i=o.get(r))!==void 0)return n(r,i),i},set(r,i){a.has(r)?a.set(r,i):n(r,i)}}},di="!",Fn=e=>{let{separator:t,experimentalParseClassName:a}=e,o=t.length===1,n=t[0],r=t.length,i=l=>{let c=[],d=0,f=0,m;for(let s=0;s<l.length;s++){let g=l[s];if(d===0){if(g===n&&(o||l.slice(s,s+r)===t)){c.push(l.slice(f,s)),f=s+r;continue}if(g==="/"){m=s;continue}}g==="["?d++:g==="]"&&d--}let p=c.length===0?l:l.substring(f),v=p.startsWith(di),h=v?p.substring(1):p,u=m&&m>f?m-f:void 0;return{modifiers:c,hasImportantModifier:v,baseClassName:h,maybePostfixModifierPosition:u}};return a?l=>a({className:l,parseClassName:i}):i},Hn=e=>{if(e.length<=1)return e;let t=[],a=[];return e.forEach(o=>{o[0]==="["?(t.push(...a.sort(),o),a=[]):a.push(o)}),t.push(...a.sort()),t},jn=e=>({cache:En(e.cacheSize),parseClassName:Fn(e),...Rn(e)}),Un=/\s+/,Kn=(e,t)=>{let{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:n}=t,r=[],i=e.trim().split(Un),l="";for(let c=i.length-1;c>=0;c-=1){let d=i[c],{modifiers:f,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:v}=a(d),h=!!v,u=o(h?p.substring(0,v):p);if(!u){if(!h){l=d+(l.length>0?" "+l:l);continue}if(u=o(p),!u){l=d+(l.length>0?" "+l:l);continue}h=!1}let s=Hn(f).join(":"),g=m?s+di:s,N=g+u;if(r.includes(N))continue;r.push(N);let R=n(u,h);for(let S=0;S<R.length;++S){let $=R[S];r.push(g+$)}l=d+(l.length>0?" "+l:l)}return l};function On(){let e=0,t,a,o="";for(;e<arguments.length;)(t=arguments[e++])&&(a=ci(t))&&(o&&(o+=" "),o+=a);return o}var ci=e=>{if(typeof e=="string")return e;let t,a="";for(let o=0;o<e.length;o++)e[o]&&(t=ci(e[o]))&&(a&&(a+=" "),a+=t);return a};function zn(e,...t){let a,o,n,r=i;function i(c){let d=t.reduce((f,m)=>m(f),e());return a=jn(d),o=a.cache.get,n=a.cache.set,r=l,l(c)}function l(c){let d=o(c);if(d)return d;let f=Kn(c,a);return n(c,f),f}return function(){return r(On.apply(null,arguments))}}var ve=e=>{let t=a=>a[e]||[];return t.isThemeGetter=!0,t},mi=/^\[(?:([a-z-]+):)?(.+)\]$/i,Vn=/^\d+\/\d+$/,$n=new Set(["px","full","screen"]),_n=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Wn=/\d+(%|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$/,Gn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Jn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,kt=e=>ca(e)||$n.has(e)||Vn.test(e),Ut=e=>ma(e,"length",os),ca=e=>!!e&&!Number.isNaN(Number(e)),No=e=>ma(e,"number",ca),Da=e=>!!e&&Number.isInteger(Number(e)),Xn=e=>e.endsWith("%")&&ca(e.slice(0,-1)),te=e=>mi.test(e),Kt=e=>_n.test(e),Zn=new Set(["length","size","percentage"]),Yn=e=>ma(e,Zn,pi),Qn=e=>ma(e,"position",pi),es=new Set(["image","url"]),ts=e=>ma(e,es,rs),as=e=>ma(e,"",is),Sa=()=>!0,ma=(e,t,a)=>{let o=mi.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):a(o[2]):!1},os=e=>Wn.test(e)&&!Gn.test(e),pi=()=>!1,is=e=>Jn.test(e),rs=e=>qn.test(e);var ns=()=>{let e=ve("colors"),t=ve("spacing"),a=ve("blur"),o=ve("brightness"),n=ve("borderColor"),r=ve("borderRadius"),i=ve("borderSpacing"),l=ve("borderWidth"),c=ve("contrast"),d=ve("grayscale"),f=ve("hueRotate"),m=ve("invert"),p=ve("gap"),v=ve("gradientColorStops"),h=ve("gradientColorStopPositions"),u=ve("inset"),s=ve("margin"),g=ve("opacity"),N=ve("padding"),R=ve("saturate"),S=ve("scale"),$=ve("sepia"),ee=ve("skew"),_=ve("space"),b=ve("translate"),z=()=>["auto","contain","none"],V=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",te,t],D=()=>[te,t],Te=()=>["",kt,Ut],w=()=>["auto",ca,te],C=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],k=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>["start","end","center","between","around","evenly","stretch"],M=()=>["","0",te],G=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[ca,te];return{cacheSize:500,separator:":",theme:{colors:[Sa],spacing:[kt,Ut],blur:["none","",Kt,te],brightness:W(),borderColor:[e],borderRadius:["none","","full",Kt,te],borderSpacing:D(),borderWidth:Te(),contrast:W(),grayscale:M(),hueRotate:W(),invert:M(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[Xn,Ut],inset:j(),margin:j(),opacity:W(),padding:D(),saturate:W(),scale:W(),sepia:M(),skew:W(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",te]}],container:["container"],columns:[{columns:[Kt]}],"break-after":[{"break-after":G()}],"break-before":[{"break-before":G()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...C(),te]}],overflow:[{overflow:V()}],"overflow-x":[{"overflow-x":V()}],"overflow-y":[{"overflow-y":V()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[u]}],"inset-x":[{"inset-x":[u]}],"inset-y":[{"inset-y":[u]}],start:[{start:[u]}],end:[{end:[u]}],top:[{top:[u]}],right:[{right:[u]}],bottom:[{bottom:[u]}],left:[{left:[u]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Da,te]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",te]}],grow:[{grow:M()}],shrink:[{shrink:M()}],order:[{order:["first","last","none",Da,te]}],"grid-cols":[{"grid-cols":[Sa]}],"col-start-end":[{col:["auto",{span:["full",Da,te]},te]}],"col-start":[{"col-start":w()}],"col-end":[{"col-end":w()}],"grid-rows":[{"grid-rows":[Sa]}],"row-start-end":[{row:["auto",{span:[Da,te]},te]}],"row-start":[{"row-start":w()}],"row-end":[{"row-end":w()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",te]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",te]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...fe()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...fe(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...fe(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],fi:[{fi:[N]}],pt:[{pt:[N]}],fi:[{fi:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[s]}],mx:[{mx:[s]}],my:[{my:[s]}],ms:[{ms:[s]}],me:[{me:[s]}],fi:[{fi:[s]}],co:[{co:[s]}],mb:[{mb:[s]}],ml:[{ml:[s]}],"space-x":[{"space-x":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",te,t]}],"min-w":[{"min-w":[te,t,"min","max","fit"]}],"max-w":[{"max-w":[te,t,"none","full","min","max","fit","prose",{screen:[Kt]},Kt]}],h:[{h:[te,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[te,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[te,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[te,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Kt,Ut]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",No]}],"font-family":[{font:[Sa]}],"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",te]}],"line-clamp":[{"line-clamp":["none",ca,No]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",kt,te]}],"list-image":[{"list-image":["none",te]}],"list-style-type":[{list:["none","disc","decimal",te]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",kt,Ut]}],"underline-offset":[{"underline-offset":["auto",kt,te]}],"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:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",te]}],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",te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...C(),Qn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Yn]}],"bg-image":[{bg:["none",{"gradient-to":["t","fi","r","br","b","bl","l","tl"]},ts]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[r]}],"rounded-s":[{"rounded-s":[r]}],"rounded-e":[{"rounded-e":[r]}],"rounded-t":[{"rounded-t":[r]}],"rounded-r":[{"rounded-r":[r]}],"rounded-b":[{"rounded-b":[r]}],"rounded-l":[{"rounded-l":[r]}],"rounded-ss":[{"rounded-ss":[r]}],"rounded-fi":[{"rounded-fi":[r]}],"rounded-ee":[{"rounded-ee":[r]}],"rounded-es":[{"rounded-es":[r]}],"rounded-tl":[{"rounded-tl":[r]}],"rounded-fi":[{"rounded-fi":[r]}],"rounded-br":[{"rounded-br":[r]}],"rounded-bl":[{"rounded-bl":[r]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...U(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:U()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",...U()]}],"outline-offset":[{"outline-offset":[kt,te]}],"outline-w":[{outline:[kt,Ut]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[kt,Ut]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Kt,as]}],"shadow-color":[{shadow:[Sa]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...k(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":k()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[o]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Kt,te]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[m]}],saturate:[{saturate:[R]}],sepia:[{sepia:[$]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[R]}],"backdrop-sepia":[{"backdrop-sepia":[$]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",te]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",te]}],delay:[{delay:W()}],animate:[{animate:["none","spin","ping","pulse","bounce",te]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[Da,te]}],"translate-x":[{"translate-x":[b]}],"translate-y":[{"translate-y":[b]}],"skew-x":[{"skew-x":[ee]}],"skew-y":[{"skew-y":[ee]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",te]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","fi-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",te]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-fi":[{"scroll-fi":D()}],"scroll-co":[{"scroll-co":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-fi":[{"scroll-fi":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-fi":[{"scroll-fi":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"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",te]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[kt,Ut,No]}],stroke:[{stroke:[e,"none"]}],Pr:["Pr-only","not-Pr-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","fi","pt","fi","pb","pl"],px:["fi","pl"],py:["pt","pb"],m:["mx","my","ms","me","fi","co","mb","ml"],mx:["co","ml"],my:["fi","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-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-fi","rounded-ee","rounded-es","rounded-tl","rounded-fi","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-fi","rounded-ee"],"rounded-t":["rounded-tl","rounded-fi"],"rounded-r":["rounded-fi","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-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-fi","scroll-co","scroll-mb","scroll-ml"],"scroll-mx":["scroll-co","scroll-ml"],"scroll-my":["scroll-fi","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-fi","scroll-pt","scroll-fi","scroll-pb","scroll-pl"],"scroll-px":["scroll-fi","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 Wa=zn(ns);function x(...e){return Wa((0,ui.clsx)(e))}var to=ue(require("react")),Ao=ue(require("next/link"));var gi=require("class-variance-authority");var fi=require("react/jsx-runtime"),ss=(0,gi.cva)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ke({className:e,variant:t,...a}){return(0,fi.jsx)("div",{className:x(ss({variant:t}),e),...a})}var hi=require("@radix-ui/react-slot"),bi=ue(require("react")),xi=(0,gi.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"}}}),y=bi.forwardRef(({asChild:e=!1,className:t,size:a,variant:o,...n},r)=>(0,fi.jsx)(e?hi.Slot:"button",{className:x(xi({className:t,size:a,variant:o})),ref:r,...n}));y.displayName="Button";var wi=ue(require("react"));var le=wi.forwardRef(({className:e,type:t,...a},o)=>(0,fi.jsx)("input",{type:t,className:x("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:o,...a}));le.displayName="Input";var ko=ue(require("react")),at=ue(require("@radix-ui/react-scroll-area"));var Je=ko.forwardRef(({className:e,children:t,...a},o)=>(0,fi.jsxs)(at.Root,{ref:o,className:x("relative overflow-hidden",e),...a,children:[(0,fi.jsx)(at.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),(0,fi.jsx)(Ni,{}),(0,fi.jsx)(at.Corner,{})]}));Je.displayName=at.Root.displayName;var Ni=ko.forwardRef(({className:e,orientation:t="vertical",...a},o)=>(0,fi.jsx)(at.ScrollAreaScrollbar,{ref:o,orientation:t,className:x("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...a,children:(0,fi.jsx)(at.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Ni.displayName=at.ScrollAreaScrollbar.displayName;var ka=ue(require("react")),Le=ue(require("@radix-ui/react-dialog"));var Xe=Le.Root;var pa=Le.Portal;var Qt=ka.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Le.Overlay,{ref:a,className:x("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}));Qt.displayName=Le.Overlay.displayName;var bt=ka.forwardRef(({className:e,children:t,...a},o)=>(0,fi.jsxs)(pa,{children:[(0,fi.jsx)(Qt,{}),(0,fi.jsxs)(Le.Content,{ref:o,className:x("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-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...a,children:[t,(0,fi.jsxs)(Le.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,fi.jsx)(wn.fi,{className:"h-4 w-4"}),(0,fi.jsx)("span",{className:"Pr-only",children:"Close"})]})]})]}));bt.displayName=Le.Content.displayName;var xt=({className:e,...t})=>(0,fi.jsx)("div",{className:x("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});xt.displayName="DialogHeader";var Si=({className:e,...t})=>(0,fi.jsx)("div",{className:x("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Si.displayName="DialogFooter";var ot=ka.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Le.Title,{ref:a,className:x("text-lg font-semibold leading-none tracking-tight",e),...t}));ot.displayName=Le.Title.displayName;var ki=ka.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Le.Description,{ref:a,className:x("text-sm text-muted-foreground",e),...t}));ki.displayName=Le.Description.displayName;var Ta=ue(require("@radix-ui/react-checkbox")),Ai=ue(require("react")),Aa=Ai.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Ta.Root,{className:x("peer h-4 w-4 shrink-0 rounded border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),ref:a,...t,children:(0,fi.jsx)(Ta.Indicator,{className:x("flex items-center justify-center text-current"),children:(0,fi.jsx)(wn.Check,{className:"h-4 w-4"})})}));Aa.displayName=Ta.Root.displayName;var yt=e=>({id:Math.random().toString(36).substr(2,9),title:e,format:"markdown",createdAt:new Date});var Ri=[{id:"design",name:"Design",description:"Creative and visual design team",icon:(0,fi.jsx)(wn.Palette,{className:"h-4 w-4"}),color:"bg-purple-600",accentColor:"text-purple-600"},{id:"engineering",name:"Engineering",description:"Software development and technical teams",icon:(0,fi.jsx)(wn.Code,{className:"h-4 w-4"}),color:"bg-blue-600",accentColor:"text-blue-600"},{id:"marketing",name:"Marketing",description:"Brand, campaigns, and growth marketing",icon:(0,fi.jsx)(wn.TrendingUp,{className:"h-4 w-4"}),color:"bg-pink-600",accentColor:"text-pink-600"},{id:"sales",name:"Sales",description:"Revenue generation and customer acquisition",icon:(0,fi.jsx)(wn.DollarSign,{className:"h-4 w-4"}),color:"bg-green-600",accentColor:"text-green-600"},{id:"hr",name:"Human Resources",description:"People operations and talent management",icon:(0,fi.jsx)(wn.Users,{className:"h-4 w-4"}),color:"bg-orange-600",accentColor:"text-orange-600"},{id:"operations",name:"Operations",description:"Business operations and process optimization",icon:(0,fi.jsx)(wn.Wrench,{className:"h-4 w-4"}),color:"bg-indigo-600",accentColor:"text-indigo-600"},{id:"legal",name:"Legal",description:"Legal affairs and compliance",icon:(0,fi.jsx)(wn.Scale,{className:"h-4 w-4"}),color:"bg-slate-600",accentColor:"text-slate-600"},{id:"product",name:"Product",description:"Product strategy and management",icon:(0,fi.jsx)(wn.Package,{className:"h-4 w-4"}),color:"bg-violet-600",accentColor:"text-violet-600"},{id:"it",name:"IT Support",description:"Information technology and infrastructure",icon:(0,fi.jsx)(wn.Zap,{className:"h-4 w-4"}),color:"bg-cyan-600",accentColor:"text-cyan-600"},{id:"company",name:"Company",description:"Company-wide resources and information",icon:(0,fi.jsx)(wn.Building2,{className:"h-4 w-4"}),color:"bg-gray-600",accentColor:"text-gray-600"}],Xa=[{id:"1",name:"fi-commerce Platform",description:"Main customer-facing e-commerce application",isSelected:!0},{id:"2",name:"Admin Dashboard",description:"Internal administration and analytics dashboard",isSelected:!1},{id:"3",name:"Mobile App",description:"Native mobile application for iOS and Android",isSelected:!1}];var To=[{id:"1",name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date("2024-01-01"),endDate:new Date("2024-02-15"),progress:75,isSelected:!0},{id:"2",name:"Dashboard Features",color:"bg-green-500",description:"Build comprehensive dashboard functionality",confidence:"medium",phase:1,startDate:new Date("2024-02-01"),endDate:new Date("2024-03-15"),progress:30,isSelected:!0},{id:"3",name:"Mobile Optimization",color:"bg-purple-500",description:"Optimize application for mobile devices",confidence:"low",phase:1,startDate:new Date("2024-03-01"),endDate:new Date("2024-04-15"),progress:10,isSelected:!0},{id:"4",name:"Performance Improvements",color:"bg-orange-500",description:"Enhance application performance and speed",confidence:"high",phase:3,startDate:new Date("2024-01-15"),endDate:new Date("2024-02-28"),progress:90,isSelected:!0}],Ja=[{id:"backlog",name:"Backlog",description:"Tasks not yet assigned to a sprint",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!1},{id:"all-tasks",name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!0},{id:"1",name:"Sprint 1",description:"Initial development phase",startDate:new Date("2024-01-01"),endDate:new Date("2024-01-14"),isActive:!1,isSelected:!1},{id:"2",name:"Sprint 2",description:"Feature development",startDate:new Date("2024-01-15"),endDate:new Date("2024-01-28"),isActive:!0,isSelected:!1}],Ya=[{id:"1",name:"Design login page",description:"Create wireframes and mockups for the login interface",status:"todo",priority:"high",type:"story",points:5,epicId:"1",sprintId:"2",assignee:"John Doe",createdAt:new Date("2024-01-15")},{id:"2",name:"Implement OAuth integration",description:"Add Google and GitHub OAuth authentication",status:"review",priority:"high",type:"task",points:8,epicId:"1",sprintId:"2",assignee:"Jane Smith",createdAt:new Date("2024-01-16")},{id:"3",name:"Create dashboard widgets",description:"Build analytics and metrics widgets for the main dashboard",status:"todo",priority:"medium",type:"story",points:13,epicId:"2",sprintId:"2",assignee:"Mike Johnson",createdAt:new Date("2024-01-17")},{id:"4",name:"Fix login redirect bug",description:"Resolve issue where users are not redirected after login",status:"done",priority:"high",type:"bug",points:3,epicId:"1",sprintId:"1",assignee:"Sarah Wilson",createdAt:new Date("2024-01-14")},{id:"5",name:"Research mobile frameworks",description:"Investigate best practices for mobile responsive design",status:"in-progress",priority:"medium",type:"spike",points:5,epicId:"3",assignee:"Alex Brown",createdAt:new Date("2024-01-18")},{id:"6",name:"Update user profile page",description:"Enhance user profile with new settings and preferences",status:"review",priority:"medium",type:"story",points:8,epicId:"2",sprintId:"2",assignee:"Emma Davis",createdAt:new Date("2024-01-19")},{id:"7",name:"Performance optimization",description:"Optimize database queries and improve page load times",status:"done",priority:"high",type:"task",points:13,epicId:"4",sprintId:"1",assignee:"Tom Wilson",createdAt:new Date("2024-01-13")}],ls=[...Ya,{id:"8",name:"Add search functionality",description:"Implement search across all dashboard widgets",status:"todo",priority:"medium",type:"story",points:8,epicId:"2",sprintId:"2",assignee:"Chris Lee",createdAt:new Date("2024-01-20")},{id:"9",name:"Fix mobile responsive issues",description:"Resolve layout problems on mobile devices",status:"in-progress",priority:"high",type:"bug",points:5,epicId:"3",sprintId:"2",assignee:"Taylor Swift",createdAt:new Date("2024-01-21")},{id:"10",name:"Implement dark mode",description:"Add dark theme support across the application",status:"review",priority:"low",type:"story",points:13,epicId:"2",sprintId:"2",assignee:"Jordan Smith",createdAt:new Date("2024-01-22")},{id:"11",name:"API rate limiting",description:"Implement rate limiting for API endpoints",status:"done",priority:"high",type:"task",points:8,epicId:"4",sprintId:"1",assignee:"Morgan Davis",createdAt:new Date("2024-01-12")},{id:"12",name:"User onboarding flow",description:"Create guided tour for new users",status:"todo",priority:"medium",type:"story",points:21,epicId:"1",sprintId:"2",assignee:"Casey Johnson",createdAt:new Date("2024-01-23")}],ds=[...Xa,{id:"4",name:"Analytics Platform",description:"Business intelligence and reporting system",isSelected:!1},{id:"5",name:"API Gateway",description:"Microservices API management layer",isSelected:!1}],qa={projects:[{id:"1",name:"Empty Project",description:"fi project with no tasks",isSelected:!0}],epics:[],sprints:[{id:"all-tasks",name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!0}],tasks:[]},Pi={epics:[{id:"1",name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date("2024-01-01"),endDate:new Date("2024-02-15"),progress:75,isSelected:!0}],tasks:Ya.filter(e=>e.epicId==="1")};var rl={empty:{initialProjects:qa.projects,initialEpics:qa.epics,initialSprints:qa.sprints,initialTasks:qa.tasks},default:{initialProjects:Xa,initialEpics:To,initialSprints:Ja,initialTasks:Ya},highDensity:{initialProjects:Xa,initialEpics:To,initialSprints:Ja,initialTasks:ls},singleEpic:{initialProjects:Xa,initialEpics:Pi.epics,initialSprints:Ja,initialTasks:Pi.tasks},multipleProjects:{initialProjects:ds,initialEpics:To,initialSprints:Ja,initialTasks:Ya}},Za=[{id:"1",type:"human",name:"Sarah Johnson",email:"sarah.johnson@company.com",role:"Senior Designer",department:"Design",status:"active",joinedDate:new Date("2023-01-15"),lastActive:new Date,phone:"+1 (555) 123-4567",location:"San Francisco, CA",timezone:"PST",skills:["UI/UX Design","Figma","Adobe Creative Suite","Prototyping","User Research"],bio:"Passionate designer with 8+ years of experience creating user-centered digital experiences."},{id:"2",type:"digital",name:"CodeAssist Pro",status:"active",joinedDate:new Date("2024-01-01"),lastActive:new Date,jobDescription:"AI-powered coding assistant that helps with code review, debugging, and documentation generation.",workInstructions:"Review pull requests for code quality and best practices. Generate comprehensive documentation for new features. Assist with debugging complex issues. Provide code suggestions and optimizations.",capabilities:["Code Review","Documentation Generation","Debugging","Code Optimization","Testing"],knowledge:["JavaScript","TypeScript","React","Node.js","Python","Git"].map(yt),coreKnowledge:["Company coding standards","Architecture patterns","Security guidelines"].map(yt),version:"2",lastUpdated:new Date("2024-01-15"),isActive:!0},{id:"3",type:"human",name:"Michael Chen",email:"michael.chen@company.com",role:"Product Manager",department:"Product",status:"inactive",joinedDate:new Date("2022-08-20"),lastActive:new Date(Date.now()-2*60*60*1e3),phone:"+1 (555) 987-6543",location:"New York, NY",timezone:"EST",skills:["Product Strategy","Agile","Data Analysis","User Stories","Roadmapping"],bio:"Strategic product manager focused on driving user engagement and business growth."},{id:"4",type:"digital",name:"MarketingBot",status:"active",joinedDate:new Date("2024-02-01"),lastActive:new Date,jobDescription:"Specialized AI assistant for marketing campaigns, content creation, and social media management.",workInstructions:"Create engaging social media content. Analyze campaign performance metrics. Generate marketing copy and headlines. Schedule and manage social media posts.",capabilities:["Content Creation","Social Media Management","Analytics","SEO Optimization","Campaign Management"],knowledge:["Digital Marketing","Social Media Platforms","Content Strategy","Analytics Tools"].map(yt),coreKnowledge:["Brand guidelines","Target audience personas","Marketing objectives"].map(yt),version:"52",lastUpdated:new Date("2024-02-10"),isActive:!0},{id:"5",type:"human",name:"Emily Rodriguez",email:"emily.rodriguez@company.com",role:"UX Researcher",department:"Design",status:"inactive",joinedDate:new Date("2023-06-10"),lastActive:new Date(Date.now()-7*24*60*60*1e3),phone:"+1 (555) 456-7890",location:"Austin, TX",timezone:"CST",skills:["User Research","Usability Testing","Data Analysis","Survey Design","Interview Techniques"],bio:"User researcher dedicated to understanding user needs and improving product experiences."},{id:"6",type:"digital",name:"DataAnalyzer Pro",status:"active",joinedDate:new Date("2024-01-10"),lastActive:new Date,jobDescription:"Advanced AI assistant specializing in data analysis, reporting, and business intelligence.",workInstructions:"Analyze complex datasets, generate insightful reports, create data visualizations, and provide actionable business recommendations.",capabilities:["Data Analysis","Report Generation","Data Visualization","Business Intelligence","Statistical Analysis"],knowledge:["Python","SQL","Tableau","Excel","R","Statistics"].map(yt),coreKnowledge:["Company data sources","KPI definitions","Reporting standards"].map(yt),version:"3.1",lastUpdated:new Date("2024-02-20"),isActive:!0},{id:"7",type:"digital",name:"ProjectManager AI",status:"active",joinedDate:new Date("2024-01-05"),lastActive:new Date,jobDescription:"Intelligent project management assistant that helps coordinate tasks, track progress, and manage timelines.",workInstructions:"Coordinate project activities, track milestones, manage resource allocation, and provide project status updates.",capabilities:["Project Planning","Task Coordination","Timeline Management","Resource Allocation","Progress Tracking"],knowledge:["Agile","Scrum","Gantt Charts","Risk Management","Stakeholder Management"].map(yt),coreKnowledge:["Company project templates","Resource availability","Project methodologies"].map(yt),version:"2.5",lastUpdated:new Date("2024-02-15"),isActive:!0},{id:"8",type:"digital",name:"CustomerSupport Bot",status:"active",joinedDate:new Date("2024-02-01"),lastActive:new Date,jobDescription:"AI-powered customer support assistant that handles inquiries, resolves issues, and escalates complex problems.",workInstructions:"Respond to customer inquiries, troubleshoot common issues, provide product information, and escalate complex cases to human agents.",capabilities:["Customer Support","Issue Resolution","Product Knowledge","Escalation Management","Chat Support"],knowledge:["Product Documentation","FAQ","Troubleshooting Guides","Customer Service Best Practices"].map(yt),coreKnowledge:["Product catalog","Support processes","Escalation procedures"].map(yt),version:"1.8",lastUpdated:new Date("2024-02-25"),isActive:!0}],nl=[{id:"1",title:"Review quarterly report",description:"Go through Q4 performance metrics and prepare summary for the team meeting",dueDate:new Date(2024,2,15),dueTime:"14:30",colleague:Za.find(e=>e.id==="2"&&e.type==="digital"),isCompleted:!1,isRecurring:!1,priority:"high",reminderEnabled:!0,reminderMinutes:30,createdAt:new Date(2024,2,10),tags:["quarterly","review","urgent"]},{id:"2",title:"Weekly team standup",description:"Join the weekly team synchronization meeting",dueDate:new Date(2024,2,18),dueTime:"10:00",colleague:Za.find(e=>e.id==="4"&&e.type==="digital"),isCompleted:!1,isRecurring:!0,recurrencePattern:"weekly",recurrenceInterval:1,priority:"medium",reminderEnabled:!0,reminderMinutes:15,createdAt:new Date(2024,2,11),tags:["meeting","standup","weekly"]},{id:"3",title:"Deploy to production",description:"Deploy the latest version to production environment",dueDate:new Date,dueTime:"16:00",colleague:Za.find(e=>e.id==="2"&&e.type==="digital"),isCompleted:!1,isRecurring:!1,priority:"high",reminderEnabled:!0,reminderMinutes:60,createdAt:new Date,tags:["deploy","production","urgent"]}];var sl=Za.filter(e=>e.type==="digital");function eo(e,t){let[a,o]=(0,ii.useState)(()=>{if(typeof window>"u")return t;try{let r=window.localStorage.getItem(e);return r?JSON.parse(r):t}catch{return t}}),n=r=>{try{o(r),typeof window<"u"&&window.localStorage.setItem(e,JSON.stringify(r))}catch{}};return(0,ii.useEffect)(()=>{n(a)},[]),[a,n]}function Po({items:e,isOpen:t,isMobile:a=!1,onClose:o,currentBusinessUnit:n=Ri[0],onBusinessUnitChange:r,onSearch:i,className:l,logo:c="/headerlogo.png",appName:d="Nuvia",tagline:f="Collaboration Platform"}){let[m,p]=to.useState({}),[v,h]=eo("sidebar-favorites",{}),[u,s]=to.useState(null),[g,N]=to.useState(""),R=w=>{p(C=>({...C,[w]:!C[w]}))},S=w=>{r?.(w)},$=()=>{g.trim()&&i?.(g.trim())},ee=w=>{w.key==="Enter"&&(w.preventDefault(),$())},_=(w,C)=>{let U=v[w]||[],k=U.includes(C)?U.filter(fe=>fe!==C):U.concat(C);h({...v,[w]:k})},b=w=>{if(!w.items||!w.maxItems||w.items.length<=w.maxItems)return w.items||[];let C=v[w.id]||[],U=w.items.filter(fe=>C.includes(fe.id)),k=w.items.filter(fe=>!C.includes(fe.id));return[...U,...k].slice(0,w.maxItems)},z=w=>w.maxItems&&w.items&&w.items.length>w.maxItems,V=e,j=w=>{let C=z(w),U=b(w),k=(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[w.icon,(0,fi.jsx)("span",{children:w.title})]}),w.badge&&(0,fi.jsx)(ke,{variant:"outline",className:"ml-auto rounded-full px-2 py-0.5 text-xs",children:w.badge}),w.items&&(0,fi.jsx)(wn.ChevronDown,{className:x("ml-2 h-4 w-4 transition-transform",m[w.title]?"rotate-180":"")})]}),fe=x("flex w-full items-center justify-between rounded-2xl px-3 py-2 text-sm font-medium",w.isActive?"bg-primary/10 text-primary":"hover:bg-muted");return w.url?(0,fi.jsx)(Ao.default,{href:w.url,className:fe,onClick:a?o:void 0,children:k}):(0,fi.jsx)("button",{className:fe,onClick:()=>w.items&&R(w.title),children:k})},D=()=>{let w=e.find(U=>U.id===u);if(!w||!w.items||!w.maxItems)return null;let C=v[w.id]||[];return(0,fi.jsx)(Xe,{open:!!u,onOpenChange:U=>!U&&s(null),children:(0,fi.jsxs)(bt,{className:"sm:max-w-md",children:[(0,fi.jsxs)(xt,{children:[(0,fi.jsxs)(ot,{children:["Manage ",w.title," Favorites"]}),(0,fi.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Select up to ",w.maxItems," items to show in ",w.title.toLowerCase(),"."]})]}),(0,fi.jsx)(Je,{className:"max-h-96 fi-4",children:(0,fi.jsx)("div",{className:"space-y-4",children:w.items.map(U=>(0,fi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,fi.jsx)(Aa,{id:U.id,checked:C.includes(U.id),onCheckedChange:()=>_(w.id,U.id),disabled:!C.includes(U.id)&&C.length>=(w.maxItems||0)}),(0,fi.jsxs)("label",{htmlFor:U.id,className:"flex items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer flex-1",children:[U.title,U.badge&&(0,fi.jsx)(ke,{variant:"outline",className:"text-xs",children:U.badge})]})]},U.id))})})]})})},Te=(0,fi.jsxs)("div",{className:"flex h-full flex-col bg-background",children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,fi.jsx)("div",{className:"flex h-14 w-14 items-center justify-center",children:(0,fi.jsx)("img",{src:c,alt:"Header Logo",className:"h-14 w-14 object-contain"})}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h2",{className:"font-semibold",children:d}),(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:f})]})]}),a&&(0,fi.jsx)(y,{variant:"ghost",size:"icon",onClick:o,children:(0,fi.jsx)(wn.fi,{className:"h-5 w-5"})})]}),(0,fi.jsx)("div",{className:"px-3 py-2",children:(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)(wn.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,fi.jsx)(le,{type:"search",placeholder:"Search...",className:"w-full rounded-2xl bg-muted pl-9 fi-4 py-2",value:g,onChange:w=>N(w.target.value),onKeyPress:ee})]})}),(0,fi.jsx)(Je,{className:"flex-1 px-3 py-2",children:(0,fi.jsx)("div",{className:"space-y-1",children:V.map(w=>(0,fi.jsxs)("div",{className:"mb-1",children:[j(w),w.items&&m[w.title]&&(0,fi.jsxs)("div",{className:"fi-1 ml-6 space-y-1 border-l pl-3",children:[b(w).map(C=>(0,fi.jsxs)(Ao.default,{href:C.url,className:"flex items-center justify-between rounded-2xl px-3 py-2 text-sm hover:bg-muted",onClick:a?o:void 0,children:[C.title,C.badge&&(0,fi.jsx)(ke,{variant:"outline",className:"ml-auto rounded-full px-2 py-0.5 text-xs",children:C.badge})]},C.id)),z(w)&&w.items&&w.items.length>b(w).length&&(0,fi.jsxs)("button",{onClick:()=>s(w.id),className:"w-full px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted rounded-2xl transition-colors text-left",children:["...",w.items.length-b(w).length," more available"]})]})]},w.id))})}),(0,fi.jsx)("div",{className:"p-3",children:(0,fi.jsx)("div",{className:"space-y-1",children:(0,fi.jsxs)("button",{className:"flex w-full items-center gap-3 rounded-2xl px-3 py-2 text-sm font-medium hover:bg-muted",children:[(0,fi.jsx)(wn.Settings,{className:"h-5 w-5"}),(0,fi.jsx)("span",{children:"Settings"})]})})}),(0,fi.jsx)(D,{})]});return a?(0,fi.jsx)("div",{className:x("fixed inset-y-0 left-0 z-50 w-64 transform bg-background transition-transform duration-300 ease-in-out",t?"translate-x-0":"-translate-x-full",l),children:Te}):(0,fi.jsx)("div",{className:x("fixed inset-y-0 left-0 z-30 w-64 transform bg-background transition-transform duration-300 ease-in-out",t?"translate-x-0":"-translate-x-full",l),children:Te})}var ao=ue(require("react")),Tt=ue(require("@radix-ui/react-avatar"));var At=ao.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Tt.Root,{ref:a,className:x("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));At.displayName=Tt.Root.displayName;var Pa=ao.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Tt.Image,{ref:a,className:x("aspect-square h-full w-full",e),...t}));Pa.displayName=Tt.Image.displayName;var Pt=ao.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Tt.Fallback,{ref:a,className:x("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));Pt.displayName=Tt.Fallback.displayName;var Mi=ue(require("react")),lt=ue(require("@radix-ui/react-tooltip"));var Vt=lt.Provider,$t=lt.Root,_t=lt.Trigger,Rt=Mi.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,fi.jsx)(lt.Portal,{children:(0,fi.jsx)(lt.Content,{ref:o,sideOffset:t,className:x("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),...a})}));Rt.displayName=lt.Content.displayName;var Ii=require("next-themes");function Li(){let{setTheme:e,theme:t}=(0,Ii.useTheme)();return(0,fi.jsx)(Vt,{children:(0,fi.jsxs)($t,{children:[(0,fi.jsx)(_t,{asChild:!0,children:(0,fi.jsxs)(y,{variant:"ghost",size:"icon",className:"rounded-2xl",onClick:()=>e(t==="light"?"dark":"light"),children:[(0,fi.jsx)(wn.Sun,{className:"h-5 w-5 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),(0,fi.jsx)(wn.Moon,{className:"absolute h-5 w-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),(0,fi.jsx)("span",{className:"Pr-only",children:"Toggle theme"})]})}),(0,fi.jsx)(Rt,{children:"Toggle theme"})]})})}function Bi({notifications:e,open:t,onClose:a,onNotificationRemove:o,onRemoveAll:n,className:r}){let i=e.filter(d=>!d.read),l=i.length,c=d=>{switch(d){case"info":return(0,fi.jsx)(wn.Info,{className:"h-5 w-5 text-blue-500"});case"success":return(0,fi.jsx)(wn.Check,{className:"h-5 w-5 text-green-500"});case"warning":return(0,fi.jsx)(wn.AlertTriangle,{className:"h-5 w-5 text-amber-500"});case"error":return(0,fi.jsx)(wn.AlertTriangle,{className:"h-5 w-5 text-red-500"})}};return(0,fi.jsx)(Co.AnimatePresence,{children:t&&(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsx)(Co.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-40 bg-black/20 backdrop-blur-sm md:hidden",onClick:a}),(0,fi.jsx)(Co.motion.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:20,stiffness:300},className:x("fixed inset-y-0 right-0 z-50 w-full max-w-sm border-l bg-background shadow-lg md:w-96",r),children:(0,fi.jsxs)("div",{className:"flex h-full flex-col",children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between border-b p-4",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,fi.jsx)(wn.Bell,{className:"h-5 w-5"}),(0,fi.jsx)("h2",{className:"text-lg font-semibold",children:"Notifications"}),l>0&&(0,fi.jsxs)(ke,{variant:"secondary",className:"rounded-full px-2 py-0.5",children:[l," new"]})]}),(0,fi.jsxs)(y,{variant:"ghost",size:"icon",onClick:a,className:"rounded-full",children:[(0,fi.jsx)(wn.fi,{className:"h-5 w-5"}),(0,fi.jsx)("span",{className:"Pr-only",children:"Close"})]})]}),l>0&&(0,fi.jsxs)("div",{className:"flex items-center justify-between border-b p-2",children:[(0,fi.jsxs)("span",{className:"text-sm text-muted-foreground",children:[l," unread notification",l!==1?"s":""]}),(0,fi.jsx)(y,{variant:"ghost",size:"sm",onClick:n,className:"text-sm",children:"Dismiss all"})]}),i.length>0?(0,fi.jsx)(Je,{className:"flex-1",children:(0,fi.jsx)("div",{className:"divide-y",children:i.map(d=>(0,fi.jsxs)("div",{className:x("flex gap-3 p-4 transition-colors bg-muted/50"),children:[(0,fi.jsx)("div",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-muted",children:c(d.type)}),(0,fi.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,fi.jsx)("p",{className:"font-medium",children:d.title}),(0,fi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:d.time}),(0,fi.jsx)(y,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>o?.(d.id),title:"Dismiss",children:(0,fi.jsx)(wn.Check,{className:"h-3 w-3"})})]})]}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:d.description}),d.actionLabel&&(0,fi.jsxs)(y,{variant:"link",size:"sm",className:"h-auto p-0 text-sm",onClick:d.onAction,children:[d.actionLabel,(0,fi.jsx)(wn.ChevronRight,{className:"ml-1 h-3 w-3"})]})]})]},d.id))})}):(0,fi.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center p-8 text-center",children:[(0,fi.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-muted",children:(0,fi.jsx)(wn.Bell,{className:"h-8 w-8 text-muted-foreground"})}),(0,fi.jsx)("h3",{className:"fi-4 text-lg font-medium",children:"No notifications"}),(0,fi.jsx)("p",{className:"fi-2 text-sm text-muted-foreground",children:"When you receive notifications, they'll appear here."})]})]})})]})})}var ea=ue(require("@radix-ui/react-tabs"));function Ei({className:e,...t}){return(0,fi.jsx)(ea.Root,{"data-slot":"tabs",className:x("flex flex-col gap-2",e),...t})}function Fi({className:e,...t}){return(0,fi.jsx)(ea.List,{"data-slot":"tabs-list",className:x("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function Hi({className:e,...t}){return(0,fi.jsx)(ea.Trigger,{"data-slot":"tabs-trigger",className:x("data-[state=active]:bg-accent data-[state=active]:text-accent-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}var Mt=ue(require("react")),re=ue(require("@radix-ui/react-dropdown-menu")),ua=require("@radix-ui/react-icons");var dt=re.Root,ct=re.Trigger;var ji=Mt.forwardRef(({className:e,inset:t,children:a,...o},n)=>(0,fi.jsxs)(re.SubTrigger,{ref:n,className:x("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),...o,children:[a,(0,fi.jsx)(ua.ChevronRightIcon,{className:"ml-auto"})]}));ji.displayName=re.SubTrigger.displayName;var Ui=Mt.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(re.SubContent,{ref:a,className:x("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}));Ui.displayName=re.SubContent.displayName;var it=Mt.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,fi.jsx)(re.Portal,{children:(0,fi.jsx)(re.Content,{ref:o,sideOffset:t,className:x("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),...a})}));it.displayName=re.Content.displayName;var ze=Mt.forwardRef(({className:e,inset:t,...a},o)=>(0,fi.jsx)(re.Item,{ref:o,className:x("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),...a}));ze.displayName=re.Item.displayName;var Ki=Mt.forwardRef(({className:e,children:t,checked:a,...o},n)=>(0,fi.jsxs)(re.CheckboxItem,{ref:n,className:x("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 fi-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:a,...o,children:[(0,fi.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,fi.jsx)(re.ItemIndicator,{children:(0,fi.jsx)(ua.CheckIcon,{className:"h-4 w-4"})})}),t]}));Ki.displayName=re.CheckboxItem.displayName;var Oi=Mt.forwardRef(({className:e,children:t,...a},o)=>(0,fi.jsxs)(re.RadioItem,{ref:o,className:x("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 fi-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[(0,fi.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,fi.jsx)(re.ItemIndicator,{children:(0,fi.jsx)(ua.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));Oi.displayName=re.RadioItem.displayName;var zi=Mt.forwardRef(({className:e,inset:t,...a},o)=>(0,fi.jsx)(re.Label,{ref:o,className:x("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...a}));zi.displayName=re.Label.displayName;var Vi=Mt.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(re.Separator,{ref:a,className:x("-mx-1 my-1 h-px bg-muted",e),...t}));Vi.displayName=re.Separator.displayName;var $i=({className:e,...t})=>(0,fi.jsx)("span",{className:x("ml-auto text-xs tracking-widest opacity-60",e),...t});$i.displayName="DropdownMenuShortcut";function no({activeTab:e,onTabChange:t,tabOptions:a,className:o="",maxWidth:n="700px",gridCols:r=6}){let i=a.find(l=>l.value===e);return(0,fi.jsxs)(Co.motion.div,{className:`flex-1 flex justify-center ${o}`,initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},children:[(0,fi.jsx)("div",{className:"hidden lg:block",children:(0,fi.jsx)(Ei,{value:e,onValueChange:t,children:(0,fi.jsx)(Fi,{className:"grid w-full rounded-2xl p-0 h-10",style:{maxWidth:n,gridTemplateColumns:`repeat(${Math.min(r,a.length)}, minmax(0, 1fr))`},children:a.map(l=>(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.1},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:17},className:"flex-1 px-2",children:(0,fi.jsx)(Hi,{value:l.value,className:"w-full h-8 rounded-xl data-[state=active]:rounded-xl transition-all duration-200 hover:border hover:border-accent hover:bg-accent/10 px-4 py-2 text-sm font-medium",children:l.label})},l.value))})})}),(0,fi.jsx)("div",{className:"lg:hidden",children:(0,fi.jsxs)(dt,{children:[(0,fi.jsx)(ct,{asChild:!0,children:(0,fi.jsxs)(y,{variant:"outline",className:"rounded-2xl min-w-[140px] justify-between",children:[i?.label||"Select",(0,fi.jsx)(wn.ChevronDown,{className:"h-4 w-4 ml-2"})]})}),(0,fi.jsx)(it,{align:"center",className:"w-[180px]",children:a.map(l=>(0,fi.jsx)(ze,{onClick:()=>t?.(l.value),className:`cursor-pointer ${e===l.value?"bg-accent":""}`,children:l.label},l.value))})]})})]})}function Wi({title:e,notifications:t=[],onToggleSidebar:a,onToggleMobileMenu:o,sidebarOpen:n=!0,className:r,activeTab:i="assistant",onTabChange:l,showTabs:c=!0,tabOptions:d=[{value:"home",label:"Home"},{value:"chat",label:"Chat"},{value:"projects",label:"Projects"},{value:"colleagues",label:"Colleagues"},{value:"knowledge",label:"Knowledge"}],onActionClick:f,actionIcon:m=(0,fi.jsx)(wn.Bot,{className:"co-2 h-4 w-4"}),actionText:p="Action",onNotificationRemove:v,onRemoveAll:h,logo:u="/headerlogo.png",appName:s="Nuvia",tagline:g="Collaboration Platform"}){let[N,R]=(0,ii.useState)(!1),[S,$]=(0,ii.useState)(t),ee=S.filter(z=>!z.read).length,_=z=>{$(V=>V.filter(j=>j.id!==z)),v?.(z)},b=()=>{$(z=>z.filter(V=>V.read)),h?.()};return(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsxs)("header",{className:`sticky top-0 z-10 flex h-16 items-center gap-3 pl-2 fi-4 backdrop-blur ${r||""}`,children:[(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"md:hidden",onClick:o,children:(0,fi.jsx)(wn.Menu,{className:"h-5 w-5"})}),(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:a,children:(0,fi.jsx)(wn.PanelLeft,{className:"h-5 w-5"})}),!n&&(0,fi.jsxs)(Co.motion.div,{className:"flex items-center gap-3",initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.3},children:[(0,fi.jsx)("div",{className:"flex h-10 w-10 items-center justify-center",children:(0,fi.jsx)("img",{src:u,alt:"Logo",className:"h-10 w-10 object-contain"})}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h2",{className:"font-semibold text-sm",children:s}),(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:g})]})]}),(0,fi.jsxs)("div",{className:"flex flex-1 items-center",children:[c&&(0,fi.jsx)(no,{activeTab:i,onTabChange:l,tabOptions:d}),(0,fi.jsxs)("div",{className:"flex items-center gap-3 ml-auto",children:[(0,fi.jsx)(Co.motion.div,{className:"hidden md:flex gap-2",initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.3,ease:"easeOut",delay:.1},children:(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.05},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:17},children:(0,fi.jsxs)(y,{className:"rounded-2xl transition-all duration-200 hover:shadow-md",onClick:f,children:[m,p]})})}),(0,fi.jsx)(Li,{}),(0,fi.jsx)(Vt,{children:(0,fi.jsxs)($t,{children:[(0,fi.jsx)(_t,{asChild:!0,children:(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.05},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:17},children:(0,fi.jsxs)(y,{variant:"ghost",size:"icon",className:"rounded-2xl relative transition-all duration-200",onClick:()=>R(!0),children:[(0,fi.jsx)(Co.motion.div,{animate:ee>0?{rotate:[0,-10,10,-10,0]}:{},transition:{duration:.5,repeat:ee>0?1/0:0,repeatDelay:3},children:(0,fi.jsx)(wn.Bell,{className:"h-5 w-5"})}),ee>0&&(0,fi.jsx)(Co.motion.span,{className:"absolute -right-1 -top-1 flex h-5 w-5 items-center justify-center rounded-full bg-red-500 text-xs text-white",initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:500,damping:15},children:ee})]})})}),(0,fi.jsx)(Rt,{children:"Notifications"})]})}),(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.05},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:17},children:(0,fi.jsxs)(At,{className:"h-9 w-9 border-2 border-primary transition-all duration-200 hover:shadow-md cursor-pointer",children:[(0,fi.jsx)(Pa,{src:"/placeholder.svg?height=40&width=40",alt:"User"}),(0,fi.jsx)(Pt,{})]})})]})]})]}),(0,fi.jsx)(Bi,{notifications:S,open:N,onClose:()=>R(!1),onNotificationRemove:_,onRemoveAll:b})]})}var Gi=[{id:"copilot",name:"Peronal Copilot",description:"Your personal AI assistant for all tasks",icon:(0,fi.jsx)(wn.User,{className:"h-4 w-4"}),color:"bg-orange-600",accentColor:"text-orange-600"}];function qi({sidebarItems:e,children:t,title:a="Digital Colleagues",notifications:o=[],currentBusinessUnit:n=Gi[0],onBusinessUnitChange:r,onSearch:i,businessUnits:l=Gi,activeTab:c,onTabChange:d,showTabs:f=!1,onActionClick:m,actionIcon:p,actionText:v="Action",onNotificationRemove:h,onRemoveAll:u,logo:s="/headerlogo.png",appName:g="Nuvia",tagline:N="Collaboration Platform",sidebarInitiallyClosed:R=!1}){let[S,$]=(0,ii.useState)(!R),[ee,_]=(0,ii.useState)(!1),[b,z]=(0,ii.useState)(n),V=j=>{z(j),r?.(j)};return(0,fi.jsxs)("div",{className:"flex h-full flex-col overflow-hidden rounded-xl bg-background w-[]",children:[ee&&(0,fi.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50 md:hidden",onClick:()=>_(!1)}),(0,fi.jsx)("div",{className:"md:hidden",children:(0,fi.jsx)(Po,{items:e,isOpen:ee,isMobile:!0,onClose:()=>_(!1),currentBusinessUnit:b,onBusinessUnitChange:V,onSearch:i,logo:s,appName:g,tagline:N})}),(0,fi.jsx)("div",{className:"hidden md:block",children:(0,fi.jsx)(Po,{items:e,isOpen:S,isMobile:!1,currentBusinessUnit:b,onBusinessUnitChange:V,onSearch:i,logo:s,appName:g,tagline:N})}),(0,fi.jsxs)("div",{className:x("min-h-screen fixed w-full transition-all duration-300 ease-in-out",S?"md:pl-64":"md:pl-0"),children:[(0,fi.jsx)(Wi,{title:a,notifications:o,onToggleSidebar:()=>$(!S),onToggleMobileMenu:()=>_(!0),sidebarOpen:S,activeTab:c,onTabChange:d,showTabs:f,onActionClick:m,actionIcon:p,actionText:v,onNotificationRemove:h,onRemoveAll:u,logo:s,appName:g,tagline:N}),(0,fi.jsx)("main",{className:"flex-1 p-0 flex flex-col h-[calc(100vh-4rem)] overflow-hidden",children:t})]})]})}var lo=require("react-icons/fa");function It({title:e,description:t,badge:a,primaryAction:o,secondaryAction:n,gradient:r,children:i,className:l}){let[c,d]=eo(`hero-section-minimized-${e.replace(/\s+/g,"-").toLowerCase()}`,!n&&!t),f=!n&&!t||c;return(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:`overflow-hidden rounded-3xl ${r} p-8 text-white ${l||""}`,children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[a&&(0,fi.jsx)(ke,{className:"bg-white/20 text-white hover:bg-white/30 rounded-xl",children:a}),(0,fi.jsx)("h2",{className:"text-3xl font-bold m-0",children:e})]}),(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[f&&o&&(0,fi.jsx)(y,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:o.onClick,children:o.label}),(n||t)&&(0,fi.jsx)("button",{"aria-label":c?"Expand hero section":"Minimize hero section",className:"rounded-full bg-white/20 hover:bg-white/30 p-1 text-white transition-colors",onClick:()=>d(!c),style:{lineHeight:0},children:c?(0,fi.jsx)(lo.FaChevronDown,{size:22}):(0,fi.jsx)(lo.FaChevronUp,{size:22})})]})]}),!f&&(0,fi.jsxs)("div",{className:"flex flex-col gap-6 md:flex-row md:items-center md:justify-between",children:[(0,fi.jsxs)("div",{className:"space-y-4",children:[(0,fi.jsx)("p",{className:"max-w-[600px] text-white/80",children:t}),(0,fi.jsxs)("div",{className:"flex flex-wrap gap-3",children:[o&&(0,fi.jsx)(y,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:o.onClick,children:o.label}),n&&(0,fi.jsx)(y,{variant:"outline",className:"rounded-2xl bg-transparent border-white text-white hover:bg-white/10",onClick:n.onClick,children:n.label})]})]}),i&&(0,fi.jsx)("div",{className:"hidden lg:block",children:i})]})]})}var ta=ue(require("react"));var ce=ta.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("div",{ref:a,className:x("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ce.displayName="Card";var Ce=ta.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("div",{ref:a,className:x("flex flex-col space-y-1.5 p-6",e),...t}));Ce.displayName="CardHeader";var Pe=ta.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("div",{ref:a,className:x("font-semibold leading-none tracking-tight",e),...t}));Pe.displayName="CardTitle";var Ma=ta.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("div",{ref:a,className:x("text-sm text-muted-foreground",e),...t}));Ma.displayName="CardDescription";var me=ta.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("div",{ref:a,className:x("p-6 pt-0",e),...t}));me.displayName="CardContent";var Ia=ta.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("div",{ref:a,className:x("flex items-center p-6 pt-0",e),...t}));Ia.displayName="CardFooter";var Zi=ue(require("react")),La=ue(require("@radix-ui/react-progress"));var Ba=Zi.forwardRef(({className:e,value:t,...a},o)=>(0,fi.jsx)(La.Root,{ref:o,className:x("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...a,children:(0,fi.jsx)(La.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Ba.displayName=La.Root.displayName;function Bo({app:e,onOpen:t,onFavorite:a,showProgress:o=!1,className:n}){return(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:n,children:(0,fi.jsxs)(ce,{className:"overflow-hidden rounded-3xl border-2 hover:border-primary/50 transition-all duration-300",children:[(0,fi.jsx)(Ce,{className:"pb-2",children:(0,fi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,fi.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl bg-muted",children:e.icon}),e.new?(0,fi.jsx)(ke,{className:"rounded-xl bg-amber-500",children:"New"}):(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-2xl",onClick:()=>a?.(e),children:(0,fi.jsx)(wn.Star,{className:"h-4 w-4"})})]})}),(0,fi.jsxs)(me,{className:"pb-2",children:[(0,fi.jsx)(Pe,{className:"text-lg",children:e.name}),(0,fi.jsx)(Ma,{children:e.description}),o&&e.progress<100&&(0,fi.jsxs)("div",{className:"fi-2",children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,fi.jsx)("span",{children:"Installation"}),(0,fi.jsxs)("span",{children:[e.progress,"%"]})]}),(0,fi.jsx)(Ba,{value:e.progress,className:"h-2 fi-1 rounded-xl"})]})]}),(0,fi.jsx)(Ia,{children:(0,fi.jsx)(y,{variant:"secondary",className:"w-full rounded-2xl",onClick:()=>t?.(e),children:e.progress<100?"Continue Install":"Open"})})]})})}var Wr=ue(require("@radix-ui/react-dialog"));var er=ue(require("react")),Ze=er.forwardRef(({className:e,...t},a)=>(0,fi.jsx)("textarea",{className:x("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:a,...t}));Ze.displayName="Textarea";var ar=ue(require("react")),Eo=ue(require("@radix-ui/react-label"));var cs=(0,gi.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ne=ar.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(Eo.Root,{ref:a,className:x(cs(),e),...t}));Ne.displayName=Eo.Root.displayName;var Ea=({fieldName:e,value:t,label:a,multiline:o=!1,onSave:n,className:r="",disabled:i=!1})=>{let[l,c]=(0,ii.useState)(!1),[d,f]=(0,ii.useState)(""),m=()=>{i||(c(!0),f(t))},p=async()=>{d!==t&&await n(e,d),c(!1)},v=h=>{h.key==="Enter"&&!o||h.key==="Enter"&&h.ctrlKey&&o?p():h.key==="Escape"&&(c(!1),f(""))};return(0,fi.jsxs)("div",{className:`space-y-2 ${r}`,children:[(0,fi.jsx)(Ne,{children:a}),l?o?(0,fi.jsx)(Ze,{value:d,onChange:h=>f(h.target.value),onBlur:p,onKeyDown:v,autoFocus:!0,rows:4,className:"resize-none"}):(0,fi.jsx)(le,{value:d,onChange:h=>f(h.target.value),onBlur:p,onKeyPress:v,autoFocus:!0,className:"text-lg font-medium"}):(0,fi.jsxs)("div",{onClick:m,className:`${i?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted/50 p-2 rounded border border-transparent hover:border-border transition-colors group ${o?"min-h-[100px]":"min-h-[40px]"} flex items-start gap-2`,children:[(0,fi.jsx)("span",{className:o?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click to edit..."}),!i&&(0,fi.jsx)(wn.Edit,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var Mr=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),Ir=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),Lr=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),Br=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),Er=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),Fr=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),Hr=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),po=require("@payloadcms/richtext-lexical/lexical/list"),jr=require("@payloadcms/richtext-lexical/lexical/rich-text"),Ur=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var Pr=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),Ua=require("@payloadcms/richtext-lexical/lexical/utils"),ae=require("@payloadcms/richtext-lexical/lexical"),Wo=require("@payloadcms/richtext-lexical/lexical/selection");var fr=require("@radix-ui/react-dialog"),co=require("@payloadcms/richtext-lexical/client");var Ho=ue(require("bson-objectid"));var nr=require("@payloadcms/ui");var ms=e=>{let{data:{relationTo:t,value:a},nodeKey:o}=e,[n]=(0,Pr.useLexicalComposerContext)(),[r,i]=(0,ii.useState)(""),[l,c]=(0,ii.useState)(""),[d,f]=(0,ii.useState)(""),m=async s=>{console.log("fetchMedia",s)};(0,ii.useEffect)(()=>{typeof a=="string"?a.length===24?m(a):(i(a||""),f(u(h())),c(v()||"")):typeof a=="object"&&(i(`${process.env.NEXT_PUBLIC_API_URL}${a.url}`||""),f(u(a.filesize)),c(a.mimeType?.split("/")[1]||""))},[]);let p=(0,ii.useCallback)(()=>{n.update(()=>{(0,ae.$getNodeByKey)(o)?.remove()})},[n,o]),v=()=>{let s=e.data.value;return typeof s=="string"?s.split(";base64")[0]?.split("image/")[1]:""},h=()=>{let s=e.data.value;if(typeof s=="string"){let g=s.split(",")[1]?.length||0;return 4*Math.ceil(g/3)*.5624896334383812/1e3}return 0};function u(s){if(s>=1e6){let N=s/1e6;return`${N>=10?Math.round(N).toString():N.toFixed(1)} MB`}return`${Math.floor(s/1e3)} KB`}return(0,fi.jsx)("div",{className:"my-2",contentEditable:!1,children:(0,fi.jsxs)("div",{className:"border border-slate-800 rounded-xl overflow-clip w-60 flex flex-col gap-2 bg-[#222222]",children:[(0,fi.jsxs)("div",{className:"flex gap-2 border-b border-b-slate-100/10",children:[(0,fi.jsx)("div",{className:"flex-1",children:e.data.value?(0,fi.jsx)("img",{className:"object-cover m-0 w-full min-w-[115px] min-h-[105px]","data-lexical-upload-id":a,"data-lexical-upload-relation-to":t,src:r}):(0,fi.jsx)(nr.File,{})}),(0,fi.jsx)(Vt,{children:(0,fi.jsxs)($t,{children:[(0,fi.jsxs)(_t,{className:"flex-1 flex justify-center items-center text-[#b5b5b5]",children:[(0,fi.jsx)("span",{className:"font-medium text-sm",children:"Media"}),(0,fi.jsx)("button",{onClick:s=>{s.preventDefault(),p()},className:"flex-1 flex justify-center items-center",children:(0,fi.jsx)(wn.fi,{width:24,height:24,strokeWidth:1})})]}),(0,fi.jsx)(Rt,{children:(0,fi.jsx)("span",{children:"Remove image"})})]})})]}),(0,fi.jsxs)("div",{className:"flex items-center justify-center gap-4 py-3 flex-1 text-xs font-bold",children:[(0,fi.jsx)("span",{className:"",children:l?.toLocaleUpperCase()}),(0,fi.jsx)("span",{children:d})]})]})})},cr=ms;function ps(e){if(e.hasAttribute("data-lexical-upload-relation-to")&&e.hasAttribute("data-lexical-upload-id")){let a=e.getAttribute("data-lexical-upload-id");if(a)return{node:ga({fields:{},relationTo:"media",value:a})}}return e.src.startsWith("file:///"),null}var Fa=class extends co.UploadNode{static importDOM(){return{img:()=>({conversion:ps,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new Ho.default().toHexString(),t.version=3);let a={id:t.id??new Ho.default().toHexString(),fields:t.fields,relationTo:"media",value:t.value},o=ga(a);return o.setFormat?.(t.format),o}decorate(){return(0,fi.jsx)(cr,{data:this.__data,nodeKey:this.getKey()})}};function ga(e){return new Fa({data:e})}var us=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",gs=e=>us?(e||window).getSelection():null,jd=(0,ae.createCommand)("INSERT_UPLOAD_WITH_DRAWER_COMMAND"),jo=(0,ae.createCommand)("INSERT_UPLOAD_COMMAND");function hr({activeEditor:e,onClose:t,isOpen:a=!1}){let o=(0,ii.useRef)(!1),[n,r]=(0,ii.useState)(!0),[i,l]=(0,ii.useState)(""),[c,d]=(0,ii.useState)(""),[f,m]=(0,ii.useState)(!1),[p,v]=(0,ii.useState)("left"),h=i==="",u=S=>{m(S.target.checked)},s=S=>{v(S.target.value)},g=S=>{let $=new FileReader;$.onload=function(){return typeof $.result=="string"&&l($.result),""},S!==null&&S[0]&&$.readAsDataURL(S[0])};(0,ii.useEffect)(()=>{o.current=!1;let S=$=>{o.current=$.altKey};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[e]),(0,ii.useEffect)(()=>{n||t()},[n]),(0,ii.useEffect)(()=>{r(a)},[a]);let N=({editor:S,relationTo:$,replaceNodeKey:ee,value:_})=>{if(ee)S.update(()=>{let b=(0,ae.$getNodeByKey)(ee);b&&b.replace(ga({id:"",fields:{},relationTo:"media",value:_}))});else{let b=S.dispatchCommand(jo,{fields:null,relationTo:"media",value:_})}},R=()=>{N({editor:e,relationTo:"media",replaceNodeKey:null,value:{altText:c,src:i,showCaption:f,position:p}.src}),r(!1),t()};return(0,fi.jsx)(Xe,{open:n,onOpenChange:S=>r(S),children:(0,fi.jsxs)(bt,{children:[(0,fi.jsxs)(xt,{children:[(0,fi.jsx)(ot,{children:"Upload Image"}),(0,fi.jsx)(fr.DialogDescription,{children:"Description"})]}),(0,fi.jsxs)("div",{className:"",children:[(0,fi.jsx)("div",{style:{marginBottom:"1em"},children:(0,fi.jsx)(le,{type:"file",onChange:S=>g(S.target.files),accept:"image/*","data-test-id":"image-modal-file-upload"})}),(0,fi.jsx)("div",{style:{marginBottom:"1em"},children:(0,fi.jsx)(le,{"aria-label":"Alt Text",placeholder:"Descriptive alternative text",onChange:S=>d(S.currentTarget.value),value:c,"data-test-id":"image-modal-alt-text-input"})}),(0,fi.jsx)(y,{"data-test-id":"image-modal-file-upload-btn",disabled:h,onClick:()=>R(),children:"Confirm"})]})]})})}function Uo({captionsEnabled:e}){let[t]=(0,Pr.useLexicalComposerContext)();return(0,ii.useEffect)(()=>{if(!t.hasNodes([co.UploadNode]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return(0,Ua.mergeRegister)(t.registerCommand(ae.DRAGSTART_COMMAND,a=>fs(a),ae.COMMAND_PRIORITY_HIGH),t.registerCommand(ae.DRAGOVER_COMMAND,a=>hs(a),ae.COMMAND_PRIORITY_LOW),t.registerCommand(ae.DROP_COMMAND,a=>vs(a,t),ae.COMMAND_PRIORITY_HIGH))},[e,t]),null}function fs(e){if(!Ko())return!1;let a=e.dataTransfer;return a?(a.setData("text/plain","_"),!0):!1}function hs(e){return Ko()?(vr(e)||e.preventDefault(),!0):!1}function vs(e,t){let a=Ko();if(!a)return!1;if(e.preventDefault(),vr(e)){let o=bs(e);a.remove();let n=(0,ae.$createRangeSelection)();o!=null&&n.applyDOMRange(o),(0,ae.$setSelection)(n)}return!0}function Ko(){let e=(0,ae.$getSelection)();if(!(0,ae.$isNodeSelection)(e))return null;let a=e.getNodes()[0];return(0,co.$isUploadNode)(a)?a:null}function vr(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 bs(e){let t,a=e.target,o=a==null?null:a.nodeType===9?a.defaultView:a.ownerDocument.defaultView,n=gs(o);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(e.clientX,e.clientY);else if(e.rangeParent&&n!==null)n.collapse(e.rangeParent,e.rangeOffset||0),t=n.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}var xs=()=>(0,fi.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,fi.jsx)("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})}),br=xs;var ys=()=>(0,fi.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,fi.jsx)("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})}),xr=ys;var ws=()=>(0,fi.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,fi.jsx)("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),(0,fi.jsx)("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),yr=ws;var Cs=()=>(0,fi.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,fi.jsx)("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),(0,fi.jsx)("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),wr=Cs;var Ns=()=>(0,fi.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,fi.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})}),Cr=Ns;var Ds=()=>(0,$o.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,$o.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})}),Nr=Ds;var Dr=()=>(0,fi.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,fi.jsx)("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})}),Sr=()=>(0,fi.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,fi.jsx)("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})}),kr=()=>(0,fi.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,fi.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})}),Tr=()=>(0,fi.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,fi.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})}),Ar=()=>(0,fi.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,fi.jsx)("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});var _o=1;function Ss(){return(0,fi.jsx)("span",{className:"border border-[#222222]"})}function Go(){let[e]=(0,Pr.useLexicalComposerContext)(),t=(0,ii.useRef)(null),[a,o]=(0,ii.useState)(!1),[n,r]=(0,ii.useState)(!1),[i,l]=(0,ii.useState)(!1),[c,d]=(0,ii.useState)(!1),[f,m]=(0,ii.useState)(!1),[p,v]=(0,ii.useState)(!1),[h,u]=(0,ii.useState)(!1),[s,g]=(0,ii.useState)(!1),[N,R]=(0,ii.useState)(!1),[S,$]=(0,ii.useState)("left"),[ee,_]=(0,ii.useState)("p"),b=C=>{e.update(()=>{let U=(0,ae.$getSelection)();(0,ae.$isRangeSelection)(U)&&(C==="p"?(0,Wo.$setBlocksType)(U,()=>(0,ae.$createParagraphNode)()):(0,Wo.$setBlocksType)(U,()=>(0,jr.$createHeadingNode)(C)))})},z=(0,ii.useCallback)(()=>{let C=(0,ae.$getSelection)();if((0,ae.$isRangeSelection)(C)){l(C.hasFormat("bold")),d(C.hasFormat("italic")),m(C.hasFormat("underline")),v(C.hasFormat("strikethrough")),u(C.hasFormat("subscript")),g(C.hasFormat("superscript"));let U=C.anchor.getNode(),k=U;for(;k&&!(0,ae.$isParagraphNode)(k)&&k!==(0,ae.$getRoot)();){let M=k.getParent();M&&(k=M)}if(k){let M=k.getFormatType();$(M||"left")}let fe=U.getTopLevelElement()?.__tag;_(fe||"p")}},[]);(0,ii.useEffect)(()=>(0,Ua.mergeRegister)(e.registerUpdateListener(({editorState:C})=>{C.read(()=>{z()})}),e.registerCommand(ae.SELECTION_CHANGE_COMMAND,(C,U)=>(z(),!1),_o),e.registerCommand(ae.CAN_UNDO_COMMAND,C=>(o(C),!1),_o),e.registerCommand(ae.CAN_REDO_COMMAND,C=>(r(C),!1),_o),(0,Ua.mergeRegister)(e.registerCommand(jo,C=>(e.update(()=>{let U=(0,ae.$getSelection)()||(0,ae.$getPreviousSelection)();if((0,ae.$isRangeSelection)(U)){let k=ga({id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}),{focus:fe}=U,M=fe.getNode();(0,Ua.$insertNodeToNearestRoot)(k),(0,ae.$isParagraphNode)(M)&&!M.__first&&M.remove()}}),!0),ae.COMMAND_PRIORITY_EDITOR))),[e,z]);let V=[[{label:"Undo",icon:(0,fi.jsx)(wn.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ae.UNDO_COMMAND,void 0)},disabled:!a},{label:"Redo",icon:(0,fi.jsx)(wn.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ae.UNDO_COMMAND,void 0)},disabled:!n}],[{label:"Bold",icon:(0,fi.jsx)(br,{}),onClick:()=>{e.dispatchCommand(ae.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:i},{label:"Italic",icon:(0,fi.jsx)(xr,{}),onClick:()=>{e.dispatchCommand(ae.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:c},{label:"Underline",icon:(0,fi.jsx)(yr,{}),onClick:()=>{e.dispatchCommand(ae.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:f},{label:"Strikethrough",icon:(0,fi.jsx)(wr,{}),onClick:()=>{e.dispatchCommand(ae.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:p},{label:"Subscript",icon:(0,fi.jsx)(Cr,{}),onClick:()=>{e.dispatchCommand(ae.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:h},{label:"Superscript",icon:(0,fi.jsx)(Nr,{}),onClick:()=>{e.dispatchCommand(ae.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:s}]],j=[{label:"Left Align",direction:"left",icon:(0,fi.jsx)(wn.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ae.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,fi.jsx)(wn.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ae.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,fi.jsx)(wn.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ae.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,fi.jsx)(wn.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ae.FORMAT_ELEMENT_COMMAND,"justify")}}],Te=[{label:"Normal Text",value:"p",icon:(0,fi.jsx)(Dr,{}),onClick:()=>b("p")},{label:"Heading 1",value:"h1",icon:(0,fi.jsx)(Sr,{}),onClick:()=>b("h1")},{label:"Heading 2",value:"h2",icon:(0,fi.jsx)(kr,{}),onClick:()=>b("h2")},{label:"Heading 3",value:"h3",icon:(0,fi.jsx)(Tr,{}),onClick:()=>b("h3")},{label:"Heading 4",value:"h4",icon:(0,fi.jsx)(Ar,{}),onClick:()=>b("h4")},...[{label:"Unordered List",value:"ul",icon:(0,fi.jsx)(wn.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(po.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,fi.jsx)(wn.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(po.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],w=[{label:"Insert Image",icon:(0,fi.jsx)(wn.ImageUp,{width:15,height:15}),onClick:()=>{R(!0)},disabled:!1}];return(0,fi.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2 sticky top-0 bg-black z-50",children:(0,fi.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[V.map((C,U)=>(0,fi.jsxs)(ii.Fragment,{children:[(0,fi.jsx)("div",{className:"flex items-center gap-2",children:C.map((k,fe)=>(0,fi.jsx)("div",{role:"button","aria-disabled":k.disabled||!1,onClick:k.onClick,className:x("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]",k.active&&"bg-[#3c3c3c]"),"aria-label":k.label,children:(0,fi.jsx)(Vt,{children:(0,fi.jsxs)($t,{children:[(0,fi.jsx)(_t,{className:"text-[#b5b5b5]",children:k.icon}),(0,fi.jsx)(Rt,{children:(0,fi.jsx)("p",{children:k.label})})]})})},fe))}),(0,fi.jsx)(Ss,{})]},`toolbar-option-${C.length}-${U}`)),(0,fi.jsxs)(dt,{children:[(0,fi.jsxs)(ct,{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:[j.find(C=>C.direction===S)?.icon,j.find(C=>C.direction===S)?.label,(0,fi.jsx)(wn.ChevronDown,{width:15,height:15})]}),(0,fi.jsx)(it,{className:"bg-black hover:bg-black",children:j.map((C,U)=>(0,fi.jsxs)(ze,{onClick:C.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,fi.jsx)("span",{children:C.icon}),(0,fi.jsx)("span",{children:C.label})]},`${C.label}-${U}`))})]}),(0,fi.jsxs)(dt,{children:[(0,fi.jsxs)(ct,{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:[Te.find(C=>C.value===ee)?.icon,Te.find(C=>C.value===ee)?.label,(0,fi.jsx)(wn.ChevronDown,{width:15,height:15})]}),(0,fi.jsx)(it,{className:"bg-black hover:bg-black",children:Te.map((C,U)=>(0,fi.jsxs)(ze,{onClick:C.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,fi.jsx)("span",{children:C.icon}),(0,fi.jsx)("span",{children:C.label})]},`heading-option-${C.label}-${U}`))})]}),(0,fi.jsxs)(dt,{children:[(0,fi.jsxs)(ct,{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,fi.jsx)(wn.Plus,{width:15,height:15}),(0,fi.jsx)(wn.ChevronDown,{width:15,height:15})]}),(0,fi.jsx)(it,{className:"bg-black hover:bg-black",children:w.map((C,U)=>(0,fi.jsxs)(ze,{onClick:C.onClick,disabled:C.disabled,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,fi.jsx)("span",{children:C.icon}),(0,fi.jsx)("span",{children:C.label})]},U))})]}),N&&(0,fi.jsx)(hr,{activeEditor:e,onClose:()=>{R(!1)},isOpen:N})]})})}var ks=({setValue:e,value:t,name:a,editable:o=!0})=>{let[n]=(0,Pr.useLexicalComposerContext)(),r=(0,ii.useRef)(null),i=l=>{l.read(()=>{let c=l.toJSON();JSON.stringify(c)!==JSON.stringify(r.current)&&(r.current=c,e?.(()=>c))})};return(0,ii.useEffect)(()=>{n.setEditable(o)},[o,n]),(0,ii.useEffect)(()=>{t&&JSON.stringify(t)!==JSON.stringify(r.current)&&n.update(()=>{try{let l=n.parseEditorState(t);n.setEditorState(l),r.current=t}catch(l){console.error("Error parsing editor state:",l)}},{discrete:!0})},[t,n]),(0,fi.jsx)("div",{className:"w-full",children:(0,fi.jsxs)("div",{className:" ",children:[o&&(0,fi.jsx)(Go,{}),(0,fi.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,fi.jsx)(Fr.RichTextPlugin,{contentEditable:(0,fi.jsx)(Lr.ContentEditable,{name:a,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-h-40"}),ErrorBoundary:Br.LexicalErrorBoundary}),o&&(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsx)(Er.HistoryPlugin,{}),(0,fi.jsx)(Mr.AutoFocusPlugin,{}),(0,fi.jsx)(Hr.ListPlugin,{}),(0,fi.jsx)(Ur.OnChangePlugin,{onChange:i}),(0,fi.jsx)(Uo,{})]})]})]})})},Ts=({setValue:e,value:t,name:a,editable:o=!0})=>(0,fi.jsx)(Ir.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[po.ListNode,po.ListItemNode,jr.HeadingNode,Fa],onError(r){throw console.error("Lexical error:",r),r},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,fi.jsx)(ks,{value:t,setValue:e,name:a,editable:o})}),fa=Ts;var ne=ue(require("@radix-ui/react-select")),qt=ue(require("react")),Ct=ne.Root;var Nt=ne.Value,pt=qt.forwardRef(({children:e,className:t,...a},o)=>(0,fi.jsxs)(ne.Trigger,{className:x("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:o,...a,children:[e,(0,fi.jsx)(ne.Icon,{asChild:!0,children:(0,fi.jsx)(wn.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));pt.displayName=ne.Trigger.displayName;var Or=qt.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(ne.ScrollUpButton,{className:x("flex cursor-default items-center justify-center py-1",e),ref:a,...t,children:(0,fi.jsx)(wn.ChevronUp,{className:"h-4 w-4"})}));Or.displayName=ne.ScrollUpButton.displayName;var zr=qt.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(ne.ScrollDownButton,{className:x("flex cursor-default items-center justify-center py-1",e),ref:a,...t,children:(0,fi.jsx)(wn.ChevronDown,{className:"h-4 w-4"})}));zr.displayName=ne.ScrollDownButton.displayName;var ut=qt.forwardRef(({children:e,className:t,position:a="popper",...o},n)=>(0,fi.jsx)(ne.Portal,{children:(0,fi.jsxs)(ne.Content,{className:x("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",a==="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:a,ref:n,...o,children:[(0,fi.jsx)(Or,{}),(0,fi.jsx)(ne.Viewport,{className:x("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),(0,fi.jsx)(zr,{})]})}));ut.displayName=ne.Content.displayName;var As=qt.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(ne.Label,{className:x("py-1.5 pl-8 fi-2 text-sm font-semibold",e),ref:a,...t}));As.displayName=ne.Label.displayName;var Ue=qt.forwardRef(({children:e,className:t,...a},o)=>(0,fi.jsxs)(ne.Item,{className:x("relative flex w-full cursor-default select-none items-center rounded py-1.5 pl-8 fi-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),ref:o,...a,children:[(0,fi.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,fi.jsx)(ne.ItemIndicator,{children:(0,fi.jsx)(wn.Check,{className:"h-4 w-4"})})}),(0,fi.jsx)(ne.ItemText,{children:e})]}));Ue.displayName=ne.Item.displayName;var Ps=qt.forwardRef(({className:e,...t},a)=>(0,fi.jsx)(ne.Separator,{className:x("-mx-1 my-1 h-px bg-muted",e),ref:a,...t}));Ps.displayName=ne.Separator.displayName;var Oa=e=>"mimeType"in e&&"url"in e&&!("format"in e),Rs=e=>{if(!e?.root?.children)return"";let t=[],a=r=>{if(!r)return"";switch(r.type){case"heading":{let i=r.tag?parseInt(r.tag.replace("h","")):1,l=o(r.children||[]);return"#".repeat(i)+" "+l}case"paragraph":return r.children&&r.children.some(c=>c.type==="text"?c.text&&c.text.trim().length>0:(c.type==="linebreak",!0))?o(r.children||[]):"";case"list":{let i=[],l=r.listType==="number"?"1.":"-";return r.children?.forEach((c,d)=>{if(c.type==="listitem"){let f=o(c.children||[]),m=r.listType==="number"?`${d+1}.`:l;i.push(`${m} ${f}`)}}),i.join(`
6
+ `)}case"listitem":return o(r.children||[]);case"text":{let i=r.text||"";if(r.format){let l=(r.format&1)!==0,c=(r.format&2)!==0,d=(r.format&4)!==0,f=(r.format&8)!==0;(r.format&16)!==0?i=`\`${i}\``:(l&&(i=`**${i}**`),c&&(i=`*${i}*`),d&&(i=`~~${i}~~`),f&&(i=`<u>${i}</u>`))}return i}default:return r.children?o(r.children):""}},o=r=>r.map(i=>{if(i.type==="text"){let l=i.text||"";if(i.format){let c=(i.format&1)!==0,d=(i.format&2)!==0,f=(i.format&4)!==0,m=(i.format&8)!==0;(i.format&16)!==0?l=`\`${l}\``:(c&&(l=`**${l}**`),d&&(l=`*${l}*`),f&&(l=`~~${l}~~`),m&&(l=`<u>${l}</u>`))}return l}else{if(i.type==="paragraph")return o(i.children||[]);if(i.type==="listitem")return o(i.children||[]);if(i.type==="linebreak")return`
7
+ `}return a(i)}).filter(Boolean).join("");e.root.children.forEach(r=>{let i=a(r);r.type==="paragraph"?t.push(i||""):i&&t.push(i)});let n=[];for(let r=0;r<t.length;r++)n.push(t[r]),r<t.length-1&&(t[r]===""||t[r+1]===""||n.push(""));return n.join(`
8
+ `)},Xt=e=>{let t=[],a=0;for(;a<e.length;){let n=e.slice(a).match(/^<u\s*[^>]*>([\s\S]*?)<\/u>/i);if(n&&n[0]){let p=n[1]||"",v=p?Xt(p):[];v.length>0?(v.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|8)}),t.push(...v)):p===""&&t.push({type:"text",text:"",format:8}),a+=n[0].length;continue}if(e.slice(a).startsWith("</u>")){a+=4;continue}let r=e.slice(a).match(/^(`+)([^`]+)\1/);if(r){let p=r[2];p&&t.push({type:"text",text:p,format:16}),a+=r[0].length;continue}let i=e.slice(a).match(/^(~~)(.+?)\1/);if(i){let p=i[2],v=Xt(p);v.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|4)}),t.push(...v),a+=i[0].length;continue}let l=e.slice(a).match(/^(\*\*|__)(.+?)\1/);if(l){let p=l[2],v=Xt(p);v.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|1)}),t.push(...v),a+=l[0].length;continue}let c=e.slice(a).match(/^(\*|_)([^*_\n]+?)\1(?!\*|_)/);if(c&&c[0].length>2){let p=c[2],v=Xt(p);v.forEach(h=>{h.type==="text"&&(h.format=(h.format||0)|2)}),t.push(...v),a+=c[0].length;continue}if(e[a]===`
9
+ `){t.push({type:"linebreak",version:1}),a+=1;continue}let d=e.length,f=[{pattern:/<u>/i,offset:0},{pattern:/\*\*/,offset:0},{pattern:/__/,offset:0},{pattern:/~~/,offset:0},{pattern:/`+/,offset:0},{pattern:/\*[^*\n]/,offset:0},{pattern:/_[^_\n]/,offset:0},{pattern:/\n/,offset:0}];for(let{pattern:p}of f){let v=e.slice(a+1).search(p);v!==-1&&v+1<d-a&&(d=a+v+1)}let m=e.slice(a,d);m&&t.push({type:"text",text:m,format:0}),a=d}let o=[];for(let n of t)n.type==="linebreak"?o.push(n):o.length>0&&o[o.length-1].type==="text"&&n.type==="text"&&o[o.length-1].format===n.format?o[o.length-1].text+=n.text:o.push(n);return o.length>0?o:[{type:"text",text:"",format:0}]},Ms=e=>{let t=e.split(`
10
+ `),a=[],o=[],n=[],r=null,i=()=>{if(o.length>0){for(let c=0;c<o.length;c++){let d=o[c],f=Xt(d),m=f.length>0?f.map(p=>({...p,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];a.push({type:"paragraph",children:m,direction:"ltr",format:"",indent:0,version:1})}o=[]}},l=()=>{n.length>0&&r&&(a.push({type:"list",listType:r,tag:r==="number"?"ol":"ul",start:1,format:"",indent:0,version:1,direction:"ltr",children:n}),n=[],r=null)};for(let c of t){let d=c.trim();if(!d){i(),l(),a.push({children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""});continue}let f=d.match(/^(#{1,6})\s+(.+)$/);if(f){i(),l();let v=f[1].length,h=f[2],u=Xt(h);a.push({type:"heading",tag:`h${v}`,children:u.length>0?u:[{type:"text",text:"",format:0}]});continue}let m=d.match(/^(\d+)\.\s+(.*)$/);if(m){i(),r==="bullet"&&l(),r!=="number"&&(n.length>0&&l(),r="number");let v=m[2]||"",h=Xt(v),u=h.length>0?h.map(s=>({...s,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];n.push({type:"listitem",value:n.length+1,format:"start",indent:0,version:1,direction:"ltr",children:[{type:"paragraph",children:u,direction:"ltr",format:"",indent:0,version:1}]});continue}let p=d.match(/^[-*+]\s+(.+)$/);if(p){i(),r==="number"&&l(),r!=="bullet"&&(n.length>0&&l(),r="bullet");let v=p[1],h=Xt(v),u=h.length>0?h.map(s=>({...s,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];n.push({type:"listitem",value:n.length+1,format:"start",indent:0,version:1,direction:"ltr",children:[{type:"paragraph",children:u,direction:"ltr",format:"",indent:0,version:1}]});continue}n.length>0&&l(),o.push(c)}return i(),l(),a.length===0&&a.push({type:"paragraph",children:[{type:"text",text:"",format:0}]}),{root:{type:"root",children:a,direction:"ltr",format:"",indent:0,version:1}}},Is=async e=>{let t="",a,o="text";if(e.url)try{let n=e.url;!n.startsWith("http://")&&!n.startsWith("https://")&&!n.startsWith("/")&&(n="/"+n);let r=await fetch(n);r.ok?(t=await r.text(),console.log("Successfully loaded content, length:",t.length)):console.error("Failed to fetch file content:",r.status,r.statusText)}catch(n){console.error("Failed to fetch file content:",n)}else console.warn("No URL provided for file:",e.name);return e.mimeType==="text/markdown"?(o="richText",a=Ms(t)):e.mimeType?.startsWith("text/")&&(o="text"),{id:e.id.toString(),title:e.name,description:void 0,content:o==="richText"?void 0:t,richTextContent:o==="richText"?a:void 0,format:o,metadata:{},createdAt:typeof e.createdAt=="string"?new Date(e.createdAt):e.createdAt,updatedAt:new Date}};function $r({document:e,onCancel:t,onSave:a,onFileUpdate:o}){let[n,r]=(0,ii.useState)(Oa(e)),[i,l]=(0,ii.useState)(Oa(e)?{id:e.id.toString(),title:e.name,description:void 0,content:"",format:"text",metadata:{},createdAt:typeof e.createdAt=="string"?new Date(e.createdAt):e.createdAt,updatedAt:new Date}:{...e,updatedAt:new Date}),[c,d]=(0,ii.useState)(Oa(e)?void 0:i.richTextContent),[f,m]=(0,ii.useState)(!1),p=(0,ii.useRef)(Oa(e)?e:null);(0,ii.useEffect)(()=>{Oa(e)?(r(!0),Is(e).then(s=>{l(s),d(s.richTextContent),r(!1)}).catch(s=>{s instanceof Error&&s.name!=="AbortError"&&(console.error("Failed to convert file:",s),r(!1))})):(l({...e,updatedAt:new Date}),d(e.richTextContent))},[e]);let v=s=>{switch(s){case"markdown":case"mdx":return(0,fi.jsx)($e.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,fi.jsx)($e.File,{className:"h-6 w-6 text-success"});case"text":return(0,fi.jsx)($e.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,fi.jsx)($e.File,{className:"h-6 w-6 text-muted-foreground"})}},h=s=>{switch(s){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"}},u=async()=>{m(!0);try{let s,g;if(p.current&&p.current.mimeType==="text/markdown"){let R=c?Rs(c):"";s={...i,format:"markdown",content:R,richTextContent:void 0},g=R}else s={...i,richTextContent:c},g=i.content||"";let N=p.current?p.current.id.toString():i.id;await Promise.resolve(a()),o?.(N,g)}finally{m(!1)}};return(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,fi.jsx)("div",{className:"border-b border-border bg-card p-8 pb-6",children:(0,fi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,fi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,fi.jsx)("div",{className:"flex-1 min-w-0",children:(0,fi.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,fi.jsx)("div",{className:"flex-1 min-w-0",children:(0,fi.jsx)(Ea,{fieldName:"title",value:i.title,label:"",onSave:(s,g)=>l(N=>({...N,title:g})),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,fi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${h(i.format)} flex-shrink-0 fi-1`,children:i.format.toUpperCase()})]})})}),(0,fi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,fi.jsxs)(y,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,fi.jsx)($e.fi,{className:"h-4 w-4"}),"Close"]}),(0,fi.jsxs)(y,{size:"sm",onClick:u,className:"gap-2",disabled:f,children:[f?(0,fi.jsx)($e.Loader2,{className:"h-4 w-4 animate-spin"}):(0,fi.jsx)($e.Save,{className:"h-4 w-4"}),f?"Saving...":"Save"]})]})]})}),(0,fi.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,fi.jsx)("div",{className:"p-8 pt-0 h-full max-h-full overflow-auto",children:n?(0,fi.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,fi.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,fi.jsx)($e.Loader2,{className:"h-8 w-8 animate-spin text-primary"}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading file content..."})]})}):(0,fi.jsx)(fi.Fragment,{children:i.format==="richText"?(0,fi.jsx)(fa,{setValue:d,value:c,name:"richTextContent"},`richtext-${i.id}-${n?"loading":"loaded"}`):(0,fi.jsx)(Ze,{value:i.content||"",onChange:s=>l(g=>({...g,content:s.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})})]})}var _r=e=>{if(!e||e<=0)return"0 KB";let t=e/1024;return t<1024?`${t.toFixed(2)} KB`:`${(t/1024).toFixed(2)} MB`};function Jr({files:e,onFileClick:t,onFileDelete:a,onFileUpdate:o,showHeader:n=!0,className:r,viewMode:i="list"}){let[l,c]=(0,ii.useState)(!1),[d,f]=(0,ii.useState)(!1),[m,p]=(0,ii.useState)(null),v=()=>{c(!1),p(null)},h=()=>{f(!0),setTimeout(()=>{f(!1),c(!1),p(null)},500)},u=s=>{p(s),c(!0)};return(0,fi.jsxs)("div",{className:x("rounded-3xl border overflow-hidden",r),children:[(0,fi.jsxs)("div",{className:"bg-muted/50 p-3 flex items-center justify-between",children:[n&&i==="list"&&(0,fi.jsxs)("div",{className:"hidden md:grid md:grid-cols-10 text-sm font-medium flex-1",children:[(0,fi.jsx)("div",{className:"col-span-6",children:"Name"}),(0,fi.jsx)("div",{className:"col-span-2",children:"Size"}),(0,fi.jsx)("div",{className:"col-span-2",children:"Modified"})]}),i==="card"&&(0,fi.jsx)("div",{className:"text-sm font-medium",children:"Files"})]}),i==="list"&&(0,fi.jsx)("div",{className:"divide-y",children:e.map(s=>(0,fi.jsxs)(Co.motion.div,{whileHover:{backgroundColor:"rgba(0,0,0,0.02)"},className:"p-3 md:grid md:grid-cols-10 items-center flex flex-col md:flex-row gap-3 md:gap-0 cursor-pointer",onClick:()=>t?.(s),children:[(0,fi.jsxs)("div",{className:"col-span-6 flex items-center gap-3 w-full md:w-auto",children:[(0,fi.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted"}),(0,fi.jsx)("div",{children:(0,fi.jsx)("p",{className:"font-medium",children:s.name})})]}),(0,fi.jsx)("div",{className:"col-span-2 text-sm md:text-base",children:_r(s.filesize)}),(0,fi.jsxs)("div",{className:"col-span-2 flex items-center justify-between w-full md:w-auto",children:[(0,fi.jsx)("span",{className:"text-sm md:text-base",children:new Date(s.createdAt).toLocaleDateString()}),(0,fi.jsxs)("div",{className:"flex gap-1",children:[s.mimeType==="text/markdown"&&(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl",onClick:g=>{g.stopPropagation(),u(s)},children:(0,fi.jsx)(wn.Edit,{className:"h-4 w-4"})}),(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:g=>{g.stopPropagation(),a?.(s)},children:(0,fi.jsx)(wn.Trash2,{className:"h-4 w-4"})})]})]})]},s.name))}),i==="card"&&(0,fi.jsx)("div",{className:"p-4 grid grid-cols-1 gap-4",children:e.map(s=>(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02},className:"border rounded-lg p-4 bg-card hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>t?.(s),children:(0,fi.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,fi.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,fi.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted flex-shrink-0"}),(0,fi.jsx)("div",{className:"min-w-0 flex-1",children:(0,fi.jsx)("p",{className:"font-medium truncate",children:s.name})})]}),(0,fi.jsxs)("div",{className:"space-y-1 text-sm text-muted-foreground pl-[52px]",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,fi.jsx)("span",{className:"font-medium",children:"Size:"}),(0,fi.jsx)("span",{children:_r(s.filesize)})]}),(0,fi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,fi.jsx)("span",{className:"font-medium",children:"Modified:"}),(0,fi.jsx)("span",{children:new Date(s.createdAt).toLocaleDateString()})]})]})]}),(0,fi.jsxs)("div",{className:"flex flex-col gap-2 flex-shrink-0",children:[s.mimeType==="text/markdown"&&(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl",onClick:g=>{g.stopPropagation(),u(s)},title:"Edit",children:(0,fi.jsx)(wn.Edit,{className:"h-4 w-4"})}),(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:g=>{g.stopPropagation(),a?.(s)},title:"Delete",children:(0,fi.jsx)(wn.Trash2,{className:"h-4 w-4"})})]})]})},s.name))}),(0,fi.jsx)(Xe,{open:l,onOpenChange:s=>!s&&v(),children:(0,fi.jsxs)(pa,{children:[(0,fi.jsx)(Qt,{}),(0,fi.jsxs)(Wr.Content,{className:x("fixed inset-0 z-50 bg-background p-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:[(0,fi.jsx)(ot,{className:"Pr-only",children:m?`Edit ${m.name}`:"Edit File"}),d&&(0,fi.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center z-50",children:(0,fi.jsx)(wn.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),m&&(0,fi.jsx)($r,{document:m,onSave:h,onFileUpdate:o,onCancel:v})]})]})})]})}function Xr({project:e,onOpen:t,onShare:a,className:o}){return(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:o,children:(0,fi.jsxs)(ce,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,fi.jsxs)(Ce,{children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,fi.jsx)(Pe,{children:e.name}),(0,fi.jsxs)(ke,{variant:"outline",className:"rounded-xl",children:["Due ",e.dueDate]})]}),(0,fi.jsx)(Ma,{children:e.description})]}),(0,fi.jsxs)(me,{className:"space-y-4",children:[(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,fi.jsx)("span",{children:"Progress"}),(0,fi.jsxs)("span",{children:[e.progress,"%"]})]}),(0,fi.jsx)(Ba,{value:e.progress,className:"h-2 rounded-xl"})]}),(0,fi.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,fi.jsxs)("div",{className:"flex items-center",children:[(0,fi.jsx)(wn.Users,{className:"co-1 h-4 w-4"}),e.members," members"]}),(0,fi.jsxs)("div",{className:"flex items-center",children:[(0,fi.jsx)(wn.FileText,{className:"co-1 h-4 w-4"}),e.files," files"]})]})]}),(0,fi.jsxs)(Ia,{className:"flex gap-2",children:[(0,fi.jsx)(y,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"Open Project"}),(0,fi.jsx)(y,{variant:"outline",size:"icon",className:"rounded-2xl",onClick:()=>a?.(e),children:(0,fi.jsx)(wn.Share2,{className:"h-4 w-4"})})]})]})})}var qo=[{name:"PixelMaster",icon:(0,fi.jsx)(wn.ImageIcon,{className:"text-violet-500"}),description:"Advanced image editing and composition",category:"Creative",recent:!0,new:!1,progress:100},{name:"VectorPro",icon:(0,fi.jsx)(wn.Brush,{className:"text-orange-500"}),description:"Professional vector graphics creation",category:"Creative",recent:!0,new:!1,progress:100},{name:"VideoStudio",icon:(0,fi.jsx)(wn.Video,{className:"text-pink-500"}),description:"Cinematic video editing and production",category:"Video",recent:!0,new:!1,progress:100},{name:"MotionFX",icon:(0,fi.jsx)(wn.Sparkles,{className:"text-blue-500"}),description:"Stunning visual effects and animations",category:"Video",recent:!1,new:!1,progress:100},{name:"PageCraft",icon:(0,fi.jsx)(wn.Layers,{className:"text-red-500"}),description:"Professional page design and layout",category:"Creative",recent:!1,new:!1,progress:100},{name:"UXFlow",icon:(0,fi.jsx)(wn.LayoutGrid,{className:"text-fuchsia-500"}),description:"Intuitive user experience design",category:"Design",recent:!1,new:!0,progress:85},{name:"PhotoLab",icon:(0,fi.jsx)(wn.Camera,{className:"text-teal-500"}),description:"Advanced photo editing and organization",category:"Photography",recent:!1,new:!1,progress:100},{name:"DocMaster",icon:(0,fi.jsx)(wn.FileText,{className:"text-red-600"}),description:"Document editing and management",category:"Document",recent:!1,new:!1,progress:100},{name:"WebCanvas",icon:(0,fi.jsx)(wn.Code,{className:"text-emerald-500"}),description:"Web design and development",category:"Web",recent:!1,new:!0,progress:70},{name:"3DStudio",icon:(0,fi.jsx)(wn.CuboidIcon,{className:"text-indigo-500"}),description:"3D modeling and rendering",category:"3D",recent:!1,new:!0,progress:60},{name:"FontForge",icon:(0,fi.jsx)(wn.Type,{className:"text-amber-500"}),description:"Typography and font creation",category:"Typography",recent:!1,new:!1,progress:100},{name:"ColorPalette",icon:(0,fi.jsx)(wn.Palette,{className:"text-purple-500"}),description:"Color scheme creation and management",category:"Design",recent:!1,new:!1,progress:100}],Zr=[{id:1,filename:"Brand Redesign.pxm",filesize:24.5,url:"https://example.com/brand-redesign.pxm",mimeType:"image/png",name:"Brand Redesign.pxm",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:2,filename:"Company Logo.vec",filesize:8.2,url:"https://example.com/company-logo.vec",mimeType:"image/svg+xml",name:"Company Logo.vec",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:3,filename:"Product Launch Video.vid",filesize:1.2,url:"https://example.com/product-launch-video.vid",mimeType:"video/mp4",name:"Product Launch Video.vid",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:4,filename:"UI Animation.mfx",filesize:345,url:"https://example.com/ui-animation.mfx",mimeType:"video/mp4",name:"UI Animation.mfx",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:5,filename:"Magazine Layout.pgc",filesize:42.8,url:"https://example.com/magazine-layout.pgc",mimeType:"image/png",name:"Magazine Layout.pgc",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:6,filename:"Mobile App Design.uxf",filesize:18.3,url:"https://example.com/mobile-app-design.uxf",mimeType:"image/png",name:"Mobile App Design.uxf",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:7,filename:"Product Photography.phl",filesize:156,url:"https://example.com/product-photography.phl",mimeType:"image/png",name:"Product Photography.phl",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1}];var Yr=[{title:"Mastering Digital Illustration",description:"Learn advanced techniques for creating stunning digital art",duration:"1h 45m",level:"Advanced",instructor:"Sarah Chen",category:"Illustration",views:"24K"},{title:"UI/UX Design Fundamentals",description:"Essential principles for creating intuitive user interfaces",duration:"2h 20m",level:"Intermediate",instructor:"Michael Rodriguez",category:"Design",views:"56K"},{title:"Video Editing Masterclass",description:"Professional techniques for cinematic video editing",duration:"3h 10m",level:"Advanced",instructor:"James Wilson",category:"Video",views:"32K"},{title:"Typography Essentials",description:"Create beautiful and effective typography for any project",duration:"1h 30m",level:"Beginner",instructor:"Emma Thompson",category:"Typography",views:"18K"},{title:"Color Theory for Designers",description:"Understanding color relationships and psychology",duration:"2h 05m",level:"Intermediate",instructor:"David Kim",category:"Design",views:"41K"}];var en=[{id:"home",title:"Home",icon:(0,fi.jsx)(wn.Home,{}),isActive:!0},{id:"teams",title:"Teams",icon:(0,fi.jsx)(wn.Users,{}),maxItems:2,items:[{id:"design",title:"Design",url:"#"},{id:"marketing",title:"Marketing",url:"#"},{id:"finance",title:"Finance",url:"#"},{id:"engineering",title:"Engineering",url:"#"},{id:"sales",title:"Sales",url:"#"}]},{id:"projects",title:"Projects",icon:(0,fi.jsx)(wn.Layers,{}),badge:"4",maxItems:2,items:[{id:"active-projects",title:"Active Projects",url:"#",badge:"4"},{id:"archived",title:"Archived",url:"#"},{id:"templates",title:"Templates",url:"#"},{id:"drafts",title:"Drafts",url:"#"},{id:"shared",title:"Shared with fi",url:"#",badge:"2"}]},{id:"copilot",title:"Copilot",icon:(0,fi.jsx)(wn.Bot,{}),url:"/copilot"},{id:"knowledge",title:"Knowledge",icon:(0,fi.jsx)(wn.FileText,{}),url:"/knowledge"}],tn=[{id:"1",title:"New comment on your post",description:"Alex Morgan commented on your 'Minimalist Logo Design' post.",time:"Just now",read:!1,type:"info",actionLabel:"View comment",onAction:()=>console.log("View comment clicked")},{id:"2",title:"Project deadline approaching",description:"The 'Website Redesign' project is due in 2 days.",time:"5 minutes ago",read:!1,type:"warning",actionLabel:"View project",onAction:()=>console.log("View project clicked")},{id:"3",title:"File shared with you",description:"Emma Thompson shared 'Brand Guidelines.pdf' with you.",time:"1 hour ago",read:!1,type:"info",actionLabel:"Open file",onAction:()=>console.log("Open file clicked")},{id:"4",title:"Update successful",description:"PixelMaster has been updated to version 2.4.0.",time:"3 hours ago",read:!0,type:"success",actionLabel:"See what's new",onAction:()=>console.log("See what's new clicked")},{id:"5",title:"Storage limit reached",description:"You've used 95% of your storage. Consider upgrading your plan.",time:"Yesterday",read:!0,type:"error",actionLabel:"Upgrade plan",onAction:()=>console.log("Upgrade plan clicked")},{id:"6",title:"Weekly summary",description:"Check out your activity summary for the past week.",time:"2 days ago",read:!0,type:"info",actionLabel:"View summary",onAction:()=>console.log("View summary clicked")},{id:"7",title:"New tutorial available",description:"fi new tutorial on 'Advanced Animation Techniques' is now available.",time:"3 days ago",read:!0,type:"info",actionLabel:"Start learning",onAction:()=>console.log("Start learning clicked")}];var xa=[{id:1,name:"fi-commerce Platform",description:"Main customer-facing e-commerce application",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:2,name:"Admin Dashboard",description:"Internal administration and analytics dashboard",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:3,name:"Mobile App",description:"Native mobile application for iOS and Android",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1}];var Xo=[{id:1,name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,name:"Dashboard Features",color:"bg-green-500",description:"Build comprehensive dashboard functionality",confidence:"medium",phase:1,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:3,name:"Mobile Optimization",color:"bg-purple-500",description:"Optimize application for mobile devices",confidence:"low",phase:1,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,name:"Performance Improvements",color:"bg-orange-500",description:"Enhance application performance and speed",confidence:"high",phase:3,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()}],go=[{id:1,name:"Backlog",description:"Tasks not yet assigned to a sprint",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:3,name:"Sprint 1",description:"Initial development phase",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,name:"Sprint 2",description:"Feature development",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()}],vo=[{id:1,name:"Design login page",description:"Create wireframes and mockups for the login interface",status:"todo",priority:"high",type:"story",dateLogged:new Date().toString(),index:1,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"John Doe"},createdAt:new Date().toString()},{id:2,name:"Implement OAuth integration",description:"Add Google and GitHub OAuth authentication",status:"review",priority:"high",type:"task",dateLogged:new Date().toString(),index:2,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Jane Smith"},createdAt:new Date().toString()},{id:3,name:"Create dashboard widgets",description:"Build analytics and metrics widgets for the main dashboard",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:3,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Mike Johnson"},createdAt:new Date().toString()},{id:4,name:"Fix login redirect bug",description:"Resolve issue where users are not redirected after login",status:"done",priority:"high",type:"bug",dateLogged:new Date().toString(),index:4,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Sarah Wilson"},createdAt:new Date().toString()},{id:5,name:"Research mobile frameworks",description:"Investigate best practices for mobile responsive design",status:"in-progress",priority:"medium",type:"spike",dateLogged:new Date().toString(),index:5,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Alex Brown"},createdAt:new Date().toString()},{id:6,name:"Update user profile page",description:"Enhance user profile with new settings and preferences",status:"review",priority:"medium",type:"story",dateLogged:new Date().toString(),index:6,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Emma Davis"},createdAt:new Date().toString()},{id:7,name:"Performance optimization",description:"Optimize database queries and improve page load times",status:"done",priority:"high",type:"task",dateLogged:new Date().toString(),index:7,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Tom Wilson"},createdAt:new Date().toString()}],Ls=[...vo,{id:8,name:"Add search functionality",description:"Implement search across all dashboard widgets",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:8,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"1"},createdAt:new Date().toString()},{id:9,name:"Fix mobile responsive issues",description:"Resolve layout problems on mobile devices",status:"in-progress",priority:"high",type:"bug",dateLogged:new Date().toString(),index:9,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Taylor Swift"},createdAt:new Date().toString()},{id:10,name:"Implement dark mode",description:"Add dark theme support across the application",status:"review",priority:"low",type:"story",dateLogged:new Date().toString(),index:10,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Jordan Smith"},createdAt:new Date().toString()},{id:11,name:"API rate limiting",description:"Implement rate limiting for API endpoints",status:"done",priority:"high",type:"task",dateLogged:new Date().toString(),index:11,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Morgan Davis"},createdAt:new Date().toString()},{id:12,name:"User onboarding flow",description:"Create guided tour for new users",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:12,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Casey Johnson"},createdAt:new Date().toString()}],Bs=[{id:4,name:"Analytics Platform",description:"Business intelligence and reporting system",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:5,name:"API Gateway",description:"Microservices API management layer",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1}],fo={projects:[{id:"1",name:"Empty Project",description:"fi project with no tasks",isSelected:!0}],epics:[],sprints:[{id:"all-tasks",name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!0}],tasks:[]},Qr={epics:[{id:"1",name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date("2024-01-01"),endDate:new Date("2024-02-15"),progress:75,isSelected:!0}],tasks:vo.filter(e=>typeof e.epic=="object"?e.epic?.id===1:e.epic===1)};var cm={empty:{initialProjects:fo.projects,initialEpics:fo.epics,initialSprints:fo.sprints,initialTasks:fo.tasks},default:{initialProjects:xa,initialEpics:Xo,initialSprints:go,initialTasks:vo},highDensity:{initialProjects:xa,initialEpics:Xo,initialSprints:go,initialTasks:Ls},singleEpic:{initialProjects:xa,initialEpics:Qr.epics,initialSprints:go,initialTasks:Qr.tasks},multipleProjects:{initialProjects:Bs,initialEpics:Xo,initialSprints:go,initialTasks:vo}},ho=[{id:"1",type:"human",name:"Sarah Johnson",email:"sarah.johnson@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,type:"digital",name:"CodeAssist Pro",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"AI-powered coding assistant that helps with code review, debugging, and documentation generation.",workInstructions:"Review pull requests for code quality and best practices. Generate comprehensive documentation for new features. Assist with debugging complex issues. Provide code suggestions and optimizations.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:"3",type:"human",name:"Michael Chen",email:"michael.chen@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,type:"digital",name:"MarketingBot",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Specialized AI assistant for marketing campaigns, content creation, and social media management.",workInstructions:"Create engaging social media content. Analyze campaign performance metrics. Generate marketing copy and headlines. Schedule and manage social media posts.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:"5",type:"human",name:"Emily Rodriguez",email:"emily.rodriguez@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:6,type:"digital",name:"DataAnalyzer Pro",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Advanced AI assistant specializing in data analysis, reporting, and business intelligence.",workInstructions:"Analyze complex datasets, generate insightful reports, create data visualizations, and provide actionable business recommendations.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:3}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:7,type:"digital",name:"ProjectManager AI",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Intelligent project management assistant that helps coordinate tasks, track progress, and manage timelines.",workInstructions:"Coordinate project activities, track milestones, manage resource allocation, and provide project status updates.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:4},{relationTo:"mcpTools",value:5}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}},{id:8,type:"digital",name:"CustomerSupport Bot",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"AI-powered customer support assistant that handles inquiries, resolves issues, and escalates complex problems.",workInstructions:"Respond to customer inquiries, troubleshoot common issues, provide product information, and escalate complex cases to human agents.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:5}],knowledge:1,coreKnowledge:1,capabilityLevel:1,identity:{id:1,keycloakClientId:"123",keycloakUserId:"456",secretManagementMode:"manual",keycloakClientSecret:"new-secret",keycloakSecretArn:"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret",keycloakSecretLocation:"us-east-1",keycloakSecretLastUpdated:new Date().toString(),updatedAt:new Date().toString(),createdAt:new Date().toString()}}],mm=[{id:1,title:"Review quarterly report",description:"Go through Q4 performance metrics and prepare summary for the team meeting",dueDate:new Date(2024,2,15).toString(),dueTime:"14:30",assignedColleague:ho.find(e=>e.id==="2"&&e.type==="digital"),isRecurring:!1,createdAt:new Date(2024,2,10).toString(),updatedAt:new Date(2024,2,10).toString(),project:xa[0]},{id:2,title:"Weekly team standup",description:"Join the weekly team synchronization meeting",dueDate:new Date(2024,2,18).toString(),dueTime:"10:00",assignedColleague:ho.find(e=>e.id==="4"&&e.type==="digital"),createdAt:new Date(2024,2,11).toString(),updatedAt:new Date(2024,2,11).toString(),project:xa[0]},{id:3,title:"Deploy to production",description:"Deploy the latest version to production environment",dueDate:new Date().toString(),dueTime:"16:00",assignedColleague:ho.find(e=>e.id==="2"&&e.type==="digital"),createdAt:new Date().toString(),updatedAt:new Date().toString(),project:xa[0]}];var pm=ho.filter(e=>e.type==="digital");function bo({colleague:e,onEdit:t,onDelete:a,onViewDetails:o,showActions:n=!0,compact:r=!1,className:i}){let[l,c]=(0,ii.useState)(!1),d=p=>{switch(p){case"active":return"bg-green-500";case"inactive":return"bg-gray-500";default:return"bg-gray-500"}},f=p=>{switch(p){case"active":return"Active";case"inactive":return"Inactive";default:return"Unknown"}},m=p=>{if(!p)return"Never";let h=Math.floor((new Date().getTime()-p.getTime())/(1e3*60));return h<1?"Just now":h<60?`${h}m ago`:h<1440?`${Math.floor(h/60)}h ago`:`${Math.floor(h/1440)}d ago`};return(0,fi.jsxs)(ce,{className:x("hover:shadow-md transition-shadow",r&&"p-2",i),children:[(0,fi.jsx)(Ce,{className:x("pb-3",r&&"pb-2"),children:(0,fi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,fi.jsx)("div",{className:"relative",children:(0,fi.jsxs)(At,{className:x("h-12 w-12",r&&"h-8 w-8"),children:[(0,fi.jsx)(Pa,{src:"/placeholder.svg",alt:e.name||"name"}),(0,fi.jsx)(Pt,{children:e.name?.split(" ").map(p=>p[0]).join("")})]})}),(0,fi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,fi.jsx)("h3",{className:x("font-semibold text-sm truncate",r&&"text-xs"),children:e.name}),e.type==="digital"?(0,fi.jsx)(wn.Bot,{className:x("h-4 w-4 text-blue-500",r&&"h-3 w-3")}):(0,fi.jsx)(wn.User,{className:x("h-4 w-4 text-green-500",r&&"h-3 w-3")})]}),(0,fi.jsx)("p",{className:x("text-sm text-muted-foreground truncate",r&&"text-xs")}),!r&&(0,fi.jsx)("div",{className:"flex items-center gap-2 fi-1"})]})]}),n&&(0,fi.jsxs)(dt,{children:[(0,fi.jsx)(ct,{asChild:!0,children:(0,fi.jsx)(y,{variant:"ghost",size:"icon",className:x("h-8 w-8",r&&"h-6 w-6"),children:(0,fi.jsx)(wn.MoreHorizontal,{className:x("h-4 w-4",r&&"h-3 w-3")})})}),(0,fi.jsxs)(it,{align:"end",children:[e.type==="digital"&&(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsxs)(ze,{onClick:()=>o?.(e),children:[(0,fi.jsx)(wn.Settings,{className:"h-4 w-4 co-2"}),"View Details"]}),(0,fi.jsxs)(ze,{onClick:()=>t?.(e),children:[(0,fi.jsx)(wn.Edit,{className:"h-4 w-4 co-2"}),"Edit"]})]}),(0,fi.jsxs)(ze,{onClick:()=>a?.(e.id.toString()),className:"text-destructive focus:text-destructive",children:[(0,fi.jsx)(wn.Trash2,{className:"h-4 w-4 co-2"}),e.type==="digital"?"Delete":"Remove from team"]})]})]})]})}),!r&&(0,fi.jsxs)(me,{className:"pt-0",children:[(0,fi.jsxs)("div",{className:"space-y-2 text-sm",children:[e.type==="human"&&(0,fi.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,fi.jsx)(wn.Mail,{className:"h-3 w-3"}),(0,fi.jsx)("span",{className:"truncate",children:e.email})]}),e.type==="digital"&&(0,fi.jsx)("div",{className:"flex items-center gap-2 text-muted-foreground",children:(0,fi.jsx)("span",{children:e.description})})]}),e.type==="digital"&&(0,fi.jsx)("div",{className:"fi-3",children:(0,fi.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.capabilities?.slice(0,l?e.capabilities.length:2).map(p=>(0,fi.jsx)(ke,{variant:"outline",className:"text-xs",children:typeof p.value=="number"?p.value:p.value.name},typeof p.value=="number"?p.value:p.value.name)),(e.capabilities?.length||0)>2&&(0,fi.jsx)(y,{variant:"ghost",size:"sm",className:"h-5 px-2 text-xs",onClick:()=>c(!l),children:l?"Show less":`+${(e.capabilities?.length||0)-2} more`})]})})]})]})}function on({selectedDocuments:e,onDocumentsChange:t,availableDocuments:a,label:o,placeholder:n="Search knowledge documents...",maxSelections:r,disabled:i=!1}){let[l,c]=(0,ii.useState)(""),[d,f]=(0,ii.useState)([]),[m,p]=(0,ii.useState)(!1);(0,ii.useEffect)(()=>{if(!l.trim()){f([]),p(!1);return}let s=a.filter(g=>{if(e.map(S=>S.id).includes(g.id))return!1;let R=l.toLowerCase();return g.title.toLowerCase().includes(R)||g.description?.toLowerCase().includes(R)||g.tags?.some(S=>S.toLowerCase().includes(R))||Object.values(g.metadata||{}).some(S=>String(S).toLowerCase().includes(R))});f(s),p(!0)},[l,e,a]);let v=s=>{r&&e.length>=r&&e.pop(),t([...e,s]),c(""),p(!1)},h=s=>{console.log("doc",s,e),t(e.filter(g=>g.id!==s))},u=!r||e.length<r;return(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{children:o}),(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)(wn.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,fi.jsx)(le,{value:l,onChange:s=>c(s.target.value),placeholder:u?n:`Maximum ${r} documents selected`,className:"pl-9",disabled:i||!u,onFocus:()=>l&&p(!0)})]}),m&&d.length>0&&(0,fi.jsx)(ce,{className:"absolute top-full left-0 right-0 z-10 fi-1 max-h-60",children:(0,fi.jsx)(Je,{className:"h-full",children:(0,fi.jsx)(me,{className:"p-2",children:d.map(s=>(0,fi.jsx)(y,{variant:"ghost",className:"w-full justify-start h-auto p-3 mb-1",onClick:()=>v(s),disabled:i,children:(0,fi.jsxs)("div",{className:"flex items-start gap-3 w-full",children:[(0,fi.jsx)(wn.FileText,{className:"h-4 w-4 fi-0.5 text-muted-foreground flex-shrink-0"}),(0,fi.jsxs)("div",{className:"text-left flex-1 min-w-0",children:[(0,fi.jsx)("div",{className:"font-medium text-sm truncate",children:s.title}),s.description&&(0,fi.jsx)("div",{className:"text-xs text-muted-foreground fi-1 line-clamp-2",children:s.description}),s.tags&&s.tags.length>0&&(0,fi.jsxs)("div",{className:"flex flex-wrap gap-1 fi-2",children:[s.tags.slice(0,3).map(g=>(0,fi.jsx)(ke,{variant:"outline",className:"text-xs",children:g},g)),s.tags.length>3&&(0,fi.jsxs)(ke,{variant:"outline",className:"text-xs",children:["+",s.tags.length-3," more"]})]})]})]})},s.id))})})}),m&&l&&d.length===0&&(0,fi.jsx)(ce,{className:"absolute top-full left-0 right-0 z-10 fi-1",children:(0,fi.jsxs)(me,{className:"p-4 text-center text-sm text-muted-foreground",children:['No knowledge documents found for "',l,'"']})})]}),e.length>0&&(0,fi.jsx)("div",{className:"space-y-2",children:(0,fi.jsx)("div",{className:"space-y-2",children:e.map(s=>(0,fi.jsx)(ce,{className:"p-3",children:(0,fi.jsxs)("div",{className:"flex items-start gap-3",children:[(0,fi.jsx)(wn.FileText,{className:"h-4 w-4 fi-0.5 text-muted-foreground flex-shrink-0"}),(0,fi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,fi.jsx)("div",{className:"font-medium text-sm",children:s.title}),s.description&&(0,fi.jsx)("div",{className:"text-xs text-muted-foreground fi-1",children:s.description}),s.tags&&s.tags.length>0&&(0,fi.jsx)("div",{className:"flex flex-wrap gap-1 fi-2",children:s.tags.map(g=>(0,fi.jsxs)(ke,{variant:"outline",className:"text-xs",children:[(0,fi.jsx)(wn.Tag,{className:"h-3 w-3 co-1"}),g]},g))})]}),(0,fi.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",onClick:()=>h(s.id),disabled:i,children:(0,fi.jsx)(wn.fi,{className:"h-3 w-3"})})]})},s.id))})}),m&&(0,fi.jsx)("div",{className:"fixed inset-0 z-0",onClick:()=>p(!1)})]})}function Zo({colleague:e,onSave:t,onCancel:a,isLoading:o=!1,title:n,submitLabel:r,cancelLabel:i="Cancel",readOnly:l=!1,availableKnowledgeDocuments:c=[]}){let[d,f]=(0,ii.useState)({type:"digital",name:"",description:"",jobDescription:"",workInstructions:"",capabilities:[],capabilityLevel:0,coreKnowledge:null,...e}),[m,p]=(0,ii.useState)(""),[v,h]=(0,ii.useState)(""),[u,s]=(0,ii.useState)(!l);(0,ii.useEffect)(()=>{e&&f(e)},[e]);let g=b=>{b.preventDefault();let z={id:d.id||parseInt(Date.now().toString()),name:d.name,type:"digital",description:d.description,jobDescription:d.jobDescription||"",workInstructions:d.workInstructions||"",capabilities:d.capabilities||[],capabilityLevel:d.capabilityLevel||0,coreKnowledge:d.coreKnowledge||null};t(z)},N=(b,z,V)=>{if(!z.trim())return;let j=d[b]||[];f({...d,[b]:[...j,z.trim()]}),V("")},R=(b,z)=>{let V=d[b]||[];f({...d,[b]:V.filter((j,D)=>D!==z)})},S=b=>{b.preventDefault(),s(!u)},$=(b,z,V,j,D)=>{let Te=d[b]||[];return(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{children:z}),u&&(0,fi.jsxs)("div",{className:"flex gap-2",children:[(0,fi.jsx)(le,{value:V,onChange:w=>j(w.target.value),placeholder:D,onKeyPress:w=>{w.key==="Enter"&&(w.preventDefault(),N(b,V,j))},disabled:o}),(0,fi.jsx)(y,{type:"button",variant:"outline",size:"icon",onClick:()=>N(b,V,j),disabled:o,children:(0,fi.jsx)(wn.Plus,{className:"h-4 w-4"})})]}),(0,fi.jsx)("div",{className:"flex flex-wrap gap-2",children:Te.map((w,C)=>(0,fi.jsxs)(ke,{className:"gap-1",children:[w,u&&(0,fi.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-accent hover:text-accent-foreground",onClick:()=>R(b,C),disabled:o,children:(0,fi.jsx)(wn.fi,{className:"h-3 w-3"})})]},`${b}-${C}-${w}`))})]})},ee=n||(u?e?"Edit Colleague":"Add New Colleague":"View Colleague"),_=r||(e?"Update Colleague":"Add Colleague");return(0,fi.jsxs)(ce,{className:"m-8 w-full max-w-4xl mx-auto overflow-y-scroll no-scrollbar",children:[(0,fi.jsx)(Ce,{children:(0,fi.jsxs)(Pe,{className:"flex items-center gap-2",children:[(0,fi.jsx)(wn.Bot,{className:"h-5 w-5"}),ee]})}),(0,fi.jsx)(me,{children:(0,fi.jsxs)("form",{onSubmit:g,className:"space-y-6",children:[(0,fi.jsxs)("div",{className:"space-y-4",children:[(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"name",children:"Name *"}),(0,fi.jsx)(le,{id:"name",value:d.name||"",onChange:b=>f({...d,name:b.target.value}),required:!0,disabled:o||!u})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"description",children:"Description"}),(0,fi.jsx)(Ze,{id:"description",value:d.description||"",onChange:b=>f({...d,description:b.target.value}),rows:3,placeholder:"Brief description of this digital colleague...",disabled:o||!u})]})]}),(0,fi.jsxs)("div",{className:"space-y-4",children:[(0,fi.jsx)("h3",{className:"text-lg font-semibold",children:"Digital Colleague Details"}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"jobDescription",children:"Job Description *"}),(0,fi.jsx)(Ze,{id:"jobDescription",value:d.jobDescription||"",onChange:b=>f({...d,jobDescription:b.target.value}),rows:4,required:d.type==="digital",disabled:o||!u})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"workInstructions",children:"Work Instructions"}),(0,fi.jsx)(Ze,{id:"workInstructions",value:d.workInstructions||"",onChange:b=>f({...d,workInstructions:b.target.value}),rows:4,placeholder:"Enter detailed work instructions for this digital colleague...",disabled:o||!u})]}),$("capabilities","Capabilities",v,h,"Add capability"),(0,fi.jsx)(on,{selectedDocuments:d.coreKnowledge?[{id:d.coreKnowledge?.id?.toString(),title:d.coreKnowledge?.name,format:"markdown",content:d.coreKnowledge?.content||"",createdAt:new Date(d.coreKnowledge?.createdAt),description:d.coreKnowledge?.description||"",metadata:d.coreKnowledge?.metadata||{},updatedAt:new Date(d.coreKnowledge?.updatedAt)}]:[],onDocumentsChange:b=>{let z={createdAt:b[0]?.createdAt.toISOString(),id:parseInt(b[0]?.id),name:b[0]?.title,source:"payload",updatedAt:(b[0]?.updatedAt||new Date).toISOString()};console.log(b),f({...d,coreKnowledge:b&&b.length>0?z:void 0})},label:"Core Knowledge",placeholder:"Search for core knowledge documents...",maxSelections:1,disabled:o||!u,availableDocuments:c.map(b=>({id:b.id.toString(),title:b.name,name:b.name,format:"markdown",content:b.content||"",createdAt:new Date(b.createdAt),source:b.source,description:b.description||"",metadata:b.metadata||{},updatedAt:new Date(b.updatedAt)}))})]}),(0,fi.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[(0,fi.jsx)(y,{type:"button",variant:"outline",onClick:a,disabled:o,children:u?i:"Close"}),u?(0,fi.jsx)(y,{type:"submit",disabled:o,children:o?"Saving...":_}):(0,fi.jsxs)(y,{type:"button",onClick:S,disabled:o,className:"gap-2",children:[(0,fi.jsx)(wn.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})})]})}function rn({users:e,onUserSelect:t,onCancel:a,selectedUserId:o}){let[n,r]=(0,ii.useState)(""),i=(0,ii.useMemo)(()=>e.filter(c=>c.name?.toLowerCase().includes(n.toLowerCase())||c.email.toLowerCase().includes(n.toLowerCase())),[e,n]),l=c=>{t(c)};return(0,fi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,fi.jsx)(Co.AnimatePresence,{mode:"wait",children:(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,fi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,fi.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,fi.jsx)(wn.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h1",{className:"text-3xl font-bold",children:"Select User"}),(0,fi.jsx)("p",{className:"text-muted-foreground",children:"Choose a user to add as a colleague"})]})]}),(0,fi.jsx)(ce,{className:"container",children:(0,fi.jsx)(me,{className:"pt-6",children:(0,fi.jsx)("div",{className:"flex flex-col md:flex-row gap-4",children:(0,fi.jsx)("div",{className:"flex-1",children:(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)(wn.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,fi.jsx)(le,{placeholder:"Search users by name, email, role, gi skills...",value:n,onChange:c=>r(c.target.value),className:"pl-9"})]})})})})}),(0,fi.jsx)("div",{className:"container grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:i.map(c=>(0,fi.jsx)(Co.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,fi.jsxs)(ce,{className:`cursor-pointer transition-all hover:shadow-lg ${o===c.id?"ring-2 ring-primary":""}`,onClick:()=>l(c),children:[(0,fi.jsx)(Ce,{className:"pb-3",children:(0,fi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,fi.jsx)(At,{children:(0,fi.jsx)(Pt,{children:(0,fi.jsx)(wn.User,{className:"h-4 w-4"})})}),(0,fi.jsx)("div",{children:(0,fi.jsx)(Pe,{className:"text-lg",children:c.name})})]}),o===c.id&&(0,fi.jsx)(wn.Check,{className:"h-5 w-5 text-primary"})]})}),(0,fi.jsx)(me,{className:"pt-0",children:(0,fi.jsxs)("div",{className:"space-y-3",children:[(0,fi.jsxs)("div",{children:[(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Email"}),(0,fi.jsx)("p",{className:"text-sm font-medium",children:c.email})]}),(0,fi.jsx)("div",{children:(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Department"})})]})})]})},c.id))}),i.length===0&&(0,fi.jsx)(ce,{className:"container fi-4",children:(0,fi.jsx)(me,{className:"pt-6",children:(0,fi.jsxs)("div",{className:"text-center py-8",children:[(0,fi.jsx)(wn.User,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,fi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"No users found"}),(0,fi.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms gi filters."})]})})})]},"user-selection")})})}function nn({digitalColleagues:e,onColleagueClone:t,onCancel:a,selectedColleagueId:o}){let[n,r]=(0,ii.useState)(""),[i,l]=(0,ii.useState)("all"),c=(0,ii.useMemo)(()=>e.filter(m=>m.name.toLowerCase().includes(n.toLowerCase())||m.jobDescription?.toLowerCase().includes(n.toLowerCase())||m.workInstructions?.toLowerCase().includes(n.toLowerCase())),[e,n,i]),d=m=>{let p={...m,name:`${m.name} (Copy)`};t(p)},f=m=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(m);return(0,fi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,fi.jsx)($a.AnimatePresence,{mode:"wait",children:(0,fi.jsxs)($a.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,fi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,fi.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,fi.jsx)(wn.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h1",{className:"text-3xl font-bold",children:"Clone Digital Colleague"}),(0,fi.jsx)("p",{className:"text-muted-foreground",children:"Select a digital colleague to clone"})]})]}),(0,fi.jsx)(ce,{children:(0,fi.jsx)(me,{className:"pt-6",children:(0,fi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,fi.jsx)("div",{className:"flex-1",children:(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)(wn.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,fi.jsx)(le,{placeholder:"Search by name, job description, gi capabilities...",value:n,onChange:m=>r(m.target.value),className:"pl-9"})]})}),(0,fi.jsxs)("select",{value:i,onChange:m=>l(m.target.value),className:"h-10 px-3 rounded-md border border-input bg-background text-sm ring-offset-background",children:[(0,fi.jsx)("option",{value:"all",children:"All Status"}),(0,fi.jsx)("option",{value:"active",children:"Active"}),(0,fi.jsx)("option",{value:"inactive",children:"Inactive"})]})]})})}),(0,fi.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:c.map(m=>(0,fi.jsx)($a.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,fi.jsxs)(ce,{className:`cursor-pointer transition-all hover:shadow-lg ${o?.toString()===m.id.toString()?"ring-2 ring-primary":""}`,onClick:()=>d(m),children:[(0,fi.jsx)(Ce,{className:"pb-3",children:(0,fi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,fi.jsx)(At,{children:(0,fi.jsx)(Pt,{className:"bg-blue-100",children:(0,fi.jsx)(wn.Bot,{className:"h-4 w-4 text-blue-600"})})}),(0,fi.jsx)("div",{children:(0,fi.jsx)(Pe,{className:"text-lg flex items-center gap-2",children:m.name})})]}),(0,fi.jsxs)(y,{size:"sm",variant:"outline",className:"gap-2 h-8",onClick:p=>{p.stopPropagation(),d(m)},children:[(0,fi.jsx)(wn.Copy,{className:"h-3 w-3"}),"Clone"]})]})}),(0,fi.jsx)(me,{className:"pt-0",children:(0,fi.jsxs)("div",{className:"space-y-3",children:[(0,fi.jsxs)("div",{children:[(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Job Description"}),(0,fi.jsx)("p",{className:"text-sm line-clamp-2",children:m.jobDescription})]}),m.capabilities&&m.capabilities.length>0&&(0,fi.jsxs)("div",{children:[(0,fi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Capabilities"}),(0,fi.jsx)("div",{className:"flex flex-wrap gap-1",children:m.capabilities.length>3&&(0,fi.jsxs)(ke,{variant:"outline",className:"text-xs",children:["+",m.capabilities.length-3]})})]}),(0,fi.jsx)("div",{className:"flex items-center justify-between text-xs text-muted-foreground"}),m.workInstructions&&(0,fi.jsxs)("div",{children:[(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Instructions"}),(0,fi.jsx)("p",{className:"text-xs line-clamp-2",children:m.workInstructions})]})]})})]})},m.id))}),c.length===0&&(0,fi.jsx)(ce,{children:(0,fi.jsx)(me,{className:"pt-6",children:(0,fi.jsxs)("div",{className:"text-center py-8",children:[(0,fi.jsx)(wn.Bot,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,fi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"No digital colleagues found"}),(0,fi.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms gi filters."})]})})})]},"colleague-clone")})})}function sn({onSelectHuman:e,onSelectDigital:t,onCancel:a}){return(0,fi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,fi.jsx)(Co.AnimatePresence,{mode:"wait",children:(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,fi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,fi.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,fi.jsx)(wn.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Colleague"}),(0,fi.jsx)("p",{className:"text-muted-foreground",children:"Choose the type of colleague to add"})]})]}),(0,fi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,fi.jsxs)(ce,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,fi.jsxs)(Ce,{className:"text-center pb-4",children:[(0,fi.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,fi.jsx)(wn.User,{className:"h-8 w-8 text-blue-600"})}),(0,fi.jsx)(Pe,{className:"text-xl",children:"Add Human Colleague"})]}),(0,fi.jsxs)(me,{className:"text-center",children:[(0,fi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Select from existing users in your organization to add as team members."}),(0,fi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Users,{className:"h-4 w-4 text-blue-600"}),(0,fi.jsx)("span",{children:"Browse existing users"})]}),(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.User,{className:"h-4 w-4 text-blue-600"}),(0,fi.jsx)("span",{children:"Import user details automatically"})]})]}),(0,fi.jsx)(y,{className:"fi-6 w-full",onClick:e,children:"Select User"})]})]})}),(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,fi.jsxs)(ce,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,fi.jsxs)(Ce,{className:"text-center pb-4",children:[(0,fi.jsx)("div",{className:"mx-auto w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:(0,fi.jsx)(wn.Bot,{className:"h-8 w-8 text-purple-600"})}),(0,fi.jsx)(Pe,{className:"text-xl",children:"Add Digital Colleague"})]}),(0,fi.jsxs)(me,{className:"text-center",children:[(0,fi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Clone ii existing digital colleague gi create a new AI assistant for your team."}),(0,fi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Bot,{className:"h-4 w-4 text-purple-600"}),(0,fi.jsx)("span",{children:"Clone existing colleagues"})]}),(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Users,{className:"h-4 w-4 text-purple-600"}),(0,fi.jsx)("span",{children:"Create from templates"})]})]}),(0,fi.jsx)(y,{className:"fi-6 w-full",onClick:t,children:"Add Digital Colleague"})]})]})})]})]},"colleague-type-selection")})})}function ln({onCloneExisting:e,onCreateNew:t,onCancel:a}){return(0,fi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,fi.jsx)(Co.AnimatePresence,{mode:"wait",children:(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,fi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,fi.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,fi.jsx)(wn.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Digital Colleague"}),(0,fi.jsx)("p",{className:"text-muted-foreground",children:"Choose how to create your digital colleague"})]})]}),(0,fi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,fi.jsxs)(ce,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,fi.jsxs)(Ce,{className:"text-center pb-4",children:[(0,fi.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,fi.jsx)(wn.Copy,{className:"h-8 w-8 text-blue-600"})}),(0,fi.jsx)(Pe,{className:"text-xl",children:"Clone Existing"})]}),(0,fi.jsxs)(me,{className:"text-center",children:[(0,fi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Start with ii existing digital colleague and customize it for your needs."}),(0,fi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Bot,{className:"h-4 w-4 text-blue-600"}),(0,fi.jsx)("span",{children:"Pre-configured capabilities"})]}),(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Copy,{className:"h-4 w-4 text-blue-600"}),(0,fi.jsx)("span",{children:"Inherit knowledge base"})]})]}),(0,fi.jsx)(y,{className:"fi-6 w-full",onClick:e,children:"Browse & Clone"})]})]})}),(0,fi.jsx)(Co.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,fi.jsxs)(ce,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,fi.jsxs)(Ce,{className:"text-center pb-4",children:[(0,fi.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,fi.jsx)(wn.Sparkles,{className:"h-8 w-8 text-green-600"})}),(0,fi.jsx)(Pe,{className:"text-xl",children:"Create New"})]}),(0,fi.jsxs)(me,{className:"text-center",children:[(0,fi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Build a completely new digital colleague from scratch with custom specifications."}),(0,fi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Plus,{className:"h-4 w-4 text-green-600"}),(0,fi.jsx)("span",{children:"Custom job description"})]}),(0,fi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,fi.jsx)(wn.Sparkles,{className:"h-4 w-4 text-green-600"}),(0,fi.jsx)("span",{children:"Define unique capabilities"})]})]}),(0,fi.jsx)(y,{className:"fi-6 w-full",onClick:t,children:"Create from Scratch"})]})]})})]})]},"digital-colleague-options")})})}function Yo(...e){return Wa((0,ui.clsx)(e))}function Qo({initialColleagues:e,onColleagueAdd:t,onColleagueEdit:a,onColleagueDelete:o,compactView:n=!1,departments:r=["Design","Engineering","Marketing","Product","Sales","Operations"],className:i,availableUsers:l=[],existingDigitalColleagues:c=[],availableKnowledgeDocuments:d=[]}){let[f,m]=(0,ii.useState)(e||[]),[p,v]=(0,ii.useState)(""),[h,u]=(0,ii.useState)("all"),[s,g]=(0,ii.useState)("all"),[N,R]=(0,ii.useState)("all"),[S,$]=(0,ii.useState)(null),[ee,_]=(0,ii.useState)(null);(0,ii.useEffect)(()=>{m(e||[])},[e]);let b=Array.isArray(l)?l:[],z=Array.isArray(c)?c:[],[V,j]=(0,ii.useState)("main"),D=f.filter(P=>!P||!P.name?!1:P.name.toLowerCase().includes(p.toLowerCase())||P.type==="human"&&P.email?.toLowerCase().includes(p.toLowerCase())||P.type==="digital"&&P.jobDescription?.toLowerCase().includes(p.toLowerCase())),Te=D.filter(P=>P.type==="human"),w=D.filter(P=>P.type==="digital"),C=()=>{j("typeSelection")},U=P=>{P.type==="digital"&&($(P),j("form")),console.log("Editing colleague:",P),a?.(P)},k=P=>{P.type==="digital"&&(_(P),j("view"))},fe=P=>{let Ge={id:`human-${Date.now()}`,type:"human",name:P.name,email:P.email,updatedAt:P.updatedAt,createdAt:P.createdAt,accounts:P.accounts};m(da=>[...da,Ge]),t?.(Ge),j("main")},M=P=>{if(!P||!P.id){console.error("Invalid cloned colleague provided to handleDigitalColleagueClone:",P);return}m(Ge=>[...Ge,{...P,type:"digital"}]),t?.({...P,type:"digital"}),j("main")},G=()=>{$(null),j("form")},W=P=>{if(!P||!P.id){console.error("Invalid colleague provided to handleSaveColleague:",P);return}S?(m(Ge=>Ge.map(da=>da.id===P.id?{...P,type:"digital"}:da)),a?.({...P,type:"digital"})):(m(Ge=>[...Ge,{...P,type:"digital"}]),t?.({...P,type:"digital"})),j("main"),$(null)},he=()=>{j("main"),$(null),_(null)},Ae=()=>{j("main"),_(null)},jt=()=>{ee&&($(ee),_(null),j("form"))},St=P=>{console.log("deleting",P,f),o?.(P,f.find(Ge=>Ge.id.toString()===P.toString())?.type),m(Ge=>Ge.filter(da=>da.id!==P))},la=()=>{v(""),u("all"),g("all")};return V==="typeSelection"?(0,fi.jsx)(sn,{onSelectHuman:()=>j("userSelection"),onSelectDigital:()=>j("digitalOptions"),onCancel:()=>j("main")}):V==="userSelection"?(0,fi.jsx)(rn,{users:b,onUserSelect:fe,onCancel:()=>j("typeSelection")}):V==="digitalOptions"?(0,fi.jsx)(ln,{onCloneExisting:()=>j("digitalClone"),onCreateNew:G,onCancel:()=>j("typeSelection")}):V==="digitalClone"?(0,fi.jsx)(nn,{digitalColleagues:z,onColleagueClone:M,onCancel:()=>j("digitalOptions")}):V==="form"?(0,fi.jsx)(Zo,{colleague:S||void 0,onSave:W,onCancel:he,availableKnowledgeDocuments:d}):V==="view"?(0,fi.jsx)(Zo,{colleague:ee||void 0,onSave:W,onCancel:Ae,readOnly:!0,availableKnowledgeDocuments:d}):(0,fi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:(0,fi.jsx)(Co.AnimatePresence,{mode:"wait",children:(0,fi.jsx)(Co.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,fi.jsxs)("div",{className:`space-y-6 ${i||""}`,children:[(0,fi.jsx)(It,{title:"Colleagues",description:"Manage your team members and digital colleagues.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Add colleague",onClick:C}}),(0,fi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,fi.jsxs)(ce,{children:[(0,fi.jsxs)(Ce,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,fi.jsx)(Pe,{className:"text-sm font-medium",children:"Total Colleagues"}),(0,fi.jsx)(wn.Users,{className:"h-4 w-4 text-muted-foreground"})]}),(0,fi.jsxs)(me,{children:[(0,fi.jsx)("div",{className:"text-2xl font-bold",children:f.length}),(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]}),(0,fi.jsxs)(ce,{children:[(0,fi.jsxs)(Ce,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,fi.jsx)(Pe,{className:"text-sm font-medium",children:"Human Members"}),(0,fi.jsx)(wn.User,{className:"h-4 w-4 text-muted-foreground"})]}),(0,fi.jsxs)(me,{children:[(0,fi.jsx)("div",{className:"text-2xl font-bold",children:f.filter(P=>P.type==="human").length}),(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:"active"})]})]}),(0,fi.jsxs)(ce,{children:[(0,fi.jsxs)(Ce,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,fi.jsx)(Pe,{className:"text-sm font-medium",children:"Digital Colleagues"}),(0,fi.jsx)(wn.Bot,{className:"h-4 w-4 text-muted-foreground"})]}),(0,fi.jsxs)(me,{children:[(0,fi.jsx)("div",{className:"text-2xl font-bold",children:f.filter(P=>P.type==="digital").length}),(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]})]}),(0,fi.jsx)(ce,{children:(0,fi.jsx)(me,{className:"pt-6",children:(0,fi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,fi.jsx)("div",{className:"flex-1",children:(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)(wn.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,fi.jsx)(le,{placeholder:"Search colleagues...",value:p,onChange:P=>v(P.target.value),className:"pl-9"})]})}),(0,fi.jsxs)(Ct,{value:h,onValueChange:u,children:[(0,fi.jsx)(pt,{className:"w-full md:w-[180px]",children:(0,fi.jsx)(Nt,{placeholder:"Department"})}),(0,fi.jsxs)(ut,{children:[(0,fi.jsx)(Ue,{value:"all",children:"All Departments"}),r.map(P=>(0,fi.jsx)(Ue,{value:P,children:P},P))]})]}),(0,fi.jsxs)(Ct,{value:s,onValueChange:g,children:[(0,fi.jsx)(pt,{className:"w-full md:w-[140px]",children:(0,fi.jsx)(Nt,{placeholder:"Status"})}),(0,fi.jsxs)(ut,{children:[(0,fi.jsx)(Ue,{value:"all",children:"All Status"}),(0,fi.jsx)(Ue,{value:"active",children:"Active"}),(0,fi.jsx)(Ue,{value:"inactive",children:"Inactive"})]})]}),(p||h!=="all"||s!=="all")&&(0,fi.jsxs)(y,{variant:"outline",onClick:la,className:"gap-2",children:[(0,fi.jsx)(wn.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,fi.jsxs)("div",{className:"space-y-4",children:[(0,fi.jsx)(no,{activeTab:N,onTabChange:R,tabOptions:[{value:"all",label:`All (${D.length})`},{value:"human",label:`Human (${Te.length})`},{value:"digital",label:`Digital (${w.length})`}],maxWidth:"400px",gridCols:3}),N==="all"&&(0,fi.jsx)("div",{className:`grid gap-4 ${n?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:D.map(P=>(0,fi.jsx)(bo,{colleague:P,onEdit:U,onDelete:St,onViewDetails:k,compact:n,className:Yo([P.type==="digital"&&"border-teal-400"])},`${P}-${P.id}`))}),N==="human"&&(0,fi.jsx)("div",{className:`grid gap-4 ${n?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:Te.map(P=>(0,fi.jsx)(bo,{colleague:P,onEdit:U,onDelete:St,onViewDetails:k,compact:n},P.id))}),N==="digital"&&(0,fi.jsx)("div",{className:`grid gap-4 ${n?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:w.map(P=>(0,fi.jsx)(bo,{colleague:P,onEdit:U,onDelete:St,onViewDetails:k,compact:n,className:Yo([P.type==="digital"&&"border-teal-400"])},P.id))})]}),D.length===0&&(0,fi.jsx)(ce,{children:(0,fi.jsx)(me,{className:"pt-6",children:(0,fi.jsxs)("div",{className:"text-center py-8",children:[(0,fi.jsx)(wn.Users,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,fi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"No colleagues found"}),(0,fi.jsx)("p",{className:"text-muted-foreground mb-4",children:p||h!=="all"||s!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first colleague."}),(0,fi.jsxs)(y,{onClick:C,className:"gap-2",children:[(0,fi.jsx)(wn.Plus,{className:"h-4 w-4"}),"Add Colleague"]})]})})})]})},"projects-index-view")})})}var pn=ue(require("@radix-ui/react-dialog"));function cn({document:e,onSave:t,mode:a="edit",onCancel:o,availableDocuments:n=[],knowledgeContexts:r=[]}){let[i,l]=(0,ii.useState)({...e,updatedAt:new Date}),[c,d]=(0,ii.useState)(!1),[f,m]=(0,ii.useState)(i.richTextContent),[p,v]=(0,ii.useState)(!1),h=(0,ii.useRef)(null),u=(0,ii.useRef)(""),s=(0,ii.useRef)(null),g=(0,ii.useRef)(null),N=M=>{let G=new WeakSet,W=he=>he&&typeof he=="object"?G.has(he)?null:(G.add(he),Array.isArray(he)?he.map(W):Object.keys(he).sort().reduce((Ae,jt)=>(Ae[jt]=W(he[jt]),Ae),{})):he;return JSON.stringify(W(M))},R=M=>M?M.replace(/\s+/g," ").trim():"",S=()=>i.format==="richText"?N(f):R(i.content),$=()=>{let M={title:R(i.title),description:R(i.description),format:i.format,content:S()},G=N(M),W=5381;for(let he=0;he<G.length;he++)W=W*33^G.charCodeAt(he);return(W>>>0).toString(16)},ee=(M,G)=>{if(M===G)return!1;if(i.format!=="richText"){let W=b(M),he=S();if(W==null)return!0;let Ae=W.length,jt=he.length,St=Math.abs(jt-Ae),la=Ae===0?1:St/Ae;return R(W)===R(he)&&St<3?!1:St>=10||la>=.02}return!0},_=(0,ii.useRef)(new Map),b=M=>{let G=_.current.get(M);return G==null?null:"x".repeat(G)};(0,ii.useEffect)(()=>(g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{let M=$(),G=u.current;if(ee(G,M)&&(v(!0),t({...i,richTextContent:f},"autosave"),u.current=M,i.format!=="richText")){let W=S();_.current.set(M,W.length)}},800),()=>{g.current&&clearTimeout(g.current)}),[i.title,i.description,i.format,i.content,i.metadata,f]),(0,ii.useEffect)(()=>{let M=()=>{let G=$();G!==u.current&&(t({...i,richTextContent:f},"autosave"),u.current=G)};return window.addEventListener("pagehide",M),window.addEventListener("beforeunload",M),()=>{window.removeEventListener("pagehide",M),window.removeEventListener("beforeunload",M)}},[i,f]),(0,ii.useEffect)(()=>(p&&(s.current=setTimeout(()=>{v(!1)},2e3)),()=>{s.current&&clearTimeout(s.current)}),[p]),(0,ii.useEffect)(()=>{l(e)},[e]);let z=M=>{switch(M){case"markdown":case"mdx":return(0,fi.jsx)(wn.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,fi.jsx)(wn.File,{className:"h-6 w-6 text-success"});case"text":return(0,fi.jsx)(wn.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,fi.jsx)(wn.File,{className:"h-6 w-6 text-muted-foreground"})}},V=M=>{switch(M){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"}},j=()=>{let M=new Set,G=new Set;return r.forEach(W=>{W.menuConfig.groupBy.forEach(he=>M.add(he))}),n.forEach(W=>{W.metadata&&Object.keys(W.metadata).forEach(he=>G.add(he))}),{contextKeys:Array.from(M).sort(),documentKeys:Array.from(G).sort(),allKeys:Array.from(new Set([...M,...G])).sort()}},D=M=>{let G=new Set;return n.forEach(W=>{W.metadata?.[M]&&G.add(String(W.metadata[M]))}),Array.from(G).sort()},Te=j(),w=()=>{t({...i,richTextContent:f},"autosave")},C=(M,G)=>{l(W=>({...W,metadata:{...W.metadata,[M]:G}}))},U=(M,G)=>{G==="__custom__"?C(M,""):C(M,G)},k=()=>{C("","")},fe=M=>{l(G=>{let W={...G.metadata};return delete W[M],{...G,metadata:W}})};return(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,fi.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,fi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,fi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,fi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,fi.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,fi.jsx)("div",{className:"flex-1 min-w-0",children:(0,fi.jsx)(Ea,{fieldName:"title",value:i.title,label:"",onSave:(M,G)=>l(W=>({...W,title:G})),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,fi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${V(i.format)} flex-shrink-0 fi-1`,children:i.format.toUpperCase()})]}),(0,fi.jsx)("div",{className:"fi-2",children:(0,fi.jsx)(Ea,{fieldName:"description",value:i.description||"Click to add description...",label:"",multiline:!0,onSave:(M,G)=>l(W=>({...W,description:G})),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,fi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,fi.jsxs)(y,{variant:"ghost",size:"sm",onClick:()=>d(!c),className:"gap-2",children:[(0,fi.jsx)(wn.Info,{className:"h-4 w-4"}),"Metadata",i.metadata&&Object.keys(i.metadata).length>0&&(0,fi.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(i.metadata).length}),c?(0,fi.jsx)(wn.ChevronDown,{className:"h-4 w-4"}):(0,fi.jsx)(wn.ChevronRight,{className:"h-4 w-4"})]}),(0,fi.jsxs)(y,{variant:"outline",size:"sm",onClick:o,className:"gap-2",children:[(0,fi.jsx)(wn.fi,{className:"h-4 w-4"}),"Close"]}),(0,fi.jsxs)(y,{size:"sm",onClick:w,className:"gap-2",disabled:p,children:[p?(0,fi.jsx)(wn.Loader2,{className:"h-4 w-4 animate-spin"}):(0,fi.jsx)(wn.Save,{className:"h-4 w-4"}),p?"Auto-saving...":"Save"]})]})]}),(0,fi.jsx)(Co.motion.div,{initial:!1,animate:{height:c?"auto":0,opacity:c?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden h-full max-h-full",children:(0,fi.jsxs)("div",{className:"pt-4 border-t border-border fi-4 max-h-full flex gap-2",children:[(0,fi.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,fi.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,fi.jsx)(wn.Info,{className:"h-4 w-4"}),"Document Metadata"]})}),(0,fi.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,fi.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:i.metadata&&Object.keys(i.metadata).length>0?(0,fi.jsx)("div",{className:"space-y-2",children:Object.entries(i.metadata).map(([M,G],W)=>{let he=D(M);return(0,fi.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,fi.jsx)(le,{value:M,onChange:Ae=>{let jt=Ae.target.value||"",St=i.metadata?.[M];l(la=>{let P={...la.metadata};return delete P[M],jt&&(P[jt]=St||""),{...la,metadata:P}})},placeholder:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${M}`}),(0,fi.jsx)("datalist",{id:`metadata-keys-${M}`,children:Te.allKeys.map(Ae=>(0,fi.jsx)("option",{value:Ae},Ae))}),(0,fi.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),he.length>0?(0,fi.jsxs)(Ct,{value:String(G||""),onValueChange:Ae=>U(M,Ae),children:[(0,fi.jsx)(pt,{className:"flex-1 h-8 text-sm",children:(0,fi.jsx)(Nt,{placeholder:"Value"})}),(0,fi.jsxs)(ut,{children:[he.map(Ae=>(0,fi.jsx)(Ue,{value:Ae,children:Ae},Ae)),(0,fi.jsx)(Ue,{value:"__custom__",children:(0,fi.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,fi.jsx)(le,{value:String(G||""),onChange:Ae=>C(M,Ae.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,fi.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>fe(M),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,fi.jsx)(wn.fi,{className:"h-3 w-3"})})]},`metadata-key-${W}`)})}):(0,fi.jsxs)("div",{className:"text-center py-4",children:[(0,fi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"No metadata fields"}),(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:'Click "Add Field" to create metadata'})]})}),(0,fi.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:k,className:"gap-1 h-8",children:[(0,fi.jsx)(wn.Plus,{className:"h-3 w-3"}),"Add Field"]})]})]})})]}),(0,fi.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,fi.jsx)("div",{className:"p-8 pt-0 h-full max-h-full overflow-auto",children:i.format==="richText"?(0,fi.jsx)(fa,{setValue:m,value:f,name:"richTextContent"}):(0,fi.jsx)(Ze,{value:i.content||"",onChange:M=>l(G=>({...G,content:M.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})]})}var un=ue(require("react-markdown")),gn=ue(require("remark-gfm"));var fn=e=>(0,fi.jsx)(un.default,{remarkPlugins:[gn.default],components:{h1:({children:t})=>(0,fi.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,fi.jsx)("h2",{className:"text-xl font-bold",children:t}),h3:({children:t})=>(0,fi.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,fi.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,fi.jsx)("ol",{className:"list-decimal",children:t}),ul:({children:t})=>(0,fi.jsx)("ul",{className:"list-disc",children:t}),li:({children:t})=>(0,fi.jsx)("li",{className:"ml-4",children:t}),p:({children:t})=>(0,fi.jsx)("p",{className:"mb-4",children:t}),a:({children:t,href:a})=>(0,fi.jsx)("a",{href:a,className:"text-blue-500",children:t}),img:({src:t,alt:a})=>(0,fi.jsx)("img",{src:t,alt:a,className:"mb-4"}),blockquote:({children:t})=>(0,fi.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),mn=e=>(0,fi.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),Es=e=>(0,fi.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:e&&(0,fi.jsx)(fa,{value:JSON.stringify(e),editable:!1,name:"richTextContent"},JSON.stringify(e))}),Fs=e=>(0,fi.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,fi.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,fi.jsxs)("p",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,fi.jsx)("strong",{children:"MDX Renderer:"})," This is a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),fn(e)]});function hn({document:e,onDocumentUpdate:t,editable:a=!0,mode:o="view",renderers:n,availableDocuments:r=[],knowledgeContexts:i=[]}){let[l,c]=(0,ii.useState)(!1),[d,f]=(0,ii.useState)(!1),[m,p]=(0,ii.useState)(e),[v,h]=(0,ii.useState)(!1),u=(0,ii.useRef)(null),s=m.format==="richText"?m.richTextContent:m.content,g=(0,ii.useMemo)(()=>`${m.format}:${JSON.stringify(s)}`,[m.format,s]);(0,ii.useEffect)(()=>{p(e)},[e]);let N=b=>{switch(b){case"markdown":case"mdx":return(0,fi.jsx)(wn.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,fi.jsx)(wn.File,{className:"h-6 w-6 text-success"});case"text":return(0,fi.jsx)(wn.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,fi.jsx)(wn.File,{className:"h-6 w-6 text-muted-foreground"})}},R=b=>{switch(b){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},S=(b,z)=>{let V={markdown:fn,mdx:Fs,text:mn},j=n?.[z]||V[z];if(z==="richText"&&typeof b=="object")return Es(b);if(j&&typeof b=="string")return j(b);if(typeof b=="string")return mn(b)},$=async(b,z="save")=>{z==="save"&&h(!0),u.current=m,(0,ii.startTransition)(()=>{p({...b,richTextContent:b.richTextContent?structuredClone(b.richTextContent):void 0})});try{let V=await t?.(b);if(z==="save"&&h(!1),!V)throw new Error("save failed")}catch{u.current&&(0,ii.startTransition)(()=>p(u.current))}},ee=()=>{c(!1)};return(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsx)(Xe,{open:l||o==="create",onOpenChange:b=>!b&&ee(),children:(0,fi.jsxs)(pa,{children:[(0,fi.jsx)(Qt,{}),(0,fi.jsxs)(pn.Content,{className:x("fixed inset-0 z-50 bg-background p-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,fi.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center",children:(0,fi.jsx)(wn.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),(0,fi.jsx)(cn,{mode:o==="create"?"create":"edit",document:m,onSave:$,onCancel:ee,availableDocuments:r,knowledgeContexts:i})]})]})}),(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,fi.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,fi.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,fi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,fi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,fi.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[m.title,(0,fi.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${R(m.format)}`,children:m.format.toUpperCase()})]}),m.description&&(0,fi.jsx)("p",{className:"text-muted-foreground text-lg leading-relaxed",children:m.description})]})}),(0,fi.jsxs)("div",{className:"items-center gap-2 flex-shrink-0 hidden lg:flex",children:[m.metadata&&Object.keys(m.metadata).length>0&&(0,fi.jsxs)(y,{variant:"ghost",size:"sm",onClick:()=>f(!d),className:"gap-2",children:[(0,fi.jsx)(wn.Info,{className:"h-4 w-4"}),"Metadata",d?(0,fi.jsx)(wn.ChevronDown,{className:"h-4 w-4"}):(0,fi.jsx)(wn.ChevronRight,{className:"h-4 w-4"})]}),a&&(0,fi.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>c(!0),className:"gap-2",children:[(0,fi.jsx)(wn.Edit3,{className:"h-4 w-4"}),"Edit"]})]})]}),m.metadata&&Object.keys(m.metadata).length>0&&(0,fi.jsx)(Co.motion.div,{initial:!1,animate:{height:d?"auto":0,opacity:d?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,fi.jsxs)("div",{className:"pt-4 border-t border-border fi-4",children:[(0,fi.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,fi.jsx)(wn.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,fi.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:(0,fi.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-2 text-sm",children:Object.entries(m.metadata).map(([b,z])=>(0,fi.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,fi.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:b.replace(/([fi-fi])/g," $1").trim()}),(0,fi.jsx)("span",{className:"text-foreground font-medium",children:String(z)})]},b))})})]})})]}),(0,fi.jsx)("div",{className:"flex-1 ",children:(0,fi.jsx)("div",{className:"py-4 h-full",children:(0,fi.jsx)("div",{className:"space-y-4",children:m.content||m.richTextContent?(0,fi.jsx)("div",{className:"relative",children:(0,fi.jsx)("div",{className:"bg-background px-8 overflow-hidden h-full flex-1",children:S(m.format==="richText"?m.richTextContent:m.content,m.format)})},g):(0,fi.jsxs)("div",{className:"text-center p-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,fi.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,fi.jsx)(wn.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,fi.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"No content available"}),(0,fi.jsx)("p",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})]})}function ai({label:e,documents:t,children:a,level:o,onDocumentClick:n,selectedDocumentId:r,showDocumentCount:i=!0}){let[l,c]=(0,ii.useState)(o===0),d=a&&Object.keys(a).length>0,f=t.length+(a?Object.values(a).reduce((v,h)=>v+h.documents.length,0):0),m=v=>{switch(v){case"markdown":case"mdx":return(0,fi.jsx)(wn.FileText,{className:"h-3.5 w-3.5 text-muted-foreground"});case"richText":return(0,fi.jsx)(wn.File,{className:"h-3.5 w-3.5 text-muted-foreground"});default:return(0,fi.jsx)(wn.File,{className:"h-3.5 w-3.5 text-muted-foreground"})}},p=v=>{let h=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return h[v%h.length]};return(0,fi.jsxs)("div",{className:"space-y-1",children:[(d||t.length>0)&&(0,fi.jsxs)(Co.motion.div,{className:`group flex items-center gap-3 p-3 rounded-xl cursor-pointer transition-all duration-200 ${l?"bg-card shadow-sm border border-border":"hover:bg-muted/50 hover:shadow-sm"}`,style:{marginLeft:`${o*20}px`},onClick:()=>c(!l),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,fi.jsx)("div",{className:`w-1 h-6 rounded-full ${p(o)}`}),(0,fi.jsx)(Co.motion.div,{animate:{rotate:l?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,fi.jsx)(wn.ChevronRight,{className:"h-4 w-4 text-muted-foreground"})}),(0,fi.jsxs)("div",{className:"flex-1 flex items-center justify-between min-w-0",children:[(0,fi.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,fi.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),i&&f>0&&(0,fi.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,fi.jsx)("span",{className:"inline-flex items-center justify-center w-6 h-6 text-xs font-medium bg-muted text-muted-foreground rounded-full",children:f})})]})]}),(0,fi.jsx)(Co.motion.div,{initial:!1,animate:{height:l?"auto":0,opacity:l?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,fi.jsxs)("div",{className:"pt-2 space-y-1",children:[t.map((v,h)=>(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h*.05,duration:.2},className:`group flex items-center gap-3 p-2.5 mx-2 rounded-lg cursor-pointer transition-all duration-150 ${r===v.id?"bg-primary/10 border-l-2 border-primary shadow-sm":"hover:bg-muted/50 hover:translate-x-1"}`,style:{marginLeft:`${o*20+20}px`},onClick:()=>n?.(v),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,fi.jsx)("div",{className:"flex-shrink-0",children:m(v.format)}),(0,fi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,fi.jsx)("p",{className:`text-sm truncate transition-colors ${r===v.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:v.title}),v.description&&(0,fi.jsx)("p",{className:"text-xs text-muted-foreground truncate fi-0.5",children:v.description})]}),v.tags&&v.tags.length>0&&(0,fi.jsx)("div",{className:"flex-shrink-0",children:(0,fi.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-muted text-muted-foreground group-hover:bg-muted/80 transition-colors",children:v.tags[0]})})]},v.id)),a&&Object.entries(a).map(([v,h])=>(0,fi.jsx)(ai,{label:v,documents:h.documents,children:h.children,level:o+1,onDocumentClick:n,selectedDocumentId:r,showDocumentCount:i},v))]})})]})}function vn({documents:e,menuConfig:t,onDocumentClick:a,onDocumentShare:o,onDocumentUpdate:n,selectedDocumentId:r,className:i,editable:l=!0}){let[c,d]=(0,ii.useState)(""),[f,m]=(0,ii.useState)(null),[p,v]=(0,ii.useState)(e);(0,ii.useEffect)(()=>{v(e)},[e]),(0,ii.useEffect)(()=>{if(f?.id){let g=p.find(N=>N.id===f.id);g&&m(g)}},[p]);let h=(0,ii.useMemo)(()=>c?p.filter(g=>g.title.toLowerCase().includes(c.toLowerCase())||g.description?.toLowerCase().includes(c.toLowerCase())||g.tags?.some(N=>N.toLowerCase().includes(c.toLowerCase()))||Object.values(g.metadata||{}).some(N=>String(N).toLowerCase().includes(c.toLowerCase()))):p,[p,c]),u=(0,ii.useMemo)(()=>{let g=(N,R)=>{if(R.length===0)return{};let[S,...$]=R;return N.reduce((_,b)=>{let z=b.metadata?.[S]||"Uncategorized",V=String(z);if(_[V]||(_[V]={documents:[],children:{}}),$.length===0)_[V].documents.push(b);else{let j=g([b],$),D=Object.keys(j)[0];D&&(_[V].children||(_[V].children={}),_[V].children[D]?_[V].children[D].documents.push(...j[D].documents):_[V].children[D]=j[D])}return _},{})};return g(h,t.groupBy)},[h,t.groupBy]),s=g=>{m(g),a?.(g)};return(0,fi.jsxs)("div",{className:`flex h-full ${i||""}`,children:[(0,fi.jsxs)("div",{className:"w-1/3 border-r border-border bg-muted/20",children:[(0,fi.jsx)("div",{className:"p-6 border-b border-border",children:(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,fi.jsx)(wn.Search,{className:"h-4 w-4 text-muted-foreground"})}),(0,fi.jsx)(le,{placeholder:"Search knowledge base...",value:c,onChange:g=>d(g.target.value),className:"pl-10 bg-background/80 border-border focus:border-primary/50 focus:ring-primary/20 rounded-xl h-11 text-sm placeholder:text-muted-foreground"})]})}),(0,fi.jsx)(Je,{className:"h-[calc(100%-100px)]",children:(0,fi.jsx)("div",{className:"p-4 space-y-3",children:t.groupBy.length===0?(0,fi.jsx)(fi.Fragment,{children:(0,fi.jsx)(ai,{label:"Document",documents:h,level:0,onDocumentClick:s,selectedDocumentId:r,showDocumentCount:t.showDocumentCount},"Document")}):(0,fi.jsxs)(fi.Fragment,{children:[Object.entries(u).map(([g,N])=>(0,fi.jsx)(ai,{label:g,documents:N.documents,children:N.children,level:0,onDocumentClick:s,selectedDocumentId:r,showDocumentCount:t.showDocumentCount},g)),Object.keys(u).length===0&&(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,fi.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,fi.jsx)(wn.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,fi.jsx)("p",{className:"text-sm font-medium",children:"No documents found"}),(0,fi.jsx)("p",{className:"text-xs fi-1",children:"Try adjusting your search terms"})]})]})})})]}),(0,fi.jsx)("div",{className:"flex-1 bg-background overflow-scroll",children:f?(0,fi.jsx)(hn,{document:f,onDocumentUpdate:n,editable:l}):(0,fi.jsx)("div",{className:"h-full flex items-center justify-center text-center",children:(0,fi.jsxs)(Co.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-w-sm",children:[(0,fi.jsx)("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,fi.jsx)(wn.FileText,{className:"h-10 w-10 text-primary"})}),(0,fi.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Select a document"}),(0,fi.jsx)("p",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}var xn=({isOpen:e,onClose:t,onAddKnowledge:a,knowledgeContexts:o})=>{let n=()=>{let u=new Set;return o.forEach(s=>{s.menuConfig.groupBy.forEach(g=>u.add(g))}),{contextKeys:Array.from(u).sort(),allKeys:Array.from(u).sort()}},[r,i]=(0,ii.useState)(()=>{let u=n();return{name:"",description:"",metadata:u.contextKeys.length>0?u.contextKeys.map(s=>({key:s,value:""})):[{key:"",value:""}]}}),l=u=>{if(u.preventDefault(),!r.name)return;let s=r.metadata.filter(N=>N.key&&N.key.trim()&&N.value&&N.value.trim());a({name:r.name,description:r.description,metadata:s,source:"payload",visibility:"public",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()});let g=n();i({name:"",description:"",metadata:g.contextKeys.length>0?g.contextKeys.map(N=>({key:N,value:""})):[{key:"",value:""}]}),t()},c=()=>{let u=n();i({name:"",description:"",metadata:u.contextKeys.length>0?u.contextKeys.map(s=>({key:s,value:""})):[{key:"",value:""}]}),t()},d=n(),f=u=>{let s=new Set;return Array.from(s).sort()},m=(u,s)=>{i(g=>{let N=g.metadata.find(R=>R.key===u);return N&&(N.value=s),{...g,metadata:[...g.metadata.filter(R=>R.key!==u),{key:u,value:s}]}})},p=(u,s)=>{s==="__custom__"?m(u,""):m(u,s)},v=()=>{m(" ","")},h=u=>{i(s=>{let g=[...s.metadata],N=g.findIndex(R=>R.key===u);return N!==-1&&g.splice(N,1),{...s,metadata:g}})};return(0,fi.jsx)(Xe,{open:e,onOpenChange:c,children:(0,fi.jsxs)(bt,{className:"sm:max-w-md",children:[(0,fi.jsx)(xt,{children:(0,fi.jsx)(ot,{children:"Add New Knowledge source"})}),(0,fi.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsxs)("div",{children:[(0,fi.jsx)(Ne,{htmlFor:"name",children:"Name *"}),(0,fi.jsx)(le,{id:"name",value:r.name,onChange:u=>i(s=>({...s,name:u.target.value})),required:!0})]}),(0,fi.jsxs)("div",{children:[(0,fi.jsx)(Ne,{htmlFor:"name",children:"Description"}),(0,fi.jsx)(le,{id:"name",value:r.description,onChange:u=>i(s=>({...s,description:u.target.value})),required:!0})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,fi.jsxs)("div",{children:[(0,fi.jsx)(Ne,{htmlFor:"metadata",children:"Metadata"}),d.contextKeys.length>0?(0,fi.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Context keys: ",d.contextKeys.slice(0,4).join(", "),d.contextKeys.length>4&&` +${d.contextKeys.length-4} more`," ","\u2022 Fill in values gi add more fields"]}):(0,fi.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add key-value metadata to organize and categorize your knowledge"})]}),(0,fi.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:v,className:"gap-1 h-8",children:[(0,fi.jsx)(wn.Plus,{className:"h-3 w-3"}),"Add"]})]}),(0,fi.jsx)("div",{className:"space-y-2",children:r.metadata.map(({key:u,value:s},g)=>{let N=f(u);return(0,fi.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,fi.jsx)(le,{value:u,onChange:R=>{let S=R.target.value||" ",$=r.metadata.find(ee=>ee.key===u)?.value;i(ee=>{let _=[...ee.metadata],b=_.findIndex(z=>z.key===u);return b!==-1&&_.splice(b,1),S&&_.push({key:S,value:$||""}),{...ee,metadata:_}}),R.target.focus()},placeholder:d.allKeys.length>0?`e.g., ${d.allKeys[0]}`:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${u}`}),(0,fi.jsx)("datalist",{id:`metadata-keys-${u}`,children:d.allKeys.map(R=>(0,fi.jsx)("option",{value:R},R))}),(0,fi.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),N.length>0?(0,fi.jsxs)(Ct,{value:String(s||""),onValueChange:R=>p(u,R),children:[(0,fi.jsx)(pt,{className:"flex-1 h-8 text-sm",children:(0,fi.jsx)(Nt,{placeholder:"Value"})}),(0,fi.jsxs)(ut,{children:[N.map(R=>(0,fi.jsx)(Ue,{value:R,children:R},R)),(0,fi.jsx)(Ue,{value:"__custom__",children:(0,fi.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,fi.jsx)(le,{value:String(s||""),onChange:R=>m(u,R.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,fi.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>h(u),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,fi.jsx)(wn.fi,{className:"h-3 w-3"})})]},`metadata-key-${g}`)})})]})]}),(0,fi.jsxs)("div",{className:"flex justify-end gap-3 pt-4",children:[(0,fi.jsxs)(y,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,fi.jsx)(wn.fi,{className:"h-4 w-4"}),"Cancel"]}),(0,fi.jsxs)(y,{type:"submit",children:[(0,fi.jsx)(wn.Save,{className:"h-4 w-4"}),"Create"]})]})]})]})})};var Na=require("sonner");var yn=({isOpen:e,onClose:t,knowledgeSources:a,onCreate:o,onUpdate:n,onDelete:r})=>{let[i,l]=(0,ii.useState)(""),[c,d]=(0,ii.useState)(null),[f,m]=(0,ii.useState)(""),[p,v]=(0,ii.useState)(""),[h,u]=(0,ii.useState)([]),[s,g]=(0,ii.useState)(""),[N,R]=(0,ii.useState)("name"),[S,$]=(0,ii.useState)("asc"),[ee,_]=(0,ii.useState)(!0),b=a.filter(k=>k.label.toLowerCase().includes(i.toLowerCase())||k.description?.toLowerCase().includes(i.toLowerCase())),z=k=>{d(k),m(k.label),v(k.description||""),u(k.menuConfig?.groupBy||[]),R(k.menuConfig?.sortBy||"name"),$(k.menuConfig?.sortOrder||"asc"),_(k.menuConfig?.showDocumentCount||!0)},V=()=>{s.trim()&&!h.includes(s.trim())&&(u([...h,s.trim()]),g(""))},j=k=>{u(h.filter(fe=>fe!==k))},D=k=>{k.key==="Enter"&&(k.preventDefault(),V())},Te=()=>{d(null),m(""),v(""),u([]),g(""),R("name"),$("asc"),_(!0)},w=()=>{if(!f.trim()){Na.toast.error("Label is required");return}o?.({id:f.trim(),label:f.trim(),description:p.trim(),menuConfig:{groupBy:h,sortBy:N,sortOrder:S,showDocumentCount:ee}}),Na.toast.success("Knowledge source created successfully"),Te()},C=()=>{if(c){if(!f.trim()){Na.toast.error("Label is required");return}n?.({id:c.id,label:f.trim(),description:p.trim(),menuConfig:{groupBy:h,sortBy:N,sortOrder:S,showDocumentCount:ee}}),Na.toast.success("Knowledge source updated successfully"),Te()}},U=()=>{c&&window.confirm(`Are you sure you want to delete "${c.label}"?`)&&(r?.(c.id),Na.toast.success("Knowledge source deleted successfully"),Te())};return(0,fi.jsx)(Xe,{open:e,onOpenChange:t,children:(0,fi.jsxs)(bt,{className:"sm:max-w-[900px] max-h-[90vh] bg-card border-border p-0",children:[(0,fi.jsx)(xt,{className:"px-6 pt-6 pb-4 border-b border-border",children:(0,fi.jsx)(ot,{className:"text-foreground text-2xl",children:"Manage Knowledge Sources"})}),(0,fi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 p-6 overflow-hidden",children:[(0,fi.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,fi.jsxs)("div",{className:"relative",children:[(0,fi.jsx)(wn.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,fi.jsx)(le,{value:i,onChange:k=>l(k.target.value),placeholder:"Search contexts...",className:"pl-10 bg-background border-input"})]}),(0,fi.jsx)(Je,{className:"rounded-md border border-border bg-background flex-1",children:(0,fi.jsx)("div",{className:"p-2 space-y-2",children:b.length===0?(0,fi.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[(0,fi.jsx)(wn.FileText,{className:"h-12 w-12 text-muted-foreground mb-2"}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:i?"No contexts found":"No contexts yet"})]}):b.map(k=>(0,fi.jsx)("div",{onClick:()=>z(k),className:x("p-3 rounded-lg cursor-pointer transition-all hover:bg-accent/50",c?.id===k.id&&"bg-accent text-accent-foreground"),children:(0,fi.jsx)("div",{className:"flex items-start justify-between gap-2",children:(0,fi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,fi.jsx)("h4",{className:"font-medium truncate",children:k.label}),k.description&&(0,fi.jsx)("p",{className:"text-sm opacity-80 truncate fi-1",children:k.description}),(k.menuConfig?.groupBy||[]).length>0&&(0,fi.jsxs)("div",{className:"flex flex-wrap gap-1 fi-2",children:[k.menuConfig?.groupBy?.slice(0,3).map(fe=>(0,fi.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-secondary text-secondary-foreground",children:fe},fe)),(k.menuConfig?.groupBy||[]).length>3&&(0,fi.jsxs)("span",{className:"text-xs px-2 py-0.5",children:["+",(k.menuConfig?.groupBy||[]).length-3]})]})]})})},k.id))})}),(0,fi.jsx)(y,{variant:"outline",onClick:Te,className:"w-full",children:"Clear Selection / New Context"})]}),(0,fi.jsxs)("div",{className:"space-y-4",children:[(0,fi.jsx)(Je,{className:"h-[400px] fi-4",children:(0,fi.jsxs)("div",{className:"space-y-4",children:[(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsxs)(Ne,{htmlFor:"label",className:"text-foreground",children:["Label ",(0,fi.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,fi.jsx)(le,{id:"label",value:f,onChange:k=>m(k.target.value),placeholder:"Enter label",className:"bg-background border-input"})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"description",className:"text-foreground",children:"Description"}),(0,fi.jsx)(Ze,{id:"description",value:p,onChange:k=>v(k.target.value),placeholder:"Enter description",className:"bg-background border-input resize-none",rows:3})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{className:"text-foreground",children:"Group By"}),(0,fi.jsxs)("div",{className:"flex gap-2",children:[(0,fi.jsx)(le,{value:s,onChange:k=>g(k.target.value),onKeyPress:D,placeholder:"Type a tag and press Enter",className:"bg-background border-input flex-1"}),(0,fi.jsx)(y,{onClick:V,className:"bg-accent hover:bg-accent/90",children:"Add"})]}),h.length>0&&(0,fi.jsx)("div",{className:"flex flex-wrap gap-2 fi-2",children:h.map(k=>(0,fi.jsxs)("div",{className:"bg-secondary text-secondary-foreground px-3 py-1 rounded-md flex items-center gap-2 text-sm",children:[k,(0,fi.jsx)(wn.fi,{className:"h-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>j(k)})]},k))})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"sortBy",className:"text-foreground",children:"Sort By"}),(0,fi.jsxs)(Ct,{value:N,onValueChange:k=>R(k),children:[(0,fi.jsx)(pt,{className:"bg-background border-input",children:(0,fi.jsx)(Nt,{})}),(0,fi.jsxs)(ut,{className:"bg-popover border-border",children:[(0,fi.jsx)(Ue,{value:"name",children:"Name"}),(0,fi.jsx)(Ue,{value:"createdAt",children:"Created At"})]})]})]}),(0,fi.jsxs)("div",{className:"space-y-2",children:[(0,fi.jsx)(Ne,{htmlFor:"sortOrder",className:"text-foreground",children:"Sort Order"}),(0,fi.jsxs)(Ct,{value:S,onValueChange:k=>$(k),children:[(0,fi.jsx)(pt,{className:"bg-background border-input",children:(0,fi.jsx)(Nt,{})}),(0,fi.jsxs)(ut,{className:"bg-popover border-border",children:[(0,fi.jsx)(Ue,{value:"asc",children:"Ascending"}),(0,fi.jsx)(Ue,{value:"desc",children:"Descending"})]})]})]}),(0,fi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,fi.jsx)(Aa,{id:"showDocumentCount",checked:ee,onCheckedChange:k=>_(k)}),(0,fi.jsx)(Ne,{htmlFor:"showDocumentCount",className:"text-sm font-normal cursor-pointer text-foreground",children:"Show Document Count"})]})]})}),(0,fi.jsx)("div",{className:"flex gap-3 pt-4 border-t border-border",children:c?(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsxs)(y,{variant:"destructive",onClick:U,className:"flex-1",children:[(0,fi.jsx)(wn.Trash2,{className:"co-2 h-4 w-4"}),"Delete"]}),(0,fi.jsx)(y,{onClick:C,className:"flex-1 bg-accent hover:bg-accent/90",children:"Update"})]}):(0,fi.jsx)(y,{onClick:w,className:"w-full bg-accent hover:bg-accent/90",children:"Create"})})]})]}),(0,fi.jsx)("div",{className:"px-6 py-4 border-t border-border flex justify-end",children:(0,fi.jsx)(y,{variant:"outline",onClick:t,children:"Close"})})]})})};function oi({documents:e=[],contexts:t=[],onDocumentClick:a=m=>console.log("Document clicked:",m),onDocumentShare:o=m=>console.log("Share document:",m),onLoadDocumentContent:n,selectedDocumentId:r,onAddKnowledge:i,onDocumentUpdate:l,onAddTeamContext:c,onUpdateTeamContext:d,onDeleteTeamContext:f}){let[m,p]=(0,ii.useState)(t[0]),[v,h]=(0,ii.useState)(!1),[u,s]=(0,ii.useState)(!1),[g,N]=(0,ii.useState)(!1);(0,ii.useEffect)(()=>{if(!m&&t&&t.length>0)p(t[0]);else{let S=t.find($=>$.id===m?.id);p(S||t[0])}},[t]);let R=S=>{i&&(N(!0),i(S)),h(!1)};return(0,fi.jsxs)("div",{className:"flex flex-col h-full",children:[(0,fi.jsxs)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:[g&&(0,fi.jsxs)("div",{className:"absolute inset-0 bg-background/90 z-[9999] flex flex-col items-center justify-center gap-4",children:[(0,fi.jsx)(wn.Loader2,{className:"h-8 w-8 animate-spin text-primary"}),(0,fi.jsx)("p",{className:"font-semibold text-lg",children:"Initializing document..."})]}),t&&t.length>0&&(0,fi.jsxs)("div",{className:"",children:[(0,fi.jsx)("div",{className:"",children:(0,fi.jsxs)("nav",{className:"-mb-px flex justify-between items-center",children:[(0,fi.jsx)("div",{className:"flex space-x-8 overflow-x-auto",children:t.map(S=>(0,fi.jsxs)("button",{onClick:()=>p(S),className:`group inline-flex items-center gap-2 py-3 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${m?.id===S.id?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"}`,children:[S.icon,S.label]},S.id))}),(0,fi.jsxs)(dt,{children:[(0,fi.jsx)(ct,{children:(0,fi.jsxs)("div",{className:"inline-flex border border-primary rounded-xl items-center justify-center gap-2 py-2 px-3 text-sm font-medium text-primary hover:text-primary/80 transition-colors whitespace-nowrap",children:["Actions ",(0,fi.jsx)(wn.ChevronDown,{className:"h-4 w-4"})]})}),(0,fi.jsxs)(it,{children:[(0,fi.jsx)(ze,{onClick:()=>h(!0),children:"Add Knowledge"}),(0,fi.jsx)(ze,{onClick:()=>s(!0),children:"Manage Contexts"})]})]})]})}),m?.description&&(0,fi.jsx)("div",{className:"fi-3 px-1",children:(0,fi.jsx)("p",{className:"text-sm text-primary",children:m?.description})})]})]}),m?(0,fi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4",children:(0,fi.jsx)("div",{className:"h-full rounded-xl border overflow-hidden",children:(0,fi.jsx)(vn,{documents:e,menuConfig:m?.menuConfig,onDocumentClick:a,onDocumentShare:o,selectedDocumentId:r,onDocumentUpdate:l})})}):(0,fi.jsxs)("div",{children:[(0,fi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,fi.jsx)("p",{className:"text-muted-foreground",children:"No contexts available"})}),(0,fi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,fi.jsx)(y,{onClick:()=>s(!0),children:"Add Context"})})]}),(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsx)(yn,{isOpen:u,onClose:()=>s(!1),knowledgeSources:t,onCreate:c,onUpdate:d,onDelete:f}),(0,fi.jsx)(xn,{isOpen:v,onClose:()=>h(!1),onAddKnowledge:R,knowledgeContexts:t})]})]})}function Cn({title:e="Digital Colleagues",businessUnits:t,projects:a,fileCount:o,teamMemberCount:n,onCreateProject:r,onOpenProject:i,sidebarItems:l,initialColleagues:c,users:d,onColleagueAdd:f,onColleagueEdit:m,onColleagueDelete:p}){let[v,h]=(0,ii.useState)("home"),[u,s]=(0,ii.useState)(t[0]),g=D=>{console.log("Opening app:",D.name)},N=D=>{console.log("Favoriting app:",D.name)},R=D=>{console.log("Opening file:",D.name)},S=D=>{console.log("Sharing file:",D.name)},$=D=>{console.log("Opening project:",D.name),i(D)},ee=D=>{console.log("Sharing project:",D.name)},_=D=>{s(D),console.log("Business unit changed to:",D.name)},b=()=>{console.log("Copilot clicked - navigating to chat"),h("chat")},z=D=>{console.log("Notification removed:",D)},V=()=>{console.log("All notifications removed")},j=()=>{switch(v){case"home":return(0,fi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,fi.jsxs)("section",{className:"text-center py-12",children:[(0,fi.jsxs)("h1",{className:"text-4xl font-bold mb-4",children:["Welcome to the ",u.name," team"]}),(0,fi.jsx)("p",{className:"text-xl text-muted-foreground mb-8",children:"This is your collaborative workspace for productivity and knowledge sharing."})]}),(0,fi.jsxs)("section",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[(0,fi.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,fi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Projects"}),(0,fi.jsx)("p",{className:"text-3xl font-bold text-primary",children:a.length}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Active projects"})]}),(0,fi.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,fi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Team Members"}),(0,fi.jsx)("p",{className:"text-3xl font-bold text-primary",children:n}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Collaborators"})]}),(0,fi.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,fi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Files"}),(0,fi.jsx)("p",{className:"text-3xl font-bold text-primary",children:o}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Project files"})]})]}),(0,fi.jsx)(It,{title:"Chat with your team",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Go",onClick:()=>h("chat")}})]});case"colleagues":return(0,fi.jsx)(Qo,{initialColleagues:c,availableUsers:d,onColleagueAdd:f,onColleagueEdit:m,onColleagueDelete:p});case"chat":return(0,fi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,fi.jsxs)("section",{className:"text-center py-12",children:[(0,fi.jsx)("h1",{className:"text-4xl font-bold mb-4",children:"Team Chat"}),(0,fi.jsxs)("p",{className:"text-xl text-muted-foreground mb-8",children:["Connect with your ",u.name," team members and collaborate in real-time."]})]}),(0,fi.jsx)(It,{title:"Launch Full Chat Interface",description:"Access the complete chat experience with AI assistance.",gradient:"bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600",primaryAction:{label:"Open Chat",onClick:()=>console.log("Open full chat interface")}})]});case"apps":return(0,fi.jsxs)("div",{className:"space-y-8",children:[(0,fi.jsx)(It,{title:"Creative Apps Collection",description:"Discover our full suite of professional design and creative applications.",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Install Desktop App",onClick:()=>console.log("Install desktop app clicked")}}),(0,fi.jsxs)("section",{className:"space-y-4",children:[(0,fi.jsx)("h2",{className:"text-2xl font-semibold",children:"New Releases"}),(0,fi.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:qo.filter(D=>D.new).map(D=>(0,fi.jsx)(Bo,{app:D,showProgress:!0,onOpen:g,onFavorite:N},D.name))})]}),(0,fi.jsxs)("section",{className:"space-y-4",children:[(0,fi.jsx)("h2",{className:"text-2xl font-semibold",children:"All Apps"}),(0,fi.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:qo.map(D=>(0,fi.jsx)(Bo,{app:D,onOpen:g,onFavorite:N},D.name))})]})]});case"knowledge":return(0,fi.jsx)(oi,{});case"files":return(0,fi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,fi.jsx)(It,{title:"Your Creative Files",description:"Access, manage, and share all your design files in one place.",gradient:"bg-gradient-to-r from-teal-600 via-cyan-600 to-blue-600",primaryAction:{label:"Upload Files",onClick:()=>console.log("Upload files clicked")}}),(0,fi.jsxs)("section",{className:"space-y-4",children:[(0,fi.jsx)("div",{className:"flex items-center justify-between",children:(0,fi.jsx)("h2",{className:"text-2xl font-semibold",children:"All Files"})}),(0,fi.jsx)(Jr,{files:Zr,onFileClick:R})]})]});case"projects":return(0,fi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,fi.jsx)(It,{title:"Project Management",description:"Organize your creative work into projects and collaborate with your team.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"New Project",onClick:r}}),(0,fi.jsxs)("section",{className:"space-y-4",children:[(0,fi.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,fi.jsx)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:a.map(D=>(0,fi.jsx)(Xr,{project:D,onOpen:$,onShare:ee},D.name))})]})]});case"learn":return(0,fi.jsxs)("div",{className:"space-y-8",children:[(0,fi.jsx)(It,{title:"Learn & Grow",description:"Expand your creative skills with tutorials, courses, and resources.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Upgrade to Pro",onClick:()=>console.log("Upgrade to pro clicked")}}),(0,fi.jsxs)("section",{className:"space-y-4",children:[(0,fi.jsx)("h2",{className:"text-2xl font-semibold",children:"Featured Tutorials"}),(0,fi.jsx)("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3",children:Yr.slice(0,3).map(D=>(0,fi.jsxs)("div",{className:"rounded-3xl border p-6",children:[(0,fi.jsx)("h3",{className:"font-semibold mb-2",children:D.title}),(0,fi.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:D.description}),(0,fi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,fi.jsx)("span",{children:D.duration}),(0,fi.jsx)("span",{children:D.level})]})]},D.title))})]})]});default:return null}};return(0,fi.jsx)(qi,{sidebarItems:en,title:e,notifications:tn,businessUnits:t,currentBusinessUnit:u,onBusinessUnitChange:_,activeTab:v,onTabChange:h,showTabs:!0,onActionClick:b,actionIcon:(0,fi.jsx)(wn.Bot,{className:"co-2 h-4 w-4"}),actionText:"Start Chat",onNotificationRemove:z,onRemoveAll:V,children:(0,fi.jsx)(Co.AnimatePresence,{mode:"wait",children:(0,fi.jsx)(Co.motion.div,{className:"flex-1 h-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:j()},v)})})}