1import{M as a,A as v,y as _,aN as t,p as w,D as r}from"./TOzMG3e7.js";import{u as y}from"./jFKcngeV.js";async function h(n){return a().get(`/stripe/portal?return_url=${encodeURIComponent(n)}`)}async function A(){return a().get("/stripe/subscription")}async function b(){return a().get("/stripe/plans")}async function S(n){return a().post("/stripe/checkout",{price_id:n})}function U(){const n=v(),s=r(null),i=r(null),u=r(!1),l=r(!1),p=r(null),d=w(()=>n.user?.is_premium??!1);function o(){s.value=null,i.value=null,u.value=!1}async function g(){if(!n.isLoggedIn){o();return}l.value=!0,p.value=null;try{const e=await A();s.value=e.plan??null,i.value=e.expires_at?new Date(e.expires_at):null,u.value=e.cancel_at_period_end??!1,e.is_premium!==void 0&&e.is_premium!==n.user?.is_premium&&await n.refreshToken()}catch{o()}finally{l.value=!1}}async function m(){const e=window.location.href,c=await h(e);if(!c.url)return;const f=y();if(f.isNative()){await f.openExternal(c.url);return}window.open(c.url,"_blank")}return _(()=>n.isLoggedIn,e=>{e||o()}),{isPremium:d,plan:t(s),expiresAt:t(i),cancelAtPeriodEnd:t(u),loading:t(l),error:t(p),refresh:g,openBillingPortal:m}}export{b as a,S as c,h as g,U as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.