when-4bbc8319.js 3.5 KB

1
  1. define(["exports"],function(n){"use strict";function r(n,r){return null!=n?n:r}r.EMPTY_OBJECT=Object.freeze({});var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(n,r,e){return n(e={path:r,exports:{},require:function(n,r){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==r&&e.path)}},e.exports),e.exports}var u=t(function(n,r){var e;e=function(){var e,t,l;function y(n,r,e,t){return a(n).then(r,e,t)}function a(n){var r,e,n=n instanceof h?n:u(n)?(r=m(),n.then(function(n){r.resolve(n)},function(n){r.reject(n)},function(n){r.progress(n)}),r.promise):(e=n,new h(function(n){try{return a(n?n(e):e)}catch(n){return p(n)}}));return n}function h(n){this.then=n}function p(e){return new h(function(n,r){try{return r?a(r(e)):p(e)}catch(n){return p(n)}})}function m(){var n=new h(u),i=[],f=[],t=function(r,e,t){var u=m(),o="function"==typeof t?function(n){try{u.progress(t(n))}catch(n){u.progress(n)}}:function(n){u.progress(n)};return i.push(function(n){n.then(r,e).then(u.resolve,u.reject,o)}),f.push(o),u.promise},r=function(n){return v(f,n),n},e=function(n){return n=a(n),t=n.then,e=a,r=w,v(i,n),f=i=l,n};return{then:u,resolve:o,reject:c,progress:s,promise:n,resolver:{resolve:o,reject:c,progress:s}};function u(n,r,e){return t(n,r,e)}function o(n){return e(n)}function c(n){return e(p(n))}function s(n){return r(n)}}function u(n){return n&&"function"==typeof n.then}function o(n,p,v,d,g){return c(2,arguments),y(n,function(n){var r,e,t,u,o=n.length>>>0,i=Math.max(0,Math.min(p,o)),f=[],c=o-i+1,s=[],l=m();if(i)for(t=l.progress,e=function(n){s.push(n),--c||(r=e=w,l.reject(s))},r=function(n){f.push(n),--i||(r=e=w,l.resolve(f))},u=0;u<o;++u)u in n&&y(n[u],h,a,t);else l.resolve(f);return l.then(v,d,g);function a(n){e(n)}function h(n){r(n)}})}function i(n,r,e,t){return c(1,arguments),f(n,s).then(r,e,t)}function f(n,f){return y(n,function(n){var r,e,t,u=r=n.length>>>0,o=[],i=m();if(u)for(e=function(n,r){y(n,f).then(function(n){o[r]=n,--u||i.resolve(o)},i.reject)},t=0;t<r;t++)t in n?e(n[t],t):--u;else i.resolve(o);return i.promise})}function v(n,r){for(var e,t=0;e=n[t++];)e(r)}function c(n,r){for(var e,t=r.length;n<t;)if(null!=(e=r[--t])&&"function"!=typeof e)throw new Error("arg "+t+" must be a function")}function w(){}function s(n){return n}return y.defer=m,y.resolve=a,y.reject=function(n){return y(n,p)},y.join=function(){return f(arguments,s)},y.all=i,y.map=f,y.reduce=function(n,o){var r=t.call(arguments,1);return y(n,function(n){var u=n.length;return r[0]=function(n,e,t){return y(n,function(r){return y(e,function(n){return o(r,n,t,u)})})},e.apply(n,r)})},y.any=function(n,r,e,t){return o(n,1,function(n){return r?r(n[0]):n[0]},e,t)},y.some=o,y.chain=function(n,r,e){var t=2<arguments.length;return y(n,function(n){return r.resolve(n=t?e:n),n},function(n){return r.reject(n),p(n)},r.progress)},y.isPromise=u,h.prototype={always:function(n,r){return this.then(n,n,r)},otherwise:function(n){return this.then(l,n)},yield:function(n){return this.then(function(){return n})},spread:function(r){return this.then(function(n){return i(n,function(n){return r.apply(l,n)})})}},t=[].slice,e=[].reduce||function(n){var r,e=0,t=Object(this),u=t.length>>>0,o=arguments;if(o.length<=1)for(;;){if(e in t){r=t[e++];break}if(++e>=u)throw new TypeError}else r=o[1];for(;e<u;++e)e in t&&(r=n(r,t[e],e,t));return r},y},n.exports=e()});n.commonjsGlobal=e,n.createCommonjsModule=t,n.defaultValue=r,n.defined=function(n){return null!=n},n.when=u});