2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
import{f as z,I as p,D as q,J as L,K as W,L as V,x as G,G as H,M as T,N as J,O as Z,u as F,r as x,P as M,Q,R as Y,S as X,T as K,V as I,W as k,Y as ee,Z as te,$ as ae,z as R}from"#entry";function se(r){return typeof r=="string"?`'${r}'`:new re().serialize(r)}const re=(function(){class r{#e=new Map;compare(e,t){const s=typeof e,o=typeof t;return s==="string"&&o==="string"?e.localeCompare(t):s==="number"&&o==="number"?e-t:String.prototype.localeCompare.call(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return"null";switch(typeof e){case"string":return t?e:`'${e}'`;case"bigint":return`${e}n`;case"object":return this.$object(e);case"function":return this.$function(e)}return String(e)}serializeObject(e){const t=Object.prototype.toString.call(e);if(t!=="[object Object]")return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);const s=e.constructor,o=s===Object||s===void 0?"":s.name;if(o!==""&&globalThis[o]===s)return this.serializeBuiltInType(o,e);if(typeof e.toJSON=="function"){const n=e.toJSON();return o+(n!==null&&typeof n=="object"?this.$object(n):`(${this.serialize(n)})`)}return this.serializeObjectEntries(o,Object.entries(e))}serializeBuiltInType(e,t){const s=this["$"+e];if(s)return s.call(this,t);if(typeof t?.entries=="function")return this.serializeObjectEntries(e,t.entries());throw new Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){const s=Array.from(t).sort((n,i)=>this.compare(n[0],i[0]));let o=`${e}{`;for(let n=0;n<s.length;n++){const[i,f]=s[n];o+=`${this.serialize(i,!0)}:${this.serialize(f)}`,n<s.length-1&&(o+=",")}return o+"}"}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){const t=Function.prototype.toString.call(e);return t.slice(-15)==="[native code] }"?`${e.name||""}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,"")}`}$Array(e){let t="[";for(let s=0;s<e.length;s++)t+=this.serialize(e[s]),s<e.length-1&&(t+=",");return t+"]"}$Date(e){try{return`Date(${e.toISOString()})`}catch{return"Date(null)"}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(",")}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((t,s)=>this.compare(t,s)))}`}$Map(e){return this.serializeObjectEntries("Map",e.entries())}}for(const a of["Error","RegExp","URL"])r.prototype["$"+a]=function(e){return`${a}(${e})`};for(const a of["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"])r.prototype["$"+a]=function(e){return`${a}[${e.join(",")}]`};for(const a of["BigInt64Array","BigUint64Array"])r.prototype["$"+a]=function(e){return`${a}[${e.join("n,")}${e.length>0?"n":""}]`};return r})(),ne=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],ie=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],oe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",$=[];class ce{_data=new j;_hash=new j([...ne]);_nDataBytes=0;_minBufferSize=0;finalize(a){a&&this._append(a);const e=this._nDataBytes*8,t=this._data.sigBytes*8;return this._data.words[t>>>5]|=128<<24-t%32,this._data.words[(t+64>>>9<<4)+14]=Math.floor(e/4294967296),this._data.words[(t+64>>>9<<4)+15]=e,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(a,e){const t=this._hash.words;let s=t[0],o=t[1],n=t[2],i=t[3],f=t[4],m=t[5],c=t[6],l=t[7];for(let u=0;u<64;u++){if(u<16)$[u]=a[e+u]|0;else{const b=$[u-15],d=(b<<25|b>>>7)^(b<<14|b>>>18)^b>>>3,y=$[u-2],B=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;$[u]=d+$[u-7]+B+$[u-16]}const D=f&m^~f&c,_=s&o^s&n^o&n,h=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),g=(f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25),v=l+g+D+ie[u]+$[u],w=h+_;l=c,c=m,m=f,f=i+v|0,i=n,n=o,o=s,s=v+w|0}t[0]=t[0]+s|0,t[1]=t[1]+o|0,t[2]=t[2]+n|0,t[3]=t[3]+i|0,t[4]=t[4]+f|0,t[5]=t[5]+m|0,t[6]=t[6]+c|0,t[7]=t[7]+l|0}_append(a){typeof a=="string"&&(a=j.fromUtf8(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes}_process(a){let e,t=this._data.sigBytes/64;a?t=Math.ceil(t):t=Math.max((t|0)-this._minBufferSize,0);const s=t*16,o=Math.min(s*4,this._data.sigBytes);if(s){for(let n=0;n<s;n+=16)this._doProcessBlock(this._data.words,n);e=this._data.words.splice(0,s),this._data.sigBytes-=o}return new j(e,o)}}class j{words;sigBytes;constructor(a,e){a=this.words=a||[],this.sigBytes=e===void 0?a.length*4:e}static fromUtf8(a){const e=unescape(encodeURIComponent(a)),t=e.length,s=[];for(let o=0;o<t;o++)s[o>>>2]|=(e.charCodeAt(o)&255)<<24-o%4*8;return new j(s,t)}toBase64(){const a=[];for(let e=0;e<this.sigBytes;e+=3){const t=this.words[e>>>2]>>>24-e%4*8&255,s=this.words[e+1>>>2]>>>24-(e+1)%4*8&255,o=this.words[e+2>>>2]>>>24-(e+2)%4*8&255,n=t<<16|s<<8|o;for(let i=0;i<4&&e*8+i*6<this.sigBytes*8;i++)a.push(oe.charAt(n>>>6*(3-i)&63))}return a.join("")}concat(a){if(this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4),this.sigBytes%4)for(let e=0;e<a.sigBytes;e++){const t=a.words[e>>>2]>>>24-e%4*8&255;this.words[this.sigBytes+e>>>2]|=t<<24-(this.sigBytes+e)%4*8}else for(let e=0;e<a.sigBytes;e+=4)this.words[this.sigBytes+e>>>2]=a.words[e>>>2];this.sigBytes+=a.sigBytes}}function ue(r){return new ce().finalize(r).toBase64()}function O(r){return ue(se(r))}const le={trailing:!0};function fe(r,a=25,e={}){if(e={...le,...e},!Number.isFinite(a))throw new TypeError("Expected `wait` to be a finite number");let t,s,o=[],n,i;const f=(l,u)=>(n=de(r,l,u),n.finally(()=>{if(n=null,e.trailing&&i&&!s){const D=f(l,i);return i=null,D}}),n),m=function(...l){return e.trailing&&(i=l),n||new Promise(u=>{const D=!s&&e.leading;clearTimeout(s),s=setTimeout(()=>{s=null;const _=e.leading?t:f(this,l);i=null;for(const h of o)h(_);o=[]},a),D?(t=f(this,l),u(t)):o.push(u)})},c=l=>{l&&(clearTimeout(l),s=null)};return m.isPending=()=>!!s,m.cancel=()=>{c(s),o=[],i=null},m.flush=()=>{if(c(s),!i||n)return;const l=i;return i=null,f(this,l)},m}async function de(r,a,e){return await r.apply(a,e)}const he=Symbol.for("nuxt:client-only");function ye(...r){const a=typeof r[r.length-1]=="string"?r.pop():void 0;_e(r[0],r[1])&&r.unshift(a);let[e,t,s={}]=r,o=!1;const n=z(()=>p(e));if(typeof n.value!="string")throw new TypeError("[nuxt] [useAsyncData] key must be a string.");if(typeof t!="function")throw new TypeError("[nuxt] [useAsyncData] handler must be a function.");const i=q();s.server??=!0,s.default??=ge,s.getCachedData??=A,s.lazy??=!1,s.immediate??=!0,s.deep??=L.deep,s.dedupe??="cancel",s._functionName,i._asyncData[n.value];function f(){const _={cause:"initial",dedupe:s.dedupe};return i._asyncData[n.value]?._init||(_.cachedData=s.getCachedData(n.value,i,{cause:"initial"}),i._asyncData[n.value]=U(i,n.value,t,s,_.cachedData)),()=>i._asyncData[n.value].execute(_)}const m=f(),c=i._asyncData[n.value];c._deps++;const l=s.server!==!1&&i.payload.serverRendered;{let _=function(d){const y=i._asyncData[d];y?._deps&&(y._deps--,y._deps===0&&y?._off())};const h=W();if(h&&l&&s.immediate&&!h.sp&&(h.sp=[]),h&&!h._nuxtOnBeforeMountCbs){h._nuxtOnBeforeMountCbs=[];const d=h._nuxtOnBeforeMountCbs;V(()=>{d.forEach(y=>{y()}),d.splice(0,d.length)}),G(()=>d.splice(0,d.length))}const g=h&&(h._nuxtClientOnly||H(he,!1));l&&i.isHydrating&&(c.error.value||c.data.value!==void 0)?c.status.value=c.error.value?"error":"success":h&&(!g&&i.payload.serverRendered&&i.isHydrating||s.lazy)&&s.immediate?h._nuxtOnBeforeMountCbs.push(m):s.immediate&&c.status.value!=="success"&&m();const v=Z(),w=T(n,(d,y)=>{if((d||y)&&d!==y){o=!0;const B=i._asyncData[y]?.data.value!==void 0,C=i._asyncDataPromises[y]!==void 0,E={cause:"initial",dedupe:s.dedupe};if(!i._asyncData[d]?._init){let P;y&&B?P=i._asyncData[y].data.value:(P=s.getCachedData(d,i,{cause:"initial"}),E.cachedData=P),i._asyncData[d]=U(i,d,t,s,P)}i._asyncData[d]._deps++,y&&_(y),(s.immediate||B||C)&&i._asyncData[d].execute(E),K(()=>{o=!1})}},{flush:"sync"}),b=s.watch?T(s.watch,()=>{o||c._execute({cause:"watch",dedupe:s.dedupe})}):()=>{};v&&J(()=>{w(),b(),_(n.value)})}const u={data:S(()=>i._asyncData[n.value]?.data),pending:S(()=>i._asyncData[n.value]?.pending),status:S(()=>i._asyncData[n.value]?.status),error:S(()=>i._asyncData[n.value]?.error),refresh:(..._)=>i._asyncData[n.value]?._init?i._asyncData[n.value].execute(..._):f()(),execute:(..._)=>u.refresh(..._),clear:()=>N(i,n.value)},D=Promise.resolve(i._asyncDataPromises[n.value]).then(()=>u);return Object.assign(D,u),D}function S(r){return z({get(){return r()?.value},set(a){const e=r();e&&(e.value=a)}})}function _e(r,a){return!(typeof r=="string"||typeof r=="object"&&r!==null||typeof r=="function"&&typeof a=="function")}function N(r,a){a in r.payload.data&&(r.payload.data[a]=void 0),a in r.payload._errors&&(r.payload._errors[a]=void 0),r._asyncData[a]&&(r._asyncData[a].data.value=F(r._asyncData[a]._default()),r._asyncData[a].error.value=void 0,r._asyncData[a].status.value="idle"),a in r._asyncDataPromises&&(r._asyncDataPromises[a]&&(r._asyncDataPromises[a].cancelled=!0),r._asyncDataPromises[a]=void 0)}function me(r,a){const e={};for(const t of a)e[t]=r[t];return e}function U(r,a,e,t,s){r.payload._errors[a]??=void 0;const o=t.getCachedData!==A,n=e,i=t.deep?x:M,f=s!==void 0,m=r.hook("app:data:refresh",async l=>{(!l||l.includes(a))&&await c.execute({cause:"refresh:hook"})}),c={data:i(f?s:t.default()),pending:z(()=>c.status.value==="pending"),error:Q(r.payload._errors,a),status:M("idle"),execute:(...l)=>{const[u,D=void 0]=l,_=u&&D===void 0&&typeof u=="object"?u:{};if(r._asyncDataPromises[a]){if((_.dedupe??t.dedupe)==="defer")return r._asyncDataPromises[a];r._asyncDataPromises[a].cancelled=!0}{const g="cachedData"in _?_.cachedData:t.getCachedData(a,r,{cause:_.cause??"refresh:manual"});if(g!==void 0)return r.payload.data[a]=c.data.value=g,c.error.value=void 0,c.status.value="success",Promise.resolve(g)}c.status.value="pending";const h=new Promise((g,v)=>{try{g(n(r))}catch(w){v(w)}}).then(async g=>{if(h.cancelled)return r._asyncDataPromises[a];let v=g;t.transform&&(v=await t.transform(g)),t.pick&&(v=me(v,t.pick)),r.payload.data[a]=v,c.data.value=v,c.error.value=void 0,c.status.value="success"}).catch(g=>{if(h.cancelled)return r._asyncDataPromises[a];c.error.value=X(g),c.data.value=F(t.default()),c.status.value="error"}).finally(()=>{h.cancelled||delete r._asyncDataPromises[a]});return r._asyncDataPromises[a]=h,r._asyncDataPromises[a]},_execute:fe((...l)=>c.execute(...l),0,{leading:!0}),_default:t.default,_deps:0,_init:!0,_hash:void 0,_off:()=>{m(),r._asyncData[a]?._init&&(r._asyncData[a]._init=!1),o||Y(()=>{r._asyncData[a]?._init||(N(r,a),c.execute=()=>Promise.resolve())})}};return c}const ge=()=>{},A=(r,a,e)=>{if(a.isHydrating)return a.payload.data[r];if(e.cause!=="refresh:manual"&&e.cause!=="refresh:hook")return a.static.data[r]};function ve(r,a,e){const[t={},s]=[{},a],o=z(()=>p(r)),n=z(()=>p(t.key)||"$f"+O([s,typeof o.value=="string"?o.value:"",...De(t)]));if(!t.baseURL&&typeof o.value=="string"&&o.value[0]==="/"&&o.value[1]==="/")throw new Error('[nuxt] [useFetch] the request URL must not start with "//".');const{server:i,lazy:f,default:m,transform:c,pick:l,watch:u,immediate:D,getCachedData:_,deep:h,dedupe:g,...v}=t,w=I({...k,...v,cache:typeof t.cache=="boolean"?void 0:t.cache}),b={server:i,lazy:f,default:m,transform:c,pick:l,immediate:D,getCachedData:_,deep:h,dedupe:g,watch:u===!1?[]:[...u||[],w]};let d;return ye(u===!1?n.value:n,()=>{d?.abort?.(new DOMException("Request aborted as another request to the same endpoint was initiated.","AbortError")),d=typeof AbortController<"u"?new AbortController:{};const B=p(t.timeout);let C;return B&&(C=setTimeout(()=>d.abort(new DOMException("Request aborted due to timeout.","AbortError")),B),d.signal.onabort=()=>clearTimeout(C)),(t.$fetch||globalThis.$fetch)(o.value,{signal:d.signal,...w}).finally(()=>{clearTimeout(C)})},b)}function De(r){const a=[p(r.method)?.toUpperCase()||"GET",p(r.baseURL)];for(const e of[r.params||r.query]){const t=p(e);if(!t)continue;const s={};for(const[o,n]of Object.entries(t))s[p(o)]=p(n);a.push(s)}if(r.body){const e=p(r.body);if(!e)a.push(O(e));else if(e instanceof ArrayBuffer)a.push(O(Object.fromEntries([...new Uint8Array(e).entries()].map(([t,s])=>[t,s.toString()]))));else if(e instanceof FormData){const t={};for(const s of e.entries()){const[o,n]=s;t[o]=n instanceof File?n.name:n}a.push(O(t))}else if(ee(e))a.push(O(I(e)));else try{a.push(O(e))}catch{console.warn("[useFetch] Failed to hash body",e)}}return a}const be=te(async(r,a)=>{let e,t;if(["/mitgliederbereich","/cms"].some(n=>r.path.startsWith(n)))try{const{data:n}=([e,t]=ae(()=>ve("/api/auth/status","$iafshigZRx")),e=await e,t(),e);if(!n.value||!n.value.isLoggedIn)return R("/login?redirect="+r.path);if(r.path.startsWith("/cms")&&!(n.value.role==="admin"||n.value.role==="vorstand"))return R("/mitgliederbereich")}catch{return R("/login?redirect="+r.path)}});export{be as default};
|