const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LandingPage2-Cww1FPoA.js","assets/vendor-react-DP_h-t3b.js","assets/vendor-ui-B25LK1Jt.js","assets/HomePage-jka_6ods.js","assets/ComposeCard-Bk4m_lqu.js","assets/ScheduleModal-j4AWtqsx.js","assets/GaugeContainer-7I4Xtyhd.js","assets/index-BcWmkXPs.js","assets/ScoresContainer-BYpUV9Sd.js","assets/ControversyQuadrantContainer-thi1k0ZE.js","assets/AudienceContainer-DfjEVq87.js","assets/ScrollToTopButton-D7GA-uh-.js","assets/StickyPageHeader-CyW28mw1.js","assets/TermsPage-C7vOMNcx.js","assets/PrivacyPage-CpsEwxfV.js","assets/PricingPage-BcEUooFk.js","assets/SuccessPage-qKfe-uFv.js","assets/MomentumGauge-C_imhPMD.js","assets/ViralScorePage-C9P-b76v.js","assets/UserProfilePage-lQNs4paZ.js","assets/DashboardPage-BCnYKQMR.js","assets/BookmarksPage-syfP_op-.js","assets/AdminPanel-xqHkZ2tX.js","assets/AdminLoginPage-BUT0W1hP.js","assets/TrendPage-Ckfo6dk4.js","assets/QueuePage-DpqitpWV.js","assets/VoicesPage-FzYx6-Vt.js","assets/MoimaereLoginPage-GdhPO1hO.js","assets/CreatePage-B6M-xHDs.js","assets/textDiff-CYX06i_n.js","assets/WrapPage-C_qWdy61.js","assets/ConnectionsPage-BjqXu7za.js","assets/MemeGeneratorPage-_2BfIau8.js","assets/meme-templates-DjvQ13cQ.js","assets/TemplateMemeGeneratorPage-BQaO8mSx.js","assets/MemeDirectoryPage-Dq7hox54.js","assets/TypefullyPage-Tw7COsrh.js","assets/HypefuryPage-D-UM9ubg.js","assets/TweetHunterPage-D4Q4kn-C.js","assets/PostwisePage-B3f1Db5h.js","assets/BufferPage-CTQxEgiz.js","assets/HootsuitePage-DKeImxo9.js","assets/SuperxPage-xEk0IO2A.js","assets/TaplioPage-2dJzyAM3.js","assets/CopyaiPage-BddMVyDY.js","assets/PostbridgePage-DkLB7DPo.js","assets/SampleAnimationPage-DusxzcUF.js","assets/TwitterVideoDownlaoder-JKeqwLDk.js","assets/TwitterGIFDownloader-CfasZtnN.js","assets/PosttoAnimationPage-DzDUQ9ei.js","assets/BlogPage-DcP82B6k.js","assets/blog-posts-CnxJLRO5.js","assets/BlogPostPage-Dy5iuBhX.js","assets/UnsubscribePage-DwALpKHv.js"])))=>i.map(i=>d[i]);
var en=Object.defineProperty;var tn=(n,e,t)=>e in n?en(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ue=(n,e,t)=>tn(n,typeof e!="symbol"?e+"":e,t);import{r as f,a as sn,g as gs,R as pe,u as Ce,b as rn,c as te,d as Je,L as B,N as nt,B as nn,e as an,f as C}from"./vendor-react-DP_h-t3b.js";import{X as kt,M as Rs,Z as $s,C as Ls,P as Ds,S as Zt,a as on,b as ln,c as cn,d as dn,e as un,B as hn,f as fn,g as mn,h as pn,L as gn,i as xn,j as xs,k as O,A as ve,l as yn,I as vn,m as bn,T as wn,n as _n,o as jn}from"./vendor-ui-B25LK1Jt.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=t(a);fetch(a.href,i)}})();var mr={exports:{}},Nt={};/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var kn=f,Nn=Symbol.for("react.element"),Sn=Symbol.for("react.fragment"),Tn=Object.prototype.hasOwnProperty,En=kn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Pn={key:!0,ref:!0,__self:!0,__source:!0};function pr(n,e,t){var s,a={},i=null,o=null;t!==void 0&&(i=""+t),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(s in e)Tn.call(e,s)&&!Pn.hasOwnProperty(s)&&(a[s]=e[s]);if(n&&n.defaultProps)for(s in e=n.defaultProps,e)a[s]===void 0&&(a[s]=e[s]);return{$$typeof:Nn,type:n,key:i,ref:o,props:a,_owner:En.current}}Nt.Fragment=Sn;Nt.jsx=pr;Nt.jsxs=pr;mr.exports=Nt;var r=mr.exports,gr,Us=sn;gr=Us.createRoot,Us.hydrateRoot;var An=typeof Element<"u",Cn=typeof Map=="function",On=typeof Set=="function",In=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function vt(n,e){if(n===e)return!0;if(n&&e&&typeof n=="object"&&typeof e=="object"){if(n.constructor!==e.constructor)return!1;var t,s,a;if(Array.isArray(n)){if(t=n.length,t!=e.length)return!1;for(s=t;s--!==0;)if(!vt(n[s],e[s]))return!1;return!0}var i;if(Cn&&n instanceof Map&&e instanceof Map){if(n.size!==e.size)return!1;for(i=n.entries();!(s=i.next()).done;)if(!e.has(s.value[0]))return!1;for(i=n.entries();!(s=i.next()).done;)if(!vt(s.value[1],e.get(s.value[0])))return!1;return!0}if(On&&n instanceof Set&&e instanceof Set){if(n.size!==e.size)return!1;for(i=n.entries();!(s=i.next()).done;)if(!e.has(s.value[0]))return!1;return!0}if(In&&ArrayBuffer.isView(n)&&ArrayBuffer.isView(e)){if(t=n.length,t!=e.length)return!1;for(s=t;s--!==0;)if(n[s]!==e[s])return!1;return!0}if(n.constructor===RegExp)return n.source===e.source&&n.flags===e.flags;if(n.valueOf!==Object.prototype.valueOf&&typeof n.valueOf=="function"&&typeof e.valueOf=="function")return n.valueOf()===e.valueOf();if(n.toString!==Object.prototype.toString&&typeof n.toString=="function"&&typeof e.toString=="function")return n.toString()===e.toString();if(a=Object.keys(n),t=a.length,t!==Object.keys(e).length)return!1;for(s=t;s--!==0;)if(!Object.prototype.hasOwnProperty.call(e,a[s]))return!1;if(An&&n instanceof Element)return!1;for(s=t;s--!==0;)if(!((a[s]==="_owner"||a[s]==="__v"||a[s]==="__o")&&n.$$typeof)&&!vt(n[a[s]],e[a[s]]))return!1;return!0}return n!==n&&e!==e}var Rn=function(e,t){try{return vt(e,t)}catch(s){if((s.message||"").match(/stack|recursion/i))return!1;throw s}};const $n=gs(Rn);var Ln=function(n,e,t,s,a,i,o,l){if(!n){var c;if(e===void 0)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[t,s,a,i,o,l],u=0;c=new Error(e.replace(/%s/g,function(){return d[u++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}},Dn=Ln;const zs=gs(Dn);var Un=function(e,t,s,a){var i=s?s.call(a,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var o=Object.keys(e),l=Object.keys(t);if(o.length!==l.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(t),d=0;d<o.length;d++){var u=o[d];if(!c(u))return!1;var h=e[u],m=t[u];if(i=s?s.call(a,h,m,u):void 0,i===!1||i===void 0&&h!==m)return!1}return!0};const zn=gs(Un);var xr=(n=>(n.BASE="base",n.BODY="body",n.HEAD="head",n.HTML="html",n.LINK="link",n.META="meta",n.NOSCRIPT="noscript",n.SCRIPT="script",n.STYLE="style",n.TITLE="title",n.FRAGMENT="Symbol(react.fragment)",n))(xr||{}),Lt={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},Ms=Object.values(xr),ys={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},Mn=Object.entries(ys).reduce((n,[e,t])=>(n[t]=e,n),{}),ae="data-rh",qe={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},Ve=(n,e)=>{for(let t=n.length-1;t>=0;t-=1){const s=n[t];if(Object.prototype.hasOwnProperty.call(s,e))return s[e]}return null},Bn=n=>{let e=Ve(n,"title");const t=Ve(n,qe.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),t&&e)return t.replace(/%s/g,()=>e);const s=Ve(n,qe.DEFAULT_TITLE);return e||s||void 0},Fn=n=>Ve(n,qe.ON_CHANGE_CLIENT_STATE)||(()=>{}),Dt=(n,e)=>e.filter(t=>typeof t[n]<"u").map(t=>t[n]).reduce((t,s)=>({...t,...s}),{}),Wn=(n,e)=>e.filter(t=>typeof t.base<"u").map(t=>t.base).reverse().reduce((t,s)=>{if(!t.length){const a=Object.keys(s);for(let i=0;i<a.length;i+=1){const l=a[i].toLowerCase();if(n.indexOf(l)!==-1&&s[l])return t.concat(s)}}return t},[]),qn=n=>console&&typeof console.warn=="function"&&void 0,Ze=(n,e,t)=>{const s={};return t.filter(a=>Array.isArray(a[n])?!0:(typeof a[n]<"u"&&qn(`Helmet: ${n} should be of type "Array". Instead found type "${typeof a[n]}"`),!1)).map(a=>a[n]).reverse().reduce((a,i)=>{const o={};i.filter(c=>{let d;const u=Object.keys(c);for(let m=0;m<u.length;m+=1){const g=u[m],v=g.toLowerCase();e.indexOf(v)!==-1&&!(d==="rel"&&c[d].toLowerCase()==="canonical")&&!(v==="rel"&&c[v].toLowerCase()==="stylesheet")&&(d=v),e.indexOf(g)!==-1&&(g==="innerHTML"||g==="cssText"||g==="itemprop")&&(d=g)}if(!d||!c[d])return!1;const h=c[d].toLowerCase();return s[d]||(s[d]={}),o[d]||(o[d]={}),s[d][h]?!1:(o[d][h]=!0,!0)}).reverse().forEach(c=>a.push(c));const l=Object.keys(o);for(let c=0;c<l.length;c+=1){const d=l[c],u={...s[d],...o[d]};s[d]=u}return a},[]).reverse()},Vn=(n,e)=>{if(Array.isArray(n)&&n.length){for(let t=0;t<n.length;t+=1)if(n[t][e])return!0}return!1},Hn=n=>({baseTag:Wn(["href"],n),bodyAttributes:Dt("bodyAttributes",n),defer:Ve(n,qe.DEFER),encode:Ve(n,qe.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Dt("htmlAttributes",n),linkTags:Ze("link",["rel","href"],n),metaTags:Ze("meta",["name","charset","http-equiv","property","itemprop"],n),noscriptTags:Ze("noscript",["innerHTML"],n),onChangeClientState:Fn(n),scriptTags:Ze("script",["src","innerHTML"],n),styleTags:Ze("style",["cssText"],n),title:Bn(n),titleAttributes:Dt("titleAttributes",n),prioritizeSeoTags:Vn(n,qe.PRIORITIZE_SEO_TAGS)}),yr=n=>Array.isArray(n)?n.join(""):n,Jn=(n,e)=>{const t=Object.keys(n);for(let s=0;s<t.length;s+=1)if(e[t[s]]&&e[t[s]].includes(n[t[s]]))return!0;return!1},Ut=(n,e)=>Array.isArray(n)?n.reduce((t,s)=>(Jn(s,e)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:n,priority:[]},Bs=(n,e)=>({...n,[e]:void 0}),Gn=["noscript","script","style"],es=(n,e=!0)=>e===!1?String(n):String(n).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;"),vr=n=>Object.keys(n).reduce((e,t)=>{const s=typeof n[t]<"u"?`${t}="${n[t]}"`:`${t}`;return e?`${e} ${s}`:s},""),Kn=(n,e,t,s)=>{const a=vr(t),i=yr(e);return a?`<${n} ${ae}="true" ${a}>${es(i,s)}</${n}>`:`<${n} ${ae}="true">${es(i,s)}</${n}>`},Xn=(n,e,t=!0)=>e.reduce((s,a)=>{const i=a,o=Object.keys(i).filter(d=>!(d==="innerHTML"||d==="cssText")).reduce((d,u)=>{const h=typeof i[u]>"u"?u:`${u}="${es(i[u],t)}"`;return d?`${d} ${h}`:h},""),l=i.innerHTML||i.cssText||"",c=Gn.indexOf(n)===-1;return`${s}<${n} ${ae}="true" ${o}${c?"/>":`>${l}</${n}>`}`},""),br=(n,e={})=>Object.keys(n).reduce((t,s)=>{const a=ys[s];return t[a||s]=n[s],t},e),Qn=(n,e,t)=>{const s={key:e,[ae]:!0},a=br(t,s);return[pe.createElement("title",a,e)]},bt=(n,e)=>e.map((t,s)=>{const a={key:s,[ae]:!0};return Object.keys(t).forEach(i=>{const l=ys[i]||i;if(l==="innerHTML"||l==="cssText"){const c=t.innerHTML||t.cssText;a.dangerouslySetInnerHTML={__html:c}}else a[l]=t[i]}),pe.createElement(n,a)}),ee=(n,e,t=!0)=>{switch(n){case"title":return{toComponent:()=>Qn(n,e.title,e.titleAttributes),toString:()=>Kn(n,e.title,e.titleAttributes,t)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>br(e),toString:()=>vr(e)};default:return{toComponent:()=>bt(n,e),toString:()=>Xn(n,e,t)}}},Yn=({metaTags:n,linkTags:e,scriptTags:t,encode:s})=>{const a=Ut(n,Lt.meta),i=Ut(e,Lt.link),o=Ut(t,Lt.script);return{priorityMethods:{toComponent:()=>[...bt("meta",a.priority),...bt("link",i.priority),...bt("script",o.priority)],toString:()=>`${ee("meta",a.priority,s)} ${ee("link",i.priority,s)} ${ee("script",o.priority,s)}`},metaTags:a.default,linkTags:i.default,scriptTags:o.default}},Zn=n=>{const{baseTag:e,bodyAttributes:t,encode:s=!0,htmlAttributes:a,noscriptTags:i,styleTags:o,title:l="",titleAttributes:c,prioritizeSeoTags:d}=n;let{linkTags:u,metaTags:h,scriptTags:m}=n,g={toComponent:()=>{},toString:()=>""};return d&&({priorityMethods:g,linkTags:u,metaTags:h,scriptTags:m}=Yn(n)),{priority:g,base:ee("base",e,s),bodyAttributes:ee("bodyAttributes",t,s),htmlAttributes:ee("htmlAttributes",a,s),link:ee("link",u,s),meta:ee("meta",h,s),noscript:ee("noscript",i,s),script:ee("script",m,s),style:ee("style",o,s),title:ee("title",{title:l,titleAttributes:c},s)}},ts=Zn,ft=[],wr=!!(typeof window<"u"&&window.document&&window.document.createElement),ss=class{constructor(n,e){ue(this,"instances",[]);ue(this,"canUseDOM",wr);ue(this,"context");ue(this,"value",{setHelmet:n=>{this.context.helmet=n},helmetInstances:{get:()=>this.canUseDOM?ft:this.instances,add:n=>{(this.canUseDOM?ft:this.instances).push(n)},remove:n=>{const e=(this.canUseDOM?ft:this.instances).indexOf(n);(this.canUseDOM?ft:this.instances).splice(e,1)}}});this.context=n,this.canUseDOM=e||!1,e||(n.helmet=ts({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ea={},_r=pe.createContext(ea),Ae,jr=(Ae=class extends f.Component{constructor(t){super(t);ue(this,"helmetData");this.helmetData=new ss(this.props.context||{},Ae.canUseDOM)}render(){return pe.createElement(_r.Provider,{value:this.helmetData.value},this.props.children)}},ue(Ae,"canUseDOM",wr),Ae),Re=(n,e)=>{const t=document.head||document.querySelector("head"),s=t.querySelectorAll(`${n}[${ae}]`),a=[].slice.call(s),i=[];let o;return e&&e.length&&e.forEach(l=>{const c=document.createElement(n);for(const d in l)if(Object.prototype.hasOwnProperty.call(l,d))if(d==="innerHTML")c.innerHTML=l.innerHTML;else if(d==="cssText")c.styleSheet?c.styleSheet.cssText=l.cssText:c.appendChild(document.createTextNode(l.cssText));else{const u=d,h=typeof l[u]>"u"?"":l[u];c.setAttribute(d,h)}c.setAttribute(ae,"true"),a.some((d,u)=>(o=u,c.isEqualNode(d)))?a.splice(o,1):i.push(c)}),a.forEach(l=>{var c;return(c=l.parentNode)==null?void 0:c.removeChild(l)}),i.forEach(l=>t.appendChild(l)),{oldTags:a,newTags:i}},rs=(n,e)=>{const t=document.getElementsByTagName(n)[0];if(!t)return;const s=t.getAttribute(ae),a=s?s.split(","):[],i=[...a],o=Object.keys(e);for(const l of o){const c=e[l]||"";t.getAttribute(l)!==c&&t.setAttribute(l,c),a.indexOf(l)===-1&&a.push(l);const d=i.indexOf(l);d!==-1&&i.splice(d,1)}for(let l=i.length-1;l>=0;l-=1)t.removeAttribute(i[l]);a.length===i.length?t.removeAttribute(ae):t.getAttribute(ae)!==o.join(",")&&t.setAttribute(ae,o.join(","))},ta=(n,e)=>{typeof n<"u"&&document.title!==n&&(document.title=yr(n)),rs("title",e)},Fs=(n,e)=>{const{baseTag:t,bodyAttributes:s,htmlAttributes:a,linkTags:i,metaTags:o,noscriptTags:l,onChangeClientState:c,scriptTags:d,styleTags:u,title:h,titleAttributes:m}=n;rs("body",s),rs("html",a),ta(h,m);const g={baseTag:Re("base",t),linkTags:Re("link",i),metaTags:Re("meta",o),noscriptTags:Re("noscript",l),scriptTags:Re("script",d),styleTags:Re("style",u)},v={},_={};Object.keys(g).forEach(w=>{const{newTags:N,oldTags:A}=g[w];N.length&&(v[w]=N),A.length&&(_[w]=g[w].oldTags)}),e&&e(),c(n,v,_)},et=null,sa=n=>{et&&cancelAnimationFrame(et),n.defer?et=requestAnimationFrame(()=>{Fs(n,()=>{et=null})}):(Fs(n),et=null)},ra=sa,Ws=class extends f.Component{constructor(){super(...arguments);ue(this,"rendered",!1)}shouldComponentUpdate(e){return!zn(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:t}=this.props.context;let s=null;const a=Hn(e.get().map(i=>{const o={...i.props};return delete o.context,o}));jr.canUseDOM?ra(a):ts&&(s=ts(a)),t(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},Yt,na=(Yt=class extends f.Component{shouldComponentUpdate(n){return!$n(Bs(this.props,"helmetData"),Bs(n,"helmetData"))}mapNestedChildrenToProps(n,e){if(!e)return null;switch(n.type){case"script":case"noscript":return{innerHTML:e};case"style":return{cssText:e};default:throw new Error(`<${n.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(n,e,t,s){return{...e,[n.type]:[...e[n.type]||[],{...t,...this.mapNestedChildrenToProps(n,s)}]}}mapObjectTypeChildren(n,e,t,s){switch(n.type){case"title":return{...e,[n.type]:s,titleAttributes:{...t}};case"body":return{...e,bodyAttributes:{...t}};case"html":return{...e,htmlAttributes:{...t}};default:return{...e,[n.type]:{...t}}}}mapArrayTypeChildrenToProps(n,e){let t={...e};return Object.keys(n).forEach(s=>{t={...t,[s]:n[s]}}),t}warnOnInvalidChildren(n,e){return zs(Ms.some(t=>n.type===t),typeof n.type=="function"?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${Ms.join(", ")} are allowed. Helmet does not support rendering <${n.type}> elements. Refer to our API for more information.`),zs(!e||typeof e=="string"||Array.isArray(e)&&!e.some(t=>typeof t!="string"),`Helmet expects a string as a child of <${n.type}>. Did you forget to wrap your children in braces? ( <${n.type}>{\`\`}</${n.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(n,e){let t={};return pe.Children.forEach(n,s=>{if(!s||!s.props)return;const{children:a,...i}=s.props,o=Object.keys(i).reduce((c,d)=>(c[Mn[d]||d]=i[d],c),{});let{type:l}=s;switch(typeof l=="symbol"?l=l.toString():this.warnOnInvalidChildren(s,a),l){case"Symbol(react.fragment)":e=this.mapChildrenToProps(a,e);break;case"link":case"meta":case"noscript":case"script":case"style":t=this.flattenArrayTypeChildren(s,t,o,a);break;default:e=this.mapObjectTypeChildren(s,e,o,a);break}}),this.mapArrayTypeChildrenToProps(t,e)}render(){const{children:n,...e}=this.props;let t={...e},{helmetData:s}=e;if(n&&(t=this.mapChildrenToProps(n,t)),s&&!(s instanceof ss)){const a=s;s=new ss(a.context,!0),delete t.helmetData}return s?pe.createElement(Ws,{...t,context:s.value}):pe.createElement(_r.Consumer,null,a=>pe.createElement(Ws,{...t,context:a}))}},ue(Yt,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),Yt);const aa="modulepreload",ia=function(n){return"/"+n},qs={},R=function(e,t,s){let a=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));a=Promise.allSettled(t.map(c=>{if(c=ia(c),c in qs)return;qs[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":aa,d||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),d)return new Promise((m,g)=>{h.addEventListener("load",m),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return a.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return e().catch(i)})};function oa(){const{pathname:n}=Ce();return f.useEffect(()=>{window.scrollTo(0,0)},[n]),null}function kr({isOpen:n,onClose:e,children:t,title:s}){return f.useEffect(()=>{n?document.body.style.overflow="hidden":document.body.style.overflow="";const a=i=>{i.key==="Escape"&&e()};return n&&document.addEventListener("keydown",a),()=>{document.body.style.overflow="",document.removeEventListener("keydown",a)}},[n,e]),n?r.jsxs("div",{className:"fixed inset-0 z-[9999]",children:[r.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-[9999]",onClick:e}),r.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 z-[10000]",children:r.jsxs("div",{className:"bg-[var(--surface)] rounded-2xl w-full max-w-md mx-auto border border-[var(--border)] shadow-xl relative z-[10001]",children:[s&&r.jsxs("div",{className:"flex items-center justify-between p-6 pb-4",children:[r.jsx("h2",{className:"text-xl font-bold text-[var(--text)]",style:{fontFamily:"KaioBold, sans-serif"},children:s}),r.jsx("button",{onClick:e,className:"p-1 text-[var(--muted)] hover:text-[var(--text)] hover:bg-[var(--hover)] rounded-full transition-all duration-200","aria-label":"Close modal",children:r.jsx(kt,{size:20})})]}),r.jsx("div",{className:"p-6 pt-0",children:t})]})})]}):null}function la({isOpen:n,onClose:e,onTwitterSignIn:t,onXOAuth2SignIn:s,onGoogleSignIn:a,isLoading:i=!1}){const o=async()=>{try{await a()}catch{}};return r.jsx(kr,{isOpen:n,onClose:e,title:"Login to Post2x",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"w-full h-48 mb-4 overflow-hidden rounded-xl bg-gray-100",children:r.jsx("img",{src:"/auth_banner.webp",alt:"Post2X Banner",className:"w-full h-full object-cover object-top"})}),r.jsx("div",{className:"text-center mb-6",children:r.jsxs("p",{className:"text-[var(--foreground)] text-sm",children:["Get 100 free credits and join the full",r.jsx("br",{className:"sm:hidden"})," creator ecosystem."]})}),r.jsxs("button",{onClick:o,disabled:i,className:"w-full flex items-center justify-center gap-3 px-6 py-3 bg-black text-white rounded-xl font-medium hover:bg-gray-800 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:[r.jsx("div",{className:"bg-white rounded-full p-0.5",children:r.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",children:[r.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),r.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),r.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),r.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]})}),r.jsx("span",{children:"Login with Google"})]}),r.jsx("p",{className:"text-center text-[10px] font-bold text-gray-400 tracking-widest uppercase",children:"Secure OAuth 2.0"}),i&&r.jsxs("div",{className:"text-center py-2",children:[r.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-[var(--accent)] mx-auto"}),r.jsx("p",{className:"text-xs text-[var(--muted)] mt-2",children:"Logging you in..."})]})]})})}const ca=n=>{let e;return n?e=n:typeof fetch>"u"?e=(...t)=>R(async()=>{const{default:s}=await Promise.resolve().then(()=>Ge);return{default:s}},void 0).then(({default:s})=>s(...t)):e=fetch,(...t)=>e(...t)};class vs extends Error{constructor(e,t="FunctionsError",s){super(e),this.name=t,this.context=s}}class da extends vs{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Vs extends vs{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Hs extends vs{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var ns;(function(n){n.Any="any",n.ApNortheast1="ap-northeast-1",n.ApNortheast2="ap-northeast-2",n.ApSouth1="ap-south-1",n.ApSoutheast1="ap-southeast-1",n.ApSoutheast2="ap-southeast-2",n.CaCentral1="ca-central-1",n.EuCentral1="eu-central-1",n.EuWest1="eu-west-1",n.EuWest2="eu-west-2",n.EuWest3="eu-west-3",n.SaEast1="sa-east-1",n.UsEast1="us-east-1",n.UsWest1="us-west-1",n.UsWest2="us-west-2"})(ns||(ns={}));var ua=function(n,e,t,s){function a(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(n,e||[])).next())})};class ha{constructor(e,{headers:t={},customFetch:s,region:a=ns.Any}={}){this.url=e,this.headers=t,this.region=a,this.fetch=ca(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var s;return ua(this,void 0,void 0,function*(){try{const{headers:a,method:i,body:o}=t;let l={},{region:c}=t;c||(c=this.region);const d=new URL(`${this.url}/${e}`);c&&c!=="any"&&(l["x-region"]=c,d.searchParams.set("forceFunctionRegion",c));let u;o&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)&&(typeof Blob<"u"&&o instanceof Blob||o instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",u=o):typeof o=="string"?(l["Content-Type"]="text/plain",u=o):typeof FormData<"u"&&o instanceof FormData?u=o:(l["Content-Type"]="application/json",u=JSON.stringify(o)));const h=yield this.fetch(d.toString(),{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),a),body:u}).catch(_=>{throw new da(_)}),m=h.headers.get("x-relay-error");if(m&&m==="true")throw new Vs(h);if(!h.ok)throw new Hs(h);let g=((s=h.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),v;return g==="application/json"?v=yield h.json():g==="application/octet-stream"?v=yield h.blob():g==="text/event-stream"?v=h:g==="multipart/form-data"?v=yield h.formData():v=yield h.text(),{data:v,error:null,response:h}}catch(a){return{data:null,error:a,response:a instanceof Hs||a instanceof Vs?a.context:void 0}}})}}var Z={},bs={},St={},ct={},Tt={},Et={},fa=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},He=fa();const ma=He.fetch,Nr=He.fetch.bind(He),Sr=He.Headers,pa=He.Request,ga=He.Response,Ge=Object.freeze(Object.defineProperty({__proto__:null,Headers:Sr,Request:pa,Response:ga,default:Nr,fetch:ma},Symbol.toStringTag,{value:"Module"})),xa=rn(Ge);var Pt={};Object.defineProperty(Pt,"__esModule",{value:!0});let ya=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};Pt.default=ya;var Tr=te&&te.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Et,"__esModule",{value:!0});const va=Tr(xa),ba=Tr(Pt);let wa=class{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:typeof fetch>"u"?this.fetch=va.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Object.assign({},this.headers),this.headers[e]=t,this}then(e,t){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["Content-Type"]="application/json");const s=this.fetch;let a=s(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var o,l,c;let d=null,u=null,h=null,m=i.status,g=i.statusText;if(i.ok){if(this.method!=="HEAD"){const N=await i.text();N===""||(this.headers.Accept==="text/csv"||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?u=N:u=JSON.parse(N))}const _=(o=this.headers.Prefer)===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),w=(l=i.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");_&&w&&w.length>1&&(h=parseInt(w[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(u)&&(u.length>1?(d={code:"PGRST116",details:`Results contain ${u.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},u=null,h=null,m=406,g="Not Acceptable"):u.length===1?u=u[0]:u=null)}else{const _=await i.text();try{d=JSON.parse(_),Array.isArray(d)&&i.status===404&&(u=[],d=null,m=200,g="OK")}catch{i.status===404&&_===""?(m=204,g="No Content"):d={message:_}}if(d&&this.isMaybeSingle&&(!((c=d==null?void 0:d.details)===null||c===void 0)&&c.includes("0 rows"))&&(d=null,m=200,g="OK"),d&&this.shouldThrowOnError)throw new ba.default(d)}return{error:d,data:u,count:h,status:m,statusText:g}});return this.shouldThrowOnError||(a=a.catch(i=>{var o,l,c;return{error:{message:`${(o=i==null?void 0:i.name)!==null&&o!==void 0?o:"FetchError"}: ${i==null?void 0:i.message}`,details:`${(l=i==null?void 0:i.stack)!==null&&l!==void 0?l:""}`,hint:"",code:`${(c=i==null?void 0:i.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),a.then(e,t)}returns(){return this}overrideTypes(){return this}};Et.default=wa;var _a=te&&te.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Tt,"__esModule",{value:!0});const ja=_a(Et);let ka=class extends ja.default{select(e){let t=!1;const s=(e??"*").split("").map(a=>/\s/.test(a)&&!t?"":(a==='"'&&(t=!t),a)).join("");return this.url.searchParams.set("select",s),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:t=!0,nullsFirst:s,foreignTable:a,referencedTable:i=a}={}){const o=i?`${i}.order`:"order",l=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:s=t}={}){const a=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(a,`${e}`),this}range(e,t,{foreignTable:s,referencedTable:a=s}={}){const i=typeof a>"u"?"offset":`${a}.offset`,o=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(o,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return this.method==="GET"?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:t=!1,settings:s=!1,buffers:a=!1,wal:i=!1,format:o="text"}={}){var l;const c=[e?"analyze":null,t?"verbose":null,s?"settings":null,a?"buffers":null,i?"wal":null].filter(Boolean).join("|"),d=(l=this.headers.Accept)!==null&&l!==void 0?l:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${o}; for="${d}"; options=${c};`,o==="json"?this:this}rollback(){var e;return((e=this.headers.Prefer)!==null&&e!==void 0?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}};Tt.default=ka;var Na=te&&te.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(ct,"__esModule",{value:!0});const Sa=Na(Tt);let Ta=class extends Sa.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){const s=Array.from(new Set(t)).map(a=>typeof a=="string"&&new RegExp("[,()]").test(a)?`"${a}"`:`${a}`).join(",");return this.url.searchParams.append(e,`in.(${s})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:s,type:a}={}){let i="";a==="plain"?i="pl":a==="phrase"?i="ph":a==="websearch"&&(i="w");const o=s===void 0?"":`(${s})`;return this.url.searchParams.append(e,`${i}fts${o}.${t}`),this}match(e){return Object.entries(e).forEach(([t,s])=>{this.url.searchParams.append(t,`eq.${s}`)}),this}not(e,t,s){return this.url.searchParams.append(e,`not.${t}.${s}`),this}or(e,{foreignTable:t,referencedTable:s=t}={}){const a=s?`${s}.or`:"or";return this.url.searchParams.append(a,`(${e})`),this}filter(e,t,s){return this.url.searchParams.append(e,`${t}.${s}`),this}};ct.default=Ta;var Ea=te&&te.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(St,"__esModule",{value:!0});const tt=Ea(ct);let Pa=class{constructor(e,{headers:t={},schema:s,fetch:a}){this.url=e,this.headers=t,this.schema=s,this.fetch=a}select(e,{head:t=!1,count:s}={}){const a=t?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(l=>/\s/.test(l)&&!i?"":(l==='"'&&(i=!i),l)).join("");return this.url.searchParams.set("select",o),s&&(this.headers.Prefer=`count=${s}`),new tt.default({method:a,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:t,defaultToNull:s=!0}={}){const a="POST",i=[];if(this.headers.Prefer&&i.push(this.headers.Prefer),t&&i.push(`count=${t}`),s||i.push("missing=default"),this.headers.Prefer=i.join(","),Array.isArray(e)){const o=e.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);this.url.searchParams.set("columns",l.join(","))}}return new tt.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:t,ignoreDuplicates:s=!1,count:a,defaultToNull:i=!0}={}){const o="POST",l=[`resolution=${s?"ignore":"merge"}-duplicates`];if(t!==void 0&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&l.push(this.headers.Prefer),a&&l.push(`count=${a}`),i||l.push("missing=default"),this.headers.Prefer=l.join(","),Array.isArray(e)){const c=e.reduce((d,u)=>d.concat(Object.keys(u)),[]);if(c.length>0){const d=[...new Set(c)].map(u=>`"${u}"`);this.url.searchParams.set("columns",d.join(","))}}return new tt.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:t}={}){const s="PATCH",a=[];return this.headers.Prefer&&a.push(this.headers.Prefer),t&&a.push(`count=${t}`),this.headers.Prefer=a.join(","),new tt.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){const t="DELETE",s=[];return e&&s.push(`count=${e}`),this.headers.Prefer&&s.unshift(this.headers.Prefer),this.headers.Prefer=s.join(","),new tt.default({method:t,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}};St.default=Pa;var At={},Ct={};Object.defineProperty(Ct,"__esModule",{value:!0});Ct.version=void 0;Ct.version="0.0.0-automated";Object.defineProperty(At,"__esModule",{value:!0});At.DEFAULT_HEADERS=void 0;const Aa=Ct;At.DEFAULT_HEADERS={"X-Client-Info":`postgrest-js/${Aa.version}`};var Er=te&&te.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(bs,"__esModule",{value:!0});const Ca=Er(St),Oa=Er(ct),Ia=At;let Ra=class Pr{constructor(e,{headers:t={},schema:s,fetch:a}={}){this.url=e,this.headers=Object.assign(Object.assign({},Ia.DEFAULT_HEADERS),t),this.schemaName=s,this.fetch=a}from(e){const t=new URL(`${this.url}/${e}`);return new Ca.default(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new Pr(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:s=!1,get:a=!1,count:i}={}){let o;const l=new URL(`${this.url}/rpc/${e}`);let c;s||a?(o=s?"HEAD":"GET",Object.entries(t).filter(([u,h])=>h!==void 0).map(([u,h])=>[u,Array.isArray(h)?`{${h.join(",")}}`:`${h}`]).forEach(([u,h])=>{l.searchParams.append(u,h)})):(o="POST",c=t);const d=Object.assign({},this.headers);return i&&(d.Prefer=`count=${i}`),new Oa.default({method:o,url:l,headers:d,schema:this.schemaName,body:c,fetch:this.fetch,allowEmpty:!1})}};bs.default=Ra;var Ke=te&&te.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Z,"__esModule",{value:!0});Z.PostgrestError=Z.PostgrestBuilder=Z.PostgrestTransformBuilder=Z.PostgrestFilterBuilder=Z.PostgrestQueryBuilder=Z.PostgrestClient=void 0;const Ar=Ke(bs);Z.PostgrestClient=Ar.default;const Cr=Ke(St);Z.PostgrestQueryBuilder=Cr.default;const Or=Ke(ct);Z.PostgrestFilterBuilder=Or.default;const Ir=Ke(Tt);Z.PostgrestTransformBuilder=Ir.default;const Rr=Ke(Et);Z.PostgrestBuilder=Rr.default;const $r=Ke(Pt);Z.PostgrestError=$r.default;var $a=Z.default={PostgrestClient:Ar.default,PostgrestQueryBuilder:Cr.default,PostgrestFilterBuilder:Or.default,PostgrestTransformBuilder:Ir.default,PostgrestBuilder:Rr.default,PostgrestError:$r.default};const{PostgrestClient:La,PostgrestQueryBuilder:Kl,PostgrestFilterBuilder:Xl,PostgrestTransformBuilder:Ql,PostgrestBuilder:Yl,PostgrestError:Zl}=$a;class Da{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"&&process.versions&&process.versions.node){const t=parseInt(process.versions.node.split(".")[0]);return t>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${t} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${t} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
import ws from "ws"
new RealtimeClient(url, { transport: ws })`}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=`

Suggested solution: ${e.workaround}`),new Error(t)}static createWebSocket(e,t){const s=this.getWebSocketConstructor();return new s(e,t)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const Ua="2.15.1",za=`realtime-js/${Ua}`,Ma="1.0.0",as=1e4,Ba=1e3,Fa=100;var at;(function(n){n[n.connecting=0]="connecting",n[n.open=1]="open",n[n.closing=2]="closing",n[n.closed=3]="closed"})(at||(at={}));var J;(function(n){n.closed="closed",n.errored="errored",n.joined="joined",n.joining="joining",n.leaving="leaving"})(J||(J={}));var ne;(function(n){n.close="phx_close",n.error="phx_error",n.join="phx_join",n.reply="phx_reply",n.leave="phx_leave",n.access_token="access_token"})(ne||(ne={}));var is;(function(n){n.websocket="websocket"})(is||(is={}));var Pe;(function(n){n.Connecting="connecting",n.Open="open",n.Closing="closing",n.Closed="closed"})(Pe||(Pe={}));class Wa{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),s=new TextDecoder;return this._decodeBroadcast(e,t,s)}_decodeBroadcast(e,t,s){const a=t.getUint8(1),i=t.getUint8(2);let o=this.HEADER_LENGTH+2;const l=s.decode(e.slice(o,o+a));o=o+a;const c=s.decode(e.slice(o,o+i));o=o+i;const d=JSON.parse(s.decode(e.slice(o,e.byteLength)));return{ref:null,topic:l,event:c,payload:d}}}class Lr{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var F;(function(n){n.abstime="abstime",n.bool="bool",n.date="date",n.daterange="daterange",n.float4="float4",n.float8="float8",n.int2="int2",n.int4="int4",n.int4range="int4range",n.int8="int8",n.int8range="int8range",n.json="json",n.jsonb="jsonb",n.money="money",n.numeric="numeric",n.oid="oid",n.reltime="reltime",n.text="text",n.time="time",n.timestamp="timestamp",n.timestamptz="timestamptz",n.timetz="timetz",n.tsrange="tsrange",n.tstzrange="tstzrange"})(F||(F={}));const Js=(n,e,t={})=>{var s;const a=(s=t.skipTypes)!==null&&s!==void 0?s:[];return Object.keys(e).reduce((i,o)=>(i[o]=qa(o,n,e,a),i),{})},qa=(n,e,t,s)=>{const a=e.find(l=>l.name===n),i=a==null?void 0:a.type,o=t[n];return i&&!s.includes(i)?Dr(i,o):os(o)},Dr=(n,e)=>{if(n.charAt(0)==="_"){const t=n.slice(1,n.length);return Ga(e,t)}switch(n){case F.bool:return Va(e);case F.float4:case F.float8:case F.int2:case F.int4:case F.int8:case F.numeric:case F.oid:return Ha(e);case F.json:case F.jsonb:return Ja(e);case F.timestamp:return Ka(e);case F.abstime:case F.date:case F.daterange:case F.int4range:case F.int8range:case F.money:case F.reltime:case F.text:case F.time:case F.timestamptz:case F.timetz:case F.tsrange:case F.tstzrange:return os(e);default:return os(e)}},os=n=>n,Va=n=>{switch(n){case"t":return!0;case"f":return!1;default:return n}},Ha=n=>{if(typeof n=="string"){const e=parseFloat(n);if(!Number.isNaN(e))return e}return n},Ja=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},Ga=(n,e)=>{if(typeof n!="string")return n;const t=n.length-1,s=n[t];if(n[0]==="{"&&s==="}"){let i;const o=n.slice(1,t);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(l=>Dr(e,l))}return n},Ka=n=>typeof n=="string"?n.replace(" ","T"):n,Ur=n=>{let e=n;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"};class zt{constructor(e,t,s={},a=as){this.channel=e,this.event=t,this.payload=s,this.timeout=a,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var s;return this._hasReceived(e)&&t((s=this.receivedResp)===null||s===void 0?void 0:s.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=t=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=t,this._matchReceive(t)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Gs;(function(n){n.SYNC="sync",n.JOIN="join",n.LEAVE="leave"})(Gs||(Gs={}));class it{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(t==null?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},a=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=it.syncState(this.state,a,i,o),this.pendingDiffs.forEach(c=>{this.state=it.syncDiff(this.state,c,i,o)}),this.pendingDiffs=[],l()}),this.channel._on(s.diff,{},a=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(a):(this.state=it.syncDiff(this.state,a,i,o),l())}),this.onJoin((a,i,o)=>{this.channel._trigger("presence",{event:"join",key:a,currentPresences:i,newPresences:o})}),this.onLeave((a,i,o)=>{this.channel._trigger("presence",{event:"leave",key:a,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,s,a){const i=this.cloneDeep(e),o=this.transformState(t),l={},c={};return this.map(i,(d,u)=>{o[d]||(c[d]=u)}),this.map(o,(d,u)=>{const h=i[d];if(h){const m=u.map(w=>w.presence_ref),g=h.map(w=>w.presence_ref),v=u.filter(w=>g.indexOf(w.presence_ref)<0),_=h.filter(w=>m.indexOf(w.presence_ref)<0);v.length>0&&(l[d]=v),_.length>0&&(c[d]=_)}else l[d]=u}),this.syncDiff(i,{joins:l,leaves:c},s,a)}static syncDiff(e,t,s,a){const{joins:i,leaves:o}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return s||(s=()=>{}),a||(a=()=>{}),this.map(i,(l,c)=>{var d;const u=(d=e[l])!==null&&d!==void 0?d:[];if(e[l]=this.cloneDeep(c),u.length>0){const h=e[l].map(g=>g.presence_ref),m=u.filter(g=>h.indexOf(g.presence_ref)<0);e[l].unshift(...m)}s(l,u,c)}),this.map(o,(l,c)=>{let d=e[l];if(!d)return;const u=c.map(h=>h.presence_ref);d=d.filter(h=>u.indexOf(h.presence_ref)<0),e[l]=d,a(l,d,c),d.length===0&&delete e[l]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(s=>t(s,e[s]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((t,s)=>{const a=e[s];return"metas"in a?t[s]=a.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):t[s]=a,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Ks;(function(n){n.ALL="*",n.INSERT="INSERT",n.UPDATE="UPDATE",n.DELETE="DELETE"})(Ks||(Ks={}));var ot;(function(n){n.BROADCAST="broadcast",n.PRESENCE="presence",n.POSTGRES_CHANGES="postgres_changes",n.SYSTEM="system"})(ot||(ot={}));var me;(function(n){n.SUBSCRIBED="SUBSCRIBED",n.TIMED_OUT="TIMED_OUT",n.CLOSED="CLOSED",n.CHANNEL_ERROR="CHANNEL_ERROR"})(me||(me={}));class ws{constructor(e,t={config:{}},s){this.topic=e,this.params=t,this.socket=s,this.bindings={},this.state=J.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new zt(this,ne.join,this.params,this.timeout),this.rejoinTimer=new Lr(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=J.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(a=>a.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=J.closed,this.socket._remove(this)}),this._onError(a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=J.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=J.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=J.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ne.reply,{},(a,i)=>{this._trigger(this._replyEventName(i),a)}),this.presence=new it(this),this.broadcastEndpointURL=Ur(this.socket.endPoint),this.private=this.params.config.private||!1}subscribe(e,t=this.timeout){var s,a;if(this.socket.isConnected()||this.socket.connect(),this.state==J.closed){const{config:{broadcast:i,presence:o,private:l}}=this.params,c=(a=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(m=>m.filter))!==null&&a!==void 0?a:[],d=!!this.bindings[ot.PRESENCE]&&this.bindings[ot.PRESENCE].length>0,u={},h={broadcast:i,presence:Object.assign(Object.assign({},o),{enabled:d}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(u.access_token=this.socket.accessTokenValue),this._onError(m=>e==null?void 0:e(me.CHANNEL_ERROR,m)),this._onClose(()=>e==null?void 0:e(me.CLOSED)),this.updateJoinPayload(Object.assign({config:h},u)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:m})=>{var g;if(this.socket.setAuth(),m===void 0){e==null||e(me.SUBSCRIBED);return}else{const v=this.bindings.postgres_changes,_=(g=v==null?void 0:v.length)!==null&&g!==void 0?g:0,w=[];for(let N=0;N<_;N++){const A=v[N],{filter:{event:k,schema:j,table:x,filter:p}}=A,b=m&&m[N];if(b&&b.event===k&&b.schema===j&&b.table===x&&b.filter===p)w.push(Object.assign(Object.assign({},A),{id:b.id}));else{this.unsubscribe(),this.state=J.errored,e==null||e(me.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=w,e&&e(me.SUBSCRIBED);return}}).receive("error",m=>{this.state=J.errored,e==null||e(me.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(m).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(me.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,s){return this.state===J.joined&&e===ot.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,t,s)}async send(e,t={}){var s,a;if(!this._canPush()&&e.type==="broadcast"){const{event:i,payload:o}=e,c={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const d=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(s=t.timeout)!==null&&s!==void 0?s:this.timeout);return await((a=d.body)===null||a===void 0?void 0:a.cancel()),d.ok?"ok":"error"}catch(d){return d.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,l,c;const d=this._push(e.type,e,t.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(l=(o=this.params)===null||o===void 0?void 0:o.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),d.receive("ok",()=>i("ok")),d.receive("error",()=>i("error")),d.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=J.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ne.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(a=>{s=new zt(this,ne.leave,{},e),s.receive("ok",()=>{t(),a("ok")}).receive("timeout",()=>{t(),a("timed out")}).receive("error",()=>{a("error")}),s.send(),this._canPush()||s.trigger("ok",{})}).finally(()=>{s==null||s.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=J.closed,this.bindings={}}async _fetchWithTimeout(e,t,s){const a=new AbortController,i=setTimeout(()=>a.abort(),s),o=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:a.signal}));return clearTimeout(i),o}_push(e,t,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let a=new zt(this,e,t,s);return this._canPush()?a.send():this._addToPushBuffer(a),a}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Fa){const t=this.pushBuffer.shift();t&&(t.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${t.event}`,t.payload))}}_onMessage(e,t,s){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,s){var a,i;const o=e.toLocaleLowerCase(),{close:l,error:c,leave:d,join:u}=ne;if(s&&[l,c,d,u].indexOf(o)>=0&&s!==this._joinRef())return;let m=this._onMessage(o,t,s);if(t&&!m)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(a=this.bindings.postgres_changes)===null||a===void 0||a.filter(g=>{var v,_,w;return((v=g.filter)===null||v===void 0?void 0:v.event)==="*"||((w=(_=g.filter)===null||_===void 0?void 0:_.event)===null||w===void 0?void 0:w.toLocaleLowerCase())===o}).map(g=>g.callback(m,s)):(i=this.bindings[o])===null||i===void 0||i.filter(g=>{var v,_,w,N,A,k;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in g){const j=g.id,x=(v=g.filter)===null||v===void 0?void 0:v.event;return j&&((_=t.ids)===null||_===void 0?void 0:_.includes(j))&&(x==="*"||(x==null?void 0:x.toLocaleLowerCase())===((w=t.data)===null||w===void 0?void 0:w.type.toLocaleLowerCase()))}else{const j=(A=(N=g==null?void 0:g.filter)===null||N===void 0?void 0:N.event)===null||A===void 0?void 0:A.toLocaleLowerCase();return j==="*"||j===((k=t==null?void 0:t.event)===null||k===void 0?void 0:k.toLocaleLowerCase())}else return g.type.toLocaleLowerCase()===o}).map(g=>{if(typeof m=="object"&&"ids"in m){const v=m.data,{schema:_,table:w,commit_timestamp:N,type:A,errors:k}=v;m=Object.assign(Object.assign({},{schema:_,table:w,commit_timestamp:N,eventType:A,new:{},old:{},errors:k}),this._getPayloadRecords(v))}g.callback(m,s)})}_isClosed(){return this.state===J.closed}_isJoined(){return this.state===J.joined}_isJoining(){return this.state===J.joining}_isLeaving(){return this.state===J.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,s){const a=e.toLocaleLowerCase(),i={type:a,filter:t,callback:s};return this.bindings[a]?this.bindings[a].push(i):this.bindings[a]=[i],this}_off(e,t){const s=e.toLocaleLowerCase();return this.bindings[s]&&(this.bindings[s]=this.bindings[s].filter(a=>{var i;return!(((i=a.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===s&&ws.isEqual(a.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(ne.close,{},e)}_onError(e){this._on(ne.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=J.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=Js(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=Js(e.columns,e.old_record)),t}}const Xs=()=>{},mt={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Xa=[1e3,2e3,5e3,1e4],Qa=1e4,Ya=`
  addEventListener("message", (e) => {
    if (e.data.event === "start") {
      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
    }
  });`;class Za{constructor(e,t){var s;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=as,this.transport=null,this.heartbeatIntervalMs=mt.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Xs,this.ref=0,this.reconnectTimer=null,this.logger=Xs,this.conn=null,this.sendBuffer=[],this.serializer=new Wa,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=a=>{let i;return a?i=a:typeof fetch>"u"?i=(...o)=>R(async()=>{const{default:l}=await Promise.resolve().then(()=>Ge);return{default:l}},void 0).then(({default:l})=>l(...o)).catch(l=>{throw new Error(`Failed to load @supabase/node-fetch: ${l.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):i=fetch,(...o)=>i(...o)},!(!((s=t==null?void 0:t.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${is.websocket}`,this.httpEndpoint=Ur(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(t==null?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Da.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const t=e.message;throw t.includes("Node.js")?new Error(`${t}

To use Realtime in Node.js, you need to provide a WebSocket implementation:

Option 1: Use Node.js 22+ which has native WebSocket support
Option 2: Install and provide the "ws" package:

  npm install ws

  import ws from "ws"
  const client = new RealtimeClient(url, {
    ...options,
    transport: ws
  })`):new Error(`WebSocket not available: ${t}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:Ma}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const s=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(s),this._setConnectionState("disconnected")},e?this.conn.close(e,t??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map(t=>t.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,s){this.logger(e,t,s)}connectionState(){switch(this.conn&&this.conn.readyState){case at.connecting:return Pe.Connecting;case at.open:return Pe.Open;case at.closing:return Pe.Closing;default:return Pe.Closed}}isConnected(){return this.connectionState()===Pe.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,t={config:{}}){const s=`realtime:${e}`,a=this.getChannels().find(i=>i.topic===s);if(a)return a;{const i=new ws(`realtime:${e}`,t,this);return this.channels.push(i),i}}push(e){const{topic:t,event:s,payload:a,ref:i}=e,o=()=>{this.encode(e,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${t} ${s} (${i})`,a),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){this.heartbeatCallback("disconnected");return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.heartbeatCallback("timeout"),this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(Ba,"heartbeat timeout"),setTimeout(()=>{var t;this.isConnected()||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout()},mt.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatCallback("sent"),this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(s=>s.topic===e&&(s._isJoined()||s._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,t=>{t.topic==="phoenix"&&t.event==="phx_reply"&&this.heartbeatCallback(t.payload.status==="ok"?"ok":"error"),t.ref&&t.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:s,event:a,payload:i,ref:o}=t,l=o?`(${o})`:"",c=i.status||"";this.log("receive",`${c} ${s} ${a} ${l}`.trim(),i),this.channels.filter(d=>d._isMember(s)).forEach(d=>d._trigger(a,i,o)),this._triggerStateCallbacks("message",t)})}_clearTimer(e){var t;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((t=this.reconnectTimer)===null||t===void 0||t.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=t=>{this.log("worker","worker error",t.message),this.workerRef.terminate()},this.workerRef.onmessage=t=>{t.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(ne.error))}_appendParams(e,t){if(Object.keys(t).length===0)return e;const s=e.match(/\?/)?"&":"?",a=new URLSearchParams(t);return`${e}${s}${a}`}_workerObjectUrl(e){let t;if(e)t=e;else{const s=new Blob([Ya],{type:"application/javascript"});t=URL.createObjectURL(s)}return t}_setConnectionState(e,t=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t;e?t=e:this.accessToken?t=await this.accessToken():t=this.accessTokenValue,this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(s=>{const a={access_token:t,version:za};t&&s.updateJoinPayload(a),s.joinedOnce&&s._isJoined()&&s._push(ne.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(t=>{this.log("error",`error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(s=>{try{s(t)}catch(a){this.log("error",`error in ${e} callback`,a)}})}catch(s){this.log("error",`error triggering ${e} callbacks`,s)}}_setupReconnectionTimer(){this.reconnectTimer=new Lr(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},mt.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var t,s,a,i,o,l,c,d;if(this.transport=(t=e==null?void 0:e.transport)!==null&&t!==void 0?t:null,this.timeout=(s=e==null?void 0:e.timeout)!==null&&s!==void 0?s:as,this.heartbeatIntervalMs=(a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:mt.HEARTBEAT_INTERVAL,this.worker=(i=e==null?void 0:e.worker)!==null&&i!==void 0?i:!1,this.accessToken=(o=e==null?void 0:e.accessToken)!==null&&o!==void 0?o:null,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(l=e==null?void 0:e.reconnectAfterMs)!==null&&l!==void 0?l:u=>Xa[u-1]||Qa,this.encode=(c=e==null?void 0:e.encode)!==null&&c!==void 0?c:(u,h)=>h(JSON.stringify(u)),this.decode=(d=e==null?void 0:e.decode)!==null&&d!==void 0?d:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}class _s extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function G(n){return typeof n=="object"&&n!==null&&"__isStorageError"in n}class ei extends _s{constructor(e,t,s){super(e),this.name="StorageApiError",this.status=t,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class ls extends _s{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}var ti=function(n,e,t,s){function a(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(n,e||[])).next())})};const zr=n=>{let e;return n?e=n:typeof fetch>"u"?e=(...t)=>R(async()=>{const{default:s}=await Promise.resolve().then(()=>Ge);return{default:s}},void 0).then(({default:s})=>s(...t)):e=fetch,(...t)=>e(...t)},si=()=>ti(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield R(()=>Promise.resolve().then(()=>Ge),void 0)).Response:Response}),cs=n=>{if(Array.isArray(n))return n.map(t=>cs(t));if(typeof n=="function"||n!==Object(n))return n;const e={};return Object.entries(n).forEach(([t,s])=>{const a=t.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[a]=cs(s)}),e},ri=n=>{if(typeof n!="object"||n===null)return!1;const e=Object.getPrototypeOf(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)};var Oe=function(n,e,t,s){function a(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(n,e||[])).next())})};const Mt=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),ni=(n,e,t)=>Oe(void 0,void 0,void 0,function*(){const s=yield si();n instanceof s&&!(t!=null&&t.noResolveJson)?n.json().then(a=>{const i=n.status||500,o=(a==null?void 0:a.statusCode)||i+"";e(new ei(Mt(a),i,o))}).catch(a=>{e(new ls(Mt(a),a))}):e(new ls(Mt(n),n))}),ai=(n,e,t,s)=>{const a={method:n,headers:(e==null?void 0:e.headers)||{}};return n==="GET"||!s?a:(ri(s)?(a.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),a.body=JSON.stringify(s)):a.body=s,e!=null&&e.duplex&&(a.duplex=e.duplex),Object.assign(Object.assign({},a),t))};function dt(n,e,t,s,a,i){return Oe(this,void 0,void 0,function*(){return new Promise((o,l)=>{n(t,ai(e,s,a,i)).then(c=>{if(!c.ok)throw c;return s!=null&&s.noResolveJson?c:c.json()}).then(c=>o(c)).catch(c=>ni(c,l,s))})})}function _t(n,e,t,s){return Oe(this,void 0,void 0,function*(){return dt(n,"GET",e,t,s)})}function ce(n,e,t,s,a){return Oe(this,void 0,void 0,function*(){return dt(n,"POST",e,s,a,t)})}function ds(n,e,t,s,a){return Oe(this,void 0,void 0,function*(){return dt(n,"PUT",e,s,a,t)})}function ii(n,e,t,s){return Oe(this,void 0,void 0,function*(){return dt(n,"HEAD",e,Object.assign(Object.assign({},t),{noResolveJson:!0}),s)})}function Mr(n,e,t,s,a){return Oe(this,void 0,void 0,function*(){return dt(n,"DELETE",e,s,a,t)})}var Y=function(n,e,t,s){function a(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(n,e||[])).next())})};const oi={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Qs={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class li{constructor(e,t={},s,a){this.url=e,this.headers=t,this.bucketId=s,this.fetch=zr(a)}uploadOrUpdate(e,t,s,a){return Y(this,void 0,void 0,function*(){try{let i;const o=Object.assign(Object.assign({},Qs),a);let l=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;typeof Blob<"u"&&s instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",this.encodeMetadata(c)),i.append("",s)):typeof FormData<"u"&&s instanceof FormData?(i=s,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",this.encodeMetadata(c))):(i=s,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=this.toBase64(this.encodeMetadata(c)))),a!=null&&a.headers&&(l=Object.assign(Object.assign({},l),a.headers));const d=this._removeEmptyFolders(t),u=this._getFinalPath(d),h=yield(e=="PUT"?ds:ce)(this.fetch,`${this.url}/object/${u}`,i,Object.assign({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{data:{path:d,id:h.Id,fullPath:h.Key},error:null}}catch(i){if(G(i))return{data:null,error:i};throw i}})}upload(e,t,s){return Y(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,s)})}uploadToSignedUrl(e,t,s,a){return Y(this,void 0,void 0,function*(){const i=this._removeEmptyFolders(e),o=this._getFinalPath(i),l=new URL(this.url+`/object/upload/sign/${o}`);l.searchParams.set("token",t);try{let c;const d=Object.assign({upsert:Qs.upsert},a),u=Object.assign(Object.assign({},this.headers),{"x-upsert":String(d.upsert)});typeof Blob<"u"&&s instanceof Blob?(c=new FormData,c.append("cacheControl",d.cacheControl),c.append("",s)):typeof FormData<"u"&&s instanceof FormData?(c=s,c.append("cacheControl",d.cacheControl)):(c=s,u["cache-control"]=`max-age=${d.cacheControl}`,u["content-type"]=d.contentType);const h=yield ds(this.fetch,l.toString(),c,{headers:u});return{data:{path:i,fullPath:h.Key},error:null}}catch(c){if(G(c))return{data:null,error:c};throw c}})}createSignedUploadUrl(e,t){return Y(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e);const a=Object.assign({},this.headers);t!=null&&t.upsert&&(a["x-upsert"]="true");const i=yield ce(this.fetch,`${this.url}/object/upload/sign/${s}`,{},{headers:a}),o=new URL(this.url+i.url),l=o.searchParams.get("token");if(!l)throw new _s("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:l},error:null}}catch(s){if(G(s))return{data:null,error:s};throw s}})}update(e,t,s){return Y(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,s)})}move(e,t,s){return Y(this,void 0,void 0,function*(){try{return{data:yield ce(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers}),error:null}}catch(a){if(G(a))return{data:null,error:a};throw a}})}copy(e,t,s){return Y(this,void 0,void 0,function*(){try{return{data:{path:(yield ce(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers})).Key},error:null}}catch(a){if(G(a))return{data:null,error:a};throw a}})}createSignedUrl(e,t,s){return Y(this,void 0,void 0,function*(){try{let a=this._getFinalPath(e),i=yield ce(this.fetch,`${this.url}/object/sign/${a}`,Object.assign({expiresIn:t},s!=null&&s.transform?{transform:s.transform}:{}),{headers:this.headers});const o=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${o}`)},{data:i,error:null}}catch(a){if(G(a))return{data:null,error:a};throw a}})}createSignedUrls(e,t,s){return Y(this,void 0,void 0,function*(){try{const a=yield ce(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return{data:a.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${i}`):null})),error:null}}catch(a){if(G(a))return{data:null,error:a};throw a}})}download(e,t){return Y(this,void 0,void 0,function*(){const a=typeof(t==null?void 0:t.transform)<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString((t==null?void 0:t.transform)||{}),o=i?`?${i}`:"";try{const l=this._getFinalPath(e);return{data:yield(yield _t(this.fetch,`${this.url}/${a}/${l}${o}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(l){if(G(l))return{data:null,error:l};throw l}})}info(e){return Y(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{const s=yield _t(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:cs(s),error:null}}catch(s){if(G(s))return{data:null,error:s};throw s}})}exists(e){return Y(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{return yield ii(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(G(s)&&s instanceof ls){const a=s.originalError;if([400,404].includes(a==null?void 0:a.status))return{data:!1,error:s}}throw s}})}getPublicUrl(e,t){const s=this._getFinalPath(e),a=[],i=t!=null&&t.download?`download=${t.download===!0?"":t.download}`:"";i!==""&&a.push(i);const l=typeof(t==null?void 0:t.transform)<"u"?"render/image":"object",c=this.transformOptsToQueryString((t==null?void 0:t.transform)||{});c!==""&&a.push(c);let d=a.join("&");return d!==""&&(d=`?${d}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${s}${d}`)}}}remove(e){return Y(this,void 0,void 0,function*(){try{return{data:yield Mr(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(t){if(G(t))return{data:null,error:t};throw t}})}list(e,t,s){return Y(this,void 0,void 0,function*(){try{const a=Object.assign(Object.assign(Object.assign({},oi),t),{prefix:e||""});return{data:yield ce(this.fetch,`${this.url}/object/list/${this.bucketId}`,a,{headers:this.headers},s),error:null}}catch(a){if(G(a))return{data:null,error:a};throw a}})}listV2(e,t){return Y(this,void 0,void 0,function*(){try{const s=Object.assign({},e);return{data:yield ce(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,s,{headers:this.headers},t),error:null}}catch(s){if(G(s))return{data:null,error:s};throw s}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}const ci="2.11.0",di={"X-Client-Info":`storage-js/${ci}`};var $e=function(n,e,t,s){function a(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(n,e||[])).next())})};class ui{constructor(e,t={},s,a){const i=new URL(e);a!=null&&a.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href,this.headers=Object.assign(Object.assign({},di),t),this.fetch=zr(s)}listBuckets(){return $e(this,void 0,void 0,function*(){try{return{data:yield _t(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(G(e))return{data:null,error:e};throw e}})}getBucket(e){return $e(this,void 0,void 0,function*(){try{return{data:yield _t(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(t){if(G(t))return{data:null,error:t};throw t}})}createBucket(e,t={public:!1}){return $e(this,void 0,void 0,function*(){try{return{data:yield ce(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(G(s))return{data:null,error:s};throw s}})}updateBucket(e,t){return $e(this,void 0,void 0,function*(){try{return{data:yield ds(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(G(s))return{data:null,error:s};throw s}})}emptyBucket(e){return $e(this,void 0,void 0,function*(){try{return{data:yield ce(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(t){if(G(t))return{data:null,error:t};throw t}})}deleteBucket(e){return $e(this,void 0,void 0,function*(){try{return{data:yield Mr(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(t){if(G(t))return{data:null,error:t};throw t}})}}class hi extends ui{constructor(e,t={},s,a){super(e,t,s,a)}from(e){return new li(this.url,this.headers,e,this.fetch)}}const fi="2.55.0";let rt="";typeof Deno<"u"?rt="deno":typeof document<"u"?rt="web":typeof navigator<"u"&&navigator.product==="ReactNative"?rt="react-native":rt="node";const mi={"X-Client-Info":`supabase-js-${rt}/${fi}`},pi={headers:mi},gi={schema:"public"},xi={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},yi={};var vi=function(n,e,t,s){function a(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(n,e||[])).next())})};const bi=n=>{let e;return n?e=n:typeof fetch>"u"?e=Nr:e=fetch,(...t)=>e(...t)},wi=()=>typeof Headers>"u"?Sr:Headers,_i=(n,e,t)=>{const s=bi(t),a=wi();return(i,o)=>vi(void 0,void 0,void 0,function*(){var l;const c=(l=yield e())!==null&&l!==void 0?l:n;let d=new a(o==null?void 0:o.headers);return d.has("apikey")||d.set("apikey",n),d.has("Authorization")||d.set("Authorization",`Bearer ${c}`),s(i,Object.assign(Object.assign({},o),{headers:d}))})};var ji=function(n,e,t,s){function a(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(n,e||[])).next())})};function ki(n){return n.endsWith("/")?n:n+"/"}function Ni(n,e){var t,s;const{db:a,auth:i,realtime:o,global:l}=n,{db:c,auth:d,realtime:u,global:h}=e,m={db:Object.assign(Object.assign({},c),a),auth:Object.assign(Object.assign({},d),i),realtime:Object.assign(Object.assign({},u),o),storage:{},global:Object.assign(Object.assign(Object.assign({},h),l),{headers:Object.assign(Object.assign({},(t=h==null?void 0:h.headers)!==null&&t!==void 0?t:{}),(s=l==null?void 0:l.headers)!==null&&s!==void 0?s:{})}),accessToken:()=>ji(this,void 0,void 0,function*(){return""})};return n.accessToken?m.accessToken=n.accessToken:delete m.accessToken,m}const Br="2.71.1",Fe=30*1e3,us=3,Bt=us*Fe,Si="http://localhost:9999",Ti="supabase.auth.token",Ei={"X-Client-Info":`gotrue-js/${Br}`},hs="X-Supabase-Api-Version",Fr={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Pi=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Ai=10*60*1e3;class js extends Error{constructor(e,t,s){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=s}}function $(n){return typeof n=="object"&&n!==null&&"__isAuthError"in n}class Ci extends js{constructor(e,t,s){super(e,t,s),this.name="AuthApiError",this.status=t,this.code=s}}function Oi(n){return $(n)&&n.name==="AuthApiError"}class Wr extends js{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class we extends js{constructor(e,t,s,a){super(e,s,a),this.name=t,this.status=s}}class ye extends we{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Ii(n){return $(n)&&n.name==="AuthSessionMissingError"}class pt extends we{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class gt extends we{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class xt extends we{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function Ri(n){return $(n)&&n.name==="AuthImplicitGrantRedirectError"}class Ys extends we{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class fs extends we{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function Ft(n){return $(n)&&n.name==="AuthRetryableFetchError"}class Zs extends we{constructor(e,t,s){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=s}}class ms extends we{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const jt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),er=` 	
\r=`.split(""),$i=(()=>{const n=new Array(128);for(let e=0;e<n.length;e+=1)n[e]=-1;for(let e=0;e<er.length;e+=1)n[er[e].charCodeAt(0)]=-2;for(let e=0;e<jt.length;e+=1)n[jt[e].charCodeAt(0)]=e;return n})();function tr(n,e,t){if(n!==null)for(e.queue=e.queue<<8|n,e.queuedBits+=8;e.queuedBits>=6;){const s=e.queue>>e.queuedBits-6&63;t(jt[s]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const s=e.queue>>e.queuedBits-6&63;t(jt[s]),e.queuedBits-=6}}function qr(n,e,t){const s=$i[n];if(s>-1)for(e.queue=e.queue<<6|s,e.queuedBits+=6;e.queuedBits>=8;)t(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(n)}"`)}}function sr(n){const e=[],t=o=>{e.push(String.fromCodePoint(o))},s={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},i=o=>{Ui(o,s,t)};for(let o=0;o<n.length;o+=1)qr(n.charCodeAt(o),a,i);return e.join("")}function Li(n,e){if(n<=127){e(n);return}else if(n<=2047){e(192|n>>6),e(128|n&63);return}else if(n<=65535){e(224|n>>12),e(128|n>>6&63),e(128|n&63);return}else if(n<=1114111){e(240|n>>18),e(128|n>>12&63),e(128|n>>6&63),e(128|n&63);return}throw new Error(`Unrecognized Unicode codepoint: ${n.toString(16)}`)}function Di(n,e){for(let t=0;t<n.length;t+=1){let s=n.charCodeAt(t);if(s>55295&&s<=56319){const a=(s-55296)*1024&65535;s=(n.charCodeAt(t+1)-56320&65535|a)+65536,t+=1}Li(s,e)}}function Ui(n,e,t){if(e.utf8seq===0){if(n<=127){t(n);return}for(let s=1;s<6;s+=1)if(!(n>>7-s&1)){e.utf8seq=s;break}if(e.utf8seq===2)e.codepoint=n&31;else if(e.utf8seq===3)e.codepoint=n&15;else if(e.utf8seq===4)e.codepoint=n&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(n<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|n&63,e.utf8seq-=1,e.utf8seq===0&&t(e.codepoint)}}function zi(n){const e=[],t={queue:0,queuedBits:0},s=a=>{e.push(a)};for(let a=0;a<n.length;a+=1)qr(n.charCodeAt(a),t,s);return new Uint8Array(e)}function Mi(n){const e=[];return Di(n,t=>e.push(t)),new Uint8Array(e)}function Bi(n){const e=[],t={queue:0,queuedBits:0},s=a=>{e.push(a)};return n.forEach(a=>tr(a,t,s)),tr(null,t,s),e.join("")}function Fi(n){return Math.round(Date.now()/1e3)+n}function Wi(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const e=Math.random()*16|0;return(n=="x"?e:e&3|8).toString(16)})}const re=()=>typeof window<"u"&&typeof document<"u",ke={tested:!1,writable:!1},Vr=()=>{if(!re())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(ke.tested)return ke.writable;const n=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(n,n),globalThis.localStorage.removeItem(n),ke.tested=!0,ke.writable=!0}catch{ke.tested=!0,ke.writable=!1}return ke.writable};function qi(n){const e={},t=new URL(n);if(t.hash&&t.hash[0]==="#")try{new URLSearchParams(t.hash.substring(1)).forEach((a,i)=>{e[i]=a})}catch{}return t.searchParams.forEach((s,a)=>{e[a]=s}),e}const Hr=n=>{let e;return n?e=n:typeof fetch>"u"?e=(...t)=>R(async()=>{const{default:s}=await Promise.resolve().then(()=>Ge);return{default:s}},void 0).then(({default:s})=>s(...t)):e=fetch,(...t)=>e(...t)},Vi=n=>typeof n=="object"&&n!==null&&"status"in n&&"ok"in n&&"json"in n&&typeof n.json=="function",We=async(n,e,t)=>{await n.setItem(e,JSON.stringify(t))},Ne=async(n,e)=>{const t=await n.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return t}},xe=async(n,e)=>{await n.removeItem(e)};class Ot{constructor(){this.promise=new Ot.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}Ot.promiseConstructor=Promise;function Wt(n){const e=n.split(".");if(e.length!==3)throw new ms("Invalid JWT structure");for(let s=0;s<e.length;s++)if(!Pi.test(e[s]))throw new ms("JWT not in base64url format");return{header:JSON.parse(sr(e[0])),payload:JSON.parse(sr(e[1])),signature:zi(e[2]),raw:{header:e[0],payload:e[1]}}}async function Hi(n){return await new Promise(e=>{setTimeout(()=>e(null),n)})}function Ji(n,e){return new Promise((s,a)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await n(i);if(!e(i,null,o)){s(o);return}}catch(o){if(!e(i,o)){a(o);return}}})()})}function Gi(n){return("0"+n.toString(16)).substr(-2)}function Ki(){const e=new Uint32Array(56);if(typeof crypto>"u"){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=t.length;let a="";for(let i=0;i<56;i++)a+=t.charAt(Math.floor(Math.random()*s));return a}return crypto.getRandomValues(e),Array.from(e,Gi).join("")}async function Xi(n){const t=new TextEncoder().encode(n),s=await crypto.subtle.digest("SHA-256",t),a=new Uint8Array(s);return Array.from(a).map(i=>String.fromCharCode(i)).join("")}async function Qi(n){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return n;const t=await Xi(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Le(n,e,t=!1){const s=Ki();let a=s;t&&(a+="/PASSWORD_RECOVERY"),await We(n,`${e}-code-verifier`,a);const i=await Qi(s);return[i,s===i?"plain":"s256"]}const Yi=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Zi(n){const e=n.headers.get(hs);if(!e||!e.match(Yi))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function eo(n){if(!n)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(n<=e)throw new Error("JWT has expired")}function to(n){switch(n){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const so=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function De(n){if(!so.test(n))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function qt(){const n={};return new Proxy(n,{get:(e,t)=>{if(t==="__isUserNotAvailableProxy")return!0;if(typeof t=="symbol"){const s=t.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function rr(n){return JSON.parse(JSON.stringify(n))}var ro=function(n,e){var t={};for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&e.indexOf(s)<0&&(t[s]=n[s]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(n);a<s.length;a++)e.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(n,s[a])&&(t[s[a]]=n[s[a]]);return t};const Se=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),no=[502,503,504];async function nr(n){var e;if(!Vi(n))throw new fs(Se(n),0);if(no.includes(n.status))throw new fs(Se(n),n.status);let t;try{t=await n.json()}catch(i){throw new Wr(Se(i),i)}let s;const a=Zi(n);if(a&&a.getTime()>=Fr["2024-01-01"].timestamp&&typeof t=="object"&&t&&typeof t.code=="string"?s=t.code:typeof t=="object"&&t&&typeof t.error_code=="string"&&(s=t.error_code),s){if(s==="weak_password")throw new Zs(Se(t),n.status,((e=t.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(s==="session_not_found")throw new ye}else if(typeof t=="object"&&t&&typeof t.weak_password=="object"&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new Zs(Se(t),n.status,t.weak_password.reasons);throw new Ci(Se(t),n.status||500,s)}const ao=(n,e,t,s)=>{const a={method:n,headers:(e==null?void 0:e.headers)||{}};return n==="GET"?a:(a.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),a.body=JSON.stringify(s),Object.assign(Object.assign({},a),t))};async function L(n,e,t,s){var a;const i=Object.assign({},s==null?void 0:s.headers);i[hs]||(i[hs]=Fr["2024-01-01"].name),s!=null&&s.jwt&&(i.Authorization=`Bearer ${s.jwt}`);const o=(a=s==null?void 0:s.query)!==null&&a!==void 0?a:{};s!=null&&s.redirectTo&&(o.redirect_to=s.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await io(n,e,t+l,{headers:i,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(c):{data:Object.assign({},c),error:null}}async function io(n,e,t,s,a,i){const o=ao(e,s,a,i);let l;try{l=await n(t,Object.assign({},o))}catch(c){throw new fs(Se(c),0)}if(l.ok||await nr(l),s!=null&&s.noResolveJson)return l;try{return await l.json()}catch(c){await nr(c)}}function fe(n){var e;let t=null;uo(n)&&(t=Object.assign({},n),n.expires_at||(t.expires_at=Fi(n.expires_in)));const s=(e=n.user)!==null&&e!==void 0?e:n;return{data:{session:t,user:s},error:null}}function ar(n){const e=fe(n);return!e.error&&n.weak_password&&typeof n.weak_password=="object"&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.message&&typeof n.weak_password.message=="string"&&n.weak_password.reasons.reduce((t,s)=>t&&typeof s=="string",!0)&&(e.data.weak_password=n.weak_password),e}function be(n){var e;return{data:{user:(e=n.user)!==null&&e!==void 0?e:n},error:null}}function oo(n){return{data:n,error:null}}function lo(n){const{action_link:e,email_otp:t,hashed_token:s,redirect_to:a,verification_type:i}=n,o=ro(n,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:e,email_otp:t,hashed_token:s,redirect_to:a,verification_type:i},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function co(n){return n}function uo(n){return n.access_token&&n.refresh_token&&n.expires_in}const Vt=["global","local","others"];var ho=function(n,e){var t={};for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&e.indexOf(s)<0&&(t[s]=n[s]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(n);a<s.length;a++)e.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(n,s[a])&&(t[s[a]]=n[s[a]]);return t};class fo{constructor({url:e="",headers:t={},fetch:s}){this.url=e,this.headers=t,this.fetch=Hr(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t=Vt[0]){if(Vt.indexOf(t)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Vt.join(", ")}`);try{return await L(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(s){if($(s))return{data:null,error:s};throw s}}async inviteUserByEmail(e,t={}){try{return await L(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:be})}catch(s){if($(s))return{data:{user:null},error:s};throw s}}async generateLink(e){try{const{options:t}=e,s=ho(e,["options"]),a=Object.assign(Object.assign({},s),t);return"newEmail"in s&&(a.new_email=s==null?void 0:s.newEmail,delete a.newEmail),await L(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:lo,redirectTo:t==null?void 0:t.redirectTo})}catch(t){if($(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await L(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:be})}catch(t){if($(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,s,a,i,o,l,c;try{const d={nextPage:null,lastPage:0,total:0},u=await L(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(t=e==null?void 0:e.page)===null||t===void 0?void 0:t.toString())!==null&&s!==void 0?s:"",per_page:(i=(a=e==null?void 0:e.perPage)===null||a===void 0?void 0:a.toString())!==null&&i!==void 0?i:""},xform:co});if(u.error)throw u.error;const h=await u.json(),m=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,g=(c=(l=u.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return g.length>0&&(g.forEach(v=>{const _=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(v.split(";")[1].split("=")[1]);d[`${w}Page`]=_}),d.total=parseInt(m)),{data:Object.assign(Object.assign({},h),d),error:null}}catch(d){if($(d))return{data:{users:[]},error:d};throw d}}async getUserById(e){De(e);try{return await L(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:be})}catch(t){if($(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){De(e);try{return await L(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:be})}catch(s){if($(s))return{data:{user:null},error:s};throw s}}async deleteUser(e,t=!1){De(e);try{return await L(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:be})}catch(s){if($(s))return{data:{user:null},error:s};throw s}}async _listFactors(e){De(e.userId);try{const{data:t,error:s}=await L(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:a=>({data:{factors:a},error:null})});return{data:t,error:s}}catch(t){if($(t))return{data:null,error:t};throw t}}async _deleteFactor(e){De(e.userId),De(e.id);try{return{data:await L(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if($(t))return{data:null,error:t};throw t}}}function ir(n={}){return{getItem:e=>n[e]||null,setItem:(e,t)=>{n[e]=t},removeItem:e=>{delete n[e]}}}function mo(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}const Ue={debug:!!(globalThis&&Vr()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Jr extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class po extends Jr{}async function go(n,e,t){Ue.debug;const s=new globalThis.AbortController;return e>0&&setTimeout(()=>{s.abort(),Ue.debug},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(n,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async a=>{if(a){Ue.debug;try{return await t()}finally{Ue.debug}}else{if(e===0)throw Ue.debug,new po(`Acquiring an exclusive Navigator LockManager lock "${n}" immediately failed`);if(Ue.debug)try{const i=await globalThis.navigator.locks.query()}catch{}return await t()}}))}mo();const xo={url:Si,storageKey:Ti,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Ei,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function or(n,e,t){return await t()}const ze={};class lt{constructor(e){var t,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=lt.nextInstanceID,lt.nextInstanceID+=1,this.instanceID>0&&re();const a=Object.assign(Object.assign({},xo),e);if(this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.persistSession=a.persistSession,this.storageKey=a.storageKey,this.autoRefreshToken=a.autoRefreshToken,this.admin=new fo({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=Hr(a.fetch),this.lock=a.lock||or,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,a.lock?this.lock=a.lock:re()&&(!((t=globalThis==null?void 0:globalThis.navigator)===null||t===void 0)&&t.locks)?this.lock=go:this.lock=or,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?(a.storage?this.storage=a.storage:Vr()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ir(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=ir(this.memoryStorage)),re()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch{}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}get jwks(){var e,t;return(t=(e=ze[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&t!==void 0?t:{keys:[]}}set jwks(e){ze[this.storageKey]=Object.assign(Object.assign({},ze[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return(t=(e=ze[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&t!==void 0?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){ze[this.storageKey]=Object.assign(Object.assign({},ze[this.storageKey]),{cachedAt:e})}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${Br}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{const t=qi(window.location.href);let s="none";if(this._isImplicitGrantCallback(t)?s="implicit":await this._isPKCECallback(t)&&(s="pkce"),re()&&this.detectSessionInUrl&&s!=="none"){const{data:a,error:i}=await this._getSessionFromURL(t,s);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Ri(i)){const c=(e=i.details)===null||e===void 0?void 0:e.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return await this._removeSession(),{error:i}}const{session:o,redirectType:l}=a;return this._debug("#_initialize()","detected session in URL",o,"redirect type",l),await this._saveSession(o),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return $(t)?{error:t}:{error:new Wr("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,s,a;try{const i=await L(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(t=e==null?void 0:e.options)===null||t===void 0?void 0:t.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(a=e==null?void 0:e.options)===null||a===void 0?void 0:a.captchaToken}},xform:fe}),{data:o,error:l}=i;if(l||!o)return{data:{user:null,session:null},error:l};const c=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:d,session:c},error:null}}catch(i){if($(i))return{data:{user:null,session:null},error:i};throw i}}async signUp(e){var t,s,a;try{let i;if("email"in e){const{email:u,password:h,options:m}=e;let g=null,v=null;this.flowType==="pkce"&&([g,v]=await Le(this.storage,this.storageKey)),i=await L(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:m==null?void 0:m.emailRedirectTo,body:{email:u,password:h,data:(t=m==null?void 0:m.data)!==null&&t!==void 0?t:{},gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},code_challenge:g,code_challenge_method:v},xform:fe})}else if("phone"in e){const{phone:u,password:h,options:m}=e;i=await L(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(s=m==null?void 0:m.data)!==null&&s!==void 0?s:{},channel:(a=m==null?void 0:m.channel)!==null&&a!==void 0?a:"sms",gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken}},xform:fe})}else throw new gt("You must provide either an email or phone number and a password");const{data:o,error:l}=i;if(l||!o)return{data:{user:null,session:null},error:l};const c=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:d,session:c},error:null}}catch(i){if($(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithPassword(e){try{let t;if("email"in e){const{email:i,password:o,options:l}=e;t=await L(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:ar})}else if("phone"in e){const{phone:i,password:o,options:l}=e;t=await L(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:ar})}else throw new gt("You must provide either an email or phone number and a password");const{data:s,error:a}=t;return a?{data:{user:null,session:null},error:a}:!s||!s.session||!s.user?{data:{user:null,session:null},error:new pt}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:a})}catch(t){if($(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOAuth(e){var t,s,a,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(t=e.options)===null||t===void 0?void 0:t.redirectTo,scopes:(s=e.options)===null||s===void 0?void 0:s.scopes,queryParams:(a=e.options)===null||a===void 0?void 0:a.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:t}=e;if(t==="solana")return await this.signInWithSolana(e);throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}async signInWithSolana(e){var t,s,a,i,o,l,c,d,u,h,m,g;let v,_;if("message"in e)v=e.message,_=e.signature;else{const{chain:w,wallet:N,statement:A,options:k}=e;let j;if(re())if(typeof N=="object")j=N;else{const p=window;if("solana"in p&&typeof p.solana=="object"&&("signIn"in p.solana&&typeof p.solana.signIn=="function"||"signMessage"in p.solana&&typeof p.solana.signMessage=="function"))j=p.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof N!="object"||!(k!=null&&k.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=N}const x=new URL((t=k==null?void 0:k.url)!==null&&t!==void 0?t:window.location.href);if("signIn"in j&&j.signIn){const p=await j.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},k==null?void 0:k.signInWithSolana),{version:"1",domain:x.host,uri:x.href}),A?{statement:A}:null));let b;if(Array.isArray(p)&&p[0]&&typeof p[0]=="object")b=p[0];else if(p&&typeof p=="object"&&"signedMessage"in p&&"signature"in p)b=p;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in b&&"signature"in b&&(typeof b.signedMessage=="string"||b.signedMessage instanceof Uint8Array)&&b.signature instanceof Uint8Array)v=typeof b.signedMessage=="string"?b.signedMessage:new TextDecoder().decode(b.signedMessage),_=b.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in j)||typeof j.signMessage!="function"||!("publicKey"in j)||typeof j!="object"||!j.publicKey||!("toBase58"in j.publicKey)||typeof j.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");v=[`${x.host} wants you to sign in with your Solana account:`,j.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${x.href}`,`Issued At: ${(a=(s=k==null?void 0:k.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&a!==void 0?a:new Date().toISOString()}`,...!((i=k==null?void 0:k.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${k.signInWithSolana.notBefore}`]:[],...!((o=k==null?void 0:k.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${k.signInWithSolana.expirationTime}`]:[],...!((l=k==null?void 0:k.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${k.signInWithSolana.chainId}`]:[],...!((c=k==null?void 0:k.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${k.signInWithSolana.nonce}`]:[],...!((d=k==null?void 0:k.signInWithSolana)===null||d===void 0)&&d.requestId?[`Request ID: ${k.signInWithSolana.requestId}`]:[],...!((h=(u=k==null?void 0:k.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...k.signInWithSolana.resources.map(b=>`- ${b}`)]:[]].join(`
`);const p=await j.signMessage(new TextEncoder().encode(v),"utf8");if(!p||!(p instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");_=p}}try{const{data:w,error:N}=await L(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:v,signature:Bi(_)},!((m=e.options)===null||m===void 0)&&m.captchaToken?{gotrue_meta_security:{captcha_token:(g=e.options)===null||g===void 0?void 0:g.captchaToken}}:null),xform:fe});if(N)throw N;return!w||!w.session||!w.user?{data:{user:null,session:null},error:new pt}:(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),{data:Object.assign({},w),error:N})}catch(w){if($(w))return{data:{user:null,session:null},error:w};throw w}}async _exchangeCodeForSession(e){const t=await Ne(this.storage,`${this.storageKey}-code-verifier`),[s,a]=(t??"").split("/");try{const{data:i,error:o}=await L(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:fe});if(await xe(this.storage,`${this.storageKey}-code-verifier`),o)throw o;return!i||!i.session||!i.user?{data:{user:null,session:null,redirectType:null},error:new pt}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:a??null}),error:o})}catch(i){if($(i))return{data:{user:null,session:null,redirectType:null},error:i};throw i}}async signInWithIdToken(e){try{const{options:t,provider:s,token:a,access_token:i,nonce:o}=e,l=await L(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:a,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:t==null?void 0:t.captchaToken}},xform:fe}),{data:c,error:d}=l;return d?{data:{user:null,session:null},error:d}:!c||!c.session||!c.user?{data:{user:null,session:null},error:new pt}:(c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),{data:c,error:d})}catch(t){if($(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOtp(e){var t,s,a,i,o;try{if("email"in e){const{email:l,options:c}=e;let d=null,u=null;this.flowType==="pkce"&&([d,u]=await Le(this.storage,this.storageKey));const{error:h}=await L(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(t=c==null?void 0:c.data)!==null&&t!==void 0?t:{},create_user:(s=c==null?void 0:c.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:d,code_challenge_method:u},redirectTo:c==null?void 0:c.emailRedirectTo});return{data:{user:null,session:null},error:h}}if("phone"in e){const{phone:l,options:c}=e,{data:d,error:u}=await L(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(a=c==null?void 0:c.data)!==null&&a!==void 0?a:{},create_user:(i=c==null?void 0:c.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return{data:{user:null,session:null,messageId:d==null?void 0:d.message_id},error:u}}throw new gt("You must provide either an email or phone number.")}catch(l){if($(l))return{data:{user:null,session:null},error:l};throw l}}async verifyOtp(e){var t,s;try{let a,i;"options"in e&&(a=(t=e.options)===null||t===void 0?void 0:t.redirectTo,i=(s=e.options)===null||s===void 0?void 0:s.captchaToken);const{data:o,error:l}=await L(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:a,xform:fe});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,d=o.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),{data:{user:d,session:c},error:null}}catch(a){if($(a))return{data:{user:null,session:null},error:a};throw a}}async signInWithSSO(e){var t,s,a;try{let i=null,o=null;return this.flowType==="pkce"&&([i,o]=await Le(this.storage,this.storageKey)),await L(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(s=(t=e.options)===null||t===void 0?void 0:t.redirectTo)!==null&&s!==void 0?s:void 0}),!((a=e==null?void 0:e.options)===null||a===void 0)&&a.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:o}),headers:this.headers,xform:oo})}catch(i){if($(i))return{data:null,error:i};throw i}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new ye;const{error:a}=await L(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:a}})}catch(e){if($(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const t=`${this.url}/resend`;if("email"in e){const{email:s,type:a,options:i}=e,{error:o}=await L(this.fetch,"POST",t,{headers:this.headers,body:{email:s,type:a,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in e){const{phone:s,type:a,options:i}=e,{data:o,error:l}=await L(this.fetch,"POST",t,{headers:this.headers,body:{phone:s,type:a,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l}}throw new gt("You must provide either an email or phone number and a type")}catch(t){if($(t))return{data:{user:null,session:null},error:t};throw t}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async t=>t))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),a=(async()=>(await s,await t()))();return this.pendingInLock.push((async()=>{try{await a}catch{}})()),a}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=t();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const a=[...this.pendingInLock];await Promise.all(a),this.pendingInLock.splice(0,a.length)}return await s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const t=await Ne(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),t!==null&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const s=e.expires_at?e.expires_at*1e3-Date.now()<Bt:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",e.expires_at),!s){if(this.userStorage){const o=await Ne(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=qt()}if(this.storage.isServer&&e.user){let o=this.suppressGetSessionWarning;e=new Proxy(e,{get:(c,d,u)=>(!o&&d==="user"&&(o=!0,this.suppressGetSessionWarning=!0),Reflect.get(c,d,u))})}return{data:{session:e},error:null}}const{session:a,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:a},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await L(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:be}):await this._useSession(async t=>{var s,a,i;const{data:o,error:l}=t;if(l)throw l;return!(!((s=o.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ye}:await L(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(a=o.session)===null||a===void 0?void 0:a.access_token)!==null&&i!==void 0?i:void 0,xform:be})})}catch(t){if($(t))return Ii(t)&&(await this._removeSession(),await xe(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:t};throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async s=>{const{data:a,error:i}=s;if(i)throw i;if(!a.session)throw new ye;const o=a.session;let l=null,c=null;this.flowType==="pkce"&&e.email!=null&&([l,c]=await Le(this.storage,this.storageKey));const{data:d,error:u}=await L(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:t==null?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:be});if(u)throw u;return o.user=d.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(s){if($(s))return{data:{user:null},error:s};throw s}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ye;const t=Date.now()/1e3;let s=t,a=!0,i=null;const{payload:o}=Wt(e.access_token);if(o.exp&&(s=o.exp,a=s<=t),a){const{session:l,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return{data:{user:null,session:null},error:c};if(!l)return{data:{user:null,session:null},error:null};i=l}else{const{data:l,error:c}=await this._getUser(e.access_token);if(c)throw c;i={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(t){if($(t))return{data:{session:null,user:null},error:t};throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var s;if(!e){const{data:o,error:l}=t;if(l)throw l;e=(s=o.session)!==null&&s!==void 0?s:void 0}if(!(e!=null&&e.refresh_token))throw new ye;const{session:a,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:a?{data:{user:a.user,session:a},error:null}:{data:{user:null,session:null},error:null}})}catch(t){if($(t))return{data:{user:null,session:null},error:t};throw t}}async _getSessionFromURL(e,t){try{if(!re())throw new xt("No browser detected.");if(e.error||e.error_description||e.error_code)throw new xt(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if(this.flowType==="pkce")throw new Ys("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new xt("Not a valid implicit grant flow url.");break;default:}if(t==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Ys("No code detected.");const{data:A,error:k}=await this._exchangeCodeForSession(e.code);if(k)throw k;const j=new URL(window.location.href);return j.searchParams.delete("code"),window.history.replaceState(window.history.state,"",j.toString()),{data:{session:A.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:a,access_token:i,refresh_token:o,expires_in:l,expires_at:c,token_type:d}=e;if(!i||!l||!o||!d)throw new xt("No session defined in URL");const u=Math.round(Date.now()/1e3),h=parseInt(l);let m=u+h;c&&(m=parseInt(c)),(m-u)*1e3<=Fe;const v=m-h;u-v>=120||u-v<0;const{data:_,error:w}=await this._getUser(i);if(w)throw w;const N={provider_token:s,provider_refresh_token:a,access_token:i,expires_in:h,expires_at:m,refresh_token:o,token_type:d,user:_.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:N,redirectType:e.type},error:null}}catch(s){if($(s))return{data:{session:null,redirectType:null},error:s};throw s}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const t=await Ne(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var s;const{data:a,error:i}=t;if(i)return{error:i};const o=(s=a.session)===null||s===void 0?void 0:s.access_token;if(o){const{error:l}=await this.admin.signOut(o,e);if(l&&!(Oi(l)&&(l.status===404||l.status===401||l.status===403)))return{error:l}}return e!=="others"&&(await this._removeSession(),await xe(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const t=Wi(),s={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,s),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})))(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async t=>{var s,a;try{const{data:{session:i},error:o}=t;if(o)throw o;await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((a=this.stateChangeEmitters.get(e))===null||a===void 0?void 0:a.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i)}})}async resetPasswordForEmail(e,t={}){let s=null,a=null;this.flowType==="pkce"&&([s,a]=await Le(this.storage,this.storageKey,!0));try{return await L(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:a,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(i){if($(i))return{data:null,error:i};throw i}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return{data:{identities:(e=t.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(t){if($(t))return{data:null,error:t};throw t}}async linkIdentity(e){var t;try{const{data:s,error:a}=await this._useSession(async i=>{var o,l,c,d,u;const{data:h,error:m}=i;if(m)throw m;const g=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(l=e.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await L(this.fetch,"GET",g,{headers:this.headers,jwt:(u=(d=h.session)===null||d===void 0?void 0:d.access_token)!==null&&u!==void 0?u:void 0})});if(a)throw a;return re()&&!(!((t=e.options)===null||t===void 0)&&t.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),{data:{provider:e.provider,url:s==null?void 0:s.url},error:null}}catch(s){if($(s))return{data:{provider:e.provider,url:null},error:s};throw s}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var s,a;const{data:i,error:o}=t;if(o)throw o;return await L(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(a=(s=i.session)===null||s===void 0?void 0:s.access_token)!==null&&a!==void 0?a:void 0})})}catch(t){if($(t))return{data:null,error:t};throw t}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const s=Date.now();return await Ji(async a=>(a>0&&await Hi(200*Math.pow(2,a-1)),this._debug(t,"refreshing attempt",a),await L(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:fe})),(a,i)=>{const o=200*Math.pow(2,a);return i&&Ft(i)&&Date.now()+o-s<Fe})}catch(s){if(this._debug(t,"error",s),$(s))return{data:{session:null,user:null},error:s};throw s}finally{this._debug(t,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const s=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",s),re()&&!t.skipBrowserRedirect&&window.location.assign(s),{data:{provider:e,url:s},error:null}}async _recoverAndRefresh(){var e,t;const s="#_recoverAndRefresh()";this._debug(s,"begin");try{const a=await Ne(this.storage,this.storageKey);if(a&&this.userStorage){let o=await Ne(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:a.user},await We(this.userStorage,this.storageKey+"-user",o)),a.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:qt()}else if(a&&!a.user&&!a.user){const o=await Ne(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(a.user=o.user,await xe(this.storage,this.storageKey+"-user"),await We(this.storage,this.storageKey,a)):a.user=qt()}if(this._debug(s,"session from storage",a),!this._isValidSession(a)){this._debug(s,"session is not valid"),a!==null&&await this._removeSession();return}const i=((t=a.expires_at)!==null&&t!==void 0?t:1/0)*1e3-Date.now()<Bt;if(this._debug(s,`session has${i?"":" not"} expired with margin of ${Bt}s`),i){if(this.autoRefreshToken&&a.refresh_token){const{error:o}=await this._callRefreshToken(a.refresh_token);o&&(Ft(o)||(this._debug(s,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(a.user&&a.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(a.access_token);!l&&(o!=null&&o.user)?(a.user=o.user,await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)):this._debug(s,"could not get user data, skipping SIGNED_IN notification")}catch(o){this._debug(s,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",a)}catch(a){this._debug(s,"error",a);return}finally{this._debug(s,"end")}}async _callRefreshToken(e){var t,s;if(!e)throw new ye;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const a=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(a,"begin");try{this.refreshingDeferred=new Ot;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new ye;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const l={session:i.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(i){if(this._debug(a,"error",i),$(i)){const o={session:null,error:i};return Ft(i)||await this._removeSession(),(t=this.refreshingDeferred)===null||t===void 0||t.resolve(o),o}throw(s=this.refreshingDeferred)===null||s===void 0||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(a,"end")}}async _notifyAllSubscribers(e,t,s=!0){const a=`#_notifyAllSubscribers(${e})`;this._debug(a,"begin",t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(e,t)}catch(c){i.push(c)}});if(await Promise.all(o),i.length>0){for(let l=0;l<i.length;l+=1);throw i[0]}}finally{this._debug(a,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const t=Object.assign({},e),s=t.user&&t.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!s&&t.user&&await We(this.userStorage,this.storageKey+"-user",{user:t.user});const a=Object.assign({},t);delete a.user;const i=rr(a);await We(this.storage,this.storageKey,i)}else{const a=rr(t);await We(this.storage,this.storageKey,a)}}async _removeSession(){this._debug("#_removeSession()"),await xe(this.storage,this.storageKey),await xe(this.storage,this.storageKey+"-code-verifier"),await xe(this.storage,this.storageKey+"-user"),this.userStorage&&await xe(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&re()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch{}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Fe);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const a=Math.floor((s.expires_at*1e3-e)/Fe);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${Fe}ms, refresh threshold is ${us} ticks`),a<=us&&await this._callRefreshToken(s.refresh_token)})}catch{}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof Jr)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!re()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch{}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const a=[`provider=${encodeURIComponent(t)}`];if(s!=null&&s.redirectTo&&a.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&a.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[i,o]=await Le(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});a.push(l.toString())}if(s!=null&&s.queryParams){const i=new URLSearchParams(s.queryParams);a.push(i.toString())}return s!=null&&s.skipBrowserRedirect&&a.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${a.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var s;const{data:a,error:i}=t;return i?{data:null,error:i}:await L(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token})})}catch(t){if($(t))return{data:null,error:t};throw t}}async _enroll(e){try{return await this._useSession(async t=>{var s,a;const{data:i,error:o}=t;if(o)return{data:null,error:o};const l=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:{issuer:e.issuer}),{data:c,error:d}=await L(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return d?{data:null,error:d}:(e.factorType==="totp"&&(!((a=c==null?void 0:c.totp)===null||a===void 0)&&a.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),{data:c,error:null})})}catch(t){if($(t))return{data:null,error:t};throw t}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var s;const{data:a,error:i}=t;if(i)return{data:null,error:i};const{data:o,error:l}=await L(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token});return l?{data:null,error:l}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),{data:o,error:l})})}catch(t){if($(t))return{data:null,error:t};throw t}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var s;const{data:a,error:i}=t;return i?{data:null,error:i}:await L(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:{channel:e.channel},headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token})})}catch(t){if($(t))return{data:null,error:t};throw t}})}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?{data:null,error:s}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){const{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};const s=(e==null?void 0:e.factors)||[],a=s.filter(o=>o.factor_type==="totp"&&o.status==="verified"),i=s.filter(o=>o.factor_type==="phone"&&o.status==="verified");return{data:{all:s,totp:a,phone:i},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,s;const{data:{session:a},error:i}=e;if(i)return{data:null,error:i};if(!a)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=Wt(a.access_token);let l=null;o.aal&&(l=o.aal);let c=l;((s=(t=a.user.factors)===null||t===void 0?void 0:t.filter(h=>h.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(c="aal2");const u=o.amr||[];return{data:{currentLevel:l,nextLevel:c,currentAuthenticationMethods:u},error:null}}))}async fetchJwk(e,t={keys:[]}){let s=t.keys.find(l=>l.kid===e);if(s)return s;const a=Date.now();if(s=this.jwks.keys.find(l=>l.kid===e),s&&this.jwks_cached_at+Ai>a)return s;const{data:i,error:o}=await L(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=a,s=i.keys.find(l=>l.kid===e),!s)?null:s}async getClaims(e,t={}){try{let s=e;if(!s){const{data:g,error:v}=await this.getSession();if(v||!g.session)return{data:null,error:v};s=g.session.access_token}const{header:a,payload:i,signature:o,raw:{header:l,payload:c}}=Wt(s);t!=null&&t.allowExpired||eo(i.exp);const d=!a.alg||a.alg.startsWith("HS")||!a.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(a.kid,t!=null&&t.keys?{keys:t.keys}:t==null?void 0:t.jwks);if(!d){const{error:g}=await this.getUser(s);if(g)throw g;return{data:{claims:i,header:a,signature:o},error:null}}const u=to(a.alg),h=await crypto.subtle.importKey("jwk",d,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,Mi(`${l}.${c}`)))throw new ms("Invalid JWT signature");return{data:{claims:i,header:a,signature:o},error:null}}catch(s){if($(s))return{data:null,error:s};throw s}}}lt.nextInstanceID=0;const yo=lt;class vo extends yo{constructor(e){super(e)}}var bo=function(n,e,t,s){function a(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(n,e||[])).next())})};class wo{constructor(e,t,s){var a,i,o;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");if(!t)throw new Error("supabaseKey is required.");const l=ki(e),c=new URL(l);this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const d=`sb-${c.hostname.split(".")[0]}-auth-token`,u={db:gi,realtime:yi,auth:Object.assign(Object.assign({},xi),{storageKey:d}),global:pi},h=Ni(s??{},u);this.storageKey=(a=h.auth.storageKey)!==null&&a!==void 0?a:"",this.headers=(i=h.global.headers)!==null&&i!==void 0?i:{},h.accessToken?(this.accessToken=h.accessToken,this.auth=new Proxy({},{get:(m,g)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(g)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=h.auth)!==null&&o!==void 0?o:{},this.headers,h.global.fetch),this.fetch=_i(t,this._getAccessToken.bind(this),h.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},h.realtime)),this.rest=new La(new URL("rest/v1",c).href,{headers:this.headers,schema:h.db.schema,fetch:this.fetch}),this.storage=new hi(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),h.accessToken||this._listenForAuthEvents()}get functions(){return new ha(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},s={}){return this.rest.rpc(e,t,s)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t;return bo(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();const{data:s}=yield this.auth.getSession();return(t=(e=s.session)===null||e===void 0?void 0:e.access_token)!==null&&t!==void 0?t:this.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:a,storageKey:i,flowType:o,lock:l,debug:c},d,u){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new vo({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),d),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:a,flowType:o,lock:l,debug:c,fetch:u,hasCustomAuthorizationHeader:"Authorization"in this.headers})}_initRealtimeClient(e){return new Za(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,s)=>{this._handleTokenChanged(t,"CLIENT",s==null?void 0:s.access_token)})}_handleTokenChanged(e,t,s){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==s?this.changedAccessToken=s:e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const _o=(n,e,t)=>new wo(n,e,t);function jo(){if(typeof window<"u"||typeof process>"u")return!1;const n=process.version;if(n==null)return!1;const e=n.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}jo();const ko="https://pamffbanuwjldtpshraq.supabase.co".trim(),No="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBhbWZmYmFudXdqbGR0cHNocmFxIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTU0NTU5MjgsImV4cCI6MjA3MTAzMTkyOH0.z2YaWkmSGwp9RiOwklFhKAAlRM0jvkPiMPbhno_uYIo".trim(),D=_o(ko||"https://placeholder.supabase.co",No||"placeholder-key");function Xe(){const[n,e]=f.useState(null),[t,s]=f.useState(null),[a,i]=f.useState(!0);return f.useEffect(()=>{D.auth.getSession().then(({data:{session:h}})=>{s(h),e((h==null?void 0:h.user)??null),i(!1)});const{data:{subscription:u}}=D.auth.onAuthStateChange((h,m)=>{s(m),e((m==null?void 0:m.user)??null),i(!1)});return()=>u.unsubscribe()},[]),{user:n,session:t,loading:a,signInWithTwitter:async()=>{const u=window.location.pathname,h=["/","/landing","/landingtest"].includes(u),g=sessionStorage.getItem("auth_redirect")||(h?"/create":u);sessionStorage.setItem("auth_redirect",g);const v=`${window.location.origin}/auth/callback?next=${encodeURIComponent(g)}`,{error:_}=await D.auth.signInWithOAuth({provider:"twitter",options:{redirectTo:v,scopes:"users.read tweet.read offline.access",queryParams:{"user.fields":"id,name,username,profile_image_url,verified"}}});if(_)throw _},signInWithGoogle:async()=>{const u=window.location.pathname,h=["/","/landing","/landingtest"].includes(u),g=sessionStorage.getItem("auth_redirect")||(h?"/create":u);sessionStorage.setItem("auth_redirect",g);const v=`${window.location.origin}/auth/callback?next=${encodeURIComponent(g)}`,{error:_}=await D.auth.signInWithOAuth({provider:"google",options:{redirectTo:v,queryParams:{access_type:"offline",prompt:"consent"}}});if(_)throw _},signInWithXOAuth2:async()=>{var g;const u=window.location.pathname,m=["/","/landing","/landingtest"].includes(u)?"/create":u;sessionStorage.setItem("auth_redirect",m);try{const _=await fetch("https://pamffbanuwjldtpshraq.supabase.co/functions/v1/x-oauth2-start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:(n==null?void 0:n.id)||null})});if(!_.ok){const N=await _.json().catch(()=>({error:"Unknown error"}));throw(g=N.error)!=null&&g.includes("not configured")?new Error("X OAuth 2.0 is not configured on the server. Please contact support."):new Error(N.error||`Failed to start OAuth flow: ${_.status}`)}const w=await _.json();if(!w.authorize_url)throw new Error("No authorization URL received from server");window.location.href=w.authorize_url}catch(v){throw v instanceof Error?new Error(v.message):new Error("Failed to initiate X OAuth 2.0 authentication. Please try again.")}},signOut:async()=>{const{error:u}=await D.auth.signOut();if(u)throw u}}}const Gr=f.createContext(void 0);function So({children:n}){const[e,t]=f.useState(!1),[s,a]=f.useState(!1),{signInWithTwitter:i,signInWithXOAuth2:o,signInWithGoogle:l}=Xe(),c=f.useCallback(()=>{t(!0)},[]),d=f.useCallback(()=>{t(!1)},[]),u=f.useCallback(async()=>{a(!0);try{await i()}catch{}finally{a(!1)}},[i]),h=f.useCallback(async()=>{a(!0);try{await o()}catch{}finally{a(!1)}},[o]),m=f.useCallback(async()=>{a(!0);try{await l()}catch{}finally{a(!1)}},[l]);return r.jsxs(Gr.Provider,{value:{showAuthModal:c,hideAuthModal:d,isAuthModalOpen:e},children:[n,r.jsx(la,{isOpen:e,onClose:d,onTwitterSignIn:u,onXOAuth2SignIn:h,onGoogleSignIn:m,isLoading:s})]})}function To(){const n=f.useContext(Gr);if(n===void 0)throw new Error("useAuthModal must be used within an AuthModalProvider");return n}const Kr=f.createContext(void 0),Eo=1e3,Po=2e3,Ao=5*60*1e3;function Co({children:n}){const[e,t]=f.useState([]),[s,a]=f.useState(!1),[i,o]=f.useState(!1),[l,c]=f.useState([]),d=f.useRef(null),u=f.useRef(null),h=f.useRef(new Map),m=f.useCallback(async(j,x=!1)=>{if(!j||u.current===j&&!x)return;if(d.current!==j)d.current=j,t([]),o(!1);else if(!x&&i)return;u.current=j,a(!0);try{const{data:b,error:y}=await D.from("user_generations").select("id, prompt, model, aspect_ratio, results, created_at, voice_username, voice_name, voice_avatar_url, voice_is_verified, is_meme_mode").eq("user_id",j).gt("expires_at",new Date().toISOString()).order("created_at",{ascending:!1}).limit(Eo);if(d.current!==j||y)return;const P=(b||[]).map(S=>({id:S.id,prompt:S.prompt,model:S.model,aspectRatio:S.aspect_ratio,results:S.results||[],createdAt:new Date(S.created_at),voiceUsername:S.voice_username,voiceName:S.voice_name,voiceAvatarUrl:S.voice_avatar_url,voiceIsVerified:S.voice_is_verified,isMemeMode:S.is_meme_mode||!1}));t(P)}catch{}finally{u.current===j&&(u.current=null),a(!1),o(!0)}},[i]),g=f.useCallback(async()=>{},[]),v=f.useCallback(async j=>{j&&await m(j,!0)},[m]),_=f.useCallback(j=>{t(x=>[j,...x])},[]),w=f.useCallback(()=>{t([]),o(!1),d.current=null,u.current=null},[]),N=f.useCallback(j=>{c(p=>p.filter(b=>b.jobId!==j));const x=h.current.get(j);x&&(clearInterval(x),h.current.delete(j))},[]),A=f.useCallback(async j=>{if(Date.now()-j.startedAt>Ao){N(j.jobId);return}try{const{data:p,error:b}=await D.from("generation_queue").select("status, result_generation_id, error_message").eq("id",j.jobId).maybeSingle();if(b||!p)return;if(p.status==="completed"&&p.result_generation_id){const{data:y,error:P}=await D.from("user_generations").select("*").eq("id",p.result_generation_id).maybeSingle();if(!P&&y){const S={id:y.id,prompt:y.prompt,model:y.model,aspectRatio:y.aspect_ratio,results:y.results,createdAt:new Date(y.created_at),voiceUsername:y.voice_username,voiceName:y.voice_name,voiceAvatarUrl:y.voice_avatar_url,voiceIsVerified:y.voice_is_verified,isMemeMode:y.is_meme_mode};t(U=>U.some(z=>z.id===S.id)?U:[S,...U])}N(j.jobId)}else p.status==="failed"&&N(j.jobId)}catch{}},[N]),k=f.useCallback((j,x)=>{if(h.current.has(j))return;const p={jobId:j,userId:x,startedAt:Date.now()};c(y=>[...y,p]);const b=setInterval(()=>{A(p)},Po);h.current.set(j,b),A(p)},[A]);return f.useEffect(()=>()=>{h.current.forEach(j=>clearInterval(j)),h.current.clear()},[]),r.jsx(Kr.Provider,{value:{historyItems:e,isLoading:s,hasLoadedOnce:i,hasMore:!1,pendingJobs:l,fetchGenerations:m,fetchMoreGenerations:g,addGeneration:_,clearGenerations:w,refreshGenerations:v,startBackgroundPolling:k},children:n})}function ec(){const n=f.useContext(Kr);if(n===void 0)throw new Error("useGenerations must be used within a GenerationsProvider");return n}let he=null,Me=null,Be=0;const lr=3e4;function ks(n){const[e,t]=f.useState(()=>n&&Me===n.id&&he&&Date.now()-Be<lr?he:null),[s,a]=f.useState(!0),[i,o]=f.useState(null),[l,c]=f.useState(null);f.useEffect(()=>{if(!n){t(null),a(!1);return}if(Me===n.id&&he)if(Date.now()-Be<lr){t(he),a(!1);return}else{t(he),a(!1),d(!0);return}d(!1)},[n]);const d=async(x=!1)=>{try{x||a(!0);const{data:p,error:b}=await D.from("user_profiles").select("*").eq("id",n.id).single();if(b){if(b.code==="PGRST116"){await u();return}throw b}t(p),he=p,Me=n.id,Be=Date.now(),o(null)}catch(p){o(p instanceof Error?p.message:"Failed to fetch profile")}finally{a(!1)}},u=async()=>{try{const{data:x,error:p}=await D.rpc("create_user_profile_if_missing",{user_id:n.id});if(x&&!p){const{data:P,error:S}=await D.from("user_profiles").select("*").eq("id",n.id).single();if(P&&!S){t(P),he=P,Me=n.id,Be=Date.now(),o(null);return}}const{data:b,error:y}=await D.from("user_profiles").upsert({id:n.id,tier:"free",credits:100,monthly_credits_used:0,daily_credits_used:0,last_daily_reset:new Date().toISOString(),last_monthly_reset:new Date().toISOString(),onboarding_completed:!1,plan_selected:!1},{onConflict:"id"}).select().single();if(y)throw y;t(b),he=b,Me=n.id,Be=Date.now(),o(null)}catch(x){o(x instanceof Error?x.message:"Failed to create profile")}},h=x=>!!x,m=x=>{switch(x){case"free":return{canImprove:!1,showFullUI:!1,analyzeCredits:2,improveCredits:2};case"pro":return{canImprove:!0,showFullUI:!0,monthlyCredits:2500,analyzeCredits:2,improveCredits:2};case"xpert":return{canImprove:!0,showFullUI:!0,monthlyCredits:5e3,analyzeCredits:2,improveCredits:2};default:return{canImprove:!1,showFullUI:!1,analyzeCredits:2,improveCredits:2}}},g=(x,p)=>{if(!e)return;let b;if(p!==void 0)b=p;else{const S=m(e.tier);b=x==="analyze"?S.analyzeCredits:S.improveCredits}const y=(l==null?void 0:l.credits)??e.credits,P=(l==null?void 0:l.monthlyCreditsUsed)??e.monthly_credits_used;e.tier==="free"?c({credits:Math.max(0,y-b)}):c({monthlyCreditsUsed:P+b})};f.useEffect(()=>{e&&c(null)},[e==null?void 0:e.credits,e==null?void 0:e.monthly_credits_used]);const v=async(x,p)=>{if(!n||!e)return!1;try{const b=m(e.tier),y=p||(x==="analyze"?b.analyzeCredits:b.improveCredits),{data:P,error:S}=await D.rpc("consume_credits",{p_user_id:n.id,p_credits_needed:y,p_generation_type:x,p_model_name:null,p_generation_count:null,p_voice_username:null,p_aspect_ratio:null,p_is_meme_mode:!1,p_prompt_text:null,p_metadata:{}});if(S)throw S;return P?(await d(),!0):!1}catch{return c(null),!1}},_=async x=>{if(!n)return!1;try{const{data:p,error:b}=await D.rpc("upgrade_user_tier",{p_user_id:n.id,p_new_tier:x});if(b)throw b;return p?(await d(),!0):!1}catch{return!1}},w=(x,p)=>{const b=e;if(!b||!h(b))return!1;const y=(l==null?void 0:l.credits)??b.credits,P=(l==null?void 0:l.monthlyCreditsUsed)??b.monthly_credits_used,S=m(b.tier);if(x==="improve"&&!S.canImprove)return!1;const U=p||(x==="analyze"?S.analyzeCredits:x==="improve"?S.improveCredits:S.analyzeCredits);return b.tier==="xpert"||b.tier==="pro"?y-P>=U:y>=U},N=f.useCallback(()=>{const x=e;if(!x)return 0;const p=(l==null?void 0:l.credits)??x.credits,b=(l==null?void 0:l.monthlyCreditsUsed)??x.monthly_credits_used;return x.tier==="xpert"||x.tier==="pro"?Math.max(0,p-b):p},[e,l]),A=f.useCallback(()=>{const x=e;return x?x.tier==="xpert"||x.tier==="pro"?x.credits:x.tier==="free"?100:0:0},[e]),k=f.useCallback(async()=>{if(n)try{const{data:x,error:p}=await D.from("user_profiles").select("*").eq("id",n.id).single();if(p)throw p;t(x),he=x,Me=n.id,Be=Date.now()}catch{}},[n]),j=async x=>{if(!n||!e)return!1;try{const{error:p}=await D.from("user_profiles").update({streak_emoji:x}).eq("id",n.id);if(p)throw p;return t(b=>b?{...b,streak_emoji:x}:null),!0}catch{return!1}};return{profile:e?{...e,credits:(l==null?void 0:l.credits)??e.credits,monthly_credits_used:(l==null?void 0:l.monthlyCreditsUsed)??e.monthly_credits_used}:null,loading:s,error:i,tierLimits:e?m(e.tier):null,consumeCredits:v,upgradeTier:_,canPerformAction:w,getCreditsRemaining:N,getTotalCredits:A,optimisticallyConsumeCredits:g,refresh:d,forceRefresh:k,hasValidAccess:()=>h(e),updateStreakEmoji:j}}let st=!1,Ht=null,Jt=null;const Oo=()=>{const n=Math.floor(Math.random()*20)+10,e=Math.floor(Math.random()*7)+1,t=new Date,s=t.getFullYear(),a=t.getMonth(),i=t.getDate(),o=[];for(let l=1;l<=i;l++){const c=`${s}-${String(a+1).padStart(2,"0")}-${String(l).padStart(2,"0")}`;o.push(c)}return{health_percent:67,current_streak:e,missions_list:["Post media (image/video): add 5 more this month","Ask genuine questions: add 7 more this month","Drop punchy one-liners: add 10 more this month","Publish multi-line posts: add 15 more this month"],dashboard_stats:{postCount:n,replyCount:Math.floor(n*2.5),likesCount:Math.floor(n*15),impressionsCount:Math.floor(n*1200)},time_left_str:"0h 29m",posting_days:o,cumulative_views:[{day:"2025-11-01",daily_views:1200,cumulative_views:1200},{day:"2025-11-02",daily_views:1800,cumulative_views:3e3},{day:"2025-11-03",daily_views:2100,cumulative_views:5100},{day:"2025-11-04",daily_views:1500,cumulative_views:6600},{day:"2025-11-05",daily_views:2400,cumulative_views:9e3}],best_time_list:["09:00","12:00","15:00","18:00","21:00"],cached_date:new Date().toISOString().split("T")[0]}};function Xr(n){const{profile:e,loading:t}=ks(n),[s,a]=f.useState(null),[i,o]=f.useState(!0),[l,c]=f.useState(null),d=f.useRef(!1),u=f.useRef(!1),h=()=>s!=null&&s.posting_days?new Set(s.posting_days):new Set,m=()=>{const x=new Date,p=x.getFullYear(),b=String(x.getMonth()+1).padStart(2,"0"),y=String(x.getDate()).padStart(2,"0");return`${p}-${b}-${y}`},g=(x,p)=>`history_${x}_${p}`,v=(x,p)=>{try{const b=g(x,p),y=sessionStorage.getItem(b);if(y)return JSON.parse(y)}catch{}return null},_=(x,p,b,y=!0)=>{try{const P=g(x,p);sessionStorage.setItem(P,JSON.stringify(b)),y&&window.dispatchEvent(new CustomEvent("historyDataUpdated",{detail:{userId:x,data:b}}))}catch{}},w=(x,p)=>{try{const b=`history_${x}_`,y=[];for(let P=0;P<sessionStorage.length;P++){const S=sessionStorage.key(P);S&&S.startsWith(b)&&!S.endsWith(p)&&y.push(S)}y.forEach(P=>{sessionStorage.removeItem(P)})}catch{}},N=async x=>{try{const{data:p,error:b}=await D.from("dashboard_cache").select("cached_data, cached_date").eq("user_id",x).single();if(b||!p)return null;const y=p.cached_data;return y.cached_date=p.cached_date,y}catch{return null}},A=async(x,p,b)=>{try{const{error:y}=await D.from("dashboard_cache").upsert({user_id:x,cached_data:p,cached_date:b,updated_at:new Date().toISOString()},{onConflict:"user_id"});if(y)throw y;_(x,b,p)}catch(y){throw y}},k=async()=>{var b,y;if(!n)return!1;const x=m();if(window.__clearHistoryFetchTracking&&(Ht=null,Jt=null,window.__clearHistoryFetchTracking=!1),st||Ht===n.id&&Jt===x||d.current)return!1;if(!((e==null?void 0:e.tier)==="pro"||(e==null?void 0:e.tier)==="xpert"))return c("Upgrade to Pro to access real dashboard data"),!1;try{d.current=!0,st=!0,o(!0),c(null);const{data:{session:P}}=await D.auth.getSession();if(!P)return c("No valid session found"),!1;const S=-new Date().getTimezoneOffset(),U=await fetch("https://pamffbanuwjldtpshraq.supabase.co/functions/v1/fetch-user-history-data",{method:"POST",headers:{Authorization:`Bearer ${P.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({username:((b=n.user_metadata)==null?void 0:b.preferred_username)||((y=n.user_metadata)==null?void 0:y.user_name),timezoneOffset:S,forceRefresh:!0})});if(!U.ok){const M=await U.json().catch(()=>({error:"Unknown error"}));throw new Error(M.error||`HTTP error! status: ${U.status}`)}const z=await U.json(),W=m();return await A(n.id,z,W),a({...z,cached_date:W}),c(null),Ht=n.id,Jt=W,!0}catch(P){return c(P instanceof Error?P.message:"Failed to fetch user history"),!1}finally{o(!1),d.current=!1,st=!1}};return f.useEffect(()=>{if(!n)return;const x=p=>{const b=p;b.detail.userId===n.id&&a(b.detail.data)};return window.addEventListener("historyDataUpdated",x),()=>window.removeEventListener("historyDataUpdated",x)},[n==null?void 0:n.id]),f.useEffect(()=>{if(!n){a(null),c(null),o(!1),u.current=!1;return}if(!e){o(!0);return}if(u.current&&s)return;const x=setTimeout(()=>{p()},50),p=async()=>{if(!((e==null?void 0:e.tier)==="pro"||(e==null?void 0:e.tier)==="xpert")){a(Oo()),c(null),o(!1),u.current=!0;return}o(!0),a(null),c(null);const y=m();w(n.id,y);const P=v(n.id,y);if(P){a(P),c(null),o(!1),u.current=!0;return}const S=await N(n.id);if(S)S.cached_date===y?(_(n.id,y,S,!1),a(S),c(null),o(!1),u.current=!0):(await k(),u.current=!0);else if(st){let W=0;for(;st&&W<3e4;)await new Promise(X=>setTimeout(X,500)),W+=500;if(W>=3e4){c("Loading timeout - please refresh the page"),o(!1);return}const M=await N(n.id);M?(_(n.id,y,M,!1),a(M),c(null),o(!1),u.current=!0):(c("Failed to load data after fetch"),o(!1))}else await k(),u.current=!0};return()=>clearTimeout(x)},[n==null?void 0:n.id,e]),{historyData:s,loading:i,error:l,getPostingDays:h,updateHistoryData:x=>{if(a(x),n){const p=m();A(n.id,x,p).catch(b=>{})}},fetchFreshData:k}}let Gt=null,Kt=null,Xt=0;const cr=6e4;function Io(n){const[e,t]=f.useState(()=>n&&Kt===n&&Date.now()-Xt<cr?Gt:null),[s,a]=f.useState(!0);return f.useEffect(()=>{if(!n){a(!1);return}if(Kt===n&&Date.now()-Xt<cr){t(Gt),a(!1);return}const i=setTimeout(()=>{o()},100),o=async()=>{var c,d,u;a(!0);try{const{data:h,error:m}=await D.from("social_connections").select("platform, profile_data").eq("user_id",n).eq("is_active",!0);if(m){a(!1);return}if(!h||h.length===0){t(null),a(!1);return}const g=["x","google"];let v=null;for(const _ of g){const w=h.find(N=>N.platform===_);if(w){const N=((c=w.profile_data)==null?void 0:c.picture)||((d=w.profile_data)==null?void 0:d.profile_image_url)||((u=w.profile_data)==null?void 0:u.avatar_url);if(N){v=N;break}}}t(v),Gt=v,Kt=n,Xt=Date.now(),a(!1)}catch{a(!1)}},l=D.channel("social_connections_changes").on("postgres_changes",{event:"*",schema:"public",table:"social_connections",filter:`user_id=eq.${n}`},()=>{o()}).subscribe();return()=>{clearTimeout(i),D.removeChannel(l)}},[n]),{avatarUrl:e,loading:s}}function yt(n){if(n)return n.replace(/_[a-z]+\.(jpg|jpeg|png|gif|webp)$/i,".$1")}function dr({user:n,profile:e,onSignOut:t,getCreditsRemaining:s,refreshProfile:a,onClose:i,isOpen:o,onCollapseChange:l,streakCount:c=0,streakEmoji:d="🔥",onEmojiClick:u,isLoadingEmoji:h=!1,isFreeUser:m=!1,socialAvatarUrl:g,avatarLoading:v=!1,onShowToast:_}){var Ts,Es,Ps,As,Cs,Os,Is;const w=Ce(),N=Je(),[A,k]=f.useState(!1),[j,x]=f.useState(!1),[p,b]=f.useState(()=>{const I=localStorage.getItem("sidebarCollapsed");return I?JSON.parse(I):!1}),[y,P]=f.useState(!1),[S,U]=f.useState(!1),[z,W]=f.useState(null),[M,X]=f.useState(!0),de=f.useRef(null),H=((Es=(Ts=n==null?void 0:n.user_metadata)==null?void 0:Ts.name)==null?void 0:Es.split(" ")[0])||((As=(Ps=n==null?void 0:n.user_metadata)==null?void 0:Ps.display_name)==null?void 0:As.split(" ")[0])||((Cs=n==null?void 0:n.user_metadata)==null?void 0:Cs.preferred_username)||"User",V=z||H,ge="My Workspace";f.useEffect(()=>{(async()=>{if(!n){X(!1);return}try{const{data:oe,error:Qe}=await D.from("social_connections").select("platform, platform_username").eq("user_id",n.id).eq("platform","x").eq("is_active",!0).maybeSingle();!Qe&&oe?(U(!0),W(oe.platform_username)):(U(!1),W(null))}catch{U(!1),W(null)}finally{X(!1)}})()},[n]),f.useEffect(()=>{function I(oe){de.current&&!de.current.contains(oe.target)&&P(!1)}if(y)return document.addEventListener("mousedown",I),()=>{document.removeEventListener("mousedown",I)}},[y]);const[ut,It]=f.useState(0);f.useEffect(()=>{y&&e&&It(I=>I+1)},[e==null?void 0:e.credits,e==null?void 0:e.monthly_credits_used,y]);const ht=e&&s?Math.round((T()-s())/T()*100):0,_e=16,Ie=2*Math.PI*_e,E=Ie-ht/100*Ie;function T(){return e?e.tier==="free"?100:e.tier==="pro"?2500:5e3:100}const q=()=>{const I=!p;b(I),localStorage.setItem("sidebarCollapsed",JSON.stringify(I)),l&&l(I)},K=I=>{(e==null?void 0:e.tier)==="free"&&!S&&!M&&(I.preventDefault(),_&&_("Please connect your X account to view your Wrapped","error"),N("/connections"))},se=()=>{if(!e)return null;switch(e.tier){case"pro":return r.jsx(ln,{size:14,className:"text-blue-500"});case"xpert":return r.jsx(on,{size:14,className:"text-purple-500"});default:return null}},ie=new Date;ie.setMonth(ie.getMonth()-1);const Rt=`${ie.toLocaleString("default",{month:"long"})} Wrapped`,Ns=new Date().getDate()<=7,Ss=[{path:"/create",icon:cn,label:"Create"},{path:"/visualize",icon:dn,label:"Animate",hasBeta:!0},{path:"/memegenerator",icon:un,label:"Meme Maker"},{path:"/analytics",icon:hn,label:"Analytics"},{path:"/queue",icon:fn,label:"Queue"},{path:"/voices",icon:mn,label:"Voices"},{path:"/bookmarks",icon:pn,label:"Bookmarks",requiresPro:!0},{path:"/connections",icon:gn,label:"Connections"}],$t=I=>I==="/analytics"?w.pathname==="/analytics"||w.pathname==="/app"||w.pathname==="/dashboard":I==="/viral-score"?w.pathname==="/viral-score"||w.pathname.startsWith("/viral-score/"):I==="/wrap"?w.pathname==="/wrap":I==="/connections"?w.pathname==="/connections":I==="/visualize"?w.pathname==="/visualize":I==="/memegenerator"?w.pathname==="/memegenerator":w.pathname===I;return window.innerWidth<768?r.jsxs("div",{className:"bg-white h-full w-64 flex flex-col font-sans shadow-xl",onClick:I=>I.stopPropagation(),children:[r.jsxs("nav",{className:"flex flex-col gap-1 mt-6 flex-1 px-3",children:[Ss.map(I=>{const oe=$t(I.path),Qe=I.requiresPro&&(e==null?void 0:e.tier)!=="pro"&&(e==null?void 0:e.tier)!=="xpert",Ye=I.path==="/analytics",Zr=m?0:c;return r.jsxs(B,{to:Qe?"/pricing":I.path,onClick:i,className:`flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-200 group ${oe?"bg-gray-100 text-gray-900":"text-gray-600 hover:bg-gray-50 hover:text-gray-900"}`,children:[r.jsx("span",{className:`shrink-0 ${oe?"text-gray-900":"text-gray-500 group-hover:text-gray-900"}`,children:r.jsx(I.icon,{size:20})}),r.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[r.jsx("span",{className:"text-sm font-medium whitespace-nowrap overflow-hidden",children:I.label}),I.hasBeta&&r.jsx("span",{className:"ml-auto px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wide bg-blue-100 text-blue-600 rounded",children:"Beta"}),Ye&&r.jsxs("span",{className:"ml-auto flex items-center gap-1 text-sm",children:[r.jsx("span",{children:d}),r.jsx("span",{className:"font-semibold text-gray-900",children:Zr})]})]})]},I.path)}),r.jsxs("a",{href:"mailto:moimaere@post2x.com",onClick:i,className:"flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-200 text-gray-600 hover:bg-gray-50 hover:text-gray-900 group",children:[r.jsx("span",{className:"shrink-0 text-gray-500 group-hover:text-gray-900",children:r.jsx(Rs,{size:20})}),r.jsx("span",{className:"text-sm font-medium whitespace-nowrap overflow-hidden",children:"Support"})]})]}),r.jsxs("div",{className:"flex flex-col border-t border-gray-100 p-4 gap-2",children:[Ns&&r.jsx(B,{to:"/wrap",onClick:I=>{K(I),(e==null?void 0:e.tier)==="free"&&!S&&!M||i()},className:"text-white border-2 border-transparent [background-clip:padding-box,border-box] [background-origin:padding-box,border-box] bg-[linear-gradient(#000,#000),linear-gradient(to_right,#22d3ee,#818cf8,#e879f9)] shadow-[0_0_8px_rgba(34,211,238,0.3)] hover:shadow-[0_0_15px_rgba(232,121,249,0.5)] transition-all duration-300 font-bold tracking-wide rounded-full justify-center text-center px-3 py-2.5 text-sm",children:Rt}),r.jsxs(B,{to:"/pricing",onClick:i,className:"flex items-center justify-center gap-2 w-full py-2 rounded-full border border-gray-200 bg-[linear-gradient(45deg,transparent_25%,rgba(68,68,68,.02)_50%,transparent_75%,transparent_100%)] bg-[length:4px_4px] hover:bg-gray-50 transition-all text-sm font-medium text-gray-900 shadow-sm group",children:[r.jsx("div",{className:"w-5 h-5 rounded-full bg-gray-900 text-white flex items-center justify-center shrink-0",children:r.jsx($s,{size:10,fill:"currentColor"})}),r.jsx("span",{className:"whitespace-nowrap",children:"Upgrade"})]}),r.jsxs("div",{className:"relative",ref:de,children:[r.jsxs("button",{onClick:()=>{P(!y),!y&&a&&a()},className:"flex items-center gap-3 w-full group text-left relative py-1 rounded-lg hover:bg-gray-50 transition-colors",children:[r.jsxs("div",{className:"relative w-9 h-9 shrink-0 flex items-center justify-center",children:[r.jsxs("svg",{className:"absolute inset-0 w-full h-full -rotate-90 transform",viewBox:"0 0 36 36",children:[r.jsx("circle",{cx:"18",cy:"18",r:_e,fill:"none",stroke:"#E5E7EB",strokeWidth:"2"}),r.jsx("circle",{cx:"18",cy:"18",r:_e,fill:"none",stroke:"#1F2937",strokeWidth:"2",strokeDasharray:Ie,strokeDashoffset:E,strokeLinecap:"round",className:"transition-all duration-500 ease-out"})]}),r.jsx("div",{className:"w-7 h-7 rounded-full overflow-hidden flex items-center justify-center bg-gray-100 z-10",children:v?r.jsx("span",{className:"text-xs font-bold text-gray-700",children:V.charAt(0).toUpperCase()}):g?r.jsx("img",{src:g,alt:"Avatar",className:"w-full h-full object-cover"}):yt((Os=n==null?void 0:n.user_metadata)==null?void 0:Os.avatar_url)?r.jsx("img",{src:yt(n.user_metadata.avatar_url),alt:"Avatar",className:"w-full h-full object-cover"}):r.jsx("span",{className:"text-xs font-bold text-gray-700",children:V.charAt(0).toUpperCase()})})]}),r.jsxs("div",{className:"flex flex-col flex-1 min-w-0 overflow-hidden",children:[r.jsx("span",{className:"text-sm font-medium text-gray-900 truncate",children:V}),r.jsx("span",{className:"text-xs text-gray-500 truncate",children:ge})]}),r.jsx(Ls,{size:14,className:`text-gray-400 shrink-0 transition-transform ${y?"rotate-180":""}`})]}),y&&r.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-white rounded-lg shadow-lg border border-gray-200 py-2 z-50",children:[r.jsx("div",{className:"px-3 py-2 border-b border-gray-100",children:r.jsxs("div",{className:"flex items-center gap-2",children:[se(),r.jsxs("span",{className:"text-sm font-semibold text-gray-900 capitalize",children:[(e==null?void 0:e.tier)||"Free"," Plan"]})]})}),r.jsxs("div",{className:"px-3 py-2 border-b border-gray-100",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[r.jsx("span",{className:"text-gray-500 font-medium",children:"Total"}),r.jsx("span",{className:"text-gray-900 font-semibold",children:T()})]}),r.jsxs("div",{className:"flex items-center justify-between text-xs",children:[r.jsx("span",{className:"text-gray-500 font-medium",children:"Remaining"}),r.jsx("span",{className:"text-gray-900 font-semibold",children:(s==null?void 0:s())||0})]})]}),r.jsx("button",{onClick:()=>{P(!1),t()},className:"w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 transition-colors",children:"Sign out"})]},`dropdown-${ut}`)]})]})]}):r.jsxs("div",{className:`${p?"w-[72px]":"w-64"} h-screen border-r border-gray-200 bg-white flex flex-col shrink-0 transition-all duration-300 ease-in-out`,children:[r.jsx("div",{className:`h-16 flex items-center ${p?"justify-center flex-col gap-1 mt-2":"justify-between px-4"}`,children:p?r.jsx("button",{onClick:q,onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),className:"w-8 h-8 flex items-center justify-center rounded hover:bg-gray-100 transition-colors",title:"Expand sidebar",children:A?r.jsx(Ds,{size:20,className:"text-gray-600 rotate-180"}):r.jsx("img",{src:"/logo.svg",alt:"Post2X",className:"w-8 h-8 rounded-full"})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("img",{src:"/logo.svg",alt:"Post2X",className:"w-8 h-8 rounded-full"}),r.jsx("span",{className:"font-bold text-gray-900 tracking-tight whitespace-nowrap overflow-hidden",children:"Post2X"})]}),r.jsx("button",{onClick:q,className:"text-gray-400 hover:text-gray-600 transition-colors p-1",children:r.jsx(Ds,{size:18})})]})}),r.jsxs("nav",{className:`flex flex-col gap-1 mt-2 flex-1 ${p?"px-3 items-center":"px-3"}`,children:[Ss.map(I=>{const oe=$t(I.path),Qe=I.requiresPro&&(e==null?void 0:e.tier)!=="pro"&&(e==null?void 0:e.tier)!=="xpert",Ye=I.path==="/analytics";return r.jsx(Ro,{icon:r.jsx(I.icon,{size:20}),label:I.label,active:oe,collapsed:p,to:Qe?"/pricing":I.path,hasBeta:I.hasBeta,streakCount:Ye?c:void 0,streakEmoji:Ye?d:void 0,isFreeUser:Ye?m:void 0},I.path)}),r.jsxs("a",{href:"mailto:moimaere@post2x.com",className:`flex items-center ${p?"justify-center w-10 h-10 px-0":"gap-3 px-3 w-full"} py-2 rounded-lg transition-all duration-200 text-gray-600 hover:bg-gray-50 hover:text-gray-900 group`,title:p?"Support":void 0,children:[r.jsx("span",{className:"shrink-0 text-gray-500 group-hover:text-gray-900",children:r.jsx(Rs,{size:20})}),!p&&r.jsx("span",{className:"text-sm font-medium whitespace-nowrap overflow-hidden",children:"Support"})]})]}),r.jsxs("div",{className:`flex flex-col border-t border-gray-100 ${p?"p-3 items-center py-4 gap-3":"p-4 gap-2"}`,children:[Ns&&r.jsx(B,{to:"/wrap",onClick:K,title:p?Rt:void 0,className:`flex items-center ${p?"justify-center w-10 h-10 px-0":"gap-3 px-3 w-full"} py-2 rounded-full transition-all duration-300 text-white border-2 border-transparent [background-clip:padding-box,border-box] [background-origin:padding-box,border-box] bg-[linear-gradient(#000,#000),linear-gradient(to_right,#22d3ee,#818cf8,#e879f9)] shadow-[0_0_8px_rgba(34,211,238,0.3)] hover:shadow-[0_0_15px_rgba(232,121,249,0.5)] font-bold tracking-wide ${p?"":"justify-center"} ${$t("/wrap")?"shadow-[0_0_15px_rgba(232,121,249,0.5)]":""}`,children:p?r.jsx(Zt,{size:20,className:"text-cyan-300"}):r.jsx("span",{className:"text-sm font-medium whitespace-nowrap overflow-hidden",children:Rt})}),r.jsxs(B,{to:"/pricing",className:`flex items-center justify-center gap-2 w-full py-2 rounded-full border border-gray-200 bg-[linear-gradient(45deg,transparent_25%,rgba(68,68,68,.02)_50%,transparent_75%,transparent_100%)] bg-[length:4px_4px] hover:bg-gray-50 transition-all text-sm font-medium text-gray-900 shadow-sm group ${p?"w-10 h-10 p-0":""}`,title:"Upgrade Plan",children:[r.jsx("div",{className:"w-5 h-5 rounded-full bg-gray-900 text-white flex items-center justify-center shrink-0",children:r.jsx($s,{size:10,fill:"currentColor"})}),!p&&r.jsx("span",{className:"whitespace-nowrap",children:"Upgrade"})]}),r.jsxs("div",{className:"relative",ref:de,children:[r.jsxs("button",{onClick:()=>{P(!y),!y&&a&&a()},className:`flex items-center ${p?"justify-center w-10 h-10":"gap-3 w-full"} group text-left relative py-1 rounded-lg hover:bg-gray-50 transition-colors`,onMouseEnter:()=>!y&&x(!0),onMouseLeave:()=>x(!1),children:[r.jsxs("div",{className:"relative w-9 h-9 shrink-0 flex items-center justify-center",children:[r.jsxs("svg",{className:"absolute inset-0 w-full h-full -rotate-90 transform",viewBox:"0 0 36 36",children:[r.jsx("circle",{cx:"18",cy:"18",r:_e,fill:"none",stroke:"#E5E7EB",strokeWidth:"2"}),r.jsx("circle",{cx:"18",cy:"18",r:_e,fill:"none",stroke:"#1F2937",strokeWidth:"2",strokeDasharray:Ie,strokeDashoffset:E,strokeLinecap:"round",className:"transition-all duration-500 ease-out"})]}),r.jsx("div",{className:"w-7 h-7 rounded-full overflow-hidden flex items-center justify-center bg-gray-100 z-10",children:j&&!y?r.jsxs("span",{className:"text-[10px] font-bold text-gray-900 animate-in fade-in duration-200",children:[ht,"%"]}):v?r.jsx("span",{className:"text-xs font-bold text-gray-700",children:V.charAt(0).toUpperCase()}):g?r.jsx("img",{src:g,alt:"Avatar",className:"w-full h-full object-cover animate-in fade-in duration-200"}):yt((Is=n==null?void 0:n.user_metadata)==null?void 0:Is.avatar_url)?r.jsx("img",{src:yt(n.user_metadata.avatar_url),alt:"Avatar",className:"w-full h-full object-cover animate-in fade-in duration-200"}):r.jsx("span",{className:"text-xs font-bold text-gray-700",children:V.charAt(0).toUpperCase()})})]}),!p&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col flex-1 min-w-0 overflow-hidden",children:[r.jsx("span",{className:"text-sm font-medium text-gray-900 truncate",children:V}),r.jsx("span",{className:"text-xs text-gray-500 truncate",children:ge})]}),r.jsx(Ls,{size:14,className:`text-gray-400 shrink-0 transition-transform ${y?"rotate-180":""}`})]})]}),y&&!p&&r.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-white rounded-lg shadow-lg border border-gray-200 py-2 z-50",children:[r.jsx("div",{className:"px-3 py-2 border-b border-gray-100",children:r.jsxs("div",{className:"flex items-center gap-2",children:[se(),r.jsxs("span",{className:"text-sm font-semibold text-gray-900 capitalize",children:[(e==null?void 0:e.tier)||"Free"," Plan"]})]})}),r.jsxs("div",{className:"px-3 py-2 border-b border-gray-100",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[r.jsx("span",{className:"text-gray-500 font-medium",children:"Total"}),r.jsx("span",{className:"text-gray-900 font-semibold",children:T()})]}),r.jsxs("div",{className:"flex items-center justify-between text-xs",children:[r.jsx("span",{className:"text-gray-500 font-medium",children:"Remaining"}),r.jsx("span",{className:"text-gray-900 font-semibold",children:(s==null?void 0:s())||0})]})]}),r.jsx("button",{onClick:()=>{P(!1),t()},className:"w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 transition-colors",children:"Sign out"})]},`dropdown-${ut}`)]})]})]})}const Ro=({icon:n,label:e,active:t,collapsed:s,to:a,hasBeta:i,streakCount:o,streakEmoji:l,isFreeUser:c})=>{const d=o!==void 0,u=c?0:o;return r.jsxs(B,{to:a,title:s?d?`${e} - ${u} day streak`:e:void 0,className:`flex items-center ${s?"justify-center w-10 h-10 px-0":"gap-3 px-3 w-full"} py-2 rounded-lg transition-all duration-200 group ${t?"bg-gray-100 text-gray-900":"text-gray-600 hover:bg-gray-50 hover:text-gray-900"}`,children:[r.jsx("span",{className:`shrink-0 ${t?"text-gray-900":"text-gray-500 group-hover:text-gray-900"}`,children:n}),!s&&r.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[r.jsx("span",{className:"text-sm font-medium whitespace-nowrap overflow-hidden",children:e}),i&&r.jsx("span",{className:"ml-auto px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wide bg-blue-100 text-blue-600 rounded",children:"Beta"}),d&&r.jsxs("span",{className:"ml-auto flex items-center gap-1 text-sm",children:[r.jsx("span",{children:l}),r.jsx("span",{className:"font-semibold text-gray-900",children:u})]})]})]})},$o=["🔥","⚡","🎯","🚀","💪","⭐","💎","👑","🏆","🎉","💯","✨","🌟","💫","🎨","🎮"];function Lo({user:n,profile:e,onMenuClick:t,onEmojiChange:s,isRightSidebarOpen:a,onBackClick:i}){const o=Ce(),{historyData:l}=Xr(n),[c,d]=f.useState(!1),u=f.useRef(null);f.useEffect(()=>{const v=_=>{u.current&&!u.current.contains(_.target)&&d(!1)};if(c)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[c]);const h=v=>{s&&s(v),d(!1)},m=[{path:"/create",label:"Create"},{path:"/analyze",label:"Analyze"},{path:"/trend",label:"Trends"},{path:"/queue",label:"Queue"},{path:"/bookmarks",label:"Bookmarks"},{path:"/viral-score",label:"Viral Score"},{path:"/pricing",label:"Subscribe"},{path:"/voices",label:"Voices"},{path:"/memegenerator",label:"Meme Maker"},{path:"/visualize",label:"Visualize"}],g=()=>{const v=m.find(_=>o.pathname===_.path||o.pathname.startsWith(_.path+"/"));return(v==null?void 0:v.label)||"Post2X"};return r.jsx("header",{className:"md:hidden fixed top-0 left-0 right-0 z-50 bg-white/95 backdrop-blur-sm border-b border-gray-200 shadow-sm",children:r.jsxs("div",{className:"flex items-center justify-between px-4 h-14",children:[r.jsx("button",{onClick:a?i:t,className:"flex items-center justify-center w-9 h-9 -ml-1 rounded-lg hover:bg-gray-100 active:bg-gray-200 transition-colors",children:a?r.jsx(xn,{size:20,className:"text-gray-700"}):r.jsx(xs,{size:20,className:"text-gray-700"})}),r.jsx("div",{className:"flex items-center flex-1 justify-center",children:r.jsx("span",{className:"font-bold text-gray-900 text-base",children:g()})}),r.jsxs("div",{className:"relative",ref:u,children:[r.jsxs("button",{onClick:()=>d(!c),className:"flex items-center justify-center gap-1.5 px-2 h-9 rounded-lg hover:bg-gray-100 active:bg-gray-200 transition-colors",children:[r.jsx("span",{className:"text-xl leading-none",children:(e==null?void 0:e.streak_emoji)||"🔥"}),r.jsx("span",{className:"text-sm font-bold text-gray-900 leading-none",children:(e==null?void 0:e.tier)==="free"?0:(l==null?void 0:l.current_streak)||0})]}),c&&r.jsx("div",{className:"fixed left-0 right-0 top-14 bg-white border-b border-gray-200 shadow-lg p-4 z-50 animate-in slide-in-from-top duration-200",children:r.jsxs("div",{className:"max-w-md mx-auto",children:[r.jsx("div",{className:"text-xs font-semibold text-gray-500 mb-3",children:"Choose Streak Emoji"}),r.jsx("div",{className:"grid grid-cols-8 gap-2",children:$o.map(v=>r.jsx("button",{onClick:()=>h(v),className:`text-2xl aspect-square flex items-center justify-center rounded-lg transition-all hover:bg-gray-100 active:scale-95 ${((e==null?void 0:e.streak_emoji)||"🔥")===v?"bg-blue-50 ring-2 ring-blue-500":""}`,children:v},v))})]})})]})]})})}const Do=["🔥","⚡","🎯","🚀","💪","⭐","💎","👑","🏆","🎉","💯","✨","🌟","🎃","🦄","🐉","🌈","☀️","🌙","💫","🎨","🎭","🎪","🎬","🎮","🎲","🎰","🧩","🎯","🎱","🏀","⚽","🏈","⚾","🎾","🏐","🏉","🥎","🏏","🏑","🏒","🥍","🏓","🏸","🥊","🥋","🥅","⛳","🍕","🍔","🍟","🌭","🍿","🧁","🍰","🎂","🍩","🍪","🍫","🍬","🍭","🍮","🍯","☕","🥤","🧃","🧋","🍵","🥃","🍷","🍺","🍻","🐶","🐱","🐭","🐹","🐰","🦊","🐻","🐼","🐨","🐯","🦁","🐮","🐷","🐸","🐵","🐔","🐧","🐦","🐤","🦆","🦅","🦉","🦇","🐺","🐗","🐴","🦄","🐝","🐛","🦋","🐌","🐞"];function Uo({isOpen:n,onClose:e,onSelect:t,currentEmoji:s}){const[a,i]=f.useState(s),o=c=>{i(c)},l=()=>{t(a),e()};return r.jsx(kr,{isOpen:n,onClose:e,title:"Choose Your Streak Emoji",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-6xl mb-2",children:a}),r.jsx("p",{className:"text-sm text-[var(--muted)]",children:"This emoji will appear on your streak counter and calendar"})]}),r.jsx("div",{className:"max-h-64 overflow-y-auto p-2 bg-[var(--bg)] rounded-xl",children:r.jsx("div",{className:"grid grid-cols-8 gap-2",children:Do.map(c=>r.jsx("button",{onClick:()=>o(c),className:`
                  text-2xl p-2 rounded-lg transition-all duration-200
                  hover:bg-[var(--hover)] hover:scale-110
                  ${a===c?"bg-blue-100 ring-2 ring-blue-500":""}
                `,children:c},c))})}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:e,className:"flex-1 px-4 py-2 border border-[var(--border)] text-[var(--text)] rounded-xl font-medium hover:bg-[var(--hover)] transition-all duration-200",children:"Cancel"}),r.jsx("button",{onClick:l,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-xl font-medium hover:bg-blue-700 transition-all duration-200",children:"Save"})]})]})})}function zo({message:n,visible:e,onHide:t,type:s="success"}){const[a,i]=f.useState(!1),o=f.useRef(t);if(f.useEffect(()=>{o.current=t},[t]),f.useEffect(()=>{if(e){i(!1);const d=setTimeout(()=>{i(!0)},2700),u=setTimeout(()=>{o.current(),i(!1)},3e3);return()=>{clearTimeout(d),clearTimeout(u)}}else i(!1)},[e]),!e)return null;const l=s==="error"?"bg-red-500":"bg-green-500",c=s==="error"?kt:O;return r.jsx("div",{className:`fixed top-20 left-1/2 transform -translate-x-1/2 z-[9998] transition-all duration-300 ${a?"opacity-0 scale-95":"opacity-100 scale-100"}`,children:r.jsxs("div",{className:`${l} text-white rounded-lg px-6 py-3 flex items-center gap-3 shadow-lg`,children:[r.jsx(c,{size:18,className:"text-white flex-shrink-0"}),r.jsx("span",{className:"text-white text-sm font-medium",children:n})]})})}const Qr=f.createContext({isCollapsed:!1}),tc=()=>f.useContext(Qr);function Te({children:n,streakCount:e,streakEmoji:t,isRightSidebarOpen:s,onBackClick:a}){const{user:i,signOut:o}=Xe(),{profile:l,getCreditsRemaining:c,refresh:d,updateStreakEmoji:u}=ks(i),{historyData:h}=Xr(i),{avatarUrl:m,loading:g}=Io(i==null?void 0:i.id),v=Je(),_=Ce(),[w,N]=f.useState(()=>{const M=localStorage.getItem("sidebarCollapsed");return M?JSON.parse(M):!1}),[A,k]=f.useState(!1),[j,x]=f.useState(!1),[p,b]=f.useState(null),y=e??(h==null?void 0:h.current_streak)??0,P=t||(l==null?void 0:l.streak_emoji)||"🔥",S=(l==null?void 0:l.tier)==="free",U=(M,X="success")=>{b({message:M,type:X}),setTimeout(()=>b(null),3e3)},z=async()=>{try{x(!1),await o(),v("/")}catch{}},W=M=>{N(M),localStorage.setItem("sidebarCollapsed",JSON.stringify(M))};return f.useEffect(()=>(j?(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%"):(document.body.style.overflow="",document.body.style.position="",document.body.style.width=""),()=>{document.body.style.overflow="",document.body.style.position="",document.body.style.width=""}),[j]),i?r.jsxs(Qr.Provider,{value:{isCollapsed:w},children:[r.jsx("div",{className:"hidden md:block fixed left-0 top-0 h-screen z-[200]",children:r.jsx(dr,{isOpen:!0,onClose:()=>{},user:i,profile:l,onSignOut:z,getCreditsRemaining:c,refreshProfile:d,onCollapseChange:W,streakCount:y,streakEmoji:P,onEmojiClick:()=>k(!0),isFreeUser:S,socialAvatarUrl:m,avatarLoading:g,onShowToast:U})}),r.jsxs("div",{className:`md:hidden fixed inset-0 top-14 z-[200] pointer-events-none transition-opacity duration-300 ${j?"opacity-100 pointer-events-auto":"opacity-0"}`,children:[r.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-50",onClick:()=>x(!1)}),r.jsx("div",{className:`absolute left-0 top-0 h-full transition-transform duration-300 ease-out ${j?"translate-x-0":"-translate-x-full"}`,children:r.jsx(dr,{isOpen:j,onClose:()=>x(!1),user:i,profile:l,onSignOut:z,getCreditsRemaining:c,refreshProfile:d,onCollapseChange:()=>{},streakCount:y,streakEmoji:P,socialAvatarUrl:m,avatarLoading:g,onEmojiClick:()=>k(!0),isFreeUser:S,onShowToast:U})})]}),p&&r.jsx(zo,{message:p.message,type:p.type,visible:!!p,onHide:()=>b(null)}),r.jsxs("main",{className:`md:pb-0 min-h-[100dvh] md:min-h-0 transition-all duration-300 ${w?"md:ml-[72px]":"md:ml-64"}`,children:[_.pathname!=="/create"&&_.pathname!=="/memegenerator"&&r.jsx(Lo,{user:i,profile:l,onSignOut:z,getCreditsRemaining:c,onMenuClick:()=>x(!j),onEmojiChange:async M=>{await u(M)},isRightSidebarOpen:s,onBackClick:a}),r.jsx(pe.Suspense,{fallback:r.jsx("div",{className:"flex items-center justify-center min-h-[200px] h-full",children:r.jsx("div",{className:"w-8 h-8 border-2 border-gray-300 border-t-gray-800 rounded-full animate-spin"})}),children:n})]}),A&&r.jsx(Uo,{isOpen:A,onClose:()=>{k(!1),x(!1)},onSelect:async M=>{await u(M),k(!1),x(!1)},currentEmoji:P})]}):r.jsx(r.Fragment,{children:n})}function Ee({children:n,requiresPaid:e=!1}){const{user:t,loading:s}=Xe(),{profile:a}=ks(t),i=Ce(),[o,l]=f.useState(!0);return f.useEffect(()=>{(a!==null||!t)&&l(!1)},[a,t]),s||o&&t?null:t?e&&(a==null?void 0:a.tier)==="free"?r.jsx(nt,{to:"/pricing",state:{from:i},replace:!0}):r.jsx(r.Fragment,{children:n}):r.jsx(nt,{to:"/",state:{from:i},replace:!0})}const Yr="post2x_referral",Mo=30;function Bo(){try{const n=localStorage.getItem(Yr);if(!n)return null;const e=JSON.parse(n);return Fo(e)?(ps(),null):e}catch{return null}}function Fo(n){const e=Mo*24*60*60*1e3;return Date.now()-n.capturedAt>e}function ps(){try{localStorage.removeItem(Yr)}catch{}}function Wo(){const n=Je(),[e,t]=f.useState("Processing authentication...");return f.useEffect(()=>{(async()=>{var a,i,o,l,c,d,u,h,m,g,v,_,w,N;try{t("Verifying session...");const A=new URLSearchParams(window.location.hash.substring(1)),k=new URLSearchParams(window.location.search),j=A.get("error")||k.get("error"),x=A.get("error_description")||k.get("error_description");if(j){t("Authentication failed: "+(x||j)),setTimeout(()=>{n("/",{replace:!0})},3e3);return}const p=A.get("access_token"),b=A.get("refresh_token");if(p&&b){t("Establishing session...");try{const S=D.auth.setSession({access_token:p,refresh_token:b}),U=new Promise((M,X)=>setTimeout(()=>X(new Error("Session timeout")),5e3)),{data:z,error:W}=await Promise.race([S,U]);W&&t("Session error, trying alternative...")}catch{t("Finalizing...")}await new Promise(S=>setTimeout(S,300))}const{data:{session:y},error:P}=await D.auth.getSession();if(P){t("Authentication failed. Redirecting..."),setTimeout(()=>{n("/",{replace:!0})},2e3);return}if(y){const S=((i=(a=y.user)==null?void 0:a.app_metadata)==null?void 0:i.providers)||[];if(S.includes("google")){const{data:H}=await D.from("social_connections").select("*").eq("user_id",y.user.id).eq("platform","google").maybeSingle();if(!H){const{error:V}=await D.from("social_connections").insert({user_id:y.user.id,platform:"google",platform_user_id:((o=y.user.user_metadata)==null?void 0:o.sub)||y.user.id,platform_username:y.user.email||"",profile_data:{name:((l=y.user.user_metadata)==null?void 0:l.full_name)||((c=y.user.user_metadata)==null?void 0:c.name),email:y.user.email,picture:((d=y.user.user_metadata)==null?void 0:d.avatar_url)||((u=y.user.user_metadata)==null?void 0:u.picture)},is_active:!0})}}if(S.includes("linkedin_oidc")){const{data:H}=await D.from("social_connections").select("*").eq("user_id",y.user.id).eq("platform","linkedin").maybeSingle();if(!H){const{error:V}=await D.from("social_connections").insert({user_id:y.user.id,platform:"linkedin",platform_user_id:((h=y.user.user_metadata)==null?void 0:h.sub)||y.user.id,platform_username:((m=y.user.user_metadata)==null?void 0:m.preferred_username)||y.user.email||"",profile_data:{name:((g=y.user.user_metadata)==null?void 0:g.name)||((v=y.user.user_metadata)==null?void 0:v.full_name),email:y.user.email,picture:((_=y.user.user_metadata)==null?void 0:_.picture)||((w=y.user.user_metadata)==null?void 0:w.avatar_url)},is_active:!0})}}const U=Bo();if(U){const{data:H}=await D.from("user_profiles").select("referral_code").eq("id",y.user.id).single();if(H!=null&&H.referral_code)ps();else try{const{error:V}=await D.from("user_profiles").update({referral_code:U.code,referral_landing_page:U.landingPage,referral_captured_at:new Date(U.capturedAt).toISOString()}).eq("id",y.user.id);V||(await D.rpc("increment_referral_signup",{p_referral_code:U.code}),ps())}catch{}}const{data:z,error:W}=await D.from("user_profiles").select("onboarding_completed, plan_selected, tier, twitter_access_token, oauth_version, oauth2_access_token").eq("id",y.user.id).maybeSingle();if(!z){const H=sessionStorage.getItem("auth_redirect");H&&sessionStorage.removeItem("auth_redirect");const V=H||"/create";t("Success! Redirecting..."),setTimeout(()=>{n(V,{replace:!0})},500);return}if(z!=null&&z.oauth2_access_token)try{const H=new AbortController,V=setTimeout(()=>H.abort(),5e3),ge=await fetch("https://pamffbanuwjldtpshraq.supabase.co/functions/v1/x-oauth2-user-info",{method:"POST",headers:{Authorization:`Bearer ${y.access_token}`,"Content-Type":"application/json"},signal:H.signal});clearTimeout(V),ge.ok}catch(H){H.name}((N=y.user.app_metadata)==null?void 0:N.provider)==="twitter"&&!(z!=null&&z.twitter_access_token)&&(z!=null&&z.oauth2_access_token);const M=sessionStorage.getItem("auth_redirect");M&&sessionStorage.removeItem("auth_redirect");const de=k.get("next")||A.get("next")||M||"/create";t("Success! Redirecting..."),setTimeout(()=>{n(de,{replace:!0})},500)}else{t("Finalizing authentication...");const{data:{subscription:S}}=D.auth.onAuthStateChange(async(U,z)=>{if(U==="SIGNED_IN"&&z){const{data:W}=await D.from("user_profiles").select("onboarding_completed, plan_selected, tier").eq("id",z.user.id).single();S.unsubscribe();const M=sessionStorage.getItem("auth_redirect");M?(sessionStorage.removeItem("auth_redirect"),n(M,{replace:!0})):n("/create",{replace:!0})}});setTimeout(async()=>{const{data:{session:U}}=await D.auth.getSession();if(U){const{data:z}=await D.from("user_profiles").select("onboarding_completed, plan_selected, tier").eq("id",U.user.id).single();S.unsubscribe();const W=sessionStorage.getItem("auth_redirect");W?(sessionStorage.removeItem("auth_redirect"),n(W,{replace:!0})):n("/create",{replace:!0})}else S.unsubscribe(),n("/",{replace:!0})},3e3)}}catch{t("An error occurred. Redirecting..."),setTimeout(()=>{n("/",{replace:!0})},2e3)}})()},[n]),r.jsx("div",{className:"min-h-screen bg-[var(--bg)] text-[var(--text)] flex items-center justify-center",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-[var(--accent)] mx-auto mb-4"}),r.jsx("p",{className:"text-[var(--text)] font-medium mb-2",children:"Signing you in..."}),r.jsx("p",{className:"text-[var(--muted)] text-sm",children:e})]})})}const ur=({className:n="w-4 h-4"})=>r.jsxs("svg",{viewBox:"0 0 24 24",className:n,children:[r.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),r.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),r.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.84z",fill:"#FBBC05"}),r.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),Qt=({onNavigateHome:n,onNavigateApp:e,showPricing:t=!1,onPricingClick:s,isFixed:a=!1})=>{const[i,o]=f.useState(!1),l=Je(),{user:c,signInWithGoogle:d}=Xe(),u=()=>{n?n():l("/")};return r.jsxs(r.Fragment,{children:[r.jsx("nav",{className:`${a?"fixed top-0 left-0 right-0 h-16":"sticky top-0"} z-50 bg-white/80 backdrop-blur-md border-b border-gray-100`,children:r.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"flex items-center justify-between h-16",children:[r.jsxs("div",{className:"flex items-center gap-3 sm:gap-4 cursor-pointer shrink-0",onClick:u,children:[r.jsx("img",{src:"/logo.svg",alt:"Post2X",className:"w-12 h-12 sm:w-14 sm:h-14 rounded-full object-cover ring-2 ring-gray-200 flex-shrink-0"}),r.jsx("span",{className:"text-2xl sm:text-3xl font-bold text-gray-900",style:{fontFamily:"KaioBold, sans-serif"},children:"Post2X"})]}),r.jsxs("div",{className:"hidden md:flex items-center gap-8 ml-auto",children:[t&&r.jsx("button",{onClick:s,className:"text-sm font-medium text-gray-600 hover:text-black transition-colors",children:"Pricing"}),c?r.jsxs("button",{onClick:()=>l("/create"),className:"bg-black text-white px-5 py-2.5 rounded-full hover:bg-gray-800 transition-all shadow-sm hover:shadow-md active:scale-95 flex items-center gap-2 font-medium",children:["Open App",r.jsx(ve,{size:16})]}):r.jsxs("button",{onClick:d,className:"bg-black text-white px-5 py-2.5 rounded-full hover:bg-gray-800 transition-all shadow-sm hover:shadow-md active:scale-95 flex items-center gap-2 font-medium",children:[r.jsx("div",{className:"bg-white rounded-full p-0.5",children:r.jsx(ur,{className:"w-4 h-4"})}),"Sign in with Google"]})]}),r.jsx("button",{className:"md:hidden text-gray-900",onClick:()=>o(!i),"aria-label":i?"Close menu":"Open menu",children:i?r.jsx(kt,{size:24}):r.jsx(xs,{size:24})})]})})}),i&&r.jsx("div",{className:"fixed inset-0 bg-black/20 z-30 md:hidden",onClick:()=>o(!1)}),i&&r.jsxs("div",{className:"fixed left-0 right-0 top-16 bg-white/80 backdrop-blur-md z-40 flex flex-col p-6 gap-6 md:hidden animate-in slide-in-from-top-10 duration-200 border-b border-gray-100 shadow-lg",children:[t&&r.jsx("button",{onClick:()=>{s==null||s(),o(!1)},className:"text-lg font-medium text-gray-700 hover:text-black transition-colors text-left",children:"Pricing"}),c?r.jsxs("button",{onClick:()=>{l("/create"),o(!1)},className:"bg-black text-white py-3 rounded-full font-medium flex items-center justify-center gap-2",children:["Open App",r.jsx(ve,{size:18})]}):r.jsxs("button",{onClick:()=>{d(),o(!1)},className:"bg-black text-white py-3 rounded-full font-medium flex items-center justify-center gap-2",children:[r.jsx("div",{className:"bg-white rounded-full p-0.5",children:r.jsx(ur,{className:"w-4 h-4"})}),"Sign in with Google"]})]})]})},wt=()=>r.jsx("footer",{className:"bg-white py-12 md:py-16 px-6 border-t border-gray-200",children:r.jsx("div",{className:"max-w-7xl mx-auto",children:r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-8 md:gap-10",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4 md:mb-6",children:[r.jsx("img",{src:"/logo.svg",alt:"Post2X",className:"w-7 h-7 rounded-full object-cover"}),r.jsx("span",{className:"font-bold text-sm uppercase tracking-wider text-gray-900",children:"Post2X"})]}),r.jsxs("ul",{className:"space-y-3 md:space-y-4 text-gray-600 text-sm",children:[r.jsx("li",{children:"AI-powered social media content creation"}),r.jsx("li",{className:"text-gray-500",children:"2025 Post2x, Inc. All rights reserved."})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-bold text-gray-900 mb-4 md:mb-6 text-sm uppercase tracking-wider h-7 flex items-center",children:"Company"}),r.jsxs("ul",{className:"space-y-3 md:space-y-4 text-gray-600 text-sm",children:[r.jsx("li",{children:r.jsx(B,{to:"/pricing",className:"hover:text-black transition-colors",children:"Pricing"})}),r.jsx("li",{children:r.jsx(B,{to:"/terms",className:"hover:text-black transition-colors",children:"Terms"})}),r.jsx("li",{children:r.jsx(B,{to:"/privacy",className:"hover:text-black transition-colors",children:"Privacy"})}),r.jsx("li",{children:r.jsx(B,{to:"/blog",className:"hover:text-black transition-colors",children:"Blog"})}),r.jsx("li",{children:r.jsx("a",{href:"mailto:moimaere@post2x.com",className:"hover:text-black transition-colors",children:"Contact"})})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-bold text-gray-900 mb-4 md:mb-6 text-sm uppercase tracking-wider h-7 flex items-center",children:"Social"}),r.jsxs("ul",{className:"space-y-3 md:space-y-4 text-gray-600 text-sm",children:[r.jsx("li",{children:r.jsx("a",{href:"https://x.com/post2x",target:"_blank",rel:"noopener noreferrer",className:"hover:text-black transition-colors",children:"X (Post2X)"})}),r.jsx("li",{children:r.jsx("a",{href:"https://x.com/moimaere",target:"_blank",rel:"noopener noreferrer",className:"hover:text-black transition-colors",children:"X (Moimaere)"})})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-bold text-gray-900 mb-4 md:mb-6 text-sm uppercase tracking-wider h-7 flex items-center",children:"Free Tools"}),r.jsxs("ul",{className:"space-y-3 md:space-y-4 text-gray-600 text-sm",children:[r.jsx("li",{children:r.jsx(B,{to:"/memegenerator",className:"hover:text-black transition-colors",children:"Meme Maker"})}),r.jsx("li",{children:r.jsx(B,{to:"/memes",className:"hover:text-black transition-colors",children:"Meme Templates"})}),r.jsx("li",{children:r.jsx(B,{to:"/visualize",className:"hover:text-black transition-colors",children:"Text to Animation"})}),r.jsx("li",{children:r.jsx(B,{to:"/twitter-gif-downloader",className:"hover:text-black transition-colors",children:"Twitter GIF Downloader"})}),r.jsx("li",{children:r.jsx(B,{to:"/twitter-video-downloader",className:"hover:text-black transition-colors",children:"Twitter Video Downloader"})})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-bold text-gray-900 mb-4 md:mb-6 text-sm uppercase tracking-wider h-7 flex items-center",children:"Compare"}),r.jsxs("ul",{className:"space-y-3 md:space-y-4 text-gray-600 text-sm",children:[r.jsx("li",{children:r.jsx(B,{to:"/typefully",className:"hover:text-black transition-colors",children:"Typefully"})}),r.jsx("li",{children:r.jsx(B,{to:"/hypefury",className:"hover:text-black transition-colors",children:"Hypefury"})}),r.jsx("li",{children:r.jsx(B,{to:"/tweethunter",className:"hover:text-black transition-colors",children:"Tweet Hunter"})}),r.jsx("li",{children:r.jsx(B,{to:"/taplio",className:"hover:text-black transition-colors",children:"Taplio"})}),r.jsx("li",{children:r.jsx(B,{to:"/hootsuite",className:"hover:text-black transition-colors",children:"Hootsuite"})}),r.jsx("li",{children:r.jsx(B,{to:"/buffer",className:"hover:text-black transition-colors",children:"Buffer"})}),r.jsx("li",{children:r.jsx(B,{to:"/copyai",className:"hover:text-black transition-colors",children:"CopyAI"})}),r.jsx("li",{children:r.jsx(B,{to:"/postbridge",className:"hover:text-black transition-colors",children:"Post Bridge"})}),r.jsx("li",{children:r.jsx(B,{to:"/postwise",className:"hover:text-black transition-colors",children:"Postwise"})}),r.jsx("li",{children:r.jsx(B,{to:"/superx",className:"hover:text-black transition-colors",children:"SuperX"})})]})]})]})})});function qo({title:n="Post2X - Grow on 𝕏 with daily streaks & tasks",description:e="Personalized post suggestions, banger prediction, daily streaks and tasks.",keywords:t="grow on X, grow on Twitter, viral tweet analyzer, AI post suggestions, social media scoring, AI post optimizer, tweet engagement, viral content, social media analytics, post improvement",ogImage:s="https://post2x.com/logo.svg",canonicalUrl:a,noindex:i=!1,structuredData:o,author:l,publishedDate:c,modifiedDate:d}){const u=n.toLowerCase().includes("post2x")?n:`${n} | Post2X`,h=a||`https://post2x.com${window.location.pathname}`,m=s.startsWith("/")?`https://post2x.com${s}`:s,v=(()=>{const _=[];if(_.push({"@context":"https://schema.org","@type":"Organization",name:"Post2X",url:"https://post2x.com",logo:"https://post2x.com/logo.svg",sameAs:["https://x.com/Post2X"]}),_.push({"@context":"https://schema.org","@type":"WebSite",name:"Post2X",url:"https://post2x.com",potentialAction:{"@type":"SearchAction",target:"https://post2x.com/search?q={search_term_string}","query-input":"required name=search_term_string"}}),!o)return _;const{type:w,data:N,breadcrumbs:A}=o;return(w==="Article"||w==="BlogPosting")&&_.push({"@context":"https://schema.org","@type":w,headline:u,description:e,image:m,author:{"@type":"Organization",name:l||"Post2X"},publisher:{"@type":"Organization",name:"Post2X",logo:{"@type":"ImageObject",url:"https://post2x.com/logo.svg"}},datePublished:c,dateModified:d||c,mainEntityOfPage:{"@type":"WebPage","@id":h},...N}),A&&A.length>0&&_.push({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:A.map((k,j)=>({"@type":"ListItem",position:j+1,name:k.name,item:k.url}))}),(w==="Product"||w==="Service")&&_.push({"@context":"https://schema.org","@type":w,name:u,description:e,image:m,brand:{"@type":"Brand",name:"Post2X"},...N}),w==="FAQPage"&&_.push({"@context":"https://schema.org","@type":"FAQPage",mainEntity:(N==null?void 0:N.questions)||[]}),_})();return r.jsxs(na,{children:[r.jsx("title",{children:u}),r.jsx("meta",{name:"description",content:e}),r.jsx("meta",{name:"keywords",content:t}),r.jsx("meta",{name:"author",content:l||"Post2X"}),r.jsx("meta",{name:"robots",content:i?"noindex, nofollow":"index, follow"}),r.jsx("meta",{name:"fragment",content:"!"}),r.jsx("meta",{property:"og:title",content:u}),r.jsx("meta",{property:"og:description",content:e}),r.jsx("meta",{property:"og:type",content:"website"}),r.jsx("meta",{property:"og:url",content:h}),r.jsx("meta",{property:"og:image",content:m}),r.jsx("meta",{property:"og:site_name",content:"Post2X"}),r.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),r.jsx("meta",{name:"twitter:site",content:"@Post2X"}),r.jsx("meta",{name:"twitter:creator",content:"@Post2X"}),r.jsx("meta",{name:"twitter:title",content:u}),r.jsx("meta",{name:"twitter:description",content:e}),r.jsx("meta",{name:"twitter:image",content:m}),r.jsx("meta",{name:"twitter:image:alt",content:"Post2X - AI Viral Tweet Analyzer"}),r.jsx("link",{rel:"canonical",href:h}),v&&v.map((_,w)=>r.jsx("script",{type:"application/ld+json",children:JSON.stringify(_)},w))]})}const Vo=n=>{const[e,t]=f.useState(!1),s=f.useRef(null);return f.useEffect(()=>{const a=new IntersectionObserver(([i])=>{i.isIntersecting&&(t(!0),s.current&&a.unobserve(s.current))},n);return s.current&&a.observe(s.current),()=>{s.current&&a.unobserve(s.current)}},[s,n]),[s,e]},Q=({children:n,className:e="",delay:t=0})=>{const[s,a]=Vo({threshold:.1,rootMargin:"0px 0px -50px 0px"});return r.jsx("div",{ref:s,style:{transitionDelay:`${t}ms`},className:`transition-all duration-1000 ease-out transform ${a?"opacity-100 translate-y-0":"opacity-0 translate-y-12"} ${e}`,children:n})},Ho=()=>r.jsx("img",{src:"/x_logo.png",alt:"X",className:"w-8 h-8 object-contain"}),Jo=()=>r.jsx("svg",{viewBox:"0 0 24 24",className:"w-8 h-8 text-[#0A66C2]",fill:"currentColor",children:r.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.063 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 21.227.792 22 1.771 22h20.451C23.2 22 24 21.227 24 20.542V1.729C24 .774 23.2 0 22.225 0z"})}),Go=()=>r.jsx("img",{src:"/threads_logo.png",alt:"Threads",className:"w-8 h-8 object-contain"}),Ko=()=>r.jsx("img",{src:"/bluesky2_logo.jpg",alt:"Bluesky",className:"w-8 h-8 object-contain rounded"}),hr=({className:n="w-8 h-8"})=>r.jsxs("svg",{viewBox:"0 0 24 24",className:n,children:[r.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),r.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),r.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.84z",fill:"#FBBC05"}),r.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),Xo=({onNavigateApp:n})=>{const[e,t]=f.useState(!1),[s,a]=f.useState(0),i=f.useRef(null),o=f.useRef(null),[l,c]=f.useState(0),[d,u]=f.useState("monthly"),h=Je(),{showAuthModal:m}=To(),{user:g,signInWithGoogle:v}=Xe();f.useEffect(()=>{g&&h("/create")},[g,h]);const _=f.useRef(null),w=f.useRef(null),N=f.useRef([]),A=f.useRef([]),k=f.useRef(null),[j,x]=f.useState(!1),p=f.useRef(null),b=f.useRef(null),y=f.useRef(null),[P,S]=f.useState(!1),[U,z]=f.useState(!1),[W,M]=f.useState(!1),[X,de]=f.useState([!1,!1,!1]);f.useEffect(()=>{const E=()=>{const T=new IntersectionObserver(([q])=>{x(q.isIntersecting)},{threshold:.4});return k.current&&T.observe(k.current),()=>T.disconnect()};if("requestIdleCallback"in window){const T=requestIdleCallback(E);return()=>cancelIdleCallback(T)}else{const T=setTimeout(E,100);return()=>clearTimeout(T)}},[]),f.useEffect(()=>{N.current.forEach((E,T)=>{E&&(T===s&&j?E.paused&&E.play().catch(()=>{}):E.paused||E.pause())})},[s,j,X]),f.useEffect(()=>{const E={threshold:.5,root:null},T=K=>{K.forEach(se=>{const ie=se.target;se.isIntersecting?(A.current.forEach(je=>{je&&je!==ie&&je.pause()}),ie.play().catch(()=>{})):ie.pause()})},q=new IntersectionObserver(T,E);return A.current.forEach(K=>{K&&q.observe(K)}),()=>{q.disconnect()}},[X]),f.useEffect(()=>{const E={threshold:.5,rootMargin:"0px"},T=se=>{se.forEach(ie=>{const je=ie.target;ie.isIntersecting?je.play().catch(()=>{}):je.pause()})},q=new IntersectionObserver(T,E),K=[p.current,b.current,y.current].filter(Boolean);return K.forEach(se=>{q.observe(se)}),()=>{K.forEach(se=>{q.unobserve(se)})}},[P,U,W]);const H=E=>{if(E.current){const K=E.current.getBoundingClientRect().top+window.pageYOffset-80;window.scrollTo({top:K,behavior:"smooth"})}t(!1)},V=[{id:"texts",title:"Texts",description:"Add your favorite creator, enter a context, and get high-quality, original posts in their style.",videoUrl:"https://pamffbanuwjldtpshraq.supabase.co/storage/v1/object/sign/landing_page_videos/text.mp4?token=eyJraWQiOiJzdG9yYWdlLXVybC1zaWduaW5nLWtleV9mNzM1ZjQ2ZS1lY2JmLTQ3NzAtOTZkMi0xODEzOGVkNWVhZWIiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJsYW5kaW5nX3BhZ2VfdmlkZW9zL3RleHQubXA0IiwiaWF0IjoxNzY1MjE0NTY1LCJleHAiOjIwODA1NzQ1NjV9.TnoPFbkeVUEFJQASuUqk5rQveqs7kmj0KzFsTreS0ME"},{id:"images",title:"Images",description:"Choose an image model and generate thumbnails, covers, or original memes. All ready to post or schedule.",videoUrl:"https://pamffbanuwjldtpshraq.supabase.co/storage/v1/object/sign/landing_page_videos/images.mp4?token=eyJraWQiOiJzdG9yYWdlLXVybC1zaWduaW5nLWtleV9mNzM1ZjQ2ZS1lY2JmLTQ3NzAtOTZkMi0xODEzOGVkNWVhZWIiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJsYW5kaW5nX3BhZ2VfdmlkZW9zL2ltYWdlcy5tcDQiLCJpYXQiOjE3NjUyMTAxMjQsImV4cCI6MjA4MDU3MDEyNH0.dkbBIqvaX-N6RleHZ9Ep8aInUkhigtqW5nqzz2qweAQ"},{id:"shitposts",title:"Shitposts",description:"Never miss the daily trends. Instead of classic memes, get trending memes from Reddit in real-time.",videoUrl:"https://pamffbanuwjldtpshraq.supabase.co/storage/v1/object/sign/landing_page_videos/shitpost.mp4?token=eyJraWQiOiJzdG9yYWdlLXVybC1zaWduaW5nLWtleV9mNzM1ZjQ2ZS1lY2JmLTQ3NzAtOTZkMi0xODEzOGVkNWVhZWIiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJsYW5kaW5nX3BhZ2VfdmlkZW9zL3NoaXRwb3N0Lm1wNCIsImlhdCI6MTc2NTIxMDMyMywiZXhwIjoyMDgwNTcwMzIzfQ.dl9BRD-yb33_vcDr1PlVz0IXm8RzHbewL_npLWXtONM"}],ge=[{quote:`Post2x got it straight off the bat, helped me scale the best of my tweets.

Bangers only. It's 🔥🔥🔥`,name:"Cara Ernon",role:"CEO of Uppp",avatar:"/cara.JPG"},{quote:`With Post2x, I never run out of ideas!

It delivers high-performing posts that perfectly match each client's style.`,name:"Hakim Tanrıverdi",role:"Ghostwriter",avatar:"/hakim.jpg"},{quote:"I write all my own posts and value authenticity, but seeing how Post2x nails @Moimaere's tone (built in public) I'm curious to try it.",name:"Ben Boarer",role:"Co-founder of Sprynge",avatar:"/BenBoarer.jpg"}],ut=()=>{if(i.current){const E=i.current.scrollLeft,T=i.current.offsetWidth,q=Math.round(E/T);q!==s&&a(q)}},It=()=>{if(o.current){const E=o.current.scrollLeft,T=o.current.offsetWidth,q=Math.round(E/T);q!==l&&c(q)}},ht=r.jsxs("div",{className:"w-full md:aspect-[4/3] bg-gray-100 rounded-3xl overflow-hidden shadow-2xl relative border border-gray-200",children:[!P&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-100",children:r.jsx("div",{className:"w-8 h-8 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin"})}),r.jsx("video",{ref:p,src:"https://pamffbanuwjldtpshraq.supabase.co/storage/v1/object/sign/landing_page_videos/improveD.mp4?token=eyJraWQiOiJzdG9yYWdlLXVybC1zaWduaW5nLWtleV9mNzM1ZjQ2ZS1lY2JmLTQ3NzAtOTZkMi0xODEzOGVkNWVhZWIiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJsYW5kaW5nX3BhZ2VfdmlkZW9zL2ltcHJvdmVELm1wNCIsImlhdCI6MTc2NTIxNTg3MiwiZXhwIjoyMDgwNTc1ODcyfQ.ihYKqBUQYkUEQVmn3UvolCPShVw8q_QKRNlRKSSzyP0",className:`w-full h-auto md:h-full md:object-cover transition-opacity duration-300 ${P?"opacity-100":"opacity-0"}`,loop:!0,muted:!0,playsInline:!0,"webkit-playsinline":"true","x5-playsinline":"true",preload:"auto",onLoadedData:()=>S(!0)})]}),_e=r.jsxs("div",{className:"w-full md:aspect-[4/3] bg-gray-100 rounded-3xl overflow-hidden shadow-2xl relative border border-gray-200",children:[!U&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-100",children:r.jsx("div",{className:"w-8 h-8 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin"})}),r.jsx("video",{ref:b,src:"https://pamffbanuwjldtpshraq.supabase.co/storage/v1/object/sign/landing_page_videos/schedule.mp4?token=eyJraWQiOiJzdG9yYWdlLXVybC1zaWduaW5nLWtleV9mNzM1ZjQ2ZS1lY2JmLTQ3NzAtOTZkMi0xODEzOGVkNWVhZWIiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJsYW5kaW5nX3BhZ2VfdmlkZW9zL3NjaGVkdWxlLm1wNCIsImlhdCI6MTc2NTIxMDg1MCwiZXhwIjoyMDgwNTcwODUwfQ.Vyzk4UT7wvh4Z961oRHqGu3A8r8_d20JqpqhLfGGyfs",className:`w-full h-auto md:h-full md:object-cover transition-opacity duration-300 ${U?"opacity-100":"opacity-0"}`,loop:!0,muted:!0,playsInline:!0,"webkit-playsinline":"true","x5-playsinline":"true",preload:"auto",onLoadedData:()=>z(!0)})]}),Ie=r.jsxs("div",{className:"w-full md:aspect-[4/3] bg-gray-100 rounded-3xl overflow-hidden shadow-2xl relative border border-gray-200",children:[!W&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-100",children:r.jsx("div",{className:"w-8 h-8 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin"})}),r.jsx("video",{ref:y,src:"https://pamffbanuwjldtpshraq.supabase.co/storage/v1/object/sign/landing_page_videos/analytics.mov?token=eyJraWQiOiJzdG9yYWdlLXVybC1zaWduaW5nLWtleV9mNzM1ZjQ2ZS1lY2JmLTQ3NzAtOTZkMi0xODEzOGVkNWVhZWIiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJsYW5kaW5nX3BhZ2VfdmlkZW9zL2FuYWx5dGljcy5tb3YiLCJpYXQiOjE3NjUyMTA5NzgsImV4cCI6MjA4MDU3MDk3OH0.2oP83ordWxRkUhR96dKI-2pnh2miq8BRCD1eTHJbCnU",className:`w-full h-auto md:h-full md:object-cover transition-opacity duration-300 ${W?"opacity-100":"opacity-0"}`,loop:!0,muted:!0,playsInline:!0,"webkit-playsinline":"true","x5-playsinline":"true",preload:"auto",onLoadedData:()=>M(!0)})]});return r.jsxs("div",{className:"min-h-screen bg-white text-gray-900 font-sans selection:bg-black/10",children:[r.jsx(qo,{title:"Post2X - AI Content Creator for X, LinkedIn, Threads & Bluesky",description:"Create 100+ posts in 1 hour. AI-powered content creation that matches your voice. Generate posts, images, and animations for X, LinkedIn, Threads & Bluesky.",keywords:"AI content creator, social media content generator, AI post creator, Twitter content creator, LinkedIn content generator, X post generator, Threads content creator, Bluesky post creator, AI writing assistant, content creation tool, social media automation, AI copywriting, post scheduler, content marketing tool, social media management",canonicalUrl:"https://post2x.com",ogImage:"https://post2x.com/logo.svg",structuredData:{type:"Organization",data:{name:"Post2X",url:"https://post2x.com",logo:"https://post2x.com/logo.svg",description:"AI-powered content creation platform for social media",sameAs:["https://x.com/moimaere"]}}}),r.jsx("style",{children:`
        @keyframes float {
            0% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
            100% { transform: translateY(0px); }
        }
        /* Hide scrollbar for Chrome, Safari and Opera */
        .no-scrollbar::-webkit-scrollbar {
            display: none;
        }
        /* Hide scrollbar for IE, Edge and Firefox */
        .no-scrollbar {
            -ms-overflow-style: none;  /* IE and Edge */
            scrollbar-width: none;  /* Firefox */
        }
      `}),r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-white/80 backdrop-blur-md border-b border-gray-100",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"flex items-center justify-between h-16",children:[r.jsxs("div",{className:"flex items-center gap-3 sm:gap-4 cursor-pointer shrink-0",onClick:n,children:[r.jsx("img",{src:"/logo.svg",alt:"Post2X Logo",className:"w-12 h-12 sm:w-14 sm:h-14 rounded-full object-cover ring-2 ring-gray-200 flex-shrink-0"}),r.jsx("span",{className:"text-2xl sm:text-3xl font-bold text-gray-900",style:{fontFamily:"KaioBold, sans-serif"},children:"Post2X"})]}),r.jsxs("div",{className:"hidden md:flex items-center gap-8 ml-auto",children:[r.jsx("button",{onClick:()=>H(w),className:"text-sm font-medium text-gray-500 hover:text-black transition-colors",children:"Pricing"}),g?r.jsxs("button",{onClick:()=>h("/create"),className:"bg-black text-white px-5 py-2.5 rounded-full hover:bg-gray-800 transition-all shadow-sm hover:shadow-md active:scale-95 flex items-center gap-2 font-medium",children:["Open App",r.jsx(ve,{size:16})]}):r.jsxs("button",{onClick:v,className:"bg-black text-white px-5 py-2.5 rounded-full hover:bg-gray-800 transition-all shadow-sm hover:shadow-md active:scale-95 flex items-center gap-2 font-medium",children:[r.jsx("div",{className:"bg-white rounded-full p-0.5",children:r.jsx(hr,{className:"w-4 h-4"})}),"Sign in with Google"]})]}),r.jsx("button",{className:"md:hidden text-gray-900",onClick:()=>t(!e),children:e?r.jsx(kt,{size:24}):r.jsx(xs,{size:24})})]})})}),e&&r.jsxs("div",{className:"fixed inset-0 top-16 bg-white z-40 flex flex-col p-6 gap-6 md:hidden animate-in slide-in-from-top-10 duration-200 border-t border-gray-100",children:[r.jsx("button",{onClick:()=>H(_),className:"text-lg font-medium text-gray-600 text-left",children:"Features"}),r.jsx("button",{onClick:()=>H(w),className:"text-lg font-medium text-gray-600 text-left",children:"Pricing"}),r.jsx("div",{className:"h-px bg-gray-100 w-full my-2"}),g?r.jsxs("button",{onClick:()=>h("/create"),className:"bg-black text-white py-3 rounded-full font-medium flex items-center justify-center gap-2",children:["Open App",r.jsx(ve,{size:18})]}):r.jsxs("button",{onClick:v,className:"bg-black text-white py-3 rounded-full font-medium flex items-center justify-center gap-2",children:[r.jsx("div",{className:"bg-white rounded-full p-0.5",children:r.jsx(hr,{className:"w-4 h-4"})}),"Sign in with Google"]})]}),r.jsxs("main",{className:"pt-32 md:pt-32 pb-8 px-4 md:px-6 max-w-7xl mx-auto flex flex-col items-center text-center",children:[r.jsxs("div",{className:"flex gap-4 mb-10",children:[r.jsx("div",{className:"w-6 h-6 md:w-10 md:h-10 text-gray-400 opacity-70 hover:opacity-100 transition-opacity",children:r.jsx(Ho,{})}),r.jsx("div",{className:"w-6 h-6 md:w-10 md:h-10 text-[#0077b5] opacity-70 hover:opacity-100 transition-opacity",children:r.jsx(Jo,{})}),r.jsx("div",{className:"w-6 h-6 md:w-10 md:h-10 text-black opacity-70 hover:opacity-100 transition-opacity",children:r.jsx(Go,{})}),r.jsx("div",{className:"w-6 h-6 md:w-10 md:h-10 text-[#0085ff] opacity-70 hover:opacity-100 transition-opacity",children:r.jsx(Ko,{})})]}),r.jsxs("h1",{className:"hero-title text-[2.25rem] sm:text-5xl md:text-7xl font-bold tracking-tight mb-6 text-gray-900 max-w-5xl mx-auto leading-[1.1]",style:{fontFamily:"KaioBold, sans-serif"},children:["Create 100+ posts ",r.jsx("br",{}),r.jsx("span",{className:"text-gray-400",children:"in just 1 hour."})]}),r.jsx("p",{className:"hero-subtitle text-base sm:text-lg md:text-xl text-gray-500 max-w-3xl mb-10 leading-relaxed mx-auto",children:"Stop copying old viral formats. Create personalized banger content in any style and schedule it to all your channels in one shot."}),r.jsxs("div",{className:"flex flex-col items-center gap-8 mb-16 w-full",children:[r.jsx("div",{className:"flex flex-col items-center gap-3 w-full sm:w-auto",children:g?r.jsxs("button",{onClick:()=>h("/create"),className:"hero-cta w-full sm:w-auto bg-black text-white px-6 py-3 rounded-full font-semibold text-base hover:bg-gray-800 transition-all shadow-lg hover:shadow-xl active:scale-95 flex items-center justify-center gap-2 min-w-[180px]",children:["Open App ",r.jsx(ve,{size:18})]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:m,className:"hero-cta w-full sm:w-auto bg-black text-white px-6 py-3 rounded-full font-semibold text-base hover:bg-gray-800 transition-all shadow-lg hover:shadow-xl active:scale-95 flex items-center justify-center gap-2 min-w-[180px]",children:["Start for free ",r.jsx(ve,{size:18})]}),r.jsx("span",{className:"text-sm text-gray-500 font-medium",children:"No credit card required"})]})}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[r.jsx("div",{className:"flex -space-x-3",children:["/cara.JPG","/wojak_avatar.jpg","/pablo_avatar.jpg","/rudy_avatar.jpg","/moi_avatar.jpg"].map((E,T)=>r.jsx("div",{className:"w-10 h-10 rounded-full border-2 border-white overflow-hidden bg-gray-100 ring-1 ring-gray-50",children:r.jsx("img",{src:E,alt:`User ${T}`,className:"w-full h-full object-cover",loading:"lazy"})},T))}),r.jsxs("div",{className:"text-gray-600 text-lg",children:["Used by ",r.jsx("span",{className:"text-gray-900 font-bold",children:"250+"})," creators"]})]})]})]}),r.jsxs("section",{ref:_,className:"pt-12 pb-16 md:pb-12 max-w-7xl mx-auto px-6",children:[r.jsxs(Q,{className:"flex flex-col gap-6 lg:hidden",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-md bg-green-50 text-green-600 text-xs font-bold tracking-wider uppercase mb-6",children:[r.jsx(Zt,{size:14}),"AI Generation"]}),r.jsxs("h2",{className:"text-4xl font-bold text-gray-900 leading-[1.1]",style:{fontFamily:"KaioBold, sans-serif"},children:["Create content ",r.jsx("br",{}),r.jsx("span",{className:"text-green-500",children:"in seconds"})]})]}),r.jsx("div",{ref:i,onScroll:ut,className:"flex overflow-x-auto snap-x snap-mandatory pb-4 no-scrollbar pl-6",style:{scrollbarWidth:"none"},children:V.map((E,T)=>r.jsxs("div",{className:`w-[75vw] shrink-0 snap-start flex flex-col gap-4 ${T===V.length-1?"mr-6":"mr-4"}`,children:[r.jsx("h3",{className:"text-xl font-bold text-gray-900",children:E.title}),r.jsx("p",{className:"text-gray-600 leading-relaxed text-lg",children:E.description}),r.jsxs("div",{className:"w-full bg-gray-100 rounded-2xl overflow-hidden shadow-lg relative border border-gray-200",children:[!X[T]&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-100 z-10",children:r.jsx("div",{className:"w-8 h-8 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin"})}),r.jsx("video",{ref:q=>A.current[T]=q,src:E.videoUrl,className:`w-full h-auto transition-opacity duration-300 ${X[T]?"opacity-100":"opacity-0"}`,loop:!0,muted:!0,playsInline:!0,"webkit-playsinline":"true","x5-playsinline":"true",preload:"auto",onLoadedData:()=>de(q=>{const K=[...q];return K[T]=!0,K})})]})]},E.id))})]}),r.jsxs(Q,{className:"hidden lg:block pt-12",children:[r.jsxs("div",{className:"mb-16 max-w-2xl",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-md bg-green-50 text-green-600 text-xs font-bold tracking-wider uppercase mb-6",children:[r.jsx(Zt,{size:14}),"AI Generation"]}),r.jsxs("h2",{className:"text-4xl md:text-5xl font-bold text-gray-900 leading-[1.1]",style:{fontFamily:"KaioBold, sans-serif"},children:["Create content ",r.jsx("br",{}),r.jsx("span",{className:"text-green-500",children:"in seconds"})]})]}),r.jsxs("div",{ref:k,className:"flex flex-row gap-16 items-start",children:[r.jsx("div",{className:"flex-1 space-y-8 relative pt-4",children:V.map((E,T)=>r.jsxs("div",{onClick:()=>a(T),className:`flex items-start gap-4 p-4 rounded-xl cursor-pointer transition-all duration-300 border ${s===T?"bg-white border-gray-200 shadow-sm":"bg-transparent border-transparent hover:bg-gray-50"}`,children:[r.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center shrink-0 mt-1 transition-colors ${s===T?"bg-black text-white":"bg-gray-100 text-gray-400"}`,children:T===0?r.jsx(yn,{size:14}):T===1?r.jsx(vn,{size:14}):r.jsx(bn,{size:14})}),r.jsxs("div",{children:[r.jsx("h4",{className:`font-semibold mb-1 ${s===T?"text-gray-900":"text-gray-600"}`,children:E.title}),r.jsx("p",{className:"text-gray-500 text-sm leading-relaxed",children:E.description})]})]},E.id))}),r.jsx("div",{className:"flex-1 w-full",children:r.jsxs("div",{className:"w-full aspect-square md:aspect-[4/3] bg-gray-100 rounded-3xl overflow-hidden shadow-2xl relative border border-gray-200 ring-1 ring-gray-200 flex items-center justify-center",children:[!X[s]&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-100 z-20",children:r.jsx("div",{className:"w-10 h-10 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin"})}),V.map((E,T)=>r.jsx("div",{className:`absolute inset-0 transition-opacity duration-500 ${s===T?"opacity-100 z-10":"opacity-0 z-0"}`,children:r.jsx("div",{className:"w-full h-full bg-gray-100 relative overflow-hidden",children:r.jsx("video",{ref:q=>N.current[T]=q,src:E.videoUrl,className:`w-full h-full object-cover transition-opacity duration-300 ${X[T]?"opacity-100":"opacity-0"}`,loop:!0,muted:!0,playsInline:!0,"webkit-playsinline":"true","x5-playsinline":"true",preload:"auto",onLoadedData:()=>de(q=>{const K=[...q];return K[T]=!0,K})})})},E.id))]})})]})]})]}),r.jsx("section",{className:"py-16 md:py-12 max-w-7xl mx-auto px-6",children:r.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 lg:gap-16 items-center",children:[r.jsx(Q,{className:"flex-1 w-full order-2 lg:order-1",children:ht}),r.jsxs(Q,{className:"flex-1 space-y-8 self-center order-1 lg:order-2",delay:200,children:[r.jsxs("div",{children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-md bg-purple-50 text-purple-600 text-xs font-bold tracking-wider uppercase mb-6",children:[r.jsx(wn,{size:14}),"Go Viral"]}),r.jsxs("h2",{className:"text-4xl md:text-5xl font-bold text-gray-900 leading-[1.1] mb-6",style:{fontFamily:"KaioBold, sans-serif"},children:["Analyze ",r.jsx("br",{className:"md:hidden"}),"& Improve ",r.jsx("br",{}),r.jsx("span",{className:"text-purple-500",children:"before posting"})]}),r.jsx("p",{className:"text-xl text-gray-500 leading-relaxed max-w-md",children:"Don't guess what works. Get instant feedback on your content's potential performance, clarity, and tone alignment before it goes live."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-purple-100 flex items-center justify-center text-purple-600 shrink-0 mt-1",children:r.jsx(O,{size:14,strokeWidth:3})}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold text-gray-900",children:"Virality Score"}),r.jsx("p",{className:"text-gray-500 text-sm",children:"Predict how likely your post is to be shared."})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-purple-100 flex items-center justify-center text-purple-600 shrink-0 mt-1",children:r.jsx(O,{size:14,strokeWidth:3})}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold text-gray-900",children:"Smart Improvement"}),r.jsx("p",{className:"text-gray-500 text-sm",children:"Boost your post without changing its context."})]})]})]})]})]})}),r.jsx("section",{className:"py-16 md:py-12 max-w-7xl mx-auto px-6",children:r.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 lg:gap-16 items-center",children:[r.jsxs(Q,{className:"flex-1 space-y-8 self-center",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-md bg-blue-50 text-blue-600 text-xs font-bold tracking-wider uppercase mb-6",children:[r.jsx(_n,{size:14}),"Scheduling"]}),r.jsxs("h2",{className:"text-4xl md:text-5xl font-bold text-gray-900 leading-[1.1] mb-6",style:{fontFamily:"KaioBold, sans-serif"},children:["Schedule posts ",r.jsx("br",{}),r.jsx("span",{className:"text-blue-500",children:"effortlessly"})]}),r.jsx("p",{className:"text-xl text-gray-500 leading-relaxed max-w-md",children:"Queue up your content for the week in one sitting. We handle the posting at the times you choose."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 shrink-0 mt-1",children:r.jsx(O,{size:14,strokeWidth:3})}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold text-gray-900",children:"Multi-platform"}),r.jsx("p",{className:"text-gray-500 text-sm",children:"X, LinkedIn, Threads, and Bluesky support."})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 shrink-0 mt-1",children:r.jsx(O,{size:14,strokeWidth:3})}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold text-gray-900",children:"Smart Queue"}),r.jsx("p",{className:"text-gray-500 text-sm",children:"Set slots once. Queue posts anytime."})]})]})]})]}),r.jsx(Q,{className:"flex-1 w-full",delay:200,children:_e})]})}),r.jsx("section",{className:"py-16 md:py-12 max-w-7xl mx-auto px-6",children:r.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 lg:gap-16 items-center",children:[r.jsx(Q,{className:"flex-1 w-full order-2 lg:order-1",children:Ie}),r.jsxs(Q,{className:"flex-1 space-y-8 self-center order-1 lg:order-2",delay:200,children:[r.jsxs("div",{children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-md bg-orange-50 text-orange-600 text-xs font-bold tracking-wider uppercase mb-6",children:[r.jsx(jn,{size:14}),"Gamification"]}),r.jsxs("h2",{className:"text-4xl md:text-5xl font-bold text-gray-900 leading-[1.1] mb-6",style:{fontFamily:"KaioBold, sans-serif"},children:["Track your progress ",r.jsx("br",{}),r.jsx("span",{className:"text-orange-500",children:"with Streaks 🔥"})]}),r.jsx("p",{className:"text-xl text-gray-500 leading-relaxed max-w-md",children:"Consistency is key to growth. We make it fun to show up every day with streak tracking and achievement badges."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-orange-100 flex items-center justify-center text-orange-600 shrink-0 mt-1",children:r.jsx(O,{size:14,strokeWidth:3})}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold text-gray-900",children:"Momentum Score"}),r.jsx("p",{className:"text-gray-500 text-sm",children:"Hit your targets and level up."})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-orange-100 flex items-center justify-center text-orange-600 shrink-0 mt-1",children:r.jsx(O,{size:14,strokeWidth:3})}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold text-gray-900",children:"X Analytics"}),r.jsx("p",{className:"text-gray-500 text-sm",children:"View your performance at a glance."})]})]})]})]})]})}),r.jsx("section",{className:"py-16 md:py-24 bg-white border-t border-gray-50",children:r.jsxs("div",{className:"max-w-7xl mx-auto px-6",children:[r.jsx(Q,{className:"text-center mb-8 md:mb-16",children:r.jsxs("h2",{className:"text-4xl md:text-5xl font-bold text-gray-900",style:{fontFamily:"KaioBold, sans-serif"},children:["Loved ",r.jsx("br",{className:"md:hidden"}),"by Creators"]})}),r.jsx("div",{className:"md:hidden flex overflow-x-auto snap-x snap-mandatory pb-4 no-scrollbar pl-6",children:ge.map((E,T)=>r.jsx("div",{className:`w-[75vw] shrink-0 snap-start h-full ${T===ge.length-1?"mr-6":"mr-4"}`,children:r.jsxs("div",{className:"bg-white border border-gray-100 rounded-2xl p-6 hover:shadow-lg transition-all duration-300 hover:border-gray-200 flex flex-col justify-between h-full",children:[r.jsxs("div",{className:"text-lg text-gray-600 font-medium leading-relaxed mb-8 whitespace-pre-wrap",children:['"',E.quote,'"']}),r.jsxs("div",{className:"flex items-center gap-3 mt-auto",children:[r.jsx("div",{className:"w-10 h-10 rounded-full overflow-hidden bg-gray-100 border border-gray-100",children:r.jsx("img",{src:E.avatar,alt:E.name,className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"font-bold text-gray-900 text-sm",children:E.name}),r.jsx("span",{className:"text-xs text-gray-400 font-medium",children:E.role})]})]})]})},T))}),r.jsx("div",{className:"hidden md:grid grid-cols-3 gap-6",children:ge.map((E,T)=>r.jsx(Q,{delay:T*100,className:"h-full",children:r.jsxs("div",{className:"bg-white border border-gray-100 rounded-2xl p-8 hover:shadow-lg transition-all duration-300 hover:border-gray-200 flex flex-col justify-between h-full",children:[r.jsxs("div",{className:"text-lg text-gray-600 font-medium leading-relaxed mb-8 whitespace-pre-wrap",children:['"',E.quote,'"']}),r.jsxs("div",{className:"flex items-center gap-3 mt-auto",children:[r.jsx("div",{className:"w-10 h-10 rounded-full overflow-hidden bg-gray-100 border border-gray-100",children:r.jsx("img",{src:E.avatar,alt:E.name,className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"font-bold text-gray-900 text-sm",children:E.name}),r.jsx("span",{className:"text-xs text-gray-400 font-medium",children:E.role})]})]})]})},T))})]})}),r.jsx("section",{ref:w,className:"py-16 md:py-24 bg-black text-white",children:r.jsxs("div",{className:"max-w-7xl mx-auto px-6",children:[r.jsxs(Q,{className:"text-center mb-8 md:mb-10",children:[r.jsx("h2",{className:"text-3xl md:text-5xl font-bold mb-4 md:mb-6",style:{fontFamily:"KaioBold, sans-serif"},children:"Simple pricing for everyone."}),r.jsx("p",{className:"text-lg md:text-xl text-gray-400 max-w-2xl mx-auto",children:"Start for free and upgrade as you grow. No hidden fees."})]}),r.jsx(Q,{className:"flex justify-center mb-12",children:r.jsxs("div",{className:"bg-gray-900 p-1 rounded-full inline-flex items-center relative border border-gray-800",children:[r.jsx("button",{onClick:()=>u("monthly"),className:`px-6 py-2.5 rounded-full text-sm font-bold transition-all duration-300 ${d==="monthly"?"bg-white text-black shadow-md":"text-gray-400 hover:text-white"}`,children:"Monthly"}),r.jsxs("button",{onClick:()=>u("yearly"),className:`px-6 py-2.5 rounded-full text-sm font-bold transition-all duration-300 flex items-center gap-2 ${d==="yearly"?"bg-white text-black shadow-md":"text-gray-400 hover:text-white"}`,children:["Yearly",r.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full font-bold transition-colors ${d==="yearly"?"bg-green-500 text-black":"bg-gray-800 text-green-400"}`,children:"-20%"})]})]})}),r.jsxs("div",{ref:o,onScroll:It,className:"md:hidden flex overflow-x-auto snap-x snap-mandatory pb-4 no-scrollbar pl-6",children:[r.jsx("div",{className:"w-[75vw] shrink-0 snap-start mr-4 flex flex-col h-full",children:r.jsxs("div",{className:"bg-white/5 rounded-3xl p-4 border border-white/10 hover:border-white/20 transition-all flex flex-col h-full pointer-events-auto",children:[r.jsx("div",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider mb-3",children:"Starter"}),r.jsxs("div",{className:"flex items-baseline gap-1 mb-2",children:[r.jsx("span",{className:"text-4xl font-bold text-white",children:"$0"}),r.jsx("span",{className:"text-gray-400",children:"/mo"})]}),r.jsx("p",{className:"text-gray-400 mb-3 h-10 text-sm leading-relaxed",children:"For creators getting started."}),r.jsx("button",{onClick:m,className:"w-full bg-white/10 hover:bg-white/20 text-white font-semibold py-3 rounded-full transition-colors mb-3",children:"GET STARTED"}),r.jsxs("ul",{className:"space-y-2 text-sm text-gray-300",children:[r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," 100 Credits"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Advanced content creation"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Virality predictions"]})]})]})}),r.jsx("div",{className:"w-[75vw] shrink-0 snap-start mr-4 flex flex-col h-full",children:r.jsxs("div",{className:"bg-white rounded-3xl p-4 border border-white relative flex flex-col h-full shadow-2xl shadow-white/5 pointer-events-auto overflow-hidden",children:[d==="monthly"&&r.jsx("div",{className:"absolute top-0 right-0 bg-green-500 text-black text-[10px] font-bold px-3 py-1.5 rounded-bl-xl rounded-tr-2xl uppercase tracking-wide",children:"FIRST MONTH 50% OFF"}),r.jsx("div",{className:"text-sm font-bold text-gray-500 uppercase tracking-wider mb-3",children:"Pro"}),r.jsx("div",{className:"flex flex-col mb-2",children:d==="monthly"?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-gray-400 line-through text-sm font-medium",children:"$24/mo"}),r.jsxs("div",{className:"flex items-baseline gap-1",children:[r.jsx("span",{className:"text-4xl font-bold text-gray-900",children:"$12"}),r.jsx("span",{className:"text-gray-500",children:"/mo"})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-baseline gap-1",children:[r.jsx("span",{className:"text-4xl font-bold text-gray-900",children:"$19"}),r.jsx("span",{className:"text-gray-500",children:"/mo"})]}),r.jsx("span",{className:"text-xs text-gray-500 font-medium mt-1",children:"Billed annually $228"})]})}),r.jsx("p",{className:"text-gray-500 mb-3 h-10 text-sm leading-relaxed",children:"For creators leveling up their content."}),r.jsx("button",{onClick:m,className:"w-full bg-black hover:bg-gray-800 text-white font-semibold py-3 rounded-full transition-colors mb-3 shadow-lg",children:"SUBSCRIBE"}),r.jsxs("ul",{className:"space-y-2 text-sm text-gray-600",children:[r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," 2,500 Credits"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Advanced content creation"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Multi-platform scheduling"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Virality predictions"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Post improvement"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Progress tracking"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Human support"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Bookmarks"]})]})]})}),r.jsx("div",{className:"w-[75vw] shrink-0 snap-start mr-6 flex flex-col h-full",children:r.jsxs("div",{className:"bg-white/5 rounded-3xl p-4 border border-white/10 hover:border-white/20 transition-all flex flex-col h-full pointer-events-auto relative overflow-hidden",children:[d==="monthly"&&r.jsx("div",{className:"absolute top-0 right-0 bg-green-500 text-black text-[10px] font-bold px-3 py-1.5 rounded-bl-xl rounded-tr-2xl uppercase tracking-wide",children:"FIRST MONTH 50% OFF"}),r.jsx("div",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider mb-3",children:"Xpert"}),r.jsx("div",{className:"flex flex-col mb-2",children:d==="monthly"?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-gray-400 line-through text-sm font-medium",children:"$48/mo"}),r.jsxs("div",{className:"flex items-baseline gap-1",children:[r.jsx("span",{className:"text-4xl font-bold text-white",children:"$24"}),r.jsx("span",{className:"text-gray-400",children:"/mo"})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-baseline gap-1",children:[r.jsx("span",{className:"text-4xl font-bold text-white",children:"$38"}),r.jsx("span",{className:"text-gray-400",children:"/mo"})]}),r.jsx("span",{className:"text-xs text-gray-400 font-medium mt-1",children:"Billed annually $456"})]})}),r.jsx("p",{className:"text-gray-400 mb-3 h-10 text-sm leading-relaxed",children:"For serious creators growing their audience."}),r.jsx("button",{onClick:m,className:"w-full bg-white/10 hover:bg-white/20 text-white font-semibold py-3 rounded-full transition-colors mb-3",children:"SUBSCRIBE"}),r.jsxs("ul",{className:"space-y-2 text-sm text-gray-300",children:[r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," 5,000 Credits"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Advanced content creation"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Multi-platform scheduling"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Virality predictions"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Post improvement"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Progress tracking"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Priority support"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Bookmarks"]})]})]})})]}),r.jsxs("div",{className:"hidden md:grid grid-cols-1 md:grid-cols-3 gap-8 max-w-5xl mx-auto",children:[r.jsx(Q,{delay:0,className:"h-full",children:r.jsxs("div",{className:"bg-white/5 rounded-3xl p-8 border border-white/10 hover:border-white/20 transition-all flex flex-col h-full",children:[r.jsx("div",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider mb-4",children:"Starter"}),r.jsxs("div",{className:"flex items-baseline gap-1 mb-2",children:[r.jsx("span",{className:"text-4xl font-bold text-white",children:"$0"}),r.jsx("span",{className:"text-gray-400",children:"/mo"})]}),r.jsx("p",{className:"text-gray-400 mb-8 h-12 text-sm leading-relaxed",children:"For creators getting started."}),r.jsx("button",{onClick:m,className:"w-full bg-white/10 hover:bg-white/20 text-white font-semibold py-3 rounded-full transition-colors mb-8",children:"GET STARTED"}),r.jsxs("ul",{className:"space-y-4 text-sm text-gray-300",children:[r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," 100 Credits"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Advanced content creation"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Virality predictions"]})]})]})}),r.jsx(Q,{delay:150,className:"h-full",children:r.jsxs("div",{className:"bg-white rounded-3xl p-8 border border-white transform md:-translate-y-4 relative flex flex-col h-full shadow-2xl shadow-white/5 overflow-hidden",children:[d==="monthly"&&r.jsx("div",{className:"absolute top-0 right-0 bg-green-500 text-black text-[10px] font-bold px-3 py-1.5 rounded-bl-xl rounded-tr-2xl uppercase tracking-wide",children:"FIRST MONTH 50% OFF"}),r.jsx("div",{className:"text-sm font-bold text-gray-500 uppercase tracking-wider mb-4",children:"Pro"}),r.jsx("div",{className:"flex flex-col mb-2",children:d==="monthly"?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-gray-400 line-through text-sm font-medium",children:"$24/mo"}),r.jsxs("div",{className:"flex items-baseline gap-1",children:[r.jsx("span",{className:"text-4xl font-bold text-gray-900",children:"$12"}),r.jsx("span",{className:"text-gray-500",children:"/mo"})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-baseline gap-1",children:[r.jsx("span",{className:"text-4xl font-bold text-gray-900",children:"$19"}),r.jsx("span",{className:"text-gray-500",children:"/mo"})]}),r.jsx("span",{className:"text-xs text-gray-500 font-medium mt-1",children:"Billed annually $228"})]})}),r.jsx("p",{className:"text-gray-500 mb-8 h-12 text-sm leading-relaxed",children:"For creators leveling up their content."}),r.jsx("button",{onClick:m,className:"w-full bg-black hover:bg-gray-800 text-white font-semibold py-3 rounded-full transition-colors mb-8 shadow-lg",children:"SUBSCRIBE"}),r.jsxs("ul",{className:"space-y-4 text-sm text-gray-600",children:[r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," 2,500 Credits"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Advanced content creation"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Multi-platform scheduling"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Virality predictions"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Post improvement"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Progress tracking"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Human support"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-black"})," Bookmarks"]})]})]})}),r.jsx(Q,{delay:300,className:"h-full",children:r.jsxs("div",{className:"bg-white/5 rounded-3xl p-8 border border-white/10 hover:border-white/20 transition-all flex flex-col h-full relative overflow-hidden",children:[d==="monthly"&&r.jsx("div",{className:"absolute top-0 right-0 bg-green-500 text-black text-[10px] font-bold px-3 py-1.5 rounded-bl-xl rounded-tr-2xl uppercase tracking-wide",children:"FIRST MONTH 50% OFF"}),r.jsx("div",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider mb-4",children:"Xpert"}),r.jsx("div",{className:"flex flex-col mb-2",children:d==="monthly"?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-gray-400 line-through text-sm font-medium",children:"$48/mo"}),r.jsxs("div",{className:"flex items-baseline gap-1",children:[r.jsx("span",{className:"text-4xl font-bold text-white",children:"$24"}),r.jsx("span",{className:"text-gray-400",children:"/mo"})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-baseline gap-1",children:[r.jsx("span",{className:"text-4xl font-bold text-white",children:"$38"}),r.jsx("span",{className:"text-gray-400",children:"/mo"})]}),r.jsx("span",{className:"text-xs text-gray-400 font-medium mt-1",children:"Billed annually $456"})]})}),r.jsx("p",{className:"text-gray-400 mb-8 h-12 text-sm leading-relaxed",children:"For serious creators growing their audience."}),r.jsx("button",{onClick:m,className:"w-full bg-white/10 hover:bg-white/20 text-white font-semibold py-3 rounded-full transition-colors mb-8",children:"SUBSCRIBE"}),r.jsxs("ul",{className:"space-y-4 text-sm text-gray-300",children:[r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," 5,000 Credits"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Advanced content creation"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Multi-platform scheduling"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Virality predictions"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Post improvement"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Progress tracking"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Priority support"]}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(O,{size:16,className:"text-white"})," Bookmarks"]})]})]})})]})]})}),r.jsx("section",{className:"py-16 md:py-24 bg-white border-t border-gray-100",children:r.jsxs(Q,{className:"max-w-4xl mx-auto px-6 text-center",children:[r.jsx("h2",{className:"text-4xl md:text-6xl font-bold text-gray-900 mb-6 tracking-tight",style:{fontFamily:"KaioBold, sans-serif"},children:"Ready to get started?"}),r.jsx("p",{className:"text-xl text-gray-500 mb-10 max-w-2xl mx-auto leading-relaxed",children:"Join hundreds of creators who are scaling their content effortlessly with Post2x."}),r.jsx("div",{className:"flex flex-col items-center gap-3",children:g?r.jsxs("button",{onClick:()=>h("/create"),className:"bg-black text-white px-8 py-4 rounded-full font-semibold text-lg hover:bg-gray-800 transition-all shadow-lg hover:shadow-xl active:scale-95 flex items-center gap-2 mx-auto",children:["Open App ",r.jsx(ve,{size:20})]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:m,className:"bg-black text-white px-8 py-4 rounded-full font-semibold text-lg hover:bg-gray-800 transition-all shadow-lg hover:shadow-xl active:scale-95 flex items-center gap-2 mx-auto",children:["Start for free ",r.jsx(ve,{size:20})]}),r.jsx("span",{className:"text-sm text-gray-500 font-medium",children:"No credit card required"})]})})]})}),r.jsx(wt,{})]})},Qo=f.lazy(()=>R(()=>import("./LandingPage2-Cww1FPoA.js"),__vite__mapDeps([0,1,2]))),Yo=f.lazy(()=>R(()=>import("./HomePage-jka_6ods.js"),__vite__mapDeps([3,1,4,5,2,6,7,8,9,10,11,12])).then(n=>({default:n.HomePage}))),Zo=f.lazy(()=>R(()=>import("./TermsPage-C7vOMNcx.js"),__vite__mapDeps([13,1,2])).then(n=>({default:n.TermsPage}))),el=f.lazy(()=>R(()=>import("./PrivacyPage-CpsEwxfV.js"),__vite__mapDeps([14,1,2])).then(n=>({default:n.PrivacyPage}))),tl=f.lazy(()=>R(()=>import("./PricingPage-BcEUooFk.js"),__vite__mapDeps([15,1,12,2])).then(n=>({default:n.PricingPage}))),sl=f.lazy(()=>R(()=>import("./SuccessPage-qKfe-uFv.js"),__vite__mapDeps([16,1,17,2])).then(n=>({default:n.SuccessPage}))),rl=f.lazy(()=>R(()=>import("./ViralScorePage-C9P-b76v.js"),__vite__mapDeps([18,1,11,2,12])).then(n=>({default:n.ViralScorePage}))),nl=f.lazy(()=>R(()=>import("./UserProfilePage-lQNs4paZ.js"),__vite__mapDeps([19,1,2])).then(n=>({default:n.UserProfilePage}))),fr=f.lazy(()=>R(()=>import("./DashboardPage-BCnYKQMR.js"),__vite__mapDeps([20,1,5,2,17,11,12])).then(n=>({default:n.DashboardPage}))),al=f.lazy(()=>R(()=>import("./BookmarksPage-syfP_op-.js"),__vite__mapDeps([21,1,5,2,12])).then(n=>({default:n.BookmarksPage}))),il=f.lazy(()=>R(()=>import("./AdminPanel-xqHkZ2tX.js"),__vite__mapDeps([22,1,2])).then(n=>({default:n.AdminPanel}))),ol=f.lazy(()=>R(()=>import("./AdminLoginPage-BUT0W1hP.js"),__vite__mapDeps([23,1,2])).then(n=>({default:n.AdminLoginPage}))),ll=f.lazy(()=>R(()=>import("./TrendPage-Ckfo6dk4.js"),__vite__mapDeps([24,1,12,2])).then(n=>({default:n.TrendPage}))),cl=f.lazy(()=>R(()=>import("./QueuePage-DpqitpWV.js"),__vite__mapDeps([25,1,12,2,11])).then(n=>({default:n.QueuePage}))),dl=f.lazy(()=>R(()=>import("./VoicesPage-FzYx6-Vt.js"),__vite__mapDeps([26,1,2])).then(n=>({default:n.VoicesPage}))),ul=f.lazy(()=>R(()=>import("./MoimaereLoginPage-GdhPO1hO.js"),__vite__mapDeps([27,1,2])).then(n=>({default:n.MoimaereLoginPage}))),hl=f.lazy(()=>R(()=>import("./CreatePage-B6M-xHDs.js"),__vite__mapDeps([28,1,7,5,2,29])).then(n=>({default:n.CreatePage}))),fl=f.lazy(()=>R(()=>import("./WrapPage-C_qWdy61.js"),__vite__mapDeps([30,1,2]))),ml=f.lazy(()=>R(()=>import("./ConnectionsPage-BjqXu7za.js"),__vite__mapDeps([31,1,2])).then(n=>({default:n.ConnectionsPage}))),pl=f.lazy(()=>R(()=>import("./MemeGeneratorPage-_2BfIau8.js"),__vite__mapDeps([32,1,4,5,2,29,7,33]))),gl=f.lazy(()=>R(()=>import("./TemplateMemeGeneratorPage-BQaO8mSx.js"),__vite__mapDeps([34,1,32,4,5,2,29,7,33]))),xl=f.lazy(()=>R(()=>import("./MemeDirectoryPage-Dq7hox54.js"),__vite__mapDeps([35,1,33,2]))),yl=f.lazy(()=>R(()=>import("./TypefullyPage-Tw7COsrh.js"),__vite__mapDeps([36,2,1]))),vl=f.lazy(()=>R(()=>import("./HypefuryPage-D-UM9ubg.js"),__vite__mapDeps([37,2,1]))),bl=f.lazy(()=>R(()=>import("./TweetHunterPage-D4Q4kn-C.js"),__vite__mapDeps([38,2,1]))),wl=f.lazy(()=>R(()=>import("./PostwisePage-B3f1Db5h.js"),__vite__mapDeps([39,2,1]))),_l=f.lazy(()=>R(()=>import("./BufferPage-CTQxEgiz.js"),__vite__mapDeps([40,2,1]))),jl=f.lazy(()=>R(()=>import("./HootsuitePage-DKeImxo9.js"),__vite__mapDeps([41,2,1]))),kl=f.lazy(()=>R(()=>import("./SuperxPage-xEk0IO2A.js"),__vite__mapDeps([42,2,1]))),Nl=f.lazy(()=>R(()=>import("./TaplioPage-2dJzyAM3.js"),__vite__mapDeps([43,2,1]))),Sl=f.lazy(()=>R(()=>import("./CopyaiPage-BddMVyDY.js"),__vite__mapDeps([44,2,1]))),Tl=f.lazy(()=>R(()=>import("./PostbridgePage-DkLB7DPo.js"),__vite__mapDeps([45,2,1]))),El=f.lazy(()=>R(()=>import("./SampleAnimationPage-DusxzcUF.js"),__vite__mapDeps([46,1,2])).then(n=>({default:n.SampleAnimationPage}))),Pl=f.lazy(()=>R(()=>import("./TwitterVideoDownlaoder-JKeqwLDk.js"),__vite__mapDeps([47,1,2]))),Al=f.lazy(()=>R(()=>import("./TwitterGIFDownloader-CfasZtnN.js"),__vite__mapDeps([48,1,2]))),Cl=f.lazy(()=>R(()=>import("./PosttoAnimationPage-DzDUQ9ei.js"),__vite__mapDeps([49,1,2]))),Ol=f.lazy(()=>R(()=>import("./BlogPage-DcP82B6k.js"),__vite__mapDeps([50,51,1,2]))),Il=f.lazy(()=>R(()=>import("./BlogPostPage-Dy5iuBhX.js"),__vite__mapDeps([52,51,1,2]))),Rl=f.lazy(()=>R(()=>import("./UnsubscribePage-DwALpKHv.js"),__vite__mapDeps([53,1,2]))),$l=()=>r.jsxs("div",{className:"flex flex-col min-h-screen bg-white",children:[r.jsxs("div",{className:"h-16 border-b border-gray-200 flex items-center px-4 gap-3",children:[r.jsx("div",{className:"w-8 h-8 bg-gray-100 rounded-full animate-pulse"}),r.jsx("div",{className:"w-32 h-5 bg-gray-100 rounded animate-pulse"})]}),r.jsxs("div",{className:"flex-1 flex flex-col lg:flex-row p-6 gap-6 max-w-[1200px] w-full mx-auto",children:[r.jsx("div",{className:"w-full aspect-square lg:flex-[2] max-h-[50vh] lg:max-h-[70vh] bg-gray-50 rounded-lg border-2 border-dashed border-gray-200 animate-pulse"}),r.jsxs("div",{className:"flex flex-col gap-3 w-full lg:flex-1 lg:min-w-[320px]",children:[r.jsx("div",{className:"h-12 bg-gray-100 rounded-lg animate-pulse"}),r.jsx("div",{className:"h-12 bg-gray-100 rounded-lg animate-pulse"}),r.jsx("div",{className:"h-12 bg-gray-100 rounded-lg animate-pulse"})]})]})]});function le(){const n=Ce(),[e,t]=f.useState(new Set([n.pathname])),s=Je();f.useEffect(()=>{t(o=>new Set([...o,n.pathname]))},[n.pathname]);const a=o=>e.has(o),i=o=>n.pathname===o;return r.jsxs(Te,{children:[r.jsx("div",{style:{display:i("/create")?"contents":"none"},children:a("/create")&&r.jsx(Ee,{children:r.jsx(hl,{})})}),r.jsx("div",{style:{display:i("/memegenerator")?"contents":"none"},children:a("/memegenerator")&&r.jsx(pl,{})}),r.jsx("div",{style:{display:i("/analytics")?"contents":"none"},children:a("/analytics")&&r.jsx(Ee,{children:r.jsx(fr,{})})}),r.jsx("div",{style:{display:i("/dashboard")?"contents":"none"},children:a("/dashboard")&&r.jsx(Ee,{children:r.jsx(fr,{})})}),r.jsx("div",{style:{display:i("/bookmarks")?"contents":"none"},children:a("/bookmarks")&&r.jsx(Ee,{children:r.jsx(al,{})})}),r.jsx("div",{style:{display:i("/voices")?"contents":"none"},children:a("/voices")&&r.jsx(dl,{})}),r.jsx("div",{style:{display:i("/queue")?"contents":"none"},children:a("/queue")&&r.jsx(Ee,{children:r.jsx(cl,{})})}),r.jsx("div",{style:{display:i("/connections")?"contents":"none"},children:a("/connections")&&r.jsx(Ee,{children:r.jsx(ml,{})})}),r.jsx("div",{style:{display:i("/visualize")?"contents":"none"},children:a("/visualize")&&r.jsx(Cl,{onNavigateHome:()=>s("/"),onNavigateApp:()=>s("/create")})})]})}function Ll(){const{user:n}=Xe(),e=Ce(),s=["/","/landingtest","/terms","/privacy","/wrap","/typefully","/hypefury","/tweethunter","/postwise","/buffer","/hootsuite","/superx","/taplio","/jasper","/copyai","/postbridge","/sample_animation","/twitter-video-downloader","/twitter-gif-downloader","/visualize","/memegenerator","/blog"].includes(e.pathname)||e.pathname.startsWith("/memegenerator/")||e.pathname.startsWith("/blog/");return n||s?null:r.jsx("footer",{className:"mt-8 border-t border-[var(--border)] bg-[var(--bg)]",children:r.jsxs("div",{className:"w-full px-4 py-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-6 mb-4",children:[r.jsxs(B,{to:"/",className:"flex items-center gap-2",children:[r.jsx("img",{src:"/logo.svg",alt:"Post2X Logo",className:"w-6 h-6 sm:w-7 sm:h-7 rounded-full object-cover ring-2 ring-gray-200 flex-shrink-0"}),r.jsx("span",{className:"text-lg sm:text-xl font-bold text-[var(--text)]",style:{fontFamily:"KaioBold, sans-serif"},children:"Post2X"})]}),r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx("h2",{className:"text-sm font-semibold text-[var(--text)] mb-2",children:"Free Tools:"}),r.jsxs("div",{className:"flex flex-col items-center gap-1 text-sm text-[var(--muted)]",children:[r.jsx(B,{to:"/twitter-gif-downloader",className:"hover:text-[var(--text)] transition-colors duration-200",children:"Twitter GIF Downloader"}),r.jsx(B,{to:"/twitter-video-downloader",className:"hover:text-[var(--text)] transition-colors duration-200",children:"Twitter Video Downloader"})]})]}),r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx("h2",{className:"text-sm font-semibold text-[var(--text)] mb-2",children:"Follow me on X:"}),r.jsx("a",{href:"https://x.com/moimaere",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--muted)] hover:text-[var(--text)] text-sm transition-colors duration-200",children:"@moimaere"})]}),r.jsxs("div",{className:"flex flex-col items-center sm:items-end",children:[r.jsx("h2",{className:"text-sm font-semibold text-[var(--text)] mb-2",children:"Legal:"}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--muted)]",children:[r.jsx(B,{to:"/privacy",className:"hover:text-[var(--text)] transition-colors duration-200",children:"Privacy"}),r.jsx("span",{children:"-"}),r.jsx(B,{to:"/terms",className:"hover:text-[var(--text)] transition-colors duration-200",children:"ToS"})]})]})]}),r.jsxs("div",{className:"text-center text-xs text-[var(--muted)] mt-4",children:["© ",new Date().getFullYear()," Post2X. All rights reserved."]})]})})}function Dl(){return r.jsx(nn,{basename:"/",children:r.jsx(So,{children:r.jsxs(Co,{children:[r.jsx(oa,{}),r.jsx(f.Suspense,{fallback:r.jsx($l,{}),children:r.jsxs(an,{children:[r.jsx(C,{path:"/blog",element:r.jsxs(r.Fragment,{children:[r.jsx(Qt,{isFixed:!0}),r.jsx(Ol,{}),r.jsx(wt,{})]})}),r.jsx(C,{path:"/blog/:slug",element:r.jsxs(r.Fragment,{children:[r.jsx(Qt,{isFixed:!0}),r.jsx(Il,{}),r.jsx(wt,{})]})}),r.jsx(C,{path:"/",element:r.jsx(Xo,{onNavigateApp:()=>window.location.href="/create"})}),r.jsx(C,{path:"/landing",element:r.jsx(nt,{to:"/",replace:!0})}),r.jsx(C,{path:"/landingtest",element:r.jsx(Qo,{onNavigateApp:()=>{}})}),r.jsx(C,{path:"/typefully",element:r.jsx(yl,{onNavigateHome:()=>window.location.href="/",onNavigateApp:()=>window.location.href="/create"})}),r.jsx(C,{path:"/hypefury",element:r.jsx(vl,{onNavigateHome:()=>window.location.href="/",onNavigateApp:()=>window.location.href="/create"})}),r.jsx(C,{path:"/tweethunter",element:r.jsx(bl,{onNavigateHome:()=>window.location.href="/",onNavigateApp:()=>window.location.href="/create"})}),r.jsx(C,{path:"/postwise",element:r.jsx(wl,{onNavigateHome:()=>window.location.href="/",onNavigateApp:()=>window.location.href="/create"})}),r.jsx(C,{path:"/buffer",element:r.jsx(_l,{onNavigateHome:()=>window.location.href="/",onNavigateApp:()=>window.location.href="/create"})}),r.jsx(C,{path:"/hootsuite",element:r.jsx(jl,{onNavigateHome:()=>window.location.href="/",onNavigateApp:()=>window.location.href="/create"})}),r.jsx(C,{path:"/superx",element:r.jsx(kl,{onNavigateHome:()=>window.location.href="/",onNavigateApp:()=>window.location.href="/create"})}),r.jsx(C,{path:"/taplio",element:r.jsx(Nl,{onNavigateHome:()=>window.location.href="/",onNavigateApp:()=>window.location.href="/create"})}),r.jsx(C,{path:"/copyai",element:r.jsx(Sl,{onNavigateHome:()=>window.location.href="/",onNavigateApp:()=>window.location.href="/create"})}),r.jsx(C,{path:"/postbridge",element:r.jsx(Tl,{onNavigateHome:()=>window.location.href="/",onNavigateApp:()=>window.location.href="/create"})}),r.jsx(C,{path:"/twitter-video-downloader",element:r.jsx(Pl,{onNavigateHome:()=>window.location.href="/",onNavigateApp:()=>window.location.href="/create"})}),r.jsx(C,{path:"/twitter-gif-downloader",element:r.jsx(Al,{onNavigateHome:()=>window.location.href="/",onNavigateApp:()=>window.location.href="/create"})}),r.jsx(C,{path:"/auth/callback",element:r.jsx(Wo,{})}),r.jsx(C,{path:"/terms",element:r.jsx(Zo,{})}),r.jsx(C,{path:"/privacy",element:r.jsx(el,{})}),r.jsx(C,{path:"/unsubscribe",element:r.jsx(Rl,{})}),r.jsx(C,{path:"/success",element:r.jsx(sl,{})}),r.jsx(C,{path:"/muammer",element:r.jsx(ul,{})}),r.jsx(C,{path:"/admin",element:r.jsx(ol,{})}),r.jsx(C,{path:"/admin/panel",element:r.jsx(il,{})}),r.jsx(C,{path:"/wrap",element:r.jsx(fl,{})}),r.jsx(C,{path:"/sample_animation",element:r.jsx(El,{})}),r.jsx(C,{path:"/memegenerator/:slug",element:r.jsx(Te,{children:r.jsx(gl,{})})}),r.jsx(C,{path:"/memes",element:r.jsxs(r.Fragment,{children:[r.jsx(Qt,{}),r.jsx(xl,{}),r.jsx(wt,{})]})}),r.jsx(C,{path:"/create",element:r.jsx(le,{})}),r.jsx(C,{path:"/memegenerator",element:r.jsx(le,{})}),r.jsx(C,{path:"/analytics",element:r.jsx(le,{})}),r.jsx(C,{path:"/dashboard",element:r.jsx(le,{})}),r.jsx(C,{path:"/bookmarks",element:r.jsx(le,{})}),r.jsx(C,{path:"/voices",element:r.jsx(le,{})}),r.jsx(C,{path:"/queue",element:r.jsx(le,{})}),r.jsx(C,{path:"/queue",element:r.jsx(le,{})}),r.jsx(C,{path:"/connections",element:r.jsx(le,{})}),r.jsx(C,{path:"/visualize",element:r.jsx(le,{})}),r.jsx(C,{path:"/app",element:r.jsx(nt,{to:"/create",replace:!0})}),r.jsx(C,{path:"/analyze",element:r.jsx(Te,{children:r.jsx(Ee,{children:r.jsx(Yo,{})})})}),r.jsx(C,{path:"/trend",element:r.jsx(Te,{children:r.jsx(ll,{})})}),r.jsx(C,{path:"/viral-score",element:r.jsx(Te,{children:r.jsx(rl,{})})}),r.jsx(C,{path:"/viral-score/profile/:username",element:r.jsx(Te,{children:r.jsx(nl,{})})}),r.jsx(C,{path:"/pricing",element:r.jsx(Te,{children:r.jsx(tl,{})})}),r.jsx(C,{path:"*",element:r.jsx(nt,{to:"/",replace:!0})})]})}),r.jsx(Ll,{})]})})})}gr(document.getElementById("root")).render(r.jsx(f.StrictMode,{children:r.jsx(jr,{children:r.jsx(Dl,{})})}));export{dr as D,Uo as E,na as H,kr as M,wt as P,qo as S,zo as T,R as _,Xe as a,Xr as b,ks as c,Qt as d,la as e,tc as f,yt as g,ec as h,Io as i,r as j,D as s,To as u};