PageSourceSearch

https://uploadtourl.com/static/js/398.8556a44e.chunk.js

js uploadtourl.com collected 2026-10-05 02:39:29 UTC 26,020 bytes, 2 lines download raw bytes

1"use strict";(globalThis.webpackChunkfrontend=globalThis.webpackChunkfrontend||[]).push([[398],{2464(e,s,t){t.d(s,{A:()=>$});var a=t(5043),r=t(5847),d=t(3866),l=t(4107),o=t(4379),n=t(5731),i=t(6376),c=t(2626),x=t(8306),m=t(797),u=t(8326),p=t(9463),h=t(3390),f=t(9766),b=t(1002),g=t(6328),N=t(2024),j=t(579);const v=`${{NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_CLERK_PUBLISHABLE_KEY:"pk_live_Y2xlcmsudXBsb2FkdG91cmwuY29tJA"}.REACT_APP_BACKEND_URL||""}/api`,w="idle",y="uploading",k="success";function A(){const{getToken:e}=(0,d.As)(),{userData:s}=(0,l.J)(),[t,r]=(0,a.useState)(w),[o,n]=(0,a.useState)(""),[i,c]=(0,a.useState)(!1),x=(0,a.useRef)(null),u=(0,a.useCallback)(async t=>{r(y),n(t.name);try{let d=((null===s||void 0===s?void 0:s.api_keys)||[]).find(e=>e.is_active);if(!d){var a;const s=await e(),t=await fetch(`${v}/dashboard`,{headers:{Authorization:`Bearer ${s}`}});if(!t.ok)throw new Error("Failed to fetch account data.");d=((null===(a=(await t.json()).user)||void 0===a?void 0:a.api_keys)||[]).find(e=>e.is_active)}if(!d)throw new Error("No active API key found. Generate one from Overview.");const l=new FormData;l.append("file",t),l.append("expiry_days","1"),l.append("source","dashboard-sidebar");const o=await fetch(`${v}/upload`,{method:"POST",headers:{"x-api-key":d.key},body:l});if(!o.ok){const e=await o.json().catch(()=>({}));throw new Error(e.detail||`Upload failed (${o.status})`)}const n=await o.json();await navigator.clipboard.writeText(n.url),g.oR.success("Uploaded! URL copied to clipboard",{description:n.url}),r(k)}catch(d){return g.oR.error(d.message||"Upload failed"),r(w),void n("")}setTimeout(()=>{r(w),n("")},2500)},[e,s]),p=(0,a.useCallback)(e=>{e.preventDefault(),c(!0)},[]),h=(0,a.useCallback)(e=>{e.preventDefault(),c(!1)},[]),f=(0,a.useCallback)(e=>{var s;e.preventDefault(),c(!1);const a=null===(s=e.dataTransfer.files)||void 0===s?void 0:s[0];a&&t===w&&u(a)},[t,u]);return(0,j.jsxs)("div",{className:"bg-[#1D202C] rounded-[14px] p-4","data-testid":"sidebar-quick-upload",children:[(0,j.jsx)("p",{className:"text-[12.5px] font-bold text-white mb-1",children:"Quick Upload"}),(0,j.jsx)("p",{className:"text-[11.5px] text-[#9497A1] mb-3 leading-relaxed",children:"Drop a file without leaving this menu."}),(0,j.jsx)("input",{ref:x,type:"file",className:"hidden",onChange:e=>{var s;const t=null===(s=e.target.files)||void 0===s?void 0:s[0];t&&u(t),e.target.value=""},"data-testid":"sidebar-quick-upload-input"}),(0,j.jsx)("button",{onClick:()=>{var e;return t===w&&(null===(e=x.current)||void 0===e?void 0:e.click())},onDragOver:p,onDragLeave:h,onDrop:f,disabled:t!==w,className:`w-full border-[1.5px] border-dashed rounded-[10px] py-4 px-2 text-center transition-colors ${i?"border-brand bg-brand/10":"border-[#3A3D4C] hover:border-brand/60"} ${t!==w?"cursor-default":"cursor-pointer"}`,children:t===y?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(N.A,{className:"w-4 h-4 text-brand animate-spin mx-auto mb-1.5"}),(0,j.jsx)("p",{className:"text-[11.5px] text-[#9497A1] truncate px-2",children:o})]}):t===k?(0,j.jsx)("p",{className:"text-[11.5px] text-success font-bold",children:"Copied to clipboard!"}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(m.A,{className:"w-4 h-4 text-brand mx-auto mb-1.5"}),(0,j.jsx)("p",{className:"text-[11.5px] text-brand font-bold",children:"Click or drop file"})]})})]})}const C=[{name:"Overview",icon:o.A,path:"/dashboard"},{name:"Custom Domain",icon:n.A,path:"/dashboard/custom-domain",proOnly:!0},{name:"Billing",icon:i.A,path:"/billing"},{name:"API Docs",icon:c.A,path:"/dashboard/api-docs"},{name:"Integrations",icon:x.A,path:"/dashboard/integrations"}];function _(e){var s;let{collapsed:t,setCollapsed:a}=e;const{openUserProfile:o}=(0,d.ho)(),{userData:n}=(0,l.J)(),i=(null===n||void 0===n||null===(s=n.user)||void 0===s?void 0:s.plan)||(null===n||void 0===n?void 0:n.plan)||"free",c=["pro","business"].includes(i);return(0,j.jsxs)("aside",{className:(0,f.cn)("fixed left-0 top-0 h-screen bg-[#14161F] border-r border-white/10 transition-all duration-300 z-50 flex flex-col overflow-y-auto overflow-x-hidden",t?"w-20":"w-64"),children:[(0,j.jsxs)("div",{className:"p-6 flex items-center gap-3",children:[(0,j.jsxs)(r.N_,{to:"/",className:"flex items-center gap-3 hover:opacity-80 transition-opacity shrink-0",children:[(0,j.jsx)("div",{className:"w-9 h-9 rounded-[10px] bg-gradient-to-br from-brand-from to-brand-to flex items-center justify-center shadow-glow shrink-0",children:(0,j.jsx)(m.A,{className:"w-4 h-4 text-white"})}),!t&&(0,j.jsx)("span",{className:"text-[15.5px] font-extrabold text-white whitespace-nowrap",children:"Upload to URL"})]}),(0,j.jsx)("div",{className:(0,f.cn)("ml-auto",t&&"hidden"),children:(0,j.jsx)(b.U,{})})]}),!t&&(0,j.jsx)("div",{className:"text-[10.5px] font-bold tracking-wider text-[#6C6F7C] px-6 pb-2",children:"MENU"}),(0,j.jsx)("nav",{className:"flex-1 px-3 py-1 space-y-1",children:C.map(e=>(0,j.jsxs)(r.k2,{to:e.path,end:"/dashboard"===e.path,className:e=>{let{isActive:s}=e;return(0,f.cn)("flex items-center gap-3 px-3 py-2.5 rounded-[10px] transition-all group text-[13.5px] font-semibold",s?"bg-brand text-white shadow-glow":"text-[#B7B9C4] hover:text-white hover:bg-white/5")},children:[(0,j.jsx)(e.icon,{className:(0,f.cn)("w-4 h-4 shrink-0",t&&"mx-auto")}),!t&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("span",{children:e.name}),e.proOnly&&!c&&(0,j.jsx)("span",{className:"ml-auto text-[9px] font-extrabold tracking-wider px-1.5 py-0.5 rounded bg-brand/20 text-brand border border-brand/30",children:"PRO"})]})]},e.path))}),!t&&(0,j.jsx)("div",{className:"px-3 pb-3",children:(0,j.jsx)(A,{})}),(0,j.jsxs)("div",{className:"p-4 border-t border-white/10",children:[(0,j.jsxs)("div",{className:(0,f.cn)("flex items-center gap-3 px-2 py-2",t&&"justify-center"),children:[(0,j.jsx)(d.uF,{afterSignOutUrl:"/"}),!t&&(0,j.jsxs)("div",{className:"flex flex-col min-w-0 cursor-pointer group",onClick:()=>o(),children:[(0,j.jsx)("span",{className:"text-[12.5px] font-bold text-white truncate group-hover:text-white/80 transition-colors",children:"Account"}),(0,j.jsx)("span",{className:"text-[11px] text-[#6C6F7C] truncate group-hover:text-[#9497A1] transition-colors",children:"Settings"})]})]}),t&&(0,j.jsx)("div",{className:"flex justify-center mt-2",children:(0,j.jsx)(b.U,{})}),(0,j.jsxs)(h.$,{variant:"ghost",size:"sm",onClick:()=>a(!t),className:"w-full mt-4 text-[#6C6F7C] hover:text-white hover:bg-white/5 flex items-center justify-center transition-colors",children:[t?(0,j.jsx)(u.A,{className:"w-4 h-4"}):(0,j.jsx)(p.A,{className:"w-4 h-4 mr-2"}),!t&&"Collapse"]})]})]})}var R=t(614),S=t(2983);function $(e){let{children:s}=e;const[t,r]=(0,a.useState)(!1),[d,l]=(0,a.useState)(!1);return(0,j.jsxs)("div",{className:"min-h-screen bg-background flex",children:[(0,j.jsx)("div",{className:"hidden md:block",children:(0,j.jsx)(_,{collapsed:t,setCollapsed:r})}),d&&(0,j.jsx)("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[60] md:hidden",onClick:()=>l(!1)}),(0,j.jsxs)("div",{className:(0,f.cn)("fixed inset-y-0 left-0 w-64 bg-[#14161F] z-[70] transition-transform duration-300 transform md:hidden",d?"translate-x-0":"-translate-x-full"),children:[(0,j.jsx)(_,{collapsed:!1,setCollapsed:()=>l(!1)}),(0,j.jsx)(h.$,{variant:"ghost",size:"icon",className:"absolute top-4 right-4 text-[#B7B9C4] hover:text-white hover:bg-white/10",onClick:()=>l(!1),children:(0,j.jsx)(R.A,{className:"w-6 h-6"})})]}),(0,j.jsxs)("div",{className:(0,f.cn)("flex-1 min-w-0 flex flex-col transition-all duration-300",t?"md:pl-20":"md:pl-64"),children:[(0,j.jsxs)("header",{className:"md:hidden flex items-center justify-between p-4 border-b border-border bg-card/90 backdrop-blur-md sticky top-0 z-40",children:[(0,j.jsxs)("div",{className:"flex items-center gap-3",children:[(0,j.jsx)("div",{className:"w-9 h-9 rounded-[10px] bg-gradient-to-br from-brand-from to-brand-to flex items-center justify-center shadow-glow",children:(0,j.jsx)(m.A,{className:"w-4 h-4 text-white"})}),(0,j.jsx)("span",{className:"font-extrabold text-foreground tracking-tight text-lg",children:"Upload to URL"})]}),(0,j.jsxs)("div",{className:"flex items-center gap-2",children:[(0,j.jsx)(b.U,{}),(0,j.jsx)(h.$,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-foreground hover:bg-accent rounded-xl",onClick:()=>l(!0),children:(0,j.jsx)(S.A,{className:"w-6 h-6"})})]})]}),(0,j.jsx)("main",{className:"flex-1 p-2 md:p-3 lg:p-4 overflow-x-hidden",children:(0,j.jsx)("div",{className:"w-full mx-auto",children:s})})]})]})}},1140(e,s,t){t.d(s,{Zp:()=>l});var a=t(5043),r=t(9766),d=t(579);const l=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,d.jsx)("div",{ref:s,className:(0,r.cn)("rounded-xl border bg-card text-card-foreground shadow",t),...a})});
1l.displayName="Card";a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,d.jsx)("div",{ref:s,className:(0,r.cn)("flex flex-col space-y-1.5 p-6",t),...a})}).displayName="CardHeader";a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,d.jsx)("div",{ref:s,className:(0,r.cn)("font-semibold leading-none tracking-tight",t),...a})}).displayName="CardTitle";a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,d.jsx)("div",{ref:s,className:(0,r.cn)("text-sm text-muted-foreground",t),...a})}).displayName="CardDescription";a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,d.jsx)("div",{ref:s,className:(0,r.cn)("p-6 pt-0",t),...a})}).displayName="CardContent";a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,d.jsx)("div",{ref:s,className:(0,r.cn)("flex items-center p-6 pt-0",t),...a})}).displayName="CardFooter"},398(e,s,t){t.r(s),t.d(s,{default:()=>z});var a=t(5043),r=t(3866),d=t(4107),l=t(5847),o=t(3390),n=t(1140),i=(t(5949),t(5319)),c=t(2464),x=t(735),m=t(6328),u=t(7737),p=t(1360),h=t(9855),f=t(4651),b=t(5087),g=t(2313),N=t(797),j=t(1680),v=t(764),w=t(9463),y=t(8326),k=t(1546),A=t(9766),C=t(579);const _=k.bL,R=(k.l9,k.ZL),S=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,C.jsx)(k.hJ,{className:(0,A.cn)("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",t),...a,ref:s})});S.displayName=k.hJ.displayName;const $=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,C.jsxs)(R,{children:[(0,C.jsx)(S,{}),(0,C.jsx)(k.UC,{ref:s,className:(0,A.cn)("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",t),...a})]})});$.displayName=k.UC.displayName;const D=e=>{let{className:s,...t}=e;return(0,C.jsx)("div",{className:(0,A.cn)("flex flex-col space-y-2 text-center sm:text-left",s),...t})};D.displayName="AlertDialogHeader";const E=e=>{let{className:s,...t}=e;return(0,C.jsx)("div",{className:(0,A.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t})};E.displayName="AlertDialogFooter";const P=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,C.jsx)(k.hE,{ref:s,className:(0,A.cn)("text-lg font-semibold",t),...a})});P.displayName=k.hE.displayName;const F=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,C.jsx)(k.VY,{ref:s,className:(0,A.cn)("text-sm text-muted-foreground",t),...a})});F.displayName=k.VY.displayName;const U=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,C.jsx)(k.rc,{ref:s,className:(0,A.cn)((0,o.r)(),t),...a})});U.displayName=k.rc.displayName;const T=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,C.jsx)(k.ZD,{ref:s,className:(0,A.cn)((0,o.r)({variant:"outline"}),"mt-2 sm:mt-0",t),...a})});T.displayName=k.ZD.displayName;const L=`${{NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_CLERK_PUBLISHABLE_KEY:"pk_live_Y2xlcmsudXBsb2FkdG91cmwuY29tJA"}.REACT_APP_BACKEND_URL||""}/api`;function z(){var e,s,t,k;const{getToken:A}=(0,r.As)(),{userData:R,setUserData:S}=(0,d.J)(),z=(0,l.Zp)(),[O,B]=(0,a.useState)(null),[I,K]=(0,a.useState)(!0),[H,Y]=(0,a.useState)(null),[Z,J]=(0,a.useState)(null),[W,G]=(0,a.useState)(1),[V,q]=(0,a.useState)(null),[M,Q]=(0,a.useState)(new Set);(0,a.useEffect)(()=>{X(1)},[]);const X=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;try{const s=await A(),t=await fetch(`${L}/dashboard?page=${e}&page_size=5`,{headers:{Authorization:`Bearer ${s}`}});if(!t.ok)throw new Error(`Server responded with ${t.status}`);const a=await t.json();B(a),a.user&&S(a.user),q(a.pagination||null),G(e)}catch(s){console.error("Failed to fetch dashboard:",s),m.oR.error("Failed to load dashboard data. Please check your connection and try again.")}finally{K(!1)}},ee=e=>{navigator.clipboard.writeText(e),m.oR.success("Copied to clipboard!")};if(I)return(0,C.jsx)(x.A,{message:"Loading dashboard"});return(0,C.jsxs)(c.A,{children:[(0,C.jsxs)("div",{className:"space-y-6",children:[(0,C.jsx)("div",{className:"bg-gradient-to-br from-[#12141C] to-[#22242F] rounded-2xl p-6 sm:p-8 shadow-elevated",children:(0,C.jsxs)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-6",children:[(0,C.jsxs)("div",{"data-testid":"credits-available-card",children:[(0,C.jsx)("p",{className:"text-xs font-bold uppercase tracking-widest text-[#9497A1] mb-2",children:"Credits Available"}),(0,C.jsx)("p",{className:"text-4xl font-extrabold text-white","data-testid":"credits-available-value",children:(null===O||void 0===O||null===(e=O.user)||void 0===e?void 0:e.credits)||0})]}),(0,C.jsxs)("div",{className:"flex items-center gap-8",children:[(0,C.jsxs)("div",{"data-testid":"credits-used-card",children:[(0,C.jsx)("p",{className:"text-xs font-bold uppercase tracking-widest text-[#9497A1] mb-2 text-right",children:"Credits Used"}),(0,C.jsx)("p",{className:"text-2xl font-extrabold text-white text-right","data-testid":"credits-used-value",children:(null===O||void 0===O||null===(s=O.user)||void 0===s?void 0:s.credits_used)||0})]}),(0,C.jsx)(o.$,{onClick:()=>z("/billing"),className:"bg-brand hover:bg-brand/90 text-brand-foreground rounded-xl px-6 py-5 font-bold shadow-glow transition-all whitespace-nowrap",children:"Upgrade Plan"})]})]})}),(0,C.jsxs)(n.Zp,{className:"bg-card border border-border rounded-2xl p-4 sm:p-8 shadow-soft","data-testid":"api-key-section",children:[(0,C.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[(0,C.jsxs)("div",{className:"flex items-center gap-3",children:[(0,C.jsx)(u.A,{className:"w-5 h-5 text-brand"}),(0,C.jsx)("h2",{className:"text-xl sm:text-2xl font-bold text-foreground",children:"API Keys"})]}),(0,C.jsxs)(o.$,{onClick:async()=>{try{const e=await A();(await fetch(`${L}/api-key/generate`,{method:"POST",headers:{Authorization:`Bearer ${e}`}})).ok&&(m.oR.success("API key generated successfully!"),X(W))}catch(e){console.error("Failed to generate API key:",e),m.oR.error("Failed to generate API key")}},className:"w-full sm:w-auto bg-brand hover:bg-brand/90 text-brand-foreground rounded-xl px-6 font-bold shadow-glow transition-all","data-testid":"generate-api-key-button",children:[(0,C.jsx)(p.A,{className:"w-4 h-4 mr-2"}),"Generate New Key"]})]}),(null===R||void 0===R||null===(t=R.api_keys)||void 0===t?void 0:t.length)>0?(0,C.jsx)("div",{className:"space-y-4",children:R.api_keys.map((e,s)=>e.is_active&&(0,C.jsxs)("div",{className:"bg-muted/60 border border-border rounded-xl p-4 sm:p-6","data-testid":`api-key-${s}`,children:[(0,C.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,C.jsxs)("p",{className:"text-xs sm:text-sm text-muted-foreground font-medium",children:["Created: ",new Date(e.created_at).toLocaleDateString()]}),(0,C.jsxs)(o.$,{onClick:()=>{return s=e.id,void Y(s);var s},variant:"destructive",size:"sm",className:"rounded-lg text-xs sm:text-sm h-8 px-3","data-testid":`revoke-key-${s}`,children:[(0,C.jsx)(h.A,{className:"w-3 h-3 sm:w-4 sm:h-4 mr-1 sm:mr-2"}),"Revoke"]})]}),(0,C.jsxs)("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-3",children:[(0,C.jsxs)("div",{className:"flex-1 bg-background border border-border rounded-lg px-3 sm:px-4 py-2 sm:py-3 flex items-center justify-between overflow-hidden",children:[(0,C.jsx)("code",{className:"text-xs sm:text-sm font-mono truncate text-foreground
1/80 mr-2",children:M.has(e.id||s)?e.key:`\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022${e.key.slice(-4)}`}),(0,C.jsx)(o.$,{onClick:()=>{return t=e.id||s,void Q(e=>{const s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s});var t},variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground flex-shrink-0 h-8 w-8 p-0","data-testid":`toggle-key-${s}`,children:M.has(e.id||s)?(0,C.jsx)(f.A,{className:"w-4 h-4"}):(0,C.jsx)(b.A,{className:"w-4 h-4"})})]}),(0,C.jsxs)(o.$,{onClick:()=>ee(e.key),variant:"outline",className:"w-full sm:w-auto border-border text-foreground hover:bg-accent rounded-lg flex-shrink-0 flex items-center justify-center gap-2 h-10 sm:h-auto","data-testid":`copy-key-${s}`,children:[(0,C.jsx)(g.A,{className:"w-4 h-4"}),(0,C.jsx)("span",{className:"sm:hidden text-sm",children:"Copy Key"})]})]})]},e.id||s))}):(0,C.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,C.jsx)(u.A,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),(0,C.jsx)("p",{children:"No API keys yet. Generate one to start uploading files!"})]})]}),(0,C.jsxs)(n.Zp,{className:"bg-card border border-border rounded-2xl p-4 sm:p-8 shadow-soft","data-testid":"quick-upload-section",children:[(0,C.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-6",children:[(0,C.jsxs)("div",{className:"flex items-center gap-3",children:[(0,C.jsx)(N.A,{className:"w-5 h-5 text-brand"}),(0,C.jsx)("h2",{className:"text-xl sm:text-2xl font-bold text-foreground",children:"Quick Upload"})]}),(0,C.jsx)("span",{className:"hidden sm:inline text-xs font-bold text-success bg-success-bg px-3 py-1 rounded-full",children:"Instant URL on drop"})]}),(0,C.jsx)(i.A,{source:"dashboard"})]}),(0,C.jsxs)(n.Zp,{className:"bg-card border border-border rounded-2xl p-4 sm:p-8 shadow-soft","data-testid":"recent-uploads-section",children:[(0,C.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 sm:gap-4 mb-6",children:[(0,C.jsxs)("div",{className:"flex items-center gap-3",children:[(0,C.jsx)(j.A,{className:"w-5 h-5 text-brand"}),(0,C.jsx)("h2",{className:"text-xl sm:text-2xl font-bold text-foreground",children:"Recent Uploads"})]}),V&&V.total_uploads>0&&(0,C.jsxs)("span",{className:"text-sm text-muted-foreground",children:[V.total_uploads," total upload",1!==V.total_uploads?"s":""]})]}),(null===O||void 0===O||null===(k=O.recent_uploads)||void 0===k?void 0:k.length)>0?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("div",{className:"overflow-x-auto",children:(0,C.jsxs)("table",{className:"w-full",children:[(0,C.jsx)("thead",{className:"border-b border-border",children:(0,C.jsxs)("tr",{children:[(0,C.jsx)("th",{className:"text-left py-3 px-4 text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"File Name"}),(0,C.jsx)("th",{className:"text-left py-3 px-4 text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Size"}),(0,C.jsx)("th",{className:"text-left py-3 px-4 text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Uploaded"}),(0,C.jsx)("th",{className:"text-left py-3 px-4 text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Expires"}),(0,C.jsx)("th",{className:"text-left py-3 px-4 text-xs font-bold text-muted-foreground uppercase tracking-wider",children:"Actions"})]})}),(0,C.jsx)("tbody",{className:"divide-y divide-border",children:O.recent_uploads.map((e,s)=>(0,C.jsxs)("tr",{className:"hover:bg-accent/50","data-testid":`upload-row-${s}`,children:[(0,C.jsx)("td",{className:"py-4 px-4 text-sm text-foreground font-semibold",children:e.filename}),(0,C.jsxs)("td",{className:"py-4 px-4 text-sm text-foreground/80",children:[(e.file_size/1024).toFixed(2)," KB"]}),(0,C.jsx)("td",{className:"py-4 px-4 text-sm text-foreground/80",children:new Date(e.uploaded_at).toLocaleDateString()}),(0,C.jsx)("td",{className:"py-4 px-4 text-sm text-foreground/80",children:e.expires_at?new Date(e.expires_at).toLocaleDateString():(0,C.jsx)("span",{className:"text-success",children:"Never"})}),(0,C.jsx)("td",{className:"py-4 px-4",children:(0,C.jsxs)("div",{className:"flex items-center gap-1",children:[(0,C.jsxs)(o.$,{onClick:()=>ee(e.public_url),variant:"ghost",size:"sm",className:"text-brand hover:bg-brand-tint","data-testid":`copy-url-button-${s}`,children:[(0,C.jsx)(g.A,{className:"w-4 h-4 mr-1.5"}),"Copy URL"]}),(0,C.jsxs)("a",{href:e.public_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-accent transition-colors","data-testid":`open-file-button-${s}`,children:[(0,C.jsx)(v.A,{className:"w-4 h-4"}),"Open"]}),(0,C.jsxs)(o.$,{onClick:()=>J(e.id),variant:"ghost",size:"sm",className:"text-destructive hover:bg-destructive/10","data-testid":`delete-file-button-${s}`,children:[(0,C.jsx)(h.A,{className:"w-4 h-4 mr-1.5"}),"Delete"]})]})})]},e.id||s))})]})}),V&&V.total_pages>1&&(0,C.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mt-6 pt-4 border-t border-border",children:[(0,C.jsxs)("p",{className:"text-sm text-muted-foreground text-center sm:text-left",children:["Page ",V.page," of ",V.total_pages]}),(0,C.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[(0,C.jsxs)(o.$,{variant:"outline",size:"sm",className:"border-border text-foreground hover:bg-accent rounded-lg text-xs sm:text-sm",disabled:W<=1,onClick:()=>X(W-1),"data-testid":"pagination-prev",children:[(0,C.jsx)(w.A,{className:"w-3 h-3 sm:w-4 sm:h-4 sm:mr-1"}),(0,C.jsx)("span",{className:"hidden sm:inline",children:"Previous"}),(0,C.jsx)("span",{className:"sm:hidden",children:"Prev"})]}),Array.from({length:V.total_pages},(e,s)=>s+1).filter(e=>1===e||e===V.total_pages||Math.abs(e-W)<=1).reduce((e,s,t,a)=>(t>0&&s-a[t-1]>1&&e.push("ellipsis-"+s),e.push(s),e),[]).map(e=>"string"===typeof e?(0,C.jsx)("span",{className:"px-1 text-muted-foreground text-xs sm:text-sm",children:"..."},e):(0,C.jsx)(o.$,{variant:e===W?"default":"outline",size:"sm",className:e===W?"bg-brand hover:bg-brand/90 text-brand-foreground rounded-lg min-w-[32px] sm:min-w-[36px] text-xs sm:text-sm":"border-border text-foreground hover:bg-accent rounded-lg min-w-[32px] sm:min-w-[36px] text-xs sm:text-sm",onClick:()=>X(e),"data-testid":`pagination-page-${e}`,children:e},e)),(0,C.jsxs)(o.$,{variant:"outline",size:"sm",className:"border-border text-foreground hover:bg-accent rounded-lg text-xs sm:text-sm",disabled:W>=V.total_pages,onClick:()=>X(W+1),"data-testid":"pagination-next",children:[(0,C.jsx)("span",{className:"hidden sm:inline",children:"Next"}),(0,C.jsx)("span",{className:"sm:hidden",children:"Next"}),(0,C.jsx)(y.A,{className:"w-3 h-3 sm:w-4 sm:h-4 sm:ml-1"})]})]})]})]}):(0,C.jsxs)("div",{className:"text-center py-12 text-muted-foreground","data-testid":"no-uploads-message",children:[(0,C.jsx)(N.A,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),(0,C.jsx)("p",{children:"No uploads yet. Use your API key to start uploading files!"})]})]})]}),(0,C.jsx)(_,{open:!!H,onOpenChange:e=>{e||Y(null)},children:(0,C.jsxs)($,{className:"bg-popover border-border shadow-elevated rounded-2xl",children:[(0,C.jsxs)(D,{children:[(0,C.jsx)(P,{className:"text-foreground",children:"Revoke API Key"}),(0,C.jsx)(F,{className:"text-muted-foreground",children:"Are you sure you want to revoke this API key? Any applications using it will immediately lose access. This action cannot be undone."})]}),(0,C.jsxs)(E,{children:[(0,C.jsx)(T,{className:"border-border text-foreground",children:"Cancel"}),(0,C.jsx)(U,{onClick:async()=>
1{if(H)try{const e=await A();(await fetch(`${L}/api-key/${H}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`}})).ok?(m.oR.success("API key revoked successfully"),X(W)):m.oR.error("Failed to revoke API key")}catch(e){console.error("Failed to revoke API key:",e),m.oR.error("Failed to revoke API key")}finally{Y(null)}},className:"bg-destructive hover:bg-destructive/90 text-destructive-foreground shadow-lg",children:"Revoke Key"})]})]})}),(0,C.jsx)(_,{open:!!Z,onOpenChange:e=>{e||J(null)},children:(0,C.jsxs)($,{className:"bg-popover border-border shadow-elevated rounded-2xl",children:[(0,C.jsxs)(D,{children:[(0,C.jsx)(P,{className:"text-foreground",children:"Delete File"}),(0,C.jsx)(F,{className:"text-muted-foreground",children:"Are you sure you want to delete this file? The file will be permanently removed from storage and its URL will stop working. This action cannot be undone."})]}),(0,C.jsxs)(E,{children:[(0,C.jsx)(T,{className:"border-border text-foreground",children:"Cancel"}),(0,C.jsx)(U,{onClick:async()=>{if(Z)try{const e=await A(),s=await fetch(`${L}/dashboard/file/${Z}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`}});if(s.ok)m.oR.success("File deleted successfully"),X(W);else{const e=await s.json().catch(()=>null);m.oR.error((null===e||void 0===e?void 0:e.detail)||"Failed to delete file")}}catch(e){console.error("Failed to delete file:",e),m.oR.error("Failed to delete file")}finally{J(null)}},className:"bg-destructive hover:bg-destructive/90 text-destructive-foreground shadow-lg",children:"Delete File"})]})]})})]})}}}]);
2//# sourceMappingURL=398.8556a44e.chunk.js.map

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.