import{useMemo}from"react";export const useDownloadInfo=({downloadUrls:e,defaultFileName:l})=>useMemo((()=>{if(e)return e.map((({title:e,url:o})=>({url:o,title:e||getFileNameFromUrl(o,l||"openapi.yaml"),iconType:getIconTypeFromUrl(o)})))}),[e,l]);function getFileNameFromUrl(e,l){const o=e.split("?")[0].split(/[\\\/]/).pop();return o&&(o.includes("yaml")||o.includes("json"))?o:l}function getIconTypeFromUrl(e,l){const o=l||e.split("?")[0].split(/[\\\/]/).pop();return o?o.includes("yaml")?"yaml":o.includes("json")?"json":"file":"file"}
//# sourceMappingURL=useDownloadInfo.js.map