import{useMemo as r}from"react";const p=({downloadUrls:n,defaultFileName:i})=>r(()=>{if(n)return n.map(({title:e,url:t})=>({url:t,title:e||o(t,i||"openapi.yaml"),iconType:s(t)}))},[n,i]);function o(n,i){const e=n.split("?")[0].split(/[\\\/]/).pop();return!e||!e.includes("yaml")&&!e.includes("json")?i:e}function s(n,i){const e=i||n.split("?")[0].split(/[\\\/]/).pop();return e?e.includes("yaml")?"yaml":e.includes("json")?"json":"file":"file"}export{p as useDownloadInfo};
