import{__exports as r}from"../../../_virtual/esnext.async-iterator.reduce.mjs";import{__require as e}from"../internals/export.mjs";import{__require as t}from"../internals/function-call.mjs";import{__require as i}from"../internals/a-callable.mjs";import{__require as n}from"../internals/an-object.mjs";import{__require as o}from"../internals/is-object.mjs";import{__require as a}from"../internals/get-built-in.mjs";import{__require as s}from"../internals/get-iterator-direct.mjs";import{__require as m}from"../internals/async-iterator-close.mjs";var c;function u(){if(c)return r;c=1;var u=e(),l=t(),f=i(),_=n(),p=o(),v=a(),j=s(),h=m(),q=v("Promise"),y=TypeError;return u({target:"AsyncIterator",proto:!0,real:!0,forced:!0},{reduce:function(r){_(this),f(r);var e=j(this),t=e.iterator,i=e.next,n=arguments.length<2,o=n?void 0:arguments[1],a=0;return new q(function(e,s){var m=function(r){h(t,s,r,s)},c=function(){try{q.resolve(_(l(i,t))).then(function(t){try{if(_(t).done)n?s(new y("Reduce of empty iterator with no initial value")):e(o);else{var i=t.value;if(n)n=!1,o=i,c();else try{var u=r(o,i,a),l=function(r){o=r,c()};p(u)?q.resolve(u).then(l,m):l(u)}catch(r){m(r)}}a++}catch(r){s(r)}},s)}catch(r){s(r)}};c()})}}),r}export{u as __require};