"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[5],{206:e=>{var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,r,s,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var u=new i(r,s||e,o),a=n?n+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],u]:e._events[a].push(u):(e._events[a]=u,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function u(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),u.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},u.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,s=r.length,o=new Array(s);i{n.d(t,{a:()=>c});var r=n(206);class i extends Error{constructor(e){super(e),this.name="TimeoutError"}}class s extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const o=e=>void 0===globalThis.DOMException?new s(e):new DOMException(e),u=e=>{const t=void 0===e.reason?o("This operation was aborted."):e.reason;return t instanceof Error?t:o(t)};class a{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,id:t.id,run:e};if(0===this.size||this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const r=function(e,t){let n=0,r=e.length;for(;r>0;){const s=Math.trunc(r/2);let o=n+s;i=e[o],t.priority-i.priority<=0?(n=++o,r-=s+1):r=s}var i;return n}(this.#e,n);this.#e.splice(r,0,n)}setPriority(e,t){const n=this.#e.findIndex((t=>t.id===e));if(-1===n)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);const[r]=this.#e.splice(n,1);this.enqueue(r.run,{priority:t,id:e})}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class c extends r.EventEmitter{#t;#n;#r=0;#i;#s;#o=0;#u;#a;#e;#c;#h=0;#l;#v;#d;#p=1n;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:a,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#s=e.interval,this.#e=new e.queueClass,this.#c=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#d=!0===e.throwOnTimeout,this.#v=!1===e.autoStart}get#f(){return this.#n||this.#r{this.#g()}),t)),!0;this.#r=this.#t?this.#h:0}return!1}#I(){if(0===this.#e.size)return this.#u&&clearInterval(this.#u),this.#u=void 0,this.emit("empty"),0===this.#h&&this.emit("idle"),!1;if(!this.#v){const e=!this.#b;if(this.#f&&this.#y){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#C(),!0)}}return!1}#C(){this.#n||void 0!==this.#u||(this.#u=setInterval((()=>{this.#w()}),this.#s),this.#o=Date.now()+this.#s)}#w(){0===this.#r&&0===this.#h&&this.#u&&(clearInterval(this.#u),this.#u=void 0),this.#r=this.#t?this.#h:0,this.#E()}#E(){for(;this.#I(););}get concurrency(){return this.#l}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#l=e,this.#E()}async#T(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}setPriority(e,t){this.#e.setPriority(e,t)}async add(e,t={}){return t.id??=(this.#p++).toString(),t={timeout:this.timeout,throwOnTimeout:this.#d,...t},new Promise(((n,r)=>{this.#e.enqueue((async()=>{this.#h++,this.#r++;try{t.signal?.throwIfAborted();let r=e({signal:t.signal});t.timeout&&(r=function(e,t){const{milliseconds:n,fallback:r,message:s,customTimers:o={setTimeout,clearTimeout}}=t;let a,c;const h=new Promise(((h,l)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&l(u(e)),c=()=>{l(u(e))},e.addEventListener("abort",c,{once:!0})}if(n===Number.POSITIVE_INFINITY)return void e.then(h,l);const v=new i;a=o.setTimeout.call(void 0,(()=>{if(r)try{h(r())}catch(e){l(e)}else"function"==typeof e.cancel&&e.cancel(),!1===s?h():s instanceof Error?l(s):(v.message=s??`Promise timed out after ${n} milliseconds`,l(v))}),n),(async()=>{try{h(await e)}catch(e){l(e)}})()})).finally((()=>{h.clear(),c&&t.signal&&t.signal.removeEventListener("abort",c)}));return h.clear=()=>{o.clearTimeout.call(void 0,a),a=void 0},h}(Promise.resolve(r),{milliseconds:t.timeout})),t.signal&&(r=Promise.race([r,this.#T(t.signal)]));const s=await r;n(s),this.emit("completed",s)}catch(e){if(e instanceof i&&!t.throwOnTimeout)return void n();r(e),this.emit("error",e)}finally{this.#m()}}),t),this.emit("add"),this.#I()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#v?(this.#v=!1,this.#E(),this):this}pause(){this.#v=!0}clear(){this.#e=new this.#c}async onEmpty(){0!==this.#e.size&&await this.#q("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const r=()=>{t&&!t()||(this.off(e,r),n())};this.on(e,r)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#h}get isPaused(){return this.#v}}}}]);