1import{r as d}from"./vendor-wagmi-CRHMQcRy.js";import{ag as i,ah as f}from"./index-CjDX1y09.js";const u=5443;class c extends Error{constructor(e){super(e),this.name="CloudflareImagesUploadError"}}function p(r){const e=r.errors?.find(a=>typeof a.message=="string");return e?.code===u?f:e?.message?e.message:"Cloudflare failed to accept the image"}const E=()=>{const r=i();return d.useCallback(async({file:e})=>{const a=await r();if(typeof a>"u"||typeof a.url>"u")return;const n=a.url,t=new FormData;t.append("file",e,e.name);const o=await(await fetch(n,{method:"POST",body:t})).json();if(typeof o>"u"||!o.success||typeof o.result?.variants>"u")throw new c(p(o));const s=o.result.variants.find(l=>l.endsWith("/original"));if(!(typeof s>"u"))return{version:"v1",imageUrl:s}},[r])};export{E as u};
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.