import{w as l,i as g,t as o,p as c}from"./drawing-BQ51fstA.js";import{$ as s,a1 as u}from"./App-CSvRzCsn.js";import"./sentry-common-2nFGZClv.js";import"./PrefsViewStore-B9QxYjkz.js";import"./index-F0fMEJXd.js";import"./index-CZYymlJf.js";import"./main-process-state-jW3BbbTQ.js";import"./index-jPDAJ20a.js";import"./report-dialog-DCdDPy0Y.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"4.2.860"}}catch{}})();try{(function(){var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7563e311-2356-437f-991a-5ee5c9997c85",e._sentryDebugIdIdentifier="sentry-dbid-7563e311-2356-437f-991a-5ee5c9997c85")})()}catch{}const d=l(new Worker(new URL(""+new URL("worker-Ci-N1dJm.js",import.meta.url).href,import.meta.url),{type:"module"}));async function p(e,t){logger.debug("tiff fetch");const a=await(await fetch(e)).arrayBuffer();if(logger.debug("tiff image fetched",a.byteLength,"bytes"),g){const r=t.transferControlToOffscreen();logger.debug("tiff worker decoding");const n=await d.decodeTIFF(o(a,[a]));logger.debug("tiff worker transferring"),await d.draw(o(n,[n.rgba.buffer]),o(r,[r]))}else{const r=await d.decodeTIFF(o(a,[a]));c(t,new ImageData(new Uint8ClampedArray(r.rgba),r.width,r.height))}logger.debug("tiff worker completed")}const x=({src:e,...t})=>{const f=s.useRef(!1),[a,r]=s.useState(!0),n=s.useCallback(i=>{f.current=i==null,i&&(async()=>{try{await p(e,i)}finally{f.current||r(!1)}})()},[e]);return u.jsx("canvas",{className:a?"img loading":"img",ref:n,...t,"data-sentry-component":"TiffImg","data-sentry-source-file":"index.tsx"})};export{x as default};
//# sourceMappingURL=index-74lQVcwe.js.map
