import{E as v}from"./index-V4SUT3Zk.chunk.mjs";import{z as b}from"./preload-helper-DadE4qT2.chunk.mjs";import{n as w}from"./index-Dgdobvu3.chunk.mjs";class g extends Error{constructor(t){super(t),this.name="TimeoutError"}}class I extends Error{constructor(t){super(),this.name="AbortError",this.message=t}}const m=r=>globalThis.DOMException===void 0?new I(r):new DOMException(r),p=r=>{const t=r.reason===void 0?m("This operation was aborted."):r.reason;return t instanceof Error?t:m(t)};function E(r,t){const{milliseconds:e,fallback:i,message:n,customTimers:s={setTimeout,clearTimeout}}=t;let o;const c=new Promise((u,h)=>{if(typeof e!="number"||Math.sign(e)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(t.signal){const{signal:a}=t;a.aborted&&h(p(a)),a.addEventListener("abort",()=>{h(p(a))})}if(e===Number.POSITIVE_INFINITY){r.then(u,h);return}const d=new g;o=s.setTimeout.call(void 0,()=>{if(i){try{u(i())}catch(a){h(a)}return}typeof r.cancel=="function"&&r.cancel(),n===!1?u():n instanceof Error?h(n):(d.message=n??`Promise timed out after ${e} milliseconds`,h(d))},e),(async()=>{try{u(await r)}catch(a){h(a)}})()}).finally(()=>{c.clear()});return c.clear=()=>{s.clearTimeout.call(void 0,o),o=void 0},c}function T(r,t,e){let i=0,n=r.length;for(;n>0;){const s=Math.trunc(n/2);let o=i+s;e(r[o],t)<=0?(i=++o,n-=s+1):n=s}return i}class z{#t=[];enqueue(t,e){e={priority:0,...e};const i={priority:e.priority,id:e.id,run:t};if(this.size===0||this.#t[this.size-1].priority>=e.priority){this.#t.push(i);return}const n=T(this.#t,i,(s,o)=>o.priority-s.priority);this.#t.splice(n,0,i)}setPriority(t,e){const i=this.#t.findIndex(s=>s.id===t);if(i===-1)throw new ReferenceError(`No promise function with the id "${t}" exists in the queue.`);const[n]=this.#t.splice(i,1);this.enqueue(n.run,{priority:e,id:t})}dequeue(){return this.#t.shift()?.run}filter(t){return this.#t.filter(e=>e.priority===t.priority).map(e=>e.run)}get size(){return this.#t.length}}class q extends v{#t;#o;#n=0;#m;#a;#p=0;#e;#h;#r;#f;#i=0;#u;#s;#y;#b=1n;timeout;constructor(t){if(super(),t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:z,...t},!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${t.intervalCap?.toString()??""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${t.interval?.toString()??""}\` (${typeof t.interval})`);this.#t=t.carryoverConcurrencyCount,this.#o=t.intervalCap===Number.POSITIVE_INFINITY||t.interval===0,this.#m=t.intervalCap,this.#a=t.interval,this.#r=new t.queueClass,this.#f=t.queueClass,this.concurrency=t.concurrency,this.timeout=t.timeout,this.#y=t.throwOnTimeout===!0,this.#s=t.autoStart===!1}get#w(){return this.#o||this.#n{this.#T()},e)),!0}return!1}#c(){if(this.#r.size===0)return this.#e&&clearInterval(this.#e),this.#e=void 0,this.emit("empty"),this.#i===0&&this.emit("idle"),!1;if(!this.#s){const t=!this.#z;if(this.#w&&this.#I){const e=this.#r.dequeue();return e?(this.emit("active"),e(),t&&this.#g(),!0):!1}}return!1}#g(){this.#o||this.#e!==void 0||(this.#e=setInterval(()=>{this.#v()},this.#a),this.#p=Date.now()+this.#a)}#v(){this.#n===0&&this.#i===0&&this.#e&&(clearInterval(this.#e),this.#e=void 0),this.#n=this.#t?this.#i:0,this.#l()}#l(){for(;this.#c(););}get concurrency(){return this.#u}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this.#u=t,this.#l()}async#N(t){return new Promise((e,i)=>{t.addEventListener("abort",()=>{i(t.reason)},{once:!0})})}setPriority(t,e){this.#r.setPriority(t,e)}async add(t,e={}){return e.id??=(this.#b++).toString(),e={timeout:this.timeout,throwOnTimeout:this.#y,...e},new Promise((i,n)=>{this.#r.enqueue(async()=>{this.#i++;try{e.signal?.throwIfAborted(),this.#n++;let s=t({signal:e.signal});e.timeout&&(s=E(Promise.resolve(s),{milliseconds:e.timeout})),e.signal&&(s=Promise.race([s,this.#N(e.signal)]));const o=await s;i(o),this.emit("completed",o)}catch(s){if(s instanceof g&&!e.throwOnTimeout){i();return}n(s),this.emit("error",s)}finally{this.#E()}},e),this.emit("add"),this.#c()})}async addAll(t,e){return Promise.all(t.map(async i=>this.add(i,e)))}start(){return this.#s?(this.#s=!1,this.#l(),this):this}pause(){this.#s=!0}clear(){this.#r=new this.#f}async onEmpty(){this.#r.size!==0&&await this.#d("empty")}async onSizeLessThan(t){this.#r.sizethis.#r.size{const n=()=>{e&&!e()||(this.off(t,n),i())};this.on(t,n)})}get size(){return this.#r.size}sizeBy(t){return this.#r.filter(t).length}get pending(){return this.#i}get isPaused(){return this.#s}}const l={name:"NcProgressBar",props:{value:{type:Number,default:0,validator(r){return r>=0&&r<=100}},size:{type:[String,Number],default:"small",validator(r){return["small","medium"].includes(r)||typeof r=="number"}},error:{type:Boolean,default:!1},type:{type:String,default:"linear",validator(r){return["linear","circular"].includes(r)}},color:{type:String,default:null}},data(){return{stroke:4}},computed:{height(){return this.type==="circular"?Number.isInteger(this.size)?this.size:44:this.size==="small"?4:this.size==="medium"?6:this.size},progress(){return this.value/100},radius(){return this.height/2},radiusNormalized(){return this.radius-3*this.stroke},circumference(){return this.radiusNormalized*2*Math.PI}}},f=()=>{b((r,t)=>({"15a054de":r.color}))},y=l.setup;l.setup=y?(r,t)=>(f(),y(r,t)):f;const N=l;var x=function(){var r=this,t=r._self._c;return r.type==="circular"?t("span",{staticClass:"progress-bar progress-bar--circular",class:{"progress-bar--error":r.error},style:{"--progress-bar-height":r.height+"px"},attrs:{role:"progressbar","aria-valuenow":r.value}},[t("svg",{attrs:{height:r.height,width:r.height}},[t("circle",{attrs:{stroke:"currentColor",fill:"transparent","stroke-dasharray":`${r.progress*r.circumference} ${(1-r.progress)*r.circumference}`,"stroke-dashoffset":.25*r.circumference,"stroke-width":r.stroke,r:r.radiusNormalized,cx:r.radius,cy:r.radius}}),t("circle",{attrs:{stroke:"var(--color-background-darker)",fill:"transparent","stroke-dasharray":`${(1-r.progress)*r.circumference} ${r.progress*r.circumference}`,"stroke-dashoffset":(.25-r.progress)*r.circumference,"stroke-width":r.stroke,r:r.radiusNormalized,cx:r.radius,cy:r.radius}})])]):t("progress",{staticClass:"progress-bar progress-bar--linear vue",class:{"progress-bar--error":r.error},style:{"--progress-bar-height":r.height+"px"},attrs:{max:"100"},domProps:{value:r.value}})},P=[],C=w(N,x,P,!1,null,"06c9abdc");const O=C.exports;export{O as N,q as P}; //# sourceMappingURL=NcProgressBar-D7zYeXBH-uJjZguS5.chunk.mjs.map