PageSourceSearch

https://www.cadeodinheiro.online/_next/static/chunks/f875bd6e838b383d.js

js cadeodinheiro.online collected 2026-09-24 15:08:22 UTC 26,672 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,823962,193135,e=>{"use strict";var t=e.i(434752);e.s(["QrCode",()=>t.default],823962);var r=e.i(843476),a=e.i(271645),i=e.i(643531),n=e.i(174886),o=e.i(531278),t=t,s=e.i(63209),l=e.i(975157),c=e.i(29490),u=e.i(347015),d=e.i(836055);function p({customerEmail:e,customerName:p,onPaid:g,className:f}){let[h,m]=(0,a.useState)("loading"),[y,w]=(0,a.useState)(null),[b,P]=(0,a.useState)(null),[v,C]=(0,a.useState)(!1),[E,S]=(0,a.useState)(0),x=(0,a.useRef)(null),_=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(_.current)return;_.current=!0;let t=!1;return(async()=>{try{let r=await (0,d.tauriFetch)(`${(0,u.getApiUrl)()}/api/pix/create-subscription`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({customerEmail:e,customerName:p})}),a=await r.text(),i={};try{i=a?JSON.parse(a):{}}catch{}if(!r.ok){let e="string"==typeof i.error?i.error:null;throw Error(e||(r.status>=500?"O Pix está temporariamente indisponível. Tente novamente em alguns minutos.":"Não foi possível gerar o Pix. Confira sua conexão e tente novamente."))}if(t)return;let n=i.data??i;w({orderId:n.orderId,brCode:n.brCode,brCodeBase64:n.brCodeBase64,amount:n.amount,expiresAt:n.expiresAt}),m("ready"),(0,c.trackCheckoutStarted)("annual","pix")}catch(r){if(t)return;let e=r instanceof Error?r.message:"Erro ao gerar PIX.";P(/failed to fetch|networkerror|network request failed/i.test(e)?"Não foi possível conectar ao pagamento Pix. Confira sua internet e tente novamente.":e),m("error")}})(),()=>{t=!0}},[e,p,E]);let k=(0,a.useCallback)(()=>{x.current&&(clearInterval(x.current),x.current=null)},[]);(0,a.useEffect)(()=>{if("ready"===h&&y?.orderId)return x.current=setInterval(async()=>{try{let e=await (0,d.tauriFetch)(`${(0,u.getApiUrl)()}/api/payments/pix/status?orderId=${encodeURIComponent(y.orderId)}`),t=await e.json(),r=(t?.data?.status??t?.status??"").toString().toUpperCase();"PAID"===r&&(k(),m("paid"),g())}catch{}},4e3),k},[h,y?.orderId,g,k]);let I=(0,a.useCallback)(async()=>{if(y?.brCode)try{await navigator.clipboard.writeText(y.brCode),C(!0),setTimeout(()=>C(!1),2e3)}catch{}},[y?.brCode]),A=y?(y.amount/100).toLocaleString("pt-BR",{style:"currency",currency:"BRL"}):"";return"loading"===h?(0,r.jsxs)("div",{className:(0,l.cn)("flex flex-col items-center justify-center gap-3 py-10",f),children:[(0,r.jsx)(o.Loader2,{className:"size-6 animate-spin text-ink-3"}),(0,r.jsx)("p",{className:"text-sm text-ink-3",children:"Gerando seu PIX…"})]}):"error"===h?(0,r.jsxs)("div",{className:(0,l.cn)("flex flex-col items-center gap-3 py-8 text-center",f),children:[(0,r.jsx)(s.AlertCircle,{className:"size-7 text-bad"}),(0,r.jsx)("p",{className:"text-sm text-ink-2",children:b}),(0,r.jsx)("button",{type:"button",onClick:()=>{_.current=!1,m("loading"),P(null),S(e=>e+1)},className:"rounded-lg border border-line px-4 py-2 text-sm font-semibold text-ink hover:bg-surface-3",children:"Tentar novamente"})]}):"paid"===h?(0,r.jsxs)("div",{className:(0,l.cn)("flex flex-col items-center gap-3 py-10 text-center",f),children:[(0,r.jsx)("div",{className:"grid size-14 place-items-center rounded-full bg-good/15 text-good",children:(0,r.jsx)(i.Check,{className:"size-7"})}),(0,r.jsx)("p",{className:"text-base font-bold text-ink",children:"Pagamento confirmado!"}),(0,r.jsx)("p",{className:"text-sm text-ink-3",children:"Seu Premium já está ativo. ✨"})]}):(0,r.jsxs)("div",{className:(0,l.cn)("flex flex-col items-center gap-4",f),children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-ink-3",children:[(0,r.jsx)(t.default,{className:"size-3.5"}),"Pague com PIX ",A&&`\xb7 ${A}`]}),y?.brCodeBase64?(0,r.jsx)("div",{className:"rounded-2xl border border-line bg-white p-3",children:(0,r.jsx)("img",{src:y.brCodeBase64.startsWith("data:")?y.brCodeBase64:`data:image/png;base64,${y.brCodeBase64}`,alt:"QR Code PIX",width:200,height:200,className:"size-[200px]"})}):null,(0,r.jsx)("p",{className:"text-center text-xs text-ink-3 max-w-xs",children:"Abra o app do seu banco, escaneie o QR Code ou cole o código abaixo."}),(0,r.jsxs)("button",{type:"button",onClick:I,className:(0,l.cn)("flex w-full items-center justify-between gap-2 rounded-xl border px-4 py-3 text-left text-sm transition-colors",v?"border-good bg-good/10 text-good":"border-line bg-surface-2 text-ink-2 hover:border-line-strong"),children:[(0,r.jsx)("span",{className:"truncate font-mono text-xs",children:y?.brCode}),v?(0,r.jsx)(i.Check,{className:"size-4 shrink-0"}):(0,r.jsx)(n.Copy,{className:"size-4 shrink-0 text-ink-3"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-ink-4",children:[(0,r.jsx)(o.Loader2,{className:"size-3.5 animate-spin"}),"Aguardando confirmação do pagamento…"]})]})}e.s(["PixCheckout",()=>p],193135)},428248,e=>{"use strict";var t=e.i(271645),r=e.i(132261);let a=r.PRICING.monthly.cents,i=r.PRICING.annual.cents,n=null;function o(e){return(e/100).toFixed(2).replace(".",",")}function s(){let e=Math.round(i/12);return{monthlyCents:a,annualCents:i,discountPct:Math.round((1-e/a)*100)}}function l(){let e,[r,l]=(0,t.useState)(n??s()),[c,u]=(0,t.useState)(!n);return(0,t.useEffect)(()=>
1{if(n)return;let e=!0;return(async()=>{try{let t=await fetch("/api/public/plan-limits");if(!t.ok)throw Error(`plan-limits fetch failed: ${t.status}`);let r=await t.json(),o=Math.round((r?.premium?.price??a/100)*100),s=Math.round((r?.premium?.annual?.price??i/100)*100),c=r?.premium?.annual?.discountPct??(o>0?Math.round((1-Math.round(s/12)/o)*100):0),u={monthlyCents:o,annualCents:s,discountPct:c};n=u,e&&l(u)}catch{let t=s();n=t,e&&l(t)}finally{e&&u(!1)}})(),()=>{e=!1}},[]),{loading:c,monthlyCents:r.monthlyCents,monthly:o(r.monthlyCents),monthlyLabel:`R$ ${o(r.monthlyCents)}`,annual:(e=Math.round(r.annualCents/12),{totalCents:r.annualCents,totalLabel:`R$ ${o(r.annualCents)}`,monthlyEquivalent:o(e),monthlyEquivalentLabel:`R$ ${o(e)}`,discountPct:r.discountPct})}}e.s(["usePlanPricing",()=>l])},132261,e=>{"use strict";let t={monthly:{cents:999,display:"R$ 9,99",period:"/mês"},annual:{cents:7990,display:"R$ 79,90",period:"/ano",monthlyEquivalent:"R$ 6,66",monthlyEquivalentCents:666,savingsPercent:33},trial:{days:3},freeAiCredits:5};function r(e){let r="annual"===e?`${t.annual.display}${t.annual.period}`:`${t.monthly.display}${t.monthly.period}`;return`Gr\xe1tis por ${t.trial.days} dias, depois ${r}. Renova\xe7\xe3o autom\xe1tica — cancele antes do fim do teste e n\xe3o pagar\xe1 nada.`}e.s(["PRICING",0,t,"getTrialDisclosure",()=>r])},586682,e=>{"use strict";var t,r,a,i,n;function o(e,t,r,a){if("a"===r&&!a)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?a:"a"===r?a.call(e):a?a.value:t.get(e)}function s(e,t,r,a,i){if("m"===a)throw TypeError("Private method is not writable");if("a"===a&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,r):i?i.value=r:t.set(e,r),r}"function"==typeof SuppressedError&&SuppressedError;let l="__TAURI_TO_IPC_KEY__";function c(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class u{constructor(e){t.set(this,void 0),r.set(this,0),a.set(this,[]),i.set(this,void 0),s(this,t,e||(()=>{}),"f"),this.id=c(e=>{let n=e.index;if("end"in e)return void(n==o(this,r,"f")?this.cleanupCallback():s(this,i,n,"f"));let l=e.message;if(n==o(this,r,"f")){for(o(this,t,"f").call(this,l),s(this,r,o(this,r,"f")+1,"f");o(this,r,"f")in o(this,a,"f");){let e=o(this,a,"f")[o(this,r,"f")];o(this,t,"f").call(this,e),delete o(this,a,"f")[o(this,r,"f")],s(this,r,o(this,r,"f")+1,"f")}o(this,r,"f")===o(this,i,"f")&&this.cleanupCallback()}else o(this,a,"f")[n]=l})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){s(this,t,e,"f")}get onmessage(){return o(this,t,"f")}[(t=new WeakMap,r=new WeakMap,a=new WeakMap,i=new WeakMap,l)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[l]()}}class d{constructor(e,t,r){this.plugin=e,this.event=t,this.channelId=r}async unregister(){return h(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function p(e,t,r){let a=new u(r);try{return await h(`plugin:${e}|register_listener`,{event:t,handler:a}),new d(e,t,a.id)}catch{return await h(`plugin:${e}|registerListener`,{event:t,handler:a}),new d(e,t,a.id)}}async function g(e){return h(`plugin:${e}|check_permissions`)}async function f(e){return h(`plugin:${e}|request_permissions`)}async function h(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}function m(e,t="asset"){return window.__TAURI_INTERNALS__.convertFileSrc(e,t)}class y{get rid(){return o(this,n,"f")}constructor(e){n.set(this,void 0),s(this,n,e,"f")}async close(){return h("plugin:resources|close",{rid:this.rid})}}function w(){return!!(globalThis||window).isTauri}n=new WeakMap,e.s(["Channel",()=>u,"PluginListener",()=>d,"Resource",()=>y,"SERIALIZE_TO_IPC_FN",()=>l,"addPluginListener",()=>p,"checkPermissions",()=>g,"convertFileSrc",()=>m,"invoke",()=>h,"isTauri",()=>w,"requestPermissions",()=>f,"transformCallback",()=>c],586682)},836055,e=>{"use strict";var t=e.i(347015);async function r(e,r){if(r?.signal){if((0,t.isTauri)()){let t=localStorage.getItem("tauri_auth_token"),a=new Headers(r?.headers);return t&&a.set("Authorization",`Bearer ${t}`),fetch(e,{...r,headers:a})}return fetch(e,r)}let a=new AbortController,i=setTimeout(()=>a.abort(),9e3);try{if((0,t.isTauri)()){let t=localStorage.getItem("tauri_auth_token"),i=new Headers(r?.headers);return t&&i.set("Authorization",`Bearer ${t}`),await fetch(e,{...r,headers:i,signal:a.signal})}return await fetch(e,{...r,signal:a.signal})}finally{clearTimeout(i)}}function a(){return(0,t.isTauri)()?localStorage.getItem("tauri_auth_token"):null}e.s(["getAuthToken",()=>a,"tauriFetch",()=>r])},29490,e=>{"use strict";var t=e.i(247167),r=e.i(347015);function a(e,t){if((0,r.isTauri)()){if(window.FirebaseAnalytics?.logEvent)try{window.FirebaseAnalytics.logEvent(e,JSON.stringify(t??{}))}catch(e){}return}window.gtag&&window.gtag("event",e,t??{})}var i=e.i(464120);let n="AW-17940236048";function o(...e){window.gtag&&window.gtag(...e)}function s(e,t,r="BRL"){let a=(0,i.getStoredGclid)();o("event","conversion",{send_to:`${n}/${e}`,...null!=t&&{value:t,currency:r},...a&&{gclid:a}})}async function l(e){let t=new TextEncoder().encode(e.trim().toLowerCase());return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t))).map(e=>e.toString(16).padStart(2,"0")).join("")}async function c(e){if(e&&window.gtag)try{let t=await l(e);window.gtag("set","user_data",{sha256_email_address:t})}catch{}s("NeMqCLKf_YwcEJCOyepC"),a("sign_up",{method:"email"})}function u(e,t,r){if(!Number.isFinite(e)||e<=0)return void console.warn("[ads] purchase event skipped: invali
1d value",e);let s=(0,i.getStoredGclid)();o("event","conversion",{send_to:`${n}/Llo3CLWf_YwcEJCOyepC`,value:e,currency:"BRL",transaction_id:t,...s&&{gclid:s}}),o("event","purchase",{value:e,currency:"BRL",transaction_id:t,items:[{id:"premium",name:"Premium Subscription",quantity:1}],...s&&{gclid:s}}),a("purchase",{value:e,currency:"BRL",transaction_id:t,payment_method:r})}function d(){s("MKB7CPKLnKAcEJCOyepC"),a("tutorial_complete")}function p(e,r){let n=(0,i.getStoredGclid)();o("event","begin_checkout",{currency:"BRL",items:[{id:`premium_${e}`,name:`Premium ${e}`,quantity:1}],payment_method:r,...n&&{gclid:n}});let l=t.default.env.NEXT_PUBLIC_GADS_LABEL_BEGIN_CHECKOUT;l&&s(l),a("begin_checkout",{plan:e,payment_method:r})}e.s(["trackCheckoutStarted",()=>p,"trackFirstExpense",()=>d,"trackPremiumPurchase",()=>u,"trackSignup",()=>c],29490)},277638,e=>{"use strict";var t=e.i(271645),r=e.i(573340),a=e.i(66312),i=e.i(347015);function n(){let[e,n]=(0,t.useState)(r.DEFAULT_APP_RUNTIME_CONFIG),[o,s]=(0,t.useState)(!0);return(0,t.useEffect)(()=>{let e=!0;return(async()=>{let t=new AbortController,r=window.setTimeout(()=>t.abort(),5e3);try{let r=await fetch(`${(0,i.getApiUrl)()}/api/public/app-config`,{cache:"no-store",signal:t.signal}),o=await r.json();if(!e||!r.ok)return;n(o),(0,a.setProductEventDebugEnabled)(!!o.debug?.productEventLogsEnabled)}catch(e){e instanceof DOMException&&"AbortError"===e.name||console.error("[APP_RUNTIME_CONFIG_CLIENT_ERROR]",e)}finally{window.clearTimeout(r),e&&s(!1)}})(),()=>{e=!1}},[]),{config:e,isLoading:o}}e.s(["useAppRuntimeConfig",()=>n])},573340,e=>{"use strict";e.s(["DEFAULT_APP_RUNTIME_CONFIG",0,{billing:{web:{stripeEnabled:!0},android:{googlePlayEnabled:!0,stripeEnabled:!1}},auth:{android:{googleSignInEnabled:!1}},ads:{web:{enabled:!1},android:{enabled:!1}},debug:{notificationImportLogsEnabled:!1,productEventLogsEnabled:!1}}])},66312,22665,e=>{"use strict";var t=e.i(347015);let r="app_install_id";function a(){try{let e=localStorage.getItem(r);if(e)return e;let t=crypto.randomUUID();return localStorage.setItem(r,t),t}catch{return""}}function i(){try{return localStorage.getItem(r)}catch{return null}}e.s(["ensureInstallId",()=>a,"peekInstallId",()=>i],22665);let n=[];function o(e,r={}){let a={timestamp:Date.now(),eventName:e,params:r};n.push(a),n.length>80&&n.splice(0,n.length-80),window.__productEventDebugEnabled&&console.info("[PRODUCT_EVENT]",e,r),function(...e){window.gtag&&window.gtag(...e)}("event",e,r);try{let a=`${(0,t.getApiUrl)()}/api/public/product-event`,n={"Content-Type":"application/json"};if((0,t.isTauri)()){let e=localStorage.getItem("tauri_auth_token");e&&(n.Authorization=`Bearer ${e}`)}fetch(a,{method:"POST",headers:n,keepalive:!0,body:JSON.stringify({event:e,anonId:i()||void 0,platform:(0,t.getPlatform)(),props:r})}).catch(()=>{})}catch{}}function s(e){window.__productEventDebugEnabled=e}function l(){return n.slice().reverse()}e.s(["getProductEventLogs",()=>l,"setProductEventDebugEnabled",()=>s,"trackProductEvent",()=>o],66312)},372428,611339,508792,157338,e=>{"use strict";var t=e.i(271645),r=e.i(347015),a=e.i(500932);let i={hasSubscription:!1,status:null,platform:null,currentPeriodEnd:null,cancelAtPeriodEnd:!1,planType:"free",isPremium:!1,limits:null,features:null,aiUsage:null,isLoading:!0,error:null},n=null,o=null,s=0,l=null,c=null,u=new Set;function d(e,t){for(let r of(n=t,o=e,s=Date.now(),u))r(t)}function p(){return{subscriptionStateCache:n,subscriptionStateCacheUserId:o,subscriptionStateCacheUpdatedAt:s}}function g(){return{subscriptionFetchPromise:l,subscriptionFetchUserId:c}}function f(e,t){l=e,c=t}var h=e.i(739067),m=e.i(778497),y=e.i(836055);let w={monthly:"gastos_premium_monthly",promoMonthly:"gastos_premium_monthly_promo",quarterly:"gastos_premium_trimestral",annual:"gastos_premium_anual"},b=new Set(Object.values(w));e.s(["GOOGLE_PLAY_PRODUCTS",0,w,"SUPPORTED_GOOGLE_PLAY_PRODUCTS",0,b],611339);let P=w.monthly,v=!1,C=null,E=null;var S=e.i(586682);async function x(t){if(!(0,r.isTauri)())return void window.open(t,"_blank","noopener,noreferrer");let a=null;try{let{openUrl:r}=await e.A(515511);await r(t);return}catch(e){a=e,console.error("[Tauri] opener.openUrl failed:",e)}let i=null;try{let{open:r}=await e.A(406213);await r(t);return}catch(e){i=e,console.error("[Tauri] shell.open failed:",e)}for(let e of[()=>(0,S.invoke)("plugin:opener|open_url",{url:t}),()=>(0,S.invoke)("plugin:opener|open_path",{path:t})])try{await e();return}catch{}throw Error("Falha ao abrir navegador externo. Verifique as permissoes do aplicativo.",{cause:a??i})}e.s(["openExternalLink",()=>x],508792);var _=e.i(29490);
1let k="stripe_checkout_pending_v1",I="stripe-checkout-pending-updated";function A(){return"undefined"!=typeof localStorage}function T(){if(!A())return null;let e=localStorage.getItem(k);if(!e)return null;try{let t=JSON.parse(e);if(!t||"object"!=typeof t||!t.url||"string"!=typeof t.url)return null;return{url:t.url,sessionId:"string"==typeof t.sessionId?t.sessionId:void 0,createdAt:"string"==typeof t.createdAt?t.createdAt:new Date().toISOString(),context:t.context||"unknown"}}catch{return null}}function N(e){A()&&(localStorage.setItem(k,JSON.stringify(e)),window.dispatchEvent(new CustomEvent(I,{detail:e})))}function L(){A()&&(localStorage.removeItem(k),window.dispatchEvent(new CustomEvent(I,{detail:null})))}function R(e){if(!A())return()=>{};let t=t=>{e(t.detail??null)};return window.addEventListener(I,t),()=>window.removeEventListener(I,t)}e.s(["clearPendingStripeCheckout",()=>L,"getPendingStripeCheckout",()=>T,"onPendingStripeCheckoutChange",()=>R,"setPendingStripeCheckout",()=>N],157338);var O=e.i(277638);e.i(247167);let j={aiChat:!0,aiInsights:!0,aiSuggest:!0,tasks:!0,shopping:!0,goals:!0,subscriptions:!0,installments:!0,scenarios:!0,zbb:!0,export:!0,customDashboards:!0,notifications:!0,mcp:!0};function U(){let n=function(){let e,r,n,o=(0,a.c)(4),[s,l]=(0,t.useState)(i);return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>(u.add(l),()=>{u.delete(l)}),r=[l],o[0]=e,o[1]=r):(e=o[0],r=o[1]),(0,t.useEffect)(e,r),o[2]!==s?(n={state:s,setState:l,broadcastSubscriptionState:d,getCacheState:p,getFetchState:g,setFetchState:f},o[2]=s,o[3]=n):n=o[3],n}(),[o,s]=(0,t.useState)(!1),{config:l}=(0,O.useAppRuntimeConfig)(),c=(0,r.isTauri)();(0,t.useEffect)(()=>{},[!1]);let w=function(a){let{data:i}=(0,h.useTauriSafeSession)(),n=(0,t.useRef)(!1),o=async e=>{try{let t=(0,r.getApiUrl)(),n=await (0,y.tauriFetch)(`${t}/api/iap/validate-google-play`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({productId:e.productId,purchaseToken:e.purchaseToken,purchaseTime:e.purchaseTime,purchaseState:e.purchaseState,userId:i?.user?.id})});if(n.ok){let e=await n.json();("active"===e.status||e.success)&&a.setState(e=>({...e,hasSubscription:!0,status:"active",platform:"google_play",isPremium:!0,planType:"premium"}))}}catch(e){console.error("Error validating Google Play purchase:",e)}};return{checkGooglePlayPurchases:(0,t.useCallback)(async(t=!1)=>{(0,r.isTauri)()&&(i?.user?.id&&E!==i.user.id&&(E=i.user.id,v=!1,C=null),!t&&v||(!t&&C?await C:(C=(async()=>{let t;try{let{restorePurchases:r}=await e.A(406213);m.logger.info("[IAP] Restoring purchases...");let a=await Promise.race([r("subs"),new Promise((e,r)=>{t=window.setTimeout(()=>{r(Error("Google Play restore timed out"))},4e3)})]);m.logger.info("[IAP] restorePurchases raw response:",JSON.stringify(a,null,2));let i=a?.purchases||[];if(m.logger.info("[IAP] Purchases array length:",i.length),!i||!Array.isArray(i)||0===i.length){v=!0;return}for(let e of i)b.has(e.productId)&&0===e.purchaseState&&await o(e);v=!0}catch(e){console.error("[IAP] Error checking Google Play purchases:",e)}finally{void 0!==t&&window.clearTimeout(t)}})(),await C,C=null)))},[i?.user?.id]),purchaseGooglePlay:async(t=P)=>{if(!(0,r.isTauri)())throw Error("Google Play disponível apenas no aplicativo Android");try{m.logger.info("[IAP] === PURCHASE FLOW START ==="),m.logger.info("[IAP] Product ID:",t);let{getProducts:r,purchase:a,acknowledgePurchase:n}=await e.A(406213);m.logger.info("[IAP] Getting products for:",[t]);let s=await r([t],"subs");m.logger.info("[IAP] getProducts raw response:",JSON.stringify(s,null,2));let l=s?.products||[];if(m.logger.info("[IAP] Products array length:",l.length),0===l.length)throw Error(`Produto "${t}" n\xe3o encontrado no Google Play. Verifique se o produto foi criado no Google Play Console.`);let c=l[0];m.logger.info("[IAP] Found product:",c.productId),m.logger.info("[IAP] Subscription offer details:",JSON.stringify(c.subscriptionOfferDetails,null,2));let u={},d=c.subscriptionOfferDetails||[];if(d.length>0){let e=d.find(e=>e.offerId?.includes("trial")||e.pricingPhases?.pricingPhaseList?.some(e=>0===Number(e.priceAmountMicros)));u.offerToken=(e||d[0]).offerToken,m.logger.info("[IAP] Using offer:",e?"trial":"base",u.offerToken)}i?.user?.id&&(u.obfuscatedAccountId=i.user.id),m.logger.info("[IAP] Starting purchase flow...");let p=await a(t,"subs",u);if(m.logger.info("[IAP] Purchase result:",JSON.stringify(p,null,2)),!p||!p.purchaseToken)throw Error("Compra cancelada ou nao concluida no Google Play.");if(0!==p.purchaseState)throw Error("Compra nao aprovada no Google Play.");return m.logger.info("[IAP] Purchase successful, acknowledging..."),await n(p.purchaseToken),m.logger.info("[IAP] Purchase acknowledged"),await o(p),m.logger.info("[IAP] === PURCHASE FLOW COMPLETE ==="),p}catch(e){throw console.error("[IAP] === PURCHASE ERROR ==="),console.error("[IAP] Error:",e instanceof Error?e.message:String(e)),e}},iapChecked:n}}(n),{checkSubscription:S,createCheckoutSession:k,openPortal:I,refreshSubscription:A,lastLifecycleRefreshAtRef:T}=function(e,a){let{data:n}=(0,h.useTauriSafeSession)(),o=(0,t.useRef)(0),s=(0,t.useCallback)(async(t=!1)=>{let o=n?.user?.id;if(!o)return void e.setState(e=>({...e,isLoading:!1}));let{subscriptionStateCache:s,subscriptionStateCacheUserId:l,subscriptionStateCacheUpdatedAt:c}=e.getCacheState(),u=Date.now()-c<15e3;if(!t&&u&&s&&l===o)return void e.setState(s);let{subscriptionFetchPromise:d,subscriptionFetchUserId:p}=e.getFetchState();if(!t&&d&&p===o){await d;let t=e.getCacheState();t.subscriptionStateCache&&t.subscriptionStateCacheUserId===o&&e.setState(t.subscriptionStateCache);return}let g=(async()=>{try{let i;e.setState(e=>({...e,isLoading:!0,error:null}));let n=(0,r.getApiUrl)(),s=t?`${n}
1/api/subscription/status?force=true`:`${n}/api/subscription/status`,l=new AbortController,c=window.setTimeout(()=>l.abort(),5e3);try{i=await (0,y.tauriFetch)(s,{signal:l.signal})}finally{window.clearTimeout(c)}if(!i.ok)throw Error("Failed to fetch subscription status");let u=await i.json(),d={hasSubscription:"active"===u.status||u.isPremium,status:u.status,platform:u.platform,currentPeriodEnd:u.currentPeriodEnd?new Date(u.currentPeriodEnd):null,cancelAtPeriodEnd:u.cancelAtPeriodEnd||!1,planType:u.planType||"free",isPremium:u.isPremium||!1,limits:u.limits||null,features:u.features||null,aiUsage:u.aiUsage||null,isLoading:!1,error:null};e.broadcastSubscriptionState(o,d),a&&await a(u.status)}catch(a){let t=e.getCacheState(),r={...t.subscriptionStateCacheUserId===o&&t.subscriptionStateCache?t.subscriptionStateCache:i,isLoading:!1,error:a instanceof Error?a.message:"Unknown error"};e.broadcastSubscriptionState(o,r)}finally{e.getFetchState().subscriptionFetchUserId===o&&e.setFetchState(null,null)}})();e.setFetchState(g,o),await g},[n?.user?.id]),l=async e=>{try{let t=e?.billingCycle??"monthly";(0,_.trackCheckoutStarted)(t,"stripe");let a=(0,r.getApiUrl)(),i=await (0,y.tauriFetch)(`${a}/api/stripe/create-checkout-session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({billingCycle:t})});if(!i.ok)throw Error("Failed to create checkout session");let{url:n,sessionId:o}=await i.json();(0,r.isTauri)()?("string"==typeof n&&n.length>0&&N({url:n,sessionId:"string"==typeof o?o:void 0,createdAt:new Date().toISOString(),context:"unknown"}),await x(n)):window.location.href=n}catch(e){throw console.error("Error creating checkout session:",e),e}},c=async()=>{try{let e=(0,r.getApiUrl)(),t=await (0,y.tauriFetch)(`${e}/api/stripe/portal`,{method:"POST"});if(!t.ok)throw Error("Failed to open portal");let{url:a}=await t.json();(0,r.isTauri)()?await x(a):window.location.href=a}catch(e){throw console.error("Error opening portal:",e),e}},u=(0,t.useCallback)(()=>s(!0),[s]);return{checkSubscription:s,createCheckoutSession:l,openPortal:c,refreshSubscription:u,lastLifecycleRefreshAtRef:o}}(n,(0,t.useCallback)(async e=>{if((0,r.isTauri)()&&"active"!==e&&!w.iapChecked.current){let e;w.iapChecked.current=!0;try{await Promise.race([w.checkGooglePlayPurchases(!1),new Promise(t=>{e=window.setTimeout(t,4500)})])}finally{void 0!==e&&window.clearTimeout(e)}}},[w.checkGooglePlayPurchases])),L={web:{stripeEnabled:l.billing.web.stripeEnabled},android:{googlePlayEnabled:l.billing.android.googlePlayEnabled,stripeEnabled:l.billing.android.stripeEnabled}},R=async e=>{if(c){if(L.android.googlePlayEnabled)return w.purchaseGooglePlay();throw Error("Nenhum metodo de assinatura esta habilitado no app Android.")}if(!L.web.stripeEnabled)throw Error("Assinatura via web esta temporariamente desabilitada.");return k(e)},U=c?{googlePlay:L.android.googlePlayEnabled,stripe:!1}:{googlePlay:!1,stripe:L.web.stripeEnabled},$=Number(U.googlePlay)+Number(U.stripe)>1;(0,t.useEffect)(()=>{S(!1)},[S]),(0,t.useEffect)(()=>{let t,r=()=>{let e=Date.now();e-T.current<2500||(T.current=e,S(!0))},a=()=>{"visible"===document.visibilityState&&r()};return window.addEventListener("focus",r),document.addEventListener("visibilitychange",a),(async()=>{try{let{getCurrentWindow:a}=await e.A(664835);t=await a().onFocusChanged(({payload:e})=>{e&&r()})}catch{}})(),()=>{window.removeEventListener("focus",r),document.removeEventListener("visibilitychange",a),t&&t()}},[S,T]);let G=n.state.isLoading,F=o||n.state.isPremium,D=o?"premium":n.state.planType;return{...n.state,hasSubscription:o||n.state.hasSubscription,planType:D,isPremium:F,features:o?j:n.state.features,localPremiumAvailable:!1,localPremiumMode:o,setLocalPremiumMode:e=>{s(e)},isLoading:G,subscribe:R,purchaseGooglePlay:w.purchaseGooglePlay,createCheckoutSession:k,openPortal:I,restoreGooglePlayPurchases:()=>w.checkGooglePlayPurchases(!0),refresh:A,isTauri:c,runtimeConfig:l,paymentAvailability:L,availablePaymentMethods:U,hasMultiplePaymentMethods:$,canUse:e=>!!o||(n.state.features?.[e]??!1),isWithinLimit:(e,t)=>{if(o||!n.state.limits)return!0;let r={people:n.state.limits.maxPeople,categories:n.state.limits.maxCategories,cards:n.state.limits.maxCards}[e];return -1===r||t<r},isOverLimit:(e,t)=>
1{if(o||!n.state.limits)return!1;let r={people:n.state.limits.maxPeople,categories:n.state.limits.maxCategories,cards:n.state.limits.maxCards}[e];return -1!==r&&t>r},getLimitInfo:(e,t)=>{if(o||!n.state.limits)return null;let r={people:n.state.limits.maxPeople,categories:n.state.limits.maxCategories,cards:n.state.limits.maxCards}[e];return -1===r?null:{current:t,limit:r,isOver:t>r,excess:Math.max(0,t-r)}}}}e.s(["useSubscription",()=>U],372428)},174886,e=>{"use strict";var t=e.i(991124);e.s(["Copy",()=>t.default])},247978,e=>{"use strict";let t=(0,e.i(475254).default)("credit-card",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);e.s(["default",()=>t])},561659,e=>{"use strict";var t=e.i(247978);e.s(["CreditCard",()=>t.default])},826707,e=>{"use strict";var t=e.i(365452);e.s(["Smartphone",()=>t.default])}]);

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.