@framerauth/sdk 2.1.12 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/framerauth.js +5 -5
- package/dist/framerauth.mjs +1 -1
- package/package.json +12 -3
package/dist/framerauth.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var tt=Object.defineProperty,rt=Object.defineProperties,nt=Object.getOwnPropertyDescriptors,he=Object.getOwnPropertySymbols,ot=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable,fe=(t,e,r)=>e in t?tt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x=(t,e)=>{for(var r in e||(e={}))ot.call(e,r)&&fe(t,r,e[r]);if(he)for(var r of he(e))at.call(e,r)&&fe(t,r,e[r]);return t},U=(t,e)=>rt(t,nt(e)),it=class extends Error{constructor(t,e,r){super(e||t.toString(),{cause:r}),this.status=t,this.statusText=e,this.error=r}},st=async(t,e)=>{var r,n,o,a,i,u;let c=e||{},s={onRequest:[e?.onRequest],onResponse:[e?.onResponse],onSuccess:[e?.onSuccess],onError:[e?.onError],onRetry:[e?.onRetry]};if(!e||!e?.plugins)return{url:t,options:c,hooks:s};for(let f of e?.plugins||[]){if(f.init){let v=await((r=f.init)==null?void 0:r.call(f,t.toString(),e));c=v.options||c,t=v.url}s.onRequest.push((n=f.hooks)==null?void 0:n.onRequest),s.onResponse.push((o=f.hooks)==null?void 0:o.onResponse),s.onSuccess.push((a=f.hooks)==null?void 0:a.onSuccess),s.onError.push((i=f.hooks)==null?void 0:i.onError),s.onRetry.push((u=f.hooks)==null?void 0:u.onRetry)}return{url:t,options:c,hooks:s}},pe=class{constructor(t){this.options=t}shouldAttemptRetry(t,e){return this.options.shouldRetry?Promise.resolve(t<this.options.attempts&&this.options.shouldRetry(e)):Promise.resolve(t<this.options.attempts)}getDelay(){return this.options.delay}},lt=class{constructor(t){this.options=t}shouldAttemptRetry(t,e){return this.options.shouldRetry?Promise.resolve(t<this.options.attempts&&this.options.shouldRetry(e)):Promise.resolve(t<this.options.attempts)}getDelay(t){return Math.min(this.options.maxDelay,this.options.baseDelay*2**t)}};function ct(t){if(typeof t=="number")return new pe({type:"linear",attempts:t,delay:1e3});switch(t.type){case"linear":return new pe(t);case"exponential":return new lt(t);default:throw new Error("Invalid retry strategy")}}var dt=async t=>{let e={},r=async n=>typeof n=="function"?await n():n;if(t?.auth){if(t.auth.type==="Bearer"){let n=await r(t.auth.token);if(!n)return e;e.authorization=`Bearer ${n}`}else if(t.auth.type==="Basic"){let n=r(t.auth.username),o=r(t.auth.password);if(!n||!o)return e;e.authorization=`Basic ${btoa(`${n}:${o}`)}`}else if(t.auth.type==="Custom"){let n=r(t.auth.value);if(!n)return e;e.authorization=`${r(t.auth.prefix)} ${n}`}}return e},ut=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function ht(t){let e=t.headers.get("content-type"),r=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!e)return"json";let n=e.split(";").shift()||"";return ut.test(n)?"json":r.has(n)||n.startsWith("text/")?"text":"blob"}function ft(t){try{return JSON.parse(t),!0}catch{return!1}}function be(t){if(t===void 0)return!1;let e=typeof t;return e==="string"||e==="number"||e==="boolean"||e===null?!0:e!=="object"?!1:Array.isArray(t)?!0:t.buffer?!1:t.constructor&&t.constructor.name==="Object"||typeof t.toJSON=="function"}function me(t){try{return JSON.parse(t)}catch{return t}}function ge(t){return typeof t=="function"}function pt(t){if(t?.customFetchImpl)return t.customFetchImpl;if(typeof globalThis<"u"&&ge(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&ge(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function mt(t){let e=new Headers(t?.headers),r=await dt(t);for(let[n,o]of Object.entries(r||{}))e.set(n,o);if(!e.has("content-type")){let n=gt(t?.body);n&&e.set("content-type",n)}return e}function gt(t){return be(t)?"application/json":null}function bt(t){if(!t?.body)return null;let e=new Headers(t?.headers);if(be(t.body)&&!e.has("content-type")){for(let[r,n]of Object.entries(t?.body))n instanceof Date&&(t.body[r]=n.toISOString());return JSON.stringify(t.body)}return t.body}function yt(t,e){var r;if(e?.method)return e.method.toUpperCase();if(t.startsWith("@")){let n=(r=t.split("@")[1])==null?void 0:r.split("/")[0];return ve.includes(n)?n.toUpperCase():e?.body?"POST":"GET"}return e?.body?"POST":"GET"}function vt(t,e){let r;return!t?.signal&&t?.timeout&&(r=setTimeout(()=>e?.abort(),t?.timeout)),{abortTimeout:r,clearTimeout:()=>{r&&clearTimeout(r)}}}var wt=class ye extends Error{constructor(e,r){super(r||JSON.stringify(e,null,2)),this.issues=e,Object.setPrototypeOf(this,ye.prototype)}};async function kt(t,e){let r=await t["~standard"].validate(e);if(r.issues)throw new wt(r.issues);return r.value}var ve=["get","post","put","patch","delete"];function Pt(t,e){let{baseURL:r,params:n,query:o}=e||{query:{},params:{},baseURL:""},a=t.startsWith("http")?t.split("/").slice(0,3).join("/"):r||"";if(t.startsWith("@")){let v=t.toString().split("@")[1].split("/")[0];ve.includes(v)&&(t=t.replace(`@${v}/`,"/"))}a.endsWith("/")||(a+="/");let[i,u]=t.replace(a,"").split("?"),c=new URLSearchParams(u);for(let[v,g]of Object.entries(o||{}))g!=null&&c.set(v,String(g));if(n)if(Array.isArray(n)){let v=i.split("/").filter(g=>g.startsWith(":"));for(let[g,Q]of v.entries()){let j=n[g];i=i.replace(Q,j)}}else for(let[v,g]of Object.entries(n))i=i.replace(`:${v}`,String(g));i=i.split("/").map(encodeURIComponent).join("/"),i.startsWith("/")&&(i=i.slice(1));let s=c.toString();return s=s.length>0?`?${s}`.replace(/\+/g,"%20"):"",a.startsWith("http")?new URL(`${i}${s}`,a):`${a}${i}${s}`}var h=async(t,e)=>{var r,n,o,a,i,u,c,s;let{hooks:f,url:v,options:g}=await st(t,e),Q=pt(g),j=new AbortController,Je=(r=g.signal)!=null?r:j.signal,Ve=Pt(v,g),Ge=bt(g),Ke=await mt(g),Qe=yt(v,g),p=U(x({},g),{url:Ve,headers:Ke,body:Ge,method:Qe,signal:Je});for(let w of f.onRequest)if(w){let y=await w(p);y instanceof Object&&(p=y)}("pipeTo"in p&&typeof p.pipeTo=="function"||typeof((n=e?.body)==null?void 0:n.pipe)=="function")&&("duplex"in p||(p.duplex="half"));let{clearTimeout:Ye}=vt(g,j),d=await Q(p.url,p);Ye();let de={response:d,request:p};for(let w of f.onResponse)if(w){let y=await w(U(x({},de),{response:(o=e?.hookOptions)!=null&&o.cloneResponse?d.clone():d}));y instanceof Response?d=y:y instanceof Object&&(d=y.response)}if(d.ok){if(!(p.method!=="HEAD"))return{data:"",error:null};let y=ht(d),E={data:"",response:d,request:p};if(y==="json"||y==="text"){let O=await d.text(),et=await((a=p.jsonParser)!=null?a:me)(O);E.data=et}else E.data=await d[y]();p?.output&&p.output&&!p.disableValidation&&(E.data=await kt(p.output,E.data));for(let O of f.onSuccess)O&&await O(U(x({},E),{response:(i=e?.hookOptions)!=null&&i.cloneResponse?d.clone():d}));return e?.throw?E.data:{data:E.data,error:null}}let Ze=(u=e?.jsonParser)!=null?u:me,N=await d.text(),ue=ft(N),Y=ue?await Ze(N):null,Xe={response:d,responseText:N,request:p,error:U(x({},Y),{status:d.status,statusText:d.statusText})};for(let w of f.onError)w&&await w(U(x({},Xe),{response:(c=e?.hookOptions)!=null&&c.cloneResponse?d.clone():d}));if(e?.retry){let w=ct(e.retry),y=(s=e.retryAttempt)!=null?s:0;if(await w.shouldAttemptRetry(y,d)){for(let O of f.onRetry)O&&await O(de);let E=w.getDelay(y);return await new Promise(O=>setTimeout(O,E)),await h(t,U(x({},e),{retryAttempt:y+1}))}}if(e?.throw)throw new it(d.status,d.statusText,ue?Y:N);return{data:null,error:U(x({},Y),{status:d.status,statusText:d.statusText})}};var St="https://core.framerauth.com/v2",Rt="application/octet-stream",Et=t=>{if(t instanceof Blob)return t;let e=typeof FormData<"u"&&t instanceof FormData?t.get("file"):t?.file;if(!(e instanceof Blob))throw new Error("No image was provided");return e},H=class{baseURL=null;useBearerAuth=!1;data;state;api;auth;constructor(e){this.baseURL=null,this.data=e.data,this.state=e.state,this.api={fetchBookmarks:async()=>{if(!this.baseURL)throw new Error("Auth client not initialized");let r=await h(`${this.baseURL}/profile/bookmarks`,{...this.authOptions()});if(!r.data)return r;let n=new Set(r.data),o={};for(let a of n)o[a]=!0;return{data:o,error:null}},fetchProject:async()=>await h(`${St}/public/project/config`)},this.auth={getSession:async()=>{if(!this.baseURL)throw new Error("Auth client not initialized");let r=await h(`${this.baseURL}/get-session`,{method:"GET",...this.authOptions(),query:{disableCookieCache:!0}});return r.data?(this.data.user.set(r.data.user),this.data.session.set(r.data.session),this.data.tags.set(r.data.user.tags??[])):(this.data.user.set(null),this.data.session.set(null),this.data.tags.set([]),this.data.bookmarks.set({}),this.data.bearerToken.set(null)),r},signUp:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let{fetchOptions:n,...o}=r,a=this.authOptions(),i={...a,...n,headers:{...a.headers,...n?.headers}},u=await h(`${this.baseURL}/sign-up/email`,{...i,method:"POST",body:o,onSuccess:c=>{let s=c.response.headers.get("set-auth-token");s&&this.data.bearerToken.set(s)}});return u.error||(await this.auth.getSession(),this.api.fetchBookmarks().then(c=>{this.data.bookmarks.set(c.data??{})})),u},signIn:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let{fetchOptions:n,...o}=r,a=this.authOptions(),i={...a,...n,headers:{...a.headers,...n?.headers}},u=await h(`${this.baseURL}/sign-in/email`,{...i,method:"POST",body:o,onSuccess:c=>{let s=c.response.headers.get("set-auth-token");s&&this.data.bearerToken.set(s)}});return u.error||(await this.auth.getSession(),this.api.fetchBookmarks().then(c=>{this.data.bookmarks.set(c.data??{})})),u},signInSocial:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=await h(`${this.baseURL}/sign-in/social`,{method:"POST",...this.authOptions(),body:r});return n.data?.url&&(window.location.href=n.data.url),n},signOut:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=await h(`${this.baseURL}/sign-out`,{method:"POST",...this.authOptions(),body:{}});return this.data.user.set(null),this.data.session.set(null),this.data.tags.set([]),this.data.bookmarks.set({}),this.data.bearerToken.set(null),r?.redirectTo&&(window.location.href=r.redirectTo),n},sendOTP:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=`${this.baseURL}/email-otp/send-verification-otp`;return await h(n,{body:r,...this.authOptions(),method:"POST"})},signInOTP:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=`${this.baseURL}/sign-in/email-otp`,o=await h(n,{body:r,...this.authOptions(),method:"POST",onSuccess:a=>{let i=a.response.headers.get("set-auth-token");i&&this.data.bearerToken.set(i)}});return o.error||(await this.auth.getSession(),this.api.fetchBookmarks().then(a=>{this.data.bookmarks.set(a.data??{})})),o},updateProfile:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=`${this.baseURL}/profile`;return await h(n,{body:r,...this.authOptions(),method:"PATCH"})},updateProfilePicture:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=`${this.baseURL}/profile/avatar`,o=this.authOptions();return await h(n,{...o,method:"POST",headers:{...o.headers,"Content-Type":Rt},body:Et(r)})},createBookmark:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=`${this.baseURL}/profile/bookmarks`;return await h(n,{body:r,...this.authOptions(),method:"POST"})},deleteBookmark:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=`${this.baseURL}/profile/bookmarks/${r.bookmark_type}/${r.id}`;return await h(n,{...this.authOptions(),method:"DELETE"})},sendForgotPasswordEmail:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=`${this.baseURL}/request-password-reset`;return await h(n,{body:r,...this.authOptions(),method:"POST"})},resetPassword:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=`${this.baseURL}/reset-password`;return await h(n,{body:r,...this.authOptions(),method:"POST"})},storeCheckout:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=`${this.baseURL}/store/checkout/session`;return await h(n,{body:r,...this.authOptions(),method:"POST"})},storePortal:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=`${this.baseURL}/plugins/${r.pluginId}/portal`,o=this.authOptions();return await h(n,{...o,method:"GET",headers:{...o.headers,Accept:"application/json"},query:r.returnURL?{returnURL:r.returnURL}:void 0})},sendVerificationEmail:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=`${this.baseURL}/send-verification-email`;return await h(n,{body:r,...this.authOptions(),method:"POST"})},exchangeOneTimeToken:async r=>{if(!this.baseURL)throw new Error("Auth client not initialized");let n=await h(`${this.baseURL}/one-time-token/verify`,{method:"POST",body:{token:r}});return n.data?.session?.token&&this.data.bearerToken.set(n.data.session.token),n}}}updateBaseURL(e){this.baseURL=e}updateAuthMode(e){this.useBearerAuth=e}async handleOTTFromURL(){if(!this.useBearerAuth)return;let e=new URLSearchParams(window.location.search),r=e.get("ott");if(!r)return;e.delete("ott");let n=e.size?`${window.location.pathname}?${e.toString()}${window.location.hash}`:`${window.location.pathname}${window.location.hash}`;history.replaceState(null,"",n),await this.auth.exchangeOneTimeToken(r)}authOptions(){if(this.useBearerAuth){let e=this.data.bearerToken.get();return e?{headers:{Authorization:`Bearer ${e}`}}:{}}return{credentials:"include"}}};var R=[],T=0,M=4,Ot=0,b=t=>{let e=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},lc:0,listen(n){return r.lc=e.push(n),()=>{for(let a=T+M;a<R.length;)R[a]===n?R.splice(a,M):a+=M;let o=e.indexOf(n);~o&&(e.splice(o,1),--r.lc||r.off())}},notify(n,o){Ot++;let a=!R.length;for(let i of e)R.push(i,r.value,n,o);if(a){for(T=0;T<R.length;T+=M)R[T](R[T+1],R[T+2],R[T+3]);R.length=0}},off(){},set(n){let o=r.value;o!==n&&(r.value=n,r.notify(o))},subscribe(n){let o=r.listen(n);return n(r.value),o},value:t};return r};var Lt=5,$=6,z=10,Tt=(t,e,r,n)=>(t.events=t.events||{},t.events[r+z]||(t.events[r+z]=n(o=>{t.events[r].reduceRight((a,i)=>(i(a),a),{shared:{},...o})})),t.events[r]=t.events[r]||[],t.events[r].push(e),()=>{let o=t.events[r],a=o.indexOf(e);o.splice(a,1),o.length||(delete t.events[r],t.events[r+z](),delete t.events[r+z])});var we=1e3,Z=(t,e)=>Tt(t,n=>{let o=e(n);o&&t.events[$].push(o)},Lt,n=>{let o=t.listen;t.listen=(...i)=>(!t.lc&&!t.active&&(t.active=!0,n()),o(...i));let a=t.off;return t.events[$]=[],t.off=()=>{a(),setTimeout(()=>{if(t.active&&!t.lc){t.active=!1;for(let i of t.events[$])i();t.events[$]=[]}},we)},()=>{t.listen=o,t.off=a}});var I=(t={})=>{let e=b(t);return e.setKey=function(r,n){let o=e.value;typeof n>"u"&&r in e.value?(e.value={...e.value},delete e.value[r],e.notify(o,r)):e.value[r]!==n&&(e.value={...e.value,[r]:n},e.notify(o,r))},e};var ke=t=>t,_={},X={addEventListener(){},removeEventListener(){}};function At(){try{return typeof localStorage<"u"}catch{return!1}}At()&&(_=localStorage);var xt={addEventListener(t,e,r){window.addEventListener("storage",e),window.addEventListener("pageshow",r)},removeEventListener(t,e,r){window.removeEventListener("storage",e),window.removeEventListener("pageshow",r)}};typeof window<"u"&&(X=xt);function k(t,e=void 0,r={}){let n=r.encode||ke,o=r.decode||ke,a=b(e),i=a.set;a.set=s=>{let f=n(s);typeof f>"u"?delete _[t]:_[t]=f,i(s)};function u(s){s.key===t?s.newValue===null?i(e):i(o(s.newValue)):_[t]||i(e)}function c(){a.set(_[t]?o(_[t]):e)}return Z(a,()=>{if(c(),r.listen!==!1)return X.addEventListener(t,u,c),()=>{X.removeEventListener(t,u,c)}}),a}var Ut="framerauth_v2_",Pe=new TextEncoder,_t=new TextDecoder;function Se(){let t=typeof window<"u"?window.location.hostname:"1f8cXd6c7b4a3vL4z5746oUgQ28190adbef";return Pe.encode(Ut+t)}function Dt(t){let e=Se(),r=Pe.encode(t),n=new Uint8Array(r.length);for(let o=0;o<r.length;o++)n[o]=r[o]^e[o%e.length];return n}function Ft(t){let e=Dt(t),r=Array.from(e,n=>String.fromCharCode(n)).join("");return btoa(r)}function Ct(t){let e=Se(),r=atob(t),n=Uint8Array.from(r,a=>a.charCodeAt(0)),o=new Uint8Array(n.length);for(let a=0;a<n.length;a++)o[a]=n[a]^e[a%e.length];return _t.decode(o)}function P({obfuscate:t}){return e=>{let r=JSON.stringify(e);return t&&(r=Ft(r)),r}}function S({deobfuscate:t,fallback:e,validator:r}){return n=>{try{if(!n)return e;t&&(n=Ct(n));let o=JSON.parse(n);if(r){let a=r(o);return a===null?e:a}return o}catch{return e}}}var Re=k("fa-project",null,{encode:P({obfuscate:!0}),decode:S({deobfuscate:!0,fallback:null})}),Ee=b(!1);var Oe=k("fa-tags",[],{encode:P({obfuscate:!0}),decode:S({deobfuscate:!0,fallback:[]})}),Le=b(!1);function Te(t){return Array.isArray(t)?t.length===0?!0:t.every(e=>e!==null&&typeof e=="object"&&typeof e.id=="string"&&typeof e.name=="string"):!1}function Bt(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.id!="string"||typeof e.email!="string"||typeof e.name!="string"||typeof e.email_verified!="boolean"||!(e.created_at instanceof Date||typeof e.created_at=="string")||!(e.updated_at instanceof Date||typeof e.updated_at=="string")?!1:Te(e.tags)}function jt(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.id=="string"&&typeof e.user_id=="string"&&typeof e.token=="string"&&(e.expires_at instanceof Date||typeof e.expires_at=="string")&&(e.created_at instanceof Date||typeof e.created_at=="string")&&(e.updated_at instanceof Date||typeof e.updated_at=="string")}function Ae(t){if(!t||typeof t!="object")return null;let e=t;return Te(e.tags)||(e.tags=[]),Bt(e)?e:null}function xe(t){return jt(t)?t:null}function Nt(t){return!t||typeof t!="object"||Array.isArray(t)?!1:Object.entries(t).every(([e,r])=>typeof e=="string"&&typeof r=="boolean")}function Ue(t){return!t||typeof t!="object"||Array.isArray(t)?{}:Nt(t)?t:{}}var _e=k("fa-user",null,{encode:P({obfuscate:!0}),decode:S({deobfuscate:!0,fallback:null,validator:Ae})}),De=b(!1);var Fe=k("fa-session",null,{encode:P({obfuscate:!0}),decode:S({deobfuscate:!0,fallback:null,validator:xe})}),Ce=b(!1);var Be=b(!0);var je="This page is restricted.",Ht={lock:`
|
|
1
|
+
"use strict";(()=>{var I=[],k=0,W=4,St=0,y=t=>{let e=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},lc:0,listen(o){return r.lc=e.push(o),()=>{for(let a=k+W;a<I.length;)I[a]===o?I.splice(a,W):a+=W;let n=e.indexOf(o);~n&&(e.splice(n,1),--r.lc||r.off())}},notify(o,n){St++;let a=!I.length;for(let i of e)I.push(i,r.value,o,n);if(a){for(k=0;k<I.length;k+=W)I[k](I[k+1],I[k+2],I[k+3]);I.length=0}},off(){},set(o){let n=r.value;n!==o&&(r.value=o,r.notify(n))},subscribe(o){let n=r.listen(o);return o(r.value),n},value:t};return r};var At=5,$=6,K=10,Nt=(t,e,r,o)=>(t.events=t.events||{},t.events[r+K]||(t.events[r+K]=o(n=>{t.events[r].reduceRight((a,i)=>(i(a),a),{shared:{},...n})})),t.events[r]=t.events[r]||[],t.events[r].push(e),()=>{let n=t.events[r],a=n.indexOf(e);n.splice(a,1),n.length||(delete t.events[r],t.events[r+K](),delete t.events[r+K])});var be=1e3,ae=(t,e)=>Nt(t,o=>{let n=e(o);n&&t.events[$].push(n)},At,o=>{let n=t.listen;t.listen=(...i)=>(!t.lc&&!t.active&&(t.active=!0,o()),n(...i));let a=t.off;return t.events[$]=[],t.off=()=>{a(),setTimeout(()=>{if(t.active&&!t.lc){t.active=!1;for(let i of t.events[$])i();t.events[$]=[]}},be)},()=>{t.listen=n,t.off=a}});var V=(t={})=>{let e=y(t);return e.setKey=function(r,o){let n=e.value;typeof o>"u"&&r in e.value?(e.value={...e.value},delete e.value[r],e.notify(n,r)):e.value[r]!==o&&(e.value={...e.value,[r]:o},e.notify(n,r))},e};var ve=t=>t,U={},ie={addEventListener(){},removeEventListener(){}};function Rt(){try{return typeof localStorage<"u"}catch{return!1}}Rt()&&(U=localStorage);var Ot={addEventListener(t,e,r){window.addEventListener("storage",e),window.addEventListener("pageshow",r)},removeEventListener(t,e,r){window.removeEventListener("storage",e),window.removeEventListener("pageshow",r)}};typeof window<"u"&&(ie=Ot);function N(t,e=void 0,r={}){let o=r.encode||ve,n=r.decode||ve,a=y(e),i=a.set;a.set=s=>{let p=o(s);typeof p>"u"?delete U[t]:U[t]=p,i(s)};function u(s){s.key===t?s.newValue===null?i(e):i(n(s.newValue)):U[t]||i(e)}function c(){a.set(U[t]?n(U[t]):e)}return ae(a,()=>{if(c(),r.listen!==!1)return ie.addEventListener(t,u,c),()=>{ie.removeEventListener(t,u,c)}}),a}var It="framerauth_v2_",Se=new TextEncoder,Tt=new TextDecoder;function Ae(){let t=typeof window<"u"?window.location.hostname:"1f8cXd6c7b4a3vL4z5746oUgQ28190adbef";return Se.encode(It+t)}function Pt(t){let e=Ae(),r=Se.encode(t),o=new Uint8Array(r.length);for(let n=0;n<r.length;n++)o[n]=r[n]^e[n%e.length];return o}function _t(t){let e=Pt(t),r=Array.from(e,o=>String.fromCharCode(o)).join("");return btoa(r)}function kt(t){let e=Ae(),r=atob(t),o=Uint8Array.from(r,a=>a.charCodeAt(0)),n=new Uint8Array(o.length);for(let a=0;a<o.length;a++)n[a]=o[a]^e[a%e.length];return Tt.decode(n)}function R({obfuscate:t}){return e=>{let r=JSON.stringify(e);return t&&(r=_t(r)),r}}function O({deobfuscate:t,fallback:e,validator:r}){return o=>{try{if(!o)return e;t&&(o=kt(o));let n=JSON.parse(o);if(r){let a=r(n);return a===null?e:a}return n}catch{return e}}}var q=N("fa-project",null,{encode:R({obfuscate:!0}),decode:O({deobfuscate:!0,fallback:null})}),Ne=y(!1);var Z={ACCESS_DENIED:"This page is restricted.",BACK:"Back",NOT_CONFIGURED_HEADING:"FrameAuth can’t verify this domain",NOT_CONFIGURED_MESSAGE:"This site has FrameAuth installed which handles sign-up, sign-in, user accounts, and member-only content. Access stays locked until this domain is verified.",NOT_CONFIGURED_ACTION:"Fix this",SUSPENDED_HEADING:"FrameAuth - Action required",SUSPENDED_MESSAGE:"If you are the site owner, please log in to the FrameAuth dashboard to reactivate your project.",SUSPENDED_ACTION:"Open FrameAuth dashboard",SNIPPET_MISSING:"FramerAuth snippet missing from start of <body>",UNKNOWN_ERROR:"Unknown error",CLIENT_NOT_INITIALIZED:"Auth client not initialized",IMAGE_REQUIRED:"No image was provided",BROWSER_UNAVAILABLE:"Browser not available"};var Re={ACCESS_DENIED:"此页面的访问受限。",BACK:"返回",NOT_CONFIGURED_HEADING:"FrameAuth 无法验证此域名",NOT_CONFIGURED_MESSAGE:"此网站使用 FrameAuth 管理注册、登录、用户账户和会员专属内容。在此域名通过验证之前,访问将保持锁定。",NOT_CONFIGURED_ACTION:"修复",SUSPENDED_HEADING:"FrameAuth - 需要采取操作",SUSPENDED_MESSAGE:"如果您是网站所有者,请登录 FrameAuth 控制台以重新激活您的项目。",SUSPENDED_ACTION:"打开 FrameAuth 控制台",SNIPPET_MISSING:"<body> 开头缺少 FramerAuth 代码片段",UNKNOWN_ERROR:"未知错误",CLIENT_NOT_INITIALIZED:"身份验证客户端尚未初始化",IMAGE_REQUIRED:"未提供图片",BROWSER_UNAVAILABLE:"浏览器不可用"};var Oe={ACCESS_DENIED:"El acceso a esta página está restringido.",BACK:"Volver",NOT_CONFIGURED_HEADING:"FrameAuth no puede verificar este dominio",NOT_CONFIGURED_MESSAGE:"Este sitio utiliza FrameAuth para gestionar el registro, el inicio de sesión, las cuentas de usuario y el contenido exclusivo para miembros. El acceso seguirá bloqueado hasta que se verifique este dominio.",NOT_CONFIGURED_ACTION:"Solucionar",SUSPENDED_HEADING:"FrameAuth - Se requiere una acción",SUSPENDED_MESSAGE:"Si eres el propietario del sitio, inicia sesión en el panel de FrameAuth para reactivar tu proyecto.",SUSPENDED_ACTION:"Abrir el panel de FrameAuth",SNIPPET_MISSING:"Falta el fragmento de FramerAuth al inicio de <body>",UNKNOWN_ERROR:"Error desconocido",CLIENT_NOT_INITIALIZED:"El cliente de autenticación no está inicializado",IMAGE_REQUIRED:"No se proporcionó ninguna imagen",BROWSER_UNAVAILABLE:"Navegador no disponible"};var Ie={ACCESS_DENIED:"L’accès à cette page est restreint.",BACK:"Retour",NOT_CONFIGURED_HEADING:"FrameAuth ne peut pas vérifier ce domaine",NOT_CONFIGURED_MESSAGE:"Ce site utilise FrameAuth pour gérer les inscriptions, les connexions, les comptes utilisateurs et le contenu réservé aux membres. L’accès reste verrouillé tant que ce domaine n’est pas vérifié.",NOT_CONFIGURED_ACTION:"Corriger",SUSPENDED_HEADING:"FrameAuth - Action requise",SUSPENDED_MESSAGE:"Si vous êtes le propriétaire du site, connectez-vous au tableau de bord FrameAuth pour réactiver votre projet.",SUSPENDED_ACTION:"Ouvrir le tableau de bord FrameAuth",SNIPPET_MISSING:"L’extrait FramerAuth est absent du début de <body>",UNKNOWN_ERROR:"Erreur inconnue",CLIENT_NOT_INITIALIZED:"Le client d’authentification n’est pas initialisé",IMAGE_REQUIRED:"Aucune image fournie",BROWSER_UNAVAILABLE:"Navigateur indisponible"};var Te={ACCESS_DENIED:"الوصول إلى هذه الصفحة مقيّد.",BACK:"رجوع",NOT_CONFIGURED_HEADING:"يتعذر على FrameAuth التحقق من هذا النطاق",NOT_CONFIGURED_MESSAGE:"يستخدم هذا الموقع FrameAuth لإدارة التسجيل وتسجيل الدخول وحسابات المستخدمين والمحتوى الخاص بالأعضاء. سيبقى الوصول مقفلاً حتى يتم التحقق من هذا النطاق.",NOT_CONFIGURED_ACTION:"إصلاح المشكلة",SUSPENDED_HEADING:"FrameAuth - يلزم اتخاذ إجراء",SUSPENDED_MESSAGE:"إذا كنت مالك الموقع، فيرجى تسجيل الدخول إلى لوحة تحكم FrameAuth لإعادة تفعيل مشروعك.",SUSPENDED_ACTION:"فتح لوحة تحكم FrameAuth",SNIPPET_MISSING:"مقطع FramerAuth غير موجود في بداية <body>",UNKNOWN_ERROR:"خطأ غير معروف",CLIENT_NOT_INITIALIZED:"لم تتم تهيئة عميل المصادقة",IMAGE_REQUIRED:"لم يتم تقديم صورة",BROWSER_UNAVAILABLE:"المتصفح غير متاح"};var Pe={ACCESS_DENIED:"O acesso a esta página é restrito.",BACK:"Voltar",NOT_CONFIGURED_HEADING:"O FrameAuth não consegue verificar este domínio",NOT_CONFIGURED_MESSAGE:"Este site usa o FrameAuth para gerenciar cadastros, logins, contas de usuário e conteúdo exclusivo para membros. O acesso permanece bloqueado até que este domínio seja verificado.",NOT_CONFIGURED_ACTION:"Corrigir",SUSPENDED_HEADING:"FrameAuth - Ação necessária",SUSPENDED_MESSAGE:"Se você é o proprietário do site, entre no painel do FrameAuth para reativar seu projeto.",SUSPENDED_ACTION:"Abrir o painel do FrameAuth",SNIPPET_MISSING:"O trecho de código do FramerAuth não está no início de <body>",UNKNOWN_ERROR:"Erro desconhecido",CLIENT_NOT_INITIALIZED:"O cliente de autenticação não foi inicializado",IMAGE_REQUIRED:"Nenhuma imagem foi fornecida",BROWSER_UNAVAILABLE:"Navegador indisponível"};var _e={ACCESS_DENIED:"Доступ к этой странице ограничен.",BACK:"Назад",NOT_CONFIGURED_HEADING:"FrameAuth не может подтвердить этот домен",NOT_CONFIGURED_MESSAGE:"Этот сайт использует FrameAuth для регистрации, входа, управления учетными записями и контентом только для участников. Доступ останется заблокированным, пока этот домен не будет подтвержден.",NOT_CONFIGURED_ACTION:"Исправить",SUSPENDED_HEADING:"FrameAuth - Требуется действие",SUSPENDED_MESSAGE:"Если вы владелец сайта, войдите в панель FrameAuth, чтобы снова активировать проект.",SUSPENDED_ACTION:"Открыть панель FrameAuth",SNIPPET_MISSING:"В начале <body> отсутствует фрагмент кода FramerAuth",UNKNOWN_ERROR:"Неизвестная ошибка",CLIENT_NOT_INITIALIZED:"Клиент аутентификации не инициализирован",IMAGE_REQUIRED:"Изображение не предоставлено",BROWSER_UNAVAILABLE:"Браузер недоступен"};var ke={ACCESS_DENIED:"Der Zugriff auf diese Seite ist eingeschränkt.",BACK:"Zurück",NOT_CONFIGURED_HEADING:"FrameAuth kann diese Domain nicht verifizieren",NOT_CONFIGURED_MESSAGE:"Diese Website verwendet FrameAuth für Registrierung, Anmeldung, Benutzerkonten und Inhalte nur für Mitglieder. Der Zugriff bleibt gesperrt, bis diese Domain verifiziert wurde.",NOT_CONFIGURED_ACTION:"Beheben",SUSPENDED_HEADING:"FrameAuth - Aktion erforderlich",SUSPENDED_MESSAGE:"Wenn Sie der Websitebetreiber sind, melden Sie sich bitte im FrameAuth-Dashboard an, um Ihr Projekt wieder zu aktivieren.",SUSPENDED_ACTION:"FrameAuth-Dashboard öffnen",SNIPPET_MISSING:"Das FramerAuth-Snippet fehlt am Anfang von <body>",UNKNOWN_ERROR:"Unbekannter Fehler",CLIENT_NOT_INITIALIZED:"Der Authentifizierungsclient wurde nicht initialisiert",IMAGE_REQUIRED:"Es wurde kein Bild bereitgestellt",BROWSER_UNAVAILABLE:"Browser nicht verfügbar"};var Le={ACCESS_DENIED:"このページへのアクセスは制限されています。",BACK:"戻る",NOT_CONFIGURED_HEADING:"FrameAuth はこのドメインを確認できません",NOT_CONFIGURED_MESSAGE:"このサイトでは FrameAuth を使用して、登録、サインイン、ユーザーアカウント、会員限定コンテンツを管理しています。このドメインの確認が完了するまで、アクセスはロックされます。",NOT_CONFIGURED_ACTION:"修正する",SUSPENDED_HEADING:"FrameAuth - 対応が必要です",SUSPENDED_MESSAGE:"サイトの所有者の方は、FrameAuth ダッシュボードにログインしてプロジェクトを再有効化してください。",SUSPENDED_ACTION:"FrameAuth ダッシュボードを開く",SNIPPET_MISSING:"<body> の先頭に FramerAuth のスニペットがありません",UNKNOWN_ERROR:"不明なエラー",CLIENT_NOT_INITIALIZED:"認証クライアントが初期化されていません",IMAGE_REQUIRED:"画像が指定されていません",BROWSER_UNAVAILABLE:"ブラウザーを利用できません"};var we={ACCESS_DENIED:"इस पेज का ऐक्सेस प्रतिबंधित है।",BACK:"वापस",NOT_CONFIGURED_HEADING:"FrameAuth इस डोमेन को सत्यापित नहीं कर सकता",NOT_CONFIGURED_MESSAGE:"यह साइट साइन अप, साइन इन, उपयोगकर्ता खातों और केवल सदस्यों के लिए उपलब्ध सामग्री को प्रबंधित करने के लिए FrameAuth का उपयोग करती है। इस डोमेन के सत्यापित होने तक ऐक्सेस बंद रहेगा।",NOT_CONFIGURED_ACTION:"इसे ठीक करें",SUSPENDED_HEADING:"FrameAuth - कार्रवाई आवश्यक है",SUSPENDED_MESSAGE:"यदि आप साइट के मालिक हैं, तो कृपया अपना प्रोजेक्ट फिर से सक्रिय करने के लिए FrameAuth डैशबोर्ड में लॉग इन करें।",SUSPENDED_ACTION:"FrameAuth डैशबोर्ड खोलें",SNIPPET_MISSING:"<body> की शुरुआत में FramerAuth स्निपेट नहीं है",UNKNOWN_ERROR:"अज्ञात त्रुटि",CLIENT_NOT_INITIALIZED:"ऑथेंटिकेशन क्लाइंट प्रारंभ नहीं हुआ है",IMAGE_REQUIRED:"कोई चित्र प्रदान नहीं किया गया",BROWSER_UNAVAILABLE:"ब्राउज़र उपलब्ध नहीं है"};var De={ACCESS_DENIED:"Ez az oldal korlátozott hozzáférésű.",BACK:"Vissza",NOT_CONFIGURED_HEADING:"A FrameAuth nem tudja ellenőrizni ezt a domaint",NOT_CONFIGURED_MESSAGE:"Ezen az oldalon a FrameAuth kezeli a regisztrációt, a bejelentkezést, a felhasználói fiókokat és a csak tagoknak szóló tartalmakat. A hozzáférés zárolva marad, amíg a domain ellenőrzése meg nem történik.",NOT_CONFIGURED_ACTION:"Javítás",SUSPENDED_HEADING:"FrameAuth – Teendő szükséges",SUSPENDED_MESSAGE:"Ha te vagy az oldal tulajdonosa, jelentkezz be a FrameAuth irányítópultra a projekt újraaktiválásához.",SUSPENDED_ACTION:"FrameAuth irányítópult megnyitása",SNIPPET_MISSING:"A FramerAuth-kódrészlet hiányzik a <body> elejéről",UNKNOWN_ERROR:"Ismeretlen hiba",CLIENT_NOT_INITIALIZED:"A hitelesítési kliens nincs inicializálva",IMAGE_REQUIRED:"Nem adtál meg képet",BROWSER_UNAVAILABLE:"A böngésző nem érhető el"};var Ue={en:Z,zh:Re,es:Oe,fr:Ie,ar:Te,pt:Pe,ru:_e,de:ke,ja:Le,hi:we,hu:De};var Lt=["en","zh","es","fr","ar","pt","ru","de","ja","hi","hu"];function Ce(t){return typeof t=="string"&&Lt.some(e=>e===t)}function xe(t){return t.trim().toLowerCase().split(/[-_]/)[0]}function Fe(t){return typeof t=="string"&&Ce(xe(t))}function C(t){if(typeof t!="string")return"en";let e=xe(t);return Ce(e)?e:"en"}function Me(){return typeof window<"u"&&window.FramerAuth?.data?.project?window.FramerAuth.data.project:q}function x(){return C(Me().get()?.locale)}function wt(t){return t?.locale!==void 0&&!Fe(t.locale)?"ltr":t?.dir==="ltr"||t?.dir==="rtl"?t.dir:C(t?.locale)==="ar"?"rtl":"ltr"}function B(){return wt(Me().get())}function Dt(t,e,r,o,n){let a=n===void 0?x():C(n);return(t[a][r]??e[r]).replace(/\{(\w+)\}/g,(u,c)=>!o||!Object.prototype.hasOwnProperty.call(o,c)?u:String(o[c]))}function v(t,e,r){return Dt(Ue,Z,t,e,r)}var Ut=Object.defineProperty,Ct=Object.defineProperties,xt=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertySymbols,Ft=Object.prototype.hasOwnProperty,Mt=Object.prototype.propertyIsEnumerable,Be=(t,e,r)=>e in t?Ut(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w=(t,e)=>{for(var r in e||(e={}))Ft.call(e,r)&&Be(t,r,e[r]);if(Ge)for(var r of Ge(e))Mt.call(e,r)&&Be(t,r,e[r]);return t},D=(t,e)=>Ct(t,xt(e)),Gt=class extends Error{constructor(t,e,r){super(e||t.toString(),{cause:r}),this.status=t,this.statusText=e,this.error=r}},Bt=async(t,e)=>{var r,o,n,a,i,u;let c=e||{},s={onRequest:[e?.onRequest],onResponse:[e?.onResponse],onSuccess:[e?.onSuccess],onError:[e?.onError],onRetry:[e?.onRetry]};if(!e||!e?.plugins)return{url:t,options:c,hooks:s};for(let p of e?.plugins||[]){if(p.init){let S=await((r=p.init)==null?void 0:r.call(p,t.toString(),e));c=S.options||c,t=S.url}s.onRequest.push((o=p.hooks)==null?void 0:o.onRequest),s.onResponse.push((n=p.hooks)==null?void 0:n.onResponse),s.onSuccess.push((a=p.hooks)==null?void 0:a.onSuccess),s.onError.push((i=p.hooks)==null?void 0:i.onError),s.onRetry.push((u=p.hooks)==null?void 0:u.onRetry)}return{url:t,options:c,hooks:s}},je=class{constructor(t){this.options=t}shouldAttemptRetry(t,e){return this.options.shouldRetry?Promise.resolve(t<this.options.attempts&&this.options.shouldRetry(e)):Promise.resolve(t<this.options.attempts)}getDelay(){return this.options.delay}},jt=class{constructor(t){this.options=t}shouldAttemptRetry(t,e){return this.options.shouldRetry?Promise.resolve(t<this.options.attempts&&this.options.shouldRetry(e)):Promise.resolve(t<this.options.attempts)}getDelay(t){return Math.min(this.options.maxDelay,this.options.baseDelay*2**t)}};function Ht(t){if(typeof t=="number")return new je({type:"linear",attempts:t,delay:1e3});switch(t.type){case"linear":return new je(t);case"exponential":return new jt(t);default:throw new Error("Invalid retry strategy")}}var zt=async t=>{let e={},r=async o=>typeof o=="function"?await o():o;if(t?.auth){if(t.auth.type==="Bearer"){let o=await r(t.auth.token);if(!o)return e;e.authorization=`Bearer ${o}`}else if(t.auth.type==="Basic"){let o=r(t.auth.username),n=r(t.auth.password);if(!o||!n)return e;e.authorization=`Basic ${btoa(`${o}:${n}`)}`}else if(t.auth.type==="Custom"){let o=r(t.auth.value);if(!o)return e;e.authorization=`${r(t.auth.prefix)} ${o}`}}return e},Wt=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function $t(t){let e=t.headers.get("content-type"),r=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!e)return"json";let o=e.split(";").shift()||"";return Wt.test(o)?"json":r.has(o)||o.startsWith("text/")?"text":"blob"}function Kt(t){try{return JSON.parse(t),!0}catch{return!1}}function We(t){if(t===void 0)return!1;let e=typeof t;return e==="string"||e==="number"||e==="boolean"||e===null?!0:e!=="object"?!1:Array.isArray(t)?!0:t.buffer?!1:t.constructor&&t.constructor.name==="Object"||typeof t.toJSON=="function"}function He(t){try{return JSON.parse(t)}catch{return t}}function ze(t){return typeof t=="function"}function Vt(t){if(t?.customFetchImpl)return t.customFetchImpl;if(typeof globalThis<"u"&&ze(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&ze(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function qt(t){let e=new Headers(t?.headers),r=await zt(t);for(let[o,n]of Object.entries(r||{}))e.set(o,n);if(!e.has("content-type")){let o=Zt(t?.body);o&&e.set("content-type",o)}return e}function Zt(t){return We(t)?"application/json":null}function Jt(t){if(!t?.body)return null;let e=new Headers(t?.headers);if(We(t.body)&&!e.has("content-type")){for(let[r,o]of Object.entries(t?.body))o instanceof Date&&(t.body[r]=o.toISOString());return JSON.stringify(t.body)}return t.body}function Qt(t,e){var r;if(e?.method)return e.method.toUpperCase();if(t.startsWith("@")){let o=(r=t.split("@")[1])==null?void 0:r.split("/")[0];return Ke.includes(o)?o.toUpperCase():e?.body?"POST":"GET"}return e?.body?"POST":"GET"}function Yt(t,e){let r;return!t?.signal&&t?.timeout&&(r=setTimeout(()=>e?.abort(),t?.timeout)),{abortTimeout:r,clearTimeout:()=>{r&&clearTimeout(r)}}}var Xt=class $e extends Error{constructor(e,r){super(r||JSON.stringify(e,null,2)),this.issues=e,Object.setPrototypeOf(this,$e.prototype)}};async function er(t,e){let r=await t["~standard"].validate(e);if(r.issues)throw new Xt(r.issues);return r.value}var Ke=["get","post","put","patch","delete"];function tr(t,e){let{baseURL:r,params:o,query:n}=e||{query:{},params:{},baseURL:""},a=t.startsWith("http")?t.split("/").slice(0,3).join("/"):r||"";if(t.startsWith("@")){let S=t.toString().split("@")[1].split("/")[0];Ke.includes(S)&&(t=t.replace(`@${S}/`,"/"))}a.endsWith("/")||(a+="/");let[i,u]=t.replace(a,"").split("?"),c=new URLSearchParams(u);for(let[S,E]of Object.entries(n||{}))E!=null&&c.set(S,String(E));if(o)if(Array.isArray(o)){let S=i.split("/").filter(E=>E.startsWith(":"));for(let[E,oe]of S.entries()){let H=o[E];i=i.replace(oe,H)}}else for(let[S,E]of Object.entries(o))i=i.replace(`:${S}`,String(E));i=i.split("/").map(encodeURIComponent).join("/"),i.startsWith("/")&&(i=i.slice(1));let s=c.toString();return s=s.length>0?`?${s}`.replace(/\+/g,"%20"):"",a.startsWith("http")?new URL(`${i}${s}`,a):`${a}${i}${s}`}var h=async(t,e)=>{var r,o,n,a,i,u,c,s;let{hooks:p,url:S,options:E}=await Bt(t,e),oe=Vt(E),H=new AbortController,ft=(r=E.signal)!=null?r:H.signal,ht=tr(S,E),pt=Jt(E),mt=await qt(E),gt=Qt(S,E),m=D(w({},E),{url:ht,headers:mt,body:pt,method:gt,signal:ft});for(let A of p.onRequest)if(A){let b=await A(m);b instanceof Object&&(m=b)}("pipeTo"in m&&typeof m.pipeTo=="function"||typeof((o=e?.body)==null?void 0:o.pipe)=="function")&&("duplex"in m||(m.duplex="half"));let{clearTimeout:Et}=Yt(E,H),d=await oe(m.url,m);Et();let Ee={response:d,request:m};for(let A of p.onResponse)if(A){let b=await A(D(w({},Ee),{response:(n=e?.hookOptions)!=null&&n.cloneResponse?d.clone():d}));b instanceof Response?d=b:b instanceof Object&&(d=b.response)}if(d.ok){if(!(m.method!=="HEAD"))return{data:"",error:null};let b=$t(d),T={data:"",response:d,request:m};if(b==="json"||b==="text"){let P=await d.text(),vt=await((a=m.jsonParser)!=null?a:He)(P);T.data=vt}else T.data=await d[b]();m?.output&&m.output&&!m.disableValidation&&(T.data=await er(m.output,T.data));for(let P of p.onSuccess)P&&await P(D(w({},T),{response:(i=e?.hookOptions)!=null&&i.cloneResponse?d.clone():d}));return e?.throw?T.data:{data:T.data,error:null}}let yt=(u=e?.jsonParser)!=null?u:He,z=await d.text(),ye=Kt(z),ne=ye?await yt(z):null,bt={response:d,responseText:z,request:m,error:D(w({},ne),{status:d.status,statusText:d.statusText})};for(let A of p.onError)A&&await A(D(w({},bt),{response:(c=e?.hookOptions)!=null&&c.cloneResponse?d.clone():d}));if(e?.retry){let A=Ht(e.retry),b=(s=e.retryAttempt)!=null?s:0;if(await A.shouldAttemptRetry(b,d)){for(let P of p.onRetry)P&&await P(Ee);let T=A.getDelay(b);return await new Promise(P=>setTimeout(P,T)),await h(t,D(w({},e),{retryAttempt:b+1}))}}if(e?.throw)throw new Gt(d.status,d.statusText,ye?ne:z);return{data:null,error:D(w({},ne),{status:d.status,statusText:d.statusText})}};var f=class extends Error{constructor(r){super(v(r));this.code=r}};var rr="https://core.framerauth.com/v2",or="application/octet-stream",nr=t=>{if(t instanceof Blob)return t;let e=typeof FormData<"u"&&t instanceof FormData?t.get("file"):t?.file;if(!(e instanceof Blob))throw new f("IMAGE_REQUIRED");return e},J=class{baseURL=null;useBearerAuth=!1;data;state;api;auth;constructor(e){this.baseURL=null,this.data=e.data,this.state=e.state,this.api={fetchBookmarks:async()=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let r=await h(`${this.baseURL}/profile/bookmarks`,{...this.authOptions()});if(!r.data)return r;let o=new Set(r.data),n={};for(let a of o)n[a]=!0;return{data:n,error:null}},fetchProject:async()=>await h(`${rr}/public/project/config`)},this.auth={getSession:async()=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let r=await h(`${this.baseURL}/get-session`,{method:"GET",...this.authOptions(),query:{disableCookieCache:!0}});return r.data?(this.data.user.set(r.data.user),this.data.session.set(r.data.session),this.data.tags.set(r.data.user.tags??[])):(this.data.user.set(null),this.data.session.set(null),this.data.tags.set([]),this.data.bookmarks.set({}),this.data.bearerToken.set(null)),r},signUp:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let{fetchOptions:o,...n}=r,a=this.authOptions(),i={...a,...o,headers:{...a.headers,...o?.headers}},u=await h(`${this.baseURL}/sign-up/email`,{...i,method:"POST",body:n,onSuccess:c=>{let s=c.response.headers.get("set-auth-token");s&&this.data.bearerToken.set(s)}});return u.error||(await this.auth.getSession(),this.api.fetchBookmarks().then(c=>{this.data.bookmarks.set(c.data??{})})),u},signIn:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let{fetchOptions:o,...n}=r,a=this.authOptions(),i={...a,...o,headers:{...a.headers,...o?.headers}},u=await h(`${this.baseURL}/sign-in/email`,{...i,method:"POST",body:n,onSuccess:c=>{let s=c.response.headers.get("set-auth-token");s&&this.data.bearerToken.set(s)}});return u.error||(await this.auth.getSession(),this.api.fetchBookmarks().then(c=>{this.data.bookmarks.set(c.data??{})})),u},signInSocial:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=await h(`${this.baseURL}/sign-in/social`,{method:"POST",...this.authOptions(),body:r});return o.data?.url&&(window.location.href=o.data.url),o},signOut:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=await h(`${this.baseURL}/sign-out`,{method:"POST",...this.authOptions(),body:{}});return this.data.user.set(null),this.data.session.set(null),this.data.tags.set([]),this.data.bookmarks.set({}),this.data.bearerToken.set(null),r?.redirectTo&&(window.location.href=r.redirectTo),o},sendOTP:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=`${this.baseURL}/email-otp/send-verification-otp`;return await h(o,{body:r,...this.authOptions(),method:"POST"})},signInOTP:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=`${this.baseURL}/sign-in/email-otp`,n=await h(o,{body:r,...this.authOptions(),method:"POST",onSuccess:a=>{let i=a.response.headers.get("set-auth-token");i&&this.data.bearerToken.set(i)}});return n.error||(await this.auth.getSession(),this.api.fetchBookmarks().then(a=>{this.data.bookmarks.set(a.data??{})})),n},updateProfile:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=`${this.baseURL}/profile`;return await h(o,{body:r,...this.authOptions(),method:"PATCH"})},updateProfilePicture:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=`${this.baseURL}/profile/avatar`,n=this.authOptions();return await h(o,{...n,method:"POST",headers:{...n.headers,"Content-Type":or},body:nr(r)})},createBookmark:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=`${this.baseURL}/profile/bookmarks`;return await h(o,{body:r,...this.authOptions(),method:"POST"})},deleteBookmark:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=`${this.baseURL}/profile/bookmarks/${r.bookmark_type}/${r.id}`;return await h(o,{...this.authOptions(),method:"DELETE"})},sendForgotPasswordEmail:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=`${this.baseURL}/request-password-reset`;return await h(o,{body:r,...this.authOptions(),method:"POST"})},resetPassword:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=`${this.baseURL}/reset-password`;return await h(o,{body:r,...this.authOptions(),method:"POST"})},storeCheckout:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=`${this.baseURL}/store/checkout/session`;return await h(o,{body:r,...this.authOptions(),method:"POST"})},storePortal:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=`${this.baseURL}/plugins/${r.pluginId}/portal`,n=this.authOptions();return await h(o,{...n,method:"GET",headers:{...n.headers,Accept:"application/json"},query:r.returnURL?{returnURL:r.returnURL}:void 0})},sendVerificationEmail:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=`${this.baseURL}/send-verification-email`;return await h(o,{body:r,...this.authOptions(),method:"POST"})},exchangeOneTimeToken:async r=>{if(!this.baseURL)throw new f("CLIENT_NOT_INITIALIZED");let o=await h(`${this.baseURL}/one-time-token/verify`,{method:"POST",body:{token:r}});return o.data?.session?.token&&this.data.bearerToken.set(o.data.session.token),o}}}updateBaseURL(e){this.baseURL=e}updateAuthMode(e){this.useBearerAuth=e}async handleOTTFromURL(){if(!this.useBearerAuth)return;let e=new URLSearchParams(window.location.search),r=e.get("ott");if(!r)return;e.delete("ott");let o=e.size?`${window.location.pathname}?${e.toString()}${window.location.hash}`:`${window.location.pathname}${window.location.hash}`;history.replaceState(null,"",o),await this.auth.exchangeOneTimeToken(r)}authOptions(){if(this.useBearerAuth){let e=this.data.bearerToken.get();return e?{headers:{Authorization:`Bearer ${e}`}}:{}}return{credentials:"include"}}};var Ve=N("fa-tags",[],{encode:R({obfuscate:!0}),decode:O({deobfuscate:!0,fallback:[]})}),qe=y(!1);function Ze(t){return Array.isArray(t)?t.length===0?!0:t.every(e=>e!==null&&typeof e=="object"&&typeof e.id=="string"&&typeof e.name=="string"):!1}function ar(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.id!="string"||typeof e.email!="string"||typeof e.name!="string"||typeof e.email_verified!="boolean"||!(e.created_at instanceof Date||typeof e.created_at=="string")||!(e.updated_at instanceof Date||typeof e.updated_at=="string")?!1:Ze(e.tags)}function ir(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.id=="string"&&typeof e.user_id=="string"&&typeof e.token=="string"&&(e.expires_at instanceof Date||typeof e.expires_at=="string")&&(e.created_at instanceof Date||typeof e.created_at=="string")&&(e.updated_at instanceof Date||typeof e.updated_at=="string")}function Je(t){if(!t||typeof t!="object")return null;let e=t;return Ze(e.tags)||(e.tags=[]),ar(e)?e:null}function Qe(t){return ir(t)?t:null}function sr(t){return!t||typeof t!="object"||Array.isArray(t)?!1:Object.entries(t).every(([e,r])=>typeof e=="string"&&typeof r=="boolean")}function Ye(t){return!t||typeof t!="object"||Array.isArray(t)?{}:sr(t)?t:{}}var Xe=N("fa-user",null,{encode:R({obfuscate:!0}),decode:O({deobfuscate:!0,fallback:null,validator:Je})}),et=y(!1);var tt=N("fa-session",null,{encode:R({obfuscate:!0}),decode:O({deobfuscate:!0,fallback:null,validator:Qe})}),rt=y(!1);var ot=y(!0);var lr={lock:`
|
|
2
2
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
|
|
3
3
|
<path
|
|
4
4
|
d="M 2 7.5 L 14 7.5 L 14 12.5 C 14 14.157 12.657 15.5 11 15.5 L 5 15.5 C 3.343 15.5 2 14.157 2 12.5 Z"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
stroke-linecap="round"
|
|
36
36
|
></path>
|
|
37
37
|
</svg>
|
|
38
|
-
`},
|
|
38
|
+
`},se=class t extends HTMLElement{static styles=`
|
|
39
39
|
:host {
|
|
40
40
|
--color-primary: #f9f9f9;
|
|
41
41
|
--color-secondary: #333333;
|
|
@@ -174,11 +174,11 @@
|
|
|
174
174
|
opacity: 1;
|
|
175
175
|
background-color: var(--button-background-active-color);
|
|
176
176
|
}
|
|
177
|
-
`;shadow;config={heading:"",message:
|
|
177
|
+
`;shadow;config={heading:"",message:v("ACCESS_DENIED"),actionLabel:"",actionHref:"",icon:"lock"};onAction;handleAction=()=>{this.onAction?.()};static get observedAttributes(){return["heading","message","action-label","action-href","icon"]}constructor(){super(),this.shadow=this.attachShadow({mode:"closed"})}attributeChangedCallback(e,r,o){switch(e){case"heading":this.config.heading=o||"";break;case"message":this.config.message=o||v("ACCESS_DENIED",void 0,this.lang?C(this.lang):void 0);break;case"action-label":this.config.actionLabel=o||"";break;case"action-href":this.config.actionHref=o||"";break;case"icon":this.config.icon=o==="warning"?"warning":"lock";break}this.isConnected&&this.render()}connectedCallback(){this.style.fontFamily=getComputedStyle(document.body).fontFamily,this.render(),this.focusInitial()}focusInitial(){(this.shadow.querySelector(".btn--action")??this.shadow.querySelector(".section"))?.focus()}renderAction(){return this.config.actionLabel?this.config.actionHref?'<a class="btn--action" target="_blank" rel="noopener noreferrer"></a>':this.onAction?'<button class="btn--action" type="button"></button>':"":""}render(){let e=this.config.heading.length>0,r=e?'aria-labelledby="fa-overlay-heading" aria-describedby="fa-overlay-description"':'aria-labelledby="fa-overlay-description"',o=document.createElement("template");o.innerHTML=`
|
|
178
178
|
<style>${t.styles}</style>
|
|
179
179
|
<div class="section" role="dialog" aria-modal="true" tabindex="-1" ${r}>
|
|
180
180
|
<main>
|
|
181
|
-
<div class="icon" aria-hidden="true">${
|
|
181
|
+
<div class="icon" aria-hidden="true">${lr[this.config.icon]}</div>
|
|
182
182
|
<div id="container">
|
|
183
183
|
${e?'<div class="heading" id="fa-overlay-heading"></div>':""}
|
|
184
184
|
<div class="description" id="fa-overlay-description"></div>
|
|
@@ -186,4 +186,4 @@
|
|
|
186
186
|
</div>
|
|
187
187
|
</main>
|
|
188
188
|
</div>
|
|
189
|
-
`,this.shadow.replaceChildren(n.content.cloneNode(!0));let o=this.shadow.querySelector(".heading");o&&(o.textContent=this.config.heading);let a=this.shadow.querySelector(".description");a&&(a.textContent=this.config.message);let i=this.shadow.querySelector(".btn--action");i&&(i.textContent=this.config.actionLabel,i instanceof HTMLAnchorElement?i.href=this.config.actionHref:i.addEventListener("click",this.handleAction))}},te="fa-overlay";function Mt(){customElements.get(te)||customElements.define(te,ee)}function B(t){Mt();let e=document.createElement(te);return t.onAction&&(e.onAction=t.onAction),t.heading&&e.setAttribute("heading",t.heading),e.setAttribute("message",t.message),t.actionLabel&&e.setAttribute("action-label",t.actionLabel),t.actionHref&&e.setAttribute("action-href",t.actionHref),t.icon&&e.setAttribute("icon",t.icon),t.theme&&e.setAttribute("theme",t.theme),e}function L(){document.body.style.visibility="hidden"}function A(){document.body.style.visibility="visible"}var $t="/sign-in",zt="This page is restricted.",W=null;function q(t,e){let n=document.querySelector(`meta[name="${t}"]`)?.content.trim();return n||e&&document.querySelector(`meta[name="${e}"]`)?.content.trim()||null}function It(t){return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function re(){return W||(W={errorPath:m(q("fa:error-path","framerauth:error-path")??$t),boostPatterns:It(q("fa:boost","framerauth:boost")),router:q("fa:router"),accessDeniedMessage:q("fa:access-denied-message")??zt},W)}function Wt(){return re().errorPath}function m(t){let r=(t??"").trim();if(r.includes("://"))try{r=new URL(r).pathname}catch{}return r=r.split("#")[0]??"",r=r.split("?")[0]??"",r.length===0&&(r="/"),r.startsWith("/")||(r=`/${r}`),r!=="/"&&r.endsWith("/")&&(r=r.slice(0,-1)),r}function qt(t,e){return m(t)===m(e)}function J(t=window.location.pathname){return m(t)==="/"}function D(t=window.location.pathname,e=Wt()){return qt(t,e)}function Ne(t){let e=t.map(r=>r.trim()).filter(Boolean).map(r=>{if(r==="*"||r==="/*")return{kind:"all"};let n=r.startsWith("/")?r:`/${r}`;return n.endsWith("/**")?{kind:"deep",base:m(n.slice(0,-3))}:n.endsWith("/*")?{kind:"oneSegment",base:m(n.slice(0,-2))}:n.endsWith("*")?{kind:"prefixPathSegment",base:m(n.slice(0,-1))}:{kind:"exact",base:m(n)}});return r=>{let n=m(r);return e.some(o=>{if(o.kind==="all")return!0;if(o.kind==="exact")return n===o.base;if(o.kind==="deep")return n.startsWith(`${o.base}/`);if(o.kind==="oneSegment"){if(!n.startsWith(`${o.base}/`))return!1;let a=n.slice(o.base.length+1);return a.length>0&&!a.includes("/")}return n===o.base||n.startsWith(`${o.base}/`)})}}var V=class{hasAccess;isPublicPath;errorPath;forceFallbackOverlay;accessDeniedMessage;onError;originalPushState;originalReplaceState;isMonkeyPatched=!1;navigationHandler=null;navigationSuccessHandler=null;fallbackPopStateHandler=null;lockedOverlay=null;shouldReloadAfterErrorRedirect=!1;isObservingNavigation=!1;constructor(e){this.hasAccess=e.hasAccess,this.isPublicPath=e.isPublicPath,this.errorPath=e.errorPath,this.forceFallbackOverlay=e.forceFallbackOverlay,this.accessDeniedMessage=e.accessDeniedMessage,this.onError=e.onError,this.originalPushState=history.pushState.bind(history),this.originalReplaceState=history.replaceState.bind(history)}normalizeToPath(e){if(e instanceof URL)return m(e.pathname);if(e.startsWith("./"))return m(e.slice(1));if(e.startsWith("/"))return m(e);try{let r=new URL(e);return m(r.pathname)}catch{return m(e.startsWith("/")?e:"/"+e)}}normalizePathInput(e){let r=e.startsWith("/")?e:`/${e}`;return m(r)}checkAccess(e){let r=this.normalizePathInput(e);if(D(r,this.errorPath)||this.isPublicPath(r))return!0;try{return this.hasAccess(r)}catch{return!1}}isOnErrorPage(){let e=this.normalizePathInput(window.location.pathname);return D(e,this.errorPath)}redirectToError(){if(this.isOnErrorPage()){A();return}window.location.replace(this.errorPath)}handleAccessDenied(e){e&&this.onError&&this.onError(e),this.redirectToError()}monkeyPatchHistory(){if(this.isMonkeyPatched)return;let e=this;history.pushState=function(r,n,o){if(o){let a=e.normalizeToPath(o);e.checkAccess(a)||(L(),e.isObservingNavigation||e.renderLockedOverlay())}return e.originalPushState.call(this,r,n,o)},history.replaceState=function(r,n,o){if(o){let a=e.normalizeToPath(o);e.checkAccess(a)||(L(),e.isObservingNavigation||e.renderLockedOverlay())}return e.originalReplaceState.call(this,r,n,o)},this.isMonkeyPatched=!0}startObservingNavigation(){if(this.forceFallbackOverlay)return!1;let e=window.navigation;return!e||this.navigationHandler?!1:(this.navigationHandler=r=>{let n=r,o=n.destination?.url;if(!o)return;let a=new URL(o);if(!(a.origin!==window.location.origin||this.checkAccess(a.pathname))){if(L(),n.canIntercept&&r.cancelable&&typeof n.intercept=="function"){n.intercept({precommitHandler:u=>{u.redirect(this.errorPath,{history:n.navigationType==="push"?"push":"replace"}),this.shouldReloadAfterErrorRedirect=!0}});return}this.renderLockedOverlay()}},this.navigationSuccessHandler=()=>{this.shouldReloadAfterErrorRedirect&&this.isOnErrorPage()&&(this.shouldReloadAfterErrorRedirect=!1,window.location.reload())},e.addEventListener("navigate",this.navigationHandler),e.addEventListener("navigatesuccess",this.navigationSuccessHandler),this.isObservingNavigation=!0,!0)}stopObservingNavigation(){let e=window.navigation;!e||!this.navigationHandler||(e.removeEventListener("navigate",this.navigationHandler),this.navigationSuccessHandler&&e.removeEventListener("navigatesuccess",this.navigationSuccessHandler),this.navigationHandler=null,this.navigationSuccessHandler=null,this.shouldReloadAfterErrorRedirect=!1,this.isObservingNavigation=!1)}startObservingFallbackPopState(){this.fallbackPopStateHandler||(this.fallbackPopStateHandler=()=>{if(!this.checkAccess(window.location.pathname)){L(),this.renderLockedOverlay();return}this.removeLockedOverlay(),A()},window.addEventListener("popstate",this.fallbackPopStateHandler))}stopObservingFallbackPopState(){this.fallbackPopStateHandler&&(window.removeEventListener("popstate",this.fallbackPopStateHandler),this.fallbackPopStateHandler=null)}renderLockedOverlay(){if(this.lockedOverlay)return;this.startObservingFallbackPopState();let e=B({message:this.accessDeniedMessage,actionLabel:"Back",onAction:()=>history.back()});e.id="fa-access-denied",document.documentElement.appendChild(e),this.lockedOverlay=e}removeLockedOverlay(){this.lockedOverlay?.remove(),this.lockedOverlay=null}restoreHistory(){this.isMonkeyPatched&&(history.pushState=this.originalPushState,history.replaceState=this.originalReplaceState,this.isMonkeyPatched=!1)}start(){this.stop(),this.startObservingNavigation(),this.monkeyPatchHistory()}stop(){this.restoreHistory(),this.stopObservingNavigation(),this.stopObservingFallbackPopState(),this.removeLockedOverlay(),A()}};var He=k("fa-bookmarks",I(),{encode:P({obfuscate:!0}),decode:S({deobfuscate:!0,fallback:{},validator:Ue})}),Me=b(!1);var $e=k("fa-bearer-token",null,{encode:P({obfuscate:!0}),decode:S({deobfuscate:!0,fallback:null})});var ze=(t,e)=>{let r=m(e),n=t.data.user.get(),o=t.data.session.get(),a=t.data.project.get();if(!a)return!1;if(!Object.prototype.hasOwnProperty.call(a.pages,r))return!0;if(!n||!o)return!1;let u=a.pages[r];return u.length===0?!0:u.some(c=>n.tags.find(s=>s.id===c))};console.log("FramerAuth SDK (JavaScript): 2.1.12");var Jt="/v2",Vt=0,Ie="https://frameauth.com/guides-v2/configuration-error",Gt="https://app.frameauth.com",l=new H({data:{user:_e,project:Re,tags:Oe,bookmarks:He,session:Fe,bearerToken:$e},state:{initializing:Be,userLoading:De,projectLoading:Ee,tagsLoading:Le,bookmarksLoading:Me,sessionLoading:Ce}});window.FramerAuth=l;var F=re(),We=Ne(F.boostPatterns),C=null,ne=!1,oe=!1;function ae(t){return t?.status===404}function ie(t){return t?.status===403}function Kt(){return ne||oe}function se(t){if(oe)return;oe=!0,l.data.project.set(null),l.state.projectLoading.set(!1),C?.stop(),C=null,L();let e=B({heading:"FrameAuth - Action required",message:t??"",actionLabel:"Open FrameAuth dashboard",actionHref:Gt,icon:"warning",theme:"warning"});e.id="fa-project-suspended",document.documentElement.appendChild(e)}function le(){if(ne)return;if(ne=!0,l.data.project.set(null),l.state.projectLoading.set(!1),J()){console.warn(`FramerAuth: this domain is not linked to a FramerAuth project. The home page is shown signed-out; other pages show a warning. Fix: ${Ie}`),C||K(),A();return}C?.stop(),C=null,L();let t=B({heading:"FrameAuth can\u2019t verify this domain",message:"This site has FrameAuth installed which handles sign-up, sign-in, user accounts, and member-only content. Access stays locked until this domain is verified.",actionLabel:"Fix this",actionHref:Ie,icon:"warning",theme:"warning"});t.id="fa-project-not-configured",document.documentElement.appendChild(t)}function Qt(){return D()?!0:l.data.project.get()!==null&&We(window.location.pathname)}function G(t){let e=qe(t);if(!e)throw new Error("Unable to initialize FramerAuth: project tenantHost is missing");l.updateBaseURL(`https://${e}${Jt}`),l.updateAuthMode(Yt(t))}function Yt(t){return t.sessionTransport==="bearer"}function qe(t){if(t.customDomain)return t.customDomain;let e=Zt(t);return e?`${t.slug}.${e}`:null}function Zt(t){return Vt||t.tenantHost||null}function ce(){l.api.fetchBookmarks().then(({data:t})=>{l.data.bookmarks.set(t??{})})}function Xt(){return new V({hasAccess:t=>ze(l,t),isPublicPath:t=>J(t)||We(t),errorPath:F.errorPath,forceFallbackOverlay:F.router==="overlay",accessDeniedMessage:F.accessDeniedMessage,onError:t=>{console.error("[Router] Error in router:",t)}})}function K(){let t=Xt();return t.checkAccess(window.location.pathname)?(t.start(),C=t,!0):(t.handleAccessDenied(),!1)}function er(){let t=l.data.project.get();return t&&qe(t)?(G(t),l.api.fetchProject().then(e=>{e.data?(l.data.project.set(e.data),G(e.data)):ae(e.error)?le():ie(e.error)&&se(e.error.message)}).catch(e=>{console.error("Failed to refresh FramerAuth project:",e)}),l.handleOTTFromURL().then(()=>Kt()?null:l.auth.getSession()).then(e=>{e&&e.data!==null&&ce()}).catch(e=>{console.error("Failed to refresh FramerAuth session:",e)})):(l.state.projectLoading.set(!0),l.api.fetchProject().then(e=>{if(e.data)return l.data.project.set(e.data),G(e.data),l.state.projectLoading.set(!1),l.handleOTTFromURL().then(()=>l.auth.getSession());if(ae(e.error)){le();return}if(ie(e.error)){se(e.error.message);return}l.state.projectLoading.set(!1)}).then(e=>{e&&e.data!==null&&ce()}).catch(e=>{console.error("Failed to initialize FramerAuth in the background:",e),l.state.projectLoading.set(!1)})),K()}async function tr(){L();let t=l.data.project.get(),e=await l.api.fetchProject();if(e.data)t=e.data,l.data.project.set(t);else{if(ae(e.error))return le(),!1;if(ie(e.error))return se(e.error.message),!1;if(!t)throw new Error(e.error.message||"Unable to load FramerAuth project!")}G(t),await l.handleOTTFromURL(),(await l.auth.getSession()).data!==null&&ce();let n=K();return n&&A(),n}async function rr(){l.state.initializing.set(!0);try{(Qt()?er():await tr())&&window.dispatchEvent(new CustomEvent("framerauth:initialized"))}catch(t){console.error("Failed to initialize FramerAuth:",t),J()||D(window.location.pathname,F.errorPath)?(K(),A()):window.location.replace(F.errorPath),window.dispatchEvent(new CustomEvent("framerauth:initialization-failed",{detail:{error:t}}))}finally{l.state.initializing.set(!1)}}rr();})();
|
|
189
|
+
`,this.shadow.replaceChildren(o.content.cloneNode(!0));let n=this.shadow.querySelector(".heading");n&&(n.textContent=this.config.heading);let a=this.shadow.querySelector(".description");a&&(a.textContent=this.config.message);let i=this.shadow.querySelector(".btn--action");i&&(i.textContent=this.config.actionLabel,i instanceof HTMLAnchorElement?i.href=this.config.actionHref:i.addEventListener("click",this.handleAction))}},le="fa-overlay";function cr(){customElements.get(le)||customElements.define(le,se)}function j(t){cr();let e=document.createElement(le);return e.lang=t.locale??x(),e.dir=t.dir??B(),t.onAction&&(e.onAction=t.onAction),t.heading&&e.setAttribute("heading",t.heading),e.setAttribute("message",t.message),t.actionLabel&&e.setAttribute("action-label",t.actionLabel),t.actionHref&&e.setAttribute("action-href",t.actionHref),t.icon&&e.setAttribute("icon",t.icon),t.theme&&e.setAttribute("theme",t.theme),e}function _(){document.body.style.visibility="hidden"}function L(){document.body.style.visibility="visible"}var ur="/sign-in",Q=null;function Y(t,e){let o=document.querySelector(`meta[name="${t}"]`)?.content.trim();return o||e&&document.querySelector(`meta[name="${e}"]`)?.content.trim()||null}function dr(t){return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function ce(){if(Q)return Q;let t=Y("fa:access-denied-message");return Q={errorPath:g(Y("fa:error-path","framerauth:error-path")??ur),boostPatterns:dr(Y("fa:boost","framerauth:boost")),router:Y("fa:router"),accessDeniedMessageOverride:t??void 0},Q}function fr(){return ce().errorPath}function g(t){let r=(t??"").trim();if(r.includes("://"))try{r=new URL(r).pathname}catch{}return r=r.split("#")[0]??"",r=r.split("?")[0]??"",r.length===0&&(r="/"),r.startsWith("/")||(r=`/${r}`),r!=="/"&&r.endsWith("/")&&(r=r.slice(0,-1)),r}function hr(t,e){return g(t)===g(e)}function X(t=window.location.pathname){return g(t)==="/"}function F(t=window.location.pathname,e=fr()){return hr(t,e)}function nt(t){let e=t.map(r=>r.trim()).filter(Boolean).map(r=>{if(r==="*"||r==="/*")return{kind:"all"};let o=r.startsWith("/")?r:`/${r}`;return o.endsWith("/**")?{kind:"deep",base:g(o.slice(0,-3))}:o.endsWith("/*")?{kind:"oneSegment",base:g(o.slice(0,-2))}:o.endsWith("*")?{kind:"prefixPathSegment",base:g(o.slice(0,-1))}:{kind:"exact",base:g(o)}});return r=>{let o=g(r);return e.some(n=>{if(n.kind==="all")return!0;if(n.kind==="exact")return o===n.base;if(n.kind==="deep")return o.startsWith(`${n.base}/`);if(n.kind==="oneSegment"){if(!o.startsWith(`${n.base}/`))return!1;let a=o.slice(n.base.length+1);return a.length>0&&!a.includes("/")}return o===n.base||o.startsWith(`${n.base}/`)})}}var ee=class{hasAccess;isPublicPath;errorPath;forceFallbackOverlay;accessDeniedMessage;onError;originalPushState;originalReplaceState;isMonkeyPatched=!1;navigationHandler=null;navigationSuccessHandler=null;fallbackPopStateHandler=null;lockedOverlay=null;shouldReloadAfterErrorRedirect=!1;isObservingNavigation=!1;constructor(e){this.hasAccess=e.hasAccess,this.isPublicPath=e.isPublicPath,this.errorPath=e.errorPath,this.forceFallbackOverlay=e.forceFallbackOverlay,this.accessDeniedMessage=e.accessDeniedMessage,this.onError=e.onError,this.originalPushState=history.pushState.bind(history),this.originalReplaceState=history.replaceState.bind(history)}normalizeToPath(e){if(e instanceof URL)return g(e.pathname);if(e.startsWith("./"))return g(e.slice(1));if(e.startsWith("/"))return g(e);try{let r=new URL(e);return g(r.pathname)}catch{return g(e.startsWith("/")?e:"/"+e)}}normalizePathInput(e){let r=e.startsWith("/")?e:`/${e}`;return g(r)}checkAccess(e){let r=this.normalizePathInput(e);if(F(r,this.errorPath)||this.isPublicPath(r))return!0;try{return this.hasAccess(r)}catch{return!1}}isOnErrorPage(){let e=this.normalizePathInput(window.location.pathname);return F(e,this.errorPath)}redirectToError(){if(this.isOnErrorPage()){L();return}window.location.replace(this.errorPath)}handleAccessDenied(e){e&&this.onError&&this.onError(e),this.redirectToError()}monkeyPatchHistory(){if(this.isMonkeyPatched)return;let e=this;history.pushState=function(r,o,n){if(n){let a=e.normalizeToPath(n);e.checkAccess(a)||(_(),e.isObservingNavigation||e.renderLockedOverlay())}return e.originalPushState.call(this,r,o,n)},history.replaceState=function(r,o,n){if(n){let a=e.normalizeToPath(n);e.checkAccess(a)||(_(),e.isObservingNavigation||e.renderLockedOverlay())}return e.originalReplaceState.call(this,r,o,n)},this.isMonkeyPatched=!0}startObservingNavigation(){if(this.forceFallbackOverlay)return!1;let e=window.navigation;return!e||this.navigationHandler?!1:(this.navigationHandler=r=>{let o=r,n=o.destination?.url;if(!n)return;let a=new URL(n);if(!(a.origin!==window.location.origin||this.checkAccess(a.pathname))){if(_(),o.canIntercept&&r.cancelable&&typeof o.intercept=="function"){o.intercept({precommitHandler:u=>{u.redirect(this.errorPath,{history:o.navigationType==="push"?"push":"replace"}),this.shouldReloadAfterErrorRedirect=!0}});return}this.renderLockedOverlay()}},this.navigationSuccessHandler=()=>{this.shouldReloadAfterErrorRedirect&&this.isOnErrorPage()&&(this.shouldReloadAfterErrorRedirect=!1,window.location.reload())},e.addEventListener("navigate",this.navigationHandler),e.addEventListener("navigatesuccess",this.navigationSuccessHandler),this.isObservingNavigation=!0,!0)}stopObservingNavigation(){let e=window.navigation;!e||!this.navigationHandler||(e.removeEventListener("navigate",this.navigationHandler),this.navigationSuccessHandler&&e.removeEventListener("navigatesuccess",this.navigationSuccessHandler),this.navigationHandler=null,this.navigationSuccessHandler=null,this.shouldReloadAfterErrorRedirect=!1,this.isObservingNavigation=!1)}startObservingFallbackPopState(){this.fallbackPopStateHandler||(this.fallbackPopStateHandler=()=>{if(!this.checkAccess(window.location.pathname)){_(),this.renderLockedOverlay();return}this.removeLockedOverlay(),L()},window.addEventListener("popstate",this.fallbackPopStateHandler))}stopObservingFallbackPopState(){this.fallbackPopStateHandler&&(window.removeEventListener("popstate",this.fallbackPopStateHandler),this.fallbackPopStateHandler=null)}renderLockedOverlay(){if(this.lockedOverlay)return;this.startObservingFallbackPopState();let e=j({message:this.accessDeniedMessage??v("ACCESS_DENIED"),actionLabel:v("BACK"),onAction:()=>history.back()});e.id="fa-access-denied",document.documentElement.appendChild(e),this.lockedOverlay=e}removeLockedOverlay(){this.lockedOverlay?.remove(),this.lockedOverlay=null}restoreHistory(){this.isMonkeyPatched&&(history.pushState=this.originalPushState,history.replaceState=this.originalReplaceState,this.isMonkeyPatched=!1)}start(){this.stop(),this.startObservingNavigation(),this.monkeyPatchHistory()}stop(){this.restoreHistory(),this.stopObservingNavigation(),this.stopObservingFallbackPopState(),this.removeLockedOverlay(),L()}};var at=N("fa-bookmarks",V(),{encode:R({obfuscate:!0}),decode:O({deobfuscate:!0,fallback:{},validator:Ye})}),it=y(!1);var st=N("fa-bearer-token",null,{encode:R({obfuscate:!0}),decode:O({deobfuscate:!0,fallback:null})});var lt=(t,e)=>{let r=g(e),o=t.data.user.get(),n=t.data.session.get(),a=t.data.project.get();if(!a)return!1;if(!Object.prototype.hasOwnProperty.call(a.pages,r))return!0;if(!o||!n)return!1;let u=a.pages[r];return u.length===0?!0:u.some(c=>o.tags.find(s=>s.id===c))};console.log("FramerAuth SDK (JavaScript): 2.2.0");var pr="/v2",mr=0,ct="https://frameauth.com/guides-v2/configuration-error",gr="https://app.frameauth.com",l=new J({data:{user:Xe,project:q,tags:Ve,bookmarks:at,session:tt,bearerToken:st},state:{initializing:ot,userLoading:et,projectLoading:Ne,tagsLoading:qe,bookmarksLoading:it,sessionLoading:rt}});window.FramerAuth=l;var M=ce(),ut=nt(M.boostPatterns),G=null,ue=!1,de=!1;function fe(t){return t?.status===404}function he(t){return t?.status===403}function Er(){return ue||de}function pe(){if(de)return;de=!0;let t=x(),e=B();l.data.project.set(null),l.state.projectLoading.set(!1),G?.stop(),G=null,_();let r=j({heading:v("SUSPENDED_HEADING",void 0,t),message:v("SUSPENDED_MESSAGE",void 0,t),actionLabel:v("SUSPENDED_ACTION",void 0,t),actionHref:gr,icon:"warning",theme:"warning",locale:t,dir:e});r.id="fa-project-suspended",document.documentElement.appendChild(r)}function me(){if(ue)return;ue=!0;let t=x(),e=B();if(l.data.project.set(null),l.state.projectLoading.set(!1),X()){console.warn(`FramerAuth: this domain is not linked to a FramerAuth project. The home page is shown signed-out; other pages show a warning. Fix: ${ct}`),G||re(),L();return}G?.stop(),G=null,_();let r=j({heading:v("NOT_CONFIGURED_HEADING",void 0,t),message:v("NOT_CONFIGURED_MESSAGE",void 0,t),actionLabel:v("NOT_CONFIGURED_ACTION",void 0,t),actionHref:ct,icon:"warning",theme:"warning",locale:t,dir:e});r.id="fa-project-not-configured",document.documentElement.appendChild(r)}function yr(){return F()?!0:l.data.project.get()!==null&&ut(window.location.pathname)}function te(t){let e=dt(t);if(!e)throw new Error("Unable to initialize FramerAuth: project tenantHost is missing");l.updateBaseURL(`https://${e}${pr}`),l.updateAuthMode(br(t))}function br(t){return t.sessionTransport==="bearer"}function dt(t){if(t.customDomain)return t.customDomain;let e=vr(t);return e?`${t.slug}.${e}`:null}function vr(t){return mr||t.tenantHost||null}function ge(){l.api.fetchBookmarks().then(({data:t})=>{l.data.bookmarks.set(t??{})})}function Sr(){return new ee({hasAccess:t=>lt(l,t),isPublicPath:t=>X(t)||ut(t),errorPath:M.errorPath,forceFallbackOverlay:M.router==="overlay",accessDeniedMessage:M.accessDeniedMessageOverride,onError:t=>{console.error("[Router] Error in router:",t)}})}function re(){let t=Sr();return t.checkAccess(window.location.pathname)?(t.start(),G=t,!0):(t.handleAccessDenied(),!1)}function Ar(){let t=l.data.project.get();return t&&dt(t)?(te(t),l.api.fetchProject().then(e=>{e.data?(l.data.project.set(e.data),te(e.data)):fe(e.error)?me():he(e.error)&&pe()}).catch(e=>{console.error("Failed to refresh FramerAuth project:",e)}),l.handleOTTFromURL().then(()=>Er()?null:l.auth.getSession()).then(e=>{e&&e.data!==null&&ge()}).catch(e=>{console.error("Failed to refresh FramerAuth session:",e)})):(l.state.projectLoading.set(!0),l.api.fetchProject().then(e=>{if(e.data)return l.data.project.set(e.data),te(e.data),l.state.projectLoading.set(!1),l.handleOTTFromURL().then(()=>l.auth.getSession());if(fe(e.error)){me();return}if(he(e.error)){pe();return}l.state.projectLoading.set(!1)}).then(e=>{e&&e.data!==null&&ge()}).catch(e=>{console.error("Failed to initialize FramerAuth in the background:",e),l.state.projectLoading.set(!1)})),re()}async function Nr(){_();let t=l.data.project.get(),e=await l.api.fetchProject();if(e.data)t=e.data,l.data.project.set(t);else{if(fe(e.error))return me(),!1;if(he(e.error))return pe(),!1;if(!t)throw new Error(e.error.message||"Unable to load FramerAuth project!")}te(t),await l.handleOTTFromURL(),(await l.auth.getSession()).data!==null&&ge();let o=re();return o&&L(),o}async function Rr(){l.state.initializing.set(!0);try{(yr()?Ar():await Nr())&&window.dispatchEvent(new CustomEvent("framerauth:initialized"))}catch(t){console.error("Failed to initialize FramerAuth:",t),X()||F(window.location.pathname,M.errorPath)?(re(),L()):window.location.replace(M.errorPath),window.dispatchEvent(new CustomEvent("framerauth:initialization-failed",{detail:{error:t}}))}finally{l.state.initializing.set(!1)}}Rr();})();
|
package/dist/framerauth.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var he=()=>typeof window<"u",ge=()=>window.location.host.endsWith("framercanvas.com"),w="FramerAuth snippet missing from start of <body>",v=()=>!he()||ge()||!window?.FramerAuth?null:window.FramerAuth;async function Ge(){let t=v();if(!t)return{data:null,error:{message:w}};try{return await t.auth.getSession()}catch(e){return{data:null,error:{message:e instanceof Error?e.message:"Unknown error"}}}}async function Qe(t){let e=v();if(!e)return{data:null,error:{message:w}};try{return await e.auth.signUp(t)}catch(r){return{data:null,error:{message:r instanceof Error?r.message:"Unknown error"}}}}async function Ye(t){let e=v();if(!e)return{data:null,error:{message:w}};try{return await e.auth.signIn(t)}catch(r){return{data:null,error:{message:r instanceof Error?r.message:"Unknown error"}}}}async function Xe(t){let e=v();if(!e)return{data:null,error:{message:w}};try{return await e.auth.signInOTP(t)}catch(r){return{data:null,error:{message:r instanceof Error?r.message:"Unknown error"}}}}async function Ze(t){let e=v();if(!e)return{data:null,error:{message:w}};try{return await e.auth.sendOTP(t)}catch(r){return{data:null,error:{message:r instanceof Error?r.message:"Unknown error"}}}}async function et(t){let e=v();if(!e)return{data:null,error:{message:w}};try{return await e.auth.signOut(t)}catch(r){return{data:null,error:{message:r instanceof Error?r.message:"Unknown error"}}}}async function tt(t){let e=v();if(!e)return{data:null,error:{message:w}};try{return await e.auth.updateProfile(t)}catch(r){return{data:null,error:{message:r instanceof Error?r.message:"Unknown error"}}}}async function rt(t){let e=v();if(!e)return{data:null,error:{message:w}};try{return await e.auth.updateProfilePicture(t)}catch(r){return{data:null,error:{message:r instanceof Error?r.message:"Unknown error"}}}}async function nt(t){let e=v();if(!e)return{data:null,error:{message:w}};try{return await e.auth.sendForgotPasswordEmail(t)}catch(r){return{data:null,error:{message:r instanceof Error?r.message:"Unknown error"}}}}async function at(t){let e=v();if(!e)return{data:null,error:{message:w}};try{return await e.auth.resetPassword(t)}catch(r){return{data:null,error:{message:r instanceof Error?r.message:"Unknown error"}}}}async function ot(t){let e=v();if(!e)return{data:null,error:{message:w}};try{return await e.auth.signInSocial(t)}catch(r){return{data:null,error:{message:r instanceof Error?r.message:"Unknown error"}}}}async function st(t){let e=v();if(!e)return{data:null,error:{message:w}};try{return await e.auth.storeCheckout(t)}catch(r){return{data:null,error:{message:r instanceof Error?r.message:"Unknown error"}}}}async function it(t){let e=v();if(!e)return{data:null,error:{message:w}};try{return await e.auth.storePortal(t)}catch(r){return{data:null,error:{message:r instanceof Error?r.message:"Unknown error"}}}}async function ut(t){let e=v();if(!e)return{data:null,error:{message:w}};try{return await e.auth.sendVerificationEmail(t)}catch(r){return{data:null,error:{message:r instanceof Error?r.message:"Unknown error"}}}}var ye=Object.defineProperty,we=Object.defineProperties,ve=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,Q=(t,e,r)=>e in t?ye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,O=(t,e)=>{for(var r in e||(e={}))ke.call(e,r)&&Q(t,r,e[r]);if(G)for(var r of G(e))Pe.call(e,r)&&Q(t,r,e[r]);return t},A=(t,e)=>we(t,ve(e)),be=class extends Error{constructor(t,e,r){super(e||t.toString(),{cause:r}),this.status=t,this.statusText=e,this.error=r}},Te=async(t,e)=>{var r,n,o,a,s,c;let i=e||{},u={onRequest:[e?.onRequest],onResponse:[e?.onResponse],onSuccess:[e?.onSuccess],onError:[e?.onError],onRetry:[e?.onRetry]};if(!e||!e?.plugins)return{url:t,options:i,hooks:u};for(let f of e?.plugins||[]){if(f.init){let l=await((r=f.init)==null?void 0:r.call(f,t.toString(),e));i=l.options||i,t=l.url}u.onRequest.push((n=f.hooks)==null?void 0:n.onRequest),u.onResponse.push((o=f.hooks)==null?void 0:o.onResponse),u.onSuccess.push((a=f.hooks)==null?void 0:a.onSuccess),u.onError.push((s=f.hooks)==null?void 0:s.onError),u.onRetry.push((c=f.hooks)==null?void 0:c.onRetry)}return{url:t,options:i,hooks:u}},Y=class{constructor(t){this.options=t}shouldAttemptRetry(t,e){return this.options.shouldRetry?Promise.resolve(t<this.options.attempts&&this.options.shouldRetry(e)):Promise.resolve(t<this.options.attempts)}getDelay(){return this.options.delay}},Se=class{constructor(t){this.options=t}shouldAttemptRetry(t,e){return this.options.shouldRetry?Promise.resolve(t<this.options.attempts&&this.options.shouldRetry(e)):Promise.resolve(t<this.options.attempts)}getDelay(t){return Math.min(this.options.maxDelay,this.options.baseDelay*2**t)}};function xe(t){if(typeof t=="number")return new Y({type:"linear",attempts:t,delay:1e3});switch(t.type){case"linear":return new Y(t);case"exponential":return new Se(t);default:throw new Error("Invalid retry strategy")}}var Oe=async t=>{let e={},r=async n=>typeof n=="function"?await n():n;if(t?.auth){if(t.auth.type==="Bearer"){let n=await r(t.auth.token);if(!n)return e;e.authorization=`Bearer ${n}`}else if(t.auth.type==="Basic"){let n=r(t.auth.username),o=r(t.auth.password);if(!n||!o)return e;e.authorization=`Basic ${btoa(`${n}:${o}`)}`}else if(t.auth.type==="Custom"){let n=r(t.auth.value);if(!n)return e;e.authorization=`${r(t.auth.prefix)} ${n}`}}return e},Ae=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Ee(t){let e=t.headers.get("content-type"),r=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!e)return"json";let n=e.split(";").shift()||"";return Ae.test(n)?"json":r.has(n)||n.startsWith("text/")?"text":"blob"}function Re(t){try{return JSON.parse(t),!0}catch{return!1}}function ee(t){if(t===void 0)return!1;let e=typeof t;return e==="string"||e==="number"||e==="boolean"||e===null?!0:e!=="object"?!1:Array.isArray(t)?!0:t.buffer?!1:t.constructor&&t.constructor.name==="Object"||typeof t.toJSON=="function"}function X(t){try{return JSON.parse(t)}catch{return t}}function Z(t){return typeof t=="function"}function _e(t){if(t?.customFetchImpl)return t.customFetchImpl;if(typeof globalThis<"u"&&Z(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&Z(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function Ue(t){let e=new Headers(t?.headers),r=await Oe(t);for(let[n,o]of Object.entries(r||{}))e.set(n,o);if(!e.has("content-type")){let n=Fe(t?.body);n&&e.set("content-type",n)}return e}function Fe(t){return ee(t)?"application/json":null}function je(t){if(!t?.body)return null;let e=new Headers(t?.headers);if(ee(t.body)&&!e.has("content-type")){for(let[r,n]of Object.entries(t?.body))n instanceof Date&&(t.body[r]=n.toISOString());return JSON.stringify(t.body)}return t.body}function Le(t,e){var r;if(e?.method)return e.method.toUpperCase();if(t.startsWith("@")){let n=(r=t.split("@")[1])==null?void 0:r.split("/")[0];return re.includes(n)?n.toUpperCase():e?.body?"POST":"GET"}return e?.body?"POST":"GET"}function Ce(t,e){let r;return!t?.signal&&t?.timeout&&(r=setTimeout(()=>e?.abort(),t?.timeout)),{abortTimeout:r,clearTimeout:()=>{r&&clearTimeout(r)}}}var Ie=class te extends Error{constructor(e,r){super(r||JSON.stringify(e,null,2)),this.issues=e,Object.setPrototypeOf(this,te.prototype)}};async function Be(t,e){let r=await t["~standard"].validate(e);if(r.issues)throw new Ie(r.issues);return r.value}var re=["get","post","put","patch","delete"];function $e(t,e){let{baseURL:r,params:n,query:o}=e||{query:{},params:{},baseURL:""},a=t.startsWith("http")?t.split("/").slice(0,3).join("/"):r||"";if(t.startsWith("@")){let l=t.toString().split("@")[1].split("/")[0];re.includes(l)&&(t=t.replace(`@${l}/`,"/"))}a.endsWith("/")||(a+="/");let[s,c]=t.replace(a,"").split("?"),i=new URLSearchParams(c);for(let[l,m]of Object.entries(o||{}))m!=null&&i.set(l,String(m));if(n)if(Array.isArray(n)){let l=s.split("/").filter(m=>m.startsWith(":"));for(let[m,x]of l.entries()){let y=n[m];s=s.replace(x,y)}}else for(let[l,m]of Object.entries(n))s=s.replace(`:${l}`,String(m));s=s.split("/").map(encodeURIComponent).join("/"),s.startsWith("/")&&(s=s.slice(1));let u=i.toString();return u=u.length>0?`?${u}`.replace(/\+/g,"%20"):"",a.startsWith("http")?new URL(`${s}${u}`,a):`${a}${s}${u}`}var M=async(t,e)=>{var r,n,o,a,s,c,i,u;let{hooks:f,url:l,options:m}=await Te(t,e),x=_e(m),y=new AbortController,U=(r=m.signal)!=null?r:y.signal,B=$e(l,m),ue=je(m),le=await Ue(m),ce=Le(l,m),p=A(O({},m),{url:B,headers:le,body:ue,method:ce,signal:U});for(let P of f.onRequest)if(P){let h=await P(p);h instanceof Object&&(p=h)}("pipeTo"in p&&typeof p.pipeTo=="function"||typeof((n=e?.body)==null?void 0:n.pipe)=="function")&&("duplex"in p||(p.duplex="half"));let{clearTimeout:fe}=Ce(m,y),d=await x(p.url,p);fe();let J={response:d,request:p};for(let P of f.onResponse)if(P){let h=await P(A(O({},J),{response:(o=e?.hookOptions)!=null&&o.cloneResponse?d.clone():d}));h instanceof Response?d=h:h instanceof Object&&(d=h.response)}if(d.ok){if(!(p.method!=="HEAD"))return{data:"",error:null};let h=Ee(d),b={data:"",response:d,request:p};if(h==="json"||h==="text"){let T=await d.text(),pe=await((a=p.jsonParser)!=null?a:X)(T);b.data=pe}else b.data=await d[h]();p?.output&&p.output&&!p.disableValidation&&(b.data=await Be(p.output,b.data));for(let T of f.onSuccess)T&&await T(A(O({},b),{response:(s=e?.hookOptions)!=null&&s.cloneResponse?d.clone():d}));return e?.throw?b.data:{data:b.data,error:null}}let de=(c=e?.jsonParser)!=null?c:X,F=await d.text(),K=Re(F),$=K?await de(F):null,me={response:d,responseText:F,request:p,error:A(O({},$),{status:d.status,statusText:d.statusText})};for(let P of f.onError)P&&await P(A(O({},me),{response:(i=e?.hookOptions)!=null&&i.cloneResponse?d.clone():d}));if(e?.retry){let P=xe(e.retry),h=(u=e.retryAttempt)!=null?u:0;if(await P.shouldAttemptRetry(h,d)){for(let T of f.onRetry)T&&await T(J);let b=P.getDelay(h);return await new Promise(T=>setTimeout(T,b)),await M(t,A(O({},e),{retryAttempt:h+1}))}}if(e?.throw)throw new be(d.status,d.statusText,K?$:F);return{data:null,error:A(O({},$),{status:d.status,statusText:d.statusText})}};function q(t,e,r){let n=new Set(e).add(void 0);return t.listen((o,a,s)=>{n.has(s)&&r(o,a,s)})}import{useCallback as Me,useRef as qe,useSyncExternalStore as He}from"react";var H=(t,e)=>r=>{t.current!==r&&(t.current=r,e())};function S(t,{keys:e,deps:r=[t,e]}={}){let n=qe();n.current=t.get();let o=Me(s=>(H(n,s)(t.value),e?.length>0?q(t,e,H(n,s)):t.listen(H(n,s))),r),a=()=>n.current;return He(o,a,a)}import{useState as ne}from"react";var Ne="https://core.framerauth.com/v2",R=()=>typeof window<"u",j=()=>window.location.host.endsWith("framercanvas.com"),We=()=>{let t=Object.keys(window.parent);for(let e=t.length-1;e>=0;e--)try{let r=new URLSearchParams(window.parent[t[e]].location.search).get("siteId");if(r)return r}catch{}},Ve=async()=>{let t=We()||"";return await M(`${Ne}/public/project/config`,{headers:{"x-framer-project-id":t}})};function St(){if(!R()||j()||!window?.FramerAuth)return{initializing:!0,setInitializing:()=>{}};let t=window.FramerAuth;return{initializing:S(t.state.initializing)}}function E(){if(!R()||j()||!window?.FramerAuth)return{session:null,loading:!1,setSession:()=>{},setLoading:()=>{}};let t=window.FramerAuth,e=S(t.data.session),r=S(t.state.sessionLoading);return{session:e,loading:r,setSession:a=>t.data.session.set(a),setLoading:a=>t.state.sessionLoading.set(a)}}function L(){if(!R()||j()||!window?.FramerAuth)return{user:null,loading:!1,setUser:()=>{},setLoading:()=>{}};let t=window.FramerAuth,e=S(t.data.user),r=S(t.state.userLoading),n=a=>t.data.user.set(a),o=a=>t.state.userLoading.set(a);return e&&!Object.prototype.hasOwnProperty.call(e,"tags")&&(e.tags=[]),{user:e,loading:r,setUser:n,setLoading:o}}function xt(){let[t,e]=ne(null),[r,n]=ne(!1);if(!R())return{project:null,loading:!1,setProject:()=>{},setLoading:()=>{},fetchProject:async()=>({data:null,error:{message:"Browser not available"}})};if(!window?.FramerAuth){let l=y=>e(y),m=y=>n(y);return{project:t,loading:r,setProject:l,setLoading:m,fetchProject:async()=>{m(!0);let y=await Ve();return y.data&&l(y.data),m(!1),y}}}let a=window.FramerAuth,s=S(a.data.project),c=S(a.state.projectLoading),i=l=>a.data.project.set(l),u=l=>a.state.projectLoading.set(l);return{project:s,loading:c,setProject:i,setLoading:u,fetchProject:async()=>{u(!0);let l=await a.api.fetchProject();return l.data&&i(l.data),u(!1),l}}}function C(t){if(!R()||j()||!window?.FramerAuth)return{bookmarks:null,loading:!1,createBookmark:a=>{},deleteBookmark:a=>{},setLoading:()=>{}};let e=window.FramerAuth;return{bookmarks:S(e.data.bookmarks,{keys:t}),createBookmark:a=>{let c={...e.data.bookmarks.get(),[a]:!0};e.data.bookmarks.set(c)},deleteBookmark:a=>{let c={...e.data.bookmarks.get()};delete c[a],e.data.bookmarks.set(c)}}}import{useEffect as V,useMemo as k,useRef as D}from"react";import{useRouter as De,RenderTarget as oe,inferInitialRouteFromPath as ze}from"framer";function ae(t){return t.toLowerCase()}function N(t,e="any"){return t==="all"||t==="any"?t:e}function _(t){return t!==null}function I(t,e,r="all"){if(!_(t))return!1;if(e.length===0)return t.tags.length>0;let n=t.tags.map(a=>ae(a.name)),o=e.map(ae);return r==="any"?o.some(a=>n.includes(a)):o.every(a=>n.includes(a))}import{jsx as g}from"react/jsx-runtime";typeof window<"u"&&window.FramerAuth&&console.log("FramerAuth SDK (React): 2.1.12");function se(t){let e=t;return typeof e?.displayName=="string"&&e.displayName.length>0&&typeof e?.defaultProps=="object"&&e.defaultProps!==null}function ie(t,e){return e?t.parentElement:t}function W(t){let e;if(typeof t=="string")e=t.split(",");else if(Array.isArray(t))e=t.filter(n=>typeof n=="string");else return null;let r=e.map(n=>n.trim()).filter(Boolean);return r.length>0?r:null}function z(t,e){return e!==void 0?typeof e=="string"||Array.isArray(e)||e===null?{tags:W(e),operator:"any"}:{tags:W(e.tags),operator:N(e.require)}:{tags:W(t?.tags),operator:N(t?.require)}}function Lt(t){return e=>{let{session:r}=E();return r?g(t,{...e}):null}}function Ct(t){return e=>{let{session:r}=E();return r?null:g(t,{...e})}}function It(t){return e=>{let{session:r}=E(),n=r?null:e?.variant;return g(t,{...e,variant:n})}}function Bt(t,e){let r=se(t);return n=>{let{user:o}=L(),a=D(null),{tags:s,operator:c}=k(()=>z(n,e),[n?.tags,n?.require,e]),i=k(()=>_(o)?s?I(o,s,c):o.tags.length>0:!1,[o,s,c]);return V(()=>{if(a.current){let f=ie(a.current,r);if(!f)return;i?f.style.display="":f.style.display="none"}},[a.current,i]),k(()=>i!==!0?g("div",{ref:a}):g(t,{ref:a,...n}),[n,i,void 0])}}function $t(t,e){let r=se(t);return n=>{let{user:o}=L(),a=D(null),{tags:s,operator:c}=k(()=>z(n,e),[n?.tags,n?.require,e]),i=k(()=>_(o)?s?I(o,s,c):o.tags.length>0:!1,[o,s,c]);return V(()=>{if(a.current){let f=ie(a.current,r);if(!f)return;i?f.style.display="none":f.style.display=""}},[a.current,i]),k(()=>i===!0?g("div",{ref:a}):g(t,{ref:a,...n}),[n,i,void 0])}}function Mt(t,e){return r=>{let{user:n}=L(),o=r?.variant,{tags:a,operator:s}=z(r,e);if(!a){let u=null;return(!_(n)||n.tags.length===0)&&(u=o),g(t,{...r,variant:u})}let i=I(n,a,s)?null:o;return g(t,{...r,variant:i})}}function qt(t,e="saved-for-later"){return r=>{let{bookmarks:n}=C(),a=k(()=>n?Object.keys(n).some(c=>c.startsWith(`${e}:`)):!1,[n])?null:"Empty State";return g(t,{...r,variant:a})}}function Ht(t,e="saved-for-later"){return r=>{let{bookmarks:n}=C(),o=D(null),a=k(()=>`${e}:${r?.slug}`,[r]),s=k(()=>Je()?!0:n?a in n:!1,[n?.[a],a]);return V(()=>{if(o.current){let i=o.current.parentElement;if(!i)return;s?i.style.display="":i.style.display="none"}},[o.current,s]),k(()=>s?g(t,{ref:o,...r}):g("div",{ref:o}),[r,s,void 0])}}function Nt(t,e="saved-for-later"){return r=>{let n=De(),{session:o}=E(),{bookmarks:a,createBookmark:s,deleteBookmark:c}=C([`${e}:${r?.slug}`]),i=k(()=>`${e}:${r?.slug}`,[r]),u=k(()=>a?i in a:!1,[a?.[i],i]),f=async m=>{try{if(u)c(i),window?.FramerAuth.auth.deleteBookmark({id:r?.slug,bookmark_type:e});else if(s(i),window?.FramerAuth.auth.createBookmark({id:r?.slug,bookmark_type:e}),r?.link){let[x,y]=r.link.split("#"),{routeId:U,pathVariables:B}=ze(n.routes,x);U&&n.navigate(U,y,B)}}catch(x){console.error(x)}},l=k(()=>u?r?.variant:void 0,[u,r?.variant]);return o?g(t,{...r,variant:l,onClick:f}):null}}function Wt(t){return e=>g(t,{...e,onClick:async n=>{window?.FramerAuth.auth.signInSocial({provider:"github",callbackURL:window.location.origin+"/account"})}})}function Vt(t,e){return r=>{let{session:n}=E();return n?g(t,{...r,onClick:async a=>{window?.FramerAuth.auth.signOut({redirectTo:e.redirectTo})}}):null}}function Je(){return oe.current()===oe.canvas}export{Wt as buttonSignInSocial,Vt as buttonSignOut,Ge as getSession,Je as isCanvas,at as resetPassword,nt as sendForgotPasswordEmail,Ze as sendOTP,ut as sendVerificationEmail,Lt as showIfSignedIn,Ct as showIfSignedOut,Bt as showIfWithTag,$t as showIfWithoutTag,Ye as signIn,Xe as signInOTP,ot as signInSocial,et as signOut,Qe as signUp,st as storeCheckout,it as storePortal,It as toggleVariant,Mt as toggleVariantIfWithTag,tt as updateProfile,rt as updateProfilePicture,C as useBookmarks,St as useIsInitializing,xt as useProject,E as useSession,L as useUser,qt as withBookmarks,Ht as withIsBookmarked,Nt as withToggleBookmark};
|
|
1
|
+
var S=[],L=0,G=4,Tt=0,C=e=>{let t=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},lc:0,listen(n){return r.lc=t.push(n),()=>{for(let o=L+G;o<S.length;)S[o]===n?S.splice(o,G):o+=G;let a=t.indexOf(n);~a&&(t.splice(a,1),--r.lc||r.off())}},notify(n,a){Tt++;let o=!S.length;for(let i of t)S.push(i,r.value,n,a);if(o){for(L=0;L<S.length;L+=G)S[L](S[L+1],S[L+2],S[L+3]);S.length=0}},off(){},set(n){let a=r.value;a!==n&&(r.value=n,r.notify(a))},subscribe(n){let a=r.listen(n);return n(r.value),a},value:e};return r};var Ot=5,B=6,K=10,Rt=(e,t,r,n)=>(e.events=e.events||{},e.events[r+K]||(e.events[r+K]=n(a=>{e.events[r].reduceRight((o,i)=>(i(o),o),{shared:{},...a})})),e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let a=e.events[r],o=a.indexOf(t);a.splice(o,1),a.length||(delete e.events[r],e.events[r+K](),delete e.events[r+K])});var pe=1e3,X=(e,t)=>Rt(e,n=>{let a=t(n);a&&e.events[B].push(a)},Ot,n=>{let a=e.listen;e.listen=(...i)=>(!e.lc&&!e.active&&(e.active=!0,n()),a(...i));let o=e.off;return e.events[B]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let i of e.events[B])i();e.events[B]=[]}},pe)},()=>{e.listen=a,e.off=o}});function ee(e,t,r){let n=new Set(t).add(void 0);return e.listen((a,o,i)=>{n.has(i)&&r(a,o,i)})}var _e=e=>e,F={},te={addEventListener(){},removeEventListener(){}};function St(){try{return typeof localStorage<"u"}catch{return!1}}St()&&(F=localStorage);var gt={addEventListener(e,t,r){window.addEventListener("storage",t),window.addEventListener("pageshow",r)},removeEventListener(e,t,r){window.removeEventListener("storage",t),window.removeEventListener("pageshow",r)}};typeof window<"u"&&(te=gt);function Ne(e,t=void 0,r={}){let n=r.encode||_e,a=r.decode||_e,o=C(t),i=o.set;o.set=l=>{let c=n(l);typeof c>"u"?delete F[e]:F[e]=c,i(l)};function u(l){l.key===e?l.newValue===null?i(t):i(a(l.newValue)):F[e]||i(t)}function s(){o.set(F[e]?a(F[e]):t)}return X(o,()=>{if(s(),r.listen!==!1)return te.addEventListener(e,u,s),()=>{te.removeEventListener(e,u,s)}}),o}var ht="framerauth_v2_",Te=new TextEncoder,Dt=new TextDecoder;function Oe(){let e=typeof window<"u"?window.location.hostname:"1f8cXd6c7b4a3vL4z5746oUgQ28190adbef";return Te.encode(ht+e)}function yt(e){let t=Oe(),r=Te.encode(e),n=new Uint8Array(r.length);for(let a=0;a<r.length;a++)n[a]=r[a]^t[a%t.length];return n}function Lt(e){let t=yt(e),r=Array.from(t,n=>String.fromCharCode(n)).join("");return btoa(r)}function Ct(e){let t=Oe(),r=atob(e),n=Uint8Array.from(r,o=>o.charCodeAt(0)),a=new Uint8Array(n.length);for(let o=0;o<n.length;o++)a[o]=n[o]^t[o%t.length];return Dt.decode(a)}function Re({obfuscate:e}){return t=>{let r=JSON.stringify(t);return e&&(r=Lt(r)),r}}function Se({deobfuscate:e,fallback:t,validator:r}){return n=>{try{if(!n)return t;e&&(n=Ct(n));let a=JSON.parse(n);if(r){let o=r(a);return o===null?t:o}return a}catch{return t}}}var ge=Ne("fa-project",null,{encode:Re({obfuscate:!0}),decode:Se({deobfuscate:!0,fallback:null})}),Mr=C(!1);var M={ACCESS_DENIED:"This page is restricted.",BACK:"Back",NOT_CONFIGURED_HEADING:"FrameAuth can’t verify this domain",NOT_CONFIGURED_MESSAGE:"This site has FrameAuth installed which handles sign-up, sign-in, user accounts, and member-only content. Access stays locked until this domain is verified.",NOT_CONFIGURED_ACTION:"Fix this",SUSPENDED_HEADING:"FrameAuth - Action required",SUSPENDED_MESSAGE:"If you are the site owner, please log in to the FrameAuth dashboard to reactivate your project.",SUSPENDED_ACTION:"Open FrameAuth dashboard",SNIPPET_MISSING:"FramerAuth snippet missing from start of <body>",UNKNOWN_ERROR:"Unknown error",CLIENT_NOT_INITIALIZED:"Auth client not initialized",IMAGE_REQUIRED:"No image was provided",BROWSER_UNAVAILABLE:"Browser not available"};var he={ACCESS_DENIED:"此页面的访问受限。",BACK:"返回",NOT_CONFIGURED_HEADING:"FrameAuth 无法验证此域名",NOT_CONFIGURED_MESSAGE:"此网站使用 FrameAuth 管理注册、登录、用户账户和会员专属内容。在此域名通过验证之前,访问将保持锁定。",NOT_CONFIGURED_ACTION:"修复",SUSPENDED_HEADING:"FrameAuth - 需要采取操作",SUSPENDED_MESSAGE:"如果您是网站所有者,请登录 FrameAuth 控制台以重新激活您的项目。",SUSPENDED_ACTION:"打开 FrameAuth 控制台",SNIPPET_MISSING:"<body> 开头缺少 FramerAuth 代码片段",UNKNOWN_ERROR:"未知错误",CLIENT_NOT_INITIALIZED:"身份验证客户端尚未初始化",IMAGE_REQUIRED:"未提供图片",BROWSER_UNAVAILABLE:"浏览器不可用"};var De={ACCESS_DENIED:"El acceso a esta página está restringido.",BACK:"Volver",NOT_CONFIGURED_HEADING:"FrameAuth no puede verificar este dominio",NOT_CONFIGURED_MESSAGE:"Este sitio utiliza FrameAuth para gestionar el registro, el inicio de sesión, las cuentas de usuario y el contenido exclusivo para miembros. El acceso seguirá bloqueado hasta que se verifique este dominio.",NOT_CONFIGURED_ACTION:"Solucionar",SUSPENDED_HEADING:"FrameAuth - Se requiere una acción",SUSPENDED_MESSAGE:"Si eres el propietario del sitio, inicia sesión en el panel de FrameAuth para reactivar tu proyecto.",SUSPENDED_ACTION:"Abrir el panel de FrameAuth",SNIPPET_MISSING:"Falta el fragmento de FramerAuth al inicio de <body>",UNKNOWN_ERROR:"Error desconocido",CLIENT_NOT_INITIALIZED:"El cliente de autenticación no está inicializado",IMAGE_REQUIRED:"No se proporcionó ninguna imagen",BROWSER_UNAVAILABLE:"Navegador no disponible"};var ye={ACCESS_DENIED:"L’accès à cette page est restreint.",BACK:"Retour",NOT_CONFIGURED_HEADING:"FrameAuth ne peut pas vérifier ce domaine",NOT_CONFIGURED_MESSAGE:"Ce site utilise FrameAuth pour gérer les inscriptions, les connexions, les comptes utilisateurs et le contenu réservé aux membres. L’accès reste verrouillé tant que ce domaine n’est pas vérifié.",NOT_CONFIGURED_ACTION:"Corriger",SUSPENDED_HEADING:"FrameAuth - Action requise",SUSPENDED_MESSAGE:"Si vous êtes le propriétaire du site, connectez-vous au tableau de bord FrameAuth pour réactiver votre projet.",SUSPENDED_ACTION:"Ouvrir le tableau de bord FrameAuth",SNIPPET_MISSING:"L’extrait FramerAuth est absent du début de <body>",UNKNOWN_ERROR:"Erreur inconnue",CLIENT_NOT_INITIALIZED:"Le client d’authentification n’est pas initialisé",IMAGE_REQUIRED:"Aucune image fournie",BROWSER_UNAVAILABLE:"Navigateur indisponible"};var Le={ACCESS_DENIED:"الوصول إلى هذه الصفحة مقيّد.",BACK:"رجوع",NOT_CONFIGURED_HEADING:"يتعذر على FrameAuth التحقق من هذا النطاق",NOT_CONFIGURED_MESSAGE:"يستخدم هذا الموقع FrameAuth لإدارة التسجيل وتسجيل الدخول وحسابات المستخدمين والمحتوى الخاص بالأعضاء. سيبقى الوصول مقفلاً حتى يتم التحقق من هذا النطاق.",NOT_CONFIGURED_ACTION:"إصلاح المشكلة",SUSPENDED_HEADING:"FrameAuth - يلزم اتخاذ إجراء",SUSPENDED_MESSAGE:"إذا كنت مالك الموقع، فيرجى تسجيل الدخول إلى لوحة تحكم FrameAuth لإعادة تفعيل مشروعك.",SUSPENDED_ACTION:"فتح لوحة تحكم FrameAuth",SNIPPET_MISSING:"مقطع FramerAuth غير موجود في بداية <body>",UNKNOWN_ERROR:"خطأ غير معروف",CLIENT_NOT_INITIALIZED:"لم تتم تهيئة عميل المصادقة",IMAGE_REQUIRED:"لم يتم تقديم صورة",BROWSER_UNAVAILABLE:"المتصفح غير متاح"};var Ce={ACCESS_DENIED:"O acesso a esta página é restrito.",BACK:"Voltar",NOT_CONFIGURED_HEADING:"O FrameAuth não consegue verificar este domínio",NOT_CONFIGURED_MESSAGE:"Este site usa o FrameAuth para gerenciar cadastros, logins, contas de usuário e conteúdo exclusivo para membros. O acesso permanece bloqueado até que este domínio seja verificado.",NOT_CONFIGURED_ACTION:"Corrigir",SUSPENDED_HEADING:"FrameAuth - Ação necessária",SUSPENDED_MESSAGE:"Se você é o proprietário do site, entre no painel do FrameAuth para reativar seu projeto.",SUSPENDED_ACTION:"Abrir o painel do FrameAuth",SNIPPET_MISSING:"O trecho de código do FramerAuth não está no início de <body>",UNKNOWN_ERROR:"Erro desconhecido",CLIENT_NOT_INITIALIZED:"O cliente de autenticação não foi inicializado",IMAGE_REQUIRED:"Nenhuma imagem foi fornecida",BROWSER_UNAVAILABLE:"Navegador indisponível"};var Pe={ACCESS_DENIED:"Доступ к этой странице ограничен.",BACK:"Назад",NOT_CONFIGURED_HEADING:"FrameAuth не может подтвердить этот домен",NOT_CONFIGURED_MESSAGE:"Этот сайт использует FrameAuth для регистрации, входа, управления учетными записями и контентом только для участников. Доступ останется заблокированным, пока этот домен не будет подтвержден.",NOT_CONFIGURED_ACTION:"Исправить",SUSPENDED_HEADING:"FrameAuth - Требуется действие",SUSPENDED_MESSAGE:"Если вы владелец сайта, войдите в панель FrameAuth, чтобы снова активировать проект.",SUSPENDED_ACTION:"Открыть панель FrameAuth",SNIPPET_MISSING:"В начале <body> отсутствует фрагмент кода FramerAuth",UNKNOWN_ERROR:"Неизвестная ошибка",CLIENT_NOT_INITIALIZED:"Клиент аутентификации не инициализирован",IMAGE_REQUIRED:"Изображение не предоставлено",BROWSER_UNAVAILABLE:"Браузер недоступен"};var Ue={ACCESS_DENIED:"Der Zugriff auf diese Seite ist eingeschränkt.",BACK:"Zurück",NOT_CONFIGURED_HEADING:"FrameAuth kann diese Domain nicht verifizieren",NOT_CONFIGURED_MESSAGE:"Diese Website verwendet FrameAuth für Registrierung, Anmeldung, Benutzerkonten und Inhalte nur für Mitglieder. Der Zugriff bleibt gesperrt, bis diese Domain verifiziert wurde.",NOT_CONFIGURED_ACTION:"Beheben",SUSPENDED_HEADING:"FrameAuth - Aktion erforderlich",SUSPENDED_MESSAGE:"Wenn Sie der Websitebetreiber sind, melden Sie sich bitte im FrameAuth-Dashboard an, um Ihr Projekt wieder zu aktivieren.",SUSPENDED_ACTION:"FrameAuth-Dashboard öffnen",SNIPPET_MISSING:"Das FramerAuth-Snippet fehlt am Anfang von <body>",UNKNOWN_ERROR:"Unbekannter Fehler",CLIENT_NOT_INITIALIZED:"Der Authentifizierungsclient wurde nicht initialisiert",IMAGE_REQUIRED:"Es wurde kein Bild bereitgestellt",BROWSER_UNAVAILABLE:"Browser nicht verfügbar"};var ve={ACCESS_DENIED:"このページへのアクセスは制限されています。",BACK:"戻る",NOT_CONFIGURED_HEADING:"FrameAuth はこのドメインを確認できません",NOT_CONFIGURED_MESSAGE:"このサイトでは FrameAuth を使用して、登録、サインイン、ユーザーアカウント、会員限定コンテンツを管理しています。このドメインの確認が完了するまで、アクセスはロックされます。",NOT_CONFIGURED_ACTION:"修正する",SUSPENDED_HEADING:"FrameAuth - 対応が必要です",SUSPENDED_MESSAGE:"サイトの所有者の方は、FrameAuth ダッシュボードにログインしてプロジェクトを再有効化してください。",SUSPENDED_ACTION:"FrameAuth ダッシュボードを開く",SNIPPET_MISSING:"<body> の先頭に FramerAuth のスニペットがありません",UNKNOWN_ERROR:"不明なエラー",CLIENT_NOT_INITIALIZED:"認証クライアントが初期化されていません",IMAGE_REQUIRED:"画像が指定されていません",BROWSER_UNAVAILABLE:"ブラウザーを利用できません"};var Fe={ACCESS_DENIED:"इस पेज का ऐक्सेस प्रतिबंधित है।",BACK:"वापस",NOT_CONFIGURED_HEADING:"FrameAuth इस डोमेन को सत्यापित नहीं कर सकता",NOT_CONFIGURED_MESSAGE:"यह साइट साइन अप, साइन इन, उपयोगकर्ता खातों और केवल सदस्यों के लिए उपलब्ध सामग्री को प्रबंधित करने के लिए FrameAuth का उपयोग करती है। इस डोमेन के सत्यापित होने तक ऐक्सेस बंद रहेगा।",NOT_CONFIGURED_ACTION:"इसे ठीक करें",SUSPENDED_HEADING:"FrameAuth - कार्रवाई आवश्यक है",SUSPENDED_MESSAGE:"यदि आप साइट के मालिक हैं, तो कृपया अपना प्रोजेक्ट फिर से सक्रिय करने के लिए FrameAuth डैशबोर्ड में लॉग इन करें।",SUSPENDED_ACTION:"FrameAuth डैशबोर्ड खोलें",SNIPPET_MISSING:"<body> की शुरुआत में FramerAuth स्निपेट नहीं है",UNKNOWN_ERROR:"अज्ञात त्रुटि",CLIENT_NOT_INITIALIZED:"ऑथेंटिकेशन क्लाइंट प्रारंभ नहीं हुआ है",IMAGE_REQUIRED:"कोई चित्र प्रदान नहीं किया गया",BROWSER_UNAVAILABLE:"ब्राउज़र उपलब्ध नहीं है"};var Me={ACCESS_DENIED:"Ez az oldal korlátozott hozzáférésű.",BACK:"Vissza",NOT_CONFIGURED_HEADING:"A FrameAuth nem tudja ellenőrizni ezt a domaint",NOT_CONFIGURED_MESSAGE:"Ezen az oldalon a FrameAuth kezeli a regisztrációt, a bejelentkezést, a felhasználói fiókokat és a csak tagoknak szóló tartalmakat. A hozzáférés zárolva marad, amíg a domain ellenőrzése meg nem történik.",NOT_CONFIGURED_ACTION:"Javítás",SUSPENDED_HEADING:"FrameAuth – Teendő szükséges",SUSPENDED_MESSAGE:"Ha te vagy az oldal tulajdonosa, jelentkezz be a FrameAuth irányítópultra a projekt újraaktiválásához.",SUSPENDED_ACTION:"FrameAuth irányítópult megnyitása",SNIPPET_MISSING:"A FramerAuth-kódrészlet hiányzik a <body> elejéről",UNKNOWN_ERROR:"Ismeretlen hiba",CLIENT_NOT_INITIALIZED:"A hitelesítési kliens nincs inicializálva",IMAGE_REQUIRED:"Nem adtál meg képet",BROWSER_UNAVAILABLE:"A böngésző nem érhető el"};var H={en:M,zh:he,es:De,fr:ye,ar:Le,pt:Ce,ru:Pe,de:Ue,ja:ve,hi:Fe,hu:Me};var re=["en","zh","es","fr","ar","pt","ru","de","ja","hi","hu"];function ne(e){return typeof e=="string"&&re.some(t=>t===e)}function xe(e){return e.trim().toLowerCase().split(/[-_]/)[0]}function be(e){return typeof e=="string"&&ne(xe(e))}function P(e){if(typeof e!="string")return"en";let t=xe(e);return ne(t)?t:"en"}function j(){return typeof window<"u"&&window.FramerAuth?.data?.project?window.FramerAuth.data.project:ge}function oe(){return P(j().get()?.locale)}function ae(e){return e?.locale!==void 0&&!be(e.locale)?"ltr":e?.dir==="ltr"||e?.dir==="rtl"?e.dir:P(e?.locale)==="ar"?"rtl":"ltr"}function ke(){return ae(j().get())}function ie(e,t,r,n,a){let o=a===void 0?oe():P(a);return(e[o][r]??t[r]).replace(/\{(\w+)\}/g,(u,s)=>!n||!Object.prototype.hasOwnProperty.call(n,s)?u:String(n[s]))}function we(e,t,r){return ie(H,M,e,t,r)}var Pt=["SNIPPET_MISSING","UNKNOWN_ERROR","CLIENT_NOT_INITIALIZED","IMAGE_REQUIRED","BROWSER_UNAVAILABLE"];function Ut(e){return Pt.includes(e)}function A(e){let t=we(e);return{code:e,message:t,status:0,statusText:t}}function p(e){return typeof e=="object"&&e!==null&&"code"in e&&Ut(e.code)?A(e.code):e instanceof Error&&e.message?{message:e.message,status:0,statusText:e.message}:A("UNKNOWN_ERROR")}var vt=()=>typeof window<"u",Ft=()=>window.location.host.endsWith("framercanvas.com"),T=()=>!vt()||Ft()||!window?.FramerAuth?null:window.FramerAuth;async function In(){let e=T();if(!e)return{data:null,error:A("SNIPPET_MISSING")};try{return await e.auth.getSession()}catch(t){return{data:null,error:p(t)}}}async function fn(e){let t=T();if(!t)return{data:null,error:A("SNIPPET_MISSING")};try{return await t.auth.signUp(e)}catch(r){return{data:null,error:p(r)}}}async function pn(e){let t=T();if(!t)return{data:null,error:A("SNIPPET_MISSING")};try{return await t.auth.signIn(e)}catch(r){return{data:null,error:p(r)}}}async function _n(e){let t=T();if(!t)return{data:null,error:A("SNIPPET_MISSING")};try{return await t.auth.signInOTP(e)}catch(r){return{data:null,error:p(r)}}}async function Nn(e){let t=T();if(!t)return{data:null,error:A("SNIPPET_MISSING")};try{return await t.auth.sendOTP(e)}catch(r){return{data:null,error:p(r)}}}async function Tn(e){let t=T();if(!t)return{data:null,error:A("SNIPPET_MISSING")};try{return await t.auth.signOut(e)}catch(r){return{data:null,error:p(r)}}}async function On(e){let t=T();if(!t)return{data:null,error:A("SNIPPET_MISSING")};try{return await t.auth.updateProfile(e)}catch(r){return{data:null,error:p(r)}}}async function Rn(e){let t=T();if(!t)return{data:null,error:A("SNIPPET_MISSING")};try{return await t.auth.updateProfilePicture(e)}catch(r){return{data:null,error:p(r)}}}async function Sn(e){let t=T();if(!t)return{data:null,error:A("SNIPPET_MISSING")};try{return await t.auth.sendForgotPasswordEmail(e)}catch(r){return{data:null,error:p(r)}}}async function gn(e){let t=T();if(!t)return{data:null,error:A("SNIPPET_MISSING")};try{return await t.auth.resetPassword(e)}catch(r){return{data:null,error:p(r)}}}async function hn(e){let t=T();if(!t)return{data:null,error:A("SNIPPET_MISSING")};try{return await t.auth.signInSocial(e)}catch(r){return{data:null,error:p(r)}}}async function Dn(e){let t=T();if(!t)return{data:null,error:A("SNIPPET_MISSING")};try{return await t.auth.storeCheckout(e)}catch(r){return{data:null,error:p(r)}}}async function yn(e){let t=T();if(!t)return{data:null,error:A("SNIPPET_MISSING")};try{return await t.auth.storePortal(e)}catch(r){return{data:null,error:p(r)}}}async function Ln(e){let t=T();if(!t)return{data:null,error:A("SNIPPET_MISSING")};try{return await t.auth.sendVerificationEmail(e)}catch(r){return{data:null,error:p(r)}}}var Mt=Object.defineProperty,xt=Object.defineProperties,bt=Object.getOwnPropertyDescriptors,Ve=Object.getOwnPropertySymbols,kt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable,Ge=(e,t,r)=>t in e?Mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,U=(e,t)=>{for(var r in t||(t={}))kt.call(t,r)&&Ge(e,r,t[r]);if(Ve)for(var r of Ve(t))wt.call(t,r)&&Ge(e,r,t[r]);return e},v=(e,t)=>xt(e,bt(t)),Vt=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r}),this.status=e,this.statusText=t,this.error=r}},Gt=async(e,t)=>{var r,n,a,o,i,u;let s=t||{},l={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:s,hooks:l};for(let c of t?.plugins||[]){if(c.init){let E=await((r=c.init)==null?void 0:r.call(c,e.toString(),t));s=E.options||s,e=E.url}l.onRequest.push((n=c.hooks)==null?void 0:n.onRequest),l.onResponse.push((a=c.hooks)==null?void 0:a.onResponse),l.onSuccess.push((o=c.hooks)==null?void 0:o.onSuccess),l.onError.push((i=c.hooks)==null?void 0:i.onError),l.onRetry.push((u=c.hooks)==null?void 0:u.onRetry)}return{url:e,options:s,hooks:l}},Be=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},Bt=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function Kt(e){if(typeof e=="number")return new Be({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new Be(e);case"exponential":return new Bt(e);default:throw new Error("Invalid retry strategy")}}var Ht=async e=>{let t={},r=async n=>typeof n=="function"?await n():n;if(e?.auth){if(e.auth.type==="Bearer"){let n=await r(e.auth.token);if(!n)return t;t.authorization=`Bearer ${n}`}else if(e.auth.type==="Basic"){let n=r(e.auth.username),a=r(e.auth.password);if(!n||!a)return t;t.authorization=`Basic ${btoa(`${n}:${a}`)}`}else if(e.auth.type==="Custom"){let n=r(e.auth.value);if(!n)return t;t.authorization=`${r(e.auth.prefix)} ${n}`}}return t},jt=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function zt(e){let t=e.headers.get("content-type"),r=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";let n=t.split(";").shift()||"";return jt.test(n)?"json":r.has(n)||n.startsWith("text/")?"text":"blob"}function Wt(e){try{return JSON.parse(e),!0}catch{return!1}}function je(e){if(e===void 0)return!1;let t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function Ke(e){try{return JSON.parse(e)}catch{return e}}function He(e){return typeof e=="function"}function Qt(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&He(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&He(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function qt(e){let t=new Headers(e?.headers),r=await Ht(e);for(let[n,a]of Object.entries(r||{}))t.set(n,a);if(!t.has("content-type")){let n=Jt(e?.body);n&&t.set("content-type",n)}return t}function Jt(e){return je(e)?"application/json":null}function Zt(e){if(!e?.body)return null;let t=new Headers(e?.headers);if(je(e.body)&&!t.has("content-type")){for(let[r,n]of Object.entries(e?.body))n instanceof Date&&(e.body[r]=n.toISOString());return JSON.stringify(e.body)}return e.body}function $t(e,t){var r;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){let n=(r=e.split("@")[1])==null?void 0:r.split("/")[0];return We.includes(n)?n.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function Yt(e,t){let r;return!e?.signal&&e?.timeout&&(r=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:r,clearTimeout:()=>{r&&clearTimeout(r)}}}var Xt=class ze extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,ze.prototype)}};async function er(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new Xt(r.issues);return r.value}var We=["get","post","put","patch","delete"];function tr(e,t){let{baseURL:r,params:n,query:a}=t||{query:{},params:{},baseURL:""},o=e.startsWith("http")?e.split("/").slice(0,3).join("/"):r||"";if(e.startsWith("@")){let E=e.toString().split("@")[1].split("/")[0];We.includes(E)&&(e=e.replace(`@${E}/`,"/"))}o.endsWith("/")||(o+="/");let[i,u]=e.replace(o,"").split("?"),s=new URLSearchParams(u);for(let[E,d]of Object.entries(a||{}))d!=null&&s.set(E,String(d));if(n)if(Array.isArray(n)){let E=i.split("/").filter(d=>d.startsWith(":"));for(let[d,y]of E.entries()){let N=n[d];i=i.replace(y,N)}}else for(let[E,d]of Object.entries(n))i=i.replace(`:${E}`,String(d));i=i.split("/").map(encodeURIComponent).join("/"),i.startsWith("/")&&(i=i.slice(1));let l=s.toString();return l=l.length>0?`?${l}`.replace(/\+/g,"%20"):"",o.startsWith("http")?new URL(`${i}${l}`,o):`${o}${i}${l}`}var se=async(e,t)=>{var r,n,a,o,i,u,s,l;let{hooks:c,url:E,options:d}=await Gt(e,t),y=Qt(d),N=new AbortController,w=(r=d.signal)!=null?r:N.signal,$=tr(E,d),dt=Zt(d),At=await qt(d),It=$t(E,d),I=v(U({},d),{url:$,headers:At,body:dt,method:It,signal:w});for(let R of c.onRequest)if(R){let f=await R(I);f instanceof Object&&(I=f)}("pipeTo"in I&&typeof I.pipeTo=="function"||typeof((n=t?.body)==null?void 0:n.pipe)=="function")&&("duplex"in I||(I.duplex="half"));let{clearTimeout:ft}=Yt(d,N),m=await y(I.url,I);ft();let Ie={response:m,request:I};for(let R of c.onResponse)if(R){let f=await R(v(U({},Ie),{response:(a=t?.hookOptions)!=null&&a.cloneResponse?m.clone():m}));f instanceof Response?m=f:f instanceof Object&&(m=f.response)}if(m.ok){if(!(I.method!=="HEAD"))return{data:"",error:null};let f=zt(m),g={data:"",response:m,request:I};if(f==="json"||f==="text"){let h=await m.text(),Nt=await((o=I.jsonParser)!=null?o:Ke)(h);g.data=Nt}else g.data=await m[f]();I?.output&&I.output&&!I.disableValidation&&(g.data=await er(I.output,g.data));for(let h of c.onSuccess)h&&await h(v(U({},g),{response:(i=t?.hookOptions)!=null&&i.cloneResponse?m.clone():m}));return t?.throw?g.data:{data:g.data,error:null}}let pt=(u=t?.jsonParser)!=null?u:Ke,V=await m.text(),fe=Wt(V),Y=fe?await pt(V):null,_t={response:m,responseText:V,request:I,error:v(U({},Y),{status:m.status,statusText:m.statusText})};for(let R of c.onError)R&&await R(v(U({},_t),{response:(s=t?.hookOptions)!=null&&s.cloneResponse?m.clone():m}));if(t?.retry){let R=Kt(t.retry),f=(l=t.retryAttempt)!=null?l:0;if(await R.shouldAttemptRetry(f,m)){for(let h of c.onRetry)h&&await h(Ie);let g=R.getDelay(f);return await new Promise(h=>setTimeout(h,g)),await se(e,v(U({},t),{retryAttempt:f+1}))}}if(t?.throw)throw new Vt(m.status,m.statusText,fe?Y:V);return{data:null,error:v(U({},Y),{status:m.status,statusText:m.statusText})}};import{useCallback as rr,useRef as nr,useSyncExternalStore as or}from"react";var le=(e,t)=>r=>{e.current!==r&&(e.current=r,t())};function D(e,{keys:t,deps:r=[e,t]}={}){let n=nr();n.current=e.get();let a=rr(i=>(le(n,i)(e.value),t?.length>0?ee(e,t,le(n,i)):e.listen(le(n,i))),r),o=()=>n.current;return or(a,o,o)}import{useState as Qe}from"react";var ar="https://core.framerauth.com/v2",b=()=>typeof window<"u",z=()=>window.location.host.endsWith("framercanvas.com"),ir=()=>{let e=Object.keys(window.parent);for(let t=e.length-1;t>=0;t--)try{let r=new URLSearchParams(window.parent[e[t]].location.search).get("siteId");if(r)return r}catch{}},sr=async()=>{let e=ir()||"";return await se(`${ar}/public/project/config`,{headers:{"x-framer-project-id":e}})};function Bn(){if(!b()||z()||!window?.FramerAuth)return{initializing:!0,setInitializing:()=>{}};let e=window.FramerAuth;return{initializing:D(e.state.initializing)}}function x(){if(!b()||z()||!window?.FramerAuth)return{session:null,loading:!1,setSession:()=>{},setLoading:()=>{}};let e=window.FramerAuth,t=D(e.data.session),r=D(e.state.sessionLoading);return{session:t,loading:r,setSession:o=>e.data.session.set(o),setLoading:o=>e.state.sessionLoading.set(o)}}function W(){if(!b()||z()||!window?.FramerAuth)return{user:null,loading:!1,setUser:()=>{},setLoading:()=>{}};let e=window.FramerAuth,t=D(e.data.user),r=D(e.state.userLoading),n=o=>e.data.user.set(o),a=o=>e.state.userLoading.set(o);return t&&!Object.prototype.hasOwnProperty.call(t,"tags")&&(t.tags=[]),{user:t,loading:r,setUser:n,setLoading:a}}function Kn(){let[e,t]=Qe(null),[r,n]=Qe(!1);if(!b())return{project:null,loading:!1,setProject:()=>{},setLoading:()=>{},fetchProject:async()=>({data:null,error:A("BROWSER_UNAVAILABLE")})};if(!window?.FramerAuth){let E=N=>t(N),d=N=>n(N);return{project:e,loading:r,setProject:E,setLoading:d,fetchProject:async()=>{d(!0);let N=await sr();return N.data&&E(N.data),d(!1),N}}}let o=window.FramerAuth,i=D(o.data.project),u=D(o.state.projectLoading),s=E=>o.data.project.set(E),l=E=>o.state.projectLoading.set(E);return{project:i,loading:u,setProject:s,setLoading:l,fetchProject:async()=>{l(!0);let E=await o.api.fetchProject();return E.data&&s(E.data),l(!1),E}}}function Q(e){if(!b()||z()||!window?.FramerAuth)return{bookmarks:null,loading:!1,createBookmark:o=>{},deleteBookmark:o=>{},setLoading:()=>{}};let t=window.FramerAuth;return{bookmarks:D(t.data.bookmarks,{keys:e}),createBookmark:o=>{let u={...t.data.bookmarks.get(),[o]:!0};t.data.bookmarks.set(u)},deleteBookmark:o=>{let u={...t.data.bookmarks.get()};delete u[o],t.data.bookmarks.set(u)}}}import{useEffect as Ee,useMemo as O,useRef as me}from"react";import{useRouter as lr,RenderTarget as Je,inferInitialRouteFromPath as ur}from"framer";function qe(e){return e.toLowerCase()}function ue(e,t="any"){return e==="all"||e==="any"?e:t}function k(e){return e!==null}function q(e,t,r="all"){if(!k(e))return!1;if(t.length===0)return e.tags.length>0;let n=e.tags.map(o=>qe(o.name)),a=t.map(qe);return r==="any"?a.some(o=>n.includes(o)):a.every(o=>n.includes(o))}import{jsx as _}from"react/jsx-runtime";typeof window<"u"&&window.FramerAuth&&console.log("FramerAuth SDK (React): 2.2.0");function Ze(e){let t=e;return typeof t?.displayName=="string"&&t.displayName.length>0&&typeof t?.defaultProps=="object"&&t.defaultProps!==null}function $e(e,t){return t?e.parentElement:e}function ce(e){let t;if(typeof e=="string")t=e.split(",");else if(Array.isArray(e))t=e.filter(n=>typeof n=="string");else return null;let r=t.map(n=>n.trim()).filter(Boolean);return r.length>0?r:null}function de(e,t){return t!==void 0?typeof t=="string"||Array.isArray(t)||t===null?{tags:ce(t),operator:"any"}:{tags:ce(t.tags),operator:ue(t.require)}:{tags:ce(e?.tags),operator:ue(e?.require)}}function $n(e){return t=>{let{session:r}=x();return r?_(e,{...t}):null}}function Yn(e){return t=>{let{session:r}=x();return r?null:_(e,{...t})}}function Xn(e){return t=>{let{session:r}=x(),n=r?null:t?.variant;return _(e,{...t,variant:n})}}function eo(e,t){let r=Ze(e);return n=>{let{user:a}=W(),o=me(null),{tags:i,operator:u}=O(()=>de(n,t),[n?.tags,n?.require,t]),s=O(()=>k(a)?i?q(a,i,u):a.tags.length>0:!1,[a,i,u]);return Ee(()=>{if(o.current){let c=$e(o.current,r);if(!c)return;s?c.style.display="":c.style.display="none"}},[o.current,s]),O(()=>s!==!0?_("div",{ref:o}):_(e,{ref:o,...n}),[n,s,void 0])}}function to(e,t){let r=Ze(e);return n=>{let{user:a}=W(),o=me(null),{tags:i,operator:u}=O(()=>de(n,t),[n?.tags,n?.require,t]),s=O(()=>k(a)?i?q(a,i,u):a.tags.length>0:!1,[a,i,u]);return Ee(()=>{if(o.current){let c=$e(o.current,r);if(!c)return;s?c.style.display="none":c.style.display=""}},[o.current,s]),O(()=>s===!0?_("div",{ref:o}):_(e,{ref:o,...n}),[n,s,void 0])}}function ro(e,t){return r=>{let{user:n}=W(),a=r?.variant,{tags:o,operator:i}=de(r,t);if(!o){let l=null;return(!k(n)||n.tags.length===0)&&(l=a),_(e,{...r,variant:l})}let s=q(n,o,i)?null:a;return _(e,{...r,variant:s})}}function no(e,t="saved-for-later"){return r=>{let{bookmarks:n}=Q(),o=O(()=>n?Object.keys(n).some(u=>u.startsWith(`${t}:`)):!1,[n])?null:"Empty State";return _(e,{...r,variant:o})}}function oo(e,t="saved-for-later"){return r=>{let{bookmarks:n}=Q(),a=me(null),o=O(()=>`${t}:${r?.slug}`,[r]),i=O(()=>cr()?!0:n?o in n:!1,[n?.[o],o]);return Ee(()=>{if(a.current){let s=a.current.parentElement;if(!s)return;i?s.style.display="":s.style.display="none"}},[a.current,i]),O(()=>i?_(e,{ref:a,...r}):_("div",{ref:a}),[r,i,void 0])}}function ao(e,t="saved-for-later"){return r=>{let n=lr(),{session:a}=x(),{bookmarks:o,createBookmark:i,deleteBookmark:u}=Q([`${t}:${r?.slug}`]),s=O(()=>`${t}:${r?.slug}`,[r]),l=O(()=>o?s in o:!1,[o?.[s],s]),c=async d=>{try{if(l)u(s),window?.FramerAuth.auth.deleteBookmark({id:r?.slug,bookmark_type:t});else if(i(s),window?.FramerAuth.auth.createBookmark({id:r?.slug,bookmark_type:t}),r?.link){let[y,N]=r.link.split("#"),{routeId:w,pathVariables:$}=ur(n.routes,y);w&&n.navigate(w,N,$)}}catch(y){console.error(y)}},E=O(()=>l?r?.variant:void 0,[l,r?.variant]);return a?_(e,{...r,variant:E,onClick:c}):null}}function io(e){return t=>_(e,{...t,onClick:async n=>{window?.FramerAuth.auth.signInSocial({provider:"github",callbackURL:window.location.origin+"/account"})}})}function so(e,t){return r=>{let{session:n}=x();return n?_(e,{...r,onClick:async o=>{window?.FramerAuth.auth.signOut({redirectTo:t.redirectTo})}}):null}}function cr(){return Je.current()===Je.canvas}var J={INVALID_EMAIL:"Invalid email format. Example: user@example.com",INVALID_URL:"Invalid URL format. Example: https://example.com",INVALID_PHONE:"Invalid phone number format. Example: +1234567890",INVALID_DATE:"Invalid date format. Example: 2023-12-31",INVALID_TIME:"Invalid time format. Example: 14:30 or 14:30:45",INVALID_DATETIME:"Invalid datetime format. Example: 2023-12-31T14:30:00Z",INVALID_NUMBER:"Invalid number format. Example: 42",INVALID_VALUE:"Invalid value.",FIELD_REQUIRED:"{field} is required.",PROJECT_UNAVAILABLE:"FramerAuth is unavailable because the project configuration could not be loaded. Please refresh or contact support.",CAPTCHA_NOT_CONFIGURED:"CAPTCHA is not configured correctly. Please contact support.",CAPTCHA_REQUIRED:"Please complete the CAPTCHA.",SIGNED_IN:"Successfully signed in.",ACCOUNT_CREATED:"Account created successfully.",PASSWORD_REQUIREMENTS_NOT_MET:"Password does not meet requirements.",TOKEN_NOT_FOUND:"Token not found.",PASSWORD_RESET:"Password has been reset.",EMAIL_INSTRUCTIONS_SENT:"Email instructions sent.",EMAIL_NOT_FOUND:"Email not found.",PASSWORDS_DO_NOT_MATCH:"Passwords do not match.",PROFILE_UPDATED:"Profile updated successfully.",AVATAR_FILE_TOO_LARGE:"Avatar is larger than the 4MB maximum",PRICE_ID_REQUIRED:"Price ID is required for checkout",SEND_VERIFICATION_EMAIL_PROMPT:"Press OK to send a verification email.",VERIFICATION_EMAIL_SENT:"Verification email sent.",CHECKOUT_FAILED:"Checkout failed",NO_CUSTOMER_ACCOUNT:"No customer account found.",PORTAL_UNAVAILABLE:"Unable to open portal",ACTION_FAILED:"Something went wrong. Please try again."};var Ye={INVALID_EMAIL:"邮箱格式无效。示例:user@example.com",INVALID_URL:"URL 格式无效。示例:https://example.com",INVALID_PHONE:"电话号码格式无效。示例:+1234567890",INVALID_DATE:"日期格式无效。示例:2023-12-31",INVALID_TIME:"时间格式无效。示例:14:30 或 14:30:45",INVALID_DATETIME:"日期时间格式无效。示例:2023-12-31T14:30:00Z",INVALID_NUMBER:"数字格式无效。示例:42",INVALID_VALUE:"值无效。",FIELD_REQUIRED:"{field}为必填项。",PROJECT_UNAVAILABLE:"无法加载项目配置,FramerAuth 暂时不可用。请刷新页面或联系支持团队。",CAPTCHA_NOT_CONFIGURED:"CAPTCHA 配置不正确。请联系支持团队。",CAPTCHA_REQUIRED:"请完成 CAPTCHA 验证。",SIGNED_IN:"登录成功。",ACCOUNT_CREATED:"账户创建成功。",PASSWORD_REQUIREMENTS_NOT_MET:"密码不符合要求。",TOKEN_NOT_FOUND:"未找到令牌。",PASSWORD_RESET:"密码已重置。",EMAIL_INSTRUCTIONS_SENT:"操作说明已通过邮件发送。",EMAIL_NOT_FOUND:"未找到邮箱。",PASSWORDS_DO_NOT_MATCH:"两次输入的密码不一致。",PROFILE_UPDATED:"个人资料更新成功。",AVATAR_FILE_TOO_LARGE:"头像超过了 4MB 的大小上限",PRICE_ID_REQUIRED:"结账时必须提供价格 ID",SEND_VERIFICATION_EMAIL_PROMPT:"点击 OK 发送验证邮件。",VERIFICATION_EMAIL_SENT:"验证邮件已发送。",CHECKOUT_FAILED:"结账失败",NO_CUSTOMER_ACCOUNT:"未找到客户账户。",PORTAL_UNAVAILABLE:"无法打开门户",ACTION_FAILED:"出现错误。请重试。"};var Xe={INVALID_EMAIL:"Formato de correo electrónico no válido. Ejemplo: user@example.com",INVALID_URL:"Formato de URL no válido. Ejemplo: https://example.com",INVALID_PHONE:"Formato de número de teléfono no válido. Ejemplo: +1234567890",INVALID_DATE:"Formato de fecha no válido. Ejemplo: 2023-12-31",INVALID_TIME:"Formato de hora no válido. Ejemplo: 14:30 o 14:30:45",INVALID_DATETIME:"Formato de fecha y hora no válido. Ejemplo: 2023-12-31T14:30:00Z",INVALID_NUMBER:"Formato de número no válido. Ejemplo: 42",INVALID_VALUE:"Valor no válido.",FIELD_REQUIRED:"El campo {field} es obligatorio.",PROJECT_UNAVAILABLE:"FramerAuth no está disponible porque no se pudo cargar la configuración del proyecto. Actualiza la página o contacta con soporte.",CAPTCHA_NOT_CONFIGURED:"El CAPTCHA no está configurado correctamente. Contacta con soporte.",CAPTCHA_REQUIRED:"Completa el CAPTCHA.",SIGNED_IN:"Sesión iniciada correctamente.",ACCOUNT_CREATED:"Cuenta creada correctamente.",PASSWORD_REQUIREMENTS_NOT_MET:"La contraseña no cumple los requisitos.",TOKEN_NOT_FOUND:"No se encontró el token.",PASSWORD_RESET:"La contraseña se ha restablecido.",EMAIL_INSTRUCTIONS_SENT:"Se han enviado las instrucciones por correo electrónico.",EMAIL_NOT_FOUND:"No se encontró el correo electrónico.",PASSWORDS_DO_NOT_MATCH:"Las contraseñas no coinciden.",PROFILE_UPDATED:"Perfil actualizado correctamente.",AVATAR_FILE_TOO_LARGE:"El avatar supera el tamaño máximo de 4 MB",PRICE_ID_REQUIRED:"Se requiere el ID del precio para proceder al pago",SEND_VERIFICATION_EMAIL_PROMPT:"Pulsa OK para enviar un correo de verificación.",VERIFICATION_EMAIL_SENT:"Correo de verificación enviado.",CHECKOUT_FAILED:"No se pudo completar el pago",NO_CUSTOMER_ACCOUNT:"No se encontró ninguna cuenta de cliente.",PORTAL_UNAVAILABLE:"No se puede abrir el portal",ACTION_FAILED:"Algo salió mal. Inténtalo de nuevo."};var et={INVALID_EMAIL:"Format d’adresse e-mail invalide. Exemple : user@example.com",INVALID_URL:"Format d’URL invalide. Exemple : https://example.com",INVALID_PHONE:"Format de numéro de téléphone invalide. Exemple : +1234567890",INVALID_DATE:"Format de date invalide. Exemple : 2023-12-31",INVALID_TIME:"Format d’heure invalide. Exemple : 14:30 ou 14:30:45",INVALID_DATETIME:"Format de date et d’heure invalide. Exemple : 2023-12-31T14:30:00Z",INVALID_NUMBER:"Format de nombre invalide. Exemple : 42",INVALID_VALUE:"Valeur invalide.",FIELD_REQUIRED:"Le champ {field} est requis.",PROJECT_UNAVAILABLE:"FramerAuth est indisponible car la configuration du projet n’a pas pu être chargée. Veuillez actualiser la page ou contacter l’assistance.",CAPTCHA_NOT_CONFIGURED:"Le CAPTCHA n’est pas configuré correctement. Veuillez contacter l’assistance.",CAPTCHA_REQUIRED:"Veuillez compléter le CAPTCHA.",SIGNED_IN:"Connexion réussie.",ACCOUNT_CREATED:"Compte créé avec succès.",PASSWORD_REQUIREMENTS_NOT_MET:"Le mot de passe ne respecte pas les critères requis.",TOKEN_NOT_FOUND:"Jeton introuvable.",PASSWORD_RESET:"Le mot de passe a été réinitialisé.",EMAIL_INSTRUCTIONS_SENT:"Les instructions ont été envoyées par e-mail.",EMAIL_NOT_FOUND:"Adresse e-mail introuvable.",PASSWORDS_DO_NOT_MATCH:"Les mots de passe ne correspondent pas.",PROFILE_UPDATED:"Profil mis à jour avec succès.",AVATAR_FILE_TOO_LARGE:"L’avatar dépasse la taille maximale de 4 Mo",PRICE_ID_REQUIRED:"L’identifiant du prix est requis pour passer au paiement",SEND_VERIFICATION_EMAIL_PROMPT:"Appuyez sur OK pour envoyer un e-mail de vérification.",VERIFICATION_EMAIL_SENT:"E-mail de vérification envoyé.",CHECKOUT_FAILED:"Échec du paiement",NO_CUSTOMER_ACCOUNT:"Aucun compte client trouvé.",PORTAL_UNAVAILABLE:"Impossible d’ouvrir le portail",ACTION_FAILED:"Une erreur s’est produite. Veuillez réessayer."};var tt={INVALID_EMAIL:"تنسيق البريد الإلكتروني غير صالح. مثال: user@example.com",INVALID_URL:"تنسيق الرابط غير صالح. مثال: https://example.com",INVALID_PHONE:"تنسيق رقم الهاتف غير صالح. مثال: +1234567890",INVALID_DATE:"تنسيق التاريخ غير صالح. مثال: 2023-12-31",INVALID_TIME:"تنسيق الوقت غير صالح. مثال: 14:30 أو 14:30:45",INVALID_DATETIME:"تنسيق التاريخ والوقت غير صالح. مثال: 2023-12-31T14:30:00Z",INVALID_NUMBER:"تنسيق الرقم غير صالح. مثال: 42",INVALID_VALUE:"قيمة غير صالحة.",FIELD_REQUIRED:"الحقل {field} مطلوب.",PROJECT_UNAVAILABLE:"FramerAuth غير متاح لتعذر تحميل إعدادات المشروع. يرجى تحديث الصفحة أو الاتصال بالدعم.",CAPTCHA_NOT_CONFIGURED:"لم يتم إعداد CAPTCHA بشكل صحيح. يرجى الاتصال بالدعم.",CAPTCHA_REQUIRED:"يرجى إكمال CAPTCHA.",SIGNED_IN:"تم تسجيل الدخول بنجاح.",ACCOUNT_CREATED:"تم إنشاء الحساب بنجاح.",PASSWORD_REQUIREMENTS_NOT_MET:"كلمة المرور لا تستوفي المتطلبات.",TOKEN_NOT_FOUND:"الرمز المميز غير موجود.",PASSWORD_RESET:"تمت إعادة تعيين كلمة المرور.",EMAIL_INSTRUCTIONS_SENT:"تم إرسال التعليمات عبر البريد الإلكتروني.",EMAIL_NOT_FOUND:"البريد الإلكتروني غير موجود.",PASSWORDS_DO_NOT_MATCH:"كلمتا المرور غير متطابقتين.",PROFILE_UPDATED:"تم تحديث الملف الشخصي بنجاح.",AVATAR_FILE_TOO_LARGE:"يتجاوز حجم الصورة الشخصية الحد الأقصى البالغ 4 ميغابايت",PRICE_ID_REQUIRED:"معرّف السعر مطلوب لإتمام الدفع",SEND_VERIFICATION_EMAIL_PROMPT:"اضغط على OK لإرسال رسالة تحقق عبر البريد الإلكتروني.",VERIFICATION_EMAIL_SENT:"تم إرسال رسالة التحقق عبر البريد الإلكتروني.",CHECKOUT_FAILED:"تعذر إتمام الدفع",NO_CUSTOMER_ACCOUNT:"لم يتم العثور على حساب عميل.",PORTAL_UNAVAILABLE:"تعذر فتح البوابة",ACTION_FAILED:"حدث خطأ ما. يرجى المحاولة مرة أخرى."};var rt={INVALID_EMAIL:"Formato de e-mail inválido. Exemplo: user@example.com",INVALID_URL:"Formato de URL inválido. Exemplo: https://example.com",INVALID_PHONE:"Formato de telefone inválido. Exemplo: +1234567890",INVALID_DATE:"Formato de data inválido. Exemplo: 2023-12-31",INVALID_TIME:"Formato de hora inválido. Exemplo: 14:30 ou 14:30:45",INVALID_DATETIME:"Formato de data e hora inválido. Exemplo: 2023-12-31T14:30:00Z",INVALID_NUMBER:"Formato de número inválido. Exemplo: 42",INVALID_VALUE:"Valor inválido.",FIELD_REQUIRED:"O campo {field} é obrigatório.",PROJECT_UNAVAILABLE:"O FramerAuth está indisponível porque não foi possível carregar a configuração do projeto. Atualize a página ou entre em contato com o suporte.",CAPTCHA_NOT_CONFIGURED:"O CAPTCHA não está configurado corretamente. Entre em contato com o suporte.",CAPTCHA_REQUIRED:"Complete o CAPTCHA.",SIGNED_IN:"Login realizado com sucesso.",ACCOUNT_CREATED:"Conta criada com sucesso.",PASSWORD_REQUIREMENTS_NOT_MET:"A senha não atende aos requisitos.",TOKEN_NOT_FOUND:"Token não encontrado.",PASSWORD_RESET:"A senha foi redefinida.",EMAIL_INSTRUCTIONS_SENT:"As instruções foram enviadas por e-mail.",EMAIL_NOT_FOUND:"E-mail não encontrado.",PASSWORDS_DO_NOT_MATCH:"As senhas não coincidem.",PROFILE_UPDATED:"Perfil atualizado com sucesso.",AVATAR_FILE_TOO_LARGE:"O avatar excede o tamanho máximo de 4 MB",PRICE_ID_REQUIRED:"O ID do preço é necessário para finalizar a compra",SEND_VERIFICATION_EMAIL_PROMPT:"Pressione OK para enviar um e-mail de verificação.",VERIFICATION_EMAIL_SENT:"E-mail de verificação enviado.",CHECKOUT_FAILED:"Não foi possível finalizar a compra",NO_CUSTOMER_ACCOUNT:"Nenhuma conta de cliente encontrada.",PORTAL_UNAVAILABLE:"Não foi possível abrir o portal",ACTION_FAILED:"Algo deu errado. Tente novamente."};var nt={INVALID_EMAIL:"Неверный формат электронной почты. Пример: user@example.com",INVALID_URL:"Неверный формат URL. Пример: https://example.com",INVALID_PHONE:"Неверный формат номера телефона. Пример: +1234567890",INVALID_DATE:"Неверный формат даты. Пример: 2023-12-31",INVALID_TIME:"Неверный формат времени. Пример: 14:30 или 14:30:45",INVALID_DATETIME:"Неверный формат даты и времени. Пример: 2023-12-31T14:30:00Z",INVALID_NUMBER:"Неверный формат числа. Пример: 42",INVALID_VALUE:"Недопустимое значение.",FIELD_REQUIRED:"Поле {field} обязательно.",PROJECT_UNAVAILABLE:"FramerAuth недоступен, поскольку не удалось загрузить конфигурацию проекта. Обновите страницу или обратитесь в службу поддержки.",CAPTCHA_NOT_CONFIGURED:"CAPTCHA настроена некорректно. Обратитесь в службу поддержки.",CAPTCHA_REQUIRED:"Пожалуйста, пройдите CAPTCHA.",SIGNED_IN:"Вход выполнен успешно.",ACCOUNT_CREATED:"Учетная запись успешно создана.",PASSWORD_REQUIREMENTS_NOT_MET:"Пароль не соответствует требованиям.",TOKEN_NOT_FOUND:"Токен не найден.",PASSWORD_RESET:"Пароль сброшен.",EMAIL_INSTRUCTIONS_SENT:"Инструкции отправлены по электронной почте.",EMAIL_NOT_FOUND:"Адрес электронной почты не найден.",PASSWORDS_DO_NOT_MATCH:"Пароли не совпадают.",PROFILE_UPDATED:"Профиль успешно обновлен.",AVATAR_FILE_TOO_LARGE:"Размер аватара превышает максимально допустимые 4 МБ",PRICE_ID_REQUIRED:"Для оформления покупки необходим идентификатор цены",SEND_VERIFICATION_EMAIL_PROMPT:"Нажмите OK, чтобы отправить письмо для подтверждения адреса.",VERIFICATION_EMAIL_SENT:"Письмо для подтверждения адреса отправлено.",CHECKOUT_FAILED:"Не удалось оформить покупку",NO_CUSTOMER_ACCOUNT:"Учетная запись клиента не найдена.",PORTAL_UNAVAILABLE:"Не удалось открыть портал",ACTION_FAILED:"Что-то пошло не так. Пожалуйста, попробуйте снова."};var ot={INVALID_EMAIL:"Ungültiges E-Mail-Format. Beispiel: user@example.com",INVALID_URL:"Ungültiges URL-Format. Beispiel: https://example.com",INVALID_PHONE:"Ungültiges Telefonnummernformat. Beispiel: +1234567890",INVALID_DATE:"Ungültiges Datumsformat. Beispiel: 2023-12-31",INVALID_TIME:"Ungültiges Zeitformat. Beispiel: 14:30 oder 14:30:45",INVALID_DATETIME:"Ungültiges Datums- und Zeitformat. Beispiel: 2023-12-31T14:30:00Z",INVALID_NUMBER:"Ungültiges Zahlenformat. Beispiel: 42",INVALID_VALUE:"Ungültiger Wert.",FIELD_REQUIRED:"Das Feld {field} ist erforderlich.",PROJECT_UNAVAILABLE:"FramerAuth ist nicht verfügbar, da die Projektkonfiguration nicht geladen werden konnte. Bitte aktualisieren Sie die Seite oder kontaktieren Sie den Support.",CAPTCHA_NOT_CONFIGURED:"Das CAPTCHA ist nicht korrekt konfiguriert. Bitte kontaktieren Sie den Support.",CAPTCHA_REQUIRED:"Bitte lösen Sie das CAPTCHA.",SIGNED_IN:"Erfolgreich angemeldet.",ACCOUNT_CREATED:"Konto erfolgreich erstellt.",PASSWORD_REQUIREMENTS_NOT_MET:"Das Passwort erfüllt die Anforderungen nicht.",TOKEN_NOT_FOUND:"Token nicht gefunden.",PASSWORD_RESET:"Das Passwort wurde zurückgesetzt.",EMAIL_INSTRUCTIONS_SENT:"Die Anweisungen wurden per E-Mail gesendet.",EMAIL_NOT_FOUND:"E-Mail nicht gefunden.",PASSWORDS_DO_NOT_MATCH:"Die Passwörter stimmen nicht überein.",PROFILE_UPDATED:"Profil erfolgreich aktualisiert.",AVATAR_FILE_TOO_LARGE:"Das Profilbild überschreitet die maximale Größe von 4 MB",PRICE_ID_REQUIRED:"Die Preis-ID ist erforderlich, um zur Kasse zu gehen",SEND_VERIFICATION_EMAIL_PROMPT:"Drücken Sie OK, um eine Bestätigungs-E-Mail zu senden.",VERIFICATION_EMAIL_SENT:"Bestätigungs-E-Mail gesendet.",CHECKOUT_FAILED:"Bezahlvorgang fehlgeschlagen",NO_CUSTOMER_ACCOUNT:"Kein Kundenkonto gefunden.",PORTAL_UNAVAILABLE:"Das Portal konnte nicht geöffnet werden",ACTION_FAILED:"Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut."};var at={INVALID_EMAIL:"メールアドレスの形式が無効です。例:user@example.com",INVALID_URL:"URL の形式が無効です。例:https://example.com",INVALID_PHONE:"電話番号の形式が無効です。例:+1234567890",INVALID_DATE:"日付の形式が無効です。例:2023-12-31",INVALID_TIME:"時刻の形式が無効です。例:14:30 または 14:30:45",INVALID_DATETIME:"日時の形式が無効です。例:2023-12-31T14:30:00Z",INVALID_NUMBER:"数値の形式が無効です。例:42",INVALID_VALUE:"値が無効です。",FIELD_REQUIRED:"{field}は必須です。",PROJECT_UNAVAILABLE:"プロジェクトの設定を読み込めないため、FramerAuth を利用できません。ページを再読み込みするか、サポートにお問い合わせください。",CAPTCHA_NOT_CONFIGURED:"CAPTCHA が正しく設定されていません。サポートにお問い合わせください。",CAPTCHA_REQUIRED:"CAPTCHA を完了してください。",SIGNED_IN:"サインインしました。",ACCOUNT_CREATED:"アカウントを作成しました。",PASSWORD_REQUIREMENTS_NOT_MET:"パスワードが要件を満たしていません。",TOKEN_NOT_FOUND:"トークンが見つかりません。",PASSWORD_RESET:"パスワードを再設定しました。",EMAIL_INSTRUCTIONS_SENT:"手順をメールで送信しました。",EMAIL_NOT_FOUND:"メールアドレスが見つかりません。",PASSWORDS_DO_NOT_MATCH:"パスワードが一致しません。",PROFILE_UPDATED:"プロフィールを更新しました。",AVATAR_FILE_TOO_LARGE:"アバターのサイズが上限の4MBを超えています",PRICE_ID_REQUIRED:"購入手続きには価格 ID が必要です",SEND_VERIFICATION_EMAIL_PROMPT:"確認メールを送信するには OK を押してください。",VERIFICATION_EMAIL_SENT:"確認メールを送信しました。",CHECKOUT_FAILED:"購入手続きに失敗しました",NO_CUSTOMER_ACCOUNT:"顧客アカウントが見つかりません。",PORTAL_UNAVAILABLE:"ポータルを開けません",ACTION_FAILED:"問題が発生しました。もう一度お試しください。"};var it={INVALID_EMAIL:"ईमेल का फ़ॉर्मैट अमान्य है। उदाहरण: user@example.com",INVALID_URL:"URL का फ़ॉर्मैट अमान्य है। उदाहरण: https://example.com",INVALID_PHONE:"फ़ोन नंबर का फ़ॉर्मैट अमान्य है। उदाहरण: +1234567890",INVALID_DATE:"तारीख का फ़ॉर्मैट अमान्य है। उदाहरण: 2023-12-31",INVALID_TIME:"समय का फ़ॉर्मैट अमान्य है। उदाहरण: 14:30 या 14:30:45",INVALID_DATETIME:"तारीख और समय का फ़ॉर्मैट अमान्य है। उदाहरण: 2023-12-31T14:30:00Z",INVALID_NUMBER:"संख्या का फ़ॉर्मैट अमान्य है। उदाहरण: 42",INVALID_VALUE:"मान अमान्य है।",FIELD_REQUIRED:"{field} आवश्यक है।",PROJECT_UNAVAILABLE:"प्रोजेक्ट की सेटिंग लोड नहीं हो सकी, इसलिए FramerAuth उपलब्ध नहीं है। कृपया पेज रीफ़्रेश करें या सहायता से संपर्क करें।",CAPTCHA_NOT_CONFIGURED:"CAPTCHA सही तरीके से कॉन्फ़िगर नहीं किया गया है। कृपया सहायता से संपर्क करें।",CAPTCHA_REQUIRED:"कृपया CAPTCHA पूरा करें।",SIGNED_IN:"सफलतापूर्वक साइन इन किया गया।",ACCOUNT_CREATED:"खाता सफलतापूर्वक बनाया गया।",PASSWORD_REQUIREMENTS_NOT_MET:"पासवर्ड आवश्यकताओं को पूरा नहीं करता।",TOKEN_NOT_FOUND:"टोकन नहीं मिला।",PASSWORD_RESET:"पासवर्ड रीसेट कर दिया गया है।",EMAIL_INSTRUCTIONS_SENT:"निर्देश ईमेल से भेज दिए गए हैं।",EMAIL_NOT_FOUND:"ईमेल नहीं मिला।",PASSWORDS_DO_NOT_MATCH:"पासवर्ड मेल नहीं खाते।",PROFILE_UPDATED:"प्रोफ़ाइल सफलतापूर्वक अपडेट की गई।",AVATAR_FILE_TOO_LARGE:"अवतार का आकार 4 MB की अधिकतम सीमा से बड़ा है",PRICE_ID_REQUIRED:"चेकआउट के लिए मूल्य ID आवश्यक है",SEND_VERIFICATION_EMAIL_PROMPT:"सत्यापन ईमेल भेजने के लिए OK दबाएँ।",VERIFICATION_EMAIL_SENT:"सत्यापन ईमेल भेज दिया गया है।",CHECKOUT_FAILED:"चेकआउट विफल रहा",NO_CUSTOMER_ACCOUNT:"कोई ग्राहक खाता नहीं मिला।",PORTAL_UNAVAILABLE:"पोर्टल नहीं खोला जा सका",ACTION_FAILED:"कुछ गलत हो गया। कृपया फिर से प्रयास करें।"};var st={INVALID_EMAIL:"Érvénytelen e-mail-formátum. Példa: user@example.com",INVALID_URL:"Érvénytelen URL-formátum. Példa: https://example.com",INVALID_PHONE:"Érvénytelen telefonszám-formátum. Példa: +1234567890",INVALID_DATE:"Érvénytelen dátumformátum. Példa: 2023-12-31",INVALID_TIME:"Érvénytelen időformátum. Példa: 14:30 vagy 14:30:45",INVALID_DATETIME:"Érvénytelen dátum- és időformátum. Példa: 2023-12-31T14:30:00Z",INVALID_NUMBER:"Érvénytelen számformátum. Példa: 42",INVALID_VALUE:"Érvénytelen érték.",FIELD_REQUIRED:"A(z) {field} mező kitöltése kötelező.",PROJECT_UNAVAILABLE:"A FramerAuth nem érhető el, mert nem sikerült betölteni a projekt konfigurációját. Frissítsd az oldalt, vagy lépj kapcsolatba az ügyfélszolgálattal.",CAPTCHA_NOT_CONFIGURED:"A CAPTCHA nincs megfelelően beállítva. Lépj kapcsolatba az ügyfélszolgálattal.",CAPTCHA_REQUIRED:"Kérjük, töltsd ki a CAPTCHA-t.",SIGNED_IN:"Sikeres bejelentkezés.",ACCOUNT_CREATED:"A fiók sikeresen létrejött.",PASSWORD_REQUIREMENTS_NOT_MET:"A jelszó nem felel meg a követelményeknek.",TOKEN_NOT_FOUND:"A token nem található.",PASSWORD_RESET:"A jelszó visszaállítása megtörtént.",EMAIL_INSTRUCTIONS_SENT:"Az utasításokat elküldtük e-mailben.",EMAIL_NOT_FOUND:"Az e-mail-cím nem található.",PASSWORDS_DO_NOT_MATCH:"A jelszavak nem egyeznek.",PROFILE_UPDATED:"A profil sikeresen frissült.",AVATAR_FILE_TOO_LARGE:"A profilkép nagyobb a megengedett 4 MB-nál",PRICE_ID_REQUIRED:"A fizetéshez ár-azonosító szükséges",SEND_VERIFICATION_EMAIL_PROMPT:"Nyomd meg az OK gombot a megerősítő e-mail elküldéséhez.",VERIFICATION_EMAIL_SENT:"A megerősítő e-mailt elküldtük.",CHECKOUT_FAILED:"A fizetés nem sikerült",NO_CUSTOMER_ACCOUNT:"Nem található ügyfélfiók.",PORTAL_UNAVAILABLE:"Nem sikerült megnyitni a portált",ACTION_FAILED:"Valami hiba történt. Kérjük, próbáld újra."};var lt={en:J,zh:Ye,es:Xe,fr:et,ar:tt,pt:rt,ru:nt,de:ot,ja:at,hi:it,hu:st};var ut={...M,...J},ct=Object.fromEntries(Object.entries(H).map(([e,t])=>[e,{...t,...lt[e]}]));function Z(e,t,r){return ie(ct,ut,e,t,r)}import{useCallback as Ae,useSyncExternalStore as Er}from"react";var mr=C(null);function mt(){let e=typeof window<"u"&&!window.location.host.endsWith("framercanvas.com")&&!!window.FramerAuth?.data?.project,t=e?j():mr,r=Ae(s=>t.listen(s),[t]),n=Ae(()=>t.get(),[t]),a=Er(r,n,()=>null),o=e?P(a?.locale):"en",i=ae(a);return{t:Ae((s,l)=>Z(s,l,o),[o]),locale:o,dir:i}}export{re as SUPPORTED_LOCALES,io as buttonSignInSocial,so as buttonSignOut,ke as getDir,oe as getLocale,In as getSession,cr as isCanvas,gn as resetPassword,Sn as sendForgotPasswordEmail,Nn as sendOTP,Ln as sendVerificationEmail,$n as showIfSignedIn,Yn as showIfSignedOut,eo as showIfWithTag,to as showIfWithoutTag,pn as signIn,_n as signInOTP,hn as signInSocial,Tn as signOut,fn as signUp,Dn as storeCheckout,yn as storePortal,Z as t,Xn as toggleVariant,ro as toggleVariantIfWithTag,On as updateProfile,Rn as updateProfilePicture,Q as useBookmarks,mt as useFramerAuthText,Bn as useIsInitializing,Kn as useProject,x as useSession,W as useUser,no as withBookmarks,oo as withIsBookmarked,ao as withToggleBookmark};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@framerauth/sdk",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -23,21 +23,30 @@
|
|
|
23
23
|
"build:prod": "pnpm run lint && tsup --env.VITE_API_URL https://core.framerauth.com --env.VITE_TENANT_HOSTNAME \"\" --env.VITE_BASE_PATH /v2",
|
|
24
24
|
"release:beta": "pnpm run build:prod && npm publish --access public --tag beta",
|
|
25
25
|
"release:latest": "pnpm run build:prod && npm publish --access public",
|
|
26
|
-
"preview": "vite preview"
|
|
26
|
+
"preview": "vite preview",
|
|
27
|
+
"test": "vitest run --maxWorkers=2"
|
|
27
28
|
},
|
|
28
29
|
"peerDependencies": {
|
|
29
30
|
"react": "^18.0.0 || ^19.0.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
33
|
+
"@testing-library/dom": "10.4.1",
|
|
34
|
+
"@testing-library/react": "16.3.0",
|
|
32
35
|
"@types/node": "^24.10.1",
|
|
33
36
|
"@types/react": "^19.1.5",
|
|
37
|
+
"@types/react-dom": "^19.1.9",
|
|
34
38
|
"dotenv": "^17.2.3",
|
|
39
|
+
"framer-motion": "12.19.2",
|
|
40
|
+
"jsdom": "^30.1.1",
|
|
35
41
|
"nanostores": "^1.0.1",
|
|
36
42
|
"prettier": "3.6.2",
|
|
37
43
|
"react": "^19.1.0",
|
|
44
|
+
"react-dom": "^19.1.1",
|
|
38
45
|
"tsup": "^8.5.1",
|
|
39
46
|
"typescript": "^5.9.3",
|
|
40
|
-
"vite": "^6.4.1"
|
|
47
|
+
"vite": "^6.4.1",
|
|
48
|
+
"vitest": "^5.0.3",
|
|
49
|
+
"zod": "4.0.14"
|
|
41
50
|
},
|
|
42
51
|
"dependencies": {
|
|
43
52
|
"@better-fetch/fetch": "^1.1.18",
|