cortex-react-components 2.17.5 → 2.18.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-72BE5VJT.mjs → chunk-275W7H4O.mjs} +1 -1
- package/dist/{chunk-VRE6VCHX.mjs → chunk-2BR55L74.mjs} +1 -1
- package/dist/{chunk-BGADMIWV.mjs → chunk-2BRDNDUB.mjs} +1 -1
- package/dist/{chunk-ZAAHG2J7.mjs → chunk-3DZFESHK.mjs} +1 -1
- package/dist/{chunk-2GZQYAN3.mjs → chunk-3HNU2NYP.mjs} +1 -1
- package/dist/{chunk-M74BIPBM.mjs → chunk-3NRXQBBS.mjs} +1 -1
- package/dist/{chunk-KRLNPNMZ.mjs → chunk-3Y7QG6VP.mjs} +1 -1
- package/dist/{chunk-SK2QJG6J.mjs → chunk-3ZQFJ5WD.mjs} +1 -1
- package/dist/{chunk-ZCBUDRT7.mjs → chunk-4DR4ILAP.mjs} +1 -1
- package/dist/{chunk-CYWA6TR2.mjs → chunk-5EQXJS23.mjs} +1 -1
- package/dist/{chunk-JT65KF7C.mjs → chunk-5MWZTJYP.mjs} +1 -1
- package/dist/{chunk-CNCT3JZV.mjs → chunk-5NIEZE7A.mjs} +1 -1
- package/dist/{chunk-PMYLKWPE.mjs → chunk-6R6NYDWN.mjs} +1 -1
- package/dist/{chunk-WDZOGIT2.mjs → chunk-75F3LJMX.mjs} +1 -1
- package/dist/{chunk-DNMPFZJH.mjs → chunk-7IARWH7M.mjs} +1 -1
- package/dist/{chunk-NXG2Y4N4.mjs → chunk-7R47MHQE.mjs} +1 -1
- package/dist/chunk-7TSR2LQB.mjs +1 -0
- package/dist/{chunk-66ODXUVL.mjs → chunk-AJQHGVZ5.mjs} +1 -1
- package/dist/{chunk-AGWQ5S2Z.mjs → chunk-AQQCH7Z2.mjs} +1 -1
- package/dist/{chunk-PTGTIV55.mjs → chunk-BAB3ATRB.mjs} +1 -1
- package/dist/{chunk-BN747TQM.mjs → chunk-C4RWEPVF.mjs} +1 -1
- package/dist/{chunk-PRK2XFAZ.mjs → chunk-CXOVEABI.mjs} +1 -1
- package/dist/{chunk-R5P4ZICA.mjs → chunk-D6K6RO5P.mjs} +1 -1
- package/dist/{chunk-CJDUN6R4.mjs → chunk-DKRRVTCV.mjs} +1 -1
- package/dist/{chunk-3BG2SCNC.mjs → chunk-EH3PJU6C.mjs} +1 -1
- package/dist/{chunk-JUFFNFV6.mjs → chunk-EM3T2XYC.mjs} +1 -1
- package/dist/{chunk-4NHQXOKZ.mjs → chunk-FE7ZGUPU.mjs} +1 -1
- package/dist/{chunk-T36QUKC6.mjs → chunk-GHOL5L32.mjs} +1 -1
- package/dist/{chunk-PZZTGPEO.mjs → chunk-GTZJWMZR.mjs} +1 -1
- package/dist/chunk-GXRWKWKJ.mjs +1 -0
- package/dist/{chunk-DA2BPW6D.mjs → chunk-HHPTGV4F.mjs} +1 -1
- package/dist/{chunk-57HKHEQN.mjs → chunk-HUYTXZLC.mjs} +1 -1
- package/dist/{chunk-75WE6ZXB.mjs → chunk-ITJH72Z2.mjs} +1 -1
- package/dist/{chunk-GIL2SMPM.mjs → chunk-KWYJ3XZI.mjs} +1 -1
- package/dist/{chunk-WUA65ZZB.mjs → chunk-L3BLBPSR.mjs} +1 -1
- package/dist/{chunk-ERHNVIOZ.mjs → chunk-LHO4WFYP.mjs} +1 -1
- package/dist/chunk-LX3D4J7I.mjs +1 -0
- package/dist/{chunk-FXO5SPBG.mjs → chunk-N7M6FTIO.mjs} +1 -1
- package/dist/{chunk-Y62OBV2E.mjs → chunk-NINFDOV5.mjs} +1 -1
- package/dist/{chunk-RIRZRO6U.mjs → chunk-P55W6AFU.mjs} +1 -1
- package/dist/{chunk-23XORW7A.mjs → chunk-P7S6XFU4.mjs} +1 -1
- package/dist/{chunk-EUMMM454.mjs → chunk-PTJVI53B.mjs} +1 -1
- package/dist/{chunk-S3P6OGB7.mjs → chunk-PWFVXG44.mjs} +1 -1
- package/dist/{chunk-RBJOTC2X.mjs → chunk-QAJBJFRP.mjs} +1 -1
- package/dist/{chunk-5KS3DITB.mjs → chunk-RGOKBIQ5.mjs} +1 -1
- package/dist/{chunk-JLUX7EHB.mjs → chunk-RJGYVDOU.mjs} +1 -1
- package/dist/{chunk-T5HJS6OF.mjs → chunk-RSDUFAIB.mjs} +1 -1
- package/dist/{chunk-I6OBIS4J.mjs → chunk-TTWEHUP5.mjs} +1 -1
- package/dist/{chunk-SRUG246N.mjs → chunk-TXVA6XJT.mjs} +1 -1
- package/dist/{chunk-SIL7AP7H.mjs → chunk-V5VE3EIY.mjs} +1 -1
- package/dist/{chunk-CQAMS7RZ.mjs → chunk-V6GK2FJG.mjs} +1 -1
- package/dist/{chunk-X5UJBRSB.mjs → chunk-WHDV4REI.mjs} +1 -1
- package/dist/{chunk-BDNY6OKE.mjs → chunk-WIRQ5IRT.mjs} +1 -1
- package/dist/{chunk-UZSBX5GO.mjs → chunk-X3JZSN3W.mjs} +1 -1
- package/dist/{chunk-VNYUNZ3M.mjs → chunk-XGIYNUGC.mjs} +1 -1
- package/dist/{chunk-UX5OJ3WS.mjs → chunk-ZEALRBXW.mjs} +1 -1
- package/dist/{chunk-PXLSH6S2.mjs → chunk-ZFUP5NVF.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/ImageBlock.mjs +1 -1
- package/dist/components/Blocks/MediaBlock.mjs +1 -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.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.d.ts +2 -1
- package/dist/components/Chat/ChatInterface.js +10 -10
- package/dist/components/Chat/ChatInterface.mjs +1 -1
- package/dist/components/Chat/ChatInterfaceMessages.mjs +1 -1
- package/dist/components/Chat/ChatMessage.mjs +1 -1
- package/dist/components/Chat/Components/ChatCardArtefact.mjs +1 -0
- package/dist/components/Chat/Components/ChatCardTask.mjs +1 -0
- package/dist/components/Chat/Components/Conversation.css +1 -0
- package/dist/components/Chat/Components/Conversation.d.ts +15 -0
- package/dist/components/Chat/Components/Conversation.js +4 -0
- package/dist/components/Chat/Components/Conversation.mjs +4 -0
- package/dist/components/Chat/Components/Message.css +1 -0
- package/dist/components/Chat/Components/Message.d.ts +19 -0
- package/dist/components/Chat/Components/Message.js +4 -0
- package/dist/components/Chat/Components/Message.mjs +1 -0
- package/dist/components/Chat/CopilotInterface.js +10 -10
- package/dist/components/Chat/CopilotInterface.mjs +1 -1
- package/dist/components/Chat/PartTypes/MessageHandler.css +1 -0
- package/dist/components/Chat/PartTypes/MessageHandler.d.ts +9 -0
- package/dist/components/Chat/PartTypes/MessageHandler.js +20 -0
- package/dist/components/Chat/PartTypes/MessageHandler.mjs +1 -0
- package/dist/components/Chat/PartTypes/PartApprovalTool.d.ts +1 -1
- package/dist/components/Chat/PartTypes/PartApprovalTool.mjs +1 -1
- package/dist/components/Chat/PartTypes/PartAuthenticateTool.d.ts +1 -1
- package/dist/components/Chat/PartTypes/PartAuthenticateTool.mjs +1 -1
- package/dist/components/Chat/PartTypes/index.js +6 -6
- package/dist/components/Chat/PartTypes/index.mjs +1 -1
- package/dist/components/Chat/demo-long-messages.js +15 -15
- package/dist/components/Chat/demo-long-messages.mjs +1 -1
- package/dist/components/Chat/demo-tests.js +32 -32
- package/dist/components/Chat/demo-tests.mjs +1 -1
- package/dist/components/Chat/demo.js +10 -10
- package/dist/components/Chat/demo.mjs +1 -1
- package/dist/components/Chat/example-usage.js +10 -10
- package/dist/components/Chat/example-usage.mjs +1 -1
- package/dist/components/Chat/example-with-vercel-ai.js +10 -10
- package/dist/components/Chat/example-with-vercel-ai.mjs +1 -1
- package/dist/components/Chat/index.d.ts +2 -2
- package/dist/components/Chat/index.js +10 -10
- package/dist/components/Chat/index.mjs +1 -1
- package/dist/components/DigitalColleagues/AppSidebarLeft.mjs +1 -1
- package/dist/components/DigitalColleagues/MainPage.mjs +1 -1
- package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +1 -1
- package/dist/components/DigitalColleagues/Views/ColleaguesView.mjs +1 -1
- package/dist/components/DigitalColleagues/Views/index.mjs +1 -1
- package/dist/components/DigitalColleagues/index.mjs +1 -1
- package/dist/components/Foundary/AppSidebarLeft.mjs +1 -1
- package/dist/components/Foundary/Knowledge/add-knowledge-modal.mjs +1 -1
- package/dist/components/Foundary/Knowledge/add-team-context.mjs +1 -1
- package/dist/components/Foundary/MainPage.mjs +1 -1
- package/dist/components/Foundary/Pages/dashboardpage.js +1 -1
- package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
- package/dist/components/Foundary/RichText/index.mjs +1 -1
- package/dist/components/Foundary/RichText/plugins/toolbar-plugin.mjs +1 -1
- package/dist/components/Foundary/Views/ColleaguesView.mjs +1 -1
- package/dist/components/Foundary/Views/KnowledgeView.js +1 -1
- package/dist/components/Foundary/Views/KnowledgeView.mjs +1 -1
- package/dist/components/Foundary/Views/index.js +1 -1
- package/dist/components/Foundary/Views/index.mjs +1 -1
- package/dist/components/Foundary/document-edit.js +1 -1
- package/dist/components/Foundary/document-edit.mjs +1 -1
- package/dist/components/Foundary/document-preview-examples.js +1 -1
- package/dist/components/Foundary/document-preview-examples.mjs +1 -1
- package/dist/components/Foundary/document-preview.js +1 -1
- package/dist/components/Foundary/document-preview.mjs +1 -1
- package/dist/components/Foundary/index.js +1 -1
- package/dist/components/Foundary/index.mjs +1 -1
- package/dist/components/Foundary/knowledge-browser.js +1 -1
- package/dist/components/Foundary/knowledge-browser.mjs +1 -1
- package/dist/components/HeaderFooter/Header.mjs +1 -1
- package/dist/components/HeaderFooter/HeaderDesktop.mjs +1 -1
- package/dist/components/HeaderFooter/SectionHeading.mjs +1 -1
- package/dist/components/HeaderFooter/VideoHeader.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/PostHero/index.mjs +1 -1
- package/dist/components/Heros/RenderHero.mjs +1 -1
- package/dist/components/Heros/SectionHero/index.mjs +1 -1
- package/dist/components/Heros/index.mjs +1 -1
- package/dist/components/Holidays/HolidayTracker.mjs +1 -1
- package/dist/components/Holidays/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/Menus/SidebarLeft.mjs +1 -1
- package/dist/components/Menus/SidebarRight.mjs +1 -1
- package/dist/components/Menus/index.mjs +1 -1
- package/dist/components/Other/index.mjs +1 -1
- package/dist/components/Payload/CollectionArchive/index.mjs +1 -1
- package/dist/components/Payload/Media/index.mjs +1 -1
- package/dist/components/Payload/PayloadCard/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/index.mjs +1 -1
- package/dist/components/dc-temp/index.mjs +1 -1
- package/dist/components/index.js +19 -19
- package/dist/components/index.mjs +1 -1
- package/dist/components/ui/index.mjs +1 -1
- package/dist/components/ui/sidebar.mjs +1 -1
- package/dist/globals.css +1 -1
- package/dist/index.js +23 -23
- 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/BlogListSection.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/form/index.mjs +1 -1
- package/dist/sections/index.mjs +1 -1
- package/package.json +2 -1
- package/dist/chunk-SMDC36XJ.mjs +0 -1
- package/dist/components/Chat/ChatCardArtefact.mjs +0 -1
- package/dist/components/Chat/ChatCardTask.mjs +0 -1
- /package/dist/{chunk-I2PVJQQR.mjs → chunk-RL6365DN.mjs} +0 -0
- /package/dist/{chunk-DBY4SXQI.mjs → chunk-YPZAYXNQ.mjs} +0 -0
- /package/dist/components/Chat/{ChatCardArtefact.css → Components/ChatCardArtefact.css} +0 -0
- /package/dist/components/Chat/{ChatCardArtefact.d.ts → Components/ChatCardArtefact.d.ts} +0 -0
- /package/dist/components/Chat/{ChatCardArtefact.js → Components/ChatCardArtefact.js} +0 -0
- /package/dist/components/Chat/{ChatCardTask.css → Components/ChatCardTask.css} +0 -0
- /package/dist/components/Chat/{ChatCardTask.d.ts → Components/ChatCardTask.d.ts} +0 -0
- /package/dist/components/Chat/{ChatCardTask.js → Components/ChatCardTask.js} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
"use client"
|
|
4
4
|
|
|
5
|
-
"use strict";var En=Object.create;var Po=Object.defineProperty;var Mn=Object.getOwnPropertyDescriptor;var In=Object.getOwnPropertyNames;var Fn=Object.getPrototypeOf,Bn=Object.prototype.hasOwnProperty;var Ln=(e,t)=>{for(var o in t)Po(e,o,{get:t[o],enumerable:!0})},Xr=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of In(t))!Bn.call(e,r)&&r!==o&&Po(e,r,{get:()=>t[r],enumerable:!(a=Mn(t,r))||a.enumerable});return e};var Ce=(e,t,o)=>(o=e!=null?En(Fn(e)):{},Xr(t||!e||!e.__esModule?Po(o,"default",{value:e,enumerable:!0}):o,e)),Hn=e=>Xr(Po({},"__esModule",{value:!0}),e);var Ul={};Ln(Ul,{ColleaguesView:()=>cr,FileView:()=>go,KnowledgeView:()=>Er,PlanningView:()=>Jo,ProjectView:()=>Vr,ProjectsIndexView:()=>$r,TeamsIndexView:()=>_r});module.exports=Hn(Ul);var jt=require("react"),Pt=require("lucide-react");var si=require("clsx");var rr="-",On=e=>{let t=jn(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{let s=c.split(rr);return s[0]===""&&s.length!==1&&s.shift(),ei(s,t)||Vn(c)},getConflictingClassGroupIds:(c,s)=>{let m=o[c]||[];return s&&a[c]?[...m,...a[c]]:m}}},ei=(e,t)=>{if(e.length===0)return t.classGroupId;let o=e[0],a=t.nextPart.get(o),r=a?ei(e.slice(1),a):void 0;if(r)return r;if(t.validators.length===0)return;let i=e.join(rr);return t.validators.find(({validator:c})=>c(i))?.classGroupId},Yr=/^\[(.+)\]$/,Vn=e=>{if(Yr.test(e)){let t=Yr.exec(e)[1],o=t?.substring(0,t.indexOf(":"));if(o)return"arbitrary.."+o}},jn=e=>{let{theme:t,prefix:o}=e,a={nextPart:new Map,validators:[]};return zn(Object.entries(e.classGroups),o).forEach(([i,c])=>{or(c,a,i,t)}),a},or=(e,t,o,a)=>{e.forEach(r=>{if(typeof r=="string"){let i=r===""?t:Qr(t,r);i.classGroupId=o;return}if(typeof r=="function"){if(Kn(r)){or(r(a),t,o,a);return}t.validators.push({validator:r,classGroupId:o});return}Object.entries(r).forEach(([i,c])=>{or(c,Qr(t,i),o,a)})})},Qr=(e,t)=>{let o=e;return t.split(rr).forEach(a=>{o.nextPart.has(a)||o.nextPart.set(a,{nextPart:new Map,validators:[]}),o=o.nextPart.get(a)}),o},Kn=e=>e.isThemeGetter,zn=(e,t)=>t?e.map(([o,a])=>{let r=a.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([c,s])=>[t+c,s])):i);return[o,r]}):e,Un=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=new Map,a=new Map,r=(i,c)=>{o.set(i,c),t++,t>e&&(t=0,a=o,o=new Map)};return{get(i){let c=o.get(i);if(c!==void 0)return c;if((c=a.get(i))!==void 0)return r(i,c),c},set(i,c){o.has(i)?o.set(i,c):r(i,c)}}},ti="!",$n=e=>{let{separator:t,experimentalParseClassName:o}=e,a=t.length===1,r=t[0],i=t.length,c=s=>{let m=[],n=0,l=0,d;for(let p=0;p<s.length;p++){let C=s[p];if(n===0){if(C===r&&(a||s.slice(p,p+i)===t)){m.push(s.slice(l,p)),l=p+i;continue}if(C==="/"){d=p;continue}}C==="["?n++:C==="]"&&n--}let g=m.length===0?s:s.substring(l),w=g.startsWith(ti),b=w?g.substring(1):g,y=d&&d>l?d-l:void 0;return{modifiers:m,hasImportantModifier:w,baseClassName:b,maybePostfixModifierPosition:y}};return o?s=>o({className:s,parseClassName:c}):c},Gn=e=>{if(e.length<=1)return e;let t=[],o=[];return e.forEach(a=>{a[0]==="["?(t.push(...o.sort(),a),o=[]):o.push(a)}),t.push(...o.sort()),t},_n=e=>({cache:Un(e.cacheSize),parseClassName:$n(e),...On(e)}),Wn=/\s+/,qn=(e,t)=>{let{parseClassName:o,getClassGroupId:a,getConflictingClassGroupIds:r}=t,i=[],c=e.trim().split(Wn),s="";for(let m=c.length-1;m>=0;m-=1){let n=c[m],{modifiers:l,hasImportantModifier:d,baseClassName:g,maybePostfixModifierPosition:w}=o(n),b=!!w,y=a(b?g.substring(0,w):g);if(!y){if(!b){s=n+(s.length>0?" "+s:s);continue}if(y=a(g),!y){s=n+(s.length>0?" "+s:s);continue}b=!1}let p=Gn(l).join(":"),C=d?p+ti:p,N=C+y;if(i.includes(N))continue;i.push(N);let h=r(y,b);for(let R=0;R<h.length;++R){let te=h[R];i.push(C+te)}s=n+(s.length>0?" "+s:s)}return s};function Zn(){let e=0,t,o,a="";for(;e<arguments.length;)(t=arguments[e++])&&(o=ai(t))&&(a&&(a+=" "),a+=o);return a}var ai=e=>{if(typeof e=="string")return e;let t,o="";for(let a=0;a<e.length;a++)e[a]&&(t=ai(e[a]))&&(o&&(o+=" "),o+=t);return o};function Jn(e,...t){let o,a,r,i=c;function c(m){let n=t.reduce((l,d)=>d(l),e());return o=_n(n),a=o.cache.get,r=o.cache.set,i=s,s(m)}function s(m){let n=a(m);if(n)return n;let l=qn(m,o);return r(m,l),l}return function(){return i(Zn.apply(null,arguments))}}var Ve=e=>{let t=o=>o[e]||[];return t.isThemeGetter=!0,t},oi=/^\[(?:([a-z-]+):)?(.+)\]$/i,Xn=/^\d+\/\d+$/,Yn=new Set(["px","full","screen"]),Qn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,el=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|ci|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,tl=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,al=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)ci-?((\d+)?\.?(\d+)[a-z]+|0)/,ol=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zt=e=>Ha(e)||Yn.has(e)||Xn.test(e),ma=e=>Oa(e,"length",ml),Ha=e=>!!e&&!Number.isNaN(Number(e)),ar=e=>Oa(e,"number",Ha),ao=e=>!!e&&Number.isInteger(Number(e)),rl=e=>e.endsWith("%")&&Ha(e.slice(0,-1)),de=e=>oi.test(e),pa=e=>Qn.test(e),il=new Set(["length","size","percentage"]),sl=e=>Oa(e,il,ri),nl=e=>Oa(e,"position",ri),ll=new Set(["image","url"]),dl=e=>Oa(e,ll,ul),cl=e=>Oa(e,"",pl),oo=()=>!0,Oa=(e,t,o)=>{let a=oi.exec(e);return a?a[1]?typeof t=="string"?a[1]===t:t.has(a[1]):o(a[2]):!1},ml=e=>el.test(e)&&!tl.test(e),ri=()=>!1,pl=e=>al.test(e),ul=e=>ol.test(e);var gl=()=>{let e=Ve("colors"),t=Ve("spacing"),o=Ve("blur"),a=Ve("brightness"),r=Ve("borderColor"),i=Ve("borderRadius"),c=Ve("borderSpacing"),s=Ve("borderWidth"),m=Ve("contrast"),n=Ve("grayscale"),l=Ve("hueRotate"),d=Ve("invert"),g=Ve("gap"),w=Ve("gradientColorStops"),b=Ve("gradientColorStopPositions"),y=Ve("inset"),p=Ve("margin"),C=Ve("opacity"),N=Ve("padding"),h=Ve("saturate"),R=Ve("scale"),te=Ve("sepia"),D=Ve("skew"),H=Ve("space"),P=Ve("translate"),K=()=>["auto","contain","none"],J=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto",de,t],E=()=>[de,t],Re=()=>["",Zt,ma],xe=()=>["auto",Ha,de],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ue=()=>["solid","dashed","dotted","double","none"],Ae=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ht=()=>["start","end","center","between","around","evenly","stretch"],lt=()=>["","0",de],St=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Ha,de];return{cacheSize:500,separator:":",theme:{colors:[oo],spacing:[Zt,ma],blur:["none","",pa,de],brightness:M(),borderColor:[e],borderRadius:["none","","full",pa,de],borderSpacing:E(),borderWidth:Re(),contrast:M(),grayscale:lt(),hueRotate:M(),invert:lt(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[rl,ma],inset:L(),margin:L(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:lt(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",de]}],container:["container"],columns:[{columns:[pa]}],"break-after":[{"break-after":St()}],"break-before":[{"break-before":St()}],"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:[...z(),de]}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:K()}],"overscroll-x":[{"overscroll-x":K()}],"overscroll-y":[{"overscroll-y":K()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ao,de]}],basis:[{basis:L()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",de]}],grow:[{grow:lt()}],shrink:[{shrink:lt()}],order:[{order:["first","last","none",ao,de]}],"grid-cols":[{"grid-cols":[oo]}],"col-start-end":[{col:["auto",{span:["full",ao,de]},de]}],"col-start":[{"col-start":xe()}],"col-end":[{"col-end":xe()}],"grid-rows":[{"grid-rows":[oo]}],"row-start-end":[{row:["auto",{span:[ao,de]},de]}],"row-start":[{"row-start":xe()}],"row-end":[{"row-end":xe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","ci",de]}],"auto-rows":[{"auto-rows":["auto","min","max","ci",de]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...ht()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ht(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ht(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],ci:[{ci:[N]}],ci:[{ci:[N]}],ci:[{ci:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[p]}],mx:[{mx:[p]}],my:[{my:[p]}],Pt:[{Pt:[p]}],me:[{me:[p]}],ci:[{ci:[p]}],mr:[{mr:[p]}],mb:[{mb:[p]}],ml:[{ml:[p]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",de,t]}],"min-w":[{"min-w":[de,t,"min","max","fit"]}],"max-w":[{"max-w":[de,t,"none","full","min","max","fit","prose",{screen:[pa]},pa]}],h:[{h:[de,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[de,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[de,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[de,t,"auto","min","max","fit"]}],"font-size":[{text:["base",pa,ma]}],"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:[oo]}],"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",de]}],"line-clamp":[{"line-clamp":["none",Ha,ar]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Zt,de]}],"list-image":[{"list-image":["none",de]}],"list-style-type":[{list:["none","disc","decimal",de]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[C]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[C]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ue(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Zt,ma]}],"underline-offset":[{"underline-offset":["auto",Zt,de]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",de]}],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",de]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[C]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...z(),nl]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",sl]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},dl]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[w]}],"gradient-via":[{via:[w]}],"gradient-to":[{to:[w]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ci":[{"rounded-ci":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[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":[C]}],"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":[C]}],"divide-style":[{divide:ue()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...ue()]}],"outline-offset":[{"outline-offset":[Zt,de]}],"outline-w":[{outline:[Zt,ma]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[C]}],"ring-offset-w":[{"ring-offset":[Zt,ma]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",pa,cl]}],"shadow-color":[{shadow:[oo]}],opacity:[{opacity:[C]}],"mix-blend":[{"mix-blend":[...Ae(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Ae()}],filter:[{filter:["","none"]}],blur:[{blur:[o]}],brightness:[{brightness:[a]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",pa,de]}],grayscale:[{grayscale:[n]}],"hue-rotate":[{"hue-rotate":[l]}],invert:[{invert:[d]}],saturate:[{saturate:[h]}],sepia:[{sepia:[te]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[o]}],"backdrop-brightness":[{"backdrop-brightness":[a]}],"backdrop-contrast":[{"backdrop-contrast":[m]}],"backdrop-grayscale":[{"backdrop-grayscale":[n]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[l]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[C]}],"backdrop-saturate":[{"backdrop-saturate":[h]}],"backdrop-sepia":[{"backdrop-sepia":[te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",de]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",de]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",de]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[ao,de]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[D]}],"skew-y":[{"skew-y":[D]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",de]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","li-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",de]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-Pt":[{"scroll-Pt":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-ci":[{"scroll-ci":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-ci":[{"scroll-ci":E()}],"scroll-ci":[{"scroll-ci":E()}],"scroll-ci":[{"scroll-ci":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",de]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Zt,ma,ar]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","ci","ci","ci","pb","pl"],px:["ci","pl"],py:["ci","pb"],m:["mx","my","Pt","me","ci","mr","mb","ml"],mx:["mr","ml"],my:["ci","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ci","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ci"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-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-Pt","scroll-me","scroll-ci","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-ci","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-ci","scroll-ci","scroll-ci","scroll-pb","scroll-pl"],"scroll-px":["scroll-ci","scroll-pl"],"scroll-py":["scroll-ci","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var ii=Jn(gl);function S(...e){return ii((0,si.clsx)(e))}var ni=require("@radix-ui/react-slot"),li=require("class-variance-authority"),di=Ce(require("react")),ci=require("react/jsx-runtime"),ro=(0,li.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=di.forwardRef(({asChild:e=!1,className:t,size:o,variant:a,...r},i)=>(0,ci.jsx)(e?ni.Slot:"button",{className:S(ro({className:t,size:o,variant:a})),ref:i,...r}));x.displayName="Button";var Ca=Ce(require("react"));var U=Ca.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("div",{ref:o,className:S("rounded-xl border bg-card text-card-foreground shadow",e),...t}));U.displayName="Card";var Ge=Ca.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("div",{ref:o,className:S("flex flex-col space-y-1.5 p-6",e),...t}));Ge.displayName="CardHeader";var Qe=Ca.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("div",{ref:o,className:S("font-semibold leading-none tracking-tight",e),...t}));Qe.displayName="CardTitle";var io=Ca.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("div",{ref:o,className:S("text-sm text-muted-foreground",e),...t}));io.displayName="CardDescription";var fe=Ca.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("div",{ref:o,className:S("p-6 ci-0",e),...t}));fe.displayName="CardContent";var so=Ca.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("div",{ref:o,className:S("flex items-center p-6 ci-0",e),...t}));so.displayName="CardFooter";var mi=Ce(require("react"));var O=mi.forwardRef(({className:e,type:t,...o},a)=>(0,ci.jsx)("input",{type:t,className:S("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:a,...o}));O.displayName="Input";var ve=Ce(require("@radix-ui/react-select")),ua=Ce(require("react")),Be=ve.Root;var Je=ve.Value,Ee=ua.forwardRef(({children:e,className:t,...o},a)=>(0,ci.jsxs)(ve.Trigger,{className:S("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:a,...o,children:[e,(0,ci.jsx)(ve.Icon,{asChild:!0,children:(0,ci.jsx)(Pt.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Ee.displayName=ve.Trigger.displayName;var ui=ua.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ve.ScrollUpButton,{className:S("flex cursor-default items-center justify-center py-1",e),ref:o,...t,children:(0,ci.jsx)(Pt.ChevronUp,{className:"h-4 w-4"})}));ui.displayName=ve.ScrollUpButton.displayName;var gi=ua.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ve.ScrollDownButton,{className:S("flex cursor-default items-center justify-center py-1",e),ref:o,...t,children:(0,ci.jsx)(Pt.ChevronDown,{className:"h-4 w-4"})}));gi.displayName=ve.ScrollDownButton.displayName;var Me=ua.forwardRef(({children:e,className:t,position:o="popper",...a},r)=>(0,ci.jsx)(ve.Portal,{children:(0,ci.jsxs)(ve.Content,{className:S("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded border bg-card text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:o,ref:r,...a,children:[(0,ci.jsx)(ui,{}),(0,ci.jsx)(ve.Viewport,{className:S("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),(0,ci.jsx)(gi,{})]})}));Me.displayName=ve.Content.displayName;var fl=ua.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ve.Label,{className:S("py-1.5 pl-8 ci-2 text-sm font-semibold",e),ref:o,...t}));fl.displayName=ve.Label.displayName;var ne=ua.forwardRef(({children:e,className:t,...o},a)=>(0,ci.jsxs)(ve.Item,{className:S("relative flex w-full cursor-default select-none items-center rounded py-1.5 pl-8 ci-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),ref:a,...o,children:[(0,ci.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ci.jsx)(ve.ItemIndicator,{children:(0,ci.jsx)(Pt.Check,{className:"h-4 w-4"})})}),(0,ci.jsx)(ve.ItemText,{children:e})]}));ne.displayName=ve.Item.displayName;var vl=ua.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ve.Separator,{className:S("-mx-1 my-1 h-px bg-muted",e),ref:o,...t}));vl.displayName=ve.Separator.displayName;var ir=require("motion/react");var Da=Ce(require("@radix-ui/react-tabs"));function fi({className:e,...t}){return(0,ci.jsx)(Da.Root,{"data-slot":"tabs",className:S("flex flex-col gap-2",e),...t})}function vi({className:e,...t}){return(0,ci.jsx)(Da.List,{"data-slot":"tabs-list",className:S("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function hi({className:e,...t}){return(0,ci.jsx)(Da.Trigger,{"data-slot":"tabs-trigger",className:S("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 Jt=Ce(require("react")),he=Ce(require("@radix-ui/react-dropdown-menu")),Va=require("@radix-ui/react-icons");var ga=he.Root,fa=he.Trigger;var bi=Jt.forwardRef(({className:e,inset:t,children:o,...a},r)=>(0,ci.jsxs)(he.SubTrigger,{ref:r,className:S("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),...a,children:[o,(0,ci.jsx)(Va.ChevronRightIcon,{className:"ml-auto"})]}));bi.displayName=he.SubTrigger.displayName;var xi=Jt.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(he.SubContent,{ref:o,className:S("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}));xi.displayName=he.SubContent.displayName;var Xt=Jt.forwardRef(({className:e,sideOffset:t=4,...o},a)=>(0,ci.jsx)(he.Portal,{children:(0,ci.jsx)(he.Content,{ref:a,sideOffset:t,className:S("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));Xt.displayName=he.Content.displayName;var Ot=Jt.forwardRef(({className:e,inset:t,...o},a)=>(0,ci.jsx)(he.Item,{ref:a,className:S("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...o}));Ot.displayName=he.Item.displayName;var yi=Jt.forwardRef(({className:e,children:t,checked:o,...a},r)=>(0,ci.jsxs)(he.CheckboxItem,{ref:r,className:S("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 ci-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:o,...a,children:[(0,ci.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ci.jsx)(he.ItemIndicator,{children:(0,ci.jsx)(Va.CheckIcon,{className:"h-4 w-4"})})}),t]}));yi.displayName=he.CheckboxItem.displayName;var wi=Jt.forwardRef(({className:e,children:t,...o},a)=>(0,ci.jsxs)(he.RadioItem,{ref:a,className:S("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 ci-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...o,children:[(0,ci.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ci.jsx)(he.ItemIndicator,{children:(0,ci.jsx)(Va.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));wi.displayName=he.RadioItem.displayName;var Ci=Jt.forwardRef(({className:e,inset:t,...o},a)=>(0,ci.jsx)(he.Label,{ref:a,className:S("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...o}));Ci.displayName=he.Label.displayName;var Ni=Jt.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(he.Separator,{ref:o,className:S("-mx-1 my-1 h-px bg-muted",e),...t}));Ni.displayName=he.Separator.displayName;var Si=({className:e,...t})=>(0,ci.jsx)("span",{className:S("ml-auto text-xs tracking-widest opacity-60",e),...t});Si.displayName="DropdownMenuShortcut";function Ao({activeTab:e,onTabChange:t,tabOptions:o,className:a="",maxWidth:r="700px",gridCols:i=6}){let c=o.find(s=>s.value===e);return(0,ci.jsxs)(ir.motion.div,{className:`flex-1 flex justify-center ${a}`,initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},children:[(0,ci.jsx)("div",{className:"hidden lg:block",children:(0,ci.jsx)(fi,{value:e,onValueChange:t,children:(0,ci.jsx)(vi,{className:"grid w-full rounded-2xl p-0 h-10",style:{maxWidth:r,gridTemplateColumns:`repeat(${Math.min(i,o.length)}, minmax(0, 1fr))`},children:o.map(s=>(0,ci.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,ci.jsx)(hi,{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,ci.jsx)("div",{className:"lg:hidden",children:(0,ci.jsxs)(ga,{children:[(0,ci.jsx)(fa,{asChild:!0,children:(0,ci.jsxs)(x,{variant:"outline",className:"rounded-2xl min-w-[140px] justify-between",children:[c?.label||"Select",(0,ci.jsx)(Pt.ChevronDown,{className:"h-4 w-4 ml-2"})]})}),(0,ci.jsx)(Xt,{align:"center",className:"w-[180px]",children:o.map(s=>(0,ci.jsx)(Ot,{onClick:()=>t?.(s.value),className:`cursor-pointer ${e===s.value?"bg-accent":""}`,children:s.label},s.value))})]})})]})}var Eo=Ce(require("react")),Yt=Ce(require("@radix-ui/react-avatar"));var Qt=Eo.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(Yt.Root,{ref:o,className:S("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));Qt.displayName=Yt.Root.displayName;var sr=Eo.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(Yt.Image,{ref:o,className:S("aspect-square h-full w-full",e),...t}));sr.displayName=Yt.Image.displayName;var ea=Eo.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(Yt.Fallback,{ref:o,className:S("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ea.displayName=Yt.Fallback.displayName;var Ti=(0,li.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 me({className:e,variant:t,...o}){return(0,ci.jsx)("div",{className:S(Ti({variant:t}),e),...o})}function Io({colleague:e,onEdit:t,onDelete:o,onViewDetails:a,showActions:r=!0,compact:i=!1,className:c}){let[s,m]=(0,jt.useState)(!1),n=g=>{switch(g){case"active":return"bg-green-500";case"inactive":return"bg-gray-500";default:return"bg-gray-500"}},l=g=>{switch(g){case"active":return"Active";case"inactive":return"Inactive";default:return"Unknown"}},d=g=>{if(!g)return"Never";let b=Math.floor((new Date().getTime()-g.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,ci.jsxs)(U,{className:S("hover:shadow-md transition-shadow",i&&"p-2",c),children:[(0,ci.jsx)(Ge,{className:S("pb-3",i&&"pb-2"),children:(0,ci.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ci.jsx)("div",{className:"relative",children:(0,ci.jsxs)(Qt,{className:S("h-12 w-12",i&&"h-8 w-8"),children:[(0,ci.jsx)(sr,{src:"/placeholder.svg",alt:e.name||"name"}),(0,ci.jsx)(ea,{children:e.name?.split(" ").map(g=>g[0]).join("")})]})}),(0,ci.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("h3",{className:S("font-semibold text-sm truncate",i&&"text-xs"),children:e.name}),e.type==="digital"?(0,ci.jsx)(Pt.Bot,{className:S("h-4 w-4 text-blue-500",i&&"h-3 w-3")}):(0,ci.jsx)(Pt.User,{className:S("h-4 w-4 text-green-500",i&&"h-3 w-3")})]}),(0,ci.jsx)("p",{className:S("text-sm text-muted-foreground truncate",i&&"text-xs")}),!i&&(0,ci.jsx)("div",{className:"flex items-center gap-2 ci-1"})]})]}),r&&(0,ci.jsxs)(ga,{children:[(0,ci.jsx)(fa,{asChild:!0,children:(0,ci.jsx)(x,{variant:"ghost",size:"icon",className:S("h-8 w-8",i&&"h-6 w-6"),children:(0,ci.jsx)(Pt.MoreHorizontal,{className:S("h-4 w-4",i&&"h-3 w-3")})})}),(0,ci.jsxs)(Xt,{align:"end",children:[e.type==="digital"&&(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsxs)(Ot,{onClick:()=>a?.(e),children:[(0,ci.jsx)(Pt.Settings,{className:"h-4 w-4 mr-2"}),"View Details"]}),(0,ci.jsxs)(Ot,{onClick:()=>t?.(e),children:[(0,ci.jsx)(Pt.Edit,{className:"h-4 w-4 mr-2"}),"Edit"]})]}),(0,ci.jsxs)(Ot,{onClick:()=>o?.(e.id.toString()),className:"text-destructive focus:text-destructive",children:[(0,ci.jsx)(Pt.Trash2,{className:"h-4 w-4 mr-2"}),e.type==="digital"?"Delete":"Remove from team"]})]})]})]})}),!i&&(0,ci.jsxs)(fe,{className:"ci-0",children:[(0,ci.jsx)("div",{className:"space-y-2 text-sm",children:e.type==="human"&&(0,ci.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,ci.jsx)(Pt.Mail,{className:"h-3 w-3"}),(0,ci.jsx)("span",{className:"truncate",children:e.email})]})}),e.type==="digital"&&(0,ci.jsx)("div",{className:"ci-3",children:(0,ci.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.capabilities?.slice(0,s?e.capabilities.length:2).map(g=>(0,ci.jsx)(me,{variant:"outline",className:"text-xs",children:typeof g.value=="number"?g.value:g.value.name},typeof g.value=="number"?g.value:g.value.name)),(e.capabilities?.length||0)>2&&(0,ci.jsx)(x,{variant:"ghost",size:"sm",className:"h-5 px-2 text-xs",onClick:()=>m(!s),children:s?"Show less":`+${(e.capabilities?.length||0)-2} more`})]})})]})]})}var Ai=Ce(require("react")),nr=Ce(require("@radix-ui/react-label"));var hl=(0,li.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),T=Ai.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(nr.Root,{ref:o,className:S(hl(),e),...t}));T.displayName=nr.Root.displayName;var Ii=Ce(require("react")),Te=Ii.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("textarea",{className:S("flex min-h-[80px] w-full rounded border border-border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...t}));Te.displayName="Textarea";var lr=Ce(require("react")),Et=Ce(require("@radix-ui/react-scroll-area"));var no=lr.forwardRef(({className:e,children:t,...o},a)=>(0,ci.jsxs)(Et.Root,{ref:a,className:S("relative overflow-hidden",e),...o,children:[(0,ci.jsx)(Et.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),(0,ci.jsx)(Bi,{}),(0,ci.jsx)(Et.Corner,{})]}));no.displayName=Et.Root.displayName;var Bi=lr.forwardRef(({className:e,orientation:t="vertical",...o},a)=>(0,ci.jsx)(Et.ScrollAreaScrollbar,{ref:a,orientation:t,className:S("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),...o,children:(0,ci.jsx)(Et.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Bi.displayName=Et.ScrollAreaScrollbar.displayName;function Li({selectedDocuments:e,onDocumentsChange:t,availableDocuments:o,label:a,placeholder:r="Search knowledge documents...",maxSelections:i,disabled:c=!1}){let[s,m]=(0,jt.useState)(""),[n,l]=(0,jt.useState)([]),[d,g]=(0,jt.useState)(!1);(0,jt.useEffect)(()=>{if(!s.trim()){l([]),g(!1);return}let p=o.filter(C=>{if(e.map(R=>R.id).includes(C.id))return!1;let h=s.toLowerCase();return C.title.toLowerCase().includes(h)||C.description?.toLowerCase().includes(h)||C.tags?.some(R=>R.toLowerCase().includes(h))||Object.values(C.metadata||{}).some(R=>String(R).toLowerCase().includes(h))});l(p),g(!0)},[s,e,o]);let w=p=>{i&&e.length>=i&&e.pop(),t([...e,p]),m(""),g(!1)},b=p=>{console.log("doc",p,e),t(e.filter(C=>C.id!==p))},y=!i||e.length<i;return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:a}),(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)(Pt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,ci.jsx)(O,{value:s,onChange:p=>m(p.target.value),placeholder:y?r:`Maximum ${i} documents selected`,className:"pl-9",disabled:c||!y,onFocus:()=>s&&g(!0)})]}),d&&n.length>0&&(0,ci.jsx)(U,{className:"absolute top-full left-0 right-0 z-10 ci-1 max-h-60",children:(0,ci.jsx)(no,{className:"h-full",children:(0,ci.jsx)(fe,{className:"p-2",children:n.map(p=>(0,ci.jsx)(x,{variant:"ghost",className:"w-full justify-start h-auto p-3 mb-1",onClick:()=>w(p),disabled:c,children:(0,ci.jsxs)("div",{className:"flex items-start gap-3 w-full",children:[(0,ci.jsx)(Pt.FileText,{className:"h-4 w-4 ci-0.5 text-muted-foreground flex-shrink-0"}),(0,ci.jsxs)("div",{className:"text-left flex-1 min-w-0",children:[(0,ci.jsx)("div",{className:"font-medium text-sm truncate",children:p.title}),p.description&&(0,ci.jsx)("div",{className:"text-xs text-muted-foreground ci-1 line-clamp-2",children:p.description}),p.tags&&p.tags.length>0&&(0,ci.jsxs)("div",{className:"flex flex-wrap gap-1 ci-2",children:[p.tags.slice(0,3).map(C=>(0,ci.jsx)(me,{variant:"outline",className:"text-xs",children:C},C)),p.tags.length>3&&(0,ci.jsxs)(me,{variant:"outline",className:"text-xs",children:["+",p.tags.length-3," more"]})]})]})]})},p.id))})})}),d&&s&&n.length===0&&(0,ci.jsx)(U,{className:"absolute top-full left-0 right-0 z-10 ci-1",children:(0,ci.jsxs)(fe,{className:"p-4 text-center text-sm text-muted-foreground",children:['jt knowledge documents found for "',s,'"']})})]}),e.length>0&&(0,ci.jsx)("div",{className:"space-y-2",children:(0,ci.jsx)("div",{className:"space-y-2",children:e.map(p=>(0,ci.jsx)(U,{className:"p-3",children:(0,ci.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ci.jsx)(Pt.FileText,{className:"h-4 w-4 ci-0.5 text-muted-foreground flex-shrink-0"}),(0,ci.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ci.jsx)("div",{className:"font-medium text-sm",children:p.title}),p.description&&(0,ci.jsx)("div",{className:"text-xs text-muted-foreground ci-1",children:p.description}),p.tags&&p.tags.length>0&&(0,ci.jsx)("div",{className:"flex flex-wrap gap-1 ci-2",children:p.tags.map(C=>(0,ci.jsxs)(me,{variant:"outline",className:"text-xs",children:[(0,ci.jsx)(Pt.Tag,{className:"h-3 w-3 mr-1"}),C]},C))})]}),(0,ci.jsx)(x,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",onClick:()=>b(p.id),disabled:c,children:(0,ci.jsx)(Pt.X,{className:"h-3 w-3"})})]})},p.id))})}),d&&(0,ci.jsx)("div",{className:"fixed inset-0 z-0",onClick:()=>g(!1)})]})}function dr({colleague:e,onSave:t,onCancel:o,isLoading:a=!1,title:r,submitLabel:i,cancelLabel:c="Cancel",readOnly:s=!1,availableKnowledgeDocuments:m=[]}){let[n,l]=(0,jt.useState)({type:"digital",name:"",description:"",jobDescription:"",workInstructions:"",capabilities:[],capabilityLevel:0,coreKnowledge:null,...e}),[d,g]=(0,jt.useState)(""),[w,b]=(0,jt.useState)(""),[y,p]=(0,jt.useState)(!s);(0,jt.useEffect)(()=>{e&&l(e)},[e]);let C=P=>{P.preventDefault();let K={id:n.id||parseInt(Date.now().toString()),name:n.name,type:"digital",description:n.description,jobDescription:n.jobDescription||"",workInstructions:n.workInstructions||"",capabilities:n.capabilities||[],capabilityLevel:n.capabilityLevel||0,coreKnowledge:n.coreKnowledge||null};t(K)},N=(P,K,J)=>{if(!K.trim())return;let L=n[P]||[];l({...n,[P]:[...L,K.trim()]}),J("")},h=(P,K)=>{let J=n[P]||[];l({...n,[P]:J.filter((L,E)=>E!==K)})},R=P=>{P.preventDefault(),p(!y)},te=(P,K,J,L,E)=>{let Re=n[P]||[];return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:K}),y&&(0,ci.jsxs)("div",{className:"flex gap-2",children:[(0,ci.jsx)(O,{value:J,onChange:xe=>L(xe.target.value),placeholder:E,onKeyPress:xe=>{xe.key==="Enter"&&(xe.preventDefault(),N(P,J,L))},disabled:a}),(0,ci.jsx)(x,{type:"button",variant:"outline",size:"icon",onClick:()=>N(P,J,L),disabled:a,children:(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"})})]}),(0,ci.jsx)("div",{className:"flex flex-wrap gap-2",children:Re.map((xe,z)=>(0,ci.jsxs)(me,{className:"gap-1",children:[xe,y&&(0,ci.jsx)(x,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-accent hover:text-accent-foreground",onClick:()=>h(P,z),disabled:a,children:(0,ci.jsx)(Pt.X,{className:"h-3 w-3"})})]},`${P}-${z}-${xe}`))})]})},D=r||(y?e?"Edit Colleague":"Add New Colleague":"View Colleague"),H=i||(e?"Update Colleague":"Add Colleague");return(0,ci.jsxs)(U,{className:"m-8 w-full max-w-4xl mx-auto",children:[(0,ci.jsx)(Ge,{children:(0,ci.jsxs)(Qe,{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Bot,{className:"h-5 w-5"}),D]})}),(0,ci.jsx)(fe,{children:(0,ci.jsxs)("form",{onSubmit:C,className:"space-y-6",children:[(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Name *"}),(0,ci.jsx)(O,{id:"name",value:n.name||"",onChange:P=>l({...n,name:P.target.value}),required:!0,disabled:a||!y})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Te,{id:"description",value:n.description||"",onChange:P=>l({...n,description:P.target.value}),rows:3,placeholder:"Brief description of this digital colleague...",disabled:a||!y})]})]}),(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)("h3",{className:"text-lg font-semibold",children:"Digital Colleague Details"}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"jobDescription",children:"Job Description *"}),(0,ci.jsx)(Te,{id:"jobDescription",value:n.jobDescription||"",onChange:P=>l({...n,jobDescription:P.target.value}),rows:4,required:n.type==="digital",disabled:a||!y})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"workInstructions",children:"Work Instructions"}),(0,ci.jsx)(Te,{id:"workInstructions",value:n.workInstructions||"",onChange:P=>l({...n,workInstructions:P.target.value}),rows:4,placeholder:"Enter detailed work instructions for this digital colleague...",disabled:a||!y})]}),te("capabilities","Capabilities",w,b,"Add capability"),(0,ci.jsx)(Li,{selectedDocuments:n.coreKnowledge?[{id:n.coreKnowledge?.id?.toString(),title:n.coreKnowledge?.name,format:"markdown",content:n.coreKnowledge?.content||"",createdAt:new Date(n.coreKnowledge?.createdAt),description:n.coreKnowledge?.description||"",metadata:n.coreKnowledge?.metadata||{},updatedAt:new Date(n.coreKnowledge?.updatedAt)}]:[],onDocumentsChange:P=>{let K={createdAt:P[0]?.createdAt.toISOString(),id:parseInt(P[0]?.id),name:P[0]?.title,source:"payload",updatedAt:(P[0]?.updatedAt||new Date).toISOString()};console.log(P),l({...n,coreKnowledge:P&&P.length>0?K:void 0})},label:"Core Knowledge",placeholder:"Search for core knowledge documents...",maxSelections:1,disabled:a||!y,availableDocuments:m.map(P=>({id:P.id.toString(),title:P.name,name:P.name,format:"markdown",content:P.content||"",createdAt:new Date(P.createdAt),source:P.source,description:P.description||"",metadata:P.metadata||{},updatedAt:new Date(P.updatedAt)}))})]}),(0,ci.jsxs)("div",{className:"flex justify-end gap-2 ci-4 border-t",children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:o,disabled:a,children:y?c:"Close"}),y?(0,ci.jsx)(x,{type:"submit",disabled:a,children:a?"Saving...":H}):(0,ci.jsxs)(x,{type:"button",onClick:R,disabled:a,className:"gap-2",children:[(0,ci.jsx)(Pt.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})})]})}function Hi({users:e,onUserSelect:t,onCancel:o,selectedUserId:a}){let[r,i]=(0,jt.useState)(""),c=(0,jt.useMemo)(()=>e.filter(m=>m.name?.toLowerCase().includes(r.toLowerCase())||m.email.toLowerCase().includes(r.toLowerCase())),[e,r]),s=m=>{t(m)};return(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ci.jsxs)(x,{variant:"ghost",onClick:o,className:"gap-2",children:[(0,ci.jsx)(Pt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-3xl font-bold",children:"Select User"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Choose a user to add as a colleague"})]})]}),(0,ci.jsx)(U,{className:"container",children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsx)("div",{className:"flex flex-col md:flex-row gap-4",children:(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)(Pt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,ci.jsx)(O,{placeholder:"Search users by name, email, role, or skills...",value:r,onChange:m=>i(m.target.value),className:"pl-9"})]})})})})}),(0,ci.jsx)("div",{className:"container grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:c.map(m=>(0,ci.jsx)(ir.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,ci.jsxs)(U,{className:`cursor-pointer transition-all hover:shadow-lg ${a===m.id?"ring-2 ring-primary":""}`,onClick:()=>s(m),children:[(0,ci.jsx)(Ge,{className:"pb-3",children:(0,ci.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ci.jsx)(Qt,{children:(0,ci.jsx)(ea,{children:(0,ci.jsx)(Pt.User,{className:"h-4 w-4"})})}),(0,ci.jsx)("div",{children:(0,ci.jsx)(Qe,{className:"text-lg",children:m.name})})]}),a===m.id&&(0,ci.jsx)(Pt.Check,{className:"h-5 w-5 text-primary"})]})}),(0,ci.jsx)(fe,{className:"ci-0",children:(0,ci.jsxs)("div",{className:"space-y-3",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("p",{className:"text-sm text-muted-foreground",children:"Email"}),(0,ci.jsx)("p",{className:"text-sm font-medium",children:m.email})]}),(0,ci.jsx)("div",{children:(0,ci.jsx)("p",{className:"text-sm text-muted-foreground",children:"Department"})})]})})]})},m.id))}),c.length===0&&(0,ci.jsx)(U,{className:"container ci-4",children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"text-center py-8",children:[(0,ci.jsx)(Pt.User,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,ci.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"jt users found"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"user-selection")})})}function Oi({digitalColleagues:e,onColleagueClone:t,onCancel:o,selectedColleagueId:a}){let[r,i]=(0,jt.useState)(""),[c,s]=(0,jt.useState)("all"),m=(0,jt.useMemo)(()=>e.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())||d.jobDescription?.toLowerCase().includes(r.toLowerCase())||d.workInstructions?.toLowerCase().includes(r.toLowerCase())),[e,r,c]),n=d=>{let g={...d,name:`${d.name} (Copy)`};t(g)},l=d=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(d);return(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ci.jsxs)(x,{variant:"ghost",onClick:o,className:"gap-2",children:[(0,ci.jsx)(Pt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-3xl font-bold",children:"Clone Digital Colleague"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Select a digital colleague to clone"})]})]}),(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)(Pt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,ci.jsx)(O,{placeholder:"Search by name, job description, or capabilities...",value:r,onChange:d=>i(d.target.value),className:"pl-9"})]})}),(0,ci.jsxs)("select",{value:c,onChange:d=>s(d.target.value),className:"h-10 px-3 rounded-md border border-input bg-background text-sm ring-offset-background",children:[(0,ci.jsx)("option",{value:"all",children:"All Status"}),(0,ci.jsx)("option",{value:"active",children:"Active"}),(0,ci.jsx)("option",{value:"inactive",children:"Inactive"})]})]})})}),(0,ci.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:m.map(d=>(0,ci.jsx)(ir.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,ci.jsxs)(U,{className:`cursor-pointer transition-all hover:shadow-lg ${a?.toString()===d.id.toString()?"ring-2 ring-primary":""}`,onClick:()=>n(d),children:[(0,ci.jsx)(Ge,{className:"pb-3",children:(0,ci.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ci.jsx)(Qt,{children:(0,ci.jsx)(ea,{className:"bg-blue-100",children:(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-blue-600"})})}),(0,ci.jsx)("div",{children:(0,ci.jsx)(Qe,{className:"text-lg flex items-center gap-2",children:d.name})})]}),(0,ci.jsxs)(x,{size:"sm",variant:"outline",className:"gap-2 h-8",onClick:g=>{g.stopPropagation(),n(d)},children:[(0,ci.jsx)(Pt.Copy,{className:"h-3 w-3"}),"Clone"]})]})}),(0,ci.jsx)(fe,{className:"ci-0",children:(0,ci.jsxs)("div",{className:"space-y-3",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("p",{className:"text-sm text-muted-foreground",children:"Job Description"}),(0,ci.jsx)("p",{className:"text-sm line-clamp-2",children:d.jobDescription})]}),d.capabilities&&d.capabilities.length>0&&(0,ci.jsxs)("div",{children:[(0,ci.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Capabilities"}),(0,ci.jsx)("div",{className:"flex flex-wrap gap-1",children:d.capabilities.length>3&&(0,ci.jsxs)(me,{variant:"outline",className:"text-xs",children:["+",d.capabilities.length-3]})})]}),(0,ci.jsx)("div",{className:"flex items-center justify-between text-xs text-muted-foreground"}),d.workInstructions&&(0,ci.jsxs)("div",{children:[(0,ci.jsx)("p",{className:"text-sm text-muted-foreground",children:"Instructions"}),(0,ci.jsx)("p",{className:"text-xs line-clamp-2",children:d.workInstructions})]})]})})]})},d.id))}),m.length===0&&(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"text-center py-8",children:[(0,ci.jsx)(Pt.Bot,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,ci.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"jt digital colleagues found"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"colleague-clone")})})}function Vi({onSelectHuman:e,onSelectDigital:t,onCancel:o}){return(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ci.jsxs)(x,{variant:"ghost",onClick:o,className:"gap-2",children:[(0,ci.jsx)(Pt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-3xl font-bold",children:"Add Colleague"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Choose the type of colleague to add"})]})]}),(0,ci.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,ci.jsxs)(U,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,ci.jsxs)(Ge,{className:"text-center pb-4",children:[(0,ci.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,ci.jsx)(Pt.User,{className:"h-8 w-8 text-blue-600"})}),(0,ci.jsx)(Qe,{className:"text-xl",children:"Add Human Colleague"})]}),(0,ci.jsxs)(fe,{className:"text-center",children:[(0,ci.jsx)("p",{className:"text-muted-foreground mb-4",children:"Select from existing users in your organization to add as team members."}),(0,ci.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Users,{className:"h-4 w-4 text-blue-600"}),(0,ci.jsx)("span",{children:"Browse existing users"})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.User,{className:"h-4 w-4 text-blue-600"}),(0,ci.jsx)("span",{children:"Import user details automatically"})]})]}),(0,ci.jsx)(x,{className:"ci-6 w-full",onClick:e,children:"Select User"})]})]})}),(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,ci.jsxs)(U,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,ci.jsxs)(Ge,{className:"text-center pb-4",children:[(0,ci.jsx)("div",{className:"mx-auto w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:(0,ci.jsx)(Pt.Bot,{className:"h-8 w-8 text-purple-600"})}),(0,ci.jsx)(Qe,{className:"text-xl",children:"Add Digital Colleague"})]}),(0,ci.jsxs)(fe,{className:"text-center",children:[(0,ci.jsx)("p",{className:"text-muted-foreground mb-4",children:"Clone an existing digital colleague or create a new AI assistant for your team."}),(0,ci.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-purple-600"}),(0,ci.jsx)("span",{children:"Clone existing colleagues"})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Users,{className:"h-4 w-4 text-purple-600"}),(0,ci.jsx)("span",{children:"Create from templates"})]})]}),(0,ci.jsx)(x,{className:"ci-6 w-full",onClick:t,children:"Add Digital Colleague"})]})]})})]})]},"colleague-type-selection")})})}function ji({onCloneExisting:e,onCreateNew:t,onCancel:o}){return(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ci.jsxs)(x,{variant:"ghost",onClick:o,className:"gap-2",children:[(0,ci.jsx)(Pt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-3xl font-bold",children:"Add Digital Colleague"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Choose how to create your digital colleague"})]})]}),(0,ci.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,ci.jsxs)(U,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,ci.jsxs)(Ge,{className:"text-center pb-4",children:[(0,ci.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,ci.jsx)(Pt.Copy,{className:"h-8 w-8 text-blue-600"})}),(0,ci.jsx)(Qe,{className:"text-xl",children:"Clone Existing"})]}),(0,ci.jsxs)(fe,{className:"text-center",children:[(0,ci.jsx)("p",{className:"text-muted-foreground mb-4",children:"Start with an existing digital colleague and customize ci for your needs."}),(0,ci.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-blue-600"}),(0,ci.jsx)("span",{children:"Pre-configured capabilities"})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Copy,{className:"h-4 w-4 text-blue-600"}),(0,ci.jsx)("span",{children:"Inherit knowledge base"})]})]}),(0,ci.jsx)(x,{className:"ci-6 w-full",onClick:e,children:"Browse & Clone"})]})]})}),(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,ci.jsxs)(U,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,ci.jsxs)(Ge,{className:"text-center pb-4",children:[(0,ci.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,ci.jsx)(Pt.Sparkles,{className:"h-8 w-8 text-green-600"})}),(0,ci.jsx)(Qe,{className:"text-xl",children:"Create New"})]}),(0,ci.jsxs)(fe,{className:"text-center",children:[(0,ci.jsx)("p",{className:"text-muted-foreground mb-4",children:"Build a completely new digital colleague from scratch with custom specifications."}),(0,ci.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4 text-green-600"}),(0,ci.jsx)("span",{children:"Custom job description"})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Sparkles,{className:"h-4 w-4 text-green-600"}),(0,ci.jsx)("span",{children:"Define unique capabilities"})]})]}),(0,ci.jsx)(x,{className:"ci-6 w-full",onClick:t,children:"Create from Scratch"})]})]})})]})]},"digital-colleague-options")})})}function Ki(e,t){let[o,a]=(0,jt.useState)(()=>{if(typeof window>"ci")return t;try{let i=window.localStorage.getItem(e);return i?JSON.parse(i):t}catch{return t}}),r=i=>{try{a(i),typeof window<"ci"&&window.localStorage.setItem(e,JSON.stringify(i))}catch{}};return(0,jt.useEffect)(()=>{r(o)},[]),[o,r]}var Lo=require("react-icons/fa");function gt({title:e,description:t,badge:o,primaryAction:a,secondaryAction:r,gradient:i,children:c,className:s}){let[m,n]=Ki(`hero-section-minimized-${e.replace(/\s+/g,"-").toLowerCase()}`,!r&&!t),l=!r&&!t||m;return(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:`overflow-hidden rounded-3xl ${i} p-8 text-white ${s||""}`,children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[o&&(0,ci.jsx)(me,{className:"bg-white/20 text-white hover:bg-white/30 rounded-xl",children:o}),(0,ci.jsx)("h2",{className:"text-3xl font-bold m-0",children:e})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[l&&a&&(0,ci.jsx)(x,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:a.onClick,children:a.label}),(r||t)&&(0,ci.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:()=>n(!m),style:{lineHeight:0},children:m?(0,ci.jsx)(Lo.FaChevronDown,{size:22}):(0,ci.jsx)(Lo.FaChevronUp,{size:22})})]})]}),!l&&(0,ci.jsxs)("div",{className:"flex flex-col gap-6 md:flex-row md:items-center md:justify-between",children:[(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)("p",{className:"max-w-[600px] text-white/80",children:t}),(0,ci.jsxs)("div",{className:"flex flex-wrap gap-3",children:[a&&(0,ci.jsx)(x,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:a.onClick,children:a.label}),r&&(0,ci.jsx)(x,{variant:"outline",className:"rounded-2xl bg-transparent border-white text-white hover:bg-white/10",onClick:r.onClick,children:r.label})]})]}),c&&(0,ci.jsx)("div",{className:"hidden lg:block",children:c})]})]})}function cr({initialColleagues:e,onColleagueAdd:t,onColleagueEdit:o,onColleagueDelete:a,compactView:r=!1,departments:i=["Design","Engineering","Marketing","Product","Sales","Operations"],className:c,availableUsers:s=[],existingDigitalColleagues:m=[],availableKnowledgeDocuments:n=[]}){let[l,d]=(0,jt.useState)(e||[]),[g,w]=(0,jt.useState)(""),[b,y]=(0,jt.useState)("all"),[p,C]=(0,jt.useState)("all"),[N,h]=(0,jt.useState)("all"),[R,te]=(0,jt.useState)(null),[D,H]=(0,jt.useState)(null);(0,jt.useEffect)(()=>{d(e||[])},[e]);let P=Array.isArray(s)?s:[],K=Array.isArray(m)?m:[],[J,L]=(0,jt.useState)("main"),E=l.filter(F=>!F||!F.name?!1:F.name.toLowerCase().includes(g.toLowerCase())||F.type==="human"&&F.email?.toLowerCase().includes(g.toLowerCase())||F.type==="digital"&&F.jobDescription?.toLowerCase().includes(g.toLowerCase())),Re=E.filter(F=>F.type==="human"),xe=E.filter(F=>F.type==="digital"),z=()=>{L("typeSelection")},ue=F=>{F.type==="digital"&&(te(F),L("form")),console.log("Editing colleague:",F),o?.(F)},Ae=F=>{F.type==="digital"&&(H(F),L("view"))},ht=F=>{let Ue={id:`human-${Date.now()}`,type:"human",name:F.name,email:F.email,updatedAt:F.updatedAt,createdAt:F.createdAt,accounts:F.accounts};d(At=>[...At,Ue]),t?.(Ue),L("main")},lt=F=>{if(!F||!F.id){console.error("Invalid cloned colleague provided to handleDigitalColleagueClone:",F);return}d(Ue=>[...Ue,{...F,type:"digital"}]),t?.({...F,type:"digital"}),L("main")},St=()=>{te(null),L("form")},M=F=>{if(!F||!F.id){console.error("Invalid colleague provided to handleSaveColleague:",F);return}R?(d(Ue=>Ue.map(At=>At.id===F.id?{...F,type:"digital"}:At)),o?.({...F,type:"digital"})):(d(Ue=>[...Ue,{...F,type:"digital"}]),t?.({...F,type:"digital"})),L("main"),te(null)},ye=()=>{L("main"),te(null),H(null)},Fe=()=>{L("main"),H(null)},Tt=()=>{D&&(te(D),H(null),L("form"))},ke=F=>{console.log("deleting",F,l),a?.(F,l.find(Ue=>Ue.id.toString()===F.toString())?.type),d(Ue=>Ue.filter(At=>At.id!==F))},yt=()=>{w(""),y("all"),C("all")};return J==="typeSelection"?(0,ci.jsx)(Vi,{onSelectHuman:()=>L("userSelection"),onSelectDigital:()=>L("digitalOptions"),onCancel:()=>L("main")}):J==="userSelection"?(0,ci.jsx)(Hi,{users:P,onUserSelect:ht,onCancel:()=>L("typeSelection")}):J==="digitalOptions"?(0,ci.jsx)(ji,{onCloneExisting:()=>L("digitalClone"),onCreateNew:St,onCancel:()=>L("typeSelection")}):J==="digitalClone"?(0,ci.jsx)(Oi,{digitalColleagues:K,onColleagueClone:lt,onCancel:()=>L("digitalOptions")}):J==="form"?(0,ci.jsx)(dr,{colleague:R||void 0,onSave:M,onCancel:ye,availableKnowledgeDocuments:n}):J==="view"?(0,ci.jsx)(dr,{colleague:D||void 0,onSave:M,onCancel:Fe,readOnly:!0,availableKnowledgeDocuments:n}):(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsx)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,ci.jsxs)("div",{className:`space-y-6 ${c||""}`,children:[(0,ci.jsx)(gt,{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:z}}),(0,ci.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,ci.jsxs)(U,{children:[(0,ci.jsxs)(Ge,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,ci.jsx)(Qe,{className:"text-sm font-medium",children:"Total Colleagues"}),(0,ci.jsx)(Pt.Users,{className:"h-4 w-4 text-muted-foreground"})]}),(0,ci.jsxs)(fe,{children:[(0,ci.jsx)("div",{className:"text-2xl font-bold",children:l.length}),(0,ci.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]}),(0,ci.jsxs)(U,{children:[(0,ci.jsxs)(Ge,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,ci.jsx)(Qe,{className:"text-sm font-medium",children:"Human Members"}),(0,ci.jsx)(Pt.User,{className:"h-4 w-4 text-muted-foreground"})]}),(0,ci.jsxs)(fe,{children:[(0,ci.jsx)("div",{className:"text-2xl font-bold",children:l.filter(F=>F.type==="human").length}),(0,ci.jsx)("p",{className:"text-xs text-muted-foreground",children:"active"})]})]}),(0,ci.jsxs)(U,{children:[(0,ci.jsxs)(Ge,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,ci.jsx)(Qe,{className:"text-sm font-medium",children:"Digital Colleagues"}),(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-muted-foreground"})]}),(0,ci.jsxs)(fe,{children:[(0,ci.jsx)("div",{className:"text-2xl font-bold",children:l.filter(F=>F.type==="digital").length}),(0,ci.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]})]}),(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)(Pt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,ci.jsx)(O,{placeholder:"Search colleagues...",value:g,onChange:F=>w(F.target.value),className:"pl-9"})]})}),(0,ci.jsxs)(Be,{value:b,onValueChange:y,children:[(0,ci.jsx)(Ee,{className:"w-full md:w-[180px]",children:(0,ci.jsx)(Je,{placeholder:"Department"})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)(ne,{value:"all",children:"All Departments"}),i.map(F=>(0,ci.jsx)(ne,{value:F,children:F},F))]})]}),(0,ci.jsxs)(Be,{value:p,onValueChange:C,children:[(0,ci.jsx)(Ee,{className:"w-full md:w-[140px]",children:(0,ci.jsx)(Je,{placeholder:"Status"})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)(ne,{value:"all",children:"All Status"}),(0,ci.jsx)(ne,{value:"active",children:"Active"}),(0,ci.jsx)(ne,{value:"inactive",children:"Inactive"})]})]}),(g||b!=="all"||p!=="all")&&(0,ci.jsxs)(x,{variant:"outline",onClick:yt,className:"gap-2",children:[(0,ci.jsx)(Pt.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)(Ao,{activeTab:N,onTabChange:h,tabOptions:[{value:"all",label:`All (${E.length})`},{value:"human",label:`Human (${Re.length})`},{value:"digital",label:`Digital (${xe.length})`}],maxWidth:"400px",gridCols:3}),N==="all"&&(0,ci.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:E.map(F=>(0,ci.jsx)(Io,{colleague:F,onEdit:ue,onDelete:ke,onViewDetails:Ae,compact:r},`${F}-${F.id}`))}),N==="human"&&(0,ci.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:Re.map(F=>(0,ci.jsx)(Io,{colleague:F,onEdit:ue,onDelete:ke,onViewDetails:Ae,compact:r},F.id))}),N==="digital"&&(0,ci.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:xe.map(F=>(0,ci.jsx)(Io,{colleague:F,onEdit:ue,onDelete:ke,onViewDetails:Ae,compact:r},F.id))})]}),E.length===0&&(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"text-center py-8",children:[(0,ci.jsx)(Pt.Users,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,ci.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"jt colleagues found"}),(0,ci.jsx)("p",{className:"text-muted-foreground mb-4",children:g||b!=="all"||p!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first colleague."}),(0,ci.jsxs)(x,{onClick:z,className:"gap-2",children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),"Add Colleague"]})]})})})]})},"projects-index-view")})})}var bl=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 Oo({files:e,onFileClick:t,onFileEdit:o,onFileDelete:a,showHeader:r=!0,className:i}){return(0,ci.jsxs)("div",{className:`rounded-3xl border overflow-hidden ${i||""}`,children:[r&&(0,ci.jsxs)("div",{className:"bg-muted/50 p-3 hidden md:grid md:grid-cols-10 text-sm font-medium",children:[(0,ci.jsx)("div",{className:"col-span-6",children:"Name"}),(0,ci.jsx)("div",{className:"col-span-2",children:"Size"}),(0,ci.jsx)("div",{className:"col-span-2",children:"Modified"})]}),(0,ci.jsx)("div",{className:"divide-y",children:e.map(c=>(0,ci.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?.(c),children:[(0,ci.jsxs)("div",{className:"col-span-6 flex items-center gap-3 w-full md:w-auto",children:[(0,ci.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted"}),(0,ci.jsx)("div",{children:(0,ci.jsx)("p",{className:"font-medium",children:c.name})})]}),(0,ci.jsx)("div",{className:"col-span-2 text-sm md:text-base",children:bl(c.filesize)}),(0,ci.jsxs)("div",{className:"col-span-2 flex items-center justify-between w-full md:w-auto",children:[(0,ci.jsx)("span",{className:"text-sm md:text-base",children:new Date(c.createdAt).toLocaleDateString()}),(0,ci.jsx)("div",{className:"flex gap-1",children:(0,ci.jsx)(x,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:s=>{s.stopPropagation(),a?.(c)},children:(0,ci.jsx)($i.Trash2,{className:"h-4 w-4"})})})]})]},c.name))})]})}var po=Ce(require("react")),ut=Ce(require("@radix-ui/react-dialog"));var Xe=ut.Root;var _i=ut.Portal;var mr=po.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ut.Overlay,{ref:o,className:S("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}));mr.displayName=ut.Overlay.displayName;var _e=po.forwardRef(({className:e,children:t,...o},a)=>(0,ci.jsxs)(_i,{children:[(0,ci.jsx)(mr,{}),(0,ci.jsxs)(ut.Content,{ref:a,className:S("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),...o,children:[t,(0,ci.jsxs)(ut.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,ci.jsx)(Pt.X,{className:"h-4 w-4"}),(0,ci.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));_e.displayName=ut.Content.displayName;var We=({className:e,...t})=>(0,ci.jsx)("div",{className:S("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});We.displayName="DialogHeader";var Ua=({className:e,...t})=>(0,ci.jsx)("div",{className:S("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ua.displayName="DialogFooter";var qe=po.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ut.Title,{ref:o,className:S("text-lg font-semibold leading-none tracking-tight",e),...t}));qe.displayName=ut.Title.displayName;var $a=po.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ut.Description,{ref:o,className:S("text-sm text-muted-foreground",e),...t}));$a.displayName=ut.Description.displayName;var Wi=({isOpen:e,onClose:t,onAddFile:o})=>{let[a,r]=(0,jt.useState)(null),[i,c]=(0,jt.useState)(""),[s,m]=(0,jt.useState)(""),[n,l]=(0,jt.useState)(""),d=w=>{let b=w.target.files?.[0];b&&(r(b),i||c(b.name))},g=async w=>{if(w.preventDefault(),!a)return;let b=new FormData;b.append("file",a),b.append("name",i),s&&b.append("description",s),n&&b.append("tags",n),o?.(b),t(),r(null),c(""),m(""),l("")};return(0,ci.jsx)(Xe,{open:e,onOpenChange:t,children:(0,ci.jsxs)(_e,{className:"sm:max-w-md",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New File"})}),(0,ci.jsxs)("form",{onSubmit:g,className:"grid gap-4",children:[(0,ci.jsx)("div",{className:"flex items-center justify-center w-full",children:(0,ci.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,ci.jsxs)("div",{className:"flex flex-col items-center justify-center ci-5 pb-6",children:[(0,ci.jsx)(xl,{className:"w-10 h-10 text-gray-400"}),(0,ci.jsxs)("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:[(0,ci.jsx)("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),(0,ci.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"SVG, PNG, JPG or GIF (MAX. 800x400px)"})]}),(0,ci.jsx)("input",{id:"dropzone-file",type:"file",className:"hidden",onChange:d})]})}),a&&(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("p",{className:"font-medium",children:a.name}),(0,ci.jsxs)("p",{className:"text-sm text-muted-foreground",children:[((a.size||0)/1024).toFixed(2)," KB"]})]}),(0,ci.jsx)(x,{type:"submit",onClick:g,children:"Upload"})]})]})]})})};function xl(e){return(0,ci.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,ci.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,ci.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,ci.jsx)("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]})}function go({initialFiles:e=[],onFileAdd:t,onFileEdit:o,onFileDelete:a,onFileClick:r,compactView:i=!1,className:c}){let[s,m]=(0,$t.useState)(e),[n,l]=(0,$t.useState)(""),[d,g]=(0,$t.useState)("all"),[w,b]=(0,$t.useState)("all"),[y,p]=(0,$t.useState)(!1),C=(0,$t.useRef)(""),N=L=>L.map(E=>`${E.id}-${new Date(E.createdAt).getTime()}-${new Date(E.updatedAt).getTime()}`).join("-");(0,$t.useEffect)(()=>{let L=N(e);L!==C.current&&(m(e),C.current=L)},[e]);let h=s.filter(L=>L.name.toLowerCase().includes(n.toLowerCase())),R=h.slice(0,10),te=h.filter(Boolean),D=()=>{p(!0)},H=L=>{o?.(L)},P=L=>{console.log("deleting file",L),m(E=>E.filter(Re=>Re.name!==L.name)),a?.(L.id.toString())},K=L=>{r?.(L)},J=()=>{l(""),g("all")};return(0,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsx)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,ci.jsxs)("div",{className:`space-y-6 ${c||""}`,children:[(0,ci.jsx)(gt,{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:D},secondaryAction:{label:"Download all",onClick:()=>console.log("Download all clicked")}}),(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)(Pt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,ci.jsx)(O,{placeholder:"Search files...",value:n,onChange:L=>l(L.target.value),className:"pl-9"})]})}),(n||d!=="all")&&(0,ci.jsxs)(x,{variant:"outline",onClick:J,className:"gap-2",children:[(0,ci.jsx)(Pt.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)(Ao,{activeTab:w,onTabChange:b,tabOptions:[{value:"all",label:`All Files (${h.length})`},{value:"recent",label:`Recent (${R.length})`}],maxWidth:"500px",gridCols:3}),w==="all"&&(0,ci.jsx)(Oo,{files:h,onFileClick:K,onFileEdit:H,onFileDelete:P,showHeader:!i}),w==="recent"&&(0,ci.jsx)(Oo,{files:R,onFileClick:K,onFileEdit:H,onFileDelete:P,showHeader:!i}),w==="shared"&&(0,ci.jsx)(Oo,{files:te,onFileClick:K,onFileEdit:H,onFileDelete:P,showHeader:!i})]}),h.length===0&&(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"text-center py-8",children:[(0,ci.jsx)(Pt.File,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,ci.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"jt files found"}),(0,ci.jsx)("p",{className:"text-muted-foreground mb-4",children:n||d!=="all"?"Try adjusting your filters to see more results.":"Get started by uploading your first file."}),(0,ci.jsxs)(x,{onClick:D,className:"gap-2",children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),"Upload File"]})]})})})]})},"files-view")}),(0,ci.jsx)(Wi,{isOpen:y,onClose:()=>p(!1),onAddFile:t})]})}var bs=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),xs=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),ys=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),ws=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),Cs=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),Ns=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),Ss=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),_o=require("@payloadcms/richtext-lexical/lexical/list"),Ds=require("@payloadcms/richtext-lexical/lexical/rich-text"),ks=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var fs=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),vs=require("@payloadcms/richtext-lexical/lexical/utils"),Ne=require("@payloadcms/richtext-lexical/lexical"),kr=require("@payloadcms/richtext-lexical/lexical/selection");var yl=()=>(0,ci.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,ci.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"})}),qi=yl;var wl=()=>(0,ci.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,ci.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"})}),Zi=wl;var Cl=()=>(0,ci.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,ci.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,ci.jsx)("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),Ji=Cl;var Nl=()=>(0,ci.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,ci.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,ci.jsx)("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),Xi=Nl;var Sl=()=>(0,ci.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,ci.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"})}),Yi=Sl;var Dl=()=>(0,ci.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,ci.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"})}),Qi=Dl;var es=()=>(0,ci.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,ci.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"})}),ts=()=>(0,ci.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,ci.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"})}),as=()=>(0,ci.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,ci.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"})}),os=()=>(0,ci.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,ci.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"})}),rs=()=>(0,ci.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,ci.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 is=Ce(require("react")),zt=Ce(require("@radix-ui/react-tooltip"));var hr=zt.Provider,br=zt.Root,xr=zt.Trigger,jo=is.forwardRef(({className:e,sideOffset:t=4,...o},a)=>(0,ci.jsx)(zt.Portal,{children:(0,ci.jsx)(zt.Content,{ref:a,sideOffset:t,className:S("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));jo.displayName=zt.Content.displayName;var ss=Ce(require("react")),yr=Ce(require("@radix-ui/react-toggle"));var wr=(0,li.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=ir]:bg-accent data-[state=ir]: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"}}),kl=ss.forwardRef(({className:e,variant:t,size:o,...a},r)=>(0,ci.jsx)(yr.Root,{ref:r,className:S(wr({variant:t,size:o,className:e})),...a}));kl.displayName=yr.Root.displayName;var Ta=Ce(require("react")),Ga=Ce(require("@radix-ui/react-toggle-group"));var ds=Ta.createContext({size:"default",variant:"default"}),Pa=Ta.forwardRef(({className:e,variant:t,size:o,children:a,...r},i)=>(0,ci.jsx)(Ga.Root,{ref:i,className:S("flex items-center justify-center gap-1",e),...r,children:(0,ci.jsx)(ds.Provider,{value:{variant:t,size:o},children:a})}));Pa.displayName=Ga.Root.displayName;var Ra=Ta.forwardRef(({className:e,children:t,variant:o,size:a,...r},i)=>{let c=Ta.useContext(ds);return(0,ci.jsx)(Ga.Item,{ref:i,className:S(wr({variant:c.variant||o,size:c.size||a}),e),...r,children:t})});Ra.displayName=Ga.Item.displayName;var cs=Ce(require("react")),Gt=Ce(require("@radix-ui/react-popover"));var Nr=Gt.Root,Sr=Gt.Trigger;var zo=cs.forwardRef(({className:e,align:t="center",sideOffset:o=4,...a},r)=>(0,ci.jsx)(Gt.Portal,{children:(0,ci.jsx)(Gt.Content,{ref:r,align:t,sideOffset:o,className:S("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),...a})}));zo.displayName=Gt.Content.displayName;var ho=Ce(require("@radix-ui/react-checkbox")),ps=Ce(require("react")),bo=ps.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ho.Root,{className:S("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:o,...t,children:(0,ci.jsx)(ho.Indicator,{className:S("flex items-center justify-center text-current"),children:(0,ci.jsx)(Pt.Check,{className:"h-4 w-4"})})}));bo.displayName=ho.Root.displayName;var us=require("react-day-picker");function $o({className:e,classNames:t,showOutsideDays:o=!0,...a}){return(0,ci.jsx)(us.DayPicker,{showOutsideDays:o,weekStartsOn:1,className:S("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 ci-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:S(ro({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 ci-2",cell:S("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",a.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:S(ro({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},...a})}$o.displayName="Calendar";var Dr=1;function Tl(){return(0,ci.jsx)("span",{className:"border border-[#222222]"})}function Tr(){let[e]=(0,fs.useLexicalComposerContext)(),t=(0,jt.useRef)(null),[o,a]=(0,jt.useState)(!1),[r,i]=(0,jt.useState)(!1),[c,s]=(0,jt.useState)(!1),[m,n]=(0,jt.useState)(!1),[l,d]=(0,jt.useState)(!1),[g,w]=(0,jt.useState)(!1),[b,y]=(0,jt.useState)(!1),[p,C]=(0,jt.useState)(!1),[N,h]=(0,jt.useState)(!1),[R,te]=(0,jt.useState)("left"),[D,H]=(0,jt.useState)("p"),P=z=>{e.update(()=>{let ue=(0,Ne.$getSelection)();(0,Ne.$isRangeSelection)(ue)&&(z==="p"?(0,kr.$setBlocksType)(ue,()=>(0,Ne.$createParagraphNode)()):(0,kr.$setBlocksType)(ue,()=>(0,Ds.$createHeadingNode)(z)))})},K=(0,jt.useCallback)(()=>{let z=(0,Ne.$getSelection)();if((0,Ne.$isRangeSelection)(z)){s(z.hasFormat("bold")),n(z.hasFormat("italic")),d(z.hasFormat("underline")),w(z.hasFormat("strikethrough")),y(z.hasFormat("subscript")),C(z.hasFormat("superscript"));let ue=z.anchor.getNode(),Ae=ue;for(;Ae&&!(0,Ne.$isParagraphNode)(Ae)&&Ae!==(0,Ne.$getRoot)();){let lt=Ae.getParent();lt&&(Ae=lt)}if(Ae){let lt=Ae.getFormatType();te(lt||"left")}let ht=ue.getTopLevelElement()?.__tag;H(ht||"p")}},[]);(0,jt.useEffect)(()=>(0,vs.mergeRegister)(e.registerUpdateListener(({editorState:z})=>{z.read(()=>{K()})}),e.registerCommand(Ne.SELECTION_CHANGE_COMMAND,(z,ue)=>(K(),!1),Dr),e.registerCommand(Ne.CAN_UNDO_COMMAND,z=>(a(z),!1),Dr),e.registerCommand(Ne.CAN_REDO_COMMAND,z=>(i(z),!1),Dr)),[e,K]);let J=[[{label:"Undo",icon:(0,ci.jsx)(Pt.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ne.UNDO_COMMAND,void 0)},disabled:!o},{label:"Redo",icon:(0,ci.jsx)(Pt.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ne.UNDO_COMMAND,void 0)},disabled:!r}],[{label:"Bold",icon:(0,ci.jsx)(qi,{}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:c},{label:"Italic",icon:(0,ci.jsx)(Zi,{}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:m},{label:"Underline",icon:(0,ci.jsx)(Ji,{}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:l},{label:"Strikethrough",icon:(0,ci.jsx)(Xi,{}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:g},{label:"Subscript",icon:(0,ci.jsx)(Yi,{}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:b},{label:"Superscript",icon:(0,ci.jsx)(Qi,{}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:p}]],L=[{label:"Left Align",direction:"left",icon:(0,ci.jsx)(Pt.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,ci.jsx)(Pt.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,ci.jsx)(Pt.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,ci.jsx)(Pt.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_ELEMENT_COMMAND,"justify")}}],Re=[{label:"Normal Text",value:"p",icon:(0,ci.jsx)(es,{}),onClick:()=>P("p")},{label:"Heading 1",value:"h1",icon:(0,ci.jsx)(ts,{}),onClick:()=>P("h1")},{label:"Heading 2",value:"h2",icon:(0,ci.jsx)(as,{}),onClick:()=>P("h2")},{label:"Heading 3",value:"h3",icon:(0,ci.jsx)(os,{}),onClick:()=>P("h3")},{label:"Heading 4",value:"h4",icon:(0,ci.jsx)(rs,{}),onClick:()=>P("h4")},...[{label:"Unordered List",value:"ul",icon:(0,ci.jsx)(Pt.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(_o.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,ci.jsx)(Pt.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(_o.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],xe=[{label:"Insert Image",icon:(0,ci.jsx)(Pt.ImageUp,{width:15,height:15}),onClick:()=>{h(!0)},disabled:!1}];return(0,ci.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2",children:(0,ci.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[J.map((z,ue)=>(0,ci.jsxs)(jt.Fragment,{children:[(0,ci.jsx)("div",{className:"flex items-center gap-2",children:z.map((Ae,ht)=>(0,ci.jsx)("div",{role:"button","aria-disabled":Ae.disabled||!1,onClick:Ae.onClick,className:S("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]",Ae.active&&"bg-[#3c3c3c]"),"aria-label":Ae.label,children:(0,ci.jsx)(hr,{children:(0,ci.jsxs)(br,{children:[(0,ci.jsx)(xr,{className:"text-[#b5b5b5]",children:Ae.icon}),(0,ci.jsx)(jo,{children:(0,ci.jsx)("p",{children:Ae.label})})]})})},ht))}),(0,ci.jsx)(Tl,{})]},`toolbar-option-${z.length}-${ue}`)),(0,ci.jsxs)(ga,{children:[(0,ci.jsxs)(fa,{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:[L.find(z=>z.direction===R)?.icon,L.find(z=>z.direction===R)?.label,(0,ci.jsx)(Pt.ChevronDown,{width:15,height:15})]}),(0,ci.jsx)(Xt,{className:"bg-black hover:bg-black",children:L.map((z,ue)=>(0,ci.jsxs)(Ot,{onClick:z.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,ci.jsx)("span",{children:z.icon}),(0,ci.jsx)("span",{children:z.label})]},`${z.label}-${ue}`))})]}),(0,ci.jsxs)(ga,{children:[(0,ci.jsxs)(fa,{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:[Re.find(z=>z.value===D)?.icon,Re.find(z=>z.value===D)?.label,(0,ci.jsx)(Pt.ChevronDown,{width:15,height:15})]}),(0,ci.jsx)(Xt,{className:"bg-black hover:bg-black",children:Re.map((z,ue)=>(0,ci.jsxs)(Ot,{onClick:z.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,ci.jsx)("span",{children:z.icon}),(0,ci.jsx)("span",{children:z.label})]},`heading-option-${z.label}-${ue}`))})]})]})})}var Pl=({setValue:e,value:t,name:o,editable:a=!0})=>{let[r]=(0,fs.useLexicalComposerContext)(),i=c=>{c.read(()=>{let s=c.toJSON();e?.(()=>s)})};return(0,jt.useEffect)(()=>{r.setEditable(a)},[a]),(0,jt.useEffect)(()=>{t&&r.update(()=>{r.setEditorState(r.parseEditorState(t))})},[]),(0,ci.jsx)("div",{className:"w-full",children:(0,ci.jsxs)("div",{className:" ",children:[a&&(0,ci.jsx)(Tr,{}),(0,ci.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,ci.jsx)(Ns.RichTextPlugin,{contentEditable:(0,ci.jsx)(ys.ContentEditable,{name:o,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-h-40"}),ErrorBoundary:ws.LexicalErrorBoundary}),a&&(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(Cs.HistoryPlugin,{}),(0,ci.jsx)(bs.AutoFocusPlugin,{}),(0,ci.jsx)(Ss.ListPlugin,{}),(0,ci.jsx)(ks.OnChangePlugin,{onChange:i})]})]})]})})},Rl=({setValue:e,value:t,name:o,editable:a=!0})=>(0,ci.jsx)(xs.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[_o.ListNode,_o.ListItemNode,Ds.HeadingNode],onError(i){throw console.error("Lexical error:",i),i},theme:{code:"editor-code",heading:{h1:"text-4xl",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,ci.jsx)(Pl,{value:t,setValue:e,name:o,editable:a})}),Wo=Rl;function Rs({document:e,onSave:t,mode:o="edit",onCancel:a,availableDocuments:r=[],knowledgeContexts:i=[]}){let[c,s]=(0,jt.useState)({...e,updatedAt:new Date}),[m,n]=(0,jt.useState)(c.richTextContent);(0,jt.useEffect)(()=>{s(e)},[e]);let l=()=>{let N=new Set,h=new Set;return i.forEach(R=>{R.menuConfig.groupBy.forEach(te=>N.add(te))}),r.forEach(R=>{R.metadata&&Object.keys(R.metadata).forEach(te=>h.add(te))}),{contextKeys:Array.from(N).sort(),documentKeys:Array.from(h).sort(),allKeys:Array.from(new Set([...N,...h])).sort()}},d=N=>{let h=new Set;return r.forEach(R=>{R.metadata?.[N]&&h.add(String(R.metadata[N]))}),Array.from(h).sort()},g=l(),w=()=>{t({...c,richTextContent:m})},b=(N,h)=>{s(R=>({...R,metadata:{...R.metadata,[N]:h}}))},y=(N,h)=>{h==="__custom__"?b(N,""):b(N,h)},p=()=>{b("","")},C=N=>{s(h=>{let R={...h.metadata};return delete R[N],{...h,metadata:R}})};return(0,ci.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,ci.jsxs)("div",{className:"border-b border-border bg-card p-8",children:[(0,ci.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-6",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ci.jsx)("div",{className:"flex-shrink-0 p-3 rounded-xl bg-primary/10 border border-primary/20",children:(0,ci.jsx)(Pt.Edit3,{className:"h-6 w-6 text-primary"})}),(0,ci.jsx)("h1",{className:"text-2xl font-bold text-foreground",children:o==="edit"?"Edit Document":"Create Document"})]}),(0,ci.jsxs)("div",{className:"flex gap-2",children:[(0,ci.jsxs)(x,{variant:"outline",size:"sm",onClick:a,className:"gap-2",children:[(0,ci.jsx)(Pt.X,{className:"h-4 w-4"}),"Cancel"]}),(0,ci.jsxs)(x,{size:"sm",onClick:w,className:"gap-2",children:[(0,ci.jsx)(Pt.Save,{className:"h-4 w-4"}),"Save Changes"]})]})]}),(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Title"}),(0,ci.jsx)(O,{value:c.title,onChange:N=>s(h=>({...h,title:N.target.value})),className:"text-lg font-semibold",placeholder:"Document title..."})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Description"}),(0,ci.jsx)(Te,{value:c.description||"",onChange:N=>s(h=>({...h,description:N.target.value})),placeholder:"Document description...",rows:2})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("label",{className:"block text-sm font-medium text-foreground",children:"Metadata"}),g.contextKeys.length>0&&(0,ci.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Suggested: ",g.contextKeys.slice(0,4).join(", "),g.contextKeys.length>4&&` +${g.contextKeys.length-4}`]})]}),(0,ci.jsxs)(x,{type:"button",variant:"outline",size:"sm",onClick:p,className:"gap-1 h-8",children:[(0,ci.jsx)(Pt.Plus,{className:"h-3 w-3"}),"Add"]})]}),c.metadata&&Object.keys(c.metadata).length>0?(0,ci.jsx)("div",{className:"space-y-2",children:Object.entries(c.metadata).map(([N,h],R)=>{let te=d(N);return(0,ci.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ci.jsx)(O,{value:N,onChange:D=>{let H=D.target.value||"",P=c.metadata?.[N];s(K=>{let J={...K.metadata};return delete J[N],H&&(J[H]=P||""),{...K,metadata:J}})},placeholder:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${N}`}),(0,ci.jsx)("datalist",{id:`metadata-keys-${N}`,children:g.allKeys.map(D=>(0,ci.jsx)("option",{value:D},D))}),(0,ci.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),te.length>0?(0,ci.jsxs)(Be,{value:String(h||""),onValueChange:D=>y(N,D),children:[(0,ci.jsx)(Ee,{className:"flex-1 h-8 text-sm",children:(0,ci.jsx)(Je,{placeholder:"Value"})}),(0,ci.jsxs)(Me,{children:[te.map(D=>(0,ci.jsx)(ne,{value:D,children:D},D)),(0,ci.jsx)(ne,{value:"__custom__",children:(0,ci.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,ci.jsx)(O,{value:String(h||""),onChange:D=>b(N,D.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,ci.jsx)(x,{type:"button",variant:"ghost",size:"sm",onClick:()=>C(N),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,ci.jsx)(Pt.X,{className:"h-3 w-3"})})]},`metadata-key-${R}`)})}):(0,ci.jsx)("div",{className:"text-center py-3 border border-dashed border-border rounded-lg bg-muted/20",children:(0,ci.jsx)("p",{className:"text-xs text-muted-foreground",children:'jt metadata \u2022 Click "Add" to create fields'})})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Format"}),(0,ci.jsxs)(Be,{value:c.format,onValueChange:N=>s(h=>({...h,format:N})),children:[(0,ci.jsx)(Ee,{className:"flex-1 h-8 text-sm",children:(0,ci.jsx)(Je,{placeholder:"Format"})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)(ne,{value:"markdown",children:"Markdown"}),(0,ci.jsx)(ne,{value:"richText",children:"Rich Text"})]})]})]})]})]}),(0,ci.jsx)("div",{className:"flex-1 overflow-auto",children:(0,ci.jsxs)("div",{className:"p-8",children:[(0,ci.jsx)("label",{className:"block text-sm font-medium text-foreground mb-4",children:"Content"}),c.format==="richText"?(0,ci.jsx)(Wo,{setValue:n,value:m,name:"richTextContent"}):(0,ci.jsx)(Te,{value:c.content||"",onChange:N=>s(h=>({...h,content:N.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})]})})]})}var Ms=Ce(require("react-markdown")),Is=Ce(require("remark-gfm"));var Fs=e=>(0,$.jsx)(Ms.default,{remarkPlugins:[Is.default],components:{h1:({children:t})=>(0,$.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,$.jsx)("h2",{className:"text-xl font-bold",children:t}),h3:({children:t})=>(0,$.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,$.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,$.jsx)("ol",{className:"list-decimal",children:t}),ul:({children:t})=>(0,$.jsx)("ul",{className:"list-disc",children:t}),li:({children:t})=>(0,$.jsx)("li",{className:"ml-4",children:t}),p:({children:t})=>(0,$.jsx)("p",{className:"mb-4",children:t}),a:({children:t,href:o})=>(0,$.jsx)("a",{href:o,className:"text-blue-500",children:t}),img:({src:t,alt:o})=>(0,$.jsx)("img",{src:t,alt:o,className:"mb-4"}),blockquote:({children:t})=>(0,$.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),As=e=>(0,$.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),Al=e=>(0,$.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:e&&(0,$.jsx)(Wo,{value:JSON.stringify(e),editable:!1,name:"richTextContent"})}),El=e=>(0,$.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,$.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,$.jsxs)("p",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,$.jsx)("strong",{children:"MDX Renderer:"})," This is a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),Fs(e)]});function Bs({document:e,onDocumentUpdate:t,editable:o=!0,mode:a="view",renderers:r,availableDocuments:i=[],knowledgeContexts:c=[]}){let[s,m]=(0,jt.useState)(!1),[n,l]=(0,jt.useState)(e);(0,jt.useEffect)(()=>{l(e)},[e]);let d=p=>{switch(p){case"markdown":case"mdx":return(0,$.jsx)(Pt.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,$.jsx)(Pt.File,{className:"h-6 w-6 text-success"});case"text":return(0,$.jsx)(Pt.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,$.jsx)(Pt.File,{className:"h-6 w-6 text-muted-foreground"})}},g=p=>{switch(p){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},w=(p,C)=>{let N={markdown:Fs,mdx:El,text:As},h=r?.[C]||N[C];if(C==="richText"&&typeof p=="object")return Al(p);if(h&&typeof p=="string")return h(p);if(typeof p=="string")return As(p)},b=p=>{m(!1),t?.(p),l(p)},y=()=>{m(!1)};return s||a==="create"?(0,$.jsx)(Rs,{mode:a==="create"?"create":"edit",document:n,onSave:b,onCancel:y,availableDocuments:i,knowledgeContexts:c}):(0,$.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,$.jsxs)("div",{className:"border-b border-border bg-card p-8",children:[(0,$.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,$.jsxs)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:[(0,$.jsx)("div",{className:"flex-shrink-0 p-3 rounded-xl bg-muted border border-border",children:d(n.format)}),(0,$.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,$.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:n.title}),n.description&&(0,$.jsx)("p",{className:"text-muted-foreground text-lg leading-relaxed mb-4",children:n.description})]})]}),o&&(0,$.jsx)("div",{className:"flex-shrink-0",children:(0,$.jsxs)(x,{variant:"outline",size:"sm",onClick:()=>m(!0),className:"gap-2",children:[(0,$.jsx)(Pt.Edit3,{className:"h-4 w-4"}),"Edit"]})})]}),(0,$.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,$.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${g(n.format)}`,children:n.format.toUpperCase()}),n.tags?.map(p=>(0,$.jsxs)("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm bg-muted text-muted-foreground border border-border",children:["#",p]},p))]})]}),(0,$.jsx)("div",{className:"flex-1 overflow-auto",children:(0,$.jsxs)("div",{className:"p-8",children:[n.metadata&&Object.keys(n.metadata).length>0&&(0,$.jsxs)("div",{className:"mb-6",children:[(0,$.jsx)("h3",{className:"text-sm font-semibold text-foreground mb-2",children:"Metadata"}),(0,$.jsx)("div",{className:"bg-muted rounded-lg p-3 border border-border",children:(0,$.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-x-4 gap-y-1 text-xs",children:Object.entries(n.metadata).map(([p,C])=>(0,$.jsxs)("div",{className:"flex gap-1",children:[(0,$.jsxs)("span",{className:"text-muted-foreground font-medium",children:[p.replace(/([A-Z])/g," $1").trim(),":"]}),(0,$.jsx)("span",{className:"text-foreground truncate",children:String(C)})]},p))})})]}),(0,$.jsx)("div",{className:"space-y-4",children:n.content||n.richTextContent?(0,$.jsx)("div",{className:"relative",children:(0,$.jsx)("div",{className:"bg-card border border-border rounded-xl p-6 overflow-hidden",children:w(n.format==="richText"?n.richTextContent:n.content,n.format)})}):(0,$.jsxs)("div",{className:"text-center py-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,$.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,$.jsx)(Pt.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,$.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"jt content available"}),(0,$.jsx)("p",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})]})})]})}function Rr({label:e,documents:t,children:o,level:a,onDocumentClick:r,selectedDocumentId:i,showDocumentCount:c=!0}){let[s,m]=(0,jt.useState)(a===0),n=o&&Object.keys(o).length>0,l=t.length+(o?Object.values(o).reduce((w,b)=>w+b.documents.length,0):0),d=w=>{switch(w){case"markdown":case"mdx":return(0,ci.jsx)(Pt.FileText,{className:"h-3.5 w-3.5 text-muted-foreground"});case"richText":return(0,ci.jsx)(Pt.File,{className:"h-3.5 w-3.5 text-muted-foreground"});default:return(0,ci.jsx)(Pt.File,{className:"h-3.5 w-3.5 text-muted-foreground"})}},g=w=>{let b=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return b[w%b.length]};return(0,ci.jsxs)("div",{className:"space-y-1",children:[(n||t.length>0)&&(0,ci.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:`${a*20}px`},onClick:()=>m(!s),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,ci.jsx)("div",{className:`w-1 h-6 rounded-full ${g(a)}`}),(0,ci.jsx)(ir.motion.div,{animate:{rotate:s?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,ci.jsx)(Pt.ChevronRight,{className:"h-4 w-4 text-muted-foreground"})}),(0,ci.jsxs)("div",{className:"flex-1 flex items-center justify-between min-w-0",children:[(0,ci.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,ci.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),c&&l>0&&(0,ci.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,ci.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,ci.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,ci.jsxs)("div",{className:"ci-2 space-y-1",children:[t.map((w,b)=>(0,ci.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 ${i===w.id?"bg-primary/10 border-l-2 border-primary shadow-sm":"hover:bg-muted/50 hover:translate-x-1"}`,style:{marginLeft:`${a*20+20}px`},onClick:()=>r?.(w),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,ci.jsx)("div",{className:"flex-shrink-0",children:d(w.format)}),(0,ci.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ci.jsx)("p",{className:`text-sm truncate transition-colors ${i===w.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:w.title}),w.description&&(0,ci.jsx)("p",{className:"text-xs text-muted-foreground truncate ci-0.5",children:w.description})]}),w.tags&&w.tags.length>0&&(0,ci.jsx)("div",{className:"flex-shrink-0",children:(0,ci.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:w.tags[0]})})]},w.id)),o&&Object.entries(o).map(([w,b])=>(0,ci.jsx)(Rr,{label:w,documents:b.documents,children:b.children,level:a+1,onDocumentClick:r,selectedDocumentId:i,showDocumentCount:c},w))]})})]})}function Ls({documents:e,menuConfig:t,onDocumentClick:o,onDocumentShare:a,onDocumentUpdate:r,selectedDocumentId:i,className:c,editable:s=!0}){let[m,n]=(0,jt.useState)(""),[l,d]=(0,jt.useState)(null),[g,w]=(0,jt.useState)(e);(0,jt.useEffect)(()=>{w(e)},[e]);let b=(0,jt.useMemo)(()=>m?g.filter(C=>C.title.toLowerCase().includes(m.toLowerCase())||C.description?.toLowerCase().includes(m.toLowerCase())||C.tags?.some(N=>N.toLowerCase().includes(m.toLowerCase()))||Object.values(C.metadata||{}).some(N=>String(N).toLowerCase().includes(m.toLowerCase()))):g,[g,m]),y=(0,jt.useMemo)(()=>{let C=(N,h)=>{if(h.length===0)return{};let[R,...te]=h;return N.reduce((H,P)=>{let K=P.metadata?.[R]||"Uncategorized",J=String(K);if(H[J]||(H[J]={documents:[],children:{}}),te.length===0)H[J].documents.push(P);else{let L=C([P],te),E=Object.keys(L)[0];E&&(H[J].children||(H[J].children={}),H[J].children[E]?H[J].children[E].documents.push(...L[E].documents):H[J].children[E]=L[E])}return H},{})};return C(b,t.groupBy)},[b,t.groupBy]),p=C=>{d(C),o?.(C)};return(0,ci.jsxs)("div",{className:`flex h-full ${c||""}`,children:[(0,ci.jsxs)("div",{className:"w-1/3 border-r border-border bg-muted/20",children:[(0,ci.jsx)("div",{className:"p-6 border-b border-border",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,ci.jsx)(Pt.Search,{className:"h-4 w-4 text-muted-foreground"})}),(0,ci.jsx)(O,{placeholder:"Search knowledge base...",value:m,onChange:C=>n(C.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,ci.jsx)(no,{className:"h-[calc(100%-100px)]",children:(0,ci.jsx)("div",{className:"p-4 space-y-3",children:t.groupBy.length===0?(0,ci.jsx)(ci.Fragment,{children:(0,ci.jsx)(Rr,{label:"Document",documents:b,level:0,onDocumentClick:p,selectedDocumentId:i,showDocumentCount:t.showDocumentCount},"Document")}):(0,ci.jsxs)(ci.Fragment,{children:[Object.entries(y).map(([C,N])=>(0,ci.jsx)(Rr,{label:C,documents:N.documents,children:N.children,level:0,onDocumentClick:p,selectedDocumentId:i,showDocumentCount:t.showDocumentCount},C)),Object.keys(y).length===0&&(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,ci.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,ci.jsx)(Pt.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,ci.jsx)("p",{className:"text-sm font-medium",children:"jt documents found"}),(0,ci.jsx)("p",{className:"text-xs ci-1",children:"Try adjusting your search terms"})]})]})})})]}),(0,ci.jsx)("div",{className:"flex-1 bg-background",children:l?(0,ci.jsx)(Bs,{document:l,onDocumentUpdate:r,editable:s}):(0,ci.jsx)("div",{className:"h-full flex items-center justify-center text-center",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-w-sm",children:[(0,ci.jsx)("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,ci.jsx)(Pt.FileText,{className:"h-10 w-10 text-primary"})}),(0,ci.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Select a document"}),(0,ci.jsx)("p",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}var Os=({isOpen:e,onClose:t,onAddKnowledge:o,knowledgeContexts:a})=>{let[r,i]=(0,jt.useState)({name:"",description:"",metadata:[]}),c=y=>{y.preventDefault(),r.name&&(o({name:r.name,description:r.description,metadata:r.metadata,source:"payload",visibility:"public",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),i({name:"",description:"",metadata:[]}),t())},s=()=>{i({name:"",description:"",metadata:[]}),t()},n=(()=>{let y=new Set,p=new Set;return a.forEach(C=>{C.menuConfig.groupBy.forEach(N=>y.add(N))}),{contextKeys:Array.from(y).sort(),documentKeys:Array.from(p).sort(),allKeys:Array.from(new Set([...y,...p])).sort()}})(),l=y=>{let p=new Set;return Array.from(p).sort()},d=(y,p)=>{i(C=>{let N=C.metadata.find(h=>h.key===y);return N&&(N.value=p),{...C,metadata:[...C.metadata.filter(h=>h.key!==y),{key:y,value:p}]}})},g=(y,p)=>{p==="__custom__"?d(y,""):d(y,p)},w=()=>{d(" ","")},b=y=>{i(p=>{let C=[...p.metadata],N=C.findIndex(h=>h.key===y);return N!==-1&&C.splice(N,1),{...p,metadata:C}})};return(0,ci.jsx)(Xe,{open:e,onOpenChange:s,children:(0,ci.jsxs)(_e,{className:"sm:max-w-md",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New Knowledge source"})}),(0,ci.jsxs)("form",{onSubmit:c,className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Name *"}),(0,ci.jsx)(O,{id:"name",value:r.name,onChange:y=>i(p=>({...p,name:y.target.value})),required:!0})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Description"}),(0,ci.jsx)(O,{id:"name",value:r.description,onChange:y=>i(p=>({...p,description:y.target.value})),required:!0})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"metadata",children:"Metadata"}),n.contextKeys.length>0&&(0,ci.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Suggested: ",n.contextKeys.slice(0,4).join(", "),n.contextKeys.length>4&&` +${n.contextKeys.length-4}`]})]}),(0,ci.jsxs)(x,{type:"button",variant:"outline",size:"sm",onClick:w,className:"gap-1 h-8",children:[(0,ci.jsx)(Pt.Plus,{className:"h-3 w-3"}),"Add"]})]}),r.metadata&&r.metadata.length>0?(0,ci.jsx)("div",{className:"space-y-2",children:r.metadata.map(({key:y,value:p},C)=>{let N=l(y);return(0,ci.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ci.jsx)(O,{value:y,onChange:h=>{let R=h.target.value||" ",te=r.metadata.find(D=>D.key===y)?.value;i(D=>{let H=[...D.metadata],P=H.findIndex(K=>K.key===y);return P!==-1&&H.splice(P,1),R&&H.push({key:R,value:te||""}),{...D,metadata:H}}),h.target.focus()},placeholder:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${y}`}),(0,ci.jsx)("datalist",{id:`metadata-keys-${y}`,children:n.allKeys.map(h=>(0,ci.jsx)("option",{value:h},h))}),(0,ci.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),N.length>0?(0,ci.jsxs)(Be,{value:String(p||""),onValueChange:h=>g(y,h),children:[(0,ci.jsx)(Ee,{className:"flex-1 h-8 text-sm",children:(0,ci.jsx)(Je,{placeholder:"Value"})}),(0,ci.jsxs)(Me,{children:[N.map(h=>(0,ci.jsx)(ne,{value:h,children:h},h)),(0,ci.jsx)(ne,{value:"__custom__",children:(0,ci.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,ci.jsx)(O,{value:String(p||""),onChange:h=>d(y,h.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,ci.jsx)(x,{type:"button",variant:"ghost",size:"sm",onClick:()=>b(y),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,ci.jsx)(Pt.X,{className:"h-3 w-3"})})]},`metadata-key-${C}`)})}):(0,ci.jsx)("div",{className:"text-center py-3 border border-dashed border-border rounded-lg bg-muted/20",children:(0,ci.jsx)("p",{className:"text-xs text-muted-foreground",children:'jt metadata \u2022 Click "Add" to create fields'})})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end gap-3 ci-4",children:[(0,ci.jsxs)(x,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,ci.jsx)(Pt.X,{className:"h-4 w-4"}),"Cancel"]}),(0,ci.jsxs)(x,{type:"submit",children:[(0,ci.jsx)(Pt.Save,{className:"h-4 w-4"}),"Create"]})]})]})]})})};var Vs=({isOpen:e,onClose:t,onAddTeamContext:o})=>{let[a,r]=(0,jt.useState)({label:"",description:"",groupBy:[],sortBy:"name",sortOrder:"asc",showDocumentCount:!0}),[i,c]=(0,jt.useState)(""),s=d=>{d.preventDefault(),console.log("formData",a),a.label&&(o({id:a.label,label:a.label,description:a.description,menuConfig:{groupBy:a.groupBy,sortBy:a.sortBy||null,sortOrder:a.sortOrder,showDocumentCount:a.showDocumentCount}}),r({label:"",description:"",groupBy:[],sortBy:"name",sortOrder:"asc",showDocumentCount:!0}))},m=()=>{r({label:"",description:"",groupBy:[],sortBy:"name",sortOrder:"asc",showDocumentCount:!0}),t()},n=[{value:"name",label:"Name"},{value:"createdAt",label:"Created Date"}],l=[{value:"asc",label:"Ascending"},{value:"desc",label:"Descending"}];return(0,ci.jsx)(Xe,{open:e,onOpenChange:m,children:(0,ci.jsxs)(_e,{className:"sm:max-w-md",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New Knowledge source"})}),(0,ci.jsxs)("form",{onSubmit:s,className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"label",children:"Label *"}),(0,ci.jsx)(O,{id:"label",value:a.label,onChange:d=>r(g=>({...g,label:d.target.value})),required:!0})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(O,{id:"description",value:a.description,onChange:d=>r(g=>({...g,description:d.target.value}))})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{children:"Group By"}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)("div",{className:"flex flex-wrap gap-2",children:a.groupBy.map(d=>(0,ci.jsxs)(me,{variant:"secondary",className:"px-2 py-1",children:[d,(0,ci.jsx)("button",{type:"button",className:"ml-1 inline-flex",onClick:()=>{r(g=>({...g,groupBy:g.groupBy.filter(w=>w!==d)}))},"aria-label":`Remove ${d}`,children:(0,ci.jsx)(Pt.X,{className:"h-3 w-3"})})]},d))}),(0,ci.jsxs)("div",{className:"flex gap-2",children:[(0,ci.jsx)(O,{placeholder:"Type a tag and press Enter",value:i,onChange:d=>c(d.target.value),onKeyDown:d=>{(d.key==="Enter"||d.key===",")&&(d.preventDefault(),r(g=>({...g,groupBy:[...g.groupBy,i]})),c(""))}}),(0,ci.jsx)(x,{type:"button",onClick:()=>{r(d=>({...d,groupBy:[...d.groupBy,i]})),c("")},children:"Add"})]})]})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"sortBy",children:"Sort By"}),(0,ci.jsxs)(Be,{value:a.sortBy,onValueChange:d=>r(g=>({...g,sortBy:d})),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{placeholder:"Select sort field"})}),(0,ci.jsx)(Me,{children:n.map(d=>(0,ci.jsx)(ne,{value:d.value,children:d.label},d.value))})]})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"sortOrder",children:"Sort Order"}),(0,ci.jsxs)(Be,{value:a.sortOrder,onValueChange:d=>r(g=>({...g,sortOrder:d})),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{placeholder:"Select sort order"})}),(0,ci.jsx)(Me,{children:l.map(d=>(0,ci.jsx)(ne,{value:d.value,children:d.label},d.value))})]})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(bo,{id:"showDocumentCount",checked:a.showDocumentCount,onCheckedChange:d=>r(g=>({...g,showDocumentCount:d}))}),(0,ci.jsx)(T,{htmlFor:"showDocumentCount",className:"text-sm",children:"Show Document Count"})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end gap-3 ci-4",children:[(0,ci.jsxs)(x,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,ci.jsx)(Pt.X,{className:"h-4 w-4"}),"Cancel"]}),(0,ci.jsxs)(x,{type:"submit",children:[(0,ci.jsx)(Pt.Save,{className:"h-4 w-4"}),"Create"]})]})]})]})})};function Er({documents:e=[],contexts:t=[],onDocumentClick:o=n=>console.log("Document clicked:",n),onDocumentShare:a=n=>console.log("Share document:",n),onLoadDocumentContent:r,selectedDocumentId:i,onAddKnowledge:c,onAddTeamContext:s,onDocumentUpdate:m}){let[n,l]=(0,jt.useState)(t[0]),[d,g]=(0,jt.useState)(!1),[w,b]=(0,jt.useState)(!1);(0,jt.useEffect)(()=>{!n&&t&&t.length>0&&l(t[0])},[t]);let y=C=>{c&&c(C),g(!1)},p=C=>{s&&s(C),b(!1)};return(0,ci.jsxs)("div",{className:"flex flex-col h-full max-h-[calc(100vh-8rem)]",children:[(0,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:[(0,ci.jsx)(gt,{title:"Knowledge",description:"Access, manage, and share all your team knowledge in one place.",gradient:"bg-gradient-to-r from-teal-600 via-cyan-600 to-blue-600",primaryAction:c?{label:"Create",onClick:()=>g(!0)}:void 0,secondaryAction:s?{label:"Add Context",onClick:()=>b(!0)}:void 0}),t&&t.length>0&&(0,ci.jsxs)("div",{className:"ci-6",children:[(0,ci.jsx)("div",{className:"border-b border-border",children:(0,ci.jsx)("nav",{className:"-mb-px flex space-x-8 overflow-x-auto",children:t.map(C=>(0,ci.jsxs)("button",{onClick:()=>l(C),className:`group inline-flex items-center gap-2 py-3 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${n?.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))})}),n?.description&&(0,ci.jsx)("div",{className:"ci-3 px-1",children:(0,ci.jsx)("p",{className:"text-sm text-muted-foreground",children:n?.description})})]})]}),n?(0,ci.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4",children:(0,ci.jsx)("div",{className:"h-full rounded-3xl border overflow-hidden",children:(0,ci.jsx)(Ls,{documents:e,menuConfig:n?.menuConfig,onDocumentClick:o,onDocumentShare:a,selectedDocumentId:i,onDocumentUpdate:m})})}):(0,ci.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,ci.jsx)("p",{className:"text-muted-foreground",children:"jt contexts available"})}),(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(Vs,{isOpen:w,onClose:()=>b(!1),onAddTeamContext:p}),(0,ci.jsx)(Os,{isOpen:d,onClose:()=>g(!1),onAddKnowledge:y,knowledgeContexts:t})]})]})}var Ml=[{key:"kanban",icon:Pt.Kanban,label:"Kanban",color:"bg-primary",title:"Kanban View"},{key:"planning",icon:Pt.Calendar,label:"Planning",color:"bg-brand-plum",title:"Planning View",hiddenOnMobile:!0},{key:"epics",icon:Pt.Target,label:"Epics",color:"bg-brand-orange",title:"Epic Planning"},{key:"files",icon:Pt.FileText,label:"Files",color:"bg-brand-green",title:"Files"},{key:"tasks",icon:Pt.Calendar,label:"Tasks",color:"bg-brand-cyan",title:"Tasks"}],js=({currentView:e,onViewChange:t,children:o})=>(0,ci.jsxs)("div",{className:"flex w-full h-screen",children:[(0,ci.jsx)("div",{className:"w-12 h-full bg-sidebar-background flex flex-col flex-shrink-0",children:Ml.map(a=>{let r=a.icon,i=e===a.key;return(0,ci.jsxs)("button",{onClick:()=>t(a.key),className:`flex-1 w-12 flex items-center justify-center text-sidebar-foreground transition-all duration-200 relative overflow-hidden group/btn ${i?a.color:`${a.color}/75 hover:${a.color}`} ${a.hiddenOnMobile?"hidden md:flex":""} hover:w-28 hover:justify-start hover:pl-3`,title:a.title,children:[(0,ci.jsx)(r,{className:"h-4 w-4 flex-shrink-0"}),(0,ci.jsx)("span",{className:"text-xs font-medium whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity duration-200 absolute left-8",children:a.label})]},a.key)})}),(0,ci.jsx)("div",{className:"flex-1 min-w-0 px-4 md:px-6 h-full overflow-auto",children:(0,ci.jsx)("div",{className:"w-full h-full",children:o})})]});var Ie=Ce(require("react"));var Ks=({title:e,status:t,taskCount:o,children:a,onDrop:r,isCompact:i=!1,height:c})=>{let s=l=>{l.preventDefault()},m=l=>{l.preventDefault(),r(t)};return(0,ci.jsxs)(U,{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 ${i?"lg:max-w-xs":""}`,style:{height:c||"calc(100vh - 350px)"},onDragOver:s,onDrop:m,children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,ci.jsx)("h3",{className:`font-semibold text-foreground select-none-important ${i?"text-base":"text-lg"}`,children:e}),(0,ci.jsx)(me,{variant:"secondary",className:"bg-muted text-muted-foreground",children:o})]}),(0,ci.jsx)("div",{className:"flex-1 overflow-y-auto space-y-4 min-h-0",children:a})]})};var Co=({task:e,epic:t,onDragStart:o,onTaskClick:a,isCompact:r=!1})=>{let i=l=>{o(e)},c=()=>{a(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,ci.jsx)(Pt.BookOpen,{className:"h-3 w-3"});case"bug":return(0,ci.jsx)(Pt.Bug,{className:"h-3 w-3"});case"spike":return(0,ci.jsx)(Pt.Zap,{className:"h-3 w-3"});case"task":default:return(0,ci.jsx)(Pt.AlertCircle,{className:"h-3 w-3"})}},n=()=>{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 r?(0,ci.jsx)(U,{className:"p-3 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-sm",draggable:!0,onDragStart:i,onClick:c,children:(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("div",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ${n()}`,children:m()}),(0,ci.jsx)("h4",{className:"font-medium text-foreground text-sm mb-1 line-clamp-2 select-none-important",children:e.name})]})}):(0,ci.jsxs)(U,{className:"p-4 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-md",draggable:!0,onDragStart:i,onClick:c,children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ci.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-sm font-medium ${n()}`,children:[m(),(0,ci.jsx)("span",{className:"capitalize",children:e.type})]}),(0,ci.jsxs)("div",{className:"flex gap-1",children:[(0,ci.jsx)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-xs font-medium ${s()}`,children:e.priority}),(0,ci.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,ci.jsx)("h4",{className:"font-semibold text-foreground mb-2 select-none-important",children:e.name}),(0,ci.jsx)("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2 select-none-important",children:e.description}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ci.jsx)(Pt.User,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:e.assignee?.value?.name})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:new Date(e.createdAt).toLocaleDateString()})]})]})]})};var Il=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:Pt.BookOpen},{value:"task",label:"Task",color:"bg-secondary/20 text-secondary-foreground",icon:Pt.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:Pt.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:Pt.Zap}],Fl=[{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"}],Wa=({isOpen:e,onClose:t,onAddTask:o,epics:a,sprints:r,assignees:i,defaultEpicId:c})=>{let[s,m]=(0,jt.useState)({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:"",sprint:"none",assignee:""});(0,jt.useEffect)(()=>{e&&c&&m(d=>({...d,epic:c}))},[e,c]),(0,jt.useEffect)(()=>{e&&m({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:c||"",sprint:"none",assignee:""})},[e]);let n=d=>{d.preventDefault(),s.name.trim()&&(o({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:c||"",sprint:"",assignee:""}),t())},l=(d,g)=>{m(w=>({...w,[d]:g}))};return(0,ci.jsx)(Xe,{open:e,onOpenChange:t,children:(0,ci.jsxs)(_e,{className:"sm:max-w-md",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New Task"})}),(0,ci.jsxs)("form",{onSubmit:n,className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Task Title"}),(0,ci.jsx)(O,{id:"name",value:s.name,onChange:d=>l("name",d.target.value),placeholder:"Enter task title",required:!0})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Te,{id:"description",value:s.description,onChange:d=>l("description",d.target.value),placeholder:"Enter task description",rows:3})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Type"}),(0,ci.jsx)(Pa,{type:"single",value:s.type||"",onValueChange:d=>d&&l("type",d),children:Il.map(d=>{let g=d.icon;return(0,ci.jsxs)(Ra,{value:d.value,className:"flex items-center gap-2 data-[state=ir]:bg-primary data-[state=ir]:text-primary-foreground",children:[(0,ci.jsx)(g,{className:"h-4 w-4"}),d.label]},d.value)})})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Priority"}),(0,ci.jsx)(Pa,{type:"single",value:s.priority||"",onValueChange:d=>d&&l("priority",d),children:Fl.map(d=>(0,ci.jsx)(Ra,{value:d.value,className:"data-[state=ir]:bg-primary data-[state=ir]:text-primary-foreground",children:d.label},d.value))})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"points",children:"Story Points"}),(0,ci.jsx)(O,{id:"points",type:"number",min:"1",max:"100",value:s.storyPoints,onChange:d=>l("storyPoints",parseInt(d.target.value)||1),placeholder:"Enter story points",required:!0})]}),!c&&(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"epic",children:"Epic"}),(0,ci.jsxs)(Be,{value:s.epic,onValueChange:d=>l("epic",d),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{placeholder:"Select an epic"})}),(0,ci.jsx)(Me,{children:a.map(d=>(0,ci.jsx)(ne,{value:d.id.toString(),children:(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${d.color}`}),d.name]})},d.id))})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"sprint",children:"Sprint (Optional)"}),(0,ci.jsxs)(Be,{value:s.sprint,onValueChange:d=>l("sprint",d),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{placeholder:"Select a sprint"})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)(ne,{value:"none",children:"jt Sprint"}),r.map(d=>(0,ci.jsx)(ne,{value:d.id.toString(),children:(0,ci.jsx)("div",{className:"flex items-center gap-2",children:d.name})},d.id))]})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"sprint",children:"Assignee"}),(0,ci.jsxs)(Be,{value:s.assignee,onValueChange:d=>l("assignee",d),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{placeholder:"Select an Assignee"})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)(ne,{value:"none",children:"jt Assignee"}),i.map(d=>(0,ci.jsx)(ne,{value:d.id.toString(),children:(0,ci.jsx)("div",{className:"flex items-center gap-2",children:d.name})},d.id))]})]})]}),(0,ci.jsxs)(Ua,{children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,ci.jsx)(x,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Task"})]})]})]})})};var Ir=({fieldName:e,value:t,label:o,multiline:a=!1,onSave:r,className:i="",disabled:c=!1})=>{let[s,m]=(0,jt.useState)(!1),[n,l]=(0,jt.useState)(""),d=()=>{c||(m(!0),l(t))},g=async()=>{n!==t&&await r(e,n),m(!1)},w=b=>{b.key==="Enter"&&!a||b.key==="Enter"&&b.ctrlKey&&a?g():b.key==="Escape"&&(m(!1),l(""))};return(0,ci.jsxs)("div",{className:`space-y-2 ${i}`,children:[(0,ci.jsx)(T,{children:o}),s?a?(0,ci.jsx)(Te,{value:n,onChange:b=>l(b.target.value),onBlur:g,onKeyDown:w,autoFocus:!0,rows:4,className:"resize-none"}):(0,ci.jsx)(O,{value:n,onChange:b=>l(b.target.value),onBlur:g,onKeyPress:w,autoFocus:!0,className:"text-lg font-medium"}):(0,ci.jsxs)("div",{onClick:d,className:`${c?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted/50 p-2 rounded border border-transparent hover:border-border transition-colors group ${a?"min-h-[100px]":"min-h-[40px]"} flex items-start gap-2`,children:[(0,ci.jsx)("span",{className:a?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click to edit..."}),!c&&(0,ci.jsx)(Pt.Edit,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var $s=({comments:e,onAddComment:t})=>{let[o,a]=(0,jt.useState)(""),r=c=>c.split(" ").map(s=>s[0]).join("").toUpperCase(),i=()=>{o.trim()&&(t(o),a(""))};return(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.MessageSquare,{className:"h-5 w-5"}),(0,ci.jsx)(T,{className:"text-lg font-medium",children:"Comments"}),(0,ci.jsx)(me,{variant:"secondary",children:e.length})]}),(0,ci.jsx)("div",{className:"space-y-4 max-h-60 overflow-y-auto",children:e.map(c=>(0,ci.jsxs)("div",{className:"flex gap-3 p-3 bg-muted/50 rounded-lg",children:[(0,ci.jsx)(Qt,{className:"h-8 w-8 ci-1",children:(0,ci.jsx)(ea,{className:"text-xs bg-muted text-muted-foreground",children:r(c.author)})}),(0,ci.jsxs)("div",{className:"flex-1",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,ci.jsx)("span",{className:"font-medium text-sm",children:c.author}),(0,ci.jsxs)("span",{className:"text-xs text-muted-foreground",children:[c.createdAt.toLocaleDateString()," ci ",c.createdAt.toLocaleTimeString()]})]}),(0,ci.jsx)("p",{className:"text-sm text-muted-foreground",children:c.text})]})]},c.id))}),(0,ci.jsxs)("div",{className:"flex gap-2",children:[(0,ci.jsx)(Te,{value:o,onChange:c=>a(c.target.value),placeholder:"Add a comment...",rows:2,className:"flex-1 resize-none"}),(0,ci.jsx)(x,{onClick:i,disabled:!o.trim(),size:"sm",className:"self-end",children:(0,ci.jsx)(Pt.Send,{className:"h-4 w-4"})})]})]})};var Zo=({label:e,value:t,onValueChange:o,options:a,showColor:r=!1,disabled:i=!1})=>{let[c,s]=(0,jt.useState)(!1),m=a.find(l=>l.value===t);return(0,ci.jsxs)("div",{className:"space-y-1",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:e}),(0,ci.jsxs)(Be,{value:t,onValueChange:o,open:c,onOpenChange:l=>{i||s(l)},disabled:i,children:[(0,ci.jsx)(Ee,{className:"h-auto p-0 border-none bg-transparent hover:bg-muted/50 rounded-md",children:(0,ci.jsxs)(me,{variant:"secondary",className:`${i?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!i&&s(!c),children:[r&&m?.color&&(0,ci.jsx)("div",{className:`w-2 h-2 rounded-full ${m.color} mr-1`}),m?.label||"Select..."]})}),(0,ci.jsx)(Me,{children:a.map(l=>(0,ci.jsx)(ne,{value:l.value,children:r&&l.color?(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${l.color}`}),l.label]}):l.label},l.value))})]})]})};var _s=({label:e,value:t,onValueChange:o,options:a,placeholder:r="Search...",allowCustomValue:i=!1,disabled:c=!1})=>{let[s,m]=(0,jt.useState)(!1),[n,l]=(0,jt.useState)(""),d=a.find(p=>p.value===t),g=a.filter(p=>p.label.toLowerCase().includes(n.toLowerCase())),w=p=>{o(p),m(!1),l("")},b=()=>{i&&n.trim()&&!a.find(p=>p.value===n.trim())&&(o(n.trim()),m(!1),l(""))};return(0,ci.jsxs)("div",{className:"space-y-1",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:e}),(0,ci.jsxs)(Be,{value:t,onValueChange:w,open:s,onOpenChange:p=>{c||m(p)},disabled:c,children:[(0,ci.jsx)(Ee,{className:"h-auto p-0 border-none bg-transparent hover:bg-muted/50 rounded-md",children:(0,ci.jsx)(me,{variant:"secondary",className:`${c?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!c&&m(!s),children:d?.label||t||"Select..."})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)("div",{className:"p-2",children:(0,ci.jsx)(O,{placeholder:r,value:n,onChange:p=>l(p.target.value),onKeyDown:p=>{p.key==="Enter"&&i&&b()},className:"mb-2"})}),g.map(p=>(0,ci.jsx)(ne,{value:p.value,children:p.label},p.value)),i&&n.trim()&&!g.find(p=>p.value===n.trim())&&(0,ci.jsxs)(ne,{value:n.trim(),children:['Add "',n.trim(),'"']})]})]})]})};var ot=e=>e?typeof e=="number"?e:typeof e=="object"&&e&&"id"in e?e.id:0:0;var Bl=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:Pt.BookOpen},{value:"task",label:"Task",color:"bg-muted text-muted-foreground",icon:Pt.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:Pt.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:Pt.Zap}],Ll=[{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 Ws=({task:e,epics:t,sprints:o,lastUpdated:a,onUpdateTask:r,onClose:i,onDelete:c,isUpdating:s=!1,isDeleting:m=!1,deleteState:n="idle",teamMembers:l})=>{let[d,g]=(0,jt.useState)(e.storyPoints),w=(0,jt.useRef)(null),[b,y]=(0,jt.useState)(l);(0,jt.useEffect)(()=>{y(l)},[l]);let p=(0,jt.useCallback)((h,R)=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{r(h,R)},500)},[r]);(0,jt.useEffect)(()=>{p("storyPoints",d?.toString()||"1")},[d]);let C=h=>h.split(" ").map(R=>R[0]).join("").toUpperCase(),N=()=>n==="loading"?(0,ci.jsxs)(x,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,ci.jsx)(Pt.Loader2,{className:"h-3 w-3 animate-spin"}),"Deleting..."]}):n==="success"?(0,ci.jsxs)(x,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,ci.jsx)(Pt.Check,{className:"h-3 w-3"}),"Deleted"]}):n==="error"?(0,ci.jsxs)(x,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,ci.jsx)(Pt.X,{className:"h-3 w-3"}),"Delete failed"]}):(0,ci.jsxs)(x,{onClick:c,variant:"destructive",className:"w-full h-8 text-xs gap-1",disabled:s||m,children:[(0,ci.jsx)(Pt.Trash2,{className:"h-3 w-3"}),"Delete Task"]});return(0,ci.jsxs)("div",{className:"flex flex-col h-full",children:[(0,ci.jsxs)("div",{className:"space-y-4",style:{opacity:s?.6:1},children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Status"}),(0,ci.jsx)(Zo,{label:"",value:e.status,onValueChange:h=>r("status",h),options:[{value:"todo",label:"To Do"},{value:"in-progress",label:"In Progress"},{value:"done",label:"Done"}],disabled:s})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Type"}),(0,ci.jsx)(Pa,{type:"single",value:e.type||"",onValueChange:h=>h&&r("type",h),className:"grid grid-cols-2 gap-1",disabled:s,children:Bl.map(h=>{let R=h.icon;return(0,ci.jsxs)(Ra,{value:h.value,className:"flex items-center gap-1 text-xs h-8 data-[state=ir]:bg-primary data-[state=ir]:text-primary-foreground",size:"sm",disabled:s,children:[(0,ci.jsx)(R,{className:"h-3 w-3"}),h.label]},h.value)})})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Priority"}),(0,ci.jsx)(Pa,{type:"single",value:e.priority||"",onValueChange:h=>h&&r("priority",h),className:"grid grid-cols-3 gap-1",disabled:s,children:Ll.map(h=>(0,ci.jsx)(Ra,{value:h.value,className:"text-xs h-8 data-[state=ir]:bg-primary data-[state=ir]:text-primary-foreground",size:"sm",disabled:s,children:h.label},h.value))})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Story Points"}),(0,ci.jsx)("input",{type:"number",min:"1",max:"100",value:d||1,onChange:h=>{let R=Number(h.target.value);R<1?g(1):R>100?g(100):g(R)},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,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Epic"}),(0,ci.jsx)(Zo,{label:"",value:ot(e.epic).toString(),onValueChange:h=>r("epic",h),options:(t||[]).map(h=>({value:h.id.toString(),label:h?.name,color:h.color})),showColor:!0,disabled:s})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Sprint"}),(0,ci.jsx)(Zo,{label:"",value:ot(e.sprint).toString()||"none",onValueChange:h=>r("sprint",h==="none"?"":h),options:[{value:"none",label:"jt Sprint"},...(o||[]).map(h=>({value:h.id.toString(),label:`${h?.name}`}))],disabled:s})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Assignee"}),(0,ci.jsx)(_s,{label:"",value:e.assignee?.value?.name,onValueChange:h=>r("assignee",h),options:b.map(h=>({value:`${typeof h.email=="string"?"users":"digital-colleagues"}:${h.id}`,label:h?.name||""})),placeholder:"Search team members...",allowCustomValue:!0,disabled:s})]})]}),(0,ci.jsxs)("div",{className:"ci-auto ci-4 space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(x,{onClick:i,variant:"outline",className:"w-full h-8 text-xs",disabled:s||m,children:"Close"}),N()]}),(0,ci.jsxs)("div",{className:"ci-4 border-t border-border space-y-2",children:[(0,ci.jsx)("div",{className:"text-xs text-muted-foreground font-medium mb-2",children:"Information"}),(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)("span",{className:"text-xs text-muted-foreground",children:"Logged By"}),(0,ci.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,ci.jsx)(Pt.User,{className:"h-3 w-3"}),(0,ci.jsx)("span",{children:"System"})]})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)("span",{className:"text-xs text-muted-foreground",children:"Created"}),(0,ci.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-3 w-3"}),(0,ci.jsx)("span",{children:new Date(e.createdAt)?.toLocaleDateString()})]})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)("span",{className:"text-xs text-muted-foreground",children:"Last Updated"}),(0,ci.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,ci.jsx)(Pt.Clock,{className:"h-3 w-3"}),(0,ci.jsxs)("span",{children:[new Date(a).toLocaleDateString()," ci"," ",new Date(a).toLocaleTimeString()]})]})]})]})]})]})};var qs=({isOpen:e,onClose:t,initialTask:o,epics:a,sprints:r,onUpdateTask:i,onDeleteTask:c,onAddComment:s,colleagues:m})=>{let[n,l]=(0,jt.useState)(o),[d,g]=(0,jt.useState)(new Date),[w,b]=(0,jt.useState)("idle"),[y,p]=(0,jt.useState)("idle"),[C,N]=(0,jt.useState)([]),[h,R]=(0,jt.useState)(m);(0,jt.useEffect)(()=>{l(o)},[o]);let te=async(E,Re)=>{if(Re!==n[E]){b("loading");try{await i(n.id.toString(),{[E]:Re}),g(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch(xe){console.log("error",xe),b("error"),setTimeout(()=>b("idle"),3e3)}}},D=async(E,Re)=>{if(Re!==n[E]){b("loading");try{await i(n.id.toString(),{[E]:Re}),g(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch(xe){console.log("error",xe),b("error"),setTimeout(()=>b("idle"),3e3)}}},H=async E=>{if(s){b("loading");try{await s?.({content:E,taskId:n.id.toString()}),g(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch{b("error"),setTimeout(()=>b("idle"),3e3)}}},P=async()=>{p("loading");try{await c(n.id.toString()),p("success"),setTimeout(()=>{t(),p("idle")},1e3)}catch{p("error"),setTimeout(()=>p("idle"),3e3)}},K=w!=="loading"&&y!=="loading",J=()=>{K&&t()},L=()=>w==="loading"?(0,ci.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,ci.jsx)(Pt.Loader2,{className:"h-4 w-4 animate-spin"}),(0,ci.jsx)("span",{children:"Updating..."})]}):w==="success"?(0,ci.jsxs)("div",{className:"flex items-center gap-2 text-sm text-success",children:[(0,ci.jsx)(Pt.Check,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:"Updated successfully"})]}):w==="error"?(0,ci.jsxs)("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[(0,ci.jsx)(Pt.X,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:"Update failed"})]}):null;return(0,ci.jsx)(Xe,{open:e,onOpenChange:J,children:(0,ci.jsxs)(_e,{className:"max-w-3xl max-h-[80vh] overflow-y-auto p-4",children:[(0,ci.jsxs)(We,{children:[(0,ci.jsx)(qe,{className:"sr-only",children:n?.name}),(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)("div",{className:"flex-1",children:L()}),!K&&(0,ci.jsx)("div",{className:"text-xs text-muted-foreground",children:"Please wait..."})]})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,ci.jsxs)("div",{className:"lg:col-span-2 space-y-4",children:[(0,ci.jsx)(Ir,{fieldName:"name",value:n.name||"",label:"",onSave:te,className:"border-b border-border pb-3",disabled:w==="loading"}),(0,ci.jsx)(Ir,{fieldName:"description",value:n.description||"",label:"Description",multiline:!0,onSave:te,disabled:w==="loading"}),(0,ci.jsx)($s,{comments:(n?.comments||[]).map(E=>({author:E.author.value.name||"",createdAt:new Date(E.timestamp),text:E.text,id:E.id||""})),onAddComment:H})]}),(0,ci.jsx)(Ws,{task:n,epics:a,sprints:r,lastUpdated:d,onUpdateTask:D,onClose:J,onDelete:P,isUpdating:w==="loading",isDeleting:y==="loading",deleteState:y,teamMembers:h})]})]})})};var Za=({isOpen:e,onClose:t,onAddEpic:o})=>{let[a,r]=(0,jt.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}),i=["bg-blue-500","bg-green-500","bg-purple-500","bg-orange-500","bg-red-500","bg-yellow-500","bg-pink-500","bg-indigo-500"],c=[{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=l=>{l.preventDefault(),a.name.trim()&&(o({name:a.name.trim(),description:a.description.trim(),color:a.color,confidence:a.confidence,phase:a.phase,startDate:a.startDate,endDate:a.endDate}),r({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString(),endDate:new Date().toISOString(),progress:0}),t())},n=(l,d)=>{r(g=>({...g,[l]:d}))};return(0,ci.jsx)(Xe,{open:e,onOpenChange:t,children:(0,ci.jsxs)(_e,{className:"sm:max-w-md",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New Epic"})}),(0,ci.jsxs)("form",{onSubmit:m,className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Epic Name"}),(0,ci.jsx)(O,{id:"name",value:a.name,onChange:l=>n("name",l.target.value),placeholder:"Enter epic name",required:!0})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Te,{id:"description",value:a.description,onChange:l=>n("description",l.target.value),placeholder:"Enter epic description (optional)",rows:3})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Color"}),(0,ci.jsx)("div",{className:"flex gap-2 flex-wrap",children:i.map(l=>(0,ci.jsx)("button",{type:"button",onClick:()=>n("color",l),className:`w-8 h-8 rounded-full ${l} ${a.color===l?"ring-2 ring-gray-400":""}`},l))})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Confidence"}),(0,ci.jsxs)(Be,{value:a.confidence,onValueChange:l=>n("confidence",l),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{})}),(0,ci.jsx)(Me,{children:c.map(l=>(0,ci.jsx)(ne,{value:l.value,children:l.label},l.value))})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Phase"}),(0,ci.jsxs)(Be,{value:a.phase.toString(),onValueChange:l=>n("phase",parseInt(l)),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{})}),(0,ci.jsx)(Me,{children:s.map(l=>(0,ci.jsx)(ne,{value:l.value.toString(),children:l.label},l.value))})]})]})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Start Date"}),(0,ci.jsx)(O,{type:"date",value:a.startDate,onChange:l=>n("startDate",l.target.value)})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"End Date"}),(0,ci.jsx)(O,{type:"date",value:a.endDate,onChange:l=>n("endDate",l.target.value)})]})]}),(0,ci.jsxs)(Ua,{children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,ci.jsx)(x,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Epic"})]})]})]})})};var Js=({initialTasks:e=[],initialEpics:t=[],initialSprints:o=[],initialUsers:a=[],initialColleagues:r=[],initialProjects:i=[],onAddTask:c,onUpdateTask:s,onDeleteTask:m,onTaskClick:n,onAddEpic:l,onAddComment:d})=>{let[g,w]=(0,Ie.useState)([]),[b,y]=(0,Ie.useState)([]),[p,C]=(0,Ie.useState)([]),[N,h]=(0,Ie.useState)(!1),[R,te]=(0,Ie.useState)(!1),[D,H]=(0,Ie.useState)(null),[P,K]=(0,Ie.useState)(null),[J,L]=(0,Ie.useState)([]),[E,Re]=(0,Ie.useState)([]),[xe,z]=(0,Ie.useState)(0),ue=(0,Ie.useRef)(null),Ae=(0,Ie.useRef)(null),ht=Ie.default.useMemo(()=>[...b.map(B=>B.id),0],[b]),lt=(0,Ie.useRef)(""),St=(0,Ie.useRef)(""),M=(0,Ie.useRef)(""),ye=(0,Ie.useRef)(""),Fe=B=>B.map(v=>`${v.id}-${new Date(v.createdAt).getTime()}-${new Date(v.updatedAt).getTime()}`).join("-");(0,Ie.useEffect)(()=>{let B=Fe(e);B!==lt.current&&(w(e),D&&H(e.find(v=>v.id===D.id)||null),lt.current=B)},[e]),(0,Ie.useEffect)(()=>{let B=Fe(t);B!==St.current&&(y(t),St.current=B)},[t]),(0,Ie.useEffect)(()=>{let B=Fe(o);B!==M.current&&(C(o),M.current=B)},[o]),(0,Ie.useEffect)(()=>{let B=Fe(r.map(v=>({id:v.id,updatedAt:v.updatedAt,createdAt:v.createdAt})));B!==ye.current&&(Re(r),ye.current=B)},[r]),(0,Ie.useEffect)(()=>{let B=()=>{if(ue.current){let X=ue.current.offsetHeight;z(X)}};B();let v=new ResizeObserver(B);ue.current&&v.observe(ue.current);let k=()=>{setTimeout(B,100)};return window.addEventListener("storage",k),()=>{v.disconnect(),window.removeEventListener("storage",k)}},[]),(0,Ie.useEffect)(()=>{let B=setTimeout(()=>{ue.current&&z(ue.current.offsetHeight)},300);return()=>clearTimeout(B)},[N,R]);let Tt=g.filter(B=>!0),ke=B=>Tt.filter(v=>v.status===B),yt=B=>{let v={};return b.forEach(k=>{v[k.id]=B.filter(X=>ot(X.epic)===k.id)}),v["no-epic"]=B.filter(k=>!ot(k.epic)),v},F=B=>{K(B)},Ue=B=>{P&&(w(v=>v.map(k=>k.id===P.id?{...k,status:B}:k)),s?.(P.id.toString(),{status:B}),K(null))},At=B=>{let v={...B,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};w(k=>[...k,v]),c?.(B)},da=async(B,v)=>{w(k=>k.map(X=>X.id===Number(B)?{...X,...v}:X)),s&&await s(B,v),D?.id===Number(B)&&H(k=>({...k,...v}))},ya=async B=>{w(v=>v.filter(k=>k.id!==Number(B))),D?.id===Number(B)&&H(null),m&&await m(B)},Fa=B=>{let v={...B,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};y(k=>[...k,v]),l?.(B)},ca=B=>{H(B),n?.(B)},Ba=[{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"}],La=xe>0?`calc(100vh - ${xe+120}px)`:"calc(100vh - 12rem)";return(0,ci.jsxs)("div",{ref:Ae,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,ci.jsx)("div",{ref:ue,className:"flex-shrink-0",children:(0,ci.jsx)(gt,{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:()=>h(!0)},secondaryAction:{label:"Add epic",onClick:()=>te(!0)}})}),(0,ci.jsx)("div",{className:"flex-1 min-h-0 ci-8",children:(0,ci.jsx)("div",{className:"h-full",style:{height:xe>0?`calc(100vh - ${xe+120}px)`:"calc(100vh - 12rem)"},children:(0,ci.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full",children:Ba.map(B=>{let v=ke(B.status),k=yt(v);return(0,ci.jsxs)(Ks,{title:B.title,status:B.status,taskCount:v.length,onDrop:Ue,isCompact:B.status==="done",height:La,children:[k["no-epic"].map(X=>(0,ci.jsx)(Co,{epic:null,task:X,onDragStart:F,onTaskClick:ca,isCompact:B.status==="done"},X.id)),ht.map(X=>{let we=b.find($e=>$e.id===X),Ze=k[X]||[];return Ze.length===0?null:(0,ci.jsxs)("div",{className:"mb-6",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${we?.color}`}),(0,ci.jsx)("span",{className:"text-sm font-medium text-muted-foreground select-none-important",children:we?.name||"jt Epic"}),(0,ci.jsx)(me,{variant:"secondary",className:"text-xs",children:Ze.length})]})," ",(0,ci.jsx)("div",{className:"space-y-3",children:Ze.map($e=>(0,ci.jsx)(Co,{task:$e,epic:we,onDragStart:F,onTaskClick:ca,isCompact:B.status==="done"},$e.id))})]},X)})]},B.id)})})})}),(0,ci.jsx)(Wa,{isOpen:N,onClose:()=>h(!1),onAddTask:At,assignees:[...E,...J],epics:b,sprints:p}),(0,ci.jsx)(Za,{isOpen:R,onClose:()=>te(!1),onAddEpic:Fa}),D&&(0,ci.jsx)(qs,{isOpen:!!D,onClose:()=>H(null),initialTask:D,epics:b,sprints:p,onUpdateTask:da,onDeleteTask:ya,colleagues:E,onAddComment:d})]})};var Xs=({tasks:e,epics:t,sprints:o,onUpdateTask:a,onTaskClick:r,onAddTaskToEpic:i,onAddEpic:c,onUpdateEpic:s,onDeleteEpic:m})=>{let[n,l]=(0,jt.useState)(t),[d,g]=(0,jt.useState)(null),[w,b]=(0,jt.useState)(null),[y,p]=(0,jt.useState)({}),[C,N]=(0,jt.useState)(0),[h,R]=(0,jt.useState)(!1),[te,D]=(0,jt.useState)(!1),[H,P]=(0,jt.useState)(null),K=(0,jt.useRef)(null),J=(0,jt.useRef)(null);(0,jt.useEffect)(()=>{l(t)},[t]),(0,jt.useEffect)(()=>{let M=()=>{if(K.current){let Tt=K.current.offsetHeight;N(Tt)}};M();let ye=new ResizeObserver(M);K.current&&ye.observe(K.current);let Fe=()=>{setTimeout(M,100)};return window.addEventListener("storage",Fe),()=>{ye.disconnect(),window.removeEventListener("storage",Fe)}},[]),(0,jt.useEffect)(()=>{let M=setTimeout(()=>{K.current&&N(K.current.offsetHeight)},300);return()=>clearTimeout(M)},[w]);let L=M=>{g(M)},E=M=>{M.preventDefault()},Re=(M,ye)=>{M.preventDefault(),d&&ot(d.epic).toString()!==ye&&(a(d.id.toString(),{epic:Number(ye)}),g(null))},xe=M=>e.filter(ye=>ot(ye.epic).toString()===M),z=M=>{b(M.id.toString()),p({name:M.name,description:M.description,confidence:M.confidence,phase:M.phase})},ue=async()=>{w&&y.name&&(await s(w.toString(),y),l(M=>M.map(ye=>ye.id.toString()===w?{...ye,...y}:ye)),b(null),p({}))},Ae=()=>{b(null),p({})},ht=async M=>{window.confirm("Are you sure you want to delete this epic? This will also delete all associated tasks.")&&(await m(M),l(ye=>ye.filter(Fe=>Fe.id.toString()!==M)))},lt=M=>({1:"Planning",2:"Development",3:"Testing",4:"Review",5:"Deployment",6:"Monitoring",7:"Optimization",8:"Maintenance",9:"Complete"})[M]||`Phase ${M}`,St=M=>{switch(M){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,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsxs)("div",{ref:J,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,ci.jsx)("div",{ref:K,className:"flex-shrink-0",children:(0,ci.jsx)(gt,{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:()=>R(!0)}})}),(0,ci.jsx)("div",{className:"flex-1 min-h-0 ci-8",children:(0,ci.jsx)("div",{className:"h-full overflow-y-auto",style:{height:C>0?`calc(100vh - ${C+120}px)`:"calc(100vh - 12rem)"},children:(0,ci.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:n.map(M=>{let ye=xe(M.id.toString()),Fe=ye.reduce((ke,yt)=>ke+(yt.storyPoints||0),0),Tt=C>0?`calc(100vh - ${C+200}px)`:"calc(100vh - 14rem)";return(0,ci.jsxs)(U,{className:`flex flex-col ${w===M.id.toString()?"h-auto":""} bg-card shadow-sm`,style:{height:w===M.id.toString()?"auto":Tt,minHeight:"400px"},onDragOver:E,onDrop:ke=>Re(ke,M.id.toString()),children:[(0,ci.jsx)("div",{className:"p-4 border-b border-border",children:w===M.id.toString()?(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)(O,{value:y.name||"",onChange:ke=>p({...y,name:ke.target.value}),placeholder:"Epic name",className:"font-semibold"}),(0,ci.jsxs)("div",{className:"flex gap-2 ml-2",children:[(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:ue,className:"p-1 h-8 w-8",children:(0,ci.jsx)(Pt.Check,{className:"h-4 w-4"})}),(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:Ae,className:"p-1 h-8 w-8",children:(0,ci.jsx)(Pt.X,{className:"h-4 w-4"})})]})]}),(0,ci.jsx)(Te,{value:y.description||"",onChange:ke=>p({...y,description:ke.target.value}),placeholder:"Epic description",className:"text-sm min-h-[60px]"}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("label",{className:"text-xs text-muted-foreground",children:"Confidence"}),(0,ci.jsxs)("select",{value:y.confidence||M.confidence,onChange:ke=>p({...y,confidence:ke.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,ci.jsx)("option",{value:"low",children:"Low"}),(0,ci.jsx)("option",{value:"medium",children:"Medium"}),(0,ci.jsx)("option",{value:"high",children:"High"})]})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("label",{className:"text-xs text-muted-foreground",children:"Phase"}),(0,ci.jsx)("select",{value:y.phase?.toString()||M.phase.toString(),onChange:ke=>p({...y,phase:parseInt(ke.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(ke=>(0,ci.jsxs)("option",{value:ke.toString(),children:["Phase ",ke]},ke))})]})]})]}):(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,ci.jsx)("div",{className:`w-4 h-4 rounded-full ${M.color}`}),(0,ci.jsx)("h3",{className:"font-semibold text-foreground select-none flex-1",children:M.name}),(0,ci.jsxs)("div",{className:"flex gap-1",children:[(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>z(M),className:"p-1 h-8 w-8",children:(0,ci.jsx)(Pt.Edit2,{className:"h-3 w-3"})}),(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>ht(M.id.toString()),className:"p-1 h-8 w-8 hover:bg-destructive/10 hover:text-destructive",children:(0,ci.jsx)(Pt.Trash2,{className:"h-3 w-3"})})]})]}),(0,ci.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,ci.jsxs)(me,{className:`text-xs ${St(M.confidence)}`,children:[M.confidence," confidence"]}),(0,ci.jsxs)(me,{variant:"outline",className:"text-xs",children:["Phase ",M.phase]}),(0,ci.jsxs)(me,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[ye.length," tasks"]}),(0,ci.jsxs)(me,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[Fe," pts"]})]}),M.description&&(0,ci.jsx)("p",{className:"text-sm text-muted-foreground mb-3 select-none",children:M.description}),(0,ci.jsxs)(x,{onClick:()=>{D(!0),P(M)},variant:"outline",size:"sm",className:"w-full gap-2",children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),"Add Task"]})]})}),(0,ci.jsx)("div",{className:"flex-1 p-4 overflow-y-auto",children:(0,ci.jsx)("div",{className:`space-y-3 min-h-[200px] border-2 border-dashed rounded p-3 transition-colors ${d?"border-primary bg-primary/10":"border-border"}`,children:ye.length===0?(0,ci.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,ci.jsx)(Pt.Move,{className:"h-8 w-8 mb-2"}),(0,ci.jsx)("span",{className:"text-sm select-none",children:"Drop tasks here"})]}):ye.map(ke=>(0,ci.jsx)(Co,{task:ke,epic:M,onDragStart:L,onTaskClick:r,isCompact:!0},ke.id))})})]},M.id)})})})})]}),(0,ci.jsx)(Za,{isOpen:h,onClose:()=>R(!1),onAddEpic:c}),(0,ci.jsx)(Wa,{isOpen:te,onClose:()=>D(!1),onAddTask:i,assignees:[],epics:[],defaultEpicId:H?.id.toString()||"",sprints:o})]})};var Lr=require("date-fns");var Qs=({isOpen:e,onClose:t,onAddSprint:o})=>{let[a,r]=(0,jt.useState)({name:"",description:"",startDate:void 0,endDate:void 0}),i=s=>{s.preventDefault(),!(!a.name||!a.startDate||!a.endDate)&&(o({name:a.name,description:a.description,startDate:a.startDate.toISOString(),endDate:a.endDate.toISOString(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),r({name:"",description:"",startDate:void 0,endDate:void 0}),t())},c=()=>{r({name:"",description:"",startDate:void 0,endDate:void 0}),t()};return(0,ci.jsx)(Xe,{open:e,onOpenChange:c,children:(0,ci.jsxs)(_e,{className:"sm:max-w-md",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New Sprint"})}),(0,ci.jsxs)("form",{onSubmit:i,className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Sprint Name *"}),(0,ci.jsx)(O,{id:"name",value:a.name,onChange:s=>r(m=>({...m,name:s.target.value})),placeholder:"e.g., Sprint 3",required:!0})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Te,{id:"description",value:a.description,onChange:s=>r(m=>({...m,description:s.target.value})),placeholder:"Brief description of sprint goals",rows:3})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Start Date *"}),(0,ci.jsxs)(Nr,{children:[(0,ci.jsx)(Sr,{asChild:!0,children:(0,ci.jsxs)(x,{variant:"outline",className:S("w-full justify-start text-left font-normal",!a.startDate&&"text-muted-foreground"),children:[(0,ci.jsx)(Pt.CalendarIcon,{className:"mr-2 h-4 w-4"}),a.startDate?(0,Lr.format)(a.startDate,"PPP"):"Pick a date"]})}),(0,ci.jsx)(zo,{className:"w-auto p-0",align:"start",children:(0,ci.jsx)($o,{mode:"single",selected:a.startDate,onSelect:s=>r(m=>({...m,startDate:s})),initialFocus:!0})})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"End Date *"}),(0,ci.jsxs)(Nr,{children:[(0,ci.jsx)(Sr,{asChild:!0,children:(0,ci.jsxs)(x,{variant:"outline",className:S("w-full justify-start text-left font-normal",!a.endDate&&"text-muted-foreground"),children:[(0,ci.jsx)(Pt.CalendarIcon,{className:"mr-2 h-4 w-4"}),a.endDate?(0,Lr.format)(a.endDate,"PPP"):"Pick a date"]})}),(0,ci.jsx)(zo,{className:"w-auto p-0",align:"start",children:(0,ci.jsx)($o,{mode:"single",selected:a.endDate,onSelect:s=>r(m=>({...m,endDate:s})),initialFocus:!0,disabled:s=>a.startDate?s<a.startDate:!1})})]})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end gap-3 ci-4",children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:c,children:"Cancel"}),(0,ci.jsx)(x,{type:"submit",disabled:!a.name||!a.startDate||!a.endDate,children:"Add Sprint"})]})]})]})})};var Jo=({tasks:e,epics:t,sprints:o,onUpdateTask:a,onTaskClick:r,onAddSprint:i,onUpdateSprint:c,onDeleteSprint:s})=>{let[m,n]=(0,jt.useState)([]),[l,d]=(0,jt.useState)(new Set),[g,w]=(0,jt.useState)(null),[b,y]=(0,jt.useState)(!1),[p,C]=(0,jt.useState)(null),[N,h]=(0,jt.useState)(null),[R,te]=(0,jt.useState)({name:"",description:"",startDate:"",endDate:"",isActive:!1}),[D,H]=(0,jt.useState)([]),[P,K]=(0,jt.useState)("upcoming"),[J,L]=(0,jt.useState)(!1),[E,Re]=(0,jt.useState)(0),xe=(0,jt.useRef)(null),z=(0,jt.useRef)(null);(0,jt.useEffect)(()=>{let v=()=>{xe.current&&Re(xe.current.offsetHeight)};v();let k=new ResizeObserver(v);return xe.current&&k.observe(xe.current),()=>k.disconnect()},[]);let ue=v=>t.find(k=>k.id===Number(v)),Ae=v=>o.find(k=>k.id===Number(v)),ht=v=>{let k={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 k[v]||k.medium},lt=v=>{if(!v||v?.length===0)return"";let k=v?.trim().split(" ");if(k?.length===1)return k[0];let X=k[0],we=k[k.length-1][0].toUpperCase();return`${X} ${we}`},St=v=>{let k={},X=[];return v.forEach(we=>{we.epic?(k[ot(we.epic)]||(k[ot(we.epic)]=[]),k[ot(we.epic)].push(we)):X.push(we)}),{tasksByEpic:k,unassignedTasks:X}};(0,jt.useEffect)(()=>{H(o)},[o]);let M=D.filter(v=>{switch(P){default:return!0}}),ye=D.filter(v=>m.includes(v.id.toString())),Fe=e.filter(v=>!v.sprint||v.status==="backlog"),Tt=Fe.reduce((v,k)=>v+(k.storyPoints||0),0),ke=v=>{n(k=>k.includes(v)?k.filter(X=>X!==v):k?.length<3?[...k,v]:k)},yt=v=>{d(k=>{let X=new Set(k);return X.has(v)?X.delete(v):X.add(v),X})},F=v=>{i(v),y(!1)},Ue=v=>{h(v.id.toString()),te({name:v.name,description:v.description||"",startDate:v.startDate?new Date(v.startDate).toISOString().split("T")[0]:v.startDate,endDate:v.endDate?new Date(v.endDate).toISOString().split("T")[0]:v.endDate,isActive:!1})},At=()=>{N&&(c(N,{name:R.name,description:R.description,startDate:R.startDate,endDate:R.endDate}),H(v=>v.map(k=>(k.id===Number(N)&&(k.name=R.name,k.description=R.description,k.startDate=R.startDate,k.endDate=R.endDate),k))),h(null))},da=()=>{h(null),te({name:"",description:"",startDate:"",endDate:"",isActive:!1})},ya=(v,k)=>{w(k),v.dataTransfer.effectAllowed="move"},Fa=v=>{v.preventDefault(),v.dataTransfer.dropEffect="move"},ca=v=>{C(v)},Ba=()=>{C(null)},La=(v,k)=>{if(v.preventDefault(),C(null),!g)return;(ot(g.sprint)||void 0)!==Number(k)&&a(g.id.toString(),{sprint:Number(k)}),w(null)},B=({task:v,showSprint:k=!1})=>{let X=v.epic?ue(ot(v.epic).toString()):null,we=v.sprint?Ae(ot(v.sprint).toString()):null;return(0,ci.jsx)(U,{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:wt=>{wt.dataTransfer.effectAllowed="move",wt.dataTransfer.setData("text/plain",v.id.toString()),ya(wt,v)},onClick:wt=>{g===null&&r(v)},style:{userSelect:"none"},children:(0,ci.jsxs)("div",{className:"space-y-2 pointer-events-none",children:[(0,ci.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,ci.jsx)("h4",{className:"font-medium text-sm text-foreground line-clamp-1",children:v.name}),(0,ci.jsx)(me,{className:`text-xs ${ht(v.priority||"medium")}`,children:v.priority?.[0]?.toUpperCase()})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-1",children:[X&&(0,ci.jsx)("div",{className:`w-2 h-2 rounded-full ${X.color}`}),(0,ci.jsx)("span",{className:"text-muted-foreground truncate",children:X?.name})]}),(0,ci.jsx)("span",{className:"text-muted-foreground",children:lt(v.assignee?.value?.name)})]}),k&&we&&(0,ci.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-3 w-3"}),(0,ci.jsx)("span",{children:we.name})]})]})})};return(0,ci.jsxs)("div",{ref:z,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,ci.jsx)("div",{ref:xe,className:"flex-shrink-0",children:(0,ci.jsx)(gt,{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:()=>y(!0)}})}),(0,ci.jsx)("div",{className:"flex-1 min-h-0 ci-8",children:(0,ci.jsxs)("div",{className:"h-full",style:{height:E>0?`calc(100vh - ${E+120}px)`:"calc(100vh - 12rem)"},children:[(0,ci.jsxs)("div",{className:"mb-4",children:[(0,ci.jsx)(U,{className:"p-3 bg-card shadow-sm",children:(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h3",{className:"font-semibold text-foreground text-sm",children:"Sprint Board"}),(0,ci.jsxs)("p",{className:"text-xs text-muted-foreground",children:[m?.length,"/3 selected"]})]}),m?.length>0&&(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("span",{className:"text-xs text-muted-foreground",children:"Viewing:"}),(0,ci.jsx)("div",{className:"flex flex-wrap gap-1",children:ye.map(v=>(0,ci.jsxs)("div",{className:"flex items-center gap-1 bg-primary/10 text-primary px-2 py-0.5 rounded text-xs",children:[(0,ci.jsx)("span",{className:"max-w-[80px] truncate",children:v.name}),(0,ci.jsx)("button",{onClick:()=>ke(v.id.toString()),className:"ml-0.5 hover:bg-primary/20 h-8 rounded p-0.5",children:(0,ci.jsx)(Pt.X,{className:"h-4 w-4"})})]},v.id))})]})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsxs)(x,{onClick:()=>y(!0),className:"bg-primary hover:bg-primary/90 text-primary-foreground gap-1",size:"sm",children:[(0,ci.jsx)(Pt.Plus,{className:"h-3 w-3"}),"Add"]}),(0,ci.jsxs)(x,{onClick:()=>L(!J),variant:"outline",size:"sm",className:"gap-1",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-3 w-3"}),J?"Close":"Select"]})]})]})}),J&&(0,ci.jsx)("div",{className:"fixed inset-0 bg-black/20 z-[5]",onClick:()=>L(!1)}),(0,ci.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 ${J?"translate-x-0 opacity-100 visible":"translate-x-full opacity-0 invisible"}`,children:(0,ci.jsxs)(U,{className:"h-full rounded-none border-0 flex flex-col",children:[(0,ci.jsxs)("div",{className:"p-4 border-b bg-muted/30 flex-shrink-0",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)("h3",{className:"font-semibold text-foreground text-base",children:"Select Sprints"}),(0,ci.jsx)(x,{variant:"ghost",size:"sm",onClick:()=>L(!1),className:"h-8 w-8 p-0",children:(0,ci.jsx)(Pt.X,{className:"h-4 w-4"})})]}),(0,ci.jsx)("p",{className:"text-sm text-muted-foreground ci-1",children:"Choose up to 3 sprints to view in your planning board"})]}),(0,ci.jsxs)("div",{className:"flex flex-col flex-1 p-4 min-h-0",children:[(0,ci.jsx)("div",{className:"flex gap-1 mb-4 bg-muted p-1 rounded-lg",children:[{key:"all",label:"All",count:o.length},{key:"active",label:"Active"},{key:"upcoming",label:"Upcoming"}].map(v=>(0,ci.jsxs)(x,{variant:P===v.key?"default":"outline",size:"sm",onClick:()=>K(v.key),className:"text-xs h-8 px-3 flex-1",children:[v.label," (",v.count,")"]},v.key))}),(0,ci.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto",children:M.length>0?M.map(v=>{let k=m.includes(v.id.toString()),X=e.filter(Ze=>ot(Ze.sprint)===v.id).length,we=!k&&m.length<3;return(0,ci.jsx)("div",{className:`p-3 rounded-lg border transition-all ${k?"bg-primary/10 border-primary/30":we?"bg-card border-border hover:border-primary/50":"bg-muted/30 border-border/30 opacity-60"}`,children:N===v.id.toString()?(0,ci.jsxs)("div",{className:"space-y-3",children:[(0,ci.jsx)(O,{value:R.name,onChange:Ze=>te($e=>({...$e,name:Ze.target.value})),className:"text-sm",placeholder:"Sprint name"}),(0,ci.jsx)(Te,{value:R.description,onChange:Ze=>te($e=>({...$e,description:Ze.target.value})),className:"text-sm min-h-[60px]",placeholder:"Sprint description"}),(0,ci.jsxs)("div",{className:"flex gap-2",children:[(0,ci.jsxs)(x,{size:"sm",onClick:()=>At(),className:"flex-1",children:[(0,ci.jsx)(Pt.Check,{className:"h-3 w-3 mr-1"}),"Save"]}),(0,ci.jsxs)(x,{size:"sm",variant:"outline",onClick:da,className:"flex-1",children:[(0,ci.jsx)(Pt.X,{className:"h-3 w-3 mr-1"}),"Cancel"]})]})]}):(0,ci.jsxs)("div",{children:[(0,ci.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ci.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,ci.jsx)("h4",{className:"font-medium text-sm text-foreground truncate",children:v.name}),(0,ci.jsx)(me,{variant:"default",className:"text-xs bg-green-100 text-green-800 border-green-200",children:"Active"})]}),(0,ci.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:v.description}),(0,ci.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[(0,ci.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ci.jsx)(Pt.CalendarDays,{className:"h-3 w-3"}),new Date(v.startDate).toLocaleDateString()]}),(0,ci.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ci.jsx)(Pt.User,{className:"h-3 w-3"}),X," tasks"]})]})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-1 ml-2",children:[(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>Ue(v),className:"h-6 w-6 p-0",children:(0,ci.jsx)(Pt.Edit2,{className:"h-3 w-3"})}),(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>s(v.id.toString()),className:"h-6 w-6 p-0 text-destructive hover:text-destructive",children:(0,ci.jsx)(Pt.Trash2,{className:"h-3 w-3"})})]})]}),(0,ci.jsx)("div",{className:"flex items-center justify-between ci-2",children:(0,ci.jsx)(x,{variant:k?"default":"outline",size:"sm",className:"text-xs w-full h-8 flex items-center justify-center cursor-pointer",onClick:()=>ke(v.id.toString()),disabled:!k&&m?.length>=3,children:(0,ci.jsx)("span",{className:"pointer-events-none select-none",children:k?"Deselect":m?.length>=3?"Limit Reached":"Select"})})})]})},v.id)}):(0,ci.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),(0,ci.jsxs)("p",{className:"text-sm",children:['jt sprints found for "',P,'" filter']}),(0,ci.jsx)(x,{variant:"link",size:"sm",onClick:()=>K("all"),className:"text-xs",children:"Show all sprints"})]})}),m?.length===0&&(0,ci.jsx)("div",{className:"ci-4 p-4 bg-muted/50 rounded-lg border-2 border-dashed border-border",children:(0,ci.jsxs)("div",{className:"text-center",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-6 w-6 mx-auto mb-2 text-muted-foreground"}),(0,ci.jsx)("p",{className:"text-sm text-muted-foreground font-medium",children:"Select sprints to start planning"}),(0,ci.jsx)("p",{className:"text-xs text-muted-foreground ci-1",children:"Choose up to 3 sprints to view alongside your backlog"})]})})]})]})})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full flex-1 min-h-0",children:[(0,ci.jsx)("div",{className:"lg:col-span-1",children:(0,ci.jsxs)(U,{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:Fa,onDragEnter:()=>ca("backlog"),onDragLeave:Ba,onDrop:v=>La(v,"backlog"),style:{height:E>0?`calc(100vh - ${E+200}px)`:"calc(100vh - 16rem)"},children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,ci.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:"Backlog"}),(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsxs)(me,{variant:"secondary",className:"bg-muted text-muted-foreground",children:[Fe?.length," tasks"]}),(0,ci.jsxs)(me,{variant:"outline",className:"bg-gray-50 text-gray-700 border-gray-200",children:[Tt," pts"]})]})]}),(0,ci.jsx)("div",{className:`flex-1 overflow-y-auto space-y-3 min-h-0 p-3 rounded transition-colors ${p==="backlog"?"bg-primary/10":""}`,children:(()=>{let{tasksByEpic:v,unassignedTasks:k}=St(Fe);return(0,ci.jsxs)(ci.Fragment,{children:[Object.entries(v).map(([X,we])=>{let Ze=ue(X);if(!Ze)return null;let $e=l.has(X);return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.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:()=>yt(X),children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${Ze.color}`}),(0,ci.jsx)("span",{className:"font-medium text-muted-foreground",children:Ze.name}),(0,ci.jsxs)("span",{className:"text-muted-foreground",children:["(",we?.length,")"]}),(0,ci.jsx)("div",{className:"ml-auto",children:$e?(0,ci.jsx)(Pt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ci.jsx)(Pt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!$e&&(0,ci.jsx)("div",{className:"space-y-2 pl-2",children:we.map(wt=>(0,ci.jsx)(B,{task:wt},wt.id))})]},X)}),k?.length>0&&(()=>{let X=l.has("no-epic");return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.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:()=>yt("no-epic"),children:[(0,ci.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,ci.jsx)("span",{className:"font-medium text-muted-foreground",children:"jt Epic"}),(0,ci.jsxs)("span",{className:"text-muted-foreground",children:["(",k?.length,")"]}),(0,ci.jsx)("div",{className:"ml-auto",children:X?(0,ci.jsx)(Pt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ci.jsx)(Pt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!X&&(0,ci.jsx)("div",{className:"space-y-2 pl-2",children:k?.map(we=>(0,ci.jsx)(B,{task:we},we.id))})]})})(),Fe?.length===0&&(0,ci.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"}),Fe?.length>0&&Object.keys(v).length===0&&k.length===0&&(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:"Direct backlog tasks:"}),Fe?.map(X=>(0,ci.jsx)(B,{task:X},X.id))]})]})})()})]})}),ye.map(v=>{let k=e.filter(we=>ot(we?.sprint)===v.id),X=k.reduce((we,Ze)=>we+(Ze?.storyPoints||0),0);return(0,ci.jsxs)(U,{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:Fa,onDragEnter:()=>ca(v.id.toString()),onDragLeave:Ba,onDrop:we=>La(we,v.id.toString()),style:{height:E>0?`calc(100vh - ${E+200}px)`:"calc(100vh - 16rem)"},children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,ci.jsx)("div",{children:(0,ci.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:v.name})}),(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsxs)(me,{variant:"secondary",className:"bg-muted flex items-center justify-center text-muted-foreground",children:[k?.length," tasks"]}),(0,ci.jsxs)(me,{variant:"outline",className:"bg-blue-50 flex items-center justify-center text-blue-700 border-blue-200",children:[X," pts"]}),(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>{L(!0),Ue(v)},className:"h-6 px-2",children:(0,ci.jsx)(Pt.Edit2,{className:"h-3 w-3"})}),(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>s(v.id.toString()),className:"h-6 px-2 text-destructive hover:text-destructive",children:(0,ci.jsx)(Pt.Trash2,{className:"h-3 w-3"})})]})]}),(0,ci.jsx)("div",{className:"flex-1 overflow-y-auto space-y-3 min-h-0",children:(()=>{let{tasksByEpic:we,unassignedTasks:Ze}=St(k);return(0,ci.jsxs)(ci.Fragment,{children:[Object.entries(we).map(([$e,wt])=>{let Qa=ue($e);if(!Qa)return null;let eo=l.has($e);return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.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:()=>yt($e),children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${Qa.color}`}),(0,ci.jsx)("span",{className:"font-medium text-muted-foreground",children:Qa.name}),(0,ci.jsxs)("span",{className:"text-muted-foreground",children:["(",wt?.length,")"]}),(0,ci.jsx)("div",{className:"ml-auto",children:eo?(0,ci.jsx)(Pt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ci.jsx)(Pt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!eo&&(0,ci.jsx)("div",{className:"space-y-2 pl-2",children:wt?.map(to=>(0,ci.jsx)(B,{task:to},to.id))})]},$e)}),Ze?.length>0&&(()=>{let $e=l.has("no-epic");return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.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:()=>yt("no-epic"),children:[(0,ci.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,ci.jsx)("span",{className:"font-medium text-muted-foreground",children:"jt Epic"}),(0,ci.jsxs)("span",{className:"text-muted-foreground",children:["(",Ze?.length,")"]}),(0,ci.jsx)("div",{className:"ml-auto",children:$e?(0,ci.jsx)(Pt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ci.jsx)(Pt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!$e&&(0,ci.jsx)("div",{className:"space-y-2 pl-2",children:Ze?.map(wt=>(0,ci.jsx)(B,{task:wt},wt.id))})]})})(),k?.length===0&&(0,ci.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm select-none",children:"Drop tasks here"})]})})()})]},v.id)})]}),(0,ci.jsx)(Qs,{isOpen:b,onClose:()=>y(!1),onAddSprint:F})]})})]})};var Hl=e=>e.toLocaleDateString("en-US",{weekday:"short",year:"numeric",month:"short",day:"numeric"}),Ol=e=>{let[t,o]=e.split(":"),a=new Date;return a.setHours(parseInt(t),parseInt(o)),a.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})},Hr=(e,t)=>{let o=new Date,a=new Date(e);if(t){let[r,i]=t.split(":");a.setHours(parseInt(r),parseInt(i))}return a<o},Or=e=>{let t=new Date;return e.toDateString()===t.toDateString()},Vl=e=>{let t=new Date;return t.setDate(t.getDate()+1),e.toDateString()===t.toDateString()},jl=({colleagues:e,onAddReminder:t,open:o,setOpen:a})=>{let[r,i]=(0,jt.useState)({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""}),[c,s]=(0,jt.useState)(!1),m=l=>{if(l.preventDefault(),!e.find(w=>w?.id.toString()===r.colleagueId.toString())){console.error("jt valid colleague selected"),s(!0);return}s(!1);let g={title:r.title,description:r.description,dueDate:new Date(r.dueDate).toISOString(),dueTime:r.dueTime||void 0,isRecurring:r.isRecurring,assignedColleague:Number(r.colleagueId),project:1,updatedAt:new Date().toISOString()};t(g),a(!1),i({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""})};(0,jt.useEffect)(()=>{r.colleagueId&&s(!1)},[r.colleagueId]);let n=e.filter(Boolean);return(0,ci.jsx)(Xe,{open:o,onOpenChange:a,children:(0,ci.jsxs)(_e,{className:"max-w-2xl",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New Reminder"})}),(0,ci.jsxs)("form",{onSubmit:m,className:"space-y-4",children:[(0,ci.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"title",children:"Title"}),(0,ci.jsx)(O,{id:"title",value:r.title,onChange:l=>i({...r,title:l.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Te,{id:"description",value:r.description,onChange:l=>i({...r,description:l.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"dueDate",children:"Due Date"}),(0,ci.jsx)(O,{id:"dueDate",type:"date",value:r.dueDate,onChange:l=>i({...r,dueDate:l.target.value}),required:!0})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"dueTime",children:"Due Time (optional)"}),(0,ci.jsx)(O,{id:"dueTime",type:"time",value:r.dueTime,onChange:l=>i({...r,dueTime:l.target.value})})]})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{className:`${c?"text-destructive":""}`,htmlFor:"colleague",children:"Assigned Colleague"}),(0,ci.jsxs)(Be,{value:r.colleagueId,onValueChange:l=>{i({...r,colleagueId:l})},required:!0,children:[(0,ci.jsx)(Ee,{className:`${c?"text-destructive border-red-500":""}`,children:(0,ci.jsx)(Je,{className:`${c?"text-destructive border-red-500":""}`,placeholder:"Select a digital colleague",children:e.find(l=>l?.id.toString()===r.colleagueId.toString())?.name||"Select a digital colleague"})}),(0,ci.jsx)(Me,{children:n.map(l=>(0,ci.jsx)(ne,{value:l.id.toString(),children:l.name},l.id))})]}),c&&(0,ci.jsx)("p",{className:"text-destructive text-sm",children:"Please select a digital colleague"})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)("input",{type:"checkbox",id:"isRecurring",checked:r.isRecurring,onChange:l=>i({...r,isRecurring:l.target.checked}),className:"rounded border-border"}),(0,ci.jsx)(T,{htmlFor:"isRecurring",children:"Make this a recurring reminder"})]}),r.isRecurring&&(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4 pl-6",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"recurrencePattern",children:"Frequency"}),(0,ci.jsxs)(Be,{value:r.recurrencePattern,onValueChange:l=>i({...r,recurrencePattern:l}),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)(ne,{value:"daily",children:"Daily"}),(0,ci.jsx)(ne,{value:"weekly",children:"Weekly"}),(0,ci.jsx)(ne,{value:"monthly",children:"Monthly"}),(0,ci.jsx)(ne,{value:"yearly",children:"Yearly"})]})]})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"recurrenceInterval",children:"Every"}),(0,ci.jsx)(O,{id:"recurrenceInterval",type:"number",min:"1",value:r.recurrenceInterval,onChange:l=>i({...r,recurrenceInterval:parseInt(l.target.value)})})]})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),(0,ci.jsx)(x,{type:"submit",children:"Add Reminder"})]})]})]})})},Kl=({reminder:e,colleagues:t,onUpdateReminder:o,open:a,onClose:r})=>{let[i,c]=(0,jt.useState)({title:e.title,description:e.description,dueDate:e.dueDate?.toString().split("T")[0],dueTime:e.dueTime||"",isRecurring:e.isRecurring}),s=n=>{n.preventDefault(),o(e.id.toString(),{title:i.title,description:i.description,dueDate:new Date(i.dueDate||"").toISOString(),dueTime:i.dueTime||void 0,isRecurring:i.isRecurring}),r()},m=t.filter(Boolean);return(0,ci.jsx)(Xe,{open:a,onOpenChange:r,children:(0,ci.jsxs)(_e,{className:"max-w-2xl",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Edit Reminder"})}),(0,ci.jsxs)("form",{onSubmit:s,className:"space-y-4",children:[(0,ci.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"edit-title",children:"Title"}),(0,ci.jsx)(O,{id:"edit-title",value:i.title,onChange:n=>c({...i,title:n.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"edit-description",children:"Description"}),(0,ci.jsx)(Te,{id:"edit-description",value:i.description||"",onChange:n=>c({...i,description:n.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"edit-dueDate",children:"Due Date"}),(0,ci.jsx)(O,{id:"edit-dueDate",type:"date",value:i.dueDate,onChange:n=>c({...i,dueDate:n.target.value}),required:!0})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"edit-dueTime",children:"Due Time (optional)"}),(0,ci.jsx)(O,{id:"edit-dueTime",type:"time",value:i.dueTime,onChange:n=>c({...i,dueTime:n.target.value})})]})]}),(0,ci.jsx)("div",{className:"space-y-2",children:(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)("input",{type:"checkbox",id:"edit-isRecurring",checked:i.isRecurring||!1,onChange:n=>c({...i,isRecurring:n.target.checked}),className:"rounded border-border"}),(0,ci.jsx)(T,{htmlFor:"edit-isRecurring",children:"Make this a recurring reminder"})]})}),(0,ci.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),(0,ci.jsx)(x,{type:"submit",children:"Save Changes"})]})]})]})})},zl=({reminder:e,colleagues:t,onUpdateReminder:o,onDeleteReminder:a})=>{let[r,i]=(0,jt.useState)(!1);if(!e||!e.id)return null;let c=Hr(new Date(e.dueDate||""),e.dueTime||""),s=Or(new Date(e.dueDate||"")),m=Vl(new Date(e.dueDate||"")),n=()=>{o(e.id.toString(),{})},l=()=>s?"Today":m?"Tomorrow":Hl(new Date(e.dueDate||""));return(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(Kl,{reminder:e,colleagues:t,onUpdateReminder:o,open:r,onClose:()=>i(!1)}),(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"p-4",children:(0,ci.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ci.jsxs)("div",{className:"flex items-start space-x-3 flex-1",children:[(0,ci.jsx)("button",{onClick:n,className:"ci-1 text-primary hover:text-primary/80"}),(0,ci.jsxs)("div",{className:"flex-1",children:[(0,ci.jsx)("div",{className:"flex items-center space-x-2 mb-1",children:(0,ci.jsx)("h3",{children:e.title})}),(0,ci.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:e.description}),(0,ci.jsxs)("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[(0,ci.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-4 w-4"}),(0,ci.jsx)("span",{className:c?"text-destructive font-medium":"",children:l()})]}),e.dueTime&&(0,ci.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,ci.jsx)(Pt.Clock,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:Ol(e.dueTime)})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,ci.jsx)(Pt.User,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:typeof e.assignedColleague!="number"?e.assignedColleague.name:"Unknown Colleague"})]})]})]})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,ci.jsx)(x,{variant:"ghost",size:"sm",onClick:()=>i(!0),className:"h-8 w-8 p-0",children:(0,ci.jsx)(Pt.Edit2,{className:"h-4 w-4"})}),(0,ci.jsx)(x,{variant:"ghost",size:"sm",onClick:()=>a(e.id.toString()),className:"h-8 w-8 p-0 text-destructive hover:text-destructive/80",children:(0,ci.jsx)(Pt.Trash2,{className:"h-4 w-4"})})]})]})})})]})},en=({initialReminders:e=[],initialColleagues:t=[],onAddReminder:o,onUpdateReminder:a,onDeleteReminder:r})=>{let[i,c]=(0,jt.useState)(e.filter(Boolean)),[s,m]=(0,jt.useState)(t.filter(Boolean)),[n,l]=(0,jt.useState)("all"),[d,g]=(0,jt.useState)(""),[w,b]=(0,jt.useState)(!1);(0,jt.useEffect)(()=>{c(e.filter(Boolean))},[e]),(0,jt.useEffect)(()=>{m(t.filter(Boolean))},[t]);let y=D=>{if(!D.title){console.error("Invalid reminder data:",D);return}let H={...D,id:Date.now(),createdAt:new Date().toISOString()};c(P=>[...P,H]),o?.(D)},p=(D,H)=>{if(!D){console.error("jt reminder ID provided for update");return}c(P=>P.map(K=>K?.id.toString()===D?{...K,...H}:K)),a?.(D,H)},C=D=>{if(!D){console.error("jt reminder ID provided for deletion");return}c(H=>H.filter(P=>P?.id.toString()!==D)),r?.(D)},h=i.filter(D=>{if(!D)return!1;if(d){let H=d.toLowerCase();if(!(D.title.toLowerCase().includes(H)||D.description?.toLowerCase().includes(H)))return!1}switch(n){case"pending":case"completed":case"overdue":return Hr(new Date(D.dueDate||""),D.dueTime||"");case"today":return Or(new Date(D.dueDate||""));default:return!0}}).sort((D,H)=>{if(!D||!H)return 0;let P={high:3,medium:2,low:1},K=0;return K!==0?K:new Date(D.dueDate||"").getTime()-new Date(H.dueDate||"").getTime()}),R={total:i.filter(Boolean).length,overdue:i.filter(D=>D&&Hr(new Date(D.dueDate||""),D.dueTime||"")).length,today:i.filter(D=>D&&Or(new Date(D.dueDate||""))).length},te=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,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,ci.jsx)(gt,{title:"Task Reminders",description:"Manage reminders and stay ir 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,ci.jsxs)("div",{className:"h-full bg-background",children:[(0,ci.jsx)(jl,{colleagues:s,onAddReminder:y,open:w,setOpen:b}),(0,ci.jsxs)("div",{className:"p-6",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-2xl font-bold text-foreground",children:"Task Reminders"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Manage your digital colleague task reminders"})]}),(0,ci.jsxs)(x,{className:"flex items-center space-x-2",onClick:()=>b(!0),children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:"Add Reminder"})]})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-5 gap-4 mb-6",children:[(0,ci.jsxs)(U,{className:"p-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-foreground",children:R.total}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Total"})]}),(0,ci.jsxs)(U,{className:"p-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-primary",children:R.overdue}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Pending"})]}),(0,ci.jsxs)(U,{className:"p-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-success",children:R.today}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Completed"})]}),(0,ci.jsxs)(U,{className:"p-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-destructive",children:R.overdue}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Overdue"})]}),(0,ci.jsxs)(U,{className:"p-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-warning",children:R.today}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Today"})]})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-4 mb-6",children:[(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsx)(O,{placeholder:"Search reminders...",value:d,onChange:D=>g(D.target.value),className:"max-w-md"})}),(0,ci.jsxs)(Be,{value:n,onValueChange:D=>l(D),children:[(0,ci.jsx)(Ee,{className:"w-40",children:(0,ci.jsx)(Je,{})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsxs)(ne,{value:"all",children:["All (",R.total,")"]}),(0,ci.jsxs)(ne,{value:"overdue",children:["Overdue (",R.overdue,")"]}),(0,ci.jsxs)(ne,{value:"overdue",children:["Overdue (",R.overdue,")"]}),(0,ci.jsxs)(ne,{value:"today",children:["Today (",R.today,")"]})]})]})]}),(0,ci.jsx)("div",{className:"space-y-4",children:h.length===0?(0,ci.jsxs)(U,{className:"p-8 text-center",children:[(0,ci.jsx)("div",{className:"text-muted-foreground",children:d||n!=="all"?"jt reminders match your filters":"jt reminders yet"}),!d&&n==="all"&&(0,ci.jsx)("p",{className:"text-sm text-muted-foreground/60 ci-2",children:"Create your first reminder to get started"})]}):h.map(D=>D&&(0,ci.jsx)(zl,{reminder:D,colleagues:s,onUpdateReminder:p,onDeleteReminder:C},D.id))})]})]})]})};var tn=require("next/navigation");function Vr({title:e="",initialTasks:t=[],initialEpics:o=[],initialSprints:a=[],initialProjects:r=[],initialReminders:i=[],initialColleagues:c=[],initialUsers:s=[],initialFiles:m=[],initialView:n="kanban",onAddTask:l,onUpdateTask:d,onDeleteTask:g,onTaskClick:w,onAddEpic:b,onUpdateEpic:y,onDeleteEpic:p,onAddTaskToEpic:C,onAddSprint:N,onUpdateSprint:h,onDeleteSprint:R,onAddProject:te,onUpdateProject:D,onDeleteProject:H,onFileAdd:P,onFileEdit:K,onFileDelete:J,onFileClick:L,onAddReminder:E,onUpdateReminder:Re,onDeleteReminder:xe,onViewChange:z,onToggleMobileMenu:ue,onTeamClick:Ae,onTeamChange:ht,onCopilotClick:lt,handleAddComment:St}){let[M,ye]=(0,jt.useState)(t),[Fe,Tt]=(0,jt.useState)(o),[ke,yt]=(0,jt.useState)(a),[F,Ue]=(0,jt.useState)(r),[At,da]=(0,jt.useState)(i),[ya,Fa]=(0,jt.useState)(c),[ca,Ba]=(0,jt.useState)(s),[La,B]=(0,jt.useState)(m),[v,k]=(0,jt.useState)(!1),[X,we]=(0,jt.useState)(!1),[Ze,$e]=(0,jt.useState)(null),[wt,Qa]=(0,jt.useState)(null),[eo,to]=(0,jt.useState)(null),[wa,Wr]=(0,jt.useState)(n||"kanban"),[$l,pn]=(0,jt.useState)(!1),un=(0,tn.useRouter)();(0,jt.useEffect)(()=>{ye(t)},[t]),(0,jt.useEffect)(()=>{yt(a)},[a]),(0,jt.useEffect)(()=>{Tt(o)},[o]),(0,jt.useEffect)(()=>{Ue(r)},[r]),(0,jt.useEffect)(()=>{B(m)},[m]),(0,jt.useEffect)(()=>{Ba(s)},[s]),(0,jt.useEffect)(()=>{Fa(c)},[c]),(0,jt.useEffect)(()=>{da(i)},[i]),(0,jt.useEffect)(()=>{Wr(n)},[n]);let gn=M.filter(A=>{}),Gl=A=>gn.filter(Z=>Z.status===A),_l=A=>{let Z={};return Fe.forEach(se=>{}),Z},Wl=A=>{to(A)},ql=A=>{eo&&(ye(Z=>Z.map(se=>se.id===eo.id?{...se,status:A}:se)),to(null))},qr=A=>{let Z={...A,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};ye(se=>[...se,Z]),l?.(Z)},To=async(A,Z)=>(ye(se=>se.map(dt=>dt.id===Number(A)?{...dt,...Z}:dt)),await d?.(A,Z)),Zl=async(A,Z)=>{To(A,Z)},Zr=A=>{ye(Z=>Z.filter(se=>se.id!==Number(A))),Ze?.id===Number(A)&&$e(null),g?.(A)},Jl=async A=>{Zr(A)},Xl=A=>{let Z={...A,id:Date.now()};Ue(se=>[...se,Z]),te?.(A)},Yl=(A,Z)=>{Ue(se=>se.map(dt=>dt.id===Number(A)?{...dt,...Z}:dt)),D?.(A,Z)},Ql=A=>{Ue(Z=>Z.filter(se=>se.id!==Number(A))),H?.(A)},Jr=A=>{let Z={...A,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};Tt(se=>[...se,Z]),b?.({...Z})},fn=()=>{we(!0)},vn=(A,Z)=>{Tt(se=>se.map(dt=>dt.id===Number(A)?{...dt,...Z}:dt)),y?.(A,Z)},hn=A=>{Tt(Z=>Z.filter(se=>se.id!==Number(A))),ye(Z=>Z.filter(se=>ot(se.epic)!==Number(A))),p?.(A)},bn=A=>{let Z={...A,id:Date.now()};yt(se=>[...se,Z]),N?.(A)},xn=(A,Z)=>{yt(se=>se.map(dt=>dt.id===Number(A)?{...dt,...Z}:dt)),h?.(A,Z)},yn=A=>{A==="backlog"||A==="all-tasks"||(yt(Z=>Z.filter(se=>se.id!==Number(A))),ye(Z=>Z.map(se=>ot(se.sprint)===Number(A)?{...se,sprint:void 0}:se)),R?.(A))},er=A=>{$e(A)},wn=A=>{A==="planning"&&window.innerWidth<768||(Wr(A),z?.(A))},ed=()=>{pn(A=>!A),ue?.()},td=()=>{un.push("/")},ad=A=>{console.log("Switching to team:",A)},od=A=>{console.log("Switching to team:",A)},Cn=A=>{k(!0)},Nn=()=>{k(!1),Qa(null)},Sn=A=>{let Z={...A,id:Date.now(),createdAt:new Date().toISOString()};da(se=>[...se,Z]),E?.(A)},Dn=(A,Z)=>{da(se=>se.map(dt=>dt.id===Number(A)?{...dt,...Z}:dt)),Re?.(A,Z)},kn=A=>{da(Z=>Z.filter(se=>se.id!==Number(A))),xe?.(A)},Tn=()=>{P?.()},Pn=A=>{K?.(A)},Rn=A=>{B(Z=>Z.filter(se=>se.name!==A)),J?.(A)},An=A=>{L?.(A)},rd=[{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"}],id=()=>{switch(wa){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"}},tr=[{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")}],sd=tr.sort((A,Z)=>Z.lastUsed.getTime()-A.lastUsed.getTime()).slice(0,3),nd=tr.length>3,ld=tr.slice(3);return(0,ci.jsxs)(js,{currentView:wa,onViewChange:wn,children:[wa==="kanban"&&(0,ci.jsx)("div",{className:"h-full overflow-hidden",children:(0,ci.jsx)(Js,{initialProjects:F,initialEpics:Fe,initialSprints:ke.map(A=>({...A,isSelected:!1})),initialTasks:M,initialColleagues:ya,initialUsers:ca,onAddTask:qr,onUpdateTask:To,onDeleteTask:Zr,onTaskClick:er,onAddEpic:Jr,onAddComment:St})}),wa==="planning"&&(0,ci.jsx)("div",{className:"hidden md:block h-full",children:(0,ci.jsx)(Jo,{tasks:M,epics:Fe,sprints:ke,onUpdateTask:To,onTaskClick:er,onAddSprint:bn,onUpdateSprint:xn,onDeleteSprint:yn})}),wa==="tasks"&&(0,ci.jsx)("div",{className:"h-full",children:(0,ci.jsx)(en,{initialReminders:At,initialColleagues:ya,onAddReminder:Sn,onUpdateReminder:Dn,onDeleteReminder:kn})}),wa==="files"&&(0,ci.jsx)("div",{className:"h-full",children:(0,ci.jsx)(go,{initialFiles:La,onFileAdd:Tn,onFileEdit:Pn,onFileDelete:Rn,onFileClick:An,compactView:!1})}),wa==="epics"&&(0,ci.jsx)("div",{className:"h-full",children:(0,ci.jsx)(Xs,{tasks:M,epics:Fe,sprints:ke,onUpdateTask:To,onTaskClick:er,onAddTaskToEpic:Cn,onAddEpic:fn,onUpdateEpic:vn,onDeleteEpic:hn})}),(0,ci.jsx)(Wa,{isOpen:v,onClose:Nn,onAddTask:qr,epics:Fe,sprints:ke,assignees:[...ya,...ca],defaultEpicId:wt||void 0}),(0,ci.jsx)(Za,{isOpen:X,onClose:()=>we(!1),onAddEpic:Jr})]})}var an=Ce(require("react")),So=Ce(require("@radix-ui/react-progress"));var Kr=an.forwardRef(({className:e,value:t,...o},a)=>(0,ci.jsx)(So.Root,{ref:a,className:S("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...o,children:(0,ci.jsx)(So.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Kr.displayName=So.Root.displayName;function rn({project:e,onOpen:t,onShare:o,className:a}){return(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:a,children:(0,ci.jsxs)(U,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,ci.jsxs)(Ge,{children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)(Qe,{children:e.name}),(0,ci.jsxs)(me,{variant:"outline",className:"rounded-xl",children:["Due ",e.dueDate]})]}),(0,ci.jsx)(io,{children:e.description})]}),(0,ci.jsxs)(fe,{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ci.jsx)("span",{children:"Progress"}),(0,ci.jsxs)("span",{children:[e.progress,"%"]})]}),(0,ci.jsx)(Kr,{value:e.progress,className:"h-2 rounded-xl"})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,ci.jsxs)("div",{className:"flex items-center",children:[(0,ci.jsx)(Pt.Users,{className:"mr-1 h-4 w-4"}),e.members," members"]}),(0,ci.jsxs)("div",{className:"flex items-center",children:[(0,ci.jsx)(Pt.FileText,{className:"mr-1 h-4 w-4"}),e.files," files"]})]})]}),(0,ci.jsxs)(so,{className:"flex gap-2",children:[(0,ci.jsx)(x,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"Open Project"}),(0,ci.jsx)(x,{variant:"outline",size:"icon",className:"rounded-2xl",onClick:()=>o?.(e),children:(0,ci.jsx)(Pt.Share2,{className:"h-4 w-4"})})]})]})})}var sn=({onSubmit:e,onCancel:t,isLoading:o=!1,initialData:a,className:r=""})=>{let[i,c]=(0,jt.useState)({name:a?.name||"",description:a?.description||"",objectives:a?.objectives||"",workInstructions:a?.workInstructions||"",plan:a?.plan||!1}),[s,m]=(0,jt.useState)({}),n=()=>{let g={};return i.name.trim()?i.name.trim().length<3&&(g.name="Project name must ci ci least 3 characters"):g.name="Project name is required",i.objectives.trim()?i.objectives.trim().length<10&&(g.objectives="Please provide more detailed objectives (ci least 10 characters)"):g.objectives="Project objectives are required",i.workInstructions.trim()?i.workInstructions.trim().length<20&&(g.workInstructions="Please provide more detailed work instructions (ci least 20 characters)"):g.workInstructions="Work instructions are required",m(g),Object.keys(g).length===0},l=async g=>{if(g.preventDefault(),!!n())try{await e(i)}catch(w){console.error("Error submitting project form:",w)}},d=(g,w)=>{c(b=>({...b,[g]:w})),s[g]&&m(b=>({...b,[g]:void 0}))};return(0,ci.jsxs)("div",{className:`w-full max-w-2xl ${r}`,children:[(0,ci.jsxs)("div",{className:"mb-4",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Plus,{className:"h-5 w-5"}),"Create New Project"]}),(0,ci.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,ci.jsxs)("form",{onSubmit:l,children:[(0,ci.jsxs)("div",{className:"space-y-6",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",className:"text-sm font-medium",children:"Project Name *"}),(0,ci.jsx)(O,{id:"name",type:"text",placeholder:"Enter project name",value:i.name,onChange:g=>d("name",g.target.value),className:s.name?"border-red-500 focus:border-red-500":"",disabled:o,maxLength:100}),s.name&&(0,ci.jsx)("p",{className:"text-sm text-red-600",children:s.name})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",className:"text-sm font-medium",children:"Project Description *"}),(0,ci.jsx)(O,{id:"description",type:"text",placeholder:"Enter project description",value:i.description,onChange:g=>d("description",g.target.value),className:s.description?"border-red-500 focus:border-red-500":"",disabled:o,maxLength:100}),s.description&&(0,ci.jsx)("p",{className:"text-sm text-red-600",children:s.description})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"objectives",className:"text-sm font-medium",children:"Project Objectives *"}),(0,ci.jsx)(Te,{id:"objectives",placeholder:"Describe the main goals and objectives of this project...",value:i.objectives,onChange:g=>d("objectives",g.target.value),className:`min-h-[100px] resize-y ${s.objectives?"border-red-500 focus:border-red-500":""}`,disabled:o,maxLength:1e3}),(0,ci.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,ci.jsx)("span",{children:s.objectives&&(0,ci.jsx)("span",{className:"text-red-600",children:s.objectives})}),(0,ci.jsxs)("span",{children:[i.objectives.length,"/1000"]})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"workInstructions",className:"text-sm font-medium",children:"Work Instructions *"}),(0,ci.jsx)(Te,{id:"workInstructions",placeholder:"Provide detailed instructions ir how the work should ci carried out, including processes, standards, and expectations...",value:i.workInstructions,onChange:g=>d("workInstructions",g.target.value),className:`min-h-[120px] resize-y ${s.workInstructions?"border-red-500 focus:border-red-500":""}`,disabled:o,maxLength:2e3}),(0,ci.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,ci.jsx)("span",{children:s.workInstructions&&(0,ci.jsx)("span",{className:"text-red-600",children:s.workInstructions})}),(0,ci.jsxs)("span",{children:[i.workInstructions.length,"/2000"]})]})]}),(0,ci.jsxs)("div",{className:"space-y-3",children:[(0,ci.jsx)(T,{className:"text-sm font-medium",children:"Project Management"}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(bo,{id:"plan",checked:i.plan,onCheckedChange:g=>d("plan",g===!0),disabled:o}),(0,ci.jsx)(T,{htmlFor:"plan",className:"text-sm text-gray-700 cursor-pointer",children:"Enable project planning and management features"})]}),(0,ci.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,ci.jsxs)("div",{className:"flex justify-end gap-3",children:[t&&(0,ci.jsxs)(x,{type:"button",variant:"outline",onClick:t,disabled:o,className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.X,{className:"h-4 w-4"}),"Cancel"]}),(0,ci.jsx)(x,{type:"submit",disabled:o,className:"flex items-center gap-2",children:o?(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(Pt.Loader2,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),"Create Project"]})})]})]})]})};function $r({projects:e=[],onAddProject:t,handleProjectOpen:o,handleProjectShare:a}){let[r,i]=(0,jt.useState)(!1),[c,s]=(0,jt.useState)(!1),m=async l=>{s(!0);try{await t(l),i(!1)}catch(d){console.error("Error creating project:",d)}finally{s(!1)}},n=()=>{i(!0)};return(0,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsx)(gt,{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:n}}),(0,ci.jsxs)("section",{className:"space-y-4 ci-8",children:[(0,ci.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,ci.jsx)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:e.map(l=>(0,ci.jsx)(rn,{project:l,onOpen:o,onShare:a},l.id))})]})]},"projects-index-view")}),(0,ci.jsx)(Xe,{open:r,onOpenChange:i,children:(0,ci.jsxs)(_e,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[(0,ci.jsxs)(We,{className:"sr-only",children:[(0,ci.jsx)(qe,{children:"Create New Project"}),(0,ci.jsx)($a,{children:"Fill out the form below to create a new project."})]}),(0,ci.jsx)(sn,{onSubmit:m,onCancel:()=>i(!1),isLoading:c,className:"border-0 shadow-none"})]})})]})}function ln({team:e,onOpen:t,className:o}){return(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:o,children:(0,ci.jsxs)(U,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,ci.jsxs)(Ge,{children:[(0,ci.jsx)(Qe,{className:"text-lg",children:e.name}),(0,ci.jsx)(io,{className:"ci-1 text-sm",children:e.description})]}),(0,ci.jsxs)(fe,{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Users,{className:"h-4 w-4 text-blue-500"}),(0,ci.jsx)("span",{children:"Human"})]}),(0,ci.jsx)("span",{className:"font-medium",children:e.humanColleagues})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-purple-500"}),(0,ci.jsx)("span",{children:"Digital"})]}),(0,ci.jsx)("span",{className:"font-medium",children:e.digitalColleagues})]})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm border-t ci-4",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.FolderOpen,{className:"h-4 w-4 text-green-500"}),(0,ci.jsx)("span",{children:"Projects"})]}),(0,ci.jsx)("span",{className:"font-medium",children:e.projects})]})]}),(0,ci.jsx)(so,{className:"flex gap-2",children:(0,ci.jsx)(x,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"View Team"})})]})})}var dn=Ce(require("react")),Do=Ce(require("@radix-ui/react-switch"));var Ya=dn.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(Do.Root,{className:S("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:o,children:(0,ci.jsx)(Do.Thumb,{className:S("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")})}));Ya.displayName=Do.Root.displayName;function cn({team:e,onSave:t,onCancel:o,isLoading:a=!1,title:r,submitLabel:i,cancelLabel:c="Cancel",readOnly:s=!1}){let[m,n]=(0,jt.useState)({name:"",description:"",systemMsg:"",useProjects:!1,useKnowledge:!1,useFiles:!1,useChat:!1,...e}),[l,d]=(0,jt.useState)(!s);(0,jt.useEffect)(()=>{e&&n(e)},[e]);let g=async p=>{p.preventDefault();let C={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(C)},w=p=>{p.preventDefault(),d(!l)},b=r||(l?e?"Edit Team":"Create New Team":"View Team"),y=i||(e?"Update Team":"Create Team");return(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Users,{className:"h-5 w-5"}),b]}),(0,ci.jsxs)("form",{onSubmit:g,className:"space-y-6",children:[(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Team Name *"}),(0,ci.jsx)(O,{id:"name",value:m.name||"",onChange:p=>n({...m,name:p.target.value}),required:!0,disabled:a||!l,placeholder:"Enter team name..."})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Te,{id:"description",value:m.description||"",onChange:p=>n({...m,description:p.target.value}),rows:3,placeholder:"Brief description of this team...",disabled:a||!l})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"systemMsg",children:"Ways of working"}),(0,ci.jsx)(Te,{id:"systemMsg",value:m.systemMsg||"",onChange:p=>n({...m,systemMsg:p.target.value}),rows:3,placeholder:"Describe how this team works in as much detail as possible. Include processes, tools, systems, styles...",disabled:a||!l})]})]}),(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)("h3",{className:"text-lg font-semibold",children:"Team Configuration"}),(0,ci.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(Ya,{id:"useProjects",checked:m.useProjects||!1,onCheckedChange:p=>n({...m,useProjects:p}),disabled:a||!l}),(0,ci.jsx)(T,{htmlFor:"useProjects",children:"Enable Projects"})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(Ya,{id:"useKnowledge",checked:m.useKnowledge||!1,onCheckedChange:p=>n({...m,useKnowledge:p}),disabled:a||!l}),(0,ci.jsx)(T,{htmlFor:"useKnowledge",children:"Enable Knowledge Base"})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(Ya,{id:"useFiles",checked:m.useFiles||!1,onCheckedChange:p=>n({...m,useFiles:p}),disabled:a||!l}),(0,ci.jsx)(T,{htmlFor:"useFiles",children:"Enable File Management"})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(Ya,{id:"useChat",checked:m.useChat||!1,onCheckedChange:p=>n({...m,useChat:p}),disabled:a||!l}),(0,ci.jsx)(T,{htmlFor:"useChat",children:"Enable Team Chat"})]})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end gap-2 ci-4 border-t",children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:o,disabled:a,children:l?c:"Close"}),l?(0,ci.jsx)(x,{type:"submit",disabled:a||!m.name?.trim(),children:a?"Saving...":y}):(0,ci.jsxs)(x,{type:"button",onClick:w,disabled:a,className:"gap-2",children:[(0,ci.jsx)(Pt.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})]})}function _r({teams:e=[],onCreateTeam:t,onTeamOpen:o}){let[a,r]=(0,jt.useState)(!1),i=()=>{r(!0)},c=async n=>{await t?.(n),r(!1)},s=()=>{r(!1)},m=n=>{o?.(n)};return(0,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsx)(gt,{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:i}}),(0,ci.jsxs)("section",{className:"space-y-4 ci-8",children:[(0,ci.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Teams"}),e.length===0?(0,ci.jsxs)("div",{className:"text-center py-12",children:[(0,ci.jsx)("p",{className:"text-muted-foreground text-lg",children:"You'ci not part of any teams yet."}),(0,ci.jsx)("p",{className:"text-muted-foreground text-sm ci-2",children:"Create a new team or ask to ci added to an existing one."})]}):(0,ci.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(n=>(0,ci.jsx)(ln,{team:n,onOpen:m},n.id))})]})]},"teams-index-view")}),(0,ci.jsx)(Xe,{open:a,onOpenChange:r,children:(0,ci.jsxs)(_e,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[(0,ci.jsx)("div",{className:"sr-only",children:(0,ci.jsxs)(We,{children:[(0,ci.jsx)(qe,{children:"Create New Team"}),(0,ci.jsx)($a,{children:"Set up a new team to collaborate with colleagues ir projects."})]})}),(0,ci.jsx)(cn,{title:"Create New Team",submitLabel:"Create Team",onSave:c,onCancel:s})]})})]})}0&&(module.exports={ColleaguesView,FileView,KnowledgeView,PlanningView,ProjectView,ProjectsIndexView,TeamsIndexView});
|
|
5
|
+
"use strict";var En=Object.create;var Po=Object.defineProperty;var Mn=Object.getOwnPropertyDescriptor;var In=Object.getOwnPropertyNames;var Fn=Object.getPrototypeOf,Bn=Object.prototype.hasOwnProperty;var Ln=(e,t)=>{for(var o in t)Po(e,o,{get:t[o],enumerable:!0})},Xr=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of In(t))!Bn.call(e,r)&&r!==o&&Po(e,r,{get:()=>t[r],enumerable:!(a=Mn(t,r))||a.enumerable});return e};var Ce=(e,t,o)=>(o=e!=null?En(Fn(e)):{},Xr(t||!e||!e.__esModule?Po(o,"default",{value:e,enumerable:!0}):o,e)),Hn=e=>Xr(Po({},"__esModule",{value:!0}),e);var Ul={};Ln(Ul,{ColleaguesView:()=>cr,FileView:()=>go,KnowledgeView:()=>Er,PlanningView:()=>Jo,ProjectView:()=>Vr,ProjectsIndexView:()=>$r,TeamsIndexView:()=>_r});module.exports=Hn(Ul);var jt=require("react"),Pt=require("lucide-react");var si=require("clsx");var rr="-",On=e=>{let t=jn(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{let s=c.split(rr);return s[0]===""&&s.length!==1&&s.shift(),ei(s,t)||Vn(c)},getConflictingClassGroupIds:(c,s)=>{let m=o[c]||[];return s&&a[c]?[...m,...a[c]]:m}}},ei=(e,t)=>{if(e.length===0)return t.classGroupId;let o=e[0],a=t.nextPart.get(o),r=a?ei(e.slice(1),a):void 0;if(r)return r;if(t.validators.length===0)return;let i=e.join(rr);return t.validators.find(({validator:c})=>c(i))?.classGroupId},Yr=/^\[(.+)\]$/,Vn=e=>{if(Yr.test(e)){let t=Yr.exec(e)[1],o=t?.substring(0,t.indexOf(":"));if(o)return"arbitrary.."+o}},jn=e=>{let{theme:t,prefix:o}=e,a={nextPart:new Map,validators:[]};return zn(Object.entries(e.classGroups),o).forEach(([i,c])=>{or(c,a,i,t)}),a},or=(e,t,o,a)=>{e.forEach(r=>{if(typeof r=="string"){let i=r===""?t:Qr(t,r);i.classGroupId=o;return}if(typeof r=="function"){if(Kn(r)){or(r(a),t,o,a);return}t.validators.push({validator:r,classGroupId:o});return}Object.entries(r).forEach(([i,c])=>{or(c,Qr(t,i),o,a)})})},Qr=(e,t)=>{let o=e;return t.split(rr).forEach(a=>{o.nextPart.has(a)||o.nextPart.set(a,{nextPart:new Map,validators:[]}),o=o.nextPart.get(a)}),o},Kn=e=>e.isThemeGetter,zn=(e,t)=>t?e.map(([o,a])=>{let r=a.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([c,s])=>[t+c,s])):i);return[o,r]}):e,Un=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=new Map,a=new Map,r=(i,c)=>{o.set(i,c),t++,t>e&&(t=0,a=o,o=new Map)};return{get(i){let c=o.get(i);if(c!==void 0)return c;if((c=a.get(i))!==void 0)return r(i,c),c},set(i,c){o.has(i)?o.set(i,c):r(i,c)}}},ti="!",$n=e=>{let{separator:t,experimentalParseClassName:o}=e,a=t.length===1,r=t[0],i=t.length,c=s=>{let m=[],n=0,l=0,d;for(let p=0;p<s.length;p++){let C=s[p];if(n===0){if(C===r&&(a||s.slice(p,p+i)===t)){m.push(s.slice(l,p)),l=p+i;continue}if(C==="/"){d=p;continue}}C==="["?n++:C==="]"&&n--}let g=m.length===0?s:s.substring(l),w=g.startsWith(ti),b=w?g.substring(1):g,y=d&&d>l?d-l:void 0;return{modifiers:m,hasImportantModifier:w,baseClassName:b,maybePostfixModifierPosition:y}};return o?s=>o({className:s,parseClassName:c}):c},Gn=e=>{if(e.length<=1)return e;let t=[],o=[];return e.forEach(a=>{a[0]==="["?(t.push(...o.sort(),a),o=[]):o.push(a)}),t.push(...o.sort()),t},_n=e=>({cache:Un(e.cacheSize),parseClassName:$n(e),...On(e)}),Wn=/\s+/,qn=(e,t)=>{let{parseClassName:o,getClassGroupId:a,getConflictingClassGroupIds:r}=t,i=[],c=e.trim().split(Wn),s="";for(let m=c.length-1;m>=0;m-=1){let n=c[m],{modifiers:l,hasImportantModifier:d,baseClassName:g,maybePostfixModifierPosition:w}=o(n),b=!!w,y=a(b?g.substring(0,w):g);if(!y){if(!b){s=n+(s.length>0?" "+s:s);continue}if(y=a(g),!y){s=n+(s.length>0?" "+s:s);continue}b=!1}let p=Gn(l).join(":"),C=d?p+ti:p,N=C+y;if(i.includes(N))continue;i.push(N);let h=r(y,b);for(let R=0;R<h.length;++R){let te=h[R];i.push(C+te)}s=n+(s.length>0?" "+s:s)}return s};function Zn(){let e=0,t,o,a="";for(;e<arguments.length;)(t=arguments[e++])&&(o=ai(t))&&(a&&(a+=" "),a+=o);return a}var ai=e=>{if(typeof e=="string")return e;let t,o="";for(let a=0;a<e.length;a++)e[a]&&(t=ai(e[a]))&&(o&&(o+=" "),o+=t);return o};function Jn(e,...t){let o,a,r,i=c;function c(m){let n=t.reduce((l,d)=>d(l),e());return o=_n(n),a=o.cache.get,r=o.cache.set,i=s,s(m)}function s(m){let n=a(m);if(n)return n;let l=qn(m,o);return r(m,l),l}return function(){return i(Zn.apply(null,arguments))}}var Ve=e=>{let t=o=>o[e]||[];return t.isThemeGetter=!0,t},oi=/^\[(?:([a-z-]+):)?(.+)\]$/i,Xn=/^\d+\/\d+$/,Yn=new Set(["px","full","screen"]),Qn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,el=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|ci|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,tl=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,al=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)ci-?((\d+)?\.?(\d+)[a-z]+|0)/,ol=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zt=e=>Ha(e)||Yn.has(e)||Xn.test(e),ma=e=>Oa(e,"length",ml),Ha=e=>!!e&&!Number.isNaN(Number(e)),ar=e=>Oa(e,"number",Ha),ao=e=>!!e&&Number.isInteger(Number(e)),rl=e=>e.endsWith("%")&&Ha(e.slice(0,-1)),de=e=>oi.test(e),pa=e=>Qn.test(e),il=new Set(["length","size","percentage"]),sl=e=>Oa(e,il,ri),nl=e=>Oa(e,"position",ri),ll=new Set(["image","url"]),dl=e=>Oa(e,ll,ul),cl=e=>Oa(e,"",pl),oo=()=>!0,Oa=(e,t,o)=>{let a=oi.exec(e);return a?a[1]?typeof t=="string"?a[1]===t:t.has(a[1]):o(a[2]):!1},ml=e=>el.test(e)&&!tl.test(e),ri=()=>!1,pl=e=>al.test(e),ul=e=>ol.test(e);var gl=()=>{let e=Ve("colors"),t=Ve("spacing"),o=Ve("blur"),a=Ve("brightness"),r=Ve("borderColor"),i=Ve("borderRadius"),c=Ve("borderSpacing"),s=Ve("borderWidth"),m=Ve("contrast"),n=Ve("grayscale"),l=Ve("hueRotate"),d=Ve("invert"),g=Ve("gap"),w=Ve("gradientColorStops"),b=Ve("gradientColorStopPositions"),y=Ve("inset"),p=Ve("margin"),C=Ve("opacity"),N=Ve("padding"),h=Ve("saturate"),R=Ve("scale"),te=Ve("sepia"),D=Ve("skew"),H=Ve("space"),P=Ve("translate"),K=()=>["auto","contain","none"],J=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto",de,t],E=()=>[de,t],Re=()=>["",Zt,ma],xe=()=>["auto",Ha,de],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ue=()=>["solid","dashed","dotted","double","none"],Ae=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ht=()=>["start","end","center","between","around","evenly","stretch"],lt=()=>["","0",de],St=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Ha,de];return{cacheSize:500,separator:":",theme:{colors:[oo],spacing:[Zt,ma],blur:["none","",pa,de],brightness:M(),borderColor:[e],borderRadius:["none","","full",pa,de],borderSpacing:E(),borderWidth:Re(),contrast:M(),grayscale:lt(),hueRotate:M(),invert:lt(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[rl,ma],inset:L(),margin:L(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:lt(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",de]}],container:["container"],columns:[{columns:[pa]}],"break-after":[{"break-after":St()}],"break-before":[{"break-before":St()}],"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:[...z(),de]}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:K()}],"overscroll-x":[{"overscroll-x":K()}],"overscroll-y":[{"overscroll-y":K()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ao,de]}],basis:[{basis:L()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",de]}],grow:[{grow:lt()}],shrink:[{shrink:lt()}],order:[{order:["first","last","none",ao,de]}],"grid-cols":[{"grid-cols":[oo]}],"col-start-end":[{col:["auto",{span:["full",ao,de]},de]}],"col-start":[{"col-start":xe()}],"col-end":[{"col-end":xe()}],"grid-rows":[{"grid-rows":[oo]}],"row-start-end":[{row:["auto",{span:[ao,de]},de]}],"row-start":[{"row-start":xe()}],"row-end":[{"row-end":xe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","ci",de]}],"auto-rows":[{"auto-rows":["auto","min","max","ci",de]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...ht()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ht(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ht(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],ci:[{ci:[N]}],ci:[{ci:[N]}],ci:[{ci:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[p]}],mx:[{mx:[p]}],my:[{my:[p]}],Pt:[{Pt:[p]}],me:[{me:[p]}],ci:[{ci:[p]}],mr:[{mr:[p]}],mb:[{mb:[p]}],ml:[{ml:[p]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",de,t]}],"min-w":[{"min-w":[de,t,"min","max","fit"]}],"max-w":[{"max-w":[de,t,"none","full","min","max","fit","prose",{screen:[pa]},pa]}],h:[{h:[de,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[de,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[de,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[de,t,"auto","min","max","fit"]}],"font-size":[{text:["base",pa,ma]}],"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:[oo]}],"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",de]}],"line-clamp":[{"line-clamp":["none",Ha,ar]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Zt,de]}],"list-image":[{"list-image":["none",de]}],"list-style-type":[{list:["none","disc","decimal",de]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[C]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[C]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ue(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Zt,ma]}],"underline-offset":[{"underline-offset":["auto",Zt,de]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",de]}],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",de]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[C]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...z(),nl]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",sl]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},dl]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[w]}],"gradient-via":[{via:[w]}],"gradient-to":[{to:[w]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ci":[{"rounded-ci":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[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":[C]}],"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":[C]}],"divide-style":[{divide:ue()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...ue()]}],"outline-offset":[{"outline-offset":[Zt,de]}],"outline-w":[{outline:[Zt,ma]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[C]}],"ring-offset-w":[{"ring-offset":[Zt,ma]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",pa,cl]}],"shadow-color":[{shadow:[oo]}],opacity:[{opacity:[C]}],"mix-blend":[{"mix-blend":[...Ae(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Ae()}],filter:[{filter:["","none"]}],blur:[{blur:[o]}],brightness:[{brightness:[a]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",pa,de]}],grayscale:[{grayscale:[n]}],"hue-rotate":[{"hue-rotate":[l]}],invert:[{invert:[d]}],saturate:[{saturate:[h]}],sepia:[{sepia:[te]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[o]}],"backdrop-brightness":[{"backdrop-brightness":[a]}],"backdrop-contrast":[{"backdrop-contrast":[m]}],"backdrop-grayscale":[{"backdrop-grayscale":[n]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[l]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[C]}],"backdrop-saturate":[{"backdrop-saturate":[h]}],"backdrop-sepia":[{"backdrop-sepia":[te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",de]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",de]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",de]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[ao,de]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[D]}],"skew-y":[{"skew-y":[D]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",de]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","li-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",de]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-Pt":[{"scroll-Pt":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-ci":[{"scroll-ci":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-ci":[{"scroll-ci":E()}],"scroll-ci":[{"scroll-ci":E()}],"scroll-ci":[{"scroll-ci":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",de]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Zt,ma,ar]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","ci","ci","ci","pb","pl"],px:["ci","pl"],py:["ci","pb"],m:["mx","my","Pt","me","ci","mr","mb","ml"],mx:["mr","ml"],my:["ci","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ci","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ci"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-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-Pt","scroll-me","scroll-ci","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-ci","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-ci","scroll-ci","scroll-ci","scroll-pb","scroll-pl"],"scroll-px":["scroll-ci","scroll-pl"],"scroll-py":["scroll-ci","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var ii=Jn(gl);function S(...e){return ii((0,si.clsx)(e))}var ni=require("@radix-ui/react-slot"),li=require("class-variance-authority"),di=Ce(require("react")),ci=require("react/jsx-runtime"),ro=(0,li.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=di.forwardRef(({asChild:e=!1,className:t,size:o,variant:a,...r},i)=>(0,ci.jsx)(e?ni.Slot:"button",{className:S(ro({className:t,size:o,variant:a})),ref:i,...r}));x.displayName="Button";var Ca=Ce(require("react"));var U=Ca.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("div",{ref:o,className:S("rounded-xl border bg-card text-card-foreground shadow",e),...t}));U.displayName="Card";var Ge=Ca.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("div",{ref:o,className:S("flex flex-col space-y-1.5 p-6",e),...t}));Ge.displayName="CardHeader";var Qe=Ca.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("div",{ref:o,className:S("font-semibold leading-none tracking-tight",e),...t}));Qe.displayName="CardTitle";var io=Ca.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("div",{ref:o,className:S("text-sm text-muted-foreground",e),...t}));io.displayName="CardDescription";var fe=Ca.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("div",{ref:o,className:S("p-6 ci-0",e),...t}));fe.displayName="CardContent";var so=Ca.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("div",{ref:o,className:S("flex items-center p-6 ci-0",e),...t}));so.displayName="CardFooter";var mi=Ce(require("react"));var O=mi.forwardRef(({className:e,type:t,...o},a)=>(0,ci.jsx)("input",{type:t,className:S("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:a,...o}));O.displayName="Input";var ve=Ce(require("@radix-ui/react-select")),ua=Ce(require("react")),Be=ve.Root;var Je=ve.Value,Ee=ua.forwardRef(({children:e,className:t,...o},a)=>(0,ci.jsxs)(ve.Trigger,{className:S("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:a,...o,children:[e,(0,ci.jsx)(ve.Icon,{asChild:!0,children:(0,ci.jsx)(Pt.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Ee.displayName=ve.Trigger.displayName;var ui=ua.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ve.ScrollUpButton,{className:S("flex cursor-default items-center justify-center py-1",e),ref:o,...t,children:(0,ci.jsx)(Pt.ChevronUp,{className:"h-4 w-4"})}));ui.displayName=ve.ScrollUpButton.displayName;var gi=ua.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ve.ScrollDownButton,{className:S("flex cursor-default items-center justify-center py-1",e),ref:o,...t,children:(0,ci.jsx)(Pt.ChevronDown,{className:"h-4 w-4"})}));gi.displayName=ve.ScrollDownButton.displayName;var Me=ua.forwardRef(({children:e,className:t,position:o="popper",...a},r)=>(0,ci.jsx)(ve.Portal,{children:(0,ci.jsxs)(ve.Content,{className:S("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded border bg-card text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:o,ref:r,...a,children:[(0,ci.jsx)(ui,{}),(0,ci.jsx)(ve.Viewport,{className:S("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),(0,ci.jsx)(gi,{})]})}));Me.displayName=ve.Content.displayName;var fl=ua.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ve.Label,{className:S("py-1.5 pl-8 ci-2 text-sm font-semibold",e),ref:o,...t}));fl.displayName=ve.Label.displayName;var ne=ua.forwardRef(({children:e,className:t,...o},a)=>(0,ci.jsxs)(ve.Item,{className:S("relative flex w-full cursor-default select-none items-center rounded py-1.5 pl-8 ci-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),ref:a,...o,children:[(0,ci.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ci.jsx)(ve.ItemIndicator,{children:(0,ci.jsx)(Pt.Check,{className:"h-4 w-4"})})}),(0,ci.jsx)(ve.ItemText,{children:e})]}));ne.displayName=ve.Item.displayName;var vl=ua.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ve.Separator,{className:S("-mx-1 my-1 h-px bg-muted",e),ref:o,...t}));vl.displayName=ve.Separator.displayName;var ir=require("motion/react");var Da=Ce(require("@radix-ui/react-tabs"));function fi({className:e,...t}){return(0,ci.jsx)(Da.Root,{"data-slot":"tabs",className:S("flex flex-col gap-2",e),...t})}function vi({className:e,...t}){return(0,ci.jsx)(Da.List,{"data-slot":"tabs-list",className:S("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function hi({className:e,...t}){return(0,ci.jsx)(Da.Trigger,{"data-slot":"tabs-trigger",className:S("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 Jt=Ce(require("react")),he=Ce(require("@radix-ui/react-dropdown-menu")),Va=require("@radix-ui/react-icons");var ga=he.Root,fa=he.Trigger;var bi=Jt.forwardRef(({className:e,inset:t,children:o,...a},r)=>(0,ci.jsxs)(he.SubTrigger,{ref:r,className:S("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),...a,children:[o,(0,ci.jsx)(Va.ChevronRightIcon,{className:"ml-auto"})]}));bi.displayName=he.SubTrigger.displayName;var xi=Jt.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(he.SubContent,{ref:o,className:S("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}));xi.displayName=he.SubContent.displayName;var Xt=Jt.forwardRef(({className:e,sideOffset:t=4,...o},a)=>(0,ci.jsx)(he.Portal,{children:(0,ci.jsx)(he.Content,{ref:a,sideOffset:t,className:S("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));Xt.displayName=he.Content.displayName;var Ot=Jt.forwardRef(({className:e,inset:t,...o},a)=>(0,ci.jsx)(he.Item,{ref:a,className:S("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...o}));Ot.displayName=he.Item.displayName;var yi=Jt.forwardRef(({className:e,children:t,checked:o,...a},r)=>(0,ci.jsxs)(he.CheckboxItem,{ref:r,className:S("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 ci-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:o,...a,children:[(0,ci.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ci.jsx)(he.ItemIndicator,{children:(0,ci.jsx)(Va.CheckIcon,{className:"h-4 w-4"})})}),t]}));yi.displayName=he.CheckboxItem.displayName;var wi=Jt.forwardRef(({className:e,children:t,...o},a)=>(0,ci.jsxs)(he.RadioItem,{ref:a,className:S("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 ci-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...o,children:[(0,ci.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ci.jsx)(he.ItemIndicator,{children:(0,ci.jsx)(Va.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));wi.displayName=he.RadioItem.displayName;var Ci=Jt.forwardRef(({className:e,inset:t,...o},a)=>(0,ci.jsx)(he.Label,{ref:a,className:S("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...o}));Ci.displayName=he.Label.displayName;var Ni=Jt.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(he.Separator,{ref:o,className:S("-mx-1 my-1 h-px bg-muted",e),...t}));Ni.displayName=he.Separator.displayName;var Si=({className:e,...t})=>(0,ci.jsx)("span",{className:S("ml-auto text-xs tracking-widest opacity-60",e),...t});Si.displayName="DropdownMenuShortcut";function Ao({activeTab:e,onTabChange:t,tabOptions:o,className:a="",maxWidth:r="700px",gridCols:i=6}){let c=o.find(s=>s.value===e);return(0,ci.jsxs)(ir.motion.div,{className:`flex-1 flex justify-center ${a}`,initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},children:[(0,ci.jsx)("div",{className:"hidden lg:block",children:(0,ci.jsx)(fi,{value:e,onValueChange:t,children:(0,ci.jsx)(vi,{className:"grid w-full rounded-2xl p-0 h-10",style:{maxWidth:r,gridTemplateColumns:`repeat(${Math.min(i,o.length)}, minmax(0, 1fr))`},children:o.map(s=>(0,ci.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,ci.jsx)(hi,{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,ci.jsx)("div",{className:"lg:hidden",children:(0,ci.jsxs)(ga,{children:[(0,ci.jsx)(fa,{asChild:!0,children:(0,ci.jsxs)(x,{variant:"outline",className:"rounded-2xl min-w-[140px] justify-between",children:[c?.label||"Select",(0,ci.jsx)(Pt.ChevronDown,{className:"h-4 w-4 ml-2"})]})}),(0,ci.jsx)(Xt,{align:"center",className:"w-[180px]",children:o.map(s=>(0,ci.jsx)(Ot,{onClick:()=>t?.(s.value),className:`cursor-pointer ${e===s.value?"bg-accent":""}`,children:s.label},s.value))})]})})]})}var Eo=Ce(require("react")),Yt=Ce(require("@radix-ui/react-avatar"));var Qt=Eo.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(Yt.Root,{ref:o,className:S("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));Qt.displayName=Yt.Root.displayName;var sr=Eo.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(Yt.Image,{ref:o,className:S("aspect-square h-full w-full",e),...t}));sr.displayName=Yt.Image.displayName;var ea=Eo.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(Yt.Fallback,{ref:o,className:S("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ea.displayName=Yt.Fallback.displayName;var Ti=(0,li.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 me({className:e,variant:t,...o}){return(0,ci.jsx)("div",{className:S(Ti({variant:t}),e),...o})}function Io({colleague:e,onEdit:t,onDelete:o,onViewDetails:a,showActions:r=!0,compact:i=!1,className:c}){let[s,m]=(0,jt.useState)(!1),n=g=>{switch(g){case"active":return"bg-green-500";case"inactive":return"bg-gray-500";default:return"bg-gray-500"}},l=g=>{switch(g){case"active":return"Active";case"inactive":return"Inactive";default:return"Unknown"}},d=g=>{if(!g)return"Never";let b=Math.floor((new Date().getTime()-g.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,ci.jsxs)(U,{className:S("hover:shadow-md transition-shadow",i&&"p-2",c),children:[(0,ci.jsx)(Ge,{className:S("pb-3",i&&"pb-2"),children:(0,ci.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ci.jsx)("div",{className:"relative",children:(0,ci.jsxs)(Qt,{className:S("h-12 w-12",i&&"h-8 w-8"),children:[(0,ci.jsx)(sr,{src:"/placeholder.svg",alt:e.name||"name"}),(0,ci.jsx)(ea,{children:e.name?.split(" ").map(g=>g[0]).join("")})]})}),(0,ci.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("h3",{className:S("font-semibold text-sm truncate",i&&"text-xs"),children:e.name}),e.type==="digital"?(0,ci.jsx)(Pt.Bot,{className:S("h-4 w-4 text-blue-500",i&&"h-3 w-3")}):(0,ci.jsx)(Pt.User,{className:S("h-4 w-4 text-green-500",i&&"h-3 w-3")})]}),(0,ci.jsx)("p",{className:S("text-sm text-muted-foreground truncate",i&&"text-xs")}),!i&&(0,ci.jsx)("div",{className:"flex items-center gap-2 ci-1"})]})]}),r&&(0,ci.jsxs)(ga,{children:[(0,ci.jsx)(fa,{asChild:!0,children:(0,ci.jsx)(x,{variant:"ghost",size:"icon",className:S("h-8 w-8",i&&"h-6 w-6"),children:(0,ci.jsx)(Pt.MoreHorizontal,{className:S("h-4 w-4",i&&"h-3 w-3")})})}),(0,ci.jsxs)(Xt,{align:"end",children:[e.type==="digital"&&(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsxs)(Ot,{onClick:()=>a?.(e),children:[(0,ci.jsx)(Pt.Settings,{className:"h-4 w-4 mr-2"}),"View Details"]}),(0,ci.jsxs)(Ot,{onClick:()=>t?.(e),children:[(0,ci.jsx)(Pt.Edit,{className:"h-4 w-4 mr-2"}),"Edit"]})]}),(0,ci.jsxs)(Ot,{onClick:()=>o?.(e.id.toString()),className:"text-destructive focus:text-destructive",children:[(0,ci.jsx)(Pt.Trash2,{className:"h-4 w-4 mr-2"}),e.type==="digital"?"Delete":"Remove from team"]})]})]})]})}),!i&&(0,ci.jsxs)(fe,{className:"ci-0",children:[(0,ci.jsx)("div",{className:"space-y-2 text-sm",children:e.type==="human"&&(0,ci.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,ci.jsx)(Pt.Mail,{className:"h-3 w-3"}),(0,ci.jsx)("span",{className:"truncate",children:e.email})]})}),e.type==="digital"&&(0,ci.jsx)("div",{className:"ci-3",children:(0,ci.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.capabilities?.slice(0,s?e.capabilities.length:2).map(g=>(0,ci.jsx)(me,{variant:"outline",className:"text-xs",children:typeof g.value=="number"?g.value:g.value.name},typeof g.value=="number"?g.value:g.value.name)),(e.capabilities?.length||0)>2&&(0,ci.jsx)(x,{variant:"ghost",size:"sm",className:"h-5 px-2 text-xs",onClick:()=>m(!s),children:s?"Show less":`+${(e.capabilities?.length||0)-2} more`})]})})]})]})}var Ai=Ce(require("react")),nr=Ce(require("@radix-ui/react-label"));var hl=(0,li.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),T=Ai.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(nr.Root,{ref:o,className:S(hl(),e),...t}));T.displayName=nr.Root.displayName;var Ii=Ce(require("react")),Te=Ii.forwardRef(({className:e,...t},o)=>(0,ci.jsx)("textarea",{className:S("flex min-h-[80px] w-full rounded border border-border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...t}));Te.displayName="Textarea";var lr=Ce(require("react")),Et=Ce(require("@radix-ui/react-scroll-area"));var no=lr.forwardRef(({className:e,children:t,...o},a)=>(0,ci.jsxs)(Et.Root,{ref:a,className:S("relative overflow-hidden",e),...o,children:[(0,ci.jsx)(Et.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),(0,ci.jsx)(Bi,{}),(0,ci.jsx)(Et.Corner,{})]}));no.displayName=Et.Root.displayName;var Bi=lr.forwardRef(({className:e,orientation:t="vertical",...o},a)=>(0,ci.jsx)(Et.ScrollAreaScrollbar,{ref:a,orientation:t,className:S("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),...o,children:(0,ci.jsx)(Et.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Bi.displayName=Et.ScrollAreaScrollbar.displayName;function Li({selectedDocuments:e,onDocumentsChange:t,availableDocuments:o,label:a,placeholder:r="Search knowledge documents...",maxSelections:i,disabled:c=!1}){let[s,m]=(0,jt.useState)(""),[n,l]=(0,jt.useState)([]),[d,g]=(0,jt.useState)(!1);(0,jt.useEffect)(()=>{if(!s.trim()){l([]),g(!1);return}let p=o.filter(C=>{if(e.map(R=>R.id).includes(C.id))return!1;let h=s.toLowerCase();return C.title.toLowerCase().includes(h)||C.description?.toLowerCase().includes(h)||C.tags?.some(R=>R.toLowerCase().includes(h))||Object.values(C.metadata||{}).some(R=>String(R).toLowerCase().includes(h))});l(p),g(!0)},[s,e,o]);let w=p=>{i&&e.length>=i&&e.pop(),t([...e,p]),m(""),g(!1)},b=p=>{console.log("doc",p,e),t(e.filter(C=>C.id!==p))},y=!i||e.length<i;return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:a}),(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)(Pt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,ci.jsx)(O,{value:s,onChange:p=>m(p.target.value),placeholder:y?r:`Maximum ${i} documents selected`,className:"pl-9",disabled:c||!y,onFocus:()=>s&&g(!0)})]}),d&&n.length>0&&(0,ci.jsx)(U,{className:"absolute top-full left-0 right-0 z-10 ci-1 max-h-60",children:(0,ci.jsx)(no,{className:"h-full",children:(0,ci.jsx)(fe,{className:"p-2",children:n.map(p=>(0,ci.jsx)(x,{variant:"ghost",className:"w-full justify-start h-auto p-3 mb-1",onClick:()=>w(p),disabled:c,children:(0,ci.jsxs)("div",{className:"flex items-start gap-3 w-full",children:[(0,ci.jsx)(Pt.FileText,{className:"h-4 w-4 ci-0.5 text-muted-foreground flex-shrink-0"}),(0,ci.jsxs)("div",{className:"text-left flex-1 min-w-0",children:[(0,ci.jsx)("div",{className:"font-medium text-sm truncate",children:p.title}),p.description&&(0,ci.jsx)("div",{className:"text-xs text-muted-foreground ci-1 line-clamp-2",children:p.description}),p.tags&&p.tags.length>0&&(0,ci.jsxs)("div",{className:"flex flex-wrap gap-1 ci-2",children:[p.tags.slice(0,3).map(C=>(0,ci.jsx)(me,{variant:"outline",className:"text-xs",children:C},C)),p.tags.length>3&&(0,ci.jsxs)(me,{variant:"outline",className:"text-xs",children:["+",p.tags.length-3," more"]})]})]})]})},p.id))})})}),d&&s&&n.length===0&&(0,ci.jsx)(U,{className:"absolute top-full left-0 right-0 z-10 ci-1",children:(0,ci.jsxs)(fe,{className:"p-4 text-center text-sm text-muted-foreground",children:['jt knowledge documents found for "',s,'"']})})]}),e.length>0&&(0,ci.jsx)("div",{className:"space-y-2",children:(0,ci.jsx)("div",{className:"space-y-2",children:e.map(p=>(0,ci.jsx)(U,{className:"p-3",children:(0,ci.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ci.jsx)(Pt.FileText,{className:"h-4 w-4 ci-0.5 text-muted-foreground flex-shrink-0"}),(0,ci.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ci.jsx)("div",{className:"font-medium text-sm",children:p.title}),p.description&&(0,ci.jsx)("div",{className:"text-xs text-muted-foreground ci-1",children:p.description}),p.tags&&p.tags.length>0&&(0,ci.jsx)("div",{className:"flex flex-wrap gap-1 ci-2",children:p.tags.map(C=>(0,ci.jsxs)(me,{variant:"outline",className:"text-xs",children:[(0,ci.jsx)(Pt.Tag,{className:"h-3 w-3 mr-1"}),C]},C))})]}),(0,ci.jsx)(x,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",onClick:()=>b(p.id),disabled:c,children:(0,ci.jsx)(Pt.X,{className:"h-3 w-3"})})]})},p.id))})}),d&&(0,ci.jsx)("div",{className:"fixed inset-0 z-0",onClick:()=>g(!1)})]})}function dr({colleague:e,onSave:t,onCancel:o,isLoading:a=!1,title:r,submitLabel:i,cancelLabel:c="Cancel",readOnly:s=!1,availableKnowledgeDocuments:m=[]}){let[n,l]=(0,jt.useState)({type:"digital",name:"",description:"",jobDescription:"",workInstructions:"",capabilities:[],capabilityLevel:0,coreKnowledge:null,...e}),[d,g]=(0,jt.useState)(""),[w,b]=(0,jt.useState)(""),[y,p]=(0,jt.useState)(!s);(0,jt.useEffect)(()=>{e&&l(e)},[e]);let C=P=>{P.preventDefault();let K={id:n.id||parseInt(Date.now().toString()),name:n.name,type:"digital",description:n.description,jobDescription:n.jobDescription||"",workInstructions:n.workInstructions||"",capabilities:n.capabilities||[],capabilityLevel:n.capabilityLevel||0,coreKnowledge:n.coreKnowledge||null};t(K)},N=(P,K,J)=>{if(!K.trim())return;let L=n[P]||[];l({...n,[P]:[...L,K.trim()]}),J("")},h=(P,K)=>{let J=n[P]||[];l({...n,[P]:J.filter((L,E)=>E!==K)})},R=P=>{P.preventDefault(),p(!y)},te=(P,K,J,L,E)=>{let Re=n[P]||[];return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:K}),y&&(0,ci.jsxs)("div",{className:"flex gap-2",children:[(0,ci.jsx)(O,{value:J,onChange:xe=>L(xe.target.value),placeholder:E,onKeyPress:xe=>{xe.key==="Enter"&&(xe.preventDefault(),N(P,J,L))},disabled:a}),(0,ci.jsx)(x,{type:"button",variant:"outline",size:"icon",onClick:()=>N(P,J,L),disabled:a,children:(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"})})]}),(0,ci.jsx)("div",{className:"flex flex-wrap gap-2",children:Re.map((xe,z)=>(0,ci.jsxs)(me,{className:"gap-1",children:[xe,y&&(0,ci.jsx)(x,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-accent hover:text-accent-foreground",onClick:()=>h(P,z),disabled:a,children:(0,ci.jsx)(Pt.X,{className:"h-3 w-3"})})]},`${P}-${z}-${xe}`))})]})},D=r||(y?e?"Edit Colleague":"Add New Colleague":"View Colleague"),H=i||(e?"Update Colleague":"Add Colleague");return(0,ci.jsxs)(U,{className:"m-8 w-full max-w-4xl mx-auto",children:[(0,ci.jsx)(Ge,{children:(0,ci.jsxs)(Qe,{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Bot,{className:"h-5 w-5"}),D]})}),(0,ci.jsx)(fe,{children:(0,ci.jsxs)("form",{onSubmit:C,className:"space-y-6",children:[(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Name *"}),(0,ci.jsx)(O,{id:"name",value:n.name||"",onChange:P=>l({...n,name:P.target.value}),required:!0,disabled:a||!y})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Te,{id:"description",value:n.description||"",onChange:P=>l({...n,description:P.target.value}),rows:3,placeholder:"Brief description of this digital colleague...",disabled:a||!y})]})]}),(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)("h3",{className:"text-lg font-semibold",children:"Digital Colleague Details"}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"jobDescription",children:"Job Description *"}),(0,ci.jsx)(Te,{id:"jobDescription",value:n.jobDescription||"",onChange:P=>l({...n,jobDescription:P.target.value}),rows:4,required:n.type==="digital",disabled:a||!y})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"workInstructions",children:"Work Instructions"}),(0,ci.jsx)(Te,{id:"workInstructions",value:n.workInstructions||"",onChange:P=>l({...n,workInstructions:P.target.value}),rows:4,placeholder:"Enter detailed work instructions for this digital colleague...",disabled:a||!y})]}),te("capabilities","Capabilities",w,b,"Add capability"),(0,ci.jsx)(Li,{selectedDocuments:n.coreKnowledge?[{id:n.coreKnowledge?.id?.toString(),title:n.coreKnowledge?.name,format:"markdown",content:n.coreKnowledge?.content||"",createdAt:new Date(n.coreKnowledge?.createdAt),description:n.coreKnowledge?.description||"",metadata:n.coreKnowledge?.metadata||{},updatedAt:new Date(n.coreKnowledge?.updatedAt)}]:[],onDocumentsChange:P=>{let K={createdAt:P[0]?.createdAt.toISOString(),id:parseInt(P[0]?.id),name:P[0]?.title,source:"payload",updatedAt:(P[0]?.updatedAt||new Date).toISOString()};console.log(P),l({...n,coreKnowledge:P&&P.length>0?K:void 0})},label:"Core Knowledge",placeholder:"Search for core knowledge documents...",maxSelections:1,disabled:a||!y,availableDocuments:m.map(P=>({id:P.id.toString(),title:P.name,name:P.name,format:"markdown",content:P.content||"",createdAt:new Date(P.createdAt),source:P.source,description:P.description||"",metadata:P.metadata||{},updatedAt:new Date(P.updatedAt)}))})]}),(0,ci.jsxs)("div",{className:"flex justify-end gap-2 ci-4 border-t",children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:o,disabled:a,children:y?c:"Close"}),y?(0,ci.jsx)(x,{type:"submit",disabled:a,children:a?"Saving...":H}):(0,ci.jsxs)(x,{type:"button",onClick:R,disabled:a,className:"gap-2",children:[(0,ci.jsx)(Pt.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})})]})}function Hi({users:e,onUserSelect:t,onCancel:o,selectedUserId:a}){let[r,i]=(0,jt.useState)(""),c=(0,jt.useMemo)(()=>e.filter(m=>m.name?.toLowerCase().includes(r.toLowerCase())||m.email.toLowerCase().includes(r.toLowerCase())),[e,r]),s=m=>{t(m)};return(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ci.jsxs)(x,{variant:"ghost",onClick:o,className:"gap-2",children:[(0,ci.jsx)(Pt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-3xl font-bold",children:"Select User"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Choose a user to add as a colleague"})]})]}),(0,ci.jsx)(U,{className:"container",children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsx)("div",{className:"flex flex-col md:flex-row gap-4",children:(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)(Pt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,ci.jsx)(O,{placeholder:"Search users by name, email, role, or skills...",value:r,onChange:m=>i(m.target.value),className:"pl-9"})]})})})})}),(0,ci.jsx)("div",{className:"container grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:c.map(m=>(0,ci.jsx)(ir.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,ci.jsxs)(U,{className:`cursor-pointer transition-all hover:shadow-lg ${a===m.id?"ring-2 ring-primary":""}`,onClick:()=>s(m),children:[(0,ci.jsx)(Ge,{className:"pb-3",children:(0,ci.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ci.jsx)(Qt,{children:(0,ci.jsx)(ea,{children:(0,ci.jsx)(Pt.User,{className:"h-4 w-4"})})}),(0,ci.jsx)("div",{children:(0,ci.jsx)(Qe,{className:"text-lg",children:m.name})})]}),a===m.id&&(0,ci.jsx)(Pt.Check,{className:"h-5 w-5 text-primary"})]})}),(0,ci.jsx)(fe,{className:"ci-0",children:(0,ci.jsxs)("div",{className:"space-y-3",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("p",{className:"text-sm text-muted-foreground",children:"Email"}),(0,ci.jsx)("p",{className:"text-sm font-medium",children:m.email})]}),(0,ci.jsx)("div",{children:(0,ci.jsx)("p",{className:"text-sm text-muted-foreground",children:"Department"})})]})})]})},m.id))}),c.length===0&&(0,ci.jsx)(U,{className:"container ci-4",children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"text-center py-8",children:[(0,ci.jsx)(Pt.User,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,ci.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"jt users found"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"user-selection")})})}function Oi({digitalColleagues:e,onColleagueClone:t,onCancel:o,selectedColleagueId:a}){let[r,i]=(0,jt.useState)(""),[c,s]=(0,jt.useState)("all"),m=(0,jt.useMemo)(()=>e.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())||d.jobDescription?.toLowerCase().includes(r.toLowerCase())||d.workInstructions?.toLowerCase().includes(r.toLowerCase())),[e,r,c]),n=d=>{let g={...d,name:`${d.name} (Copy)`};t(g)},l=d=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(d);return(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ci.jsxs)(x,{variant:"ghost",onClick:o,className:"gap-2",children:[(0,ci.jsx)(Pt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-3xl font-bold",children:"Clone Digital Colleague"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Select a digital colleague to clone"})]})]}),(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)(Pt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,ci.jsx)(O,{placeholder:"Search by name, job description, or capabilities...",value:r,onChange:d=>i(d.target.value),className:"pl-9"})]})}),(0,ci.jsxs)("select",{value:c,onChange:d=>s(d.target.value),className:"h-10 px-3 rounded-md border border-input bg-background text-sm ring-offset-background",children:[(0,ci.jsx)("option",{value:"all",children:"All Status"}),(0,ci.jsx)("option",{value:"active",children:"Active"}),(0,ci.jsx)("option",{value:"inactive",children:"Inactive"})]})]})})}),(0,ci.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:m.map(d=>(0,ci.jsx)(ir.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,ci.jsxs)(U,{className:`cursor-pointer transition-all hover:shadow-lg ${a?.toString()===d.id.toString()?"ring-2 ring-primary":""}`,onClick:()=>n(d),children:[(0,ci.jsx)(Ge,{className:"pb-3",children:(0,ci.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ci.jsx)(Qt,{children:(0,ci.jsx)(ea,{className:"bg-blue-100",children:(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-blue-600"})})}),(0,ci.jsx)("div",{children:(0,ci.jsx)(Qe,{className:"text-lg flex items-center gap-2",children:d.name})})]}),(0,ci.jsxs)(x,{size:"sm",variant:"outline",className:"gap-2 h-8",onClick:g=>{g.stopPropagation(),n(d)},children:[(0,ci.jsx)(Pt.Copy,{className:"h-3 w-3"}),"Clone"]})]})}),(0,ci.jsx)(fe,{className:"ci-0",children:(0,ci.jsxs)("div",{className:"space-y-3",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("p",{className:"text-sm text-muted-foreground",children:"Job Description"}),(0,ci.jsx)("p",{className:"text-sm line-clamp-2",children:d.jobDescription})]}),d.capabilities&&d.capabilities.length>0&&(0,ci.jsxs)("div",{children:[(0,ci.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Capabilities"}),(0,ci.jsx)("div",{className:"flex flex-wrap gap-1",children:d.capabilities.length>3&&(0,ci.jsxs)(me,{variant:"outline",className:"text-xs",children:["+",d.capabilities.length-3]})})]}),(0,ci.jsx)("div",{className:"flex items-center justify-between text-xs text-muted-foreground"}),d.workInstructions&&(0,ci.jsxs)("div",{children:[(0,ci.jsx)("p",{className:"text-sm text-muted-foreground",children:"Instructions"}),(0,ci.jsx)("p",{className:"text-xs line-clamp-2",children:d.workInstructions})]})]})})]})},d.id))}),m.length===0&&(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"text-center py-8",children:[(0,ci.jsx)(Pt.Bot,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,ci.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"jt digital colleagues found"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"colleague-clone")})})}function Vi({onSelectHuman:e,onSelectDigital:t,onCancel:o}){return(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ci.jsxs)(x,{variant:"ghost",onClick:o,className:"gap-2",children:[(0,ci.jsx)(Pt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-3xl font-bold",children:"Add Colleague"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Choose the type of colleague to add"})]})]}),(0,ci.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,ci.jsxs)(U,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,ci.jsxs)(Ge,{className:"text-center pb-4",children:[(0,ci.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,ci.jsx)(Pt.User,{className:"h-8 w-8 text-blue-600"})}),(0,ci.jsx)(Qe,{className:"text-xl",children:"Add Human Colleague"})]}),(0,ci.jsxs)(fe,{className:"text-center",children:[(0,ci.jsx)("p",{className:"text-muted-foreground mb-4",children:"Select from existing users in your organization to add as team members."}),(0,ci.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Users,{className:"h-4 w-4 text-blue-600"}),(0,ci.jsx)("span",{children:"Browse existing users"})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.User,{className:"h-4 w-4 text-blue-600"}),(0,ci.jsx)("span",{children:"Import user details automatically"})]})]}),(0,ci.jsx)(x,{className:"ci-6 w-full",onClick:e,children:"Select User"})]})]})}),(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,ci.jsxs)(U,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,ci.jsxs)(Ge,{className:"text-center pb-4",children:[(0,ci.jsx)("div",{className:"mx-auto w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:(0,ci.jsx)(Pt.Bot,{className:"h-8 w-8 text-purple-600"})}),(0,ci.jsx)(Qe,{className:"text-xl",children:"Add Digital Colleague"})]}),(0,ci.jsxs)(fe,{className:"text-center",children:[(0,ci.jsx)("p",{className:"text-muted-foreground mb-4",children:"Clone an existing digital colleague or create a new AI assistant for your team."}),(0,ci.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-purple-600"}),(0,ci.jsx)("span",{children:"Clone existing colleagues"})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Users,{className:"h-4 w-4 text-purple-600"}),(0,ci.jsx)("span",{children:"Create from templates"})]})]}),(0,ci.jsx)(x,{className:"ci-6 w-full",onClick:t,children:"Add Digital Colleague"})]})]})})]})]},"colleague-type-selection")})})}function ji({onCloneExisting:e,onCreateNew:t,onCancel:o}){return(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ci.jsxs)(x,{variant:"ghost",onClick:o,className:"gap-2",children:[(0,ci.jsx)(Pt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-3xl font-bold",children:"Add Digital Colleague"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Choose how to create your digital colleague"})]})]}),(0,ci.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,ci.jsxs)(U,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,ci.jsxs)(Ge,{className:"text-center pb-4",children:[(0,ci.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,ci.jsx)(Pt.Copy,{className:"h-8 w-8 text-blue-600"})}),(0,ci.jsx)(Qe,{className:"text-xl",children:"Clone Existing"})]}),(0,ci.jsxs)(fe,{className:"text-center",children:[(0,ci.jsx)("p",{className:"text-muted-foreground mb-4",children:"Start with an existing digital colleague and customize ci for your needs."}),(0,ci.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-blue-600"}),(0,ci.jsx)("span",{children:"Pre-configured capabilities"})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Copy,{className:"h-4 w-4 text-blue-600"}),(0,ci.jsx)("span",{children:"Inherit knowledge base"})]})]}),(0,ci.jsx)(x,{className:"ci-6 w-full",onClick:e,children:"Browse & Clone"})]})]})}),(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,ci.jsxs)(U,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,ci.jsxs)(Ge,{className:"text-center pb-4",children:[(0,ci.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,ci.jsx)(Pt.Sparkles,{className:"h-8 w-8 text-green-600"})}),(0,ci.jsx)(Qe,{className:"text-xl",children:"Create New"})]}),(0,ci.jsxs)(fe,{className:"text-center",children:[(0,ci.jsx)("p",{className:"text-muted-foreground mb-4",children:"Build a completely new digital colleague from scratch with custom specifications."}),(0,ci.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4 text-green-600"}),(0,ci.jsx)("span",{children:"Custom job description"})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Sparkles,{className:"h-4 w-4 text-green-600"}),(0,ci.jsx)("span",{children:"Define unique capabilities"})]})]}),(0,ci.jsx)(x,{className:"ci-6 w-full",onClick:t,children:"Create from Scratch"})]})]})})]})]},"digital-colleague-options")})})}function Ki(e,t){let[o,a]=(0,jt.useState)(()=>{if(typeof window>"ci")return t;try{let i=window.localStorage.getItem(e);return i?JSON.parse(i):t}catch{return t}}),r=i=>{try{a(i),typeof window<"ci"&&window.localStorage.setItem(e,JSON.stringify(i))}catch{}};return(0,jt.useEffect)(()=>{r(o)},[]),[o,r]}var Lo=require("react-icons/fa");function gt({title:e,description:t,badge:o,primaryAction:a,secondaryAction:r,gradient:i,children:c,className:s}){let[m,n]=Ki(`hero-section-minimized-${e.replace(/\s+/g,"-").toLowerCase()}`,!r&&!t),l=!r&&!t||m;return(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:`overflow-hidden rounded-3xl ${i} p-8 text-white ${s||""}`,children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[o&&(0,ci.jsx)(me,{className:"bg-white/20 text-white hover:bg-white/30 rounded-xl",children:o}),(0,ci.jsx)("h2",{className:"text-3xl font-bold m-0",children:e})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[l&&a&&(0,ci.jsx)(x,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:a.onClick,children:a.label}),(r||t)&&(0,ci.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:()=>n(!m),style:{lineHeight:0},children:m?(0,ci.jsx)(Lo.FaChevronDown,{size:22}):(0,ci.jsx)(Lo.FaChevronUp,{size:22})})]})]}),!l&&(0,ci.jsxs)("div",{className:"flex flex-col gap-6 md:flex-row md:items-center md:justify-between",children:[(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)("p",{className:"max-w-[600px] text-white/80",children:t}),(0,ci.jsxs)("div",{className:"flex flex-wrap gap-3",children:[a&&(0,ci.jsx)(x,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:a.onClick,children:a.label}),r&&(0,ci.jsx)(x,{variant:"outline",className:"rounded-2xl bg-transparent border-white text-white hover:bg-white/10",onClick:r.onClick,children:r.label})]})]}),c&&(0,ci.jsx)("div",{className:"hidden lg:block",children:c})]})]})}function cr({initialColleagues:e,onColleagueAdd:t,onColleagueEdit:o,onColleagueDelete:a,compactView:r=!1,departments:i=["Design","Engineering","Marketing","Product","Sales","Operations"],className:c,availableUsers:s=[],existingDigitalColleagues:m=[],availableKnowledgeDocuments:n=[]}){let[l,d]=(0,jt.useState)(e||[]),[g,w]=(0,jt.useState)(""),[b,y]=(0,jt.useState)("all"),[p,C]=(0,jt.useState)("all"),[N,h]=(0,jt.useState)("all"),[R,te]=(0,jt.useState)(null),[D,H]=(0,jt.useState)(null);(0,jt.useEffect)(()=>{d(e||[])},[e]);let P=Array.isArray(s)?s:[],K=Array.isArray(m)?m:[],[J,L]=(0,jt.useState)("main"),E=l.filter(F=>!F||!F.name?!1:F.name.toLowerCase().includes(g.toLowerCase())||F.type==="human"&&F.email?.toLowerCase().includes(g.toLowerCase())||F.type==="digital"&&F.jobDescription?.toLowerCase().includes(g.toLowerCase())),Re=E.filter(F=>F.type==="human"),xe=E.filter(F=>F.type==="digital"),z=()=>{L("typeSelection")},ue=F=>{F.type==="digital"&&(te(F),L("form")),console.log("Editing colleague:",F),o?.(F)},Ae=F=>{F.type==="digital"&&(H(F),L("view"))},ht=F=>{let Ue={id:`human-${Date.now()}`,type:"human",name:F.name,email:F.email,updatedAt:F.updatedAt,createdAt:F.createdAt,accounts:F.accounts};d(At=>[...At,Ue]),t?.(Ue),L("main")},lt=F=>{if(!F||!F.id){console.error("Invalid cloned colleague provided to handleDigitalColleagueClone:",F);return}d(Ue=>[...Ue,{...F,type:"digital"}]),t?.({...F,type:"digital"}),L("main")},St=()=>{te(null),L("form")},M=F=>{if(!F||!F.id){console.error("Invalid colleague provided to handleSaveColleague:",F);return}R?(d(Ue=>Ue.map(At=>At.id===F.id?{...F,type:"digital"}:At)),o?.({...F,type:"digital"})):(d(Ue=>[...Ue,{...F,type:"digital"}]),t?.({...F,type:"digital"})),L("main"),te(null)},ye=()=>{L("main"),te(null),H(null)},Fe=()=>{L("main"),H(null)},Tt=()=>{D&&(te(D),H(null),L("form"))},ke=F=>{console.log("deleting",F,l),a?.(F,l.find(Ue=>Ue.id.toString()===F.toString())?.type),d(Ue=>Ue.filter(At=>At.id!==F))},yt=()=>{w(""),y("all"),C("all")};return J==="typeSelection"?(0,ci.jsx)(Vi,{onSelectHuman:()=>L("userSelection"),onSelectDigital:()=>L("digitalOptions"),onCancel:()=>L("main")}):J==="userSelection"?(0,ci.jsx)(Hi,{users:P,onUserSelect:ht,onCancel:()=>L("typeSelection")}):J==="digitalOptions"?(0,ci.jsx)(ji,{onCloneExisting:()=>L("digitalClone"),onCreateNew:St,onCancel:()=>L("typeSelection")}):J==="digitalClone"?(0,ci.jsx)(Oi,{digitalColleagues:K,onColleagueClone:lt,onCancel:()=>L("digitalOptions")}):J==="form"?(0,ci.jsx)(dr,{colleague:R||void 0,onSave:M,onCancel:ye,availableKnowledgeDocuments:n}):J==="view"?(0,ci.jsx)(dr,{colleague:D||void 0,onSave:M,onCancel:Fe,readOnly:!0,availableKnowledgeDocuments:n}):(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsx)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,ci.jsxs)("div",{className:`space-y-6 ${c||""}`,children:[(0,ci.jsx)(gt,{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:z}}),(0,ci.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,ci.jsxs)(U,{children:[(0,ci.jsxs)(Ge,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,ci.jsx)(Qe,{className:"text-sm font-medium",children:"Total Colleagues"}),(0,ci.jsx)(Pt.Users,{className:"h-4 w-4 text-muted-foreground"})]}),(0,ci.jsxs)(fe,{children:[(0,ci.jsx)("div",{className:"text-2xl font-bold",children:l.length}),(0,ci.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]}),(0,ci.jsxs)(U,{children:[(0,ci.jsxs)(Ge,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,ci.jsx)(Qe,{className:"text-sm font-medium",children:"Human Members"}),(0,ci.jsx)(Pt.User,{className:"h-4 w-4 text-muted-foreground"})]}),(0,ci.jsxs)(fe,{children:[(0,ci.jsx)("div",{className:"text-2xl font-bold",children:l.filter(F=>F.type==="human").length}),(0,ci.jsx)("p",{className:"text-xs text-muted-foreground",children:"active"})]})]}),(0,ci.jsxs)(U,{children:[(0,ci.jsxs)(Ge,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,ci.jsx)(Qe,{className:"text-sm font-medium",children:"Digital Colleagues"}),(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-muted-foreground"})]}),(0,ci.jsxs)(fe,{children:[(0,ci.jsx)("div",{className:"text-2xl font-bold",children:l.filter(F=>F.type==="digital").length}),(0,ci.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]})]}),(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)(Pt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,ci.jsx)(O,{placeholder:"Search colleagues...",value:g,onChange:F=>w(F.target.value),className:"pl-9"})]})}),(0,ci.jsxs)(Be,{value:b,onValueChange:y,children:[(0,ci.jsx)(Ee,{className:"w-full md:w-[180px]",children:(0,ci.jsx)(Je,{placeholder:"Department"})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)(ne,{value:"all",children:"All Departments"}),i.map(F=>(0,ci.jsx)(ne,{value:F,children:F},F))]})]}),(0,ci.jsxs)(Be,{value:p,onValueChange:C,children:[(0,ci.jsx)(Ee,{className:"w-full md:w-[140px]",children:(0,ci.jsx)(Je,{placeholder:"Status"})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)(ne,{value:"all",children:"All Status"}),(0,ci.jsx)(ne,{value:"active",children:"Active"}),(0,ci.jsx)(ne,{value:"inactive",children:"Inactive"})]})]}),(g||b!=="all"||p!=="all")&&(0,ci.jsxs)(x,{variant:"outline",onClick:yt,className:"gap-2",children:[(0,ci.jsx)(Pt.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)(Ao,{activeTab:N,onTabChange:h,tabOptions:[{value:"all",label:`All (${E.length})`},{value:"human",label:`Human (${Re.length})`},{value:"digital",label:`Digital (${xe.length})`}],maxWidth:"400px",gridCols:3}),N==="all"&&(0,ci.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:E.map(F=>(0,ci.jsx)(Io,{colleague:F,onEdit:ue,onDelete:ke,onViewDetails:Ae,compact:r},`${F}-${F.id}`))}),N==="human"&&(0,ci.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:Re.map(F=>(0,ci.jsx)(Io,{colleague:F,onEdit:ue,onDelete:ke,onViewDetails:Ae,compact:r},F.id))}),N==="digital"&&(0,ci.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:xe.map(F=>(0,ci.jsx)(Io,{colleague:F,onEdit:ue,onDelete:ke,onViewDetails:Ae,compact:r},F.id))})]}),E.length===0&&(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"text-center py-8",children:[(0,ci.jsx)(Pt.Users,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,ci.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"jt colleagues found"}),(0,ci.jsx)("p",{className:"text-muted-foreground mb-4",children:g||b!=="all"||p!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first colleague."}),(0,ci.jsxs)(x,{onClick:z,className:"gap-2",children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),"Add Colleague"]})]})})})]})},"projects-index-view")})})}var bl=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 Oo({files:e,onFileClick:t,onFileEdit:o,onFileDelete:a,showHeader:r=!0,className:i}){return(0,ci.jsxs)("div",{className:`rounded-3xl border overflow-hidden ${i||""}`,children:[r&&(0,ci.jsxs)("div",{className:"bg-muted/50 p-3 hidden md:grid md:grid-cols-10 text-sm font-medium",children:[(0,ci.jsx)("div",{className:"col-span-6",children:"Name"}),(0,ci.jsx)("div",{className:"col-span-2",children:"Size"}),(0,ci.jsx)("div",{className:"col-span-2",children:"Modified"})]}),(0,ci.jsx)("div",{className:"divide-y",children:e.map(c=>(0,ci.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?.(c),children:[(0,ci.jsxs)("div",{className:"col-span-6 flex items-center gap-3 w-full md:w-auto",children:[(0,ci.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted"}),(0,ci.jsx)("div",{children:(0,ci.jsx)("p",{className:"font-medium",children:c.name})})]}),(0,ci.jsx)("div",{className:"col-span-2 text-sm md:text-base",children:bl(c.filesize)}),(0,ci.jsxs)("div",{className:"col-span-2 flex items-center justify-between w-full md:w-auto",children:[(0,ci.jsx)("span",{className:"text-sm md:text-base",children:new Date(c.createdAt).toLocaleDateString()}),(0,ci.jsx)("div",{className:"flex gap-1",children:(0,ci.jsx)(x,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:s=>{s.stopPropagation(),a?.(c)},children:(0,ci.jsx)($i.Trash2,{className:"h-4 w-4"})})})]})]},c.name))})]})}var po=Ce(require("react")),ut=Ce(require("@radix-ui/react-dialog"));var Xe=ut.Root;var _i=ut.Portal;var mr=po.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ut.Overlay,{ref:o,className:S("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}));mr.displayName=ut.Overlay.displayName;var _e=po.forwardRef(({className:e,children:t,...o},a)=>(0,ci.jsxs)(_i,{children:[(0,ci.jsx)(mr,{}),(0,ci.jsxs)(ut.Content,{ref:a,className:S("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),...o,children:[t,(0,ci.jsxs)(ut.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,ci.jsx)(Pt.X,{className:"h-4 w-4"}),(0,ci.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));_e.displayName=ut.Content.displayName;var We=({className:e,...t})=>(0,ci.jsx)("div",{className:S("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});We.displayName="DialogHeader";var Ua=({className:e,...t})=>(0,ci.jsx)("div",{className:S("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ua.displayName="DialogFooter";var qe=po.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ut.Title,{ref:o,className:S("text-lg font-semibold leading-none tracking-tight",e),...t}));qe.displayName=ut.Title.displayName;var $a=po.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ut.Description,{ref:o,className:S("text-sm text-muted-foreground",e),...t}));$a.displayName=ut.Description.displayName;var Wi=({isOpen:e,onClose:t,onAddFile:o})=>{let[a,r]=(0,jt.useState)(null),[i,c]=(0,jt.useState)(""),[s,m]=(0,jt.useState)(""),[n,l]=(0,jt.useState)(""),d=w=>{let b=w.target.files?.[0];b&&(r(b),i||c(b.name))},g=async w=>{if(w.preventDefault(),!a)return;let b=new FormData;b.append("file",a),b.append("name",i),s&&b.append("description",s),n&&b.append("tags",n),o?.(b),t(),r(null),c(""),m(""),l("")};return(0,ci.jsx)(Xe,{open:e,onOpenChange:t,children:(0,ci.jsxs)(_e,{className:"sm:max-w-md",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New File"})}),(0,ci.jsxs)("form",{onSubmit:g,className:"grid gap-4",children:[(0,ci.jsx)("div",{className:"flex items-center justify-center w-full",children:(0,ci.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,ci.jsxs)("div",{className:"flex flex-col items-center justify-center ci-5 pb-6",children:[(0,ci.jsx)(xl,{className:"w-10 h-10 text-gray-400"}),(0,ci.jsxs)("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:[(0,ci.jsx)("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),(0,ci.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"SVG, PNG, JPG or GIF (MAX. 800x400px)"})]}),(0,ci.jsx)("input",{id:"dropzone-file",type:"file",className:"hidden",onChange:d})]})}),a&&(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("p",{className:"font-medium",children:a.name}),(0,ci.jsxs)("p",{className:"text-sm text-muted-foreground",children:[((a.size||0)/1024).toFixed(2)," KB"]})]}),(0,ci.jsx)(x,{type:"submit",onClick:g,children:"Upload"})]})]})]})})};function xl(e){return(0,ci.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,ci.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,ci.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,ci.jsx)("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]})}function go({initialFiles:e=[],onFileAdd:t,onFileEdit:o,onFileDelete:a,onFileClick:r,compactView:i=!1,className:c}){let[s,m]=(0,$t.useState)(e),[n,l]=(0,$t.useState)(""),[d,g]=(0,$t.useState)("all"),[w,b]=(0,$t.useState)("all"),[y,p]=(0,$t.useState)(!1),C=(0,$t.useRef)(""),N=L=>L.map(E=>`${E.id}-${new Date(E.createdAt).getTime()}-${new Date(E.updatedAt).getTime()}`).join("-");(0,$t.useEffect)(()=>{let L=N(e);L!==C.current&&(m(e),C.current=L)},[e]);let h=s.filter(L=>L.name.toLowerCase().includes(n.toLowerCase())),R=h.slice(0,10),te=h.filter(Boolean),D=()=>{p(!0)},H=L=>{o?.(L)},P=L=>{console.log("deleting file",L),m(E=>E.filter(Re=>Re.name!==L.name)),a?.(L.id.toString())},K=L=>{r?.(L)},J=()=>{l(""),g("all")};return(0,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsx)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,ci.jsxs)("div",{className:`space-y-6 ${c||""}`,children:[(0,ci.jsx)(gt,{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:D},secondaryAction:{label:"Download all",onClick:()=>console.log("Download all clicked")}}),(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)(Pt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,ci.jsx)(O,{placeholder:"Search files...",value:n,onChange:L=>l(L.target.value),className:"pl-9"})]})}),(n||d!=="all")&&(0,ci.jsxs)(x,{variant:"outline",onClick:J,className:"gap-2",children:[(0,ci.jsx)(Pt.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)(Ao,{activeTab:w,onTabChange:b,tabOptions:[{value:"all",label:`All Files (${h.length})`},{value:"recent",label:`Recent (${R.length})`}],maxWidth:"500px",gridCols:3}),w==="all"&&(0,ci.jsx)(Oo,{files:h,onFileClick:K,onFileEdit:H,onFileDelete:P,showHeader:!i}),w==="recent"&&(0,ci.jsx)(Oo,{files:R,onFileClick:K,onFileEdit:H,onFileDelete:P,showHeader:!i}),w==="shared"&&(0,ci.jsx)(Oo,{files:te,onFileClick:K,onFileEdit:H,onFileDelete:P,showHeader:!i})]}),h.length===0&&(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"text-center py-8",children:[(0,ci.jsx)(Pt.File,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,ci.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"jt files found"}),(0,ci.jsx)("p",{className:"text-muted-foreground mb-4",children:n||d!=="all"?"Try adjusting your filters to see more results.":"Get started by uploading your first file."}),(0,ci.jsxs)(x,{onClick:D,className:"gap-2",children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),"Upload File"]})]})})})]})},"files-view")}),(0,ci.jsx)(Wi,{isOpen:y,onClose:()=>p(!1),onAddFile:t})]})}var bs=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),xs=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),ys=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),ws=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),Cs=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),Ns=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),Ss=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),_o=require("@payloadcms/richtext-lexical/lexical/list"),Ds=require("@payloadcms/richtext-lexical/lexical/rich-text"),ks=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var fs=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),vs=require("@payloadcms/richtext-lexical/lexical/utils"),Ne=require("@payloadcms/richtext-lexical/lexical"),kr=require("@payloadcms/richtext-lexical/lexical/selection");var yl=()=>(0,ci.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,ci.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"})}),qi=yl;var wl=()=>(0,ci.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,ci.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"})}),Zi=wl;var Cl=()=>(0,ci.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,ci.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,ci.jsx)("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),Ji=Cl;var Nl=()=>(0,ci.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,ci.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,ci.jsx)("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),Xi=Nl;var Sl=()=>(0,ci.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,ci.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"})}),Yi=Sl;var Dl=()=>(0,ci.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,ci.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"})}),Qi=Dl;var es=()=>(0,ci.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,ci.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"})}),ts=()=>(0,ci.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,ci.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"})}),as=()=>(0,ci.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,ci.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"})}),os=()=>(0,ci.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,ci.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"})}),rs=()=>(0,ci.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,ci.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 is=Ce(require("react")),zt=Ce(require("@radix-ui/react-tooltip"));var hr=zt.Provider,br=zt.Root,xr=zt.Trigger,jo=is.forwardRef(({className:e,sideOffset:t=4,...o},a)=>(0,ci.jsx)(zt.Portal,{children:(0,ci.jsx)(zt.Content,{ref:a,sideOffset:t,className:S("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));jo.displayName=zt.Content.displayName;var ss=Ce(require("react")),yr=Ce(require("@radix-ui/react-toggle"));var wr=(0,li.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=ir]:bg-accent data-[state=ir]: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"}}),kl=ss.forwardRef(({className:e,variant:t,size:o,...a},r)=>(0,ci.jsx)(yr.Root,{ref:r,className:S(wr({variant:t,size:o,className:e})),...a}));kl.displayName=yr.Root.displayName;var Ta=Ce(require("react")),Ga=Ce(require("@radix-ui/react-toggle-group"));var ds=Ta.createContext({size:"default",variant:"default"}),Pa=Ta.forwardRef(({className:e,variant:t,size:o,children:a,...r},i)=>(0,ci.jsx)(Ga.Root,{ref:i,className:S("flex items-center justify-center gap-1",e),...r,children:(0,ci.jsx)(ds.Provider,{value:{variant:t,size:o},children:a})}));Pa.displayName=Ga.Root.displayName;var Ra=Ta.forwardRef(({className:e,children:t,variant:o,size:a,...r},i)=>{let c=Ta.useContext(ds);return(0,ci.jsx)(Ga.Item,{ref:i,className:S(wr({variant:c.variant||o,size:c.size||a}),e),...r,children:t})});Ra.displayName=Ga.Item.displayName;var cs=Ce(require("react")),Gt=Ce(require("@radix-ui/react-popover"));var Nr=Gt.Root,Sr=Gt.Trigger;var zo=cs.forwardRef(({className:e,align:t="center",sideOffset:o=4,...a},r)=>(0,ci.jsx)(Gt.Portal,{children:(0,ci.jsx)(Gt.Content,{ref:r,align:t,sideOffset:o,className:S("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),...a})}));zo.displayName=Gt.Content.displayName;var ho=Ce(require("@radix-ui/react-checkbox")),ps=Ce(require("react")),bo=ps.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(ho.Root,{className:S("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:o,...t,children:(0,ci.jsx)(ho.Indicator,{className:S("flex items-center justify-center text-current"),children:(0,ci.jsx)(Pt.Check,{className:"h-4 w-4"})})}));bo.displayName=ho.Root.displayName;var us=require("react-day-picker");function $o({className:e,classNames:t,showOutsideDays:o=!0,...a}){return(0,ci.jsx)(us.DayPicker,{showOutsideDays:o,weekStartsOn:1,className:S("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 ci-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:S(ro({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 ci-2",cell:S("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",a.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:S(ro({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},...a})}$o.displayName="Calendar";var Dr=1;function Tl(){return(0,ci.jsx)("span",{className:"border border-[#222222]"})}function Tr(){let[e]=(0,fs.useLexicalComposerContext)(),t=(0,jt.useRef)(null),[o,a]=(0,jt.useState)(!1),[r,i]=(0,jt.useState)(!1),[c,s]=(0,jt.useState)(!1),[m,n]=(0,jt.useState)(!1),[l,d]=(0,jt.useState)(!1),[g,w]=(0,jt.useState)(!1),[b,y]=(0,jt.useState)(!1),[p,C]=(0,jt.useState)(!1),[N,h]=(0,jt.useState)(!1),[R,te]=(0,jt.useState)("left"),[D,H]=(0,jt.useState)("p"),P=z=>{e.update(()=>{let ue=(0,Ne.$getSelection)();(0,Ne.$isRangeSelection)(ue)&&(z==="p"?(0,kr.$setBlocksType)(ue,()=>(0,Ne.$createParagraphNode)()):(0,kr.$setBlocksType)(ue,()=>(0,Ds.$createHeadingNode)(z)))})},K=(0,jt.useCallback)(()=>{let z=(0,Ne.$getSelection)();if((0,Ne.$isRangeSelection)(z)){s(z.hasFormat("bold")),n(z.hasFormat("italic")),d(z.hasFormat("underline")),w(z.hasFormat("strikethrough")),y(z.hasFormat("subscript")),C(z.hasFormat("superscript"));let ue=z.anchor.getNode(),Ae=ue;for(;Ae&&!(0,Ne.$isParagraphNode)(Ae)&&Ae!==(0,Ne.$getRoot)();){let lt=Ae.getParent();lt&&(Ae=lt)}if(Ae){let lt=Ae.getFormatType();te(lt||"left")}let ht=ue.getTopLevelElement()?.__tag;H(ht||"p")}},[]);(0,jt.useEffect)(()=>(0,vs.mergeRegister)(e.registerUpdateListener(({editorState:z})=>{z.read(()=>{K()})}),e.registerCommand(Ne.SELECTION_CHANGE_COMMAND,(z,ue)=>(K(),!1),Dr),e.registerCommand(Ne.CAN_UNDO_COMMAND,z=>(a(z),!1),Dr),e.registerCommand(Ne.CAN_REDO_COMMAND,z=>(i(z),!1),Dr)),[e,K]);let J=[[{label:"Undo",icon:(0,ci.jsx)(Pt.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ne.UNDO_COMMAND,void 0)},disabled:!o},{label:"Redo",icon:(0,ci.jsx)(Pt.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ne.UNDO_COMMAND,void 0)},disabled:!r}],[{label:"Bold",icon:(0,ci.jsx)(qi,{}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:c},{label:"Italic",icon:(0,ci.jsx)(Zi,{}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:m},{label:"Underline",icon:(0,ci.jsx)(Ji,{}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:l},{label:"Strikethrough",icon:(0,ci.jsx)(Xi,{}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:g},{label:"Subscript",icon:(0,ci.jsx)(Yi,{}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:b},{label:"Superscript",icon:(0,ci.jsx)(Qi,{}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:p}]],L=[{label:"Left Align",direction:"left",icon:(0,ci.jsx)(Pt.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,ci.jsx)(Pt.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,ci.jsx)(Pt.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,ci.jsx)(Pt.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Ne.FORMAT_ELEMENT_COMMAND,"justify")}}],Re=[{label:"Normal Text",value:"p",icon:(0,ci.jsx)(es,{}),onClick:()=>P("p")},{label:"Heading 1",value:"h1",icon:(0,ci.jsx)(ts,{}),onClick:()=>P("h1")},{label:"Heading 2",value:"h2",icon:(0,ci.jsx)(as,{}),onClick:()=>P("h2")},{label:"Heading 3",value:"h3",icon:(0,ci.jsx)(os,{}),onClick:()=>P("h3")},{label:"Heading 4",value:"h4",icon:(0,ci.jsx)(rs,{}),onClick:()=>P("h4")},...[{label:"Unordered List",value:"ul",icon:(0,ci.jsx)(Pt.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(_o.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,ci.jsx)(Pt.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(_o.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],xe=[{label:"Insert Image",icon:(0,ci.jsx)(Pt.ImageUp,{width:15,height:15}),onClick:()=>{h(!0)},disabled:!1}];return(0,ci.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2",children:(0,ci.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[J.map((z,ue)=>(0,ci.jsxs)(jt.Fragment,{children:[(0,ci.jsx)("div",{className:"flex items-center gap-2",children:z.map((Ae,ht)=>(0,ci.jsx)("div",{role:"button","aria-disabled":Ae.disabled||!1,onClick:Ae.onClick,className:S("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]",Ae.active&&"bg-[#3c3c3c]"),"aria-label":Ae.label,children:(0,ci.jsx)(hr,{children:(0,ci.jsxs)(br,{children:[(0,ci.jsx)(xr,{className:"text-[#b5b5b5]",children:Ae.icon}),(0,ci.jsx)(jo,{children:(0,ci.jsx)("p",{children:Ae.label})})]})})},ht))}),(0,ci.jsx)(Tl,{})]},`toolbar-option-${z.length}-${ue}`)),(0,ci.jsxs)(ga,{children:[(0,ci.jsxs)(fa,{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:[L.find(z=>z.direction===R)?.icon,L.find(z=>z.direction===R)?.label,(0,ci.jsx)(Pt.ChevronDown,{width:15,height:15})]}),(0,ci.jsx)(Xt,{className:"bg-black hover:bg-black",children:L.map((z,ue)=>(0,ci.jsxs)(Ot,{onClick:z.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,ci.jsx)("span",{children:z.icon}),(0,ci.jsx)("span",{children:z.label})]},`${z.label}-${ue}`))})]}),(0,ci.jsxs)(ga,{children:[(0,ci.jsxs)(fa,{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:[Re.find(z=>z.value===D)?.icon,Re.find(z=>z.value===D)?.label,(0,ci.jsx)(Pt.ChevronDown,{width:15,height:15})]}),(0,ci.jsx)(Xt,{className:"bg-black hover:bg-black",children:Re.map((z,ue)=>(0,ci.jsxs)(Ot,{onClick:z.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,ci.jsx)("span",{children:z.icon}),(0,ci.jsx)("span",{children:z.label})]},`heading-option-${z.label}-${ue}`))})]})]})})}var Pl=({setValue:e,value:t,name:o,editable:a=!0})=>{let[r]=(0,fs.useLexicalComposerContext)(),i=c=>{c.read(()=>{let s=c.toJSON();e?.(()=>s)})};return(0,jt.useEffect)(()=>{r.setEditable(a)},[a]),(0,jt.useEffect)(()=>{t&&r.update(()=>{r.setEditorState(r.parseEditorState(t))})},[]),(0,ci.jsx)("div",{className:"w-full",children:(0,ci.jsxs)("div",{className:" ",children:[a&&(0,ci.jsx)(Tr,{}),(0,ci.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,ci.jsx)(Ns.RichTextPlugin,{contentEditable:(0,ci.jsx)(ys.ContentEditable,{name:o,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-h-40"}),ErrorBoundary:ws.LexicalErrorBoundary}),a&&(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(Cs.HistoryPlugin,{}),(0,ci.jsx)(bs.AutoFocusPlugin,{}),(0,ci.jsx)(Ss.ListPlugin,{}),(0,ci.jsx)(ks.OnChangePlugin,{onChange:i})]})]})]})})},Rl=({setValue:e,value:t,name:o,editable:a=!0})=>(0,ci.jsx)(xs.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[_o.ListNode,_o.ListItemNode,Ds.HeadingNode],onError(i){throw console.error("Lexical error:",i),i},theme:{code:"editor-code",heading:{h1:"text-4xl",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,ci.jsx)(Pl,{value:t,setValue:e,name:o,editable:a})}),Wo=Rl;function Rs({document:e,onSave:t,mode:o="edit",onCancel:a,availableDocuments:r=[],knowledgeContexts:i=[]}){let[c,s]=(0,jt.useState)({...e,updatedAt:new Date}),[m,n]=(0,jt.useState)(c.richTextContent);(0,jt.useEffect)(()=>{s(e)},[e]);let l=()=>{let N=new Set,h=new Set;return i.forEach(R=>{R.menuConfig.groupBy.forEach(te=>N.add(te))}),r.forEach(R=>{R.metadata&&Object.keys(R.metadata).forEach(te=>h.add(te))}),{contextKeys:Array.from(N).sort(),documentKeys:Array.from(h).sort(),allKeys:Array.from(new Set([...N,...h])).sort()}},d=N=>{let h=new Set;return r.forEach(R=>{R.metadata?.[N]&&h.add(String(R.metadata[N]))}),Array.from(h).sort()},g=l(),w=()=>{t({...c,richTextContent:m})},b=(N,h)=>{s(R=>({...R,metadata:{...R.metadata,[N]:h}}))},y=(N,h)=>{h==="__custom__"?b(N,""):b(N,h)},p=()=>{b("","")},C=N=>{s(h=>{let R={...h.metadata};return delete R[N],{...h,metadata:R}})};return(0,ci.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,ci.jsxs)("div",{className:"border-b border-border bg-card p-8",children:[(0,ci.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-6",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ci.jsx)("div",{className:"flex-shrink-0 p-3 rounded-xl bg-primary/10 border border-primary/20",children:(0,ci.jsx)(Pt.Edit3,{className:"h-6 w-6 text-primary"})}),(0,ci.jsx)("h1",{className:"text-2xl font-bold text-foreground",children:o==="edit"?"Edit Document":"Create Document"})]}),(0,ci.jsxs)("div",{className:"flex gap-2",children:[(0,ci.jsxs)(x,{variant:"outline",size:"sm",onClick:a,className:"gap-2",children:[(0,ci.jsx)(Pt.X,{className:"h-4 w-4"}),"Cancel"]}),(0,ci.jsxs)(x,{size:"sm",onClick:w,className:"gap-2",children:[(0,ci.jsx)(Pt.Save,{className:"h-4 w-4"}),"Save Changes"]})]})]}),(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Title"}),(0,ci.jsx)(O,{value:c.title,onChange:N=>s(h=>({...h,title:N.target.value})),className:"text-lg font-semibold",placeholder:"Document title..."})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Description"}),(0,ci.jsx)(Te,{value:c.description||"",onChange:N=>s(h=>({...h,description:N.target.value})),placeholder:"Document description...",rows:2})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("label",{className:"block text-sm font-medium text-foreground",children:"Metadata"}),g.contextKeys.length>0&&(0,ci.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Suggested: ",g.contextKeys.slice(0,4).join(", "),g.contextKeys.length>4&&` +${g.contextKeys.length-4}`]})]}),(0,ci.jsxs)(x,{type:"button",variant:"outline",size:"sm",onClick:p,className:"gap-1 h-8",children:[(0,ci.jsx)(Pt.Plus,{className:"h-3 w-3"}),"Add"]})]}),c.metadata&&Object.keys(c.metadata).length>0?(0,ci.jsx)("div",{className:"space-y-2",children:Object.entries(c.metadata).map(([N,h],R)=>{let te=d(N);return(0,ci.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ci.jsx)(O,{value:N,onChange:D=>{let H=D.target.value||"",P=c.metadata?.[N];s(K=>{let J={...K.metadata};return delete J[N],H&&(J[H]=P||""),{...K,metadata:J}})},placeholder:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${N}`}),(0,ci.jsx)("datalist",{id:`metadata-keys-${N}`,children:g.allKeys.map(D=>(0,ci.jsx)("option",{value:D},D))}),(0,ci.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),te.length>0?(0,ci.jsxs)(Be,{value:String(h||""),onValueChange:D=>y(N,D),children:[(0,ci.jsx)(Ee,{className:"flex-1 h-8 text-sm",children:(0,ci.jsx)(Je,{placeholder:"Value"})}),(0,ci.jsxs)(Me,{children:[te.map(D=>(0,ci.jsx)(ne,{value:D,children:D},D)),(0,ci.jsx)(ne,{value:"__custom__",children:(0,ci.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,ci.jsx)(O,{value:String(h||""),onChange:D=>b(N,D.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,ci.jsx)(x,{type:"button",variant:"ghost",size:"sm",onClick:()=>C(N),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,ci.jsx)(Pt.X,{className:"h-3 w-3"})})]},`metadata-key-${R}`)})}):(0,ci.jsx)("div",{className:"text-center py-3 border border-dashed border-border rounded-lg bg-muted/20",children:(0,ci.jsx)("p",{className:"text-xs text-muted-foreground",children:'jt metadata \u2022 Click "Add" to create fields'})})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Format"}),(0,ci.jsxs)(Be,{value:c.format,onValueChange:N=>s(h=>({...h,format:N})),children:[(0,ci.jsx)(Ee,{className:"flex-1 h-8 text-sm",children:(0,ci.jsx)(Je,{placeholder:"Format"})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)(ne,{value:"markdown",children:"Markdown"}),(0,ci.jsx)(ne,{value:"richText",children:"Rich Text"})]})]})]})]})]}),(0,ci.jsx)("div",{className:"flex-1 ",children:(0,ci.jsxs)("div",{className:"p-8",children:[(0,ci.jsx)("label",{className:"block text-sm font-medium text-foreground mb-4",children:"Content"}),c.format==="richText"?(0,ci.jsx)(Wo,{setValue:n,value:m,name:"richTextContent"}):(0,ci.jsx)(Te,{value:c.content||"",onChange:N=>s(h=>({...h,content:N.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})]})})]})}var Ms=Ce(require("react-markdown")),Is=Ce(require("remark-gfm"));var Fs=e=>(0,$.jsx)(Ms.default,{remarkPlugins:[Is.default],components:{h1:({children:t})=>(0,$.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,$.jsx)("h2",{className:"text-xl font-bold",children:t}),h3:({children:t})=>(0,$.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,$.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,$.jsx)("ol",{className:"list-decimal",children:t}),ul:({children:t})=>(0,$.jsx)("ul",{className:"list-disc",children:t}),li:({children:t})=>(0,$.jsx)("li",{className:"ml-4",children:t}),p:({children:t})=>(0,$.jsx)("p",{className:"mb-4",children:t}),a:({children:t,href:o})=>(0,$.jsx)("a",{href:o,className:"text-blue-500",children:t}),img:({src:t,alt:o})=>(0,$.jsx)("img",{src:t,alt:o,className:"mb-4"}),blockquote:({children:t})=>(0,$.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),As=e=>(0,$.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),Al=e=>(0,$.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:e&&(0,$.jsx)(Wo,{value:JSON.stringify(e),editable:!1,name:"richTextContent"})}),El=e=>(0,$.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,$.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,$.jsxs)("p",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,$.jsx)("strong",{children:"MDX Renderer:"})," This is a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),Fs(e)]});function Bs({document:e,onDocumentUpdate:t,editable:o=!0,mode:a="view",renderers:r,availableDocuments:i=[],knowledgeContexts:c=[]}){let[s,m]=(0,jt.useState)(!1),[n,l]=(0,jt.useState)(e);(0,jt.useEffect)(()=>{l(e)},[e]);let d=p=>{switch(p){case"markdown":case"mdx":return(0,$.jsx)(Pt.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,$.jsx)(Pt.File,{className:"h-6 w-6 text-success"});case"text":return(0,$.jsx)(Pt.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,$.jsx)(Pt.File,{className:"h-6 w-6 text-muted-foreground"})}},g=p=>{switch(p){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},w=(p,C)=>{let N={markdown:Fs,mdx:El,text:As},h=r?.[C]||N[C];if(C==="richText"&&typeof p=="object")return Al(p);if(h&&typeof p=="string")return h(p);if(typeof p=="string")return As(p)},b=p=>{m(!1),t?.(p),l(p)},y=()=>{m(!1)};return s||a==="create"?(0,$.jsx)(Rs,{mode:a==="create"?"create":"edit",document:n,onSave:b,onCancel:y,availableDocuments:i,knowledgeContexts:c}):(0,$.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,$.jsxs)("div",{className:"border-b border-border bg-card p-8",children:[(0,$.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,$.jsxs)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:[(0,$.jsx)("div",{className:"flex-shrink-0 p-3 rounded-xl bg-muted border border-border",children:d(n.format)}),(0,$.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,$.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:n.title}),n.description&&(0,$.jsx)("p",{className:"text-muted-foreground text-lg leading-relaxed mb-4",children:n.description})]})]}),o&&(0,$.jsx)("div",{className:"flex-shrink-0",children:(0,$.jsxs)(x,{variant:"outline",size:"sm",onClick:()=>m(!0),className:"gap-2",children:[(0,$.jsx)(Pt.Edit3,{className:"h-4 w-4"}),"Edit"]})})]}),(0,$.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,$.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${g(n.format)}`,children:n.format.toUpperCase()}),n.tags?.map(p=>(0,$.jsxs)("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm bg-muted text-muted-foreground border border-border",children:["#",p]},p))]})]}),(0,$.jsx)("div",{className:"flex-1 ",children:(0,$.jsxs)("div",{className:"p-8",children:[n.metadata&&Object.keys(n.metadata).length>0&&(0,$.jsxs)("div",{className:"mb-6",children:[(0,$.jsx)("h3",{className:"text-sm font-semibold text-foreground mb-2",children:"Metadata"}),(0,$.jsx)("div",{className:"bg-muted rounded-lg p-3 border border-border",children:(0,$.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-x-4 gap-y-1 text-xs",children:Object.entries(n.metadata).map(([p,C])=>(0,$.jsxs)("div",{className:"flex gap-1",children:[(0,$.jsxs)("span",{className:"text-muted-foreground font-medium",children:[p.replace(/([A-Z])/g," $1").trim(),":"]}),(0,$.jsx)("span",{className:"text-foreground truncate",children:String(C)})]},p))})})]}),(0,$.jsx)("div",{className:"space-y-4",children:n.content||n.richTextContent?(0,$.jsx)("div",{className:"relative",children:(0,$.jsx)("div",{className:"bg-card border border-border rounded-xl p-6 overflow-hidden",children:w(n.format==="richText"?n.richTextContent:n.content,n.format)})}):(0,$.jsxs)("div",{className:"text-center py-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,$.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,$.jsx)(Pt.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,$.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"jt content available"}),(0,$.jsx)("p",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})]})})]})}function Rr({label:e,documents:t,children:o,level:a,onDocumentClick:r,selectedDocumentId:i,showDocumentCount:c=!0}){let[s,m]=(0,jt.useState)(a===0),n=o&&Object.keys(o).length>0,l=t.length+(o?Object.values(o).reduce((w,b)=>w+b.documents.length,0):0),d=w=>{switch(w){case"markdown":case"mdx":return(0,ci.jsx)(Pt.FileText,{className:"h-3.5 w-3.5 text-muted-foreground"});case"richText":return(0,ci.jsx)(Pt.File,{className:"h-3.5 w-3.5 text-muted-foreground"});default:return(0,ci.jsx)(Pt.File,{className:"h-3.5 w-3.5 text-muted-foreground"})}},g=w=>{let b=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return b[w%b.length]};return(0,ci.jsxs)("div",{className:"space-y-1",children:[(n||t.length>0)&&(0,ci.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:`${a*20}px`},onClick:()=>m(!s),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,ci.jsx)("div",{className:`w-1 h-6 rounded-full ${g(a)}`}),(0,ci.jsx)(ir.motion.div,{animate:{rotate:s?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,ci.jsx)(Pt.ChevronRight,{className:"h-4 w-4 text-muted-foreground"})}),(0,ci.jsxs)("div",{className:"flex-1 flex items-center justify-between min-w-0",children:[(0,ci.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,ci.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),c&&l>0&&(0,ci.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,ci.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,ci.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,ci.jsxs)("div",{className:"ci-2 space-y-1",children:[t.map((w,b)=>(0,ci.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 ${i===w.id?"bg-primary/10 border-l-2 border-primary shadow-sm":"hover:bg-muted/50 hover:translate-x-1"}`,style:{marginLeft:`${a*20+20}px`},onClick:()=>r?.(w),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,ci.jsx)("div",{className:"flex-shrink-0",children:d(w.format)}),(0,ci.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ci.jsx)("p",{className:`text-sm truncate transition-colors ${i===w.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:w.title}),w.description&&(0,ci.jsx)("p",{className:"text-xs text-muted-foreground truncate ci-0.5",children:w.description})]}),w.tags&&w.tags.length>0&&(0,ci.jsx)("div",{className:"flex-shrink-0",children:(0,ci.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:w.tags[0]})})]},w.id)),o&&Object.entries(o).map(([w,b])=>(0,ci.jsx)(Rr,{label:w,documents:b.documents,children:b.children,level:a+1,onDocumentClick:r,selectedDocumentId:i,showDocumentCount:c},w))]})})]})}function Ls({documents:e,menuConfig:t,onDocumentClick:o,onDocumentShare:a,onDocumentUpdate:r,selectedDocumentId:i,className:c,editable:s=!0}){let[m,n]=(0,jt.useState)(""),[l,d]=(0,jt.useState)(null),[g,w]=(0,jt.useState)(e);(0,jt.useEffect)(()=>{w(e)},[e]);let b=(0,jt.useMemo)(()=>m?g.filter(C=>C.title.toLowerCase().includes(m.toLowerCase())||C.description?.toLowerCase().includes(m.toLowerCase())||C.tags?.some(N=>N.toLowerCase().includes(m.toLowerCase()))||Object.values(C.metadata||{}).some(N=>String(N).toLowerCase().includes(m.toLowerCase()))):g,[g,m]),y=(0,jt.useMemo)(()=>{let C=(N,h)=>{if(h.length===0)return{};let[R,...te]=h;return N.reduce((H,P)=>{let K=P.metadata?.[R]||"Uncategorized",J=String(K);if(H[J]||(H[J]={documents:[],children:{}}),te.length===0)H[J].documents.push(P);else{let L=C([P],te),E=Object.keys(L)[0];E&&(H[J].children||(H[J].children={}),H[J].children[E]?H[J].children[E].documents.push(...L[E].documents):H[J].children[E]=L[E])}return H},{})};return C(b,t.groupBy)},[b,t.groupBy]),p=C=>{d(C),o?.(C)};return(0,ci.jsxs)("div",{className:`flex h-full ${c||""}`,children:[(0,ci.jsxs)("div",{className:"w-1/3 border-r border-border bg-muted/20",children:[(0,ci.jsx)("div",{className:"p-6 border-b border-border",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,ci.jsx)(Pt.Search,{className:"h-4 w-4 text-muted-foreground"})}),(0,ci.jsx)(O,{placeholder:"Search knowledge base...",value:m,onChange:C=>n(C.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,ci.jsx)(no,{className:"h-[calc(100%-100px)]",children:(0,ci.jsx)("div",{className:"p-4 space-y-3",children:t.groupBy.length===0?(0,ci.jsx)(ci.Fragment,{children:(0,ci.jsx)(Rr,{label:"Document",documents:b,level:0,onDocumentClick:p,selectedDocumentId:i,showDocumentCount:t.showDocumentCount},"Document")}):(0,ci.jsxs)(ci.Fragment,{children:[Object.entries(y).map(([C,N])=>(0,ci.jsx)(Rr,{label:C,documents:N.documents,children:N.children,level:0,onDocumentClick:p,selectedDocumentId:i,showDocumentCount:t.showDocumentCount},C)),Object.keys(y).length===0&&(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,ci.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,ci.jsx)(Pt.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,ci.jsx)("p",{className:"text-sm font-medium",children:"jt documents found"}),(0,ci.jsx)("p",{className:"text-xs ci-1",children:"Try adjusting your search terms"})]})]})})})]}),(0,ci.jsx)("div",{className:"flex-1 bg-background overflow-scroll",children:l?(0,ci.jsx)(Bs,{document:l,onDocumentUpdate:r,editable:s}):(0,ci.jsx)("div",{className:"h-full flex items-center justify-center text-center",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-w-sm",children:[(0,ci.jsx)("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,ci.jsx)(Pt.FileText,{className:"h-10 w-10 text-primary"})}),(0,ci.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Select a document"}),(0,ci.jsx)("p",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}var Os=({isOpen:e,onClose:t,onAddKnowledge:o,knowledgeContexts:a})=>{let[r,i]=(0,jt.useState)({name:"",description:"",metadata:[]}),c=y=>{y.preventDefault(),r.name&&(o({name:r.name,description:r.description,metadata:r.metadata,source:"payload",visibility:"public",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),i({name:"",description:"",metadata:[]}),t())},s=()=>{i({name:"",description:"",metadata:[]}),t()},n=(()=>{let y=new Set,p=new Set;return a.forEach(C=>{C.menuConfig.groupBy.forEach(N=>y.add(N))}),{contextKeys:Array.from(y).sort(),documentKeys:Array.from(p).sort(),allKeys:Array.from(new Set([...y,...p])).sort()}})(),l=y=>{let p=new Set;return Array.from(p).sort()},d=(y,p)=>{i(C=>{let N=C.metadata.find(h=>h.key===y);return N&&(N.value=p),{...C,metadata:[...C.metadata.filter(h=>h.key!==y),{key:y,value:p}]}})},g=(y,p)=>{p==="__custom__"?d(y,""):d(y,p)},w=()=>{d(" ","")},b=y=>{i(p=>{let C=[...p.metadata],N=C.findIndex(h=>h.key===y);return N!==-1&&C.splice(N,1),{...p,metadata:C}})};return(0,ci.jsx)(Xe,{open:e,onOpenChange:s,children:(0,ci.jsxs)(_e,{className:"sm:max-w-md",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New Knowledge source"})}),(0,ci.jsxs)("form",{onSubmit:c,className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Name *"}),(0,ci.jsx)(O,{id:"name",value:r.name,onChange:y=>i(p=>({...p,name:y.target.value})),required:!0})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Description"}),(0,ci.jsx)(O,{id:"name",value:r.description,onChange:y=>i(p=>({...p,description:y.target.value})),required:!0})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"metadata",children:"Metadata"}),n.contextKeys.length>0&&(0,ci.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Suggested: ",n.contextKeys.slice(0,4).join(", "),n.contextKeys.length>4&&` +${n.contextKeys.length-4}`]})]}),(0,ci.jsxs)(x,{type:"button",variant:"outline",size:"sm",onClick:w,className:"gap-1 h-8",children:[(0,ci.jsx)(Pt.Plus,{className:"h-3 w-3"}),"Add"]})]}),r.metadata&&r.metadata.length>0?(0,ci.jsx)("div",{className:"space-y-2",children:r.metadata.map(({key:y,value:p},C)=>{let N=l(y);return(0,ci.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ci.jsx)(O,{value:y,onChange:h=>{let R=h.target.value||" ",te=r.metadata.find(D=>D.key===y)?.value;i(D=>{let H=[...D.metadata],P=H.findIndex(K=>K.key===y);return P!==-1&&H.splice(P,1),R&&H.push({key:R,value:te||""}),{...D,metadata:H}}),h.target.focus()},placeholder:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${y}`}),(0,ci.jsx)("datalist",{id:`metadata-keys-${y}`,children:n.allKeys.map(h=>(0,ci.jsx)("option",{value:h},h))}),(0,ci.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),N.length>0?(0,ci.jsxs)(Be,{value:String(p||""),onValueChange:h=>g(y,h),children:[(0,ci.jsx)(Ee,{className:"flex-1 h-8 text-sm",children:(0,ci.jsx)(Je,{placeholder:"Value"})}),(0,ci.jsxs)(Me,{children:[N.map(h=>(0,ci.jsx)(ne,{value:h,children:h},h)),(0,ci.jsx)(ne,{value:"__custom__",children:(0,ci.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,ci.jsx)(O,{value:String(p||""),onChange:h=>d(y,h.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,ci.jsx)(x,{type:"button",variant:"ghost",size:"sm",onClick:()=>b(y),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,ci.jsx)(Pt.X,{className:"h-3 w-3"})})]},`metadata-key-${C}`)})}):(0,ci.jsx)("div",{className:"text-center py-3 border border-dashed border-border rounded-lg bg-muted/20",children:(0,ci.jsx)("p",{className:"text-xs text-muted-foreground",children:'jt metadata \u2022 Click "Add" to create fields'})})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end gap-3 ci-4",children:[(0,ci.jsxs)(x,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,ci.jsx)(Pt.X,{className:"h-4 w-4"}),"Cancel"]}),(0,ci.jsxs)(x,{type:"submit",children:[(0,ci.jsx)(Pt.Save,{className:"h-4 w-4"}),"Create"]})]})]})]})})};var Vs=({isOpen:e,onClose:t,onAddTeamContext:o})=>{let[a,r]=(0,jt.useState)({label:"",description:"",groupBy:[],sortBy:"name",sortOrder:"asc",showDocumentCount:!0}),[i,c]=(0,jt.useState)(""),s=d=>{d.preventDefault(),console.log("formData",a),a.label&&(o({id:a.label,label:a.label,description:a.description,menuConfig:{groupBy:a.groupBy,sortBy:a.sortBy||null,sortOrder:a.sortOrder,showDocumentCount:a.showDocumentCount}}),r({label:"",description:"",groupBy:[],sortBy:"name",sortOrder:"asc",showDocumentCount:!0}))},m=()=>{r({label:"",description:"",groupBy:[],sortBy:"name",sortOrder:"asc",showDocumentCount:!0}),t()},n=[{value:"name",label:"Name"},{value:"createdAt",label:"Created Date"}],l=[{value:"asc",label:"Ascending"},{value:"desc",label:"Descending"}];return(0,ci.jsx)(Xe,{open:e,onOpenChange:m,children:(0,ci.jsxs)(_e,{className:"sm:max-w-md",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New Knowledge source"})}),(0,ci.jsxs)("form",{onSubmit:s,className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"label",children:"Label *"}),(0,ci.jsx)(O,{id:"label",value:a.label,onChange:d=>r(g=>({...g,label:d.target.value})),required:!0})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(O,{id:"description",value:a.description,onChange:d=>r(g=>({...g,description:d.target.value}))})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{children:"Group By"}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)("div",{className:"flex flex-wrap gap-2",children:a.groupBy.map(d=>(0,ci.jsxs)(me,{variant:"secondary",className:"px-2 py-1",children:[d,(0,ci.jsx)("button",{type:"button",className:"ml-1 inline-flex",onClick:()=>{r(g=>({...g,groupBy:g.groupBy.filter(w=>w!==d)}))},"aria-label":`Remove ${d}`,children:(0,ci.jsx)(Pt.X,{className:"h-3 w-3"})})]},d))}),(0,ci.jsxs)("div",{className:"flex gap-2",children:[(0,ci.jsx)(O,{placeholder:"Type a tag and press Enter",value:i,onChange:d=>c(d.target.value),onKeyDown:d=>{(d.key==="Enter"||d.key===",")&&(d.preventDefault(),r(g=>({...g,groupBy:[...g.groupBy,i]})),c(""))}}),(0,ci.jsx)(x,{type:"button",onClick:()=>{r(d=>({...d,groupBy:[...d.groupBy,i]})),c("")},children:"Add"})]})]})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"sortBy",children:"Sort By"}),(0,ci.jsxs)(Be,{value:a.sortBy,onValueChange:d=>r(g=>({...g,sortBy:d})),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{placeholder:"Select sort field"})}),(0,ci.jsx)(Me,{children:n.map(d=>(0,ci.jsx)(ne,{value:d.value,children:d.label},d.value))})]})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"sortOrder",children:"Sort Order"}),(0,ci.jsxs)(Be,{value:a.sortOrder,onValueChange:d=>r(g=>({...g,sortOrder:d})),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{placeholder:"Select sort order"})}),(0,ci.jsx)(Me,{children:l.map(d=>(0,ci.jsx)(ne,{value:d.value,children:d.label},d.value))})]})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(bo,{id:"showDocumentCount",checked:a.showDocumentCount,onCheckedChange:d=>r(g=>({...g,showDocumentCount:d}))}),(0,ci.jsx)(T,{htmlFor:"showDocumentCount",className:"text-sm",children:"Show Document Count"})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end gap-3 ci-4",children:[(0,ci.jsxs)(x,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,ci.jsx)(Pt.X,{className:"h-4 w-4"}),"Cancel"]}),(0,ci.jsxs)(x,{type:"submit",children:[(0,ci.jsx)(Pt.Save,{className:"h-4 w-4"}),"Create"]})]})]})]})})};function Er({documents:e=[],contexts:t=[],onDocumentClick:o=n=>console.log("Document clicked:",n),onDocumentShare:a=n=>console.log("Share document:",n),onLoadDocumentContent:r,selectedDocumentId:i,onAddKnowledge:c,onAddTeamContext:s,onDocumentUpdate:m}){let[n,l]=(0,jt.useState)(t[0]),[d,g]=(0,jt.useState)(!1),[w,b]=(0,jt.useState)(!1);(0,jt.useEffect)(()=>{!n&&t&&t.length>0&&l(t[0])},[t]);let y=C=>{c&&c(C),g(!1)},p=C=>{s&&s(C),b(!1)};return(0,ci.jsxs)("div",{className:"flex flex-col h-full max-h-[calc(100vh-8rem)]",children:[(0,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:[(0,ci.jsx)(gt,{title:"Knowledge",description:"Access, manage, and share all your team knowledge in one place.",gradient:"bg-gradient-to-r from-teal-600 via-cyan-600 to-blue-600",primaryAction:c?{label:"Create",onClick:()=>g(!0)}:void 0,secondaryAction:s?{label:"Add Context",onClick:()=>b(!0)}:void 0}),t&&t.length>0&&(0,ci.jsxs)("div",{className:"ci-6",children:[(0,ci.jsx)("div",{className:"border-b border-border",children:(0,ci.jsx)("nav",{className:"-mb-px flex space-x-8 overflow-x-auto",children:t.map(C=>(0,ci.jsxs)("button",{onClick:()=>l(C),className:`group inline-flex items-center gap-2 py-3 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${n?.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))})}),n?.description&&(0,ci.jsx)("div",{className:"ci-3 px-1",children:(0,ci.jsx)("p",{className:"text-sm text-muted-foreground",children:n?.description})})]})]}),n?(0,ci.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4",children:(0,ci.jsx)("div",{className:"h-full rounded-3xl border overflow-hidden",children:(0,ci.jsx)(Ls,{documents:e,menuConfig:n?.menuConfig,onDocumentClick:o,onDocumentShare:a,selectedDocumentId:i,onDocumentUpdate:m})})}):(0,ci.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,ci.jsx)("p",{className:"text-muted-foreground",children:"jt contexts available"})}),(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(Vs,{isOpen:w,onClose:()=>b(!1),onAddTeamContext:p}),(0,ci.jsx)(Os,{isOpen:d,onClose:()=>g(!1),onAddKnowledge:y,knowledgeContexts:t})]})]})}var Ml=[{key:"kanban",icon:Pt.Kanban,label:"Kanban",color:"bg-primary",title:"Kanban View"},{key:"planning",icon:Pt.Calendar,label:"Planning",color:"bg-brand-plum",title:"Planning View",hiddenOnMobile:!0},{key:"epics",icon:Pt.Target,label:"Epics",color:"bg-brand-orange",title:"Epic Planning"},{key:"files",icon:Pt.FileText,label:"Files",color:"bg-brand-green",title:"Files"},{key:"tasks",icon:Pt.Calendar,label:"Tasks",color:"bg-brand-cyan",title:"Tasks"}],js=({currentView:e,onViewChange:t,children:o})=>(0,ci.jsxs)("div",{className:"flex w-full h-screen",children:[(0,ci.jsx)("div",{className:"w-12 h-full bg-sidebar-background flex flex-col flex-shrink-0",children:Ml.map(a=>{let r=a.icon,i=e===a.key;return(0,ci.jsxs)("button",{onClick:()=>t(a.key),className:`flex-1 w-12 flex items-center justify-center text-sidebar-foreground transition-all duration-200 relative overflow-hidden group/btn ${i?a.color:`${a.color}/75 hover:${a.color}`} ${a.hiddenOnMobile?"hidden md:flex":""} hover:w-28 hover:justify-start hover:pl-3`,title:a.title,children:[(0,ci.jsx)(r,{className:"h-4 w-4 flex-shrink-0"}),(0,ci.jsx)("span",{className:"text-xs font-medium whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity duration-200 absolute left-8",children:a.label})]},a.key)})}),(0,ci.jsx)("div",{className:"flex-1 min-w-0 px-4 md:px-6 h-full overflow-auto",children:(0,ci.jsx)("div",{className:"w-full h-full",children:o})})]});var Ie=Ce(require("react"));var Ks=({title:e,status:t,taskCount:o,children:a,onDrop:r,isCompact:i=!1,height:c})=>{let s=l=>{l.preventDefault()},m=l=>{l.preventDefault(),r(t)};return(0,ci.jsxs)(U,{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 ${i?"lg:max-w-xs":""}`,style:{height:c||"calc(100vh - 350px)"},onDragOver:s,onDrop:m,children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,ci.jsx)("h3",{className:`font-semibold text-foreground select-none-important ${i?"text-base":"text-lg"}`,children:e}),(0,ci.jsx)(me,{variant:"secondary",className:"bg-muted text-muted-foreground",children:o})]}),(0,ci.jsx)("div",{className:"flex-1 overflow-y-auto space-y-4 min-h-0",children:a})]})};var Co=({task:e,epic:t,onDragStart:o,onTaskClick:a,isCompact:r=!1})=>{let i=l=>{o(e)},c=()=>{a(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,ci.jsx)(Pt.BookOpen,{className:"h-3 w-3"});case"bug":return(0,ci.jsx)(Pt.Bug,{className:"h-3 w-3"});case"spike":return(0,ci.jsx)(Pt.Zap,{className:"h-3 w-3"});case"task":default:return(0,ci.jsx)(Pt.AlertCircle,{className:"h-3 w-3"})}},n=()=>{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 r?(0,ci.jsx)(U,{className:"p-3 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-sm",draggable:!0,onDragStart:i,onClick:c,children:(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("div",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ${n()}`,children:m()}),(0,ci.jsx)("h4",{className:"font-medium text-foreground text-sm mb-1 line-clamp-2 select-none-important",children:e.name})]})}):(0,ci.jsxs)(U,{className:"p-4 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-md",draggable:!0,onDragStart:i,onClick:c,children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ci.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-sm font-medium ${n()}`,children:[m(),(0,ci.jsx)("span",{className:"capitalize",children:e.type})]}),(0,ci.jsxs)("div",{className:"flex gap-1",children:[(0,ci.jsx)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-xs font-medium ${s()}`,children:e.priority}),(0,ci.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,ci.jsx)("h4",{className:"font-semibold text-foreground mb-2 select-none-important",children:e.name}),(0,ci.jsx)("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2 select-none-important",children:e.description}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ci.jsx)(Pt.User,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:e.assignee?.value?.name})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:new Date(e.createdAt).toLocaleDateString()})]})]})]})};var Il=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:Pt.BookOpen},{value:"task",label:"Task",color:"bg-secondary/20 text-secondary-foreground",icon:Pt.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:Pt.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:Pt.Zap}],Fl=[{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"}],Wa=({isOpen:e,onClose:t,onAddTask:o,epics:a,sprints:r,assignees:i,defaultEpicId:c})=>{let[s,m]=(0,jt.useState)({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:"",sprint:"none",assignee:""});(0,jt.useEffect)(()=>{e&&c&&m(d=>({...d,epic:c}))},[e,c]),(0,jt.useEffect)(()=>{e&&m({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:c||"",sprint:"none",assignee:""})},[e]);let n=d=>{d.preventDefault(),s.name.trim()&&(o({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:c||"",sprint:"",assignee:""}),t())},l=(d,g)=>{m(w=>({...w,[d]:g}))};return(0,ci.jsx)(Xe,{open:e,onOpenChange:t,children:(0,ci.jsxs)(_e,{className:"sm:max-w-md",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New Task"})}),(0,ci.jsxs)("form",{onSubmit:n,className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Task Title"}),(0,ci.jsx)(O,{id:"name",value:s.name,onChange:d=>l("name",d.target.value),placeholder:"Enter task title",required:!0})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Te,{id:"description",value:s.description,onChange:d=>l("description",d.target.value),placeholder:"Enter task description",rows:3})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Type"}),(0,ci.jsx)(Pa,{type:"single",value:s.type||"",onValueChange:d=>d&&l("type",d),children:Il.map(d=>{let g=d.icon;return(0,ci.jsxs)(Ra,{value:d.value,className:"flex items-center gap-2 data-[state=ir]:bg-primary data-[state=ir]:text-primary-foreground",children:[(0,ci.jsx)(g,{className:"h-4 w-4"}),d.label]},d.value)})})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Priority"}),(0,ci.jsx)(Pa,{type:"single",value:s.priority||"",onValueChange:d=>d&&l("priority",d),children:Fl.map(d=>(0,ci.jsx)(Ra,{value:d.value,className:"data-[state=ir]:bg-primary data-[state=ir]:text-primary-foreground",children:d.label},d.value))})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"points",children:"Story Points"}),(0,ci.jsx)(O,{id:"points",type:"number",min:"1",max:"100",value:s.storyPoints,onChange:d=>l("storyPoints",parseInt(d.target.value)||1),placeholder:"Enter story points",required:!0})]}),!c&&(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"epic",children:"Epic"}),(0,ci.jsxs)(Be,{value:s.epic,onValueChange:d=>l("epic",d),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{placeholder:"Select an epic"})}),(0,ci.jsx)(Me,{children:a.map(d=>(0,ci.jsx)(ne,{value:d.id.toString(),children:(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${d.color}`}),d.name]})},d.id))})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"sprint",children:"Sprint (Optional)"}),(0,ci.jsxs)(Be,{value:s.sprint,onValueChange:d=>l("sprint",d),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{placeholder:"Select a sprint"})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)(ne,{value:"none",children:"jt Sprint"}),r.map(d=>(0,ci.jsx)(ne,{value:d.id.toString(),children:(0,ci.jsx)("div",{className:"flex items-center gap-2",children:d.name})},d.id))]})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"sprint",children:"Assignee"}),(0,ci.jsxs)(Be,{value:s.assignee,onValueChange:d=>l("assignee",d),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{placeholder:"Select an Assignee"})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)(ne,{value:"none",children:"jt Assignee"}),i.map(d=>(0,ci.jsx)(ne,{value:d.id.toString(),children:(0,ci.jsx)("div",{className:"flex items-center gap-2",children:d.name})},d.id))]})]})]}),(0,ci.jsxs)(Ua,{children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,ci.jsx)(x,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Task"})]})]})]})})};var Ir=({fieldName:e,value:t,label:o,multiline:a=!1,onSave:r,className:i="",disabled:c=!1})=>{let[s,m]=(0,jt.useState)(!1),[n,l]=(0,jt.useState)(""),d=()=>{c||(m(!0),l(t))},g=async()=>{n!==t&&await r(e,n),m(!1)},w=b=>{b.key==="Enter"&&!a||b.key==="Enter"&&b.ctrlKey&&a?g():b.key==="Escape"&&(m(!1),l(""))};return(0,ci.jsxs)("div",{className:`space-y-2 ${i}`,children:[(0,ci.jsx)(T,{children:o}),s?a?(0,ci.jsx)(Te,{value:n,onChange:b=>l(b.target.value),onBlur:g,onKeyDown:w,autoFocus:!0,rows:4,className:"resize-none"}):(0,ci.jsx)(O,{value:n,onChange:b=>l(b.target.value),onBlur:g,onKeyPress:w,autoFocus:!0,className:"text-lg font-medium"}):(0,ci.jsxs)("div",{onClick:d,className:`${c?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted/50 p-2 rounded border border-transparent hover:border-border transition-colors group ${a?"min-h-[100px]":"min-h-[40px]"} flex items-start gap-2`,children:[(0,ci.jsx)("span",{className:a?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click to edit..."}),!c&&(0,ci.jsx)(Pt.Edit,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var $s=({comments:e,onAddComment:t})=>{let[o,a]=(0,jt.useState)(""),r=c=>c.split(" ").map(s=>s[0]).join("").toUpperCase(),i=()=>{o.trim()&&(t(o),a(""))};return(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.MessageSquare,{className:"h-5 w-5"}),(0,ci.jsx)(T,{className:"text-lg font-medium",children:"Comments"}),(0,ci.jsx)(me,{variant:"secondary",children:e.length})]}),(0,ci.jsx)("div",{className:"space-y-4 max-h-60 overflow-y-auto",children:e.map(c=>(0,ci.jsxs)("div",{className:"flex gap-3 p-3 bg-muted/50 rounded-lg",children:[(0,ci.jsx)(Qt,{className:"h-8 w-8 ci-1",children:(0,ci.jsx)(ea,{className:"text-xs bg-muted text-muted-foreground",children:r(c.author)})}),(0,ci.jsxs)("div",{className:"flex-1",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,ci.jsx)("span",{className:"font-medium text-sm",children:c.author}),(0,ci.jsxs)("span",{className:"text-xs text-muted-foreground",children:[c.createdAt.toLocaleDateString()," ci ",c.createdAt.toLocaleTimeString()]})]}),(0,ci.jsx)("p",{className:"text-sm text-muted-foreground",children:c.text})]})]},c.id))}),(0,ci.jsxs)("div",{className:"flex gap-2",children:[(0,ci.jsx)(Te,{value:o,onChange:c=>a(c.target.value),placeholder:"Add a comment...",rows:2,className:"flex-1 resize-none"}),(0,ci.jsx)(x,{onClick:i,disabled:!o.trim(),size:"sm",className:"self-end",children:(0,ci.jsx)(Pt.Send,{className:"h-4 w-4"})})]})]})};var Zo=({label:e,value:t,onValueChange:o,options:a,showColor:r=!1,disabled:i=!1})=>{let[c,s]=(0,jt.useState)(!1),m=a.find(l=>l.value===t);return(0,ci.jsxs)("div",{className:"space-y-1",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:e}),(0,ci.jsxs)(Be,{value:t,onValueChange:o,open:c,onOpenChange:l=>{i||s(l)},disabled:i,children:[(0,ci.jsx)(Ee,{className:"h-auto p-0 border-none bg-transparent hover:bg-muted/50 rounded-md",children:(0,ci.jsxs)(me,{variant:"secondary",className:`${i?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!i&&s(!c),children:[r&&m?.color&&(0,ci.jsx)("div",{className:`w-2 h-2 rounded-full ${m.color} mr-1`}),m?.label||"Select..."]})}),(0,ci.jsx)(Me,{children:a.map(l=>(0,ci.jsx)(ne,{value:l.value,children:r&&l.color?(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${l.color}`}),l.label]}):l.label},l.value))})]})]})};var _s=({label:e,value:t,onValueChange:o,options:a,placeholder:r="Search...",allowCustomValue:i=!1,disabled:c=!1})=>{let[s,m]=(0,jt.useState)(!1),[n,l]=(0,jt.useState)(""),d=a.find(p=>p.value===t),g=a.filter(p=>p.label.toLowerCase().includes(n.toLowerCase())),w=p=>{o(p),m(!1),l("")},b=()=>{i&&n.trim()&&!a.find(p=>p.value===n.trim())&&(o(n.trim()),m(!1),l(""))};return(0,ci.jsxs)("div",{className:"space-y-1",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:e}),(0,ci.jsxs)(Be,{value:t,onValueChange:w,open:s,onOpenChange:p=>{c||m(p)},disabled:c,children:[(0,ci.jsx)(Ee,{className:"h-auto p-0 border-none bg-transparent hover:bg-muted/50 rounded-md",children:(0,ci.jsx)(me,{variant:"secondary",className:`${c?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!c&&m(!s),children:d?.label||t||"Select..."})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)("div",{className:"p-2",children:(0,ci.jsx)(O,{placeholder:r,value:n,onChange:p=>l(p.target.value),onKeyDown:p=>{p.key==="Enter"&&i&&b()},className:"mb-2"})}),g.map(p=>(0,ci.jsx)(ne,{value:p.value,children:p.label},p.value)),i&&n.trim()&&!g.find(p=>p.value===n.trim())&&(0,ci.jsxs)(ne,{value:n.trim(),children:['Add "',n.trim(),'"']})]})]})]})};var ot=e=>e?typeof e=="number"?e:typeof e=="object"&&e&&"id"in e?e.id:0:0;var Bl=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:Pt.BookOpen},{value:"task",label:"Task",color:"bg-muted text-muted-foreground",icon:Pt.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:Pt.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:Pt.Zap}],Ll=[{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 Ws=({task:e,epics:t,sprints:o,lastUpdated:a,onUpdateTask:r,onClose:i,onDelete:c,isUpdating:s=!1,isDeleting:m=!1,deleteState:n="idle",teamMembers:l})=>{let[d,g]=(0,jt.useState)(e.storyPoints),w=(0,jt.useRef)(null),[b,y]=(0,jt.useState)(l);(0,jt.useEffect)(()=>{y(l)},[l]);let p=(0,jt.useCallback)((h,R)=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{r(h,R)},500)},[r]);(0,jt.useEffect)(()=>{p("storyPoints",d?.toString()||"1")},[d]);let C=h=>h.split(" ").map(R=>R[0]).join("").toUpperCase(),N=()=>n==="loading"?(0,ci.jsxs)(x,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,ci.jsx)(Pt.Loader2,{className:"h-3 w-3 animate-spin"}),"Deleting..."]}):n==="success"?(0,ci.jsxs)(x,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,ci.jsx)(Pt.Check,{className:"h-3 w-3"}),"Deleted"]}):n==="error"?(0,ci.jsxs)(x,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,ci.jsx)(Pt.X,{className:"h-3 w-3"}),"Delete failed"]}):(0,ci.jsxs)(x,{onClick:c,variant:"destructive",className:"w-full h-8 text-xs gap-1",disabled:s||m,children:[(0,ci.jsx)(Pt.Trash2,{className:"h-3 w-3"}),"Delete Task"]});return(0,ci.jsxs)("div",{className:"flex flex-col h-full",children:[(0,ci.jsxs)("div",{className:"space-y-4",style:{opacity:s?.6:1},children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Status"}),(0,ci.jsx)(Zo,{label:"",value:e.status,onValueChange:h=>r("status",h),options:[{value:"todo",label:"To Do"},{value:"in-progress",label:"In Progress"},{value:"done",label:"Done"}],disabled:s})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Type"}),(0,ci.jsx)(Pa,{type:"single",value:e.type||"",onValueChange:h=>h&&r("type",h),className:"grid grid-cols-2 gap-1",disabled:s,children:Bl.map(h=>{let R=h.icon;return(0,ci.jsxs)(Ra,{value:h.value,className:"flex items-center gap-1 text-xs h-8 data-[state=ir]:bg-primary data-[state=ir]:text-primary-foreground",size:"sm",disabled:s,children:[(0,ci.jsx)(R,{className:"h-3 w-3"}),h.label]},h.value)})})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Priority"}),(0,ci.jsx)(Pa,{type:"single",value:e.priority||"",onValueChange:h=>h&&r("priority",h),className:"grid grid-cols-3 gap-1",disabled:s,children:Ll.map(h=>(0,ci.jsx)(Ra,{value:h.value,className:"text-xs h-8 data-[state=ir]:bg-primary data-[state=ir]:text-primary-foreground",size:"sm",disabled:s,children:h.label},h.value))})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Story Points"}),(0,ci.jsx)("input",{type:"number",min:"1",max:"100",value:d||1,onChange:h=>{let R=Number(h.target.value);R<1?g(1):R>100?g(100):g(R)},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,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Epic"}),(0,ci.jsx)(Zo,{label:"",value:ot(e.epic).toString(),onValueChange:h=>r("epic",h),options:(t||[]).map(h=>({value:h.id.toString(),label:h?.name,color:h.color})),showColor:!0,disabled:s})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Sprint"}),(0,ci.jsx)(Zo,{label:"",value:ot(e.sprint).toString()||"none",onValueChange:h=>r("sprint",h==="none"?"":h),options:[{value:"none",label:"jt Sprint"},...(o||[]).map(h=>({value:h.id.toString(),label:`${h?.name}`}))],disabled:s})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{className:"text-xs text-muted-foreground",children:"Assignee"}),(0,ci.jsx)(_s,{label:"",value:e.assignee?.value?.name,onValueChange:h=>r("assignee",h),options:b.map(h=>({value:`${typeof h.email=="string"?"users":"digital-colleagues"}:${h.id}`,label:h?.name||""})),placeholder:"Search team members...",allowCustomValue:!0,disabled:s})]})]}),(0,ci.jsxs)("div",{className:"ci-auto ci-4 space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(x,{onClick:i,variant:"outline",className:"w-full h-8 text-xs",disabled:s||m,children:"Close"}),N()]}),(0,ci.jsxs)("div",{className:"ci-4 border-t border-border space-y-2",children:[(0,ci.jsx)("div",{className:"text-xs text-muted-foreground font-medium mb-2",children:"Information"}),(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)("span",{className:"text-xs text-muted-foreground",children:"Logged By"}),(0,ci.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,ci.jsx)(Pt.User,{className:"h-3 w-3"}),(0,ci.jsx)("span",{children:"System"})]})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)("span",{className:"text-xs text-muted-foreground",children:"Created"}),(0,ci.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-3 w-3"}),(0,ci.jsx)("span",{children:new Date(e.createdAt)?.toLocaleDateString()})]})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)("span",{className:"text-xs text-muted-foreground",children:"Last Updated"}),(0,ci.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,ci.jsx)(Pt.Clock,{className:"h-3 w-3"}),(0,ci.jsxs)("span",{children:[new Date(a).toLocaleDateString()," ci"," ",new Date(a).toLocaleTimeString()]})]})]})]})]})]})};var qs=({isOpen:e,onClose:t,initialTask:o,epics:a,sprints:r,onUpdateTask:i,onDeleteTask:c,onAddComment:s,colleagues:m})=>{let[n,l]=(0,jt.useState)(o),[d,g]=(0,jt.useState)(new Date),[w,b]=(0,jt.useState)("idle"),[y,p]=(0,jt.useState)("idle"),[C,N]=(0,jt.useState)([]),[h,R]=(0,jt.useState)(m);(0,jt.useEffect)(()=>{l(o)},[o]);let te=async(E,Re)=>{if(Re!==n[E]){b("loading");try{await i(n.id.toString(),{[E]:Re}),g(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch(xe){console.log("error",xe),b("error"),setTimeout(()=>b("idle"),3e3)}}},D=async(E,Re)=>{if(Re!==n[E]){b("loading");try{await i(n.id.toString(),{[E]:Re}),g(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch(xe){console.log("error",xe),b("error"),setTimeout(()=>b("idle"),3e3)}}},H=async E=>{if(s){b("loading");try{await s?.({content:E,taskId:n.id.toString()}),g(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch{b("error"),setTimeout(()=>b("idle"),3e3)}}},P=async()=>{p("loading");try{await c(n.id.toString()),p("success"),setTimeout(()=>{t(),p("idle")},1e3)}catch{p("error"),setTimeout(()=>p("idle"),3e3)}},K=w!=="loading"&&y!=="loading",J=()=>{K&&t()},L=()=>w==="loading"?(0,ci.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,ci.jsx)(Pt.Loader2,{className:"h-4 w-4 animate-spin"}),(0,ci.jsx)("span",{children:"Updating..."})]}):w==="success"?(0,ci.jsxs)("div",{className:"flex items-center gap-2 text-sm text-success",children:[(0,ci.jsx)(Pt.Check,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:"Updated successfully"})]}):w==="error"?(0,ci.jsxs)("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[(0,ci.jsx)(Pt.X,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:"Update failed"})]}):null;return(0,ci.jsx)(Xe,{open:e,onOpenChange:J,children:(0,ci.jsxs)(_e,{className:"max-w-3xl max-h-[80vh] overflow-y-auto p-4",children:[(0,ci.jsxs)(We,{children:[(0,ci.jsx)(qe,{className:"sr-only",children:n?.name}),(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)("div",{className:"flex-1",children:L()}),!K&&(0,ci.jsx)("div",{className:"text-xs text-muted-foreground",children:"Please wait..."})]})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,ci.jsxs)("div",{className:"lg:col-span-2 space-y-4",children:[(0,ci.jsx)(Ir,{fieldName:"name",value:n.name||"",label:"",onSave:te,className:"border-b border-border pb-3",disabled:w==="loading"}),(0,ci.jsx)(Ir,{fieldName:"description",value:n.description||"",label:"Description",multiline:!0,onSave:te,disabled:w==="loading"}),(0,ci.jsx)($s,{comments:(n?.comments||[]).map(E=>({author:E.author.value.name||"",createdAt:new Date(E.timestamp),text:E.text,id:E.id||""})),onAddComment:H})]}),(0,ci.jsx)(Ws,{task:n,epics:a,sprints:r,lastUpdated:d,onUpdateTask:D,onClose:J,onDelete:P,isUpdating:w==="loading",isDeleting:y==="loading",deleteState:y,teamMembers:h})]})]})})};var Za=({isOpen:e,onClose:t,onAddEpic:o})=>{let[a,r]=(0,jt.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}),i=["bg-blue-500","bg-green-500","bg-purple-500","bg-orange-500","bg-red-500","bg-yellow-500","bg-pink-500","bg-indigo-500"],c=[{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=l=>{l.preventDefault(),a.name.trim()&&(o({name:a.name.trim(),description:a.description.trim(),color:a.color,confidence:a.confidence,phase:a.phase,startDate:a.startDate,endDate:a.endDate}),r({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString(),endDate:new Date().toISOString(),progress:0}),t())},n=(l,d)=>{r(g=>({...g,[l]:d}))};return(0,ci.jsx)(Xe,{open:e,onOpenChange:t,children:(0,ci.jsxs)(_e,{className:"sm:max-w-md",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New Epic"})}),(0,ci.jsxs)("form",{onSubmit:m,className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Epic Name"}),(0,ci.jsx)(O,{id:"name",value:a.name,onChange:l=>n("name",l.target.value),placeholder:"Enter epic name",required:!0})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Te,{id:"description",value:a.description,onChange:l=>n("description",l.target.value),placeholder:"Enter epic description (optional)",rows:3})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Color"}),(0,ci.jsx)("div",{className:"flex gap-2 flex-wrap",children:i.map(l=>(0,ci.jsx)("button",{type:"button",onClick:()=>n("color",l),className:`w-8 h-8 rounded-full ${l} ${a.color===l?"ring-2 ring-gray-400":""}`},l))})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Confidence"}),(0,ci.jsxs)(Be,{value:a.confidence,onValueChange:l=>n("confidence",l),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{})}),(0,ci.jsx)(Me,{children:c.map(l=>(0,ci.jsx)(ne,{value:l.value,children:l.label},l.value))})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Phase"}),(0,ci.jsxs)(Be,{value:a.phase.toString(),onValueChange:l=>n("phase",parseInt(l)),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{})}),(0,ci.jsx)(Me,{children:s.map(l=>(0,ci.jsx)(ne,{value:l.value.toString(),children:l.label},l.value))})]})]})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Start Date"}),(0,ci.jsx)(O,{type:"date",value:a.startDate,onChange:l=>n("startDate",l.target.value)})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"End Date"}),(0,ci.jsx)(O,{type:"date",value:a.endDate,onChange:l=>n("endDate",l.target.value)})]})]}),(0,ci.jsxs)(Ua,{children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,ci.jsx)(x,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Epic"})]})]})]})})};var Js=({initialTasks:e=[],initialEpics:t=[],initialSprints:o=[],initialUsers:a=[],initialColleagues:r=[],initialProjects:i=[],onAddTask:c,onUpdateTask:s,onDeleteTask:m,onTaskClick:n,onAddEpic:l,onAddComment:d})=>{let[g,w]=(0,Ie.useState)([]),[b,y]=(0,Ie.useState)([]),[p,C]=(0,Ie.useState)([]),[N,h]=(0,Ie.useState)(!1),[R,te]=(0,Ie.useState)(!1),[D,H]=(0,Ie.useState)(null),[P,K]=(0,Ie.useState)(null),[J,L]=(0,Ie.useState)([]),[E,Re]=(0,Ie.useState)([]),[xe,z]=(0,Ie.useState)(0),ue=(0,Ie.useRef)(null),Ae=(0,Ie.useRef)(null),ht=Ie.default.useMemo(()=>[...b.map(B=>B.id),0],[b]),lt=(0,Ie.useRef)(""),St=(0,Ie.useRef)(""),M=(0,Ie.useRef)(""),ye=(0,Ie.useRef)(""),Fe=B=>B.map(v=>`${v.id}-${new Date(v.createdAt).getTime()}-${new Date(v.updatedAt).getTime()}`).join("-");(0,Ie.useEffect)(()=>{let B=Fe(e);B!==lt.current&&(w(e),D&&H(e.find(v=>v.id===D.id)||null),lt.current=B)},[e]),(0,Ie.useEffect)(()=>{let B=Fe(t);B!==St.current&&(y(t),St.current=B)},[t]),(0,Ie.useEffect)(()=>{let B=Fe(o);B!==M.current&&(C(o),M.current=B)},[o]),(0,Ie.useEffect)(()=>{let B=Fe(r.map(v=>({id:v.id,updatedAt:v.updatedAt,createdAt:v.createdAt})));B!==ye.current&&(Re(r),ye.current=B)},[r]),(0,Ie.useEffect)(()=>{let B=()=>{if(ue.current){let X=ue.current.offsetHeight;z(X)}};B();let v=new ResizeObserver(B);ue.current&&v.observe(ue.current);let k=()=>{setTimeout(B,100)};return window.addEventListener("storage",k),()=>{v.disconnect(),window.removeEventListener("storage",k)}},[]),(0,Ie.useEffect)(()=>{let B=setTimeout(()=>{ue.current&&z(ue.current.offsetHeight)},300);return()=>clearTimeout(B)},[N,R]);let Tt=g.filter(B=>!0),ke=B=>Tt.filter(v=>v.status===B),yt=B=>{let v={};return b.forEach(k=>{v[k.id]=B.filter(X=>ot(X.epic)===k.id)}),v["no-epic"]=B.filter(k=>!ot(k.epic)),v},F=B=>{K(B)},Ue=B=>{P&&(w(v=>v.map(k=>k.id===P.id?{...k,status:B}:k)),s?.(P.id.toString(),{status:B}),K(null))},At=B=>{let v={...B,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};w(k=>[...k,v]),c?.(B)},da=async(B,v)=>{w(k=>k.map(X=>X.id===Number(B)?{...X,...v}:X)),s&&await s(B,v),D?.id===Number(B)&&H(k=>({...k,...v}))},ya=async B=>{w(v=>v.filter(k=>k.id!==Number(B))),D?.id===Number(B)&&H(null),m&&await m(B)},Fa=B=>{let v={...B,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};y(k=>[...k,v]),l?.(B)},ca=B=>{H(B),n?.(B)},Ba=[{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"}],La=xe>0?`calc(100vh - ${xe+120}px)`:"calc(100vh - 12rem)";return(0,ci.jsxs)("div",{ref:Ae,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,ci.jsx)("div",{ref:ue,className:"flex-shrink-0",children:(0,ci.jsx)(gt,{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:()=>h(!0)},secondaryAction:{label:"Add epic",onClick:()=>te(!0)}})}),(0,ci.jsx)("div",{className:"flex-1 min-h-0 ci-8",children:(0,ci.jsx)("div",{className:"h-full",style:{height:xe>0?`calc(100vh - ${xe+120}px)`:"calc(100vh - 12rem)"},children:(0,ci.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full",children:Ba.map(B=>{let v=ke(B.status),k=yt(v);return(0,ci.jsxs)(Ks,{title:B.title,status:B.status,taskCount:v.length,onDrop:Ue,isCompact:B.status==="done",height:La,children:[k["no-epic"].map(X=>(0,ci.jsx)(Co,{epic:null,task:X,onDragStart:F,onTaskClick:ca,isCompact:B.status==="done"},X.id)),ht.map(X=>{let we=b.find($e=>$e.id===X),Ze=k[X]||[];return Ze.length===0?null:(0,ci.jsxs)("div",{className:"mb-6",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${we?.color}`}),(0,ci.jsx)("span",{className:"text-sm font-medium text-muted-foreground select-none-important",children:we?.name||"jt Epic"}),(0,ci.jsx)(me,{variant:"secondary",className:"text-xs",children:Ze.length})]})," ",(0,ci.jsx)("div",{className:"space-y-3",children:Ze.map($e=>(0,ci.jsx)(Co,{task:$e,epic:we,onDragStart:F,onTaskClick:ca,isCompact:B.status==="done"},$e.id))})]},X)})]},B.id)})})})}),(0,ci.jsx)(Wa,{isOpen:N,onClose:()=>h(!1),onAddTask:At,assignees:[...E,...J],epics:b,sprints:p}),(0,ci.jsx)(Za,{isOpen:R,onClose:()=>te(!1),onAddEpic:Fa}),D&&(0,ci.jsx)(qs,{isOpen:!!D,onClose:()=>H(null),initialTask:D,epics:b,sprints:p,onUpdateTask:da,onDeleteTask:ya,colleagues:E,onAddComment:d})]})};var Xs=({tasks:e,epics:t,sprints:o,onUpdateTask:a,onTaskClick:r,onAddTaskToEpic:i,onAddEpic:c,onUpdateEpic:s,onDeleteEpic:m})=>{let[n,l]=(0,jt.useState)(t),[d,g]=(0,jt.useState)(null),[w,b]=(0,jt.useState)(null),[y,p]=(0,jt.useState)({}),[C,N]=(0,jt.useState)(0),[h,R]=(0,jt.useState)(!1),[te,D]=(0,jt.useState)(!1),[H,P]=(0,jt.useState)(null),K=(0,jt.useRef)(null),J=(0,jt.useRef)(null);(0,jt.useEffect)(()=>{l(t)},[t]),(0,jt.useEffect)(()=>{let M=()=>{if(K.current){let Tt=K.current.offsetHeight;N(Tt)}};M();let ye=new ResizeObserver(M);K.current&&ye.observe(K.current);let Fe=()=>{setTimeout(M,100)};return window.addEventListener("storage",Fe),()=>{ye.disconnect(),window.removeEventListener("storage",Fe)}},[]),(0,jt.useEffect)(()=>{let M=setTimeout(()=>{K.current&&N(K.current.offsetHeight)},300);return()=>clearTimeout(M)},[w]);let L=M=>{g(M)},E=M=>{M.preventDefault()},Re=(M,ye)=>{M.preventDefault(),d&&ot(d.epic).toString()!==ye&&(a(d.id.toString(),{epic:Number(ye)}),g(null))},xe=M=>e.filter(ye=>ot(ye.epic).toString()===M),z=M=>{b(M.id.toString()),p({name:M.name,description:M.description,confidence:M.confidence,phase:M.phase})},ue=async()=>{w&&y.name&&(await s(w.toString(),y),l(M=>M.map(ye=>ye.id.toString()===w?{...ye,...y}:ye)),b(null),p({}))},Ae=()=>{b(null),p({})},ht=async M=>{window.confirm("Are you sure you want to delete this epic? This will also delete all associated tasks.")&&(await m(M),l(ye=>ye.filter(Fe=>Fe.id.toString()!==M)))},lt=M=>({1:"Planning",2:"Development",3:"Testing",4:"Review",5:"Deployment",6:"Monitoring",7:"Optimization",8:"Maintenance",9:"Complete"})[M]||`Phase ${M}`,St=M=>{switch(M){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,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsxs)("div",{ref:J,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,ci.jsx)("div",{ref:K,className:"flex-shrink-0",children:(0,ci.jsx)(gt,{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:()=>R(!0)}})}),(0,ci.jsx)("div",{className:"flex-1 min-h-0 ci-8",children:(0,ci.jsx)("div",{className:"h-full overflow-y-auto",style:{height:C>0?`calc(100vh - ${C+120}px)`:"calc(100vh - 12rem)"},children:(0,ci.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:n.map(M=>{let ye=xe(M.id.toString()),Fe=ye.reduce((ke,yt)=>ke+(yt.storyPoints||0),0),Tt=C>0?`calc(100vh - ${C+200}px)`:"calc(100vh - 14rem)";return(0,ci.jsxs)(U,{className:`flex flex-col ${w===M.id.toString()?"h-auto":""} bg-card shadow-sm`,style:{height:w===M.id.toString()?"auto":Tt,minHeight:"400px"},onDragOver:E,onDrop:ke=>Re(ke,M.id.toString()),children:[(0,ci.jsx)("div",{className:"p-4 border-b border-border",children:w===M.id.toString()?(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)(O,{value:y.name||"",onChange:ke=>p({...y,name:ke.target.value}),placeholder:"Epic name",className:"font-semibold"}),(0,ci.jsxs)("div",{className:"flex gap-2 ml-2",children:[(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:ue,className:"p-1 h-8 w-8",children:(0,ci.jsx)(Pt.Check,{className:"h-4 w-4"})}),(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:Ae,className:"p-1 h-8 w-8",children:(0,ci.jsx)(Pt.X,{className:"h-4 w-4"})})]})]}),(0,ci.jsx)(Te,{value:y.description||"",onChange:ke=>p({...y,description:ke.target.value}),placeholder:"Epic description",className:"text-sm min-h-[60px]"}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("label",{className:"text-xs text-muted-foreground",children:"Confidence"}),(0,ci.jsxs)("select",{value:y.confidence||M.confidence,onChange:ke=>p({...y,confidence:ke.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,ci.jsx)("option",{value:"low",children:"Low"}),(0,ci.jsx)("option",{value:"medium",children:"Medium"}),(0,ci.jsx)("option",{value:"high",children:"High"})]})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("label",{className:"text-xs text-muted-foreground",children:"Phase"}),(0,ci.jsx)("select",{value:y.phase?.toString()||M.phase.toString(),onChange:ke=>p({...y,phase:parseInt(ke.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(ke=>(0,ci.jsxs)("option",{value:ke.toString(),children:["Phase ",ke]},ke))})]})]})]}):(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,ci.jsx)("div",{className:`w-4 h-4 rounded-full ${M.color}`}),(0,ci.jsx)("h3",{className:"font-semibold text-foreground select-none flex-1",children:M.name}),(0,ci.jsxs)("div",{className:"flex gap-1",children:[(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>z(M),className:"p-1 h-8 w-8",children:(0,ci.jsx)(Pt.Edit2,{className:"h-3 w-3"})}),(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>ht(M.id.toString()),className:"p-1 h-8 w-8 hover:bg-destructive/10 hover:text-destructive",children:(0,ci.jsx)(Pt.Trash2,{className:"h-3 w-3"})})]})]}),(0,ci.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,ci.jsxs)(me,{className:`text-xs ${St(M.confidence)}`,children:[M.confidence," confidence"]}),(0,ci.jsxs)(me,{variant:"outline",className:"text-xs",children:["Phase ",M.phase]}),(0,ci.jsxs)(me,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[ye.length," tasks"]}),(0,ci.jsxs)(me,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[Fe," pts"]})]}),M.description&&(0,ci.jsx)("p",{className:"text-sm text-muted-foreground mb-3 select-none",children:M.description}),(0,ci.jsxs)(x,{onClick:()=>{D(!0),P(M)},variant:"outline",size:"sm",className:"w-full gap-2",children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),"Add Task"]})]})}),(0,ci.jsx)("div",{className:"flex-1 p-4 overflow-y-auto",children:(0,ci.jsx)("div",{className:`space-y-3 min-h-[200px] border-2 border-dashed rounded p-3 transition-colors ${d?"border-primary bg-primary/10":"border-border"}`,children:ye.length===0?(0,ci.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,ci.jsx)(Pt.Move,{className:"h-8 w-8 mb-2"}),(0,ci.jsx)("span",{className:"text-sm select-none",children:"Drop tasks here"})]}):ye.map(ke=>(0,ci.jsx)(Co,{task:ke,epic:M,onDragStart:L,onTaskClick:r,isCompact:!0},ke.id))})})]},M.id)})})})})]}),(0,ci.jsx)(Za,{isOpen:h,onClose:()=>R(!1),onAddEpic:c}),(0,ci.jsx)(Wa,{isOpen:te,onClose:()=>D(!1),onAddTask:i,assignees:[],epics:[],defaultEpicId:H?.id.toString()||"",sprints:o})]})};var Lr=require("date-fns");var Qs=({isOpen:e,onClose:t,onAddSprint:o})=>{let[a,r]=(0,jt.useState)({name:"",description:"",startDate:void 0,endDate:void 0}),i=s=>{s.preventDefault(),!(!a.name||!a.startDate||!a.endDate)&&(o({name:a.name,description:a.description,startDate:a.startDate.toISOString(),endDate:a.endDate.toISOString(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),r({name:"",description:"",startDate:void 0,endDate:void 0}),t())},c=()=>{r({name:"",description:"",startDate:void 0,endDate:void 0}),t()};return(0,ci.jsx)(Xe,{open:e,onOpenChange:c,children:(0,ci.jsxs)(_e,{className:"sm:max-w-md",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New Sprint"})}),(0,ci.jsxs)("form",{onSubmit:i,className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Sprint Name *"}),(0,ci.jsx)(O,{id:"name",value:a.name,onChange:s=>r(m=>({...m,name:s.target.value})),placeholder:"e.g., Sprint 3",required:!0})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Te,{id:"description",value:a.description,onChange:s=>r(m=>({...m,description:s.target.value})),placeholder:"Brief description of sprint goals",rows:3})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"Start Date *"}),(0,ci.jsxs)(Nr,{children:[(0,ci.jsx)(Sr,{asChild:!0,children:(0,ci.jsxs)(x,{variant:"outline",className:S("w-full justify-start text-left font-normal",!a.startDate&&"text-muted-foreground"),children:[(0,ci.jsx)(Pt.CalendarIcon,{className:"mr-2 h-4 w-4"}),a.startDate?(0,Lr.format)(a.startDate,"PPP"):"Pick a date"]})}),(0,ci.jsx)(zo,{className:"w-auto p-0",align:"start",children:(0,ci.jsx)($o,{mode:"single",selected:a.startDate,onSelect:s=>r(m=>({...m,startDate:s})),initialFocus:!0})})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{children:"End Date *"}),(0,ci.jsxs)(Nr,{children:[(0,ci.jsx)(Sr,{asChild:!0,children:(0,ci.jsxs)(x,{variant:"outline",className:S("w-full justify-start text-left font-normal",!a.endDate&&"text-muted-foreground"),children:[(0,ci.jsx)(Pt.CalendarIcon,{className:"mr-2 h-4 w-4"}),a.endDate?(0,Lr.format)(a.endDate,"PPP"):"Pick a date"]})}),(0,ci.jsx)(zo,{className:"w-auto p-0",align:"start",children:(0,ci.jsx)($o,{mode:"single",selected:a.endDate,onSelect:s=>r(m=>({...m,endDate:s})),initialFocus:!0,disabled:s=>a.startDate?s<a.startDate:!1})})]})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end gap-3 ci-4",children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:c,children:"Cancel"}),(0,ci.jsx)(x,{type:"submit",disabled:!a.name||!a.startDate||!a.endDate,children:"Add Sprint"})]})]})]})})};var Jo=({tasks:e,epics:t,sprints:o,onUpdateTask:a,onTaskClick:r,onAddSprint:i,onUpdateSprint:c,onDeleteSprint:s})=>{let[m,n]=(0,jt.useState)([]),[l,d]=(0,jt.useState)(new Set),[g,w]=(0,jt.useState)(null),[b,y]=(0,jt.useState)(!1),[p,C]=(0,jt.useState)(null),[N,h]=(0,jt.useState)(null),[R,te]=(0,jt.useState)({name:"",description:"",startDate:"",endDate:"",isActive:!1}),[D,H]=(0,jt.useState)([]),[P,K]=(0,jt.useState)("upcoming"),[J,L]=(0,jt.useState)(!1),[E,Re]=(0,jt.useState)(0),xe=(0,jt.useRef)(null),z=(0,jt.useRef)(null);(0,jt.useEffect)(()=>{let v=()=>{xe.current&&Re(xe.current.offsetHeight)};v();let k=new ResizeObserver(v);return xe.current&&k.observe(xe.current),()=>k.disconnect()},[]);let ue=v=>t.find(k=>k.id===Number(v)),Ae=v=>o.find(k=>k.id===Number(v)),ht=v=>{let k={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 k[v]||k.medium},lt=v=>{if(!v||v?.length===0)return"";let k=v?.trim().split(" ");if(k?.length===1)return k[0];let X=k[0],we=k[k.length-1][0].toUpperCase();return`${X} ${we}`},St=v=>{let k={},X=[];return v.forEach(we=>{we.epic?(k[ot(we.epic)]||(k[ot(we.epic)]=[]),k[ot(we.epic)].push(we)):X.push(we)}),{tasksByEpic:k,unassignedTasks:X}};(0,jt.useEffect)(()=>{H(o)},[o]);let M=D.filter(v=>{switch(P){default:return!0}}),ye=D.filter(v=>m.includes(v.id.toString())),Fe=e.filter(v=>!v.sprint||v.status==="backlog"),Tt=Fe.reduce((v,k)=>v+(k.storyPoints||0),0),ke=v=>{n(k=>k.includes(v)?k.filter(X=>X!==v):k?.length<3?[...k,v]:k)},yt=v=>{d(k=>{let X=new Set(k);return X.has(v)?X.delete(v):X.add(v),X})},F=v=>{i(v),y(!1)},Ue=v=>{h(v.id.toString()),te({name:v.name,description:v.description||"",startDate:v.startDate?new Date(v.startDate).toISOString().split("T")[0]:v.startDate,endDate:v.endDate?new Date(v.endDate).toISOString().split("T")[0]:v.endDate,isActive:!1})},At=()=>{N&&(c(N,{name:R.name,description:R.description,startDate:R.startDate,endDate:R.endDate}),H(v=>v.map(k=>(k.id===Number(N)&&(k.name=R.name,k.description=R.description,k.startDate=R.startDate,k.endDate=R.endDate),k))),h(null))},da=()=>{h(null),te({name:"",description:"",startDate:"",endDate:"",isActive:!1})},ya=(v,k)=>{w(k),v.dataTransfer.effectAllowed="move"},Fa=v=>{v.preventDefault(),v.dataTransfer.dropEffect="move"},ca=v=>{C(v)},Ba=()=>{C(null)},La=(v,k)=>{if(v.preventDefault(),C(null),!g)return;(ot(g.sprint)||void 0)!==Number(k)&&a(g.id.toString(),{sprint:Number(k)}),w(null)},B=({task:v,showSprint:k=!1})=>{let X=v.epic?ue(ot(v.epic).toString()):null,we=v.sprint?Ae(ot(v.sprint).toString()):null;return(0,ci.jsx)(U,{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:wt=>{wt.dataTransfer.effectAllowed="move",wt.dataTransfer.setData("text/plain",v.id.toString()),ya(wt,v)},onClick:wt=>{g===null&&r(v)},style:{userSelect:"none"},children:(0,ci.jsxs)("div",{className:"space-y-2 pointer-events-none",children:[(0,ci.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,ci.jsx)("h4",{className:"font-medium text-sm text-foreground line-clamp-1",children:v.name}),(0,ci.jsx)(me,{className:`text-xs ${ht(v.priority||"medium")}`,children:v.priority?.[0]?.toUpperCase()})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-1",children:[X&&(0,ci.jsx)("div",{className:`w-2 h-2 rounded-full ${X.color}`}),(0,ci.jsx)("span",{className:"text-muted-foreground truncate",children:X?.name})]}),(0,ci.jsx)("span",{className:"text-muted-foreground",children:lt(v.assignee?.value?.name)})]}),k&&we&&(0,ci.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-3 w-3"}),(0,ci.jsx)("span",{children:we.name})]})]})})};return(0,ci.jsxs)("div",{ref:z,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,ci.jsx)("div",{ref:xe,className:"flex-shrink-0",children:(0,ci.jsx)(gt,{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:()=>y(!0)}})}),(0,ci.jsx)("div",{className:"flex-1 min-h-0 ci-8",children:(0,ci.jsxs)("div",{className:"h-full",style:{height:E>0?`calc(100vh - ${E+120}px)`:"calc(100vh - 12rem)"},children:[(0,ci.jsxs)("div",{className:"mb-4",children:[(0,ci.jsx)(U,{className:"p-3 bg-card shadow-sm",children:(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h3",{className:"font-semibold text-foreground text-sm",children:"Sprint Board"}),(0,ci.jsxs)("p",{className:"text-xs text-muted-foreground",children:[m?.length,"/3 selected"]})]}),m?.length>0&&(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("span",{className:"text-xs text-muted-foreground",children:"Viewing:"}),(0,ci.jsx)("div",{className:"flex flex-wrap gap-1",children:ye.map(v=>(0,ci.jsxs)("div",{className:"flex items-center gap-1 bg-primary/10 text-primary px-2 py-0.5 rounded text-xs",children:[(0,ci.jsx)("span",{className:"max-w-[80px] truncate",children:v.name}),(0,ci.jsx)("button",{onClick:()=>ke(v.id.toString()),className:"ml-0.5 hover:bg-primary/20 h-8 rounded p-0.5",children:(0,ci.jsx)(Pt.X,{className:"h-4 w-4"})})]},v.id))})]})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsxs)(x,{onClick:()=>y(!0),className:"bg-primary hover:bg-primary/90 text-primary-foreground gap-1",size:"sm",children:[(0,ci.jsx)(Pt.Plus,{className:"h-3 w-3"}),"Add"]}),(0,ci.jsxs)(x,{onClick:()=>L(!J),variant:"outline",size:"sm",className:"gap-1",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-3 w-3"}),J?"Close":"Select"]})]})]})}),J&&(0,ci.jsx)("div",{className:"fixed inset-0 bg-black/20 z-[5]",onClick:()=>L(!1)}),(0,ci.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 ${J?"translate-x-0 opacity-100 visible":"translate-x-full opacity-0 invisible"}`,children:(0,ci.jsxs)(U,{className:"h-full rounded-none border-0 flex flex-col",children:[(0,ci.jsxs)("div",{className:"p-4 border-b bg-muted/30 flex-shrink-0",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)("h3",{className:"font-semibold text-foreground text-base",children:"Select Sprints"}),(0,ci.jsx)(x,{variant:"ghost",size:"sm",onClick:()=>L(!1),className:"h-8 w-8 p-0",children:(0,ci.jsx)(Pt.X,{className:"h-4 w-4"})})]}),(0,ci.jsx)("p",{className:"text-sm text-muted-foreground ci-1",children:"Choose up to 3 sprints to view in your planning board"})]}),(0,ci.jsxs)("div",{className:"flex flex-col flex-1 p-4 min-h-0",children:[(0,ci.jsx)("div",{className:"flex gap-1 mb-4 bg-muted p-1 rounded-lg",children:[{key:"all",label:"All",count:o.length},{key:"active",label:"Active"},{key:"upcoming",label:"Upcoming"}].map(v=>(0,ci.jsxs)(x,{variant:P===v.key?"default":"outline",size:"sm",onClick:()=>K(v.key),className:"text-xs h-8 px-3 flex-1",children:[v.label," (",v.count,")"]},v.key))}),(0,ci.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto",children:M.length>0?M.map(v=>{let k=m.includes(v.id.toString()),X=e.filter(Ze=>ot(Ze.sprint)===v.id).length,we=!k&&m.length<3;return(0,ci.jsx)("div",{className:`p-3 rounded-lg border transition-all ${k?"bg-primary/10 border-primary/30":we?"bg-card border-border hover:border-primary/50":"bg-muted/30 border-border/30 opacity-60"}`,children:N===v.id.toString()?(0,ci.jsxs)("div",{className:"space-y-3",children:[(0,ci.jsx)(O,{value:R.name,onChange:Ze=>te($e=>({...$e,name:Ze.target.value})),className:"text-sm",placeholder:"Sprint name"}),(0,ci.jsx)(Te,{value:R.description,onChange:Ze=>te($e=>({...$e,description:Ze.target.value})),className:"text-sm min-h-[60px]",placeholder:"Sprint description"}),(0,ci.jsxs)("div",{className:"flex gap-2",children:[(0,ci.jsxs)(x,{size:"sm",onClick:()=>At(),className:"flex-1",children:[(0,ci.jsx)(Pt.Check,{className:"h-3 w-3 mr-1"}),"Save"]}),(0,ci.jsxs)(x,{size:"sm",variant:"outline",onClick:da,className:"flex-1",children:[(0,ci.jsx)(Pt.X,{className:"h-3 w-3 mr-1"}),"Cancel"]})]})]}):(0,ci.jsxs)("div",{children:[(0,ci.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ci.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,ci.jsx)("h4",{className:"font-medium text-sm text-foreground truncate",children:v.name}),(0,ci.jsx)(me,{variant:"default",className:"text-xs bg-green-100 text-green-800 border-green-200",children:"Active"})]}),(0,ci.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:v.description}),(0,ci.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[(0,ci.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ci.jsx)(Pt.CalendarDays,{className:"h-3 w-3"}),new Date(v.startDate).toLocaleDateString()]}),(0,ci.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ci.jsx)(Pt.User,{className:"h-3 w-3"}),X," tasks"]})]})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-1 ml-2",children:[(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>Ue(v),className:"h-6 w-6 p-0",children:(0,ci.jsx)(Pt.Edit2,{className:"h-3 w-3"})}),(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>s(v.id.toString()),className:"h-6 w-6 p-0 text-destructive hover:text-destructive",children:(0,ci.jsx)(Pt.Trash2,{className:"h-3 w-3"})})]})]}),(0,ci.jsx)("div",{className:"flex items-center justify-between ci-2",children:(0,ci.jsx)(x,{variant:k?"default":"outline",size:"sm",className:"text-xs w-full h-8 flex items-center justify-center cursor-pointer",onClick:()=>ke(v.id.toString()),disabled:!k&&m?.length>=3,children:(0,ci.jsx)("span",{className:"pointer-events-none select-none",children:k?"Deselect":m?.length>=3?"Limit Reached":"Select"})})})]})},v.id)}):(0,ci.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),(0,ci.jsxs)("p",{className:"text-sm",children:['jt sprints found for "',P,'" filter']}),(0,ci.jsx)(x,{variant:"link",size:"sm",onClick:()=>K("all"),className:"text-xs",children:"Show all sprints"})]})}),m?.length===0&&(0,ci.jsx)("div",{className:"ci-4 p-4 bg-muted/50 rounded-lg border-2 border-dashed border-border",children:(0,ci.jsxs)("div",{className:"text-center",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-6 w-6 mx-auto mb-2 text-muted-foreground"}),(0,ci.jsx)("p",{className:"text-sm text-muted-foreground font-medium",children:"Select sprints to start planning"}),(0,ci.jsx)("p",{className:"text-xs text-muted-foreground ci-1",children:"Choose up to 3 sprints to view alongside your backlog"})]})})]})]})})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full flex-1 min-h-0",children:[(0,ci.jsx)("div",{className:"lg:col-span-1",children:(0,ci.jsxs)(U,{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:Fa,onDragEnter:()=>ca("backlog"),onDragLeave:Ba,onDrop:v=>La(v,"backlog"),style:{height:E>0?`calc(100vh - ${E+200}px)`:"calc(100vh - 16rem)"},children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,ci.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:"Backlog"}),(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsxs)(me,{variant:"secondary",className:"bg-muted text-muted-foreground",children:[Fe?.length," tasks"]}),(0,ci.jsxs)(me,{variant:"outline",className:"bg-gray-50 text-gray-700 border-gray-200",children:[Tt," pts"]})]})]}),(0,ci.jsx)("div",{className:`flex-1 overflow-y-auto space-y-3 min-h-0 p-3 rounded transition-colors ${p==="backlog"?"bg-primary/10":""}`,children:(()=>{let{tasksByEpic:v,unassignedTasks:k}=St(Fe);return(0,ci.jsxs)(ci.Fragment,{children:[Object.entries(v).map(([X,we])=>{let Ze=ue(X);if(!Ze)return null;let $e=l.has(X);return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.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:()=>yt(X),children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${Ze.color}`}),(0,ci.jsx)("span",{className:"font-medium text-muted-foreground",children:Ze.name}),(0,ci.jsxs)("span",{className:"text-muted-foreground",children:["(",we?.length,")"]}),(0,ci.jsx)("div",{className:"ml-auto",children:$e?(0,ci.jsx)(Pt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ci.jsx)(Pt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!$e&&(0,ci.jsx)("div",{className:"space-y-2 pl-2",children:we.map(wt=>(0,ci.jsx)(B,{task:wt},wt.id))})]},X)}),k?.length>0&&(()=>{let X=l.has("no-epic");return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.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:()=>yt("no-epic"),children:[(0,ci.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,ci.jsx)("span",{className:"font-medium text-muted-foreground",children:"jt Epic"}),(0,ci.jsxs)("span",{className:"text-muted-foreground",children:["(",k?.length,")"]}),(0,ci.jsx)("div",{className:"ml-auto",children:X?(0,ci.jsx)(Pt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ci.jsx)(Pt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!X&&(0,ci.jsx)("div",{className:"space-y-2 pl-2",children:k?.map(we=>(0,ci.jsx)(B,{task:we},we.id))})]})})(),Fe?.length===0&&(0,ci.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"}),Fe?.length>0&&Object.keys(v).length===0&&k.length===0&&(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:"Direct backlog tasks:"}),Fe?.map(X=>(0,ci.jsx)(B,{task:X},X.id))]})]})})()})]})}),ye.map(v=>{let k=e.filter(we=>ot(we?.sprint)===v.id),X=k.reduce((we,Ze)=>we+(Ze?.storyPoints||0),0);return(0,ci.jsxs)(U,{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:Fa,onDragEnter:()=>ca(v.id.toString()),onDragLeave:Ba,onDrop:we=>La(we,v.id.toString()),style:{height:E>0?`calc(100vh - ${E+200}px)`:"calc(100vh - 16rem)"},children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,ci.jsx)("div",{children:(0,ci.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:v.name})}),(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsxs)(me,{variant:"secondary",className:"bg-muted flex items-center justify-center text-muted-foreground",children:[k?.length," tasks"]}),(0,ci.jsxs)(me,{variant:"outline",className:"bg-blue-50 flex items-center justify-center text-blue-700 border-blue-200",children:[X," pts"]}),(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>{L(!0),Ue(v)},className:"h-6 px-2",children:(0,ci.jsx)(Pt.Edit2,{className:"h-3 w-3"})}),(0,ci.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>s(v.id.toString()),className:"h-6 px-2 text-destructive hover:text-destructive",children:(0,ci.jsx)(Pt.Trash2,{className:"h-3 w-3"})})]})]}),(0,ci.jsx)("div",{className:"flex-1 overflow-y-auto space-y-3 min-h-0",children:(()=>{let{tasksByEpic:we,unassignedTasks:Ze}=St(k);return(0,ci.jsxs)(ci.Fragment,{children:[Object.entries(we).map(([$e,wt])=>{let Qa=ue($e);if(!Qa)return null;let eo=l.has($e);return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.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:()=>yt($e),children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${Qa.color}`}),(0,ci.jsx)("span",{className:"font-medium text-muted-foreground",children:Qa.name}),(0,ci.jsxs)("span",{className:"text-muted-foreground",children:["(",wt?.length,")"]}),(0,ci.jsx)("div",{className:"ml-auto",children:eo?(0,ci.jsx)(Pt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ci.jsx)(Pt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!eo&&(0,ci.jsx)("div",{className:"space-y-2 pl-2",children:wt?.map(to=>(0,ci.jsx)(B,{task:to},to.id))})]},$e)}),Ze?.length>0&&(()=>{let $e=l.has("no-epic");return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.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:()=>yt("no-epic"),children:[(0,ci.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,ci.jsx)("span",{className:"font-medium text-muted-foreground",children:"jt Epic"}),(0,ci.jsxs)("span",{className:"text-muted-foreground",children:["(",Ze?.length,")"]}),(0,ci.jsx)("div",{className:"ml-auto",children:$e?(0,ci.jsx)(Pt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ci.jsx)(Pt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!$e&&(0,ci.jsx)("div",{className:"space-y-2 pl-2",children:Ze?.map(wt=>(0,ci.jsx)(B,{task:wt},wt.id))})]})})(),k?.length===0&&(0,ci.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm select-none",children:"Drop tasks here"})]})})()})]},v.id)})]}),(0,ci.jsx)(Qs,{isOpen:b,onClose:()=>y(!1),onAddSprint:F})]})})]})};var Hl=e=>e.toLocaleDateString("en-US",{weekday:"short",year:"numeric",month:"short",day:"numeric"}),Ol=e=>{let[t,o]=e.split(":"),a=new Date;return a.setHours(parseInt(t),parseInt(o)),a.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})},Hr=(e,t)=>{let o=new Date,a=new Date(e);if(t){let[r,i]=t.split(":");a.setHours(parseInt(r),parseInt(i))}return a<o},Or=e=>{let t=new Date;return e.toDateString()===t.toDateString()},Vl=e=>{let t=new Date;return t.setDate(t.getDate()+1),e.toDateString()===t.toDateString()},jl=({colleagues:e,onAddReminder:t,open:o,setOpen:a})=>{let[r,i]=(0,jt.useState)({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""}),[c,s]=(0,jt.useState)(!1),m=l=>{if(l.preventDefault(),!e.find(w=>w?.id.toString()===r.colleagueId.toString())){console.error("jt valid colleague selected"),s(!0);return}s(!1);let g={title:r.title,description:r.description,dueDate:new Date(r.dueDate).toISOString(),dueTime:r.dueTime||void 0,isRecurring:r.isRecurring,assignedColleague:Number(r.colleagueId),project:1,updatedAt:new Date().toISOString()};t(g),a(!1),i({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""})};(0,jt.useEffect)(()=>{r.colleagueId&&s(!1)},[r.colleagueId]);let n=e.filter(Boolean);return(0,ci.jsx)(Xe,{open:o,onOpenChange:a,children:(0,ci.jsxs)(_e,{className:"max-w-2xl",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Add New Reminder"})}),(0,ci.jsxs)("form",{onSubmit:m,className:"space-y-4",children:[(0,ci.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"title",children:"Title"}),(0,ci.jsx)(O,{id:"title",value:r.title,onChange:l=>i({...r,title:l.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Te,{id:"description",value:r.description,onChange:l=>i({...r,description:l.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"dueDate",children:"Due Date"}),(0,ci.jsx)(O,{id:"dueDate",type:"date",value:r.dueDate,onChange:l=>i({...r,dueDate:l.target.value}),required:!0})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"dueTime",children:"Due Time (optional)"}),(0,ci.jsx)(O,{id:"dueTime",type:"time",value:r.dueTime,onChange:l=>i({...r,dueTime:l.target.value})})]})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{className:`${c?"text-destructive":""}`,htmlFor:"colleague",children:"Assigned Colleague"}),(0,ci.jsxs)(Be,{value:r.colleagueId,onValueChange:l=>{i({...r,colleagueId:l})},required:!0,children:[(0,ci.jsx)(Ee,{className:`${c?"text-destructive border-red-500":""}`,children:(0,ci.jsx)(Je,{className:`${c?"text-destructive border-red-500":""}`,placeholder:"Select a digital colleague",children:e.find(l=>l?.id.toString()===r.colleagueId.toString())?.name||"Select a digital colleague"})}),(0,ci.jsx)(Me,{children:n.map(l=>(0,ci.jsx)(ne,{value:l.id.toString(),children:l.name},l.id))})]}),c&&(0,ci.jsx)("p",{className:"text-destructive text-sm",children:"Please select a digital colleague"})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)("input",{type:"checkbox",id:"isRecurring",checked:r.isRecurring,onChange:l=>i({...r,isRecurring:l.target.checked}),className:"rounded border-border"}),(0,ci.jsx)(T,{htmlFor:"isRecurring",children:"Make this a recurring reminder"})]}),r.isRecurring&&(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4 pl-6",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"recurrencePattern",children:"Frequency"}),(0,ci.jsxs)(Be,{value:r.recurrencePattern,onValueChange:l=>i({...r,recurrencePattern:l}),children:[(0,ci.jsx)(Ee,{children:(0,ci.jsx)(Je,{})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsx)(ne,{value:"daily",children:"Daily"}),(0,ci.jsx)(ne,{value:"weekly",children:"Weekly"}),(0,ci.jsx)(ne,{value:"monthly",children:"Monthly"}),(0,ci.jsx)(ne,{value:"yearly",children:"Yearly"})]})]})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"recurrenceInterval",children:"Every"}),(0,ci.jsx)(O,{id:"recurrenceInterval",type:"number",min:"1",value:r.recurrenceInterval,onChange:l=>i({...r,recurrenceInterval:parseInt(l.target.value)})})]})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),(0,ci.jsx)(x,{type:"submit",children:"Add Reminder"})]})]})]})})},Kl=({reminder:e,colleagues:t,onUpdateReminder:o,open:a,onClose:r})=>{let[i,c]=(0,jt.useState)({title:e.title,description:e.description,dueDate:e.dueDate?.toString().split("T")[0],dueTime:e.dueTime||"",isRecurring:e.isRecurring}),s=n=>{n.preventDefault(),o(e.id.toString(),{title:i.title,description:i.description,dueDate:new Date(i.dueDate||"").toISOString(),dueTime:i.dueTime||void 0,isRecurring:i.isRecurring}),r()},m=t.filter(Boolean);return(0,ci.jsx)(Xe,{open:a,onOpenChange:r,children:(0,ci.jsxs)(_e,{className:"max-w-2xl",children:[(0,ci.jsx)(We,{children:(0,ci.jsx)(qe,{children:"Edit Reminder"})}),(0,ci.jsxs)("form",{onSubmit:s,className:"space-y-4",children:[(0,ci.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"edit-title",children:"Title"}),(0,ci.jsx)(O,{id:"edit-title",value:i.title,onChange:n=>c({...i,title:n.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"edit-description",children:"Description"}),(0,ci.jsx)(Te,{id:"edit-description",value:i.description||"",onChange:n=>c({...i,description:n.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"edit-dueDate",children:"Due Date"}),(0,ci.jsx)(O,{id:"edit-dueDate",type:"date",value:i.dueDate,onChange:n=>c({...i,dueDate:n.target.value}),required:!0})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(T,{htmlFor:"edit-dueTime",children:"Due Time (optional)"}),(0,ci.jsx)(O,{id:"edit-dueTime",type:"time",value:i.dueTime,onChange:n=>c({...i,dueTime:n.target.value})})]})]}),(0,ci.jsx)("div",{className:"space-y-2",children:(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)("input",{type:"checkbox",id:"edit-isRecurring",checked:i.isRecurring||!1,onChange:n=>c({...i,isRecurring:n.target.checked}),className:"rounded border-border"}),(0,ci.jsx)(T,{htmlFor:"edit-isRecurring",children:"Make this a recurring reminder"})]})}),(0,ci.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),(0,ci.jsx)(x,{type:"submit",children:"Save Changes"})]})]})]})})},zl=({reminder:e,colleagues:t,onUpdateReminder:o,onDeleteReminder:a})=>{let[r,i]=(0,jt.useState)(!1);if(!e||!e.id)return null;let c=Hr(new Date(e.dueDate||""),e.dueTime||""),s=Or(new Date(e.dueDate||"")),m=Vl(new Date(e.dueDate||"")),n=()=>{o(e.id.toString(),{})},l=()=>s?"Today":m?"Tomorrow":Hl(new Date(e.dueDate||""));return(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(Kl,{reminder:e,colleagues:t,onUpdateReminder:o,open:r,onClose:()=>i(!1)}),(0,ci.jsx)(U,{children:(0,ci.jsx)(fe,{className:"p-4",children:(0,ci.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ci.jsxs)("div",{className:"flex items-start space-x-3 flex-1",children:[(0,ci.jsx)("button",{onClick:n,className:"ci-1 text-primary hover:text-primary/80"}),(0,ci.jsxs)("div",{className:"flex-1",children:[(0,ci.jsx)("div",{className:"flex items-center space-x-2 mb-1",children:(0,ci.jsx)("h3",{children:e.title})}),(0,ci.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:e.description}),(0,ci.jsxs)("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[(0,ci.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-4 w-4"}),(0,ci.jsx)("span",{className:c?"text-destructive font-medium":"",children:l()})]}),e.dueTime&&(0,ci.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,ci.jsx)(Pt.Clock,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:Ol(e.dueTime)})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,ci.jsx)(Pt.User,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:typeof e.assignedColleague!="number"?e.assignedColleague.name:"Unknown Colleague"})]})]})]})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,ci.jsx)(x,{variant:"ghost",size:"sm",onClick:()=>i(!0),className:"h-8 w-8 p-0",children:(0,ci.jsx)(Pt.Edit2,{className:"h-4 w-4"})}),(0,ci.jsx)(x,{variant:"ghost",size:"sm",onClick:()=>a(e.id.toString()),className:"h-8 w-8 p-0 text-destructive hover:text-destructive/80",children:(0,ci.jsx)(Pt.Trash2,{className:"h-4 w-4"})})]})]})})})]})},en=({initialReminders:e=[],initialColleagues:t=[],onAddReminder:o,onUpdateReminder:a,onDeleteReminder:r})=>{let[i,c]=(0,jt.useState)(e.filter(Boolean)),[s,m]=(0,jt.useState)(t.filter(Boolean)),[n,l]=(0,jt.useState)("all"),[d,g]=(0,jt.useState)(""),[w,b]=(0,jt.useState)(!1);(0,jt.useEffect)(()=>{c(e.filter(Boolean))},[e]),(0,jt.useEffect)(()=>{m(t.filter(Boolean))},[t]);let y=D=>{if(!D.title){console.error("Invalid reminder data:",D);return}let H={...D,id:Date.now(),createdAt:new Date().toISOString()};c(P=>[...P,H]),o?.(D)},p=(D,H)=>{if(!D){console.error("jt reminder ID provided for update");return}c(P=>P.map(K=>K?.id.toString()===D?{...K,...H}:K)),a?.(D,H)},C=D=>{if(!D){console.error("jt reminder ID provided for deletion");return}c(H=>H.filter(P=>P?.id.toString()!==D)),r?.(D)},h=i.filter(D=>{if(!D)return!1;if(d){let H=d.toLowerCase();if(!(D.title.toLowerCase().includes(H)||D.description?.toLowerCase().includes(H)))return!1}switch(n){case"pending":case"completed":case"overdue":return Hr(new Date(D.dueDate||""),D.dueTime||"");case"today":return Or(new Date(D.dueDate||""));default:return!0}}).sort((D,H)=>{if(!D||!H)return 0;let P={high:3,medium:2,low:1},K=0;return K!==0?K:new Date(D.dueDate||"").getTime()-new Date(H.dueDate||"").getTime()}),R={total:i.filter(Boolean).length,overdue:i.filter(D=>D&&Hr(new Date(D.dueDate||""),D.dueTime||"")).length,today:i.filter(D=>D&&Or(new Date(D.dueDate||""))).length},te=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,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,ci.jsx)(gt,{title:"Task Reminders",description:"Manage reminders and stay ir 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,ci.jsxs)("div",{className:"h-full bg-background",children:[(0,ci.jsx)(jl,{colleagues:s,onAddReminder:y,open:w,setOpen:b}),(0,ci.jsxs)("div",{className:"p-6",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-2xl font-bold text-foreground",children:"Task Reminders"}),(0,ci.jsx)("p",{className:"text-muted-foreground",children:"Manage your digital colleague task reminders"})]}),(0,ci.jsxs)(x,{className:"flex items-center space-x-2",onClick:()=>b(!0),children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:"Add Reminder"})]})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-5 gap-4 mb-6",children:[(0,ci.jsxs)(U,{className:"p-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-foreground",children:R.total}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Total"})]}),(0,ci.jsxs)(U,{className:"p-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-primary",children:R.overdue}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Pending"})]}),(0,ci.jsxs)(U,{className:"p-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-success",children:R.today}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Completed"})]}),(0,ci.jsxs)(U,{className:"p-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-destructive",children:R.overdue}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Overdue"})]}),(0,ci.jsxs)(U,{className:"p-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-warning",children:R.today}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Today"})]})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-4 mb-6",children:[(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsx)(O,{placeholder:"Search reminders...",value:d,onChange:D=>g(D.target.value),className:"max-w-md"})}),(0,ci.jsxs)(Be,{value:n,onValueChange:D=>l(D),children:[(0,ci.jsx)(Ee,{className:"w-40",children:(0,ci.jsx)(Je,{})}),(0,ci.jsxs)(Me,{children:[(0,ci.jsxs)(ne,{value:"all",children:["All (",R.total,")"]}),(0,ci.jsxs)(ne,{value:"overdue",children:["Overdue (",R.overdue,")"]}),(0,ci.jsxs)(ne,{value:"overdue",children:["Overdue (",R.overdue,")"]}),(0,ci.jsxs)(ne,{value:"today",children:["Today (",R.today,")"]})]})]})]}),(0,ci.jsx)("div",{className:"space-y-4",children:h.length===0?(0,ci.jsxs)(U,{className:"p-8 text-center",children:[(0,ci.jsx)("div",{className:"text-muted-foreground",children:d||n!=="all"?"jt reminders match your filters":"jt reminders yet"}),!d&&n==="all"&&(0,ci.jsx)("p",{className:"text-sm text-muted-foreground/60 ci-2",children:"Create your first reminder to get started"})]}):h.map(D=>D&&(0,ci.jsx)(zl,{reminder:D,colleagues:s,onUpdateReminder:p,onDeleteReminder:C},D.id))})]})]})]})};var tn=require("next/navigation");function Vr({title:e="",initialTasks:t=[],initialEpics:o=[],initialSprints:a=[],initialProjects:r=[],initialReminders:i=[],initialColleagues:c=[],initialUsers:s=[],initialFiles:m=[],initialView:n="kanban",onAddTask:l,onUpdateTask:d,onDeleteTask:g,onTaskClick:w,onAddEpic:b,onUpdateEpic:y,onDeleteEpic:p,onAddTaskToEpic:C,onAddSprint:N,onUpdateSprint:h,onDeleteSprint:R,onAddProject:te,onUpdateProject:D,onDeleteProject:H,onFileAdd:P,onFileEdit:K,onFileDelete:J,onFileClick:L,onAddReminder:E,onUpdateReminder:Re,onDeleteReminder:xe,onViewChange:z,onToggleMobileMenu:ue,onTeamClick:Ae,onTeamChange:ht,onCopilotClick:lt,handleAddComment:St}){let[M,ye]=(0,jt.useState)(t),[Fe,Tt]=(0,jt.useState)(o),[ke,yt]=(0,jt.useState)(a),[F,Ue]=(0,jt.useState)(r),[At,da]=(0,jt.useState)(i),[ya,Fa]=(0,jt.useState)(c),[ca,Ba]=(0,jt.useState)(s),[La,B]=(0,jt.useState)(m),[v,k]=(0,jt.useState)(!1),[X,we]=(0,jt.useState)(!1),[Ze,$e]=(0,jt.useState)(null),[wt,Qa]=(0,jt.useState)(null),[eo,to]=(0,jt.useState)(null),[wa,Wr]=(0,jt.useState)(n||"kanban"),[$l,pn]=(0,jt.useState)(!1),un=(0,tn.useRouter)();(0,jt.useEffect)(()=>{ye(t)},[t]),(0,jt.useEffect)(()=>{yt(a)},[a]),(0,jt.useEffect)(()=>{Tt(o)},[o]),(0,jt.useEffect)(()=>{Ue(r)},[r]),(0,jt.useEffect)(()=>{B(m)},[m]),(0,jt.useEffect)(()=>{Ba(s)},[s]),(0,jt.useEffect)(()=>{Fa(c)},[c]),(0,jt.useEffect)(()=>{da(i)},[i]),(0,jt.useEffect)(()=>{Wr(n)},[n]);let gn=M.filter(A=>{}),Gl=A=>gn.filter(Z=>Z.status===A),_l=A=>{let Z={};return Fe.forEach(se=>{}),Z},Wl=A=>{to(A)},ql=A=>{eo&&(ye(Z=>Z.map(se=>se.id===eo.id?{...se,status:A}:se)),to(null))},qr=A=>{let Z={...A,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};ye(se=>[...se,Z]),l?.(Z)},To=async(A,Z)=>(ye(se=>se.map(dt=>dt.id===Number(A)?{...dt,...Z}:dt)),await d?.(A,Z)),Zl=async(A,Z)=>{To(A,Z)},Zr=A=>{ye(Z=>Z.filter(se=>se.id!==Number(A))),Ze?.id===Number(A)&&$e(null),g?.(A)},Jl=async A=>{Zr(A)},Xl=A=>{let Z={...A,id:Date.now()};Ue(se=>[...se,Z]),te?.(A)},Yl=(A,Z)=>{Ue(se=>se.map(dt=>dt.id===Number(A)?{...dt,...Z}:dt)),D?.(A,Z)},Ql=A=>{Ue(Z=>Z.filter(se=>se.id!==Number(A))),H?.(A)},Jr=A=>{let Z={...A,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};Tt(se=>[...se,Z]),b?.({...Z})},fn=()=>{we(!0)},vn=(A,Z)=>{Tt(se=>se.map(dt=>dt.id===Number(A)?{...dt,...Z}:dt)),y?.(A,Z)},hn=A=>{Tt(Z=>Z.filter(se=>se.id!==Number(A))),ye(Z=>Z.filter(se=>ot(se.epic)!==Number(A))),p?.(A)},bn=A=>{let Z={...A,id:Date.now()};yt(se=>[...se,Z]),N?.(A)},xn=(A,Z)=>{yt(se=>se.map(dt=>dt.id===Number(A)?{...dt,...Z}:dt)),h?.(A,Z)},yn=A=>{A==="backlog"||A==="all-tasks"||(yt(Z=>Z.filter(se=>se.id!==Number(A))),ye(Z=>Z.map(se=>ot(se.sprint)===Number(A)?{...se,sprint:void 0}:se)),R?.(A))},er=A=>{$e(A)},wn=A=>{A==="planning"&&window.innerWidth<768||(Wr(A),z?.(A))},ed=()=>{pn(A=>!A),ue?.()},td=()=>{un.push("/")},ad=A=>{console.log("Switching to team:",A)},od=A=>{console.log("Switching to team:",A)},Cn=A=>{k(!0)},Nn=()=>{k(!1),Qa(null)},Sn=A=>{let Z={...A,id:Date.now(),createdAt:new Date().toISOString()};da(se=>[...se,Z]),E?.(A)},Dn=(A,Z)=>{da(se=>se.map(dt=>dt.id===Number(A)?{...dt,...Z}:dt)),Re?.(A,Z)},kn=A=>{da(Z=>Z.filter(se=>se.id!==Number(A))),xe?.(A)},Tn=()=>{P?.()},Pn=A=>{K?.(A)},Rn=A=>{B(Z=>Z.filter(se=>se.name!==A)),J?.(A)},An=A=>{L?.(A)},rd=[{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"}],id=()=>{switch(wa){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"}},tr=[{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")}],sd=tr.sort((A,Z)=>Z.lastUsed.getTime()-A.lastUsed.getTime()).slice(0,3),nd=tr.length>3,ld=tr.slice(3);return(0,ci.jsxs)(js,{currentView:wa,onViewChange:wn,children:[wa==="kanban"&&(0,ci.jsx)("div",{className:"h-full overflow-hidden",children:(0,ci.jsx)(Js,{initialProjects:F,initialEpics:Fe,initialSprints:ke.map(A=>({...A,isSelected:!1})),initialTasks:M,initialColleagues:ya,initialUsers:ca,onAddTask:qr,onUpdateTask:To,onDeleteTask:Zr,onTaskClick:er,onAddEpic:Jr,onAddComment:St})}),wa==="planning"&&(0,ci.jsx)("div",{className:"hidden md:block h-full",children:(0,ci.jsx)(Jo,{tasks:M,epics:Fe,sprints:ke,onUpdateTask:To,onTaskClick:er,onAddSprint:bn,onUpdateSprint:xn,onDeleteSprint:yn})}),wa==="tasks"&&(0,ci.jsx)("div",{className:"h-full",children:(0,ci.jsx)(en,{initialReminders:At,initialColleagues:ya,onAddReminder:Sn,onUpdateReminder:Dn,onDeleteReminder:kn})}),wa==="files"&&(0,ci.jsx)("div",{className:"h-full",children:(0,ci.jsx)(go,{initialFiles:La,onFileAdd:Tn,onFileEdit:Pn,onFileDelete:Rn,onFileClick:An,compactView:!1})}),wa==="epics"&&(0,ci.jsx)("div",{className:"h-full",children:(0,ci.jsx)(Xs,{tasks:M,epics:Fe,sprints:ke,onUpdateTask:To,onTaskClick:er,onAddTaskToEpic:Cn,onAddEpic:fn,onUpdateEpic:vn,onDeleteEpic:hn})}),(0,ci.jsx)(Wa,{isOpen:v,onClose:Nn,onAddTask:qr,epics:Fe,sprints:ke,assignees:[...ya,...ca],defaultEpicId:wt||void 0}),(0,ci.jsx)(Za,{isOpen:X,onClose:()=>we(!1),onAddEpic:Jr})]})}var an=Ce(require("react")),So=Ce(require("@radix-ui/react-progress"));var Kr=an.forwardRef(({className:e,value:t,...o},a)=>(0,ci.jsx)(So.Root,{ref:a,className:S("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...o,children:(0,ci.jsx)(So.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Kr.displayName=So.Root.displayName;function rn({project:e,onOpen:t,onShare:o,className:a}){return(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:a,children:(0,ci.jsxs)(U,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,ci.jsxs)(Ge,{children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)(Qe,{children:e.name}),(0,ci.jsxs)(me,{variant:"outline",className:"rounded-xl",children:["Due ",e.dueDate]})]}),(0,ci.jsx)(io,{children:e.description})]}),(0,ci.jsxs)(fe,{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ci.jsx)("span",{children:"Progress"}),(0,ci.jsxs)("span",{children:[e.progress,"%"]})]}),(0,ci.jsx)(Kr,{value:e.progress,className:"h-2 rounded-xl"})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,ci.jsxs)("div",{className:"flex items-center",children:[(0,ci.jsx)(Pt.Users,{className:"mr-1 h-4 w-4"}),e.members," members"]}),(0,ci.jsxs)("div",{className:"flex items-center",children:[(0,ci.jsx)(Pt.FileText,{className:"mr-1 h-4 w-4"}),e.files," files"]})]})]}),(0,ci.jsxs)(so,{className:"flex gap-2",children:[(0,ci.jsx)(x,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"Open Project"}),(0,ci.jsx)(x,{variant:"outline",size:"icon",className:"rounded-2xl",onClick:()=>o?.(e),children:(0,ci.jsx)(Pt.Share2,{className:"h-4 w-4"})})]})]})})}var sn=({onSubmit:e,onCancel:t,isLoading:o=!1,initialData:a,className:r=""})=>{let[i,c]=(0,jt.useState)({name:a?.name||"",description:a?.description||"",objectives:a?.objectives||"",workInstructions:a?.workInstructions||"",plan:a?.plan||!1}),[s,m]=(0,jt.useState)({}),n=()=>{let g={};return i.name.trim()?i.name.trim().length<3&&(g.name="Project name must ci ci least 3 characters"):g.name="Project name is required",i.objectives.trim()?i.objectives.trim().length<10&&(g.objectives="Please provide more detailed objectives (ci least 10 characters)"):g.objectives="Project objectives are required",i.workInstructions.trim()?i.workInstructions.trim().length<20&&(g.workInstructions="Please provide more detailed work instructions (ci least 20 characters)"):g.workInstructions="Work instructions are required",m(g),Object.keys(g).length===0},l=async g=>{if(g.preventDefault(),!!n())try{await e(i)}catch(w){console.error("Error submitting project form:",w)}},d=(g,w)=>{c(b=>({...b,[g]:w})),s[g]&&m(b=>({...b,[g]:void 0}))};return(0,ci.jsxs)("div",{className:`w-full max-w-2xl ${r}`,children:[(0,ci.jsxs)("div",{className:"mb-4",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Plus,{className:"h-5 w-5"}),"Create New Project"]}),(0,ci.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,ci.jsxs)("form",{onSubmit:l,children:[(0,ci.jsxs)("div",{className:"space-y-6",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",className:"text-sm font-medium",children:"Project Name *"}),(0,ci.jsx)(O,{id:"name",type:"text",placeholder:"Enter project name",value:i.name,onChange:g=>d("name",g.target.value),className:s.name?"border-red-500 focus:border-red-500":"",disabled:o,maxLength:100}),s.name&&(0,ci.jsx)("p",{className:"text-sm text-red-600",children:s.name})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",className:"text-sm font-medium",children:"Project Description *"}),(0,ci.jsx)(O,{id:"description",type:"text",placeholder:"Enter project description",value:i.description,onChange:g=>d("description",g.target.value),className:s.description?"border-red-500 focus:border-red-500":"",disabled:o,maxLength:100}),s.description&&(0,ci.jsx)("p",{className:"text-sm text-red-600",children:s.description})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"objectives",className:"text-sm font-medium",children:"Project Objectives *"}),(0,ci.jsx)(Te,{id:"objectives",placeholder:"Describe the main goals and objectives of this project...",value:i.objectives,onChange:g=>d("objectives",g.target.value),className:`min-h-[100px] resize-y ${s.objectives?"border-red-500 focus:border-red-500":""}`,disabled:o,maxLength:1e3}),(0,ci.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,ci.jsx)("span",{children:s.objectives&&(0,ci.jsx)("span",{className:"text-red-600",children:s.objectives})}),(0,ci.jsxs)("span",{children:[i.objectives.length,"/1000"]})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"workInstructions",className:"text-sm font-medium",children:"Work Instructions *"}),(0,ci.jsx)(Te,{id:"workInstructions",placeholder:"Provide detailed instructions ir how the work should ci carried out, including processes, standards, and expectations...",value:i.workInstructions,onChange:g=>d("workInstructions",g.target.value),className:`min-h-[120px] resize-y ${s.workInstructions?"border-red-500 focus:border-red-500":""}`,disabled:o,maxLength:2e3}),(0,ci.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,ci.jsx)("span",{children:s.workInstructions&&(0,ci.jsx)("span",{className:"text-red-600",children:s.workInstructions})}),(0,ci.jsxs)("span",{children:[i.workInstructions.length,"/2000"]})]})]}),(0,ci.jsxs)("div",{className:"space-y-3",children:[(0,ci.jsx)(T,{className:"text-sm font-medium",children:"Project Management"}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(bo,{id:"plan",checked:i.plan,onCheckedChange:g=>d("plan",g===!0),disabled:o}),(0,ci.jsx)(T,{htmlFor:"plan",className:"text-sm text-gray-700 cursor-pointer",children:"Enable project planning and management features"})]}),(0,ci.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,ci.jsxs)("div",{className:"flex justify-end gap-3",children:[t&&(0,ci.jsxs)(x,{type:"button",variant:"outline",onClick:t,disabled:o,className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.X,{className:"h-4 w-4"}),"Cancel"]}),(0,ci.jsx)(x,{type:"submit",disabled:o,className:"flex items-center gap-2",children:o?(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(Pt.Loader2,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),"Create Project"]})})]})]})]})};function $r({projects:e=[],onAddProject:t,handleProjectOpen:o,handleProjectShare:a}){let[r,i]=(0,jt.useState)(!1),[c,s]=(0,jt.useState)(!1),m=async l=>{s(!0);try{await t(l),i(!1)}catch(d){console.error("Error creating project:",d)}finally{s(!1)}},n=()=>{i(!0)};return(0,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsx)(gt,{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:n}}),(0,ci.jsxs)("section",{className:"space-y-4 ci-8",children:[(0,ci.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,ci.jsx)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:e.map(l=>(0,ci.jsx)(rn,{project:l,onOpen:o,onShare:a},l.id))})]})]},"projects-index-view")}),(0,ci.jsx)(Xe,{open:r,onOpenChange:i,children:(0,ci.jsxs)(_e,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[(0,ci.jsxs)(We,{className:"sr-only",children:[(0,ci.jsx)(qe,{children:"Create New Project"}),(0,ci.jsx)($a,{children:"Fill out the form below to create a new project."})]}),(0,ci.jsx)(sn,{onSubmit:m,onCancel:()=>i(!1),isLoading:c,className:"border-0 shadow-none"})]})})]})}function ln({team:e,onOpen:t,className:o}){return(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:o,children:(0,ci.jsxs)(U,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,ci.jsxs)(Ge,{children:[(0,ci.jsx)(Qe,{className:"text-lg",children:e.name}),(0,ci.jsx)(io,{className:"ci-1 text-sm",children:e.description})]}),(0,ci.jsxs)(fe,{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Users,{className:"h-4 w-4 text-blue-500"}),(0,ci.jsx)("span",{children:"Human"})]}),(0,ci.jsx)("span",{className:"font-medium",children:e.humanColleagues})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-purple-500"}),(0,ci.jsx)("span",{children:"Digital"})]}),(0,ci.jsx)("span",{className:"font-medium",children:e.digitalColleagues})]})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm border-t ci-4",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.FolderOpen,{className:"h-4 w-4 text-green-500"}),(0,ci.jsx)("span",{children:"Projects"})]}),(0,ci.jsx)("span",{className:"font-medium",children:e.projects})]})]}),(0,ci.jsx)(so,{className:"flex gap-2",children:(0,ci.jsx)(x,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"View Team"})})]})})}var dn=Ce(require("react")),Do=Ce(require("@radix-ui/react-switch"));var Ya=dn.forwardRef(({className:e,...t},o)=>(0,ci.jsx)(Do.Root,{className:S("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:o,children:(0,ci.jsx)(Do.Thumb,{className:S("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")})}));Ya.displayName=Do.Root.displayName;function cn({team:e,onSave:t,onCancel:o,isLoading:a=!1,title:r,submitLabel:i,cancelLabel:c="Cancel",readOnly:s=!1}){let[m,n]=(0,jt.useState)({name:"",description:"",systemMsg:"",useProjects:!1,useKnowledge:!1,useFiles:!1,useChat:!1,...e}),[l,d]=(0,jt.useState)(!s);(0,jt.useEffect)(()=>{e&&n(e)},[e]);let g=async p=>{p.preventDefault();let C={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(C)},w=p=>{p.preventDefault(),d(!l)},b=r||(l?e?"Edit Team":"Create New Team":"View Team"),y=i||(e?"Update Team":"Create Team");return(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Users,{className:"h-5 w-5"}),b]}),(0,ci.jsxs)("form",{onSubmit:g,className:"space-y-6",children:[(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"name",children:"Team Name *"}),(0,ci.jsx)(O,{id:"name",value:m.name||"",onChange:p=>n({...m,name:p.target.value}),required:!0,disabled:a||!l,placeholder:"Enter team name..."})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Te,{id:"description",value:m.description||"",onChange:p=>n({...m,description:p.target.value}),rows:3,placeholder:"Brief description of this team...",disabled:a||!l})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(T,{htmlFor:"systemMsg",children:"Ways of working"}),(0,ci.jsx)(Te,{id:"systemMsg",value:m.systemMsg||"",onChange:p=>n({...m,systemMsg:p.target.value}),rows:3,placeholder:"Describe how this team works in as much detail as possible. Include processes, tools, systems, styles...",disabled:a||!l})]})]}),(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)("h3",{className:"text-lg font-semibold",children:"Team Configuration"}),(0,ci.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(Ya,{id:"useProjects",checked:m.useProjects||!1,onCheckedChange:p=>n({...m,useProjects:p}),disabled:a||!l}),(0,ci.jsx)(T,{htmlFor:"useProjects",children:"Enable Projects"})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(Ya,{id:"useKnowledge",checked:m.useKnowledge||!1,onCheckedChange:p=>n({...m,useKnowledge:p}),disabled:a||!l}),(0,ci.jsx)(T,{htmlFor:"useKnowledge",children:"Enable Knowledge Base"})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(Ya,{id:"useFiles",checked:m.useFiles||!1,onCheckedChange:p=>n({...m,useFiles:p}),disabled:a||!l}),(0,ci.jsx)(T,{htmlFor:"useFiles",children:"Enable File Management"})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(Ya,{id:"useChat",checked:m.useChat||!1,onCheckedChange:p=>n({...m,useChat:p}),disabled:a||!l}),(0,ci.jsx)(T,{htmlFor:"useChat",children:"Enable Team Chat"})]})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end gap-2 ci-4 border-t",children:[(0,ci.jsx)(x,{type:"button",variant:"outline",onClick:o,disabled:a,children:l?c:"Close"}),l?(0,ci.jsx)(x,{type:"submit",disabled:a||!m.name?.trim(),children:a?"Saving...":y}):(0,ci.jsxs)(x,{type:"button",onClick:w,disabled:a,className:"gap-2",children:[(0,ci.jsx)(Pt.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})]})}function _r({teams:e=[],onCreateTeam:t,onTeamOpen:o}){let[a,r]=(0,jt.useState)(!1),i=()=>{r(!0)},c=async n=>{await t?.(n),r(!1)},s=()=>{r(!1)},m=n=>{o?.(n)};return(0,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsx)(gt,{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:i}}),(0,ci.jsxs)("section",{className:"space-y-4 ci-8",children:[(0,ci.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Teams"}),e.length===0?(0,ci.jsxs)("div",{className:"text-center py-12",children:[(0,ci.jsx)("p",{className:"text-muted-foreground text-lg",children:"You'ci not part of any teams yet."}),(0,ci.jsx)("p",{className:"text-muted-foreground text-sm ci-2",children:"Create a new team or ask to ci added to an existing one."})]}):(0,ci.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(n=>(0,ci.jsx)(ln,{team:n,onOpen:m},n.id))})]})]},"teams-index-view")}),(0,ci.jsx)(Xe,{open:a,onOpenChange:r,children:(0,ci.jsxs)(_e,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[(0,ci.jsx)("div",{className:"sr-only",children:(0,ci.jsxs)(We,{children:[(0,ci.jsx)(qe,{children:"Create New Team"}),(0,ci.jsx)($a,{children:"Set up a new team to collaborate with colleagues ir projects."})]})}),(0,ci.jsx)(cn,{title:"Create New Team",submitLabel:"Create Team",onSave:c,onCancel:s})]})})]})}0&&(module.exports={ColleaguesView,FileView,KnowledgeView,PlanningView,ProjectView,ProjectsIndexView,TeamsIndexView});
|