"use strict";var u=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var y=(e,s)=>{for(var t in s)f(e,t,{get:s[t],enumerable:!0})},m=(e,s,t,c)=>{if(s&&typeof s=="object"||typeof s=="function")for(let r of w(s))!d.call(e,r)&&r!==t&&f(e,r,{get:()=>s[r],enumerable:!(c=h(s,r))||c.enumerable});return e};var P=(e,s,t)=>(t=e!=null?u(p(e)):{},m(s||!e||!e.__esModule?f(t,"default",{value:e,enumerable:!0}):t,e)),g=e=>m(f({},"__esModule",{value:!0}),e);var $={};y($,{resolveAssetPath:()=>D});module.exports=g($);var l=require("react-native"),i=P(require("react-native-fs")),a=require("./pngImage");async function D(e,s){const t=(0,a.toPngFileName)(s),c=l.Image.resolveAssetSource(e);if(!c?.uri)throw new Error("Cannot resolve image resource");const{uri:r}=c;if(r.startsWith("file://"))return(0,a.ensurePngFile)(r,t);if(l.Platform.OS==="ios"&&r.startsWith("/"))return(0,a.ensurePngFile)(r,t);if(l.Platform.OS==="ios"&&r.startsWith("/"))return(0,a.ensurePngFile)(r,t);if(r.startsWith("http://")||r.startsWith("https://")){const o=`${i.default.CachesDirectoryPath}/tmp_${Date.now()}_${t}`,{statusCode:n}=await i.default.downloadFile({fromUrl:r,toFile:o}).promise;if(n!==200)throw new Error(`Download resource failed: ${t}`);try{return await(0,a.ensurePngFile)(o,t)}finally{await i.default.exists(o)&&await i.default.unlink(o)}}if(l.Platform.OS==="android"){const o=r.replace("asset:/","").replace("file:///android_asset/",""),n=`${i.default.CachesDirectoryPath}/tmp_${Date.now()}_${t}`;await i.default.copyFileAssets(o,n);try{return await(0,a.ensurePngFile)(n,t)}finally{await i.default.exists(n)&&await i.default.unlink(n)}}return(0,a.ensurePngFile)(r,t)}
