PageSourceSearch

https://agentlab.morphmind.ai/_next/static/chunks/8040.ed0cb5eaffd628dd.js

js morphmind.ai collected 2026-10-04 11:57:57 UTC 6,470 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8040],{18040:(e,t,a)=>{a.d(t,{a:()=>f});var r=a(12115),l=a(18720),o=a(6507),n=a(58665),i=a(23126),s=a(84919),d=a(89531),u=a(8828),c=a(27316),p=a(26560);function f({agentId:e,agentName:t,projectId:a,targetFolder:f,containerConnectionStatus:g="running"}){let{isLocal:m,localDisconnected:h}=(0,s.V)(),b=0===(0,u.L)(e=>e.messageCount),[w,k]=(0,r.useState)([]),[S,y]=(0,r.useState)(!1),v=(0,r.useRef)(null),C=(0,r.useRef)(new Map),E=(0,r.useRef)([]),P=(0,r.useRef)(w);(0,r.useEffect)(()=>{P.current=w},[w]);let A=(0,r.useCallback)((e,t)=>{k(a=>a.map(a=>(0,o.NS)(a.file)===e?{...a,uploadProgress:t}:a))},[]),D=(0,r.useCallback)((e,t,a,r)=>{k(l=>{let n=l.map(l=>(0,o.NS)(l.file)===e?{...l,uploadStatus:t,uploadedPath:a,error:r,uploadProgress:"uploaded"===t?100:l.uploadProgress}:l);return y(n.some(e=>"uploading"===e.uploadStatus||"pending"===e.uploadStatus)),n})},[]),F=(0,r.useCallback)(e=>{k(e),y(e.some(e=>"uploading"===e.uploadStatus||"pending"===e.uploadStatus))},[]);(0,r.useEffect)(()=>{if("running"===g&&E.current.length>0){let t=E.current;if(E.current=[],a){let r=(0,o.d2)(f),n=i.z;t.forEach(async t=>{let i=(0,o.NS)(t),s=new AbortController;C.current.set(i,s),D(i,"uploading");try{let o=await n(t,{agentId:e,projectId:a,targetPath:r,signal:s.signal,onProgress:e=>{A(i,e)}}),d=o.path||o.target_path||(r?`${r}/${t.name}`:t.name);D(i,"uploaded",d),l.toast.success(`Uploaded ${t.name}`)}catch(a){let e=a instanceof Error?a.message:"Upload failed";D(i,"error",void 0,e),e.includes("cancelled")||l.toast.error(`Failed to upload ${t.name}`,{description:e})}finally{C.current.delete(i)}})}}},[g,a,f,e,m,A,D]);let N=(0,r.useCallback)((r,n)=>{(async()=>{if(h){l.toast.error("Bridge disconnected",{description:"Cannot upload files while bridge is offline."}),r.forEach(e=>{D((0,o.NS)(e),"error",void 0,"Bridge disconnected")});return}if(!a){l.toast.error("Cannot upload files",{description:"Project ID is required to upload attachments."}),r.forEach(e=>{D((0,o.NS)(e),"error",void 0,"Project ID required")});return}let s=(0,o.d2)(f),u=m&&"uploads"===s&&b,g=m&&("drop"===n||"paste"===n||"picker"===n&&"uploads"===s);if(g){let a=t?.trim(),r=window.bridge;if(u){let e=await (0,c.gg)()||(0,c.b_)();e&&await d.bridgeClient.post("/v1/bridge/set-workspace",{path:e}).then(()=>{(0,c.Dk)(e)}).catch(e=>{l.toast.error("Workspace folder not found",{description:e instanceof Error?e.message:"Failed to set workspace"})})}let o=!!a&&"Untitled"!==a,n=!1;if(b&&r?.setActiveAgent)try{await r.setActiveAgent(e,o?a:void 0,!!o&&u),n=!0}catch{}o&&n||(0,p.s3)(e)}let w=g?i.x:i.z;r.forEach(async t=>{let r=(0,o.NS)(t),n=new AbortController;C.current.set(r,n);try{let l=await w(t,{agentId:e,projectId:a,targetPath:s,signal:n.signal,onProgress:e=>{A(r,e)}}),o=l.path||l.target_path||(s?`${s}/${t.name}`:t.name);D(r,"uploaded",o)}catch(a){let e=a instanceof Error?a.message:"Upload failed";D(r,"error",void 0,e),e.includes("cancelled")?l.toast.info("Upload cancelled"):l.toast.error(`Failed to upload ${t.name}`,{description:e})}finally{C.current.delete(r)}})})()},[e,t,b,a,f,m,h,A,D]),$=(0,r.useCallback)((e,t="programmatic")=>{let a=e instanceof FileList?Array.from(e):e,r=new Set(P.current.map(e=>(0,o.NS)(e.file))),l=[];for(let e of a){let t=(0,o.NS)(e);r.has(t)||(e instanceof File?l.push({file:e,uploadStatus:"uploading",uploadProgress:0}):l.push({file:e,uploadStatus:"uploaded",uploadedPath:e.path,uploadProgress:100}),r.add(t))}if(0===l.length)return;k(e=>[...e,...l]),l.some(e=>"uploading"===e.uploadStatus)&&y(!0);let n=l.filter(e=>e.file instanceof File&&"uploading"===e.uploadStatus).map(e=>e.file);n.length>0&&N(n,t)},[N]);(0,r.useEffect)(()=>{let e=e=>{e.detail?.file&&$([e.detail.file])};return window.addEventListener(n.Zy,e),()=>{window.removeEventListener(n.Zy,e)}},[$]),(0,r.useEffect)(()=>{let e=()=>{v.current?.click()};return window.addEventListener(n.Xv,e),()=>{window.removeEventListener(n.Xv,e)}},[]);let _=(0,r.useCallback)(e=>{k(t=>{let a=t[e];if(!a)return t;let r=(0,o.NS)(a.file),l=C.current.get(r);l&&(l.abort(),C.current.delete(r));let n=t.filter((t,a)=>a!==e);return y(n.some(e=>"uploading"===e.uploadStatus||"pending"===e.uploadStatus)),n})},[]),z=(0,r.useCallback)(e=>{let t=e.target.files;t?.length&&$(t,"picker"),e.target.value=""},[$]),I=(0,r.useCallback)(e=>{let t=function(e){let t=e.clipboardData?.files?Array.from(e.clipboardData.files):[];return t.length>0?t:(e.clipboardData?.items?Array.from(e.clipboardData.items):[]).filter(e=>"file"===e.kind).map(e=>e.getAsFile()).filter(e=>e instanceof File)}(e);if(t.length>0){e.preventDefault(),$(t,"paste");return}if(!m)return;let a=window.bridge;a?.readClipboardImage&&(e.clipboardData?.getData("text/plain")||(e.preventDefault(),a.readClipboardImage().then(e=>{!e?.error&&e?.base64&&$([new File([Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0))],e.name||`pasted-image-${Date.now()}.png`,{type:e.contentType||"image/png"})],"paste")}).catch(()=>{})))},[$,m]),L=(0,r.useCallback)(async()=>
1{if(m&&"uploads"===(0,o.d2)(f)&&b)return void v.current?.click();let e=window.bridge;if(m&&e?.pickFiles)try{let t=await e.pickFiles();if(t?.paths?.length>0){let e=t.paths.map(e=>({name:e.split("/").pop()||e,path:e,type:"remote",fileType:"application/octet-stream"}));$(e,"picker");return}}catch{}v.current?.click()},[$,b,m,f]),U=(0,r.useCallback)(()=>{let e=P.current;return 0===e.length?[]:e.some(e=>"uploading"===e.uploadStatus||"pending"===e.uploadStatus)?(l.toast.error("Wait for uploads to complete"),null):e.some(e=>"error"===e.uploadStatus)?(l.toast.error("Some files failed to upload",{description:"Please remove failed files and try again"}),null):e.filter(e=>"uploaded"===e.uploadStatus).map(e=>{if(e.file instanceof File)return{name:e.file.name,size:e.file.size,type:e.file.type,targetPath:e.uploadedPath};{let t=e.file;return{name:t.name,size:t.size||0,type:t.fileType,targetPath:t.path}}})},[]),R=(0,r.useCallback)(()=>{C.current.forEach(e=>e.abort()),C.current.clear(),k([]),y(!1)},[]);return(0,r.useEffect)(()=>()=>{C.current.forEach(e=>e.abort()),C.current.clear()},[]),{addFiles:$,attachedFiles:w,fileInputRef:v,handleFileInputChange:z,handleFilePickerClick:L,handlePaste:I,isUploading:S,replaceAttachments:F,removeFile:_,resetAttachments:R,getUploadedAttachments:U}}},58665:(e,t,a)=>{a.d(t,{Rm:()=>o,Ve:()=>n,Xv:()=>l,Zy:()=>r});let r="chat:add-file",l="chat:open-file-picker",o="chat:send-annotation",n="chat:send-annotation-result"}}]);

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.