1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3444],{21764:(e,t,a)=>{a.d(t,{A:()=>m,q:()=>u});var l=a(6029),n=a(55729),s=a(82203),i=a.n(s),r=a(81278),o=a(58578),c=a(14187),d=a(35270);let u=[{operator:"url:",labelKey:"url",icon:"bi-link-45deg"},{operator:"tag:",labelKey:"tag",icon:"bi-tag"},{operator:"pinned:true",labelKey:"pinned",icon:"bi-pin-angle"},{operator:"before:",labelKey:"before",icon:"bi-calendar-minus"},{operator:"after:",labelKey:"after",icon:"bi-calendar-plus"}];function m(e){let{placeholder:t,fullWidth:a}=e,s=(0,r.useRouter)(),{t:m}=(0,c.Bd)(),[x,p]=(0,n.useState)(""),[h,f]=(0,n.useState)(!1),g=(0,n.useRef)(null);return(0,n.useEffect)(()=>{s.query.q?p(decodeURIComponent(s.query.q)):p("")},[s.query.q]),(0,l.jsxs)("div",{className:"flex items-center relative group ".concat(a?"w-full":""),children:[(0,l.jsx)("label",{htmlFor:"search-box",className:"inline-flex items-center w-fit absolute left-1 pointer-events-none rounded-md p-1 text-primary",children:(0,l.jsx)("i",{className:"bi-search"})}),(0,l.jsx)("input",{id:"search-box",type:"text",ref:g,placeholder:t||m("search_for_links"),value:x,onFocus:()=>{f(!0)},onBlur:()=>{f(!1)},onChange:e=>{e.target.value.includes("%")&&o.oR.error(m("search_query_invalid_symbol")),p(e.target.value.replace("%","")),f(!1)},onKeyDown:e=>{if("Enter"===e.key)if(!s.pathname.startsWith("/public"))return s.push("/search?q="+encodeURIComponent(x));else return x?s.push("/public/collections/"+s.query.id+"?q="+encodeURIComponent(x||"")):s.push("/public/collections/"+s.query.id)},className:"border border-neutral-content bg-base-100 focus:border-primary py-1 rounded-md pl-9 pr-2 outline-none ".concat(a?"w-full":"w-full max-w-[15rem] md:w-80 md:max-w-full")}),h&&(0,l.jsx)("div",{className:"absolute left-0 top-full mt-2 w-full z-50",children:(0,l.jsxs)("div",{className:"border border-neutral-content bg-base-200 shadow-md rounded-md px-2 py-1 flex flex-col gap-1",onMouseDown:e=>e.preventDefault(),children:[(0,l.jsx)("div",{className:"flex items-center justify-between",children:(0,l.jsx)("p",{className:"text-xs font-bold text-neutral",children:m("suggested_search_operators")})}),(0,l.jsx)("div",{className:"flex flex-col gap-1",children:u.map(e=>(0,l.jsxs)("button",{type:"button",className:"flex items-center gap-2 justify-between rounded-md px-2 py-1 text-left hover:bg-neutral-content duration-100",onClick:()=>{var t;return t=e.operator,void(p(e=>{let a=e.length>0&&!e.endsWith(" ");return"".concat(e).concat(a?" ":"").concat(t)}),f(!1),requestAnimationFrame(()=>{var e;return null==(e=g.current)?void 0:e.focus()}))},children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("i",{className:"".concat(e.icon," text-primary text-sm")}),(0,l.jsx)("span",{className:"text-xs text-neutral",children:m(e.labelKey)})]}),(0,l.jsx)("span",{className:"font-mono text-xs px-1 rounded-md bg-base-100 border border-neutral-content text-base-content",children:e.operator})]},e.operator))}),(0,l.jsx)("div",{className:"flex justify-end",children:(0,l.jsx)(d.$,{asChild:!0,variant:"ghost",size:"sm",className:"text-xs",children:(0,l.jsxs)(i(),{href:"https://docs.linkwarden.app/usage/advanced-search",target:"_blank",className:"flex items-center gap-1",children:[m("learn_more"),(0,l.jsx)("i",{className:"bi-box-arrow-up-right text-xs"})]})})})]})})]})}},25530:(e,t,a)=>{a.d(t,{A:()=>k});var l=a(6029),n=a(55729),s=a(45900),i=a(11912),r=a(83248),o=a(21485),c=a(81278),d=a(32764),u=a(14187),m=a(85492),x=a(58578),p=a(19784),h=a(23319),f=a(14759),g=a(29143);f.Ikc({email:f.YjP().email()}),f.Ikc({token:f.YjP(),password:f.YjP().min(8)}),f.Ikc({token:f.YjP()}),f.Ikc({name:f.YjP().max(50),expires:f.k5n(p.P3)}),f.Ikc({theme:f.k5n(h.Theme).optional(),readableFontFamily:f.YjP().trim().max(100).optional(),readableFontSize:f.YjP().trim().max(100).optional(),readableLineHeight:f.YjP().trim().max(100).optional(),readableLineWidth:f.YjP().trim().max(100).optional(),dismissedAnnouncementId:f.YjP().trim().max(100).optional()}),f.Ikc({username:f.YjP().min(3).max(50),password:f.YjP().min(8),sessionName:f.YjP().trim().max(50).optional()});let j=f.Ikc({type:f.k5n(["url","pdf","image"]).nullish(),url:f.YjP().trim().max(2048).url().optional(),name:f.YjP().trim().max(2048).optional(),description:f.YjP().trim().max(2048).optional(),image:f.k5n(["jpeg","png"]).optional(),collection:f.Ikc({id:f.aig().optional(),name:f.YjP().trim().max(2048).optional()}).optional(),tags:f.YOg(f.Ikc({id:f.aig().optional(),name:f.YjP().trim().max(50)})).optional()||[]});f.Ikc({id:f.aig(),name:f.YjP().trim().max(2048).nullish(),url:f.YjP().trim().max(2048).nullish(),description:f.YjP().trim().max(2048).nullish(),icon:f.YjP().trim().max(50).nullish(),iconWeight:f.YjP().trim().max(50).nullish(),color:f.YjP().trim().max(50).nullish(),collection:f.Ikc({id:f.aig(),ownerId:f.aig()}),tags:f.YOg(f.Ikc({id:f.aig().optional(),name:f.YjP().trim().max(50)})),pinnedBy:f.YOg(f.Ikc({id:f.aig().optional()}).optional()).optional()});let v=["image/jpeg","image/jpg","image/png","application/pdf","text/plain","text/html"],b=1024*Number(g.env.NEXT_PUBLIC_MAX_FILE_BUFFER||10)*1024;
1f.Ikc({file:f.bzn().refine(e=>(null==e?void 0:e.length)==1,"File is required.").refine(e=>{var t;return(null==e||null==(t=e[0])?void 0:t.size)<=b},"Max file size is ".concat(b,"MB.")).refine(e=>{var t;return v.includes(null==e||null==(t=e[0])?void 0:t.mimetype)},"Only ".concat(v.join(", ")," files are accepted.")),id:f.aig().optional(),url:f.YjP().trim().max(2048).url().optional(),format:f.k5n(p.Q3)}),f.Ikc({name:f.YjP().trim().max(2048),description:f.YjP().trim().max(2048).optional(),color:f.YjP().trim().max(50).optional(),icon:f.YjP().trim().max(50).optional(),iconWeight:f.YjP().trim().max(50).optional(),parentId:f.aig().optional()}),f.Ikc({id:f.aig(),name:f.YjP().trim().max(2048),description:f.YjP().trim().max(2048).optional(),color:f.YjP().trim().max(50).optional(),isPublic:f.zMY().optional(),icon:f.YjP().trim().max(50).nullish(),iconWeight:f.YjP().trim().max(50).nullish(),parentId:f.KCZ([f.aig(),f.euz("root")]).nullish(),members:f.YOg(f.Ikc({userId:f.aig(),canCreate:f.zMY(),canUpdate:f.zMY(),canDelete:f.zMY()})),propagateToSubcollections:f.zMY().optional()}),f.Ikc({name:f.YjP().trim().max(50)}),f.Ikc({name:f.YjP().max(50),url:f.YjP().url().max(2048),collectionId:f.aig().optional(),collectionName:f.YjP().max(50).optional()}),f.Ikc({tags:f.YOg(f.Ikc({label:f.YjP().trim().max(50),archiveAsScreenshot:f.zMY().nullish(),archiveAsMonolith:f.zMY().nullish(),archiveAsPDF:f.zMY().nullish(),archiveAsReadable:f.zMY().nullish(),archiveAsWaybackMachine:f.zMY().nullish(),aiTag:f.zMY().nullish()}))}),f.Ikc({tagIds:f.YOg(f.aig()).min(1)}),f.Ikc({newTagName:f.YjP().trim().max(50),tagIds:f.YOg(f.aig()).min(1)}),f.Ikc({color:f.YjP().trim().max(50),comment:f.YjP().trim().max(2048).nullish(),startOffset:f.aig(),endOffset:f.aig(),text:f.YjP().trim().max(2048),linkId:f.aig()}),f.Ikc({linkIds:f.YOg(f.aig()).optional()}),f.Ikc({action:f.k5n(["allAndRePreserve","allBroken"])}),f.YOg(f.Ikc({type:f.k5n(h.DashboardSectionType),collectionId:f.aig().optional(),enabled:f.zMY(),order:f.aig().optional()}));var y=a(35270),N=a(36919),w=a(34169);function k(e){var t,a,p,h;let{onClose:f}=e,{t:g}=(0,u.Bd)(),v={name:"",url:"",description:"",type:"url",tags:[],collection:{id:void 0,name:""}},b=(0,w.RT)({toast:x.Ay,t:g}),k=(0,n.useRef)(null),[_,I]=(0,n.useState)(v),[A,C]=(0,n.useState)(!1),P=(0,c.useRouter)(),{data:Y=[]}=(0,m.Xd)();(0,n.useEffect)(()=>{if(P.pathname.startsWith("/collections/")&&P.query.id){let e=Y.find(e=>e.id==Number(P.query.id));e&&e.ownerId&&I({...v,collection:{id:e.id,name:e.name}})}else I({...v,collection:{name:"Unorganized"}})},[]),(0,n.useLayoutEffect)(()=>{var e;null==(e=k.current)||e.focus()},[]);let S=async()=>{let e=j.safeParse(_);if(!e.success)return x.Ay.error("Error: ".concat(e.error.issues[0].message," [").concat(e.error.issues[0].path.join(", "),"]"));b.mutateAsync(_),f()};return(0,l.jsxs)(d.A,{toggleModal:f,children:[(0,l.jsx)("p",{className:"text-xl font-thin",children:g("create_new_link")}),(0,l.jsx)(N.w,{className:"my-3"}),(0,l.jsxs)("div",{className:"grid grid-flow-row-dense sm:grid-cols-5 gap-3",children:[(0,l.jsxs)("div",{className:"sm:col-span-3 col-span-5",children:[(0,l.jsx)("p",{className:"mb-2",children:g("link")}),(0,l.jsx)(r.A,{ref:k,value:_.url||"",onChange:e=>I({..._,url:e.target.value}),placeholder:g("link_url_placeholder"),className:"bg-base-200"})]}),(0,l.jsxs)("div",{className:"sm:col-span-2 col-span-5",children:[(0,l.jsx)("p",{className:"mb-2",children:g("collection")}),(null==(t=_.collection)?void 0:t.name)&&(0,l.jsx)(s.A,{onChange:e=>{(null==e?void 0:e.__isNew__)&&(e.value=void 0),I({..._,collection:{id:null==e?void 0:e.value,name:null==e?void 0:e.label}})},defaultValue:{value:null==(a=_.collection)?void 0:a.id,label:(null==(p=_.collection)?void 0:p.name)||"Unorganized"}})]})]}),A&&(0,l.jsxs)("div",{className:"mt-5 grid sm:grid-cols-2 gap-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"mb-2",children:g("name")}),(0,l.jsx)(r.A,{value:_.name,onChange:e=>I({..._,name:e.target.value}),placeholder:g("link_name_placeholder"),className:"bg-base-200"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"mb-2",children:g("tags")}
1),(0,l.jsx)(i.A,{onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(e=>({name:e.label}));I({..._,tags:t})},defaultValue:(null==(h=_.tags)?void 0:h.map(e=>({label:e.name,value:e.id})))||[]})]}),(0,l.jsxs)("div",{className:"sm:col-span-2",children:[(0,l.jsx)("p",{className:"mb-2",children:g("description")}),(0,l.jsx)("textarea",{value:(0,o.A)(_.description||"")||"",onChange:e=>I({..._,description:e.target.value}),placeholder:g("link_description_placeholder"),className:"resize-none w-full h-32 rounded-md p-2 border-neutral-content bg-base-200 focus:border-primary border-solid border outline-none duration-100"})]})]}),(0,l.jsxs)("div",{className:"flex justify-between items-center mt-5",children:[(0,l.jsxs)(y.$,{variant:"ghost",size:"sm",className:"flex items-center px-2 w-fit text-sm",onClick:()=>C(!A),children:[(0,l.jsx)("p",{children:g(A?"hide_options":"more_options")}),(0,l.jsx)("i",{className:"bi-chevron-".concat(A?"up":"down")})]}),(0,l.jsx)(y.$,{variant:"primary",onClick:S,children:g("create_link")})]})]})}},38970:(e,t,a)=>{a.d(t,{A:()=>i});var l=a(6029),n=a(45933),s=a(70047);let i=e=>{let{children:t,id:a,data:i,className:r}=e,{setNodeRef:o,isOver:c}=(0,s.zM)({id:a,data:i});return(0,l.jsx)("div",{ref:o,className:(0,n.cn)(c&&"bg-primary/10 outline-2 outline-dashed outline-primary rounded-lg",r),"data-over":c?"true":void 0,style:{position:"relative",zIndex:c?1:"auto"},children:t})}},43444:(e,t,a)=>{a.d(t,{A:()=>ed});var l=a(6029),n=a(82203),s=a.n(n),i=a(55729),r=a(14187),o=a(35270);function c(e){let{announcement:t,dismissAnnouncement:a}=e,{id:n,message:i}=t;return(0,l.jsx)("div",{className:"fixed mx-auto bottom-20 sm:bottom-10 w-full pointer-events-none p-5 z-30",children:(0,l.jsxs)("div",{className:"mx-auto pointer-events-auto p-2 flex justify-between gap-2 items-center border border-primary shadow-xl rounded-xl bg-base-300 backdrop-blur-sm bg-opacity-80 max-w-md",children:[(0,l.jsx)("i",{className:"bi-stars text-xl text-yellow-600 dark:text-yellow-500"}),(0,l.jsx)("p",{className:"w-4/5 text-center text-sm sm:text-base",children:i?(0,l.jsx)(r.x6,{i18nKey:i,components:[(0,l.jsx)(s(),{href:"https://linkwarden.app/blog",target:"_blank",className:"underline decoration-dotted underline-offset-4 hover:text-primary duration-100"},0)]}):(0,l.jsx)(r.x6,{i18nKey:"new_version_announcement",values:{version:n},components:[(0,l.jsx)(s(),{href:"https://linkwarden.app/blog/releases/".concat(n),target:"_blank",className:"underline decoration-dotted underline-offset-4 hover:text-primary duration-100"},0)]})}),(0,l.jsx)(o.$,{variant:"ghost",size:"icon",onClick:a,children:(0,l.jsx)("i",{className:"bi-x text-xl"})})]})})}var d=a(81278),u=a(38632),m=a(1525),x=a(41107),p=a(70814),h=a(32917),f=a(58578),g=a(85492),j=a(38544),v=a(69566),b=a(38970),y=a(23994),N=a(70047);let w=()=>{let{active:e}=(0,N.fF)(),{t}=(0,r.Bd)(),a=(0,g.rR)(),{data:n=[],isLoading:s}=(0,g.Xd)(),{data:o}=(0,j.Jd)(),c=(0,j.Qc)(),u=(0,d.useRouter)(),[m,v]=(0,i.useState)(),b=(0,i.useMemo)(()=>n.length>0?I(n,u,m,null==o?void 0:o.collectionOrder):void 0,[n,o]);(0,i.useEffect)(()=>{v(b)},[b]),(0,i.useEffect)(()=>{if(null==o?void 0:o.username)if((!o.collectionOrder||0===o.collectionOrder.length)&&n.length>0)c.mutate({...o,collectionOrder:n.filter(e=>null===e.parentId).map(e=>e.id)});else{let e=[...o.collectionOrder||[]],t=n.map(e=>e.id),a=o.collectionOrder.filter(e=>t.includes(e));n.forEach(e=>{a.includes(e.id)||e.parentId&&e.ownerId!==o.id||a.push(e.id)}),JSON.stringify(e)!==JSON.stringify(o.collectionOrder)&&c.mutateAsync({...o,collectionOrder:e})}},[o,n]);let y=async(e,l)=>{if(!l||!m||e.index===l.index&&e.parentId===l.parentId)return;let s=Number(m.items[e.parentId].children[e.index]),i=n.find(e=>e.id===s),r=n.find(e=>e.id===Number(l.parentId));if((null==i?void 0:i.ownerId)!==(null==o?void 0:o.id)&&l.parentId!==e.parentId||(null==r?void 0:r.ownerId)!==(null==o?void 0:o.id)&&"root"!==l.parentId)return f.Ay.error(t("cant_change_collection_you_dont_own"));v(t=>(0,p.o)(t,e,l));let d=function(e,t,a,l){if(a.parentId===l.parentId){let n=e.items[a.parentId],s=[...n.children];return s.splice(a.index,1),void 0!==l.index&&s.splice(l.index,0,t),n.children=s,e}let n=e.items[a.parentId],s=e.items[l.parentId];n.children=n.children.filter(e=>e!==t),s.children||(s.children=[]);let i=void 0!==l.index?l.index:s.children.length;return s.children.splice(i,0,t),s.hasChildren=!0,s.isExpanded=!0,e.items[t].data.parentId=l.parentId,e}(m,s,e,l);e.parentId!==l.parentId&&await a.mutateAsync({...i,parentId:l.parentId&&"root"!==l.parentId?Number(l.parentId):"root"===l.parentId?"root":null},{onError:e=>{f.Ay.error(e.message)}}),await c.mutateAsync({...o,collectionOrder:function e(t){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"root",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=t.items[a];return"root"!==a&&l.push(n.id),n.children&&n.children.length>
10&&n.children.forEach(a=>{e(t,a,l)}),l}(d)})};return s?(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)("div",{className:"skeleton h-4 w-full"}),(0,l.jsx)("div",{className:"skeleton h-4 w-full"}),(0,l.jsx)("div",{className:"skeleton h-4 w-full"})]}):m?(0,l.jsx)(h.A,{tree:m,renderItem:t=>k({...t},u.asPath,e),onExpand:e=>{v(t=>(0,x.r)(t,e,{isExpanded:!0}))},onCollapse:e=>{v(t=>(0,x.r)(t,e,{isExpanded:!1}))},onDragEnd:y,isDragEnabled:!0,isNestingEnabled:!0}):(0,l.jsx)("p",{className:"text-neutral text-xs font-semibold truncate w-full px-2",children:t("you_have_no_collections")})},k=(e,t,a)=>{var n;let{item:i,onExpand:r,onCollapse:o,provided:c}=e,d=i.data;return(0,l.jsx)(b.A,{id:"side-bar-collection-".concat(d.id),data:{name:d.name,id:d.id,ownerId:d.ownerId},className:"group",children:(0,l.jsx)("div",{ref:c.innerRef,...c.draggableProps,className:"mb-1",children:(0,l.jsxs)("div",{className:(0,y.cn)(t==="/collections/".concat(d.id)?"bg-primary/20 is-active":a?"select-none":"hover:bg-neutral/20","relative duration-100 flex items-center pr-2 rounded-md"),children:[_(i,r,o),(0,l.jsx)(s(),{href:"/collections/".concat(d.id),className:"w-full",...c.dragHandleProps,children:(0,l.jsxs)("div",{className:"cursor-pointer flex items-center gap-2 w-full pl-5 rounded-md",children:[d.icon?(0,l.jsx)(v.A,{icon:d.icon,size:28,weight:d.iconWeight||"regular",color:d.color,className:"-mr-[0.15rem]"}):(0,l.jsx)("i",{className:"bi-folder-fill text-lg",style:{color:d.color}}),(0,l.jsx)("p",{className:"truncate w-full text-xs",children:d.name}),d.isPublic&&(0,l.jsx)("i",{className:"bi-globe2 text-sm text-black/50 dark:text-white/50 drop-shadow",title:"This collection is being shared publicly."}),(0,l.jsx)("div",{className:"drop-shadow text-neutral text-xs",children:null==(n=d._count)?void 0:n.links})]})})]})})})},_=(e,t,a)=>e.children&&0!==e.children.length?e.isExpanded?(0,l.jsx)("button",{onClick:()=>a(e.id),className:"absolute left-0.5 top-1/2 -translate-y-1/2 flex items-center justify-center",children:(0,l.jsx)("div",{className:"bi-caret-down-fill opacity-50 hover:opacity-100 duration-200"})}):(0,l.jsx)("button",{onClick:()=>t(e.id),className:"absolute left-0.5 top-1/2 -translate-y-1/2 flex items-center justify-center",children:(0,l.jsx)("div",{className:"bi-caret-right-fill opacity-40 hover:opacity-100 duration-200"})}):null,I=(e,t,a,l)=>{l&&e.sort((e,t)=>l.indexOf(e.id)-l.indexOf(t.id));let n=e.reduce((e,t)=>{var l,n;return e[t.id]={id:t.id,children:[],hasChildren:!1,isExpanded:(null==a||null==(l=a.items[t.id])?void 0:l.isExpanded)||!1,data:{id:t.id,parentId:t.parentId,name:t.name,description:t.description,color:t.color,icon:t.icon,iconWeight:t.iconWeight,isPublic:t.isPublic,ownerId:t.ownerId,createdAt:t.createdAt,updatedAt:t.updatedAt,_count:{links:null==(n=t._count)?void 0:n.links}}},e},{}),s=Number(t.asPath.split("/collections/")[1]);if(s)for(let e in n){let t=n[e];if(Number(e)===s&&t.data.parentId){let e=t.data.parentId||null;for(;e&&n[e];)n[e].isExpanded=!0,e=n[e].data.parentId}}e.forEach(e=>{let t=e.parentId;t&&n[t]&&e.id&&(n[t].children.push(e.id),n[t].hasChildren=!0)}),e.forEach(e=>{let t=e.id;if(n[t]&&e.id){let e=function e(t){var a;let l=n[t];if(!l)return 0;let s=(null==(a=l.data._count)?void 0:a.links)||0;return l.hasChildren&&l.children.forEach(t=>{s+=e(t)}),s}(t);n[t].data._count.links=e}});let i="root";return n[i]={id:i,children:e.filter(t=>null===t.parentId||!e.find(e=>e.id===t.parentId)).map(e=>e.id)||"",hasChildren:!0,isExpanded:!0,data:{name:"Root"}},{rootId:i,items:n}};var A=a(45694),C=a(29733);function P(e){let{tags:t,active:a}=e,{active:n}=(0,N.fF)(),{t:i}=(0,C.Bd)();return t[0]?(0,l.jsx)(l.Fragment,{children:t.sort((e,t)=>e.name.localeCompare(t.name)).map((e,t)=>{var i;return(0,l.jsx)(b.A,{id:"tag-".concat(e.id),className:"group",data:{type:"tag",id:e.id,name:e.name},children:(0,l.jsx)(s(),{href:"/tags/".concat(e.id),children:(0,l.jsxs)("div",{className:(0,y.cn)(a==="/tags/".concat(e.id)?"bg-primary/20":n?"select-none":"hover:bg-neutral/20","duration-100 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md"),children:[(0,l.jsx)("i",{className:"bi-hash text-lg text-primary drop-shadow"}),(0,l.jsx)("p",{className:"truncate w-full pr-7 text-sm",children:e.name}),(0,l.jsx)("div",{className:"drop-shadow text-neutral text-xs",children:null==(i=e._count)?void 0:i.links})]})},t)},t)})}):(0,l.jsx)("p",{className:"text-neutral text-xs font-semibold truncate w-full px-2",children:i("you_have_no_tags")})}var Y=a(29035),S=a(73639),E=a(45933),z=a(19784),M=a(43072),O=a(2871);function R(e){let{children:t}=e,a=(0,i.useRef)(null),n=(0,i.useRef)(null),s=(0,i.useRef)(void 0),r=(0,i.useRef)(null),[o,c]=(0,i.useState)(!1),[d,u]=(0,i.useState)(!1),[m,x]=(0,i.useState)({top:0,height:0}),[p,h]=(0,i.useState)(!1),[f,g]=(0,i.useState)(!1),[j,v]=(0,i.useState)(!1),b=()=>{let e=a.current;if(!e)return;if(c(e.scrollTop>0),u(e.scrollHeight-e.clientHeight-e.scrollTop>1),e.scrollHeight<=e.clientHeight)return void x({top:0,height:0});let t=Math.max(e.clientHeight/e.scrollHeight*e.clientHeight,24),l=e.scrollHeight-e.clientHeight;x({top:Math.min(Math.max(e.scrollTop,0),l)/l*(e.clientHeight-t),height:t})},y=()=>{h(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>h(!1),1e3)};(0,i.useEffect)(()=>{b();let e=new ResizeObserver(b);return a.current&&e.observe(a.current),n.current&&e.observe(n.current),()=>{e.disconnect(),s.current&&clearTimeout(s.current)}},[]);let N=m.height>0&&(p||f||j);return(0,l.jsxs)("div",{className:"flex-1 min-h-0 relative mt-1",children:[(0,l.jsx)("div",{ref:a,onScroll:()=>{b(),y()},className:"h-full overflow-y-auto p-1 hide-scrollbar",children:(0,l.jsx)("div",{ref:n,children:t})}),(0,l.jsx)("div",{className:(0,E.cn)("absolute top-0 inset-x-0 h-6 bg-gradient-to-b from-base-200 to-transparent pointer-events-none transition-opacity duration-200",o?"opacity-100":"opacity-0")}),(0,l.jsx)("div",{className:(0,E.cn)("absolute bottom-0 inset-x-0 h-6 bg-gradient-to-t from-base-200 to-transparent pointer-events-none transition-opacity duration-200",d?"opacity-100":"opacity-0")}),m.height>0&&(0,l.jsx)("div",{onPointerDown:e=>{let t=a.current;t&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),r.current={startY:e.clientY,startScrollTop:t.scrollTop},v(!0))},onPointerMove:e=>{let t=a.current;if(!t||!r.current)return;let l=t.clientHeight-m.height;if(l<=0)return;let n=t.scrollHeight-t.clientHeight;t.scrollTop=r.current.startScrollTop+(e.clientY-r.current.startY)*n/l},onPointerUp:()=>{r.current=null,v(!1),y()},onPointerEnter:()=>g(!0),onPointerLeave:()=>g(!1),className:(0,E.cn)("absolute right-0.5 w-1.5 rounded-full bg-base-content/30 hover:bg-base-content/50 touch-none transition-opacity duration-300",N?"opacity-100":"opacity-0 pointer-events-none"),style:{to
1p:m.top,height:m.height}})]})}var D=a(25530),q=a(57179),F=a(81955),T=a(45900),B=a(11912),L=a(83248),W=a(21485),K=a(32764),$=a(34169),H=a(43003),U=a(36919);function J(e){var t,a,n,s;let{onClose:c}=e,{t:u}=(0,r.Bd)(),{data:m}=(0,H.UK)(),x={name:"",description:"",type:"url",tags:[],collection:{id:void 0,name:""}},[p,h]=(0,i.useState)(x),[j,v]=(0,i.useState)(),b=(0,$.fU)(),[y,N]=(0,i.useState)(!1),[w,k]=(0,i.useState)(!1),_=(0,d.useRouter)(),{data:I=[]}=(0,g.Xd)();(0,i.useEffect)(()=>{if(k(!1),_.pathname.startsWith("/collections/")&&_.query.id){let e=I.find(e=>e.id==Number(_.query.id));e&&e.ownerId&&_.asPath.startsWith("/collections/")&&h({...x,collection:{id:e.id,name:e.name}})}else h({...x,collection:{name:"Unorganized"}})},[_,I]);let A=async()=>{if(!y&&j){N(!0);let e=f.Ay.loading(u("creating"));await b.mutateAsync({link:p,file:j},{onSettled:(t,a)=>{N(!1),f.Ay.dismiss(e),a?f.Ay.error(a.message):(c(),f.Ay.success(u("created_success")))}})}};return(0,l.jsxs)(K.A,{toggleModal:c,children:[(0,l.jsx)("div",{className:"flex gap-2 items-start",children:(0,l.jsx)("p",{className:"text-xl font-thin",children:u("upload_file")})}),(0,l.jsx)(U.w,{className:"my-3"}),(0,l.jsxs)("div",{className:"grid grid-flow-row-dense sm:grid-cols-5 gap-3",children:[(0,l.jsxs)("div",{className:"sm:col-span-3 col-span-5",children:[(0,l.jsx)("p",{className:"mb-2",children:u("file")}),(0,l.jsx)("label",{className:"h-10 cursor-pointer w-full border border-neutral-content bg-base-200 hover:bg-base-300 duration-150 rounded-md px-2 flex justify-between items-center",children:(0,l.jsx)("input",{type:"file",accept:".pdf,.png,.jpg,.jpeg",className:"cursor-pointer custom-file-input w-full",onChange:e=>e.target.files&&v(e.target.files[0])})}),(0,l.jsx)("p",{className:"text-xs font-semibold mt-2",children:u("file_types",{size:(null==m?void 0:m.MAX_FILE_BUFFER)||10})})]}),(0,l.jsxs)("div",{className:"sm:col-span-2 col-span-5",children:[(0,l.jsx)("p",{className:"mb-2",children:u("collection")}),(null==(t=p.collection)?void 0:t.name)&&(0,l.jsx)(T.A,{onChange:e=>{(null==e?void 0:e.__isNew__)&&(e.value=void 0),h({...p,collection:{id:null==e?void 0:e.value,name:null==e?void 0:e.label}})},defaultValue:{value:null==(a=p.collection)?void 0:a.id,label:(null==(n=p.collection)?void 0:n.name)||"Unorganized"}})]})]}),w&&(0,l.jsx)("div",{className:"mt-5",children:(0,l.jsxs)("div",{className:"grid sm:grid-cols-2 gap-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"mb-2",children:u("name")}),(0,l.jsx)(L.A,{value:p.name,onChange:e=>h({...p,name:e.target.value}),placeholder:u("example_link"),className:"bg-base-200"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"mb-2",children:u("tags")}),(0,l.jsx)(B.A,{onChange:e=>{let t=e.map(e=>({name:e.label}));h({...p,tags:t})},defaultValue:null==(s=p.tags)?void 0:s.map(e=>({value:e.id,label:e.name}))})]}),(0,l.jsxs)("div",{className:"sm:col-span-2",children:[(0,l.jsx)("p",{className:"mb-2",children:u("description")}),(0,l.jsx)("textarea",{value:(0,W.A)(p.description||"")||"",onChange:e=>h({...p,description:e.target.value}),placeholder:u("description_placeholder"),className:"resize-none w-full h-32 rounded-md p-2 border-neutral-content bg-base-200 focus:border-primary border outline-none duration-100"})]})]})}),(0,l.jsxs)("div",{className:"flex justify-between items-center mt-5",children:[(0,l.jsxs)(o.$,{variant:"ghost",size:"sm",className:"flex items-center px-2 w-fit text-sm",onClick:()=>k(!w),children:[(0,l.jsx)("p",{children:w?u("hide_options"):u("more_options")}),(0,l.jsx)("i",{className:"bi-chevron-".concat(w?"up":"down")})]}),(0,l.jsx)(o.$,{variant:"primary",onClick:A,children:u("upload_file")})]})]})}let Q=i.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,l.jsx)("kbd",{ref:t,className:(0,E.cn)("font-mono text-xs px-1.5 py-0.5 rounded-md bg-base-200 border border-neutral-content text-neutral",a),...n})});Q.displayName="Kbd";var X=a(21764);let V="undefined"!=typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform),Z="recentSearches",G=()=>{try{let e=JSON.parse(localStorage.getItem(Z)||"[]");if(!Array.isArray(e))return[];return e.filter(e=>"string"==typeof(null==e?void 0:e.query))}catch(e){return[]}},ee=e=>{localStorage.setItem(Z,JSON.stringify(e))};function et(e){let{onClose:t}=e,{t:a}=(0,r.Bd)(),n=(0,d.useRouter)(),c=(0,i.useRef)(null),[u,m]=(0,i.useState)(""),[x,p]=(0,i.useState)(G);(0,i.useEffect)(()=>{let e=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t]);let h=e=>{let a=e.trim();a&&(ee([{query:a,searchedAt:new Date().toISOString()},...x.filter(e=>e.query!==a)].slice(0,5)),n.push("/search?q="+encodeURIComponent(a)),t())};return(0,l.jsxs)(K.A,{toggleModal:t,hideCloseButton:!0,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("i",{className:"bi-search text-neutral text-lg leading-none"}),(0,l.jsx)("input",{type:"text",ref:c,autoFocus:!0,placeholder:a("search_for_links"),value:u,onChange:e=>{e.target.value.includes("%")&&f.oR.error(a("search_query_invalid_symbol")),m(e.target.value.replace("%",""))},onKeyDown:e=>"Enter"===e.key&&h(u),className:"w-full bg-transparent outline-none text-lg"}),(0,l.jsxs)("div",{className:"hidden sm:flex items-center gap-1 shrink-0",children:[(0,l.jsx)(Q,{children:V?"â":"Ctrl"}),(0,l.jsx)(Q,{children:"K"})]})]}),(0,l.jsx)("div",{className:"border-t border-neutral-content -mx-4 sm:-mx-5 mt-4"}),(0,l.jsxs)("div",{className:"sm:max-h-80 sm:overflow-y-auto -mx-4 sm:-mx-5 -mb-4 sm:-mb-5",children:[x.length>0&&(0,l.jsxs)("div",{className:"px-4 sm:px-5",children:[(0,l.jsx)("p",{className:"text-xs font-bold text-neutral mt-4",children:a("recent")}
1),(0,l.jsx)("div",{className:"flex flex-col gap-1 mt-2",children:x.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-3 rounded-md px-2 py-1.5 cursor-pointer hover:bg-base-200 duration-100",onClick:()=>h(e.query),children:[(0,l.jsx)("i",{className:"bi-clock-history text-neutral"}),(0,l.jsx)("span",{className:"flex-1 truncate text-sm",children:e.query}),(0,l.jsx)(o.$,{variant:"ghost",size:"icon",className:"h-6 w-6","aria-label":a("delete"),onClick:t=>{t.stopPropagation();var a=e.query;let l=x.filter(e=>e.query!==a);ee(l),p(l)},children:(0,l.jsx)("i",{className:"bi-x text-lg text-neutral"})})]},e.query))}),(0,l.jsx)("div",{className:"border-t border-neutral-content -mx-4 sm:-mx-5 mt-4"})]}),(0,l.jsxs)("div",{className:"px-4 sm:px-5 pb-4 sm:pb-5",children:[(0,l.jsx)("p",{className:"text-xs font-bold text-neutral mt-4",children:a("suggested_search_operators")}),(0,l.jsx)("div",{className:"flex flex-col gap-1 mt-2",children:X.q.map(e=>(0,l.jsxs)("button",{type:"button",className:"flex items-center gap-2 justify-between rounded-md px-2 py-1.5 text-left hover:bg-base-200 duration-100",onClick:()=>{var t,a;return t=e.operator,void(m(e=>{let a=e.length>0&&!e.endsWith(" ");return"".concat(e).concat(a?" ":"").concat(t)}),null==(a=c.current)||a.focus())},children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("i",{className:"".concat(e.icon," text-primary")}),(0,l.jsx)("span",{className:"text-sm",children:a(e.labelKey)})]}),(0,l.jsx)("span",{className:"font-mono text-xs px-1.5 py-0.5 rounded-md bg-base-200 border border-neutral-content text-base-content",children:e.operator})]},e.operator))}),(0,l.jsx)("div",{className:"flex justify-end mt-2",children:(0,l.jsx)(o.$,{asChild:!0,variant:"ghost",size:"sm",className:"text-xs",children:(0,l.jsxs)(s(),{href:"https://docs.linkwarden.app/usage/advanced-search",target:"_blank",className:"flex items-center gap-1",children:[a("learn_more"),(0,l.jsx)("i",{className:"bi-box-arrow-up-right text-xs"})]})})})]})]})]})}function ea(e){let{className:t,toggleSidebar:a,sidebarIsCollapsed:n}=e,{t:s}=(0,r.Bd)(),{ref:c,inView:x}=(0,M.Wx)(),[p,h]=(0,i.useState)(()=>{let e=localStorage.getItem("tagDisclosure");return!e||"true"===e}),[f,j]=(0,i.useState)(()=>{let e=localStorage.getItem("collectionDisclosure");return!e||"true"===e}),[v,b]=(0,i.useState)(!1),[y,N]=(0,i.useState)(!1),[k,_]=(0,i.useState)(!1),[I,C]=(0,i.useState)(!1),[T,B]=(0,i.useState)(!1),{data:L}=(0,g.Xd)(),{data:W=[],isLoading:K,hasNextPage:$,isFetchingNextPage:H,fetchNextPage:U}=(0,A.PL)(void 0,{sort:z.vc.NameAZ}),[Q,X]=(0,i.useState)(""),Z=(0,d.useRouter)();return(0,i.useEffect)(()=>{localStorage.setItem("tagDisclosure",p?"true":"false")},[p]),(0,i.useEffect)(()=>{localStorage.setItem("collectionDisclosure",f?"true":"false")},[f]),(0,i.useEffect)(()=>{X(Z.asPath)},[Z,L]),(0,i.useEffect)(()=>{let e=e=>{"k"===e.key.toLowerCase()&&(V?e.metaKey:e.ctrlKey)&&(e.preventDefault(),b(e=>!e))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]),(0,i.useEffect)(()=>{x&&$&&(H||U())},[x,$,H,U]),(0,l.jsx)(O.A,{className:t,toggleSidebar:a,sidebarIsCollapsed:n,children:e=>{let{collapsed:t,toggle:a,closeMobileSidebar:n}=e,i=e=>{e(!0),n()},r=(0,l.jsxs)("div",{className:(0,E.cn)("flex flex-col gap-2",t&&"gap-3"),children:[(0,l.jsx)(m.A,{title:s("dashboard"),href:"/dashboard",icon:"bi-house",active:"/dashboard"===Q,sidebarIsCollapsed:t}),(0,l.jsx)(m.A,{title:s("links"),href:"/links",icon:"bi-link-45deg",active:"/links"===Q,sidebarIsCollapsed:t}),(0,l.jsx)(m.A,{title:s("pinned"),href:"/links/pinned",icon:"bi-pin-angle",active:"/links/pinned"===Q,sidebarIsCollapsed:t}),(0,l.jsx)(m.A,{title:s("collections"),href:"/collections",icon:"bi-folder",active:"/collections"===Q,sidebarIsCollapsed:t,expanded:f,onToggleExpand:t?void 0:()=>j(!f)}),!t&&(0,l.jsx)(u.e,{show:f,enter:"transition duration-100 ease-out",enterFrom:"transform opacity-0 -translate-y-3",enterTo:"transform opacity-100 translate-y-0",leave:"transition duration-100 ease-out",leaveFrom:"transform opacity-100 translate-y-0",leaveTo:"transform opacity-0 -translate-y-3",children:(0,l.jsx)("div",{className:"pl-4",children:(0,l.jsx)(w,{})})}),(0,l.jsx)(m.A,{title:s("tags"),href:"/tags",icon:"bi-hash",active:"/tags"===Q,sidebarIsCollapsed:t,expanded:p,onToggleExpand:t?void 0:()=>h(!p)}),!t&&(0,l.jsx)(u.e,{show:p,enter:"transition duration-100 ease-out",enterFrom:"transform opacity-0 -translate-y-3",enterTo:"transform opacity-100 translate-y-0",leave:"transition duration-100 ease-out",leaveFrom:"transform opacity-100 translate-y-0",leaveTo:"transform opacity-0 -translate-y-3",children:(0,l.jsx)("div",{className:"pl-4 flex flex-col gap-1",children:K?(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)("div",{className:"skeleton h-4 w-full"}),(0,l.jsx)("div",{className:"skeleton h-4 w-full"}),(0,l.jsx)("div",{className:"skeleton h-4 w-full"})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(P,{tags:W,active:Q}),$&&(0,l.jsx)("div",{ref:c,className:"h-1 w-full"}),H&&(0,l.jsxs)("div",{className:"flex flex-col gap-4 mt-3",children:[(0,l.jsx)("div",{className:"skeleton h-4 w-full"}),(0,l.jsx)("div",{className:"skeleton h-4 w-full"}),(0,l.jsx)("div",{className:"skeleton h-4 w-full"})]})]})})})]});return(0,l.jsxs)(l.Fragment,{children:[t?(0,l.jsxs)("div",{className:"flex flex-col items-center gap-3 shrink-0",children:[(0,l.jsx)(O.M,{icon:"bi-search",variant:"default",label:s("search_for_links"),tooltipSide:"right",onClick:()=>i(b)}),(0,l.jsxs)(S.rI,{children:[(0,l.jsx)(Y.Bc,{children:(0,l.jsxs)(Y.m_,{children:[(0,l.jsx)(Y.k$,{asChild:!0,children:(0,l.jsx)(S.ty,{asChild:!0,children:(0,l.jsx)(o.$,{variant:"primary",size:"icon",className:"h-9 w-9 shrink-0","aria-label":s("create_new"),children:(0,l.jsx)("i",{className:"bi-plus-lg text-lg leading-none"})})})}),(0,l.jsx)(Y.ZI,{side:"right",children:s("create_new")})]})}),(0,l.jsxs)(S.SQ,{side:"right",align:"start",children:[(0,l.jsxs)(S._2,{onSelect:()=>
1i(N),children:[(0,l.jsx)("i",{className:"bi-link-45deg"}),s("new_link")]}),(0,l.jsxs)(S._2,{onSelect:()=>i(_),children:[(0,l.jsx)("i",{className:"bi-folder-plus"}),s("new_collection")]}),(0,l.jsxs)(S._2,{onSelect:()=>i(C),children:[(0,l.jsx)("i",{className:"bi-tag"}),s("new_tag")]}),(0,l.jsxs)(S._2,{onSelect:()=>i(B),children:[(0,l.jsx)("i",{className:"bi-file-earmark-arrow-up"}),s("upload_file")]})]})]})]}):(0,l.jsxs)("div",{className:"flex flex-col gap-2 shrink-0 pt-1 px-1",children:[(0,l.jsx)(o.$,{size:"sm",variant:"default",className:"justify-between whitespace-nowrap h-8",onClick:()=>i(b),children:(0,l.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,l.jsx)("i",{className:"bi-search leading-none"}),s("search_for_links")]})}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsxs)(o.$,{variant:"primary",className:"flex-1 min-w-0 h-9 justify-center whitespace-nowrap",onClick:()=>i(N),children:[(0,l.jsx)("i",{className:"bi-plus-lg text-lg leading-none"}),s("new_link")]}),(0,l.jsx)(O.M,{icon:"bi-folder-plus",variant:"default",label:s("new_collection"),onClick:()=>i(_)}),(0,l.jsx)(O.M,{icon:"bi-tag",variant:"default",label:s("new_tag"),onClick:()=>i(C)}),(0,l.jsxs)(S.rI,{children:[(0,l.jsx)(Y.Bc,{children:(0,l.jsxs)(Y.m_,{children:[(0,l.jsx)(Y.k$,{asChild:!0,children:(0,l.jsx)(S.ty,{asChild:!0,children:(0,l.jsx)(o.$,{variant:"default",size:"icon",className:"h-9 w-9 shrink-0","aria-label":s("more"),children:(0,l.jsx)("i",{className:"bi-three-dots text-lg leading-none"})})})}),(0,l.jsx)(Y.ZI,{children:s("more")})]})}),(0,l.jsx)(S.SQ,{align:"end",children:(0,l.jsxs)(S._2,{onSelect:()=>i(B),children:[(0,l.jsx)("i",{className:"bi-file-earmark-arrow-up"}),s("upload_file")]})})]})]})]}),t?(0,l.jsx)("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center",children:r}):(0,l.jsx)(R,{children:r}),v&&(0,l.jsx)(et,{onClose:()=>b(!1)}),y&&(0,l.jsx)(D.A,{onClose:()=>N(!1)}),k&&(0,l.jsx)(q.A,{onClose:()=>_(!1)}),I&&(0,l.jsx)(F.A,{onClose:()=>C(!1)}),T&&(0,l.jsx)(J,{onClose:()=>B(!1)})]})}})}async function el(){try{let e=await fetch("https://linkwarden.app/blog/latest-announcement.json");if(!e.ok)return null;let t=await e.json();if(!(null==t?void 0:t.id))return null;return t}catch(e){return null}}var en=a(6472),es=a(16138),ei=a(40311),er=a(93251);function eo(e){let{children:t,activeLink:a,setActiveLink:n,sensors:s,onDragEnd:i}=e,{t:r}=(0,C.Bd)(),o=(0,$.te)({toast:f.Ay,t:r}),c=(0,ei.A)(),{data:d}=(0,j.Jd)(),u=(0,er.jE)(),m=(0,N.MS)(N.cA,{activationConstraint:{distance:10}}),x=(0,N.MS)(N.IG,{activationConstraint:{delay:200,tolerance:5}}),p=(0,N.FR)(m,x),h=async e=>{var t,l,s,m;if(i)return void i(e);let{over:x,active:p}=e;if(n(null),!x||!a)return;let h=x.data.current,g=String(x.id),j=(null==(t=p.data.current)?void 0:t.dashboardType)==="recent",v=async(e,t)=>{o.mutateAsync(e)};if((null==h?void 0:h.type)==="tag"){let e=null==h?void 0:h.name;if(!e)return;if(null==(s=a.tags)?void 0:s.some(t=>t.name===e))return void f.Ay.error(r("tag_already_added"));let t=(null!=(m=a.tags)?m:[]).map(e=>({name:e.name})),l={...a,tags:[...t,{name:e}]};return void await v(l,{invalidateDashboardOnError:void 0!==u})}let b="function"==typeof c&&void 0!==d&&void 0!==(null==d?void 0:d.id);if("pinned-links-section"===g&&b){if(Array.isArray(a.pinnedBy)&&!a.pinnedBy.length){if(void 0!==u){let e={...a,pinnedBy:[d.id]};u.setQueryData(["dashboardData"],t=>(null==t?void 0:t.links)?{...t,links:t.links.map(t=>t.id===e.id?e:t)}:t)}c(a)}return}let y=null==h?void 0:h.id,N=null==h?void 0:h.name,w=null==h?void 0:h.ownerId;if(!y||!N||void 0===w)return;if((null==(l=a.collection)?void 0:l.id)===y){j&&f.Ay.error(r("link_already_in_collection"));return}let k={...a,collection:{id:y,name:N,ownerId:w}};void 0!==u&&(u.setQueryData(["dashboardData"],e=>(null==e?void 0:e.links)?{...e,links:e.links.map(e=>e.id===k.id?k:e)}:e),u.setQueryData(["dashboardData"],e=>{var t;if(!(null==e?void 0:e.collectionLinks))return e;let l=null==(t=a.collection)?void 0:t.id;return l?{...e,collectionLinks:{...e.collectionLinks,[l]:(e.collectionLinks[l]||[]).filter(e=>e.id!==k.id),[y]:[...e.collectionLinks[y]||[],k]}}:e})),await v(k,{invalidateDashboardOnError:void 0!==u})};return(0,l.jsxs)(N.Mp,{onDragStart:e=>{var t,a;n(null!=(a=null==(t=e.active.data.current)?void 0:t.link)?a:null)},onDragEnd:h,onDragCancel:()=>{n(null)},modifiers:[es.jw],sensors:s||p,collisionDetection:E.OB,children:[!!a&&(0,l.jsx)(N.Hd,{dropAnimation:null,style:{zIndex:100,pointerEvents:"none"},children:(0,l.jsx)("div",{className:"w-fit h-fit",children:(0,l.jsx)(en.A,{link:a})})}),t]})}var ec=a(62127);function ed(e){let{children:t}=e,{data:a}=(0,j.Jd)(),n=(0,j.Jz)(),[s,r]=(0,i.useState)(null),{sidebarIsCollapsed:o,toggleSidebar:d}=(0,ec.A)();(0,i.useEffect)(()=>{el().then(r)},[]);let u=!!s&&!!(null==a?void 0:a.id)&&a.dismissedAnnouncementId!==s.id,[m,x]=(0,i.useState)(null);return(0,l.jsx)(eo,{activeLink:m,setActiveLink:x,children:(0,l.jsxs)("div",{className:"flex","data-testid":"dashboard-wrapper",children:[u&&s&&(0,l.jsx)(c,{announcement:s,dismissAnnouncement:()=>{s&&n.mutate({dismissedAnnouncementId:s.id})}}),(0,l.jsx)(ea,{toggleSidebar:d,sidebarIsCollapsed:o}),(0,l.jsx)("div",{className:"".concat(o?"":"lg:w-[calc(100%-288px)]"," w-[c
1alc(100%-56px)] sm:pb-0 pb-20 flex flex-col h-screen overflow-y-auto"),children:t})]})})}},57179:(e,t,a)=>{a.d(t,{A:()=>p});var l=a(6029),n=a(55729),s=a(83248),i=a(32764),r=a(14187),o=a(85492),c=a(58578),d=a(62608),u=a(78541),m=a(35270),x=a(36919);function p(e){let{onClose:t,parent:a}=e,{t:p}=(0,r.Bd)(),h={parentId:null==a?void 0:a.id,name:"",description:"",color:(0,u.A)("--p")},[f,g]=(0,n.useState)(h);(0,n.useEffect)(()=>{g(h)},[a]);let[j,v]=(0,n.useState)(!1),b=(0,o.W_)(),y=async()=>{if(j)return;if(!f)return null;v(!0);let e=c.Ay.loading(p("creating"));await b.mutateAsync(f,{onSettled:(a,l)=>{v(!1),c.Ay.dismiss(e),l?c.Ay.error(l.message):(t(),c.Ay.success(p("created")))}})},N=(0,n.useRef)(null);return(0,n.useLayoutEffect)(()=>{var e;null==(e=N.current)||e.focus()},[]),(0,l.jsxs)(i.A,{toggleModal:t,children:[(null==a?void 0:a.id)?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"text-xl font-thin",children:p("new_sub_collection")}),(0,l.jsx)("p",{className:"text-sm",children:p("for_collection",{name:a.name})})]}):(0,l.jsx)("p",{className:"text-xl font-thin",children:p("create_new_collection")}),(0,l.jsx)(x.w,{className:"my-3"}),(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex gap-3 items-end",children:[(0,l.jsx)(d.A,{color:f.color||(0,u.A)("--p"),setColor:e=>g({...f,color:e}),weight:f.iconWeight||"regular",setWeight:e=>g({...f,iconWeight:e}),iconName:f.icon,setIconName:e=>g({...f,icon:e}),reset:()=>g({...f,color:(0,u.A)("--p"),icon:"",iconWeight:""})}),(0,l.jsxs)("div",{className:"w-full",children:[(0,l.jsx)("p",{className:"mb-2",children:p("name")}),(0,l.jsx)(s.A,{ref:N,className:"bg-base-200",value:f.name,placeholder:p("collection_name_placeholder"),onChange:e=>g({...f,name:e.target.value})})]})]}),(0,l.jsxs)("div",{className:"w-full",children:[(0,l.jsx)("p",{className:"mb-2",children:p("description")}),(0,l.jsx)("textarea",{className:"w-full h-32 resize-none border rounded-md duration-100 bg-base-200 p-2 outline-none border-neutral-content focus:border-primary",placeholder:p("collection_description_placeholder"),value:f.description,onChange:e=>g({...f,description:e.target.value})})]})]}),(0,l.jsx)(m.$,{variant:"primary",className:"ml-auto",onClick:y,children:p("create_collection_button")})]})]})}},62608:(e,t,a)=>{a.d(t,{A:()=>d});var l=a(6029),n=a(55729),s=a(14187),i=a(69566),r=a(91604),o=a(50212),c=a(35270);let d=e=>{let{alignment:t,color:a,setColor:d,iconName:u,setIconName:m,weight:x,setWeight:p,hideDefaultIcon:h,className:f,reset:g}=e,{t:j}=(0,s.Bd)(),[v,b]=(0,n.useState)(!1);return(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(c.$,{onClick:()=>b(!v),variant:"ghost",className:"w-20 h-20",size:"icon",children:u?(0,l.jsx)(i.A,{icon:u,size:60,weight:x||"regular",color:a}):!u&&h?(0,l.jsx)("p",{className:"p-1",children:j("set_custom_icon")}):(0,l.jsx)("i",{className:"bi-folder-fill text-6xl",style:{color:a}})}),v&&(0,l.jsx)(r.A,{alignment:t,color:a,setColor:d,iconName:u,setIconName:m,weight:x,setWeight:p,reset:g,onClose:()=>b(!1),className:(0,o.A)(f,t||"lg:-translate-x-1/3 top-20 left-0")})]})}},81955:(e,t,a)=>{a.d(t,{A:()=>m});var l=a(6029),n=a(55729),s=a(83248),i=a(58578),r=a(32764),o=a(35270),c=a(14187),d=a(36919),u=a(45694);function m(e){let{onClose:t}=e,{t:a}=(0,c.Bd)(),m=(0,u.Ik)(),[x,p]=(0,n.useState)({label:""}),[h,f]=(0,n.useState)(!1),g=async()=>{if(!h){f(!0);let e=i.Ay.loading(a("creating"));await m.mutateAsync([x],{onSettled:(l,n)=>{f(!1),i.Ay.dismiss(e),n?i.Ay.error(a(n.message)):(t(),i.Ay.success(a("created")))}})}},j=(0,n.useRef)(null);return(0,n.useLayoutEffect)(()=>{var e;null==(e=j.current)||e.focus()},[]),(0,l.jsxs)(r.A,{toggleModal:t,children:[(0,l.jsx)("p",{className:"text-xl font-thin",children:a("create_new_tag")}),(0,l.jsx)(d.w,{className:"my-3"}),(0,l.jsxs)("div",{className:"w-full",children:[(0,l.jsx)("p",{className:"mb-2",children:a("name")}),(0,l.jsx)(s.A,{ref:j,value:x.label,onChange:e=>p({...x,label:e.target.value}),className:"bg-base-200",placeholder:a("tag_name_placeholder")})]}),(0,l.jsx)("div",{className:"flex justify-end items-center mt-5",children:(0,l.jsx)(o.$,{variant:"primary",onClick:g,disabled:!x.label.trim(),children:a("create_new_tag")})})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.