cortex-react-components 2.26.4 → 2.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-SME3D72Q.mjs → chunk-2BRDNDUB.mjs} +1 -1
- package/dist/{chunk-HTS3KCJL.mjs → chunk-2O54GV6Q.mjs} +1 -1
- package/dist/chunk-32G45Z2G.mjs +1 -0
- package/dist/{chunk-QDP657UR.mjs → chunk-3HNU2NYP.mjs} +1 -1
- package/dist/{chunk-HB57GPGK.mjs → chunk-3M5KHST3.mjs} +1 -1
- package/dist/{chunk-TIIYFAV6.mjs → chunk-3NRXQBBS.mjs} +1 -1
- package/dist/{chunk-IISYRLNU.mjs → chunk-3Y7QG6VP.mjs} +1 -1
- package/dist/{chunk-GULRIPMU.mjs → chunk-4FEVXBNU.mjs} +1 -1
- package/dist/{chunk-YH72WKGC.mjs → chunk-5MWZTJYP.mjs} +1 -1
- package/dist/chunk-6YHCNPFB.mjs +4 -0
- package/dist/{chunk-AABB4TFO.mjs → chunk-75F3LJMX.mjs} +1 -1
- package/dist/{chunk-NZJ7VVG6.mjs → chunk-7NWIK57W.mjs} +1 -1
- package/dist/{chunk-TQKXHMD7.mjs → chunk-7R47MHQE.mjs} +1 -1
- package/dist/{chunk-FB5PBKLV.mjs → chunk-AJQHGVZ5.mjs} +1 -1
- package/dist/chunk-B7RZ4K6Y.mjs +1 -0
- package/dist/{chunk-7MPZOMXK.mjs → chunk-C4RWEPVF.mjs} +1 -1
- package/dist/{chunk-VNKGAW4K.mjs → chunk-CXOVEABI.mjs} +1 -1
- package/dist/{chunk-J3VJUPR7.mjs → chunk-EM3T2XYC.mjs} +1 -1
- package/dist/{chunk-UTJZH3X5.mjs → chunk-EPJJKGCG.mjs} +1 -1
- package/dist/{chunk-VDN4LQSS.mjs → chunk-F6DMXMR4.mjs} +1 -1
- package/dist/{chunk-JU4TJYSZ.mjs → chunk-FE7ZGUPU.mjs} +1 -1
- package/dist/{chunk-HLRMUJPL.mjs → chunk-FZX3ZPEU.mjs} +1 -1
- package/dist/chunk-G6OGEIN4.mjs +4 -0
- package/dist/{chunk-7BYNW77I.mjs → chunk-GHOL5L32.mjs} +1 -1
- package/dist/chunk-GLZEHRPY.mjs +4 -0
- package/dist/{chunk-5MMNC65L.mjs → chunk-GTZJWMZR.mjs} +1 -1
- package/dist/chunk-HD6E7KI2.mjs +4 -0
- package/dist/{chunk-OP6ZWZIM.mjs → chunk-I75OOO4H.mjs} +1 -1
- package/dist/{chunk-NXAQ6ESJ.mjs → chunk-JDIPWJBD.mjs} +1 -1
- package/dist/{chunk-BGQC6IQK.mjs → chunk-KEK763EH.mjs} +1 -1
- package/dist/chunk-KQRQXBJ3.mjs +9 -0
- package/dist/{chunk-RWHPQAWZ.mjs → chunk-LAP57E2L.mjs} +1 -1
- package/dist/chunk-LCEEFZH7.mjs +4 -0
- package/dist/chunk-LEF6M5ZD.mjs +4 -0
- package/dist/{chunk-EM4CGGGV.mjs → chunk-LJXTXROJ.mjs} +1 -1
- package/dist/{chunk-DKRRVTCV.mjs → chunk-MS7YIAWP.mjs} +1 -1
- package/dist/chunk-MXMW65GM.mjs +4 -0
- package/dist/{chunk-YJ7XPZWV.mjs → chunk-NBJLXJQ3.mjs} +1 -1
- package/dist/{chunk-ITNR7N47.mjs → chunk-NINFDOV5.mjs} +1 -1
- package/dist/{chunk-5EM6P7SU.mjs → chunk-OQBCIB4L.mjs} +1 -1
- package/dist/{chunk-AN744MXS.mjs → chunk-OWL3KUE3.mjs} +1 -1
- package/dist/chunk-P2B3OITE.mjs +4 -0
- package/dist/{chunk-CC57QZMB.mjs → chunk-RGOKBIQ5.mjs} +1 -1
- package/dist/{chunk-MU47F4UR.mjs → chunk-RJGYVDOU.mjs} +1 -1
- package/dist/{chunk-CTTBF7F4.mjs → chunk-RS4WAAGI.mjs} +1 -1
- package/dist/chunk-SOTCQX2G.mjs +1 -0
- package/dist/{chunk-CMU5JFUC.mjs → chunk-SWE754OC.mjs} +1 -1
- package/dist/{chunk-ZA423OPA.mjs → chunk-TJZVV3XH.mjs} +1 -1
- package/dist/{chunk-WRCRZUGO.mjs → chunk-TTWEHUP5.mjs} +1 -1
- package/dist/{chunk-FBEHQRZ4.mjs → chunk-TVTTUSWM.mjs} +1 -1
- package/dist/{chunk-FR4X2HHQ.mjs → chunk-TYARLEAC.mjs} +1 -1
- package/dist/chunk-U3PUWUVM.mjs +4 -0
- package/dist/{chunk-VATGKKXW.mjs → chunk-UJITFLIZ.mjs} +1 -1
- package/dist/{chunk-IO5ZSALG.mjs → chunk-VKCDLKYH.mjs} +1 -1
- package/dist/{chunk-NDBSSX6Q.mjs → chunk-WIRQ5IRT.mjs} +1 -1
- package/dist/{chunk-VTFO5GXK.mjs → chunk-XMYXQR5W.mjs} +1 -1
- package/dist/{chunk-OVZKO3Z5.mjs → chunk-ZEALRBXW.mjs} +1 -1
- package/dist/components/AdvancedComponents/AppSidebar.d.ts +3 -2
- package/dist/components/AdvancedComponents/AppSidebar.js +1 -2
- package/dist/components/AdvancedComponents/AppSidebar.mjs +1 -1
- package/dist/components/AdvancedComponents/app-header.js +1 -1
- package/dist/components/AdvancedComponents/app-header.mjs +1 -1
- package/dist/components/AdvancedComponents/index.d.ts +1 -0
- package/dist/components/AdvancedComponents/index.js +12 -1
- package/dist/components/AdvancedComponents/index.mjs +1 -1
- package/dist/components/AdvancedComponents/navigation-tabs.js +1 -1
- package/dist/components/AdvancedComponents/navigation-tabs.mjs +1 -1
- package/dist/components/AdvancedComponents/org-chart-component/OrgChart.d.ts +15 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgChart.js +12 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgChart.mjs +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgNode.d.ts +3 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgNode.js +9 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgNode.mjs +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgTree.d.ts +10 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgTree.js +12 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgTree.mjs +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/examples/PayloadIntegration.js +233 -0
- package/dist/components/AdvancedComponents/org-chart-component/examples/PayloadIntegration.mjs +233 -0
- package/dist/components/AdvancedComponents/org-chart-component/index.d.ts +4 -0
- package/dist/components/AdvancedComponents/org-chart-component/index.js +12 -0
- package/dist/components/AdvancedComponents/org-chart-component/index.mjs +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/mockData.d.ts +7 -0
- package/dist/components/AdvancedComponents/org-chart-component/mockData.js +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/mockData.mjs +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/types/index.d.ts +33 -0
- package/dist/components/AdvancedComponents/org-chart-component/types/index.js +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/types/index.mjs +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/utils.d.ts +13 -0
- package/dist/components/AdvancedComponents/org-chart-component/utils.js +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/utils.mjs +1 -0
- package/dist/components/AdvancedComponents/user-selection.js +1 -1
- package/dist/components/AdvancedComponents/user-selection.mjs +1 -1
- package/dist/components/Blocks/Banner.mjs +1 -1
- package/dist/components/Blocks/CallToAction.mjs +1 -1
- package/dist/components/Blocks/CollapsibleArea.mjs +1 -1
- package/dist/components/Blocks/Content.mjs +1 -1
- package/dist/components/Blocks/FeaturesBlock.mjs +1 -1
- package/dist/components/Blocks/OrgChart.mjs +3 -1
- package/dist/components/Blocks/RelatedPosts.mjs +1 -1
- package/dist/components/Blocks/RenderBlocks.mjs +1 -1
- package/dist/components/Blocks/ReusableContentBlock.mjs +1 -1
- package/dist/components/Blocks/index.d.ts +0 -1
- package/dist/components/Blocks/index.js +1 -1
- package/dist/components/Blocks/index.mjs +1 -1
- package/dist/components/Cards/ContentCard.mjs +1 -1
- package/dist/components/Cards/FeatureCard.mjs +1 -1
- package/dist/components/Cards/index.mjs +1 -1
- package/dist/components/Chat/ChatInterface.mjs +1 -1
- package/dist/components/Chat/CopilotInterface.js +3 -3
- package/dist/components/Chat/CopilotInterface.mjs +1 -1
- package/dist/components/Chat/PartTypes/MessageHandler.mjs +1 -1
- package/dist/components/Chat/PartTypes/index.mjs +1 -1
- package/dist/components/Chat/demo-long-messages.js +5 -5
- package/dist/components/Chat/demo-long-messages.mjs +1 -1
- package/dist/components/Chat/demo-tests.js +5 -5
- package/dist/components/Chat/demo-tests.mjs +1 -1
- package/dist/components/Chat/demo.js +3 -3
- package/dist/components/Chat/demo.mjs +1 -1
- package/dist/components/Chat/example-usage.js +3 -3
- package/dist/components/Chat/example-usage.mjs +1 -1
- package/dist/components/Chat/example-with-vercel-ai.js +3 -3
- package/dist/components/Chat/example-with-vercel-ai.mjs +1 -1
- package/dist/components/Chat/index.js +3 -3
- package/dist/components/Chat/index.mjs +1 -1
- package/dist/components/DigitalColleagues/DigitalColleageusLayout.js +1 -1
- package/dist/components/DigitalColleagues/DigitalColleageusLayout.mjs +1 -1
- package/dist/components/DigitalColleagues/MainPage.mjs +1 -1
- package/dist/components/DigitalColleagues/Pages/dashboardpage.js +5 -5
- package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +1 -1
- package/dist/components/DigitalColleagues/Views/ColleaguesView.js +1 -1
- package/dist/components/DigitalColleagues/Views/ColleaguesView.mjs +1 -1
- package/dist/components/DigitalColleagues/Views/index.js +5 -5
- package/dist/components/DigitalColleagues/Views/index.mjs +1 -1
- package/dist/components/DigitalColleagues/index.js +5 -5
- package/dist/components/DigitalColleagues/index.mjs +1 -1
- package/dist/components/Foundary/MainPage.mjs +1 -1
- package/dist/components/Foundary/Pages/dashboardpage.js +6 -6
- package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
- package/dist/components/Foundary/RichText/index.mjs +1 -1
- package/dist/components/Foundary/RichText/plugins/toolbar-plugin.mjs +1 -1
- package/dist/components/Foundary/Views/ColleaguesView.d.ts +12 -1
- package/dist/components/Foundary/Views/ColleaguesView.js +1 -1
- package/dist/components/Foundary/Views/ColleaguesView.mjs +1 -1
- package/dist/components/Foundary/Views/KnowledgeView.mjs +1 -1
- package/dist/components/Foundary/Views/index.js +5 -5
- package/dist/components/Foundary/Views/index.mjs +1 -1
- package/dist/components/Foundary/colleague-card.js +1 -1
- package/dist/components/Foundary/colleague-card.mjs +1 -1
- package/dist/components/Foundary/colleague-form.d.ts +12 -1
- package/dist/components/Foundary/colleague-form.js +1 -1
- package/dist/components/Foundary/colleague-form.mjs +1 -1
- package/dist/components/Foundary/document-edit.mjs +1 -1
- package/dist/components/Foundary/document-preview-examples.mjs +1 -1
- package/dist/components/Foundary/document-preview.mjs +1 -1
- package/dist/components/Foundary/file-edit.mjs +1 -1
- package/dist/components/Foundary/foundary-clone.js +1 -1
- package/dist/components/Foundary/foundary-clone.mjs +1 -1
- package/dist/components/Foundary/foundary-layout.d.ts +2 -1
- package/dist/components/Foundary/foundary-layout.js +1 -1
- package/dist/components/Foundary/foundary-layout.mjs +1 -1
- package/dist/components/Foundary/index.js +5 -5
- package/dist/components/Foundary/index.mjs +1 -1
- package/dist/components/Foundary/knowledge-browser.mjs +1 -1
- package/dist/components/Foundary/knowledge-search.js +1 -1
- package/dist/components/Foundary/knowledge-search.mjs +1 -1
- package/dist/components/Foundary/types.d.ts +14 -2
- package/dist/components/HeaderFooter/SectionHeading.mjs +1 -1
- package/dist/components/HeaderFooter/index.mjs +1 -1
- package/dist/components/Heros/HighImpact/index.mjs +1 -1
- package/dist/components/Heros/LowImpact/index.mjs +1 -1
- package/dist/components/Heros/MediumImpact/index.mjs +1 -1
- package/dist/components/Heros/RenderHero.mjs +1 -1
- package/dist/components/Heros/index.mjs +1 -1
- package/dist/components/Layouts/OutputHeaderFooter.mjs +1 -1
- package/dist/components/Layouts/Print.mjs +1 -1
- package/dist/components/Layouts/SlideShow.mjs +1 -1
- package/dist/components/Layouts/index.mjs +1 -1
- package/dist/components/Payload/RichText/index.mjs +1 -1
- package/dist/components/Payload/RichText/serialize.mjs +1 -1
- package/dist/components/Payload/index.mjs +1 -1
- package/dist/components/Projects/FileView.js +1 -1
- package/dist/components/Projects/FileView.mjs +1 -1
- package/dist/components/Projects/KanbanBoardView.mjs +1 -1
- package/dist/components/Projects/ProjectPage.js +5 -5
- package/dist/components/Projects/ProjectPage.mjs +1 -1
- package/dist/components/Projects/ProjectView.js +1 -1
- package/dist/components/Projects/ProjectView.mjs +1 -1
- package/dist/components/Projects/ProjectsIndexView.mjs +1 -1
- package/dist/components/Projects/TaskDetailsModal.mjs +1 -1
- package/dist/components/Projects/file-list.mjs +1 -1
- package/dist/components/Projects/index.mjs +1 -1
- package/dist/components/dc-temp/index.js +1 -1
- package/dist/components/dc-temp/index.mjs +1 -1
- package/dist/components/index.js +33 -22
- package/dist/components/index.mjs +1 -1
- package/dist/globals.css +1 -1
- package/dist/index.js +38 -27
- package/dist/index.mjs +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/pages/Blog.mjs +1 -1
- package/dist/pages/Documentation.mjs +1 -1
- package/dist/pages/IndexPage.mjs +1 -1
- package/dist/pages/Intranet.mjs +1 -1
- package/dist/pages/LandingPage.mjs +1 -1
- package/dist/pages/Page.mjs +1 -1
- package/dist/pages/Publish.mjs +1 -1
- package/dist/pages/Website.mjs +1 -1
- package/dist/sections/AboutSection.mjs +1 -1
- package/dist/sections/BlogDetail.mjs +1 -1
- package/dist/sections/BlogList.mjs +1 -1
- package/dist/sections/ContactSection.mjs +1 -1
- package/dist/sections/PageSections.mjs +1 -1
- package/dist/sections/PricingSection.mjs +1 -1
- package/dist/sections/ServiceDetail.mjs +1 -1
- package/dist/sections/ServiceDetailSection.mjs +1 -1
- package/dist/sections/ServiceSection.mjs +1 -1
- package/dist/sections/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-4WA47ZQA.mjs +0 -4
- package/dist/chunk-53QLSQCO.mjs +0 -4
- package/dist/chunk-5HT2KC5I.mjs +0 -4
- package/dist/chunk-CRAFZGCI.mjs +0 -4
- package/dist/chunk-FGEFYI5E.mjs +0 -4
- package/dist/chunk-GPFPTU7U.mjs +0 -4
- package/dist/chunk-KKW3FINI.mjs +0 -4
- package/dist/chunk-NDZ26EG6.mjs +0 -4
- package/dist/chunk-Y7H3EUBR.mjs +0 -4
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
"use client"
|
|
4
4
|
|
|
5
|
-
"use strict";var vl=Object.create;var Xo=Object.defineProperty;var hl=Object.getOwnPropertyDescriptor;var bl=Object.getOwnPropertyNames;var xl=Object.getPrototypeOf,yl=Object.prototype.hasOwnProperty;var wl=(e,t)=>{for(var a in t)Xo(e,a,{get:t[a],enumerable:!0})},Ti=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of bl(t))!yl.call(e,i)&&i!==a&&Xo(e,i,{get:()=>t[i],enumerable:!(o=hl(t,i))||o.enumerable});return e};var Se=(e,t,a)=>(a=e!=null?vl(xl(e)):{},Ti(t||!e||!e.__esModule?Xo(a,"default",{value:e,enumerable:!0}):a,e)),Nl=e=>Ti(Xo({},"__esModule",{value:!0}),e);var jd={};wl(jd,{ColleaguesView:()=>jr,FileView:()=>$o,KnowledgeView:()=>li,PlanningView:()=>Dr,ProjectView:()=>gi,ProjectsIndexView:()=>xi,TeamsIndexView:()=>wi});module.exports=Nl(jd);var Qt=require("react"),Bt=require("lucide-react");var Fi=require("clsx");var Er="-",Cl=e=>{let t=Sl(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:n=>{let s=n.split(Er);return s[0]===""&&s.length!==1&&s.shift(),Ri(s,t)||Dl(n)},getConflictingClassGroupIds:(n,s)=>{let c=a[n]||[];return s&&o[n]?[...c,...o[n]]:c}}},Ri=(e,t)=>{if(e.length===0)return t.classGroupId;let a=e[0],o=t.nextPart.get(a),i=o?Ri(e.slice(1),o):void 0;if(i)return i;if(t.validators.length===0)return;let r=e.join(Er);return t.validators.find(({validator:n})=>n(r))?.classGroupId},ki=/^\[(.+)\]$/,Dl=e=>{if(ki.test(e)){let t=ki.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},Sl=e=>{let{theme:t,prefix:a}=e,o={nextPart:new Map,validators:[]};return kl(Object.entries(e.classGroups),a).forEach(([r,n])=>{Mr(n,o,r,t)}),o},Mr=(e,t,a,o)=>{e.forEach(i=>{if(typeof i=="string"){let r=i===""?t:Pi(t,i);r.classGroupId=a;return}if(typeof i=="function"){if(Tl(i)){Mr(i(o),t,a,o);return}t.validators.push({validator:i,classGroupId:a});return}Object.entries(i).forEach(([r,n])=>{Mr(n,Pi(t,r),a,o)})})},Pi=(e,t)=>{let a=e;return t.split(Er).forEach(o=>{a.nextPart.has(o)||a.nextPart.set(o,{nextPart:new Map,validators:[]}),a=a.nextPart.get(o)}),a},Tl=e=>e.isThemeGetter,kl=(e,t)=>t?e.map(([a,o])=>{let i=o.map(r=>typeof r=="string"?t+r:typeof r=="object"?Object.fromEntries(Object.entries(r).map(([n,s])=>[t+n,s])):r);return[a,i]}):e,Pl=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=new Map,o=new Map,i=(r,n)=>{a.set(r,n),t++,t>e&&(t=0,o=a,a=new Map)};return{get(r){let n=a.get(r);if(n!==void 0)return n;if((n=o.get(r))!==void 0)return i(r,n),n},set(r,n){a.has(r)?a.set(r,n):i(r,n)}}},Ai="!",Rl=e=>{let{separator:t,experimentalParseClassName:a}=e,o=t.length===1,i=t[0],r=t.length,n=s=>{let c=[],p=0,l=0,m;for(let d=0;d<s.length;d++){let f=s[d];if(p===0){if(f===i&&(o||s.slice(d,d+r)===t)){c.push(s.slice(l,d)),l=d+r;continue}if(f==="/"){m=d;continue}}f==="["?p++:f==="]"&&p--}let u=c.length===0?s:s.substring(l),y=u.startsWith(Ai),b=y?u.substring(1):u,h=m&&m>l?m-l:void 0;return{modifiers:c,hasImportantModifier:y,baseClassName:b,maybePostfixModifierPosition:h}};return a?s=>a({className:s,parseClassName:n}):n},Al=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},Ml=e=>({cache:Pl(e.cacheSize),parseClassName:Rl(e),...Cl(e)}),El=/\s+/,Il=(e,t)=>{let{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:i}=t,r=[],n=e.trim().split(El),s="";for(let c=n.length-1;c>=0;c-=1){let p=n[c],{modifiers:l,hasImportantModifier:m,baseClassName:u,maybePostfixModifierPosition:y}=a(p),b=!!y,h=o(b?u.substring(0,y):u);if(!h){if(!b){s=p+(s.length>0?" "+s:s);continue}if(h=o(u),!h){s=p+(s.length>0?" "+s:s);continue}b=!1}let d=Al(l).join(":"),f=m?d+Ai:d,k=f+h;if(r.includes(k))continue;r.push(k);let w=i(h,b);for(let C=0;C<w.length;++C){let X=w[C];r.push(f+X)}s=p+(s.length>0?" "+s:s)}return s};function Fl(){let e=0,t,a,o="";for(;e<arguments.length;)(t=arguments[e++])&&(a=Mi(t))&&(o&&(o+=" "),o+=a);return o}var Mi=e=>{if(typeof e=="string")return e;let t,a="";for(let o=0;o<e.length;o++)e[o]&&(t=Mi(e[o]))&&(a&&(a+=" "),a+=t);return a};function Ll(e,...t){let a,o,i,r=n;function n(c){let p=t.reduce((l,m)=>m(l),e());return a=Ml(p),o=a.cache.get,i=a.cache.set,r=s,s(c)}function s(c){let p=o(c);if(p)return p;let l=Il(c,a);return i(c,l),l}return function(){return r(Fl.apply(null,arguments))}}var qe=e=>{let t=a=>a[e]||[];return t.isThemeGetter=!0,t},Ei=/^\[(?:([a-z-]+):)?(.+)\]$/i,Bl=/^\d+\/\d+$/,Ol=new Set(["px","full","screen"]),Hl=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,jl=/\d+(%|px|r?em|[sdl]?Hi([hwib]|min|max)|Qt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Vl=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Kl=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ul=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ua=e=>oo(e)||Ol.has(e)||Bl.test(e),Sa=e=>ro(e,"length",Zl),oo=e=>!!e&&!Number.isNaN(Number(e)),Ar=e=>ro(e,"number",oo),So=e=>!!e&&Number.isInteger(Number(e)),zl=e=>e.endsWith("%")&&oo(e.slice(0,-1)),be=e=>Ei.test(e),Ta=e=>Hl.test(e),$l=new Set(["length","size","percentage"]),_l=e=>ro(e,$l,Ii),Gl=e=>ro(e,"position",Ii),Wl=new Set(["image","url"]),ql=e=>ro(e,Wl,Yl),Jl=e=>ro(e,"",Xl),To=()=>!0,ro=(e,t,a)=>{let o=Ei.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):a(o[2]):!1},Zl=e=>jl.test(e)&&!Vl.test(e),Ii=()=>!1,Xl=e=>Kl.test(e),Yl=e=>Ul.test(e);var Ql=()=>{let e=qe("colors"),t=qe("spacing"),a=qe("blur"),o=qe("brightness"),i=qe("borderColor"),r=qe("borderRadius"),n=qe("borderSpacing"),s=qe("borderWidth"),c=qe("contrast"),p=qe("grayscale"),l=qe("hueRotate"),m=qe("invert"),u=qe("gap"),y=qe("gradientColorStops"),b=qe("gradientColorStopPositions"),h=qe("inset"),d=qe("margin"),f=qe("opacity"),k=qe("padding"),w=qe("saturate"),C=qe("scale"),X=qe("sepia"),I=qe("skew"),z=qe("space"),D=qe("translate"),V=()=>["auto","contain","none"],W=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",be,t],F=()=>[be,t],Ce=()=>["",ua,Sa],ke=()=>["auto",oo,be],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],le=()=>["solid","dashed","dotted","double","none"],A=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],je=()=>["start","end","center","between","around","evenly","stretch"],M=()=>["","0",be],O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>[oo,be];return{cacheSize:500,separator:":",theme:{colors:[To],spacing:[ua,Sa],blur:["none","",Ta,be],brightness:N(),borderColor:[e],borderRadius:["none","","full",Ta,be],borderSpacing:F(),borderWidth:Ce(),contrast:N(),grayscale:M(),hueRotate:N(),invert:M(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[zl,Sa],inset:q(),margin:q(),opacity:N(),padding:F(),saturate:N(),scale:N(),sepia:M(),skew:N(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",be]}],container:["container"],columns:[{columns:[Ta]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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:[...B(),be]}],overflow:[{overflow:W()}],"overflow-x":[{"overflow-x":W()}],"overflow-y":[{"overflow-y":W()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",So,be]}],basis:[{basis:q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",be]}],grow:[{grow:M()}],shrink:[{shrink:M()}],order:[{order:["first","last","none",So,be]}],"grid-cols":[{"grid-cols":[To]}],"col-start-end":[{col:["auto",{span:["full",So,be]},be]}],"col-start":[{"col-start":ke()}],"col-end":[{"col-end":ke()}],"grid-rows":[{"grid-rows":[To]}],"row-start-end":[{row:["auto",{span:[So,be]},be]}],"row-start":[{"row-start":ke()}],"row-end":[{"row-end":ke()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",be]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",be]}],gap:[{gap:[u]}],"gap-x":[{"gap-x":[u]}],"gap-y":[{"gap-y":[u]}],"justify-content":[{justify:["normal",...je()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...je(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...je(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[k]}],px:[{px:[k]}],py:[{py:[k]}],ps:[{ps:[k]}],Hi:[{Hi:[k]}],Qt:[{Qt:[k]}],ur:[{ur:[k]}],pb:[{pb:[k]}],pl:[{pl:[k]}],m:[{m:[d]}],mx:[{mx:[d]}],my:[{my:[d]}],Ir:[{Ir:[d]}],Hi:[{Hi:[d]}],mt:[{mt:[d]}],mr:[{mr:[d]}],mb:[{mb:[d]}],ml:[{ml:[d]}],"space-x":[{"space-x":[z]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[z]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",be,t]}],"min-w":[{"min-w":[be,t,"min","max","fit"]}],"max-w":[{"max-w":[be,t,"none","full","min","max","fit","prose",{screen:[Ta]},Ta]}],h:[{h:[be,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[be,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[be,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[be,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ta,Sa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ar]}],"font-family":[{font:[To]}],"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",be]}],"line-clamp":[{"line-clamp":["none",oo,Ar]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ua,be]}],"list-image":[{"list-image":["none",be]}],"list-style-type":[{list:["none","disc","decimal",be]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[f]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[f]}],"text-decoration":["underline","overline","line-through","Qt-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ua,Sa]}],"underline-offset":[{"underline-offset":["auto",ua,be]}],"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:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be]}],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",be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[f]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),Gl]}],"bg-repeat":[{bg:["Qt-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",_l]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","Qt","b","bl","l","tl"]},ql]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],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-Bt":[{"rounded-Bt":[r]}],"rounded-Hi":[{"rounded-Hi":[r]}],"rounded-Hi":[{"rounded-Hi":[r]}],"rounded-es":[{"rounded-es":[r]}],"rounded-tl":[{"rounded-tl":[r]}],"rounded-tr":[{"rounded-tr":[r]}],"rounded-Qt":[{"rounded-Qt":[r]}],"rounded-bl":[{"rounded-bl":[r]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[f]}],"border-style":[{border:[...le(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[f]}],"divide-style":[{divide:le()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...le()]}],"outline-offset":[{"outline-offset":[ua,be]}],"outline-w":[{outline:[ua,Sa]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Ce()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[f]}],"ring-offset-w":[{"ring-offset":[ua,Sa]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ta,Jl]}],"shadow-color":[{shadow:[To]}],opacity:[{opacity:[f]}],"mix-blend":[{"mix-blend":[...A(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":A()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[o]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Ta,be]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[l]}],invert:[{invert:[m]}],saturate:[{saturate:[w]}],sepia:[{sepia:[X]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[l]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[f]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[X]}],"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",be]}],duration:[{duration:N()}],ease:[{ease:["linear","in","out","in-out",be]}],delay:[{delay:N()}],animate:[{animate:["none","spin","ping","pulse","bounce",be]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[So,be]}],"translate-x":[{"translate-x":[D]}],"translate-y":[{"translate-y":[D]}],"skew-x":[{"skew-x":[I]}],"skew-y":[{"skew-y":[I]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",be]}],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","Qt-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","Hi-resize","nw-resize","Hi-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",be]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-Ir":[{"scroll-Ir":F()}],"scroll-Hi":[{"scroll-Hi":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-Hi":[{"scroll-Hi":F()}],"scroll-Qt":[{"scroll-Qt":F()}],"scroll-ur":[{"scroll-ur":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"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",be]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ua,Sa,Ar]}],stroke:[{stroke:[e,"none"]}],Ir:["Ir-only","not-Ir-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","Hi","Qt","ur","pb","pl"],px:["ur","pl"],py:["Qt","pb"],m:["mx","my","Ir","Hi","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-Bt","rounded-Hi","rounded-Hi","rounded-es","rounded-tl","rounded-tr","rounded-Qt","rounded-bl"],"rounded-s":["rounded-Bt","rounded-es"],"rounded-e":["rounded-Hi","rounded-Hi"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-Qt"],"rounded-b":["rounded-Qt","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-Ir","scroll-Hi","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-Hi","scroll-Qt","scroll-ur","scroll-pb","scroll-pl"],"scroll-px":["scroll-ur","scroll-pl"],"scroll-py":["scroll-Qt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var Yo=Ll(Ql);function T(...e){return Yo((0,Fi.clsx)(e))}var Li=require("@radix-ui/react-slot"),Bi=require("class-variance-authority"),Oi=Se(require("react")),Hi=require("react/jsx-runtime"),ko=(0,Bi.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"}}}),x=Oi.forwardRef(({asChild:e=!1,className:t,size:a,variant:o,...i},r)=>(0,Hi.jsx)(e?Li.Slot:"button",{className:T(ko({className:t,size:a,variant:o})),ref:r,...i}));x.displayName="Button";var Va=Se(require("react"));var Y=Va.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("div",{ref:a,className:T("rounded-xl border bg-card text-card-foreground shadow",e),...t}));Y.displayName="Card";var rt=Va.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("div",{ref:a,className:T("flex flex-col space-y-1.5 p-6",e),...t}));rt.displayName="CardHeader";var lt=Va.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("div",{ref:a,className:T("font-semibold leading-none tracking-tight",e),...t}));lt.displayName="CardTitle";var Po=Va.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("div",{ref:a,className:T("text-sm text-muted-foreground",e),...t}));Po.displayName="CardDescription";var Te=Va.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("div",{ref:a,className:T("p-6 Qt-0",e),...t}));Te.displayName="CardContent";var Ro=Va.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("div",{ref:a,className:T("flex items-center p-6 Qt-0",e),...t}));Ro.displayName="CardFooter";var ji=Se(require("react"));var G=ji.forwardRef(({className:e,type:t,...a},o)=>(0,Hi.jsx)("input",{type:t,className:T("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}));G.displayName="Input";var Pe=Se(require("@radix-ui/react-select")),ka=Se(require("react")),Je=Pe.Root;var ct=Pe.Value,ze=ka.forwardRef(({children:e,className:t,...a},o)=>(0,Hi.jsxs)(Pe.Trigger,{className:T("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,Hi.jsx)(Pe.Icon,{asChild:!0,children:(0,Hi.jsx)(Bt.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));ze.displayName=Pe.Trigger.displayName;var Ki=ka.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Pe.ScrollUpButton,{className:T("flex cursor-default items-center justify-center py-1",e),ref:a,...t,children:(0,Hi.jsx)(Bt.ChevronUp,{className:"h-4 w-4"})}));Ki.displayName=Pe.ScrollUpButton.displayName;var Ui=ka.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Pe.ScrollDownButton,{className:T("flex cursor-default items-center justify-center py-1",e),ref:a,...t,children:(0,Hi.jsx)(Bt.ChevronDown,{className:"h-4 w-4"})}));Ui.displayName=Pe.ScrollDownButton.displayName;var $e=ka.forwardRef(({children:e,className:t,position:a="popper",...o},i)=>(0,Hi.jsx)(Pe.Portal,{children:(0,Hi.jsxs)(Pe.Content,{className:T("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:i,...o,children:[(0,Hi.jsx)(Ki,{}),(0,Hi.jsx)(Pe.Viewport,{className:T("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),(0,Hi.jsx)(Ui,{})]})}));$e.displayName=Pe.Content.displayName;var ed=ka.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Pe.Label,{className:T("py-1.5 pl-8 ur-2 text-sm font-semibold",e),ref:a,...t}));ed.displayName=Pe.Label.displayName;var fe=ka.forwardRef(({children:e,className:t,...a},o)=>(0,Hi.jsxs)(Pe.Item,{className:T("relative flex w-full cursor-default select-none items-center rounded py-1.5 pl-8 ur-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,Hi.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,Hi.jsx)(Pe.ItemIndicator,{children:(0,Hi.jsx)(Bt.Check,{className:"h-4 w-4"})})}),(0,Hi.jsx)(Pe.ItemText,{children:e})]}));fe.displayName=Pe.Item.displayName;var td=ka.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Pe.Separator,{className:T("-mx-1 my-1 h-px bg-muted",e),ref:a,...t}));td.displayName=Pe.Separator.displayName;var Ir=require("motion/react");var za=Se(require("@radix-ui/react-tabs"));function zi({className:e,...t}){return(0,Hi.jsx)(za.Root,{"data-slot":"tabs",className:T("flex flex-col gap-2",e),...t})}function $i({className:e,...t}){return(0,Hi.jsx)(za.List,{"data-slot":"tabs-list",className:T("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function _i({className:e,...t}){return(0,Hi.jsx)(za.Trigger,{"data-slot":"tabs-trigger",className:T("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 ga=Se(require("react")),Re=Se(require("@radix-ui/react-dropdown-menu")),io=require("@radix-ui/react-icons");var Zt=Re.Root,Xt=Re.Trigger;var Gi=ga.forwardRef(({className:e,inset:t,children:a,...o},i)=>(0,Hi.jsxs)(Re.SubTrigger,{ref:i,className:T("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...o,children:[a,(0,Hi.jsx)(io.ChevronRightIcon,{className:"ml-auto"})]}));Gi.displayName=Re.SubTrigger.displayName;var Wi=ga.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Re.SubContent,{ref:a,className:T("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}));Wi.displayName=Re.SubContent.displayName;var Kt=ga.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,Hi.jsx)(Re.Portal,{children:(0,Hi.jsx)(Re.Content,{ref:o,sideOffset:t,className:T("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})}));Kt.displayName=Re.Content.displayName;var Rt=ga.forwardRef(({className:e,inset:t,...a},o)=>(0,Hi.jsx)(Re.Item,{ref:o,className:T("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...a}));Rt.displayName=Re.Item.displayName;var qi=ga.forwardRef(({className:e,children:t,checked:a,...o},i)=>(0,Hi.jsxs)(Re.CheckboxItem,{ref:i,className:T("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 ur-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,Hi.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,Hi.jsx)(Re.ItemIndicator,{children:(0,Hi.jsx)(io.CheckIcon,{className:"h-4 w-4"})})}),t]}));qi.displayName=Re.CheckboxItem.displayName;var Ji=ga.forwardRef(({className:e,children:t,...a},o)=>(0,Hi.jsxs)(Re.RadioItem,{ref:o,className:T("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 ur-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,Hi.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,Hi.jsx)(Re.ItemIndicator,{children:(0,Hi.jsx)(io.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));Ji.displayName=Re.RadioItem.displayName;var Zi=ga.forwardRef(({className:e,inset:t,...a},o)=>(0,Hi.jsx)(Re.Label,{ref:o,className:T("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...a}));Zi.displayName=Re.Label.displayName;var Xi=ga.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Re.Separator,{ref:a,className:T("-mx-1 my-1 h-px bg-muted",e),...t}));Xi.displayName=Re.Separator.displayName;var Yi=({className:e,...t})=>(0,Hi.jsx)("span",{className:T("ml-auto text-xs tracking-widest opacity-60",e),...t});Yi.displayName="DropdownMenuShortcut";function er({activeTab:e,onTabChange:t,tabOptions:a,className:o="",maxWidth:i="700px",gridCols:r=6}){let n=a.find(s=>s.value===e);return(0,Hi.jsxs)(Ir.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,Hi.jsx)("div",{className:"hidden lg:block",children:(0,Hi.jsx)(zi,{value:e,onValueChange:t,children:(0,Hi.jsx)($i,{className:"grid w-full rounded-2xl p-0 h-10",style:{maxWidth:i,gridTemplateColumns:`repeat(${Math.min(r,a.length)}, minmax(0, 1fr))`},children:a.map(s=>(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.1},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:17},className:"flex-1 px-2",children:(0,Hi.jsx)(_i,{value:s.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:s.label})},s.value))})})}),(0,Hi.jsx)("div",{className:"lg:hidden",children:(0,Hi.jsxs)(Zt,{children:[(0,Hi.jsx)(Xt,{asChild:!0,children:(0,Hi.jsxs)(x,{variant:"outline",className:"rounded-2xl min-w-[140px] justify-between",children:[n?.label||"Select",(0,Hi.jsx)(Bt.ChevronDown,{className:"h-4 w-4 ml-2"})]})}),(0,Hi.jsx)(Kt,{align:"center",className:"w-[180px]",children:a.map(s=>(0,Hi.jsx)(Rt,{onClick:()=>t?.(s.value),className:`cursor-pointer ${e===s.value?"bg-accent":""}`,children:s.label},s.value))})]})})]})}var tr=Se(require("react")),fa=Se(require("@radix-ui/react-avatar"));var va=tr.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(fa.Root,{ref:a,className:T("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));va.displayName=fa.Root.displayName;var Fr=tr.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(fa.Image,{ref:a,className:T("aspect-square h-full w-full",e),...t}));Fr.displayName=fa.Image.displayName;var ha=tr.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(fa.Fallback,{ref:a,className:T("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ha.displayName=fa.Fallback.displayName;var ad=(0,Bi.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 Ae({className:e,variant:t,...a}){return(0,Hi.jsx)("div",{className:T(ad({variant:t}),e),...a})}function or({colleague:e,onEdit:t,onDelete:a,onViewDetails:o,showActions:i=!0,compact:r=!1,className:n}){let[s,c]=(0,Qt.useState)(!1),p=u=>{switch(u){case"active":return"bg-green-500";case"inactive":return"bg-gray-500";default:return"bg-gray-500"}},l=u=>{switch(u){case"active":return"Active";case"inactive":return"Inactive";default:return"Unknown"}},m=u=>{if(!u)return"Never";let b=Math.floor((new Date().getTime()-u.getTime())/(1e3*60));return b<1?"Just now":b<60?`${b}m ago`:b<1440?`${Math.floor(b/60)}h ago`:`${Math.floor(b/1440)}d ago`};return(0,Hi.jsxs)(Y,{className:T("hover:shadow-md transition-shadow",r&&"p-2",n),children:[(0,Hi.jsx)(rt,{className:T("pb-3",r&&"pb-2"),children:(0,Hi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Hi.jsx)("div",{className:"relative",children:(0,Hi.jsxs)(va,{className:T("h-12 w-12",r&&"h-8 w-8"),children:[(0,Hi.jsx)(Fr,{src:"/placeholder.svg",alt:e.name||"name"}),(0,Hi.jsx)(ha,{children:e.name?.split(" ").map(u=>u[0]).join("")})]})}),(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("h3",{className:T("font-semibold text-sm truncate",r&&"text-xs"),children:e.name}),e.type==="digital"?(0,Hi.jsx)(Bt.Bot,{className:T("h-4 w-4 text-blue-500",r&&"h-3 w-3")}):(0,Hi.jsx)(Bt.User,{className:T("h-4 w-4 text-green-500",r&&"h-3 w-3")})]}),(0,Hi.jsx)("p",{className:T("text-sm text-muted-foreground truncate",r&&"text-xs")}),!r&&(0,Hi.jsx)("div",{className:"flex items-center gap-2 mt-1"})]})]}),i&&(0,Hi.jsxs)(Zt,{children:[(0,Hi.jsx)(Xt,{asChild:!0,children:(0,Hi.jsx)(x,{variant:"ghost",size:"icon",className:T("h-8 w-8",r&&"h-6 w-6"),children:(0,Hi.jsx)(Bt.MoreHorizontal,{className:T("h-4 w-4",r&&"h-3 w-3")})})}),(0,Hi.jsxs)(Kt,{align:"end",children:[e.type==="digital"&&(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsxs)(Rt,{onClick:()=>o?.(e),children:[(0,Hi.jsx)(Bt.Settings,{className:"h-4 w-4 mr-2"}),"View Details"]}),(0,Hi.jsxs)(Rt,{onClick:()=>t?.(e),children:[(0,Hi.jsx)(Bt.Edit,{className:"h-4 w-4 mr-2"}),"Edit"]})]}),(0,Hi.jsxs)(Rt,{onClick:()=>a?.(e.id.toString()),className:"text-destructive focus:text-destructive",children:[(0,Hi.jsx)(Bt.Trash2,{className:"h-4 w-4 mr-2"}),e.type==="digital"?"Delete":"Remove from team"]})]})]})]})}),!r&&(0,Hi.jsxs)(Te,{className:"Qt-0",children:[(0,Hi.jsxs)("div",{className:"space-y-2 text-sm",children:[e.type==="human"&&(0,Hi.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,Hi.jsx)(Bt.Mail,{className:"h-3 w-3"}),(0,Hi.jsx)("span",{className:"truncate",children:e.email})]}),e.type==="digital"&&(0,Hi.jsx)("div",{className:"flex items-center gap-2 text-muted-foreground",children:(0,Hi.jsx)("span",{children:e.description})})]}),e.type==="digital"&&(0,Hi.jsx)("div",{className:"mt-3",children:(0,Hi.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.capabilities?.slice(0,s?e.capabilities.length:2).map(u=>(0,Hi.jsx)(Ae,{variant:"outline",className:"text-xs",children:typeof u.value=="number"?u.value:u.value.name},typeof u.value=="number"?u.value:u.value.name)),(e.capabilities?.length||0)>2&&(0,Hi.jsx)(x,{variant:"ghost",size:"sm",className:"h-5 px-2 text-xs",onClick:()=>c(!s),children:s?"Show less":`+${(e.capabilities?.length||0)-2} more`})]})})]})]})}var on=Se(require("react")),Lr=Se(require("@radix-ui/react-label"));var od=(0,Bi.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),R=on.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Lr.Root,{ref:a,className:T(od(),e),...t}));R.displayName=Lr.Root.displayName;var sn=Se(require("react")),Ee=sn.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("textarea",{className:T("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}));Ee.displayName="Textarea";var Br=Se(require("react")),Ut=Se(require("@radix-ui/react-scroll-area"));var Ra=Br.forwardRef(({className:e,children:t,...a},o)=>(0,Hi.jsxs)(Ut.Root,{ref:o,className:T("relative overflow-hidden",e),...a,children:[(0,Hi.jsx)(Ut.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),(0,Hi.jsx)(dn,{}),(0,Hi.jsx)(Ut.Corner,{})]}));Ra.displayName=Ut.Root.displayName;var dn=Br.forwardRef(({className:e,orientation:t="vertical",...a},o)=>(0,Hi.jsx)(Ut.ScrollAreaScrollbar,{ref:o,orientation:t,className:T("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,Hi.jsx)(Ut.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));dn.displayName=Ut.ScrollAreaScrollbar.displayName;function cn({selectedDocuments:e,onDocumentsChange:t,availableDocuments:a,label:o,placeholder:i="Search knowledge documents...",maxSelections:r,disabled:n=!1}){let[s,c]=(0,Qt.useState)(""),[p,l]=(0,Qt.useState)([]),[m,u]=(0,Qt.useState)(!1);(0,Qt.useEffect)(()=>{if(!s.trim()){l([]),u(!1);return}let d=a.filter(f=>{if(e.map(C=>C.id).includes(f.id))return!1;let w=s.toLowerCase();return f.title.toLowerCase().includes(w)||f.description?.toLowerCase().includes(w)||f.tags?.some(C=>C.toLowerCase().includes(w))||Object.values(f.metadata||{}).some(C=>String(C).toLowerCase().includes(w))});l(d),u(!0)},[s,e,a]);let y=d=>{r&&e.length>=r&&e.pop(),t([...e,d]),c(""),u(!1)},b=d=>{console.log("doc",d,e),t(e.filter(f=>f.id!==d))},h=!r||e.length<r;return(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{children:o}),(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)(Bt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Hi.jsx)(G,{value:s,onChange:d=>c(d.target.value),placeholder:h?i:`Maximum ${r} documents selected`,className:"pl-9",disabled:n||!h,onFocus:()=>s&&u(!0)})]}),m&&p.length>0&&(0,Hi.jsx)(Y,{className:"absolute top-full left-0 right-0 z-10 mt-1 max-h-60",children:(0,Hi.jsx)(Ra,{className:"h-full",children:(0,Hi.jsx)(Te,{className:"p-2",children:p.map(d=>(0,Hi.jsx)(x,{variant:"ghost",className:"w-full justify-start h-auto p-3 mb-1",onClick:()=>y(d),disabled:n,children:(0,Hi.jsxs)("div",{className:"flex items-start gap-3 w-full",children:[(0,Hi.jsx)(Bt.FileText,{className:"h-4 w-4 mt-0.5 text-muted-foreground flex-shrink-0"}),(0,Hi.jsxs)("div",{className:"text-left flex-1 min-w-0",children:[(0,Hi.jsx)("div",{className:"font-medium text-sm truncate",children:d.title}),d.description&&(0,Hi.jsx)("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:d.description}),d.tags&&d.tags.length>0&&(0,Hi.jsxs)("div",{className:"flex flex-wrap gap-1 mt-2",children:[d.tags.slice(0,3).map(f=>(0,Hi.jsx)(Ae,{variant:"outline",className:"text-xs",children:f},f)),d.tags.length>3&&(0,Hi.jsxs)(Ae,{variant:"outline",className:"text-xs",children:["+",d.tags.length-3," more"]})]})]})]})},d.id))})})}),m&&s&&p.length===0&&(0,Hi.jsx)(Y,{className:"absolute top-full left-0 right-0 z-10 mt-1",children:(0,Hi.jsxs)(Te,{className:"p-4 text-center text-sm text-muted-foreground",children:['Bt knowledge documents found for "',s,'"']})})]}),e.length>0&&(0,Hi.jsx)("div",{className:"space-y-2",children:(0,Hi.jsx)("div",{className:"space-y-2",children:e.map(d=>(0,Hi.jsx)(Y,{className:"p-3",children:(0,Hi.jsxs)("div",{className:"flex items-start gap-3",children:[(0,Hi.jsx)(Bt.FileText,{className:"h-4 w-4 mt-0.5 text-muted-foreground flex-shrink-0"}),(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsx)("div",{className:"font-medium text-sm",children:d.title}),d.description&&(0,Hi.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:d.description}),d.tags&&d.tags.length>0&&(0,Hi.jsx)("div",{className:"flex flex-wrap gap-1 mt-2",children:d.tags.map(f=>(0,Hi.jsxs)(Ae,{variant:"outline",className:"text-xs",children:[(0,Hi.jsx)(Bt.Tag,{className:"h-3 w-3 mr-1"}),f]},f))})]}),(0,Hi.jsx)(x,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",onClick:()=>b(d.id),disabled:n,children:(0,Hi.jsx)(Bt.X,{className:"h-3 w-3"})})]})},d.id))})}),m&&(0,Hi.jsx)("div",{className:"fixed inset-0 z-0",onClick:()=>u(!1)})]})}function Or({colleague:e,onSave:t,onCancel:a,isLoading:o=!1,title:i,submitLabel:r,cancelLabel:n="Cancel",readOnly:s=!1,availableKnowledgeDocuments:c=[]}){let[p,l]=(0,$a.useState)({type:"digital",name:"",description:"",jobDescription:"",workInstructions:"",capabilities:[],capabilityLevel:0,coreKnowledge:null,...e}),[m,u]=(0,$a.useState)(""),[y,b]=(0,$a.useState)(""),[h,d]=(0,$a.useState)(!s);(0,$a.useEffect)(()=>{e&&l(e)},[e]);let f=D=>{D.preventDefault();let V={id:p.id||parseInt(Date.now().toString()),name:p.name,type:"digital",description:p.description,jobDescription:p.jobDescription||"",workInstructions:p.workInstructions||"",capabilities:p.capabilities||[],capabilityLevel:p.capabilityLevel||0,coreKnowledge:p.coreKnowledge||null};t(V)},k=(D,V,W)=>{if(!V.trim())return;let q=p[D]||[];l({...p,[D]:[...q,V.trim()]}),W("")},w=(D,V)=>{let W=p[D]||[];l({...p,[D]:W.filter((q,F)=>F!==V)})},C=D=>{D.preventDefault(),d(!h)},X=(D,V,W,q,F)=>{let Ce=p[D]||[];return(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{children:V}),h&&(0,Hi.jsxs)("div",{className:"flex gap-2",children:[(0,Hi.jsx)(G,{value:W,onChange:ke=>q(ke.target.value),placeholder:F,onKeyPress:ke=>{ke.key==="Enter"&&(ke.preventDefault(),k(D,W,q))},disabled:o}),(0,Hi.jsx)(x,{type:"button",variant:"outline",size:"icon",onClick:()=>k(D,W,q),disabled:o,children:(0,Hi.jsx)(Bt.Plus,{className:"h-4 w-4"})})]}),(0,Hi.jsx)("div",{className:"flex flex-wrap gap-2",children:Ce.map((ke,B)=>(0,Hi.jsxs)(Ae,{className:"gap-1",children:[ke,h&&(0,Hi.jsx)(x,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-accent hover:text-accent-foreground",onClick:()=>w(D,B),disabled:o,children:(0,Hi.jsx)(Bt.X,{className:"h-3 w-3"})})]},`${D}-${B}-${ke}`))})]})},I=i||(h?e?"Edit Colleague":"Add New Colleague":"View Colleague"),z=r||(e?"Update Colleague":"Add Colleague");return(0,Hi.jsxs)(Y,{className:"m-8 w-full max-w-4xl mx-auto overflow-y-scroll Qt-scrollbar",children:[(0,Hi.jsx)(rt,{children:(0,Hi.jsxs)(lt,{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Bt.Bot,{className:"h-5 w-5"}),I]})}),(0,Hi.jsx)(Te,{children:(0,Hi.jsxs)("form",{onSubmit:f,className:"space-y-6",children:[(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"name",children:"Name *"}),(0,Hi.jsx)(G,{id:"name",value:p.name||"",onChange:D=>l({...p,name:D.target.value}),required:!0,disabled:o||!h})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:p.description||"",onChange:D=>l({...p,description:D.target.value}),rows:3,placeholder:"Brief description of this digital colleague...",disabled:o||!h})]})]}),(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsx)("h3",{className:"text-lg font-semibold",children:"Digital Colleague Details"}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"jobDescription",children:"Job Description *"}),(0,Hi.jsx)(Ee,{id:"jobDescription",value:p.jobDescription||"",onChange:D=>l({...p,jobDescription:D.target.value}),rows:4,required:p.type==="digital",disabled:o||!h})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"workInstructions",children:"Work Instructions"}),(0,Hi.jsx)(Ee,{id:"workInstructions",value:p.workInstructions||"",onChange:D=>l({...p,workInstructions:D.target.value}),rows:4,placeholder:"Enter detailed work instructions for this digital colleague...",disabled:o||!h})]}),X("capabilities","Capabilities",y,b,"Add capability"),(0,Hi.jsx)(cn,{selectedDocuments:p.coreKnowledge?[{id:p.coreKnowledge?.id?.toString(),title:p.coreKnowledge?.name,format:"markdown",content:p.coreKnowledge?.content||"",createdAt:new Date(p.coreKnowledge?.createdAt),description:p.coreKnowledge?.description||"",metadata:p.coreKnowledge?.metadata||{},updatedAt:new Date(p.coreKnowledge?.updatedAt)}]:[],onDocumentsChange:D=>{let V={createdAt:D[0]?.createdAt.toISOString(),id:parseInt(D[0]?.id),name:D[0]?.title,source:"payload",updatedAt:(D[0]?.updatedAt||new Date).toISOString()};console.log(D),l({...p,coreKnowledge:D&&D.length>0?V:void 0})},label:"Core Knowledge",placeholder:"Search for core knowledge documents...",maxSelections:1,disabled:o||!h,availableDocuments:c.map(D=>({id:D.id.toString(),title:D.name,name:D.name,format:"markdown",content:D.content||"",createdAt:new Date(D.createdAt),source:D.source,description:D.description||"",metadata:D.metadata||{},updatedAt:new Date(D.updatedAt)}))})]}),(0,Hi.jsxs)("div",{className:"flex justify-end gap-2 Qt-4 border-t",children:[(0,Hi.jsx)(x,{type:"button",variant:"outline",onClick:a,disabled:o,children:h?n:"Close"}),h?(0,Hi.jsx)(x,{type:"submit",disabled:o,children:o?"Saving...":z}):(0,Hi.jsxs)(x,{type:"button",onClick:C,disabled:o,className:"gap-2",children:[(0,Hi.jsx)(Bt.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})})]})}function mn({users:e,onUserSelect:t,onCancel:a,selectedUserId:o}){let[i,r]=(0,Qt.useState)(""),n=(0,Qt.useMemo)(()=>e.filter(c=>c.name?.toLowerCase().includes(i.toLowerCase())||c.email.toLowerCase().includes(i.toLowerCase())),[e,i]),s=c=>{t(c)};return(0,Hi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Hi.jsxs)(x,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Hi.jsx)(Bt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("h1",{className:"text-3xl font-bold",children:"Select User"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Choose a user to add as a colleague"})]})]}),(0,Hi.jsx)(Y,{className:"container",children:(0,Hi.jsx)(Te,{className:"Qt-6",children:(0,Hi.jsx)("div",{className:"flex flex-col md:flex-row gap-4",children:(0,Hi.jsx)("div",{className:"flex-1",children:(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)(Bt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Hi.jsx)(G,{placeholder:"Search users by name, email, role, or skills...",value:i,onChange:c=>r(c.target.value),className:"pl-9"})]})})})})}),(0,Hi.jsx)("div",{className:"container grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:n.map(c=>(0,Hi.jsx)(Ir.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,Hi.jsxs)(Y,{className:`cursor-pointer transition-all hover:shadow-lg ${o===c.id?"ring-2 ring-primary":""}`,onClick:()=>s(c),children:[(0,Hi.jsx)(rt,{className:"pb-3",children:(0,Hi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Hi.jsx)(va,{children:(0,Hi.jsx)(ha,{children:(0,Hi.jsx)(Bt.User,{className:"h-4 w-4"})})}),(0,Hi.jsx)("div",{children:(0,Hi.jsx)(lt,{className:"text-lg",children:c.name})})]}),o===c.id&&(0,Hi.jsx)(Bt.Check,{className:"h-5 w-5 text-primary"})]})}),(0,Hi.jsx)(Te,{className:"Qt-0",children:(0,Hi.jsxs)("div",{className:"space-y-3",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Email"}),(0,Hi.jsx)("p",{className:"text-sm font-medium",children:c.email})]}),(0,Hi.jsx)("div",{children:(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Department"})})]})})]})},c.id))}),n.length===0&&(0,Hi.jsx)(Y,{className:"container mt-4",children:(0,Hi.jsx)(Te,{className:"Qt-6",children:(0,Hi.jsxs)("div",{className:"text-center py-8",children:[(0,Hi.jsx)(Bt.User,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Hi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Bt users found"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"user-selection")})})}function pn({digitalColleagues:e,onColleagueClone:t,onCancel:a,selectedColleagueId:o}){let[i,r]=(0,Qt.useState)(""),[n,s]=(0,Qt.useState)("all"),c=(0,Qt.useMemo)(()=>e.filter(m=>m.name.toLowerCase().includes(i.toLowerCase())||m.jobDescription?.toLowerCase().includes(i.toLowerCase())||m.workInstructions?.toLowerCase().includes(i.toLowerCase())),[e,i,n]),p=m=>{let u={...m,name:`${m.name} (Copy)`};t(u)},l=m=>new Intl.DateTimeFormat("Bi-US",{month:"short",day:"numeric",year:"numeric"}).format(m);return(0,Hi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Hi.jsxs)(x,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Hi.jsx)(Bt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("h1",{className:"text-3xl font-bold",children:"Clone Digital Colleague"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Select a digital colleague to clone"})]})]}),(0,Hi.jsx)(Y,{children:(0,Hi.jsx)(Te,{className:"Qt-6",children:(0,Hi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,Hi.jsx)("div",{className:"flex-1",children:(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)(Bt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Hi.jsx)(G,{placeholder:"Search by name, job description, or capabilities...",value:i,onChange:m=>r(m.target.value),className:"pl-9"})]})}),(0,Hi.jsxs)("select",{value:n,onChange:m=>s(m.target.value),className:"h-10 px-3 rounded-md border border-input bg-background text-sm ring-offset-background",children:[(0,Hi.jsx)("option",{value:"all",children:"All Status"}),(0,Hi.jsx)("option",{value:"active",children:"Active"}),(0,Hi.jsx)("option",{value:"inactive",children:"Inactive"})]})]})})}),(0,Hi.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:c.map(m=>(0,Hi.jsx)(Ir.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,Hi.jsxs)(Y,{className:`cursor-pointer transition-all hover:shadow-lg ${o?.toString()===m.id.toString()?"ring-2 ring-primary":""}`,onClick:()=>p(m),children:[(0,Hi.jsx)(rt,{className:"pb-3",children:(0,Hi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Hi.jsx)(va,{children:(0,Hi.jsx)(ha,{className:"bg-blue-100",children:(0,Hi.jsx)(Bt.Bot,{className:"h-4 w-4 text-blue-600"})})}),(0,Hi.jsx)("div",{children:(0,Hi.jsx)(lt,{className:"text-lg flex items-center gap-2",children:m.name})})]}),(0,Hi.jsxs)(x,{size:"sm",variant:"outline",className:"gap-2 h-8",onClick:u=>{u.stopPropagation(),p(m)},children:[(0,Hi.jsx)(Bt.Copy,{className:"h-3 w-3"}),"Clone"]})]})}),(0,Hi.jsx)(Te,{className:"Qt-0",children:(0,Hi.jsxs)("div",{className:"space-y-3",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Job Description"}),(0,Hi.jsx)("p",{className:"text-sm line-clamp-2",children:m.jobDescription})]}),m.capabilities&&m.capabilities.length>0&&(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Capabilities"}),(0,Hi.jsx)("div",{className:"flex flex-wrap gap-1",children:m.capabilities.length>3&&(0,Hi.jsxs)(Ae,{variant:"outline",className:"text-xs",children:["+",m.capabilities.length-3]})})]}),(0,Hi.jsx)("div",{className:"flex items-center justify-between text-xs text-muted-foreground"}),m.workInstructions&&(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Instructions"}),(0,Hi.jsx)("p",{className:"text-xs line-clamp-2",children:m.workInstructions})]})]})})]})},m.id))}),c.length===0&&(0,Hi.jsx)(Y,{children:(0,Hi.jsx)(Te,{className:"Qt-6",children:(0,Hi.jsxs)("div",{className:"text-center py-8",children:[(0,Hi.jsx)(Bt.Bot,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Hi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Bt digital colleagues found"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"colleague-clone")})})}function un({onSelectHuman:e,onSelectDigital:t,onCancel:a}){return(0,Hi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Hi.jsxs)(x,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Hi.jsx)(Bt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Colleague"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Choose the type of colleague to add"})]})]}),(0,Hi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Hi.jsxs)(Y,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,Hi.jsxs)(rt,{className:"text-center pb-4",children:[(0,Hi.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,Hi.jsx)(Bt.User,{className:"h-8 w-8 text-blue-600"})}),(0,Hi.jsx)(lt,{className:"text-xl",children:"Add Human Colleague"})]}),(0,Hi.jsxs)(Te,{className:"text-center",children:[(0,Hi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Select from existing users in your organization to add as team members."}),(0,Hi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Bt.Users,{className:"h-4 w-4 text-blue-600"}),(0,Hi.jsx)("span",{children:"Browse existing users"})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Bt.User,{className:"h-4 w-4 text-blue-600"}),(0,Hi.jsx)("span",{children:"Import user details automatically"})]})]}),(0,Hi.jsx)(x,{className:"mt-6 w-full",onClick:e,children:"Select User"})]})]})}),(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Hi.jsxs)(Y,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,Hi.jsxs)(rt,{className:"text-center pb-4",children:[(0,Hi.jsx)("div",{className:"mx-auto w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:(0,Hi.jsx)(Bt.Bot,{className:"h-8 w-8 text-purple-600"})}),(0,Hi.jsx)(lt,{className:"text-xl",children:"Add Digital Colleague"})]}),(0,Hi.jsxs)(Te,{className:"text-center",children:[(0,Hi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Clone Qt existing digital colleague or create a new AI assistant for your team."}),(0,Hi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Bt.Bot,{className:"h-4 w-4 text-purple-600"}),(0,Hi.jsx)("span",{children:"Clone existing colleagues"})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Bt.Users,{className:"h-4 w-4 text-purple-600"}),(0,Hi.jsx)("span",{children:"Create from templates"})]})]}),(0,Hi.jsx)(x,{className:"mt-6 w-full",onClick:t,children:"Add Digital Colleague"})]})]})})]})]},"colleague-type-selection")})})}function gn({onCloneExisting:e,onCreateNew:t,onCancel:a}){return(0,Hi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Hi.jsxs)(x,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Hi.jsx)(Bt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Digital Colleague"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Choose how to create your digital colleague"})]})]}),(0,Hi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Hi.jsxs)(Y,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,Hi.jsxs)(rt,{className:"text-center pb-4",children:[(0,Hi.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,Hi.jsx)(Bt.Copy,{className:"h-8 w-8 text-blue-600"})}),(0,Hi.jsx)(lt,{className:"text-xl",children:"Clone Existing"})]}),(0,Hi.jsxs)(Te,{className:"text-center",children:[(0,Hi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Start with Qt existing digital colleague and customize Bt for your needs."}),(0,Hi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Bt.Bot,{className:"h-4 w-4 text-blue-600"}),(0,Hi.jsx)("span",{children:"Pre-configured capabilities"})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Bt.Copy,{className:"h-4 w-4 text-blue-600"}),(0,Hi.jsx)("span",{children:"Inherit knowledge base"})]})]}),(0,Hi.jsx)(x,{className:"mt-6 w-full",onClick:e,children:"Browse & Clone"})]})]})}),(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Hi.jsxs)(Y,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,Hi.jsxs)(rt,{className:"text-center pb-4",children:[(0,Hi.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,Hi.jsx)(Bt.Sparkles,{className:"h-8 w-8 text-green-600"})}),(0,Hi.jsx)(lt,{className:"text-xl",children:"Create New"})]}),(0,Hi.jsxs)(Te,{className:"text-center",children:[(0,Hi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Build a completely new digital colleague from scratch with custom specifications."}),(0,Hi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Bt.Plus,{className:"h-4 w-4 text-green-600"}),(0,Hi.jsx)("span",{children:"Custom job description"})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Bt.Sparkles,{className:"h-4 w-4 text-green-600"}),(0,Hi.jsx)("span",{children:"Define unique capabilities"})]})]}),(0,Hi.jsx)(x,{className:"mt-6 w-full",onClick:t,children:"Create from Scratch"})]})]})})]})]},"digital-colleague-options")})})}function fn(e,t){let[a,o]=(0,Qt.useState)(()=>{if(typeof window>"u")return t;try{let r=window.localStorage.getItem(e);return r?JSON.parse(r):t}catch{return t}}),i=r=>{try{o(r),typeof window<"u"&&window.localStorage.setItem(e,JSON.stringify(r))}catch{}};return(0,Qt.useEffect)(()=>{i(a)},[]),[a,i]}var nr=require("react-icons/fa");function St({title:e,description:t,badge:a,primaryAction:o,secondaryAction:i,gradient:r,children:n,className:s}){let[c,p]=fn(`hero-section-minimized-${e.replace(/\s+/Hi,"-").toLowerCase()}`,!i&&!t),l=!i&&!t||c;return(0,Hi.jsxs)(Ir.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 ${s||""}`,children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[a&&(0,Hi.jsx)(Ae,{className:"bg-white/20 text-white hover:bg-white/30 rounded-xl",children:a}),(0,Hi.jsx)("h2",{className:"text-3xl font-bold m-0",children:e})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[l&&o&&(0,Hi.jsx)(x,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:o.onClick,children:o.label}),(i||t)&&(0,Hi.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:()=>p(!c),style:{lineHeight:0},children:c?(0,Hi.jsx)(nr.FaChevronDown,{size:22}):(0,Hi.jsx)(nr.FaChevronUp,{size:22})})]})]}),!l&&(0,Hi.jsxs)("div",{className:"flex flex-col gap-6 md:flex-row md:items-center md:justify-between",children:[(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsx)("p",{className:"max-w-[600px] text-white/80",children:t}),(0,Hi.jsxs)("div",{className:"flex flex-wrap gap-3",children:[o&&(0,Hi.jsx)(x,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:o.onClick,children:o.label}),i&&(0,Hi.jsx)(x,{variant:"outline",className:"rounded-2xl bg-transparent border-white text-white hover:bg-white/10",onClick:i.onClick,children:i.label})]})]}),n&&(0,Hi.jsx)("div",{className:"hidden lg:block",children:n})]})]})}function Hr(...e){return Yo((0,Fi.clsx)(e))}function jr({initialColleagues:e,onColleagueAdd:t,onColleagueEdit:a,onColleagueDelete:o,compactView:i=!1,departments:r=["Design","Engineering","Marketing","Product","Sales","Operations"],className:n,availableUsers:s=[],existingDigitalColleagues:c=[],availableKnowledgeDocuments:p=[]}){let[l,m]=(0,Qt.useState)(e||[]),[u,y]=(0,Qt.useState)(""),[b,h]=(0,Qt.useState)("all"),[d,f]=(0,Qt.useState)("all"),[k,w]=(0,Qt.useState)("all"),[C,X]=(0,Qt.useState)(null),[I,z]=(0,Qt.useState)(null);(0,Qt.useEffect)(()=>{m(e||[])},[e]);let D=Array.isArray(s)?s:[],V=Array.isArray(c)?c:[],[W,q]=(0,Qt.useState)("main"),F=l.filter(L=>!L||!L.name?!1:L.name.toLowerCase().includes(u.toLowerCase())||L.type==="human"&&L.email?.toLowerCase().includes(u.toLowerCase())||L.type==="digital"&&L.jobDescription?.toLowerCase().includes(u.toLowerCase())),Ce=F.filter(L=>L.type==="human"),ke=F.filter(L=>L.type==="digital"),B=()=>{q("typeSelection")},le=L=>{L.type==="digital"&&(X(L),q("form")),console.log("Editing colleague:",L),a?.(L)},A=L=>{L.type==="digital"&&(z(L),q("view"))},je=L=>{let ot={id:`human-${Date.now()}`,type:"human",name:L.name,email:L.email,updatedAt:L.updatedAt,createdAt:L.createdAt,accounts:L.accounts};m(Vt=>[...Vt,ot]),t?.(ot),q("main")},M=L=>{if(!L||!L.id){console.error("Invalid cloned colleague provided to handleDigitalColleagueClone:",L);return}m(ot=>[...ot,{...L,type:"digital"}]),t?.({...L,type:"digital"}),q("main")},O=()=>{X(null),q("form")},N=L=>{if(!L||!L.id){console.error("Invalid colleague provided to handleSaveColleague:",L);return}C?(m(ot=>ot.map(Vt=>Vt.id===L.id?{...L,type:"digital"}:Vt)),a?.({...L,type:"digital"})):(m(ot=>[...ot,{...L,type:"digital"}]),t?.({...L,type:"digital"})),q("main"),X(null)},_=()=>{q("main"),X(null),z(null)},de=()=>{q("main"),z(null)},nt=()=>{I&&(X(I),z(null),q("form"))},ye=L=>{console.log("deleting",L,l),o?.(L,l.find(ot=>ot.id.toString()===L.toString())?.type),m(ot=>ot.filter(Vt=>Vt.id!==L))},at=()=>{y(""),h("all"),f("all")};return W==="typeSelection"?(0,Hi.jsx)(un,{onSelectHuman:()=>q("userSelection"),onSelectDigital:()=>q("digitalOptions"),onCancel:()=>q("main")}):W==="userSelection"?(0,Hi.jsx)(mn,{users:D,onUserSelect:je,onCancel:()=>q("typeSelection")}):W==="digitalOptions"?(0,Hi.jsx)(gn,{onCloneExisting:()=>q("digitalClone"),onCreateNew:O,onCancel:()=>q("typeSelection")}):W==="digitalClone"?(0,Hi.jsx)(pn,{digitalColleagues:V,onColleagueClone:M,onCancel:()=>q("digitalOptions")}):W==="form"?(0,Hi.jsx)(Or,{colleague:C||void 0,onSave:N,onCancel:_,availableKnowledgeDocuments:p}):W==="view"?(0,Hi.jsx)(Or,{colleague:I||void 0,onSave:N,onCancel:de,readOnly:!0,availableKnowledgeDocuments:p}):(0,Hi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsx)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Hi.jsxs)("div",{className:`space-y-6 ${n||""}`,children:[(0,Hi.jsx)(St,{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:B}}),(0,Hi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,Hi.jsxs)(Y,{children:[(0,Hi.jsxs)(rt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,Hi.jsx)(lt,{className:"text-sm font-medium",children:"Total Colleagues"}),(0,Hi.jsx)(Bt.Users,{className:"h-4 w-4 text-muted-foreground"})]}),(0,Hi.jsxs)(Te,{children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold",children:l.length}),(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]}),(0,Hi.jsxs)(Y,{children:[(0,Hi.jsxs)(rt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,Hi.jsx)(lt,{className:"text-sm font-medium",children:"Human Members"}),(0,Hi.jsx)(Bt.User,{className:"h-4 w-4 text-muted-foreground"})]}),(0,Hi.jsxs)(Te,{children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold",children:l.filter(L=>L.type==="human").length}),(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground",children:"active"})]})]}),(0,Hi.jsxs)(Y,{children:[(0,Hi.jsxs)(rt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,Hi.jsx)(lt,{className:"text-sm font-medium",children:"Digital Colleagues"}),(0,Hi.jsx)(Bt.Bot,{className:"h-4 w-4 text-muted-foreground"})]}),(0,Hi.jsxs)(Te,{children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold",children:l.filter(L=>L.type==="digital").length}),(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]})]}),(0,Hi.jsx)(Y,{children:(0,Hi.jsx)(Te,{className:"Qt-6",children:(0,Hi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,Hi.jsx)("div",{className:"flex-1",children:(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)(Bt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Hi.jsx)(G,{placeholder:"Search colleagues...",value:u,onChange:L=>y(L.target.value),className:"pl-9"})]})}),(0,Hi.jsxs)(Je,{value:b,onValueChange:h,children:[(0,Hi.jsx)(ze,{className:"w-full md:w-[180px]",children:(0,Hi.jsx)(ct,{placeholder:"Department"})}),(0,Hi.jsxs)($e,{children:[(0,Hi.jsx)(fe,{value:"all",children:"All Departments"}),r.map(L=>(0,Hi.jsx)(fe,{value:L,children:L},L))]})]}),(0,Hi.jsxs)(Je,{value:d,onValueChange:f,children:[(0,Hi.jsx)(ze,{className:"w-full md:w-[140px]",children:(0,Hi.jsx)(ct,{placeholder:"Status"})}),(0,Hi.jsxs)($e,{children:[(0,Hi.jsx)(fe,{value:"all",children:"All Status"}),(0,Hi.jsx)(fe,{value:"active",children:"Active"}),(0,Hi.jsx)(fe,{value:"inactive",children:"Inactive"})]})]}),(u||b!=="all"||d!=="all")&&(0,Hi.jsxs)(x,{variant:"outline",onClick:at,className:"gap-2",children:[(0,Hi.jsx)(Bt.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsx)(er,{activeTab:k,onTabChange:w,tabOptions:[{value:"all",label:`All (${F.length})`},{value:"human",label:`Human (${Ce.length})`},{value:"digital",label:`Digital (${ke.length})`}],maxWidth:"400px",gridCols:3}),k==="all"&&(0,Hi.jsx)("div",{className:`grid gap-4 ${i?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:F.map(L=>(0,Hi.jsx)(or,{colleague:L,onEdit:le,onDelete:ye,onViewDetails:A,compact:i,className:Hr([L.type==="digital"&&"border-teal-400"])},`${L}-${L.id}`))}),k==="human"&&(0,Hi.jsx)("div",{className:`grid gap-4 ${i?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:Ce.map(L=>(0,Hi.jsx)(or,{colleague:L,onEdit:le,onDelete:ye,onViewDetails:A,compact:i},L.id))}),k==="digital"&&(0,Hi.jsx)("div",{className:`grid gap-4 ${i?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:ke.map(L=>(0,Hi.jsx)(or,{colleague:L,onEdit:le,onDelete:ye,onViewDetails:A,compact:i,className:Hr([L.type==="digital"&&"border-teal-400"])},L.id))})]}),F.length===0&&(0,Hi.jsx)(Y,{children:(0,Hi.jsx)(Te,{className:"Qt-6",children:(0,Hi.jsxs)("div",{className:"text-center py-8",children:[(0,Hi.jsx)(Bt.Users,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Hi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Bt colleagues found"}),(0,Hi.jsx)("p",{className:"text-muted-foreground mb-4",children:u||b!=="all"||d!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first colleague."}),(0,Hi.jsxs)(x,{onClick:B,className:"gap-2",children:[(0,Hi.jsx)(Bt.Plus,{className:"h-4 w-4"}),"Add Colleague"]})]})})})]})},"projects-index-view")})})}var Io=Se(require("react")),yt=Se(require("@radix-ui/react-dialog"));var Ve=yt.Root;var co=yt.Portal;var _a=Io.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(yt.Overlay,{ref:a,className:T("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));_a.displayName=yt.Overlay.displayName;var Ze=Io.forwardRef(({className:e,children:t,...a},o)=>(0,Hi.jsxs)(co,{children:[(0,Hi.jsx)(_a,{}),(0,Hi.jsxs)(yt.Content,{ref:o,className:T("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,Hi.jsxs)(yt.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,Hi.jsx)(Bt.X,{className:"h-4 w-4"}),(0,Hi.jsx)("span",{className:"Ir-only",children:"Close"})]})]})]}));Ze.displayName=yt.Content.displayName;var Xe=({className:e,...t})=>(0,Hi.jsx)("div",{className:T("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Xe.displayName="DialogHeader";var mo=({className:e,...t})=>(0,Hi.jsx)("div",{className:T("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});mo.displayName="DialogFooter";var Ke=Io.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(yt.Title,{ref:a,className:T("text-lg font-semibold leading-none tracking-tight",e),...t}));Ke.displayName=yt.Title.displayName;var po=Io.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(yt.Description,{ref:a,className:T("text-sm text-muted-foreground",e),...t}));po.displayName=yt.Description.displayName;var gs=Se(require("@radix-ui/react-dialog"));var Ma=({fieldName:e,value:t,label:a,multiline:o=!1,onSave:i,className:r="",disabled:n=!1})=>{let[s,c]=(0,Qt.useState)(!1),[p,l]=(0,Qt.useState)(""),m=()=>{n||(c(!0),l(t))},u=async()=>{p!==t&&await i(e,p),c(!1)},y=b=>{b.key==="Enter"&&!o||b.key==="Enter"&&b.ctrlKey&&o?u():b.key==="Escape"&&(c(!1),l(""))};return(0,Hi.jsxs)("div",{className:`space-y-2 ${r}`,children:[(0,Hi.jsx)(R,{children:a}),s?o?(0,Hi.jsx)(Ee,{value:p,onChange:b=>l(b.target.value),onBlur:u,onKeyDown:y,autoFocus:!0,rows:4,className:"resize-none"}):(0,Hi.jsx)(G,{value:p,onChange:b=>l(b.target.value),onBlur:u,onKeyPress:y,autoFocus:!0,className:"text-lg font-medium"}):(0,Hi.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,Hi.jsx)("span",{className:o?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click to edit..."}),!n&&(0,Hi.jsx)(Bt.Edit,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var Gn=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),Wn=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),qn=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),Jn=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),Zn=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),Xn=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),Yn=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),ur=require("@payloadcms/richtext-lexical/lexical/list"),Qn=require("@payloadcms/richtext-lexical/lexical/rich-text"),es=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var $n=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),Ho=require("@payloadcms/richtext-lexical/lexical/utils"),xe=require("@payloadcms/richtext-lexical/lexical"),Xr=require("@payloadcms/richtext-lexical/lexical/selection");var An=require("@radix-ui/react-dialog"),mr=require("@payloadcms/richtext-lexical/client");var Ur=Se(require("bson-objectid"));var wn=require("@payloadcms/ui");var yn=Se(require("react")),ea=Se(require("@radix-ui/react-tooltip"));var lr=ea.Provider,dr=ea.Root,cr=ea.Trigger,Fo=yn.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,Hi.jsx)(ea.Portal,{children:(0,Hi.jsx)(ea.Content,{ref:o,sideOffset:t,className:T("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));Fo.displayName=ea.Content.displayName;var rd=e=>{let{data:{relationTo:t,value:a},nodeKey:o}=e,[i]=(0,$n.useLexicalComposerContext)(),[r,n]=(0,Qt.useState)(""),[s,c]=(0,Qt.useState)(""),[p,l]=(0,Qt.useState)(""),m=async d=>{console.log("fetchMedia",d)};(0,Qt.useEffect)(()=>{typeof a=="string"?a.length===24?m(a):(n(a||""),l(h(b())),c(y()||"")):typeof a=="object"&&(n(`${process.env.NEXT_PUBLIC_API_URL}${a.url}`||""),l(h(a.filesize)),c(a.mimeType?.split("/")[1]||""))},[]);let u=(0,Qt.useCallback)(()=>{i.update(()=>{(0,xe.$getNodeByKey)(o)?.remove()})},[i,o]),y=()=>{let d=e.data.value;return typeof d=="string"?d.split(";base64")[0]?.split("image/")[1]:""},b=()=>{let d=e.data.value;if(typeof d=="string"){let f=d.split(",")[1]?.length||0;return 4*Math.ceil(f/3)*.5624896334383812/1e3}return 0};function h(d){if(d>=1e6){let k=d/1e6;return`${k>=10?Math.round(k).toString():k.toFixed(1)} MB`}return`${Math.floor(d/1e3)} KB`}return(0,Hi.jsx)("div",{className:"my-2",contentEditable:!1,children:(0,Hi.jsxs)("div",{className:"border border-slate-800 rounded-xl overflow-clip w-60 flex flex-col gap-2 bg-[#222222]",children:[(0,Hi.jsxs)("div",{className:"flex gap-2 border-b border-b-slate-100/10",children:[(0,Hi.jsx)("div",{className:"flex-1",children:e.data.value?(0,Hi.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,Hi.jsx)(wn.File,{})}),(0,Hi.jsx)(lr,{children:(0,Hi.jsxs)(dr,{children:[(0,Hi.jsxs)(cr,{className:"flex-1 flex justify-center items-center text-[#b5b5b5]",children:[(0,Hi.jsx)("span",{className:"font-medium text-sm",children:"Media"}),(0,Hi.jsx)("button",{onClick:d=>{d.preventDefault(),u()},className:"flex-1 flex justify-center items-center",children:(0,Hi.jsx)(Bt.X,{width:24,height:24,strokeWidth:1})})]}),(0,Hi.jsx)(Fo,{children:(0,Hi.jsx)("span",{children:"Remove image"})})]})})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-center gap-4 py-3 flex-1 text-xs font-bold",children:[(0,Hi.jsx)("span",{className:"",children:s?.toLocaleUpperCase()}),(0,Hi.jsx)("span",{children:p})]})]})})},Sn=rd;function id(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:uo({fields:{},relationTo:"media",value:a})}}return e.src.startsWith("file:///"),null}var Lo=class extends mr.UploadNode{static importDOM(){return{img:()=>({conversion:id,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new Ur.default().toHexString(),t.version=3);let a={id:t.id??new Ur.default().toHexString(),fields:t.fields,relationTo:"media",value:t.value},o=uo(a);return o.setFormat?.(t.format),o}decorate(){return(0,Hi.jsx)(Sn,{data:this.__data,nodeKey:this.getKey()})}};function uo(e){return new Lo({data:e})}var nd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",sd=e=>nd?(e||window).getSelection():null,Dp=(0,xe.createCommand)("INSERT_UPLOAD_WITH_DRAWER_COMMAND"),zr=(0,xe.createCommand)("INSERT_UPLOAD_COMMAND");function Mn({activeEditor:e,onClose:t,isOpen:a=!1}){let o=(0,Qt.useRef)(!1),[i,r]=(0,Qt.useState)(!0),[n,s]=(0,Qt.useState)(""),[c,p]=(0,Qt.useState)(""),[l,m]=(0,Qt.useState)(!1),[u,y]=(0,Qt.useState)("left"),b=n==="",h=C=>{m(C.target.checked)},d=C=>{y(C.target.value)},f=C=>{let X=new FileReader;X.onload=function(){return typeof X.result=="string"&&s(X.result),""},C!==null&&C[0]&&X.readAsDataURL(C[0])};(0,Qt.useEffect)(()=>{o.current=!1;let C=X=>{o.current=X.altKey};return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C)}},[e]),(0,Qt.useEffect)(()=>{i||t()},[i]),(0,Qt.useEffect)(()=>{r(a)},[a]);let k=({editor:C,relationTo:X,replaceNodeKey:I,value:z})=>{if(I)C.update(()=>{let D=(0,xe.$getNodeByKey)(I);D&&D.replace(uo({id:"",fields:{},relationTo:"media",value:z}))});else{let D=C.dispatchCommand(zr,{fields:null,relationTo:"media",value:z})}},w=()=>{k({editor:e,relationTo:"media",replaceNodeKey:null,value:{altText:c,src:n,showCaption:l,position:u}.src}),r(!1),t()};return(0,Hi.jsx)(Ve,{open:i,onOpenChange:C=>r(C),children:(0,Hi.jsxs)(Ze,{children:[(0,Hi.jsxs)(Xe,{children:[(0,Hi.jsx)(Ke,{children:"Upload Image"}),(0,Hi.jsx)(An.DialogDescription,{children:"Description"})]}),(0,Hi.jsxs)("div",{className:"",children:[(0,Hi.jsx)("div",{style:{marginBottom:"1em"},children:(0,Hi.jsx)(G,{type:"file",onChange:C=>f(C.target.files),accept:"image/*","data-test-id":"image-modal-file-upload"})}),(0,Hi.jsx)("div",{style:{marginBottom:"1em"},children:(0,Hi.jsx)(G,{"aria-label":"Alt Text",placeholder:"Descriptive alternative text",onChange:C=>p(C.currentTarget.value),value:c,"data-test-id":"image-modal-alt-text-input"})}),(0,Hi.jsx)(x,{"data-test-id":"image-modal-file-upload-btn",disabled:b,onClick:()=>w(),children:"Confirm"})]})]})})}function $r({captionsEnabled:e}){let[t]=(0,$n.useLexicalComposerContext)();return(0,Qt.useEffect)(()=>{if(!t.hasNodes([mr.UploadNode]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return(0,Ho.mergeRegister)(t.registerCommand(xe.DRAGSTART_COMMAND,a=>ld(a),xe.COMMAND_PRIORITY_HIGH),t.registerCommand(xe.DRAGOVER_COMMAND,a=>dd(a),xe.COMMAND_PRIORITY_LOW),t.registerCommand(xe.DROP_COMMAND,a=>cd(a,t),xe.COMMAND_PRIORITY_HIGH))},[e,t]),null}function ld(e){if(!_r())return!1;let a=e.dataTransfer;return a?(a.setData("text/plain","_"),!0):!1}function dd(e){return _r()?(En(e)||e.preventDefault(),!0):!1}function cd(e,t){let a=_r();if(!a)return!1;if(e.preventDefault(),En(e)){let o=md(e);a.remove();let i=(0,xe.$createRangeSelection)();o!=null&&i.applyDOMRange(o),(0,xe.$setSelection)(i)}return!0}function _r(){let e=(0,xe.$getSelection)();if(!(0,xe.$isNodeSelection)(e))return null;let a=e.getNodes()[0];return(0,mr.$isUploadNode)(a)?a:null}function En(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 md(e){let t,a=e.target,o=a==null?null:a.nodeType===9?a.defaultView:a.ownerDocument.defaultView,i=sd(o);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(e.clientX,e.clientY);else if(e.rangeParent&&i!==null)i.collapse(e.rangeParent,e.rangeOffset||0),t=i.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}var pd=()=>(0,Hi.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,Hi.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"})}),In=pd;var ud=()=>(0,Hi.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,Hi.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"})}),Fn=ud;var gd=()=>(0,Hi.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,Hi.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,Hi.jsx)("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),Ln=gd;var fd=()=>(0,Hi.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,Hi.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,Hi.jsx)("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),Bn=fd;var vd=()=>(0,Hi.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,Hi.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"})}),On=vd;var hd=()=>(0,Hi.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,Hi.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"})}),Hn=hd;var jn=()=>(0,Hi.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,Hi.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"})}),Vn=()=>(0,Hi.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,Hi.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"})}),Kn=()=>(0,Hi.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,Hi.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"})}),Un=()=>(0,Hi.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,Hi.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"})}),zn=()=>(0,Hi.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,Hi.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 Zr=1;function bd(){return(0,Hi.jsx)("span",{className:"border border-[#222222]"})}function Yr(){let[e]=(0,$n.useLexicalComposerContext)(),t=(0,Qt.useRef)(null),[a,o]=(0,Qt.useState)(!1),[i,r]=(0,Qt.useState)(!1),[n,s]=(0,Qt.useState)(!1),[c,p]=(0,Qt.useState)(!1),[l,m]=(0,Qt.useState)(!1),[u,y]=(0,Qt.useState)(!1),[b,h]=(0,Qt.useState)(!1),[d,f]=(0,Qt.useState)(!1),[k,w]=(0,Qt.useState)(!1),[C,X]=(0,Qt.useState)("left"),[I,z]=(0,Qt.useState)("p"),D=B=>{e.update(()=>{let le=(0,xe.$getSelection)();(0,xe.$isRangeSelection)(le)&&(B==="p"?(0,Xr.$setBlocksType)(le,()=>(0,xe.$createParagraphNode)()):(0,Xr.$setBlocksType)(le,()=>(0,Qn.$createHeadingNode)(B)))})},V=(0,Qt.useCallback)(()=>{let B=(0,xe.$getSelection)();if((0,xe.$isRangeSelection)(B)){s(B.hasFormat("bold")),p(B.hasFormat("italic")),m(B.hasFormat("underline")),y(B.hasFormat("strikethrough")),h(B.hasFormat("subscript")),f(B.hasFormat("superscript"));let le=B.anchor.getNode(),A=le;for(;A&&!(0,xe.$isParagraphNode)(A)&&A!==(0,xe.$getRoot)();){let M=A.getParent();M&&(A=M)}if(A){let M=A.getFormatType();X(M||"left")}let je=le.getTopLevelElement()?.__tag;z(je||"p")}},[]);(0,Qt.useEffect)(()=>(0,Ho.mergeRegister)(e.registerUpdateListener(({editorState:B})=>{B.read(()=>{V()})}),e.registerCommand(xe.SELECTION_CHANGE_COMMAND,(B,le)=>(V(),!1),Zr),e.registerCommand(xe.CAN_UNDO_COMMAND,B=>(o(B),!1),Zr),e.registerCommand(xe.CAN_REDO_COMMAND,B=>(r(B),!1),Zr),(0,Ho.mergeRegister)(e.registerCommand(zr,B=>(e.update(()=>{let le=(0,xe.$getSelection)()||(0,xe.$getPreviousSelection)();if((0,xe.$isRangeSelection)(le)){let A=uo({id:B.id,fields:B.fields,relationTo:B.relationTo,value:B.value}),{focus:je}=le,M=je.getNode();(0,Ho.$insertNodeToNearestRoot)(A),(0,xe.$isParagraphNode)(M)&&!M.__first&&M.remove()}}),!0),xe.COMMAND_PRIORITY_EDITOR))),[e,V]);let W=[[{label:"Undo",icon:(0,Hi.jsx)(Bt.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(xe.UNDO_COMMAND,void 0)},disabled:!a},{label:"Redo",icon:(0,Hi.jsx)(Bt.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(xe.UNDO_COMMAND,void 0)},disabled:!i}],[{label:"Bold",icon:(0,Hi.jsx)(In,{}),onClick:()=>{e.dispatchCommand(xe.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:n},{label:"Italic",icon:(0,Hi.jsx)(Fn,{}),onClick:()=>{e.dispatchCommand(xe.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:c},{label:"Underline",icon:(0,Hi.jsx)(Ln,{}),onClick:()=>{e.dispatchCommand(xe.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:l},{label:"Strikethrough",icon:(0,Hi.jsx)(Bn,{}),onClick:()=>{e.dispatchCommand(xe.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:u},{label:"Subscript",icon:(0,Hi.jsx)(On,{}),onClick:()=>{e.dispatchCommand(xe.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:b},{label:"Superscript",icon:(0,Hi.jsx)(Hn,{}),onClick:()=>{e.dispatchCommand(xe.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:d}]],q=[{label:"Left Align",direction:"left",icon:(0,Hi.jsx)(Bt.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(xe.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,Hi.jsx)(Bt.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(xe.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,Hi.jsx)(Bt.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(xe.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,Hi.jsx)(Bt.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(xe.FORMAT_ELEMENT_COMMAND,"justify")}}],Ce=[{label:"Normal Text",value:"p",icon:(0,Hi.jsx)(jn,{}),onClick:()=>D("p")},{label:"Heading 1",value:"h1",icon:(0,Hi.jsx)(Vn,{}),onClick:()=>D("h1")},{label:"Heading 2",value:"h2",icon:(0,Hi.jsx)(Kn,{}),onClick:()=>D("h2")},{label:"Heading 3",value:"h3",icon:(0,Hi.jsx)(Un,{}),onClick:()=>D("h3")},{label:"Heading 4",value:"h4",icon:(0,Hi.jsx)(zn,{}),onClick:()=>D("h4")},...[{label:"Unordered List",value:"ul",icon:(0,Hi.jsx)(Bt.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ur.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,Hi.jsx)(Bt.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ur.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],ke=[{label:"Insert Image",icon:(0,Hi.jsx)(Bt.ImageUp,{width:15,height:15}),onClick:()=>{w(!0)},disabled:!1}];return(0,Hi.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2 sticky top-0 bg-black z-50",children:(0,Hi.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[W.map((B,le)=>(0,Hi.jsxs)(Qt.Fragment,{children:[(0,Hi.jsx)("div",{className:"flex items-center gap-2",children:B.map((A,je)=>(0,Hi.jsx)("div",{role:"button","aria-disabled":A.disabled||!1,onClick:A.onClick,className:T("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]",A.active&&"bg-[#3c3c3c]"),"aria-label":A.label,children:(0,Hi.jsx)(lr,{children:(0,Hi.jsxs)(dr,{children:[(0,Hi.jsx)(cr,{className:"text-[#b5b5b5]",children:A.icon}),(0,Hi.jsx)(Fo,{children:(0,Hi.jsx)("p",{children:A.label})})]})})},je))}),(0,Hi.jsx)(bd,{})]},`toolbar-option-${B.length}-${le}`)),(0,Hi.jsxs)(Zt,{children:[(0,Hi.jsxs)(Xt,{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:[q.find(B=>B.direction===C)?.icon,q.find(B=>B.direction===C)?.label,(0,Hi.jsx)(Bt.ChevronDown,{width:15,height:15})]}),(0,Hi.jsx)(Kt,{className:"bg-black hover:bg-black",children:q.map((B,le)=>(0,Hi.jsxs)(Rt,{onClick:B.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,Hi.jsx)("span",{children:B.icon}),(0,Hi.jsx)("span",{children:B.label})]},`${B.label}-${le}`))})]}),(0,Hi.jsxs)(Zt,{children:[(0,Hi.jsxs)(Xt,{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:[Ce.find(B=>B.value===I)?.icon,Ce.find(B=>B.value===I)?.label,(0,Hi.jsx)(Bt.ChevronDown,{width:15,height:15})]}),(0,Hi.jsx)(Kt,{className:"bg-black hover:bg-black",children:Ce.map((B,le)=>(0,Hi.jsxs)(Rt,{onClick:B.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,Hi.jsx)("span",{children:B.icon}),(0,Hi.jsx)("span",{children:B.label})]},`heading-option-${B.label}-${le}`))})]}),(0,Hi.jsxs)(Zt,{children:[(0,Hi.jsxs)(Xt,{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,Hi.jsx)(Bt.Plus,{width:15,height:15}),(0,Hi.jsx)(Bt.ChevronDown,{width:15,height:15})]}),(0,Hi.jsx)(Kt,{className:"bg-black hover:bg-black",children:ke.map((B,le)=>(0,Hi.jsxs)(Rt,{onClick:B.onClick,disabled:B.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,Hi.jsx)("span",{children:B.icon}),(0,Hi.jsx)("span",{children:B.label})]},le))})]}),k&&(0,Hi.jsx)(Mn,{activeEditor:e,onClose:()=>{w(!1)},isOpen:k})]})})}var xd=({setValue:e,value:t,name:a,editable:o=!0})=>{let[i]=(0,$n.useLexicalComposerContext)(),r=(0,Qt.useRef)(null),n=s=>{s.read(()=>{let c=s.toJSON();JSON.stringify(c)!==JSON.stringify(r.current)&&(r.current=c,e?.(()=>c))})};return(0,Qt.useEffect)(()=>{i.setEditable(o)},[o,i]),(0,Qt.useEffect)(()=>{t&&JSON.stringify(t)!==JSON.stringify(r.current)&&i.update(()=>{try{let s=i.parseEditorState(t);i.setEditorState(s),r.current=t}catch(s){console.error("Error parsing editor state:",s)}},{discrete:!0})},[t,i]),(0,Hi.jsx)("div",{className:"w-full",children:(0,Hi.jsxs)("div",{className:" ",children:[o&&(0,Hi.jsx)(Yr,{}),(0,Hi.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,Hi.jsx)(Xn.RichTextPlugin,{contentEditable:(0,Hi.jsx)(qn.ContentEditable,{name:a,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-h-40"}),ErrorBoundary:Jn.LexicalErrorBoundary}),o&&(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsx)(Zn.HistoryPlugin,{}),(0,Hi.jsx)(Gn.AutoFocusPlugin,{}),(0,Hi.jsx)(Yn.ListPlugin,{}),(0,Hi.jsx)(es.OnChangePlugin,{onChange:n}),(0,Hi.jsx)($r,{})]})]})]})})},yd=({setValue:e,value:t,name:a,editable:o=!0})=>(0,Hi.jsx)(Wn.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[ur.ListNode,ur.ListItemNode,Qn.HeadingNode,Lo],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,Hi.jsx)(xd,{value:t,setValue:e,name:a,editable:o})}),go=yd;var as=Se(require("react")),Qr=Se(require("@radix-ui/react-toggle"));var ei=(0,Bi.cva)("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),wd=as.forwardRef(({className:e,variant:t,size:a,...o},i)=>(0,Hi.jsx)(Qr.Root,{ref:i,className:T(ei({variant:t,size:a,className:e})),...o}));wd.displayName=Qr.Root.displayName;var Ga=Se(require("react")),fo=Se(require("@radix-ui/react-toggle-group"));var is=Ga.createContext({size:"default",variant:"default"}),Wa=Ga.forwardRef(({className:e,variant:t,size:a,children:o,...i},r)=>(0,Hi.jsx)(fo.Root,{ref:r,className:T("flex items-center justify-center gap-1",e),...i,children:(0,Hi.jsx)(is.Provider,{value:{variant:t,size:a},children:o})}));Wa.displayName=fo.Root.displayName;var qa=Ga.forwardRef(({className:e,children:t,variant:a,size:o,...i},r)=>{let n=Ga.useContext(is);return(0,Hi.jsx)(fo.Item,{ref:r,className:T(ei({variant:n.variant||a,size:n.size||o}),e),...i,children:t})});qa.displayName=fo.Item.displayName;var ns=Se(require("react")),ia=Se(require("@radix-ui/react-popover"));var ai=ia.Root,oi=ia.Trigger;var fr=ns.forwardRef(({className:e,align:t="center",sideOffset:a=4,...o},i)=>(0,Hi.jsx)(ia.Portal,{children:(0,Hi.jsx)(ia.Content,{ref:i,align:t,sideOffset:a,className:T("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));fr.displayName=ia.Content.displayName;var Vo=Se(require("@radix-ui/react-checkbox")),ls=Se(require("react")),Ko=ls.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Vo.Root,{className:T("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,Hi.jsx)(Vo.Indicator,{className:T("flex items-center justify-center text-current"),children:(0,Hi.jsx)(Bt.Check,{className:"h-4 w-4"})})}));Ko.displayName=Vo.Root.displayName;var ds=require("react-day-picker");function hr({className:e,classNames:t,showOutsideDays:a=!0,...o}){return(0,Hi.jsx)(ds.DayPicker,{showOutsideDays:a,weekStartsOn:1,className:T("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center Qt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:T(ko({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:T("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",o.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:T(ko({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},...o})}hr.displayName="Calendar";var Uo=e=>"mimeType"in e&&"url"in e&&!("format"in e),Nd=e=>{if(!e?.root?.children)return"";let t=[],a=r=>{if(!r)return"";switch(r.type){case"heading":{let n=r.tag?parseInt(r.tag.replace("h","")):1,s=o(r.children||[]);return"#".repeat(n)+" "+s}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 n=[],s=r.listType==="number"?"1.":"-";return r.children?.forEach((c,p)=>{if(c.type==="listitem"){let l=o(c.children||[]),m=r.listType==="number"?`${p+1}.`:s;n.push(`${m} ${l}`)}}),n.join(`
|
|
6
|
-
`)}case"listitem":return o(r.children||[]);case"text":{let n=r.text||"";if(r.format){let s=(r.format&1)!==0,
|
|
5
|
+
"use strict";var vl=Object.create;var Xo=Object.defineProperty;var hl=Object.getOwnPropertyDescriptor;var bl=Object.getOwnPropertyNames;var xl=Object.getPrototypeOf,yl=Object.prototype.hasOwnProperty;var wl=(e,t)=>{for(var a in t)Xo(e,a,{get:t[a],enumerable:!0})},Ti=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of bl(t))!yl.call(e,i)&&i!==a&&Xo(e,i,{get:()=>t[i],enumerable:!(o=hl(t,i))||o.enumerable});return e};var Te=(e,t,a)=>(a=e!=null?vl(xl(e)):{},Ti(t||!e||!e.__esModule?Xo(a,"default",{value:e,enumerable:!0}):a,e)),Nl=e=>Ti(Xo({},"__esModule",{value:!0}),e);var jd={};wl(jd,{ColleaguesView:()=>jr,FileView:()=>zo,KnowledgeView:()=>li,PlanningView:()=>Dr,ProjectView:()=>gi,ProjectsIndexView:()=>xi,TeamsIndexView:()=>wi});module.exports=Nl(jd);var ta=require("react"),Ht=require("lucide-react");var Fi=require("clsx");var Er="-",Cl=e=>{let t=Sl(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:n=>{let s=n.split(Er);return s[0]===""&&s.length!==1&&s.shift(),Ri(s,t)||Dl(n)},getConflictingClassGroupIds:(n,s)=>{let m=a[n]||[];return s&&o[n]?[...m,...o[n]]:m}}},Ri=(e,t)=>{if(e.length===0)return t.classGroupId;let a=e[0],o=t.nextPart.get(a),i=o?Ri(e.slice(1),o):void 0;if(i)return i;if(t.validators.length===0)return;let r=e.join(Er);return t.validators.find(({validator:n})=>n(r))?.classGroupId},ki=/^\[(.+)\]$/,Dl=e=>{if(ki.test(e)){let t=ki.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},Sl=e=>{let{theme:t,prefix:a}=e,o={nextPart:new Map,validators:[]};return kl(Object.entries(e.classGroups),a).forEach(([r,n])=>{Mr(n,o,r,t)}),o},Mr=(e,t,a,o)=>{e.forEach(i=>{if(typeof i=="string"){let r=i===""?t:Pi(t,i);r.classGroupId=a;return}if(typeof i=="function"){if(Tl(i)){Mr(i(o),t,a,o);return}t.validators.push({validator:i,classGroupId:a});return}Object.entries(i).forEach(([r,n])=>{Mr(n,Pi(t,r),a,o)})})},Pi=(e,t)=>{let a=e;return t.split(Er).forEach(o=>{a.nextPart.has(o)||a.nextPart.set(o,{nextPart:new Map,validators:[]}),a=a.nextPart.get(o)}),a},Tl=e=>e.isThemeGetter,kl=(e,t)=>t?e.map(([a,o])=>{let i=o.map(r=>typeof r=="string"?t+r:typeof r=="object"?Object.fromEntries(Object.entries(r).map(([n,s])=>[t+n,s])):r);return[a,i]}):e,Pl=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=new Map,o=new Map,i=(r,n)=>{a.set(r,n),t++,t>e&&(t=0,o=a,a=new Map)};return{get(r){let n=a.get(r);if(n!==void 0)return n;if((n=o.get(r))!==void 0)return i(r,n),n},set(r,n){a.has(r)?a.set(r,n):i(r,n)}}},Ai="!",Rl=e=>{let{separator:t,experimentalParseClassName:a}=e,o=t.length===1,i=t[0],r=t.length,n=s=>{let m=[],p=0,c=0,l;for(let d=0;d<s.length;d++){let v=s[d];if(p===0){if(v===i&&(o||s.slice(d,d+r)===t)){m.push(s.slice(c,d)),c=d+r;continue}if(v==="/"){l=d;continue}}v==="["?p++:v==="]"&&p--}let u=m.length===0?s:s.substring(c),C=u.startsWith(Ai),b=C?u.substring(1):u,N=l&&l>c?l-c:void 0;return{modifiers:m,hasImportantModifier:C,baseClassName:b,maybePostfixModifierPosition:N}};return a?s=>a({className:s,parseClassName:n}):n},Al=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},Ml=e=>({cache:Pl(e.cacheSize),parseClassName:Rl(e),...Cl(e)}),El=/\s+/,Il=(e,t)=>{let{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:i}=t,r=[],n=e.trim().split(El),s="";for(let m=n.length-1;m>=0;m-=1){let p=n[m],{modifiers:c,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:C}=a(p),b=!!C,N=o(b?u.substring(0,C):u);if(!N){if(!b){s=p+(s.length>0?" "+s:s);continue}if(N=o(u),!N){s=p+(s.length>0?" "+s:s);continue}b=!1}let d=Al(c).join(":"),v=l?d+Ai:d,R=v+N;if(r.includes(R))continue;r.push(R);let x=i(N,b);for(let D=0;D<x.length;++D){let J=x[D];r.push(v+J)}s=p+(s.length>0?" "+s:s)}return s};function Fl(){let e=0,t,a,o="";for(;e<arguments.length;)(t=arguments[e++])&&(a=Mi(t))&&(o&&(o+=" "),o+=a);return o}var Mi=e=>{if(typeof e=="string")return e;let t,a="";for(let o=0;o<e.length;o++)e[o]&&(t=Mi(e[o]))&&(a&&(a+=" "),a+=t);return a};function Ll(e,...t){let a,o,i,r=n;function n(m){let p=t.reduce((c,l)=>l(c),e());return a=Ml(p),o=a.cache.get,i=a.cache.set,r=s,s(m)}function s(m){let p=o(m);if(p)return p;let c=Il(m,a);return i(m,c),c}return function(){return r(Fl.apply(null,arguments))}}var Ze=e=>{let t=a=>a[e]||[];return t.isThemeGetter=!0,t},Ei=/^\[(?:([a-z-]+):)?(.+)\]$/i,Bl=/^\d+\/\d+$/,Ol=new Set(["px","full","screen"]),Hl=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,jl=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|Hi|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|Hi|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Vl=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Ul=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)Hi-?((\d+)?\.?(\d+)[a-z]+|0)/,Kl=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fa=e=>oo(e)||Ol.has(e)||Bl.test(e),ka=e=>ro(e,"length",Zl),oo=e=>!!e&&!Number.isNaN(Number(e)),Ar=e=>ro(e,"number",oo),So=e=>!!e&&Number.isInteger(Number(e)),$l=e=>e.endsWith("%")&&oo(e.slice(0,-1)),ye=e=>Ei.test(e),Pa=e=>Hl.test(e),zl=new Set(["length","size","percentage"]),_l=e=>ro(e,zl,Ii),Gl=e=>ro(e,"position",Ii),Wl=new Set(["image","url"]),ql=e=>ro(e,Wl,Yl),Jl=e=>ro(e,"",Xl),To=()=>!0,ro=(e,t,a)=>{let o=Ei.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):a(o[2]):!1},Zl=e=>jl.test(e)&&!Vl.test(e),Ii=()=>!1,Xl=e=>Ul.test(e),Yl=e=>Kl.test(e);var Ql=()=>{let e=Ze("colors"),t=Ze("spacing"),a=Ze("blur"),o=Ze("brightness"),i=Ze("borderColor"),r=Ze("borderRadius"),n=Ze("borderSpacing"),s=Ze("borderWidth"),m=Ze("contrast"),p=Ze("grayscale"),c=Ze("hueRotate"),l=Ze("invert"),u=Ze("gap"),C=Ze("gradientColorStops"),b=Ze("gradientColorStopPositions"),N=Ze("inset"),d=Ze("margin"),v=Ze("opacity"),R=Ze("padding"),x=Ze("saturate"),D=Ze("scale"),J=Ze("sepia"),I=Ze("skew"),K=Ze("space"),B=Ze("translate"),G=()=>["auto","contain","none"],de=()=>["auto","hidden","clip","visible","scroll"],Ne=()=>["auto",ye,t],F=()=>[ye,t],ie=()=>["",fa,ka],Oe=()=>["auto",oo,ye],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ue=()=>["solid","dashed","dotted","double","none"],g=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>["start","end","center","between","around","evenly","stretch"],S=()=>["","0",ye],P=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>[oo,ye];return{cacheSize:500,separator:":",theme:{colors:[To],spacing:[fa,ka],blur:["none","",Pa,ye],brightness:w(),borderColor:[e],borderRadius:["none","","full",Pa,ye],borderSpacing:F(),borderWidth:ie(),contrast:w(),grayscale:S(),hueRotate:w(),invert:S(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[$l,ka],inset:Ne(),margin:Ne(),opacity:w(),padding:F(),saturate:w(),scale:w(),sepia:S(),skew:w(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",ye]}],container:["container"],columns:[{columns:[Pa]}],"break-after":[{"break-after":P()}],"break-before":[{"break-before":P()}],"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:[...L(),ye]}],overflow:[{overflow:de()}],"overflow-x":[{"overflow-x":de()}],"overflow-y":[{"overflow-y":de()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",So,ye]}],basis:[{basis:Ne()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ye]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",So,ye]}],"grid-cols":[{"grid-cols":[To]}],"col-start-end":[{col:["auto",{span:["full",So,ye]},ye]}],"col-start":[{"col-start":Oe()}],"col-end":[{"col-end":Oe()}],"grid-rows":[{"grid-rows":[To]}],"row-start-end":[{row:["auto",{span:[So,ye]},ye]}],"row-start":[{"row-start":Oe()}],"row-end":[{"row-end":Oe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ye]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ye]}],gap:[{gap:[u]}],"gap-x":[{"gap-x":[u]}],"gap-y":[{"gap-y":[u]}],"justify-content":[{justify:["normal",...X()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...X(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...X(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[R]}],px:[{px:[R]}],py:[{py:[R]}],ps:[{ps:[R]}],Hi:[{Hi:[R]}],Hi:[{Hi:[R]}],pr:[{pr:[R]}],pb:[{pb:[R]}],pl:[{pl:[R]}],m:[{m:[d]}],mx:[{mx:[d]}],my:[{my:[d]}],Ir:[{Ir:[d]}],me:[{me:[d]}],mt:[{mt:[d]}],mr:[{mr:[d]}],mb:[{mb:[d]}],ml:[{ml:[d]}],"space-x":[{"space-x":[K]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[K]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ye,t]}],"min-w":[{"min-w":[ye,t,"min","max","fit"]}],"max-w":[{"max-w":[ye,t,"none","full","min","max","fit","prose",{screen:[Pa]},Pa]}],Hi:[{Hi:[ye,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-Hi":[{"min-Hi":[ye,t,"min","max","fit","svh","lvh","dvh"]}],"max-Hi":[{"max-Hi":[ye,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ye,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Pa,ka]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ar]}],"font-family":[{font:[To]}],"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",ye]}],"line-clamp":[{"line-clamp":["none",oo,Ar]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",fa,ye]}],"list-image":[{"list-image":["none",ye]}],"list-style-type":[{list:["none","disc","decimal",ye]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","ta-underline"],"text-decoration-style":[{decoration:[...ue(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",fa,ka]}],"underline-offset":[{"underline-offset":["auto",fa,ye]}],"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:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye]}],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",ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L(),Gl]}],"bg-repeat":[{bg:["ta-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",_l]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","ta","b","bl","l","tl"]},ql]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[C]}],"gradient-via":[{via:[C]}],"gradient-to":[{to:[C]}],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-Ht":[{"rounded-Ht":[r]}],"rounded-se":[{"rounded-se":[r]}],"rounded-Hi":[{"rounded-Hi":[r]}],"rounded-es":[{"rounded-es":[r]}],"rounded-tl":[{"rounded-tl":[r]}],"rounded-tr":[{"rounded-tr":[r]}],"rounded-ta":[{"rounded-ta":[r]}],"rounded-bl":[{"rounded-bl":[r]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...ue(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:ue()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...ue()]}],"outline-offset":[{"outline-offset":[fa,ye]}],"outline-w":[{outline:[fa,ka]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[fa,ka]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Pa,Jl]}],"shadow-color":[{shadow:[To]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...g(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":g()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[o]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",Pa,ye]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[l]}],saturate:[{saturate:[x]}],sepia:[{sepia:[J]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[m]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[l]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[J]}],"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",ye]}],duration:[{duration:w()}],ease:[{ease:["linear","in","out","in-out",ye]}],delay:[{delay:w()}],animate:[{animate:["none","spin","ping","pulse","bounce",ye]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[D]}],"scale-x":[{"scale-x":[D]}],"scale-y":[{"scale-y":[D]}],rotate:[{rotate:[So,ye]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[I]}],"skew-y":[{"skew-y":[I]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ye]}],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","ta-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ye]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-Ir":[{"scroll-Ir":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-Hi":[{"scroll-Hi":F()}],"scroll-Hi":[{"scroll-Hi":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"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",ye]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[fa,ka,Ar]}],stroke:[{stroke:[e,"none"]}],Ir:["Ir-only","not-Ir-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","Hi","Hi","pr","pb","pl"],px:["pr","pl"],py:["Hi","pb"],m:["mx","my","Ir","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","Hi"],"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-Ht","rounded-se","rounded-Hi","rounded-es","rounded-tl","rounded-tr","rounded-ta","rounded-bl"],"rounded-s":["rounded-Ht","rounded-es"],"rounded-e":["rounded-se","rounded-Hi"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-ta"],"rounded-b":["rounded-ta","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-Ir","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-Hi","scroll-Hi","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-Hi","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var Yo=Ll(Ql);function k(...e){return Yo((0,Fi.clsx)(e))}var Li=require("@radix-ui/react-slot"),Bi=require("class-variance-authority"),Oi=Te(require("react")),Hi=require("react/jsx-runtime"),ko=(0,Bi.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:"Hi-10 px-4 py-2",icon:"Hi-10 w-10",lg:"Hi-11 rounded px-8",sm:"Hi-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=Oi.forwardRef(({asChild:e=!1,className:t,size:a,variant:o,...i},r)=>(0,Hi.jsx)(e?Li.Slot:"button",{className:k(ko({className:t,size:a,variant:o})),ref:r,...i}));y.displayName="Button";var Ua=Te(require("react"));var Q=Ua.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("div",{ref:a,className:k("rounded-xl border bg-card text-card-foreground shadow",e),...t}));Q.displayName="Card";var it=Ua.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("div",{ref:a,className:k("flex flex-col space-y-1.5 p-6",e),...t}));it.displayName="CardHeader";var dt=Ua.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("div",{ref:a,className:k("font-semibold leading-none tracking-tight",e),...t}));dt.displayName="CardTitle";var Po=Ua.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("div",{ref:a,className:k("text-sm text-muted-foreground",e),...t}));Po.displayName="CardDescription";var ke=Ua.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("div",{ref:a,className:k("p-6 Hi-0",e),...t}));ke.displayName="CardContent";var Ro=Ua.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("div",{ref:a,className:k("flex items-center p-6 Hi-0",e),...t}));Ro.displayName="CardFooter";var ji=Te(require("react"));var q=ji.forwardRef(({className:e,type:t,...a},o)=>(0,Hi.jsx)("input",{type:t,className:k("flex Hi-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}));q.displayName="Input";var Re=Te(require("@radix-ui/react-select")),Ra=Te(require("react")),$e=Re.Root;var Qe=Re.Value,Ve=Ra.forwardRef(({children:e,className:t,...a},o)=>(0,Hi.jsxs)(Re.Trigger,{className:k("flex Hi-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,Hi.jsx)(Re.Icon,{asChild:!0,children:(0,Hi.jsx)($a.ChevronDown,{className:"Hi-4 w-4 opacity-50"})})]}));Ve.displayName=Re.Trigger.displayName;var Ui=Ra.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Re.ScrollUpButton,{className:k("flex cursor-default items-center justify-center py-1",e),ref:a,...t,children:(0,Hi.jsx)($a.ChevronUp,{className:"Hi-4 w-4"})}));Ui.displayName=Re.ScrollUpButton.displayName;var Ki=Ra.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Re.ScrollDownButton,{className:k("flex cursor-default items-center justify-center py-1",e),ref:a,...t,children:(0,Hi.jsx)($a.ChevronDown,{className:"Hi-4 w-4"})}));Ki.displayName=Re.ScrollDownButton.displayName;var Ue=Ra.forwardRef(({children:e,className:t,position:a="popper",...o},i)=>(0,Hi.jsx)(Re.Portal,{children:(0,Hi.jsxs)(Re.Content,{className:k("relative z-50 max-Hi-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:i,...o,children:[(0,Hi.jsx)(Ui,{}),(0,Hi.jsx)(Re.Viewport,{className:k("p-1",a==="popper"&&"Hi-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),(0,Hi.jsx)(Ki,{})]})}));Ue.displayName=Re.Content.displayName;var ed=Ra.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Re.Label,{className:k("py-1.5 pl-8 pr-2 text-sm font-semibold",e),ref:a,...t}));ed.displayName=Re.Label.displayName;var me=Ra.forwardRef(({children:e,className:t,...a},o)=>(0,Hi.jsxs)(Re.Item,{className:k("relative flex w-full cursor-default select-none items-center rounded py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),ref:o,...a,children:[(0,Hi.jsx)("span",{className:"absolute left-2 flex Hi-3.5 w-3.5 items-center justify-center",children:(0,Hi.jsx)(Re.ItemIndicator,{children:(0,Hi.jsx)($a.Check,{className:"Hi-4 w-4"})})}),(0,Hi.jsx)(Re.ItemText,{children:e})]}));me.displayName=Re.Item.displayName;var td=Ra.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Re.Separator,{className:k("-mx-1 my-1 Hi-px bg-muted",e),ref:a,...t}));td.displayName=Re.Separator.displayName;var Ir=require("motion/react");var za=Te(require("@radix-ui/react-tabs"));function $i({className:e,...t}){return(0,Hi.jsx)(za.Root,{"data-slot":"tabs",className:k("flex flex-col gap-2",e),...t})}function zi({className:e,...t}){return(0,Hi.jsx)(za.List,{"data-slot":"tabs-list",className:k("bg-muted text-muted-foreground inline-flex Hi-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function _i({className:e,...t}){return(0,Hi.jsx)(za.Trigger,{"data-slot":"tabs-trigger",className:k("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 Hi-[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 va=Te(require("react")),Ae=Te(require("@radix-ui/react-dropdown-menu")),io=require("@radix-ui/react-icons");var Yt=Ae.Root,Qt=Ae.Trigger;var Gi=va.forwardRef(({className:e,inset:t,children:a,...o},i)=>(0,Hi.jsxs)(Ae.SubTrigger,{ref:i,className:k("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,Hi.jsx)(io.ChevronRightIcon,{className:"ml-auto"})]}));Gi.displayName=Ae.SubTrigger.displayName;var Wi=va.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Ae.SubContent,{ref:a,className:k("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}));Wi.displayName=Ae.SubContent.displayName;var Kt=va.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,Hi.jsx)(Ae.Portal,{children:(0,Hi.jsx)(Ae.Content,{ref:o,sideOffset:t,className:k("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})}));Kt.displayName=Ae.Content.displayName;var Rt=va.forwardRef(({className:e,inset:t,...a},o)=>(0,Hi.jsx)(Ae.Item,{ref:o,className:k("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}));Rt.displayName=Ae.Item.displayName;var qi=va.forwardRef(({className:e,children:t,checked:a,...o},i)=>(0,Hi.jsxs)(Ae.CheckboxItem,{ref:i,className:k("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:a,...o,children:[(0,Hi.jsx)("span",{className:"absolute left-2 flex Hi-3.5 w-3.5 items-center justify-center",children:(0,Hi.jsx)(Ae.ItemIndicator,{children:(0,Hi.jsx)(io.CheckIcon,{className:"Hi-4 w-4"})})}),t]}));qi.displayName=Ae.CheckboxItem.displayName;var Ji=va.forwardRef(({className:e,children:t,...a},o)=>(0,Hi.jsxs)(Ae.RadioItem,{ref:o,className:k("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[(0,Hi.jsx)("span",{className:"absolute left-2 flex Hi-3.5 w-3.5 items-center justify-center",children:(0,Hi.jsx)(Ae.ItemIndicator,{children:(0,Hi.jsx)(io.DotFilledIcon,{className:"Hi-4 w-4 fill-current"})})}),t]}));Ji.displayName=Ae.RadioItem.displayName;var Zi=va.forwardRef(({className:e,inset:t,...a},o)=>(0,Hi.jsx)(Ae.Label,{ref:o,className:k("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...a}));Zi.displayName=Ae.Label.displayName;var Xi=va.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Ae.Separator,{ref:a,className:k("-mx-1 my-1 Hi-px bg-muted",e),...t}));Xi.displayName=Ae.Separator.displayName;var Yi=({className:e,...t})=>(0,Hi.jsx)("span",{className:k("ml-auto text-xs tracking-widest opacity-60",e),...t});Yi.displayName="DropdownMenuShortcut";function er({activeTab:e,onTabChange:t,tabOptions:a,className:o="",maxWidth:i="700px",gridCols:r=6}){let n=a.find(s=>s.value===e);return(0,Hi.jsxs)(Ir.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,Hi.jsx)("div",{className:"hidden lg:block",children:(0,Hi.jsx)($i,{value:e,onValueChange:t,children:(0,Hi.jsx)(zi,{className:"grid w-full rounded-2xl p-0 Hi-10",style:{maxWidth:i,gridTemplateColumns:`repeat(${Math.min(r,a.length)}, minmax(0, 1fr))`},children:a.map(s=>(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.1},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:17},className:"flex-1 px-2",children:(0,Hi.jsx)(_i,{value:s.value,onClick:()=>t?.(s.value),className:"w-full Hi-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:s.label})},s.value))})})}),(0,Hi.jsx)("div",{className:"lg:hidden",children:(0,Hi.jsxs)(Yt,{children:[(0,Hi.jsx)(Qt,{asChild:!0,children:(0,Hi.jsxs)(y,{variant:"outline",className:"rounded-2xl min-w-[140px] justify-between",children:[n?.label||"Select",(0,Hi.jsx)(Ht.ChevronDown,{className:"Hi-4 w-4 ml-2"})]})}),(0,Hi.jsx)(Kt,{align:"center",className:"w-[180px]",children:a.map(s=>(0,Hi.jsx)(Rt,{onClick:()=>t?.(s.value),className:`cursor-pointer ${e===s.value?"bg-accent":""}`,children:s.label},s.value))})]})})]})}var tr=Te(require("react")),ha=Te(require("@radix-ui/react-avatar"));var ba=tr.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(ha.Root,{ref:a,className:k("relative flex Hi-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));ba.displayName=ha.Root.displayName;var Fr=tr.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(ha.Image,{ref:a,className:k("aspect-square Hi-full w-full",e),...t}));Fr.displayName=ha.Image.displayName;var xa=tr.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(ha.Fallback,{ref:a,className:k("flex Hi-full w-full items-center justify-center rounded-full bg-muted",e),...t}));xa.displayName=ha.Fallback.displayName;var ad=(0,Bi.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 Pe({className:e,variant:t,...a}){return(0,Hi.jsx)("div",{className:k(ad({variant:t}),e),...a})}function or({colleague:e,onEdit:t,onDelete:a,onViewDetails:o,showActions:i=!0,compact:r=!1,className:n}){let[s,m]=(0,ta.useState)(!1),p=u=>{switch(u){case"active":return"bg-green-500";case"inactive":return"bg-gray-500";default:return"bg-gray-500"}},c=u=>{switch(u){case"active":return"Active";case"inactive":return"Inactive";default:return"Unknown"}},l=u=>{if(!u)return"Never";let b=Math.floor((new Date().getTime()-u.getTime())/(1e3*60));return b<1?"Just now":b<60?`${b}m ago`:b<1440?`${Math.floor(b/60)}Hi ago`:`${Math.floor(b/1440)}d ago`};return(0,Hi.jsxs)(Q,{className:k("hover:shadow-md transition-shadow",r&&"p-2",n),children:[(0,Hi.jsx)(it,{className:k("pb-3",r&&"pb-2"),children:(0,Hi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Hi.jsx)("div",{className:"relative",children:(0,Hi.jsxs)(ba,{className:k("Hi-12 w-12",r&&"Hi-8 w-8"),children:[(0,Hi.jsx)(Fr,{src:"/placeholder.svg",alt:e.name||"name"}),(0,Hi.jsx)(xa,{children:e.name?.split(" ").map(u=>u[0]).join("")})]})}),(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("h3",{className:k("font-semibold text-sm truncate",r&&"text-xs"),children:e.name}),e.type==="digital"?(0,Hi.jsx)(Ht.Bot,{className:k("Hi-4 w-4 text-blue-500",r&&"Hi-3 w-3")}):(0,Hi.jsx)(Ht.User,{className:k("Hi-4 w-4 text-green-500",r&&"Hi-3 w-3")})]}),(0,Hi.jsx)("p",{className:k("text-sm text-muted-foreground truncate",r&&"text-xs")}),!r&&(0,Hi.jsx)("div",{className:"flex items-center gap-2 mt-1"})]})]}),i&&(0,Hi.jsxs)(Yt,{children:[(0,Hi.jsx)(Qt,{asChild:!0,children:(0,Hi.jsx)(y,{variant:"ghost",size:"icon",className:k("Hi-8 w-8",r&&"Hi-6 w-6"),children:(0,Hi.jsx)(Ht.MoreHorizontal,{className:k("Hi-4 w-4",r&&"Hi-3 w-3")})})}),(0,Hi.jsxs)(Kt,{align:"end",children:[e.type==="digital"&&(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsxs)(Rt,{onClick:()=>o?.(e),children:[(0,Hi.jsx)(Ht.Settings,{className:"Hi-4 w-4 mr-2"}),"View Details"]}),(0,Hi.jsxs)(Rt,{onClick:()=>t?.(e),children:[(0,Hi.jsx)(Ht.Edit,{className:"Hi-4 w-4 mr-2"}),"Edit"]})]}),(0,Hi.jsxs)(Rt,{onClick:()=>a?.(e.id.toString()),className:"text-destructive focus:text-destructive",children:[(0,Hi.jsx)(Ht.Trash2,{className:"Hi-4 w-4 mr-2"}),e.type==="digital"?"Delete":"Remove from team"]})]})]})]})}),!r&&(0,Hi.jsxs)(ke,{className:"Hi-0",children:[(0,Hi.jsxs)("div",{className:"space-y-2 text-sm",children:[e.type==="human"&&(0,Hi.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,Hi.jsx)(Ht.Mail,{className:"Hi-3 w-3"}),(0,Hi.jsx)("span",{className:"truncate",children:e.email})]}),e.type==="digital"&&(0,Hi.jsx)("div",{className:"flex items-center gap-2 text-muted-foreground",children:(0,Hi.jsx)("span",{children:e.description})})]}),e.type==="digital"&&(0,Hi.jsx)("div",{className:"mt-3",children:(0,Hi.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.capabilities?.slice(0,s?e.capabilities.length:2).map(u=>(0,Hi.jsx)(Pe,{variant:"outline",className:"text-xs",children:typeof u?.value=="number"?u?.value||"":u?.value?.name||""},typeof u?.value=="number"?u?.value||"":u?.value?.name||"")),(e.capabilities?.length||0)>2&&(0,Hi.jsx)(y,{variant:"ghost",size:"sm",className:"Hi-5 px-2 text-xs",onClick:()=>m(!s),children:s?"Show less":`+${(e.capabilities?.length||0)-2} more`})]})})]})]})}var on=Te(require("react")),Lr=Te(require("@radix-ui/react-label"));var od=(0,Bi.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),M=on.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Lr.Root,{ref:a,className:k(od(),e),...t}));M.displayName=Lr.Root.displayName;var sn=Te(require("react")),Ee=sn.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)("textarea",{className:k("flex min-Hi-[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}));Ee.displayName="Textarea";var Br=Te(require("react")),$t=Te(require("@radix-ui/react-scroll-area"));var Ma=Br.forwardRef(({className:e,children:t,...a},o)=>(0,Hi.jsxs)($t.Root,{ref:o,className:k("relative overflow-hidden",e),...a,children:[(0,Hi.jsx)($t.Viewport,{className:"Hi-full w-full rounded-[inherit]",children:t}),(0,Hi.jsx)(dn,{}),(0,Hi.jsx)($t.Corner,{})]}));Ma.displayName=$t.Root.displayName;var dn=Br.forwardRef(({className:e,orientation:t="vertical",...a},o)=>(0,Hi.jsx)($t.ScrollAreaScrollbar,{ref:o,orientation:t,className:k("flex touch-none select-none transition-colors",t==="vertical"&&"Hi-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"Hi-2.5 flex-col border-t border-t-transparent p-[1px]",e),...a,children:(0,Hi.jsx)($t.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));dn.displayName=$t.ScrollAreaScrollbar.displayName;function cn({selectedDocuments:e,onDocumentsChange:t,availableDocuments:a,label:o,placeholder:i="Search knowledge documents...",maxSelections:r,disabled:n=!1}){let[s,m]=(0,ta.useState)(""),[p,c]=(0,ta.useState)([]),[l,u]=(0,ta.useState)(!1);(0,ta.useEffect)(()=>{if(!s.trim()){c([]),u(!1);return}let d=a.filter(v=>{if(e.map(D=>D.id).includes(v.id))return!1;let x=s.toLowerCase();return v.title.toLowerCase().includes(x)||v.description?.toLowerCase().includes(x)||v.tags?.some(D=>D.toLowerCase().includes(x))||Object.values(v.metadata||{}).some(D=>String(D).toLowerCase().includes(x))});c(d),u(!0)},[s,e,a]);let C=d=>{r&&e.length>=r&&e.pop(),t([...e,d]),m(""),u(!1)},b=d=>{t(e.filter(v=>v.id!==d))},N=!r||e.length<r;return(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{children:o}),(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)(Ht.Search,{className:"absolute left-3 top-3 Hi-4 w-4 text-muted-foreground"}),(0,Hi.jsx)(q,{value:s,onChange:d=>m(d.target.value),placeholder:N?i:`Maximum ${r} documents selected`,className:"pl-9",disabled:n||!N,onFocus:()=>s&&u(!0)})]}),l&&p.length>0&&(0,Hi.jsx)(Q,{className:"absolute top-full left-0 right-0 z-10 mt-1 max-Hi-60 overflow-y-scroll ta-scrollbar",children:(0,Hi.jsx)(Ma,{className:"Hi-full",children:(0,Hi.jsx)(ke,{className:"p-2",children:p.map(d=>(0,Hi.jsx)(y,{variant:"ghost",className:"w-full justify-start Hi-auto p-3 mb-1",onClick:()=>C(d),disabled:n,children:(0,Hi.jsxs)("div",{className:"flex items-start gap-3 w-full",children:[(0,Hi.jsx)(Ht.FileText,{className:"Hi-4 w-4 mt-0.5 text-muted-foreground flex-shrink-0"}),(0,Hi.jsxs)("div",{className:"text-left flex-1 min-w-0",children:[(0,Hi.jsx)("div",{className:"font-medium text-sm truncate",children:d.title}),d.description&&(0,Hi.jsx)("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:d.description}),d.tags&&d.tags.length>0&&(0,Hi.jsxs)("div",{className:"flex flex-wrap gap-1 mt-2",children:[d.tags.slice(0,3).map(v=>(0,Hi.jsx)(Pe,{variant:"outline",className:"text-xs",children:v},v)),d.tags.length>3&&(0,Hi.jsxs)(Pe,{variant:"outline",className:"text-xs",children:["+",d.tags.length-3," more"]})]})]})]})},d.id))})})}),l&&s&&p.length===0&&(0,Hi.jsx)(Q,{className:"absolute top-full left-0 right-0 z-10 mt-1",children:(0,Hi.jsxs)(ke,{className:"p-4 text-center text-sm text-muted-foreground",children:['Ht knowledge documents found for "',s,'"']})})]}),e.length>0&&(0,Hi.jsx)("div",{className:"space-y-2",children:(0,Hi.jsx)("div",{className:"space-y-2",children:e.map(d=>(0,Hi.jsx)(Q,{className:"p-3",children:(0,Hi.jsxs)("div",{className:"flex items-start gap-3",children:[(0,Hi.jsx)(Ht.FileText,{className:"Hi-4 w-4 mt-0.5 text-muted-foreground flex-shrink-0"}),(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsx)("div",{className:"font-medium text-sm",children:d.title}),d.description&&(0,Hi.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:d.description}),d.tags&&d.tags.length>0&&(0,Hi.jsx)("div",{className:"flex flex-wrap gap-1 mt-2",children:d.tags.map(v=>(0,Hi.jsxs)(Pe,{variant:"outline",className:"text-xs",children:[(0,Hi.jsx)(Ht.Tag,{className:"Hi-3 w-3 mr-1"}),v]},v))})]}),(0,Hi.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"Hi-6 w-6 flex-shrink-0",onClick:()=>b(d.id),disabled:n,children:(0,Hi.jsx)(Ht.X,{className:"Hi-3 w-3"})})]})},d.id))})}),l&&(0,Hi.jsx)("div",{className:"fixed inset-0 z-0",onClick:()=>u(!1)})]})}function Or({colleague:e,onSave:t,onCancel:a,isLoading:o=!1,title:i,submitLabel:r,cancelLabel:n="Cancel",readOnly:s=!1,availableKnowledgeDocuments:m=[],availableCapabilities:p=[],availableModels:c=[]}){let[l,u]=(0,ta.useState)(()=>{let g=e?.model||e?.metadata?.model||null;return{type:"digital",name:"",description:"",jobDescription:"",workInstructions:"",capabilities:[],capabilityLevel:0,coreKnowledge:null,...e,model:g}}),[C,b]=(0,ta.useState)(""),[N,d]=(0,ta.useState)(""),[v,R]=(0,ta.useState)(""),[x,D]=(0,ta.useState)(!s),J=l.model,I=J?typeof J=="number"?`${J}`:typeof J=="object"&&J!==null&&"id"in J?`${J.id}`:"":"";(0,ta.useEffect)(()=>{if(e){let g=e?.model||e?.metadata?.model||null;u({...e,model:g})}},[e]);let K=g=>{g.preventDefault();let X={id:l.id||parseInt(Date.now().toString()),name:l?.name,type:"digital",description:l.description,jobDescription:l.jobDescription||"",workInstructions:l.workInstructions||"",capabilities:l.capabilities||[],capabilityLevel:l.capabilityLevel||0,coreKnowledge:l.coreKnowledge||null,model:l.model||null,metadata:l.metadata||{}};t(X)},B=(g,X,S)=>{if(!X.trim())return;let P=l[g]||[];u({...l,[g]:[...P,X.trim()]}),S("")},G=(g,X)=>{let S=l[g]||[];u({...l,[g]:S.filter((P,w)=>w!==X)})},de=()=>{if(!v)return;let[g,X]=v.split(":");if(!g)return;let S=p.find(W=>`${W.relationTo}:${typeof W.value=="number"?W.value:W.value.id}`===v);if(!S)return;let P=l.capabilities||[],w={relationTo:g,value:S.value};P.some(W=>{let Ke=typeof W.value=="object"?W.value.id:W.value,Ce=typeof w.value=="object"?w.value.id:w.value;return W.relationTo===w.relationTo&&Ke===Ce})||(u({...l,capabilities:[...P,w]}),R(""))},Ne=g=>{let X=l.capabilities||[];u({...l,capabilities:X.filter((S,P)=>P!==g)})},F=g=>{if(!g||g==="__none__"){u({...l,model:null});return}let X=c.find(S=>`${S.id}`===g);if(X){let S=typeof X.id=="string"?parseInt(X.id,10):X.id;u({...l,model:isNaN(S)?null:S})}},ie=g=>{g.preventDefault(),D(!x)},Oe=(g,X,S,P,w)=>{let U=l[g]||[];return(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{children:X}),x&&(0,Hi.jsxs)("div",{className:"flex gap-2",children:[(0,Hi.jsx)(q,{value:S,onChange:W=>P(W.target.value),placeholder:w,onKeyPress:W=>{W.key==="Enter"&&(W.preventDefault(),B(g,S,P))},disabled:o}),(0,Hi.jsx)(y,{type:"button",variant:"outline",size:"icon",onClick:()=>B(g,S,P),disabled:o,children:(0,Hi.jsx)(Ht.Plus,{className:"Hi-4 w-4"})})]}),(0,Hi.jsx)("div",{className:"flex flex-wrap gap-2",children:U.map((W,Ke)=>(0,Hi.jsxs)(Pe,{className:"gap-1",children:[W,x&&(0,Hi.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"Hi-4 w-4 p-0 hover:bg-accent hover:text-accent-foreground",onClick:()=>G(g,Ke),disabled:o,children:(0,Hi.jsx)(Ht.X,{className:"Hi-3 w-3"})})]},`${g}-${Ke}-${W}`))})]})},L=i||(x?e?"Edit Colleague":"Add New Colleague":"View Colleague"),ue=r||(e?"Update Colleague":"Add Colleague");return(0,Hi.jsxs)(Q,{className:"m-8 w-full max-w-4xl mx-auto overflow-y-scroll ta-scrollbar",children:[(0,Hi.jsx)(it,{children:(0,Hi.jsxs)(dt,{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Ht.Bot,{className:"Hi-5 w-5"}),L]})}),(0,Hi.jsx)(ke,{className:"overflow-y-scroll ta-scrollbar",children:(0,Hi.jsxs)("form",{onSubmit:K,className:"space-y-6",children:[(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"name",children:"Name *"}),(0,Hi.jsx)(q,{id:"name",value:l?.name||"",onChange:g=>u({...l,name:g.target.value}),required:!0,disabled:o||!x})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:l.description||"",onChange:g=>u({...l,description:g.target.value}),rows:3,placeholder:"Brief description of this digital colleague...",disabled:o||!x})]})]}),(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsx)("h3",{className:"text-lg font-semibold",children:"Digital Colleague Details"}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"jobDescription",children:"Job Description *"}),(0,Hi.jsx)(Ee,{id:"jobDescription",value:l.jobDescription||"",onChange:g=>u({...l,jobDescription:g.target.value}),rows:4,required:l.type==="digital",disabled:o||!x})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"workInstructions",children:"Work Instructions"}),(0,Hi.jsx)(Ee,{id:"workInstructions",value:l.workInstructions||"",onChange:g=>u({...l,workInstructions:g.target.value}),rows:4,placeholder:"Enter detailed work instructions for this digital colleague...",disabled:o||!x})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{children:"Capabilities"}),x&&p.length>0&&(0,Hi.jsxs)("div",{className:"flex gap-2",children:[(0,Hi.jsxs)($e,{value:v,onValueChange:R,disabled:o,children:[(0,Hi.jsx)(Ve,{className:"flex-1",children:(0,Hi.jsx)(Qe,{placeholder:"Select a capability"})}),(0,Hi.jsx)(Ue,{children:p.filter(g=>{let X=l.capabilities||[],S=typeof g.value=="object"?g.value.id:g.value;return!X.some(P=>{let w=typeof P.value=="object"?P.value.id:P.value;return P.relationTo===g.relationTo&&w===S})}).map((g,X)=>{let S=typeof g.value=="object"?g.value.id:g.value,P=typeof g.value=="object"?g.value.name:void 0,w=`${g.relationTo}:${S}`,U=P?`${g.relationTo}: ${P}`:`${g.relationTo} (ID: ${S})`;return(0,Hi.jsx)(me,{value:w,children:U},w)})})]}),(0,Hi.jsx)(y,{type:"button",variant:"outline",size:"icon",onClick:de,disabled:o||!v,children:(0,Hi.jsx)(Ht.Plus,{className:"Hi-4 w-4"})})]}),x&&p.length===0&&(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Ht capabilities available. Please provide availableCapabilities prop."}),(0,Hi.jsx)("div",{className:"flex flex-wrap gap-2",children:l.capabilities?.map((g,X)=>{let S;if(typeof g=="string")S=g;else{let P=typeof g.value=="object"?g.value.id:g.value,w=typeof g.value=="object"?g.value.name:void 0;S=w?`${g.relationTo}: ${w}`:`${g.relationTo} (ID: ${P})`}return(0,Hi.jsxs)(Pe,{className:"gap-1",children:[S,x&&(0,Hi.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"Hi-4 w-4 p-0 hover:bg-accent hover:text-accent-foreground",onClick:()=>Ne(X),disabled:o,children:(0,Hi.jsx)(Ht.X,{className:"Hi-3 w-3"})})]},`capability-${X}`)})})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{children:"Model"}),x&&c.length>0?(0,Hi.jsxs)($e,{value:I||"__none__",onValueChange:F,disabled:o,children:[(0,Hi.jsx)(Ve,{children:(0,Hi.jsx)(Qe,{placeholder:"Select a model"})}),(0,Hi.jsxs)(Ue,{children:[(0,Hi.jsx)(me,{value:"__none__",children:"None"}),c.map(g=>{let X=`${g.id}`;return(0,Hi.jsx)(me,{value:X,children:g.name},X)})]})]}):x&&c.length===0?(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Ht models available. Please provide availableModels prop."}):(0,Hi.jsx)("div",{className:"text-sm",children:l.model?typeof l.model=="number"?`Model ${l.model}`:typeof l.model=="object"&&l.model!==null&&"name"in l.model?l.model.name||`Model ${l.model.id}`:`Model ${l.model}`:"Ht model selected"})]}),(0,Hi.jsx)(cn,{selectedDocuments:l.coreKnowledge?[{id:l.coreKnowledge?.id?.toString(),title:l.coreKnowledge?.name,format:"markdown",content:l.coreKnowledge?.content||"",createdAt:new Date(l.coreKnowledge?.createdAt),description:l.coreKnowledge?.description||"",metadata:l.coreKnowledge?.metadata||{},updatedAt:new Date(l.coreKnowledge?.updatedAt)}]:[],onDocumentsChange:g=>{let X={createdAt:g[0]?.createdAt.toISOString(),id:parseInt(g[0]?.id),name:g[0]?.title,source:"payload",updatedAt:(g[0]?.updatedAt||new Date).toISOString()};u({...l,coreKnowledge:g&&g.length>0?X:void 0})},label:"Core Knowledge",placeholder:"Search for core knowledge documents...",maxSelections:1,disabled:o||!x,availableDocuments:m.map(g=>({id:g.id.toString(),title:g?.name,name:g?.name,format:"markdown",content:g.content||"",createdAt:new Date(g.createdAt),source:g.source,description:g.description||"",metadata:g.metadata||{},updatedAt:new Date(g.updatedAt)}))})]}),(0,Hi.jsxs)("div",{className:"flex justify-end gap-2 Hi-4 border-t",children:[(0,Hi.jsx)(y,{type:"button",variant:"outline",onClick:a,disabled:o,children:x?n:"Close"}),x?(0,Hi.jsx)(y,{type:"submit",disabled:o,children:o?"Saving...":ue}):(0,Hi.jsxs)(y,{type:"button",onClick:ie,disabled:o,className:"gap-2",children:[(0,Hi.jsx)(Ht.Edit,{className:"Hi-4 w-4"}),"Edit"]})]})]})})]})}function mn({users:e,onUserSelect:t,onCancel:a,selectedUserId:o}){let[i,r]=(0,ta.useState)(""),n=Array.isArray(e)?e:[],s=(0,ta.useMemo)(()=>n.filter(p=>p!=null&&p!==void 0).filter(p=>p?.name?.toLowerCase().includes(i.toLowerCase())||p?.email?.toLowerCase().includes(i.toLowerCase())),[n,i]),m=p=>{t(p)};return(0,Hi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Hi.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Hi.jsx)(Ht.ChevronLeft,{className:"Hi-4 w-4"}),"Back"]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("h1",{className:"text-3xl font-bold",children:"Select User"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Choose a user to add as a colleague"})]})]}),(0,Hi.jsx)(Q,{className:"container",children:(0,Hi.jsx)(ke,{className:"Hi-6",children:(0,Hi.jsx)("div",{className:"flex flex-col md:flex-row gap-4",children:(0,Hi.jsx)("div",{className:"flex-1",children:(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)(Ht.Search,{className:"absolute left-3 top-3 Hi-4 w-4 text-muted-foreground"}),(0,Hi.jsx)(q,{placeholder:"Search users by name, email, role, or skills...",value:i,onChange:p=>r(p.target.value),className:"pl-9"})]})})})})}),(0,Hi.jsx)("div",{className:"container grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:s.map(p=>!p||!p.id?null:(0,Hi.jsx)(Ir.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,Hi.jsxs)(Q,{className:`cursor-pointer transition-all hover:shadow-lg ${o===p.id?"ring-2 ring-primary":""}`,onClick:()=>m(p),children:[(0,Hi.jsx)(it,{className:"pb-3",children:(0,Hi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Hi.jsx)(ba,{children:(0,Hi.jsx)(xa,{children:(0,Hi.jsx)(Ht.User,{className:"Hi-4 w-4"})})}),(0,Hi.jsx)("div",{children:(0,Hi.jsx)(dt,{className:"text-lg",children:p?.name||"Unknown User"})})]}),o===p.id&&(0,Hi.jsx)(Ht.Check,{className:"Hi-5 w-5 text-primary"})]})}),(0,Hi.jsx)(ke,{className:"Hi-0",children:(0,Hi.jsxs)("div",{className:"space-y-3",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Email"}),(0,Hi.jsx)("p",{className:"text-sm font-medium",children:p?.email||"Ht email"})]}),(0,Hi.jsx)("div",{children:(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Department"})})]})})]})},p.id))}),s.length===0&&(0,Hi.jsx)(Q,{className:"container mt-4",children:(0,Hi.jsx)(ke,{className:"Hi-6",children:(0,Hi.jsxs)("div",{className:"text-center py-8",children:[(0,Hi.jsx)(Ht.User,{className:"Hi-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Hi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ht users found"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"user-selection")})})}function un({digitalColleagues:e,onColleagueClone:t,onCancel:a,selectedColleagueId:o}){let[i,r]=(0,ta.useState)(""),[n,s]=(0,ta.useState)("all"),m=(0,ta.useMemo)(()=>e.filter(l=>l?.name.toLowerCase().includes(i.toLowerCase())||l.jobDescription?.toLowerCase().includes(i.toLowerCase())||l.workInstructions?.toLowerCase().includes(i.toLowerCase())),[e,i,n]),p=l=>{let u={...l,name:`${l?.name} (Copy)`};t(u)},c=l=>new Intl.DateTimeFormat("Bi-US",{month:"short",day:"numeric",year:"numeric"}).format(l);return(0,Hi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Hi.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Hi.jsx)(Ht.ChevronLeft,{className:"Hi-4 w-4"}),"Back"]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("h1",{className:"text-3xl font-bold",children:"Clone Digital Colleague"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Select a digital colleague to clone"})]})]}),(0,Hi.jsx)(Q,{children:(0,Hi.jsx)(ke,{className:"Hi-6",children:(0,Hi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,Hi.jsx)("div",{className:"flex-1",children:(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)(Ht.Search,{className:"absolute left-3 top-3 Hi-4 w-4 text-muted-foreground"}),(0,Hi.jsx)(q,{placeholder:"Search by name, job description, or capabilities...",value:i,onChange:l=>r(l.target.value),className:"pl-9"})]})}),(0,Hi.jsxs)("select",{value:n,onChange:l=>s(l.target.value),className:"Hi-10 px-3 rounded-md border border-input bg-background text-sm ring-offset-background",children:[(0,Hi.jsx)("option",{value:"all",children:"All Status"}),(0,Hi.jsx)("option",{value:"active",children:"Active"}),(0,Hi.jsx)("option",{value:"inactive",children:"Inactive"})]})]})})}),(0,Hi.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:m.map(l=>(0,Hi.jsx)(Ir.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,Hi.jsxs)(Q,{className:`cursor-pointer transition-all hover:shadow-lg ${o?.toString()===l.id.toString()?"ring-2 ring-primary":""}`,onClick:()=>p(l),children:[(0,Hi.jsx)(it,{className:"pb-3",children:(0,Hi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Hi.jsx)(ba,{children:(0,Hi.jsx)(xa,{className:"bg-blue-100",children:(0,Hi.jsx)(Ht.Bot,{className:"Hi-4 w-4 text-blue-600"})})}),(0,Hi.jsx)("div",{children:(0,Hi.jsx)(dt,{className:"text-lg flex items-center gap-2",children:l?.name})})]}),(0,Hi.jsxs)(y,{size:"sm",variant:"outline",className:"gap-2 Hi-8",onClick:u=>{u.stopPropagation(),p(l)},children:[(0,Hi.jsx)(Ht.Copy,{className:"Hi-3 w-3"}),"Clone"]})]})}),(0,Hi.jsx)(ke,{className:"Hi-0",children:(0,Hi.jsxs)("div",{className:"space-y-3",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Job Description"}),(0,Hi.jsx)("p",{className:"text-sm line-clamp-2",children:l.jobDescription})]}),l.capabilities&&l.capabilities.length>0&&(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Capabilities"}),(0,Hi.jsx)("div",{className:"flex flex-wrap gap-1",children:l.capabilities.length>3&&(0,Hi.jsxs)(Pe,{variant:"outline",className:"text-xs",children:["+",l.capabilities.length-3]})})]}),(0,Hi.jsx)("div",{className:"flex items-center justify-between text-xs text-muted-foreground"}),l.workInstructions&&(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Instructions"}),(0,Hi.jsx)("p",{className:"text-xs line-clamp-2",children:l.workInstructions})]})]})})]})},l.id))}),m.length===0&&(0,Hi.jsx)(Q,{children:(0,Hi.jsx)(ke,{className:"Hi-6",children:(0,Hi.jsxs)("div",{className:"text-center py-8",children:[(0,Hi.jsx)(Ht.Bot,{className:"Hi-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Hi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ht digital colleagues found"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"colleague-clone")})})}function pn({onSelectHuman:e,onSelectDigital:t,onCancel:a}){return(0,Hi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Hi.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Hi.jsx)(Ht.ChevronLeft,{className:"Hi-4 w-4"}),"Back"]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Colleague"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Choose the type of colleague to add"})]})]}),(0,Hi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Hi.jsxs)(Q,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,Hi.jsxs)(it,{className:"text-center pb-4",children:[(0,Hi.jsx)("div",{className:"mx-auto w-16 Hi-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,Hi.jsx)(Ht.User,{className:"Hi-8 w-8 text-blue-600"})}),(0,Hi.jsx)(dt,{className:"text-xl",children:"Add Human Colleague"})]}),(0,Hi.jsxs)(ke,{className:"text-center",children:[(0,Hi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Select from existing users in your organization to add as team members."}),(0,Hi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Ht.Users,{className:"Hi-4 w-4 text-blue-600"}),(0,Hi.jsx)("span",{children:"Browse existing users"})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Ht.User,{className:"Hi-4 w-4 text-blue-600"}),(0,Hi.jsx)("span",{children:"Import user details automatically"})]})]}),(0,Hi.jsx)(y,{className:"mt-6 w-full",onClick:e,children:"Select User"})]})]})}),(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Hi.jsxs)(Q,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,Hi.jsxs)(it,{className:"text-center pb-4",children:[(0,Hi.jsx)("div",{className:"mx-auto w-16 Hi-16 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:(0,Hi.jsx)(Ht.Bot,{className:"Hi-8 w-8 text-purple-600"})}),(0,Hi.jsx)(dt,{className:"text-xl",children:"Add Digital Colleague"})]}),(0,Hi.jsxs)(ke,{className:"text-center",children:[(0,Hi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Clone ta existing digital colleague or create a new AI assistant for your team."}),(0,Hi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Ht.Bot,{className:"Hi-4 w-4 text-purple-600"}),(0,Hi.jsx)("span",{children:"Clone existing colleagues"})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Ht.Users,{className:"Hi-4 w-4 text-purple-600"}),(0,Hi.jsx)("span",{children:"Create from templates"})]})]}),(0,Hi.jsx)(y,{className:"mt-6 w-full",onClick:t,children:"Add Digital Colleague"})]})]})})]})]},"colleague-type-selection")})})}function gn({onCloneExisting:e,onCreateNew:t,onCancel:a}){return(0,Hi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Hi.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Hi.jsx)(Ht.ChevronLeft,{className:"Hi-4 w-4"}),"Back"]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Digital Colleague"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Choose how to create your digital colleague"})]})]}),(0,Hi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Hi.jsxs)(Q,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,Hi.jsxs)(it,{className:"text-center pb-4",children:[(0,Hi.jsx)("div",{className:"mx-auto w-16 Hi-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,Hi.jsx)(Ht.Copy,{className:"Hi-8 w-8 text-blue-600"})}),(0,Hi.jsx)(dt,{className:"text-xl",children:"Clone Existing"})]}),(0,Hi.jsxs)(ke,{className:"text-center",children:[(0,Hi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Start with ta existing digital colleague and customize it for your needs."}),(0,Hi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Ht.Bot,{className:"Hi-4 w-4 text-blue-600"}),(0,Hi.jsx)("span",{children:"Pre-configured capabilities"})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Ht.Copy,{className:"Hi-4 w-4 text-blue-600"}),(0,Hi.jsx)("span",{children:"Inherit knowledge base"})]})]}),(0,Hi.jsx)(y,{className:"mt-6 w-full",onClick:e,children:"Browse & Clone"})]})]})}),(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Hi.jsxs)(Q,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,Hi.jsxs)(it,{className:"text-center pb-4",children:[(0,Hi.jsx)("div",{className:"mx-auto w-16 Hi-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,Hi.jsx)(Ht.Sparkles,{className:"Hi-8 w-8 text-green-600"})}),(0,Hi.jsx)(dt,{className:"text-xl",children:"Create New"})]}),(0,Hi.jsxs)(ke,{className:"text-center",children:[(0,Hi.jsx)("p",{className:"text-muted-foreground mb-4",children:"Build a completely new digital colleague from scratch with custom specifications."}),(0,Hi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Ht.Plus,{className:"Hi-4 w-4 text-green-600"}),(0,Hi.jsx)("span",{children:"Custom job description"})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Hi.jsx)(Ht.Sparkles,{className:"Hi-4 w-4 text-green-600"}),(0,Hi.jsx)("span",{children:"Define unique capabilities"})]})]}),(0,Hi.jsx)(y,{className:"mt-6 w-full",onClick:t,children:"Create from Scratch"})]})]})})]})]},"digital-colleague-options")})})}function fn(e,t){let[a,o]=(0,ta.useState)(()=>{if(typeof window>"u")return t;try{let r=window.localStorage.getItem(e);return r?JSON.parse(r):t}catch{return t}}),i=r=>{try{o(r),typeof window<"u"&&window.localStorage.setItem(e,JSON.stringify(r))}catch{}};return(0,ta.useEffect)(()=>{i(a)},[]),[a,i]}var nr=require("react-icons/fa");function St({title:e,description:t,badge:a,primaryAction:o,secondaryAction:i,gradient:r,children:n,className:s}){let[m,p]=fn(`hero-section-minimized-${e.replace(/\s+/g,"-").toLowerCase()}`,!i&&!t),c=!i&&!t||m;return(0,Hi.jsxs)(Ir.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 ${s||""}`,children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[a&&(0,Hi.jsx)(Pe,{className:"bg-white/20 text-white hover:bg-white/30 rounded-xl",children:a}),(0,Hi.jsx)("h2",{className:"text-3xl font-bold m-0",children:e})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[c&&o&&(0,Hi.jsx)(y,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:o.onClick,children:o.label}),(i||t)&&(0,Hi.jsx)("button",{"aria-label":m?"Expand hero section":"Minimize hero section",className:"rounded-full bg-white/20 hover:bg-white/30 p-1 text-white transition-colors",onClick:()=>p(!m),style:{lineHeight:0},children:m?(0,Hi.jsx)(nr.FaChevronDown,{size:22}):(0,Hi.jsx)(nr.FaChevronUp,{size:22})})]})]}),!c&&(0,Hi.jsxs)("div",{className:"flex flex-col gap-6 md:flex-row md:items-center md:justify-between",children:[(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsx)("p",{className:"max-w-[600px] text-white/80",children:t}),(0,Hi.jsxs)("div",{className:"flex flex-wrap gap-3",children:[o&&(0,Hi.jsx)(y,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:o.onClick,children:o.label}),i&&(0,Hi.jsx)(y,{variant:"outline",className:"rounded-2xl bg-transparent border-white text-white hover:bg-white/10",onClick:i.onClick,children:i.label})]})]}),n&&(0,Hi.jsx)("div",{className:"hidden lg:block",children:n})]})]})}function Hr(...e){return Yo((0,Fi.clsx)(e))}function jr({initialColleagues:e,onColleagueAdd:t,onColleagueEdit:a,onColleagueDelete:o,compactView:i=!1,departments:r=["Design","Engineering","Marketing","Product","Sales","Operations"],className:n,availableUsers:s=[],existingDigitalColleagues:m=[],availableKnowledgeDocuments:p=[],availableCapabilities:c=[],availableModels:l=[]}){let[u,C]=(0,ta.useState)(e||[]),[b,N]=(0,ta.useState)(""),[d,v]=(0,ta.useState)("all"),[R,x]=(0,ta.useState)("all"),[D,J]=(0,ta.useState)("all"),[I,K]=(0,ta.useState)(null),[B,G]=(0,ta.useState)(null);(0,ta.useEffect)(()=>{C(e||[])},[e]);let de=Array.isArray(s)?s:[],Ne=Array.isArray(m)?m:[],[F,ie]=(0,ta.useState)("main"),Oe=u.filter(O=>!O||!O?.name?!1:O?.name.toLowerCase().includes(b.toLowerCase())||O.type==="human"&&O.email?.toLowerCase().includes(b.toLowerCase())||O.type==="digital"&&O.jobDescription?.toLowerCase().includes(b.toLowerCase())),L=Oe.filter(O=>O.type==="human"),ue=Oe.filter(O=>O.type==="digital"),g=()=>{ie("typeSelection")},X=O=>{O.type==="digital"&&(K(O),ie("form")),a?.(O)},S=O=>{O.type==="digital"&&(G(O),ie("view"))},P=O=>{if(!O||!O.id){console.error("Invalid user provided to handleUserSelect:",O);return}let rt={id:`human-${Date.now()}`,type:"human",name:O?.name||"Unknown User",email:O?.email||"",updatedAt:O.updatedAt,createdAt:O.createdAt,accounts:O.accounts};C(Et=>[...Et,rt]),t?.(rt),ie("main")},w=O=>{if(!O||!O.id){console.error("Invalid cloned colleague provided to handleDigitalColleagueClone:",O);return}C(rt=>[...rt,{...O,type:"digital"}]),t?.({...O,type:"digital"}),ie("main")},U=()=>{K(null),ie("form")},W=O=>{if(!O||!O.id){console.error("Invalid colleague provided to handleSaveColleague:",O);return}I?(C(rt=>rt.map(Et=>Et.id===O.id?{...O,type:"digital"}:Et)),a?.({...O,type:"digital"})):(C(rt=>[...rt,{...O,type:"digital"}]),t?.({...O,type:"digital"})),ie("main"),K(null)},Ke=()=>{ie("main"),K(null),G(null)},Ce=()=>{ie("main"),G(null)},st=()=>{B&&(K(B),G(null),ie("form"))},Ot=O=>{o?.(O,u.find(rt=>rt.id.toString()===O.toString())?.type),C(rt=>rt.filter(Et=>Et.id!==O))},Zt=()=>{N(""),v("all"),x("all")};return F==="typeSelection"?(0,Hi.jsx)(pn,{onSelectHuman:()=>ie("userSelection"),onSelectDigital:()=>ie("digitalOptions"),onCancel:()=>ie("main")}):F==="userSelection"?(0,Hi.jsx)(mn,{users:de,onUserSelect:P,onCancel:()=>ie("typeSelection")}):F==="digitalOptions"?(0,Hi.jsx)(gn,{onCloneExisting:()=>ie("digitalClone"),onCreateNew:U,onCancel:()=>ie("typeSelection")}):F==="digitalClone"?(0,Hi.jsx)(un,{digitalColleagues:Ne,onColleagueClone:w,onCancel:()=>ie("digitalOptions")}):F==="form"?(0,Hi.jsx)(Or,{colleague:I||void 0,onSave:W,onCancel:Ke,availableKnowledgeDocuments:p,availableCapabilities:c,availableModels:l}):F==="view"?(0,Hi.jsx)(Or,{colleague:B||void 0,onSave:W,onCancel:Ce,readOnly:!0,availableKnowledgeDocuments:p,availableCapabilities:c,availableModels:l}):(0,Hi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsx)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Hi.jsxs)("div",{className:`space-y-6 ${n||""}`,children:[(0,Hi.jsx)(St,{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:g}}),(0,Hi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,Hi.jsxs)(Q,{children:[(0,Hi.jsxs)(it,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,Hi.jsx)(dt,{className:"text-sm font-medium",children:"Total Colleagues"}),(0,Hi.jsx)(Ht.Users,{className:"Hi-4 w-4 text-muted-foreground"})]}),(0,Hi.jsxs)(ke,{children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold",children:u.length}),(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]}),(0,Hi.jsxs)(Q,{children:[(0,Hi.jsxs)(it,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,Hi.jsx)(dt,{className:"text-sm font-medium",children:"Human Members"}),(0,Hi.jsx)(Ht.User,{className:"Hi-4 w-4 text-muted-foreground"})]}),(0,Hi.jsxs)(ke,{children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold",children:u.filter(O=>O.type==="human").length}),(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground",children:"active"})]})]}),(0,Hi.jsxs)(Q,{children:[(0,Hi.jsxs)(it,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,Hi.jsx)(dt,{className:"text-sm font-medium",children:"Digital Colleagues"}),(0,Hi.jsx)(Ht.Bot,{className:"Hi-4 w-4 text-muted-foreground"})]}),(0,Hi.jsxs)(ke,{children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold",children:u.filter(O=>O.type==="digital").length}),(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]})]}),(0,Hi.jsx)(Q,{children:(0,Hi.jsx)(ke,{className:"Hi-6",children:(0,Hi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,Hi.jsx)("div",{className:"flex-1",children:(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)(Ht.Search,{className:"absolute left-3 top-3 Hi-4 w-4 text-muted-foreground"}),(0,Hi.jsx)(q,{placeholder:"Search colleagues...",value:b,onChange:O=>N(O.target.value),className:"pl-9"})]})}),(0,Hi.jsxs)($e,{value:d,onValueChange:v,children:[(0,Hi.jsx)(Ve,{className:"w-full md:w-[180px]",children:(0,Hi.jsx)(Qe,{placeholder:"Department"})}),(0,Hi.jsxs)(Ue,{children:[(0,Hi.jsx)(me,{value:"all",children:"All Departments"}),r.map(O=>(0,Hi.jsx)(me,{value:O,children:O},O))]})]}),(0,Hi.jsxs)($e,{value:R,onValueChange:x,children:[(0,Hi.jsx)(Ve,{className:"w-full md:w-[140px]",children:(0,Hi.jsx)(Qe,{placeholder:"Status"})}),(0,Hi.jsxs)(Ue,{children:[(0,Hi.jsx)(me,{value:"all",children:"All Status"}),(0,Hi.jsx)(me,{value:"active",children:"Active"}),(0,Hi.jsx)(me,{value:"inactive",children:"Inactive"})]})]}),(b||d!=="all"||R!=="all")&&(0,Hi.jsxs)(y,{variant:"outline",onClick:Zt,className:"gap-2",children:[(0,Hi.jsx)(Ht.Filter,{className:"Hi-4 w-4"}),"Clear"]})]})})}),(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsx)(er,{activeTab:D,onTabChange:J,tabOptions:[{value:"all",label:`All (${Oe.length})`},{value:"human",label:`Human (${L.length})`},{value:"digital",label:`Digital (${ue.length})`}],maxWidth:"400px",gridCols:3}),D==="all"&&(0,Hi.jsx)("div",{className:`grid gap-4 ${i?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:Oe.map(O=>(0,Hi.jsx)(or,{colleague:O,onEdit:X,onDelete:Ot,onViewDetails:S,compact:i,className:Hr([O.type==="digital"&&"border-teal-400"])},`${O}-${O.id}`))}),D==="human"&&(0,Hi.jsx)("div",{className:`grid gap-4 ${i?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:L.map(O=>(0,Hi.jsx)(or,{colleague:O,onEdit:X,onDelete:Ot,onViewDetails:S,compact:i},O.id))}),D==="digital"&&(0,Hi.jsx)("div",{className:`grid gap-4 ${i?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:ue.map(O=>(0,Hi.jsx)(or,{colleague:O,onEdit:X,onDelete:Ot,onViewDetails:S,compact:i,className:Hr([O.type==="digital"&&"border-teal-400"])},O.id))})]}),Oe.length===0&&(0,Hi.jsx)(Q,{children:(0,Hi.jsx)(ke,{className:"Hi-6",children:(0,Hi.jsxs)("div",{className:"text-center py-8",children:[(0,Hi.jsx)(Ht.Users,{className:"Hi-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Hi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ht colleagues found"}),(0,Hi.jsx)("p",{className:"text-muted-foreground mb-4",children:b||d!=="all"||R!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first colleague."}),(0,Hi.jsxs)(y,{onClick:g,className:"gap-2",children:[(0,Hi.jsx)(Ht.Plus,{className:"Hi-4 w-4"}),"Add Colleague"]})]})})})]})},"projects-index-view")})})}var Io=Te(require("react")),yt=Te(require("@radix-ui/react-dialog"));var ze=yt.Root;var co=yt.Portal;var _a=Io.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(yt.Overlay,{ref:a,className:k("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}));_a.displayName=yt.Overlay.displayName;var Xe=Io.forwardRef(({className:e,children:t,...a},o)=>(0,Hi.jsxs)(co,{children:[(0,Hi.jsx)(_a,{}),(0,Hi.jsxs)(yt.Content,{ref:o,className:k("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,Hi.jsxs)(yt.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,Hi.jsx)(Ht.X,{className:"Hi-4 w-4"}),(0,Hi.jsx)("span",{className:"Ir-only",children:"Close"})]})]})]}));Xe.displayName=yt.Content.displayName;var Ye=({className:e,...t})=>(0,Hi.jsx)("div",{className:k("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ye.displayName="DialogHeader";var mo=({className:e,...t})=>(0,Hi.jsx)("div",{className:k("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});mo.displayName="DialogFooter";var _e=Io.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(yt.Title,{ref:a,className:k("text-lg font-semibold leading-none tracking-tight",e),...t}));_e.displayName=yt.Title.displayName;var uo=Io.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(yt.Description,{ref:a,className:k("text-sm text-muted-foreground",e),...t}));uo.displayName=yt.Description.displayName;var gs=Te(require("@radix-ui/react-dialog"));var Ia=({fieldName:e,value:t,label:a,multiline:o=!1,onSave:i,className:r="",disabled:n=!1})=>{let[s,m]=(0,ta.useState)(!1),[p,c]=(0,ta.useState)(""),l=()=>{n||(m(!0),c(t))},u=async()=>{p!==t&&await i(e,p),m(!1)},C=b=>{b.key==="Enter"&&!o||b.key==="Enter"&&b.ctrlKey&&o?u():b.key==="Escape"&&(m(!1),c(""))};return(0,Hi.jsxs)("div",{className:`space-y-2 ${r}`,children:[(0,Hi.jsx)(M,{children:a}),s?o?(0,Hi.jsx)(Ee,{value:p,onChange:b=>c(b.target.value),onBlur:u,onKeyDown:C,autoFocus:!0,rows:4,className:"resize-none"}):(0,Hi.jsx)(q,{value:p,onChange:b=>c(b.target.value),onBlur:u,onKeyPress:C,autoFocus:!0,className:"text-lg font-medium"}):(0,Hi.jsxs)("div",{onClick:l,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-Hi-[100px]":"min-Hi-[40px]"} flex items-start gap-2`,children:[(0,Hi.jsx)("span",{className:o?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click to edit..."}),!n&&(0,Hi.jsx)(Ht.Edit,{className:"Hi-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var Gn=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),Wn=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),qn=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),Jn=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),Zn=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),Xn=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),Yn=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),pr=require("@payloadcms/richtext-lexical/lexical/list"),Qn=require("@payloadcms/richtext-lexical/lexical/rich-text"),es=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var zn=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),Ho=require("@payloadcms/richtext-lexical/lexical/utils"),we=require("@payloadcms/richtext-lexical/lexical"),Xr=require("@payloadcms/richtext-lexical/lexical/selection");var An=require("@radix-ui/react-dialog"),mr=require("@payloadcms/richtext-lexical/client");var Kr=Te(require("bson-objectid"));var wn=require("@payloadcms/ui");var yn=Te(require("react")),aa=Te(require("@radix-ui/react-tooltip"));var lr=aa.Provider,dr=aa.Root,cr=aa.Trigger,Fo=yn.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,Hi.jsx)(aa.Portal,{children:(0,Hi.jsx)(aa.Content,{ref:o,sideOffset:t,className:k("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})}));Fo.displayName=aa.Content.displayName;var rd=e=>{let{data:{relationTo:t,value:a},nodeKey:o}=e,[i]=(0,zn.useLexicalComposerContext)(),[r,n]=(0,ta.useState)(""),[s,m]=(0,ta.useState)(""),[p,c]=(0,ta.useState)(""),l=async d=>{console.log("fetchMedia",d)};(0,ta.useEffect)(()=>{typeof a=="string"?a.length===24?l(a):(n(a||""),c(N(b())),m(C()||"")):typeof a=="object"&&(n(`${process.env.NEXT_PUBLIC_API_URL}${a.url}`||""),c(N(a.filesize)),m(a.mimeType?.split("/")[1]||""))},[]);let u=(0,ta.useCallback)(()=>{i.update(()=>{(0,we.$getNodeByKey)(o)?.remove()})},[i,o]),C=()=>{let d=e.data.value;return typeof d=="string"?d.split(";base64")[0]?.split("image/")[1]:""},b=()=>{let d=e.data.value;if(typeof d=="string"){let v=d.split(",")[1]?.length||0;return 4*Math.ceil(v/3)*.5624896334383812/1e3}return 0};function N(d){if(d>=1e6){let R=d/1e6;return`${R>=10?Math.round(R).toString():R.toFixed(1)} MB`}return`${Math.floor(d/1e3)} KB`}return(0,Hi.jsx)("div",{className:"my-2",contentEditable:!1,children:(0,Hi.jsxs)("div",{className:"border border-slate-800 rounded-xl overflow-clip w-60 flex flex-col gap-2 bg-[#222222]",children:[(0,Hi.jsxs)("div",{className:"flex gap-2 border-b border-b-slate-100/10",children:[(0,Hi.jsx)("div",{className:"flex-1",children:e.data.value?(0,Hi.jsx)("img",{className:"object-cover m-0 w-full min-w-[115px] min-Hi-[105px]","data-lexical-upload-id":a,"data-lexical-upload-relation-to":t,src:r}):(0,Hi.jsx)(wn.File,{})}),(0,Hi.jsx)(lr,{children:(0,Hi.jsxs)(dr,{children:[(0,Hi.jsxs)(cr,{className:"flex-1 flex justify-center items-center text-[#b5b5b5]",children:[(0,Hi.jsx)("span",{className:"font-medium text-sm",children:"Media"}),(0,Hi.jsx)("button",{onClick:d=>{d.preventDefault(),u()},className:"flex-1 flex justify-center items-center",children:(0,Hi.jsx)(Ht.X,{width:24,height:24,strokeWidth:1})})]}),(0,Hi.jsx)(Fo,{children:(0,Hi.jsx)("span",{children:"Remove image"})})]})})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-center gap-4 py-3 flex-1 text-xs font-bold",children:[(0,Hi.jsx)("span",{className:"",children:s?.toLocaleUpperCase()}),(0,Hi.jsx)("span",{children:p})]})]})})},Sn=rd;function id(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:po({fields:{},relationTo:"media",value:a})}}return e.src.startsWith("file:///"),null}var Lo=class extends mr.UploadNode{static importDOM(){return{img:()=>({conversion:id,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new Kr.default().toHexString(),t.version=3);let a={id:t.id??new Kr.default().toHexString(),fields:t.fields,relationTo:"media",value:t.value},o=po(a);return o.setFormat?.(t.format),o}decorate(){return(0,Hi.jsx)(Sn,{data:this.__data,nodeKey:this.getKey()})}};function po(e){return new Lo({data:e})}var nd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",sd=e=>nd?(e||window).getSelection():null,Tu=(0,we.createCommand)("INSERT_UPLOAD_WITH_DRAWER_COMMAND"),$r=(0,we.createCommand)("INSERT_UPLOAD_COMMAND");function Mn({activeEditor:e,onClose:t,isOpen:a=!1}){let o=(0,ta.useRef)(!1),[i,r]=(0,ta.useState)(!0),[n,s]=(0,ta.useState)(""),[m,p]=(0,ta.useState)(""),[c,l]=(0,ta.useState)(!1),[u,C]=(0,ta.useState)("left"),b=n==="",N=D=>{l(D.target.checked)},d=D=>{C(D.target.value)},v=D=>{let J=new FileReader;J.onload=function(){return typeof J.result=="string"&&s(J.result),""},D!==null&&D[0]&&J.readAsDataURL(D[0])};(0,ta.useEffect)(()=>{o.current=!1;let D=J=>{o.current=J.altKey};return document.addEventListener("keydown",D),()=>{document.removeEventListener("keydown",D)}},[e]),(0,ta.useEffect)(()=>{i||t()},[i]),(0,ta.useEffect)(()=>{r(a)},[a]);let R=({editor:D,relationTo:J,replaceNodeKey:I,value:K})=>{if(I)D.update(()=>{let B=(0,we.$getNodeByKey)(I);B&&B.replace(po({id:"",fields:{},relationTo:"media",value:K}))});else{let B=D.dispatchCommand($r,{fields:null,relationTo:"media",value:K})}},x=()=>{R({editor:e,relationTo:"media",replaceNodeKey:null,value:{altText:m,src:n,showCaption:c,position:u}.src}),r(!1),t()};return(0,Hi.jsx)(ze,{open:i,onOpenChange:D=>r(D),children:(0,Hi.jsxs)(Xe,{children:[(0,Hi.jsxs)(Ye,{children:[(0,Hi.jsx)(_e,{children:"Upload Image"}),(0,Hi.jsx)(An.DialogDescription,{children:"Description"})]}),(0,Hi.jsxs)("div",{className:"",children:[(0,Hi.jsx)("div",{style:{marginBottom:"1em"},children:(0,Hi.jsx)(q,{type:"file",onChange:D=>v(D.target.files),accept:"image/*","data-test-id":"image-modal-file-upload"})}),(0,Hi.jsx)("div",{style:{marginBottom:"1em"},children:(0,Hi.jsx)(q,{"aria-label":"Alt Text",placeholder:"Descriptive alternative text",onChange:D=>p(D.currentTarget.value),value:m,"data-test-id":"image-modal-alt-text-input"})}),(0,Hi.jsx)(y,{"data-test-id":"image-modal-file-upload-btn",disabled:b,onClick:()=>x(),children:"Confirm"})]})]})})}function zr({captionsEnabled:e}){let[t]=(0,zn.useLexicalComposerContext)();return(0,ta.useEffect)(()=>{if(!t.hasNodes([mr.UploadNode]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return(0,Ho.mergeRegister)(t.registerCommand(we.DRAGSTART_COMMAND,a=>ld(a),we.COMMAND_PRIORITY_HIGH),t.registerCommand(we.DRAGOVER_COMMAND,a=>dd(a),we.COMMAND_PRIORITY_LOW),t.registerCommand(we.DROP_COMMAND,a=>cd(a,t),we.COMMAND_PRIORITY_HIGH))},[e,t]),null}function ld(e){if(!_r())return!1;let a=e.dataTransfer;return a?(a.setData("text/plain","Hi"),!0):!1}function dd(e){return _r()?(En(e)||e.preventDefault(),!0):!1}function cd(e,t){let a=_r();if(!a)return!1;if(e.preventDefault(),En(e)){let o=md(e);a.remove();let i=(0,we.$createRangeSelection)();o!=null&&i.applyDOMRange(o),(0,we.$setSelection)(i)}return!0}function _r(){let e=(0,we.$getSelection)();if(!(0,we.$isNodeSelection)(e))return null;let a=e.getNodes()[0];return(0,mr.$isUploadNode)(a)?a:null}function En(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 md(e){let t,a=e.target,o=a==null?null:a.nodeType===9?a.defaultView:a.ownerDocument.defaultView,i=sd(o);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(e.clientX,e.clientY);else if(e.rangeParent&&i!==null)i.collapse(e.rangeParent,e.rangeOffset||0),t=i.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}var ud=()=>(0,Hi.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,Hi.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"})}),In=ud;var pd=()=>(0,Hi.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,Hi.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"})}),Fn=pd;var gd=()=>(0,Hi.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,Hi.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,Hi.jsx)("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),Ln=gd;var fd=()=>(0,Hi.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,Hi.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,Hi.jsx)("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),Bn=fd;var vd=()=>(0,Hi.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,Hi.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"})}),On=vd;var hd=()=>(0,Hi.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,Hi.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"})}),Hn=hd;var jn=()=>(0,Hi.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,Hi.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"})}),Vn=()=>(0,Hi.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,Hi.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"})}),Un=()=>(0,Hi.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,Hi.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"})}),Kn=()=>(0,Hi.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,Hi.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"})}),$n=()=>(0,Hi.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,Hi.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 Zr=1;function bd(){return(0,Hi.jsx)("span",{className:"border border-[#222222]"})}function Yr(){let[e]=(0,zn.useLexicalComposerContext)(),t=(0,ta.useRef)(null),[a,o]=(0,ta.useState)(!1),[i,r]=(0,ta.useState)(!1),[n,s]=(0,ta.useState)(!1),[m,p]=(0,ta.useState)(!1),[c,l]=(0,ta.useState)(!1),[u,C]=(0,ta.useState)(!1),[b,N]=(0,ta.useState)(!1),[d,v]=(0,ta.useState)(!1),[R,x]=(0,ta.useState)(!1),[D,J]=(0,ta.useState)("left"),[I,K]=(0,ta.useState)("p"),B=L=>{e.update(()=>{let ue=(0,we.$getSelection)();(0,we.$isRangeSelection)(ue)&&(L==="p"?(0,Xr.$setBlocksType)(ue,()=>(0,we.$createParagraphNode)()):(0,Xr.$setBlocksType)(ue,()=>(0,Qn.$createHeadingNode)(L)))})},G=(0,ta.useCallback)(()=>{let L=(0,we.$getSelection)();if((0,we.$isRangeSelection)(L)){s(L.hasFormat("bold")),p(L.hasFormat("italic")),l(L.hasFormat("underline")),C(L.hasFormat("strikethrough")),N(L.hasFormat("subscript")),v(L.hasFormat("superscript"));let ue=L.anchor.getNode(),g=ue;for(;g&&!(0,we.$isParagraphNode)(g)&&g!==(0,we.$getRoot)();){let S=g.getParent();S&&(g=S)}if(g){let S=g.getFormatType();J(S||"left")}let X=ue.getTopLevelElement()?.__tag;K(X||"p")}},[]);(0,ta.useEffect)(()=>(0,Ho.mergeRegister)(e.registerUpdateListener(({editorState:L})=>{L.read(()=>{G()})}),e.registerCommand(we.SELECTION_CHANGE_COMMAND,(L,ue)=>(G(),!1),Zr),e.registerCommand(we.CAN_UNDO_COMMAND,L=>(o(L),!1),Zr),e.registerCommand(we.CAN_REDO_COMMAND,L=>(r(L),!1),Zr),(0,Ho.mergeRegister)(e.registerCommand($r,L=>(e.update(()=>{let ue=(0,we.$getSelection)()||(0,we.$getPreviousSelection)();if((0,we.$isRangeSelection)(ue)){let g=po({id:L.id,fields:L.fields,relationTo:L.relationTo,value:L.value}),{focus:X}=ue,S=X.getNode();(0,Ho.$insertNodeToNearestRoot)(g),(0,we.$isParagraphNode)(S)&&!S.__first&&S.remove()}}),!0),we.COMMAND_PRIORITY_EDITOR))),[e,G]);let de=[[{label:"Undo",icon:(0,Hi.jsx)(Ht.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(we.UNDO_COMMAND,void 0)},disabled:!a},{label:"Redo",icon:(0,Hi.jsx)(Ht.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(we.UNDO_COMMAND,void 0)},disabled:!i}],[{label:"Bold",icon:(0,Hi.jsx)(In,{}),onClick:()=>{e.dispatchCommand(we.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:n},{label:"Italic",icon:(0,Hi.jsx)(Fn,{}),onClick:()=>{e.dispatchCommand(we.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:m},{label:"Underline",icon:(0,Hi.jsx)(Ln,{}),onClick:()=>{e.dispatchCommand(we.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:c},{label:"Strikethrough",icon:(0,Hi.jsx)(Bn,{}),onClick:()=>{e.dispatchCommand(we.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:u},{label:"Subscript",icon:(0,Hi.jsx)(On,{}),onClick:()=>{e.dispatchCommand(we.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:b},{label:"Superscript",icon:(0,Hi.jsx)(Hn,{}),onClick:()=>{e.dispatchCommand(we.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:d}]],Ne=[{label:"Left Align",direction:"left",icon:(0,Hi.jsx)(Ht.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(we.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,Hi.jsx)(Ht.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(we.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,Hi.jsx)(Ht.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(we.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,Hi.jsx)(Ht.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(we.FORMAT_ELEMENT_COMMAND,"justify")}}],ie=[{label:"Normal Text",value:"p",icon:(0,Hi.jsx)(jn,{}),onClick:()=>B("p")},{label:"Heading 1",value:"h1",icon:(0,Hi.jsx)(Vn,{}),onClick:()=>B("h1")},{label:"Heading 2",value:"h2",icon:(0,Hi.jsx)(Un,{}),onClick:()=>B("h2")},{label:"Heading 3",value:"h3",icon:(0,Hi.jsx)(Kn,{}),onClick:()=>B("h3")},{label:"Heading 4",value:"h4",icon:(0,Hi.jsx)($n,{}),onClick:()=>B("h4")},...[{label:"Unordered List",value:"ul",icon:(0,Hi.jsx)(Ht.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(pr.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,Hi.jsx)(Ht.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(pr.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],Oe=[{label:"Insert Image",icon:(0,Hi.jsx)(Ht.ImageUp,{width:15,height:15}),onClick:()=>{x(!0)},disabled:!1}];return(0,Hi.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2 sticky top-0 bg-black z-50",children:(0,Hi.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[de.map((L,ue)=>(0,Hi.jsxs)(ta.Fragment,{children:[(0,Hi.jsx)("div",{className:"flex items-center gap-2",children:L.map((g,X)=>(0,Hi.jsx)("div",{role:"button","aria-disabled":g.disabled||!1,onClick:g.onClick,className:k("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]",g.active&&"bg-[#3c3c3c]"),"aria-label":g.label,children:(0,Hi.jsx)(lr,{children:(0,Hi.jsxs)(dr,{children:[(0,Hi.jsx)(cr,{className:"text-[#b5b5b5]",children:g.icon}),(0,Hi.jsx)(Fo,{children:(0,Hi.jsx)("p",{children:g.label})})]})})},X))}),(0,Hi.jsx)(bd,{})]},`toolbar-option-${L.length}-${ue}`)),(0,Hi.jsxs)(Yt,{children:[(0,Hi.jsxs)(Qt,{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:[Ne.find(L=>L.direction===D)?.icon,Ne.find(L=>L.direction===D)?.label,(0,Hi.jsx)(Ht.ChevronDown,{width:15,height:15})]}),(0,Hi.jsx)(Kt,{className:"bg-black hover:bg-black",children:Ne.map((L,ue)=>(0,Hi.jsxs)(Rt,{onClick:L.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,Hi.jsx)("span",{children:L.icon}),(0,Hi.jsx)("span",{children:L.label})]},`${L.label}-${ue}`))})]}),(0,Hi.jsxs)(Yt,{children:[(0,Hi.jsxs)(Qt,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[ie.find(L=>L.value===I)?.icon,ie.find(L=>L.value===I)?.label,(0,Hi.jsx)(Ht.ChevronDown,{width:15,height:15})]}),(0,Hi.jsx)(Kt,{className:"bg-black hover:bg-black",children:ie.map((L,ue)=>(0,Hi.jsxs)(Rt,{onClick:L.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,Hi.jsx)("span",{children:L.icon}),(0,Hi.jsx)("span",{children:L.label})]},`heading-option-${L.label}-${ue}`))})]}),(0,Hi.jsxs)(Yt,{children:[(0,Hi.jsxs)(Qt,{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,Hi.jsx)(Ht.Plus,{width:15,height:15}),(0,Hi.jsx)(Ht.ChevronDown,{width:15,height:15})]}),(0,Hi.jsx)(Kt,{className:"bg-black hover:bg-black",children:Oe.map((L,ue)=>(0,Hi.jsxs)(Rt,{onClick:L.onClick,disabled:L.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,Hi.jsx)("span",{children:L.icon}),(0,Hi.jsx)("span",{children:L.label})]},ue))})]}),R&&(0,Hi.jsx)(Mn,{activeEditor:e,onClose:()=>{x(!1)},isOpen:R})]})})}var xd=({setValue:e,value:t,name:a,editable:o=!0})=>{let[i]=(0,zn.useLexicalComposerContext)(),r=(0,ta.useRef)(null),n=s=>{s.read(()=>{let m=s.toJSON();JSON.stringify(m)!==JSON.stringify(r.current)&&(r.current=m,e?.(()=>m))})};return(0,ta.useEffect)(()=>{i.setEditable(o)},[o,i]),(0,ta.useEffect)(()=>{t&&JSON.stringify(t)!==JSON.stringify(r.current)&&i.update(()=>{try{let s=i.parseEditorState(t);i.setEditorState(s),r.current=t}catch(s){console.error("Error parsing editor state:",s)}},{discrete:!0})},[t,i]),(0,Hi.jsx)("div",{className:"w-full",children:(0,Hi.jsxs)("div",{className:" ",children:[o&&(0,Hi.jsx)(Yr,{}),(0,Hi.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,Hi.jsx)(Xn.RichTextPlugin,{contentEditable:(0,Hi.jsx)(qn.ContentEditable,{name:a,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-Hi-40"}),ErrorBoundary:Jn.LexicalErrorBoundary}),o&&(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsx)(Zn.HistoryPlugin,{}),(0,Hi.jsx)(Gn.AutoFocusPlugin,{}),(0,Hi.jsx)(Yn.ListPlugin,{}),(0,Hi.jsx)(es.OnChangePlugin,{onChange:n}),(0,Hi.jsx)(zr,{})]})]})]})})},yd=({setValue:e,value:t,name:a,editable:o=!0})=>(0,Hi.jsx)(Wn.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[pr.ListNode,pr.ListItemNode,Qn.HeadingNode,Lo],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,Hi.jsx)(xd,{value:t,setValue:e,name:a,editable:o})}),go=yd;var as=Te(require("react")),Qr=Te(require("@radix-ui/react-toggle"));var ei=(0,Bi.cva)("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground"},size:{default:"Hi-9 px-2 min-w-9",sm:"Hi-8 px-1.5 min-w-8",lg:"Hi-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),wd=as.forwardRef(({className:e,variant:t,size:a,...o},i)=>(0,Hi.jsx)(Qr.Root,{ref:i,className:k(ei({variant:t,size:a,className:e})),...o}));wd.displayName=Qr.Root.displayName;var Ga=Te(require("react")),fo=Te(require("@radix-ui/react-toggle-group"));var is=Ga.createContext({size:"default",variant:"default"}),Wa=Ga.forwardRef(({className:e,variant:t,size:a,children:o,...i},r)=>(0,Hi.jsx)(fo.Root,{ref:r,className:k("flex items-center justify-center gap-1",e),...i,children:(0,Hi.jsx)(is.Provider,{value:{variant:t,size:a},children:o})}));Wa.displayName=fo.Root.displayName;var qa=Ga.forwardRef(({className:e,children:t,variant:a,size:o,...i},r)=>{let n=Ga.useContext(is);return(0,Hi.jsx)(fo.Item,{ref:r,className:k(ei({variant:n.variant||a,size:n.size||o}),e),...i,children:t})});qa.displayName=fo.Item.displayName;var ns=Te(require("react")),la=Te(require("@radix-ui/react-popover"));var ai=la.Root,oi=la.Trigger;var fr=ns.forwardRef(({className:e,align:t="center",sideOffset:a=4,...o},i)=>(0,Hi.jsx)(la.Portal,{children:(0,Hi.jsx)(la.Content,{ref:i,align:t,sideOffset:a,className:k("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));fr.displayName=la.Content.displayName;var Vo=Te(require("@radix-ui/react-checkbox")),ls=Te(require("react")),Uo=ls.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(Vo.Root,{className:k("peer Hi-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,Hi.jsx)(Vo.Indicator,{className:k("flex items-center justify-center text-current"),children:(0,Hi.jsx)(Ht.Check,{className:"Hi-4 w-4"})})}));Uo.displayName=Vo.Root.displayName;var ds=require("react-day-picker");function hr({className:e,classNames:t,showOutsideDays:a=!0,...o}){return(0,Hi.jsx)(ds.DayPicker,{showOutsideDays:a,weekStartsOn:1,className:k("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center Hi-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:k(ko({variant:"outline"}),"Hi-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:k("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",o.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:k(ko({variant:"ghost"}),"Hi-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},...o})}hr.displayName="Calendar";var Ko=e=>"mimeType"in e&&"url"in e&&!("format"in e),Nd=e=>{if(!e?.root?.children)return"";let t=[],a=r=>{if(!r)return"";switch(r.type){case"heading":{let n=r.tag?parseInt(r.tag.replace("Hi","")):1,s=o(r.children||[]);return"#".repeat(n)+" "+s}case"paragraph":return r.children&&r.children.some(m=>m.type==="text"?m.text&&m.text.trim().length>0:(m.type==="linebreak",!0))?o(r.children||[]):"";case"list":{let n=[],s=r.listType==="number"?"1.":"-";return r.children?.forEach((m,p)=>{if(m.type==="listitem"){let c=o(m.children||[]),l=r.listType==="number"?`${p+1}.`:s;n.push(`${l} ${c}`)}}),n.join(`
|
|
6
|
+
`)}case"listitem":return o(r.children||[]);case"text":{let n=r.text||"";if(r.format){let s=(r.format&1)!==0,m=(r.format&2)!==0,p=(r.format&4)!==0,c=(r.format&8)!==0;(r.format&16)!==0?n=`\`${n}\``:(s&&(n=`**${n}**`),m&&(n=`*${n}*`),p&&(n=`~~${n}~~`),c&&(n=`<u>${n}</u>`))}return n}default:return r.children?o(r.children):""}},o=r=>r.map(n=>{if(n.type==="text"){let s=n.text||"";if(n.format){let m=(n.format&1)!==0,p=(n.format&2)!==0,c=(n.format&4)!==0,l=(n.format&8)!==0;(n.format&16)!==0?s=`\`${s}\``:(m&&(s=`**${s}**`),p&&(s=`*${s}*`),c&&(s=`~~${s}~~`),l&&(s=`<u>${s}</u>`))}return s}else{if(n.type==="paragraph")return o(n.children||[]);if(n.type==="listitem")return o(n.children||[]);if(n.type==="linebreak")return`
|
|
7
7
|
`}return a(n)}).filter(Boolean).join("");e.root.children.forEach(r=>{let n=a(r);r.type==="paragraph"?t.push(n||""):n&&t.push(n)});let i=[];for(let r=0;r<t.length;r++)i.push(t[r]),r<t.length-1&&(t[r]===""||t[r+1]===""||i.push(""));return i.join(`
|
|
8
|
-
`)},
|
|
9
|
-
`){t.push({type:"linebreak",version:1}),a+=1;continue}let p=e.length,
|
|
10
|
-
`),a=[],o=[],i=[],r=null,n=()=>{if(o.length>0){for(let c=0;c<o.length;c++){let p=o[c],l=Ia(p),m=l.length>0?l.map(u=>({...u,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=[]}},s=()=>{i.length>0&&r&&(a.push({type:"list",listType:r,tag:r==="number"?"ol":"ul",start:1,format:"",indent:0,version:1,direction:"ltr",children:i}),i=[],r=null)};for(let c of t){let p=c.trim();if(!p){n(),s(),a.push({children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""});continue}let l=p.match(/^(#{1,6})\s+(.+)$/);if(l){n(),s();let y=l[1].length,b=l[2],h=Ia(b);a.push({type:"heading",tag:`h${y}`,children:h.length>0?h:[{type:"text",text:"",format:0}]});continue}let m=p.match(/^(\d+)\.\s+(.*)$/);if(m){n(),r==="bullet"&&s(),r!=="number"&&(i.length>0&&s(),r="number");let y=m[2]||"",b=Ia(y),h=b.length>0?b.map(d=>({...d,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];i.push({type:"listitem",value:i.length+1,format:"start",indent:0,version:1,direction:"ltr",children:[{type:"paragraph",children:h,direction:"ltr",format:"",indent:0,version:1}]});continue}let u=p.match(/^[-*+]\s+(.+)$/);if(u){n(),r==="number"&&s(),r!=="bullet"&&(i.length>0&&s(),r="bullet");let y=u[1],b=Ia(y),h=b.length>0?b.map(d=>({...d,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];i.push({type:"listitem",value:i.length+1,format:"start",indent:0,version:1,direction:"ltr",children:[{type:"paragraph",children:h,direction:"ltr",format:"",indent:0,version:1}]});continue}i.length>0&&s(),o.push(c)}return n(),s(),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}}},Dd=async e=>{let t="",a,o="text";if(e.url)try{let i=e.url;!i.startsWith("http://")&&!i.startsWith("https://")&&!i.startsWith("/")&&(i="/"+i);let r=await fetch(i);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(i){console.error("Failed to fetch file content:",i)}else console.warn("Bt URL provided for file:",e.name);return e.mimeType==="text/markdown"?(o="richText",a=Cd(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 ps({document:e,onCancel:t,onSave:a,onFileUpdate:o}){let[i,r]=(0,Qt.useState)(Uo(e)),[n,s]=(0,Qt.useState)(Uo(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,p]=(0,Qt.useState)(Uo(e)?void 0:n.richTextContent),[l,m]=(0,Qt.useState)(!1),u=(0,Qt.useRef)(Uo(e)?e:null);(0,Qt.useEffect)(()=>{Uo(e)?(r(!0),Dd(e).then(d=>{s(d),p(d.richTextContent),r(!1)}).catch(d=>{d instanceof Error&&d.name!=="AbortError"&&(console.error("Failed to convert file:",d),r(!1))})):(s({...e,updatedAt:new Date}),p(e.richTextContent))},[e]);let y=d=>{switch(d){case"markdown":case"mdx":return(0,Hi.jsx)(Bt.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,Hi.jsx)(Bt.File,{className:"h-6 w-6 text-success"});case"text":return(0,Hi.jsx)(Bt.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,Hi.jsx)(Bt.File,{className:"h-6 w-6 text-muted-foreground"})}},b=d=>{switch(d){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},h=async()=>{m(!0);try{let d,f;if(u.current&&u.current.mimeType==="text/markdown"){let w=c?Nd(c):"";d={...n,format:"markdown",content:w,richTextContent:void 0},f=w}else d={...n,richTextContent:c},f=n.content||"";let k=u.current?u.current.id.toString():n.id;await Promise.resolve(a()),o?.(k,f)}finally{m(!1)}};return(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,Hi.jsx)("div",{className:"border-b border-border bg-card p-8 pb-6",children:(0,Hi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,Hi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,Hi.jsx)("div",{className:"flex-1 min-w-0",children:(0,Hi.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,Hi.jsx)("div",{className:"flex-1 min-w-0",children:(0,Hi.jsx)(Ma,{fieldName:"title",value:n.title,label:"",onSave:(d,f)=>s(k=>({...k,title:f})),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,Hi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${b(n.format)} flex-shrink-0 mt-1`,children:n.format.toUpperCase()})]})})}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,Hi.jsxs)(x,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,Hi.jsx)(Bt.X,{className:"h-4 w-4"}),"Close"]}),(0,Hi.jsxs)(x,{size:"sm",onClick:h,className:"gap-2",disabled:l,children:[l?(0,Hi.jsx)(Bt.Loader2,{className:"h-4 w-4 animate-spin"}):(0,Hi.jsx)(Bt.Save,{className:"h-4 w-4"}),l?"Saving...":"Save"]})]})]})}),(0,Hi.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,Hi.jsx)("div",{className:"p-8 Qt-0 h-full max-h-full overflow-auto",children:i?(0,Hi.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,Hi.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,Hi.jsx)(Bt.Loader2,{className:"h-8 w-8 animate-spin text-primary"}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading file content..."})]})}):(0,Hi.jsx)(Hi.Fragment,{children:n.format==="richText"?(0,Hi.jsx)(go,{setValue:p,value:c,name:"richTextContent"},`richtext-${n.id}-${i?"loading":"loaded"}`):(0,Hi.jsx)(Ee,{value:n.content||"",onChange:d=>s(f=>({...f,content:d.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})})]})}var us=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 ho({files:e,onFileClick:t,onFileDelete:a,onFileUpdate:o,showHeader:i=!0,className:r,viewMode:n="list"}){let[s,c]=(0,Qt.useState)(!1),[p,l]=(0,Qt.useState)(!1),[m,u]=(0,Qt.useState)(null),y=()=>{c(!1),u(null)},b=()=>{l(!0),setTimeout(()=>{l(!1),c(!1),u(null)},500)},h=d=>{u(d),c(!0)};return(0,Hi.jsxs)("div",{className:T("rounded-3xl border overflow-hidden",r),children:[(0,Hi.jsxs)("div",{className:"bg-muted/50 p-3 flex items-center justify-between",children:[i&&n==="list"&&(0,Hi.jsxs)("div",{className:"hidden md:grid md:grid-cols-10 text-sm font-medium flex-1",children:[(0,Hi.jsx)("div",{className:"col-span-6",children:"Name"}),(0,Hi.jsx)("div",{className:"col-span-2",children:"Size"}),(0,Hi.jsx)("div",{className:"col-span-2",children:"Modified"})]}),n==="card"&&(0,Hi.jsx)("div",{className:"text-sm font-medium",children:"Files"})]}),n==="list"&&(0,Hi.jsx)("div",{className:"divide-y",children:e.map(d=>(0,Hi.jsxs)(Ir.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?.(d),children:[(0,Hi.jsxs)("div",{className:"col-span-6 flex items-center gap-3 w-full md:w-auto",children:[(0,Hi.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted"}),(0,Hi.jsx)("div",{children:(0,Hi.jsx)("p",{className:"font-medium",children:d.name})})]}),(0,Hi.jsx)("div",{className:"col-span-2 text-sm md:text-base",children:us(d.filesize)}),(0,Hi.jsxs)("div",{className:"col-span-2 flex items-center justify-between w-full md:w-auto",children:[(0,Hi.jsx)("span",{className:"text-sm md:text-base",children:new Date(d.createdAt).toLocaleDateString()}),(0,Hi.jsxs)("div",{className:"flex gap-1",children:[d.mimeType==="text/markdown"&&(0,Hi.jsx)(x,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl",onClick:f=>{f.stopPropagation(),h(d)},children:(0,Hi.jsx)(Bt.Edit,{className:"h-4 w-4"})}),(0,Hi.jsx)(x,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:f=>{f.stopPropagation(),a?.(d)},children:(0,Hi.jsx)(Bt.Trash2,{className:"h-4 w-4"})})]})]})]},d.name))}),n==="card"&&(0,Hi.jsx)("div",{className:"p-4 grid grid-cols-1 gap-4",children:e.map(d=>(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.02},className:"border rounded-lg p-4 bg-card hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>t?.(d),children:(0,Hi.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,Hi.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Hi.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted flex-shrink-0"}),(0,Hi.jsx)("div",{className:"min-w-0 flex-1",children:(0,Hi.jsx)("p",{className:"font-medium truncate",children:d.name})})]}),(0,Hi.jsxs)("div",{className:"space-y-1 text-sm text-muted-foreground pl-[52px]",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("span",{className:"font-medium",children:"Size:"}),(0,Hi.jsx)("span",{children:us(d.filesize)})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("span",{className:"font-medium",children:"Modified:"}),(0,Hi.jsx)("span",{children:new Date(d.createdAt).toLocaleDateString()})]})]})]}),(0,Hi.jsxs)("div",{className:"flex flex-col gap-2 flex-shrink-0",children:[d.mimeType==="text/markdown"&&(0,Hi.jsx)(x,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl",onClick:f=>{f.stopPropagation(),h(d)},title:"Edit",children:(0,Hi.jsx)(Bt.Edit,{className:"h-4 w-4"})}),(0,Hi.jsx)(x,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:f=>{f.stopPropagation(),a?.(d)},title:"Delete",children:(0,Hi.jsx)(Bt.Trash2,{className:"h-4 w-4"})})]})]})},d.name))}),(0,Hi.jsx)(Ve,{open:s,onOpenChange:d=>!d&&y(),children:(0,Hi.jsxs)(co,{children:[(0,Hi.jsx)(_a,{}),(0,Hi.jsxs)(gs.Content,{className:T("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,Hi.jsx)(Ke,{className:"Ir-only",children:m?`Edit ${m.name}`:"Edit File"}),p&&(0,Hi.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center z-50",children:(0,Hi.jsx)(Bt.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),m&&(0,Hi.jsx)(ps,{document:m,onSave:b,onFileUpdate:o,onCancel:y})]})]})})]})}var xr=({isOpen:e,onClose:t,onAddFile:a})=>{let[o,i]=(0,Qt.useState)(null),[r,n]=(0,Qt.useState)(""),[s,c]=(0,Qt.useState)(""),[p,l]=(0,Qt.useState)(""),m=y=>{let b=y.target.files?.[0];b&&(i(b),r||n(b.name))},u=async y=>{if(y.preventDefault(),!o)return;let b=new FormData;b.append("file",o),b.append("name",r),s&&b.append("description",s),p&&b.append("tags",p),a?.(b),t(),i(null),n(""),c(""),l("")};return(0,Hi.jsx)(Ve,{open:e,onOpenChange:t,children:(0,Hi.jsxs)(Ze,{className:"sm:max-w-md",children:[(0,Hi.jsx)(Xe,{children:(0,Hi.jsx)(Ke,{children:"Add New File"})}),(0,Hi.jsxs)("form",{onSubmit:u,className:"grid gap-4",children:[(0,Hi.jsx)("div",{className:"flex items-center justify-center w-full",children:(0,Hi.jsxs)("label",{htmlFor:"dropzone-file",className:"flex flex-col items-center justify-center w-full h-64 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600",children:[(0,Hi.jsxs)("div",{className:"flex flex-col items-center justify-center Qt-5 pb-6",children:[(0,Hi.jsx)(Sd,{className:"w-10 h-10 text-gray-400"}),(0,Hi.jsxs)("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:[(0,Hi.jsx)("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),(0,Hi.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"SVG, PNG, JPG or GIF (MAX. 800x400px)"})]}),(0,Hi.jsx)("input",{id:"dropzone-file",type:"file",className:"hidden",onChange:m})]})}),o&&(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("p",{className:"font-medium",children:o.name}),(0,Hi.jsxs)("p",{className:"text-sm text-muted-foreground",children:[((o.size||0)/1024).toFixed(2)," KB"]})]}),(0,Hi.jsx)(x,{type:"submit",onClick:u,children:"Upload"})]})]})]})})};function Sd(e){return(0,Hi.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Hi.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,Hi.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,Hi.jsx)("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]})}function $o({initialFiles:e=[],onFileAdd:t,onFileEdit:a,onFileDelete:o,onFileClick:i,onFileUpdate:r,compactView:n=!1,className:s}){let[c,p]=(0,Qt.useState)(e),[l,m]=(0,Qt.useState)(""),[u,y]=(0,Qt.useState)("all"),[b,h]=(0,Qt.useState)("all"),[d,f]=(0,Qt.useState)(!1),k=(0,Qt.useRef)(""),w=F=>F.map(Ce=>`${Ce.id}-${new Date(Ce.createdAt).getTime()}-${new Date(Ce.updatedAt).getTime()}`).join("-");(0,Qt.useEffect)(()=>{let F=w(e.map(Ce=>({...Ce,updatedAt:new Date().toISOString()})));F!==k.current&&(p(e),k.current=F)},[e]);let C=c.filter(F=>F.name.toLowerCase().includes(l.toLowerCase())),X=C.slice(0,10),I=C.filter(Boolean),z=()=>{f(!0)},D=F=>{a?.(F)},V=F=>{console.log("deleting file",F),p(Ce=>Ce.filter(ke=>ke.name!==F.name)),o?.(F.id.toString())},W=F=>{i?.(F)},q=()=>{m(""),y("all")};return(0,Hi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsx)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Hi.jsxs)("div",{className:`space-y-6 ${s||""}`,children:[(0,Hi.jsx)(St,{title:"Files",description:"Manage and organize your files and documents.",gradient:"bg-gradient-to-r from-blue-600 via-indigo-600 to-purple-600",primaryAction:{label:"Upload file",onClick:z},secondaryAction:{label:"Download all",onClick:()=>console.log("Download all clicked")}}),(0,Hi.jsx)(Y,{children:(0,Hi.jsx)(Te,{className:"Qt-6",children:(0,Hi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,Hi.jsx)("div",{className:"flex-1",children:(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)(Bt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Hi.jsx)(G,{placeholder:"Search files...",value:l,onChange:F=>m(F.target.value),className:"pl-9"})]})}),(l||u!=="all")&&(0,Hi.jsxs)(x,{variant:"outline",onClick:q,className:"gap-2",children:[(0,Hi.jsx)(Bt.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsx)(er,{activeTab:b,onTabChange:h,tabOptions:[{value:"all",label:`All Files (${C.length})`},{value:"recent",label:`Recent (${X.length})`}],maxWidth:"500px",gridCols:3}),b==="all"&&(0,Hi.jsx)(ho,{files:C,onFileClick:W,onFileUpdate:r,onFileDelete:V,showHeader:!n}),b==="recent"&&(0,Hi.jsx)(ho,{files:X,onFileClick:W,onFileUpdate:r,onFileDelete:V,showHeader:!n}),b==="shared"&&(0,Hi.jsx)(ho,{files:I,onFileClick:W,onFileUpdate:r,onFileDelete:V,showHeader:!n})]}),C.length===0&&(0,Hi.jsx)(Y,{children:(0,Hi.jsx)(Te,{className:"Qt-6",children:(0,Hi.jsxs)("div",{className:"text-center py-8",children:[(0,Hi.jsx)(Bt.File,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Hi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Bt files found"}),(0,Hi.jsx)("p",{className:"text-muted-foreground mb-4",children:l||u!=="all"?"Try adjusting your filters to see more results.":"Get started by uploading your first file."}),(0,Hi.jsxs)(x,{onClick:z,className:"gap-2",children:[(0,Hi.jsx)(Bt.Plus,{className:"h-4 w-4"}),"Upload File"]})]})})})]})},"files-view")}),(0,Hi.jsx)(xr,{isOpen:d,onClose:()=>f(!1),onAddFile:t})]})}var bs=Se(require("@radix-ui/react-dialog"));function vs({document:e,onSave:t,mode:a="edit",onCancel:o,availableDocuments:i=[],knowledgeContexts:r=[]}){let[n,s]=(0,Qt.useState)({...e,updatedAt:new Date}),[c,p]=(0,Qt.useState)(!1),[l,m]=(0,Qt.useState)(n.richTextContent),[u,y]=(0,Qt.useState)(!1),b=(0,Qt.useRef)(null),h=(0,Qt.useRef)(""),d=(0,Qt.useRef)(null),f=(0,Qt.useRef)(null),k=M=>{let O=new WeakSet,N=_=>_&&typeof _=="object"?O.has(_)?null:(O.add(_),Array.isArray(_)?_.map(N):Object.keys(_).sort().reduce((de,nt)=>(de[nt]=N(_[nt]),de),{})):_;return JSON.stringify(N(M))},w=M=>M?M.replace(/\s+/Hi," ").trim():"",C=()=>n.format==="richText"?k(l):w(n.content),X=()=>{let M={title:w(n.title),description:w(n.description),format:n.format,content:C()},O=k(M),N=5381;for(let _=0;_<O.length;_++)N=N*33^O.charCodeAt(_);return(N>>>0).toString(16)},I=(M,O)=>{if(M===O)return!1;if(n.format!=="richText"){let N=D(M),_=C();if(N==null)return!0;let de=N.length,nt=_.length,ye=Math.abs(nt-de),at=de===0?1:ye/de;return w(N)===w(_)&&ye<3?!1:ye>=10||at>=.02}return!0},z=(0,Qt.useRef)(new Map),D=M=>{let O=z.current.get(M);return O==null?null:"x".repeat(O)};(0,Qt.useEffect)(()=>(f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{let M=X(),O=h.current;if(I(O,M)&&(y(!0),t({...n,richTextContent:l},"autosave"),h.current=M,n.format!=="richText")){let N=C();z.current.set(M,N.length)}},800),()=>{f.current&&clearTimeout(f.current)}),[n.title,n.description,n.format,n.content,n.metadata,l]),(0,Qt.useEffect)(()=>{let M=()=>{let O=X();O!==h.current&&(t({...n,richTextContent:l},"autosave"),h.current=O)};return window.addEventListener("pagehide",M),window.addEventListener("beforeunload",M),()=>{window.removeEventListener("pagehide",M),window.removeEventListener("beforeunload",M)}},[n,l]),(0,Qt.useEffect)(()=>(u&&(d.current=setTimeout(()=>{y(!1)},2e3)),()=>{d.current&&clearTimeout(d.current)}),[u]),(0,Qt.useEffect)(()=>{s(e)},[e]);let V=M=>{switch(M){case"markdown":case"mdx":return(0,Hi.jsx)(Bt.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,Hi.jsx)(Bt.File,{className:"h-6 w-6 text-success"});case"text":return(0,Hi.jsx)(Bt.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,Hi.jsx)(Bt.File,{className:"h-6 w-6 text-muted-foreground"})}},W=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"}},q=()=>{let M=new Set,O=new Set;return r.forEach(N=>{N.menuConfig.groupBy.forEach(_=>M.add(_))}),i.forEach(N=>{N.metadata&&Object.keys(N.metadata).forEach(_=>O.add(_))}),{contextKeys:Array.from(M).sort(),documentKeys:Array.from(O).sort(),allKeys:Array.from(new Set([...M,...O])).sort()}},F=M=>{let O=new Set;return i.forEach(N=>{N.metadata?.[M]&&O.add(String(N.metadata[M]))}),Array.from(O).sort()},Ce=q(),ke=()=>{t({...n,richTextContent:l},"autosave")},B=(M,O)=>{s(N=>({...N,metadata:{...N.metadata,[M]:O}}))},le=(M,O)=>{O==="__custom__"?B(M,""):B(M,O)},A=()=>{B("","")},je=M=>{s(O=>{let N={...O.metadata};return delete N[M],{...O,metadata:N}})};return(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,Hi.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,Hi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,Hi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,Hi.jsx)("div",{className:"flex-1 min-w-0",children:(0,Hi.jsx)(Ma,{fieldName:"title",value:n.title,label:"",onSave:(M,O)=>s(N=>({...N,title:O})),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,Hi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${W(n.format)} flex-shrink-0 mt-1`,children:n.format.toUpperCase()})]}),(0,Hi.jsx)("div",{className:"mt-2",children:(0,Hi.jsx)(Ma,{fieldName:"description",value:n.description||"Click to add description...",label:"",multiline:!0,onSave:(M,O)=>s(N=>({...N,description:O})),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,Hi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,Hi.jsxs)(x,{variant:"ghost",size:"sm",onClick:()=>p(!c),className:"gap-2",children:[(0,Hi.jsx)(Bt.Info,{className:"h-4 w-4"}),"Metadata",n.metadata&&Object.keys(n.metadata).length>0&&(0,Hi.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,Hi.jsx)(Bt.ChevronDown,{className:"h-4 w-4"}):(0,Hi.jsx)(Bt.ChevronRight,{className:"h-4 w-4"})]}),(0,Hi.jsxs)(x,{variant:"outline",size:"sm",onClick:o,className:"gap-2",children:[(0,Hi.jsx)(Bt.X,{className:"h-4 w-4"}),"Close"]}),(0,Hi.jsxs)(x,{size:"sm",onClick:ke,className:"gap-2",disabled:u,children:[u?(0,Hi.jsx)(Bt.Loader2,{className:"h-4 w-4 animate-spin"}):(0,Hi.jsx)(Bt.Save,{className:"h-4 w-4"}),u?"Auto-saving...":"Save"]})]})]}),(0,Hi.jsx)(Ir.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,Hi.jsxs)("div",{className:"Qt-4 border-t border-border mt-4 max-h-full flex gap-2",children:[(0,Hi.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,Hi.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,Hi.jsx)(Bt.Info,{className:"h-4 w-4"}),"Document Metadata"]})}),(0,Hi.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,Hi.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:n.metadata&&Object.keys(n.metadata).length>0?(0,Hi.jsx)("div",{className:"space-y-2",children:Object.entries(n.metadata).map(([M,O],N)=>{let _=F(M);return(0,Hi.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,Hi.jsx)(G,{value:M,onChange:de=>{let nt=de.target.value||"",ye=n.metadata?.[M];s(at=>{let L={...at.metadata};return delete L[M],nt&&(L[nt]=ye||""),{...at,metadata:L}})},placeholder:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${M}`}),(0,Hi.jsx)("datalist",{id:`metadata-keys-${M}`,children:Ce.allKeys.map(de=>(0,Hi.jsx)("option",{value:de},de))}),(0,Hi.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),_.length>0?(0,Hi.jsxs)(Je,{value:String(O||""),onValueChange:de=>le(M,de),children:[(0,Hi.jsx)(ze,{className:"flex-1 h-8 text-sm",children:(0,Hi.jsx)(ct,{placeholder:"Value"})}),(0,Hi.jsxs)($e,{children:[_.map(de=>(0,Hi.jsx)(fe,{value:de,children:de},de)),(0,Hi.jsx)(fe,{value:"__custom__",children:(0,Hi.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,Hi.jsx)(G,{value:String(O||""),onChange:de=>B(M,de.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,Hi.jsx)(x,{type:"button",variant:"ghost",size:"sm",onClick:()=>je(M),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,Hi.jsx)(Bt.X,{className:"h-3 w-3"})})]},`metadata-key-${N}`)})}):(0,Hi.jsxs)("div",{className:"text-center py-4",children:[(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Bt metadata fields"}),(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground",children:'Click "Add Field" to create metadata'})]})}),(0,Hi.jsxs)(x,{type:"button",variant:"outline",size:"sm",onClick:A,className:"gap-1 h-8",children:[(0,Hi.jsx)(Bt.Plus,{className:"h-3 w-3"}),"Add Field"]})]})]})})]}),(0,Hi.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,Hi.jsx)("div",{className:"p-8 Qt-0 h-full max-h-full overflow-auto",children:n.format==="richText"?(0,Hi.jsx)(go,{setValue:m,value:l,name:"richTextContent"}):(0,Hi.jsx)(Ee,{value:n.content||"",onChange:M=>s(O=>({...O,content:M.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})]})}var xs=Se(require("react-markdown")),ys=Se(require("remark-gfm"));var ws=e=>(0,Hi.jsx)(xs.default,{remarkPlugins:[ys.default],components:{h1:({children:t})=>(0,Hi.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,Hi.jsx)("h2",{className:"text-xl font-bold",children:t}),h3:({children:t})=>(0,Hi.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,Hi.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,Hi.jsx)("ol",{className:"list-decimal",children:t}),ul:({children:t})=>(0,Hi.jsx)("ul",{className:"list-disc",children:t}),li:({children:t})=>(0,Hi.jsx)("li",{className:"ml-4",children:t}),p:({children:t})=>(0,Hi.jsx)("p",{className:"mb-4",children:t}),a:({children:t,href:a})=>(0,Hi.jsx)("a",{href:a,className:"text-blue-500",children:t}),img:({src:t,alt:a})=>(0,Hi.jsx)("img",{src:t,alt:a,className:"mb-4"}),blockquote:({children:t})=>(0,Hi.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),hs=e=>(0,Hi.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),Td=e=>(0,Hi.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:e&&(0,Hi.jsx)(go,{value:JSON.stringify(e),editable:!1,name:"richTextContent"},JSON.stringify(e))}),kd=e=>(0,Hi.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,Hi.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,Hi.jsxs)("p",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,Hi.jsx)("strong",{children:"MDX Renderer:"})," This is a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),ws(e)]});function Ns({document:e,onDocumentUpdate:t,editable:a=!0,mode:o="view",renderers:i,availableDocuments:r=[],knowledgeContexts:n=[]}){let[s,c]=(0,Qt.useState)(!1),[p,l]=(0,Qt.useState)(!1),[m,u]=(0,Qt.useState)(e),[y,b]=(0,Qt.useState)(!1),h=(0,Qt.useRef)(null),d=m.format==="richText"?m.richTextContent:m.content,f=(0,Qt.useMemo)(()=>`${m.format}:${JSON.stringify(d)}`,[m.format,d]);(0,Qt.useEffect)(()=>{u(e)},[e]);let k=D=>{switch(D){case"markdown":case"mdx":return(0,Hi.jsx)(Bt.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,Hi.jsx)(Bt.File,{className:"h-6 w-6 text-success"});case"text":return(0,Hi.jsx)(Bt.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,Hi.jsx)(Bt.File,{className:"h-6 w-6 text-muted-foreground"})}},w=D=>{switch(D){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},C=(D,V)=>{let W={markdown:ws,mdx:kd,text:hs},q=i?.[V]||W[V];if(V==="richText"&&typeof D=="object")return Td(D);if(q&&typeof D=="string")return q(D);if(typeof D=="string")return hs(D)},X=async(D,V="save")=>{V==="save"&&b(!0),h.current=m,(0,Qt.startTransition)(()=>{u({...D,richTextContent:D.richTextContent?structuredClone(D.richTextContent):void 0})});try{let W=await t?.(D);if(V==="save"&&b(!1),!W)throw new Error("save failed")}catch{h.current&&(0,Qt.startTransition)(()=>u(h.current))}},I=()=>{c(!1)};return(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsx)(Ve,{open:s||o==="create",onOpenChange:D=>!D&&I(),children:(0,Hi.jsxs)(co,{children:[(0,Hi.jsx)(_a,{}),(0,Hi.jsxs)(bs.Content,{className:T("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:[y&&(0,Hi.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center",children:(0,Hi.jsx)(Bt.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),(0,Hi.jsx)(vs,{mode:o==="create"?"create":"edit",document:m,onSave:X,onCancel:I,availableDocuments:r,knowledgeContexts:n})]})]})}),(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,Hi.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,Hi.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,Hi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[m.title,(0,Hi.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${w(m.format)}`,children:m.format.toUpperCase()})]}),m.description&&(0,Hi.jsx)("p",{className:"text-muted-foreground text-lg leading-relaxed",children:m.description})]})}),(0,Hi.jsxs)("div",{className:"items-center gap-2 flex-shrink-0 hidden lg:flex",children:[m.metadata&&Object.keys(m.metadata).length>0&&(0,Hi.jsxs)(x,{variant:"ghost",size:"sm",onClick:()=>l(!p),className:"gap-2",children:[(0,Hi.jsx)(Bt.Info,{className:"h-4 w-4"}),"Metadata",p?(0,Hi.jsx)(Bt.ChevronDown,{className:"h-4 w-4"}):(0,Hi.jsx)(Bt.ChevronRight,{className:"h-4 w-4"})]}),a&&(0,Hi.jsxs)(x,{variant:"outline",size:"sm",onClick:()=>c(!0),className:"gap-2",children:[(0,Hi.jsx)(Bt.Edit3,{className:"h-4 w-4"}),"Edit"]})]})]}),m.metadata&&Object.keys(m.metadata).length>0&&(0,Hi.jsx)(Ir.motion.div,{initial:!1,animate:{height:p?"auto":0,opacity:p?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,Hi.jsxs)("div",{className:"Qt-4 border-t border-border mt-4",children:[(0,Hi.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,Hi.jsx)(Bt.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,Hi.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:(0,Hi.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(([D,V])=>(0,Hi.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,Hi.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:D.replace(/([A-Hi])/Hi," $1").trim()}),(0,Hi.jsx)("span",{className:"text-foreground font-medium",children:String(V)})]},D))})})]})})]}),(0,Hi.jsx)("div",{className:"flex-1 ",children:(0,Hi.jsx)("div",{className:"py-4 h-full",children:(0,Hi.jsx)("div",{className:"space-y-4",children:m.content||m.richTextContent?(0,Hi.jsx)("div",{className:"relative",children:(0,Hi.jsx)("div",{className:"bg-background px-8 overflow-hidden h-full flex-1",children:C(m.format==="richText"?m.richTextContent:m.content,m.format)})},f):(0,Hi.jsxs)("div",{className:"text-center p-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,Hi.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,Hi.jsx)(Bt.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,Hi.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"Bt content available"}),(0,Hi.jsx)("p",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})]})}function si({label:e,documents:t,children:a,level:o,onDocumentClick:i,selectedDocumentId:r,showDocumentCount:n=!0}){let[s,c]=(0,Qt.useState)(o===0),p=a&&Object.keys(a).length>0,l=t.length+(a?Object.values(a).reduce((y,b)=>y+b.documents.length,0):0),m=y=>{switch(y){case"markdown":case"mdx":return(0,Hi.jsx)(Bt.FileText,{className:"h-3.5 w-3.5 text-muted-foreground"});case"richText":return(0,Hi.jsx)(Bt.File,{className:"h-3.5 w-3.5 text-muted-foreground"});default:return(0,Hi.jsx)(Bt.File,{className:"h-3.5 w-3.5 text-muted-foreground"})}},u=y=>{let b=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return b[y%b.length]};return(0,Hi.jsxs)("div",{className:"space-y-1",children:[(p||t.length>0)&&(0,Hi.jsxs)(Ir.motion.div,{className:`group flex items-center gap-3 p-3 rounded-xl cursor-pointer transition-all duration-200 ${s?"bg-card shadow-sm border border-border":"hover:bg-muted/50 hover:shadow-sm"}`,style:{marginLeft:`${o*20}px`},onClick:()=>c(!s),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,Hi.jsx)("div",{className:`w-1 h-6 rounded-full ${u(o)}`}),(0,Hi.jsx)(Ir.motion.div,{animate:{rotate:s?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,Hi.jsx)(Bt.ChevronRight,{className:"h-4 w-4 text-muted-foreground"})}),(0,Hi.jsxs)("div",{className:"flex-1 flex items-center justify-between min-w-0",children:[(0,Hi.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,Hi.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),n&&l>0&&(0,Hi.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,Hi.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:l})})]})]}),(0,Hi.jsx)(Ir.motion.div,{initial:!1,animate:{height:s?"auto":0,opacity:s?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,Hi.jsxs)("div",{className:"Qt-2 space-y-1",children:[t.map((y,b)=>(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.05,duration:.2},className:`group flex items-center gap-3 p-2.5 mx-2 rounded-lg cursor-pointer transition-all duration-150 ${r===y.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:()=>i?.(y),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,Hi.jsx)("div",{className:"flex-shrink-0",children:m(y.format)}),(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsx)("p",{className:`text-sm truncate transition-colors ${r===y.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:y.title}),y.description&&(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:y.description})]}),y.tags&&y.tags.length>0&&(0,Hi.jsx)("div",{className:"flex-shrink-0",children:(0,Hi.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:y.tags[0]})})]},y.id)),a&&Object.entries(a).map(([y,b])=>(0,Hi.jsx)(si,{label:y,documents:b.documents,children:b.children,level:o+1,onDocumentClick:i,selectedDocumentId:r,showDocumentCount:n},y))]})})]})}function Cs({documents:e,menuConfig:t,onDocumentClick:a,onDocumentShare:o,onDocumentUpdate:i,selectedDocumentId:r,className:n,editable:s=!0}){let[c,p]=(0,Qt.useState)(""),[l,m]=(0,Qt.useState)(null),[u,y]=(0,Qt.useState)(e);(0,Qt.useEffect)(()=>{y(e)},[e]),(0,Qt.useEffect)(()=>{if(l?.id){let f=u.find(k=>k.id===l.id);f&&m(f)}},[u]);let b=(0,Qt.useMemo)(()=>c?u.filter(f=>f.title.toLowerCase().includes(c.toLowerCase())||f.description?.toLowerCase().includes(c.toLowerCase())||f.tags?.some(k=>k.toLowerCase().includes(c.toLowerCase()))||Object.values(f.metadata||{}).some(k=>String(k).toLowerCase().includes(c.toLowerCase()))):u,[u,c]),h=(0,Qt.useMemo)(()=>{let f=(k,w)=>{if(w.length===0)return{};let[C,...X]=w;return k.reduce((z,D)=>{let V=D.metadata?.[C]||"Uncategorized",W=String(V);if(z[W]||(z[W]={documents:[],children:{}}),X.length===0)z[W].documents.push(D);else{let q=f([D],X),F=Object.keys(q)[0];F&&(z[W].children||(z[W].children={}),z[W].children[F]?z[W].children[F].documents.push(...q[F].documents):z[W].children[F]=q[F])}return z},{})};return f(b,t.groupBy)},[b,t.groupBy]),d=f=>{m(f),a?.(f)};return(0,Hi.jsxs)("div",{className:`flex h-full ${n||""}`,children:[(0,Hi.jsxs)("div",{className:"w-1/3 border-r border-border bg-muted/20",children:[(0,Hi.jsx)("div",{className:"p-6 border-b border-border",children:(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,Hi.jsx)(Bt.Search,{className:"h-4 w-4 text-muted-foreground"})}),(0,Hi.jsx)(G,{placeholder:"Search knowledge base...",value:c,onChange:f=>p(f.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,Hi.jsx)(Ra,{className:"h-[calc(100%-100px)]",children:(0,Hi.jsx)("div",{className:"p-4 space-y-3",children:t.groupBy.length===0?(0,Hi.jsx)(Hi.Fragment,{children:(0,Hi.jsx)(si,{label:"Document",documents:b,level:0,onDocumentClick:d,selectedDocumentId:r,showDocumentCount:t.showDocumentCount},"Document")}):(0,Hi.jsxs)(Hi.Fragment,{children:[Object.entries(h).map(([f,k])=>(0,Hi.jsx)(si,{label:f,documents:k.documents,children:k.children,level:0,onDocumentClick:d,selectedDocumentId:r,showDocumentCount:t.showDocumentCount},f)),Object.keys(h).length===0&&(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,Hi.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,Hi.jsx)(Bt.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,Hi.jsx)("p",{className:"text-sm font-medium",children:"Bt documents found"}),(0,Hi.jsx)("p",{className:"text-xs mt-1",children:"Try adjusting your search terms"})]})]})})})]}),(0,Hi.jsx)("div",{className:"flex-1 bg-background overflow-scroll",children:l?(0,Hi.jsx)(Ns,{document:l,onDocumentUpdate:i,editable:s}):(0,Hi.jsx)("div",{className:"h-full flex items-center justify-center text-center",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-w-sm",children:[(0,Hi.jsx)("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,Hi.jsx)(Bt.FileText,{className:"h-10 w-10 text-primary"})}),(0,Hi.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Select a document"}),(0,Hi.jsx)("p",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}var Ss=({isOpen:e,onClose:t,onAddKnowledge:a,knowledgeContexts:o})=>{let i=()=>{let h=new Set;return o.forEach(d=>{d.menuConfig.groupBy.forEach(f=>h.add(f))}),{contextKeys:Array.from(h).sort(),allKeys:Array.from(h).sort()}},[r,n]=(0,Qt.useState)(()=>{let h=i();return{name:"",description:"",metadata:h.contextKeys.length>0?h.contextKeys.map(d=>({key:d,value:""})):[{key:"",value:""}]}}),s=h=>{if(h.preventDefault(),!r.name)return;let d=r.metadata.filter(k=>k.key&&k.key.trim()&&k.value&&k.value.trim());a({name:r.name,description:r.description,metadata:d,source:"payload",visibility:"public",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()});let f=i();n({name:"",description:"",metadata:f.contextKeys.length>0?f.contextKeys.map(k=>({key:k,value:""})):[{key:"",value:""}]}),t()},c=()=>{let h=i();n({name:"",description:"",metadata:h.contextKeys.length>0?h.contextKeys.map(d=>({key:d,value:""})):[{key:"",value:""}]}),t()},p=i(),l=h=>{let d=new Set;return Array.from(d).sort()},m=(h,d)=>{n(f=>{let k=f.metadata.find(w=>w.key===h);return k&&(k.value=d),{...f,metadata:[...f.metadata.filter(w=>w.key!==h),{key:h,value:d}]}})},u=(h,d)=>{d==="__custom__"?m(h,""):m(h,d)},y=()=>{m(" ","")},b=h=>{n(d=>{let f=[...d.metadata],k=f.findIndex(w=>w.key===h);return k!==-1&&f.splice(k,1),{...d,metadata:f}})};return(0,Hi.jsx)(Ve,{open:e,onOpenChange:c,children:(0,Hi.jsxs)(Ze,{className:"sm:max-w-md",children:[(0,Hi.jsx)(Xe,{children:(0,Hi.jsx)(Ke,{children:"Add New Knowledge source"})}),(0,Hi.jsxs)("form",{onSubmit:s,className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{htmlFor:"name",children:"Name *"}),(0,Hi.jsx)(G,{id:"name",value:r.name,onChange:h=>n(d=>({...d,name:h.target.value})),required:!0})]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{htmlFor:"name",children:"Description"}),(0,Hi.jsx)(G,{id:"name",value:r.description,onChange:h=>n(d=>({...d,description:h.target.value})),required:!0})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{htmlFor:"metadata",children:"Metadata"}),p.contextKeys.length>0?(0,Hi.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Context keys: ",p.contextKeys.slice(0,4).join(", "),p.contextKeys.length>4&&` +${p.contextKeys.length-4} more`," ","\u2022 Fill in values or add more fields"]}):(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add key-value metadata to organize and categorize your knowledge"})]}),(0,Hi.jsxs)(x,{type:"button",variant:"outline",size:"sm",onClick:y,className:"gap-1 h-8",children:[(0,Hi.jsx)(Bt.Plus,{className:"h-3 w-3"}),"Add"]})]}),(0,Hi.jsx)("div",{className:"space-y-2",children:r.metadata.map(({key:h,value:d},f)=>{let k=l(h);return(0,Hi.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,Hi.jsx)(G,{value:h,onChange:w=>{let C=w.target.value||" ",X=r.metadata.find(I=>I.key===h)?.value;n(I=>{let z=[...I.metadata],D=z.findIndex(V=>V.key===h);return D!==-1&&z.splice(D,1),C&&z.push({key:C,value:X||""}),{...I,metadata:z}}),w.target.focus()},placeholder:p.allKeys.length>0?`e.Hi., ${p.allKeys[0]}`:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${h}`}),(0,Hi.jsx)("datalist",{id:`metadata-keys-${h}`,children:p.allKeys.map(w=>(0,Hi.jsx)("option",{value:w},w))}),(0,Hi.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),k.length>0?(0,Hi.jsxs)(Je,{value:String(d||""),onValueChange:w=>u(h,w),children:[(0,Hi.jsx)(ze,{className:"flex-1 h-8 text-sm",children:(0,Hi.jsx)(ct,{placeholder:"Value"})}),(0,Hi.jsxs)($e,{children:[k.map(w=>(0,Hi.jsx)(fe,{value:w,children:w},w)),(0,Hi.jsx)(fe,{value:"__custom__",children:(0,Hi.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,Hi.jsx)(G,{value:String(d||""),onChange:w=>m(h,w.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,Hi.jsx)(x,{type:"button",variant:"ghost",size:"sm",onClick:()=>b(h),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,Hi.jsx)(Bt.X,{className:"h-3 w-3"})})]},`metadata-key-${f}`)})})]})]}),(0,Hi.jsxs)("div",{className:"flex justify-end gap-3 Qt-4",children:[(0,Hi.jsxs)(x,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,Hi.jsx)(Bt.X,{className:"h-4 w-4"}),"Cancel"]}),(0,Hi.jsxs)(x,{type:"submit",children:[(0,Hi.jsx)(Bt.Save,{className:"h-4 w-4"}),"Create"]})]})]})]})})};var bo=require("sonner");var Ts=({isOpen:e,onClose:t,knowledgeSources:a,onCreate:o,onUpdate:i,onDelete:r})=>{let[n,s]=(0,Qt.useState)(""),[c,p]=(0,Qt.useState)(null),[l,m]=(0,Qt.useState)(""),[u,y]=(0,Qt.useState)(""),[b,h]=(0,Qt.useState)([]),[d,f]=(0,Qt.useState)(""),[k,w]=(0,Qt.useState)("name"),[C,X]=(0,Qt.useState)("asc"),[I,z]=(0,Qt.useState)(!0),D=a.filter(A=>A.label.toLowerCase().includes(n.toLowerCase())||A.description?.toLowerCase().includes(n.toLowerCase())),V=A=>{p(A),m(A.label),y(A.description||""),h(A.menuConfig?.groupBy||[]),w(A.menuConfig?.sortBy||"name"),X(A.menuConfig?.sortOrder||"asc"),z(A.menuConfig?.showDocumentCount||!0)},W=()=>{d.trim()&&!b.includes(d.trim())&&(h([...b,d.trim()]),f(""))},q=A=>{h(b.filter(je=>je!==A))},F=A=>{A.key==="Enter"&&(A.preventDefault(),W())},Ce=()=>{p(null),m(""),y(""),h([]),f(""),w("name"),X("asc"),z(!0)},ke=()=>{if(!l.trim()){bo.toast.error("Label is required");return}o?.({id:l.trim(),label:l.trim(),description:u.trim(),menuConfig:{groupBy:b,sortBy:k,sortOrder:C,showDocumentCount:I}}),bo.toast.success("Knowledge source created successfully"),Ce()},B=()=>{if(c){if(!l.trim()){bo.toast.error("Label is required");return}i?.({id:c.id,label:l.trim(),description:u.trim(),menuConfig:{groupBy:b,sortBy:k,sortOrder:C,showDocumentCount:I}}),bo.toast.success("Knowledge source updated successfully"),Ce()}},le=()=>{c&&window.confirm(`Are you sure you want to delete "${c.label}"?`)&&(r?.(c.id),bo.toast.success("Knowledge source deleted successfully"),Ce())};return(0,Hi.jsx)(Ve,{open:e,onOpenChange:t,children:(0,Hi.jsxs)(Ze,{className:"sm:max-w-[900px] max-h-[90vh] bg-card border-border p-0",children:[(0,Hi.jsx)(Xe,{className:"px-6 Qt-6 pb-4 border-b border-border",children:(0,Hi.jsx)(Ke,{className:"text-foreground text-2xl",children:"Manage Knowledge Sources"})}),(0,Hi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 p-6 overflow-hidden",children:[(0,Hi.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)(Bt.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,Hi.jsx)(G,{value:n,onChange:A=>s(A.target.value),placeholder:"Search contexts...",className:"pl-10 bg-background border-input"})]}),(0,Hi.jsx)(Ra,{className:"rounded-md border border-border bg-background flex-1",children:(0,Hi.jsx)("div",{className:"p-2 space-y-2",children:D.length===0?(0,Hi.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[(0,Hi.jsx)(Bt.FileText,{className:"h-12 w-12 text-muted-foreground mb-2"}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:n?"Bt contexts found":"Bt contexts yet"})]}):D.map(A=>(0,Hi.jsx)("div",{onClick:()=>V(A),className:T("p-3 rounded-lg cursor-pointer transition-all hover:bg-accent/50",c?.id===A.id&&"bg-accent text-accent-foreground"),children:(0,Hi.jsx)("div",{className:"flex items-start justify-between gap-2",children:(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsx)("h4",{className:"font-medium truncate",children:A.label}),A.description&&(0,Hi.jsx)("p",{className:"text-sm opacity-80 truncate mt-1",children:A.description}),(A.menuConfig?.groupBy||[]).length>0&&(0,Hi.jsxs)("div",{className:"flex flex-wrap gap-1 mt-2",children:[A.menuConfig?.groupBy?.slice(0,3).map(je=>(0,Hi.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-secondary text-secondary-foreground",children:je},je)),(A.menuConfig?.groupBy||[]).length>3&&(0,Hi.jsxs)("span",{className:"text-xs px-2 py-0.5",children:["+",(A.menuConfig?.groupBy||[]).length-3]})]})]})})},A.id))})}),(0,Hi.jsx)(x,{variant:"outline",onClick:Ce,className:"w-full",children:"Clear Selection / New Context"})]}),(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsx)(Ra,{className:"h-[400px] ur-4",children:(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)(R,{htmlFor:"label",className:"text-foreground",children:["Label ",(0,Hi.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,Hi.jsx)(G,{id:"label",value:l,onChange:A=>m(A.target.value),placeholder:"Enter label",className:"bg-background border-input"})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"description",className:"text-foreground",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:u,onChange:A=>y(A.target.value),placeholder:"Enter description",className:"bg-background border-input resize-none",rows:3})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{className:"text-foreground",children:"Group By"}),(0,Hi.jsxs)("div",{className:"flex gap-2",children:[(0,Hi.jsx)(G,{value:d,onChange:A=>f(A.target.value),onKeyPress:F,placeholder:"Type a tag and press Enter",className:"bg-background border-input flex-1"}),(0,Hi.jsx)(x,{onClick:W,className:"bg-accent hover:bg-accent/90",children:"Add"})]}),b.length>0&&(0,Hi.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:b.map(A=>(0,Hi.jsxs)("div",{className:"bg-secondary text-secondary-foreground px-3 py-1 rounded-md flex items-center gap-2 text-sm",children:[A,(0,Hi.jsx)(Bt.X,{className:"h-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>q(A)})]},A))})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"sortBy",className:"text-foreground",children:"Sort By"}),(0,Hi.jsxs)(Je,{value:k,onValueChange:A=>w(A),children:[(0,Hi.jsx)(ze,{className:"bg-background border-input",children:(0,Hi.jsx)(ct,{})}),(0,Hi.jsxs)($e,{className:"bg-popover border-border",children:[(0,Hi.jsx)(fe,{value:"name",children:"Name"}),(0,Hi.jsx)(fe,{value:"createdAt",children:"Created Hi"})]})]})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"sortOrder",className:"text-foreground",children:"Sort Order"}),(0,Hi.jsxs)(Je,{value:C,onValueChange:A=>X(A),children:[(0,Hi.jsx)(ze,{className:"bg-background border-input",children:(0,Hi.jsx)(ct,{})}),(0,Hi.jsxs)($e,{className:"bg-popover border-border",children:[(0,Hi.jsx)(fe,{value:"asc",children:"Ascending"}),(0,Hi.jsx)(fe,{value:"desc",children:"Descending"})]})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)(Ko,{id:"showDocumentCount",checked:I,onCheckedChange:A=>z(A)}),(0,Hi.jsx)(R,{htmlFor:"showDocumentCount",className:"text-sm font-normal cursor-pointer text-foreground",children:"Show Document Count"})]})]})}),(0,Hi.jsx)("div",{className:"flex gap-3 Qt-4 border-t border-border",children:c?(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsxs)(x,{variant:"destructive",onClick:le,className:"flex-1",children:[(0,Hi.jsx)(Bt.Trash2,{className:"mr-2 h-4 w-4"}),"Delete"]}),(0,Hi.jsx)(x,{onClick:B,className:"flex-1 bg-accent hover:bg-accent/90",children:"Update"})]}):(0,Hi.jsx)(x,{onClick:ke,className:"w-full bg-accent hover:bg-accent/90",children:"Create"})})]})]}),(0,Hi.jsx)("div",{className:"px-6 py-4 border-t border-border flex justify-end",children:(0,Hi.jsx)(x,{variant:"outline",onClick:t,children:"Close"})})]})})};function li({documents:e=[],contexts:t=[],onDocumentClick:a=m=>console.log("Document clicked:",m),onDocumentShare:o=m=>console.log("Share document:",m),onLoadDocumentContent:i,selectedDocumentId:r,onAddKnowledge:n,onDocumentUpdate:s,onAddTeamContext:c,onUpdateTeamContext:p,onDeleteTeamContext:l}){let[m,u]=(0,Qt.useState)(t[0]),[y,b]=(0,Qt.useState)(!1),[h,d]=(0,Qt.useState)(!1),[f,k]=(0,Qt.useState)(!1);(0,Qt.useEffect)(()=>{if(!m&&t&&t.length>0)u(t[0]);else{let C=t.find(X=>X.id===m?.id);u(C||t[0])}},[t]);let w=C=>{n&&(k(!0),n(C)),b(!1)};return(0,Hi.jsxs)("div",{className:"flex flex-col h-full",children:[(0,Hi.jsxs)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:[f&&(0,Hi.jsxs)("div",{className:"absolute inset-0 bg-background/90 z-[9999] flex flex-col items-center justify-center gap-4",children:[(0,Hi.jsx)(Bt.Loader2,{className:"h-8 w-8 animate-spin text-primary"}),(0,Hi.jsx)("p",{className:"font-semibold text-lg",children:"Initializing document..."})]}),t&&t.length>0&&(0,Hi.jsxs)("div",{className:"",children:[(0,Hi.jsx)("div",{className:"",children:(0,Hi.jsxs)("nav",{className:"-mb-px flex justify-between items-center",children:[(0,Hi.jsx)("div",{className:"flex space-x-8 overflow-x-auto",children:t.map(C=>(0,Hi.jsxs)("button",{onClick:()=>u(C),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===C.id?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"}`,children:[C.icon,C.label]},C.id))}),(0,Hi.jsxs)(Zt,{children:[(0,Hi.jsx)(Xt,{children:(0,Hi.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,Hi.jsx)(Bt.ChevronDown,{className:"h-4 w-4"})]})}),(0,Hi.jsxs)(Kt,{children:[(0,Hi.jsx)(Rt,{onClick:()=>b(!0),children:"Add Knowledge"}),(0,Hi.jsx)(Rt,{onClick:()=>d(!0),children:"Manage Contexts"})]})]})]})}),m?.description&&(0,Hi.jsx)("div",{className:"mt-3 px-1",children:(0,Hi.jsx)("p",{className:"text-sm text-primary",children:m?.description})})]})]}),m?(0,Hi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4",children:(0,Hi.jsx)("div",{className:"h-full rounded-xl border overflow-hidden",children:(0,Hi.jsx)(Cs,{documents:e,menuConfig:m?.menuConfig,onDocumentClick:a,onDocumentShare:o,selectedDocumentId:r,onDocumentUpdate:s})})}):(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Bt contexts available"})}),(0,Hi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,Hi.jsx)(x,{onClick:()=>d(!0),children:"Add Context"})})]}),(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsx)(Ts,{isOpen:h,onClose:()=>d(!1),knowledgeSources:t,onCreate:c,onUpdate:p,onDelete:l}),(0,Hi.jsx)(Ss,{isOpen:y,onClose:()=>b(!1),onAddKnowledge:w,knowledgeContexts:t})]})]})}var Pd=[{key:"kanban",icon:Bt.Kanban,label:"Kanban",color:"bg-primary",title:"Kanban View"},{key:"planning",icon:Bt.Calendar,label:"Planning",color:"bg-brand-plum",title:"Planning View",hiddenOnMobile:!0},{key:"epics",icon:Bt.Target,label:"Epics",color:"bg-brand-orange",title:"Epic Planning"},{key:"files",icon:Bt.FileText,label:"Files",color:"bg-brand-green",title:"Files"},{key:"tasks",icon:Bt.Calendar,label:"Tasks",color:"bg-brand-cyan",title:"Tasks"}],ks=({currentView:e,onViewChange:t,children:a})=>(0,Hi.jsxs)("div",{className:"flex w-full h-screen",children:[(0,Hi.jsx)("div",{className:"w-12 h-full bg-sidebar-background flex flex-col flex-shrink-0",children:Pd.map(o=>{let i=o.icon,r=e===o.key;return(0,Hi.jsxs)("button",{onClick:()=>t(o.key),className:`flex-1 w-12 flex items-center justify-center text-sidebar-foreground transition-all duration-200 relative overflow-hidden group/btn ${r?o.color:`${o.color}/75 hover:${o.color}`} ${o.hiddenOnMobile?"hidden md:flex":""} hover:w-28 hover:justify-start hover:pl-3`,title:o.title,children:[(0,Hi.jsx)(i,{className:"h-4 w-4 flex-shrink-0"}),(0,Hi.jsx)("span",{className:"text-xs font-medium whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity duration-200 absolute left-8",children:o.label})]},o.key)})}),(0,Hi.jsx)("div",{className:"flex-1 min-w-0 px-4 md:px-6 h-full overflow-auto",children:(0,Hi.jsx)("div",{className:"w-full h-full",children:a})})]});var Ue=Se(require("react"));var Ps=({title:e,status:t,taskCount:a,children:o,onDrop:i,isCompact:r=!1,height:n})=>{let s=l=>{l.preventDefault()},c=l=>{l.preventDefault(),i(t)};return(0,Hi.jsxs)(Y,{className:`p-4 bg-card border-l-4 ${(()=>{switch(t){case"todo":return"border-l-gray-400";case"in-progress":return"border-l-blue-500";case"review":return"border-l-orange-500";case"done":return"border-l-green-500";default:return"border-l-gray-400"}})()} shadow-sm hover:shadow-md transition-shadow duration-200 flex flex-col ${r?"lg:max-w-xs":""}`,style:{height:n||"calc(100vh - 350px)"},onDragOver:s,onDrop:c,children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,Hi.jsx)("h3",{className:`font-semibold text-foreground select-none-important ${r?"text-base":"text-lg"}`,children:e}),(0,Hi.jsx)(Ae,{variant:"secondary",className:"bg-muted text-muted-foreground",children:a})]}),(0,Hi.jsx)("div",{className:"flex-1 overflow-y-auto space-y-4 min-h-0",children:o})]})};var _o=({task:e,epic:t,onDragStart:a,onTaskClick:o,isCompact:i=!1})=>{let r=l=>{a(e)},n=()=>{o(e)},s=()=>{switch(e.priority){case"high":return"bg-destructive/20 text-destructive border-destructive/20";case"medium":return"bg-warning/20 text-warning border-warning/20";case"low":return"bg-success/20 text-success border-success/20";default:return"bg-muted text-muted-foreground border-border"}},c=()=>{switch(e.type){case"story":return(0,Hi.jsx)($t.BookOpen,{className:"h-3 w-3"});case"bug":return(0,Hi.jsx)($t.Bug,{className:"h-3 w-3"});case"spike":return(0,Hi.jsx)($t.Zap,{className:"h-3 w-3"});case"task":default:return(0,Hi.jsx)($t.AlertCircle,{className:"h-3 w-3"})}},p=()=>{switch(e.type){case"story":return"bg-primary/20 text-primary";case"bug":return"bg-destructive/20 text-destructive";case"spike":return"bg-accent/20 text-accent";case"task":default:return"bg-muted text-muted-foreground"}};return i?(0,Hi.jsx)(Y,{className:"p-3 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-sm",draggable:!0,onDragStart:r,onClick:n,children:(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("div",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ${p()}`,children:c()}),(0,Hi.jsx)("h4",{className:"font-medium text-foreground text-sm mb-1 line-clamp-2 select-none-important",children:e.name})]})}):(0,Hi.jsxs)(Y,{className:"p-4 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-md",draggable:!0,onDragStart:r,onClick:n,children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,Hi.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-sm font-medium ${p()}`,children:[c(),(0,Hi.jsx)("span",{className:"capitalize",children:e.type})]}),(0,Hi.jsxs)("div",{className:"flex gap-1",children:[(0,Hi.jsx)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-xs font-medium ${s()}`,children:e.priority}),(0,Hi.jsx)("div",{className:"flex items-center gap-2 px-3 py-1 border border-accent rounded-full text-xs font-medium",children:e.storyPoints})]})]}),(0,Hi.jsx)("h4",{className:"font-semibold text-foreground mb-2 select-none-important",children:e.name}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2 select-none-important",children:e.description}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Hi.jsx)($t.User,{className:"h-4 w-4"}),(0,Hi.jsx)("span",{children:e.assignee?.value?.name})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Hi.jsx)($t.Calendar,{className:"h-4 w-4"}),(0,Hi.jsx)("span",{children:new Date(e.createdAt).toLocaleDateString()})]})]})]})};var Rd=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:Bt.BookOpen},{value:"task",label:"Task",color:"bg-secondary/20 text-secondary-foreground",icon:Bt.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:Bt.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:Bt.Zap}],Ad=[{value:"low",label:"Low",color:"bg-success/20 text-success"},{value:"medium",label:"Medium",color:"bg-warning/20 text-warning"},{value:"high",label:"High",color:"bg-destructive/20 text-destructive"}],xo=({isOpen:e,onClose:t,onAddTask:a,epics:o,sprints:i,assignees:r,defaultEpicId:n})=>{let[s,c]=(0,Qt.useState)({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:"",sprint:"none",assignee:""});(0,Qt.useEffect)(()=>{e&&n&&c(m=>({...m,epic:n}))},[e,n]),(0,Qt.useEffect)(()=>{e&&c({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:n||"",sprint:"none",assignee:""})},[e]);let p=m=>{m.preventDefault(),s.name.trim()&&(a({name:s.name.trim(),description:s.description.trim(),status:"todo",priority:s.priority,type:s.type,storyPoints:s.storyPoints,epic:Number(s.epic),sprint:Number(s.sprint),assignee:s.assignee.trim()?{relationTo:"digital-colleagues",value:Number(s.assignee)}:null,dateLogged:new Date().toISOString(),index:0}),c({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:n||"",sprint:"",assignee:""}),t())},l=(m,u)=>{c(y=>({...y,[m]:u}))};return(0,Hi.jsx)(Ve,{open:e,onOpenChange:t,children:(0,Hi.jsxs)(Ze,{className:"sm:max-w-md",children:[(0,Hi.jsx)(Xe,{children:(0,Hi.jsx)(Ke,{children:"Add New Task"})}),(0,Hi.jsxs)("form",{onSubmit:p,className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"name",children:"Task Title"}),(0,Hi.jsx)(G,{id:"name",value:s.name,onChange:m=>l("name",m.target.value),placeholder:"Enter task title",required:!0})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:s.description,onChange:m=>l("description",m.target.value),placeholder:"Enter task description",rows:3})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{children:"Type"}),(0,Hi.jsx)(Wa,{type:"single",value:s.type||"",onValueChange:m=>m&&l("type",m),children:Rd.map(m=>{let u=m.icon;return(0,Hi.jsxs)(qa,{value:m.value,className:"flex items-center gap-2 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",children:[(0,Hi.jsx)(u,{className:"h-4 w-4"}),m.label]},m.value)})})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{children:"Priority"}),(0,Hi.jsx)(Wa,{type:"single",value:s.priority||"",onValueChange:m=>m&&l("priority",m),children:Ad.map(m=>(0,Hi.jsx)(qa,{value:m.value,className:"data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",children:m.label},m.value))})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"points",children:"Story Points"}),(0,Hi.jsx)(G,{id:"points",type:"number",min:"1",max:"100",value:s.storyPoints,onChange:m=>l("storyPoints",parseInt(m.target.value)||1),placeholder:"Enter story points",required:!0})]}),!n&&(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"epic",children:"Epic"}),(0,Hi.jsxs)(Je,{value:s.epic,onValueChange:m=>l("epic",m),children:[(0,Hi.jsx)(ze,{children:(0,Hi.jsx)(ct,{placeholder:"Select Qt epic"})}),(0,Hi.jsx)($e,{children:o.map(m=>(0,Hi.jsx)(fe,{value:m.id.toString(),children:(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("div",{className:`w-3 h-3 rounded-full ${m.color}`}),m.name]})},m.id))})]})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"sprint",children:"Sprint (Optional)"}),(0,Hi.jsxs)(Je,{value:s.sprint,onValueChange:m=>l("sprint",m),children:[(0,Hi.jsx)(ze,{children:(0,Hi.jsx)(ct,{placeholder:"Select a sprint"})}),(0,Hi.jsxs)($e,{children:[(0,Hi.jsx)(fe,{value:"none",children:"Bt Sprint"}),i.map(m=>(0,Hi.jsx)(fe,{value:m.id.toString(),children:(0,Hi.jsx)("div",{className:"flex items-center gap-2",children:m.name})},m.id))]})]})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"sprint",children:"Assignee"}),(0,Hi.jsxs)(Je,{value:s.assignee,onValueChange:m=>l("assignee",m),children:[(0,Hi.jsx)(ze,{children:(0,Hi.jsx)(ct,{placeholder:"Select Qt Assignee"})}),(0,Hi.jsxs)($e,{children:[(0,Hi.jsx)(fe,{value:"none",children:"Bt Assignee"}),r.map(m=>(0,Hi.jsx)(fe,{value:m.id.toString(),children:(0,Hi.jsx)("div",{className:"flex items-center gap-2",children:m.name})},m.id))]})]})]}),(0,Hi.jsxs)(mo,{children:[(0,Hi.jsx)(x,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,Hi.jsx)(x,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Task"})]})]})]})})};var As=({comments:e,onAddComment:t})=>{let[a,o]=(0,Qt.useState)(""),i=n=>n.split(" ").map(s=>s[0]).join("").toUpperCase(),r=()=>{a.trim()&&(t(a),o(""))};return(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Bt.MessageSquare,{className:"h-5 w-5"}),(0,Hi.jsx)(R,{className:"text-lg font-medium",children:"Comments"}),(0,Hi.jsx)(Ae,{variant:"secondary",children:e.length})]}),(0,Hi.jsx)("div",{className:"space-y-4 max-h-60 overflow-y-auto",children:e.map(n=>(0,Hi.jsxs)("div",{className:"flex gap-3 p-3 bg-muted/50 rounded-lg",children:[(0,Hi.jsx)(va,{className:"h-8 w-8 mt-1",children:(0,Hi.jsx)(ha,{className:"text-xs bg-muted text-muted-foreground",children:i(n.author)})}),(0,Hi.jsxs)("div",{className:"flex-1",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,Hi.jsx)("span",{className:"font-medium text-sm",children:n.author}),(0,Hi.jsxs)("span",{className:"text-xs text-muted-foreground",children:[n.createdAt.toLocaleDateString()," at ",n.createdAt.toLocaleTimeString()]})]}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:n.text})]})]},n.id))}),(0,Hi.jsxs)("div",{className:"flex gap-2",children:[(0,Hi.jsx)(Ee,{value:a,onChange:n=>o(n.target.value),placeholder:"Add a comment...",rows:2,className:"flex-1 resize-none"}),(0,Hi.jsx)(x,{onClick:r,disabled:!a.trim(),size:"sm",className:"self-end",children:(0,Hi.jsx)(Bt.Send,{className:"h-4 w-4"})})]})]})};var Cr=({label:e,value:t,onValueChange:a,options:o,showColor:i=!1,disabled:r=!1})=>{let[n,s]=(0,Qt.useState)(!1),c=o.find(l=>l.value===t);return(0,Hi.jsxs)("div",{className:"space-y-1",children:[(0,Hi.jsx)(R,{className:"text-xs text-muted-foreground",children:e}),(0,Hi.jsxs)(Je,{value:t,onValueChange:a,open:n,onOpenChange:l=>{r||s(l)},disabled:r,children:[(0,Hi.jsx)(ze,{className:"h-auto p-0 border-none bg-transparent hover:bg-muted/50 rounded-md",children:(0,Hi.jsxs)(Ae,{variant:"secondary",className:`${r?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!r&&s(!n),children:[i&&c?.color&&(0,Hi.jsx)("div",{className:`w-2 h-2 rounded-full ${c.color} mr-1`}),c?.label||"Select..."]})}),(0,Hi.jsx)($e,{children:o.map(l=>(0,Hi.jsx)(fe,{value:l.value,children:i&&l.color?(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("div",{className:`w-3 h-3 rounded-full ${l.color}`}),l.label]}):l.label},l.value))})]})]})};var Es=({label:e,value:t,onValueChange:a,options:o,placeholder:i="Search...",allowCustomValue:r=!1,disabled:n=!1})=>{let[s,c]=(0,Qt.useState)(!1),[p,l]=(0,Qt.useState)(""),m=o.find(d=>d.value===t),u=o.filter(d=>d.label.toLowerCase().includes(p.toLowerCase())),y=d=>{a(d),c(!1),l("")},b=()=>{r&&p.trim()&&!o.find(d=>d.value===p.trim())&&(a(p.trim()),c(!1),l(""))};return(0,Hi.jsxs)("div",{className:"space-y-1",children:[(0,Hi.jsx)(R,{className:"text-xs text-muted-foreground",children:e}),(0,Hi.jsxs)(Je,{value:t,onValueChange:y,open:s,onOpenChange:d=>{n||c(d)},disabled:n,children:[(0,Hi.jsx)(ze,{className:"h-auto p-0 border-none bg-transparent hover:bg-muted/50 rounded-md",children:(0,Hi.jsx)(Ae,{variant:"secondary",className:`${n?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!n&&c(!s),children:m?.label||t||"Select..."})}),(0,Hi.jsxs)($e,{children:[(0,Hi.jsx)("div",{className:"p-2",children:(0,Hi.jsx)(G,{placeholder:i,value:p,onChange:d=>l(d.target.value),onKeyDown:d=>{d.key==="Enter"&&r&&b()},className:"mb-2"})}),u.map(d=>(0,Hi.jsx)(fe,{value:d.value,children:d.label},d.value)),r&&p.trim()&&!u.find(d=>d.value===p.trim())&&(0,Hi.jsxs)(fe,{value:p.trim(),children:['Add "',p.trim(),'"']})]})]})]})};var mt=e=>e?typeof e=="number"?e:typeof e=="object"&&e&&"id"in e?e.id:0:0;var Md=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:Bt.BookOpen},{value:"task",label:"Task",color:"bg-muted text-muted-foreground",icon:Bt.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:Bt.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:Bt.Zap}],Ed=[{value:"low",label:"Low",color:"bg-success/20 text-success"},{value:"medium",label:"Medium",color:"bg-warning/20 text-warning"},{value:"high",label:"High",color:"bg-destructive/20 text-destructive"}];var Is=({task:e,epics:t,sprints:a,lastUpdated:o,onUpdateTask:i,onClose:r,onDelete:n,isUpdating:s=!1,isDeleting:c=!1,deleteState:p="idle",teamMembers:l})=>{let[m,u]=(0,Qt.useState)(e.storyPoints),y=(0,Qt.useRef)(null),[b,h]=(0,Qt.useState)(l);(0,Qt.useEffect)(()=>{h(l)},[l]);let d=(0,Qt.useCallback)((w,C)=>{y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{i(w,C)},500)},[i]);(0,Qt.useEffect)(()=>{d("storyPoints",m?.toString()||"1")},[m]);let f=w=>w.split(" ").map(C=>C[0]).join("").toUpperCase(),k=()=>p==="loading"?(0,Hi.jsxs)(x,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,Hi.jsx)(Bt.Loader2,{className:"h-3 w-3 animate-spin"}),"Deleting..."]}):p==="success"?(0,Hi.jsxs)(x,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,Hi.jsx)(Bt.Check,{className:"h-3 w-3"}),"Deleted"]}):p==="error"?(0,Hi.jsxs)(x,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,Hi.jsx)(Bt.X,{className:"h-3 w-3"}),"Delete failed"]}):(0,Hi.jsxs)(x,{onClick:n,variant:"destructive",className:"w-full h-8 text-xs gap-1",disabled:s||c,children:[(0,Hi.jsx)(Bt.Trash2,{className:"h-3 w-3"}),"Delete Task"]});return(0,Hi.jsxs)("div",{className:"flex flex-col h-full",children:[(0,Hi.jsxs)("div",{className:"space-y-4",style:{opacity:s?.6:1},children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{className:"text-xs text-muted-foreground",children:"Status"}),(0,Hi.jsx)(Cr,{label:"",value:e.status,onValueChange:w=>i("status",w),options:[{value:"todo",label:"To Do"},{value:"in-progress",label:"In Progress"},{value:"done",label:"Done"}],disabled:s})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{className:"text-xs text-muted-foreground",children:"Type"}),(0,Hi.jsx)(Wa,{type:"single",value:e.type||"",onValueChange:w=>w&&i("type",w),className:"grid grid-cols-2 gap-1",disabled:s,children:Md.map(w=>{let C=w.icon;return(0,Hi.jsxs)(qa,{value:w.value,className:"flex items-center gap-1 text-xs h-8 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",size:"sm",disabled:s,children:[(0,Hi.jsx)(C,{className:"h-3 w-3"}),w.label]},w.value)})})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{className:"text-xs text-muted-foreground",children:"Priority"}),(0,Hi.jsx)(Wa,{type:"single",value:e.priority||"",onValueChange:w=>w&&i("priority",w),className:"grid grid-cols-3 gap-1",disabled:s,children:Ed.map(w=>(0,Hi.jsx)(qa,{value:w.value,className:"text-xs h-8 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",size:"sm",disabled:s,children:w.label},w.value))})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{className:"text-xs text-muted-foreground",children:"Story Points"}),(0,Hi.jsx)("input",{type:"number",min:"1",max:"100",value:m||1,onChange:w=>{let C=Number(w.target.value);C<1?u(1):C>100?u(100):u(C)},className:"w-full h-8 px-2 text-xs border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent bg-background text-foreground disabled:opacity-50 disabled:cursor-not-allowed",disabled:s})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{className:"text-xs text-muted-foreground",children:"Epic"}),(0,Hi.jsx)(Cr,{label:"",value:mt(e.epic).toString(),onValueChange:w=>i("epic",w),options:(t||[]).map(w=>({value:w.id.toString(),label:w?.name,color:w.color})),showColor:!0,disabled:s})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{className:"text-xs text-muted-foreground",children:"Sprint"}),(0,Hi.jsx)(Cr,{label:"",value:mt(e.sprint).toString()||"none",onValueChange:w=>i("sprint",w==="none"?"":w),options:[{value:"none",label:"Bt Sprint"},...(a||[]).map(w=>({value:w.id.toString(),label:`${w?.name}`}))],disabled:s})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{className:"text-xs text-muted-foreground",children:"Assignee"}),(0,Hi.jsx)(Es,{label:"",value:e.assignee?.value?.name,onValueChange:w=>i("assignee",w),options:b.map(w=>({value:`${typeof w.email=="string"?"users":"digital-colleagues"}:${w.id}`,label:w?.name||""})),placeholder:"Search team members...",allowCustomValue:!0,disabled:s})]})]}),(0,Hi.jsxs)("div",{className:"mt-auto Qt-4 space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(x,{onClick:r,variant:"outline",className:"w-full h-8 text-xs",disabled:s||c,children:"Close"}),k()]}),(0,Hi.jsxs)("div",{className:"Qt-4 border-t border-border space-y-2",children:[(0,Hi.jsx)("div",{className:"text-xs text-muted-foreground font-medium mb-2",children:"Information"}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)("span",{className:"text-xs text-muted-foreground",children:"Logged By"}),(0,Hi.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Hi.jsx)(Bt.User,{className:"h-3 w-3"}),(0,Hi.jsx)("span",{children:"System"})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)("span",{className:"text-xs text-muted-foreground",children:"Created"}),(0,Hi.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Hi.jsx)(Bt.Calendar,{className:"h-3 w-3"}),(0,Hi.jsx)("span",{children:new Date(e.createdAt)?.toLocaleDateString()})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)("span",{className:"text-xs text-muted-foreground",children:"Last Updated"}),(0,Hi.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Hi.jsx)(Bt.Clock,{className:"h-3 w-3"}),(0,Hi.jsxs)("span",{children:[new Date(o).toLocaleDateString()," at"," ",new Date(o).toLocaleTimeString()]})]})]})]})]})]})};var Fs=({isOpen:e,onClose:t,initialTask:a,epics:o,sprints:i,onUpdateTask:r,onDeleteTask:n,onAddComment:s,colleagues:c,onUploadFile:p,onDeleteFile:l,onFileUpdate:m})=>{let[u,y]=(0,Qt.useState)(a),[b,h]=(0,Qt.useState)(new Date),[d,f]=(0,Qt.useState)("idle"),[k,w]=(0,Qt.useState)("idle"),[C,X]=(0,Qt.useState)(!1),[I,z]=(0,Qt.useState)([]),[D,V]=(0,Qt.useState)(c);(0,Qt.useEffect)(()=>{y(a)},[a]);let W=async(O,N)=>{if(N!==u[O]){f("loading");try{await r(u.id.toString(),{[O]:N}),h(new Date),f("success"),setTimeout(()=>f("idle"),1500)}catch(_){console.log("error",_),f("error"),setTimeout(()=>f("idle"),3e3)}}},q=async(O,N)=>{if(N!==u[O]){f("loading");try{await r(u.id.toString(),{[O]:N}),h(new Date),f("success"),setTimeout(()=>f("idle"),1500)}catch(_){console.log("error",_),f("error"),setTimeout(()=>f("idle"),3e3)}}},F=async O=>{if(s){f("loading");try{await s?.({content:O,taskId:u.id.toString()}),h(new Date),f("success"),setTimeout(()=>f("idle"),1500)}catch{f("error"),setTimeout(()=>f("idle"),3e3)}}},Ce=async()=>{w("loading");try{await n(u.id.toString()),w("success"),setTimeout(()=>{t(),w("idle")},1e3)}catch{w("error"),setTimeout(()=>w("idle"),3e3)}},ke=async O=>{if(p){f("loading");try{await p(u.id.toString(),O),h(new Date),f("success"),X(!1),setTimeout(()=>f("idle"),1500)}catch(N){console.error("Error uploading file:",N),f("error"),setTimeout(()=>f("idle"),3e3)}}},B=async O=>{if(l){f("loading");try{await l(u.id.toString(),O.id.toString()),h(new Date),f("success"),setTimeout(()=>f("idle"),1500)}catch(N){console.error("Error deleting file:",N),f("error"),setTimeout(()=>f("idle"),3e3)}}},le=(u.files||[]).map(O=>typeof O=="number"?null:O).filter(O=>O!==null),A=d!=="loading"&&k!=="loading",je=()=>{A&&t()},M=()=>d==="loading"?(0,Hi.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,Hi.jsx)(Bt.Loader2,{className:"h-4 w-4 animate-spin"}),(0,Hi.jsx)("span",{children:"Updating..."})]}):d==="success"?(0,Hi.jsxs)("div",{className:"flex items-center gap-2 text-sm text-success",children:[(0,Hi.jsx)(Bt.Check,{className:"h-4 w-4"}),(0,Hi.jsx)("span",{children:"Updated successfully"})]}):d==="error"?(0,Hi.jsxs)("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[(0,Hi.jsx)(Bt.X,{className:"h-4 w-4"}),(0,Hi.jsx)("span",{children:"Update failed"})]}):null;return(0,Hi.jsxs)(Ve,{open:e,onOpenChange:je,children:[(0,Hi.jsxs)(Ze,{className:"max-w-3xl max-h-[80vh] overflow-y-auto p-4",children:[(0,Hi.jsxs)(Xe,{children:[(0,Hi.jsx)(Ke,{className:"Ir-only",children:u?.name}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)("div",{className:"flex-1",children:M()}),!A&&(0,Hi.jsx)("div",{className:"text-xs text-muted-foreground",children:"Please wait..."})]})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,Hi.jsxs)("div",{className:"lg:col-span-2 space-y-4",children:[(0,Hi.jsx)(Ma,{fieldName:"name",value:u.name||"",label:"",onSave:W,className:"border-b border-border pb-3",disabled:d==="loading"}),(0,Hi.jsx)(Ma,{fieldName:"description",value:u.description||"",label:"Description",multiline:!0,onSave:W,disabled:d==="loading"}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Bt.File,{className:"h-4 w-4 text-muted-foreground"}),(0,Hi.jsx)("h3",{className:"text-sm font-medium",children:"Files"})]}),p&&(0,Hi.jsxs)(x,{variant:"outline",size:"sm",onClick:()=>X(!0),disabled:d==="loading",className:"gap-2",children:[(0,Hi.jsx)(Bt.Upload,{className:"h-4 w-4"}),"Upload"]})]}),le.length>0?(0,Hi.jsx)(ho,{files:le,onFileDelete:l?B:void 0,onFileUpdate:m,showHeader:!1,className:"border rounded-lg",viewMode:"card"}):(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground py-4 text-center border border-dashed rounded-lg",children:"Bt files attached"})]}),(0,Hi.jsx)(As,{comments:(u?.comments||[]).map(O=>({author:O.author?.value.name||"",createdAt:new Date(O.timestamp),text:O.text,id:O.id||""})),onAddComment:F})]}),(0,Hi.jsx)(Is,{task:u,epics:o,sprints:i,lastUpdated:b,onUpdateTask:q,onClose:je,onDelete:Ce,isUpdating:d==="loading",isDeleting:k==="loading",deleteState:k,teamMembers:D})]})]}),p&&(0,Hi.jsx)(xr,{isOpen:C,onClose:()=>X(!1),onAddFile:ke})]})};var yo=({isOpen:e,onClose:t,onAddEpic:a})=>{let[o,i]=(0,Qt.useState)({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString().split("T")[0],endDate:new Date().toISOString().split("T")[0],progress:0}),r=["bg-blue-500","bg-green-500","bg-purple-500","bg-orange-500","bg-red-500","bg-yellow-500","bg-pink-500","bg-indigo-500"],n=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],s=[{value:1,label:"Planning"},{value:2,label:"Development"},{value:3,label:"Testing"},{value:4,label:"Done"}],c=l=>{l.preventDefault(),o.name.trim()&&(a({name:o.name.trim(),description:o.description.trim(),color:o.color,confidence:o.confidence,phase:o.phase,startDate:o.startDate,endDate:o.endDate}),i({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString(),endDate:new Date().toISOString(),progress:0}),t())},p=(l,m)=>{i(u=>({...u,[l]:m}))};return(0,Hi.jsx)(Ve,{open:e,onOpenChange:t,children:(0,Hi.jsxs)(Ze,{className:"sm:max-w-md",children:[(0,Hi.jsx)(Xe,{children:(0,Hi.jsx)(Ke,{children:"Add New Epic"})}),(0,Hi.jsxs)("form",{onSubmit:c,className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"name",children:"Epic Name"}),(0,Hi.jsx)(G,{id:"name",value:o.name,onChange:l=>p("name",l.target.value),placeholder:"Enter epic name",required:!0})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:o.description,onChange:l=>p("description",l.target.value),placeholder:"Enter epic description (optional)",rows:3})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{children:"Color"}),(0,Hi.jsx)("div",{className:"flex gap-2 flex-wrap",children:r.map(l=>(0,Hi.jsx)("button",{type:"button",onClick:()=>p("color",l),className:`w-8 h-8 rounded-full ${l} ${o.color===l?"ring-2 ring-gray-400":""}`},l))})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{children:"Confidence"}),(0,Hi.jsxs)(Je,{value:o.confidence,onValueChange:l=>p("confidence",l),children:[(0,Hi.jsx)(ze,{children:(0,Hi.jsx)(ct,{})}),(0,Hi.jsx)($e,{children:n.map(l=>(0,Hi.jsx)(fe,{value:l.value,children:l.label},l.value))})]})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{children:"Phase"}),(0,Hi.jsxs)(Je,{value:o.phase.toString(),onValueChange:l=>p("phase",parseInt(l)),children:[(0,Hi.jsx)(ze,{children:(0,Hi.jsx)(ct,{})}),(0,Hi.jsx)($e,{children:s.map(l=>(0,Hi.jsx)(fe,{value:l.value.toString(),children:l.label},l.value))})]})]})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{children:"Start Date"}),(0,Hi.jsx)(G,{type:"date",value:o.startDate,onChange:l=>p("startDate",l.target.value)})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{children:"End Date"}),(0,Hi.jsx)(G,{type:"date",value:o.endDate,onChange:l=>p("endDate",l.target.value)})]})]}),(0,Hi.jsxs)(mo,{children:[(0,Hi.jsx)(x,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,Hi.jsx)(x,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Epic"})]})]})]})})};var Bs=({initialTasks:e=[],initialEpics:t=[],initialSprints:a=[],initialUsers:o=[],initialColleagues:i=[],initialProjects:r=[],onAddTask:n,onUpdateTask:s,onDeleteTask:c,onTaskClick:p,onAddEpic:l,onAddComment:m,onUploadFile:u,onDeleteFile:y,onFileUpdate:b})=>{let[h,d]=(0,Ue.useState)([]),[f,k]=(0,Ue.useState)([]),[w,C]=(0,Ue.useState)([]),[X,I]=(0,Ue.useState)(!1),[z,D]=(0,Ue.useState)(!1),[V,W]=(0,Ue.useState)(null),[q,F]=(0,Ue.useState)(null),[Ce,ke]=(0,Ue.useState)([]),[B,le]=(0,Ue.useState)([]),[A,je]=(0,Ue.useState)(0),M=(0,Ue.useRef)(null),O=(0,Ue.useRef)(null),N=Ue.default.useMemo(()=>[...f.map(P=>P.id),0],[f]),_=(0,Ue.useRef)(""),de=(0,Ue.useRef)(""),nt=(0,Ue.useRef)(""),ye=(0,Ue.useRef)(""),at=(P,$)=>P.map(ie=>`${ie.id}-${new Date(ie.createdAt).getTime()}-${new Date(ie.updatedAt).getTime()}`).join("-")+($?`-${$}`:"");(0,Ue.useEffect)(()=>{let P=e.map(ie=>ie.files?.filter(De=>typeof De=="object").map(De=>new Date(De.updatedAt).getTime())).flat(),$=at(e,P.join("-"));$!==_.current&&(d(e),V&&W(e.find(ie=>ie.id===V.id)||null),_.current=$)},[e]),(0,Ue.useEffect)(()=>{let P=at(t);P!==de.current&&(k(t),de.current=P)},[t]),(0,Ue.useEffect)(()=>{let P=at(a);P!==nt.current&&(C(a),nt.current=P)},[a]),(0,Ue.useEffect)(()=>{let P=at(i.map($=>({id:$.id,updatedAt:$.updatedAt,createdAt:$.createdAt})));P!==ye.current&&(le(i),ye.current=P)},[i]),(0,Ue.useEffect)(()=>{let P=()=>{if(M.current){let De=M.current.offsetHeight;je(De)}};P();let $=new ResizeObserver(P);M.current&&$.observe(M.current);let ie=()=>{setTimeout(P,100)};return window.addEventListener("storage",ie),()=>{$.disconnect(),window.removeEventListener("storage",ie)}},[]),(0,Ue.useEffect)(()=>{let P=setTimeout(()=>{M.current&&je(M.current.offsetHeight)},300);return()=>clearTimeout(P)},[X,z]);let L=h.filter(P=>!0),ot=P=>L.filter($=>$.status===P),Vt=P=>{let $={};return f.forEach(ie=>{$[ie.id]=P.filter(De=>mt(De.epic)===ie.id)}),$["Qt-epic"]=P.filter(ie=>!mt(ie.epic)),$},ma=P=>{F(P)},Oa=P=>{q&&(d($=>$.map(ie=>ie.id===q.id?{...ie,status:P}:ie)),s?.(q.id.toString(),{status:P}),F(null))},eo=P=>{let $={...P,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};d(ie=>[...ie,$]),n?.(P)},Ha=async(P,$)=>{d(ie=>ie.map(De=>De.id===Number(P)?{...De,...$}:De)),s&&await s(P,$),V?.id===Number(P)&&W(ie=>({...ie,...$}))},to=async P=>{d($=>$.filter(ie=>ie.id!==Number(P))),V?.id===Number(P)&&W(null),c&&await c(P)},ao=P=>{let $={...P,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};k(ie=>[...ie,$]),l?.(P)},Jt=P=>{W(P),p?.(P)},S=[{id:"todo",title:"To Do",status:"todo"},{id:"in-progress",title:"In Progress",status:"in-progress"},{id:"review",title:"Review",status:"review"},{id:"done",title:"Done",status:"done"}],U=A>0?`calc(100vh - ${A+120}px)`:"calc(100vh - 12rem)";return(0,Hi.jsxs)("div",{ref:O,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,Hi.jsx)("div",{ref:M,className:"flex-shrink-0",children:(0,Hi.jsx)(St,{title:"Project Board",description:"Manage tasks and track progress across your project sprints.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"Add task",onClick:()=>I(!0)},secondaryAction:{label:"Add epic",onClick:()=>D(!0)}})}),(0,Hi.jsx)("div",{className:"flex-1 min-h-0 mt-8",children:(0,Hi.jsx)("div",{className:"h-full",style:{height:A>0?`calc(100vh - ${A+120}px)`:"calc(100vh - 12rem)"},children:(0,Hi.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full",children:S.map(P=>{let $=ot(P.status),ie=Vt($);return(0,Hi.jsxs)(Ps,{title:P.title,status:P.status,taskCount:$.length,onDrop:Oa,isCompact:P.status==="done",height:U,children:[ie["Qt-epic"].map(De=>(0,Hi.jsx)(_o,{epic:null,task:De,onDragStart:ma,onTaskClick:Jt,isCompact:P.status==="done"},De.id)),N.map(De=>{let vt=f.find(ra=>ra.id===De),pa=ie[De]||[];return pa.length===0?null:(0,Hi.jsxs)("div",{className:"mb-6",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,Hi.jsx)("div",{className:`w-3 h-3 rounded-full ${vt?.color}`}),(0,Hi.jsx)("span",{className:"text-sm font-medium text-muted-foreground select-none-important",children:vt?.name||"Bt Epic"}),(0,Hi.jsx)(Ae,{variant:"secondary",className:"text-xs",children:pa.length})]})," ",(0,Hi.jsx)("div",{className:"space-y-3",children:pa.map(ra=>(0,Hi.jsx)(_o,{task:ra,epic:vt,onDragStart:ma,onTaskClick:Jt,isCompact:P.status==="done"},ra.id))})]},De)})]},P.id)})})})}),(0,Hi.jsx)(xo,{isOpen:X,onClose:()=>I(!1),onAddTask:eo,assignees:[...B,...Ce],epics:f,sprints:w}),(0,Hi.jsx)(yo,{isOpen:z,onClose:()=>D(!1),onAddEpic:ao}),V&&(0,Hi.jsx)(Fs,{isOpen:!!V,onClose:()=>W(null),initialTask:V,epics:f,sprints:w,onUpdateTask:Ha,onDeleteTask:to,colleagues:B,onUploadFile:u,onDeleteFile:y,onFileUpdate:b,onAddComment:m})]})};var Os=({tasks:e,epics:t,sprints:a,onUpdateTask:o,onTaskClick:i,onAddTaskToEpic:r,onAddEpic:n,onUpdateEpic:s,onDeleteEpic:c})=>{let[p,l]=(0,Qt.useState)(t),[m,u]=(0,Qt.useState)(null),[y,b]=(0,Qt.useState)(null),[h,d]=(0,Qt.useState)({}),[f,k]=(0,Qt.useState)(0),[w,C]=(0,Qt.useState)(!1),[X,I]=(0,Qt.useState)(!1),[z,D]=(0,Qt.useState)(null),V=(0,Qt.useRef)(null),W=(0,Qt.useRef)(null);(0,Qt.useEffect)(()=>{l(t)},[t]),(0,Qt.useEffect)(()=>{let N=()=>{if(V.current){let nt=V.current.offsetHeight;k(nt)}};N();let _=new ResizeObserver(N);V.current&&_.observe(V.current);let de=()=>{setTimeout(N,100)};return window.addEventListener("storage",de),()=>{_.disconnect(),window.removeEventListener("storage",de)}},[]),(0,Qt.useEffect)(()=>{let N=setTimeout(()=>{V.current&&k(V.current.offsetHeight)},300);return()=>clearTimeout(N)},[y]);let q=N=>{u(N)},F=N=>{N.preventDefault()},Ce=(N,_)=>{N.preventDefault(),m&&mt(m.epic).toString()!==_&&(o(m.id.toString(),{epic:Number(_)}),u(null))},ke=N=>e.filter(_=>mt(_.epic).toString()===N),B=N=>{b(N.id.toString()),d({name:N.name,description:N.description,confidence:N.confidence,phase:N.phase})},le=async()=>{y&&h.name&&(await s(y.toString(),h),l(N=>N.map(_=>_.id.toString()===y?{..._,...h}:_)),b(null),d({}))},A=()=>{b(null),d({})},je=async N=>{window.confirm("Are you sure you want to delete this epic? This will also delete all associated tasks.")&&(await c(N),l(_=>_.filter(de=>de.id.toString()!==N)))},M=N=>({1:"Planning",2:"Development",3:"Testing",4:"Review",5:"Deployment",6:"Monitoring",7:"Optimization",8:"Maintenance",9:"Complete"})[N]||`Phase ${N}`,O=N=>{switch(N){case"high":return"bg-success/10 text-success";case"medium":return"bg-warning/10 text-warning";case"low":return"bg-destructive/10 text-destructive";default:return"bg-muted text-muted-foreground"}};return(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsxs)("div",{ref:W,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,Hi.jsx)("div",{ref:V,className:"flex-shrink-0",children:(0,Hi.jsx)(St,{title:"Epic Planning",description:"Organize and manage your project epics, track progress, and assign tasks.",gradient:"bg-gradient-to-r from-rose-600 via-pink-600 to-fuchsia-600",primaryAction:{label:"Add epic",onClick:()=>C(!0)}})}),(0,Hi.jsx)("div",{className:"flex-1 min-h-0 mt-8",children:(0,Hi.jsx)("div",{className:"h-full overflow-y-auto",style:{height:f>0?`calc(100vh - ${f+120}px)`:"calc(100vh - 12rem)"},children:(0,Hi.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 auto-rows-max",children:p.map(N=>{let _=ke(N.id.toString()),de=_.reduce((ye,at)=>ye+(at.storyPoints||0),0),nt=f>0?`calc(100vh - ${f+200}px)`:"calc(100vh - 14rem)";return(0,Hi.jsxs)(Y,{className:`flex flex-col ${y===N.id.toString()?"h-auto":""} bg-card shadow-sm`,style:{height:y===N.id.toString()?"auto":nt,minHeight:"400px"},onDragOver:F,onDrop:ye=>Ce(ye,N.id.toString()),children:[(0,Hi.jsx)("div",{className:"p-4 border-b border-border",children:y===N.id.toString()?(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)(G,{value:h.name||"",onChange:ye=>d({...h,name:ye.target.value}),placeholder:"Epic name",className:"font-semibold"}),(0,Hi.jsxs)("div",{className:"flex gap-2 ml-2",children:[(0,Hi.jsx)(x,{size:"sm",variant:"ghost",onClick:le,className:"p-1 h-8 w-8",children:(0,Hi.jsx)(Bt.Check,{className:"h-4 w-4"})}),(0,Hi.jsx)(x,{size:"sm",variant:"ghost",onClick:A,className:"p-1 h-8 w-8",children:(0,Hi.jsx)(Bt.X,{className:"h-4 w-4"})})]})]}),(0,Hi.jsx)(Ee,{value:h.description||"",onChange:ye=>d({...h,description:ye.target.value}),placeholder:"Epic description",className:"text-sm min-h-[60px]"}),(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("label",{className:"text-xs text-muted-foreground",children:"Confidence"}),(0,Hi.jsxs)("select",{value:h.confidence||N.confidence,onChange:ye=>d({...h,confidence:ye.target.value}),className:"flex h-8 w-full rounded-md border border-input bg-background px-3 py-2 text-xs ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium 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",children:[(0,Hi.jsx)("option",{value:"low",children:"Low"}),(0,Hi.jsx)("option",{value:"medium",children:"Medium"}),(0,Hi.jsx)("option",{value:"high",children:"High"})]})]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("label",{className:"text-xs text-muted-foreground",children:"Phase"}),(0,Hi.jsx)("select",{value:h.phase?.toString()||N.phase.toString(),onChange:ye=>d({...h,phase:parseInt(ye.target.value)}),className:"flex h-8 w-full rounded-md border border-input bg-background px-3 py-2 text-xs ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium 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",children:[1,2,3,4,5,6,7,8,9].map(ye=>(0,Hi.jsxs)("option",{value:ye.toString(),children:["Phase ",ye]},ye))})]})]})]}):(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,Hi.jsx)("div",{className:`w-4 h-4 rounded-full ${N.color}`}),(0,Hi.jsx)("h3",{className:"font-semibold text-foreground select-none flex-1",children:N.name}),(0,Hi.jsxs)("div",{className:"flex gap-1",children:[(0,Hi.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>B(N),className:"p-1 h-8 w-8",children:(0,Hi.jsx)(Bt.Edit2,{className:"h-3 w-3"})}),(0,Hi.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>je(N.id.toString()),className:"p-1 h-8 w-8 hover:bg-destructive/10 hover:text-destructive",children:(0,Hi.jsx)(Bt.Trash2,{className:"h-3 w-3"})})]})]}),(0,Hi.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,Hi.jsxs)(Ae,{className:`text-xs ${O(N.confidence)}`,children:[N.confidence," confidence"]}),(0,Hi.jsxs)(Ae,{variant:"outline",className:"text-xs",children:["Phase ",N.phase]}),(0,Hi.jsxs)(Ae,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[_.length," tasks"]}),(0,Hi.jsxs)(Ae,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[de," pts"]})]}),N.description&&(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground mb-3 select-none",children:N.description}),(0,Hi.jsxs)(x,{onClick:()=>{I(!0),D(N)},variant:"outline",size:"sm",className:"w-full gap-2",children:[(0,Hi.jsx)(Bt.Plus,{className:"h-4 w-4"}),"Add Task"]})]})}),(0,Hi.jsx)("div",{className:"flex-1 p-4 overflow-y-auto",children:(0,Hi.jsx)("div",{className:`space-y-3 min-h-[200px] border-2 border-dashed rounded p-3 transition-colors ${m?"border-primary bg-primary/10":"border-border"}`,children:_.length===0?(0,Hi.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 text-muted-foreground border-2 border-dashed border-border rounded-lg",children:[(0,Hi.jsx)(Bt.Move,{className:"h-8 w-8 mb-2"}),(0,Hi.jsx)("span",{className:"text-sm select-none",children:"Drop tasks here"})]}):_.map(ye=>(0,Hi.jsx)(_o,{task:ye,epic:N,onDragStart:q,onTaskClick:i,isCompact:!0},ye.id))})})]},N.id)})})})})]}),(0,Hi.jsx)(yo,{isOpen:w,onClose:()=>C(!1),onAddEpic:n}),(0,Hi.jsx)(xo,{isOpen:X,onClose:()=>I(!1),onAddTask:r,assignees:[],epics:[],defaultEpicId:z?.id.toString()||"",sprints:a})]})};var mi=require("date-fns");var js=({isOpen:e,onClose:t,onAddSprint:a})=>{let[o,i]=(0,Qt.useState)({name:"",description:"",startDate:void 0,endDate:void 0}),r=s=>{s.preventDefault(),!(!o.name||!o.startDate||!o.endDate)&&(a({name:o.name,description:o.description,startDate:o.startDate.toISOString(),endDate:o.endDate.toISOString(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),i({name:"",description:"",startDate:void 0,endDate:void 0}),t())},n=()=>{i({name:"",description:"",startDate:void 0,endDate:void 0}),t()};return(0,Hi.jsx)(Ve,{open:e,onOpenChange:n,children:(0,Hi.jsxs)(Ze,{className:"sm:max-w-md",children:[(0,Hi.jsx)(Xe,{children:(0,Hi.jsx)(Ke,{children:"Add New Sprint"})}),(0,Hi.jsxs)("form",{onSubmit:r,className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"name",children:"Sprint Name *"}),(0,Hi.jsx)(G,{id:"name",value:o.name,onChange:s=>i(c=>({...c,name:s.target.value})),placeholder:"e.Hi., Sprint 3",required:!0})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:o.description,onChange:s=>i(c=>({...c,description:s.target.value})),placeholder:"Brief description of sprint goals",rows:3})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{children:"Start Date *"}),(0,Hi.jsxs)(ai,{children:[(0,Hi.jsx)(oi,{asChild:!0,children:(0,Hi.jsxs)(x,{variant:"outline",className:T("w-full justify-start text-left font-normal",!o.startDate&&"text-muted-foreground"),children:[(0,Hi.jsx)(Bt.CalendarIcon,{className:"mr-2 h-4 w-4"}),o.startDate?(0,mi.format)(o.startDate,"PPP"):"Pick a date"]})}),(0,Hi.jsx)(fr,{className:"w-auto p-0",align:"start",children:(0,Hi.jsx)(hr,{mode:"single",selected:o.startDate,onSelect:s=>i(c=>({...c,startDate:s})),initialFocus:!0})})]})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{children:"End Date *"}),(0,Hi.jsxs)(ai,{children:[(0,Hi.jsx)(oi,{asChild:!0,children:(0,Hi.jsxs)(x,{variant:"outline",className:T("w-full justify-start text-left font-normal",!o.endDate&&"text-muted-foreground"),children:[(0,Hi.jsx)(Bt.CalendarIcon,{className:"mr-2 h-4 w-4"}),o.endDate?(0,mi.format)(o.endDate,"PPP"):"Pick a date"]})}),(0,Hi.jsx)(fr,{className:"w-auto p-0",align:"start",children:(0,Hi.jsx)(hr,{mode:"single",selected:o.endDate,onSelect:s=>i(c=>({...c,endDate:s})),initialFocus:!0,disabled:s=>o.startDate?s<o.startDate:!1})})]})]})]}),(0,Hi.jsxs)("div",{className:"flex justify-end gap-3 Qt-4",children:[(0,Hi.jsx)(x,{type:"button",variant:"outline",onClick:n,children:"Cancel"}),(0,Hi.jsx)(x,{type:"submit",disabled:!o.name||!o.startDate||!o.endDate,children:"Add Sprint"})]})]})]})})};var Dr=({tasks:e,epics:t,sprints:a,onUpdateTask:o,onTaskClick:i,onAddSprint:r,onUpdateSprint:n,onDeleteSprint:s})=>{let[c,p]=(0,Qt.useState)([]),[l,m]=(0,Qt.useState)(new Set),[u,y]=(0,Qt.useState)(null),[b,h]=(0,Qt.useState)(!1),[d,f]=(0,Qt.useState)(null),[k,w]=(0,Qt.useState)(null),[C,X]=(0,Qt.useState)({name:"",description:"",startDate:"",endDate:"",isActive:!1}),[I,z]=(0,Qt.useState)([]),[D,V]=(0,Qt.useState)("upcoming"),[W,q]=(0,Qt.useState)(!1),[F,Ce]=(0,Qt.useState)(0),ke=(0,Qt.useRef)(null),B=(0,Qt.useRef)(null);(0,Qt.useEffect)(()=>{let S=()=>{ke.current&&Ce(ke.current.offsetHeight)};S();let U=new ResizeObserver(S);return ke.current&&U.observe(ke.current),()=>U.disconnect()},[]);let le=S=>t.find(U=>U.id===Number(S)),A=S=>a.find(U=>U.id===Number(S)),je=S=>{let U={high:"bg-red-100 text-red-800 border-red-200",medium:"bg-orange-100 text-orange-800 border-orange-200",low:"bg-green-100 text-green-800 border-green-200"};return U[S]||U.medium},M=S=>{if(!S||S?.length===0)return"";let U=S?.trim().split(" ");if(U?.length===1)return U[0];let P=U[0],$=U[U.length-1][0].toUpperCase();return`${P} ${$}`},O=S=>{let U={},P=[];return S.forEach($=>{$.epic?(U[mt($.epic)]||(U[mt($.epic)]=[]),U[mt($.epic)].push($)):P.push($)}),{tasksByEpic:U,unassignedTasks:P}};(0,Qt.useEffect)(()=>{z(a)},[a]);let N=I.filter(S=>{switch(D){default:return!0}}),_=I.filter(S=>c.includes(S.id.toString())),de=e.filter(S=>!S.sprint||S.status==="backlog"),nt=de.reduce((S,U)=>S+(U.storyPoints||0),0),ye=S=>{p(U=>U.includes(S)?U.filter(P=>P!==S):U?.length<3?[...U,S]:U)},at=S=>{m(U=>{let P=new Set(U);return P.has(S)?P.delete(S):P.add(S),P})},L=S=>{r(S),h(!1)},ot=S=>{w(S.id.toString()),X({name:S.name,description:S.description||"",startDate:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:S.startDate,endDate:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:S.endDate,isActive:!1})},Vt=()=>{k&&(n(k,{name:C.name,description:C.description,startDate:C.startDate,endDate:C.endDate}),z(S=>S.map(U=>(U.id===Number(k)&&(U.name=C.name,U.description=C.description,U.startDate=C.startDate,U.endDate=C.endDate),U))),w(null))},ma=()=>{w(null),X({name:"",description:"",startDate:"",endDate:"",isActive:!1})},Oa=(S,U)=>{y(U),S.dataTransfer.effectAllowed="move"},eo=S=>{S.preventDefault(),S.dataTransfer.dropEffect="move"},Ha=S=>{f(S)},to=()=>{f(null)},ao=(S,U)=>{if(S.preventDefault(),f(null),!u)return;(mt(u.sprint)||void 0)!==Number(U)&&o(u.id.toString(),{sprint:Number(U)}),y(null)},Jt=({task:S,showSprint:U=!1})=>{let P=S.epic?le(mt(S.epic).toString()):null,$=S.sprint?A(mt(S.sprint).toString()):null;return(0,Hi.jsx)(Y,{className:"p-3 cursor-grab active:cursor-grabbing hover:shadow-md transition-all duration-200 border border-border bg-card hover:bg-accent/50",draggable:!0,onDragStart:vt=>{vt.dataTransfer.effectAllowed="move",vt.dataTransfer.setData("text/plain",S.id.toString()),Oa(vt,S)},onClick:vt=>{u===null&&i(S)},style:{userSelect:"none"},children:(0,Hi.jsxs)("div",{className:"space-y-2 pointer-events-none",children:[(0,Hi.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,Hi.jsx)("h4",{className:"font-medium text-sm text-foreground line-clamp-1",children:S.name}),(0,Hi.jsx)(Ae,{className:`text-xs ${je(S.priority||"medium")}`,children:S.priority?.[0]?.toUpperCase()})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-1",children:[P&&(0,Hi.jsx)("div",{className:`w-2 h-2 rounded-full ${P.color}`}),(0,Hi.jsx)("span",{className:"text-muted-foreground truncate",children:P?.name})]}),(0,Hi.jsx)("span",{className:"text-muted-foreground",children:M(S.assignee?.value?.name)})]}),U&&$&&(0,Hi.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Hi.jsx)(Bt.Calendar,{className:"h-3 w-3"}),(0,Hi.jsx)("span",{children:$.name})]})]})})};return(0,Hi.jsxs)("div",{ref:B,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,Hi.jsx)("div",{ref:ke,className:"flex-shrink-0",children:(0,Hi.jsx)(St,{title:"Sprint Planning",description:"Plan and organize tasks across sprints and manage your development timeline.",gradient:"bg-gradient-to-r from-orange-600 via-amber-600 to-yellow-600",primaryAction:{label:"Add sprint",onClick:()=>h(!0)}})}),(0,Hi.jsx)("div",{className:"flex-1 min-h-0 mt-8",children:(0,Hi.jsxs)("div",{className:"h-full",style:{height:F>0?`calc(100vh - ${F+120}px)`:"calc(100vh - 12rem)"},children:[(0,Hi.jsxs)("div",{className:"mb-4",children:[(0,Hi.jsx)(Y,{className:"p-3 bg-card shadow-sm",children:(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("h3",{className:"font-semibold text-foreground text-sm",children:"Sprint Board"}),(0,Hi.jsxs)("p",{className:"text-xs text-muted-foreground",children:[c?.length,"/3 selected"]})]}),c?.length>0&&(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("span",{className:"text-xs text-muted-foreground",children:"Viewing:"}),(0,Hi.jsx)("div",{className:"flex flex-wrap gap-1",children:_.map(S=>(0,Hi.jsxs)("div",{className:"flex items-center gap-1 bg-primary/10 text-primary px-2 py-0.5 rounded text-xs",children:[(0,Hi.jsx)("span",{className:"max-w-[80px] truncate",children:S.name}),(0,Hi.jsx)("button",{onClick:()=>ye(S.id.toString()),className:"ml-0.5 hover:bg-primary/20 h-8 rounded p-0.5",children:(0,Hi.jsx)(Bt.X,{className:"h-4 w-4"})})]},S.id))})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsxs)(x,{onClick:()=>h(!0),className:"bg-primary hover:bg-primary/90 text-primary-foreground gap-1",size:"sm",children:[(0,Hi.jsx)(Bt.Plus,{className:"h-3 w-3"}),"Add"]}),(0,Hi.jsxs)(x,{onClick:()=>q(!W),variant:"outline",size:"sm",className:"gap-1",children:[(0,Hi.jsx)(Bt.Calendar,{className:"h-3 w-3"}),W?"Close":"Select"]})]})]})}),W&&(0,Hi.jsx)("div",{className:"fixed inset-0 bg-black/20 z-[5]",onClick:()=>q(!1)}),(0,Hi.jsx)("div",{className:`fixed top-0 right-0 h-full w-80 bg-background border-l shadow-xl z-10 transition-all duration-300 ease-in-out ${W?"translate-x-0 opacity-100 visible":"translate-x-full opacity-0 invisible"}`,children:(0,Hi.jsxs)(Y,{className:"h-full rounded-none border-0 flex flex-col",children:[(0,Hi.jsxs)("div",{className:"p-4 border-b bg-muted/30 flex-shrink-0",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)("h3",{className:"font-semibold text-foreground text-base",children:"Select Sprints"}),(0,Hi.jsx)(x,{variant:"ghost",size:"sm",onClick:()=>q(!1),className:"h-8 w-8 p-0",children:(0,Hi.jsx)(Bt.X,{className:"h-4 w-4"})})]}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Choose up to 3 sprints to view in your planning board"})]}),(0,Hi.jsxs)("div",{className:"flex flex-col flex-1 p-4 min-h-0",children:[(0,Hi.jsx)("div",{className:"flex gap-1 mb-4 bg-muted p-1 rounded-lg",children:[{key:"all",label:"All",count:a.length},{key:"active",label:"Active"},{key:"upcoming",label:"Upcoming"}].map(S=>(0,Hi.jsxs)(x,{variant:D===S.key?"default":"outline",size:"sm",onClick:()=>V(S.key),className:"text-xs h-8 px-3 flex-1",children:[S.label," (",S.count,")"]},S.key))}),(0,Hi.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto",children:N.length>0?N.map(S=>{let U=c.includes(S.id.toString()),P=e.filter(ie=>mt(ie.sprint)===S.id).length,$=!U&&c.length<3;return(0,Hi.jsx)("div",{className:`p-3 rounded-lg border transition-all ${U?"bg-primary/10 border-primary/30":$?"bg-card border-border hover:border-primary/50":"bg-muted/30 border-border/30 opacity-60"}`,children:k===S.id.toString()?(0,Hi.jsxs)("div",{className:"space-y-3",children:[(0,Hi.jsx)(G,{value:C.name,onChange:ie=>X(De=>({...De,name:ie.target.value})),className:"text-sm",placeholder:"Sprint name"}),(0,Hi.jsx)(Ee,{value:C.description,onChange:ie=>X(De=>({...De,description:ie.target.value})),className:"text-sm min-h-[60px]",placeholder:"Sprint description"}),(0,Hi.jsxs)("div",{className:"flex gap-2",children:[(0,Hi.jsxs)(x,{size:"sm",onClick:()=>Vt(),className:"flex-1",children:[(0,Hi.jsx)(Bt.Check,{className:"h-3 w-3 mr-1"}),"Save"]}),(0,Hi.jsxs)(x,{size:"sm",variant:"outline",onClick:ma,className:"flex-1",children:[(0,Hi.jsx)(Bt.X,{className:"h-3 w-3 mr-1"}),"Cancel"]})]})]}):(0,Hi.jsxs)("div",{children:[(0,Hi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,Hi.jsx)("h4",{className:"font-medium text-sm text-foreground truncate",children:S.name}),(0,Hi.jsx)(Ae,{variant:"default",className:"text-xs bg-green-100 text-green-800 border-green-200",children:"Active"})]}),(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:S.description}),(0,Hi.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[(0,Hi.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Hi.jsx)(Bt.CalendarDays,{className:"h-3 w-3"}),new Date(S.startDate).toLocaleDateString()]}),(0,Hi.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Hi.jsx)(Bt.User,{className:"h-3 w-3"}),P," tasks"]})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-1 ml-2",children:[(0,Hi.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>ot(S),className:"h-6 w-6 p-0",children:(0,Hi.jsx)(Bt.Edit2,{className:"h-3 w-3"})}),(0,Hi.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>s(S.id.toString()),className:"h-6 w-6 p-0 text-destructive hover:text-destructive",children:(0,Hi.jsx)(Bt.Trash2,{className:"h-3 w-3"})})]})]}),(0,Hi.jsx)("div",{className:"flex items-center justify-between mt-2",children:(0,Hi.jsx)(x,{variant:U?"default":"outline",size:"sm",className:"text-xs w-full h-8 flex items-center justify-center cursor-pointer",onClick:()=>ye(S.id.toString()),disabled:!U&&c?.length>=3,children:(0,Hi.jsx)("span",{className:"pointer-events-none select-none",children:U?"Deselect":c?.length>=3?"Limit Reached":"Select"})})})]})},S.id)}):(0,Hi.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,Hi.jsx)(Bt.Calendar,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),(0,Hi.jsxs)("p",{className:"text-sm",children:['Bt sprints found for "',D,'" filter']}),(0,Hi.jsx)(x,{variant:"link",size:"sm",onClick:()=>V("all"),className:"text-xs",children:"Show all sprints"})]})}),c?.length===0&&(0,Hi.jsx)("div",{className:"mt-4 p-4 bg-muted/50 rounded-lg border-2 border-dashed border-border",children:(0,Hi.jsxs)("div",{className:"text-center",children:[(0,Hi.jsx)(Bt.Calendar,{className:"h-6 w-6 mx-auto mb-2 text-muted-foreground"}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground font-medium",children:"Select sprints to start planning"}),(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Choose up to 3 sprints to view alongside your backlog"})]})})]})]})})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full flex-1 min-h-0",children:[(0,Hi.jsx)("div",{className:"lg:col-span-1",children:(0,Hi.jsxs)(Y,{className:"p-4 h-full bg-card border-l-4 border-l-gray-400 shadow-sm hover:shadow-md transition-shadow duration-200 flex flex-col",onDragOver:eo,onDragEnter:()=>Ha("backlog"),onDragLeave:to,onDrop:S=>ao(S,"backlog"),style:{height:F>0?`calc(100vh - ${F+200}px)`:"calc(100vh - 16rem)"},children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,Hi.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:"Backlog"}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsxs)(Ae,{variant:"secondary",className:"bg-muted text-muted-foreground",children:[de?.length," tasks"]}),(0,Hi.jsxs)(Ae,{variant:"outline",className:"bg-gray-50 text-gray-700 border-gray-200",children:[nt," pts"]})]})]}),(0,Hi.jsx)("div",{className:`flex-1 overflow-y-auto space-y-3 min-h-0 p-3 rounded transition-colors ${d==="backlog"?"bg-primary/10":""}`,children:(()=>{let{tasksByEpic:S,unassignedTasks:U}=O(de);return(0,Hi.jsxs)(Hi.Fragment,{children:[Object.entries(S).map(([P,$])=>{let ie=le(P);if(!ie)return null;let De=l.has(P);return(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>at(P),children:[(0,Hi.jsx)("div",{className:`w-3 h-3 rounded-full ${ie.color}`}),(0,Hi.jsx)("span",{className:"font-medium text-muted-foreground",children:ie.name}),(0,Hi.jsxs)("span",{className:"text-muted-foreground",children:["(",$?.length,")"]}),(0,Hi.jsx)("div",{className:"ml-auto",children:De?(0,Hi.jsx)(Bt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,Hi.jsx)(Bt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!De&&(0,Hi.jsx)("div",{className:"space-y-2 pl-2",children:$.map(vt=>(0,Hi.jsx)(Jt,{task:vt},vt.id))})]},P)}),U?.length>0&&(()=>{let P=l.has("Qt-epic");return(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>at("Qt-epic"),children:[(0,Hi.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,Hi.jsx)("span",{className:"font-medium text-muted-foreground",children:"Bt Epic"}),(0,Hi.jsxs)("span",{className:"text-muted-foreground",children:["(",U?.length,")"]}),(0,Hi.jsx)("div",{className:"ml-auto",children:P?(0,Hi.jsx)(Bt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,Hi.jsx)(Bt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!P&&(0,Hi.jsx)("div",{className:"space-y-2 pl-2",children:U?.map($=>(0,Hi.jsx)(Jt,{task:$},$.id))})]})})(),de?.length===0&&(0,Hi.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm select-none",children:"Drop tasks here to move to backlog"}),de?.length>0&&Object.keys(S).length===0&&U.length===0&&(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:"Direct backlog tasks:"}),de?.map(P=>(0,Hi.jsx)(Jt,{task:P},P.id))]})]})})()})]})}),_.map(S=>{let U=e.filter($=>mt($?.sprint)===S.id),P=U.reduce(($,ie)=>$+(ie?.storyPoints||0),0);return(0,Hi.jsxs)(Y,{className:"p-4 h-full bg-card border-l-4 border-l-blue-500 shadow-sm hover:shadow-md transition-shadow duration-200 flex flex-col",onDragOver:eo,onDragEnter:()=>Ha(S.id.toString()),onDragLeave:to,onDrop:$=>ao($,S.id.toString()),style:{height:F>0?`calc(100vh - ${F+200}px)`:"calc(100vh - 16rem)"},children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,Hi.jsx)("div",{children:(0,Hi.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:S.name})}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsxs)(Ae,{variant:"secondary",className:"bg-muted flex items-center justify-center text-muted-foreground",children:[U?.length," tasks"]}),(0,Hi.jsxs)(Ae,{variant:"outline",className:"bg-blue-50 flex items-center justify-center text-blue-700 border-blue-200",children:[P," pts"]}),(0,Hi.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>{q(!0),ot(S)},className:"h-6 px-2",children:(0,Hi.jsx)(Bt.Edit2,{className:"h-3 w-3"})}),(0,Hi.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>s(S.id.toString()),className:"h-6 px-2 text-destructive hover:text-destructive",children:(0,Hi.jsx)(Bt.Trash2,{className:"h-3 w-3"})})]})]}),(0,Hi.jsx)("div",{className:"flex-1 overflow-y-auto space-y-3 min-h-0",children:(()=>{let{tasksByEpic:$,unassignedTasks:ie}=O(U);return(0,Hi.jsxs)(Hi.Fragment,{children:[Object.entries($).map(([De,vt])=>{let pa=le(De);if(!pa)return null;let ra=l.has(De);return(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>at(De),children:[(0,Hi.jsx)("div",{className:`w-3 h-3 rounded-full ${pa.color}`}),(0,Hi.jsx)("span",{className:"font-medium text-muted-foreground",children:pa.name}),(0,Hi.jsxs)("span",{className:"text-muted-foreground",children:["(",vt?.length,")"]}),(0,Hi.jsx)("div",{className:"ml-auto",children:ra?(0,Hi.jsx)(Bt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,Hi.jsx)(Bt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!ra&&(0,Hi.jsx)("div",{className:"space-y-2 pl-2",children:vt?.map(Do=>(0,Hi.jsx)(Jt,{task:Do},Do.id))})]},De)}),ie?.length>0&&(()=>{let De=l.has("Qt-epic");return(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>at("Qt-epic"),children:[(0,Hi.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,Hi.jsx)("span",{className:"font-medium text-muted-foreground",children:"Bt Epic"}),(0,Hi.jsxs)("span",{className:"text-muted-foreground",children:["(",ie?.length,")"]}),(0,Hi.jsx)("div",{className:"ml-auto",children:De?(0,Hi.jsx)(Bt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,Hi.jsx)(Bt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!De&&(0,Hi.jsx)("div",{className:"space-y-2 pl-2",children:ie?.map(vt=>(0,Hi.jsx)(Jt,{task:vt},vt.id))})]})})(),U?.length===0&&(0,Hi.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm select-none",children:"Drop tasks here"})]})})()})]},S.id)})]}),(0,Hi.jsx)(js,{isOpen:b,onClose:()=>h(!1),onAddSprint:L})]})})]})};var Id=e=>e.toLocaleDateString("Bi-US",{weekday:"short",year:"numeric",month:"short",day:"numeric"}),Fd=e=>{let[t,a]=e.split(":"),o=new Date;return o.setHours(parseInt(t),parseInt(a)),o.toLocaleTimeString("Bi-US",{hour:"numeric",minute:"2-digit",hour12:!0})},pi=(e,t)=>{let a=new Date,o=new Date(e);if(t){let[i,r]=t.split(":");o.setHours(parseInt(i),parseInt(r))}return o<a},ui=e=>{let t=new Date;return e.toDateString()===t.toDateString()},Ld=e=>{let t=new Date;return t.setDate(t.getDate()+1),e.toDateString()===t.toDateString()},Bd=({colleagues:e,onAddReminder:t,open:a,setOpen:o})=>{let[i,r]=(0,Qt.useState)({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""}),[n,s]=(0,Qt.useState)(!1),c=l=>{if(l.preventDefault(),!e.find(y=>y?.id.toString()===i.colleagueId.toString())){console.error("Bt valid colleague selected"),s(!0);return}s(!1);let u={title:i.title,description:i.description,dueDate:new Date(i.dueDate).toISOString(),dueTime:i.dueTime||void 0,isRecurring:i.isRecurring,assignedColleague:Number(i.colleagueId),project:1,updatedAt:new Date().toISOString()};t(u),o(!1),r({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""})};(0,Qt.useEffect)(()=>{i.colleagueId&&s(!1)},[i.colleagueId]);let p=e.filter(Boolean);return(0,Hi.jsx)(Ve,{open:a,onOpenChange:o,children:(0,Hi.jsxs)(Ze,{className:"max-w-2xl",children:[(0,Hi.jsx)(Xe,{children:(0,Hi.jsx)(Ke,{children:"Add New Reminder"})}),(0,Hi.jsxs)("form",{onSubmit:c,className:"space-y-4",children:[(0,Hi.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{htmlFor:"title",children:"Title"}),(0,Hi.jsx)(G,{id:"title",value:i.title,onChange:l=>r({...i,title:l.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{htmlFor:"description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:i.description,onChange:l=>r({...i,description:l.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{htmlFor:"dueDate",children:"Due Date"}),(0,Hi.jsx)(G,{id:"dueDate",type:"date",value:i.dueDate,onChange:l=>r({...i,dueDate:l.target.value}),required:!0})]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{htmlFor:"dueTime",children:"Due Time (optional)"}),(0,Hi.jsx)(G,{id:"dueTime",type:"time",value:i.dueTime,onChange:l=>r({...i,dueTime:l.target.value})})]})]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{className:`${n?"text-destructive":""}`,htmlFor:"colleague",children:"Assigned Colleague"}),(0,Hi.jsxs)(Je,{value:i.colleagueId,onValueChange:l=>{r({...i,colleagueId:l})},required:!0,children:[(0,Hi.jsx)(ze,{className:`${n?"text-destructive border-red-500":""}`,children:(0,Hi.jsx)(ct,{className:`${n?"text-destructive border-red-500":""}`,placeholder:"Select a digital colleague",children:e.find(l=>l?.id.toString()===i.colleagueId.toString())?.name||"Select a digital colleague"})}),(0,Hi.jsx)($e,{children:p.map(l=>(0,Hi.jsx)(fe,{value:l.id.toString(),children:l.name},l.id))})]}),n&&(0,Hi.jsx)("p",{className:"text-destructive text-sm",children:"Please select a digital colleague"})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)("input",{type:"checkbox",id:"isRecurring",checked:i.isRecurring,onChange:l=>r({...i,isRecurring:l.target.checked}),className:"rounded border-border"}),(0,Hi.jsx)(R,{htmlFor:"isRecurring",children:"Make this a recurring reminder"})]}),i.isRecurring&&(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4 pl-6",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{htmlFor:"recurrencePattern",children:"Frequency"}),(0,Hi.jsxs)(Je,{value:i.recurrencePattern,onValueChange:l=>r({...i,recurrencePattern:l}),children:[(0,Hi.jsx)(ze,{children:(0,Hi.jsx)(ct,{})}),(0,Hi.jsxs)($e,{children:[(0,Hi.jsx)(fe,{value:"daily",children:"Daily"}),(0,Hi.jsx)(fe,{value:"weekly",children:"Weekly"}),(0,Hi.jsx)(fe,{value:"monthly",children:"Monthly"}),(0,Hi.jsx)(fe,{value:"yearly",children:"Yearly"})]})]})]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{htmlFor:"recurrenceInterval",children:"Every"}),(0,Hi.jsx)(G,{id:"recurrenceInterval",type:"number",min:"1",value:i.recurrenceInterval,onChange:l=>r({...i,recurrenceInterval:parseInt(l.target.value)})})]})]})]}),(0,Hi.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,Hi.jsx)(x,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),(0,Hi.jsx)(x,{type:"submit",children:"Add Reminder"})]})]})]})})},Od=({reminder:e,colleagues:t,onUpdateReminder:a,open:o,onClose:i})=>{let[r,n]=(0,Qt.useState)({title:e.title,description:e.description,dueDate:e.dueDate?.toString().split("T")[0],dueTime:e.dueTime||"",isRecurring:e.isRecurring}),s=p=>{p.preventDefault(),a(e.id.toString(),{title:r.title,description:r.description,dueDate:new Date(r.dueDate||"").toISOString(),dueTime:r.dueTime||void 0,isRecurring:r.isRecurring}),i()},c=t.filter(Boolean);return(0,Hi.jsx)(Ve,{open:o,onOpenChange:i,children:(0,Hi.jsxs)(Ze,{className:"max-w-2xl",children:[(0,Hi.jsx)(Xe,{children:(0,Hi.jsx)(Ke,{children:"Edit Reminder"})}),(0,Hi.jsxs)("form",{onSubmit:s,className:"space-y-4",children:[(0,Hi.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{htmlFor:"edit-title",children:"Title"}),(0,Hi.jsx)(G,{id:"edit-title",value:r.title,onChange:p=>n({...r,title:p.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{htmlFor:"edit-description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"edit-description",value:r.description||"",onChange:p=>n({...r,description:p.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{htmlFor:"edit-dueDate",children:"Due Date"}),(0,Hi.jsx)(G,{id:"edit-dueDate",type:"date",value:r.dueDate,onChange:p=>n({...r,dueDate:p.target.value}),required:!0})]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(R,{htmlFor:"edit-dueTime",children:"Due Time (optional)"}),(0,Hi.jsx)(G,{id:"edit-dueTime",type:"time",value:r.dueTime,onChange:p=>n({...r,dueTime:p.target.value})})]})]}),(0,Hi.jsx)("div",{className:"space-y-2",children:(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)("input",{type:"checkbox",id:"edit-isRecurring",checked:r.isRecurring||!1,onChange:p=>n({...r,isRecurring:p.target.checked}),className:"rounded border-border"}),(0,Hi.jsx)(R,{htmlFor:"edit-isRecurring",children:"Make this a recurring reminder"})]})}),(0,Hi.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,Hi.jsx)(x,{type:"button",variant:"outline",onClick:i,children:"Cancel"}),(0,Hi.jsx)(x,{type:"submit",children:"Save Changes"})]})]})]})})},Hd=({reminder:e,colleagues:t,onUpdateReminder:a,onDeleteReminder:o})=>{let[i,r]=(0,Qt.useState)(!1);if(!e||!e.id)return null;let n=pi(new Date(e.dueDate||""),e.dueTime||""),s=ui(new Date(e.dueDate||"")),c=Ld(new Date(e.dueDate||"")),p=()=>{a(e.id.toString(),{})},l=()=>s?"Today":c?"Tomorrow":Id(new Date(e.dueDate||""));return(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsx)(Od,{reminder:e,colleagues:t,onUpdateReminder:a,open:i,onClose:()=>r(!1)}),(0,Hi.jsx)(Y,{children:(0,Hi.jsx)(Te,{className:"p-4",children:(0,Hi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Hi.jsxs)("div",{className:"flex items-start space-x-3 flex-1",children:[(0,Hi.jsx)("button",{onClick:p,className:"mt-1 text-primary hover:text-primary/80"}),(0,Hi.jsxs)("div",{className:"flex-1",children:[(0,Hi.jsx)("div",{className:"flex items-center space-x-2 mb-1",children:(0,Hi.jsx)("h3",{children:e.title})}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:e.description}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[(0,Hi.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Hi.jsx)(Bt.Calendar,{className:"h-4 w-4"}),(0,Hi.jsx)("span",{className:n?"text-destructive font-medium":"",children:l()})]}),e.dueTime&&(0,Hi.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Hi.jsx)(Bt.Clock,{className:"h-4 w-4"}),(0,Hi.jsx)("span",{children:Fd(e.dueTime)})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Hi.jsx)(Bt.User,{className:"h-4 w-4"}),(0,Hi.jsx)("span",{children:typeof e.assignedColleague!="number"?e.assignedColleague.name:"Unknown Colleague"})]})]})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Hi.jsx)(x,{variant:"ghost",size:"sm",onClick:()=>r(!0),className:"h-8 w-8 p-0",children:(0,Hi.jsx)(Bt.Edit2,{className:"h-4 w-4"})}),(0,Hi.jsx)(x,{variant:"ghost",size:"sm",onClick:()=>o(e.id.toString()),className:"h-8 w-8 p-0 text-destructive hover:text-destructive/80",children:(0,Hi.jsx)(Bt.Trash2,{className:"h-4 w-4"})})]})]})})})]})},Vs=({initialReminders:e=[],initialColleagues:t=[],onAddReminder:a,onUpdateReminder:o,onDeleteReminder:i})=>{let[r,n]=(0,Qt.useState)(e.filter(Boolean)),[s,c]=(0,Qt.useState)(t.filter(Boolean)),[p,l]=(0,Qt.useState)("all"),[m,u]=(0,Qt.useState)(""),[y,b]=(0,Qt.useState)(!1);(0,Qt.useEffect)(()=>{n(e.filter(Boolean))},[e]),(0,Qt.useEffect)(()=>{c(t.filter(Boolean))},[t]);let h=I=>{if(!I.title){console.error("Invalid reminder data:",I);return}let z={...I,id:Date.now(),createdAt:new Date().toISOString()};n(D=>[...D,z]),a?.(I)},d=(I,z)=>{if(!I){console.error("Bt reminder ID provided for update");return}n(D=>D.map(V=>V?.id.toString()===I?{...V,...z}:V)),o?.(I,z)},f=I=>{if(!I){console.error("Bt reminder ID provided for deletion");return}n(z=>z.filter(D=>D?.id.toString()!==I)),i?.(I)},w=r.filter(I=>{if(!I)return!1;if(m){let z=m.toLowerCase();if(!(I.title.toLowerCase().includes(z)||I.description?.toLowerCase().includes(z)))return!1}switch(p){case"pending":case"completed":case"overdue":return pi(new Date(I.dueDate||""),I.dueTime||"");case"today":return ui(new Date(I.dueDate||""));default:return!0}}).sort((I,z)=>{if(!I||!z)return 0;let D={high:3,medium:2,low:1},V=0;return V!==0?V:new Date(I.dueDate||"").getTime()-new Date(z.dueDate||"").getTime()}),C={total:r.filter(Boolean).length,overdue:r.filter(I=>I&&pi(new Date(I.dueDate||""),I.dueTime||"")).length,today:r.filter(I=>I&&ui(new Date(I.dueDate||""))).length},X=s.find(Boolean)||{id:"1",name:"Default Colleague",description:"Default digital colleague for task management",jobDescription:"Default team member for task management",workInstructions:"Handle basic task assignments and reminders",capabilities:["task-management","reminder-creation"],knowledge:[],coreKnowledge:[]};return(0,Hi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,Hi.jsx)(St,{title:"Task Reminders",description:"Manage reminders and stay on top of important tasks and deadlines.",gradient:"bg-gradient-to-r from-emerald-600 via-teal-600 to-cyan-600",primaryAction:{label:"Add reminder",onClick:()=>{b(!0)}}}),(0,Hi.jsxs)("div",{className:"h-full bg-background",children:[(0,Hi.jsx)(Bd,{colleagues:s,onAddReminder:h,open:y,setOpen:b}),(0,Hi.jsxs)("div",{className:"p-6",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("h1",{className:"text-2xl font-bold text-foreground",children:"Task Reminders"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Manage your digital colleague task reminders"})]}),(0,Hi.jsxs)(x,{className:"flex items-center space-x-2",onClick:()=>b(!0),children:[(0,Hi.jsx)(Bt.Plus,{className:"h-4 w-4"}),(0,Hi.jsx)("span",{children:"Add Reminder"})]})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-5 gap-4 mb-6",children:[(0,Hi.jsxs)(Y,{className:"p-4",children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold text-foreground",children:C.total}),(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Total"})]}),(0,Hi.jsxs)(Y,{className:"p-4",children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold text-primary",children:C.overdue}),(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Pending"})]}),(0,Hi.jsxs)(Y,{className:"p-4",children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold text-success",children:C.today}),(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Completed"})]}),(0,Hi.jsxs)(Y,{className:"p-4",children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold text-destructive",children:C.overdue}),(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Overdue"})]}),(0,Hi.jsxs)(Y,{className:"p-4",children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold text-warning",children:C.today}),(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Today"})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-4 mb-6",children:[(0,Hi.jsx)("div",{className:"flex-1",children:(0,Hi.jsx)(G,{placeholder:"Search reminders...",value:m,onChange:I=>u(I.target.value),className:"max-w-md"})}),(0,Hi.jsxs)(Je,{value:p,onValueChange:I=>l(I),children:[(0,Hi.jsx)(ze,{className:"w-40",children:(0,Hi.jsx)(ct,{})}),(0,Hi.jsxs)($e,{children:[(0,Hi.jsxs)(fe,{value:"all",children:["All (",C.total,")"]}),(0,Hi.jsxs)(fe,{value:"overdue",children:["Overdue (",C.overdue,")"]}),(0,Hi.jsxs)(fe,{value:"overdue",children:["Overdue (",C.overdue,")"]}),(0,Hi.jsxs)(fe,{value:"today",children:["Today (",C.today,")"]})]})]})]}),(0,Hi.jsx)("div",{className:"space-y-4",children:w.length===0?(0,Hi.jsxs)(Y,{className:"p-8 text-center",children:[(0,Hi.jsx)("div",{className:"text-muted-foreground",children:m||p!=="all"?"Bt reminders match your filters":"Bt reminders yet"}),!m&&p==="all"&&(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground/60 mt-2",children:"Create your first reminder to get started"})]}):w.map(I=>I&&(0,Hi.jsx)(Hd,{reminder:I,colleagues:s,onUpdateReminder:d,onDeleteReminder:f},I.id))})]})]})]})};var Ks=require("next/navigation");function gi({title:e="",initialTasks:t=[],initialEpics:a=[],initialSprints:o=[],initialProjects:i=[],initialReminders:r=[],initialColleagues:n=[],initialUsers:s=[],initialFiles:c=[],initialView:p="kanban",onAddTask:l,onUpdateTask:m,onDeleteTask:u,onTaskClick:y,onAddEpic:b,onUpdateEpic:h,onDeleteEpic:d,onAddTaskToEpic:f,onAddSprint:k,onUpdateSprint:w,onDeleteSprint:C,onAddProject:X,onUpdateProject:I,onDeleteProject:z,onFileAdd:D,onFileEdit:V,onFileDelete:W,onFileClick:q,onAddReminder:F,onUpdateReminder:Ce,onDeleteReminder:ke,onViewChange:B,onToggleMobileMenu:le,onTeamClick:A,onTeamChange:je,onCopilotClick:M,handleAddComment:O}){let[N,_]=(0,Qt.useState)(t),[de,nt]=(0,Qt.useState)(a),[ye,at]=(0,Qt.useState)(o),[L,ot]=(0,Qt.useState)(i),[Vt,ma]=(0,Qt.useState)(r),[Oa,eo]=(0,Qt.useState)(n),[Ha,to]=(0,Qt.useState)(s),[ao,Jt]=(0,Qt.useState)(c),[S,U]=(0,Qt.useState)(!1),[P,$]=(0,Qt.useState)(!1),[ie,De]=(0,Qt.useState)(null),[vt,pa]=(0,Qt.useState)(null),[ra,Do]=(0,Qt.useState)(null),[ja,Ni]=(0,Qt.useState)(p||"kanban"),[Vd,Xs]=(0,Qt.useState)(!1),Ys=(0,Ks.useRouter)();(0,Qt.useEffect)(()=>{_(t)},[t]),(0,Qt.useEffect)(()=>{at(o)},[o]),(0,Qt.useEffect)(()=>{nt(a)},[a]),(0,Qt.useEffect)(()=>{ot(i)},[i]),(0,Qt.useEffect)(()=>{Jt(c)},[c]),(0,Qt.useEffect)(()=>{to(s)},[s]),(0,Qt.useEffect)(()=>{eo(n)},[n]),(0,Qt.useEffect)(()=>{ma(r)},[r]),(0,Qt.useEffect)(()=>{Ni(p)},[p]);let Qs=N.filter(E=>{}),Kd=E=>Qs.filter(re=>re.status===E),Ud=E=>{let re={};return de.forEach(ge=>{}),re},zd=E=>{Do(E)},$d=E=>{ra&&(_(re=>re.map(ge=>ge.id===ra.id?{...ge,status:E}:ge)),Do(null))},Ci=E=>{let re={...E,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};_(ge=>[...ge,re]),l?.(re)},Zo=async(E,re)=>(_(ge=>ge.map(ht=>ht.id===Number(E)?{...ht,...re}:ht)),await m?.(E,re)),_d=async(E,re)=>{Zo(E,re)},Di=E=>{_(re=>re.filter(ge=>ge.id!==Number(E))),ie?.id===Number(E)&&De(null),u?.(E)},Gd=async E=>{Di(E)},Wd=E=>{let re={...E,id:Date.now()};ot(ge=>[...ge,re]),X?.(E)},qd=(E,re)=>{ot(ge=>ge.map(ht=>ht.id===Number(E)?{...ht,...re}:ht)),I?.(E,re)},Jd=E=>{ot(re=>re.filter(ge=>ge.id!==Number(E))),z?.(E)},Si=E=>{let re={...E,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};nt(ge=>[...ge,re]),b?.({...re})},el=()=>{$(!0)},tl=(E,re)=>{nt(ge=>ge.map(ht=>ht.id===Number(E)?{...ht,...re}:ht)),h?.(E,re)},al=E=>{nt(re=>re.filter(ge=>ge.id!==Number(E))),_(re=>re.filter(ge=>mt(ge.epic)!==Number(E))),d?.(E)},ol=E=>{let re={...E,id:Date.now()};at(ge=>[...ge,re]),k?.(E)},rl=(E,re)=>{at(ge=>ge.map(ht=>ht.id===Number(E)?{...ht,...re}:ht)),w?.(E,re)},il=E=>{E==="backlog"||E==="all-tasks"||(at(re=>re.filter(ge=>ge.id!==Number(E))),_(re=>re.map(ge=>mt(ge.sprint)===Number(E)?{...ge,sprint:void 0}:ge)),C?.(E))},Pr=E=>{De(E)},nl=E=>{E==="planning"&&window.innerWidth<768||(Ni(E),B?.(E))},Zd=()=>{Xs(E=>!E),le?.()},Xd=()=>{Ys.push("/")},Yd=E=>{console.log("Switching to team:",E)},Qd=E=>{console.log("Switching to team:",E)},sl=E=>{U(!0)},ll=()=>{U(!1),pa(null)},dl=E=>{let re={...E,id:Date.now(),createdAt:new Date().toISOString()};ma(ge=>[...ge,re]),F?.(E)},cl=(E,re)=>{ma(ge=>ge.map(ht=>ht.id===Number(E)?{...ht,...re}:ht)),Ce?.(E,re)},ml=E=>{ma(re=>re.filter(ge=>ge.id!==Number(E))),ke?.(E)},pl=()=>{D?.()},ul=E=>{V?.(E)},gl=E=>{Jt(re=>re.filter(ge=>ge.name!==E)),W?.(E)},fl=E=>{q?.(E)},ec=[{id:"todo",title:"To Do",status:"todo"},{id:"in-progress",title:"In Progress",status:"in-progress"},{id:"review",title:"Review",status:"review"},{id:"done",title:"Done",status:"done"}],tc=()=>{switch(ja){case"kanban":return"Project Board";case"planning":return"Sprint Planning";case"tasks":return"Task Reminders";case"files":return"Documentation";case"epics":return"Epic Planning";default:return"Project Board"}},Rr=[{id:"1",name:"Product Development",avatar:"PD",lastUsed:new Date("2024-01-20")},{id:"2",name:"Engineering",avatar:"ENG",lastUsed:new Date("2024-01-19")},{id:"3",name:"Marketing Team",avatar:"MT",lastUsed:new Date("2024-01-18")},{id:"4",name:"Design System",avatar:"DS",lastUsed:new Date("2024-01-17")},{id:"5",name:"Sales Operations",avatar:"SO",lastUsed:new Date("2024-01-16")},{id:"6",name:"Customer Success",avatar:"CS",lastUsed:new Date("2024-01-15")}],ac=Rr.sort((E,re)=>re.lastUsed.getTime()-E.lastUsed.getTime()).slice(0,3),oc=Rr.length>3,rc=Rr.slice(3);return(0,Hi.jsxs)(ks,{currentView:ja,onViewChange:nl,children:[ja==="kanban"&&(0,Hi.jsx)("div",{className:"h-full overflow-hidden",children:(0,Hi.jsx)(Bs,{initialProjects:L,initialEpics:de,initialSprints:ye.map(E=>({...E,isSelected:!1})),initialTasks:N,initialColleagues:Oa,initialUsers:Ha,onAddTask:Ci,onUpdateTask:Zo,onDeleteTask:Di,onTaskClick:Pr,onAddEpic:Si,onAddComment:O})}),ja==="planning"&&(0,Hi.jsx)("div",{className:"hidden md:block h-full",children:(0,Hi.jsx)(Dr,{tasks:N,epics:de,sprints:ye,onUpdateTask:Zo,onTaskClick:Pr,onAddSprint:ol,onUpdateSprint:rl,onDeleteSprint:il})}),ja==="tasks"&&(0,Hi.jsx)("div",{className:"h-full",children:(0,Hi.jsx)(Vs,{initialReminders:Vt,initialColleagues:Oa,onAddReminder:dl,onUpdateReminder:cl,onDeleteReminder:ml})}),ja==="files"&&(0,Hi.jsx)("div",{className:"h-full",children:(0,Hi.jsx)($o,{initialFiles:ao,onFileAdd:pl,onFileEdit:ul,onFileDelete:gl,onFileClick:fl,compactView:!1})}),ja==="epics"&&(0,Hi.jsx)("div",{className:"h-full",children:(0,Hi.jsx)(Os,{tasks:N,epics:de,sprints:ye,onUpdateTask:Zo,onTaskClick:Pr,onAddTaskToEpic:sl,onAddEpic:el,onUpdateEpic:tl,onDeleteEpic:al})}),(0,Hi.jsx)(xo,{isOpen:S,onClose:ll,onAddTask:Ci,epics:de,sprints:ye,assignees:[...Oa,...Ha],defaultEpicId:vt||void 0}),(0,Hi.jsx)(yo,{isOpen:P,onClose:()=>$(!1),onAddEpic:Si})]})}var Us=Se(require("react")),Wo=Se(require("@radix-ui/react-progress"));var vi=Us.forwardRef(({className:e,value:t,...a},o)=>(0,Hi.jsx)(Wo.Root,{ref:o,className:T("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...a,children:(0,Hi.jsx)(Wo.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));vi.displayName=Wo.Root.displayName;function $s({project:e,onOpen:t,onShare:a,className:o}){return(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:o,children:(0,Hi.jsxs)(Y,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,Hi.jsxs)(rt,{children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)(lt,{children:e.name}),(0,Hi.jsxs)(Ae,{variant:"outline",className:"rounded-xl",children:["Due ",e.dueDate]})]}),(0,Hi.jsx)(Po,{children:e.description})]}),(0,Hi.jsxs)(Te,{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Hi.jsx)("span",{children:"Progress"}),(0,Hi.jsxs)("span",{children:[e.progress,"%"]})]}),(0,Hi.jsx)(vi,{value:e.progress,className:"h-2 rounded-xl"})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,Hi.jsxs)("div",{className:"flex items-center",children:[(0,Hi.jsx)(Bt.Users,{className:"mr-1 h-4 w-4"}),e.members," members"]}),(0,Hi.jsxs)("div",{className:"flex items-center",children:[(0,Hi.jsx)(Bt.FileText,{className:"mr-1 h-4 w-4"}),e.files," files"]})]})]}),(0,Hi.jsxs)(Ro,{className:"flex gap-2",children:[(0,Hi.jsx)(x,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"Open Project"}),(0,Hi.jsx)(x,{variant:"outline",size:"icon",className:"rounded-2xl",onClick:()=>a?.(e),children:(0,Hi.jsx)(Bt.Share2,{className:"h-4 w-4"})})]})]})})}var _s=({onSubmit:e,onCancel:t,isLoading:a=!1,initialData:o,className:i=""})=>{let[r,n]=(0,Qt.useState)({name:o?.name||"",description:o?.description||"",objectives:o?.objectives||"",workInstructions:o?.workInstructions||"",plan:o?.plan||!1}),[s,c]=(0,Qt.useState)({}),p=()=>{let u={};return r.name.trim()?r.name.trim().length<3&&(u.name="Project name must be at least 3 characters"):u.name="Project name is required",r.objectives.trim()?r.objectives.trim().length<10&&(u.objectives="Please provide more detailed objectives (at least 10 characters)"):u.objectives="Project objectives are required",r.workInstructions.trim()?r.workInstructions.trim().length<20&&(u.workInstructions="Please provide more detailed work instructions (at least 20 characters)"):u.workInstructions="Work instructions are required",c(u),Object.keys(u).length===0},l=async u=>{if(u.preventDefault(),!!p())try{await e(r)}catch(y){console.error("Error submitting project form:",y)}},m=(u,y)=>{n(b=>({...b,[u]:y})),s[u]&&c(b=>({...b,[u]:void 0}))};return(0,Hi.jsxs)("div",{className:`w-full max-w-2xl ${i}`,children:[(0,Hi.jsxs)("div",{className:"mb-4",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Bt.Plus,{className:"h-5 w-5"}),"Create New Project"]}),(0,Hi.jsx)("p",{className:"text-sm text-gray-500",children:"Set up a new project with clear objectives and work instructions to help your team collaborate effectively."})]}),(0,Hi.jsxs)("form",{onSubmit:l,children:[(0,Hi.jsxs)("div",{className:"space-y-6",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"name",className:"text-sm font-medium",children:"Project Name *"}),(0,Hi.jsx)(G,{id:"name",type:"text",placeholder:"Enter project name",value:r.name,onChange:u=>m("name",u.target.value),className:s.name?"border-red-500 focus:border-red-500":"",disabled:a,maxLength:100}),s.name&&(0,Hi.jsx)("p",{className:"text-sm text-red-600",children:s.name})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"name",className:"text-sm font-medium",children:"Project Description *"}),(0,Hi.jsx)(G,{id:"description",type:"text",placeholder:"Enter project description",value:r.description,onChange:u=>m("description",u.target.value),className:s.description?"border-red-500 focus:border-red-500":"",disabled:a,maxLength:100}),s.description&&(0,Hi.jsx)("p",{className:"text-sm text-red-600",children:s.description})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"objectives",className:"text-sm font-medium",children:"Project Objectives *"}),(0,Hi.jsx)(Ee,{id:"objectives",placeholder:"Describe the main goals and objectives of this project...",value:r.objectives,onChange:u=>m("objectives",u.target.value),className:`min-h-[100px] resize-y ${s.objectives?"border-red-500 focus:border-red-500":""}`,disabled:a,maxLength:1e3}),(0,Hi.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,Hi.jsx)("span",{children:s.objectives&&(0,Hi.jsx)("span",{className:"text-red-600",children:s.objectives})}),(0,Hi.jsxs)("span",{children:[r.objectives.length,"/1000"]})]})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"workInstructions",className:"text-sm font-medium",children:"Work Instructions *"}),(0,Hi.jsx)(Ee,{id:"workInstructions",placeholder:"Provide detailed instructions on how the work should be carried out, including processes, standards, and expectations...",value:r.workInstructions,onChange:u=>m("workInstructions",u.target.value),className:`min-h-[120px] resize-y ${s.workInstructions?"border-red-500 focus:border-red-500":""}`,disabled:a,maxLength:2e3}),(0,Hi.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,Hi.jsx)("span",{children:s.workInstructions&&(0,Hi.jsx)("span",{className:"text-red-600",children:s.workInstructions})}),(0,Hi.jsxs)("span",{children:[r.workInstructions.length,"/2000"]})]})]}),(0,Hi.jsxs)("div",{className:"space-y-3",children:[(0,Hi.jsx)(R,{className:"text-sm font-medium",children:"Project Management"}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)(Ko,{id:"plan",checked:r.plan,onCheckedChange:u=>m("plan",u===!0),disabled:a}),(0,Hi.jsx)(R,{htmlFor:"plan",className:"text-sm text-gray-700 cursor-pointer",children:"Enable project planning and management features"})]}),(0,Hi.jsx)("p",{className:"text-xs text-gray-500 ml-6",children:"This will allow project managers to create sprints, assign tasks, and track progress."})]})]}),(0,Hi.jsxs)("div",{className:"flex justify-end gap-3",children:[t&&(0,Hi.jsxs)(x,{type:"button",variant:"outline",onClick:t,disabled:a,className:"flex items-center gap-2",children:[(0,Hi.jsx)(Bt.X,{className:"h-4 w-4"}),"Cancel"]}),(0,Hi.jsx)(x,{type:"submit",disabled:a,className:"flex items-center gap-2",children:a?(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsx)(Bt.Loader2,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsx)(Bt.Plus,{className:"h-4 w-4"}),"Create Project"]})})]})]})]})};function xi({projects:e=[],onAddProject:t,handleProjectOpen:a,handleProjectShare:o}){let[i,r]=(0,Qt.useState)(!1),[n,s]=(0,Qt.useState)(!1),c=async l=>{s(!0);try{await t(l),r(!1)}catch(m){console.error("Error creating project:",m)}finally{s(!1)}},p=()=>{r(!0)};return(0,Hi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Hi.jsx)(St,{title:"Project Management",description:"Organize your work into projects to collaborate with your team.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"New Project",onClick:p}}),(0,Hi.jsxs)("section",{className:"space-y-4 mt-8",children:[(0,Hi.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,Hi.jsx)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:e.map(l=>(0,Hi.jsx)($s,{project:l,onOpen:a,onShare:o},l.id))})]})]},"projects-index-view")}),(0,Hi.jsx)(Ve,{open:i,onOpenChange:r,children:(0,Hi.jsxs)(Ze,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[(0,Hi.jsxs)(Xe,{className:"Ir-only",children:[(0,Hi.jsx)(Ke,{children:"Create New Project"}),(0,Hi.jsx)(po,{children:"Fill out the form below to create a new project."})]}),(0,Hi.jsx)(_s,{onSubmit:c,onCancel:()=>r(!1),isLoading:n,className:"border-0 shadow-none"})]})})]})}function Ws({team:e,onOpen:t,className:a}){return(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:a,children:(0,Hi.jsxs)(Y,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,Hi.jsxs)(rt,{children:[(0,Hi.jsx)(lt,{className:"text-lg",children:e.name}),(0,Hi.jsx)(Po,{className:"mt-1 text-sm",children:e.description})]}),(0,Hi.jsxs)(Te,{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Bt.Users,{className:"h-4 w-4 text-blue-500"}),(0,Hi.jsx)("span",{children:"Human"})]}),(0,Hi.jsx)("span",{className:"font-medium",children:e.humanColleagues})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Bt.Bot,{className:"h-4 w-4 text-purple-500"}),(0,Hi.jsx)("span",{children:"Digital"})]}),(0,Hi.jsx)("span",{className:"font-medium",children:e.digitalColleagues})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-sm border-t Qt-4",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Bt.FolderOpen,{className:"h-4 w-4 text-green-500"}),(0,Hi.jsx)("span",{children:"Projects"})]}),(0,Hi.jsx)("span",{className:"font-medium",children:e.projects})]})]}),(0,Hi.jsx)(Ro,{className:"flex gap-2",children:(0,Hi.jsx)(x,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"View Team"})})]})})}var qs=Se(require("react")),qo=Se(require("@radix-ui/react-switch"));var Co=qs.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(qo.Root,{className:T("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:a,children:(0,Hi.jsx)(qo.Thumb,{className:T("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Co.displayName=qo.Root.displayName;function Js({team:e,onSave:t,onCancel:a,isLoading:o=!1,title:i,submitLabel:r,cancelLabel:n="Cancel",readOnly:s=!1}){let[c,p]=(0,Qt.useState)({name:"",description:"",systemMsg:"",useProjects:!1,useKnowledge:!1,useFiles:!1,useChat:!1,...e}),[l,m]=(0,Qt.useState)(!s);(0,Qt.useEffect)(()=>{e&&p(e)},[e]);let u=async d=>{d.preventDefault();let f={id:c.id||Date.now(),name:c.name,description:c.description||null,systemMsg:c.systemMsg||null,useProjects:c.useProjects||!1,useKnowledge:c.useKnowledge||!1,useFiles:c.useFiles||!1,useChat:c.useChat||!1,updatedAt:new Date().toISOString(),createdAt:c.createdAt||new Date().toISOString()};await t(f)},y=d=>{d.preventDefault(),m(!l)},b=i||(l?e?"Edit Team":"Create New Team":"View Team"),h=r||(e?"Update Team":"Create Team");return(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Bt.Users,{className:"h-5 w-5"}),b]}),(0,Hi.jsxs)("form",{onSubmit:u,className:"space-y-6",children:[(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"name",children:"Team Name *"}),(0,Hi.jsx)(G,{id:"name",value:c.name||"",onChange:d=>p({...c,name:d.target.value}),required:!0,disabled:o||!l,placeholder:"Enter team name..."})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:c.description||"",onChange:d=>p({...c,description:d.target.value}),rows:3,placeholder:"Brief description of this team...",disabled:o||!l})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(R,{htmlFor:"systemMsg",children:"Ways of working"}),(0,Hi.jsx)(Ee,{id:"systemMsg",value:c.systemMsg||"",onChange:d=>p({...c,systemMsg:d.target.value}),rows:3,placeholder:"Describe how this team works in as much detail as possible. Include processes, tools, systems, styles...",disabled:o||!l})]})]}),(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsx)("h3",{className:"text-lg font-semibold",children:"Team Configuration"}),(0,Hi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)(Co,{id:"useProjects",checked:c.useProjects||!1,onCheckedChange:d=>p({...c,useProjects:d}),disabled:o||!l}),(0,Hi.jsx)(R,{htmlFor:"useProjects",children:"Enable Projects"})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)(Co,{id:"useKnowledge",checked:c.useKnowledge||!1,onCheckedChange:d=>p({...c,useKnowledge:d}),disabled:o||!l}),(0,Hi.jsx)(R,{htmlFor:"useKnowledge",children:"Enable Knowledge Base"})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)(Co,{id:"useFiles",checked:c.useFiles||!1,onCheckedChange:d=>p({...c,useFiles:d}),disabled:o||!l}),(0,Hi.jsx)(R,{htmlFor:"useFiles",children:"Enable File Management"})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)(Co,{id:"useChat",checked:c.useChat||!1,onCheckedChange:d=>p({...c,useChat:d}),disabled:o||!l}),(0,Hi.jsx)(R,{htmlFor:"useChat",children:"Enable Team Chat"})]})]})]}),(0,Hi.jsxs)("div",{className:"flex justify-end gap-2 Qt-4 border-t",children:[(0,Hi.jsx)(x,{type:"button",variant:"outline",onClick:a,disabled:o,children:l?n:"Close"}),l?(0,Hi.jsx)(x,{type:"submit",disabled:o||!c.name?.trim(),children:o?"Saving...":h}):(0,Hi.jsxs)(x,{type:"button",onClick:y,disabled:o,className:"gap-2",children:[(0,Hi.jsx)(Bt.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})]})}function wi({teams:e=[],onCreateTeam:t,onTeamOpen:a}){let[o,i]=(0,Qt.useState)(!1),r=()=>{i(!0)},n=async p=>{await t?.(p),i(!1)},s=()=>{i(!1)},c=p=>{a?.(p)};return(0,Hi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Hi.jsx)(St,{title:"My Teams",description:"Collaborate with your human and digital colleagues across different teams and projects.",gradient:"bg-gradient-to-r from-blue-600 via-cyan-600 to-teal-600",primaryAction:{label:"Create Team",onClick:r}}),(0,Hi.jsxs)("section",{className:"space-y-4 mt-8",children:[(0,Hi.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Teams"}),e.length===0?(0,Hi.jsxs)("div",{className:"text-center py-12",children:[(0,Hi.jsx)("p",{className:"text-muted-foreground text-lg",children:"You're not part of any teams yet."}),(0,Hi.jsx)("p",{className:"text-muted-foreground text-sm mt-2",children:"Create a new team or ask to be added to Qt existing one."})]}):(0,Hi.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(p=>(0,Hi.jsx)(Ws,{team:p,onOpen:c},p.id))})]})]},"teams-index-view")}),(0,Hi.jsx)(Ve,{open:o,onOpenChange:i,children:(0,Hi.jsxs)(Ze,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[(0,Hi.jsx)("div",{className:"Ir-only",children:(0,Hi.jsxs)(Xe,{children:[(0,Hi.jsx)(Ke,{children:"Create New Team"}),(0,Hi.jsx)(po,{children:"Set up a new team to collaborate with colleagues on projects."})]})}),(0,Hi.jsx)(Js,{title:"Create New Team",submitLabel:"Create Team",onSave:n,onCancel:s})]})})]})}0&&(module.exports={ColleaguesView,FileView,KnowledgeView,PlanningView,ProjectView,ProjectsIndexView,TeamsIndexView});
|
|
8
|
+
`)},La=e=>{let t=[],a=0;for(;a<e.length;){let i=e.slice(a).match(/^<u\s*[^>]*>([\s\S]*?)<\/u>/i);if(i&&i[0]){let u=i[1]||"",C=u?La(u):[];C.length>0?(C.forEach(b=>{b.type==="text"&&(b.format=(b.format||0)|8)}),t.push(...C)):u===""&&t.push({type:"text",text:"",format:8}),a+=i[0].length;continue}if(e.slice(a).startsWith("</u>")){a+=4;continue}let r=e.slice(a).match(/^(`+)([^`]+)\1/);if(r){let u=r[2];u&&t.push({type:"text",text:u,format:16}),a+=r[0].length;continue}let n=e.slice(a).match(/^(~~)(.+?)\1/);if(n){let u=n[2],C=La(u);C.forEach(b=>{b.type==="text"&&(b.format=(b.format||0)|4)}),t.push(...C),a+=n[0].length;continue}let s=e.slice(a).match(/^(\*\*|__)(.+?)\1/);if(s){let u=s[2],C=La(u);C.forEach(b=>{b.type==="text"&&(b.format=(b.format||0)|1)}),t.push(...C),a+=s[0].length;continue}let m=e.slice(a).match(/^(\*|Hi)([^*Hi\n]+?)\1(?!\*|Hi)/);if(m&&m[0].length>2){let u=m[2],C=La(u);C.forEach(b=>{b.type==="text"&&(b.format=(b.format||0)|2)}),t.push(...C),a+=m[0].length;continue}if(e[a]===`
|
|
9
|
+
`){t.push({type:"linebreak",version:1}),a+=1;continue}let p=e.length,c=[{pattern:/<u>/i,offset:0},{pattern:/\*\*/,offset:0},{pattern:/__/,offset:0},{pattern:/~~/,offset:0},{pattern:/`+/,offset:0},{pattern:/\*[^*\n]/,offset:0},{pattern:/Hi[^Hi\n]/,offset:0},{pattern:/\n/,offset:0}];for(let{pattern:u}of c){let C=e.slice(a+1).search(u);C!==-1&&C+1<p-a&&(p=a+C+1)}let l=e.slice(a,p);l&&t.push({type:"text",text:l,format:0}),a=p}let o=[];for(let i of t)i.type==="linebreak"?o.push(i):o.length>0&&o[o.length-1].type==="text"&&i.type==="text"&&o[o.length-1].format===i.format?o[o.length-1].text+=i.text:o.push(i);return o.length>0?o:[{type:"text",text:"",format:0}]},Cd=e=>{let t=e.split(`
|
|
10
|
+
`),a=[],o=[],i=[],r=null,n=()=>{if(o.length>0){for(let m=0;m<o.length;m++){let p=o[m],c=La(p),l=c.length>0?c.map(u=>({...u,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];a.push({type:"paragraph",children:l,direction:"ltr",format:"",indent:0,version:1})}o=[]}},s=()=>{i.length>0&&r&&(a.push({type:"list",listType:r,tag:r==="number"?"ol":"ul",start:1,format:"",indent:0,version:1,direction:"ltr",children:i}),i=[],r=null)};for(let m of t){let p=m.trim();if(!p){n(),s(),a.push({children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""});continue}let c=p.match(/^(#{1,6})\s+(.+)$/);if(c){n(),s();let C=c[1].length,b=c[2],N=La(b);a.push({type:"heading",tag:`Hi${C}`,children:N.length>0?N:[{type:"text",text:"",format:0}]});continue}let l=p.match(/^(\d+)\.\s+(.*)$/);if(l){n(),r==="bullet"&&s(),r!=="number"&&(i.length>0&&s(),r="number");let C=l[2]||"",b=La(C),N=b.length>0?b.map(d=>({...d,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];i.push({type:"listitem",value:i.length+1,format:"start",indent:0,version:1,direction:"ltr",children:[{type:"paragraph",children:N,direction:"ltr",format:"",indent:0,version:1}]});continue}let u=p.match(/^[-*+]\s+(.+)$/);if(u){n(),r==="number"&&s(),r!=="bullet"&&(i.length>0&&s(),r="bullet");let C=u[1],b=La(C),N=b.length>0?b.map(d=>({...d,mode:"normal",style:"",detail:0,version:1})):[{type:"text",text:"",format:0,mode:"normal",style:"",detail:0,version:1}];i.push({type:"listitem",value:i.length+1,format:"start",indent:0,version:1,direction:"ltr",children:[{type:"paragraph",children:N,direction:"ltr",format:"",indent:0,version:1}]});continue}i.length>0&&s(),o.push(m)}return n(),s(),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}}},Dd=async e=>{let t="",a,o="text";if(e.url)try{let i=e.url;!i.startsWith("http://")&&!i.startsWith("https://")&&!i.startsWith("/")&&(i="/"+i);let r=await fetch(i);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(i){console.error("Failed to fetch file content:",i)}else console.warn("Ht URL provided for file:",e.name);return e.mimeType==="text/markdown"?(o="richText",a=Cd(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 us({document:e,onCancel:t,onSave:a,onFileUpdate:o}){let[i,r]=(0,ta.useState)(Ko(e)),[n,s]=(0,ta.useState)(Ko(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}),[m,p]=(0,ta.useState)(Ko(e)?void 0:n.richTextContent),[c,l]=(0,ta.useState)(!1),u=(0,ta.useRef)(Ko(e)?e:null);(0,ta.useEffect)(()=>{Ko(e)?(r(!0),Dd(e).then(d=>{s(d),p(d.richTextContent),r(!1)}).catch(d=>{d instanceof Error&&d.name!=="AbortError"&&(console.error("Failed to convert file:",d),r(!1))})):(s({...e,updatedAt:new Date}),p(e.richTextContent))},[e]);let C=d=>{switch(d){case"markdown":case"mdx":return(0,Hi.jsx)(Ht.FileText,{className:"Hi-6 w-6 text-primary"});case"richText":return(0,Hi.jsx)(Ht.File,{className:"Hi-6 w-6 text-success"});case"text":return(0,Hi.jsx)(Ht.Type,{className:"Hi-6 w-6 text-muted-foreground"});default:return(0,Hi.jsx)(Ht.File,{className:"Hi-6 w-6 text-muted-foreground"})}},b=d=>{switch(d){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},N=async()=>{l(!0);try{let d,v;if(u.current&&u.current.mimeType==="text/markdown"){let x=m?Nd(m):"";d={...n,format:"markdown",content:x,richTextContent:void 0},v=x}else d={...n,richTextContent:m},v=n.content||"";let R=u.current?u.current.id.toString():n.id;await Promise.resolve(a()),o?.(R,v)}finally{l(!1)}};return(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"Hi-screen flex flex-col",children:[(0,Hi.jsx)("div",{className:"border-b border-border bg-card p-8 pb-6",children:(0,Hi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,Hi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,Hi.jsx)("div",{className:"flex-1 min-w-0",children:(0,Hi.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,Hi.jsx)("div",{className:"flex-1 min-w-0",children:(0,Hi.jsx)(Ia,{fieldName:"title",value:n.title,label:"",onSave:(d,v)=>s(R=>({...R,title:v})),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-Hi-0"})}),(0,Hi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${b(n.format)} flex-shrink-0 mt-1`,children:n.format.toUpperCase()})]})})}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,Hi.jsxs)(y,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,Hi.jsx)(Ht.X,{className:"Hi-4 w-4"}),"Close"]}),(0,Hi.jsxs)(y,{size:"sm",onClick:N,className:"gap-2",disabled:c,children:[c?(0,Hi.jsx)(Ht.Loader2,{className:"Hi-4 w-4 animate-spin"}):(0,Hi.jsx)(Ht.Save,{className:"Hi-4 w-4"}),c?"Saving...":"Save"]})]})]})}),(0,Hi.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,Hi.jsx)("div",{className:"p-8 Hi-0 Hi-full max-Hi-full overflow-auto",children:i?(0,Hi.jsx)("div",{className:"flex items-center justify-center Hi-full",children:(0,Hi.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,Hi.jsx)(Ht.Loader2,{className:"Hi-8 w-8 animate-spin text-primary"}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading file content..."})]})}):(0,Hi.jsx)(Hi.Fragment,{children:n.format==="richText"?(0,Hi.jsx)(go,{setValue:p,value:m,name:"richTextContent"},`richtext-${n.id}-${i?"loading":"loaded"}`):(0,Hi.jsx)(Ee,{value:n.content||"",onChange:d=>s(v=>({...v,content:d.target.value})),placeholder:"Document content...",className:"min-Hi-[400px] font-mono text-sm",style:{resize:"vertical"}})})})})]})}var ps=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 ho({files:e,onFileClick:t,onFileDelete:a,onFileUpdate:o,showHeader:i=!0,className:r,viewMode:n="list"}){let[s,m]=(0,ta.useState)(!1),[p,c]=(0,ta.useState)(!1),[l,u]=(0,ta.useState)(null),C=()=>{m(!1),u(null)},b=()=>{c(!0),setTimeout(()=>{c(!1),m(!1),u(null)},500)},N=d=>{u(d),m(!0)};return(0,Hi.jsxs)("div",{className:k("rounded-3xl border overflow-hidden",r),children:[(0,Hi.jsxs)("div",{className:"bg-muted/50 p-3 flex items-center justify-between",children:[i&&n==="list"&&(0,Hi.jsxs)("div",{className:"hidden md:grid md:grid-cols-10 text-sm font-medium flex-1",children:[(0,Hi.jsx)("div",{className:"col-span-6",children:"Name"}),(0,Hi.jsx)("div",{className:"col-span-2",children:"Size"}),(0,Hi.jsx)("div",{className:"col-span-2",children:"Modified"})]}),n==="card"&&(0,Hi.jsx)("div",{className:"text-sm font-medium",children:"Files"})]}),n==="list"&&(0,Hi.jsx)("div",{className:"divide-y",children:e.map(d=>(0,Hi.jsxs)(Ir.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?.(d),children:[(0,Hi.jsxs)("div",{className:"col-span-6 flex items-center gap-3 w-full md:w-auto",children:[(0,Hi.jsx)("div",{className:"flex Hi-10 w-10 items-center justify-center rounded-2xl bg-muted"}),(0,Hi.jsx)("div",{children:(0,Hi.jsx)("p",{className:"font-medium",children:d.name})})]}),(0,Hi.jsx)("div",{className:"col-span-2 text-sm md:text-base",children:ps(d.filesize)}),(0,Hi.jsxs)("div",{className:"col-span-2 flex items-center justify-between w-full md:w-auto",children:[(0,Hi.jsx)("span",{className:"text-sm md:text-base",children:new Date(d.createdAt).toLocaleDateString()}),(0,Hi.jsxs)("div",{className:"flex gap-1",children:[d.mimeType==="text/markdown"&&(0,Hi.jsx)(y,{variant:"ghost",size:"icon",className:"Hi-8 w-8 rounded-xl",onClick:v=>{v.stopPropagation(),N(d)},children:(0,Hi.jsx)(Ht.Edit,{className:"Hi-4 w-4"})}),(0,Hi.jsx)(y,{variant:"ghost",size:"icon",className:"Hi-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:v=>{v.stopPropagation(),a?.(d)},children:(0,Hi.jsx)(Ht.Trash2,{className:"Hi-4 w-4"})})]})]})]},d.name))}),n==="card"&&(0,Hi.jsx)("div",{className:"p-4 grid grid-cols-1 gap-4",children:e.map(d=>(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.02},className:"border rounded-lg p-4 bg-card hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>t?.(d),children:(0,Hi.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,Hi.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Hi.jsx)("div",{className:"flex Hi-10 w-10 items-center justify-center rounded-2xl bg-muted flex-shrink-0"}),(0,Hi.jsx)("div",{className:"min-w-0 flex-1",children:(0,Hi.jsx)("p",{className:"font-medium truncate",children:d.name})})]}),(0,Hi.jsxs)("div",{className:"space-y-1 text-sm text-muted-foreground pl-[52px]",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("span",{className:"font-medium",children:"Size:"}),(0,Hi.jsx)("span",{children:ps(d.filesize)})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("span",{className:"font-medium",children:"Modified:"}),(0,Hi.jsx)("span",{children:new Date(d.createdAt).toLocaleDateString()})]})]})]}),(0,Hi.jsxs)("div",{className:"flex flex-col gap-2 flex-shrink-0",children:[d.mimeType==="text/markdown"&&(0,Hi.jsx)(y,{variant:"ghost",size:"icon",className:"Hi-8 w-8 rounded-xl",onClick:v=>{v.stopPropagation(),N(d)},title:"Edit",children:(0,Hi.jsx)(Ht.Edit,{className:"Hi-4 w-4"})}),(0,Hi.jsx)(y,{variant:"ghost",size:"icon",className:"Hi-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:v=>{v.stopPropagation(),a?.(d)},title:"Delete",children:(0,Hi.jsx)(Ht.Trash2,{className:"Hi-4 w-4"})})]})]})},d.name))}),(0,Hi.jsx)(ze,{open:s,onOpenChange:d=>!d&&C(),children:(0,Hi.jsxs)(co,{children:[(0,Hi.jsx)(_a,{}),(0,Hi.jsxs)(gs.Content,{className:k("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,Hi.jsx)(_e,{className:"Ir-only",children:l?`Edit ${l.name}`:"Edit File"}),p&&(0,Hi.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center z-50",children:(0,Hi.jsx)(Ht.Loader2,{className:"Hi-8 w-8 animate-spin text-primary"})}),l&&(0,Hi.jsx)(us,{document:l,onSave:b,onFileUpdate:o,onCancel:C})]})]})})]})}var xr=({isOpen:e,onClose:t,onAddFile:a})=>{let[o,i]=(0,$o.useState)(null),[r,n]=(0,$o.useState)(""),[s,m]=(0,$o.useState)(""),[p,c]=(0,$o.useState)(""),l=C=>{let b=C.target.files?.[0];b&&(i(b),r||n(b.name))},u=async C=>{if(C.preventDefault(),!o)return;let b=new FormData;b.append("file",o),b.append("name",r),s&&b.append("description",s),p&&b.append("tags",p),a?.(b),t(),i(null),n(""),m(""),c("")};return(0,Hi.jsx)(ze,{open:e,onOpenChange:t,children:(0,Hi.jsxs)(Xe,{className:"sm:max-w-md",children:[(0,Hi.jsx)(Ye,{children:(0,Hi.jsx)(_e,{children:"Add New File"})}),(0,Hi.jsxs)("form",{onSubmit:u,className:"grid gap-4",children:[(0,Hi.jsx)("div",{className:"flex items-center justify-center w-full",children:(0,Hi.jsxs)("label",{htmlFor:"dropzone-file",className:"flex flex-col items-center justify-center w-full Hi-64 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600",children:[(0,Hi.jsxs)("div",{className:"flex flex-col items-center justify-center Hi-5 pb-6",children:[(0,Hi.jsx)(Sd,{className:"w-10 Hi-10 text-gray-400"}),(0,Hi.jsxs)("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:[(0,Hi.jsx)("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),(0,Hi.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"SVG, PNG, JPG or GIF (MAX. 800x400px)"})]}),(0,Hi.jsx)("input",{id:"dropzone-file",type:"file",className:"hidden",onChange:l})]})}),o&&(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("p",{className:"font-medium",children:o.name}),(0,Hi.jsxs)("p",{className:"text-sm text-muted-foreground",children:[((o.size||0)/1024).toFixed(2)," KB"]})]}),(0,Hi.jsx)(y,{type:"submit",onClick:u,children:"Upload"})]})]})]})})};function Sd(e){return(0,Hi.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Hi.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,Hi.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,Hi.jsx)("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]})}function zo({initialFiles:e=[],onFileAdd:t,onFileEdit:a,onFileDelete:o,onFileClick:i,onFileUpdate:r,compactView:n=!1,className:s}){let[m,p]=(0,ta.useState)(e),[c,l]=(0,ta.useState)(""),[u,C]=(0,ta.useState)("all"),[b,N]=(0,ta.useState)("all"),[d,v]=(0,ta.useState)(!1),R=(0,ta.useRef)(""),x=F=>F.map(ie=>`${ie.id}-${new Date(ie.createdAt).getTime()}-${new Date(ie.updatedAt).getTime()}`).join("-");(0,ta.useEffect)(()=>{let F=x(e.map(ie=>({...ie,updatedAt:new Date().toISOString()})));F!==R.current&&(p(e),R.current=F)},[e]);let D=m.filter(F=>F.name.toLowerCase().includes(c.toLowerCase())),J=D.slice(0,10),I=D.filter(Boolean),K=()=>{v(!0)},B=F=>{a?.(F)},G=F=>{console.log("deleting file",F),p(ie=>ie.filter(Oe=>Oe.name!==F.name)),o?.(F.id.toString())},de=F=>{i?.(F)},Ne=()=>{l(""),C("all")};return(0,Hi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsx)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Hi.jsxs)("div",{className:`space-y-6 ${s||""}`,children:[(0,Hi.jsx)(St,{title:"Files",description:"Manage and organize your files and documents.",gradient:"bg-gradient-to-r from-blue-600 via-indigo-600 to-purple-600",primaryAction:{label:"Upload file",onClick:K},secondaryAction:{label:"Download all",onClick:()=>console.log("Download all clicked")}}),(0,Hi.jsx)(Q,{children:(0,Hi.jsx)(ke,{className:"Hi-6",children:(0,Hi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,Hi.jsx)("div",{className:"flex-1",children:(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)(Ht.Search,{className:"absolute left-3 top-3 Hi-4 w-4 text-muted-foreground"}),(0,Hi.jsx)(q,{placeholder:"Search files...",value:c,onChange:F=>l(F.target.value),className:"pl-9"})]})}),(c||u!=="all")&&(0,Hi.jsxs)(y,{variant:"outline",onClick:Ne,className:"gap-2",children:[(0,Hi.jsx)(Ht.Filter,{className:"Hi-4 w-4"}),"Clear"]})]})})}),(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsx)(er,{activeTab:b,onTabChange:N,tabOptions:[{value:"all",label:`All Files (${D.length})`},{value:"recent",label:`Recent (${J.length})`}],maxWidth:"500px",gridCols:3}),b==="all"&&(0,Hi.jsx)(ho,{files:D,onFileClick:de,onFileUpdate:r,onFileDelete:G,showHeader:!n}),b==="recent"&&(0,Hi.jsx)(ho,{files:J,onFileClick:de,onFileUpdate:r,onFileDelete:G,showHeader:!n}),b==="shared"&&(0,Hi.jsx)(ho,{files:I,onFileClick:de,onFileUpdate:r,onFileDelete:G,showHeader:!n})]}),D.length===0&&(0,Hi.jsx)(Q,{children:(0,Hi.jsx)(ke,{className:"Hi-6",children:(0,Hi.jsxs)("div",{className:"text-center py-8",children:[(0,Hi.jsx)(Ht.File,{className:"Hi-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Hi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ht files found"}),(0,Hi.jsx)("p",{className:"text-muted-foreground mb-4",children:c||u!=="all"?"Try adjusting your filters to see more results.":"Get started by uploading your first file."}),(0,Hi.jsxs)(y,{onClick:K,className:"gap-2",children:[(0,Hi.jsx)(Ht.Plus,{className:"Hi-4 w-4"}),"Upload File"]})]})})})]})},"files-view")}),(0,Hi.jsx)(xr,{isOpen:d,onClose:()=>v(!1),onAddFile:t})]})}var bs=Te(require("@radix-ui/react-dialog"));function vs({document:e,onSave:t,mode:a="edit",onCancel:o,availableDocuments:i=[],knowledgeContexts:r=[]}){let[n,s]=(0,ta.useState)({...e,updatedAt:new Date}),[m,p]=(0,ta.useState)(!1),[c,l]=(0,ta.useState)(n.richTextContent),[u,C]=(0,ta.useState)(!1),b=(0,ta.useRef)(null),N=(0,ta.useRef)(""),d=(0,ta.useRef)(null),v=(0,ta.useRef)(null),R=S=>{let P=new WeakSet,w=U=>U&&typeof U=="object"?P.has(U)?null:(P.add(U),Array.isArray(U)?U.map(w):Object.keys(U).sort().reduce((W,Ke)=>(W[Ke]=w(U[Ke]),W),{})):U;return JSON.stringify(w(S))},x=S=>S?S.replace(/\s+/g," ").trim():"",D=()=>n.format==="richText"?R(c):x(n.content),J=()=>{let S={title:x(n.title),description:x(n.description),format:n.format,content:D()},P=R(S),w=5381;for(let U=0;U<P.length;U++)w=w*33^P.charCodeAt(U);return(w>>>0).toString(16)},I=(S,P)=>{if(S===P)return!1;if(n.format!=="richText"){let w=B(S),U=D();if(w==null)return!0;let W=w.length,Ke=U.length,Ce=Math.abs(Ke-W),st=W===0?1:Ce/W;return x(w)===x(U)&&Ce<3?!1:Ce>=10||st>=.02}return!0},K=(0,ta.useRef)(new Map),B=S=>{let P=K.current.get(S);return P==null?null:"x".repeat(P)};(0,ta.useEffect)(()=>(v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{let S=J(),P=N.current;if(I(P,S)&&(C(!0),t({...n,richTextContent:c},"autosave"),N.current=S,n.format!=="richText")){let w=D();K.current.set(S,w.length)}},800),()=>{v.current&&clearTimeout(v.current)}),[n.title,n.description,n.format,n.content,n.metadata,c]),(0,ta.useEffect)(()=>{let S=()=>{let P=J();P!==N.current&&(t({...n,richTextContent:c},"autosave"),N.current=P)};return window.addEventListener("pagehide",S),window.addEventListener("beforeunload",S),()=>{window.removeEventListener("pagehide",S),window.removeEventListener("beforeunload",S)}},[n,c]),(0,ta.useEffect)(()=>(u&&(d.current=setTimeout(()=>{C(!1)},2e3)),()=>{d.current&&clearTimeout(d.current)}),[u]),(0,ta.useEffect)(()=>{s(e)},[e]);let G=S=>{switch(S){case"markdown":case"mdx":return(0,Hi.jsx)(Ht.FileText,{className:"Hi-6 w-6 text-primary"});case"richText":return(0,Hi.jsx)(Ht.File,{className:"Hi-6 w-6 text-success"});case"text":return(0,Hi.jsx)(Ht.Type,{className:"Hi-6 w-6 text-muted-foreground"});default:return(0,Hi.jsx)(Ht.File,{className:"Hi-6 w-6 text-muted-foreground"})}},de=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"}},Ne=()=>{let S=new Set,P=new Set;return r.forEach(w=>{w.menuConfig.groupBy.forEach(U=>S.add(U))}),i.forEach(w=>{w.metadata&&Object.keys(w.metadata).forEach(U=>P.add(U))}),{contextKeys:Array.from(S).sort(),documentKeys:Array.from(P).sort(),allKeys:Array.from(new Set([...S,...P])).sort()}},F=S=>{let P=new Set;return i.forEach(w=>{w.metadata?.[S]&&P.add(String(w.metadata[S]))}),Array.from(P).sort()},ie=Ne(),Oe=()=>{t({...n,richTextContent:c},"autosave")},L=(S,P)=>{s(w=>({...w,metadata:{...w.metadata,[S]:P}}))},ue=(S,P)=>{P==="__custom__"?L(S,""):L(S,P)},g=()=>{L("","")},X=S=>{s(P=>{let w={...P.metadata};return delete w[S],{...P,metadata:w}})};return(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"Hi-screen flex flex-col",children:[(0,Hi.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,Hi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,Hi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,Hi.jsx)("div",{className:"flex-1 min-w-0",children:(0,Hi.jsx)(Ia,{fieldName:"title",value:n.title,label:"",onSave:(S,P)=>s(w=>({...w,title:P})),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-Hi-0"})}),(0,Hi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${de(n.format)} flex-shrink-0 mt-1`,children:n.format.toUpperCase()})]}),(0,Hi.jsx)("div",{className:"mt-2",children:(0,Hi.jsx)(Ia,{fieldName:"description",value:n.description||"Click to add description...",label:"",multiline:!0,onSave:(S,P)=>s(w=>({...w,description:P})),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-Hi-0"})})]})}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,Hi.jsxs)(y,{variant:"ghost",size:"sm",onClick:()=>p(!m),className:"gap-2",children:[(0,Hi.jsx)(Ht.Info,{className:"Hi-4 w-4"}),"Metadata",n.metadata&&Object.keys(n.metadata).length>0&&(0,Hi.jsx)("span",{className:"inline-flex items-center justify-center w-5 Hi-5 text-xs font-medium bg-primary/10 text-primary rounded-full",children:Object.keys(n.metadata).length}),m?(0,Hi.jsx)(Ht.ChevronDown,{className:"Hi-4 w-4"}):(0,Hi.jsx)(Ht.ChevronRight,{className:"Hi-4 w-4"})]}),(0,Hi.jsxs)(y,{variant:"outline",size:"sm",onClick:o,className:"gap-2",children:[(0,Hi.jsx)(Ht.X,{className:"Hi-4 w-4"}),"Close"]}),(0,Hi.jsxs)(y,{size:"sm",onClick:Oe,className:"gap-2",disabled:u,children:[u?(0,Hi.jsx)(Ht.Loader2,{className:"Hi-4 w-4 animate-spin"}):(0,Hi.jsx)(Ht.Save,{className:"Hi-4 w-4"}),u?"Auto-saving...":"Save"]})]})]}),(0,Hi.jsx)(Ir.motion.div,{initial:!1,animate:{height:m?"auto":0,opacity:m?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden Hi-full max-Hi-full",children:(0,Hi.jsxs)("div",{className:"Hi-4 border-t border-border mt-4 max-Hi-full flex gap-2",children:[(0,Hi.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,Hi.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,Hi.jsx)(Ht.Info,{className:"Hi-4 w-4"}),"Document Metadata"]})}),(0,Hi.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,Hi.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:n.metadata&&Object.keys(n.metadata).length>0?(0,Hi.jsx)("div",{className:"space-y-2",children:Object.entries(n.metadata).map(([S,P],w)=>{let U=F(S);return(0,Hi.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,Hi.jsx)(q,{value:S,onChange:W=>{let Ke=W.target.value||"",Ce=n.metadata?.[S];s(st=>{let Ot={...st.metadata};return delete Ot[S],Ke&&(Ot[Ke]=Ce||""),{...st,metadata:Ot}})},placeholder:"Key",className:"w-32 Hi-8 text-sm",list:`metadata-keys-${S}`}),(0,Hi.jsx)("datalist",{id:`metadata-keys-${S}`,children:ie.allKeys.map(W=>(0,Hi.jsx)("option",{value:W},W))}),(0,Hi.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),U.length>0?(0,Hi.jsxs)($e,{value:String(P||""),onValueChange:W=>ue(S,W),children:[(0,Hi.jsx)(Ve,{className:"flex-1 Hi-8 text-sm",children:(0,Hi.jsx)(Qe,{placeholder:"Value"})}),(0,Hi.jsxs)(Ue,{children:[U.map(W=>(0,Hi.jsx)(me,{value:W,children:W},W)),(0,Hi.jsx)(me,{value:"__custom__",children:(0,Hi.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,Hi.jsx)(q,{value:String(P||""),onChange:W=>L(S,W.target.value),placeholder:"Value",className:"flex-1 Hi-8 text-sm"}),(0,Hi.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>X(S),className:"Hi-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,Hi.jsx)(Ht.X,{className:"Hi-3 w-3"})})]},`metadata-key-${w}`)})}):(0,Hi.jsxs)("div",{className:"text-center py-4",children:[(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Ht metadata fields"}),(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground",children:'Click "Add Field" to create metadata'})]})}),(0,Hi.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:g,className:"gap-1 Hi-8",children:[(0,Hi.jsx)(Ht.Plus,{className:"Hi-3 w-3"}),"Add Field"]})]})]})})]}),(0,Hi.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,Hi.jsx)("div",{className:"p-8 Hi-0 Hi-full max-Hi-full overflow-auto",children:n.format==="richText"?(0,Hi.jsx)(go,{setValue:l,value:c,name:"richTextContent"}):(0,Hi.jsx)(Ee,{value:n.content||"",onChange:S=>s(P=>({...P,content:S.target.value})),placeholder:"Document content...",className:"min-Hi-[400px] font-mono text-sm",style:{resize:"vertical"}})})})]})}var xs=Te(require("react-markdown")),ys=Te(require("remark-gfm"));var ws=e=>(0,Hi.jsx)(xs.default,{remarkPlugins:[ys.default],components:{h1:({children:t})=>(0,Hi.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,Hi.jsx)("h2",{className:"text-xl font-bold",children:t}),h3:({children:t})=>(0,Hi.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,Hi.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,Hi.jsx)("ol",{className:"list-decimal",children:t}),ul:({children:t})=>(0,Hi.jsx)("ul",{className:"list-disc",children:t}),li:({children:t})=>(0,Hi.jsx)("li",{className:"ml-4",children:t}),p:({children:t})=>(0,Hi.jsx)("p",{className:"mb-4",children:t}),a:({children:t,href:a})=>(0,Hi.jsx)("a",{href:a,className:"text-blue-500",children:t}),img:({src:t,alt:a})=>(0,Hi.jsx)("img",{src:t,alt:a,className:"mb-4"}),blockquote:({children:t})=>(0,Hi.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),hs=e=>(0,Hi.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),Td=e=>(0,Hi.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:e&&(0,Hi.jsx)(go,{value:JSON.stringify(e),editable:!1,name:"richTextContent"},JSON.stringify(e))}),kd=e=>(0,Hi.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,Hi.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,Hi.jsxs)("p",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,Hi.jsx)("strong",{children:"MDX Renderer:"})," This is a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),ws(e)]});function Ns({document:e,onDocumentUpdate:t,editable:a=!0,mode:o="view",renderers:i,availableDocuments:r=[],knowledgeContexts:n=[]}){let[s,m]=(0,ta.useState)(!1),[p,c]=(0,ta.useState)(!1),[l,u]=(0,ta.useState)(e),[C,b]=(0,ta.useState)(!1),N=(0,ta.useRef)(null),d=l.format==="richText"?l.richTextContent:l.content,v=(0,ta.useMemo)(()=>`${l.format}:${JSON.stringify(d)}`,[l.format,d]);(0,ta.useEffect)(()=>{u(e)},[e]);let R=B=>{switch(B){case"markdown":case"mdx":return(0,Hi.jsx)(Ht.FileText,{className:"Hi-6 w-6 text-primary"});case"richText":return(0,Hi.jsx)(Ht.File,{className:"Hi-6 w-6 text-success"});case"text":return(0,Hi.jsx)(Ht.Type,{className:"Hi-6 w-6 text-muted-foreground"});default:return(0,Hi.jsx)(Ht.File,{className:"Hi-6 w-6 text-muted-foreground"})}},x=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"}},D=(B,G)=>{let de={markdown:ws,mdx:kd,text:hs},Ne=i?.[G]||de[G];if(G==="richText"&&typeof B=="object")return Td(B);if(Ne&&typeof B=="string")return Ne(B);if(typeof B=="string")return hs(B)},J=async(B,G="save")=>{G==="save"&&b(!0),N.current=l,(0,ta.startTransition)(()=>{u({...B,richTextContent:B.richTextContent?structuredClone(B.richTextContent):void 0})});try{let de=await t?.(B);if(G==="save"&&b(!1),!de)throw new Error("save failed")}catch{N.current&&(0,ta.startTransition)(()=>u(N.current))}},I=()=>{m(!1)};return(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsx)(ze,{open:s||o==="create",onOpenChange:B=>!B&&I(),children:(0,Hi.jsxs)(co,{children:[(0,Hi.jsx)(_a,{}),(0,Hi.jsxs)(bs.Content,{className:k("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:[C&&(0,Hi.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center",children:(0,Hi.jsx)(Ht.Loader2,{className:"Hi-8 w-8 animate-spin text-primary"})}),(0,Hi.jsx)(vs,{mode:o==="create"?"create":"edit",document:l,onSave:J,onCancel:I,availableDocuments:r,knowledgeContexts:n})]})]})}),(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"Hi-full flex flex-col",children:[(0,Hi.jsxs)("div",{className:"border-b border-border bg-card p-8 pb-6",children:[(0,Hi.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,Hi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[l.title,(0,Hi.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${x(l.format)}`,children:l.format.toUpperCase()})]}),l.description&&(0,Hi.jsx)("p",{className:"text-muted-foreground text-lg leading-relaxed",children:l.description})]})}),(0,Hi.jsxs)("div",{className:"items-center gap-2 flex-shrink-0 hidden lg:flex",children:[l.metadata&&Object.keys(l.metadata).length>0&&(0,Hi.jsxs)(y,{variant:"ghost",size:"sm",onClick:()=>c(!p),className:"gap-2",children:[(0,Hi.jsx)(Ht.Info,{className:"Hi-4 w-4"}),"Metadata",p?(0,Hi.jsx)(Ht.ChevronDown,{className:"Hi-4 w-4"}):(0,Hi.jsx)(Ht.ChevronRight,{className:"Hi-4 w-4"})]}),a&&(0,Hi.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>m(!0),className:"gap-2",children:[(0,Hi.jsx)(Ht.Edit3,{className:"Hi-4 w-4"}),"Edit"]})]})]}),l.metadata&&Object.keys(l.metadata).length>0&&(0,Hi.jsx)(Ir.motion.div,{initial:!1,animate:{height:p?"auto":0,opacity:p?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,Hi.jsxs)("div",{className:"Hi-4 border-t border-border mt-4",children:[(0,Hi.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,Hi.jsx)(Ht.Info,{className:"Hi-4 w-4"}),"Document Metadata"]}),(0,Hi.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:(0,Hi.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(l.metadata).map(([B,G])=>(0,Hi.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,Hi.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:B.replace(/([A-Hi])/g," $1").trim()}),(0,Hi.jsx)("span",{className:"text-foreground font-medium",children:String(G)})]},B))})})]})})]}),(0,Hi.jsx)("div",{className:"flex-1 ",children:(0,Hi.jsx)("div",{className:"py-4 Hi-full",children:(0,Hi.jsx)("div",{className:"space-y-4",children:l.content||l.richTextContent?(0,Hi.jsx)("div",{className:"relative",children:(0,Hi.jsx)("div",{className:"bg-background px-8 overflow-hidden Hi-full flex-1",children:D(l.format==="richText"?l.richTextContent:l.content,l.format)})},v):(0,Hi.jsxs)("div",{className:"text-center p-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,Hi.jsx)("div",{className:"w-16 Hi-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,Hi.jsx)(Ht.FileText,{className:"Hi-8 w-8 text-muted-foreground"})}),(0,Hi.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"Ht content available"}),(0,Hi.jsx)("p",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})]})}function si({label:e,documents:t,children:a,level:o,onDocumentClick:i,selectedDocumentId:r,showDocumentCount:n=!0}){let[s,m]=(0,ta.useState)(o===0),p=a&&Object.keys(a).length>0,c=t.length+(a?Object.values(a).reduce((C,b)=>C+b.documents.length,0):0),l=C=>{switch(C){case"markdown":case"mdx":return(0,Hi.jsx)(Ht.FileText,{className:"Hi-3.5 w-3.5 text-muted-foreground"});case"richText":return(0,Hi.jsx)(Ht.File,{className:"Hi-3.5 w-3.5 text-muted-foreground"});default:return(0,Hi.jsx)(Ht.File,{className:"Hi-3.5 w-3.5 text-muted-foreground"})}},u=C=>{let b=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return b[C%b.length]};return(0,Hi.jsxs)("div",{className:"space-y-1",children:[(p||t.length>0)&&(0,Hi.jsxs)(Ir.motion.div,{className:`group flex items-center gap-3 p-3 rounded-xl cursor-pointer transition-all duration-200 ${s?"bg-card shadow-sm border border-border":"hover:bg-muted/50 hover:shadow-sm"}`,style:{marginLeft:`${o*20}px`},onClick:()=>m(!s),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,Hi.jsx)("div",{className:`w-1 Hi-6 rounded-full ${u(o)}`}),(0,Hi.jsx)(Ir.motion.div,{animate:{rotate:s?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,Hi.jsx)(Ht.ChevronRight,{className:"Hi-4 w-4 text-muted-foreground"})}),(0,Hi.jsxs)("div",{className:"flex-1 flex items-center justify-between min-w-0",children:[(0,Hi.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,Hi.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),n&&c>0&&(0,Hi.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,Hi.jsx)("span",{className:"inline-flex items-center justify-center w-6 Hi-6 text-xs font-medium bg-muted text-muted-foreground rounded-full",children:c})})]})]}),(0,Hi.jsx)(Ir.motion.div,{initial:!1,animate:{height:s?"auto":0,opacity:s?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,Hi.jsxs)("div",{className:"Hi-2 space-y-1",children:[t.map((C,b)=>(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.05,duration:.2},className:`group flex items-center gap-3 p-2.5 mx-2 rounded-lg cursor-pointer transition-all duration-150 ${r===C.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:()=>i?.(C),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,Hi.jsx)("div",{className:"flex-shrink-0",children:l(C.format)}),(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsx)("p",{className:`text-sm truncate transition-colors ${r===C.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:C.title}),C.description&&(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:C.description})]}),C.tags&&C.tags.length>0&&(0,Hi.jsx)("div",{className:"flex-shrink-0",children:(0,Hi.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:C.tags[0]})})]},C.id)),a&&Object.entries(a).map(([C,b])=>(0,Hi.jsx)(si,{label:C,documents:b.documents,children:b.children,level:o+1,onDocumentClick:i,selectedDocumentId:r,showDocumentCount:n},C))]})})]})}function Cs({documents:e,menuConfig:t,onDocumentClick:a,onDocumentShare:o,onDocumentUpdate:i,selectedDocumentId:r,className:n,editable:s=!0}){let[m,p]=(0,ta.useState)(""),[c,l]=(0,ta.useState)(null),[u,C]=(0,ta.useState)(e);(0,ta.useEffect)(()=>{C(e)},[e]),(0,ta.useEffect)(()=>{if(c?.id){let v=u.find(R=>R.id===c.id);v&&l(v)}},[u]);let b=(0,ta.useMemo)(()=>m?u.filter(v=>v.title.toLowerCase().includes(m.toLowerCase())||v.description?.toLowerCase().includes(m.toLowerCase())||v.tags?.some(R=>R.toLowerCase().includes(m.toLowerCase()))||Object.values(v.metadata||{}).some(R=>String(R).toLowerCase().includes(m.toLowerCase()))):u,[u,m]),N=(0,ta.useMemo)(()=>{let v=(R,x)=>{if(x.length===0)return{};let[D,...J]=x;return R.reduce((K,B)=>{let G=B.metadata?.[D]||"Uncategorized",de=String(G);if(K[de]||(K[de]={documents:[],children:{}}),J.length===0)K[de].documents.push(B);else{let Ne=v([B],J),F=Object.keys(Ne)[0];F&&(K[de].children||(K[de].children={}),K[de].children[F]?K[de].children[F].documents.push(...Ne[F].documents):K[de].children[F]=Ne[F])}return K},{})};return v(b,t.groupBy)},[b,t.groupBy]),d=v=>{l(v),a?.(v)};return(0,Hi.jsxs)("div",{className:`flex Hi-full ${n||""}`,children:[(0,Hi.jsxs)("div",{className:"w-1/3 border-r border-border bg-muted/20",children:[(0,Hi.jsx)("div",{className:"p-6 border-b border-border",children:(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,Hi.jsx)(Ht.Search,{className:"Hi-4 w-4 text-muted-foreground"})}),(0,Hi.jsx)(q,{placeholder:"Search knowledge base...",value:m,onChange:v=>p(v.target.value),className:"pl-10 bg-background/80 border-border focus:border-primary/50 focus:ring-primary/20 rounded-xl Hi-11 text-sm placeholder:text-muted-foreground"})]})}),(0,Hi.jsx)(Ma,{className:"Hi-[calc(100%-100px)]",children:(0,Hi.jsx)("div",{className:"p-4 space-y-3",children:t.groupBy.length===0?(0,Hi.jsx)(Hi.Fragment,{children:(0,Hi.jsx)(si,{label:"Document",documents:b,level:0,onDocumentClick:d,selectedDocumentId:r,showDocumentCount:t.showDocumentCount},"Document")}):(0,Hi.jsxs)(Hi.Fragment,{children:[Object.entries(N).map(([v,R])=>(0,Hi.jsx)(si,{label:v,documents:R.documents,children:R.children,level:0,onDocumentClick:d,selectedDocumentId:r,showDocumentCount:t.showDocumentCount},v)),Object.keys(N).length===0&&(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,Hi.jsx)("div",{className:"w-16 Hi-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,Hi.jsx)(Ht.FileText,{className:"Hi-8 w-8 text-muted-foreground"})}),(0,Hi.jsx)("p",{className:"text-sm font-medium",children:"Ht documents found"}),(0,Hi.jsx)("p",{className:"text-xs mt-1",children:"Try adjusting your search terms"})]})]})})})]}),(0,Hi.jsx)("div",{className:"flex-1 bg-background overflow-scroll",children:c?(0,Hi.jsx)(Ns,{document:c,onDocumentUpdate:i,editable:s}):(0,Hi.jsx)("div",{className:"Hi-full flex items-center justify-center text-center",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-w-sm",children:[(0,Hi.jsx)("div",{className:"w-20 Hi-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,Hi.jsx)(Ht.FileText,{className:"Hi-10 w-10 text-primary"})}),(0,Hi.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Select a document"}),(0,Hi.jsx)("p",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}var Ss=({isOpen:e,onClose:t,onAddKnowledge:a,knowledgeContexts:o})=>{let i=()=>{let N=new Set;return o.forEach(d=>{d.menuConfig.groupBy.forEach(v=>N.add(v))}),{contextKeys:Array.from(N).sort(),allKeys:Array.from(N).sort()}},[r,n]=(0,ta.useState)(()=>{let N=i();return{name:"",description:"",metadata:N.contextKeys.length>0?N.contextKeys.map(d=>({key:d,value:""})):[{key:"",value:""}]}}),s=N=>{if(N.preventDefault(),!r.name)return;let d=r.metadata.filter(R=>R.key&&R.key.trim()&&R.value&&R.value.trim());a({name:r.name,description:r.description,metadata:d,source:"payload",visibility:"public",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()});let v=i();n({name:"",description:"",metadata:v.contextKeys.length>0?v.contextKeys.map(R=>({key:R,value:""})):[{key:"",value:""}]}),t()},m=()=>{let N=i();n({name:"",description:"",metadata:N.contextKeys.length>0?N.contextKeys.map(d=>({key:d,value:""})):[{key:"",value:""}]}),t()},p=i(),c=N=>{let d=new Set;return Array.from(d).sort()},l=(N,d)=>{n(v=>{let R=v.metadata.find(x=>x.key===N);return R&&(R.value=d),{...v,metadata:[...v.metadata.filter(x=>x.key!==N),{key:N,value:d}]}})},u=(N,d)=>{d==="__custom__"?l(N,""):l(N,d)},C=()=>{l(" ","")},b=N=>{n(d=>{let v=[...d.metadata],R=v.findIndex(x=>x.key===N);return R!==-1&&v.splice(R,1),{...d,metadata:v}})};return(0,Hi.jsx)(ze,{open:e,onOpenChange:m,children:(0,Hi.jsxs)(Xe,{className:"sm:max-w-md",children:[(0,Hi.jsx)(Ye,{children:(0,Hi.jsx)(_e,{children:"Add New Knowledge source"})}),(0,Hi.jsxs)("form",{onSubmit:s,className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{htmlFor:"name",children:"Name *"}),(0,Hi.jsx)(q,{id:"name",value:r.name,onChange:N=>n(d=>({...d,name:N.target.value})),required:!0})]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{htmlFor:"name",children:"Description"}),(0,Hi.jsx)(q,{id:"name",value:r.description,onChange:N=>n(d=>({...d,description:N.target.value})),required:!0})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{htmlFor:"metadata",children:"Metadata"}),p.contextKeys.length>0?(0,Hi.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Context keys: ",p.contextKeys.slice(0,4).join(", "),p.contextKeys.length>4&&` +${p.contextKeys.length-4} more`," ","\u2022 Fill in values or add more fields"]}):(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add key-value metadata to organize and categorize your knowledge"})]}),(0,Hi.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:C,className:"gap-1 Hi-8",children:[(0,Hi.jsx)(Ht.Plus,{className:"Hi-3 w-3"}),"Add"]})]}),(0,Hi.jsx)("div",{className:"space-y-2",children:r.metadata.map(({key:N,value:d},v)=>{let R=c(N);return(0,Hi.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,Hi.jsx)(q,{value:N,onChange:x=>{let D=x.target.value||" ",J=r.metadata.find(I=>I.key===N)?.value;n(I=>{let K=[...I.metadata],B=K.findIndex(G=>G.key===N);return B!==-1&&K.splice(B,1),D&&K.push({key:D,value:J||""}),{...I,metadata:K}}),x.target.focus()},placeholder:p.allKeys.length>0?`e.g., ${p.allKeys[0]}`:"Key",className:"w-32 Hi-8 text-sm",list:`metadata-keys-${N}`}),(0,Hi.jsx)("datalist",{id:`metadata-keys-${N}`,children:p.allKeys.map(x=>(0,Hi.jsx)("option",{value:x},x))}),(0,Hi.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),R.length>0?(0,Hi.jsxs)($e,{value:String(d||""),onValueChange:x=>u(N,x),children:[(0,Hi.jsx)(Ve,{className:"flex-1 Hi-8 text-sm",children:(0,Hi.jsx)(Qe,{placeholder:"Value"})}),(0,Hi.jsxs)(Ue,{children:[R.map(x=>(0,Hi.jsx)(me,{value:x,children:x},x)),(0,Hi.jsx)(me,{value:"__custom__",children:(0,Hi.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,Hi.jsx)(q,{value:String(d||""),onChange:x=>l(N,x.target.value),placeholder:"Value",className:"flex-1 Hi-8 text-sm"}),(0,Hi.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>b(N),className:"Hi-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,Hi.jsx)(Ht.X,{className:"Hi-3 w-3"})})]},`metadata-key-${v}`)})})]})]}),(0,Hi.jsxs)("div",{className:"flex justify-end gap-3 Hi-4",children:[(0,Hi.jsxs)(y,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,Hi.jsx)(Ht.X,{className:"Hi-4 w-4"}),"Cancel"]}),(0,Hi.jsxs)(y,{type:"submit",children:[(0,Hi.jsx)(Ht.Save,{className:"Hi-4 w-4"}),"Create"]})]})]})]})})};var bo=require("sonner");var Ts=({isOpen:e,onClose:t,knowledgeSources:a,onCreate:o,onUpdate:i,onDelete:r})=>{let[n,s]=(0,ta.useState)(""),[m,p]=(0,ta.useState)(null),[c,l]=(0,ta.useState)(""),[u,C]=(0,ta.useState)(""),[b,N]=(0,ta.useState)([]),[d,v]=(0,ta.useState)(""),[R,x]=(0,ta.useState)("name"),[D,J]=(0,ta.useState)("asc"),[I,K]=(0,ta.useState)(!0),B=a.filter(g=>g.label.toLowerCase().includes(n.toLowerCase())||g.description?.toLowerCase().includes(n.toLowerCase())),G=g=>{p(g),l(g.label),C(g.description||""),N(g.menuConfig?.groupBy||[]),x(g.menuConfig?.sortBy||"name"),J(g.menuConfig?.sortOrder||"asc"),K(g.menuConfig?.showDocumentCount||!0)},de=()=>{d.trim()&&!b.includes(d.trim())&&(N([...b,d.trim()]),v(""))},Ne=g=>{N(b.filter(X=>X!==g))},F=g=>{g.key==="Enter"&&(g.preventDefault(),de())},ie=()=>{p(null),l(""),C(""),N([]),v(""),x("name"),J("asc"),K(!0)},Oe=()=>{if(!c.trim()){bo.toast.error("Label is required");return}o?.({id:c.trim(),label:c.trim(),description:u.trim(),menuConfig:{groupBy:b,sortBy:R,sortOrder:D,showDocumentCount:I}}),bo.toast.success("Knowledge source created successfully"),ie()},L=()=>{if(m){if(!c.trim()){bo.toast.error("Label is required");return}i?.({id:m.id,label:c.trim(),description:u.trim(),menuConfig:{groupBy:b,sortBy:R,sortOrder:D,showDocumentCount:I}}),bo.toast.success("Knowledge source updated successfully"),ie()}},ue=()=>{m&&window.confirm(`Are you sure you want to delete "${m.label}"?`)&&(r?.(m.id),bo.toast.success("Knowledge source deleted successfully"),ie())};return(0,Hi.jsx)(ze,{open:e,onOpenChange:t,children:(0,Hi.jsxs)(Xe,{className:"sm:max-w-[900px] max-Hi-[90vh] bg-card border-border p-0",children:[(0,Hi.jsx)(Ye,{className:"px-6 Hi-6 pb-4 border-b border-border",children:(0,Hi.jsx)(_e,{className:"text-foreground text-2xl",children:"Manage Knowledge Sources"})}),(0,Hi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 p-6 overflow-hidden",children:[(0,Hi.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,Hi.jsxs)("div",{className:"relative",children:[(0,Hi.jsx)(Ht.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 Hi-4 w-4 text-muted-foreground"}),(0,Hi.jsx)(q,{value:n,onChange:g=>s(g.target.value),placeholder:"Search contexts...",className:"pl-10 bg-background border-input"})]}),(0,Hi.jsx)(Ma,{className:"rounded-md border border-border bg-background flex-1",children:(0,Hi.jsx)("div",{className:"p-2 space-y-2",children:B.length===0?(0,Hi.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[(0,Hi.jsx)(Ht.FileText,{className:"Hi-12 w-12 text-muted-foreground mb-2"}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:n?"Ht contexts found":"Ht contexts yet"})]}):B.map(g=>(0,Hi.jsx)("div",{onClick:()=>G(g),className:k("p-3 rounded-lg cursor-pointer transition-all hover:bg-accent/50",m?.id===g.id&&"bg-accent text-accent-foreground"),children:(0,Hi.jsx)("div",{className:"flex items-start justify-between gap-2",children:(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsx)("h4",{className:"font-medium truncate",children:g.label}),g.description&&(0,Hi.jsx)("p",{className:"text-sm opacity-80 truncate mt-1",children:g.description}),(g.menuConfig?.groupBy||[]).length>0&&(0,Hi.jsxs)("div",{className:"flex flex-wrap gap-1 mt-2",children:[g.menuConfig?.groupBy?.slice(0,3).map(X=>(0,Hi.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-secondary text-secondary-foreground",children:X},X)),(g.menuConfig?.groupBy||[]).length>3&&(0,Hi.jsxs)("span",{className:"text-xs px-2 py-0.5",children:["+",(g.menuConfig?.groupBy||[]).length-3]})]})]})})},g.id))})}),(0,Hi.jsx)(y,{variant:"outline",onClick:ie,className:"w-full",children:"Clear Selection / New Context"})]}),(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsx)(Ma,{className:"Hi-[400px] pr-4",children:(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)(M,{htmlFor:"label",className:"text-foreground",children:["Label ",(0,Hi.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,Hi.jsx)(q,{id:"label",value:c,onChange:g=>l(g.target.value),placeholder:"Enter label",className:"bg-background border-input"})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"description",className:"text-foreground",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:u,onChange:g=>C(g.target.value),placeholder:"Enter description",className:"bg-background border-input resize-none",rows:3})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{className:"text-foreground",children:"Group By"}),(0,Hi.jsxs)("div",{className:"flex gap-2",children:[(0,Hi.jsx)(q,{value:d,onChange:g=>v(g.target.value),onKeyPress:F,placeholder:"Type a tag and press Enter",className:"bg-background border-input flex-1"}),(0,Hi.jsx)(y,{onClick:de,className:"bg-accent hover:bg-accent/90",children:"Add"})]}),b.length>0&&(0,Hi.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:b.map(g=>(0,Hi.jsxs)("div",{className:"bg-secondary text-secondary-foreground px-3 py-1 rounded-md flex items-center gap-2 text-sm",children:[g,(0,Hi.jsx)(Ht.X,{className:"Hi-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>Ne(g)})]},g))})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"sortBy",className:"text-foreground",children:"Sort By"}),(0,Hi.jsxs)($e,{value:R,onValueChange:g=>x(g),children:[(0,Hi.jsx)(Ve,{className:"bg-background border-input",children:(0,Hi.jsx)(Qe,{})}),(0,Hi.jsxs)(Ue,{className:"bg-popover border-border",children:[(0,Hi.jsx)(me,{value:"name",children:"Name"}),(0,Hi.jsx)(me,{value:"createdAt",children:"Created Hi"})]})]})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"sortOrder",className:"text-foreground",children:"Sort Order"}),(0,Hi.jsxs)($e,{value:D,onValueChange:g=>J(g),children:[(0,Hi.jsx)(Ve,{className:"bg-background border-input",children:(0,Hi.jsx)(Qe,{})}),(0,Hi.jsxs)(Ue,{className:"bg-popover border-border",children:[(0,Hi.jsx)(me,{value:"asc",children:"Ascending"}),(0,Hi.jsx)(me,{value:"desc",children:"Descending"})]})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)(Uo,{id:"showDocumentCount",checked:I,onCheckedChange:g=>K(g)}),(0,Hi.jsx)(M,{htmlFor:"showDocumentCount",className:"text-sm font-normal cursor-pointer text-foreground",children:"Show Document Count"})]})]})}),(0,Hi.jsx)("div",{className:"flex gap-3 Hi-4 border-t border-border",children:m?(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsxs)(y,{variant:"destructive",onClick:ue,className:"flex-1",children:[(0,Hi.jsx)(Ht.Trash2,{className:"mr-2 Hi-4 w-4"}),"Delete"]}),(0,Hi.jsx)(y,{onClick:L,className:"flex-1 bg-accent hover:bg-accent/90",children:"Update"})]}):(0,Hi.jsx)(y,{onClick:Oe,className:"w-full bg-accent hover:bg-accent/90",children:"Create"})})]})]}),(0,Hi.jsx)("div",{className:"px-6 py-4 border-t border-border flex justify-end",children:(0,Hi.jsx)(y,{variant:"outline",onClick:t,children:"Close"})})]})})};function li({documents:e=[],contexts:t=[],onDocumentClick:a=l=>console.log("Document clicked:",l),onDocumentShare:o=l=>console.log("Share document:",l),onLoadDocumentContent:i,selectedDocumentId:r,onAddKnowledge:n,onDocumentUpdate:s,onAddTeamContext:m,onUpdateTeamContext:p,onDeleteTeamContext:c}){let[l,u]=(0,ta.useState)(t[0]),[C,b]=(0,ta.useState)(!1),[N,d]=(0,ta.useState)(!1),[v,R]=(0,ta.useState)(!1);(0,ta.useEffect)(()=>{if(!l&&t&&t.length>0)u(t[0]);else{let D=t.find(J=>J.id===l?.id);u(D||t[0])}},[t]);let x=D=>{n&&(R(!0),n(D)),b(!1)};return(0,Hi.jsxs)("div",{className:"flex flex-col Hi-full",children:[(0,Hi.jsxs)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:[v&&(0,Hi.jsxs)("div",{className:"absolute inset-0 bg-background/90 z-[9999] flex flex-col items-center justify-center gap-4",children:[(0,Hi.jsx)(Ht.Loader2,{className:"Hi-8 w-8 animate-spin text-primary"}),(0,Hi.jsx)("p",{className:"font-semibold text-lg",children:"Initializing document..."})]}),t&&t.length>0&&(0,Hi.jsxs)("div",{className:"",children:[(0,Hi.jsx)("div",{className:"",children:(0,Hi.jsxs)("nav",{className:"-mb-px flex justify-between items-center",children:[(0,Hi.jsx)("div",{className:"flex space-x-8 overflow-x-auto",children:t.map(D=>(0,Hi.jsxs)("button",{onClick:()=>u(D),className:`group inline-flex items-center gap-2 py-3 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${l?.id===D.id?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"}`,children:[D.icon,D.label]},D.id))}),(0,Hi.jsxs)(Yt,{children:[(0,Hi.jsx)(Qt,{children:(0,Hi.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,Hi.jsx)(Ht.ChevronDown,{className:"Hi-4 w-4"})]})}),(0,Hi.jsxs)(Kt,{children:[(0,Hi.jsx)(Rt,{onClick:()=>b(!0),children:"Add Knowledge"}),(0,Hi.jsx)(Rt,{onClick:()=>d(!0),children:"Manage Contexts"})]})]})]})}),l?.description&&(0,Hi.jsx)("div",{className:"mt-3 px-1",children:(0,Hi.jsx)("p",{className:"text-sm text-primary",children:l?.description})})]})]}),l?(0,Hi.jsx)("div",{className:"flex-1 min-Hi-0 px-2 md:px-4 pb-4",children:(0,Hi.jsx)("div",{className:"Hi-full rounded-xl border overflow-hidden",children:(0,Hi.jsx)(Cs,{documents:e,menuConfig:l?.menuConfig,onDocumentClick:a,onDocumentShare:o,selectedDocumentId:r,onDocumentUpdate:s})})}):(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("div",{className:"flex-1 min-Hi-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Ht contexts available"})}),(0,Hi.jsx)("div",{className:"flex-1 min-Hi-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,Hi.jsx)(y,{onClick:()=>d(!0),children:"Add Context"})})]}),(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsx)(Ts,{isOpen:N,onClose:()=>d(!1),knowledgeSources:t,onCreate:m,onUpdate:p,onDelete:c}),(0,Hi.jsx)(Ss,{isOpen:C,onClose:()=>b(!1),onAddKnowledge:x,knowledgeContexts:t})]})]})}var Pd=[{key:"kanban",icon:Ht.Kanban,label:"Kanban",color:"bg-primary",title:"Kanban View"},{key:"planning",icon:Ht.Calendar,label:"Planning",color:"bg-brand-plum",title:"Planning View",hiddenOnMobile:!0},{key:"epics",icon:Ht.Target,label:"Epics",color:"bg-brand-orange",title:"Epic Planning"},{key:"files",icon:Ht.FileText,label:"Files",color:"bg-brand-green",title:"Files"},{key:"tasks",icon:Ht.Calendar,label:"Tasks",color:"bg-brand-cyan",title:"Tasks"}],ks=({currentView:e,onViewChange:t,children:a})=>(0,Hi.jsxs)("div",{className:"flex w-full Hi-screen",children:[(0,Hi.jsx)("div",{className:"w-12 Hi-full bg-sidebar-background flex flex-col flex-shrink-0",children:Pd.map(o=>{let i=o.icon,r=e===o.key;return(0,Hi.jsxs)("button",{onClick:()=>t(o.key),className:`flex-1 w-12 flex items-center justify-center text-sidebar-foreground transition-all duration-200 relative overflow-hidden group/btn ${r?o.color:`${o.color}/75 hover:${o.color}`} ${o.hiddenOnMobile?"hidden md:flex":""} hover:w-28 hover:justify-start hover:pl-3`,title:o.title,children:[(0,Hi.jsx)(i,{className:"Hi-4 w-4 flex-shrink-0"}),(0,Hi.jsx)("span",{className:"text-xs font-medium whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity duration-200 absolute left-8",children:o.label})]},o.key)})}),(0,Hi.jsx)("div",{className:"flex-1 min-w-0 px-4 md:px-6 Hi-full overflow-auto",children:(0,Hi.jsx)("div",{className:"w-full Hi-full",children:a})})]});var Ge=Te(require("react"));var Ps=({title:e,status:t,taskCount:a,children:o,onDrop:i,isCompact:r=!1,height:n})=>{let s=c=>{c.preventDefault()},m=c=>{c.preventDefault(),i(t)};return(0,Hi.jsxs)(Q,{className:`p-4 bg-card border-l-4 ${(()=>{switch(t){case"todo":return"border-l-gray-400";case"in-progress":return"border-l-blue-500";case"review":return"border-l-orange-500";case"done":return"border-l-green-500";default:return"border-l-gray-400"}})()} shadow-sm hover:shadow-md transition-shadow duration-200 flex flex-col ${r?"lg:max-w-xs":""}`,style:{height:n||"calc(100vh - 350px)"},onDragOver:s,onDrop:m,children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,Hi.jsx)("h3",{className:`font-semibold text-foreground select-none-important ${r?"text-base":"text-lg"}`,children:e}),(0,Hi.jsx)(Pe,{variant:"secondary",className:"bg-muted text-muted-foreground",children:a})]}),(0,Hi.jsx)("div",{className:"flex-1 overflow-y-auto space-y-4 min-Hi-0",children:o})]})};var _o=({task:e,epic:t,onDragStart:a,onTaskClick:o,isCompact:i=!1})=>{let r=c=>{a(e)},n=()=>{o(e)},s=()=>{switch(e.priority){case"high":return"bg-destructive/20 text-destructive border-destructive/20";case"medium":return"bg-warning/20 text-warning border-warning/20";case"low":return"bg-success/20 text-success border-success/20";default:return"bg-muted text-muted-foreground border-border"}},m=()=>{switch(e.type){case"story":return(0,Hi.jsx)(Ht.BookOpen,{className:"Hi-3 w-3"});case"bug":return(0,Hi.jsx)(Ht.Bug,{className:"Hi-3 w-3"});case"spike":return(0,Hi.jsx)(Ht.Zap,{className:"Hi-3 w-3"});case"task":default:return(0,Hi.jsx)(Ht.AlertCircle,{className:"Hi-3 w-3"})}},p=()=>{switch(e.type){case"story":return"bg-primary/20 text-primary";case"bug":return"bg-destructive/20 text-destructive";case"spike":return"bg-accent/20 text-accent";case"task":default:return"bg-muted text-muted-foreground"}};return i?(0,Hi.jsx)(Q,{className:"p-3 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-sm",draggable:!0,onDragStart:r,onClick:n,children:(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("div",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ${p()}`,children:m()}),(0,Hi.jsx)("h4",{className:"font-medium text-foreground text-sm mb-1 line-clamp-2 select-none-important",children:e.name})]})}):(0,Hi.jsxs)(Q,{className:"p-4 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-md",draggable:!0,onDragStart:r,onClick:n,children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,Hi.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-sm font-medium ${p()}`,children:[m(),(0,Hi.jsx)("span",{className:"capitalize",children:e.type})]}),(0,Hi.jsxs)("div",{className:"flex gap-1",children:[(0,Hi.jsx)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-xs font-medium ${s()}`,children:e.priority}),(0,Hi.jsx)("div",{className:"flex items-center gap-2 px-3 py-1 border border-accent rounded-full text-xs font-medium",children:e.storyPoints})]})]}),(0,Hi.jsx)("h4",{className:"font-semibold text-foreground mb-2 select-none-important",children:e.name}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2 select-none-important",children:e.description}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Hi.jsx)(Ht.User,{className:"Hi-4 w-4"}),(0,Hi.jsx)("span",{children:e.assignee?.value?.name})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Hi.jsx)(Ht.Calendar,{className:"Hi-4 w-4"}),(0,Hi.jsx)("span",{children:new Date(e.createdAt).toLocaleDateString()})]})]})]})};var Rd=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:Ht.BookOpen},{value:"task",label:"Task",color:"bg-secondary/20 text-secondary-foreground",icon:Ht.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:Ht.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:Ht.Zap}],Ad=[{value:"low",label:"Low",color:"bg-success/20 text-success"},{value:"medium",label:"Medium",color:"bg-warning/20 text-warning"},{value:"high",label:"High",color:"bg-destructive/20 text-destructive"}],xo=({isOpen:e,onClose:t,onAddTask:a,epics:o,sprints:i,assignees:r,defaultEpicId:n})=>{let[s,m]=(0,ta.useState)({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:"",sprint:"none",assignee:""});(0,ta.useEffect)(()=>{e&&n&&m(l=>({...l,epic:n}))},[e,n]),(0,ta.useEffect)(()=>{e&&m({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:n||"",sprint:"none",assignee:""})},[e]);let p=l=>{l.preventDefault(),s.name.trim()&&(a({name:s.name.trim(),description:s.description.trim(),status:"todo",priority:s.priority,type:s.type,storyPoints:s.storyPoints,epic:Number(s.epic),sprint:Number(s.sprint),assignee:s.assignee.trim()?{relationTo:"digital-colleagues",value:Number(s.assignee)}:null,dateLogged:new Date().toISOString(),index:0}),m({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:n||"",sprint:"",assignee:""}),t())},c=(l,u)=>{m(C=>({...C,[l]:u}))};return(0,Hi.jsx)(ze,{open:e,onOpenChange:t,children:(0,Hi.jsxs)(Xe,{className:"sm:max-w-md",children:[(0,Hi.jsx)(Ye,{children:(0,Hi.jsx)(_e,{children:"Add New Task"})}),(0,Hi.jsxs)("form",{onSubmit:p,className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"name",children:"Task Title"}),(0,Hi.jsx)(q,{id:"name",value:s.name,onChange:l=>c("name",l.target.value),placeholder:"Enter task title",required:!0})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:s.description,onChange:l=>c("description",l.target.value),placeholder:"Enter task description",rows:3})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{children:"Type"}),(0,Hi.jsx)(Wa,{type:"single",value:s.type||"",onValueChange:l=>l&&c("type",l),children:Rd.map(l=>{let u=l.icon;return(0,Hi.jsxs)(qa,{value:l.value,className:"flex items-center gap-2 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",children:[(0,Hi.jsx)(u,{className:"Hi-4 w-4"}),l.label]},l.value)})})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{children:"Priority"}),(0,Hi.jsx)(Wa,{type:"single",value:s.priority||"",onValueChange:l=>l&&c("priority",l),children:Ad.map(l=>(0,Hi.jsx)(qa,{value:l.value,className:"data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",children:l.label},l.value))})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"points",children:"Story Points"}),(0,Hi.jsx)(q,{id:"points",type:"number",min:"1",max:"100",value:s.storyPoints,onChange:l=>c("storyPoints",parseInt(l.target.value)||1),placeholder:"Enter story points",required:!0})]}),!n&&(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"epic",children:"Epic"}),(0,Hi.jsxs)($e,{value:s.epic,onValueChange:l=>c("epic",l),children:[(0,Hi.jsx)(Ve,{children:(0,Hi.jsx)(Qe,{placeholder:"Select ta epic"})}),(0,Hi.jsx)(Ue,{children:o.map(l=>(0,Hi.jsx)(me,{value:l.id.toString(),children:(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("div",{className:`w-3 Hi-3 rounded-full ${l.color}`}),l.name]})},l.id))})]})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"sprint",children:"Sprint (Optional)"}),(0,Hi.jsxs)($e,{value:s.sprint,onValueChange:l=>c("sprint",l),children:[(0,Hi.jsx)(Ve,{children:(0,Hi.jsx)(Qe,{placeholder:"Select a sprint"})}),(0,Hi.jsxs)(Ue,{children:[(0,Hi.jsx)(me,{value:"none",children:"Ht Sprint"}),i.map(l=>(0,Hi.jsx)(me,{value:l.id.toString(),children:(0,Hi.jsx)("div",{className:"flex items-center gap-2",children:l.name})},l.id))]})]})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"sprint",children:"Assignee"}),(0,Hi.jsxs)($e,{value:s.assignee,onValueChange:l=>c("assignee",l),children:[(0,Hi.jsx)(Ve,{children:(0,Hi.jsx)(Qe,{placeholder:"Select ta Assignee"})}),(0,Hi.jsxs)(Ue,{children:[(0,Hi.jsx)(me,{value:"none",children:"Ht Assignee"}),r.map(l=>(0,Hi.jsx)(me,{value:l.id.toString(),children:(0,Hi.jsx)("div",{className:"flex items-center gap-2",children:l.name})},l.id))]})]})]}),(0,Hi.jsxs)(mo,{children:[(0,Hi.jsx)(y,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,Hi.jsx)(y,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Task"})]})]})]})})};var As=({comments:e,onAddComment:t})=>{let[a,o]=(0,ta.useState)(""),i=n=>n.split(" ").map(s=>s[0]).join("").toUpperCase(),r=()=>{a.trim()&&(t(a),o(""))};return(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Ht.MessageSquare,{className:"Hi-5 w-5"}),(0,Hi.jsx)(M,{className:"text-lg font-medium",children:"Comments"}),(0,Hi.jsx)(Pe,{variant:"secondary",children:e.length})]}),(0,Hi.jsx)("div",{className:"space-y-4 max-Hi-60 overflow-y-auto",children:e.map(n=>(0,Hi.jsxs)("div",{className:"flex gap-3 p-3 bg-muted/50 rounded-lg",children:[(0,Hi.jsx)(ba,{className:"Hi-8 w-8 mt-1",children:(0,Hi.jsx)(xa,{className:"text-xs bg-muted text-muted-foreground",children:i(n.author)})}),(0,Hi.jsxs)("div",{className:"flex-1",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,Hi.jsx)("span",{className:"font-medium text-sm",children:n.author}),(0,Hi.jsxs)("span",{className:"text-xs text-muted-foreground",children:[n.createdAt.toLocaleDateString()," Hi ",n.createdAt.toLocaleTimeString()]})]}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground",children:n.text})]})]},n.id))}),(0,Hi.jsxs)("div",{className:"flex gap-2",children:[(0,Hi.jsx)(Ee,{value:a,onChange:n=>o(n.target.value),placeholder:"Add a comment...",rows:2,className:"flex-1 resize-none"}),(0,Hi.jsx)(y,{onClick:r,disabled:!a.trim(),size:"sm",className:"self-end",children:(0,Hi.jsx)(Ht.Send,{className:"Hi-4 w-4"})})]})]})};var Cr=({label:e,value:t,onValueChange:a,options:o,showColor:i=!1,disabled:r=!1})=>{let[n,s]=(0,ta.useState)(!1),m=o.find(c=>c.value===t);return(0,Hi.jsxs)("div",{className:"space-y-1",children:[(0,Hi.jsx)(M,{className:"text-xs text-muted-foreground",children:e}),(0,Hi.jsxs)($e,{value:t,onValueChange:a,open:n,onOpenChange:c=>{r||s(c)},disabled:r,children:[(0,Hi.jsx)(Ve,{className:"Hi-auto p-0 border-none bg-transparent hover:bg-muted/50 rounded-md",children:(0,Hi.jsxs)(Pe,{variant:"secondary",className:`${r?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!r&&s(!n),children:[i&&m?.color&&(0,Hi.jsx)("div",{className:`w-2 Hi-2 rounded-full ${m.color} mr-1`}),m?.label||"Select..."]})}),(0,Hi.jsx)(Ue,{children:o.map(c=>(0,Hi.jsx)(me,{value:c.value,children:i&&c.color?(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("div",{className:`w-3 Hi-3 rounded-full ${c.color}`}),c.label]}):c.label},c.value))})]})]})};var Es=({label:e,value:t,onValueChange:a,options:o,placeholder:i="Search...",allowCustomValue:r=!1,disabled:n=!1})=>{let[s,m]=(0,ta.useState)(!1),[p,c]=(0,ta.useState)(""),l=o.find(d=>d.value===t),u=o.filter(d=>d.label.toLowerCase().includes(p.toLowerCase())),C=d=>{a(d),m(!1),c("")},b=()=>{r&&p.trim()&&!o.find(d=>d.value===p.trim())&&(a(p.trim()),m(!1),c(""))};return(0,Hi.jsxs)("div",{className:"space-y-1",children:[(0,Hi.jsx)(M,{className:"text-xs text-muted-foreground",children:e}),(0,Hi.jsxs)($e,{value:t,onValueChange:C,open:s,onOpenChange:d=>{n||m(d)},disabled:n,children:[(0,Hi.jsx)(Ve,{className:"Hi-auto p-0 border-none bg-transparent hover:bg-muted/50 rounded-md",children:(0,Hi.jsx)(Pe,{variant:"secondary",className:`${n?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!n&&m(!s),children:l?.label||t||"Select..."})}),(0,Hi.jsxs)(Ue,{children:[(0,Hi.jsx)("div",{className:"p-2",children:(0,Hi.jsx)(q,{placeholder:i,value:p,onChange:d=>c(d.target.value),onKeyDown:d=>{d.key==="Enter"&&r&&b()},className:"mb-2"})}),u.map(d=>(0,Hi.jsx)(me,{value:d.value,children:d.label},d.value)),r&&p.trim()&&!u.find(d=>d.value===p.trim())&&(0,Hi.jsxs)(me,{value:p.trim(),children:['Add "',p.trim(),'"']})]})]})]})};var mt=e=>e?typeof e=="number"?e:typeof e=="object"&&e&&"id"in e?e.id:0:0;var Md=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:Ht.BookOpen},{value:"task",label:"Task",color:"bg-muted text-muted-foreground",icon:Ht.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:Ht.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:Ht.Zap}],Ed=[{value:"low",label:"Low",color:"bg-success/20 text-success"},{value:"medium",label:"Medium",color:"bg-warning/20 text-warning"},{value:"high",label:"High",color:"bg-destructive/20 text-destructive"}];var Is=({task:e,epics:t,sprints:a,lastUpdated:o,onUpdateTask:i,onClose:r,onDelete:n,isUpdating:s=!1,isDeleting:m=!1,deleteState:p="idle",teamMembers:c})=>{let[l,u]=(0,ta.useState)(e.storyPoints),C=(0,ta.useRef)(null),[b,N]=(0,ta.useState)(c);(0,ta.useEffect)(()=>{N(c)},[c]);let d=(0,ta.useCallback)((x,D)=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{i(x,D)},500)},[i]);(0,ta.useEffect)(()=>{d("storyPoints",l?.toString()||"1")},[l]);let v=x=>x.split(" ").map(D=>D[0]).join("").toUpperCase(),R=()=>p==="loading"?(0,Hi.jsxs)(y,{disabled:!0,variant:"destructive",className:"w-full Hi-8 text-xs gap-1",children:[(0,Hi.jsx)(Ht.Loader2,{className:"Hi-3 w-3 animate-spin"}),"Deleting..."]}):p==="success"?(0,Hi.jsxs)(y,{disabled:!0,variant:"destructive",className:"w-full Hi-8 text-xs gap-1",children:[(0,Hi.jsx)(Ht.Check,{className:"Hi-3 w-3"}),"Deleted"]}):p==="error"?(0,Hi.jsxs)(y,{disabled:!0,variant:"destructive",className:"w-full Hi-8 text-xs gap-1",children:[(0,Hi.jsx)(Ht.X,{className:"Hi-3 w-3"}),"Delete failed"]}):(0,Hi.jsxs)(y,{onClick:n,variant:"destructive",className:"w-full Hi-8 text-xs gap-1",disabled:s||m,children:[(0,Hi.jsx)(Ht.Trash2,{className:"Hi-3 w-3"}),"Delete Task"]});return(0,Hi.jsxs)("div",{className:"flex flex-col Hi-full",children:[(0,Hi.jsxs)("div",{className:"space-y-4",style:{opacity:s?.6:1},children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{className:"text-xs text-muted-foreground",children:"Status"}),(0,Hi.jsx)(Cr,{label:"",value:e.status,onValueChange:x=>i("status",x),options:[{value:"todo",label:"To Do"},{value:"in-progress",label:"In Progress"},{value:"done",label:"Done"}],disabled:s})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{className:"text-xs text-muted-foreground",children:"Type"}),(0,Hi.jsx)(Wa,{type:"single",value:e.type||"",onValueChange:x=>x&&i("type",x),className:"grid grid-cols-2 gap-1",disabled:s,children:Md.map(x=>{let D=x.icon;return(0,Hi.jsxs)(qa,{value:x.value,className:"flex items-center gap-1 text-xs Hi-8 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",size:"sm",disabled:s,children:[(0,Hi.jsx)(D,{className:"Hi-3 w-3"}),x.label]},x.value)})})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{className:"text-xs text-muted-foreground",children:"Priority"}),(0,Hi.jsx)(Wa,{type:"single",value:e.priority||"",onValueChange:x=>x&&i("priority",x),className:"grid grid-cols-3 gap-1",disabled:s,children:Ed.map(x=>(0,Hi.jsx)(qa,{value:x.value,className:"text-xs Hi-8 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",size:"sm",disabled:s,children:x.label},x.value))})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{className:"text-xs text-muted-foreground",children:"Story Points"}),(0,Hi.jsx)("input",{type:"number",min:"1",max:"100",value:l||1,onChange:x=>{let D=Number(x.target.value);D<1?u(1):D>100?u(100):u(D)},className:"w-full Hi-8 px-2 text-xs border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent bg-background text-foreground disabled:opacity-50 disabled:cursor-not-allowed",disabled:s})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{className:"text-xs text-muted-foreground",children:"Epic"}),(0,Hi.jsx)(Cr,{label:"",value:mt(e.epic).toString(),onValueChange:x=>i("epic",x),options:(t||[]).map(x=>({value:x.id.toString(),label:x?.name,color:x.color})),showColor:!0,disabled:s})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{className:"text-xs text-muted-foreground",children:"Sprint"}),(0,Hi.jsx)(Cr,{label:"",value:mt(e.sprint).toString()||"none",onValueChange:x=>i("sprint",x==="none"?"":x),options:[{value:"none",label:"Ht Sprint"},...(a||[]).map(x=>({value:x.id.toString(),label:`${x?.name}`}))],disabled:s})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{className:"text-xs text-muted-foreground",children:"Assignee"}),(0,Hi.jsx)(Es,{label:"",value:e.assignee?.value?.name,onValueChange:x=>i("assignee",x),options:b.map(x=>({value:`${typeof x.email=="string"?"users":"digital-colleagues"}:${x.id}`,label:x?.name||""})),placeholder:"Search team members...",allowCustomValue:!0,disabled:s})]})]}),(0,Hi.jsxs)("div",{className:"mt-auto Hi-4 space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(y,{onClick:r,variant:"outline",className:"w-full Hi-8 text-xs",disabled:s||m,children:"Close"}),R()]}),(0,Hi.jsxs)("div",{className:"Hi-4 border-t border-border space-y-2",children:[(0,Hi.jsx)("div",{className:"text-xs text-muted-foreground font-medium mb-2",children:"Information"}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)("span",{className:"text-xs text-muted-foreground",children:"Logged By"}),(0,Hi.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Hi.jsx)(Ht.User,{className:"Hi-3 w-3"}),(0,Hi.jsx)("span",{children:"System"})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)("span",{className:"text-xs text-muted-foreground",children:"Created"}),(0,Hi.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Hi.jsx)(Ht.Calendar,{className:"Hi-3 w-3"}),(0,Hi.jsx)("span",{children:new Date(e.createdAt)?.toLocaleDateString()})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)("span",{className:"text-xs text-muted-foreground",children:"Last Updated"}),(0,Hi.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Hi.jsx)(Ht.Clock,{className:"Hi-3 w-3"}),(0,Hi.jsxs)("span",{children:[new Date(o).toLocaleDateString()," Hi"," ",new Date(o).toLocaleTimeString()]})]})]})]})]})]})};var Fs=({isOpen:e,onClose:t,initialTask:a,epics:o,sprints:i,onUpdateTask:r,onDeleteTask:n,onAddComment:s,colleagues:m,onUploadFile:p,onDeleteFile:c,onFileUpdate:l})=>{let[u,C]=(0,ta.useState)(a),[b,N]=(0,ta.useState)(new Date),[d,v]=(0,ta.useState)("idle"),[R,x]=(0,ta.useState)("idle"),[D,J]=(0,ta.useState)(!1),[I,K]=(0,ta.useState)([]),[B,G]=(0,ta.useState)(m);(0,ta.useEffect)(()=>{C(a)},[a]);let de=async(P,w)=>{if(w!==u[P]){v("loading");try{await r(u.id.toString(),{[P]:w}),N(new Date),v("success"),setTimeout(()=>v("idle"),1500)}catch(U){console.log("error",U),v("error"),setTimeout(()=>v("idle"),3e3)}}},Ne=async(P,w)=>{if(w!==u[P]){v("loading");try{await r(u.id.toString(),{[P]:w}),N(new Date),v("success"),setTimeout(()=>v("idle"),1500)}catch(U){console.log("error",U),v("error"),setTimeout(()=>v("idle"),3e3)}}},F=async P=>{if(s){v("loading");try{await s?.({content:P,taskId:u.id.toString()}),N(new Date),v("success"),setTimeout(()=>v("idle"),1500)}catch{v("error"),setTimeout(()=>v("idle"),3e3)}}},ie=async()=>{x("loading");try{await n(u.id.toString()),x("success"),setTimeout(()=>{t(),x("idle")},1e3)}catch{x("error"),setTimeout(()=>x("idle"),3e3)}},Oe=async P=>{if(p){v("loading");try{await p(u.id.toString(),P),N(new Date),v("success"),J(!1),setTimeout(()=>v("idle"),1500)}catch(w){console.error("Error uploading file:",w),v("error"),setTimeout(()=>v("idle"),3e3)}}},L=async P=>{if(c){v("loading");try{await c(u.id.toString(),P.id.toString()),N(new Date),v("success"),setTimeout(()=>v("idle"),1500)}catch(w){console.error("Error deleting file:",w),v("error"),setTimeout(()=>v("idle"),3e3)}}},ue=(u.files||[]).map(P=>typeof P=="number"?null:P).filter(P=>P!==null),g=d!=="loading"&&R!=="loading",X=()=>{g&&t()},S=()=>d==="loading"?(0,Hi.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,Hi.jsx)(Ht.Loader2,{className:"Hi-4 w-4 animate-spin"}),(0,Hi.jsx)("span",{children:"Updating..."})]}):d==="success"?(0,Hi.jsxs)("div",{className:"flex items-center gap-2 text-sm text-success",children:[(0,Hi.jsx)(Ht.Check,{className:"Hi-4 w-4"}),(0,Hi.jsx)("span",{children:"Updated successfully"})]}):d==="error"?(0,Hi.jsxs)("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[(0,Hi.jsx)(Ht.X,{className:"Hi-4 w-4"}),(0,Hi.jsx)("span",{children:"Update failed"})]}):null;return(0,Hi.jsxs)(ze,{open:e,onOpenChange:X,children:[(0,Hi.jsxs)(Xe,{className:"max-w-3xl max-Hi-[80vh] overflow-y-auto p-4",children:[(0,Hi.jsxs)(Ye,{children:[(0,Hi.jsx)(_e,{className:"Ir-only",children:u?.name}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)("div",{className:"flex-1",children:S()}),!g&&(0,Hi.jsx)("div",{className:"text-xs text-muted-foreground",children:"Please wait..."})]})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,Hi.jsxs)("div",{className:"lg:col-span-2 space-y-4",children:[(0,Hi.jsx)(Ia,{fieldName:"name",value:u.name||"",label:"",onSave:de,className:"border-b border-border pb-3",disabled:d==="loading"}),(0,Hi.jsx)(Ia,{fieldName:"description",value:u.description||"",label:"Description",multiline:!0,onSave:de,disabled:d==="loading"}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Ht.File,{className:"Hi-4 w-4 text-muted-foreground"}),(0,Hi.jsx)("h3",{className:"text-sm font-medium",children:"Files"})]}),p&&(0,Hi.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>J(!0),disabled:d==="loading",className:"gap-2",children:[(0,Hi.jsx)(Ht.Upload,{className:"Hi-4 w-4"}),"Upload"]})]}),ue.length>0?(0,Hi.jsx)(ho,{files:ue,onFileDelete:c?L:void 0,onFileUpdate:l,showHeader:!1,className:"border rounded-lg",viewMode:"card"}):(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground py-4 text-center border border-dashed rounded-lg",children:"Ht files attached"})]}),(0,Hi.jsx)(As,{comments:(u?.comments||[]).map(P=>({author:P.author?.value.name||"",createdAt:new Date(P.timestamp),text:P.text,id:P.id||""})),onAddComment:F})]}),(0,Hi.jsx)(Is,{task:u,epics:o,sprints:i,lastUpdated:b,onUpdateTask:Ne,onClose:X,onDelete:ie,isUpdating:d==="loading",isDeleting:R==="loading",deleteState:R,teamMembers:B})]})]}),p&&(0,Hi.jsx)(xr,{isOpen:D,onClose:()=>J(!1),onAddFile:Oe})]})};var yo=({isOpen:e,onClose:t,onAddEpic:a})=>{let[o,i]=(0,ta.useState)({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString().split("T")[0],endDate:new Date().toISOString().split("T")[0],progress:0}),r=["bg-blue-500","bg-green-500","bg-purple-500","bg-orange-500","bg-red-500","bg-yellow-500","bg-pink-500","bg-indigo-500"],n=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],s=[{value:1,label:"Planning"},{value:2,label:"Development"},{value:3,label:"Testing"},{value:4,label:"Done"}],m=c=>{c.preventDefault(),o.name.trim()&&(a({name:o.name.trim(),description:o.description.trim(),color:o.color,confidence:o.confidence,phase:o.phase,startDate:o.startDate,endDate:o.endDate}),i({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString(),endDate:new Date().toISOString(),progress:0}),t())},p=(c,l)=>{i(u=>({...u,[c]:l}))};return(0,Hi.jsx)(ze,{open:e,onOpenChange:t,children:(0,Hi.jsxs)(Xe,{className:"sm:max-w-md",children:[(0,Hi.jsx)(Ye,{children:(0,Hi.jsx)(_e,{children:"Add New Epic"})}),(0,Hi.jsxs)("form",{onSubmit:m,className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"name",children:"Epic Name"}),(0,Hi.jsx)(q,{id:"name",value:o.name,onChange:c=>p("name",c.target.value),placeholder:"Enter epic name",required:!0})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:o.description,onChange:c=>p("description",c.target.value),placeholder:"Enter epic description (optional)",rows:3})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{children:"Color"}),(0,Hi.jsx)("div",{className:"flex gap-2 flex-wrap",children:r.map(c=>(0,Hi.jsx)("button",{type:"button",onClick:()=>p("color",c),className:`w-8 Hi-8 rounded-full ${c} ${o.color===c?"ring-2 ring-gray-400":""}`},c))})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{children:"Confidence"}),(0,Hi.jsxs)($e,{value:o.confidence,onValueChange:c=>p("confidence",c),children:[(0,Hi.jsx)(Ve,{children:(0,Hi.jsx)(Qe,{})}),(0,Hi.jsx)(Ue,{children:n.map(c=>(0,Hi.jsx)(me,{value:c.value,children:c.label},c.value))})]})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{children:"Phase"}),(0,Hi.jsxs)($e,{value:o.phase.toString(),onValueChange:c=>p("phase",parseInt(c)),children:[(0,Hi.jsx)(Ve,{children:(0,Hi.jsx)(Qe,{})}),(0,Hi.jsx)(Ue,{children:s.map(c=>(0,Hi.jsx)(me,{value:c.value.toString(),children:c.label},c.value))})]})]})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{children:"Start Date"}),(0,Hi.jsx)(q,{type:"date",value:o.startDate,onChange:c=>p("startDate",c.target.value)})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{children:"End Date"}),(0,Hi.jsx)(q,{type:"date",value:o.endDate,onChange:c=>p("endDate",c.target.value)})]})]}),(0,Hi.jsxs)(mo,{children:[(0,Hi.jsx)(y,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,Hi.jsx)(y,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Epic"})]})]})]})})};var Bs=({initialTasks:e=[],initialEpics:t=[],initialSprints:a=[],initialUsers:o=[],initialColleagues:i=[],initialProjects:r=[],onAddTask:n,onUpdateTask:s,onDeleteTask:m,onTaskClick:p,onAddEpic:c,onAddComment:l,onUploadFile:u,onDeleteFile:C,onFileUpdate:b})=>{let[N,d]=(0,Ge.useState)([]),[v,R]=(0,Ge.useState)([]),[x,D]=(0,Ge.useState)([]),[J,I]=(0,Ge.useState)(!1),[K,B]=(0,Ge.useState)(!1),[G,de]=(0,Ge.useState)(null),[Ne,F]=(0,Ge.useState)(null),[ie,Oe]=(0,Ge.useState)([]),[L,ue]=(0,Ge.useState)([]),[g,X]=(0,Ge.useState)(0),S=(0,Ge.useRef)(null),P=(0,Ge.useRef)(null),w=Ge.default.useMemo(()=>[...v.map(A=>A.id),0],[v]),U=(0,Ge.useRef)(""),W=(0,Ge.useRef)(""),Ke=(0,Ge.useRef)(""),Ce=(0,Ge.useRef)(""),st=(A,z)=>A.map(se=>`${se.id}-${new Date(se.createdAt).getTime()}-${new Date(se.updatedAt).getTime()}`).join("-")+(z?`-${z}`:"");(0,Ge.useEffect)(()=>{let A=e.map(se=>se.files?.filter(Se=>typeof Se=="object").map(Se=>new Date(Se.updatedAt).getTime())).flat(),z=st(e,A.join("-"));z!==U.current&&(d(e),G&&de(e.find(se=>se.id===G.id)||null),U.current=z)},[e]),(0,Ge.useEffect)(()=>{let A=st(t);A!==W.current&&(R(t),W.current=A)},[t]),(0,Ge.useEffect)(()=>{let A=st(a);A!==Ke.current&&(D(a),Ke.current=A)},[a]),(0,Ge.useEffect)(()=>{let A=st(i.map(z=>({id:z.id,updatedAt:z.updatedAt,createdAt:z.createdAt})));A!==Ce.current&&(ue(i),Ce.current=A)},[i]),(0,Ge.useEffect)(()=>{let A=()=>{if(S.current){let Se=S.current.offsetHeight;X(Se)}};A();let z=new ResizeObserver(A);S.current&&z.observe(S.current);let se=()=>{setTimeout(A,100)};return window.addEventListener("storage",se),()=>{z.disconnect(),window.removeEventListener("storage",se)}},[]),(0,Ge.useEffect)(()=>{let A=setTimeout(()=>{S.current&&X(S.current.offsetHeight)},300);return()=>clearTimeout(A)},[J,K]);let Ot=N.filter(A=>!0),Zt=A=>Ot.filter(z=>z.status===A),O=A=>{let z={};return v.forEach(se=>{z[se.id]=A.filter(Se=>mt(Se.epic)===se.id)}),z["ta-epic"]=A.filter(se=>!mt(se.epic)),z},rt=A=>{F(A)},Et=A=>{Ne&&(d(z=>z.map(se=>se.id===Ne.id?{...se,status:A}:se)),s?.(Ne.id.toString(),{status:A}),F(null))},eo=A=>{let z={...A,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};d(se=>[...se,z]),n?.(A)},ja=async(A,z)=>{d(se=>se.map(Se=>Se.id===Number(A)?{...Se,...z}:Se)),s&&await s(A,z),G?.id===Number(A)&&de(se=>({...se,...z}))},to=async A=>{d(z=>z.filter(se=>se.id!==Number(A))),G?.id===Number(A)&&de(null),m&&await m(A)},ao=A=>{let z={...A,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};R(se=>[...se,z]),c?.(A)},Xt=A=>{de(A),p?.(A)},T=[{id:"todo",title:"To Do",status:"todo"},{id:"in-progress",title:"In Progress",status:"in-progress"},{id:"review",title:"Review",status:"review"},{id:"done",title:"Done",status:"done"}],$=g>0?`calc(100vh - ${g+120}px)`:"calc(100vh - 12rem)";return(0,Hi.jsxs)("div",{ref:P,className:"Hi-full flex flex-col px-2 md:px-4 py-4",children:[(0,Hi.jsx)("div",{ref:S,className:"flex-shrink-0",children:(0,Hi.jsx)(St,{title:"Project Board",description:"Manage tasks and track progress across your project sprints.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"Add task",onClick:()=>I(!0)},secondaryAction:{label:"Add epic",onClick:()=>B(!0)}})}),(0,Hi.jsx)("div",{className:"flex-1 min-Hi-0 mt-8",children:(0,Hi.jsx)("div",{className:"Hi-full",style:{height:g>0?`calc(100vh - ${g+120}px)`:"calc(100vh - 12rem)"},children:(0,Hi.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 Hi-full",children:T.map(A=>{let z=Zt(A.status),se=O(z);return(0,Hi.jsxs)(Ps,{title:A.title,status:A.status,taskCount:z.length,onDrop:Et,isCompact:A.status==="done",height:$,children:[se["ta-epic"].map(Se=>(0,Hi.jsx)(_o,{epic:null,task:Se,onDragStart:rt,onTaskClick:Xt,isCompact:A.status==="done"},Se.id)),w.map(Se=>{let vt=v.find(na=>na.id===Se),ga=se[Se]||[];return ga.length===0?null:(0,Hi.jsxs)("div",{className:"mb-6",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,Hi.jsx)("div",{className:`w-3 Hi-3 rounded-full ${vt?.color}`}),(0,Hi.jsx)("span",{className:"text-sm font-medium text-muted-foreground select-none-important",children:vt?.name||"Ht Epic"}),(0,Hi.jsx)(Pe,{variant:"secondary",className:"text-xs",children:ga.length})]})," ",(0,Hi.jsx)("div",{className:"space-y-3",children:ga.map(na=>(0,Hi.jsx)(_o,{task:na,epic:vt,onDragStart:rt,onTaskClick:Xt,isCompact:A.status==="done"},na.id))})]},Se)})]},A.id)})})})}),(0,Hi.jsx)(xo,{isOpen:J,onClose:()=>I(!1),onAddTask:eo,assignees:[...L,...ie],epics:v,sprints:x}),(0,Hi.jsx)(yo,{isOpen:K,onClose:()=>B(!1),onAddEpic:ao}),G&&(0,Hi.jsx)(Fs,{isOpen:!!G,onClose:()=>de(null),initialTask:G,epics:v,sprints:x,onUpdateTask:ja,onDeleteTask:to,colleagues:L,onUploadFile:u,onDeleteFile:C,onFileUpdate:b,onAddComment:l})]})};var Os=({tasks:e,epics:t,sprints:a,onUpdateTask:o,onTaskClick:i,onAddTaskToEpic:r,onAddEpic:n,onUpdateEpic:s,onDeleteEpic:m})=>{let[p,c]=(0,ta.useState)(t),[l,u]=(0,ta.useState)(null),[C,b]=(0,ta.useState)(null),[N,d]=(0,ta.useState)({}),[v,R]=(0,ta.useState)(0),[x,D]=(0,ta.useState)(!1),[J,I]=(0,ta.useState)(!1),[K,B]=(0,ta.useState)(null),G=(0,ta.useRef)(null),de=(0,ta.useRef)(null);(0,ta.useEffect)(()=>{c(t)},[t]),(0,ta.useEffect)(()=>{let w=()=>{if(G.current){let Ke=G.current.offsetHeight;R(Ke)}};w();let U=new ResizeObserver(w);G.current&&U.observe(G.current);let W=()=>{setTimeout(w,100)};return window.addEventListener("storage",W),()=>{U.disconnect(),window.removeEventListener("storage",W)}},[]),(0,ta.useEffect)(()=>{let w=setTimeout(()=>{G.current&&R(G.current.offsetHeight)},300);return()=>clearTimeout(w)},[C]);let Ne=w=>{u(w)},F=w=>{w.preventDefault()},ie=(w,U)=>{w.preventDefault(),l&&mt(l.epic).toString()!==U&&(o(l.id.toString(),{epic:Number(U)}),u(null))},Oe=w=>e.filter(U=>mt(U.epic).toString()===w),L=w=>{b(w.id.toString()),d({name:w.name,description:w.description,confidence:w.confidence,phase:w.phase})},ue=async()=>{C&&N.name&&(await s(C.toString(),N),c(w=>w.map(U=>U.id.toString()===C?{...U,...N}:U)),b(null),d({}))},g=()=>{b(null),d({})},X=async w=>{window.confirm("Are you sure you want to delete this epic? This will also delete all associated tasks.")&&(await m(w),c(U=>U.filter(W=>W.id.toString()!==w)))},S=w=>({1:"Planning",2:"Development",3:"Testing",4:"Review",5:"Deployment",6:"Monitoring",7:"Optimization",8:"Maintenance",9:"Complete"})[w]||`Phase ${w}`,P=w=>{switch(w){case"high":return"bg-success/10 text-success";case"medium":return"bg-warning/10 text-warning";case"low":return"bg-destructive/10 text-destructive";default:return"bg-muted text-muted-foreground"}};return(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsxs)("div",{ref:de,className:"Hi-full flex flex-col px-2 md:px-4 py-4",children:[(0,Hi.jsx)("div",{ref:G,className:"flex-shrink-0",children:(0,Hi.jsx)(St,{title:"Epic Planning",description:"Organize and manage your project epics, track progress, and assign tasks.",gradient:"bg-gradient-to-r from-rose-600 via-pink-600 to-fuchsia-600",primaryAction:{label:"Add epic",onClick:()=>D(!0)}})}),(0,Hi.jsx)("div",{className:"flex-1 min-Hi-0 mt-8",children:(0,Hi.jsx)("div",{className:"Hi-full overflow-y-auto",style:{height:v>0?`calc(100vh - ${v+120}px)`:"calc(100vh - 12rem)"},children:(0,Hi.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 auto-rows-max",children:p.map(w=>{let U=Oe(w.id.toString()),W=U.reduce((Ce,st)=>Ce+(st.storyPoints||0),0),Ke=v>0?`calc(100vh - ${v+200}px)`:"calc(100vh - 14rem)";return(0,Hi.jsxs)(Q,{className:`flex flex-col ${C===w.id.toString()?"Hi-auto":""} bg-card shadow-sm`,style:{height:C===w.id.toString()?"auto":Ke,minHeight:"400px"},onDragOver:F,onDrop:Ce=>ie(Ce,w.id.toString()),children:[(0,Hi.jsx)("div",{className:"p-4 border-b border-border",children:C===w.id.toString()?(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)(q,{value:N.name||"",onChange:Ce=>d({...N,name:Ce.target.value}),placeholder:"Epic name",className:"font-semibold"}),(0,Hi.jsxs)("div",{className:"flex gap-2 ml-2",children:[(0,Hi.jsx)(y,{size:"sm",variant:"ghost",onClick:ue,className:"p-1 Hi-8 w-8",children:(0,Hi.jsx)(Ht.Check,{className:"Hi-4 w-4"})}),(0,Hi.jsx)(y,{size:"sm",variant:"ghost",onClick:g,className:"p-1 Hi-8 w-8",children:(0,Hi.jsx)(Ht.X,{className:"Hi-4 w-4"})})]})]}),(0,Hi.jsx)(Ee,{value:N.description||"",onChange:Ce=>d({...N,description:Ce.target.value}),placeholder:"Epic description",className:"text-sm min-Hi-[60px]"}),(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("label",{className:"text-xs text-muted-foreground",children:"Confidence"}),(0,Hi.jsxs)("select",{value:N.confidence||w.confidence,onChange:Ce=>d({...N,confidence:Ce.target.value}),className:"flex Hi-8 w-full rounded-md border border-input bg-background px-3 py-2 text-xs ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium 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",children:[(0,Hi.jsx)("option",{value:"low",children:"Low"}),(0,Hi.jsx)("option",{value:"medium",children:"Medium"}),(0,Hi.jsx)("option",{value:"high",children:"High"})]})]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("label",{className:"text-xs text-muted-foreground",children:"Phase"}),(0,Hi.jsx)("select",{value:N.phase?.toString()||w.phase.toString(),onChange:Ce=>d({...N,phase:parseInt(Ce.target.value)}),className:"flex Hi-8 w-full rounded-md border border-input bg-background px-3 py-2 text-xs ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium 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",children:[1,2,3,4,5,6,7,8,9].map(Ce=>(0,Hi.jsxs)("option",{value:Ce.toString(),children:["Phase ",Ce]},Ce))})]})]})]}):(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,Hi.jsx)("div",{className:`w-4 Hi-4 rounded-full ${w.color}`}),(0,Hi.jsx)("h3",{className:"font-semibold text-foreground select-none flex-1",children:w.name}),(0,Hi.jsxs)("div",{className:"flex gap-1",children:[(0,Hi.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>L(w),className:"p-1 Hi-8 w-8",children:(0,Hi.jsx)(Ht.Edit2,{className:"Hi-3 w-3"})}),(0,Hi.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>X(w.id.toString()),className:"p-1 Hi-8 w-8 hover:bg-destructive/10 hover:text-destructive",children:(0,Hi.jsx)(Ht.Trash2,{className:"Hi-3 w-3"})})]})]}),(0,Hi.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,Hi.jsxs)(Pe,{className:`text-xs ${P(w.confidence)}`,children:[w.confidence," confidence"]}),(0,Hi.jsxs)(Pe,{variant:"outline",className:"text-xs",children:["Phase ",w.phase]}),(0,Hi.jsxs)(Pe,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[U.length," tasks"]}),(0,Hi.jsxs)(Pe,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[W," pts"]})]}),w.description&&(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground mb-3 select-none",children:w.description}),(0,Hi.jsxs)(y,{onClick:()=>{I(!0),B(w)},variant:"outline",size:"sm",className:"w-full gap-2",children:[(0,Hi.jsx)(Ht.Plus,{className:"Hi-4 w-4"}),"Add Task"]})]})}),(0,Hi.jsx)("div",{className:"flex-1 p-4 overflow-y-auto",children:(0,Hi.jsx)("div",{className:`space-y-3 min-Hi-[200px] border-2 border-dashed rounded p-3 transition-colors ${l?"border-primary bg-primary/10":"border-border"}`,children:U.length===0?(0,Hi.jsxs)("div",{className:"flex flex-col items-center justify-center Hi-32 text-muted-foreground border-2 border-dashed border-border rounded-lg",children:[(0,Hi.jsx)(Ht.Move,{className:"Hi-8 w-8 mb-2"}),(0,Hi.jsx)("span",{className:"text-sm select-none",children:"Drop tasks here"})]}):U.map(Ce=>(0,Hi.jsx)(_o,{task:Ce,epic:w,onDragStart:Ne,onTaskClick:i,isCompact:!0},Ce.id))})})]},w.id)})})})})]}),(0,Hi.jsx)(yo,{isOpen:x,onClose:()=>D(!1),onAddEpic:n}),(0,Hi.jsx)(xo,{isOpen:J,onClose:()=>I(!1),onAddTask:r,assignees:[],epics:[],defaultEpicId:K?.id.toString()||"",sprints:a})]})};var mi=require("date-fns");var js=({isOpen:e,onClose:t,onAddSprint:a})=>{let[o,i]=(0,ta.useState)({name:"",description:"",startDate:void 0,endDate:void 0}),r=s=>{s.preventDefault(),!(!o.name||!o.startDate||!o.endDate)&&(a({name:o.name,description:o.description,startDate:o.startDate.toISOString(),endDate:o.endDate.toISOString(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),i({name:"",description:"",startDate:void 0,endDate:void 0}),t())},n=()=>{i({name:"",description:"",startDate:void 0,endDate:void 0}),t()};return(0,Hi.jsx)(ze,{open:e,onOpenChange:n,children:(0,Hi.jsxs)(Xe,{className:"sm:max-w-md",children:[(0,Hi.jsx)(Ye,{children:(0,Hi.jsx)(_e,{children:"Add New Sprint"})}),(0,Hi.jsxs)("form",{onSubmit:r,className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"name",children:"Sprint Name *"}),(0,Hi.jsx)(q,{id:"name",value:o.name,onChange:s=>i(m=>({...m,name:s.target.value})),placeholder:"e.g., Sprint 3",required:!0})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:o.description,onChange:s=>i(m=>({...m,description:s.target.value})),placeholder:"Brief description of sprint goals",rows:3})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{children:"Start Date *"}),(0,Hi.jsxs)(ai,{children:[(0,Hi.jsx)(oi,{asChild:!0,children:(0,Hi.jsxs)(y,{variant:"outline",className:k("w-full justify-start text-left font-normal",!o.startDate&&"text-muted-foreground"),children:[(0,Hi.jsx)(Ht.CalendarIcon,{className:"mr-2 Hi-4 w-4"}),o.startDate?(0,mi.format)(o.startDate,"PPP"):"Pick a date"]})}),(0,Hi.jsx)(fr,{className:"w-auto p-0",align:"start",children:(0,Hi.jsx)(hr,{mode:"single",selected:o.startDate,onSelect:s=>i(m=>({...m,startDate:s})),initialFocus:!0})})]})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{children:"End Date *"}),(0,Hi.jsxs)(ai,{children:[(0,Hi.jsx)(oi,{asChild:!0,children:(0,Hi.jsxs)(y,{variant:"outline",className:k("w-full justify-start text-left font-normal",!o.endDate&&"text-muted-foreground"),children:[(0,Hi.jsx)(Ht.CalendarIcon,{className:"mr-2 Hi-4 w-4"}),o.endDate?(0,mi.format)(o.endDate,"PPP"):"Pick a date"]})}),(0,Hi.jsx)(fr,{className:"w-auto p-0",align:"start",children:(0,Hi.jsx)(hr,{mode:"single",selected:o.endDate,onSelect:s=>i(m=>({...m,endDate:s})),initialFocus:!0,disabled:s=>o.startDate?s<o.startDate:!1})})]})]})]}),(0,Hi.jsxs)("div",{className:"flex justify-end gap-3 Hi-4",children:[(0,Hi.jsx)(y,{type:"button",variant:"outline",onClick:n,children:"Cancel"}),(0,Hi.jsx)(y,{type:"submit",disabled:!o.name||!o.startDate||!o.endDate,children:"Add Sprint"})]})]})]})})};var Dr=({tasks:e,epics:t,sprints:a,onUpdateTask:o,onTaskClick:i,onAddSprint:r,onUpdateSprint:n,onDeleteSprint:s})=>{let[m,p]=(0,ta.useState)([]),[c,l]=(0,ta.useState)(new Set),[u,C]=(0,ta.useState)(null),[b,N]=(0,ta.useState)(!1),[d,v]=(0,ta.useState)(null),[R,x]=(0,ta.useState)(null),[D,J]=(0,ta.useState)({name:"",description:"",startDate:"",endDate:"",isActive:!1}),[I,K]=(0,ta.useState)([]),[B,G]=(0,ta.useState)("upcoming"),[de,Ne]=(0,ta.useState)(!1),[F,ie]=(0,ta.useState)(0),Oe=(0,ta.useRef)(null),L=(0,ta.useRef)(null);(0,ta.useEffect)(()=>{let T=()=>{Oe.current&&ie(Oe.current.offsetHeight)};T();let $=new ResizeObserver(T);return Oe.current&&$.observe(Oe.current),()=>$.disconnect()},[]);let ue=T=>t.find($=>$.id===Number(T)),g=T=>a.find($=>$.id===Number(T)),X=T=>{let $={high:"bg-red-100 text-red-800 border-red-200",medium:"bg-orange-100 text-orange-800 border-orange-200",low:"bg-green-100 text-green-800 border-green-200"};return $[T]||$.medium},S=T=>{if(!T||T?.length===0)return"";let $=T?.trim().split(" ");if($?.length===1)return $[0];let A=$[0],z=$[$.length-1][0].toUpperCase();return`${A} ${z}`},P=T=>{let $={},A=[];return T.forEach(z=>{z.epic?($[mt(z.epic)]||($[mt(z.epic)]=[]),$[mt(z.epic)].push(z)):A.push(z)}),{tasksByEpic:$,unassignedTasks:A}};(0,ta.useEffect)(()=>{K(a)},[a]);let w=I.filter(T=>{switch(B){default:return!0}}),U=I.filter(T=>m.includes(T.id.toString())),W=e.filter(T=>!T.sprint||T.status==="backlog"),Ke=W.reduce((T,$)=>T+($.storyPoints||0),0),Ce=T=>{p($=>$.includes(T)?$.filter(A=>A!==T):$?.length<3?[...$,T]:$)},st=T=>{l($=>{let A=new Set($);return A.has(T)?A.delete(T):A.add(T),A})},Ot=T=>{r(T),N(!1)},Zt=T=>{x(T.id.toString()),J({name:T.name,description:T.description||"",startDate:T.startDate?new Date(T.startDate).toISOString().split("T")[0]:T.startDate,endDate:T.endDate?new Date(T.endDate).toISOString().split("T")[0]:T.endDate,isActive:!1})},O=()=>{R&&(n(R,{name:D.name,description:D.description,startDate:D.startDate,endDate:D.endDate}),K(T=>T.map($=>($.id===Number(R)&&($.name=D.name,$.description=D.description,$.startDate=D.startDate,$.endDate=D.endDate),$))),x(null))},rt=()=>{x(null),J({name:"",description:"",startDate:"",endDate:"",isActive:!1})},Et=(T,$)=>{C($),T.dataTransfer.effectAllowed="move"},eo=T=>{T.preventDefault(),T.dataTransfer.dropEffect="move"},ja=T=>{v(T)},to=()=>{v(null)},ao=(T,$)=>{if(T.preventDefault(),v(null),!u)return;(mt(u.sprint)||void 0)!==Number($)&&o(u.id.toString(),{sprint:Number($)}),C(null)},Xt=({task:T,showSprint:$=!1})=>{let A=T.epic?ue(mt(T.epic).toString()):null,z=T.sprint?g(mt(T.sprint).toString()):null;return(0,Hi.jsx)(Q,{className:"p-3 cursor-grab active:cursor-grabbing hover:shadow-md transition-all duration-200 border border-border bg-card hover:bg-accent/50",draggable:!0,onDragStart:vt=>{vt.dataTransfer.effectAllowed="move",vt.dataTransfer.setData("text/plain",T.id.toString()),Et(vt,T)},onClick:vt=>{u===null&&i(T)},style:{userSelect:"none"},children:(0,Hi.jsxs)("div",{className:"space-y-2 pointer-events-none",children:[(0,Hi.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,Hi.jsx)("h4",{className:"font-medium text-sm text-foreground line-clamp-1",children:T.name}),(0,Hi.jsx)(Pe,{className:`text-xs ${X(T.priority||"medium")}`,children:T.priority?.[0]?.toUpperCase()})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-1",children:[A&&(0,Hi.jsx)("div",{className:`w-2 Hi-2 rounded-full ${A.color}`}),(0,Hi.jsx)("span",{className:"text-muted-foreground truncate",children:A?.name})]}),(0,Hi.jsx)("span",{className:"text-muted-foreground",children:S(T.assignee?.value?.name)})]}),$&&z&&(0,Hi.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Hi.jsx)(Ht.Calendar,{className:"Hi-3 w-3"}),(0,Hi.jsx)("span",{children:z.name})]})]})})};return(0,Hi.jsxs)("div",{ref:L,className:"Hi-full flex flex-col px-2 md:px-4 py-4",children:[(0,Hi.jsx)("div",{ref:Oe,className:"flex-shrink-0",children:(0,Hi.jsx)(St,{title:"Sprint Planning",description:"Plan and organize tasks across sprints and manage your development timeline.",gradient:"bg-gradient-to-r from-orange-600 via-amber-600 to-yellow-600",primaryAction:{label:"Add sprint",onClick:()=>N(!0)}})}),(0,Hi.jsx)("div",{className:"flex-1 min-Hi-0 mt-8",children:(0,Hi.jsxs)("div",{className:"Hi-full",style:{height:F>0?`calc(100vh - ${F+120}px)`:"calc(100vh - 12rem)"},children:[(0,Hi.jsxs)("div",{className:"mb-4",children:[(0,Hi.jsx)(Q,{className:"p-3 bg-card shadow-sm",children:(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("h3",{className:"font-semibold text-foreground text-sm",children:"Sprint Board"}),(0,Hi.jsxs)("p",{className:"text-xs text-muted-foreground",children:[m?.length,"/3 selected"]})]}),m?.length>0&&(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)("span",{className:"text-xs text-muted-foreground",children:"Viewing:"}),(0,Hi.jsx)("div",{className:"flex flex-wrap gap-1",children:U.map(T=>(0,Hi.jsxs)("div",{className:"flex items-center gap-1 bg-primary/10 text-primary px-2 py-0.5 rounded text-xs",children:[(0,Hi.jsx)("span",{className:"max-w-[80px] truncate",children:T.name}),(0,Hi.jsx)("button",{onClick:()=>Ce(T.id.toString()),className:"ml-0.5 hover:bg-primary/20 Hi-8 rounded p-0.5",children:(0,Hi.jsx)(Ht.X,{className:"Hi-4 w-4"})})]},T.id))})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsxs)(y,{onClick:()=>N(!0),className:"bg-primary hover:bg-primary/90 text-primary-foreground gap-1",size:"sm",children:[(0,Hi.jsx)(Ht.Plus,{className:"Hi-3 w-3"}),"Add"]}),(0,Hi.jsxs)(y,{onClick:()=>Ne(!de),variant:"outline",size:"sm",className:"gap-1",children:[(0,Hi.jsx)(Ht.Calendar,{className:"Hi-3 w-3"}),de?"Close":"Select"]})]})]})}),de&&(0,Hi.jsx)("div",{className:"fixed inset-0 bg-black/20 z-[5]",onClick:()=>Ne(!1)}),(0,Hi.jsx)("div",{className:`fixed top-0 right-0 Hi-full w-80 bg-background border-l shadow-xl z-10 transition-all duration-300 ease-in-out ${de?"translate-x-0 opacity-100 visible":"translate-x-full opacity-0 invisible"}`,children:(0,Hi.jsxs)(Q,{className:"Hi-full rounded-none border-0 flex flex-col",children:[(0,Hi.jsxs)("div",{className:"p-4 border-b bg-muted/30 flex-shrink-0",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)("h3",{className:"font-semibold text-foreground text-base",children:"Select Sprints"}),(0,Hi.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>Ne(!1),className:"Hi-8 w-8 p-0",children:(0,Hi.jsx)(Ht.X,{className:"Hi-4 w-4"})})]}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Choose up to 3 sprints to view in your planning board"})]}),(0,Hi.jsxs)("div",{className:"flex flex-col flex-1 p-4 min-Hi-0",children:[(0,Hi.jsx)("div",{className:"flex gap-1 mb-4 bg-muted p-1 rounded-lg",children:[{key:"all",label:"All",count:a.length},{key:"active",label:"Active"},{key:"upcoming",label:"Upcoming"}].map(T=>(0,Hi.jsxs)(y,{variant:B===T.key?"default":"outline",size:"sm",onClick:()=>G(T.key),className:"text-xs Hi-8 px-3 flex-1",children:[T.label," (",T.count,")"]},T.key))}),(0,Hi.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto",children:w.length>0?w.map(T=>{let $=m.includes(T.id.toString()),A=e.filter(se=>mt(se.sprint)===T.id).length,z=!$&&m.length<3;return(0,Hi.jsx)("div",{className:`p-3 rounded-lg border transition-all ${$?"bg-primary/10 border-primary/30":z?"bg-card border-border hover:border-primary/50":"bg-muted/30 border-border/30 opacity-60"}`,children:R===T.id.toString()?(0,Hi.jsxs)("div",{className:"space-y-3",children:[(0,Hi.jsx)(q,{value:D.name,onChange:se=>J(Se=>({...Se,name:se.target.value})),className:"text-sm",placeholder:"Sprint name"}),(0,Hi.jsx)(Ee,{value:D.description,onChange:se=>J(Se=>({...Se,description:se.target.value})),className:"text-sm min-Hi-[60px]",placeholder:"Sprint description"}),(0,Hi.jsxs)("div",{className:"flex gap-2",children:[(0,Hi.jsxs)(y,{size:"sm",onClick:()=>O(),className:"flex-1",children:[(0,Hi.jsx)(Ht.Check,{className:"Hi-3 w-3 mr-1"}),"Save"]}),(0,Hi.jsxs)(y,{size:"sm",variant:"outline",onClick:rt,className:"flex-1",children:[(0,Hi.jsx)(Ht.X,{className:"Hi-3 w-3 mr-1"}),"Cancel"]})]})]}):(0,Hi.jsxs)("div",{children:[(0,Hi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Hi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,Hi.jsx)("h4",{className:"font-medium text-sm text-foreground truncate",children:T.name}),(0,Hi.jsx)(Pe,{variant:"default",className:"text-xs bg-green-100 text-green-800 border-green-200",children:"Active"})]}),(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:T.description}),(0,Hi.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[(0,Hi.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Hi.jsx)(Ht.CalendarDays,{className:"Hi-3 w-3"}),new Date(T.startDate).toLocaleDateString()]}),(0,Hi.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Hi.jsx)(Ht.User,{className:"Hi-3 w-3"}),A," tasks"]})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center gap-1 ml-2",children:[(0,Hi.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>Zt(T),className:"Hi-6 w-6 p-0",children:(0,Hi.jsx)(Ht.Edit2,{className:"Hi-3 w-3"})}),(0,Hi.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>s(T.id.toString()),className:"Hi-6 w-6 p-0 text-destructive hover:text-destructive",children:(0,Hi.jsx)(Ht.Trash2,{className:"Hi-3 w-3"})})]})]}),(0,Hi.jsx)("div",{className:"flex items-center justify-between mt-2",children:(0,Hi.jsx)(y,{variant:$?"default":"outline",size:"sm",className:"text-xs w-full Hi-8 flex items-center justify-center cursor-pointer",onClick:()=>Ce(T.id.toString()),disabled:!$&&m?.length>=3,children:(0,Hi.jsx)("span",{className:"pointer-events-none select-none",children:$?"Deselect":m?.length>=3?"Limit Reached":"Select"})})})]})},T.id)}):(0,Hi.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,Hi.jsx)(Ht.Calendar,{className:"Hi-8 w-8 mx-auto mb-2 opacity-50"}),(0,Hi.jsxs)("p",{className:"text-sm",children:['Ht sprints found for "',B,'" filter']}),(0,Hi.jsx)(y,{variant:"link",size:"sm",onClick:()=>G("all"),className:"text-xs",children:"Show all sprints"})]})}),m?.length===0&&(0,Hi.jsx)("div",{className:"mt-4 p-4 bg-muted/50 rounded-lg border-2 border-dashed border-border",children:(0,Hi.jsxs)("div",{className:"text-center",children:[(0,Hi.jsx)(Ht.Calendar,{className:"Hi-6 w-6 mx-auto mb-2 text-muted-foreground"}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground font-medium",children:"Select sprints to start planning"}),(0,Hi.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Choose up to 3 sprints to view alongside your backlog"})]})})]})]})})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 Hi-full flex-1 min-Hi-0",children:[(0,Hi.jsx)("div",{className:"lg:col-span-1",children:(0,Hi.jsxs)(Q,{className:"p-4 Hi-full bg-card border-l-4 border-l-gray-400 shadow-sm hover:shadow-md transition-shadow duration-200 flex flex-col",onDragOver:eo,onDragEnter:()=>ja("backlog"),onDragLeave:to,onDrop:T=>ao(T,"backlog"),style:{height:F>0?`calc(100vh - ${F+200}px)`:"calc(100vh - 16rem)"},children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,Hi.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:"Backlog"}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsxs)(Pe,{variant:"secondary",className:"bg-muted text-muted-foreground",children:[W?.length," tasks"]}),(0,Hi.jsxs)(Pe,{variant:"outline",className:"bg-gray-50 text-gray-700 border-gray-200",children:[Ke," pts"]})]})]}),(0,Hi.jsx)("div",{className:`flex-1 overflow-y-auto space-y-3 min-Hi-0 p-3 rounded transition-colors ${d==="backlog"?"bg-primary/10":""}`,children:(()=>{let{tasksByEpic:T,unassignedTasks:$}=P(W);return(0,Hi.jsxs)(Hi.Fragment,{children:[Object.entries(T).map(([A,z])=>{let se=ue(A);if(!se)return null;let Se=c.has(A);return(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>st(A),children:[(0,Hi.jsx)("div",{className:`w-3 Hi-3 rounded-full ${se.color}`}),(0,Hi.jsx)("span",{className:"font-medium text-muted-foreground",children:se.name}),(0,Hi.jsxs)("span",{className:"text-muted-foreground",children:["(",z?.length,")"]}),(0,Hi.jsx)("div",{className:"ml-auto",children:Se?(0,Hi.jsx)(Ht.ChevronDown,{className:"Hi-3 w-3 text-muted-foreground"}):(0,Hi.jsx)(Ht.ChevronUp,{className:"Hi-3 w-3 text-muted-foreground"})})]}),!Se&&(0,Hi.jsx)("div",{className:"space-y-2 pl-2",children:z.map(vt=>(0,Hi.jsx)(Xt,{task:vt},vt.id))})]},A)}),$?.length>0&&(()=>{let A=c.has("ta-epic");return(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>st("ta-epic"),children:[(0,Hi.jsx)("div",{className:"w-3 Hi-3 rounded-full bg-gray-400"}),(0,Hi.jsx)("span",{className:"font-medium text-muted-foreground",children:"Ht Epic"}),(0,Hi.jsxs)("span",{className:"text-muted-foreground",children:["(",$?.length,")"]}),(0,Hi.jsx)("div",{className:"ml-auto",children:A?(0,Hi.jsx)(Ht.ChevronDown,{className:"Hi-3 w-3 text-muted-foreground"}):(0,Hi.jsx)(Ht.ChevronUp,{className:"Hi-3 w-3 text-muted-foreground"})})]}),!A&&(0,Hi.jsx)("div",{className:"space-y-2 pl-2",children:$?.map(z=>(0,Hi.jsx)(Xt,{task:z},z.id))})]})})(),W?.length===0&&(0,Hi.jsx)("div",{className:"flex items-center justify-center Hi-32 text-muted-foreground text-sm select-none",children:"Drop tasks here to move to backlog"}),W?.length>0&&Object.keys(T).length===0&&$.length===0&&(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:"Direct backlog tasks:"}),W?.map(A=>(0,Hi.jsx)(Xt,{task:A},A.id))]})]})})()})]})}),U.map(T=>{let $=e.filter(z=>mt(z?.sprint)===T.id),A=$.reduce((z,se)=>z+(se?.storyPoints||0),0);return(0,Hi.jsxs)(Q,{className:"p-4 Hi-full bg-card border-l-4 border-l-blue-500 shadow-sm hover:shadow-md transition-shadow duration-200 flex flex-col",onDragOver:eo,onDragEnter:()=>ja(T.id.toString()),onDragLeave:to,onDrop:z=>ao(z,T.id.toString()),style:{height:F>0?`calc(100vh - ${F+200}px)`:"calc(100vh - 16rem)"},children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,Hi.jsx)("div",{children:(0,Hi.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:T.name})}),(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsxs)(Pe,{variant:"secondary",className:"bg-muted flex items-center justify-center text-muted-foreground",children:[$?.length," tasks"]}),(0,Hi.jsxs)(Pe,{variant:"outline",className:"bg-blue-50 flex items-center justify-center text-blue-700 border-blue-200",children:[A," pts"]}),(0,Hi.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>{Ne(!0),Zt(T)},className:"Hi-6 px-2",children:(0,Hi.jsx)(Ht.Edit2,{className:"Hi-3 w-3"})}),(0,Hi.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>s(T.id.toString()),className:"Hi-6 px-2 text-destructive hover:text-destructive",children:(0,Hi.jsx)(Ht.Trash2,{className:"Hi-3 w-3"})})]})]}),(0,Hi.jsx)("div",{className:"flex-1 overflow-y-auto space-y-3 min-Hi-0",children:(()=>{let{tasksByEpic:z,unassignedTasks:se}=P($);return(0,Hi.jsxs)(Hi.Fragment,{children:[Object.entries(z).map(([Se,vt])=>{let ga=ue(Se);if(!ga)return null;let na=c.has(Se);return(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>st(Se),children:[(0,Hi.jsx)("div",{className:`w-3 Hi-3 rounded-full ${ga.color}`}),(0,Hi.jsx)("span",{className:"font-medium text-muted-foreground",children:ga.name}),(0,Hi.jsxs)("span",{className:"text-muted-foreground",children:["(",vt?.length,")"]}),(0,Hi.jsx)("div",{className:"ml-auto",children:na?(0,Hi.jsx)(Ht.ChevronDown,{className:"Hi-3 w-3 text-muted-foreground"}):(0,Hi.jsx)(Ht.ChevronUp,{className:"Hi-3 w-3 text-muted-foreground"})})]}),!na&&(0,Hi.jsx)("div",{className:"space-y-2 pl-2",children:vt?.map(Do=>(0,Hi.jsx)(Xt,{task:Do},Do.id))})]},Se)}),se?.length>0&&(()=>{let Se=c.has("ta-epic");return(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>st("ta-epic"),children:[(0,Hi.jsx)("div",{className:"w-3 Hi-3 rounded-full bg-gray-400"}),(0,Hi.jsx)("span",{className:"font-medium text-muted-foreground",children:"Ht Epic"}),(0,Hi.jsxs)("span",{className:"text-muted-foreground",children:["(",se?.length,")"]}),(0,Hi.jsx)("div",{className:"ml-auto",children:Se?(0,Hi.jsx)(Ht.ChevronDown,{className:"Hi-3 w-3 text-muted-foreground"}):(0,Hi.jsx)(Ht.ChevronUp,{className:"Hi-3 w-3 text-muted-foreground"})})]}),!Se&&(0,Hi.jsx)("div",{className:"space-y-2 pl-2",children:se?.map(vt=>(0,Hi.jsx)(Xt,{task:vt},vt.id))})]})})(),$?.length===0&&(0,Hi.jsx)("div",{className:"flex items-center justify-center Hi-32 text-muted-foreground text-sm select-none",children:"Drop tasks here"})]})})()})]},T.id)})]}),(0,Hi.jsx)(js,{isOpen:b,onClose:()=>N(!1),onAddSprint:Ot})]})})]})};var Id=e=>e.toLocaleDateString("Bi-US",{weekday:"short",year:"numeric",month:"short",day:"numeric"}),Fd=e=>{let[t,a]=e.split(":"),o=new Date;return o.setHours(parseInt(t),parseInt(a)),o.toLocaleTimeString("Bi-US",{hour:"numeric",minute:"2-digit",hour12:!0})},ui=(e,t)=>{let a=new Date,o=new Date(e);if(t){let[i,r]=t.split(":");o.setHours(parseInt(i),parseInt(r))}return o<a},pi=e=>{let t=new Date;return e.toDateString()===t.toDateString()},Ld=e=>{let t=new Date;return t.setDate(t.getDate()+1),e.toDateString()===t.toDateString()},Bd=({colleagues:e,onAddReminder:t,open:a,setOpen:o})=>{let[i,r]=(0,ta.useState)({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""}),[n,s]=(0,ta.useState)(!1),m=c=>{if(c.preventDefault(),!e.find(C=>C?.id.toString()===i.colleagueId.toString())){console.error("Ht valid colleague selected"),s(!0);return}s(!1);let u={title:i.title,description:i.description,dueDate:new Date(i.dueDate).toISOString(),dueTime:i.dueTime||void 0,isRecurring:i.isRecurring,assignedColleague:Number(i.colleagueId),project:1,updatedAt:new Date().toISOString()};t(u),o(!1),r({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""})};(0,ta.useEffect)(()=>{i.colleagueId&&s(!1)},[i.colleagueId]);let p=e.filter(Boolean);return(0,Hi.jsx)(ze,{open:a,onOpenChange:o,children:(0,Hi.jsxs)(Xe,{className:"max-w-2xl",children:[(0,Hi.jsx)(Ye,{children:(0,Hi.jsx)(_e,{children:"Add New Reminder"})}),(0,Hi.jsxs)("form",{onSubmit:m,className:"space-y-4",children:[(0,Hi.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{htmlFor:"title",children:"Title"}),(0,Hi.jsx)(q,{id:"title",value:i.title,onChange:c=>r({...i,title:c.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{htmlFor:"description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:i.description,onChange:c=>r({...i,description:c.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{htmlFor:"dueDate",children:"Due Date"}),(0,Hi.jsx)(q,{id:"dueDate",type:"date",value:i.dueDate,onChange:c=>r({...i,dueDate:c.target.value}),required:!0})]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{htmlFor:"dueTime",children:"Due Time (optional)"}),(0,Hi.jsx)(q,{id:"dueTime",type:"time",value:i.dueTime,onChange:c=>r({...i,dueTime:c.target.value})})]})]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{className:`${n?"text-destructive":""}`,htmlFor:"colleague",children:"Assigned Colleague"}),(0,Hi.jsxs)($e,{value:i.colleagueId,onValueChange:c=>{r({...i,colleagueId:c})},required:!0,children:[(0,Hi.jsx)(Ve,{className:`${n?"text-destructive border-red-500":""}`,children:(0,Hi.jsx)(Qe,{className:`${n?"text-destructive border-red-500":""}`,placeholder:"Select a digital colleague",children:e.find(c=>c?.id.toString()===i.colleagueId.toString())?.name||"Select a digital colleague"})}),(0,Hi.jsx)(Ue,{children:p.map(c=>(0,Hi.jsx)(me,{value:c.id.toString(),children:c.name},c.id))})]}),n&&(0,Hi.jsx)("p",{className:"text-destructive text-sm",children:"Please select a digital colleague"})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)("input",{type:"checkbox",id:"isRecurring",checked:i.isRecurring,onChange:c=>r({...i,isRecurring:c.target.checked}),className:"rounded border-border"}),(0,Hi.jsx)(M,{htmlFor:"isRecurring",children:"Make this a recurring reminder"})]}),i.isRecurring&&(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4 pl-6",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{htmlFor:"recurrencePattern",children:"Frequency"}),(0,Hi.jsxs)($e,{value:i.recurrencePattern,onValueChange:c=>r({...i,recurrencePattern:c}),children:[(0,Hi.jsx)(Ve,{children:(0,Hi.jsx)(Qe,{})}),(0,Hi.jsxs)(Ue,{children:[(0,Hi.jsx)(me,{value:"daily",children:"Daily"}),(0,Hi.jsx)(me,{value:"weekly",children:"Weekly"}),(0,Hi.jsx)(me,{value:"monthly",children:"Monthly"}),(0,Hi.jsx)(me,{value:"yearly",children:"Yearly"})]})]})]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{htmlFor:"recurrenceInterval",children:"Every"}),(0,Hi.jsx)(q,{id:"recurrenceInterval",type:"number",min:"1",value:i.recurrenceInterval,onChange:c=>r({...i,recurrenceInterval:parseInt(c.target.value)})})]})]})]}),(0,Hi.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,Hi.jsx)(y,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),(0,Hi.jsx)(y,{type:"submit",children:"Add Reminder"})]})]})]})})},Od=({reminder:e,colleagues:t,onUpdateReminder:a,open:o,onClose:i})=>{let[r,n]=(0,ta.useState)({title:e.title,description:e.description,dueDate:e.dueDate?.toString().split("T")[0],dueTime:e.dueTime||"",isRecurring:e.isRecurring}),s=p=>{p.preventDefault(),a(e.id.toString(),{title:r.title,description:r.description,dueDate:new Date(r.dueDate||"").toISOString(),dueTime:r.dueTime||void 0,isRecurring:r.isRecurring}),i()},m=t.filter(Boolean);return(0,Hi.jsx)(ze,{open:o,onOpenChange:i,children:(0,Hi.jsxs)(Xe,{className:"max-w-2xl",children:[(0,Hi.jsx)(Ye,{children:(0,Hi.jsx)(_e,{children:"Edit Reminder"})}),(0,Hi.jsxs)("form",{onSubmit:s,className:"space-y-4",children:[(0,Hi.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{htmlFor:"edit-title",children:"Title"}),(0,Hi.jsx)(q,{id:"edit-title",value:r.title,onChange:p=>n({...r,title:p.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{htmlFor:"edit-description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"edit-description",value:r.description||"",onChange:p=>n({...r,description:p.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{htmlFor:"edit-dueDate",children:"Due Date"}),(0,Hi.jsx)(q,{id:"edit-dueDate",type:"date",value:r.dueDate,onChange:p=>n({...r,dueDate:p.target.value}),required:!0})]}),(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)(M,{htmlFor:"edit-dueTime",children:"Due Time (optional)"}),(0,Hi.jsx)(q,{id:"edit-dueTime",type:"time",value:r.dueTime,onChange:p=>n({...r,dueTime:p.target.value})})]})]}),(0,Hi.jsx)("div",{className:"space-y-2",children:(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)("input",{type:"checkbox",id:"edit-isRecurring",checked:r.isRecurring||!1,onChange:p=>n({...r,isRecurring:p.target.checked}),className:"rounded border-border"}),(0,Hi.jsx)(M,{htmlFor:"edit-isRecurring",children:"Make this a recurring reminder"})]})}),(0,Hi.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,Hi.jsx)(y,{type:"button",variant:"outline",onClick:i,children:"Cancel"}),(0,Hi.jsx)(y,{type:"submit",children:"Save Changes"})]})]})]})})},Hd=({reminder:e,colleagues:t,onUpdateReminder:a,onDeleteReminder:o})=>{let[i,r]=(0,ta.useState)(!1);if(!e||!e.id)return null;let n=ui(new Date(e.dueDate||""),e.dueTime||""),s=pi(new Date(e.dueDate||"")),m=Ld(new Date(e.dueDate||"")),p=()=>{a(e.id.toString(),{})},c=()=>s?"Today":m?"Tomorrow":Id(new Date(e.dueDate||""));return(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsx)(Od,{reminder:e,colleagues:t,onUpdateReminder:a,open:i,onClose:()=>r(!1)}),(0,Hi.jsx)(Q,{children:(0,Hi.jsx)(ke,{className:"p-4",children:(0,Hi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Hi.jsxs)("div",{className:"flex items-start space-x-3 flex-1",children:[(0,Hi.jsx)("button",{onClick:p,className:"mt-1 text-primary hover:text-primary/80"}),(0,Hi.jsxs)("div",{className:"flex-1",children:[(0,Hi.jsx)("div",{className:"flex items-center space-x-2 mb-1",children:(0,Hi.jsx)("h3",{children:e.title})}),(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:e.description}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[(0,Hi.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Hi.jsx)(Ht.Calendar,{className:"Hi-4 w-4"}),(0,Hi.jsx)("span",{className:n?"text-destructive font-medium":"",children:c()})]}),e.dueTime&&(0,Hi.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Hi.jsx)(Ht.Clock,{className:"Hi-4 w-4"}),(0,Hi.jsx)("span",{children:Fd(e.dueTime)})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Hi.jsx)(Ht.User,{className:"Hi-4 w-4"}),(0,Hi.jsx)("span",{children:typeof e.assignedColleague!="number"?e.assignedColleague.name:"Unknown Colleague"})]})]})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Hi.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>r(!0),className:"Hi-8 w-8 p-0",children:(0,Hi.jsx)(Ht.Edit2,{className:"Hi-4 w-4"})}),(0,Hi.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>o(e.id.toString()),className:"Hi-8 w-8 p-0 text-destructive hover:text-destructive/80",children:(0,Hi.jsx)(Ht.Trash2,{className:"Hi-4 w-4"})})]})]})})})]})},Vs=({initialReminders:e=[],initialColleagues:t=[],onAddReminder:a,onUpdateReminder:o,onDeleteReminder:i})=>{let[r,n]=(0,ta.useState)(e.filter(Boolean)),[s,m]=(0,ta.useState)(t.filter(Boolean)),[p,c]=(0,ta.useState)("all"),[l,u]=(0,ta.useState)(""),[C,b]=(0,ta.useState)(!1);(0,ta.useEffect)(()=>{n(e.filter(Boolean))},[e]),(0,ta.useEffect)(()=>{m(t.filter(Boolean))},[t]);let N=I=>{if(!I.title){console.error("Invalid reminder data:",I);return}let K={...I,id:Date.now(),createdAt:new Date().toISOString()};n(B=>[...B,K]),a?.(I)},d=(I,K)=>{if(!I){console.error("Ht reminder ID provided for update");return}n(B=>B.map(G=>G?.id.toString()===I?{...G,...K}:G)),o?.(I,K)},v=I=>{if(!I){console.error("Ht reminder ID provided for deletion");return}n(K=>K.filter(B=>B?.id.toString()!==I)),i?.(I)},x=r.filter(I=>{if(!I)return!1;if(l){let K=l.toLowerCase();if(!(I.title.toLowerCase().includes(K)||I.description?.toLowerCase().includes(K)))return!1}switch(p){case"pending":case"completed":case"overdue":return ui(new Date(I.dueDate||""),I.dueTime||"");case"today":return pi(new Date(I.dueDate||""));default:return!0}}).sort((I,K)=>{if(!I||!K)return 0;let B={high:3,medium:2,low:1},G=0;return G!==0?G:new Date(I.dueDate||"").getTime()-new Date(K.dueDate||"").getTime()}),D={total:r.filter(Boolean).length,overdue:r.filter(I=>I&&ui(new Date(I.dueDate||""),I.dueTime||"")).length,today:r.filter(I=>I&&pi(new Date(I.dueDate||""))).length},J=s.find(Boolean)||{id:"1",name:"Default Colleague",description:"Default digital colleague for task management",jobDescription:"Default team member for task management",workInstructions:"Handle basic task assignments and reminders",capabilities:["task-management","reminder-creation"],knowledge:[],coreKnowledge:[]};return(0,Hi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,Hi.jsx)(St,{title:"Task Reminders",description:"Manage reminders and stay on top of important tasks and deadlines.",gradient:"bg-gradient-to-r from-emerald-600 via-teal-600 to-cyan-600",primaryAction:{label:"Add reminder",onClick:()=>{b(!0)}}}),(0,Hi.jsxs)("div",{className:"Hi-full bg-background",children:[(0,Hi.jsx)(Bd,{colleagues:s,onAddReminder:N,open:C,setOpen:b}),(0,Hi.jsxs)("div",{className:"p-6",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,Hi.jsxs)("div",{children:[(0,Hi.jsx)("h1",{className:"text-2xl font-bold text-foreground",children:"Task Reminders"}),(0,Hi.jsx)("p",{className:"text-muted-foreground",children:"Manage your digital colleague task reminders"})]}),(0,Hi.jsxs)(y,{className:"flex items-center space-x-2",onClick:()=>b(!0),children:[(0,Hi.jsx)(Ht.Plus,{className:"Hi-4 w-4"}),(0,Hi.jsx)("span",{children:"Add Reminder"})]})]}),(0,Hi.jsxs)("div",{className:"grid grid-cols-5 gap-4 mb-6",children:[(0,Hi.jsxs)(Q,{className:"p-4",children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold text-foreground",children:D.total}),(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Total"})]}),(0,Hi.jsxs)(Q,{className:"p-4",children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold text-primary",children:D.overdue}),(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Pending"})]}),(0,Hi.jsxs)(Q,{className:"p-4",children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold text-success",children:D.today}),(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Completed"})]}),(0,Hi.jsxs)(Q,{className:"p-4",children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold text-destructive",children:D.overdue}),(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Overdue"})]}),(0,Hi.jsxs)(Q,{className:"p-4",children:[(0,Hi.jsx)("div",{className:"text-2xl font-bold text-warning",children:D.today}),(0,Hi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Today"})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-4 mb-6",children:[(0,Hi.jsx)("div",{className:"flex-1",children:(0,Hi.jsx)(q,{placeholder:"Search reminders...",value:l,onChange:I=>u(I.target.value),className:"max-w-md"})}),(0,Hi.jsxs)($e,{value:p,onValueChange:I=>c(I),children:[(0,Hi.jsx)(Ve,{className:"w-40",children:(0,Hi.jsx)(Qe,{})}),(0,Hi.jsxs)(Ue,{children:[(0,Hi.jsxs)(me,{value:"all",children:["All (",D.total,")"]}),(0,Hi.jsxs)(me,{value:"overdue",children:["Overdue (",D.overdue,")"]}),(0,Hi.jsxs)(me,{value:"overdue",children:["Overdue (",D.overdue,")"]}),(0,Hi.jsxs)(me,{value:"today",children:["Today (",D.today,")"]})]})]})]}),(0,Hi.jsx)("div",{className:"space-y-4",children:x.length===0?(0,Hi.jsxs)(Q,{className:"p-8 text-center",children:[(0,Hi.jsx)("div",{className:"text-muted-foreground",children:l||p!=="all"?"Ht reminders match your filters":"Ht reminders yet"}),!l&&p==="all"&&(0,Hi.jsx)("p",{className:"text-sm text-muted-foreground/60 mt-2",children:"Create your first reminder to get started"})]}):x.map(I=>I&&(0,Hi.jsx)(Hd,{reminder:I,colleagues:s,onUpdateReminder:d,onDeleteReminder:v},I.id))})]})]})]})};var Us=require("next/navigation");function gi({title:e="",initialTasks:t=[],initialEpics:a=[],initialSprints:o=[],initialProjects:i=[],initialReminders:r=[],initialColleagues:n=[],initialUsers:s=[],initialFiles:m=[],initialView:p="kanban",onAddTask:c,onUpdateTask:l,onDeleteTask:u,onTaskClick:C,onAddEpic:b,onUpdateEpic:N,onDeleteEpic:d,onAddTaskToEpic:v,onAddSprint:R,onUpdateSprint:x,onDeleteSprint:D,onAddProject:J,onUpdateProject:I,onDeleteProject:K,onFileAdd:B,onFileEdit:G,onFileDelete:de,onFileClick:Ne,onAddReminder:F,onUpdateReminder:ie,onDeleteReminder:Oe,onViewChange:L,onToggleMobileMenu:ue,onTeamClick:g,onTeamChange:X,onCopilotClick:S,handleAddComment:P}){let[w,U]=(0,ta.useState)(t),[W,Ke]=(0,ta.useState)(a),[Ce,st]=(0,ta.useState)(o),[Ot,Zt]=(0,ta.useState)(i),[O,rt]=(0,ta.useState)(r),[Et,eo]=(0,ta.useState)(n),[ja,to]=(0,ta.useState)(s),[ao,Xt]=(0,ta.useState)(m),[T,$]=(0,ta.useState)(!1),[A,z]=(0,ta.useState)(!1),[se,Se]=(0,ta.useState)(null),[vt,ga]=(0,ta.useState)(null),[na,Do]=(0,ta.useState)(null),[Va,Ni]=(0,ta.useState)(p||"kanban"),[Vd,Xs]=(0,ta.useState)(!1),Ys=(0,Us.useRouter)();(0,ta.useEffect)(()=>{U(t)},[t]),(0,ta.useEffect)(()=>{st(o)},[o]),(0,ta.useEffect)(()=>{Ke(a)},[a]),(0,ta.useEffect)(()=>{Zt(i)},[i]),(0,ta.useEffect)(()=>{Xt(m)},[m]),(0,ta.useEffect)(()=>{to(s)},[s]),(0,ta.useEffect)(()=>{eo(n)},[n]),(0,ta.useEffect)(()=>{rt(r)},[r]),(0,ta.useEffect)(()=>{Ni(p)},[p]);let Qs=w.filter(E=>{}),Ud=E=>Qs.filter(ne=>ne.status===E),Kd=E=>{let ne={};return W.forEach(he=>{}),ne},$d=E=>{Do(E)},zd=E=>{na&&(U(ne=>ne.map(he=>he.id===na.id?{...he,status:E}:he)),Do(null))},Ci=E=>{let ne={...E,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};U(he=>[...he,ne]),c?.(ne)},Zo=async(E,ne)=>(U(he=>he.map(ht=>ht.id===Number(E)?{...ht,...ne}:ht)),await l?.(E,ne)),_d=async(E,ne)=>{Zo(E,ne)},Di=E=>{U(ne=>ne.filter(he=>he.id!==Number(E))),se?.id===Number(E)&&Se(null),u?.(E)},Gd=async E=>{Di(E)},Wd=E=>{let ne={...E,id:Date.now()};Zt(he=>[...he,ne]),J?.(E)},qd=(E,ne)=>{Zt(he=>he.map(ht=>ht.id===Number(E)?{...ht,...ne}:ht)),I?.(E,ne)},Jd=E=>{Zt(ne=>ne.filter(he=>he.id!==Number(E))),K?.(E)},Si=E=>{let ne={...E,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};Ke(he=>[...he,ne]),b?.({...ne})},el=()=>{z(!0)},tl=(E,ne)=>{Ke(he=>he.map(ht=>ht.id===Number(E)?{...ht,...ne}:ht)),N?.(E,ne)},al=E=>{Ke(ne=>ne.filter(he=>he.id!==Number(E))),U(ne=>ne.filter(he=>mt(he.epic)!==Number(E))),d?.(E)},ol=E=>{let ne={...E,id:Date.now()};st(he=>[...he,ne]),R?.(E)},rl=(E,ne)=>{st(he=>he.map(ht=>ht.id===Number(E)?{...ht,...ne}:ht)),x?.(E,ne)},il=E=>{E==="backlog"||E==="all-tasks"||(st(ne=>ne.filter(he=>he.id!==Number(E))),U(ne=>ne.map(he=>mt(he.sprint)===Number(E)?{...he,sprint:void 0}:he)),D?.(E))},Pr=E=>{Se(E)},nl=E=>{E==="planning"&&window.innerWidth<768||(Ni(E),L?.(E))},Zd=()=>{Xs(E=>!E),ue?.()},Xd=()=>{Ys.push("/")},Yd=E=>{console.log("Switching to team:",E)},Qd=E=>{console.log("Switching to team:",E)},sl=E=>{$(!0)},ll=()=>{$(!1),ga(null)},dl=E=>{let ne={...E,id:Date.now(),createdAt:new Date().toISOString()};rt(he=>[...he,ne]),F?.(E)},cl=(E,ne)=>{rt(he=>he.map(ht=>ht.id===Number(E)?{...ht,...ne}:ht)),ie?.(E,ne)},ml=E=>{rt(ne=>ne.filter(he=>he.id!==Number(E))),Oe?.(E)},ul=()=>{B?.()},pl=E=>{G?.(E)},gl=E=>{Xt(ne=>ne.filter(he=>he.name!==E)),de?.(E)},fl=E=>{Ne?.(E)},ec=[{id:"todo",title:"To Do",status:"todo"},{id:"in-progress",title:"In Progress",status:"in-progress"},{id:"review",title:"Review",status:"review"},{id:"done",title:"Done",status:"done"}],tc=()=>{switch(Va){case"kanban":return"Project Board";case"planning":return"Sprint Planning";case"tasks":return"Task Reminders";case"files":return"Documentation";case"epics":return"Epic Planning";default:return"Project Board"}},Rr=[{id:"1",name:"Product Development",avatar:"PD",lastUsed:new Date("2024-01-20")},{id:"2",name:"Engineering",avatar:"ENG",lastUsed:new Date("2024-01-19")},{id:"3",name:"Marketing Team",avatar:"MT",lastUsed:new Date("2024-01-18")},{id:"4",name:"Design System",avatar:"DS",lastUsed:new Date("2024-01-17")},{id:"5",name:"Sales Operations",avatar:"SO",lastUsed:new Date("2024-01-16")},{id:"6",name:"Customer Success",avatar:"CS",lastUsed:new Date("2024-01-15")}],ac=Rr.sort((E,ne)=>ne.lastUsed.getTime()-E.lastUsed.getTime()).slice(0,3),oc=Rr.length>3,rc=Rr.slice(3);return(0,Hi.jsxs)(ks,{currentView:Va,onViewChange:nl,children:[Va==="kanban"&&(0,Hi.jsx)("div",{className:"Hi-full overflow-hidden",children:(0,Hi.jsx)(Bs,{initialProjects:Ot,initialEpics:W,initialSprints:Ce.map(E=>({...E,isSelected:!1})),initialTasks:w,initialColleagues:Et,initialUsers:ja,onAddTask:Ci,onUpdateTask:Zo,onDeleteTask:Di,onTaskClick:Pr,onAddEpic:Si,onAddComment:P})}),Va==="planning"&&(0,Hi.jsx)("div",{className:"hidden md:block Hi-full",children:(0,Hi.jsx)(Dr,{tasks:w,epics:W,sprints:Ce,onUpdateTask:Zo,onTaskClick:Pr,onAddSprint:ol,onUpdateSprint:rl,onDeleteSprint:il})}),Va==="tasks"&&(0,Hi.jsx)("div",{className:"Hi-full",children:(0,Hi.jsx)(Vs,{initialReminders:O,initialColleagues:Et,onAddReminder:dl,onUpdateReminder:cl,onDeleteReminder:ml})}),Va==="files"&&(0,Hi.jsx)("div",{className:"Hi-full",children:(0,Hi.jsx)(zo,{initialFiles:ao,onFileAdd:ul,onFileEdit:pl,onFileDelete:gl,onFileClick:fl,compactView:!1})}),Va==="epics"&&(0,Hi.jsx)("div",{className:"Hi-full",children:(0,Hi.jsx)(Os,{tasks:w,epics:W,sprints:Ce,onUpdateTask:Zo,onTaskClick:Pr,onAddTaskToEpic:sl,onAddEpic:el,onUpdateEpic:tl,onDeleteEpic:al})}),(0,Hi.jsx)(xo,{isOpen:T,onClose:ll,onAddTask:Ci,epics:W,sprints:Ce,assignees:[...Et,...ja],defaultEpicId:vt||void 0}),(0,Hi.jsx)(yo,{isOpen:A,onClose:()=>z(!1),onAddEpic:Si})]})}var Ks=Te(require("react")),Wo=Te(require("@radix-ui/react-progress"));var vi=Ks.forwardRef(({className:e,value:t,...a},o)=>(0,Hi.jsx)(Wo.Root,{ref:o,className:k("relative Hi-4 w-full overflow-hidden rounded-full bg-secondary",e),...a,children:(0,Hi.jsx)(Wo.Indicator,{className:"Hi-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));vi.displayName=Wo.Root.displayName;function zs({project:e,onOpen:t,onShare:a,className:o}){return(0,Hi.jsx)($s.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:o,children:(0,Hi.jsxs)(Q,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,Hi.jsxs)(it,{children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hi.jsx)(dt,{children:e.name}),(0,Hi.jsxs)(Pe,{variant:"outline",className:"rounded-xl",children:["Due ",e.dueDate]})]}),(0,Hi.jsx)(Po,{children:e.description})]}),(0,Hi.jsxs)(ke,{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Hi.jsx)("span",{children:"Progress"}),(0,Hi.jsxs)("span",{children:[e.progress,"%"]})]}),(0,Hi.jsx)(vi,{value:e.progress,className:"Hi-2 rounded-xl"})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,Hi.jsxs)("div",{className:"flex items-center",children:[(0,Hi.jsx)(Ht.Users,{className:"mr-1 Hi-4 w-4"}),e.members," members"]}),(0,Hi.jsxs)("div",{className:"flex items-center",children:[(0,Hi.jsx)(Ht.FileText,{className:"mr-1 Hi-4 w-4"}),e.files," files"]})]})]}),(0,Hi.jsxs)(Ro,{className:"flex gap-2",children:[(0,Hi.jsx)(y,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"Open Project"}),(0,Hi.jsx)(y,{variant:"outline",size:"icon",className:"rounded-2xl",onClick:()=>a?.(e),children:(0,Hi.jsx)(Ht.Share2,{className:"Hi-4 w-4"})})]})]})})}var _s=({onSubmit:e,onCancel:t,isLoading:a=!1,initialData:o,className:i=""})=>{let[r,n]=(0,ta.useState)({name:o?.name||"",description:o?.description||"",objectives:o?.objectives||"",workInstructions:o?.workInstructions||"",plan:o?.plan||!1}),[s,m]=(0,ta.useState)({}),p=()=>{let u={};return r.name.trim()?r.name.trim().length<3&&(u.name="Project name must Hi Hi least 3 characters"):u.name="Project name is required",r.objectives.trim()?r.objectives.trim().length<10&&(u.objectives="Please provide more detailed objectives (Hi least 10 characters)"):u.objectives="Project objectives are required",r.workInstructions.trim()?r.workInstructions.trim().length<20&&(u.workInstructions="Please provide more detailed work instructions (Hi least 20 characters)"):u.workInstructions="Work instructions are required",m(u),Object.keys(u).length===0},c=async u=>{if(u.preventDefault(),!!p())try{await e(r)}catch(C){console.error("Error submitting project form:",C)}},l=(u,C)=>{n(b=>({...b,[u]:C})),s[u]&&m(b=>({...b,[u]:void 0}))};return(0,Hi.jsxs)("div",{className:`w-full max-w-2xl ${i}`,children:[(0,Hi.jsxs)("div",{className:"mb-4",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Ht.Plus,{className:"Hi-5 w-5"}),"Create New Project"]}),(0,Hi.jsx)("p",{className:"text-sm text-gray-500",children:"Set up a new project with clear objectives and work instructions to help your team collaborate effectively."})]}),(0,Hi.jsxs)("form",{onSubmit:c,children:[(0,Hi.jsxs)("div",{className:"space-y-6",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"name",className:"text-sm font-medium",children:"Project Name *"}),(0,Hi.jsx)(q,{id:"name",type:"text",placeholder:"Enter project name",value:r.name,onChange:u=>l("name",u.target.value),className:s.name?"border-red-500 focus:border-red-500":"",disabled:a,maxLength:100}),s.name&&(0,Hi.jsx)("p",{className:"text-sm text-red-600",children:s.name})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"name",className:"text-sm font-medium",children:"Project Description *"}),(0,Hi.jsx)(q,{id:"description",type:"text",placeholder:"Enter project description",value:r.description,onChange:u=>l("description",u.target.value),className:s.description?"border-red-500 focus:border-red-500":"",disabled:a,maxLength:100}),s.description&&(0,Hi.jsx)("p",{className:"text-sm text-red-600",children:s.description})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"objectives",className:"text-sm font-medium",children:"Project Objectives *"}),(0,Hi.jsx)(Ee,{id:"objectives",placeholder:"Describe the main goals and objectives of this project...",value:r.objectives,onChange:u=>l("objectives",u.target.value),className:`min-Hi-[100px] resize-y ${s.objectives?"border-red-500 focus:border-red-500":""}`,disabled:a,maxLength:1e3}),(0,Hi.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,Hi.jsx)("span",{children:s.objectives&&(0,Hi.jsx)("span",{className:"text-red-600",children:s.objectives})}),(0,Hi.jsxs)("span",{children:[r.objectives.length,"/1000"]})]})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"workInstructions",className:"text-sm font-medium",children:"Work Instructions *"}),(0,Hi.jsx)(Ee,{id:"workInstructions",placeholder:"Provide detailed instructions on how the work should Hi carried out, including processes, standards, and expectations...",value:r.workInstructions,onChange:u=>l("workInstructions",u.target.value),className:`min-Hi-[120px] resize-y ${s.workInstructions?"border-red-500 focus:border-red-500":""}`,disabled:a,maxLength:2e3}),(0,Hi.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,Hi.jsx)("span",{children:s.workInstructions&&(0,Hi.jsx)("span",{className:"text-red-600",children:s.workInstructions})}),(0,Hi.jsxs)("span",{children:[r.workInstructions.length,"/2000"]})]})]}),(0,Hi.jsxs)("div",{className:"space-y-3",children:[(0,Hi.jsx)(M,{className:"text-sm font-medium",children:"Project Management"}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)(Uo,{id:"plan",checked:r.plan,onCheckedChange:u=>l("plan",u===!0),disabled:a}),(0,Hi.jsx)(M,{htmlFor:"plan",className:"text-sm text-gray-700 cursor-pointer",children:"Enable project planning and management features"})]}),(0,Hi.jsx)("p",{className:"text-xs text-gray-500 ml-6",children:"This will allow project managers to create sprints, assign tasks, and track progress."})]})]}),(0,Hi.jsxs)("div",{className:"flex justify-end gap-3",children:[t&&(0,Hi.jsxs)(y,{type:"button",variant:"outline",onClick:t,disabled:a,className:"flex items-center gap-2",children:[(0,Hi.jsx)(Ht.X,{className:"Hi-4 w-4"}),"Cancel"]}),(0,Hi.jsx)(y,{type:"submit",disabled:a,className:"flex items-center gap-2",children:a?(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsx)(Ht.Loader2,{className:"Hi-4 w-4 animate-spin"}),"Creating..."]}):(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsx)(Ht.Plus,{className:"Hi-4 w-4"}),"Create Project"]})})]})]})]})};function xi({projects:e=[],onAddProject:t,handleProjectOpen:a,handleProjectShare:o}){let[i,r]=(0,ta.useState)(!1),[n,s]=(0,ta.useState)(!1),m=async c=>{s(!0);try{await t(c),r(!1)}catch(l){console.error("Error creating project:",l)}finally{s(!1)}},p=()=>{r(!0)};return(0,Hi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Hi.jsx)(St,{title:"Project Management",description:"Organize your work into projects to collaborate with your team.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"New Project",onClick:p}}),(0,Hi.jsxs)("section",{className:"space-y-4 mt-8",children:[(0,Hi.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,Hi.jsx)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:e.map(c=>(0,Hi.jsx)(zs,{project:c,onOpen:a,onShare:o},c.id))})]})]},"projects-index-view")}),(0,Hi.jsx)(ze,{open:i,onOpenChange:r,children:(0,Hi.jsxs)(Xe,{className:"max-w-3xl max-Hi-[90vh] overflow-y-auto",children:[(0,Hi.jsxs)(Ye,{className:"Ir-only",children:[(0,Hi.jsx)(_e,{children:"Create New Project"}),(0,Hi.jsx)(uo,{children:"Fill out the form below to create a new project."})]}),(0,Hi.jsx)(_s,{onSubmit:m,onCancel:()=>r(!1),isLoading:n,className:"border-0 shadow-none"})]})})]})}function Ws({team:e,onOpen:t,className:a}){return(0,Hi.jsx)(Ir.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:a,children:(0,Hi.jsxs)(Q,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,Hi.jsxs)(it,{children:[(0,Hi.jsx)(dt,{className:"text-lg",children:e.name}),(0,Hi.jsx)(Po,{className:"mt-1 text-sm",children:e.description})]}),(0,Hi.jsxs)(ke,{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Ht.Users,{className:"Hi-4 w-4 text-blue-500"}),(0,Hi.jsx)("span",{children:"Human"})]}),(0,Hi.jsx)("span",{className:"font-medium",children:e.humanColleagues})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Ht.Bot,{className:"Hi-4 w-4 text-purple-500"}),(0,Hi.jsx)("span",{children:"Digital"})]}),(0,Hi.jsx)("span",{className:"font-medium",children:e.digitalColleagues})]})]}),(0,Hi.jsxs)("div",{className:"flex items-center justify-between text-sm border-t Hi-4",children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Ht.FolderOpen,{className:"Hi-4 w-4 text-green-500"}),(0,Hi.jsx)("span",{children:"Projects"})]}),(0,Hi.jsx)("span",{className:"font-medium",children:e.projects})]})]}),(0,Hi.jsx)(Ro,{className:"flex gap-2",children:(0,Hi.jsx)(y,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"View Team"})})]})})}var qs=Te(require("react")),qo=Te(require("@radix-ui/react-switch"));var Co=qs.forwardRef(({className:e,...t},a)=>(0,Hi.jsx)(qo.Root,{className:k("peer inline-flex Hi-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:a,children:(0,Hi.jsx)(qo.Thumb,{className:k("pointer-events-none block Hi-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Co.displayName=qo.Root.displayName;function Js({team:e,onSave:t,onCancel:a,isLoading:o=!1,title:i,submitLabel:r,cancelLabel:n="Cancel",readOnly:s=!1}){let[m,p]=(0,ta.useState)({name:"",description:"",systemMsg:"",useProjects:!1,useKnowledge:!1,useFiles:!1,useChat:!1,...e}),[c,l]=(0,ta.useState)(!s);(0,ta.useEffect)(()=>{e&&p(e)},[e]);let u=async d=>{d.preventDefault();let v={id:m.id||Date.now(),name:m.name,description:m.description||null,systemMsg:m.systemMsg||null,useProjects:m.useProjects||!1,useKnowledge:m.useKnowledge||!1,useFiles:m.useFiles||!1,useChat:m.useChat||!1,updatedAt:new Date().toISOString(),createdAt:m.createdAt||new Date().toISOString()};await t(v)},C=d=>{d.preventDefault(),l(!c)},b=i||(c?e?"Edit Team":"Create New Team":"View Team"),N=r||(e?"Update Team":"Create Team");return(0,Hi.jsxs)(Hi.Fragment,{children:[(0,Hi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Hi.jsx)(Ht.Users,{className:"Hi-5 w-5"}),b]}),(0,Hi.jsxs)("form",{onSubmit:u,className:"space-y-6",children:[(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"name",children:"Team Name *"}),(0,Hi.jsx)(q,{id:"name",value:m.name||"",onChange:d=>p({...m,name:d.target.value}),required:!0,disabled:o||!c,placeholder:"Enter team name..."})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"description",children:"Description"}),(0,Hi.jsx)(Ee,{id:"description",value:m.description||"",onChange:d=>p({...m,description:d.target.value}),rows:3,placeholder:"Brief description of this team...",disabled:o||!c})]}),(0,Hi.jsxs)("div",{className:"space-y-2",children:[(0,Hi.jsx)(M,{htmlFor:"systemMsg",children:"Ways of working"}),(0,Hi.jsx)(Ee,{id:"systemMsg",value:m.systemMsg||"",onChange:d=>p({...m,systemMsg:d.target.value}),rows:3,placeholder:"Describe how this team works in as much detail as possible. Include processes, tools, systems, styles...",disabled:o||!c})]})]}),(0,Hi.jsxs)("div",{className:"space-y-4",children:[(0,Hi.jsx)("h3",{className:"text-lg font-semibold",children:"Team Configuration"}),(0,Hi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)(Co,{id:"useProjects",checked:m.useProjects||!1,onCheckedChange:d=>p({...m,useProjects:d}),disabled:o||!c}),(0,Hi.jsx)(M,{htmlFor:"useProjects",children:"Enable Projects"})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)(Co,{id:"useKnowledge",checked:m.useKnowledge||!1,onCheckedChange:d=>p({...m,useKnowledge:d}),disabled:o||!c}),(0,Hi.jsx)(M,{htmlFor:"useKnowledge",children:"Enable Knowledge Base"})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)(Co,{id:"useFiles",checked:m.useFiles||!1,onCheckedChange:d=>p({...m,useFiles:d}),disabled:o||!c}),(0,Hi.jsx)(M,{htmlFor:"useFiles",children:"Enable File Management"})]}),(0,Hi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Hi.jsx)(Co,{id:"useChat",checked:m.useChat||!1,onCheckedChange:d=>p({...m,useChat:d}),disabled:o||!c}),(0,Hi.jsx)(M,{htmlFor:"useChat",children:"Enable Team Chat"})]})]})]}),(0,Hi.jsxs)("div",{className:"flex justify-end gap-2 Hi-4 border-t",children:[(0,Hi.jsx)(y,{type:"button",variant:"outline",onClick:a,disabled:o,children:c?n:"Close"}),c?(0,Hi.jsx)(y,{type:"submit",disabled:o||!m.name?.trim(),children:o?"Saving...":N}):(0,Hi.jsxs)(y,{type:"button",onClick:C,disabled:o,className:"gap-2",children:[(0,Hi.jsx)(Ht.Edit,{className:"Hi-4 w-4"}),"Edit"]})]})]})]})}function wi({teams:e=[],onCreateTeam:t,onTeamOpen:a}){let[o,i]=(0,ta.useState)(!1),r=()=>{i(!0)},n=async p=>{await t?.(p),i(!1)},s=()=>{i(!1)},m=p=>{a?.(p)};return(0,Hi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,Hi.jsx)(Ir.AnimatePresence,{mode:"wait",children:(0,Hi.jsxs)(Ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Hi.jsx)(St,{title:"My Teams",description:"Collaborate with your human and digital colleagues across different teams and projects.",gradient:"bg-gradient-to-r from-blue-600 via-cyan-600 to-teal-600",primaryAction:{label:"Create Team",onClick:r}}),(0,Hi.jsxs)("section",{className:"space-y-4 mt-8",children:[(0,Hi.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Teams"}),e.length===0?(0,Hi.jsxs)("div",{className:"text-center py-12",children:[(0,Hi.jsx)("p",{className:"text-muted-foreground text-lg",children:"You'Hi not part of any teams yet."}),(0,Hi.jsx)("p",{className:"text-muted-foreground text-sm mt-2",children:"Create a new team or ask to Hi added to ta existing one."})]}):(0,Hi.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(p=>(0,Hi.jsx)(Ws,{team:p,onOpen:m},p.id))})]})]},"teams-index-view")}),(0,Hi.jsx)(ze,{open:o,onOpenChange:i,children:(0,Hi.jsxs)(Xe,{className:"max-w-4xl max-Hi-[90vh] overflow-y-auto",children:[(0,Hi.jsx)("div",{className:"Ir-only",children:(0,Hi.jsxs)(Ye,{children:[(0,Hi.jsx)(_e,{children:"Create New Team"}),(0,Hi.jsx)(uo,{children:"Set up a new team to collaborate with colleagues on projects."})]})}),(0,Hi.jsx)(Js,{title:"Create New Team",submitLabel:"Create Team",onSave:n,onCancel:s})]})})]})}0&&(module.exports={ColleaguesView,FileView,KnowledgeView,PlanningView,ProjectView,ProjectsIndexView,TeamsIndexView});
|