import{L as H,a4 as W,q as j,a5 as G,h as T,a6 as J,v as Y,U as A,C as Q,a7 as X,g as I,a8 as Z,a9 as k,aa as K,D as tt,ab as et,ac as ot,ad as N,ae as at}from"./DamWCzlT.js";const st={trailing:!0};function rt(e,t=25,a={}){if(a={...st,...a},!Number.isFinite(t))throw new TypeError("Expected `wait` to be a finite number");let s,o,l=[],n,r;const p=(d,m)=>(n=nt(e,d,m),n.finally(()=>{if(n=null,a.trailing&&r&&!o){const D=p(d,r);return r=null,D}}),n),v=function(...d){return a.trailing&&(r=d),n||new Promise(m=>{const D=!o&&a.leading;clearTimeout(o),o=setTimeout(()=>{o=null;const c=a.leading?s:p(this,d);r=null;for(const h of l)h(c);l=[]},t),D?(s=p(this,d),m(s)):l.push(m)})},i=d=>{d&&(clearTimeout(d),o=null)};return v.isPending=()=>!!o,v.cancel=()=>{i(o),l=[],r=null},v.flush=()=>{if(i(o),!r||n)return;const d=r;return r=null,p(this,d)},v}async function nt(e,t,a){return await e.apply(t,a)}function it(...e){const t=typeof e[e.length-1]=="string"?e.pop():void 0;q(e[0],e[1])&&e.unshift(t);let[a,s,o={}]=e,l=!1;const n=T(()=>k(a));if(typeof n.value!="string")throw new TypeError("[nuxt] [useAsyncData] key must be a string.");if(typeof s!="function")throw new TypeError("[nuxt] [useAsyncData] handler must be a function.");const r=H();o.server??=!0,o.default??=ct,o.getCachedData??=U,o.lazy??=!1,o.immediate??=!0,o.deep??=W.deep,o.dedupe??="cancel",o._functionName,r._asyncData[n.value];function p(){const c={cause:"initial",dedupe:o.dedupe};return r._asyncData[n.value]?._init||(c.cachedData=o.getCachedData(n.value,r,{cause:"initial"}),r._asyncData[n.value]=B(r,n.value,s,o,c.cachedData)),()=>r._asyncData[n.value].execute(c)}const v=p(),i=r._asyncData[n.value];i._deps++;const d=o.server!==!1&&r.payload.serverRendered;{let c=function(f){const u=r._asyncData[f];u?._deps&&(u._deps--,u._deps===0&&u?._off())};const h=at();if(h&&d&&o.immediate&&!h.sp&&(h.sp=[]),h&&!h._nuxtOnBeforeMountCbs){h._nuxtOnBeforeMountCbs=[];const f=h._nuxtOnBeforeMountCbs;K(()=>{f.forEach(u=>{u()}),f.splice(0,f.length)}),tt(()=>f.splice(0,f.length))}const C=h&&(h._nuxtClientOnly||et(ot,!1));d&&r.isHydrating&&(i.error.value||i.data.value!==void 0)?i.status.value=i.error.value?"error":"success":h&&(!C&&r.payload.serverRendered&&r.isHydrating||o.lazy)&&o.immediate?h._nuxtOnBeforeMountCbs.push(v):o.immediate&&i.status.value!=="success"&&v();const g=J(),b=j(n,(f,u)=>{if((f||u)&&f!==u){l=!0;const M=r._asyncData[u]?.data.value!==void 0,x=r._asyncDataPromises[u]!==void 0,R={cause:"initial",dedupe:o.dedupe};if(!r._asyncData[f]?._init){let L;u&&M?L=r._asyncData[u].data.value:(L=o.getCachedData(f,r,{cause:"initial"}),R.cachedData=L),r._asyncData[f]=B(r,f,s,o,L)}r._asyncData[f]._deps++,u&&c(u),(o.immediate||M||x)&&r._asyncData[f].execute(R),N(()=>{l=!1})}},{flush:"sync"}),w=o.watch?j(o.watch,()=>{l||(r._asyncData[n.value]?._execute.isPending()&&N(()=>{r._asyncData[n.value]?._execute.flush()}),r._asyncData[n.value]?._execute({cause:"watch",dedupe:o.dedupe}))}):()=>{};g&&G(()=>{b(),w(),c(n.value)})}const m={data:S(()=>r._asyncData[n.value]?.data),pending:S(()=>r._asyncData[n.value]?.pending),status:S(()=>r._asyncData[n.value]?.status),error:S(()=>r._asyncData[n.value]?.error),refresh:(...c)=>r._asyncData[n.value]?._init?r._asyncData[n.value].execute(...c):p()(),execute:(...c)=>m.refresh(...c),clear:()=>{const c=r._asyncData[n.value];if(c?._abortController)try{c._abortController.abort(new DOMException("AsyncData aborted by user.","AbortError"))}finally{c._abortController=void 0}V(r,n.value)}},D=Promise.resolve(r._asyncDataPromises[n.value]).then(()=>m);return Object.assign(D,m),D}function S(e){return T({get(){return e()?.value},set(t){const a=e();a&&(a.value=t)}})}function mt(...e){const t=typeof e[e.length-1]=="string"?e.pop():void 0;q(e[0],e[1])&&e.unshift(t);const[a,s,o={}]=e;return it(a,s,{...o,lazy:!0},null)}function q(e,t){return!(typeof e=="string"||typeof e=="object"&&e!==null||typeof e=="function"&&typeof t=="function")}function V(e,t){t in e.payload.data&&(e.payload.data[t]=void 0),t in e.payload._errors&&(e.payload._errors[t]=void 0),e._asyncData[t]&&(e._asyncData[t].data.value=I(e._asyncData[t]._default()),e._asyncData[t].error.value=void 0,e._asyncData[t].status.value="idle"),t in e._asyncDataPromises&&(e._asyncDataPromises[t]=void 0)}function lt(e,t){const a={};for(const s of t)a[s]=e[s];return a}function B(e,t,a,s,o){e.payload._errors[t]??=void 0;const l=s.getCachedData!==U,n=a,r=s.deep?Y:A,p=o!==void 0,v=e.hook("app:data:refresh",async d=>{(!d||d.includes(t))&&await i.execute({cause:"refresh:hook"})}),i={data:r(p?o:s.default()),pending:T(()=>i.status.value==="pending"),error:Z(e.payload._errors,t),status:A("idle"),execute:(...d)=>{const[m,D=void 0]=d,c=m&&D===void 0&&typeof m=="object"?m:{};if(e._asyncDataPromises[t]&&(c.dedupe??s.dedupe)==="defer")return e._asyncDataPromises[t];{const g="cachedData"in c?c.cachedData:s.getCachedData(t,e,{cause:c.cause??"refresh:manual"});if(g!==void 0)return e.payload.data[t]=i.data.value=g,i.error.value=void 0,i.status.value="success",Promise.resolve(g)}i._abortController&&i._abortController.abort(new DOMException("AsyncData request cancelled by deduplication","AbortError")),i._abortController=new AbortController,i.status.value="pending";const h=new AbortController,C=new Promise((g,b)=>{try{const w=c.timeout??s.timeout,f=ut([i._abortController?.signal,c?.signal],h.signal,w);if(f.aborted){const u=f.reason;b(u instanceof Error?u:new DOMException(String(u??"Aborted"),"AbortError"));return}return f.addEventListener("abort",()=>{const u=f.reason;b(u instanceof Error?u:new DOMException(String(u??"Aborted"),"AbortError"))},{once:!0,signal:h.signal}),Promise.resolve(n(e,{signal:f})).then(g,b)}catch(w){b(w)}}).then(async g=>{let b=g;s.transform&&(b=await s.transform(g)),s.pick&&(b=lt(b,s.pick)),e.payload.data[t]=b,i.data.value=b,i.error.value=void 0,i.status.value="success"}).catch(g=>{if(e._asyncDataPromises[t]&&e._asyncDataPromises[t]!==C||i._abortController?.signal.aborted)return e._asyncDataPromises[t];if(typeof DOMException<"u"&&g instanceof DOMException&&g.name==="AbortError")return i.status.value="idle",e._asyncDataPromises[t];i.error.value=X(g),i.data.value=I(s.default()),i.status.value="error"}).finally(()=>{h.abort(),delete e._asyncDataPromises[t]});return e._asyncDataPromises[t]=C,e._asyncDataPromises[t]},_execute:rt((...d)=>i.execute(...d),0,{leading:!0}),_default:s.default,_deps:0,_init:!0,_hash:void 0,_off:()=>{v(),e._asyncData[t]?._init&&(e._asyncData[t]._init=!1),l||Q(()=>{e._asyncData[t]?._init||(V(e,t),i.execute=()=>Promise.resolve())})}};return i}const ct=()=>{},U=(e,t,a)=>{if(t.isHydrating)return t.payload.data[e];if(a.cause!=="refresh:manual"&&a.cause!=="refresh:hook")return t.static.data[e]};function ut(e,t,a){const s=e.filter(n=>!!n);if(typeof a=="number"&&a>=0){const n=AbortSignal.timeout?.(a);n&&s.push(n)}if(AbortSignal.any)return AbortSignal.any(s);const o=new AbortController;for(const n of s)if(n.aborted){const r=n.reason??new DOMException("Aborted","AbortError");try{o.abort(r)}catch{o.abort()}return o.signal}const l=()=>{const r=s.find(p=>p.aborted)?.reason??new DOMException("Aborted","AbortError");try{o.abort(r)}catch{o.abort()}};for(const n of s)n.addEventListener?.("abort",l,{once:!0,signal:t});return o.signal}const y={fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,debug:4,trace:5,verbose:Number.POSITIVE_INFINITY},z={silent:{level:-1},fatal:{level:y.fatal},error:{level:y.error},warn:{level:y.warn},log:{level:y.log},info:{level:y.info},success:{level:y.success},fail:{level:y.fail},ready:{level:y.info},start:{level:y.info},box:{level:y.info},debug:{level:y.debug},trace:{level:y.trace},verbose:{level:y.verbose}};function P(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)==="[object Module]":!0}function F(e,t,a=".",s){if(!P(t))return F(e,{},a);const o=Object.assign({},t);for(const l in e){if(l==="__proto__"||l==="constructor")continue;const n=e[l];n!=null&&(Array.isArray(n)&&Array.isArray(o[l])?o[l]=[...n,...o[l]]:P(n)&&P(o[l])?o[l]=F(n,o[l],(a?`${a}.`:"")+l.toString()):o[l]=n)}return o}function ft(e){return(...t)=>t.reduce((a,s)=>F(a,s,""),{})}const dt=ft();function ht(e){return Object.prototype.toString.call(e)==="[object Object]"}function pt(e){return!(!ht(e)||!e.message&&!e.args||e.stack)}let E=!1;const $=[];class _{options;_lastLog;_mockFn;constructor(t={}){const a=t.types||z;this.options=dt({...t,defaults:{...t.defaults},level:O(t.level,a),reporters:[...t.reporters||[]]},{types:z,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(const s in a){const o={type:s,...this.options.defaults,...a[s]};this[s]=this._wrapLogFn(o),this[s].raw=this._wrapLogFn(o,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(t){this.options.level=O(t,this.options.types,this.options.level)}prompt(t,a){if(!this.options.prompt)throw new Error("prompt is not supported!");return this.options.prompt(t,a)}create(t){const a=new _({...this.options,...t});return this._mockFn&&a.mockTypes(this._mockFn),a}withDefaults(t){return this.create({...this.options,defaults:{...this.options.defaults,...t}})}withTag(t){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+":"+t:t})}addReporter(t){return this.options.reporters.push(t),this}removeReporter(t){if(t){const a=this.options.reporters.indexOf(t);if(a!==-1)return this.options.reporters.splice(a,1)}else this.options.reporters.splice(0);return this}setReporters(t){return this.options.reporters=Array.isArray(t)?t:[t],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(const t in this.options.types)console["__"+t]||(console["__"+t]=console[t]),console[t]=this[t].raw}restoreConsole(){for(const t in this.options.types)console["__"+t]&&(console[t]=console["__"+t],delete console["__"+t])}wrapStd(){this._wrapStream(this.options.stdout,"log"),this._wrapStream(this.options.stderr,"log")}_wrapStream(t,a){t&&(t.__write||(t.__write=t.write),t.write=s=>{this[a].raw(String(s).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(t){t&&t.__write&&(t.write=t.__write,delete t.__write)}pauseLogs(){E=!0}resumeLogs(){E=!1;const t=$.splice(0);for(const a of t)a[0]._logFn(a[1],a[2])}mockTypes(t){const a=t||this.options.mockFn;if(this._mockFn=a,typeof a=="function")for(const s in this.options.types)this[s]=a(s,this.options.types[s])||this[s],this[s].raw=this[s]}_wrapLogFn(t,a){return(...s)=>{if(E){$.push([this,t,s,a]);return}return this._logFn(t,s,a)}}_logFn(t,a,s){if((t.level||0)>this.level)return!1;const o={date:new Date,args:[],...t,level:O(t.level,this.options.types)};!s&&a.length===1&&pt(a[0])?Object.assign(o,a[0]):o.args=[...a],o.message&&(o.args.unshift(o.message),delete o.message),o.additional&&(Array.isArray(o.additional)||(o.additional=o.additional.split(`
`)),o.args.push(`
`+o.additional.join(`
`)),delete o.additional),o.type=typeof o.type=="string"?o.type.toLowerCase():"log",o.tag=typeof o.tag=="string"?o.tag:"";const l=(r=!1)=>{const p=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&p>0){const v=[...this._lastLog.object.args];p>1&&v.push(`(repeated ${p} times)`),this._log({...this._lastLog.object,args:v}),this._lastLog.count=1}r&&(this._lastLog.object=o,this._log(o))};clearTimeout(this._lastLog.timeout);const n=this._lastLog.time&&o.date?o.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=o.date,n<this.options.throttle)try{const r=JSON.stringify([o.type,o.tag,o.args]),p=this._lastLog.serialized===r;if(this._lastLog.serialized=r,p&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(l,this.options.throttle);return}}catch{}l(!0)}_log(t){for(const a of this.options.reporters)a.log(t,{options:this.options})}}function O(e,t={},a=3){return e===void 0?a:typeof e=="number"?e:t[e]&&t[e].level!==void 0?t[e].level:a}_.prototype.add=_.prototype.addReporter;_.prototype.remove=_.prototype.removeReporter;_.prototype.clear=_.prototype.removeReporter;_.prototype.withScope=_.prototype.withTag;_.prototype.mock=_.prototype.mockTypes;_.prototype.pause=_.prototype.pauseLogs;_.prototype.resume=_.prototype.resumeLogs;function _t(e={}){return new _(e)}class gt{options;defaultColor;levelColorMap;typeColorMap;constructor(t){this.options={...t},this.defaultColor="#7f8c8d",this.levelColorMap={0:"#c0392b",1:"#f39c12",3:"#00BCD4"},this.typeColorMap={success:"#2ecc71"}}_getLogFn(t){return t<1?console.__error||console.error:t===1?console.__warn||console.warn:console.__log||console.log}log(t){const a=this._getLogFn(t.level),s=t.type==="log"?"":t.type,o=t.tag||"",n=`
      background: ${this.typeColorMap[t.type]||this.levelColorMap[t.level]||this.defaultColor};
      border-radius: 0.5em;
      color: white;
      font-weight: bold;
      padding: 2px 0.5em;
    `,r=`%c${[o,s].filter(Boolean).join(":")}`;typeof t.args[0]=="string"?a(`${r}%c ${t.args[0]}`,n,"",...t.args.slice(1)):a(r,n,...t.args)}}function yt(e={}){return _t({reporters:e.reporters||[new gt({})],prompt(a,s={}){return s.type==="confirm"?Promise.resolve(confirm(a)):Promise.resolve(prompt(a))},...e})}const bt=yt();export{mt as a,bt as c,it as u};
