PageSourceSearch

https://app.nottana.com/assets/C0wn9xJ1.js

js nottana.com collected 2026-10-02 01:37:59 UTC 31,977 bytes, 1 lines download raw bytes

1import{u as e,d as s,j as a,B as t,I as r,cN as o,d1 as i,T as n,aq as l,a6 as d,J as c,cO as x,cy as p,aa as h,p as m,ab as u,c3 as g,az as f,ac as b,bL as y,d2 as j,aO as w,aP as k,aQ as v,dI as I,dJ as C,N as S,O as W,Q as P,aF as z,X as E,G as R,y as A,dK as D,C as $,E as T,x as O,a9 as M,bh as N}from"./DYw7LMfG.js";import{u as B,h as F,a as L,N as K,i as q,b as U}from"./UqzzAnT4.js";import{b0 as Y,q as X,u as H,aI as G,a2 as _,aR as V,a4 as J,a8 as Q,b1 as Z,b2 as ee,b3 as se,aW as ae,an as te,b4 as re,b as oe,b5 as ie,b6 as ne}from"./DNA11vdE.js";import{y as le}from"./BFMbySPq.js";import"./DXvvCRrN.js";const de={expired:{bg:"#fdecea",fg:"#c62828",label:"EXPIRED"},today:{bg:"#ffe0b2",fg:"#bf360c",label:"EXPIRING TODAY"},soon:{bg:"#fff4e5",fg:"#e65100",label:"EXPIRING SOON"},upcoming:{bg:"#fff9c4",fg:"#8d6e00",label:"UPCOMING"},missing:{bg:"#e3f2fd",fg:"#1565c0",label:"MISSING EXPIRY DATE"}},ce={expiring:{title:"Expiring Items",description:"API keys and credit cards that have expired or will expire soon.",icon:i,color:"#e65100",path:"/towercheck/expiring"},weak:{title:"Weak Passwords",description:"Passwords that are easy to guess or crack.",icon:x,color:"#c62828",path:"/towercheck/weak"},reused:{title:"Reused Passwords",description:"The same password used across multiple items.",icon:p,color:"#f9a825",path:"/towercheck/reused"},duplicates:{title:"Duplicate Items",description:"Items that appear to be duplicates of each other.",icon:j,color:"#1565c0",path:"/towercheck/duplicates"},old:{title:"Old Passwords",description:"Passwords that haven't been updated in over a year.",icon:A,color:"#6a1b9a",path:"/towercheck/old"}},xe=e=>{if(!e)return null;const s=new Date(e);return Number.isNaN(s.getTime())?null:s.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})},pe=({sectionKey:e,count:s,onClick:r})=>{const o=ce[e],i=o.icon,c=s>0;return a.jsxs(d,{elevation:0,onClick:r,"data-qa":`towercheck-card-${e}`,sx:{p:2,cursor:"pointer",border:"1px solid rgba(148, 163, 184, 0.35)",borderRadius:2,display:"flex",alignItems:"center",gap:2,transition:"all 0.15s ease","&:hover":{borderColor:o.color,backgroundColor:"action.hover"}},children:[a.jsx(t,{sx:{width:48,height:48,borderRadius:"50%",backgroundColor:c?`${o.color}15`:"action.hover",color:c?o.color:"#9e9e9e",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:a.jsx(i,{})}),a.jsxs(t,{sx:{flex:1,minWidth:0},children:[a.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1},children:[a.jsx(n,{variant:"subtitle1",sx:{fontWeight:600},children:o.title}),a.jsx(l,{label:s,size:"small",sx:{backgroundColor:c?o.color:"#e0e0e0",color:c?"#fff":"#616161",fontWeight:600,height:22,minWidth:32}})]}),a.jsx(n,{variant:"body2",color:"text.secondary",children:o.description})]}),a.jsx(N,{sx:{color:"text.secondary"}})]})},he=({title:e})=>a.jsxs(t,{sx:{maxWidth:880,mx:"auto",p:1},children:[a.jsxs(t,{sx:{display:{xs:"none",sm:"flex"},alignItems:"center",gap:1.5,mb:3},children:[a.jsx(c,{sx:{fontSize:32,color:"primary.main"}}),a.jsx(n,{variant:"h5",sx:{fontWeight:700},children:e})]}),a.jsx(d,{elevation:0,sx:{p:4,borderRadius:2,border:"1px solid rgba(148, 163, 184, 0.35)",display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:a.jsx(re,{size:40,text:"Analyzing your vault..."})})]}),me=()=>{const o=B(),{counts:i,isReady:l,status:c}=se(),x=e(),p=s(x.breakpoints.down("sm")),[h,m]=L.useState(!1);if(!l)return a.jsx(he,{title:"TowerCheck"});const u=1===i.total?"issue":"issues",g=ie(c),f=ne(c),b=i.total>0?`${i.total} security ${u} found`:"empty"===c?"No items in your vault":"Your vault looks healthy",y=i.total>0?"Review the sections below to improve your security.":"empty"===c?"Add items to your vault and TowerCheck will analyze them.":"No security issues detected across your items.",j=()=>m(e=>!e);return a.jsxs(t,{sx:{maxWidth:880,mx:"auto",p:1,overflow:"hidden"},children:[a.jsxs(t,{sx:{display:{xs:"none",sm:"flex"},alignItems:"center",gap:1.5,mb:3},children:[a.jsx(g,{sx:{fontSize:32,color:f}}),a.jsx(n,{variant:"h5",sx:{fontWeight:700},children:"TowerCheck"})]}),a.jsx(d,{elevation:0,onClick:p?j:void 0,role:p?"button":void 0,tabIndex:p?0:void 0,onKeyDown:p?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),j())}:void 0,sx:{p:{xs:2,sm:3},mb:3,borderRadius:2,cursor:p?"pointer":"default",color:"text.primary",background:e=>"dark"===e.palette.mode?i.total>0?"linear-gradient(135deg, rgba(244, 67, 54, 0.14) 0%, rgba(255, 193, 7, 0.12) 100%)":"empty"===c?"linear-gradient(135deg, rgba(148, 163, 
1184, 0.12) 0%, rgba(148, 163, 184, 0.08) 100%)":"linear-gradient(135deg, rgba(76, 175, 80, 0.14) 0%, rgba(139, 195, 74, 0.1) 100%)":i.total>0?"linear-gradient(135deg, #fff5f5 0%, #fff9e5 100%)":"empty"===c?"linear-gradient(135deg, #f5f5f5 0%, #eeeeee 100%)":"linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%)",border:"1px solid",borderColor:e=>"dark"===e.palette.mode?i.total>0?"rgba(255, 152, 0, 0.35)":"empty"===c?"rgba(148, 163, 184, 0.25)":"rgba(76, 175, 80, 0.35)":i.total>0?"#ffe0b2":"empty"===c?"#e0e0e0":"#c8e6c9"},children:a.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:2},children:[i.total>0?a.jsx(D,{sx:{fontSize:{xs:32,sm:40},color:f}}):a.jsx(g,{sx:{fontSize:{xs:32,sm:40},color:f}}),a.jsxs(t,{sx:{flex:1,minWidth:0},children:[a.jsx(n,{variant:"h6",sx:{fontWeight:700,fontSize:{xs:"1rem",sm:"1.25rem"}},children:b}),p?a.jsx($,{in:h,unmountOnExit:!0,children:a.jsx(n,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:y})}):a.jsx(n,{variant:"body2",color:"text.secondary",children:y})]}),p&&a.jsx(r,{size:"small","aria-label":h?"Collapse":"Expand",sx:{flexShrink:0},children:h?a.jsx(T,{}):a.jsx(O,{})})]})}),a.jsxs(t,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[a.jsx(pe,{sectionKey:"expiring",count:i.expiring,onClick:()=>o("/towercheck/expiring")}),a.jsx(pe,{sectionKey:"weak",count:i.weak,onClick:()=>o("/towercheck/weak")}),a.jsx(pe,{sectionKey:"reused",count:i.reused,onClick:()=>o("/towercheck/reused")}),a.jsx(pe,{sectionKey:"duplicates",count:i.duplicates,onClick:()=>o("/towercheck/duplicates")}),a.jsx(pe,{sectionKey:"old",count:i.old,onClick:()=>o("/towercheck/old")})]})]})},ue=()=>{const x=B(),[p]=q(),j=p.get("highlight"),{expiring:w,isReady:k}=se(),v=fe(),I=e(),C=s(I.breakpoints.down("sm")),S=L.useRef(I.palette.mode);L.useEffect(()=>{S.current=I.palette.mode},[I.palette.mode]);const W=L.useCallback(e=>{e&&setTimeout(()=>{const s=document.querySelector(`[data-qa="towercheck-expiring-item-${e}"]`),a=s?.closest("li")||s;a&&(a.scrollIntoView({behavior:"smooth",block:"center"}),a.style.transition="background-color 0.3s ease",a.style.setProperty("background-color",ae(S.current),"important"),setTimeout(()=>{a.style.removeProperty("background-color")},3e3))},300)},[]);if(L.useEffect(()=>{j&&k&&W(j)},[j,k,W]),L.useEffect(()=>{const e=e=>{const s=e?.detail?.passwordId;s&&W(s)};return window.addEventListener("nottana-towercheck-highlight",e),()=>{window.removeEventListener("nottana-towercheck-highlight",e)}},[W]),!k)return a.jsx(he,{title:"Expiring Items"});const P={expired:w.filter(e=>"expired"===e.severity),today:w.filter(e=>"today"===e.severity),soon:w.filter(e=>"soon"===e.severity),upcoming:w.filter(e=>"upcoming"===e.severity),missing:w.filter(e=>"missing"===e.severity)},z=(e,s)=>{if(0===s.length)return null;const o=de[e];return a.jsxs(t,{sx:{mb:3},children:[a.jsxs(t,{sx:{display:"inline-flex",alignItems:"center",px:1.5,py:.5,borderRadius:1,backgroundColor:o.bg,color:o.fg,fontSize:12,fontWeight:700,letterSpacing:.5,mb:1},children:[o.label," (",s.length,")"]}),a.jsx(d,{elevation:0,sx:{border:"1px solid rgba(148, 163, 184, 0.35)",borderRadius:2},children:a.jsx(h,{disablePadding:!0,children:s.map((e,s)=>{const{item:i,daysUntil:l,severity:d,itemType:c}=e,p="missing"===d,h=l<0,j="credit_card"===c?"Credit Card":"api_key"===c?"API Key":null,w=i.apiKeyExpiry?new Date(`${i.apiKeyExpiry}T00:00:00`).toLocaleDateString():i.expiryMonth&&i.expiryYear?`${String(i.expiryMonth).padStart(2,"0")}/${i.expiryYear}`:null,k=p?null:(e=>e<0?{text:"EXPIRED",color:"#c62828"}:0===e?{text:"EXPIRING TODAY",color:"#bf360c"}:e<=7?{text:"EXPIRING SOON",color:"#e65100"}:e<=30?{text:`EXPIRES IN ${e} DAYS`,color:"#f57f17"}:null)(l);return a.jsxs(U.Fragment,{children:[s>0&&a.jsx(m,{component:"li"}),a.jsx(u,{disablePadding:!0,secondaryAction:a.jsx(r,{edge:"end",size:"small",onClick:e=>{e.stopPropagation(),x(`/passwords/item/${i.passwordId}`)},"data-qa":`towercheck-expiring-goto-${i.passwordId}`,"aria-label":"Open in passwords",children:a.jsx(y,{fontSize:"small"})}),children:a.jsxs(g,{onClick:()=>(e=>{e?.passwordId&&v(e)})(i),"data-qa":`towercheck-expiring-item-${i.passwordId}`,sx:{pr:6},children:[a.jsx(f,{sx:{color:o.fg,minWidth:44},children:a.jsx(te,{password:i,size:32,disableInitials:!0})}),a.jsx(b,{primary:a.jsxs(a.Fragment,{children:[j&&a.jsx(n,{component:"span",variant:"caption",sx:{fontSize:"10px",fontWeight:"bold",textTransform:"uppercase",color:o.fg,letterSpacing:"0.5px",display:"block",mb:.25},children:j}),a.jsx(n,{component:"span",sx:{fontWeight:500,display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.title||"Untitled"})]}
1),secondary:a.jsx(t,{component:"span",sx:{display:"block",mt:.3},children:p?a.jsx(n,{component:"span",sx:{fontSize:"12px",color:"#1565c0",fontStyle:"italic",display:"block"},children:"Add expiry date for renewal reminders"}):a.jsxs(a.Fragment,{children:[a.jsxs(t,{component:"span",sx:{display:"flex",alignItems:"baseline",flexWrap:"wrap",columnGap:.75,rowGap:.2},children:[a.jsx(n,{component:"span",sx:{fontSize:"11px",color:"text.secondary"},children:"Expires"}),w&&a.jsx(n,{component:"span",sx:{fontSize:"14px",color:h?"#c62828":"text.primary"},children:w})]}),k&&a.jsx(n,{component:"span",sx:{mt:.3,fontSize:"11px",fontWeight:700,letterSpacing:"0.03em",whiteSpace:"nowrap",color:k.color,display:"block"},children:k.text})]})})})]})})]},i.passwordId||s)})})})]},e)};return a.jsxs(t,{sx:{maxWidth:880,mx:"auto",p:1,overflow:"hidden"},children:[a.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[a.jsx(r,{onClick:()=>x("/towercheck",{replace:!0}),size:C?"small":"medium","data-qa":"towercheck-back",color:"primary",children:a.jsx(o,{fontSize:"small"})}),a.jsx(i,{sx:{color:"#e65100",display:{xs:"none",sm:"inline-flex"}}}),a.jsx(n,{variant:"h6",sx:{fontWeight:700,display:{xs:"none",sm:"block"}},children:"Expiring Items"}),a.jsx(l,{label:w.length,size:"small",sx:{backgroundColor:"#e65100",color:"#fff",fontWeight:600,ml:1}})]}),0===w.length?a.jsxs(d,{elevation:0,sx:{p:4,textAlign:"center",border:"1px dashed rgba(148, 163, 184, 0.35)",borderRadius:2},children:[a.jsx(c,{sx:{fontSize:48,color:"text.secondary",mb:1}}),a.jsx(n,{variant:"subtitle1",sx:{fontWeight:600},children:"No expiring items"}),a.jsx(n,{variant:"body2",color:"text.secondary",children:"None of your API keys or credit cards are expired or expiring in the next 30 days."})]}):a.jsxs(a.Fragment,{children:[z("expired",P.expired),z("today",P.today),z("soon",P.soon),z("upcoming",P.upcoming),z("missing",P.missing)]})]})},ge=L.createContext(()=>{}),fe=()=>L.useContext(ge),be=L.createContext(()=>{}),ye={0:{label:"Very Weak",color:"#c62828",progress:15},1:{label:"Very Weak",color:"#c62828",progress:25},2:{label:"Weak",color:"#e65100",progress:50}},je=()=>{const i=B(),{weak:p,isReady:j}=se(),w=fe(),k=e(),v=s(k.breakpoints.down("sm"));if(!j)return a.jsx(he,{title:"Weak Passwords"});const I={veryWeak:p.filter(e=>e.score<=1),weak:p.filter(e=>2===e.score)},C=(e,s)=>{if(0===s.length)return null;const o="veryWeak"===e?"VERY WEAK":"WEAK",l="veryWeak"===e?"#c62828":"#e65100",c="veryWeak"===e?"#fdecea":"#fff4e5";return a.jsxs(t,{sx:{mb:3},children:[a.jsxs(t,{sx:{display:"inline-flex",alignItems:"center",px:1.5,py:.5,borderRadius:1,backgroundColor:c,color:l,fontSize:12,fontWeight:700,letterSpacing:.5,mb:1},children:[o," (",s.length,")"]}),a.jsx(d,{elevation:0,sx:{border:"1px solid rgba(148, 163, 184, 0.35)",borderRadius:2},children:a.jsx(h,{disablePadding:!0,children:s.map((e,s)=>{const{item:o,score:l}=e,d=ye[l]||ye[2];return a.jsxs(U.Fragment,{children:[s>0&&a.jsx(m,{component:"li"}),a.jsx(u,{disablePadding:!0,secondaryAction:a.jsx(r,{edge:"end",size:"small",onClick:e=>{e.stopPropagation(),i(`/passwords/item/${o.passwordId}`)},"data-qa":`towercheck-weak-goto-${o.passwordId}`,"aria-label":"Open in passwords",children:a.jsx(y,{fontSize:"small"})}),children:a.jsxs(g,{onClick:()=>(e=>{e?.passwordId&&w(e)})(o),"data-qa":`towercheck-weak-item-${o.passwordId}`,sx:{pr:6},children:[a.jsx(f,{sx:{color:d.color,minWidth:44},children:a.jsx(te,{password:o,size:32,disableInitials:!0})}),a.jsx(b,{primary:o.title||"Untitled",primaryTypographyProps:{noWrap:!0,sx:{fontWeight:500}},secondary:a.jsxs(t,{component:"span",sx:{display:"block",mt:.3},children:[o.websites?.[0]&&a.jsx(n,{component:"span",variant:"caption",color:"text.secondary",sx:{display:"block",mb:.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.websites[0]}),a.jsxs(t,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:[a.jsx(M,{variant:"determinate",value:d.progress,sx:{flex:1,maxWidth:140,height:6,borderRadius:3,backgroundColor:"#eeeeee","& .MuiLinearProgress-bar":{backgroundColor:d.color}}}),a.jsx(n,{component:"span",sx:{fontSize:"11px",fontWeight:700,letterSpacing:"0.03em",whiteSpace:"nowrap",color:d.color},children:d.label.toUpperCase()})]})]})})]})})]},o.passwordId||s)})})})]},e)};return a.jsxs(t,{sx:{maxWidth:880,mx:"auto",p:1,overflow:"hidden"},children:[a.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[a.jsx(r,{onClick:()=>i("/towercheck",{replace:!0}),size:v?"small":"medium","data-qa":"towercheck-back",color:"primary",children:a.jsx(o,{fontSize:"small"})}),a.jsx(x,{sx:{color:"#c62828",display:{xs:"none",sm:"inline-flex"}}}),a.jsx(n,{variant:"h6",sx:{fontWeight:700,display:{xs:"none",sm:"block"}},children:"Weak Passwords"}),a.jsx(l,{label:p.length,size:"small",sx:{backgroundColor:"#c62828",color:"#fff",fontWeight:600,ml:1}})]}),0===p.length?a.jsxs(d,{elevation:0,sx:{p:4,textAlign:"center",border:"1px dashed rgba(148, 163, 
1184, 0.35)",borderRadius:2},children:[a.jsx(c,{sx:{fontSize:48,color:"text.secondary",mb:1}}),a.jsx(n,{variant:"subtitle1",sx:{fontWeight:600},children:"No weak passwords"}),a.jsx(n,{variant:"body2",color:"text.secondary",children:"All of your passwords meet the strength threshold."})]}):a.jsxs(a.Fragment,{children:[C("veryWeak",I.veryWeak),C("weak",I.weak)]})]})},we=()=>{const i=B(),{reused:x,isReady:j}=se(),w=fe(),k=e(),v=s(k.breakpoints.down("sm"));if(!j)return a.jsx(he,{title:"Reused Passwords"});return a.jsxs(t,{sx:{maxWidth:880,mx:"auto",p:1,overflow:"hidden"},children:[a.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[a.jsx(r,{onClick:()=>i("/towercheck",{replace:!0}),size:v?"small":"medium","data-qa":"towercheck-back",color:"primary",children:a.jsx(o,{fontSize:"small"})}),a.jsx(p,{sx:{color:"#f9a825",display:{xs:"none",sm:"inline-flex"}}}),a.jsx(n,{variant:"h6",sx:{fontWeight:700,display:{xs:"none",sm:"block"}},children:"Reused Passwords"}),a.jsx(l,{label:x.length,size:"small",sx:{backgroundColor:"#f9a825",color:"#fff",fontWeight:600,ml:1}})]}),0===x.length?a.jsxs(d,{elevation:0,sx:{p:4,textAlign:"center",border:"1px dashed rgba(148, 163, 184, 0.35)",borderRadius:2},children:[a.jsx(c,{sx:{fontSize:48,color:"text.secondary",mb:1}}),a.jsx(n,{variant:"subtitle1",sx:{fontWeight:600},children:"No reused passwords"}),a.jsx(n,{variant:"body2",color:"text.secondary",children:"Every password in your vault is unique. Nice work."})]}):a.jsx(t,{sx:{display:"flex",flexDirection:"column",gap:2},children:x.map((e,s)=>a.jsxs(t,{children:[a.jsx(t,{sx:{display:"inline-flex",alignItems:"center",px:1.5,py:.5,borderRadius:1,backgroundColor:"#fff8e1",color:"#8d6e00",fontSize:12,fontWeight:700,letterSpacing:.5,mb:1},children:2===e.items.length?"PASSWORD REUSED IN ITEMS":`PASSWORD REUSED IN ${e.items.length} ITEMS`}),a.jsx(d,{elevation:0,sx:{border:"1px solid rgba(148, 163, 184, 0.35)",borderRadius:2},children:a.jsx(h,{disablePadding:!0,children:e.items.map((e,s)=>a.jsxs(U.Fragment,{children:[s>0&&a.jsx(m,{component:"li"}),a.jsx(u,{disablePadding:!0,secondaryAction:a.jsx(r,{edge:"end",size:"small",onClick:s=>{s.stopPropagation(),i(`/passwords/item/${e.passwordId}`)},"data-qa":`towercheck-reused-goto-${e.passwordId}`,"aria-label":"Open in passwords",children:a.jsx(y,{fontSize:"small"})}),children:a.jsxs(g,{onClick:()=>(e=>{e?.passwordId&&w(e)})(e),"data-qa":`towercheck-reused-item-${e.passwordId}`,sx:{pr:6},children:[a.jsx(f,{sx:{color:"#f9a825",minWidth:44},children:a.jsx(te,{password:e,size:32,disableInitials:!0})}),a.jsx(b,{primary:e.title||"Untitled",primaryTypographyProps:{noWrap:!0,sx:{fontWeight:500}},secondary:a.jsxs(t,{component:"span",sx:{display:"block",mt:.3},children:[e.websites?.[0]&&a.jsx(n,{component:"span",variant:"caption",color:"text.secondary",sx:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.websites[0]}),xe(e.modifiedAt)&&a.jsxs(n,{component:"span",variant:"caption",color:"text.secondary",sx:{display:"block"},children:["Modified ",xe(e.modifiedAt)]})]})})]})})]},e.passwordId||s))})})]},s))})]})},ke=()=>{const i=B(),{duplicates:x,isReady:p,dismissDuplicate:A,restoreDuplicate:D}=se(),$=L.useContext(be),{deletePassword:T,refreshPasswordsFromBackend:O}=Y(),{decryptedKey:M}=X(),{user:N}=H(),F=e(),K=s(F.breakpoints.down("sm")),q="expired"===N?.plan?.status||N?.plan?.endDate&&new Date(N?.plan?.endDate)<=new Date&&("cancelled"===N?.plan?.status||"14-day-trial"===N?.plan?.id)||N?.plan?.status&&["past_due","unpaid","incomplete","incomplete_expired","paused"].includes(N?.plan?.status?.toLowerCase()),[G,_]=L.useState(null),[V,J]=L.useState(null),[Q,Z]=L.useState(null),[ee,ae]=L.useState(null),[re,ie]=L.useState({sharedLinksCount:0,storageMB:0,loading:!1}),[ne,de]=L.useState(!1);if(!p)return a.jsx(he,{title:"Duplicate Items"});const ce=()=>{_(null),J(null)},pe=()=>{Z(null)},me=async e=>{try{const s=await oe.get(`/shared-items/${e}`);return(s.data?.sharedItems||[]).filter(e=>"active"===e.status||"pending"===e.status).length}catch{return 0}},ue=()=>{ne||(ae(null),ie({sharedLinksCount:0,storageMB:0,loading:!1}))};return a.jsxs(t,{sx:{maxWidth:880,mx:"auto",p:1,overflow:"hidden"},children:[a.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[a.jsx(r,{onClick:()=>i("/towercheck",{replace:!0}),size:K?"small":"medium","data-qa":"towercheck-back",color:"primary",children:a.jsx(o,{fontSize:"small"})}),a.jsx(j,{sx:{color:"#1565c0",display:{xs:"none",sm:"inline-flex"}}}),a.jsx(n,{variant:"h6",sx:{fontWeight:700,display:{xs:"none",sm:"block"}},children:"Duplicate Items"}),a.jsx(l,{label:x.length,size:"small",sx:{backgroundColor:"#1565c0",color:"#fff",fontWeight:600,ml:1}})]}),0===x.length?a.jsxs(d,{elevation:0,sx:{p:4,textAlign:"center",border:"1px dashed rgba(148, 163, 
1184, 0.35)",borderRadius:2},children:[a.jsx(c,{sx:{fontSize:48,color:"text.secondary",mb:1}}),a.jsx(n,{variant:"subtitle1",sx:{fontWeight:600},children:"No duplicate items"}),a.jsx(n,{variant:"body2",color:"text.secondary",children:"None of your items share the same title and website."})]}):a.jsx(t,{sx:{display:"flex",flexDirection:"column",gap:2},children:x.map((e,s)=>{const o=e.items[0],i=o?.title||"Untitled";return a.jsxs(t,{children:[a.jsxs(t,{sx:{display:"inline-flex",alignItems:"center",px:1.5,py:.5,borderRadius:1,backgroundColor:"#e3f2fd",color:"#0d47a1",fontSize:12,fontWeight:700,letterSpacing:.5,mb:1,maxWidth:"100%",wordBreak:"break-all"},children:[e.items.length," COPIES — ",i.toUpperCase()]}),a.jsx(d,{elevation:0,sx:{border:"1px solid rgba(148, 163, 184, 0.35)",borderRadius:2},children:a.jsx(h,{disablePadding:!0,children:e.items.map((e,s)=>a.jsxs(U.Fragment,{children:[s>0&&a.jsx(m,{component:"li"}),a.jsx(u,{disablePadding:!0,secondaryAction:a.jsx(r,{edge:"end",size:"small",onClick:s=>((e,s)=>{e.stopPropagation(),_(e.currentTarget),J(s)})(s,e),"data-qa":`towercheck-duplicates-more-${e.passwordId}`,"aria-label":"More actions",children:a.jsx(w,{fontSize:"small"})}),children:a.jsxs(g,{onClick:()=>(e=>{e?.passwordId&&$(e)})(e),"data-qa":`towercheck-duplicates-item-${e.passwordId}`,sx:{pr:9},children:[a.jsx(f,{sx:{color:"#1565c0",minWidth:44},children:a.jsx(te,{password:e,size:32,disableInitials:!0})}),a.jsx(b,{primary:e.title||"Untitled",primaryTypographyProps:{noWrap:!0,sx:{fontWeight:500}},secondary:a.jsxs(t,{component:"span",sx:{display:"block",mt:.3,wordBreak:"break-word"},children:[e.websites?.[0]&&a.jsx(n,{component:"span",variant:"caption",color:"text.secondary",sx:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.websites[0]}),e.usernames?.[0]?.username&&a.jsx(n,{component:"span",variant:"caption",color:"text.secondary",sx:{display:"block"},children:e.usernames[0].username}),xe(e.modifiedAt)&&a.jsxs(n,{component:"span",variant:"caption",color:"text.secondary",sx:{display:"block"},children:["Modified ",xe(e.modifiedAt)]})]})})]})})]},e.passwordId||s))})})]},s)})}),a.jsxs(k,{anchorEl:G,open:Boolean(G),onClose:ce,children:[a.jsxs(v,{onClick:()=>{V?.passwordId&&i(`/passwords/item/${V.passwordId}`),ce()},children:[a.jsx(f,{children:a.jsx(y,{fontSize:"small"})}),a.jsx(b,{primary:"Open in passwords"})]}),a.jsxs(v,{onClick:()=>{Z(V),ce()},children:[a.jsx(f,{children:a.jsx(I,{fontSize:"small"})}),a.jsx(b,{primary:"Not a duplicate"})]}),a.jsxs(v,{onClick:async()=>{const e=V;if(ce(),!e?.passwordId)return;if(q)return void le.error("Your plan has expired. Please upgrade to delete items.");ae(e),ie({sharedLinksCount:0,storageMB:0,loading:!0});const[s]=await Promise.all([me(e.passwordId)]);var a;ie({sharedLinksCount:s,storageMB:(a=e,Array.isArray(a?.attachments)?a.attachments.reduce((e,s)=>e+("number"==typeof s?.sizeMB?s.sizeMB:0),0):0),loading:!1})},sx:{color:"#c62828"},children:[a.jsx(f,{sx:{color:"#c62828"},children:a.jsx(C,{fontSize:"small"})}),a.jsx(b,{primary:"Delete"})]})]}),a.jsxs(S,{open:Boolean(Q),onClose:pe,children:[a.jsx(W,{children:"Mark as not a duplicate?"}),a.jsx(P,{children:a.jsxs(z,{children:["“",Q?.title||"This item","” will no longer appear in the duplicates report. Its group may also disappear if no other items remain. You can always re-dismiss if it shows up again later."]})}),a.jsxs(E,{children:[a.jsx(R,{onClick:pe,children:"Cancel"}),a.jsx(R,{onClick:()=>{Q?.passwordId&&(A(Q.passwordId),le.success("Marked as not a duplicate")),Z(null)},variant:"contained",children:"Not a duplicate"})]})]}),a.jsxs(S,{open:Boolean(ee),onClose:ne?void 0:ue,children:[a.jsx(W,{children:"Delete this item?"}),a.jsxs(P,{children:[a.jsxs(z,{sx:{mb:1},children:["This will permanently delete “",ee?.title||"this item","” from your vault. This action cannot be undone."]}),re.loading?a.jsx(n,{variant:"body2",color:"text.secondary",children:"Checking shared links…"}):a.jsxs(a.Fragment,{children:[re.sharedLinksCount>0&&a.jsxs(n,{variant:"body2",sx:{color:"#c62828",mb:.5},children:[re.sharedLinksCount," active shared link",re.sharedLinksCount>1?"s":""," will also be deleted."]}),re.storageMB>0&&a.jsxs(n,{variant:"body2",color:"text.secondary",children:["Will free ",re.storageMB.toFixed(2),"MB of storage from attachments."]})]})]}),a.jsxs(E,{children:[a.jsx(R,{onClick:ue,disabled:ne,children:"Cancel"}),a.jsx(R,{onClick:async()=>
1{if(!ee?.passwordId)return;const e=ee,{sharedLinksCount:s,storageMB:a}=re;de(!0);try{const r=Array.isArray(e.attachments)?e.attachments.map(e=>e?.filebaseKey||e?.key).filter(Boolean):[];if(s>0)try{await oe.delete(`/shared-items/by-item/${e.passwordId}`)}catch(t){console.error("[TOWERCHECK] Failed to delete shared links:",t),le.warning("Item deleted but some shared links may still be active")}if(await oe.delete("/passwords/delete-password",{data:{passwordId:e.passwordId,attachmentKeys:r}}),a>0)try{await oe.post("/api/storage/remove-usage",{fileSizeMB:a})}catch(t){console.error("[TOWERCHECK] Failed to update storage usage:",t)}if("API_keys"===e.category)try{await oe.delete(`/api/item-metadata/${e.passwordId}`)}catch(t){console.error("[TOWERCHECK] Failed to delete item metadata:",t)}T(e.passwordId),D(e.passwordId);const o=[];a>0&&o.push(`Freed ${a.toFixed(2)}MB`),s>0&&o.push(`${s} shared link${s>1?"s":""} removed`),le.success(o.length>0?`Deleted. ${o.join(" · ")}`:"Item deleted"),M&&O("All Safes",M)}catch(r){console.error("[TOWERCHECK] Failed to delete duplicate:",r),le.error("Failed to delete item")}finally{de(!1),ae(null),ie({sharedLinksCount:0,storageMB:0,loading:!1})}},disabled:ne||re.loading,color:"error",variant:"contained",children:ne?"Deleting...":"Delete"})]})]})]})},ve=e=>{const s=Math.floor(e/12),a=e%12;return 0===s?`${a} month${1===a?"":"s"}`:0===a?`${s} year${1===s?"":"s"}`:`${s}y ${a}m`},Ie=()=>{const i=B(),{old:x,isReady:p}=se(),j=fe(),w=e(),k=s(w.breakpoints.down("sm"));if(!p)return a.jsx(he,{title:"Old Passwords"});return a.jsxs(t,{sx:{maxWidth:880,mx:"auto",p:1,overflow:"hidden"},children:[a.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[a.jsx(r,{onClick:()=>i("/towercheck",{replace:!0}),size:k?"small":"medium","data-qa":"towercheck-back",color:"primary",children:a.jsx(o,{fontSize:"small"})}),a.jsx(A,{sx:{color:"#6a1b9a",display:{xs:"none",sm:"inline-flex"}}}),a.jsx(n,{variant:"h6",sx:{fontWeight:700,display:{xs:"none",sm:"block"}},children:"Old Passwords"}),a.jsx(l,{label:x.length,size:"small",sx:{backgroundColor:"#6a1b9a",color:"#fff",fontWeight:600,ml:1}})]}),0===x.length?a.jsxs(d,{elevation:0,sx:{p:4,textAlign:"center",border:"1px dashed rgba(148, 163, 184, 0.35)",borderRadius:2},children:[a.jsx(c,{sx:{fontSize:48,color:"text.secondary",mb:1}}),a.jsx(n,{variant:"subtitle1",sx:{fontWeight:600},children:"No old passwords"}),a.jsx(n,{variant:"body2",color:"text.secondary",children:"All of your passwords have been updated within the past year."})]}):a.jsx(d,{elevation:0,sx:{border:"1px solid rgba(148, 163, 184, 0.35)",borderRadius:2},children:a.jsx(h,{disablePadding:!0,children:x.map((e,s)=>{const{item:o,monthsOld:l}=e;return a.jsxs(U.Fragment,{children:[s>0&&a.jsx(m,{component:"li"}),a.jsx(u,{disablePadding:!0,secondaryAction:a.jsx(r,{edge:"end",size:"small",onClick:e=>{e.stopPropagation(),i(`/passwords/item/${o.passwordId}`)},"data-qa":`towercheck-old-goto-${o.passwordId}`,"aria-label":"Open in passwords",children:a.jsx(y,{fontSize:"small"})}),children:a.jsxs(g,{onClick:()=>(e=>{e?.passwordId&&j(e)})(o),"data-qa":`towercheck-old-item-${o.passwordId}`,sx:{pr:6},children:[a.jsx(f,{sx:{color:"#6a1b9a",minWidth:44},children:a.jsx(te,{password:o,size:32,disableInitials:!0})}),a.jsx(b,{primary:o.title||"Untitled",primaryTypographyProps:{noWrap:!0,sx:{fontWeight:500}},secondary:a.jsxs(t,{component:"span",sx:{display:"block",mt:.3},children:[o.websites?.[0]&&a.jsx(n,{component:"span",variant:"caption",color:"text.secondary",sx:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.websites[0]}),a.jsxs(n,{component:"span",sx:{fontSize:"11px",fontWeight:700,letterSpacing:"0.03em",color:"#6a1b9a",display:"block"},children:[ve(l)," WITHOUT UPDATE"]}),xe(o.modifiedAt)&&a.jsxs(n,{component:"span",variant:"caption",color:"text.secondary",sx:{display:"block"},children:["Modified ",xe(o.modifiedAt)]})]})})]})})]},o.passwordId||s)})})})]})},Ce=()=>{const r=B(),o=F().pathname,{passwords:i,isLoading:n,isDecrypting:l,loadPasswords:d,refreshPasswordsFromBackend:c,startBackgroun
1dRefresh:x,addPassword:p}=Y(),{decryptedKey:h}=X(),{user:m}=H(),{safes:u}=G(),g=e(),f=s(g.breakpoints.down("sm")),b=L.useRef(!1),y=L.useRef(!1),j=L.useRef(null),w=L.useRef({x:0,y:0}),k="/towercheck"!==o,{isOpen:v,openModal:I,closeModal:C}=_();L.useEffect(()=>{if(!k)return()=>{};const e=j.current;if(!e)return()=>{};const s=e=>{const s=e.touches[0];w.current={x:s.clientX,y:s.clientY}},a=e=>{const s=e.changedTouches[0],a=s.clientX-w.current.x,t=Math.abs(s.clientY-w.current.y);a>80&&t<60&&r("/towercheck",{replace:!0})};return e.addEventListener("touchstart",s,{passive:!0}),e.addEventListener("touchend",a,{passive:!0}),()=>{e.removeEventListener("touchstart",s),e.removeEventListener("touchend",a)}},[k,r]);const S="expired"===m?.plan?.status||m?.plan?.endDate&&new Date(m?.plan?.endDate)<=new Date&&("cancelled"===m?.plan?.status||"14-day-trial"===m?.plan?.id)||m?.plan?.status&&["past_due","unpaid","incomplete","incomplete_expired","paused"].includes(m?.plan?.status?.toLowerCase()),[W,P]=L.useState(!1),[z,E]=L.useState(null),[R,A]=L.useState(!1),[D,$]=L.useState(null),[T,O]=L.useState({}),M=L.useCallback(e=>{e&&(S?le.error("Your plan has expired. Please upgrade to edit items."):(E(e),P(!0)))},[S]),N=L.useCallback(e=>{e&&($(e),A(!0))},[]),q=L.useCallback(()=>{P(!1),E(null)},[]),U=L.useCallback(()=>{A(!1),$(null),O({})},[]),se=L.useCallback(e=>{const s=u?.find(s=>s.id===e);return s?.safeName||""},[u]),ae=L.useCallback(()=>{if(!D)return;const e=D;A(!1),$(null),O({}),E(e),P(!0)},[D]),te=L.useCallback(()=>{},[]),re=L.useCallback(async()=>{h&&await c("All Safes",h)},[h,c]),oe=L.useCallback(async(e,s,a=!1)=>{s&&p({...s,isTemporary:!1}),a||(P(!1),E(null),h&&await c("All Safes",h))},[p,h,c]);return L.useEffect(()=>{m?._id&&h&&(b.current||n||l||Array.isArray(i)&&0!==i.length||(b.current=!0,d("All Safes",h)),y.current||"function"!=typeof x||(y.current=!0,x("All Safes",h)))},[m,h,n,l,i,d,x]),k&&S?a.jsx(K,{to:"/settings?tab=plan&modal=upgrade-plan",replace:!0}):a.jsx(ge.Provider,{value:M,children:a.jsx(be.Provider,{value:N,children:a.jsx(V,{onRefresh:re,scrollableContainerRef:j,children:a.jsxs(a.Fragment,{children:[a.jsxs(t,{ref:j,sx:{p:{xs:1,sm:0},mt:{xs:"40px",sm:0},height:{sm:"100dvh"},overflowY:"auto",overflowX:"hidden",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain",position:"relative","@media (max-width: 599px)":{height:"calc(100vh - 40px - 64px - env(safe-area-inset-bottom))",minHeight:"calc(100vh - 40px - 64px - env(safe-area-inset-bottom))",maxHeight:"calc(100vh - 40px - 64px - env(safe-area-inset-bottom))",paddingBottom:"calc(16px + env(safe-area-inset-bottom))","@supports not (height: calc(100vh - 40px - 64px - env(safe-area-inset-bottom)))":{height:"calc(100vh - 104px)",minHeight:"calc(100vh - 104px)",maxHeight:"calc(100vh - 104px)",paddingBottom:"16px"},"@media (display-mode: standalone)":{height:"calc(100vh - 40px - 64px - env(safe-area-inset-bottom) - env(safe-area-inset-top))",minHeight:"calc(100vh - 40px - 64px - env(safe-area-inset-bottom) - env(safe-area-inset-top))",maxHeight:"calc(100vh - 40px - 64px - env(safe-area-inset-bottom) - env(safe-area-inset-top))",paddingBottom:"calc(24px + env(safe-area-inset-bottom))"}}},children:["14-day-trial"===m?.plan?.id&&a.jsx(t,{sx:{maxWidth:880,mx:"auto",px:1,pb:1,"& > div":{mt:0}},children:a.jsx(J,{user:m,onUpgradeClick:()=>I(!0),isMobile:f})}),m?.plan?.status&&"active"!==m.plan.status.toLowerCase()&&"14-day-trial"!==m?.plan?.id&&a.jsx(t,{sx:{maxWidth:880,mx:"auto",px:1,pb:1},children:a.jsx(J,{user:m,onUpgradeClick:()=>I(!0),isMobile:f})}),o.startsWith("/towercheck/expiring")?a.jsx(ue,{}):o.startsWith("/towercheck/weak")?a.jsx(je,{}):o.startsWith("/towercheck/reused")?a.jsx(we,{}):o.startsWith("/towercheck/duplicates")?a.jsx(ke,{}):o.startsWith("/towercheck/old")?a.jsx(Ie,{}):a.jsx(me,{})]}),a.jsx(Q,{open:v,onClose:C,currentPlanId:m?.plan?.id,currentPlanBillingCycle:m?.plan?.billingCycle}),a.jsx(Z,{open:W&&!S,onClose:q,onSave:oe,safes:u,user:m,userId:m?._id,passwords:i,decryptedKey:h,isMobile:f,selectedSafe:z?.safe||"Personal",initialData:z?{...z,isTemporary:!1}:{},isPlanExpired:S},W?`towercheck-edit-${z?.passwordId}`:"closed"),a.jsx(ee,{open:R,onClose:U,password:D,onEdit:ae,onDelete:te,onToggleFavorite:te,onShare:te,onScanText:te,visiblePasswords:T,setVisiblePasswords:O,getSafeNameById:se,onPreviewAttachment:te,onDownloadAttachment:te,isMobile:f})]})})})})};export{Ce as default};

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.