import{$ as l,a1 as r}from"./App-B8XlOBJo.js";import{i as f,t as o,p as s}from"./drawing-Cmey49do.js";import"./sentry-common-rTXItwGA.js";import"./PrefsViewStore-Cx4TYLp6.js";import"./index-D2Vj8hEx.js";import"./index-CQwKdOGl.js";import"./main-process-state-jW3BbbTQ.js";import"./index-jPDAJ20a.js";import"./report-dialog-DVH6bOL-.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:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f40ab83b-d7b3-4f13-b763-f8859bd29462",e._sentryDebugIdIdentifier="sentry-dbid-f40ab83b-d7b3-4f13-b763-f8859bd29462")})()}catch{}const I=new ComlinkWorker(new URL("data:video/mp2t;base64,aW1wb3J0IFVUSUYgZnJvbSAndXRpZicKaW1wb3J0IHsgcHV0SW1hZ2VEYXRhIH0gZnJvbSAnLi4vSGVpZkltZy9kcmF3aW5nJwoKLy8gRklYTUU6IHNhbWUgYXMgSW1hZ2VEYXRhLCBidXQgbm8gY29sb3JzcGFjZT8KZXhwb3J0IHR5cGUgVElGRkltYWdlID0gewogIHJnYmE6IFVpbnQ4QXJyYXkKICB3aWR0aDogbnVtYmVyCiAgaGVpZ2h0OiBudW1iZXIKfQoKLy8gaHR0cHM6Ly9naXRodWIuY29tL3Bob3RvcGVhL1VUSUYuanMvYmxvYi84MjA1YzFmMDgxMWM1ZTFjMDFiMThlOTYxMTk0NTc4NjIxYTQ0MDZjL1VUSUYuanMjTDEwNjIKZXhwb3J0IGZ1bmN0aW9uIGRlY29kZVRJRkYoYnVmZmVyOiBBcnJheUJ1ZmZlcik6IFRJRkZJbWFnZSB7CiAgY29uc3QgaWZkcyA9IFVUSUYuZGVjb2RlKGJ1ZmZlcikKICBsZXQgbWEgPSAwCiAgbGV0IHZzbnMgPSBpZmRzCiAgbGV0IHBhZ2UgPSB2c25zWzBdCiAgLy8gQHRzLWV4cGVjdC1lcnJvcgogIGlmIChpZmRzWzBdLnN1YklGRCkgdnNucyA9IHZzbnMuY29uY2F0KGlmZHNbMF0uc3ViSUZEKQogIGZvciAoY29uc3QgaW1nIG9mIHZzbnMpIHsKICAgIC8vIEB0cy1leHBlY3QtZXJyb3IKICAgIGlmIChpbWcudDI1OCA9PSBudWxsIHx8IGltZy50MjU4Lmxlbmd0aCA8IDMpIGNvbnRpbnVlCiAgICAvLyBAdHMtZXhwZWN0LWVycm9yCiAgICBjb25zdCBhciA9IGltZy50MjU2ICogaW1nLnQyNTcKICAgIGlmIChhciA+IG1hKSB7CiAgICAgIG1hID0gYXIKICAgICAgcGFnZSA9IGltZwogICAgfQogIH0KICAvLyBAdHMtZXhwZWN0LWVycm9yCiAgVVRJRi5kZWNvZGVJbWFnZShidWZmZXIsIHBhZ2UsIGlmZHMpCiAgY29uc3QgcmdiYSA9IFVUSUYudG9SR0JBOChwYWdlKQogIGNvbnN0IHsgd2lkdGgsIGhlaWdodCB9ID0gcGFnZQogIHJldHVybiB7IHJnYmEsIHdpZHRoLCBoZWlnaHQgfQp9CgpleHBvcnQgZnVuY3Rpb24gZHJhdyh7IHJnYmEsIHdpZHRoLCBoZWlnaHQgfTogVElGRkltYWdlLCBjYW52YXM6IE9mZnNjcmVlbkNhbnZhcykgewogIHB1dEltYWdlRGF0YShjYW52YXMsIG5ldyBJbWFnZURhdGEobmV3IFVpbnQ4Q2xhbXBlZEFycmF5KHJnYmEuYnVmZmVyKSwgd2lkdGgsIGhlaWdodCkpCn0K",import.meta.url),{type:"module"});async function b(e,n){logger.debug("tiff fetch");const g=await(await fetch(e)).arrayBuffer();if(logger.debug("tiff image fetched",g.byteLength,"bytes"),f){const t=n.transferControlToOffscreen();logger.debug("tiff worker decoding");const a=await I.decodeTIFF(o(g,[g]));logger.debug("tiff worker transferring"),await I.draw(o(a,[a.rgba.buffer]),o(t,[t]))}else{const t=await I.decodeTIFF(o(g,[g]));s(n,new ImageData(new Uint8ClampedArray(t.rgba),t.width,t.height))}logger.debug("tiff worker completed")}const w=({src:e,...n})=>{const i=l.useRef(!1),[g,t]=l.useState(!0),a=l.useCallback(d=>{i.current=d==null,d&&(async()=>{try{await b(e,d)}finally{i.current||t(!1)}})()},[e]);return r.jsx("canvas",{className:g?"img loading":"img",ref:a,...n,"data-sentry-component":"TiffImg","data-sentry-source-file":"index.tsx"})};export{w as default};
//# sourceMappingURL=index-uExMoLEq.js.map
