7 lines
43 KiB
JavaScript
Raw Permalink Normal View History

2024-08-31 01:03:37 +08:00
/**
* Minified by jsDelivr using Terser v3.14.1.
* Original file: /npm/web-streams-polyfill@2.0.2/dist/ponyfill.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e=e||self).WebStreamsPolyfill={})}(this,function(e){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:function(e){return"Symbol("+e+")"};var t=Number.isNaN||function(e){return e!=e};function o(e){return"object"==typeof e&&null!==e||"function"==typeof e}function n(e){return e.slice()}function i(e){return!1!==function(e){if("number"!=typeof e)return!1;if(t(e))return!1;if(e<0)return!1;return!0}(e)&&e!==1/0}function a(e,r,t){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,r,t)}function s(e,r,t,o){var n=e[r];if(void 0!==n){if("function"!=typeof n)throw new TypeError(n+" is not a method");switch(t){case 0:return function(){return l(n,e,o)};case 1:return function(r){var t=[r].concat(o);return l(n,e,t)}}}return function(){return Promise.resolve()}}function u(e,r,t){var o=e[r];if(void 0!==o)return a(o,e,t)}function l(e,r,t){try{return Promise.resolve(a(e,r,t))}catch(e){return Promise.reject(e)}}function c(e){return e}function f(e){if(e=Number(e),t(e)||e<0)throw new RangeError("highWaterMark property of a queuing strategy must be non-negative and non-NaN");return e}function d(e){if(void 0===e)return function(){return 1};if("function"!=typeof e)throw new TypeError("size property of a queuing strategy must be a function");return function(r){return e(r)}}function _(e,r,t){for(var o=!1,n=function(e){!1===o&&(o=!0,t(e))},i=0,a=0,s=e.length,u=new Array(s),l=function(e){var t=i;!function(e,r,t){Promise.prototype.then.call(e,r,t)}(e,function(e){u[t]=e,++a===s&&r(u)},n),++i},c=0,f=e;c<f.length;c++){l(f[c])}}var h=function(){},b=function(){function e(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._size},enumerable:!0,configurable:!0}),e.prototype.push=function(e){var r=this._back,t=r;16383===r._elements.length&&(t={_elements:[],_next:void 0}),r._elements.push(e),t!==r&&(this._back=t,r._next=t),++this._size},e.prototype.shift=function(){var e=this._front,r=e,t=this._cursor,o=t+1,n=e._elements,i=n[t];return 16384===o&&(r=e._next,o=0),--this._size,this._cursor=o,e!==r&&(this._front=r),n[t]=void 0,i},e.prototype.forEach=function(e){for(var r=this._cursor,t=this._front,o=t._elements;!(r===o.length&&void 0===t._next||r===o.length&&(r=0,0===(o=(t=t._next)._elements).length));)e(o[r]),++r},e.prototype.peek=function(){var e=this._front,r=this._cursor;return e._elements[r]},e}();function p(e){var r=e._queue.shift();return e._queueTotalSize-=r.size,e._queueTotalSize<0&&(e._queueTotalSize=0),r.value}function m(e,r,t){if(!i(t=Number(t)))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:r,size:t}),e._queueTotalSize+=t}function y(e){e._queue=new b,e._queueTotalSize=0}var v=r("[[AbortSteps]]"),w=r("[[ErrorSteps]]"),g=function(){function e(e,r){void 0===e&&(e={}),void 0===r&&(r={}),R(this);var t=r.size,o=r.highWaterMark;if(void 0!==e.type)throw new RangeError("Invalid type is specified");var n=d(t);void 0===o&&(o=1),function(e,r,t,o){var n=Object.create(x.prototype);var i=s(r,"write",1,[n]),a=s(r,"close",0,[]),l=s(r,"abort",1,[]);D(e,n,function(){return u(r,"start",[n])},i,a,l,t,o)}(this,e,o=f(o),n)}return Object.defineProperty(e.prototype,"locked",{get:function(){if(!1===P(this))throw G("locked");return T(this)},enumerable:!0,configurable:!0}),e.prototype.abort=function(e){return!1===P(this)?Promise.reject(G("abort")):!0===T(this)?Promise.reject(new TypeError("Cannot abort a stream that already has a writer")):q(this,e)},e.prototype.getWriter=function(){if(!1===P(this))throw G("getWriter");return S(this)},e}();function S(e){return new k(e)}function R(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new b,e._inFlightWriteRequest=void 0,e._closeRequest=void 0