1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7924],{87460:function(e,t,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/repositories/[id]/files",function(){return l(67561)}])},11478:function(e,t,l){"use strict";var a=l(85893),s=l(86897),r=l(98795);t.Z=e=>{let{className:t}=e;return(0,a.jsx)(s.Z,{className:(0,r.AK)(t,"transform rotate-180")})}},78167:function(e,t,l){"use strict";var a=l(85893),s=l(98795);let BasicLayout=e=>{let{children:t,className:l=null}=e;return(0,a.jsx)("div",{className:(0,s.AK)("min-w-full box-border focus:outline-none",l),children:t})};BasicLayout.Content=e=>{let{children:t,className:l=null}=e;return(0,a.jsx)("div",{className:(0,s.AK)(l,"w-full max-w-screen-2xl mx-auto"),children:t})},t.Z=BasicLayout},76433:function(e,t,l){"use strict";l.d(t,{Jv:function(){return supportsExtraction},SH:function(){return isAllowedUpload},Vt:function(){return allowedExtensionsLabel},wO:function(){return a}});let a=["pdf","doc","docx","pptx","xls","xlsx","txt","html","htm"],s=["application/vnd.ms-excel.sheet.macroenabled.12"];function isAllowedUpload(e,t){var l;let r=null==t?void 0:t.trim().toLowerCase();return!(r&&s.includes(r))&&a.includes((null===(l=e.split(".").pop())||void 0===l?void 0:l.toLowerCase())||"")}function allowedExtensionsLabel(){return a.map(e=>e.toUpperCase()).join(", ")}function supportsExtraction(e){return a.includes(e.toLowerCase())}},67561:function(e,t,l){"use strict";l.r(t),l.d(t,{__N_SSP:function(){return q},default:function(){return RepositoryFilesPage}});var a=l(85893),s=l(67294),r=l(77264),n=l(99784),i=l(20239),o=l(74496),c=l(85716),d=l(86367),u=l(78167),m=l(11163),x=l(68547),p=l(84425),h=l(15073),f=l(48974),g=l(76249),y=l(18499);let v=s.forwardRef(function({title:e,titleId:t,...l},a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},l),e?s.createElement("title",{id:t},e):null,s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM12.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM18.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0z"}))});var b=l(31038);let w=s.forwardRef(function({title:e,titleId:t,...l},a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},l),e?s.createElement("title",{id:t},e):null,s.createElement("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25zm3 10.5a.75.75 0 000-1.5H9a.75.75 0 000 1.5h6z",clipRule:"evenodd"}))}),j=s.forwardRef(function({title:e,titleId:t,...l},a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},l),e?s.createElement("title",{id:t},e):null,s.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z",clipRule:"evenodd"}))});var N=l(33504);let k=s.forwardRef(function({title:e,titleId:t,...l},a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},l),e?s.createElement("title",{id:t},e):null,s.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"}))});var C=l(86215),S=l(11355),F=l(98795),E=l(6377),A=l(75723),M=l(76433),z=l(69122),B=l(49770),R=l(4532);function SyncedBadge(){return(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-700",children:[(0,a.jsx)(h.Z,{className:"h-3 w-3"}),"SharePoint"]})}function ExtractionStatusBadge(e){let{fileType:t,status:l}=e,{t:s}=(0,z.$)();return(0,M.Jv)(t)?"completed"===l?(0,a.jsxs)("span",{title:"AI can search this document",className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800",children:[(0,a.jsx)(j,{className:"h-3 w-3"}),s("AI Ready")]}):"processing"===l?(0,a.jsxs)("span",{title:"AI is analyzing this document",className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:[(0,a.jsx)(N.Z,{className:"h-3 w-3 animate-pulse"}),s("Processing...")]}):"pending"===l?(0,a.jsxs)("span",{title:"Waiting to be processed",className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800",children:[(0,a.jsx)(N.Z,{className:"h-3 w-3"}),s("Queued")]}):"failed"===l?(0,a.jsxs)("span",{title:"Processing failed",className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800",children:[(0,a.jsx)(k,{className:"h-3 w-3"}),s("Error")]}):(0,a.jsxs)("span",{title:"Process to enable AI search",className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-600",children:[(0,a.jsx)(k,{className:"h-3 w-3"}),s("Not Processed")]}):(0,a.jsxs)("span",{title:"This file type can't be processed by AI",className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-600",children:[(0,a.jsx)(w,{className:"h-3 w-3"}),s("Not supported")]})}let Z=(0,s.forwardRef)(function(e,t){let{repositoryId:l,currentPath:r="",onFolderSelect:n,canDelete:i=!1,onFileDeleted:o,className:c}
1=e,[d,u]=(0,s.useState)("date_updated"),[m,h]=(0,s.useState)(null),[j,N]=(0,s.useState)(""),[Z,P]=(0,s.useState)(""),[L,D]=(0,s.useState)(!1),[O,U]=(0,s.useState)(null),[T,H]=(0,s.useState)(""),[_,K]=(0,s.useState)(!1),{t:W,tr:I}=(0,z.$)(),{isLoading:V,error:J,getFoldersForPath:$,getFilesForPath:q,deleteFile:G,deleteFolder:X,renameFolder:Q,deletingFileId:Y,deletingFileIds:ee,deletingFolderPath:et,refresh:el}=function(e){let[t,l]=(0,s.useState)(null),[a,r]=(0,s.useState)(new Set),[n,i]=(0,s.useState)(null),{data:o,error:c,mutate:d,isLoading:u}=(0,B.Z)(e?"/api/repositories/".concat(e,"/tree"):null,F._i),m=(0,s.useMemo)(()=>(function(e){let t=new Map;for(let l of e){let e=(l.folderPath||"").split("/").filter(Boolean),a=(0,M.Jv)(l.fileType),s=a&&"completed"===l.extractionStatus;for(let r=1;r<=e.length;r++){let n=e.slice(0,r).join("/")+"/",i=t.get(n)||{fileCount:0,aiEligibleCount:0,aiProcessedCount:0,hasSyncedFiles:!1};i.fileCount+=1,a&&(i.aiEligibleCount+=1),s&&(i.aiProcessedCount+=1),l.syncSourceId&&(i.hasSyncedFiles=!0),t.set(n,i)}}return t})((null==o?void 0:o.files)||[]),[null==o?void 0:o.files]),x=(0,s.useCallback)(e=>{if(!(null==o?void 0:o.folders))return[];let t=e||"",l=""===t?0:t.split("/").filter(Boolean).length;return o.folders.filter(e=>{var a,s;let r=e.path.split("/").filter(Boolean);return r.length===l+1&&(!t||!!e.path.startsWith(t))&&(null!==(s=null===(a=m.get(e.path))||void 0===a?void 0:a.fileCount)&&void 0!==s?s:0)>0}).map(e=>({...e,...m.get(e.path)})).sort((e,t)=>e.name.localeCompare(t.name))},[null==o?void 0:o.folders,m]),p=(0,s.useCallback)(e=>{if(!(null==o?void 0:o.files))return[];let t=e||"";return o.files.filter(e=>e.folderPath===t)},[null==o?void 0:o.files]),h=(0,s.useCallback)(async e=>{l(e),r(t=>new Set(t).add(e));try{let t=await fetch("/api/files/".concat(e),{method:"DELETE"});if(t.ok)return d(t=>t?{...t,files:t.files.filter(t=>t.id!==e)}:t,!1),!0;return!1}catch(e){return!1}finally{l(null),r(t=>{let l=new Set(t);return l.delete(e),l})}},[d]),f=(0,s.useCallback)(async t=>{i(t);try{let l=await fetch("/api/repositories/".concat(e,"/folders?path=").concat(encodeURIComponent(t)),{method:"DELETE"});if(l.ok)return d(e=>e?{folders:e.folders.filter(e=>!e.path.startsWith(t)),files:e.files.filter(e=>!e.folderPath.startsWith(t))}:e,!1),!0;return!1}catch(e){return!1}finally{i(null)}},[e,d]),g=(0,s.useCallback)(async(t,l)=>{try{let a=await fetch("/api/repositories/".concat(e,"/folders"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:t,newPath:l})});if(a.ok)return await d(),!0;return!1}catch(e){return!1}},[e,d]),y=(0,s.useCallback)(async()=>{await d()},[d]);return{isLoading:u,error:c?"Failed to load file tree":null,getFoldersForPath:x,getFilesForPath:p,deleteFile:h,deleteFolder:f,renameFolder:g,deletingFileId:t,deletingFileIds:a,deletingFolderPath:n,refresh:y}}(l),ea=(0,s.useMemo)(()=>$(r),[$,r]),es=(0,s.useMemo)(()=>q(r),[q,r]),er=(0,s.useMemo)(()=>{let e=[...es];switch(d){case"title_asc":e.sort((e,t)=>e.name.localeCompare(t.name));break;case"title_desc":e.sort((e,t)=>t.name.localeCompare(e.name));break;default:e.sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime())}return e},[es,d]);(0,s.useImperativeHandle)(t,()=>({refresh:el}),[el]),(0,s.useEffect)(()=>{if(r&&!V&&0===ea.length&&0===es.length){let e=r.split("/").filter(Boolean);e.pop();let t=e.length>0?e.join("/")+"/":"";null==n||n(t)}},[r,ea.length,es.length,V,n]);let navigateToFolder=e=>{n&&n(e)},handleDelete=async(e,t)=>{if(e.preventDefault(),e.stopPropagation(),!confirm('Are you sure you want to delete "'.concat(t.name,'"? This action cannot be undone.')))return;let l=await G(t.id);l?null==o||o(t.id):alert("Failed to delete file")},handleDeleteFolder=async(e,t)=>{if(e.preventDefault(),e.stopPropagation(),!confirm('Are you sure you want to delete folder "'.concat(t.name,'" and ALL its contents? This action cannot be undone.')))return;let l=await X(t.path);l||alert("Failed to delete folder")},startRename=(e,t)=>{e.preventDefault(),e.stopPropagation(),U(t),H(t.name)},cancelRename=()=>{U(null),H("")},handleRename=async()=>
1{if(!O)return;let e=T.replace(/\//g,"").trim();if(!e||e===O.name){cancelRename();return}let t=O.path.split("/").filter(Boolean);t[t.length-1]=e;let l=t.join("/")+"/";K(!0);try{let e=await Q(O.path,l);e||alert(W("Failed to rename folder"))}finally{K(!1),cancelRename()}},openMoveModal=(e,t)=>{e.preventDefault(),e.stopPropagation(),h(t),N(""),P("")},navigateMoveFolder=e=>{N(e),P("")},handleMove=async()=>{if(!m)return;let e=Z.replace(/^\/+|\/+$/g,"").trim(),t=e?(j||"")+e+"/":j;D(!0);try{let e=await fetch("/api/files/".concat(m.id),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderPath:t})});if(e.ok)h(null),await el();else{let t=await e.json();alert(t.error||"Failed to move file")}}catch(e){alert("Failed to move file")}finally{D(!1)}},en=r.split("/").filter(Boolean);return(0,a.jsxs)("div",{className:(0,F.AK)("border rounded-lg",c),children:[(0,a.jsxs)("div",{className:"bg-white px-4 py-2 border-b flex items-center justify-between rounded-t-lg relative z-10",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1 text-sm",children:[(0,a.jsx)("button",{onClick:()=>navigateToFolder(""),className:(0,F.AK)("hover:text-blue-600",""===r?"font-medium text-gray-900":"text-gray-500"),children:"Files"}),en.length<=3?en.map((e,t)=>{let l=en.slice(0,t+1).join("/")+"/",r=t===en.length-1;return(0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(b.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)("button",{onClick:()=>navigateToFolder(l),className:(0,F.AK)("hover:text-blue-600",r?"font-medium text-gray-900":"text-gray-500"),children:e})]},l)}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)("button",{onClick:()=>navigateToFolder(en[0]+"/"),className:"text-gray-500 hover:text-blue-600",children:en[0]}),(0,a.jsx)(b.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsxs)(C.J,{className:"relative",children:[(0,a.jsx)(C.J.Button,{className:"text-gray-500 hover:text-blue-600 flex items-center",children:(0,a.jsx)(v,{className:"h-5 w-5"})}),(0,a.jsx)(S.u,{as:s.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,a.jsx)(C.J.Panel,{className:"absolute left-0 mt-2 w-56 z-50 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 py-1 max-h-60 overflow-y-auto",children:e=>{let{close:t}=e;return(0,a.jsx)(a.Fragment,{children:en.slice(1,-2).map((e,l)=>{let s=en.slice(0,l+2).join("/")+"/";return(0,a.jsxs)("button",{onClick:()=>{navigateToFolder(s),t()},className:"flex items-center gap-2 w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 text-left",children:[(0,a.jsx)(x.Z,{className:"h-4 w-4 text-gray-400 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e})]},s)})})}})})]}),en.slice(-2).map((e,t)=>{let l=en.length-2+t,r=en.slice(0,l+1).join("/")+"/";return(0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(b.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)("button",{onClick:()=>navigateToFolder(r),className:(0,F.AK)("hover:text-blue-600",1===t?"font-medium text-gray-900":"text-gray-500"),children:e})]},r)})]})]}),(0,a.jsx)(A.Z,{options:[{id:"date_updated",description:"Date Updated"},{id:"title_asc",description:"Name (a-z)"},{id:"title_desc",description:"Name (z-a)"}],OnOptionSelected:e=>u(e),optionSelected:d})]}),(0,a.jsx)("div",{className:"divide-y bg-white overflow-hidden rounded-b-lg",children:V?(0,a.jsx)("div",{className:"flex justify-center py-8",children:(0,a.jsx)(R.Z,{className:"h-8 w-8 text-alphacast"})}):J?(0,a.jsx)("div",{className:"px-4 py-8 text-center text-red-500",children:J}):0===ea.length&&0===es.length?(0,a.jsxs)("div",{className:"px-4 py-8 text-center text-gray-500",children:[(0,a.jsx)(x.Z,{className:"h-12 w-12 mx-auto text-gray-300 mb-2"}),(0,a.jsx)("p",{children:"This folder is empty"})]}):(0,a.jsxs)(a.Fragment,{children:[r&&(0,a.jsxs)("button",{onClick:()=>{if(!r)return;let e=r.split("/").filter(Boolean);e.pop();let t=e.length>0?e.join("/")+"/":"";navigateToFolder(t)},className:"w-full px-4 py-2 flex items-center gap-3 hover:bg-gray-50 text-left",children:[(0,a.jsx)(x.Z,{className:"h8 w-8 text-gray-400"}),(0,a.jsx)("span",{className:"text-sm text-gray-600",children:".."})]}),ea.map(e=>{let t=et===e.path,l=e.hasSyncedFiles;return(0,a.jsxs)("div",{className:(0,F.AK)("w-full px-4 py-3 flex items-start gap-3 group transition-opacity duration-200",t?"opacity-50 bg-gray-50":"hover:bg-gray-50"),children:[(0,a.jsxs)("button",{onClick:()=>navigateToFolder(e.path),className:"flex items-start gap-3 flex-1 min-w-0 text-left disabled:cursor-not-allowed",disabled:t,children:[(0,a.jsx)(p.Z,{className:"h-8 w-8 text-yellow-500 flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(null==O?void 0:O.path)===e.path?(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("input",{type:"text",value:T,onChange:e=>H(e.target.value),onKeyDown:e=>{"Enter"===e.key&&handleRename(),"Escape"===e.key&&cancelRename()},onBlur:()=>{_||cancelRename()},onClick:e=>e.stopPropagation(),autoFocus:!0,disabled:_,className:"text-base font-medium text-gray-900 border border-blue-500 rounded px-1 py-0 focus:outline-none focus:ring-1 focus:ring-blue-500 min-w-0 disabled:opacity-50"}),_&&(0,a.jsxs)("svg",{className:"animate-spin h-4 w-4 text-blue-500 flex-shrink-0",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})]}):(0,a.jsx)("p",{className:"text-base font-medium text-gray-900 hover:text-gray-700 truncate",children:e.name}),l&&(0,a.jsx)(SyncedBadge,{})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1 text-xs text-gray-500",children:[(0,a.jsx)("span",{children:"FOLDER"}),(0,a.jsx)("span",{children:"â¢"}),(0,a.jsxs)("span",{children:[e.fileCount," file",1!==e.fileCount?"s":""]}),e.aiEligibleCount-e.aiProcessedCount>0&&(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-600",children:[(0,a.jsx)(k,{className:"h-3 w-3"}),I("{0} not processed",[String(e.aiEligibleCount-e.aiProcessedCount)])]}),e.fileCount-e.aiEligibleCount>0&&(0,a.jsxs)("span",{title:"These file types can't be processed by AI",className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-600",children:[(0,a.jsx)(w,{className:"h-3 w-3"}),I("{0} unsupported",[String(e.fileCount-e.aiEligibleCount)])]})]})]})]}),i&&!l&&(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{onClick:t=>startRename(t,e),disabled:t,className:"flex-shrink-0 p-1 text-gray-400 hover:text-blue-600 disabled:opacity-50 disabled:cursor-not-allowed",title:W("Rename folder"),children:(0,a.jsx)(f.Z,{className:"h-5 w-5"})}),(0,a.jsx)("button",{onClick:t=>handleDeleteFolder(t,e),disabled:t,className:"flex-shrink-0 p-1 text-gray-400 hover:text-red-600 disabled:opacity-50 disabled:cursor-not-allowed",title:"Delete folder",children:(0,a.jsx)(g.Z,{className:"h-5 w-5"})})]})]},e.path)}),er.map(e=>{let t=!!e.syncSourceId,l=ee.has(e.id);return(0,a.jsxs)("div",{className:(0,F.AK)("w-full px-4 py-3 flex items-start gap-3 transition-opacity duration-200",l?"opacity-50 bg-gray-50":"hover:bg-gray-50"),children:[(0,a.jsxs)("a",{href:"/files/".concat(e.id),className:(0,F.AK)("flex items-start gap-3 flex-1 min-w-0 text-left",l?"pointer-events-none cursor-not-allowed":""),children:[(0,a.jsx)(y.Z,{className:"h-8 w-8 text-red-600 flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("p",{className:"text-base font-medium text-alphacast hover:text-indigo-500 truncate",children:e.name}),t&&(0,a.jsx)(SyncedBadge,{}),(0,a.jsx)(ExtractionStatusBadge,{fileType:e.fileType,status:e.extractionStatus})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1 text-xs text-gray-500",children:[(0,a.jsx)("span",{children:e.fileType.toUpperCase()}),(0,a.jsx)("span",{children:"â¢"}),(0,a.jsx)("span",{children:function(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(1))+" "+["B","KB","MB","GB"][t]}(e.fileSize)}),(0,a.jsx)("span",{children:"â¢"}),(0,a.jsx)("span",{children:(0,E.rZ)(e.updatedAt)})]})]})]}),i&&!t&&(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{onClick:t=>openMoveModal(t,e),className:"flex-shrink-0 p-1 text-gray-400 hover:text-blue-600",title:W("Move to folder"),children:(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"h-5 w-5",children:[(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}),(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 16.5h4.5m0 0-2.25-2.25M18 16.5l-2.25 2.25"})]})}),(0,a.jsx)("button",{onClick:t=>handleDelete(t,e),disabled:l,className:"flex-shrink-0 p-1 text-gray-400 hover:text-red-600 disabled:opacity-50 disabled:cursor-not-allowed",title:"Delete file",children:(0,a.jsx)(g.Z,{className:"h-5 w-5"})})]})]},e.id)})]})}),m&&(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,a.jsx)("div",{className:"fixed inset-0 bg-black/50",onClick:()=>h(null)}),(0,a.jsxs)("div",{className:"relative bg-white rounded-lg shadow-xl w-full max-w-md mx-4",children:[(0,a.jsx)("div",{className:"px-6 py-4 border-b",children:(0,a.jsxs)("h3",{className:"text-lg font-medium text-gray-900",children:[W("Move")," â",m.name,"â"]})}),(0,a.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1 text-sm",children:[(0,a.jsxs)("span",{className:"text-gray-500",children:[W("Destination"),":"]}),(0,a.jsx)("button",{onClick:()=>navigateMoveFolder(""),className:(0,F.AK)("hover:text-blue-600",""===j?"font-medium text-gray-900":"text-gray-500"),children:"/"}
1),j.split("/").filter(Boolean).map((e,t,l)=>{let r=l.slice(0,t+1).join("/")+"/",n=t===l.length-1;return(0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(b.Z,{className:"h-3 w-3 text-gray-400"}),(0,a.jsx)("button",{onClick:()=>navigateMoveFolder(r),className:(0,F.AK)("hover:text-blue-600",n?"font-medium text-gray-900":"text-gray-500"),children:e})]},r)})]}),(0,a.jsxs)("div",{className:"max-h-48 overflow-y-auto border rounded-md divide-y",children:[j&&(0,a.jsxs)("button",{onClick:()=>{let e=j.split("/").filter(Boolean);e.pop();let t=e.length>0?e.join("/")+"/":"";navigateMoveFolder(t)},className:"w-full px-3 py-2 flex items-center gap-2 text-sm text-left hover:bg-gray-50 text-gray-500",children:[(0,a.jsx)(x.Z,{className:"h-4 w-4 flex-shrink-0"}),".."]}),$(j).map(e=>(0,a.jsxs)("button",{onClick:()=>navigateMoveFolder(e.path),className:"w-full px-3 py-2 flex items-center gap-2 text-sm text-left hover:bg-gray-50 text-gray-700",children:[(0,a.jsx)(p.Z,{className:"h-4 w-4 text-yellow-500 flex-shrink-0"}),e.name,(0,a.jsx)(b.Z,{className:"h-3 w-3 text-gray-400 ml-auto"})]},e.path)),0===$(j).length&&(0,a.jsx)("div",{className:"px-3 py-2 text-sm text-gray-400 italic",children:W("No subfolders")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm text-gray-600",children:W("Or type a new folder:")}),(0,a.jsx)("input",{type:"text",value:Z,onChange:e=>P(e.target.value),placeholder:W("New folder name"),className:"mt-1 w-full text-sm border border-gray-300 rounded-md px-3 py-1.5 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500"})]}),Z.trim()&&(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:[W("Destination"),":"," ",(0,a.jsxs)("span",{className:"font-medium",children:["/",j,Z.replace(/^\/+|\/+$/g,"").trim(),"/"]})]})]}),(0,a.jsxs)("div",{className:"px-6 py-3 border-t flex justify-end gap-3",children:[(0,a.jsx)("button",{onClick:()=>h(null),className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50",children:W("Cancel")}),(0,a.jsx)("button",{onClick:handleMove,disabled:L,className:(0,F.AK)("px-4 py-2 text-sm font-medium text-white rounded-md",L?"bg-blue-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"),children:L?W("Moving..."):W("Move")}
1)]})]})]})]})});var P=l(55162),L=l(11478),D=l(31415);let O=s.forwardRef(function({title:e,titleId:t,...l},a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},l),e?s.createElement("title",{id:t},e):null,s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 10.5v6m3-3H9m4.06-7.19l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"}))}),U=s.forwardRef(function({title:e,titleId:t,...l},a){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},l),e?s.createElement("title",{id:t},e):null,s.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"}))});async function computeFileHash(e){let t=await e.arrayBuffer(),l=await crypto.subtle.digest("SHA-256",t),a=Array.from(new Uint8Array(l));return a.map(e=>e.toString(16).padStart(2,"0")).join("")}async function computeFileHashes(e){if("undefined"==typeof crypto||!crypto.subtle)return null;let t=[];for(let l of e){let e=await computeFileHash(l);t.push(e)}return t}var T=l(95672),H=l(10798);function DuplicateResolutionDialog_formatFileSize(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(1))+" "+["B","KB","MB","GB"][t]}let _={content:"Identical content",name:"Same name",both:"Same name & content"},K={content:"bg-purple-100 text-purple-700",name:"bg-amber-100 text-amber-700",both:"bg-red-100 text-red-700"};function DuplicateResolutionDialog(e){let{open:t,conflicts:l,onResolve:r,onCancel:n}=e,[i,o]=(0,s.useState)(()=>{let e={};for(let t of l)e[t.index]="skip";return e}),setResolution=(e,t)=>{o(l=>({...l,[e]:t}))},setAll=e=>{let t={};for(let a of l)t[a.index]=e;o(t)};return(0,a.jsxs)(T.Z,{open:t,onClose:n,title:"Duplicate Files Detected",className:"sm:max-w-2xl",children:[(0,a.jsxs)(T.Z.Content,{className:"text-left",children:[(0,a.jsxs)("p",{className:"text-sm text-gray-600 mb-4",children:[l.length," file",1!==l.length?"s":""," already exist in this repository. Choose how to handle each one."]}),(0,a.jsxs)("div",{className:"flex gap-2 mb-3",children:[(0,a.jsx)("button",{type:"button",onClick:()=>setAll("overwrite"),className:"text-xs px-2 py-1 rounded border border-gray-300 hover:bg-gray-50 text-gray-700",children:"Overwrite All"}),(0,a.jsx)("button",{type:"button",onClick:()=>setAll("keep_both"),className:"text-xs px-2 py-1 rounded border border-gray-300 hover:bg-gray-50 text-gray-700",children:"Keep All"}),(0,a.jsx)("button",{type:"button",onClick:()=>setAll("skip"),className:"text-xs px-2 py-1 rounded border border-gray-300 hover:bg-gray-50 text-gray-700",children:"Skip All"})]}),(0,a.jsx)("div",{className:"max-h-80 overflow-y-auto border rounded-lg divide-y",children:l.map(e=>(0,a.jsx)("div",{className:"p-3",children:(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2 min-w-0 flex-1",children:[(0,a.jsx)(H.Z,{className:"h-5 w-5 text-gray-400 flex-shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-gray-900 truncate",children:e.newFile.name}),(0,a.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:["New: ",DuplicateResolutionDialog_formatFileSize(e.newFile.size)]}),(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:["Existing: ",e.existingFile.name,e.existingFile.folderPath?" in ".concat(e.existingFile.folderPath):""," ","\xb7 ",DuplicateResolutionDialog_formatFileSize(e.existingFile.fileSize)," \xb7 Updated"," ",function(e){try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch(t){return e}}(e.existingFile.updatedAt)]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,a.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded ".concat(K[e.type]),children:_[e.type]}),(0,a.jsxs)("select",{value:i[e.index],onChange:t=>setResolution(e.index,t.target.value),className:"text-sm border border-gray-300 rounded-md px-2 py-1 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[(0,a.jsx)("option",{value:"skip",children:"Skip"}),(0,a.jsx)("option",{value:"overwrite",children:"Overwrite"}),(0,a.jsx)("option",{value:"keep_both",children:"Keep Both"})]})]})]})},e.index))})]}),(0,a.jsxs)(T.Z.Actions,{children:[(0,a.jsx)("button",{type:"button",onClick:()=>{r(i)},className:"px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700",children:"Continue Upload"}),(0,a.jsx)("button",{type:"button",onClick:n,className:"px-4 py-2 bg-white text-gray-700 text-sm font-medium rounded-md border border-gray-300 hover:bg-gray-50",children:"Cancel"})]})]})}var W=l(81944);let I=M.wO.map(e=>".".concat(e)).join(",");function BulkUploadDropzone_formatFileSize(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(1))+" "+["B","KB","MB","GB"][t]}function BulkUploadDropzone(e){let{repositoryId:t,targetFolderPath:l,onUploadComplete:r,onUploadStateChange:n,maxFiles:i=50,maxFileSize:o=104857600}
1=e,[c,d]=(0,s.useState)(!1),[u,m]=(0,s.useState)([]),[p,h]=(0,s.useState)(!1),[f,g]=(0,s.useState)(!1),[v,b]=(0,s.useState)(null),[w,N]=(0,s.useState)(0),[k,C]=(0,s.useState)(""),[S,E]=(0,s.useState)([]),[A,z]=(0,s.useState)(!1),B=(0,s.useRef)([]),R=(0,s.useRef)([]),Z=(0,s.useCallback)(e=>{let t=e.slice(0,i).filter(e=>e.size<=o).filter(e=>(0,M.SH)(e.name,e.type)).map(e=>({file:e,folderPath:function(e){let t=e.webkitRelativePath||e.path||e.name,l=t.replace(/^\/+/,""),a=l.split("/");return a.length<=1?"":(a.pop(),a.join("/")+"/")}(e),relativePath:e.webkitRelativePath||e.path||e.name}));m(e=>{let l=[...e,...t];return l.slice(0,i)}),b(null)},[i,o]),{getRootProps:T,getInputProps:H,open:_}=(0,P.uI)({onDrop:Z,multiple:!0,noClick:u.length>0,onDragEnter:()=>d(!0),onDragLeave:()=>d(!1),accept:I}),removeFile=e=>{m(t=>t.filter((t,l)=>l!==e))},computeFolderPaths=()=>{let e=k.replace(/^\/+|\/+$/g,"").trim();return u.map(t=>{let a=(l||"")+(e?e+"/":""),s=t.folderPath;return a?s?(a.endsWith("/")?a:a+"/")+s:a.endsWith("/")?a:a+"/":s})},handleUpload=async()=>{if(0!==u.length){g(!0),N(0);try{let e=await computeFileHashes(u.map(e=>e.file)),l=computeFolderPaths();if(B.current=e||[],R.current=l,e){let a=await fetch("/api/repositories/".concat(t,"/files/check-duplicates"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:u.map((t,a)=>({filename:t.file.name,contentHash:e[a],folderPath:l[a],fileSize:t.file.size}))})});if(a.ok){let{duplicates:e}=await a.json();if(e&&e.length>0){let t=e.map(e=>({index:e.index,type:e.type,existingFile:{...e.existingFile,updatedAt:e.existingFile.updatedAt},newFile:{name:u[e.index].file.name,size:u[e.index].file.size}}));E(t),z(!0),g(!1);return}}}g(!1),await executeUpload(e||[],l,{})}catch(e){console.error("Pre-upload check error:",e),g(!1),await executeUpload(B.current,R.current,{})}}},handleDuplicateResolution=async e=>{z(!1),E([]);let t=new Set,l={},a={};for(let[s,r]of Object.entries(e))if("skip"===r)t.add(Number(s));else if(l[s]=r,"overwrite"===r){let e=S.find(e=>e.index===Number(s));e&&(a[s]=e.existingFile.id)}t.size>0&&m(e=>e.filter((e,l)=>!t.has(l)));let s=u.length-t.size;s<=0||await executeUpload(B.current,R.current,l,a,t)},executeUpload=async(e,l,a,s,i)=>{h(!0),null==n||n(!0);try{let n=new FormData,o=[];u.forEach((e,t)=>{let{file:l}=e;null!=i&&i.has(t)||(n.append("files",l,l.name),o.push(t))});let c=o.map(e=>l[e]),d=o.map(t=>e[t]||""),x={},p={};o.forEach((e,t)=>{a[String(e)]&&(x[String(t)]=a[String(e)]),(null==s?void 0:s[String(e)])&&(p[String(t)]=s[String(e)])}),n.append("folderPaths",JSON.stringify(c)),d.some(e=>e)&&n.append("contentHashes",JSON.stringify(d)),Object.keys(x).length>0&&n.append("resolutions",JSON.stringify(x)),Object.keys(p).length>0&&n.append("overwriteFileIds",JSON.stringify(p)),console.log("[BulkUpload] Sending ".concat(o.length," files (").concat((null==i?void 0:i.size)||0," skipped):"),o.map(e=>({name:u[e].file.name,path:u[e].folderPath})));let h=await fetch("/api/repositories/".concat(t,"/files/bulk-upload"),{method:"POST",body:n}),f=await h.json();if(402===h.status||(null==f?void 0:f.needsUpgradeMembership)){window.location.href=(0,W.Km)("createAsset");return}if(!h.ok)throw Error(f.error||"Upload failed");b(f.results),N(100);let g=f.results.map((e,t)=>e.success?-1:t).filter(e=>-1!==e);if(0===g.length)m([]);else{let e=g.map(e=>o[e]);m(t=>t.filter((t,l)=>e.includes(l)))}r&&await r(f.results)}catch(e){console.error("Upload error:",e),b([{success:!1,error:e instanceof Error?e.message:"Upload failed",originalFilename:"All files",folderPath:""}])}finally{h(!1),null==n||n(!1)}},K=u.reduce((e,t)=>{let l=t.folderPath||"(root)";return e[l]||(e[l]=[]),e[l].push(t),e},{}),V=u.reduce((e,t)=>e+t.file.size,0);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{...T(),className:(0,F.AK)("flex justify-center px-6 pt-5 pb-6 border-2 border-dashed rounded-lg transition-colors",c?"border-blue-500 bg-blue-50":u.length>0?"border-gray-200 bg-gray-50":"border-gray-300 hover:border-gray-400 cursor-pointer"),children:[(0,a.jsx)("input",{...H()}),(0,a.jsxs)("div",{className:"space-y-2 text-center",children:[(0,a.jsx)(L.Z,{className:"mx-auto h-12 w-12 text-gray-400"}),(0,a.jsxs)("div",{className:"flex flex-col text-sm text-gray-600",children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),_()},className:"font-medium text-blue-600 hover:text-blue-500",children:"Select files"})," ","or drag and drop"]}),(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:"Drop folders to preserve structure"})]}),(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:[(0,M.Vt)()," only. Up to ",i," files, ",BulkUploadDropzone_formatFileSize(o)," each"]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(O,{className:"h-5 w-5 text-gray-400 flex-shrink-0"}),(0,a.jsx)("input",{type:"text",value:k,onChange:e=>C(e.target.value),placeholder:"Create new subfolder (optional)",className:"flex-1 text-sm border border-gray-300 rounded-md px-3 py-1.5 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500",disabled:p||f})]}),(l||k.trim())&&(0,a.jsxs)("p",{className:"text-xs text-gray-500 mt-1 ml-7",children:["Files will be uploaded to:"," ",(0,a.jsxs)("span",{className:"font-medium",children:[l||"",k.replace(/^\/+|\/+$/g,"").trim(),k.trim()?"/":""]})]})]}),u.length>0&&(0,a.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,a.jsxs)("div",{className:"bg-gray-50 px-4 py-2 border-b flex justify-between items-center",children:[(0,a.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:[u.length," file",1!==u.length?"s":""," selected",(0,a.jsxs)("span",{className:"text-gray-500 ml-2",children:["(",BulkUploadDropzone_formatFileSize(V),")"]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>{m([]),b(null)},disabled:p||f,className:"text-sm text-red-600 hover:text-red-700 disabled:opacity-50",children:"Clear all"})]}),(0,a.jsx)("div",{className:"max-h-64 overflow-y-auto divide-y",children:Object.entries(K).map(e=>{let[t,l]=e;return(0,a.jsxs)("div",{className:"bg-white",children:["(root)"!==t&&(0,a.jsxs)("div",{className:"px-4 py-1.5 flex items-center gap-2 text-sm text-gray-600",children:[(0,a.jsx)(x.Z,{className:"h-4 w-4"}),(0,a.jsx)("span",{children:t})]}),l.map((e,l)=>{let s=u.indexOf(e),r=null==v?void 0:v[s];return(0,a.jsxs)("div",{className:(0,F.AK)("px-4 py-2 flex items-center justify-between gap-2","(root)"!==t?"pl-8":""),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,a.jsx)(y.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),(0,a.jsx)("span",{className:"text-sm text-gray-700 truncate",children:e.file.name}),(0,a.jsx)("span",{className:"text-xs text-gray-500 flex-shrink-0",children:BulkUploadDropzone_formatFileSize(e.file.size)})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[r&&(r.success?(0,a.jsx)(j,{className:"h-5 w-5 text-green-500"}):(0,a.jsxs)("span",{className:"flex items-center gap-1 text-red-500",children:[(0,a.jsx)(U,{className:"h-5 w-5"}),(0,a.jsx)("span",{className:"text-xs",children:r.error})]})),!p&&!f&&!r&&(0,a.jsx)("button",{type:"button",onClick:()=>removeFile(s),className:"text-gray-400 hover:text-gray-600",children:(0,a.jsx)(D.Z,{className:"h-4 w-4"})})]})]},"".concat(t,"-").concat(l))})]},t)})})]}),u.length>0&&(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)("button",{type:"button",onClick:handleUpload,disabled:p||f,className:(0,F.AK)("px-4 py-2 rounded-md text-sm font-medium text-white",p||f?"bg-blue-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"),
1children:f?(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsxs)("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):p?(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsxs)("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Uploading..."]}):"Upload ".concat(u.length," file").concat(1!==u.length?"s":"")})}),v&&v.length>0&&(0,a.jsxs)("div",{className:(0,F.AK)("p-4 rounded-lg",v.every(e=>e.success)?"bg-green-50 text-green-800":v.some(e=>e.success)?"bg-yellow-50 text-yellow-800":"bg-red-50 text-red-800"),children:[(0,a.jsxs)("p",{className:"text-sm font-medium",children:[v.filter(e=>e.success).length," of ",v.length," files uploaded successfully"]}),v.some(e=>e.success)&&(0,a.jsx)("p",{className:"text-sm mt-1 opacity-80",children:"Process documents from the Files tab to enable AI search."})]}),A&&(0,a.jsx)(DuplicateResolutionDialog,{open:A,conflicts:S,onResolve:handleDuplicateResolution,onCancel:()=>{z(!1),E([])}})]})}var V=l(33772),J=l(89479),$=l(44899);function EmptyState(e){let{hasWriteAccess:t,onUploadClick:l,createBlocked:s}=e;return(0,a.jsx)(u.Z,{children:(0,a.jsx)(o.Z,{children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Upload files for AI-powered search"}),(0,a.jsx)("p",{className:"mt-2 max-w-xl text-sm text-gray-500",children:"Upload documents (PDF, Word, PowerPoint) to your repository. Once processed, AI can search through your files to help you find information instantly."}),(0,a.jsx)("div",{className:"mt-3 text-sm",children:(0,a.jsxs)(i.Z,{onClick:l,children:[s?(0,a.jsx)(c.Z,{className:"-ml-0.5 mr-2 h-4 w-4","aria-hidden":"true"}):(0,a.jsx)(d.Z,{className:"-ml-0.5 mr-2 h-4 w-4","aria-hidden":"true"}),"Upload Files"]})})]}):(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("h3",{className:"text-md leading-6 font-normal text-gray-900",children:"The repository has no files published."})})})})}function RepositoryFilesTab(e){var t,l;let{repository:r,files:n}=e,o=(0,m.useRouter)(),{addNotification:u}
1=(0,J.n)(),[x,p]=(0,s.useState)(!1),[h,f]=(0,s.useState)(""),[g,y]=(0,s.useState)(!1),[v,b]=(0,s.useState)(!1),w=(0,s.useRef)(null),j="string"==typeof o.query.path?o.query.path:"",N=(0,s.useCallback)(e=>{let{path:t,...l}=o.query,a=e?{...l,path:e}:l;o.push({pathname:o.pathname,query:a},void 0,{shallow:!0})},[o]),{membership:k,getMembershipURL:C}=(0,$.Z)(),S=(null==k?void 0:null===(t=k.permissions)||void 0===t?void 0:t.canCreateAssets)===!1,F=(0,s.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(S){o.push(C("createAsset"));return}f(e),p(!0)},[S,C,o]),E=null==r?void 0:null===(l=r.permission)||void 0===l?void 0:l.write,A=n&&n.length>0,[M,z]=(0,s.useState)(!1),B=A||M,R=(0,s.useCallback)(async()=>{u("success","Files uploaded successfully"),p(!1),w.current?w.current.refresh():z(!0)},[u]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(T.Z,{open:x,onClose:()=>p(!1),disabled:v,title:h?"Upload to ".concat(h):"Upload Files",children:(0,a.jsx)(T.Z.Content,{children:(0,a.jsx)(BulkUploadDropzone,{repositoryId:null==r?void 0:r.id,targetFolderPath:h,onUploadComplete:R,onUploadStateChange:b})})}),(0,a.jsx)(V.Z,{open:g,onClose:()=>y(!1),repositoryId:null==r?void 0:r.id,onSourceCreated:()=>{var e;y(!1),null===(e=w.current)||void 0===e||e.refresh()}}),!B&&(0,a.jsx)(EmptyState,{hasWriteAccess:E,onUploadClick:()=>F(""),createBlocked:S}),B&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"min-w-full flex items-center justify-end gap-2 pb-4",children:E&&(0,a.jsxs)(i.Z,{onClick:()=>F(j),children:[S?(0,a.jsx)(c.Z,{className:"-ml-0.5 mr-2 h-4 w-4"}):(0,a.jsx)(d.Z,{className:"-ml-0.5 mr-2 h-4 w-4"}),"Upload"]})}),(0,a.jsx)("div",{className:"pb-4",children:(0,a.jsx)(Z,{ref:w,repositoryId:null==r?void 0:r.id,currentPath:j,onFolderSelect:N,canDelete:E})})]})]})}var q=!0;function RepositoryFilesPage(e){let{repository:t,files:l}=e,{setRepository:r}=(0,n.o)();return(0,s.useEffect)(()=>{r(t)},[t,r]),(0,a.jsx)(RepositoryFilesTab,{repository:t,files:l})}RepositoryFilesPage.Layout=r.ZP},86367:function(e,t,l){"use strict";var a=l(67294);let s=a.forwardRef(function({title:e,titleId:t,...l},s){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:s,"aria-labelledby":t},l),e?a.createElement("title",{id:t},e):null,a.createElement("path",{d:"M9.25 13.25a.75.75 0 001.5 0V4.636l2.955 3.129a.75.75 0 001.09-1.03l-4.25-4.5a.75.75 0 00-1.09 0l-4.25 4.5a.75.75 0 101.09 1.03L9.25 4.636v8.614z"}),a.createElement("path",{d:"M3.5 12.75a.75.75 0 00-1.5 0v2.5A2.75 2.75 0 004.75 18h10.5A2.75 2.75 0 0018 15.25v-2.5a.75.75 0 00-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5z"}))});t.Z=s},85716:function(e,t,l){"use strict";var a=l(67294);let s=a.forwardRef(function({title:e,titleId:t,...l},s){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:s,"aria-labelledby":t},l),e?a.createElement("title",{id:t},e):null,a.createElement("path",{fillRule:"evenodd",d:"M10 1a4.5 4.5 0 00-4.5 4.5V9H5a2 2 0 00-2 2v6a2 2 0 002 2h10a2 2 0 002-2v-6a2 2 0 00-2-2h-.5V5.5A4.5 4.5 0 0010 1zm3 8V5.5a3 3 0 10-6 0V9h6z",clipRule:"evenodd"}))});t.Z=s},85973:function(e,t,l){"use strict";var a=l(67294);let s=a.forwardRef(function({title:e,titleId:t,...l},s){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:s,"aria-labelledby":t},l),e?a.createElement("title",{id:t},e):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"}))});t.Z=s},31038:function(e,t,l){"use strict";var a=l(67294);let s=a.forwardRef(function({title:e,titleId:t,...l},s){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:s,"aria-labelledby":t},l),e?a.createElement("title",{id:t},e):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"}))});t.Z=s},15073:function(e,t,l){"use strict";var a=l(67294);let s=a.forwardRef(function({title:e,titleId:t,...l},s){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:s,"aria-labelledby":t},l),e?a.createElement("title",{id:t},e):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15a4.5 4.5 0 004.5 4.5H18a3.75 3.75 0 001.332-7.257 3 3 0 00-3.7
158-3.848 5.25 5.25 0 00-10.233 2.33A4.502 4.502 0 002.25 15z"}))});t.Z=s},10798:function(e,t,l){"use strict";var a=l(67294);let s=a.forwardRef(function({title:e,titleId:t,...l},s){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:s,"aria-labelledby":t},l),e?a.createElement("title",{id:t},e):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75"}))});t.Z=s},6244:function(e,t,l){"use strict";var a=l(67294);let s=a.forwardRef(function({title:e,titleId:t,...l},s){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:s,"aria-labelledby":t},l),e?a.createElement("title",{id:t},e):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"}))});t.Z=s},48974:function(e,t,l){"use strict";var a=l(67294);let s=a.forwardRef(function({title:e,titleId:t,...l},s){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:s,"aria-labelledby":t},l),e?a.createElement("title",{id:t},e):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487zm0 0L19.5 7.125"}))});t.Z=s},76249:function(e,t,l){"use strict";var a=l(67294);let s=a.forwardRef(function({title:e,titleId:t,...l},s){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:s,"aria-labelledby":t},l),e?a.createElement("title",{id:t},e):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"}))});t.Z=s},84425:function(e,t,l){"use strict";var a=l(67294);let s=a.forwardRef(function({title:e,titleId:t,...l},s){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:s,"aria-labelledby":t},l),e?a.createElement("title",{id:t},e):null,a.createElement("path",{d:"M19.906 9c.382 0 .749.057 1.094.162V9a3 3 0 00-3-3h-3.879a.75.75 0 01-.53-.22L11.47 3.66A2.25 2.25 0 009.879 3H6a3 3 0 00-3 3v3.162A3.756 3.756 0 014.094 9h15.812zM4.094 10.5a2.25 2.25 0 00-2.227 2.568l.857 6A2.25 2.25 0 004.951 21H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-2.227-2.568H4.094z"}))});t.Z=s},33504:function(e,t,l){"use strict";var a=l(67294);let s=a.forwardRef(function({title:e,titleId:t,...l},s){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:s,"aria-labelledby":t},l),e?a.createElement("title",{id:t},e):null,a.createElement("path",{fillRule:"evenodd",d:"M9 4.5a.75.75 0 01.721.544l.813 2.846a3.75 3.75 0 002.576 2.576l2.846.813a.75.75 0 010 1.442l-2.846.813a3.75 3.75 0 00-2.576 2.576l-.813 2.846a.75.75 0 01-1.442 0l-.813-2.846a3.75 3.75 0 00-2.576-2.576l-2.846-.813a.75.75 0 010-1.442l2.846-.813A3.75 3.75 0 007.466 7.89l.813-2.846A.75.75 0 019 4.5zM18 1.5a.75.75 0 01.728.568l.258 1.036c.236.94.97 1.674 1.91 1.91l1.036.258a.75.75 0 010 1.456l-1.036.258c-.94.236-1.674.97-1.91 1.91l-.258 1.036a.75.75 0 01-1.456 0l-.258-1.
1036a2.625 2.625 0 00-1.91-1.91l-1.036-.258a.75.75 0 010-1.456l1.036-.258a2.625 2.625 0 001.91-1.91l.258-1.036A.75.75 0 0118 1.5zM16.5 15a.75.75 0 01.712.513l.394 1.183c.15.447.5.799.948.948l1.183.395a.75.75 0 010 1.422l-1.183.395c-.447.15-.799.5-.948.948l-.395 1.183a.75.75 0 01-1.422 0l-.395-1.183a1.5 1.5 0 00-.948-.948l-1.183-.395a.75.75 0 010-1.422l1.183-.395c.447-.15.799-.5.948-.948l.395-1.183A.75.75 0 0116.5 15z",clipRule:"evenodd"}))});t.Z=s}},function(e){e.O(0,[8538,7264,3772,9774,2888,179],function(){return e(e.s=87460)}),_N_E=e.O()}]);
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.