try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c17b8bbe-47a9-49f8-aceb-3d08a8a8108c",e._sentryDebugIdIdentifier="sentry-dbid-c17b8bbe-47a9-49f8-aceb-3d08a8a8108c")}catch(e){}{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=Object.assign({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:anthropic-apps":!0})}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[79659],{0x14a6d5f1:(e,t,a)=>{a.d(t,{A9:()=>g,Wq:()=>p,fC:()=>c,qv:()=>m});var l=a(0x12c9046cd),n=a(0x14de19ae8),i=a(0x49fac030),r=a(0xac309a83),s=a(0x78b33fbd),o=a(0x156c4e43b);let d={image_in:!0,pdf_in:!1},u=o.YO(r.xR),c=e=>{let{activeOrganization:t}=(0,n.YL)(),a=null==t?void 0:t.uuid,{data:r,isLoading:s,isPlaceholderData:o}=(0,l.Sk)("/api/organizations/".concat(a,"/model_configs/").concat(e),{queryKey:[i.yV,a,e],enabled:!!a,staleTime:3e5,meta:{noToast:!0}});return{isLoading:s,modelConfig:!o&&r||d}},f=[],g=()=>{var e;let{activeOrganization:t}=(0,n.YL)(),a=null!=(e=null==t?void 0:t.claude_ai_bootstrap_models_config)?e:f,l=a.filter(e=>!e.inactive),i=l.filter(e=>!e.overflow),r=l.filter(e=>e.overflow);return{allModelOptions:a,activeModelOptions:l,mainModels:i,overflowModels:r}},p=()=>{let{allModelOptions:e}=g();return(t,a)=>{let l=e.find(e=>e.model===t);if(!l)return!1;let n=null==l?void 0:l.capabilities;return!n||!1!==n[a]}},m=()=>{let e=(0,n.h0)(),t=(0,s.useLayer)("frontend").get("free_tier_available_models",[]),a=(0,r.T9)("claude_ai_free_tier_available_models","models",[],u);return e?[]:t.length>0?t:a}},0x87b1176c:(e,t,a)=>{a.d(t,{Bg:()=>d,fR:()=>f,iV:()=>c,ih:()=>u,nI:()=>g});var l=a(0x12c9046cd),n=a(0x14de19ae8),i=a(0x139b5e710),r=a(0x49fac030),s=a(0x1b813d90),o=a(0x17e725145);let d=()=>{let{account:e,activeOrganization:t}=(0,n.YL)(),a=null==e?void 0:e.uuid,i=null==t?void 0:t.uuid,d=(0,o.useQueryClient)();return(0,l.L2)("/api/organizations/".concat(i,"/sync/mcp/drive/ingest"),"POST",{onSuccess:()=>{setTimeout(()=>{d.invalidateQueries({queryKey:[r.hx,{orgUuid:i,accountUuid:a,syncSourceType:s.v8.GDRIVE}]})},300)}})},u=()=>{let{activeOrganization:e}=(0,n.YL)(),t=null==e?void 0:e.uuid,{addError:a}=(0,i.Yf)(),d=(0,o.useQueryClient)();return(0,l.L2)("/api/organizations/".concat(t,"/sync/ingestion/gdrive/clean_up"),"POST",{onSuccess:()=>{d.invalidateQueries({queryKey:[r.hx,{orgUuid:t,syncSourceType:s.v8.GDRIVE}]})},onError:e=>{a(e.message,{error:e,errorContext:{tags:{source:"knowledge_cleanup_ingestion"}}})}})},c=e=>{let{activeOrganization:t}=(0,n.YL)(),a=null==t?void 0:t.uuid,i=(0,o.useQueryClient)();return(0,l.L2)("/api/organizations/".concat(a,"/projects/").concat(e,"/kb/resync"),"POST",{enabled:!!e,meta:{noToast:!0},onSuccess:t=>{"done"===t.status&&i.invalidateQueries({queryKey:[r.qz,{orgUuid:a,projectUuid:e}]}),e&&t.gdrive_resource_backfill_triggered&&i.invalidateQueries({queryKey:[r.LV,{orgUuid:a,projectUuid:e}]})}})},f=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],{activeOrganization:a}=(0,n.YL)(),i=null==a?void 0:a.uuid;return(0,l.Sk)("/api/organizations/".concat(i,"/projects/").concat(e,"/kb/stats"),{queryKey:[r.qz,{orgUuid:i,projectUuid:e}],enabled:!!e&&t})},g=()=>{let{activeOrganization:e}=(0,n.YL)(),t=null==e?void 0:e.uuid;return(0,l.L2)("/api/organizations/".concat(t,"/conversation/backfill"),"POST",{})}},0x1bd42f6d2:(e,t,a)=>{a.d(t,{CO:()=>f,M3:()=>d,bG:()=>u,ks:()=>p,pz:()=>o,z_:()=>c});var l=a(0x12c9046cd),n=a(0x14de19ae8),i=a(0x49fac030),r=a(0x17e725145),s=a(0x18175ce17);let o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{activeOrganization:a}=(0,n.YL)(),i=null==a?void 0:a.uuid,r=g(),o=(0,s.eL)();return(0,l.L2)(()=>"/api/organizations/".concat(i,"/projects/").concat(e,"/syncs"),"POST",{enabled:!!(a&&e),...t,onSuccess:function(){for(var a,l=arguments.length,n=Array(l),i=0;i1&&void 0!==arguments[1]?arguments[1]:{},{activeOrganization:a}=(0,n.YL)(),i=null==a?void 0:a.uuid,r=g();return(0,l.L2)(()=>"/api/organizations/".concat(i,"/projects/").concat(e,"/syncs"),"PUT",{enabled:!!(a&&e),...t,onSuccess:function(){for(var a,l=arguments.length,n=Array(l),i=0;i{let{activeOrganization:t}=(0,n.YL)(),a=null==t?void 0:t.uuid,r=g();return(0,l.Qv)(t=>"/api/organizations/".concat(a,"/projects/").concat(e,"/syncs/").concat(t),"DELETE",(e,t)=>t?t.filter(t=>t.uuid!==e):t,{queryKey:[i.LV,{orgUuid:a,projectUuid:e}],enabled:!!t,onSuccess:()=>{r(e)}})},c=e=>{let{activeOrganization:t}=(0,n.YL)(),a=null==t?void 0:t.uuid,r=g();return(0,l.Qv)(()=>"/api/organizations/".concat(a,"/projects/").concat(e,"/syncs/delete_many"),"POST",(e,t)=>t?t.filter(t=>!e.sync_source_uuids.includes(t.uuid)):t,{queryKey:[i.LV,{orgUuid:a,projectUuid:e}],enabled:!!t,onSuccess:()=>{r(e)}})},f=function(e,t){let a=!(arguments.length>2)||void 0===arguments[2]||arguments[2],{activeOrganization:o}=(0,n.YL)(),d=null==o?void 0:o.uuid,u=(0,r.useQueryClient)(),c=!!(o&&e&&a),{data:f,isLoading:g}=(0,l.Sk)("/api/organizations/".concat(d,"/projects/").concat(e,"/syncs?calculate_size=").concat(null!=t&&t),{queryKey:[i.LV,{orgUuid:d,projectUuid:e,calculateSize:t}],enabled:c,refetchInterval:e=>{var t;return(null==(t=e.state.data)?void 0:t.some(s.z3))?5e3:3e5},structuralSharing:(t,a)=>{let l=void 0!==t&&t.some(s.z3),n=void 0!==a&&a.some(s.z3);return l&&!n&&u.invalidateQueries({queryKey:[i.qz,{orgUuid:d,projectUuid:e}]}),a}});return{data:f,isLoading:!!c&&g}},g=()=>{let{activeOrganization:e}=(0,n.YL)(),t=null==e?void 0:e.uuid,a=(0,r.useQueryClient)();return e=>{a.invalidateQueries({queryKey:[i.LV,{orgUuid:t,projectUuid:e}]}),a.invalidateQueries({queryKey:[i._G,{orgUuid:t,projectUuid:e}]}),a.invalidateQueries({queryKey:[i.qz,{orgUuid:t,projectUuid:e}]})}},p=e=>{let{data:t}=f(e);return!!(null==t?void 0:t.some(s.z3))}},0x235ccdd4d:(e,t,a)=>{a.d(t,{Si:()=>D,i1:()=>V,vV:()=>O,fU:()=>U});var l=a(0x22102fd88),n=a(0x597e433e),i=a(0x1139502dd),r=a(0x13bc7d5d8),s=a(0x1ac4f341b),o=a(0x9f369389),d=a(0x1a3383306),u=a(0xe670e093);let c=new Set(["image/jpeg","image/png","image/gif","image/webp"]);function f(){var e,t;return!!(null==(t=window.claudeAppSettings)||null==(e=t.filePickers)?void 0:e.getPathForFile)}function g(e){if(!f())return null;try{return window.claudeAppSettings.filePickers.getPathForFile(e)}catch(e){return null}}async function p(e){return new Promise((t,a)=>{let l=new FileReader;l.onload=()=>{t(l.result.split(",")[1])},l.onerror=a,l.readAsDataURL(e)})}async function m(e,t){let a=[],l=[],n=[];for(let r of e){var i;let e,f=null!=(i=null==t?void 0:t.get(r))?i:g(r),m=c.has(r.type),y=r.type;if(m||!f){if(r.size>0x3200000){n.push(r);continue}let t=m?await (0,s.R)(r):r;y=t.type,e=await p(t)}if(!f&&(null===o.Q2||void 0===o.Q2?void 0:o.Q2.savePastedFile)&&e){let t=await o.Q2.savePastedFile(e,y,r.name);t.path&&(f=t.path)}if(f)if(m&&e)l.push({type:"image",source:{type:"base64",media_type:y,data:e}});else{let e={file_kind:d.Mr.Blob,file_uuid:(0,u.b)(),file_name:r.name,created_at:new Date().toISOString(),localPath:f,path:f};a.push(e)}else n.push(r)}return{files:a,imageBlocks:l,failedFiles:n}}var y=a(0x226530adf),h=a(0x14a6d5f1),x=a(0xfd34bc37),v=a(0xf32c56dd),b=a(0x12c9046cd),w=a(0x14de19ae8),_=a(0x139b5e710),M=a(0xb3796c53),j=a(0x1016c6ed2),C=a(0x20e00cddd),A=a(0x49fac030),k=a(0xac309a83),P=a(0x214c6246e),z=a(0x20b796df9),T=a(0x17e725145),L=a(0x1a1f6dda6),S=a(0xfc89b4a4),F=a(0x38e6572),Y=a(0x1ab0d1ca1),q=a(0x5267d157),E=a(0x15b1a866a),Q=a(0x25d59887);let K=[{matcher:e=>e.message.toLowerCase().includes("failed to fetch")||e.message.toLowerCase().includes("load failed")||e.message.toLowerCase().includes("networkerror"),createMessage:()=>(0,l.jsx)(F.A,{defaultMessage:"Upload failed due to a network issue. Check your internet connection and try again.",id:"1bxKaj0pKU"})},{matcher:e=>e.message.includes("password protected")||e.message.includes("document_password_protected"),createMessage:()=>(0,l.jsx)(F.A,{defaultMessage:"The document you uploaded is password protected. Please remove the password and try again.",id:"DHwwKwuaCR"})},{matcher:e=>e.message.includes("https://docs.claude.com/en/docs/build-with-claude/files#error-handling"),createMessage:()=>(0,l.jsx)(F.A,{defaultMessage:'The title of the document you uploaded is too long, or includes forbidden characters (<, >, :, ", |, ?, *, \\, /, or unicode characters 0-31)',id:"NdLqN5Z3bE"})},{matcher:e=>e.message.includes("Code execution and file creation"),extractor:e=>[...new Set(e.map(e=>(0,n.QC)(e.file.name)))],createMessage:e=>(0,l.jsx)(F.A,{defaultMessage:"Files of the following {count, plural, one {format} other {formats}} require 'Code execution and file creation'. Go to Settings > Capabilities to enable: {formats}",id:"o/NOFEuWmE",values:{count:e.length,formats:(0,l.jsx)(E.dT,{type:"conjunction",value:e})}})},{matcher:e=>e.message.includes("not supported"),extractor:e=>[...new Set(e.map(e=>(0,n.QC)(e.file.name)))],createMessage:e=>(0,l.jsx)(F.A,{defaultMessage:"Files of the following {count, plural, one {format is} other {formats are}} not supported: {formats}",id:"9JcWWPAZoB",values:{count:e.length,formats:(0,l.jsx)(E.dT,{type:"conjunction",value:e})}})},{matcher:e=>e.message.includes("exceeds maximum size")||e.message.includes("File too large"),extractor:e=>e.map(e=>({file_type:e.file.type,file_size:e.file.size})),createMessage:()=>{let e=Math.floor(i.gZ/1048576);return(0,l.jsx)(F.A,{defaultMessage:"You may not upload files larger than {sizeLimit}mb.",id:"nW3gZD88Va",values:{sizeLimit:e}})},trackAnalytics:(e,t)=>{e.track({event_key:"file_upload_too_large",large_files:t})}}];function D(e){let{syncSourceCount:t,files:a,setFiles:r,numExistingConversationFiles:s,attachments:o,setAttachments:d,numExistingConversationAttachments:u,detectSameAttachment:c,selectedModel:f,blobFileUploadsEnabled:p,conversationUuid:m,wiggleEnabled:x,isLocalAgentMode:v=!1,onImageBlocksReceived:b}=e,{addError:w}=(0,_.Yf)(),j=(0,y.Z3)(null);return function(e){let{syncSourceCount:t,onUploadComplete:a,existingAttachments:r,existingFiles:s,numExistingConversationAttachments:o,numExistingConversationFiles:d,selectedModel:u,blobFileUploadsEnabled:c,conversationUuid:f,wiggleEnabled:p,isLocalAgentMode:m=!1,onImageBlocksReceived:y}=e,x=(0,Y.A)(),{modelConfig:v}=(0,h.fC)(u),b=v.image_in,[w,_,j,C]=function(e){let{syncSourceCount:t,onUploadComplete:a,existingAttachments:n,existingFiles:r,numExistingConversationFiles:s,selectedModel:o,blobFileUploadsEnabled:d,conversationUuid:u,wiggleEnabled:c,isLocalAgentMode:f=!1,onImageBlocksReceived:g}=e,{modelConfig:p}=(0,h.fC)(o),m=p.image_in,y=V()&&p.pdf_in,{isUploading:x,setIsUploading:v,handleError:b,handleUpload:w}=O({imagesEnabled:m,blobFileUploadsEnabled:d,onUploadComplete:a,rasterizePdfUploadsEnabled:y,conversationUuid:u,wiggleEnabled:c,isLocalAgentMode:f,onImageBlocksReceived:g}),_=(0,S.useCallback)(e=>{let{newUploads:a=[],numNewPotentialAttachments:o=0,showError:u=!0}=e;if(o+a.length+(n.length+r.length+t)>i.XA.maxTotalUploadsPerMessage)return u&&b((0,l.jsx)(F.A,{defaultMessage:"You can add at most {count, plural, one {# attachment} other {# attachments}} to a message. Please select fewer attachments.",id:"qxV00r12ob",values:{count:i.XA.maxTotalUploadsPerMessage}})),!1;let c=s||0,{messageFileCount:f}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=0,l=0,n=0;for(let r of e){let{willBecomeMessageFile:e,category:s}=function(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=(null==(t=e.name.split(".").pop())?void 0:t.toLowerCase())||"";return i.h8.includes(l)?{category:"image",willBecomeMessageFile:!!a.imagesEnabled}:i.Ap.includes(l)?{category:"pdf",willBecomeMessageFile:!!a.rasterizePdfUploadsEnabled,requiresFeatureGate:"janus_claude-ai"}:i.PC.includes(l)?{category:"out-of-context",willBecomeMessageFile:!!a.blobFileUploadsEnabled,requiresFeatureGate:"ooc_attachments"}:i.BA.includes(l)?{category:"text",willBecomeMessageFile:!1}:i.pH.includes(l)?{category:"document",willBecomeMessageFile:!1}:{category:"unsupported",willBecomeMessageFile:!1}}(r,t);"unsupported"===s?n++:e?a++:l++}return{messageFileCount:a,messageAttachmentCount:l,unsupportedCount:n}}(a,{blobFileUploadsEnabled:d,imagesEnabled:m,rasterizePdfUploadsEnabled:y});if(c+f>i.XA.maxFilesPerConversation){var g;return u&&b((g=i.XA.maxFilesPerConversation,(0,l.jsx)(F.A,{defaultMessage:"You can add at most {count, plural, one {# file} other {# files}} to a chat. {suggestion}",id:"QyrCxYs5Jy",values:{count:g,suggestion:c{_({newUploads:e})&&await w(e,void 0,t)},[w,_])]}({syncSourceCount:t,onUploadComplete:a,existingFiles:s,existingAttachments:r,numExistingConversationFiles:d,numExistingConversationAttachments:o,selectedModel:u,blobFileUploadsEnabled:c,conversationUuid:f,wiggleEnabled:p,isLocalAgentMode:m,onImageBlocksReceived:y}),A=function(e){let{handleUpload:t,isLocalAgentMode:a=!1}=e,l=(0,S.useRef)({ready:0,total:0}),n=(0,S.useCallback)(()=>{l.current={ready:0,total:0}},[]),i=(0,S.useRef)(new Map),r=(0,S.useCallback)(e=>{l.current.ready+=1,l.current.total===l.current.ready&&t(e,i.current.size>0?i.current:void 0)},[t]),s=(0,S.useCallback)((e,t,n)=>{let o=e.length;for(let d=0;d{if(a&&n&&o.fullPath){let t=o.fullPath.split("/")[1],a=t?n.get(t):void 0;if(a){let t=o.fullPath.substring(a.fullPath.length);i.current.set(e,a.nativePath+t)}}t.push(e),r(t)})):o.isDirectory&&o.createReader().readEntries(e=>{s(e,t,n)})}},[r,a]);return(0,S.useCallback)(e=>{var t,l;let r;e.preventDefault(),n(),i.current=new Map;let o=null==(t=e.dataTransfer)?void 0:t.items;if(!o)return;a&&(null==(l=e.dataTransfer)?void 0:l.files)&&(r=new Map);let d=[];for(let t=0;t{let t=Array.from(e).map(e=>new File([e],"".concat(Date.now(),"_").concat(e.name),{type:e.type,lastModified:e.lastModified}));await C(t)},[C]),T=(0,S.useCallback)(async e=>{let t=e.target.files;t&&await C(Array.from(t)),e.target.value=""},[C]),L=Math.floor(i.XA.maxFileSize/1048576),q=b?(0,l.jsx)(F.A,{defaultMessage:"Upload docs or images to Claude\\n(Max {maxUploads}, {maxSize}mb each)",id:"TGYeob9u0b",values:{maxUploads:i.XA.maxTotalUploadsPerMessage,maxSize:L}}):(0,l.jsx)(F.A,{defaultMessage:"Add content ({maxUploads} max, {maxSize}mb each)\\nAccepts pdf, txt, csv, etc.",id:"rW/kw78ou7",values:{maxUploads:i.XA.maxTotalUploadsPerMessage,maxSize:L}}),E=(0,S.useCallback)(e=>{T(e)},[T]),Q=(0,S.useMemo)(()=>({type:"file",accept:p?"":(0,n.cm)({imagesEnabled:b,outOfContextFilesEnabled:c}).join(","),onChange:E,multiple:!0,"aria-label":x.formatMessage({defaultMessage:"Upload files",id:"2jjdVzJX0c"})}),[b,c,p,E,x]);return[w,_,j,A,k,C,(0,l.jsx)(M.Tooltip,{className:"text-center",tooltipContent:q,children:(0,l.jsxs)(I,{children:[(0,l.jsx)("input",{"data-testid":"file-upload",className:"absolute inset-0 -z-10 overflow-hidden rounded-xl opacity-0",...Q}),w?(0,l.jsx)(P.N,{className:"animate-spin",size:18}):(0,l.jsx)(z.x,{size:18,weight:"light"})]})},"upload-tooltip"),Q]}({syncSourceCount:t,onUploadComplete:(0,S.useCallback)(async(e,t)=>{if(c&&e.find(e=>c(e.extracted_content)))return void w((0,l.jsx)(F.A,{defaultMessage:"The same attachment was already added earlier. Claude sees the full conversation when replying, so there's no need to re-upload.",id:"KSgHlAYtgG"}));d(t=>[...t,...e]),r(e=>[...e,...t]),await Promise.resolve()},[c,w,d,r]),existingAttachments:o,existingFiles:a,numExistingConversationAttachments:u,numExistingConversationFiles:s,selectedModel:null!=f?f:j,blobFileUploadsEnabled:p,conversationUuid:m,wiggleEnabled:x,isLocalAgentMode:v,onImageBlocksReceived:b})}let U=()=>{let e=(0,b.mn)(),t=(0,T.useQueryClient)();return async(a,l,n)=>{let i=new FormData;i.append("file",a);let r=n?"/api/organizations/".concat(l,"/projects/").concat(n,"/upload"):"/api/".concat(l,"/upload"),s=await e(r,{method:"POST",body:i}),o=await s.json();if(s.ok)return n&&t.invalidateQueries({queryKey:[A.qz,{orgUuid:l,projectUuid:n}]}),o;throw(0,j.a5)({status:s.status,response:o,fallbackMessage:"File upload failed",headers:s.headers,endpoint:r,method:"POST"})}},O=e=>{var t;let{imagesEnabled:a,blobFileUploadsEnabled:n,rasterizePdfUploadsEnabled:s,onUploadComplete:o,onError:d,projectUuid:u,conversationUuid:c,wiggleEnabled:g,isLocalAgentMode:p=!1,onImageBlocksReceived:y}=e,{activeOrganization:h}=(0,w.YL)(),b=null!=(t=null==h?void 0:h.uuid)?t:"",[M]=(0,x.d)(),A=c||M,[k,P]=(0,S.useState)(!1),{addError:z}=(0,_.Yf)(),T=(()=>{let{addError:e}=(0,_.Yf)();return(0,S.useCallback)((t,a)=>{if(t instanceof j.LG){if("rate_limit_error"===t.type)return void e((0,l.jsxs)("p",{children:[(0,l.jsx)(F.A,{defaultMessage:"You’ve reached your limit for {resourceType} uploads. Please try again later.",id:"M88GeEDB7r",values:{resourceType:a}}),(0,l.jsx)(Q.W,{})]}),{error:t});if("document_password_protected"===t.errorCode)return void e((0,l.jsx)("p",{children:(0,l.jsx)(F.A,{defaultMessage:"The document you uploaded is password protected. Please remove the password and try again.",id:"DHwwKwuaCR"})}),{error:t})}if(t instanceof j.LG&&"Image is too large"===t.message)return void e((0,l.jsx)("p",{children:(0,l.jsx)(F.A,{defaultMessage:"Image is too large. Learn more",id:"SFbt+MAvby",values:{link:e=>(0,l.jsx)("a",{href:"https://support.anthropic.com/en/articles/9002500-what-kinds-of-images-can-i-upload-to-claude-ai",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-accent-main-100",children:e})}})}),{error:t});e((0,l.jsx)("p",{children:(0,l.jsx)(F.A,{defaultMessage:"Your {resourceType} upload failed. Please try again.",id:"ymWsV10Pz1",values:{resourceType:a}})}),{error:t})},[e])})(),L=(0,S.useCallback)(e=>{P(!1),z(e,{errorContext:{tags:{source:"file_upload"}}}),d&&d()},[z,d,P]),Y=(0,v.st)(),E=(0,S.useCallback)(async(e,t,d)=>{P(!0);try{if(p){if(!f())return void L("File upload is only available in Claude for Desktop.");let{files:t,imageBlocks:a,failedFiles:l}=await m(e,d);if(l.length>0){let e=l.map(e=>e.name).join(", ");L("Could not get file paths for: ".concat(e));return}t.length>0&&await o([],t),a.length>0&&y&&y(a);return}if(!b)throw Error("Organization not loaded. Please try again.");let c=(0,r.e)(),h=(0,r.O)(e),x=function(e){let{orgUuid:t,projectUuid:a,conversationUuid:l,imagesEnabled:n,rasterizePdfUploadsEnabled:r,blobFileUploadsEnabled:s,wiggleEnabled:o}=e;return{orgUuid:t,projectUuid:a,conversationUuid:l,modelConfig:{image_in:n,pdf_in:r},featureGates:{janus_claude_ai:r,ooc_attachments:s,use_canvas_resize:!0,wiggleEnabled:o},limits:i.XA}}({orgUuid:b,projectUuid:u,conversationUuid:A,imagesEnabled:a,rasterizePdfUploadsEnabled:s,blobFileUploadsEnabled:n,wiggleEnabled:g}),v=await c.processFiles(h,x),{attachments:w,files:_,errors:M}=function(e){let t=[],a=[],l=[];for(let l of e.successful){let e=l.data;"attachment"===l.type?"extracted_content"in e&&t.push(e):"file_kind"in e&&a.push(e)}for(let t of e.failed)l.push({file:t.file,error:t.error});return{attachments:t,files:a,errors:l}}(v);if(function(e,t,a){if(0===e.length)return!1;for(let l of K){let n=e.filter(e=>l.matcher(e.error));if(n.length>0){let e=l.extractor?l.extractor(n):n;return l.trackAnalytics&&l.trackAnalytics(a,e),t(l.createMessage(e)),!0}}for(let a of e)if(a.error instanceof q.o)return t((0,q.B)(a.error)),!0;return e.forEach(e=>t(e.error.message)),!0}(M,L,Y))return;let j=function(e,t,a){if(void 0===t||0===e.length)return e;let n=0,i=[];for(let r of e){if((n+=new Blob([r.extracted_content]).size/C.t2)>t)return a((0,l.jsx)(F.A,{defaultMessage:"Failed to upload file {filename}. Project knowledge exceeds maximum. Remove files to continue.",id:"MbvF6K3PJd",values:{filename:r.file_name}})),[];i.push(r)}return i}(w,t,L);if(0===j.length&&w.length>0)return;(j.length>0||_.length>0)&&await o(j,_)}catch(t){if(function(e,t){return e instanceof Error?(e.isRateLimit?t((0,l.jsx)(F.A,{defaultMessage:"Too many file upload attempts. Please wait and try again later.",id:"h/6cMHSn1V"})):413===e.statusCode||"file_too_large"===e.errorType?t((0,l.jsx)(F.A,{defaultMessage:"Uploaded file is too large. Try uploading a smaller part of the document, or copy/pasting an excerpt from the file.",id:"/mCoauj3Ws"})):"extraction_failed"===e.errorType?t((0,l.jsx)(F.A,{defaultMessage:"The file format may not be supported or the file may be corrupted.",id:"CvPTXPZIw8"})):t((0,l.jsx)(F.A,{defaultMessage:"One or more file uploads have failed. Please try again.",id:"FIwcYDeyIC"})),!0):(t((0,l.jsx)(F.A,{defaultMessage:"One or more file uploads have failed. Please try again.",id:"FIwcYDeyIC"})),!0)}(t,L))return;let e="file";t instanceof Error&&t.message.includes("image")&&(e="image"),T(t,e)}finally{P(!1)}},[n,o,a,A,L,T,b,Y,s,u,g,p,y]);return{isUploading:k,setIsUploading:P,handleError:L,handleUpload:E}};function I(e){let{className:t,...a}=e;return(0,l.jsx)("label",{className:(0,L.A)("relative grid place-content-center aspect-square rounded-xl cursor-pointer transition [fieldset:not(:disabled)_&]:hover:bg-bg-400 [fieldset:disabled_&]:opacity-50 [fieldset:disabled_&]:pointer-events-none focus-within:ring inline-flex items-center justify-center shrink-0 ring-offset-2 ring-offset-bg-300 ring-accent-main-100 focus-visible:outline-none focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none bg-[radial-gradient(ellipse,_var(--tw-gradient-stops))] from-bg-500/10 from-50% to-bg-500/30 border-0.5 border-border-400 font-medium font-ui text-text-100/90 transition-colors active:bg-bg-500/50 hover:text-text-000 hover:bg-bg-500/60",t),...a})}let V=()=>(0,k.fS)("janus_claude-ai")}}]);