import{dt as e,nt as t,ot as r,xt as n,yt as a}from"./vendor-all-1-BfXMvJfI.js";function i(i,s,o){var c;return a(this,void 0,void 0,function(){var l,u,d,f,m=this;return n(this,function(v){switch(v.label){case 0:return e()?[2,[]]:(l=r(),u=null!==(c=s.enabledMiddleware)&&void 0!==c?c:{},d=Object.entries(u).filter(function(e){return e[0],e[1]}).map(function(e){return e[0]}),f=d.map(function(e){return a(m,void 0,void 0,function(){var r,a,s,c;return n(this,function(n){switch(n.label){case 0:r=e.replace("@segment/",""),a=r,o&&(a=btoa(r).replace(/=/g,"")),s="".concat(l,"/middleware/").concat(a,"/latest/").concat(a,".js.gz"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,t(s)];case 2:return n.sent(),[2,window["".concat(r,"Middleware")]];case 3:return c=n.sent(),i.log("error",c),i.stats.increment("failed_remote_middleware"),[3,4];case 4:return[2]}})})}),[4,Promise.all(f)]);case 1:return[2,v.sent().filter(Boolean)]}})})}export{i as remoteMiddlewares};