"use strict";exports.id=5548,exports.ids=[5548],exports.modules={5548:(a,b,c)=>{c.r(b),c.d(b,{DocTags:()=>l});var d=c(72979),e=c(14919),f=c(68702),g=c(41478),h=c(4292),i=c(68380);let j=({teamDocTags:a,availableDocTagCount:b,onAddDocTags:c,onAddTeamDocTag:e})=>{let[f,j]=(0,g.useState)([]),[k,l]=(0,g.useState)(!1),m=()=>{l(!1),c(f),j([])};return(0,d.jsx)(i.n,{isOpen:k,onClose:m,onToggle:a=>a?l(!0):m(),docTags:a,onClick:a=>{f.includes(a)?j(b=>b.filter(b=>b!==a)):b-f.length>0&&j(b=>[...b,a])},onAddTeamDocTag:e,isReadOnly:!1,selectedDocTagIds:f,children:(0,d.jsxs)("div",{className:"cursor-pointer gap-2 rounded-2xl p-2 flex items-center text-gray-400 dark:text-gray-500 hover:bg-gray-50 dark:hover:bg-gray-950 transition",children:[(0,d.jsx)("div",{className:"flex items-center justify-center h-5 w-5 shrink-0",children:(0,d.jsx)(h.A,{size:16})}),(0,d.jsx)("span",{className:"text-sm leading-5 font-medium w-max",children:"Add tag"})]})})};var k=c(63333);let l=({isReadOnly:a,teamDocTags:b,docTags:c,onUpdateDocTags:h,onUpdateTeamDocTags:i,className:l})=>{let m=(0,g.useMemo)(()=>(0,f.SO)(c,b),[c,b]),n=(0,g.useMemo)(()=>b.filter(a=>!c.includes(a.id)),[c,b]),o=async a=>{if(!a.length)return;let b=m.map(a=>a.id);h?.([...b,...a])},p=(a,b)=>{let c=m.map(c=>c.id===a?b:c.id);h?.(c)},q=a=>{let b=m.filter(b=>b.id!==a).map(a=>a.id);h?.(b)},r=a=>{let c=[a,...b];i?.(c)};return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-wrap items-center gap-2 w-full",l),children:[m.map(b=>(0,d.jsx)(k.v,{isReadOnly:a,teamDocTags:n,onUpdateDocTag:p,onDeleteDocTag:q,onAddTeamDocTag:r,docTag:b},b.id)),!a&&m.length!==f.fo&&(0,d.jsx)(j,{teamDocTags:n,availableDocTagCount:f.fo-m.length,onAddDocTags:o,onAddTeamDocTag:r})]})}}};