/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/podcast-index-api@1.1.10/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
const got=require("got"),crypto=require("crypto"),querystring=require("querystring"),BASE_API_URL="https://api.podcastindex.org/api/1.0/",PATH_SEARCH_BY_TERM="search/byterm",PATH_SEARCH_BY_TITLE="search/bytitle",PATH_SEARCH_EPISODE_BY_PERSON="search/byperson",PATH_ADD_BY_FEED_URL="add/byfeedurl",PATH_ADD_BY_ITUNES_ID="add/byitunesid",PATH_EPISODES_BY_FEED_ID="episodes/byfeedid",PATH_EPISODES_BY_FEED_URL="episodes/byfeedurl",PATH_EPISODES_BY_ITUNES_ID="episodes/byitunesid",PATH_EPISODES_BY_ID="episodes/byid",PATH_EPISODES_RANDOM="episodes/random",PATH_PODCASTS_BY_FEED_URL="podcasts/byfeedurl",PATH_PODCASTS_BY_FEED_ID="podcasts/byfeedid",PATH_PODCASTS_BY_ITUNES_ID="podcasts/byitunesid",PATH_PODCASTS_BY_GUID="podcasts/byguid",PATH_PODCASTS_BY_TAG="podcasts/bytag",PATH_PODCASTS_TRENDING="podcasts/trending",PATH_PODCASTS_DEAD="podcasts/dead",PATH_RECENT_FEEDS="recent/feeds",PATH_RECENT_EPISODES="recent/episodes",PATH_RECENT_NEWFEEDS="recent/newfeeds",PATH_RECENT_SOUNDBITES="recent/soundbites",PATH_VALUE_BY_FEED_ID="value/byfeedid",PATH_VALUE_BY_FEED_URL="value/byfeedurl",PATH_CATEGORIES_LIST="categories/list",PATH_HUB_PUBNOTIFIY="hub/pubnotify",qs=e=>"?"+querystring.stringify(e),withResponse=e=>{let s=e.body;if(500===e.statusCode||s.hasOwnProperty("status")&&"false"===s.status)throw s.hasOwnProperty("description")?{message:s.description,code:e.statusCode}:{message:"Request failed.",code:e.statusCode};return s};module.exports=(e,s,t)=>{if(!e||!s)throw new Error("API Key and Secret are required from https://api.podcastindex.org/");const d=got.extend({responseType:"json",prefixUrl:BASE_API_URL,throwHttpErrors:!1,hooks:{beforeRequest:[d=>{let a=(new Date).getTime()/1e3;d.headers["User-Agent"]=t||"PodcastIndexBot/@podcast@noagendasocial.com",d.headers["X-Auth-Date"]=a,d.headers["X-Auth-Key"]=e,d.headers.Authorization=crypto.createHash("sha1").update(e+s+a).digest("hex")}]}}),a=async(e,s)=>{const t=await d(e+qs(s));return withResponse(t)};return{api:d,custom:a,searchByTerm:async(e,s="",t=!1,d=!1)=>{let n={q:e};return""!==s&&(n.val=s),t&&(n.clean=""),d&&(n.fullText=""),a("search/byterm",n)},searchByTitle:async(e,s="",t=!1,d=!1)=>{let n={q:e};return""!==s&&(n.val=s),t&&(n.clean=""),d&&(n.fullText=""),a("search/bytitle",n)},searchEpisodesByPerson:async(e,s=!1)=>{let t={q:e};return s&&(t.fullText=""),a("search/byperson",t)},podcastsByFeedUrl:async e=>a("podcasts/byfeedurl",{url:e}),podcastsByFeedId:async e=>a("podcasts/byfeedid",{id:e}),podcastsByFeedItunesId:async e=>a("podcasts/byitunesid",{id:e}),podcastsByGUID:async e=>a("podcasts/byguid",{guid:e}),podcastsByTag:async()=>a("podcasts/bytag",{"podcast-value":""}),podcastsTrending:async(e=10,s=null,t=null,d=null,n=null)=>a("podcasts/trending",{max:e,since:s,lang:t,cat:d,notcat:n}),podcastsDead:async()=>a("podcasts/dead"),addByFeedUrl:async(e,s=null,t=null)=>a("add/byfeedurl",{url:e,chash:s,itunesid:t}),addByItunesId:async e=>a("add/byitunesid",{id:e}),episodesByFeedId:async(e,s=null,t=10,d=!1)=>{let n={id:e,since:s,max:t};return d&&(n.fullText=""),a("episodes/byfeedid",n)},episodesByFeedUrl:async(e,s=null,t=10,d=!1)=>{let n={url:e,since:s,max:t};return d&&(n.fullText=""),a("episodes/byfeedurl",n)},episodesByItunesId:async(e,s=null,t=10,d=!1)=>{let n={id:e,since:s,max:t};return d&&(n.fullText=""),a("episodes/byitunesid",n)},episodesById:async(e,s=!1)=>{let t={id:e};return s&&(t.fullText=""),a("episodes/byid",t)},episodesRandom:async(e=1,s=null,t=null,d=null,n=!1)=>{let r={max:e,lang:s,cat:t,notcat:d};return n&&(r.fullText=""),a("episodes/random",r)},recentFeeds:async(e=40,s=null,t=null,d=null,n=null)=>a("recent/feeds",{max:e,since:s,lang:d,cat:t,notcat:n}),recentEpisodes:async(e=10,s=null,t=null,d=!1)=>{let n={max:e,excludeString:s||null,before:t};return d&&(n.fullText=""),a("recent/episodes",n)},recentNewFeeds:async(e=20,s=null)=>a("recent/newfeeds",{max:e,since:s}),recentSoundbites:async(e=20)=>a("recent/soundbites",{max:e}),valueByFeedId:async e=>a("value/byfeedid",{id:e}),valueByFeedUrl:async e=>a("value/byfeedurl",{url:e}),categoriesList:async()=>a("categories/list"),hubPubNotifyById:async e=>a("hub/pubnotify",{id:e}),hubPubNotifyByUrl:async e=>a("hub/pubnotify",{url:e})}};
//# sourceMappingURL=/sm/ae8d0dc2564663608cb006fe0f58b72d786c776cf96c65bd9518daaea899fe76.map