function e(...r){let t=Array.from(Array.isArray(r[0])?r[0]:r);return function(e){let r=[];if(0===e.length)return"";if("string"!=typeof e[0])throw TypeError("Url must be a string. Received "+e[0]);e[0].match(/^[^/:]+:\/*$/)&&e.length>1&&(e[0]=e.shift()+e[0]),e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(let t=0;t<e.length;t++){let l=e[t];if("string"!=typeof l)throw TypeError("Url must be a string. Received "+l);""!==l&&(t>0&&(l=l.replace(/^\/+/,"")),l=t<e.length-1?l.replace(/\/+$/,""):l.replace(/\/+$/,"/"),r.push(l))}let t=r.join("/");t=t.replace(/\/(\?|&|#[^!])/g,"$1");let l=t.split("?");return l.shift()+(l.length>0?"?":"")+l.join("&")}(t)}export{e as urlJoin};
