@sudobility/subscription-components 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +721 -702
- package/dist/index.umd.js +1 -1
- package/dist/subscription-provider.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(M,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react/jsx-runtime"),require("@sudobility/design"),require("@sudobility/components"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@sudobility/design","@sudobility/components","react"],c):(M=typeof globalThis<"u"?globalThis:M||self,c(M.SubscriptionComponents={},M.ReactJSXRuntime,M.SudobilityDesign,M.SudobilityComponents,M.React))})(this,(function(M,c,de,ee,A){"use strict";function we(e){var o,r,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(o=0;o<s;o++)e[o]&&(r=we(e[o]))&&(t&&(t+=" "),t+=r)}else for(r in e)e[r]&&(t&&(t+=" "),t+=r);return t}function We(){for(var e,o,r=0,t="",s=arguments.length;r<s;r++)(e=arguments[r])&&(o=we(e))&&(t&&(t+=" "),t+=o);return t}const Ue=(e,o)=>{const r=new Array(e.length+o.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let t=0;t<o.length;t++)r[e.length+t]=o[t];return r},qe=(e,o)=>({classGroupId:e,validator:o}),ye=(e=new Map,o=null,r)=>({nextPart:e,validators:o,classGroupId:r}),re="-",ke=[],Ye="arbitrary..",Ke=e=>{const o=Je(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:t}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Xe(a);const m=a.split(re),d=m[0]===""&&m.length>1?1:0;return ve(m,d,o)},getConflictingClassGroupIds:(a,m)=>{if(m){const d=t[a],b=r[a];return d?b?Ue(b,d):d:b||ke}return r[a]||ke}}},ve=(e,o,r)=>{if(e.length-o===0)return r.classGroupId;const s=e[o],n=r.nextPart.get(s);if(n){const b=ve(e,o+1,n);if(b)return b}const a=r.validators;if(a===null)return;const m=o===0?e.join(re):e.slice(o).join(re),d=a.length;for(let b=0;b<d;b++){const k=a[b];if(k.validator(m))return k.classGroupId}},Xe=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=e.slice(1,-1),r=o.indexOf(":"),t=o.slice(0,r);return t?Ye+t:void 0})(),Je=e=>{const{theme:o,classGroups:r}=e;return He(r,o)},He=(e,o)=>{const r=ye();for(const t in e){const s=e[t];ue(s,r,t,o)}return r},ue=(e,o,r,t)=>{const s=e.length;for(let n=0;n<s;n++){const a=e[n];Qe(a,o,r,t)}},Qe=(e,o,r,t)=>{if(typeof e=="string"){Ze(e,o,r);return}if(typeof e=="function"){Re(e,o,r,t);return}er(e,o,r,t)},Ze=(e,o,r)=>{const t=e===""?o:Ce(o,e);t.classGroupId=r},Re=(e,o,r,t)=>{if(rr(e)){ue(e(t),o,r,t);return}o.validators===null&&(o.validators=[]),o.validators.push(qe(r,e))},er=(e,o,r,t)=>{const s=Object.entries(e),n=s.length;for(let a=0;a<n;a++){const[m,d]=s[a];ue(d,Ce(o,m),r,t)}},Ce=(e,o)=>{let r=e;const t=o.split(re),s=t.length;for(let n=0;n<s;n++){const a=t[n];let m=r.nextPart.get(a);m||(m=ye(),r.nextPart.set(a,m)),r=m}return r},rr=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,tr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let o=0,r=Object.create(null),t=Object.create(null);const s=(n,a)=>{r[n]=a,o++,o>e&&(o=0,t=r,r=Object.create(null))};return{get(n){let a=r[n];if(a!==void 0)return a;if((a=t[n])!==void 0)return s(n,a),a},set(n,a){n in r?r[n]=a:s(n,a)}}},me="!",Se=":",or=[],Pe=(e,o,r,t,s)=>({modifiers:e,hasImportantModifier:o,baseClassName:r,maybePostfixModifierPosition:t,isExternal:s}),sr=e=>{const{prefix:o,experimentalParseClassName:r}=e;let t=s=>{const n=[];let a=0,m=0,d=0,b;const k=s.length;for(let z=0;z<k;z++){const w=s[z];if(a===0&&m===0){if(w===Se){n.push(s.slice(d,z)),d=z+1;continue}if(w==="/"){b=z;continue}}w==="["?a++:w==="]"?a--:w==="("?m++:w===")"&&m--}const v=n.length===0?s:s.slice(d);let L=v,h=!1;v.endsWith(me)?(L=v.slice(0,-1),h=!0):v.startsWith(me)&&(L=v.slice(1),h=!0);const D=b&&b>d?b-d:void 0;return Pe(n,h,L,D)};if(o){const s=o+Se,n=t;t=a=>a.startsWith(s)?n(a.slice(s.length)):Pe(or,!1,a,void 0,!0)}if(r){const s=t;t=n=>r({className:n,parseClassName:s})}return t},nr=e=>{const o=new Map;return e.orderSensitiveModifiers.forEach((r,t)=>{o.set(r,1e6+t)}),r=>{const t=[];let s=[];for(let n=0;n<r.length;n++){const a=r[n],m=a[0]==="[",d=o.has(a);m||d?(s.length>0&&(s.sort(),t.push(...s),s=[]),t.push(a)):s.push(a)}return s.length>0&&(s.sort(),t.push(...s)),t}},ar=e=>({cache:tr(e.cacheSize),parseClassName:sr(e),sortModifiers:nr(e),...Ke(e)}),ir=/\s+/,lr=(e,o)=>{const{parseClassName:r,getClassGroupId:t,getConflictingClassGroupIds:s,sortModifiers:n}=o,a=[],m=e.trim().split(ir);let d="";for(let b=m.length-1;b>=0;b-=1){const k=m[b],{isExternal:v,modifiers:L,hasImportantModifier:h,baseClassName:D,maybePostfixModifierPosition:z}=r(k);if(v){d=k+(d.length>0?" "+d:d);continue}let w=!!z,V=t(w?D.substring(0,z):D);if(!V){if(!w){d=k+(d.length>0?" "+d:d);continue}if(V=t(D),!V){d=k+(d.length>0?" "+d:d);continue}w=!1}const F=L.length===0?"":L.length===1?L[0]:n(L).join(":"),B=h?F+me:F,C=B+V;if(a.indexOf(C)>-1)continue;a.push(C);const N=s(V,w);for(let T=0;T<N.length;++T){const O=N[T];a.push(B+O)}d=k+(d.length>0?" "+d:d)}return d},cr=(...e)=>{let o=0,r,t,s="";for(;o<e.length;)(r=e[o++])&&(t=ze(r))&&(s&&(s+=" "),s+=t);return s},ze=e=>{if(typeof e=="string")return e;let o,r="";for(let t=0;t<e.length;t++)e[t]&&(o=ze(e[t]))&&(r&&(r+=" "),r+=o);return r},dr=(e,...o)=>{let r,t,s,n;const a=d=>{const b=o.reduce((k,v)=>v(k),e());return r=ar(b),t=r.cache.get,s=r.cache.set,n=m,m(d)},m=d=>{const b=t(d);if(b)return b;const k=lr(d,r);return s(d,k),k};return n=a,(...d)=>n(cr(...d))},ur=[],P=e=>{const o=r=>r[e]||ur;return o.isThemeGetter=!0,o},Ne=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ae=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mr=/^\d+\/\d+$/,pr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fr=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,br=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,X=e=>mr.test(e),g=e=>!!e&&!Number.isNaN(Number(e)),q=e=>!!e&&Number.isInteger(Number(e)),pe=e=>e.endsWith("%")&&g(e.slice(0,-1)),U=e=>pr.test(e),xr=()=>!0,wr=e=>fr.test(e)&&!br.test(e),Ie=()=>!1,yr=e=>gr.test(e),kr=e=>hr.test(e),vr=e=>!i(e)&&!l(e),Cr=e=>J(e,Oe,Ie),i=e=>Ne.test(e),K=e=>J(e,Ge,wr),fe=e=>J(e,Ar,g),Me=e=>J(e,Te,Ie),Sr=e=>J(e,Ee,kr),te=e=>J(e,je,yr),l=e=>Ae.test(e),R=e=>H(e,Ge),Pr=e=>H(e,Ir),De=e=>H(e,Te),zr=e=>H(e,Oe),Nr=e=>H(e,Ee),oe=e=>H(e,je,!0),J=(e,o,r)=>{const t=Ne.exec(e);return t?t[1]?o(t[1]):r(t[2]):!1},H=(e,o,r=!1)=>{const t=Ae.exec(e);return t?t[1]?o(t[1]):r:!1},Te=e=>e==="position"||e==="percentage",Ee=e=>e==="image"||e==="url",Oe=e=>e==="length"||e==="size"||e==="bg-size",Ge=e=>e==="length",Ar=e=>e==="number",Ir=e=>e==="family-name",je=e=>e==="shadow",Mr=dr(()=>{const e=P("color"),o=P("font"),r=P("text"),t=P("font-weight"),s=P("tracking"),n=P("leading"),a=P("breakpoint"),m=P("container"),d=P("spacing"),b=P("radius"),k=P("shadow"),v=P("inset-shadow"),L=P("text-shadow"),h=P("drop-shadow"),D=P("blur"),z=P("perspective"),w=P("aspect"),V=P("ease"),F=P("animate"),B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...C(),l,i],T=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],p=()=>[l,i,d],$=()=>[X,"full","auto",...p()],G=()=>[q,"none","subgrid",l,i],Y=()=>["auto",{span:["full",q,l,i]},q,l,i],Q=()=>[q,"auto",l,i],se=()=>["auto","min","max","fr",l,i],f=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],x=()=>["start","end","center","stretch","center-safe","end-safe"],y=()=>["auto",...p()],j=()=>[X,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...p()],u=()=>[e,l,i],Z=()=>[...C(),De,Me,{position:[l,i]}],ne=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Fe=()=>["auto","cover","contain",zr,Cr,{size:[l,i]}],he=()=>[pe,R,K],_=()=>["","none","full",b,l,i],W=()=>["",g,R,K],ae=()=>["solid","dashed","dotted","double"],Be=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],I=()=>[g,pe,De,Me],$e=()=>["","none",D,l,i],ie=()=>["none",g,l,i],le=()=>["none",g,l,i],xe=()=>[g,l,i],ce=()=>[X,"full",...p()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[U],breakpoint:[U],color:[xr],container:[U],"drop-shadow":[U],ease:["in","out","in-out"],font:[vr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[U],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[U],shadow:[U],spacing:["px",g],text:[U],"text-shadow":[U],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",X,i,l,w]}],container:["container"],columns:[{columns:[g,i,l,m]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:N()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:$()}],"inset-x":[{"inset-x":$()}],"inset-y":[{"inset-y":$()}],start:[{start:$()}],end:[{end:$()}],top:[{top:$()}],right:[{right:$()}],bottom:[{bottom:$()}],left:[{left:$()}],visibility:["visible","invisible","collapse"],z:[{z:[q,"auto",l,i]}],basis:[{basis:[X,"full","auto",m,...p()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[g,X,"auto","initial","none",i]}],grow:[{grow:["",g,l,i]}],shrink:[{shrink:["",g,l,i]}],order:[{order:[q,"first","last","none",l,i]}],"grid-cols":[{"grid-cols":G()}],"col-start-end":[{col:Y()}],"col-start":[{"col-start":Q()}],"col-end":[{"col-end":Q()}],"grid-rows":[{"grid-rows":G()}],"row-start-end":[{row:Y()}],"row-start":[{"row-start":Q()}],"row-end":[{"row-end":Q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":se()}],"auto-rows":[{"auto-rows":se()}],gap:[{gap:p()}],"gap-x":[{"gap-x":p()}],"gap-y":[{"gap-y":p()}],"justify-content":[{justify:[...f(),"normal"]}],"justify-items":[{"justify-items":[...x(),"normal"]}],"justify-self":[{"justify-self":["auto",...x()]}],"align-content":[{content:["normal",...f()]}],"align-items":[{items:[...x(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...x(),{baseline:["","last"]}]}],"place-content":[{"place-content":f()}],"place-items":[{"place-items":[...x(),"baseline"]}],"place-self":[{"place-self":["auto",...x()]}],p:[{p:p()}],px:[{px:p()}],py:[{py:p()}],ps:[{ps:p()}],pe:[{pe:p()}],pt:[{pt:p()}],pr:[{pr:p()}],pb:[{pb:p()}],pl:[{pl:p()}],m:[{m:y()}],mx:[{mx:y()}],my:[{my:y()}],ms:[{ms:y()}],me:[{me:y()}],mt:[{mt:y()}],mr:[{mr:y()}],mb:[{mb:y()}],ml:[{ml:y()}],"space-x":[{"space-x":p()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":p()}],"space-y-reverse":["space-y-reverse"],size:[{size:j()}],w:[{w:[m,"screen",...j()]}],"min-w":[{"min-w":[m,"screen","none",...j()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[a]},...j()]}],h:[{h:["screen","lh",...j()]}],"min-h":[{"min-h":["screen","lh","none",...j()]}],"max-h":[{"max-h":["screen","lh",...j()]}],"font-size":[{text:["base",r,R,K]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,l,fe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",pe,i]}],"font-family":[{font:[Pr,i,o]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,l,i]}],"line-clamp":[{"line-clamp":[g,"none",l,fe]}],leading:[{leading:[n,...p()]}],"list-image":[{"list-image":["none",l,i]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",l,i]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:u()}],"text-color":[{text:u()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[g,"from-font","auto",l,K]}],"text-decoration-color":[{decoration:u()}],"underline-offset":[{"underline-offset":[g,"auto",l,i]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:p()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",l,i]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",l,i]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Z()}],"bg-repeat":[{bg:ne()}],"bg-size":[{bg:Fe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},q,l,i],radial:["",l,i],conic:[q,l,i]},Nr,Sr]}],"bg-color":[{bg:u()}],"gradient-from-pos":[{from:he()}],"gradient-via-pos":[{via:he()}],"gradient-to-pos":[{to:he()}],"gradient-from":[{from:u()}],"gradient-via":[{via:u()}],"gradient-to":[{to:u()}],rounded:[{rounded:_()}],"rounded-s":[{"rounded-s":_()}],"rounded-e":[{"rounded-e":_()}],"rounded-t":[{"rounded-t":_()}],"rounded-r":[{"rounded-r":_()}],"rounded-b":[{"rounded-b":_()}],"rounded-l":[{"rounded-l":_()}],"rounded-ss":[{"rounded-ss":_()}],"rounded-se":[{"rounded-se":_()}],"rounded-ee":[{"rounded-ee":_()}],"rounded-es":[{"rounded-es":_()}],"rounded-tl":[{"rounded-tl":_()}],"rounded-tr":[{"rounded-tr":_()}],"rounded-br":[{"rounded-br":_()}],"rounded-bl":[{"rounded-bl":_()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:u()}],"border-color-x":[{"border-x":u()}],"border-color-y":[{"border-y":u()}],"border-color-s":[{"border-s":u()}],"border-color-e":[{"border-e":u()}],"border-color-t":[{"border-t":u()}],"border-color-r":[{"border-r":u()}],"border-color-b":[{"border-b":u()}],"border-color-l":[{"border-l":u()}],"divide-color":[{divide:u()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[g,l,i]}],"outline-w":[{outline:["",g,R,K]}],"outline-color":[{outline:u()}],shadow:[{shadow:["","none",k,oe,te]}],"shadow-color":[{shadow:u()}],"inset-shadow":[{"inset-shadow":["none",v,oe,te]}],"inset-shadow-color":[{"inset-shadow":u()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:u()}],"ring-offset-w":[{"ring-offset":[g,K]}],"ring-offset-color":[{"ring-offset":u()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":u()}],"text-shadow":[{"text-shadow":["none",L,oe,te]}],"text-shadow-color":[{"text-shadow":u()}],opacity:[{opacity:[g,l,i]}],"mix-blend":[{"mix-blend":[...Be(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Be()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[g]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":u()}],"mask-image-linear-to-color":[{"mask-linear-to":u()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":u()}],"mask-image-t-to-color":[{"mask-t-to":u()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":u()}],"mask-image-r-to-color":[{"mask-r-to":u()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":u()}],"mask-image-b-to-color":[{"mask-b-to":u()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":u()}],"mask-image-l-to-color":[{"mask-l-to":u()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":u()}],"mask-image-x-to-color":[{"mask-x-to":u()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":u()}],"mask-image-y-to-color":[{"mask-y-to":u()}],"mask-image-radial":[{"mask-radial":[l,i]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":u()}],"mask-image-radial-to-color":[{"mask-radial-to":u()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[g]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":u()}],"mask-image-conic-to-color":[{"mask-conic-to":u()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Z()}],"mask-repeat":[{mask:ne()}],"mask-size":[{mask:Fe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",l,i]}],filter:[{filter:["","none",l,i]}],blur:[{blur:$e()}],brightness:[{brightness:[g,l,i]}],contrast:[{contrast:[g,l,i]}],"drop-shadow":[{"drop-shadow":["","none",h,oe,te]}],"drop-shadow-color":[{"drop-shadow":u()}],grayscale:[{grayscale:["",g,l,i]}],"hue-rotate":[{"hue-rotate":[g,l,i]}],invert:[{invert:["",g,l,i]}],saturate:[{saturate:[g,l,i]}],sepia:[{sepia:["",g,l,i]}],"backdrop-filter":[{"backdrop-filter":["","none",l,i]}],"backdrop-blur":[{"backdrop-blur":$e()}],"backdrop-brightness":[{"backdrop-brightness":[g,l,i]}],"backdrop-contrast":[{"backdrop-contrast":[g,l,i]}],"backdrop-grayscale":[{"backdrop-grayscale":["",g,l,i]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g,l,i]}],"backdrop-invert":[{"backdrop-invert":["",g,l,i]}],"backdrop-opacity":[{"backdrop-opacity":[g,l,i]}],"backdrop-saturate":[{"backdrop-saturate":[g,l,i]}],"backdrop-sepia":[{"backdrop-sepia":["",g,l,i]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":p()}],"border-spacing-x":[{"border-spacing-x":p()}],"border-spacing-y":[{"border-spacing-y":p()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",l,i]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[g,"initial",l,i]}],ease:[{ease:["linear","initial",V,l,i]}],delay:[{delay:[g,l,i]}],animate:[{animate:["none",F,l,i]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[z,l,i]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:ie()}],"rotate-x":[{"rotate-x":ie()}],"rotate-y":[{"rotate-y":ie()}],"rotate-z":[{"rotate-z":ie()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[l,i,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":["translate-none"],accent:[{accent:u()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:u()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",l,i]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":p()}],"scroll-mx":[{"scroll-mx":p()}],"scroll-my":[{"scroll-my":p()}],"scroll-ms":[{"scroll-ms":p()}],"scroll-me":[{"scroll-me":p()}],"scroll-mt":[{"scroll-mt":p()}],"scroll-mr":[{"scroll-mr":p()}],"scroll-mb":[{"scroll-mb":p()}],"scroll-ml":[{"scroll-ml":p()}],"scroll-p":[{"scroll-p":p()}],"scroll-px":[{"scroll-px":p()}],"scroll-py":[{"scroll-py":p()}],"scroll-ps":[{"scroll-ps":p()}],"scroll-pe":[{"scroll-pe":p()}],"scroll-pt":[{"scroll-pt":p()}],"scroll-pr":[{"scroll-pr":p()}],"scroll-pb":[{"scroll-pb":p()}],"scroll-pl":[{"scroll-pl":p()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",l,i]}],fill:[{fill:["none",...u()]}],"stroke-w":[{stroke:[g,R,K,fe]}],stroke:[{stroke:["none",...u()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function S(...e){return Mr(We(e))}const Dr={purple:"bg-purple-500",green:"bg-green-500",blue:"bg-blue-500",yellow:"bg-yellow-400 !text-yellow-900",red:"bg-red-500"},Le=({id:e,title:o,price:r,periodLabel:t,features:s,isSelected:n,onSelect:a,topBadge:m,discountBadge:d,premiumCallout:b,bottomNote:k,introPriceNote:v,isBestValue:L=!1,ctaButton:h,className:D,children:z,disabled:w=!1,ariaLabel:V,onTrack:F,trackingLabel:B,componentName:C="SubscriptionTile"})=>{const N=!!h,T=n?"bg-blue-600 text-white ring-4 ring-blue-600 ring-offset-4 ring-offset-white dark:ring-offset-gray-900 border-transparent":"bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:shadow-md",O=()=>{!w&&!N&&(F?.({action:"select",trackingLabel:B,componentName:C}),a())},p=G=>{!w&&!N&&(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),F?.({action:"select",trackingLabel:B,componentName:C}),a())},$=G=>{G.stopPropagation(),F?.({action:"cta_click",trackingLabel:B,componentName:C}),h?.onClick&&h.onClick()};return c.jsxs("div",{className:S("relative rounded-2xl p-6 transition-all flex flex-col h-full",w?"opacity-50 cursor-not-allowed":N?"cursor-default":"cursor-pointer",T,D),onClick:O,onKeyDown:p,role:N?"article":"radio","aria-checked":N?void 0:n,"aria-label":V||`${o} - ${r}${t||""}`,"aria-disabled":w,tabIndex:N||w?-1:0,children:[m&&c.jsx("div",{className:"absolute -top-3 left-1/2 transform -translate-x-1/2",children:c.jsx("span",{className:S(Dr[m.color],"text-white px-3 py-1 rounded-full text-sm font-semibold shadow-lg whitespace-nowrap"),children:m.text})}),c.jsxs("div",{className:"flex flex-col flex-grow",children:[c.jsxs("div",{className:"text-center mb-6",children:[c.jsx("h3",{className:S(de.textVariants.heading.h4(),"mb-2",n?"text-white":""),children:o}),c.jsxs("div",{className:"mb-3",children:[c.jsx("span",{className:S("text-4xl font-bold",n?"text-white":"text-gray-900 dark:text-gray-100"),children:r}),t&&c.jsx("span",{className:S("text-lg",n?"text-blue-100":"text-gray-500 dark:text-gray-400"),children:t})]}),d&&c.jsx("div",{className:S("inline-flex items-center px-2 py-1 rounded-full text-sm font-semibold",n?"bg-blue-500 text-white":"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300"),children:d.text})]}),z,s.length>0&&c.jsx("div",{className:"space-y-3 mb-6 flex-grow",children:s.map((G,Y)=>c.jsxs("div",{className:"flex items-start",children:[c.jsx("svg",{className:S("w-5 h-5 mr-3 flex-shrink-0",n?"text-blue-200":"text-green-500"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),c.jsx("span",{className:S("text-sm text-left",n?"text-white":"text-gray-700 dark:text-gray-300"),children:G.replace(/^✓\s*/,"")})]},Y))}),b&&c.jsxs("div",{className:S("rounded-lg p-4 mb-4",n?"bg-blue-500/30":"bg-gradient-to-r from-purple-50 to-blue-50 dark:from-purple-900/20 dark:to-blue-900/20"),children:[c.jsx("div",{className:"flex items-center mb-2",children:c.jsx("span",{className:S("font-semibold text-sm",n?"text-white":"text-purple-600 dark:text-purple-400"),children:b.title})}),c.jsx("ul",{className:S("text-xs space-y-1",n?"text-blue-100":"text-gray-600 dark:text-gray-400"),children:b.features.map((G,Y)=>c.jsxs("li",{children:["• ",G]},Y))})]}),k&&c.jsx("div",{className:S("text-center text-sm font-medium mb-4",n?"text-blue-100":"text-blue-600 dark:text-blue-400"),children:k})]}),c.jsxs("div",{className:"mt-auto space-y-4",children:[v&&c.jsx("div",{className:S("p-3 rounded-lg",n?"bg-blue-500/30":"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800"),children:c.jsx("p",{className:S("text-sm font-semibold text-center",n?"text-white":"text-yellow-700 dark:text-yellow-300"),children:v})}),N?h.href?c.jsx("a",{href:h.href,className:S("block w-full py-3 font-semibold rounded-lg text-center transition-colors",n?"bg-white text-blue-600 hover:bg-gray-100":"bg-blue-600 text-white hover:bg-blue-700"),onClick:G=>G.stopPropagation(),children:h.label}):c.jsx("button",{onClick:$,disabled:w,className:S("w-full py-3 font-semibold rounded-lg transition-colors",n?"bg-white text-blue-600 hover:bg-gray-100":"bg-blue-600 text-white hover:bg-blue-700",w&&"opacity-50 cursor-not-allowed"),children:h.label}):c.jsx("div",{className:"flex justify-center",children:c.jsx("div",{className:S("w-5 h-5 rounded-full border-2 flex items-center justify-center",n?"border-white bg-white":"border-gray-300 dark:border-gray-600"),children:n&&c.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-600"})})})]})]})},Tr=({title:e,children:o,error:r,variant:t="selection",currentStatus:s,primaryAction:n,secondaryAction:a,minTileWidth:m=240,className:d,headerContent:b,aboveProducts:k,footerContent:v,currentStatusLabel:L="Current Status",freeTileConfig:h,onTrack:D,trackingLabel:z,componentName:w="SubscriptionLayout"})=>{const V=t==="selection"&&n,F=()=>{D?.({action:"primary_action",trackingLabel:z,componentName:w}),n?.onClick()},B=()=>{D?.({action:"secondary_action",trackingLabel:z,componentName:w}),a?.onClick()},C=t==="cta"&&h,N={display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, ${m}px), 1fr))`,gap:"1.5rem"};return c.jsx(ee.Card,{className:d,children:c.jsxs(ee.CardContent,{className:"pt-6",children:[b,s&&c.jsxs(c.Fragment,{children:[c.jsx("h2",{className:S(de.textVariants.heading.h3(),"mb-4"),children:L}),s.isActive?c.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-4 mb-6",children:[c.jsxs("div",{className:"flex items-center mb-2",children:[c.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full mr-3"}),c.jsx("span",{className:"font-semibold text-green-800 dark:text-green-300",children:s.activeContent?.title||"Active Subscription"})]}),s.activeContent?.fields&&s.activeContent.fields.length>0&&c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:s.activeContent.fields.map((T,O)=>c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:T.label}),c.jsx("p",{className:"font-semibold text-green-800 dark:text-green-300",children:T.value})]},O))})]}):c.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 mb-6",children:[c.jsxs("div",{className:"flex items-center mb-2",children:[c.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded-full mr-3"}),c.jsx("span",{className:"font-semibold text-yellow-800 dark:text-yellow-300",children:s.inactiveContent?.title||"No Active Subscription"})]}),s.inactiveContent?.message&&c.jsx("p",{className:"text-yellow-700 dark:text-yellow-400",children:s.inactiveContent.message})]})]}),c.jsx("h2",{className:S(de.textVariants.heading.h3(),"mb-4"),children:e}),k,c.jsxs("div",{style:N,children:[C&&c.jsx(Le,{id:"free",title:h.title,price:h.price,periodLabel:h.periodLabel,features:h.features,isSelected:!1,onSelect:()=>{},topBadge:h.topBadge,ctaButton:h.ctaButton}),o]}),v,r&&c.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 mt-6",children:c.jsx("p",{className:"text-red-600 dark:text-red-400",children:r})}),V&&c.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[a&&c.jsx(ee.Button,{onClick:B,disabled:a.disabled||a.loading,variant:"outline",className:"sm:flex-shrink-0",children:a.label}),c.jsx(ee.Button,{onClick:F,disabled:n.disabled||n.loading,className:"flex-1",children:n.label})]})]})})};function Er({options:e,value:o,onChange:r,className:t,disabled:s=!1,size:n="md"}){const a={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"};return c.jsx("div",{className:S("inline-flex rounded-lg bg-gray-100 dark:bg-gray-800 p-1",s&&"opacity-50",t),role:"radiogroup",children:e.map(m=>{const d=o===m.value;return c.jsx("button",{type:"button",role:"radio","aria-checked":d,disabled:s,onClick:()=>!s&&r(m.value),className:S(a[n],"font-medium rounded-md transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",d?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",s&&"cursor-not-allowed"),children:m.label},m.value)})})}let be=null;const Or=async()=>(be||(be=await import("@revenuecat/purchases-js")),be);let E=null;const Gr=(e,o)=>{const r=e.rcBillingProduct,t=r?.defaultSubscriptionOption,s=typeof o?.entitlement=="string"?o.entitlement:void 0;return{identifier:e.identifier,productId:r?.identifier||void 0,price:r?.currentPrice?.amountMicros?(r.currentPrice.amountMicros/1e6).toFixed(2):"0",priceString:r?.currentPrice?.formattedPrice||"$0",title:r?.title||e.identifier,description:r?.description||"",period:r?.normalPeriodDuration||void 0,introPrice:t?.introPrice?.price?.formattedPrice||void 0,introPriceAmount:t?.introPrice?.price?.amountMicros?(t.introPrice.price.amountMicros/1e6).toFixed(2):void 0,introPricePeriod:t?.introPrice?.periodDuration||void 0,introPriceCycles:t?.introPrice?.cycleCount||void 0,freeTrialPeriod:t?.trial?.periodDuration||void 0,entitlement:s}},ge=(e,o)=>{const r=e.entitlements.active[o];return r?{isActive:!0,expirationDate:r.expirationDate?new Date(r.expirationDate):void 0,purchaseDate:r.latestPurchaseDate?new Date(r.latestPurchaseDate):void 0,productIdentifier:r.productIdentifier,willRenew:r.willRenew,isSandbox:r.isSandbox,unsubscribeDetectedAt:r.unsubscribeDetectedAt?new Date(r.unsubscribeDetectedAt):void 0,billingIssueDetectedAt:r.billingIssueDetectedAt?new Date(r.billingIssueDetectedAt):void 0}:{isActive:!1}},_e=A.createContext(void 0),jr=({apiKey:e,entitlementId:o,userEmail:r,onError:t,onPurchaseSuccess:s,children:n})=>{const[a,m]=A.useState([]),[d,b]=A.useState(null),[k,v]=A.useState(!1),[L,h]=A.useState(null),[D,z]=A.useState(!1),[w,V]=A.useState(null),[F,B]=A.useState(null),C=!e||e==="your_revenuecat_api_key_here",N=A.useCallback(()=>{m([]),b(null),B(null),h(null),z(!1),V(null),E=null},[]),T=A.useCallback(async()=>{if(E)try{const f=await E.getOfferings();if(f.current){B(f.current);const x=f.current.metadata,y=f.current.availablePackages.map(j=>Gr(j,x));m(y)}}catch(f){const x=f instanceof Error?f.message:"Failed to load offerings";h(x),t?.(f instanceof Error?f:new Error(x))}},[t]),O=A.useCallback(async()=>{if(E)try{const f=await E.getCustomerInfo(),x=ge(f,o);b(x.isActive?x:null)}catch(f){const x=f instanceof Error?f.message:"Failed to load subscription status";h(x),t?.(f instanceof Error?f:new Error(x))}},[o,t]),p=A.useCallback(async(f,x)=>{if(w&&w!==f&&N(),!(D&&w===f))try{if(v(!0),h(null),C)console.warn("[SubscriptionProvider] RevenueCat API key not configured"),m([]),b(null);else{const y=await Or(),j={apiKey:e,appUserId:f};E=y.Purchases.configure(j);const u=x||r;if(u&&E)try{await E.setAttributes({email:u})}catch{}await Promise.all([T(),O()])}V(f),z(!0)}catch(y){const j=y instanceof Error?y.message:"Failed to initialize";h(j),b(null),m([]),t?.(y instanceof Error?y:new Error(j))}finally{v(!1)}},[w,D,C,e,r,T,O,t,N]),$=A.useCallback(async f=>{try{if(v(!0),h(null),C){await new Promise(ne=>setTimeout(ne,2e3));const Z={isActive:!0,expirationDate:new Date(Date.now()+365*24*60*60*1e3),purchaseDate:new Date,productIdentifier:f,willRenew:!0};return b(Z),s?.(f),!0}if(!E||!F)throw new Error("Subscription service not initialized");const y=F.availablePackages.find(Z=>Z.identifier===f);if(!y)throw new Error(`Package not found: ${f}`);const j=await E.purchase({rcPackage:y,...r?{customerEmail:r}:{}}),u=ge(j.customerInfo,o);return b(u.isActive?u:null),u.isActive&&s?.(f),u.isActive}catch(x){const y=x instanceof Error?x.message:"Purchase failed";return h(y),t?.(x instanceof Error?x:new Error(y)),!1}finally{v(!1)}},[C,F,r,o,s,t]),G=A.useCallback(async()=>{try{if(v(!0),h(null),C)return await new Promise(y=>setTimeout(y,1e3)),h("No previous purchases found"),!1;if(!E)throw new Error("Subscription service not initialized");const f=await E.getCustomerInfo(),x=ge(f,o);return b(x.isActive?x:null),x.isActive||h("No previous purchases found"),x.isActive}catch(f){const x=f instanceof Error?f.message:"Restore failed";return h(x),t?.(f instanceof Error?f:new Error(x)),!1}finally{v(!1)}},[C,o,t]),Y=A.useCallback(async()=>{if(!C)try{h(null),await Promise.all([O(),T()])}catch(f){const x=f instanceof Error?f.message:"Refresh failed";h(x),t?.(f instanceof Error?f:new Error(x))}},[C,O,T,t]),Q=A.useCallback(()=>{h(null)},[]);A.useEffect(()=>{if(!D||C||!E)return;const f=setInterval(()=>{O().catch(()=>{})},300*1e3);return()=>clearInterval(f)},[D,C,O]);const se={products:a,currentSubscription:d,isLoading:k,error:L,initialize:p,purchase:$,restore:G,refresh:Y,clearError:Q};return c.jsx(_e.Provider,{value:se,children:n})},Lr=()=>{const e=A.useContext(_e);if(!e)throw new Error("useSubscriptionContext must be used within a SubscriptionProvider");return e},Ve=()=>{try{const e=[];for(let r=0;r<localStorage.length;r++){const t=localStorage.key(r);t&&(t.includes("revenuecat")||t.includes("rcb")||t.includes("rc_"))&&e.push(t)}e.forEach(r=>localStorage.removeItem(r));const o=[];for(let r=0;r<sessionStorage.length;r++){const t=sessionStorage.key(r);t&&(t.includes("revenuecat")||t.includes("rcb")||t.includes("rc_"))&&o.push(t)}o.forEach(r=>sessionStorage.removeItem(r))}catch{}},_r=()=>{try{E&&(E.close(),E=null),Ve()}catch{}};M.SegmentedControl=Er,M.SubscriptionLayout=Tr,M.SubscriptionProvider=jr,M.SubscriptionTile=Le,M.clearRevenueCatCheckoutSessions=Ve,M.closeRevenueCatInstance=_r,M.cn=S,M.useSubscriptionContext=Lr,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(D,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react/jsx-runtime"),require("@sudobility/design"),require("@sudobility/components"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@sudobility/design","@sudobility/components","react"],d):(D=typeof globalThis<"u"?globalThis:D||self,d(D.SubscriptionComponents={},D.ReactJSXRuntime,D.SudobilityDesign,D.SudobilityComponents,D.React))})(this,(function(D,d,me,oe,P){"use strict";function ye(e){var o,t,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(o=0;o<s;o++)e[o]&&(t=ye(e[o]))&&(r&&(r+=" "),r+=t)}else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Ue(){for(var e,o,t=0,r="",s=arguments.length;t<s;t++)(e=arguments[t])&&(o=ye(e))&&(r&&(r+=" "),r+=o);return r}const qe=(e,o)=>{const t=new Array(e.length+o.length);for(let r=0;r<e.length;r++)t[r]=e[r];for(let r=0;r<o.length;r++)t[e.length+r]=o[r];return t},Ke=(e,o)=>({classGroupId:e,validator:o}),ke=(e=new Map,o=null,t)=>({nextPart:e,validators:o,classGroupId:t}),se="-",ve=[],Ye="arbitrary..",Xe=e=>{const o=He(e),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Je(a);const f=a.split(se),u=f[0]===""&&f.length>1?1:0;return Ce(f,u,o)},getConflictingClassGroupIds:(a,f)=>{if(f){const u=r[a],g=t[a];return u?g?qe(g,u):u:g||ve}return t[a]||ve}}},Ce=(e,o,t)=>{if(e.length-o===0)return t.classGroupId;const s=e[o],n=t.nextPart.get(s);if(n){const g=Ce(e,o+1,n);if(g)return g}const a=t.validators;if(a===null)return;const f=o===0?e.join(se):e.slice(o).join(se),u=a.length;for(let g=0;g<u;g++){const y=a[g];if(y.validator(f))return y.classGroupId}},Je=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=e.slice(1,-1),t=o.indexOf(":"),r=o.slice(0,t);return r?Ye+r:void 0})(),He=e=>{const{theme:o,classGroups:t}=e;return Qe(t,o)},Qe=(e,o)=>{const t=ke();for(const r in e){const s=e[r];fe(s,t,r,o)}return t},fe=(e,o,t,r)=>{const s=e.length;for(let n=0;n<s;n++){const a=e[n];Ze(a,o,t,r)}},Ze=(e,o,t,r)=>{if(typeof e=="string"){Re(e,o,t);return}if(typeof e=="function"){et(e,o,t,r);return}tt(e,o,t,r)},Re=(e,o,t)=>{const r=e===""?o:Se(o,e);r.classGroupId=t},et=(e,o,t,r)=>{if(rt(e)){fe(e(r),o,t,r);return}o.validators===null&&(o.validators=[]),o.validators.push(Ke(t,e))},tt=(e,o,t,r)=>{const s=Object.entries(e),n=s.length;for(let a=0;a<n;a++){const[f,u]=s[a];fe(u,Se(o,f),t,r)}},Se=(e,o)=>{let t=e;const r=o.split(se),s=r.length;for(let n=0;n<s;n++){const a=r[n];let f=t.nextPart.get(a);f||(f=ke(),t.nextPart.set(a,f)),t=f}return t},rt=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,ot=e=>{if(e<1)return{get:()=>{},set:()=>{}};let o=0,t=Object.create(null),r=Object.create(null);const s=(n,a)=>{t[n]=a,o++,o>e&&(o=0,r=t,t=Object.create(null))};return{get(n){let a=t[n];if(a!==void 0)return a;if((a=r[n])!==void 0)return s(n,a),a},set(n,a){n in t?t[n]=a:s(n,a)}}},pe="!",Pe=":",st=[],ze=(e,o,t,r,s)=>({modifiers:e,hasImportantModifier:o,baseClassName:t,maybePostfixModifierPosition:r,isExternal:s}),nt=e=>{const{prefix:o,experimentalParseClassName:t}=e;let r=s=>{const n=[];let a=0,f=0,u=0,g;const y=s.length;for(let N=0;N<y;N++){const w=s[N];if(a===0&&f===0){if(w===Pe){n.push(s.slice(u,N)),u=N+1;continue}if(w==="/"){g=N;continue}}w==="["?a++:w==="]"?a--:w==="("?f++:w===")"&&f--}const v=n.length===0?s:s.slice(u);let _=v,x=!1;v.endsWith(pe)?(_=v.slice(0,-1),x=!0):v.startsWith(pe)&&(_=v.slice(1),x=!0);const O=g&&g>u?g-u:void 0;return ze(n,x,_,O)};if(o){const s=o+Pe,n=r;r=a=>a.startsWith(s)?n(a.slice(s.length)):ze(st,!1,a,void 0,!0)}if(t){const s=r;r=n=>t({className:n,parseClassName:s})}return r},at=e=>{const o=new Map;return e.orderSensitiveModifiers.forEach((t,r)=>{o.set(t,1e6+r)}),t=>{const r=[];let s=[];for(let n=0;n<t.length;n++){const a=t[n],f=a[0]==="[",u=o.has(a);f||u?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},it=e=>({cache:ot(e.cacheSize),parseClassName:nt(e),sortModifiers:at(e),...Xe(e)}),lt=/\s+/,ct=(e,o)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:n}=o,a=[],f=e.trim().split(lt);let u="";for(let g=f.length-1;g>=0;g-=1){const y=f[g],{isExternal:v,modifiers:_,hasImportantModifier:x,baseClassName:O,maybePostfixModifierPosition:N}=t(y);if(v){u=y+(u.length>0?" "+u:u);continue}let w=!!N,V=r(w?O.substring(0,N):O);if(!V){if(!w){u=y+(u.length>0?" "+u:u);continue}if(V=r(O),!V){u=y+(u.length>0?" "+u:u);continue}w=!1}const F=_.length===0?"":_.length===1?_[0]:n(_).join(":"),$=x?F+pe:F,A=$+V;if(a.indexOf(A)>-1)continue;a.push(A);const S=s(V,w);for(let C=0;C<S.length;++C){const W=S[C];a.push($+W)}u=y+(u.length>0?" "+u:u)}return u},dt=(...e)=>{let o=0,t,r,s="";for(;o<e.length;)(t=e[o++])&&(r=Ne(t))&&(s&&(s+=" "),s+=r);return s},Ne=e=>{if(typeof e=="string")return e;let o,t="";for(let r=0;r<e.length;r++)e[r]&&(o=Ne(e[r]))&&(t&&(t+=" "),t+=o);return t},ut=(e,...o)=>{let t,r,s,n;const a=u=>{const g=o.reduce((y,v)=>v(y),e());return t=it(g),r=t.cache.get,s=t.cache.set,n=f,f(u)},f=u=>{const g=r(u);if(g)return g;const y=ct(u,t);return s(u,y),y};return n=a,(...u)=>n(dt(...u))},mt=[],z=e=>{const o=t=>t[e]||mt;return o.isThemeGetter=!0,o},Ae=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ie=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ft=/^\d+\/\d+$/,pt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,gt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ht=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Q=e=>ft.test(e),h=e=>!!e&&!Number.isNaN(Number(e)),K=e=>!!e&&Number.isInteger(Number(e)),be=e=>e.endsWith("%")&&h(e.slice(0,-1)),q=e=>pt.test(e),wt=()=>!0,yt=e=>bt.test(e)&&!gt.test(e),Me=()=>!1,kt=e=>ht.test(e),vt=e=>xt.test(e),Ct=e=>!l(e)&&!c(e),St=e=>Z(e,Ge,Me),l=e=>Ae.test(e),J=e=>Z(e,je,yt),ge=e=>Z(e,It,h),De=e=>Z(e,Te,Me),Pt=e=>Z(e,Ee,vt),ne=e=>Z(e,Le,kt),c=e=>Ie.test(e),te=e=>R(e,je),zt=e=>R(e,Mt),Oe=e=>R(e,Te),Nt=e=>R(e,Ge),At=e=>R(e,Ee),ae=e=>R(e,Le,!0),Z=(e,o,t)=>{const r=Ae.exec(e);return r?r[1]?o(r[1]):t(r[2]):!1},R=(e,o,t=!1)=>{const r=Ie.exec(e);return r?r[1]?o(r[1]):t:!1},Te=e=>e==="position"||e==="percentage",Ee=e=>e==="image"||e==="url",Ge=e=>e==="length"||e==="size"||e==="bg-size",je=e=>e==="length",It=e=>e==="number",Mt=e=>e==="family-name",Le=e=>e==="shadow",Dt=ut(()=>{const e=z("color"),o=z("font"),t=z("text"),r=z("font-weight"),s=z("tracking"),n=z("leading"),a=z("breakpoint"),f=z("container"),u=z("spacing"),g=z("radius"),y=z("shadow"),v=z("inset-shadow"),_=z("text-shadow"),x=z("drop-shadow"),O=z("blur"),N=z("perspective"),w=z("aspect"),V=z("ease"),F=z("animate"),$=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...A(),c,l],C=()=>["auto","hidden","clip","visible","scroll"],W=()=>["auto","contain","none"],p=()=>[c,l,u],I=()=>[Q,"full","auto",...p()],G=()=>[K,"none","subgrid",c,l],Y=()=>["auto",{span:["full",K,c,l]},K,c,l],ee=()=>[K,"auto",c,l],ie=()=>["auto","min","max","fr",c,l],re=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],m=()=>["auto",...p()],b=()=>[Q,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...p()],i=()=>[e,c,l],j=()=>[...A(),Oe,De,{position:[c,l]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",Nt,St,{size:[c,l]}],H=()=>[be,te,J],T=()=>["","none","full",g,c,l],B=()=>["",h,te,J],le=()=>["solid","dashed","dotted","double"],Be=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>[h,be,Oe,De],We=()=>["","none",O,c,l],ce=()=>["none",h,c,l],de=()=>["none",h,c,l],we=()=>[h,c,l],ue=()=>[Q,"full",...p()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[q],breakpoint:[q],color:[wt],container:[q],"drop-shadow":[q],ease:["in","out","in-out"],font:[Ct],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[q],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[q],shadow:[q],spacing:["px",h],text:[q],"text-shadow":[q],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Q,l,c,w]}],container:["container"],columns:[{columns:[h,l,c,f]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:W()}],"overscroll-x":[{"overscroll-x":W()}],"overscroll-y":[{"overscroll-y":W()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[K,"auto",c,l]}],basis:[{basis:[Q,"full","auto",f,...p()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[h,Q,"auto","initial","none",l]}],grow:[{grow:["",h,c,l]}],shrink:[{shrink:["",h,c,l]}],order:[{order:[K,"first","last","none",c,l]}],"grid-cols":[{"grid-cols":G()}],"col-start-end":[{col:Y()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":G()}],"row-start-end":[{row:Y()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:p()}],"gap-x":[{"gap-x":p()}],"gap-y":[{"gap-y":p()}],"justify-content":[{justify:[...re(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...re()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":re()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:p()}],px:[{px:p()}],py:[{py:p()}],ps:[{ps:p()}],pe:[{pe:p()}],pt:[{pt:p()}],pr:[{pr:p()}],pb:[{pb:p()}],pl:[{pl:p()}],m:[{m:m()}],mx:[{mx:m()}],my:[{my:m()}],ms:[{ms:m()}],me:[{me:m()}],mt:[{mt:m()}],mr:[{mr:m()}],mb:[{mb:m()}],ml:[{ml:m()}],"space-x":[{"space-x":p()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":p()}],"space-y-reverse":["space-y-reverse"],size:[{size:b()}],w:[{w:[f,"screen",...b()]}],"min-w":[{"min-w":[f,"screen","none",...b()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[a]},...b()]}],h:[{h:["screen","lh",...b()]}],"min-h":[{"min-h":["screen","lh","none",...b()]}],"max-h":[{"max-h":["screen","lh",...b()]}],"font-size":[{text:["base",t,te,J]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,c,ge]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",be,l]}],"font-family":[{font:[zt,l,o]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,c,l]}],"line-clamp":[{"line-clamp":[h,"none",c,ge]}],leading:[{leading:[n,...p()]}],"list-image":[{"list-image":["none",c,l]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",c,l]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:i()}],"text-color":[{text:i()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:[h,"from-font","auto",c,J]}],"text-decoration-color":[{decoration:i()}],"underline-offset":[{"underline-offset":[h,"auto",c,l]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:p()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",c,l]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",c,l]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:j()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},K,c,l],radial:["",c,l],conic:[K,c,l]},At,Pt]}],"bg-color":[{bg:i()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:i()}],"gradient-via":[{via:i()}],"gradient-to":[{to:i()}],rounded:[{rounded:T()}],"rounded-s":[{"rounded-s":T()}],"rounded-e":[{"rounded-e":T()}],"rounded-t":[{"rounded-t":T()}],"rounded-r":[{"rounded-r":T()}],"rounded-b":[{"rounded-b":T()}],"rounded-l":[{"rounded-l":T()}],"rounded-ss":[{"rounded-ss":T()}],"rounded-se":[{"rounded-se":T()}],"rounded-ee":[{"rounded-ee":T()}],"rounded-es":[{"rounded-es":T()}],"rounded-tl":[{"rounded-tl":T()}],"rounded-tr":[{"rounded-tr":T()}],"rounded-br":[{"rounded-br":T()}],"rounded-bl":[{"rounded-bl":T()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...le(),"hidden","none"]}],"divide-style":[{divide:[...le(),"hidden","none"]}],"border-color":[{border:i()}],"border-color-x":[{"border-x":i()}],"border-color-y":[{"border-y":i()}],"border-color-s":[{"border-s":i()}],"border-color-e":[{"border-e":i()}],"border-color-t":[{"border-t":i()}],"border-color-r":[{"border-r":i()}],"border-color-b":[{"border-b":i()}],"border-color-l":[{"border-l":i()}],"divide-color":[{divide:i()}],"outline-style":[{outline:[...le(),"none","hidden"]}],"outline-offset":[{"outline-offset":[h,c,l]}],"outline-w":[{outline:["",h,te,J]}],"outline-color":[{outline:i()}],shadow:[{shadow:["","none",y,ae,ne]}],"shadow-color":[{shadow:i()}],"inset-shadow":[{"inset-shadow":["none",v,ae,ne]}],"inset-shadow-color":[{"inset-shadow":i()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:i()}],"ring-offset-w":[{"ring-offset":[h,J]}],"ring-offset-color":[{"ring-offset":i()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":i()}],"text-shadow":[{"text-shadow":["none",_,ae,ne]}],"text-shadow-color":[{"text-shadow":i()}],opacity:[{opacity:[h,c,l]}],"mix-blend":[{"mix-blend":[...Be(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Be()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[h]}],"mask-image-linear-from-pos":[{"mask-linear-from":M()}],"mask-image-linear-to-pos":[{"mask-linear-to":M()}],"mask-image-linear-from-color":[{"mask-linear-from":i()}],"mask-image-linear-to-color":[{"mask-linear-to":i()}],"mask-image-t-from-pos":[{"mask-t-from":M()}],"mask-image-t-to-pos":[{"mask-t-to":M()}],"mask-image-t-from-color":[{"mask-t-from":i()}],"mask-image-t-to-color":[{"mask-t-to":i()}],"mask-image-r-from-pos":[{"mask-r-from":M()}],"mask-image-r-to-pos":[{"mask-r-to":M()}],"mask-image-r-from-color":[{"mask-r-from":i()}],"mask-image-r-to-color":[{"mask-r-to":i()}],"mask-image-b-from-pos":[{"mask-b-from":M()}],"mask-image-b-to-pos":[{"mask-b-to":M()}],"mask-image-b-from-color":[{"mask-b-from":i()}],"mask-image-b-to-color":[{"mask-b-to":i()}],"mask-image-l-from-pos":[{"mask-l-from":M()}],"mask-image-l-to-pos":[{"mask-l-to":M()}],"mask-image-l-from-color":[{"mask-l-from":i()}],"mask-image-l-to-color":[{"mask-l-to":i()}],"mask-image-x-from-pos":[{"mask-x-from":M()}],"mask-image-x-to-pos":[{"mask-x-to":M()}],"mask-image-x-from-color":[{"mask-x-from":i()}],"mask-image-x-to-color":[{"mask-x-to":i()}],"mask-image-y-from-pos":[{"mask-y-from":M()}],"mask-image-y-to-pos":[{"mask-y-to":M()}],"mask-image-y-from-color":[{"mask-y-from":i()}],"mask-image-y-to-color":[{"mask-y-to":i()}],"mask-image-radial":[{"mask-radial":[c,l]}],"mask-image-radial-from-pos":[{"mask-radial-from":M()}],"mask-image-radial-to-pos":[{"mask-radial-to":M()}],"mask-image-radial-from-color":[{"mask-radial-from":i()}],"mask-image-radial-to-color":[{"mask-radial-to":i()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[h]}],"mask-image-conic-from-pos":[{"mask-conic-from":M()}],"mask-image-conic-to-pos":[{"mask-conic-to":M()}],"mask-image-conic-from-color":[{"mask-conic-from":i()}],"mask-image-conic-to-color":[{"mask-conic-to":i()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:j()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",c,l]}],filter:[{filter:["","none",c,l]}],blur:[{blur:We()}],brightness:[{brightness:[h,c,l]}],contrast:[{contrast:[h,c,l]}],"drop-shadow":[{"drop-shadow":["","none",x,ae,ne]}],"drop-shadow-color":[{"drop-shadow":i()}],grayscale:[{grayscale:["",h,c,l]}],"hue-rotate":[{"hue-rotate":[h,c,l]}],invert:[{invert:["",h,c,l]}],saturate:[{saturate:[h,c,l]}],sepia:[{sepia:["",h,c,l]}],"backdrop-filter":[{"backdrop-filter":["","none",c,l]}],"backdrop-blur":[{"backdrop-blur":We()}],"backdrop-brightness":[{"backdrop-brightness":[h,c,l]}],"backdrop-contrast":[{"backdrop-contrast":[h,c,l]}],"backdrop-grayscale":[{"backdrop-grayscale":["",h,c,l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h,c,l]}],"backdrop-invert":[{"backdrop-invert":["",h,c,l]}],"backdrop-opacity":[{"backdrop-opacity":[h,c,l]}],"backdrop-saturate":[{"backdrop-saturate":[h,c,l]}],"backdrop-sepia":[{"backdrop-sepia":["",h,c,l]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":p()}],"border-spacing-x":[{"border-spacing-x":p()}],"border-spacing-y":[{"border-spacing-y":p()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",c,l]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[h,"initial",c,l]}],ease:[{ease:["linear","initial",V,c,l]}],delay:[{delay:[h,c,l]}],animate:[{animate:["none",F,c,l]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,c,l]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[c,l,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ue()}],"translate-x":[{"translate-x":ue()}],"translate-y":[{"translate-y":ue()}],"translate-z":[{"translate-z":ue()}],"translate-none":["translate-none"],accent:[{accent:i()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:i()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",c,l]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":p()}],"scroll-mx":[{"scroll-mx":p()}],"scroll-my":[{"scroll-my":p()}],"scroll-ms":[{"scroll-ms":p()}],"scroll-me":[{"scroll-me":p()}],"scroll-mt":[{"scroll-mt":p()}],"scroll-mr":[{"scroll-mr":p()}],"scroll-mb":[{"scroll-mb":p()}],"scroll-ml":[{"scroll-ml":p()}],"scroll-p":[{"scroll-p":p()}],"scroll-px":[{"scroll-px":p()}],"scroll-py":[{"scroll-py":p()}],"scroll-ps":[{"scroll-ps":p()}],"scroll-pe":[{"scroll-pe":p()}],"scroll-pt":[{"scroll-pt":p()}],"scroll-pr":[{"scroll-pr":p()}],"scroll-pb":[{"scroll-pb":p()}],"scroll-pl":[{"scroll-pl":p()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",c,l]}],fill:[{fill:["none",...i()]}],"stroke-w":[{stroke:[h,te,J,ge]}],stroke:[{stroke:["none",...i()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function k(...e){return Dt(Ue(e))}const Ot={purple:"bg-purple-500",green:"bg-green-500",blue:"bg-blue-500",yellow:"bg-yellow-400 !text-yellow-900",red:"bg-red-500"},_e=({id:e,title:o,price:t,periodLabel:r,features:s,isSelected:n,onSelect:a,topBadge:f,discountBadge:u,premiumCallout:g,bottomNote:y,introPriceNote:v,isBestValue:_=!1,ctaButton:x,className:O,children:N,disabled:w=!1,ariaLabel:V,onTrack:F,trackingLabel:$,componentName:A="SubscriptionTile"})=>{const S=!!x,C=n?"bg-blue-600 text-white ring-4 ring-blue-600 ring-offset-4 ring-offset-white dark:ring-offset-gray-900 border-transparent":"bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:shadow-md",W=()=>{!w&&!S&&(F?.({action:"select",trackingLabel:$,componentName:A}),a())},p=G=>{!w&&!S&&(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),F?.({action:"select",trackingLabel:$,componentName:A}),a())},I=G=>{G.stopPropagation(),F?.({action:"cta_click",trackingLabel:$,componentName:A}),x?.onClick&&x.onClick()};return d.jsxs("div",{className:k("relative rounded-2xl p-6 transition-all flex flex-col h-full",S?"pb-20":"pb-14",w?"opacity-50 cursor-not-allowed":S?"cursor-default":"cursor-pointer",C,O),onClick:W,onKeyDown:p,role:S?"article":"radio","aria-checked":S?void 0:n,"aria-label":V||`${o} - ${t}${r||""}`,"aria-disabled":w,tabIndex:S||w?-1:0,children:[f&&d.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 z-10",children:d.jsx("span",{className:k(Ot[f.color],"text-white px-4 py-1.5 rounded-full text-sm font-semibold shadow-lg whitespace-nowrap"),children:f.text})}),d.jsxs("div",{className:"flex flex-col flex-grow",children:[d.jsxs("div",{className:k("text-center mb-6",f&&"mt-2"),children:[d.jsx("h3",{className:k(me.textVariants.heading.h4(),"mb-2",n?"text-white":""),children:o}),d.jsxs("div",{className:"mb-3",children:[d.jsx("span",{className:k("text-4xl font-bold",n?"text-white":"text-gray-900 dark:text-gray-100"),children:t}),r&&d.jsx("span",{className:k("text-lg",n?"text-blue-100":"text-gray-500 dark:text-gray-400"),children:r})]}),u&&d.jsx("div",{className:k("inline-flex items-center px-2 py-1 rounded-full text-sm font-semibold",n?"bg-blue-500 text-white":"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300"),children:u.text})]}),N,s.length>0&&d.jsx("div",{className:"space-y-3 mb-6 flex-grow",children:s.map((G,Y)=>d.jsxs("div",{className:"flex items-start",children:[d.jsx("svg",{className:k("w-5 h-5 mr-3 flex-shrink-0",n?"text-blue-200":"text-green-500"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),d.jsx("span",{className:k("text-sm text-left",n?"text-white":"text-gray-700 dark:text-gray-300"),children:G.replace(/^✓\s*/,"")})]},Y))}),g&&d.jsxs("div",{className:k("rounded-lg p-4 mb-4",n?"bg-blue-500/30":"bg-gradient-to-r from-purple-50 to-blue-50 dark:from-purple-900/20 dark:to-blue-900/20"),children:[d.jsx("div",{className:"flex items-center mb-2",children:d.jsx("span",{className:k("font-semibold text-sm",n?"text-white":"text-purple-600 dark:text-purple-400"),children:g.title})}),d.jsx("ul",{className:k("text-xs space-y-1",n?"text-blue-100":"text-gray-600 dark:text-gray-400"),children:g.features.map((G,Y)=>d.jsxs("li",{children:["• ",G]},Y))})]}),y&&d.jsx("div",{className:k("text-center text-sm font-medium mb-4",n?"text-blue-100":"text-blue-600 dark:text-blue-400"),children:y}),v&&d.jsx("div",{className:k("p-3 rounded-lg mt-auto",n?"bg-blue-500/30":"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800"),children:d.jsx("p",{className:k("text-sm font-semibold text-center",n?"text-white":"text-yellow-700 dark:text-yellow-300"),children:v})})]}),S&&d.jsx("div",{className:"absolute bottom-4 left-6 right-6",children:x.href?d.jsx("a",{href:x.href,className:k("block w-full py-3 font-semibold rounded-lg text-center transition-colors",n?"bg-white text-blue-600 hover:bg-gray-100":"bg-blue-600 text-white hover:bg-blue-700"),onClick:G=>G.stopPropagation(),children:x.label}):d.jsx("button",{onClick:I,disabled:w,className:k("w-full py-3 font-semibold rounded-lg transition-colors",n?"bg-white text-blue-600 hover:bg-gray-100":"bg-blue-600 text-white hover:bg-blue-700",w&&"opacity-50 cursor-not-allowed"),children:x.label})}),!S&&d.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2",children:d.jsx("div",{className:k("w-5 h-5 rounded-full border-2 flex items-center justify-center",n?"border-white bg-white":"border-gray-300 dark:border-gray-600"),children:n&&d.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-600"})})})]})},Tt=({title:e,children:o,error:t,variant:r="selection",currentStatus:s,primaryAction:n,secondaryAction:a,minTileWidth:f=240,className:u,headerContent:g,aboveProducts:y,footerContent:v,currentStatusLabel:_="Current Status",freeTileConfig:x,onTrack:O,trackingLabel:N,componentName:w="SubscriptionLayout"})=>{const V=r==="selection"&&n,F=()=>{O?.({action:"primary_action",trackingLabel:N,componentName:w}),n?.onClick()},$=()=>{O?.({action:"secondary_action",trackingLabel:N,componentName:w}),a?.onClick()},A=r==="cta"&&x,S={display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, ${f}px), 1fr))`,gap:"1.5rem"};return d.jsx(oe.Card,{className:u,children:d.jsxs(oe.CardContent,{className:"pt-6",children:[g,s&&d.jsxs(d.Fragment,{children:[d.jsx("h2",{className:k(me.textVariants.heading.h3(),"mb-4"),children:_}),s.isActive?d.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-4 mb-6",children:[d.jsxs("div",{className:"flex items-center mb-2",children:[d.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full mr-3"}),d.jsx("span",{className:"font-semibold text-green-800 dark:text-green-300",children:s.activeContent?.title||"Active Subscription"})]}),s.activeContent?.fields&&s.activeContent.fields.length>0&&d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:s.activeContent.fields.map((C,W)=>d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:C.label}),d.jsx("p",{className:"font-semibold text-green-800 dark:text-green-300",children:C.value})]},W))})]}):d.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 mb-6",children:[d.jsxs("div",{className:"flex items-center mb-2",children:[d.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded-full mr-3"}),d.jsx("span",{className:"font-semibold text-yellow-800 dark:text-yellow-300",children:s.inactiveContent?.title||"No Active Subscription"})]}),s.inactiveContent?.message&&d.jsx("p",{className:"text-yellow-700 dark:text-yellow-400",children:s.inactiveContent.message})]})]}),d.jsx("h2",{className:k(me.textVariants.heading.h3(),"mb-4"),children:e}),y,d.jsxs("div",{style:S,children:[A&&d.jsx(_e,{id:"free",title:x.title,price:x.price,periodLabel:x.periodLabel,features:x.features,isSelected:!1,onSelect:()=>{},topBadge:x.topBadge,ctaButton:x.ctaButton}),o]}),v,t&&d.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 mt-6",children:d.jsx("p",{className:"text-red-600 dark:text-red-400",children:t})}),V&&d.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[a&&d.jsx(oe.Button,{onClick:$,disabled:a.disabled||a.loading,variant:"outline",className:"sm:flex-shrink-0",children:a.label}),d.jsx(oe.Button,{onClick:F,disabled:n.disabled||n.loading,className:"flex-1",children:n.label})]})]})})};function Et({options:e,value:o,onChange:t,className:r,disabled:s=!1,size:n="md"}){const a={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"};return d.jsx("div",{className:k("inline-flex rounded-lg bg-gray-100 dark:bg-gray-800 p-1",s&&"opacity-50",r),role:"radiogroup",children:e.map(f=>{const u=o===f.value;return d.jsx("button",{type:"button",role:"radio","aria-checked":u,disabled:s,onClick:()=>!s&&t(f.value),className:k(a[n],"font-medium rounded-md transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",u?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",s&&"cursor-not-allowed"),children:f.label},f.value)})})}let he=null;const Gt=async()=>(he||(he=await import("@revenuecat/purchases-js")),he);let E=null;const Fe=(e,o)=>{const t=e.rcBillingProduct,r=t?.defaultSubscriptionOption,s=typeof o?.entitlement=="string"?o.entitlement:void 0;return{identifier:e.identifier,productId:t?.identifier||void 0,price:t?.currentPrice?.amountMicros?(t.currentPrice.amountMicros/1e6).toFixed(2):"0",priceString:t?.currentPrice?.formattedPrice||"$0",title:t?.title||e.identifier,description:t?.description||"",period:t?.normalPeriodDuration||void 0,introPrice:r?.introPrice?.price?.formattedPrice||void 0,introPriceAmount:r?.introPrice?.price?.amountMicros?(r.introPrice.price.amountMicros/1e6).toFixed(2):void 0,introPricePeriod:r?.introPrice?.periodDuration||void 0,introPriceCycles:r?.introPrice?.cycleCount||void 0,freeTrialPeriod:r?.trial?.periodDuration||void 0,entitlement:s}},xe=(e,o)=>{const t=e.entitlements.active[o];return t?{isActive:!0,expirationDate:t.expirationDate?new Date(t.expirationDate):void 0,purchaseDate:t.latestPurchaseDate?new Date(t.latestPurchaseDate):void 0,productIdentifier:t.productIdentifier,willRenew:t.willRenew,isSandbox:t.isSandbox,unsubscribeDetectedAt:t.unsubscribeDetectedAt?new Date(t.unsubscribeDetectedAt):void 0,billingIssueDetectedAt:t.billingIssueDetectedAt?new Date(t.billingIssueDetectedAt):void 0}:{isActive:!1}},Ve=P.createContext(void 0),jt=({apiKey:e,entitlementId:o,userEmail:t,onError:r,onPurchaseSuccess:s,children:n})=>{const[a,f]=P.useState([]),[u,g]=P.useState(null),[y,v]=P.useState(!1),[_,x]=P.useState(null),[O,N]=P.useState(!1),[w,V]=P.useState(null),[F,$]=P.useState(null),[A,S]=P.useState(null),C=!e||e==="your_revenuecat_api_key_here",W=P.useCallback(()=>{f([]),g(null),$(null),S(null),x(null),N(!1),V(null),E=null},[]),p=P.useCallback(async()=>{if(E)try{const m=await E.getOfferings();m.current&&$(m.current);const b=m.all;if(b){S(b);const i=[];for(const j of Object.keys(b)){const L=b[j];if(L?.availablePackages){const U=L.metadata,H=L.availablePackages.map(T=>Fe(T,U));i.push(...H)}}f(i)}else if(m.current){const i=m.current.metadata,j=m.current.availablePackages.map(L=>Fe(L,i));f(j)}}catch(m){const b=m instanceof Error?m.message:"Failed to load offerings";x(b),r?.(m instanceof Error?m:new Error(b))}},[r]),I=P.useCallback(async()=>{if(E)try{const m=await E.getCustomerInfo(),b=xe(m,o);g(b.isActive?b:null)}catch(m){const b=m instanceof Error?m.message:"Failed to load subscription status";x(b),r?.(m instanceof Error?m:new Error(b))}},[o,r]),G=P.useCallback(async(m,b)=>{if(w&&w!==m&&W(),!(O&&w===m))try{if(v(!0),x(null),C)console.warn("[SubscriptionProvider] RevenueCat API key not configured"),f([]),g(null);else{const i=await Gt(),j={apiKey:e,appUserId:m};E=i.Purchases.configure(j);const L=b||t;if(L&&E)try{await E.setAttributes({email:L})}catch{}await Promise.all([p(),I()])}V(m),N(!0)}catch(i){const j=i instanceof Error?i.message:"Failed to initialize";x(j),g(null),f([]),r?.(i instanceof Error?i:new Error(j))}finally{v(!1)}},[w,O,C,e,t,p,I,r,W]),Y=P.useCallback(async m=>{try{if(v(!0),x(null),C){await new Promise(U=>setTimeout(U,2e3));const L={isActive:!0,expirationDate:new Date(Date.now()+365*24*60*60*1e3),purchaseDate:new Date,productIdentifier:m,willRenew:!0};return g(L),s?.(m),!0}if(!E||!F&&!A)throw new Error("Subscription service not initialized");let b;if(A)for(const L of Object.keys(A)){const U=A[L];if(U?.availablePackages&&(b=U.availablePackages.find(H=>H.identifier===m),b))break}else F&&(b=F.availablePackages.find(U=>U.identifier===m));if(!b)throw new Error(`Package not found: ${m}`);const i=await E.purchase({rcPackage:b,...t?{customerEmail:t}:{}}),j=xe(i.customerInfo,o);return g(j.isActive?j:null),j.isActive&&s?.(m),j.isActive}catch(b){const i=b instanceof Error?b.message:"Purchase failed";return x(i),r?.(b instanceof Error?b:new Error(i)),!1}finally{v(!1)}},[C,F,A,t,o,s,r]),ee=P.useCallback(async()=>{try{if(v(!0),x(null),C)return await new Promise(i=>setTimeout(i,1e3)),x("No previous purchases found"),!1;if(!E)throw new Error("Subscription service not initialized");const m=await E.getCustomerInfo(),b=xe(m,o);return g(b.isActive?b:null),b.isActive||x("No previous purchases found"),b.isActive}catch(m){const b=m instanceof Error?m.message:"Restore failed";return x(b),r?.(m instanceof Error?m:new Error(b)),!1}finally{v(!1)}},[C,o,r]),ie=P.useCallback(async()=>{if(!C)try{x(null),await Promise.all([I(),p()])}catch(m){const b=m instanceof Error?m.message:"Refresh failed";x(b),r?.(m instanceof Error?m:new Error(b))}},[C,I,p,r]),re=P.useCallback(()=>{x(null)},[]);P.useEffect(()=>{if(!O||C||!E)return;const m=setInterval(()=>{I().catch(()=>{})},300*1e3);return()=>clearInterval(m)},[O,C,I]);const X={products:a,currentSubscription:u,isLoading:y,error:_,initialize:G,purchase:Y,restore:ee,refresh:ie,clearError:re};return d.jsx(Ve.Provider,{value:X,children:n})},Lt=()=>{const e=P.useContext(Ve);if(!e)throw new Error("useSubscriptionContext must be used within a SubscriptionProvider");return e},$e=()=>{try{const e=[];for(let t=0;t<localStorage.length;t++){const r=localStorage.key(t);r&&(r.includes("revenuecat")||r.includes("rcb")||r.includes("rc_"))&&e.push(r)}e.forEach(t=>localStorage.removeItem(t));const o=[];for(let t=0;t<sessionStorage.length;t++){const r=sessionStorage.key(t);r&&(r.includes("revenuecat")||r.includes("rcb")||r.includes("rc_"))&&o.push(r)}o.forEach(t=>sessionStorage.removeItem(t))}catch{}},_t=()=>{try{E&&(E.close(),E=null),$e()}catch{}};D.SegmentedControl=Et,D.SubscriptionLayout=Tt,D.SubscriptionProvider=jt,D.SubscriptionTile=_e,D.clearRevenueCatCheckoutSessions=$e,D.closeRevenueCatInstance=_t,D.cn=k,D.useSubscriptionContext=Lt,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-provider.d.ts","sourceRoot":"","sources":["../src/subscription-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMZ,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAGV,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAmGjB,MAAM,WAAW,yBAA0B,SAAQ,0BAA0B;IAC3E,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,
|
|
1
|
+
{"version":3,"file":"subscription-provider.d.ts","sourceRoot":"","sources":["../src/subscription-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMZ,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAGV,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAmGjB,MAAM,WAAW,yBAA0B,SAAQ,0BAA0B;IAC3E,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAiXpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAO,wBAQzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,+BAA+B,QAAO,IAgClD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,IAU1C,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|