1/*! For license information please see 533.a2414bd4.chunk.js.LICENSE.txt */ 2"use strict";(self.webpackChunkmrassistant_frontend=self.webpackChunkmrassistant_frontend||[]).push([[533],{533:(e,t,a)=>{a.r(t),a.d(t,{default:()=>E});var r=a(9950),s=a(960),l=a(5445),n=a(5441),d=a(7091),i=a(2759),o=a(475);var c=a(7871);function x(e){var t;const a=null===e||void 0===e||null===(t=e.response)||void 0===t?void 0:t.data;if(!a||"object"!==typeof a)return!1;return"NO_QUOTA_ALLOCATED"===String(a.error||"").toUpperCase()}var u=a(7637),m=a(2989),g=a(8907),h=a(7334),f=a(998),p=a(3621),y=a(5205),b=a(4414);const w=f.ek.files,v=e=>{let{isOpen:t,onClose:a,busy:s=!1,fileDescription:l,onFileDescriptionChange:n,selectedFile:d,onSelectedFileChange:i,onSubmit:o}=e;const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{!d&&c.current&&(c.current.value="")},[d]),(0,b.jsx)(h.A,{isOpen:t,onClose:a,busy:s,width:"md",title:"Upload file",subtitle:"Add a knowledge file for your assistants",icon:(0,b.jsx)(w,{className:"h-4 w-4","aria-hidden":!0}),titleId:"upload-file-drawer-title",asForm:!0,onSubmit:o,footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("button",{type:"button",onClick:a,disabled:s,className:y.If,children:"Cancel"}),(0,b.jsx)("button",{type:"submit",disabled:s||!d,className:y.QH,children:s?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(m.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),"Uploading\u2026"]}):"Upload file"})]}),children:(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:p.f4,children:[(0,b.jsx)("p",{className:`${p.th} mb-2.5`,children:"File"}),(0,b.jsx)("input",{id:"upload-file-input",type:"file",ref:c,className:"hidden",onChange:e=>{var t;return i((null===(t=e.target.files)||void 0===t?void 0:t[0])||null)},required:!0}),(0,b.jsx)("button",{type:"button",onClick:()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.click()},className:"w-full rounded-lg border border-dashed border-gray-300 bg-white/60 px-3 py-8 transition-colors hover:border-accent/40 hover:bg-gray-50 dark:border-edge dark:bg-surface/40 dark:hover:bg-white/5",children:(0,b.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center",children:[(0,b.jsx)(g.A,{className:"h-8 w-8 text-gray-400 dark:text-gray-500","aria-hidden":!0}),(0,b.jsx)("p",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:d?d.name:"Click to choose a file"}),(0,b.jsx)("p",{className:p.Z6,children:"PDF, TXT, DOCX, and other supported formats"})]})})]}),(0,b.jsxs)("div",{className:p.f4,children:[(0,b.jsx)("p",{className:`${p.th} mb-2.5`,children:"Details"}),(0,b.jsxs)("label",{htmlFor:"upload-file-description",className:p.Q2,children:["Description ",(0,b.jsx)("span",{className:"font-normal text-gray-400",children:"(optional)"})]}),(0,b.jsx)("textarea",{id:"upload-file-description",value:l,onChange:e=>n(e.target.value),rows:3,className:`mt-1 ${p.yV}`,placeholder:"What is this file used for?"})]})]})})};var k=a(4069),j=a(691),N=a(1973),C=a(3365),A=a(9893),F=a(9399);const $=f.ek.files,S=f.RV.upload,L=f.RV.refresh,_=f.RV.search,M=f.RV.download,D=f.RV.delete,T=e=>{switch(e){case"ok":return"bg-green-50 text-green-700 border border-green-200 dark:bg-green-950/40 dark:text-green-300 dark:border-green-900/50";
2case"pending":return"bg-yellow-50 text-yellow-700 border border-yellow-200 dark:bg-yellow-950/40 dark:text-yellow-300 dark:border-yellow-900/50";case"error":return"bg-red-50 text-red-700 border border-red-200 dark:bg-red-950/40 dark:text-red-300 dark:border-red-900/50";case"info":return"bg-blue-50 text-blue-700 border border-blue-200 dark:bg-blue-950/40 dark:text-blue-300 dark:border-blue-900/50";default:return"bg-gray-100 text-gray-700 border border-gray-200 dark:bg-dark-700 dark:text-gray-300 dark:border-dark-600"}},E=()=>{const e=(0,n.jE)(),{data:t,isLoading:a,refetch:m}=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return(0,d.I)({queryKey:i.l.files,queryFn:()=>l.A.listFiles(),enabled:e,...o.P1,staleTime:12e4,gcTime:6e5})}(),g=null!==t&&void 0!==t?t:[],[h,f]=(0,r.useState)(!1),[p,y]=(0,r.useState)(""),[w,E]=(0,r.useState)(null),[U,B]=(0,r.useState)(!1),[R,I]=(0,r.useState)(""),[O,z]=(0,r.useState)("all"),[V,H]=(0,r.useState)(new Set),{toast:q}=(0,c.dj)(),K=()=>{e.invalidateQueries({queryKey:i.l.files})},Q=()=>{y(""),E(null)},W=e=>{const t=e.original_filename||e.filename||"",a=t.lastIndexOf(".");return a>0?t.substring(0,a):t},P=e=>{var t;const a=(null===(t=e.file_type)||void 0===t?void 0:t.toLowerCase())||"";return"pdf"===a?"PDF":["jpg","jpeg","png","gif","svg","webp"].includes(a)?"Image":["mp3","wav","ogg","m4a"].includes(a)?"Audio":["docx","doc","txt","rtf"].includes(a)?"Document":a.toUpperCase()||"File"},Z=e=>{if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return Math.round(e/Math.pow(1024,t)*100)/100+" "+["B","KB","MB","GB"][t]},G=(0,r.useMemo)(()=>{let e=g;if(R.trim()){const t=R.toLowerCase();e=e.filter(e=>{var a;const r=W(e).toLowerCase(),s=(e.original_filename||e.filename||"").toLowerCase(),l=(null===(a=e.file_type)||void 0===a?void 0:a.toLowerCase())||"";return r.includes(t)||s.includes(t)||l.includes(t)})}return"all"!==O&&(e=e.filter(e=>P(e)===O)),e},[g,R,O]),J=(0,r.useMemo)(()=>["all",...Array.from(new Set(g.map(e=>P(e))))],[g]),X=e=>{const t="h-5 w-5",a=e.toLowerCase();return"pdf"===a?(0,b.jsx)("svg",{className:`${t} text-accent dark:text-accent-text`,fill:"currentColor",viewBox:"0 0 24 24",children:(0,b.jsx)("path",{d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}):["jpg","jpeg","png","gif","svg","webp"].includes(a)?(0,b.jsx)("svg",{className:`${t} text-gray-500 dark:text-gray-400`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}):["mp3","wav","ogg","m4a"].includes(a)?(0,b.jsx)("svg",{className:`${t} text-gray-500 dark:text-gray-400`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"})}):(0,b.jsx)(u.A,{className:`${t} text-gray-500 dark:text-gray-400`})};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:C.gI,children:[(0,b.jsx)(N.kR,{title:"Files",description:`Manage uploaded knowledge files \xb7 ${g.length} total${R||"all"!==O?" \xb7 filtered":""}`,badge:(0,b.jsx)("span",{className:"shrink-0 rounded-full bg-gray-200/80 px-2 py-0.5 text-[10px] font-medium tabular-nums text-gray-600 dark:bg-surface-raised dark:text-gray-300",children:a?"\u2026":G.length}),icon:(0,b.jsx)("div",{className:j.ib,children:(0,b.jsx)($,{className:j.$4,"aria-hidden":"true"})}),actions:(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>f(!0),className:"inline-flex items-center gap-1 rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent-hover",children:[(0,b.jsx)(S,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Upload File"})]}),(0,b.jsx)("button",{type:"button",onClick:()=>{m()},className:A.TI,title:"Refresh","aria-label":"Refresh",children:(0,b.jsx)(L,{className:"h-4 w-4 "+(a?"animate-spin":"")})})]})}),(0,b.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col px-3 pb-3 pt-0 sm:px-4 lg:px-6",children:[(0,b.jsxs)("div",{className:F.Au,children:[(0,b.jsx)("div",{className:"flex items-center justify-between gap-2",children:(0,b.jsx)("div",{className:"min-w-0 flex items-center gap-2",children:(0,b.jsx)("h2",{className:`truncate text-sm font-medium ${j.W}`,children:"Library"})})}),(0,b.jsx)("p",{className:"mt-1 line-clamp-1 text-xs text-gray-500 dark:text-gray-400",children:"Search and filter uploaded documents"}),g.length>0&&!a?(0,b.jsxs)("div",{className:"mt-2 grid grid-cols-[minmax(0,1fr)_minmax(8rem,auto)] items-center gap-1.5 sm:gap-2",children:[(0,b.jsxs)("div",{className:"relative min-w-0",children:[(0,b.jsx)(_,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-gray-400","aria-hidden":!0}),(0,b.jsx)("input",{type:"search",value:R,onChange:e=>
2I(e.target.value),placeholder:"Search files\u2026",className:`${F.jB} pl-7`,"aria-label":"Search files"})]}),(0,b.jsx)("select",{value:O,onChange:e=>z(e.target.value),className:F.jB,"aria-label":"Filter by type",children:J.map(e=>(0,b.jsx)("option",{value:e,children:"all"===e?"All types":`${e} Files`},e))})]}):null]}),(0,b.jsx)("div",{className:`${F.Df} flex min-h-0 flex-1 flex-col`,children:a?(0,b.jsx)("div",{className:"px-3 py-4",children:(0,b.jsx)(k.A,{rows:8,cols:6,label:"Loading files"})}):0===g.length?(0,b.jsxs)("div",{className:"px-4 py-16 text-center",children:[(0,b.jsx)("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-full border border-gray-200 bg-gray-50 dark:border-neutral-700 dark:bg-neutral-900",children:(0,b.jsx)($,{className:"h-7 w-7 text-gray-400"})}),(0,b.jsx)("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"No files yet"}),(0,b.jsx)("p",{className:"mx-auto mt-2 max-w-md text-sm text-gray-600 dark:text-gray-400",children:"Upload files to use with your assistants."}),(0,b.jsxs)("button",{type:"button",onClick:()=>f(!0),className:"mt-6 inline-flex items-center justify-center gap-2 rounded-lg bg-accent px-4 py-2 text-sm font-semibold text-white hover:bg-accent-hover",children:[(0,b.jsx)(S,{className:"h-4 w-4"}),"Upload your first file"]})]}):0===G.length?(0,b.jsxs)("div",{className:"px-6 py-16 text-center",children:[(0,b.jsx)(_,{className:"mx-auto h-10 w-10 text-gray-400"}),(0,b.jsx)("h3",{className:"mt-3 text-base font-semibold text-gray-900 dark:text-white",children:"No files found"}),(0,b.jsx)("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:R?`No files match "${R}"`:"No files match the selected filter."}),(0,b.jsx)("button",{type:"button",onClick:()=>{I(""),z("all")},className:"mt-4 text-sm font-medium text-accent hover:underline dark:text-accent-text",children:"Clear filters"})]}):(0,b.jsx)("div",{className:F.IL,children:(0,b.jsxs)("table",{className:"w-full table-fixed text-xs",children:[(0,b.jsxs)("colgroup",{children:[(0,b.jsx)("col",{className:"w-[34%]"}),(0,b.jsx)("col",{className:"w-[12%]"}),(0,b.jsx)("col",{className:"w-[10%]"}),(0,b.jsx)("col",{className:"w-[14%]"}),(0,b.jsx)("col",{className:"w-[16%]"}),(0,b.jsx)("col",{className:"w-[14%]"})]}),(0,b.jsx)("thead",{children:(0,b.jsxs)("tr",{children:[(0,b.jsx)("th",{className:F.BL,children:"Name"}),(0,b.jsx)("th",{className:F.BL,children:"Type"}),(0,b.jsx)("th",{className:F.BL,children:"Size"}),(0,b.jsx)("th",{className:F.BL,children:"Created"}),(0,b.jsx)("th",{className:F.BL,children:"Status"}),(0,b.jsx)("th",{className:`${F.BL} text-right`,children:"Actions"})]})}),(0,b.jsx)("tbody",{className:"divide-y divide-gray-200/80 dark:divide-neutral-700",children:G.map(t=>{return(0,b.jsxs)("tr",{className:"transition-colors hover:bg-gray-50/80 dark:hover:bg-neutral-800/50",children:[(0,b.jsx)("td",{className:"max-w-0 px-3 py-2.5",children:(0,b.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,b.jsx)("span",{className:"shrink-0",children:X(t.file_type)}),(0,b.jsx)("span",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",title:W(t),children:W(t)})]})}),(0,b.jsx)("td",{className:"truncate px-2 py-2.5 text-gray-600 dark:text-gray-400",children:P(t)}),(0,b.jsx)("td",{className:"whitespace-nowrap px-2 py-2.5 tabular-nums text-gray-600 dark:text-gray-400",children:Z(t.file_size||0)}),(0,b.jsx)("td",{className:"whitespace-nowrap px-2 py-2.5 tabular-nums text-gray-600 dark:text-gray-400",children:(a=t.created_at,new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}))}),(0,b.jsx)("td",{className:"px-2 py-2.5",children:(0,b.jsxs)("div",{className:"flex flex-wrap gap-1",children:[t.status&&(0,b.jsx)("span",{className:`rounded-full px-1.5 py-px text-[10px] font-medium capitalize ${T("processed"===t.status||"ready"===t.status?"ok":"processing"===t.status||"pending"===t.status?"pending":"error"===t.status||"failed"===t.status?"error":"muted")}`,children:t.status}),t.sync_status&&(0,b.jsx)("span",{className:`rounded-full px-1.5 py-px text-[10px] font-medium capitalize ${T("synced"===t.sync_status||"active"===t.sync_status?"info":"syncing"===t.sync_status||"pending"===t.sync_status?"pending":"muted")}`,children:"synced"===t.sync_status?"Synced":t.sync_status}),!t.status&&!t.sync_status&&(0,b.jsx)("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:s.V5})]})}),(0,b.jsx)("td",{className:"px-2 py-2.5 text-right",children:(0,b.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,b.jsx)("button",{type:"button",onClick:()=>(async t=>{H(e=>
2new Set(e).add(t));try{await l.A.syncFile(t),q("File synced successfully","success");const a=await l.A.getFile(t);e.setQueryData(i.l.files,e=>(null!==e&&void 0!==e?e:[]).map(e=>e.id===t?a:e))}catch(a){console.error("Failed to sync file:",a),q("Failed to sync file","error")}finally{H(e=>{const a=new Set(e);return a.delete(t),a})}})(t.id),disabled:V.has(t.id),className:A.wJ,title:"Sync file to agent","aria-label":"Sync file to agent",children:(0,b.jsx)(L,{className:"h-3.5 w-3.5 "+(V.has(t.id)?"animate-spin":"")})}),(0,b.jsx)("button",{type:"button",onClick:()=>(async e=>{try{if(e.public_url){let a=e.public_url;if(a.includes("minio:9000")||a.includes("minio:9001"))try{const e=new URL(a).pathname;a=`${window.location.origin}/storage${e}`}catch(t){console.error("Failed to convert MinIO URL:",t)}window.open(a,"_blank")}else{const t=await l.A.downloadFile(e.id);if(t)if(t.startsWith("blob:")){const a=document.createElement("a");a.href=t,a.download=e.original_filename||e.filename,document.body.appendChild(a),a.click(),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(t),100)}else window.open(t,"_blank");else q("Download URL not available","error")}}catch(a){console.error("Failed to download file:",a),q("Failed to download file","error")}})(t),className:A.wJ,title:"Download file","aria-label":"Download file",children:(0,b.jsx)(M,{className:"h-3.5 w-3.5"})}),(0,b.jsx)("button",{type:"button",onClick:()=>(async e=>{if(window.confirm("Are you sure you want to delete this file?"))try{await l.A.deleteFile(e),q("File deleted successfully","success"),K()}catch(t){console.error("Failed to delete file:",t),q("Failed to delete file","error")}})(t.id),className:A.Hq,title:"Delete file","aria-label":"Delete file",children:(0,b.jsx)(D,{className:"h-3.5 w-3.5"})})]})})]},t.id);var a})})]})})})]})]}),(0,b.jsx)(v,{isOpen:h,onClose:()=>{U||(f(!1),Q())},busy:U,fileDescription:p,onFileDescriptionChange:y,selectedFile:w,onSelectedFileChange:E,onSubmit:async e=>{if(e.preventDefault(),!w)return void q("Please select a file to upload","error");const t=new FormData;t.append("file",w),t.append("name",w.name),t.append("description",p),B(!0);try{await l.A.uploadFile(t),q("File uploaded successfully","success"),f(!1),Q(),K()}catch(a){console.error("Failed to upload file:",a);const e=function(e){var t;if(x(e)){var a;const t=null===(a=e.response)||void 0===a?void 0:a.data;return("string"===typeof(null===t||void 0===t?void 0:t.message)?t.message:null)||"Setting up your account\u2026 this usually finishes within a few minutes."}const r=null===e||void 0===e||null===(t=e.response)||void 0===t?void 0:t.data;if(r&&"object"===typeof r){if("string"===typeof r.message&&r.message.trim())return r.message;if("string"===typeof r.detail&&r.detail.trim())return r.detail}return"Failed to upload file"}(a);q(e,"error"),x(a)&&f(!1)}finally{B(!1)}}})]})}},1221:(e,t,a)=>{a.d(t,{CA:()=>f,CL:()=>h,EK:()=>y,G$:()=>o,Jp:()=>m,ML:()=>g,Pi:()=>s,W1:()=>c,bL:()=>l,jS:()=>x,kT:()=>n,p9:()=>d,uE:()=>i,vg:()=>p,zL:()=>u});var r=a(691);const s="overflow-hidden rounded-lg border border-gray-200 bg-white dark:border-edge dark:bg-dark-700",l=`${s} p-4 sm:p-5`,n="text-sm font-semibold text-gray-900 dark:text-white",d="text-xs text-gray-500 dark:text-gray-400",i="w-full px-3 pb-6 pt-3 sm:px-4 lg:px-5",o="w-full px-3 sm:px-4 lg:px-5",c="mb-4 rounded-lg border border-gray-200 bg-white px-3 py-2.5 dark:border-edge dark:bg-dark-700 sm:px-3 sm:py-2.5",x=`${r.oT} bg-gray-50 dark:bg-dark-800`,u=`${r.gl} bg-gray-50 dark:bg-dark-800`,m="inline-flex w-fit gap-0.5 rounded-md border border-gray-200 bg-gray-50 p-0.5 dark:border-edge dark:bg-dark-800",g="rounded px-2.5 py-1 text-[11px] font-medium text-gray-600 transition-colors hover:bg-white dark:text-gray-300 dark:hover:bg-dark-600",h="rounded bg-accent px-2.5 py-1 text-[11px] font-medium text-white shadow-sm dark:bg-accent-text",f="text-lg font-bold tabular-nums leading-none text-gray-900 dark:text-white sm:text-xl",p="text-[10px] font-medium uppercase tracking-wide text-gray-400",y="inline-flex items-center gap-1 text-xs font-semibold text-gray-900 transition-colors hover:text-gray-700 dark:text-gray-100 dark:hover:text-gray-200"},1973:(e,t,a)=>
2{a.d(t,{PP:()=>i,kR:()=>d});a(9950);var r=a(691),s=a(1221),l=a(4414);const n=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return t.filter(Boolean).join(" ")},d=e=>{let{title:t,description:a,badge:d,icon:i,actions:o,metricsStrip:c,embedded:x=!1,wide:u=!1}=e;return(0,l.jsxs)("div",{className:n(!x&&r.gN,x&&"bg-transparent"),children:[(0,l.jsxs)("div",{className:n("mx-auto flex w-full flex-col gap-2.5 py-3 sm:flex-row sm:items-center sm:justify-between",u?s.G$:"max-w-7xl px-4 sm:px-6 lg:px-8"),children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[i?(0,l.jsx)("div",{className:"shrink-0",children:i}):null,(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("h1",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 text-lg leading-tight",children:[(0,l.jsx)("span",{className:r.W,children:t}),d]}),a?(0,l.jsx)("p",{className:"mt-0.5 line-clamp-1 text-xs text-gray-500 dark:text-gray-400",children:a}):null]})]}),o?(0,l.jsx)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:o}):null]}),c]})},i="inline-flex items-center gap-1.5 rounded-lg border border-gray-200 bg-white px-2.5 py-1.5 text-xs font-medium text-gray-700 shadow-sm transition duration-150 hover:border-accent/40 hover:text-gray-900 dark:border-edge dark:bg-surface dark:text-gray-200 dark:hover:border-accent-text/50"},3621:(e,t,a)=>{a.d(t,{HS:()=>m,KK:()=>d,MB:()=>f,MS:()=>y,O0:()=>w,OO:()=>h,Q2:()=>s,Z6:()=>l,aQ:()=>g,f4:()=>o,fF:()=>u,i9:()=>x,k6:()=>p,s1:()=>n,th:()=>c,vM:()=>b,wU:()=>v,yV:()=>i});var r=a(691);const s="text-[11px] font-medium text-gray-600 dark:text-gray-400",l="text-[10px] leading-snug text-gray-500 dark:text-gray-500",n=r.oT,d=r.gl,i="w-full min-w-0 rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs text-gray-900 shadow-sm transition-colors placeholder:text-gray-400 focus:border-accent/40 focus:outline-none focus:ring-1 focus:ring-accent/20 dark:border-edge dark:bg-surface dark:text-gray-100 resize-y",o="rounded-lg border border-gray-200/80 bg-gray-50/50 p-3 dark:border-edge dark:bg-surface/60",c="text-[10px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",x="fixed inset-0 z-40 bg-black/40 backdrop-blur-[1px]",u="flex shrink-0 items-center justify-between gap-2 border-b border-gray-200/80 px-3 py-2.5 dark:border-edge",m="flex shrink-0 items-center justify-end gap-2 border-t border-gray-200/80 bg-gray-50/95 px-3 py-2.5 backdrop-blur-xl dark:border-edge dark:bg-surface-raised/95",g="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-gray-200 bg-white text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-800 dark:border-edge dark:bg-surface dark:hover:bg-white/5 dark:hover:text-gray-200",h="flex items-center justify-between gap-3 rounded-lg border border-gray-200/70 bg-white/80 px-3 py-2 dark:border-edge dark:bg-surface/80",f="flex w-full items-center justify-between gap-2 rounded-lg border px-2.5 py-2 text-left text-xs transition-colors",p="border-accent/50 bg-red-50/80 text-gray-900 dark:border-accent-text/40 dark:bg-red-950/20 dark:text-gray-100",y="border-gray-200/80 bg-white/80 text-gray-900 hover:bg-gray-50 dark:border-edge dark:bg-surface/80 dark:text-gray-100 dark:hover:bg-white/5",b="rounded-lg border border-accent/25 bg-accent/5 px-3 py-2 text-xs text-gray-900 dark:border-accent/35 dark:bg-accent/10 dark:text-gray-100",w="rounded-lg border border-gray-200/80 bg-white px-3 py-2 text-xs text-gray-900 dark:border-edge dark:bg-surface/80 dark:text-gray-100";function v(){const e="fixed inset-y-0 right-0 z-50 flex w-full flex-col border-l border-gray-200/80 bg-white shadow-2xl dark:border-edge dark:bg-surface-raised";return{sm:`${e} max-w-md sm:max-w-sm`,md:`${e} max-w-lg sm:max-w-md`,lg:`${e} max-w-xl sm:max-w-lg`,xl:`${e} max-w-2xl sm:max-w-xl`,"2xl":`${e} max-w-3xl sm:max-w-2xl`}[arguments.length>0&&void 0!==arguments[0]?arguments[0]:"md"]}v("sm")},4069:(e,t,a)=>{a.d(t,{A:()=>l});var r=a(9950),s=a(4414);const l=e=>{let{rows:t=8,cols:a=6,label:l="Loading\u2026",className:n=""}=e;const[d,i]=(0,r.useState)(8);return(0,r.useEffect)(()=>{const e=window.setInterval(()=>{i(e=>e>=90?14:e+6+8*Math.random())},380);return()=>window.clearInterval(e)},[]),(0,s.jsxs)("div",{className:n,role:"status","aria-busy":"true","aria-live":"polite","aria-label":l,children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,s.jsx)("span",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:l}),(0,s.jsxs)("span",{className:"text-[10px] tabular-nums text-gray-400 dark:text-gray-500",children:[Math.round(d),"%"]})]}),(0,s.jsx)("div",{className:"mb-3 h-1 overflow-hidden rounded-full bg-gray-200 dark:bg-dark-600",children:(0,s.jsx)("div",{className:"h-full rounded-full bg-gradient-to-r from-[#ff0000] to-[#ff6b6b] transition-[width] duration-300 ease-out",style:{width:`${d}%`}})}),(0,s.jsx)("table",{className:"w-full text-xs",children:(0,s.jsx)("tbody",{className:"animate-pulse",children:Array.from({length:t}).map((e,t)=>(0,s.jsx)("tr",{className:"border-b border-gray-100 dark:border-gray-800/80",children:Array.from({length:a}).map((e,r)=>(0,s.jsx)("td",{className:"px-2 py-2.5",children:(0,s.jsx)("div",{className:"h-3 rounded bg-gray-200 dark:bg-gray-700",style:{width:r===a-1?"1.75rem":48+(t+r)%4*10+"%"}})},r))},t))})})]})}},5205:(e,t,a)=>{a.d(t,{$O:()=>o,If:()=>d,K_:()=>r,QH:()=>l,VL:()=>i,iW:()=>n});const r=`${a(691).gl} disabled:cursor-not-allowed disabled:opacity-60`,s="inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs transition duration-150 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-dark-700",l=`${s} bg-primary font-semibold text-primary-contrast shadow-sm hover:bg-primary-hover`,n=`${s} bg-accent font-semibold text-white shadow-sm hover:bg-accent-hover`,d=`${s} border border-gray-200 bg-white font-medium text-gray-700 shadow-sm hover:border-accent/40 hover:text-gray-900 dark:border-edge dark:bg-surface dark:text-gray-200 dark:hover:border-accent-text/50`,i=`${s} font-medium text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-white/5 dark:hover:text-gray-100`,o=`${s} border border-red-500/50 bg-transparent font-medium text-red-600 hover:bg-red-600 hover:text-white dark:border-red-400/40 dark:text-red-400 dark:hover:bg-red-600 dark:hover:text-white`},5445:(e,t,a)=>{a.d(t,{A:()=>s});var r=a(1029);const s={listFiles:async e=>{var t,a;const s=e?`/files?agent_id=${encodeURIComponent(e)}`:"/files",l=await r.Ay.get(s,{showErrorToast:!1});return Array.isArray(l.data)?l.data:null!==(t=l.data)&&void 0!==t&&t.files&&Array.isArray(l.data.files)?l.data.files:null!==(a=l.data)&&void 0!==a&&a.results&&Array.isArray(l.data.results)?l.data.results:[]},uploadFile:async(e,t)=>{const a=t?`/files/upload?agent_id=${encodeURIComponent(t)}`:"/files/upload";return(await r.Ay.post(a,e,{headers:{"Content-Type":"multipart/form-data"},showSuccessToast:!0})).data},getFile:async e=>(await r.Ay.get(`/files/${e}`,{showErrorToast:!1})).data,deleteFile:async e=>{await r.Ay.delete(`/files/${e}`,{showSuccessToast:!0})},downloadFile:async e=>{var t,a;const s=await r.Ay.get(`/files/${e}/download`,{responseType:"blob",showErrorToast:!1});if(null!==(t=s.data)&&void 0!==t&&t.download_url||null!==(a=s.data)&&void 0!==a&&a.url)return s.data.download_url||s.data.url;const l=new Blob([s.data]);return URL.createObjectURL(l)},syncFile:async(e,t)=>{const a={};t&&(a.agent_id=t);return(await r.Ay.post(`/files/${e}/sync`,a,{showSuccessToast:!0})).data},getFileStatus:async e=>(await r.Ay.get(`/files/${e}/status`,{showErrorToast:!1})).data,getSyncStatus:async e=>(await r.Ay.get(`/files/${e}/sync-status`,{showErrorToast:!1})).data}},7334:(e,t,a)=>{a.d(t,{A:()=>
2o});var r=a(9950),s=a(6479),l=a(3621),n=a(691),d=a(4414);const i=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return t.filter(Boolean).join(" ")};const o=e=>{let{isOpen:t,onClose:a,title:o,subtitle:c,icon:x,children:u,footer:m,headerActions:g,busy:h=!1,titleId:f="app-drawer-title",asForm:p=!1,onSubmit:y,panelClassName:b,headerIconClassName:w=n.ib,width:v="md"}=e;const k=(0,r.useRef)(null);if(function(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(0,r.useEffect)(()=>{if(!e)return;const r=e=>{"Escape"!==e.key||a||t()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,t,a])}(t,a,h),(0,r.useEffect)(()=>{var e;if(!t)return;const a=document.body.style.overflow;document.body.style.overflow="hidden";const r=k.current,s=r?Array.from(r.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')):[],l=document.activeElement;null===(e=s[0])||void 0===e||e.focus();const n=e=>{if("Tab"!==e.key||0===s.length)return;const t=s[0],a=s[s.length-1];e.shiftKey&&document.activeElement===t?(e.preventDefault(),a.focus()):e.shiftKey||document.activeElement!==a||(e.preventDefault(),t.focus())};return document.addEventListener("keydown",n),()=>{var e;document.body.style.overflow=a,document.removeEventListener("keydown",n),null===l||void 0===l||null===(e=l.focus)||void 0===e||e.call(l)}},[t]),!t)return null;const j=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:u}),m?(0,d.jsx)("div",{className:l.HS,children:m}):null]});return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{type:"button",className:l.i9,"aria-label":"Close drawer",onClick:()=>{h||a()}}),(0,d.jsxs)("aside",{ref:k,className:i((0,l.wU)(v),b),role:"dialog","aria-modal":"true","aria-labelledby":f,children:[(0,d.jsxs)("div",{className:l.fF,children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,d.jsx)("div",{className:i("shrink-0 rounded-lg p-1.5 shadow-sm",w),children:x}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h2",{id:f,className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:o}),c?(0,d.jsx)("p",{className:"truncate text-[11px] text-gray-500 dark:text-gray-400",children:c}):null]})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[g,(0,d.jsx)("button",{type:"button",onClick:a,disabled:h,className:l.aQ,"aria-label":"Close",children:(0,d.jsx)(s.A,{className:"h-4 w-4","aria-hidden":!0})})]})]}),p?(0,d.jsx)("form",{onSubmit:y,className:"flex min-h-0 flex-1 flex-col",children:j}):(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:j})]})]})}},7637:(e,t,a)=>{a.d(t,{A:()=>r});const r=(0,a(6230).A)("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},8907:(e,t,a)=>{a.d(t,{A:()=>r});const r=(0,a(6230).A)("file-up",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]])}}]);
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.