@moneybar.online/moneybar 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -87
- package/dist/index.browser.js +50 -24
- package/dist/index.browser.js.map +1 -1
- package/dist/index.bundle.js +1 -1
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.cjs.js +50 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +50 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +50 -24
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types.d.ts +5 -4
- package/dist/types.d.ts.map +1 -1
- package/example-template.html +113 -57
- package/moneybar-config-template.js +221 -31
- package/package.json +1 -1
- package/src/index.ts +48 -24
- package/src/types.ts +5 -4
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@supabase/supabase-js")):"function"==typeof define&&define.amd?define(["exports","@supabase/supabase-js"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).MoneyBar={},n.Supabase)}(this,function(n,t){"use strict";n.MoneyBar=class{mergeConfigs(n){const t="undefined"!=typeof window?window.APP_CONFIG:null;if(!n&&!t)throw new Error("MoneyBar: No configuration provided. Either pass config to constructor or set window.APP_CONFIG");return n?t?{...t,...n}:n:t}constructor(n){this.currentUser=null,this.userFingerprint=null,this.eventListeners=new Map,this.supabaseConnectionFailed=!1,this.paymentConnectionFailed=!1,this.cachedStatus=null,this.statusCacheTime=0,this.STATUS_CACHE_DURATION=5e3,this.initializationPromise=null,this.cachedPremiumStatus=null,this.premiumStatusCacheTime=0,this.config=this.mergeConfigs(n),this.config.options,this.validateConfig(),this.initializeSupabase(),this.initializePayment(),this.initializeFingerprint(),this.setupAuthListener(),this.checkPaymentStatus()}async handleDownload(){try{if(this.supabaseConnectionFailed)return void this.config.callbacks?.onError?.(new Error("Server connection required for download verification. Please check your configuration."));if(this.config.payment&&this.paymentConnectionFailed)return void this.config.callbacks?.onError?.(new Error("Payment configuration error. Please contact support."));if(this.currentUser){if(await this.checkPremiumStatus(this.currentUser.email))return void this.config.callbacks?.onPremiumDownload()}const n=await this.getDownloadStatus();if(n.currentCount>=n.limit)return void this.config.callbacks?.onLimitReached(n.currentCount,n.limit);await this.incrementDownloadCount(),this.config.callbacks?.onDownloadAllowed(),this.cachedStatus=null;const t=await this.getDownloadStatus();this.emit("countChanged",{count:t.currentCount,limit:t.limit}),t.currentCount>=t.limit&&setTimeout(()=>{this.config.callbacks?.onLimitReached(t.currentCount,t.limit)},100)}catch(n){this.handleError(n)}}async getDownloadStatus(n=!1){console.log(`🔍 [INIT] getDownloadStatus called (forceRefresh: ${n}) at ${(new Date).toISOString()}`);const t=this.cachedStatus?Date.now()-this.statusCacheTime:-1;if(!n&&this.cachedStatus&&t<this.STATUS_CACHE_DURATION)return console.log(`🔍 [INIT] Using cached status (age: ${t}ms)`),this.cachedStatus;if(!n&&this.initializationPromise)return console.log("🔍 [INIT] Waiting for existing initialization promise"),await this.initializationPromise;console.log(`🔍 [INIT] Starting new status fetch (cache age: ${t}ms)`),this.initializationPromise=this.fetchFreshStatus(n);try{const n=await this.initializationPromise;return console.log("🔍 [INIT] Status fetch completed successfully"),n}finally{this.initializationPromise=null}}async fetchFreshStatus(n){try{let t=0,e=!1;if(t=n||!this.cachedStatus?await this.getDownloadCount():this.cachedStatus.currentCount,this.currentUser){const t=null!==this.cachedPremiumStatus&&Date.now()-this.premiumStatusCacheTime<this.STATUS_CACHE_DURATION;n||!t?(console.log(`🔥 [SUPABASE API] About to call checkPremiumStatus from getDownloadStatus (forceRefresh: ${n}, cacheValid: ${t})`),e=await this.checkPremiumStatus(this.currentUser.email),this.cachedPremiumStatus=e,this.premiumStatusCacheTime=Date.now()):(e=this.cachedPremiumStatus,console.log(`🔍 [CACHE] Using cached premium status from getDownloadStatus: ${e}`))}else e=!1;const a={currentCount:t,limit:this.config.freeDownloadLimit,isPremium:e,isAuthenticated:!!this.currentUser,remaining:Math.max(0,this.config.freeDownloadLimit-t)};return this.cachedStatus=a,this.statusCacheTime=Date.now(),a}catch(n){this.handleError(n);const t={currentCount:0,limit:this.config.freeDownloadLimit,isPremium:!1,isAuthenticated:!1,remaining:this.config.freeDownloadLimit};return this.cachedStatus=t,this.statusCacheTime=Date.now(),t}}async getUserContext(){const n=await this.getDownloadStatus();return{isPremium:n.isPremium,isAuthenticated:n.isAuthenticated,email:this.currentUser?.email,name:this.currentUser?.user_metadata?.full_name||this.currentUser?.user_metadata?.name,currentCount:n.currentCount,remaining:n.remaining,limit:n.limit,user:this.currentUser}}async signIn(){try{const{error:n}=await this.supabase.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${window.location.origin}${window.location.pathname}`}});if(n)throw n}catch(n){this.handleError(n)}}async signOut(){try{await this.supabase.auth.signOut(),this.currentUser=null,this.emit("authChanged",{user:null,isPremium:!1})}catch(n){this.handleError(n)}}async createPayment(){if(!this.currentUser)throw new Error("User must be signed in to create payment");if(!this.config.payment)throw new Error("Payment configuration not provided");const n={email:this.currentUser.email,product_id:this.config.payment.productId,mode:this.config.payment.mode||"test",app_id:this.config.appId,return_url:`${window.location.origin}${window.location.pathname}?payment=success`};console.log(`🔥 [SUPABASE API] createPayment called for email: ${this.currentUser.email} | Time: ${(new Date).toISOString()}`);try{const t=await fetch(`${this.config.supabase.url}/functions/v1/create-payment`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.config.supabase.anonKey}`},body:JSON.stringify(n)});if(console.log(`🔥 [SUPABASE API] createPayment response: ${t.status}`),this.config.options,!t.ok){const n=await t.text();let e;this.config.options?.debug&&console.error("🔍 DEBUG: createPayment error response:",n);try{e=JSON.parse(n)}catch{e={error:n}}throw(n.includes("404")||n.includes("could not be found"))&&(this.paymentConnectionFailed=!0,this.config.options?.debug&&console.warn("Invalid payment product ID detected, disabling downloads"),this.updateStatusDisplays()),new Error(e.error||"Payment creation failed")}const e=await t.json();return this.config.options,e}catch(n){return this.handleError(n),null}}attachToButton(n,t){const e=document.querySelector(n);if(!e)throw new Error(`Button not found: ${n}`);this.injectBaseStyles(),this.createTitleBar(),this.createPaywallModal(),this.createSuccessModal(),this.createAuthUI(),this.createStatusDisplay(),e.setAttribute("data-leadfast-attached","true"),e.onclick=async n=>{n.preventDefault(),await this.handleButtonClick(t)},this.setupUIUpdates()}attachToButtons(n){this.injectBaseStyles(),this.createTitleBar(),this.createPaywallModal(),this.createSuccessModal(),this.createAuthUI(),n.buttons.forEach(n=>{const t=document.querySelector(n.selector);t?(t.setAttribute("data-leadfast-attached","true"),t.onclick=async t=>{t.preventDefault(),await this.handleButtonClick(n.downloadCallback)},this.setupUIUpdates()):console.warn(`Button not found: ${n.selector}`)}),this.createGlobalStatusDisplay()}async handleButtonClick(n){const t=document.querySelector('[data-leadfast-attached="true"]');if(t&&t.disabled)console.log("⚠️ Button click ignored - operation already in progress");else{t&&(t.disabled=!0,t.style.opacity="0.6");try{await this.handleButtonClickInternal(n)}finally{t&&(t.disabled=!1,t.style.opacity="1")}}}async handleButtonClickInternal(n){if(this.supabaseConnectionFailed)return void this.showConnectionError();if(this.config.payment&&this.paymentConnectionFailed)return void this.showPaymentConfigError();const t=this.cachedStatus&&Date.now()-this.statusCacheTime<this.STATUS_CACHE_DURATION?this.cachedStatus:await this.getDownloadStatus();if(t.isPremium){const t=await this.getUserContext();return void(n.length>0?n(t):n())}if(t.currentCount>=t.limit)this.showPaywallInstant(t);else{try{if(n.length>0){const t=await this.getUserContext();t.isPremium||(t.currentCount+=1,t.remaining=Math.max(0,t.limit-t.currentCount)),n(t)}else n();const t=await this.getDownloadStatus(!0);if(t.currentCount>=t.limit)return console.warn(`⚠️ Limit reached during execution (${t.currentCount}/${t.limit}) - canceling increment`),void alert("⚠️ You reached the limit while this action was processing. No attempt was counted.");const e=await this.incrementDownloadCount();if(e>this.config.freeDownloadLimit)return void console.error(`⚠️ Server returned count (${e}) exceeding limit (${this.config.freeDownloadLimit})`);if(!0===this.config.successMessage?.enabled){const n=this.config.successMessage?.title||"Action Completed!",t=this.config.successMessage?.message||"Your action completed successfully!";this.showSuccess(n,t)}}catch(n){return console.error("User function failed:",n),void alert("Action failed. Please check the console for details. No attempt was counted.")}this.cachedStatus=null,this.updateStatusDisplays()}}injectBaseStyles(){if(document.getElementById("lead-fast-styles"))return;this.config.theme?.name&&this.injectDaisyUI();const n=document.createElement("style");n.id="lead-fast-styles";const t=this.config.theme?.primaryColor||"#3182ce";n.textContent=`\n /* User Profile Card - Top Right */\n .lead-fast-profile {\n position: fixed;\n top: 20px;\n left: 50%;\n transform: translateX(-50%);\n z-index: 1000;\n font-family: system-ui, -apple-system, sans-serif;\n width: 90%;\n max-width: 1200px;\n }\n\n .lead-fast-title-bar {\n background: rgba(250, 247, 245, 0.9) !important;\n border: 1px solid rgba(231, 226, 223, 0.6) !important;\n color: #291334 !important;\n border-radius: 16px;\n padding: 12px 24px;\n box-shadow: 0 8px 32px rgb(0 0 0 / 0.1), 0 2px 8px rgb(0 0 0 / 0.05);\n backdrop-filter: blur(20px);\n display: flex;\n align-items: center;\n justify-content: space-between;\n min-height: 60px;\n font-family: system-ui, -apple-system, sans-serif;\n }\n\n /* Theme variations for floating title bar */\n [data-theme="bumblebee"] .lead-fast-title-bar {\n background: rgba(255, 248, 220, 0.9) !important;\n border-color: rgba(254, 215, 170, 0.6) !important;\n color: #1c1917 !important;\n }\n\n [data-theme="garden"] .lead-fast-title-bar {\n background: rgba(240, 253, 244, 0.9) !important;\n border-color: rgba(134, 239, 172, 0.6) !important;\n color: #14532d !important;\n }\n\n [data-theme="emerald"] .lead-fast-title-bar {\n background: rgba(236, 253, 245, 0.9) !important;\n border-color: rgba(167, 243, 208, 0.6) !important;\n color: #065f46 !important;\n }\n\n [data-theme="corporate"] .lead-fast-title-bar {\n background: rgba(248, 250, 252, 0.9) !important;\n border-color: rgba(226, 232, 240, 0.6) !important;\n color: #1e293b !important;\n }\n\n [data-theme="dark"] .lead-fast-title-bar {\n background: rgba(31, 41, 55, 0.9) !important;\n border-color: rgba(55, 65, 81, 0.6) !important;\n color: #f9fafb !important;\n }\n\n [data-theme="cyberpunk"] .lead-fast-title-bar {\n background: rgba(0, 20, 36, 0.9) !important;\n border-color: rgba(7, 89, 133, 0.6) !important;\n color: #0ea5e9 !important;\n box-shadow: 0 8px 32px rgba(14, 165, 233, 0.2), 0 2px 8px rgba(14, 165, 233, 0.1);\n }\n\n [data-theme="valentine"] .lead-fast-title-bar {\n background: rgba(233, 30, 122, 0.15) !important;\n border-color: rgba(233, 30, 122, 0.6) !important;\n color: #831843 !important;\n }\n\n [data-theme="synthwave"] .lead-fast-title-bar {\n background: rgba(32, 20, 64, 0.9) !important;\n border-color: rgba(186, 85, 211, 0.6) !important;\n color: #ff00ff !important;\n box-shadow: 0 8px 32px rgba(255, 0, 255, 0.2), 0 2px 8px rgba(255, 0, 255, 0.1);\n }\n\n [data-theme="dracula"] .lead-fast-title-bar {\n background: rgba(40, 42, 54, 0.9) !important;\n border-color: rgba(98, 114, 164, 0.6) !important;\n color: #f8f8f2 !important;\n }\n\n [data-theme="halloween"] .lead-fast-title-bar {\n background: rgba(26, 26, 26, 0.9) !important;\n border-color: rgba(255, 165, 0, 0.6) !important;\n color: #ff6600 !important;\n }\n\n [data-theme="forest"] .lead-fast-title-bar {\n background: rgba(23, 46, 23, 0.9) !important;\n border-color: rgba(34, 197, 94, 0.6) !important;\n color: #22c55e !important;\n }\n\n [data-theme="luxury"] .lead-fast-title-bar {\n background: rgba(9, 9, 11, 0.9) !important;\n border-color: rgba(212, 175, 55, 0.6) !important;\n color: #d4af37 !important;\n }\n\n [data-theme="night"] .lead-fast-title-bar {\n background: rgba(15, 23, 42, 0.9) !important;\n border-color: rgba(30, 58, 138, 0.6) !important;\n color: #60a5fa !important;\n }\n\n [data-theme="light"] .lead-fast-title-bar {\n background: rgba(255, 255, 255, 0.9) !important;\n border-color: rgba(229, 231, 235, 0.6) !important;\n color: #1f2937 !important;\n }\n\n [data-theme="cupcake"] .lead-fast-title-bar {\n background: rgba(250, 235, 215, 0.9) !important;\n border-color: rgba(219, 185, 156, 0.6) !important;\n color: #8b4513 !important;\n }\n\n [data-theme="retro"] .lead-fast-title-bar {\n background: rgba(212, 165, 116, 0.9) !important;\n border-color: rgba(185, 144, 102, 0.6) !important;\n color: #5d4037 !important;\n }\n\n [data-theme="aqua"] .lead-fast-title-bar {\n background: rgba(240, 253, 250, 0.9) !important;\n border-color: rgba(125, 211, 252, 0.6) !important;\n color: #155e75 !important;\n }\n\n [data-theme="lofi"] .lead-fast-title-bar {\n background: rgba(248, 248, 248, 0.9) !important;\n border-color: rgba(68, 68, 68, 0.6) !important;\n color: #1a1a1a !important;\n }\n\n [data-theme="pastel"] .lead-fast-title-bar {\n background: rgba(254, 251, 255, 0.9) !important;\n border-color: rgba(209, 196, 233, 0.6) !important;\n color: #7c3aed !important;\n }\n\n [data-theme="fantasy"] .lead-fast-title-bar {\n background: rgba(255, 247, 237, 0.9) !important;\n border-color: rgba(249, 168, 212, 0.6) !important;\n color: #be185d !important;\n }\n\n [data-theme="wireframe"] .lead-fast-title-bar {\n background: rgba(223, 223, 223, 0.9) !important;\n border-color: rgba(0, 0, 0, 0.3) !important;\n color: #000000 !important;\n }\n\n [data-theme="black"] .lead-fast-title-bar {\n background: rgba(0, 0, 0, 0.9) !important;\n border-color: rgba(55, 55, 55, 0.6) !important;\n color: #ffffff !important;\n }\n\n [data-theme="cmyk"] .lead-fast-title-bar {\n background: rgba(0, 255, 255, 0.9) !important;\n border-color: rgba(255, 0, 255, 0.6) !important;\n color: #000000 !important;\n }\n\n [data-theme="autumn"] .lead-fast-title-bar {\n background: rgba(139, 69, 19, 0.9) !important;\n border-color: rgba(255, 140, 0, 0.6) !important;\n color: #ff8c00 !important;\n }\n\n [data-theme="business"] .lead-fast-title-bar {\n background: rgba(29, 78, 216, 0.9) !important;\n border-color: rgba(59, 130, 246, 0.6) !important;\n color: #3b82f6 !important;\n }\n\n [data-theme="acid"] .lead-fast-title-bar {\n background: rgba(255, 255, 0, 0.9) !important;\n border-color: rgba(255, 0, 255, 0.6) !important;\n color: #000000 !important;\n }\n\n [data-theme="lemonade"] .lead-fast-title-bar {\n background: rgba(255, 255, 224, 0.9) !important;\n border-color: rgba(34, 197, 94, 0.6) !important;\n color: #15803d !important;\n }\n\n [data-theme="coffee"] .lead-fast-title-bar {\n background: rgba(101, 67, 33, 0.9) !important;\n border-color: rgba(160, 82, 45, 0.6) !important;\n color: #d2b48c !important;\n }\n\n [data-theme="winter"] .lead-fast-title-bar {\n background: rgba(248, 250, 252, 0.9) !important;\n border-color: rgba(59, 130, 246, 0.6) !important;\n color: #1e40af !important;\n }\n\n .lead-fast-title-section {\n display: flex;\n align-items: center;\n gap: 16px;\n }\n\n .lead-fast-logo {\n font-size: 20px;\n font-weight: 700;\n display: flex;\n align-items: center;\n gap: 8px;\n color: inherit;\n text-decoration: none;\n }\n\n .lead-fast-logo img {\n width: 32px;\n height: 32px;\n border-radius: 6px;\n }\n\n .lead-fast-nav {\n display: flex;\n align-items: center;\n gap: 32px;\n margin-left: 24px;\n }\n\n .lead-fast-nav-link {\n color: inherit;\n text-decoration: none;\n font-weight: 500;\n font-size: 14px;\n opacity: 0.8;\n transition: all 0.2s;\n }\n\n .lead-fast-nav-link:hover {\n opacity: 1;\n text-decoration: none;\n }\n\n .lead-fast-user-section {\n display: flex;\n align-items: center;\n gap: 12px;\n }\n\n .lead-fast-avatar {\n width: 36px;\n height: 36px;\n border-radius: 50%;\n background: linear-gradient(135deg, ${t}, #4f46e5);\n display: flex;\n align-items: center;\n justify-content: center;\n color: white;\n font-weight: 600;\n font-size: 14px;\n }\n\n .lead-fast-user-info {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 2px;\n }\n\n .lead-fast-user-email {\n color: inherit !important;\n font-size: 13px;\n font-weight: 500;\n line-height: 1;\n }\n\n .lead-fast-user-status {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n\n .lead-fast-badge {\n padding: 2px 6px;\n border-radius: 12px;\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.025em;\n line-height: 1;\n }\n\n .lead-fast-badge.premium {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n .lead-fast-badge.free {\n background: #65c3c8 !important;\n color: #291334 !important;\n }\n\n [data-theme="dark"] .lead-fast-badge.premium {\n background: #059669 !important;\n color: #ffffff !important;\n }\n\n [data-theme="dark"] .lead-fast-badge.free {\n background: #374151 !important;\n color: #f9fafb !important;\n }\n\n .lead-fast-count {\n font-size: 10px;\n color: inherit !important;\n opacity: 0.7;\n line-height: 1;\n }\n\n .lead-fast-signout {\n background: rgba(0, 0, 0, 0.1) !important;\n border: none;\n color: inherit !important;\n cursor: pointer;\n padding: 6px 12px;\n border-radius: 8px;\n transition: all 0.2s;\n font-size: 11px;\n font-weight: 500;\n margin-left: 8px;\n }\n\n [data-theme="dark"] .lead-fast-signout {\n background: rgba(255, 255, 255, 0.1) !important;\n }\n\n [data-theme="cyberpunk"] .lead-fast-signout {\n background: rgba(14, 165, 233, 0.2) !important;\n }\n\n .lead-fast-signout:hover {\n background: rgba(0, 0, 0, 0.2) !important;\n transform: translateY(-1px);\n }\n\n [data-theme="dark"] .lead-fast-signout:hover {\n background: rgba(255, 255, 255, 0.2) !important;\n }\n\n [data-theme="cyberpunk"] .lead-fast-signout:hover {\n background: rgba(14, 165, 233, 0.3) !important;\n }\n\n .lead-fast-branding {\n position: absolute;\n bottom: -20px;\n left: 24px;\n font-size: 9px;\n color: inherit !important;\n opacity: 0.4;\n font-weight: 500;\n letter-spacing: 0.05em;\n text-transform: lowercase;\n background: rgba(255, 255, 255, 0.8);\n padding: 2px 6px;\n border-radius: 4px;\n backdrop-filter: blur(8px);\n }\n\n [data-theme="dark"] .lead-fast-branding {\n background: rgba(0, 0, 0, 0.6);\n }\n\n [data-theme="cyberpunk"] .lead-fast-branding {\n background: rgba(0, 20, 36, 0.8);\n }\n\n /* Modal Theming */\n .download-limiter-modal {\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0,0,0,0.5);\n z-index: 9999;\n align-items: center;\n justify-content: center;\n }\n .download-limiter-modal.show { display: flex; }\n\n .download-limiter-content {\n background: #faf7f5 !important;\n color: #291334 !important;\n padding: 2rem;\n border-radius: 12px;\n max-width: 400px;\n text-align: center;\n box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);\n border: 1px solid #e7e2df !important;\n font-family: system-ui, -apple-system, sans-serif;\n }\n\n [data-theme="dark"] .download-limiter-content {\n background: #1f2937 !important;\n color: #f9fafb !important;\n border-color: #374151 !important;\n }\n\n [data-theme="cyberpunk"] .download-limiter-content {\n background: #001424 !important;\n color: #0ea5e9 !important;\n border-color: #075985 !important;\n }\n\n [data-theme="valentine"] .download-limiter-content {\n background: rgba(233, 30, 122, 0.05) !important;\n color: #831843 !important;\n border-color: #e91e7a !important;\n }\n\n [data-theme="bumblebee"] .download-limiter-content {\n background: rgba(255, 248, 220, 0.95) !important;\n color: #1c1917 !important;\n border-color: rgba(254, 215, 170, 0.8) !important;\n }\n\n [data-theme="garden"] .download-limiter-content {\n background: rgba(240, 253, 244, 0.95) !important;\n color: #14532d !important;\n border-color: rgba(134, 239, 172, 0.8) !important;\n }\n\n [data-theme="emerald"] .download-limiter-content {\n background: rgba(236, 253, 245, 0.95) !important;\n color: #065f46 !important;\n border-color: rgba(167, 243, 208, 0.8) !important;\n }\n\n [data-theme="corporate"] .download-limiter-content {\n background: rgba(248, 250, 252, 0.95) !important;\n color: #1e293b !important;\n border-color: rgba(226, 232, 240, 0.8) !important;\n }\n\n [data-theme="forest"] .download-limiter-content {\n background: rgba(23, 46, 23, 0.95) !important;\n color: #22c55e !important;\n border-color: rgba(34, 197, 94, 0.8) !important;\n }\n\n [data-theme="halloween"] .download-limiter-content {\n background: rgba(26, 26, 26, 0.95) !important;\n color: #ff6500 !important;\n border-color: rgba(255, 165, 0, 0.3) !important;\n }\n\n [data-theme="synthwave"] .download-limiter-content {\n background: rgba(32, 20, 64, 0.95) !important;\n color: #ba55d3 !important;\n border-color: rgba(186, 85, 211, 0.3) !important;\n }\n\n [data-theme="dracula"] .download-limiter-content {\n background: rgba(40, 42, 54, 0.95) !important;\n color: #f8f8f2 !important;\n border-color: rgba(98, 114, 164, 0.3) !important;\n }\n\n [data-theme="luxury"] .download-limiter-content {\n background: rgba(9, 9, 11, 0.95) !important;\n color: #d4af37 !important;\n border-color: rgba(212, 175, 55, 0.3) !important;\n }\n\n [data-theme="night"] .download-limiter-content {\n background: rgba(15, 23, 42, 0.95) !important;\n color: #1e40af !important;\n border-color: rgba(30, 58, 138, 0.3) !important;\n }\n\n [data-theme="light"] .download-limiter-content {\n background: rgba(255, 255, 255, 0.95) !important;\n color: #1f2937 !important;\n border-color: rgba(229, 231, 235, 0.8) !important;\n }\n\n [data-theme="cupcake"] .download-limiter-content {\n background: rgba(250, 235, 215, 0.95) !important;\n color: #8b4513 !important;\n border-color: rgba(219, 185, 156, 0.8) !important;\n }\n\n [data-theme="retro"] .download-limiter-content {\n background: rgba(212, 165, 116, 0.95) !important;\n color: #5d4037 !important;\n border-color: rgba(185, 144, 102, 0.8) !important;\n }\n\n [data-theme="aqua"] .download-limiter-content {\n background: rgba(240, 253, 250, 0.95) !important;\n color: #155e75 !important;\n border-color: rgba(125, 211, 252, 0.8) !important;\n }\n\n [data-theme="lofi"] .download-limiter-content {\n background: rgba(248, 248, 248, 0.95) !important;\n color: #1a1a1a !important;\n border-color: rgba(68, 68, 68, 0.8) !important;\n }\n\n [data-theme="pastel"] .download-limiter-content {\n background: rgba(254, 251, 255, 0.95) !important;\n color: #7c3aed !important;\n border-color: rgba(209, 196, 233, 0.8) !important;\n }\n\n [data-theme="fantasy"] .download-limiter-content {\n background: rgba(255, 247, 237, 0.95) !important;\n color: #be185d !important;\n border-color: rgba(249, 168, 212, 0.8) !important;\n }\n\n [data-theme="wireframe"] .download-limiter-content {\n background: rgba(255, 255, 255, 0.95) !important;\n color: #000000 !important;\n border-color: rgba(0, 0, 0, 0.3) !important;\n }\n\n [data-theme="black"] .download-limiter-content {\n background: rgba(0, 0, 0, 0.95) !important;\n color: #ffffff !important;\n border-color: rgba(55, 55, 55, 0.8) !important;\n }\n\n [data-theme="cmyk"] .download-limiter-content {\n background: rgba(0, 255, 255, 0.95) !important;\n color: #000000 !important;\n border-color: rgba(255, 0, 255, 0.8) !important;\n }\n\n [data-theme="autumn"] .download-limiter-content {\n background: rgba(139, 69, 19, 0.95) !important;\n color: #ff8c00 !important;\n border-color: rgba(255, 140, 0, 0.8) !important;\n }\n\n [data-theme="business"] .download-limiter-content {\n background: rgba(29, 78, 216, 0.95) !important;\n color: #3b82f6 !important;\n border-color: rgba(59, 130, 246, 0.8) !important;\n }\n\n [data-theme="acid"] .download-limiter-content {\n background: rgba(255, 255, 0, 0.95) !important;\n color: #000000 !important;\n border-color: rgba(255, 0, 255, 0.8) !important;\n }\n\n [data-theme="lemonade"] .download-limiter-content {\n background: rgba(255, 255, 224, 0.95) !important;\n color: #15803d !important;\n border-color: rgba(34, 197, 94, 0.8) !important;\n }\n\n [data-theme="coffee"] .download-limiter-content {\n background: rgba(101, 67, 33, 0.95) !important;\n color: #d2b48c !important;\n border-color: rgba(160, 82, 45, 0.8) !important;\n }\n\n [data-theme="winter"] .download-limiter-content {\n background: rgba(248, 250, 252, 0.95) !important;\n color: #1e40af !important;\n border-color: rgba(59, 130, 246, 0.8) !important;\n }\n\n .download-limiter-content h2 {\n color: inherit !important;\n margin: 0 0 1rem 0;\n font-size: 1.5rem;\n font-weight: 600;\n }\n .download-limiter-content p {\n color: inherit !important;\n margin: 0 0 1.5rem 0;\n line-height: 1.6;\n }\n .download-limiter-signin-btn {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n background: #65c3c8 !important;\n color: #291334 !important;\n border: none;\n padding: 12px 20px;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n text-decoration: none;\n transition: all 0.2s;\n box-shadow: 0 2px 4px rgba(0,0,0,0.1);\n }\n\n [data-theme="dark"] .download-limiter-signin-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cyberpunk"] .download-limiter-signin-btn {\n background: #f59e0b !important;\n color: #000000 !important;\n }\n\n [data-theme="valentine"] .download-limiter-signin-btn {\n background: #e91e7a !important;\n color: #ffffff !important;\n }\n\n [data-theme="bumblebee"] .download-limiter-signin-btn {\n background: #fbbf24 !important;\n color: #1c1917 !important;\n }\n\n [data-theme="garden"] .download-limiter-signin-btn {\n background: #22c55e !important;\n color: #ffffff !important;\n }\n\n [data-theme="emerald"] .download-limiter-signin-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="corporate"] .download-limiter-signin-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="forest"] .download-limiter-signin-btn {\n background: #22c55e !important;\n color: #1a1a1a !important;\n }\n\n [data-theme="halloween"] .download-limiter-signin-btn {\n background: #ff6500 !important;\n color: #1a1a1a !important;\n }\n\n [data-theme="synthwave"] .download-limiter-signin-btn {\n background: #ba55d3 !important;\n color: #201040 !important;\n }\n\n [data-theme="dracula"] .download-limiter-signin-btn {\n background: #8be9fd !important;\n color: #282a36 !important;\n }\n\n [data-theme="luxury"] .download-limiter-signin-btn {\n background: #d4af37 !important;\n color: #09090b !important;\n }\n\n [data-theme="night"] .download-limiter-signin-btn {\n background: #1e40af !important;\n color: #ffffff !important;\n }\n\n [data-theme="light"] .download-limiter-signin-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cupcake"] .download-limiter-signin-btn {\n background: #8b4513 !important;\n color: #ffffff !important;\n }\n\n [data-theme="retro"] .download-limiter-signin-btn {\n background: #d4a574 !important;\n color: #ffffff !important;\n }\n\n [data-theme="aqua"] .download-limiter-signin-btn {\n background: #0891b2 !important;\n color: #ffffff !important;\n }\n\n [data-theme="lofi"] .download-limiter-signin-btn {\n background: #1a1a1a !important;\n color: #ffffff !important;\n }\n\n [data-theme="pastel"] .download-limiter-signin-btn {\n background: #7c3aed !important;\n color: #ffffff !important;\n }\n\n [data-theme="fantasy"] .download-limiter-signin-btn {\n background: #be185d !important;\n color: #ffffff !important;\n }\n\n [data-theme="wireframe"] .download-limiter-signin-btn {\n background: #dfdfdf !important;\n color: #000000 !important;\n border: 1px solid #000000 !important;\n }\n\n [data-theme="black"] .download-limiter-signin-btn {\n background: #ffffff !important;\n color: #000000 !important;\n }\n\n [data-theme="cmyk"] .download-limiter-signin-btn {\n background: #ff00ff !important;\n color: #000000 !important;\n }\n\n [data-theme="autumn"] .download-limiter-signin-btn {\n background: #ff8c00 !important;\n color: #ffffff !important;\n }\n\n [data-theme="business"] .download-limiter-signin-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="acid"] .download-limiter-signin-btn {\n background: #ff00ff !important;\n color: #000000 !important;\n }\n\n [data-theme="lemonade"] .download-limiter-signin-btn {\n background: #22c55e !important;\n color: #ffffff !important;\n }\n\n [data-theme="coffee"] .download-limiter-signin-btn {\n background: #a0522d !important;\n color: #ffffff !important;\n }\n\n [data-theme="winter"] .download-limiter-signin-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n .download-limiter-signin-btn:hover {\n opacity: 0.9;\n transform: translateY(-1px);\n box-shadow: 0 4px 8px rgba(0,0,0,0.15);\n }\n\n /* Upgrade Button Styles for All Themes */\n [data-theme="dark"] .upgrade-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cyberpunk"] .upgrade-btn {\n background: #ff073a !important;\n color: #ffffff !important;\n }\n\n [data-theme="valentine"] .upgrade-btn {\n background: #e91e7a !important;\n color: #ffffff !important;\n }\n\n [data-theme="bumblebee"] .upgrade-btn {\n background: #f59e0b !important;\n color: #ffffff !important;\n }\n\n [data-theme="garden"] .upgrade-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="emerald"] .upgrade-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="corporate"] .upgrade-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="forest"] .upgrade-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="halloween"] .upgrade-btn {\n background: #ff7b00 !important;\n color: #000000 !important;\n }\n\n [data-theme="synthwave"] .upgrade-btn {\n background: #e879f9 !important;\n color: #ffffff !important;\n }\n\n [data-theme="dracula"] .upgrade-btn {\n background: #bd93f9 !important;\n color: #ffffff !important;\n }\n\n [data-theme="luxury"] .upgrade-btn {\n background: #d4af37 !important;\n color: #000000 !important;\n }\n\n [data-theme="night"] .upgrade-btn {\n background: #38bdf8 !important;\n color: #ffffff !important;\n }\n\n [data-theme="light"] .upgrade-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cupcake"] .upgrade-btn {\n background: #f472b6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="retro"] .upgrade-btn {\n background: #d4a574 !important;\n color: #ffffff !important;\n }\n\n [data-theme="aqua"] .upgrade-btn {\n background: #06b6d4 !important;\n color: #ffffff !important;\n }\n\n [data-theme="lofi"] .upgrade-btn {\n background: #a3a3a3 !important;\n color: #000000 !important;\n }\n\n [data-theme="pastel"] .upgrade-btn {\n background: #a78bfa !important;\n color: #ffffff !important;\n }\n\n [data-theme="fantasy"] .upgrade-btn {\n background: #f472b6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="wireframe"] .upgrade-btn {\n background: #dfdfdf !important;\n color: #000000 !important;\n border: 1px solid #000000 !important;\n }\n\n [data-theme="black"] .upgrade-btn {\n background: #ffffff !important;\n color: #000000 !important;\n }\n\n [data-theme="cmyk"] .upgrade-btn {\n background: #0891b2 !important;\n color: #ffffff !important;\n }\n\n [data-theme="autumn"] .upgrade-btn {\n background: #d97706 !important;\n color: #ffffff !important;\n }\n\n [data-theme="business"] .upgrade-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="acid"] .upgrade-btn {\n background: #84cc16 !important;\n color: #000000 !important;\n }\n\n [data-theme="lemonade"] .upgrade-btn {\n background: #22c55e !important;\n color: #ffffff !important;\n }\n\n [data-theme="coffee"] .upgrade-btn {\n background: #a0522d !important;\n color: #ffffff !important;\n }\n\n [data-theme="winter"] .upgrade-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n /* Cancel Button Styles for All Themes */\n [data-theme="dark"] .cancel-btn {\n background: #4b5563 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cyberpunk"] .cancel-btn {\n background: #7e22ce !important;\n color: #ffffff !important;\n }\n\n [data-theme="valentine"] .cancel-btn {\n background: #c11560 !important;\n color: #ffffff !important;\n }\n\n [data-theme="bumblebee"] .cancel-btn {\n background: #d97706 !important;\n color: #ffffff !important;\n }\n\n [data-theme="garden"] .cancel-btn {\n background: #059669 !important;\n color: #ffffff !important;\n }\n\n [data-theme="emerald"] .cancel-btn {\n background: #059669 !important;\n color: #ffffff !important;\n }\n\n [data-theme="corporate"] .cancel-btn {\n background: #6b7280 !important;\n color: #ffffff !important;\n }\n\n [data-theme="forest"] .cancel-btn {\n background: #059669 !important;\n color: #ffffff !important;\n }\n\n [data-theme="halloween"] .cancel-btn {\n background: #7c3aed !important;\n color: #ffffff !important;\n }\n\n [data-theme="synthwave"] .cancel-btn {\n background: #7e22ce !important;\n color: #ffffff !important;\n }\n\n [data-theme="dracula"] .cancel-btn {\n background: #6272a4 !important;\n color: #ffffff !important;\n }\n\n [data-theme="luxury"] .cancel-btn {\n background: #8b5cf6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="night"] .cancel-btn {\n background: #0284c7 !important;\n color: #ffffff !important;\n }\n\n [data-theme="light"] .cancel-btn {\n background: #6b7280 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cupcake"] .cancel-btn {\n background: #ec4899 !important;\n color: #ffffff !important;\n }\n\n [data-theme="retro"] .cancel-btn {\n background: #b8925c !important;\n color: #ffffff !important;\n }\n\n [data-theme="aqua"] .cancel-btn {\n background: #0891b2 !important;\n color: #ffffff !important;\n }\n\n [data-theme="lofi"] .cancel-btn {\n background: #6b7280 !important;\n color: #ffffff !important;\n }\n\n [data-theme="pastel"] .cancel-btn {\n background: #8b5cf6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="fantasy"] .cancel-btn {\n background: #ec4899 !important;\n color: #ffffff !important;\n }\n\n [data-theme="wireframe"] .cancel-btn {\n background: #f5f5f5 !important;\n color: #000000 !important;\n border: 1px solid #000000 !important;\n }\n\n [data-theme="black"] .cancel-btn {\n background: #6b7280 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cmyk"] .cancel-btn {\n background: #0369a1 !important;\n color: #ffffff !important;\n }\n\n [data-theme="autumn"] .cancel-btn {\n background: #c2410c !important;\n color: #ffffff !important;\n }\n\n [data-theme="business"] .cancel-btn {\n background: #6b7280 !important;\n color: #ffffff !important;\n }\n\n [data-theme="acid"] .cancel-btn {\n background: #65a30d !important;\n color: #ffffff !important;\n }\n\n [data-theme="lemonade"] .cancel-btn {\n background: #16a34a !important;\n color: #ffffff !important;\n }\n\n [data-theme="coffee"] .cancel-btn {\n background: #8b4513 !important;\n color: #ffffff !important;\n }\n\n [data-theme="winter"] .cancel-btn {\n background: #1e40af !important;\n color: #ffffff !important;\n }\n\n /* Success Button Styles for All Themes */\n [data-theme="dark"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cyberpunk"] .success-btn {\n background: #00ff41 !important;\n color: #000000 !important;\n }\n\n [data-theme="valentine"] .success-btn {\n background: #e91e7a !important;\n color: #ffffff !important;\n }\n\n [data-theme="bumblebee"] .success-btn {\n background: #f59e0b !important;\n color: #ffffff !important;\n }\n\n [data-theme="garden"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="emerald"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="corporate"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="forest"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="halloween"] .success-btn {\n background: #ff7b00 !important;\n color: #000000 !important;\n }\n\n [data-theme="synthwave"] .success-btn {\n background: #00ff41 !important;\n color: #000000 !important;\n }\n\n [data-theme="dracula"] .success-btn {\n background: #50fa7b !important;\n color: #000000 !important;\n }\n\n [data-theme="luxury"] .success-btn {\n background: #d4af37 !important;\n color: #000000 !important;\n }\n\n [data-theme="night"] .success-btn {\n background: #22d3ee !important;\n color: #ffffff !important;\n }\n\n [data-theme="light"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cupcake"] .success-btn {\n background: #f472b6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="retro"] .success-btn {\n background: #d4a574 !important;\n color: #ffffff !important;\n }\n\n [data-theme="aqua"] .success-btn {\n background: #06b6d4 !important;\n color: #ffffff !important;\n }\n\n [data-theme="lofi"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="pastel"] .success-btn {\n background: #34d399 !important;\n color: #ffffff !important;\n }\n\n [data-theme="fantasy"] .success-btn {\n background: #f472b6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="wireframe"] .success-btn {\n background: #dfdfdf !important;\n color: #000000 !important;\n border: 1px solid #000000 !important;\n }\n\n [data-theme="black"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cmyk"] .success-btn {\n background: #06b6d4 !important;\n color: #ffffff !important;\n }\n\n [data-theme="autumn"] .success-btn {\n background: #d97706 !important;\n color: #ffffff !important;\n }\n\n [data-theme="business"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="acid"] .success-btn {\n background: #84cc16 !important;\n color: #000000 !important;\n }\n\n [data-theme="lemonade"] .success-btn {\n background: #22c55e !important;\n color: #ffffff !important;\n }\n\n [data-theme="coffee"] .success-btn {\n background: #a0522d !important;\n color: #ffffff !important;\n }\n\n [data-theme="winter"] .success-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n .download-limiter-signout-btn {\n background: #dc3545;\n color: white;\n border: none;\n padding: 6px 12px;\n border-radius: 4px;\n font-size: 12px;\n cursor: pointer;\n margin-left: 8px;\n }\n .download-limiter-premium-badge {\n background: linear-gradient(45deg, #f39c12, #e74c3c);\n color: white;\n padding: 2px 6px;\n border-radius: 3px;\n font-size: 10px;\n margin-left: 8px;\n font-weight: bold;\n }\n .download-limiter-btn-premium {\n opacity: 0.7;\n }\n .download-limiter-success-modal {\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0,0,0,0.5);\n z-index: 10000;\n align-items: center;\n justify-content: center;\n }\n .download-limiter-success-modal.show { display: flex; }\n .download-limiter-success-content {\n background: white;\n padding: 2rem;\n border-radius: 8px;\n max-width: 400px;\n text-align: center;\n box-shadow: 0 4px 20px rgba(0,0,0,0.15);\n border-left: 4px solid #38a169;\n }\n\n /* Single upgrade flow styles */\n .single-upgrade-container {\n margin: 20px 0;\n text-align: center;\n }\n\n .single-upgrade-content .upgrade-btn {\n background: linear-gradient(135deg, #059669, #0d9488) !important;\n color: white !important;\n border: none !important;\n padding: 16px 32px !important;\n border-radius: 12px !important;\n font-size: 18px !important;\n font-weight: 600 !important;\n cursor: pointer !important;\n transition: all 0.3s ease !important;\n box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3) !important;\n margin-bottom: 16px !important;\n min-width: 200px !important;\n }\n\n .single-upgrade-content .upgrade-btn:hover {\n background: linear-gradient(135deg, #047857, #0f766e) !important;\n transform: translateY(-2px) !important;\n box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4) !important;\n }\n\n .single-upgrade-content .upgrade-description {\n font-size: 14px !important;\n color: #6b7280 !important;\n margin: 12px 0 0 0 !important;\n line-height: 1.5 !important;\n max-width: 300px !important;\n margin-left: auto !important;\n margin-right: auto !important;\n }\n\n /* Anonymous user usage count styles */\n .lead-fast-anonymous-status {\n display: flex;\n align-items: center;\n gap: 12px;\n }\n\n .lead-fast-anonymous-status .lead-fast-count {\n background: rgba(59, 130, 246, 0.1);\n color: #1d4ed8;\n padding: 6px 12px;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n border: 1px solid rgba(59, 130, 246, 0.2);\n }\n\n /* Success button theming */\n .download-limiter-btn.success-btn {\n background: #059669 !important;\n color: white !important;\n border: none !important;\n padding: 12px 24px !important;\n border-radius: 8px !important;\n cursor: pointer !important;\n margin-top: 20px !important;\n font-size: 16px !important;\n font-weight: 500 !important;\n transition: all 0.2s ease !important;\n }\n\n .download-limiter-btn.success-btn:hover {\n background: #047857 !important;\n transform: translateY(-1px) !important;\n }\n\n /* Theme-specific success button colors */\n [data-theme="cyberpunk"] .download-limiter-btn.success-btn {\n background: #0ea5e9 !important;\n box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3) !important;\n }\n\n [data-theme="cyberpunk"] .download-limiter-btn.success-btn:hover {\n background: #0284c7 !important;\n }\n\n [data-theme="valentine"] .download-limiter-btn.success-btn {\n background: #be185d !important;\n }\n\n [data-theme="valentine"] .download-limiter-btn.success-btn:hover {\n background: #9d174d !important;\n }\n\n [data-theme="bumblebee"] .download-limiter-btn.success-btn {\n background: #f59e0b !important;\n }\n\n [data-theme="bumblebee"] .download-limiter-btn.success-btn:hover {\n background: #d97706 !important;\n }\n\n [data-theme="garden"] .download-limiter-btn.success-btn {\n background: #16a34a !important;\n }\n\n [data-theme="garden"] .download-limiter-btn.success-btn:hover {\n background: #15803d !important;\n }\n\n /* Google Sign-in button theming */\n .download-limiter-btn.google-signin-btn {\n background: #4285f4 !important;\n color: white !important;\n border: none !important;\n padding: 12px 24px !important;\n border-radius: 8px !important;\n cursor: pointer !important;\n margin-right: 10px !important;\n display: inline-flex !important;\n align-items: center !important;\n gap: 8px !important;\n font-size: 14px !important;\n font-weight: 500 !important;\n transition: all 0.2s ease !important;\n }\n\n .download-limiter-btn.google-signin-btn:hover {\n background: #3367d6 !important;\n transform: translateY(-1px) !important;\n }\n\n /* Upgrade button theming */\n .download-limiter-btn.upgrade-btn {\n background: #059669 !important;\n color: white !important;\n border: none !important;\n padding: 12px 24px !important;\n border-radius: 8px !important;\n cursor: pointer !important;\n margin-right: 10px !important;\n font-size: 16px !important;\n font-weight: 500 !important;\n transition: all 0.2s ease !important;\n }\n\n .download-limiter-btn.upgrade-btn:hover {\n background: #047857 !important;\n transform: translateY(-1px) !important;\n }\n\n /* Theme-specific button colors */\n [data-theme="cyberpunk"] .download-limiter-btn.upgrade-btn {\n background: #0ea5e9 !important;\n box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3) !important;\n }\n\n [data-theme="valentine"] .download-limiter-btn.upgrade-btn {\n background: #be185d !important;\n }\n\n [data-theme="bumblebee"] .download-limiter-btn.upgrade-btn {\n background: #f59e0b !important;\n }\n\n [data-theme="garden"] .download-limiter-btn.upgrade-btn {\n background: #16a34a !important;\n }\n\n /* Cancel button container and styling - positioned at very bottom */\n .download-limiter-cancel-container {\n margin-top: 30px !important;\n padding-top: 20px !important;\n border-top: 1px solid rgba(0, 0, 0, 0.1) !important;\n text-align: center !important;\n position: relative !important;\n bottom: 0 !important;\n }\n\n .download-limiter-btn.cancel-btn {\n background: transparent !important;\n color: #6b7280 !important;\n border: none !important;\n padding: 8px 16px !important;\n border-radius: 6px !important;\n cursor: pointer !important;\n font-size: 13px !important;\n font-weight: 400 !important;\n transition: all 0.2s ease !important;\n text-decoration: underline !important;\n margin: 0 auto !important;\n display: block !important;\n }\n\n .download-limiter-btn.cancel-btn:hover {\n color: #374151 !important;\n background: rgba(107, 114, 128, 0.1) !important;\n text-decoration: none !important;\n }\n\n /* Theme-specific cancel button border */\n [data-theme="dark"] .download-limiter-cancel-container {\n border-top-color: rgba(255, 255, 255, 0.1) !important;\n }\n\n [data-theme="dark"] .download-limiter-btn.cancel-btn {\n color: #9ca3af !important;\n }\n\n [data-theme="dark"] .download-limiter-btn.cancel-btn:hover {\n color: #d1d5db !important;\n background: rgba(156, 163, 175, 0.1) !important;\n }\n\n [data-theme="cyberpunk"] .download-limiter-cancel-container {\n border-top-color: rgba(14, 165, 233, 0.2) !important;\n }\n\n [data-theme="cyberpunk"] .download-limiter-btn.cancel-btn {\n color: #0ea5e9 !important;\n }\n\n [data-theme="cyberpunk"] .download-limiter-btn.cancel-btn:hover {\n color: #38bdf8 !important;\n background: rgba(14, 165, 233, 0.1) !important;\n }\n `,document.head.appendChild(n)}injectDaisyUI(){if(document.querySelector('link[href*="daisyui"]')){if(this.config.theme?.name){const n=this.config.theme.name.toLowerCase();document.documentElement.setAttribute("data-theme",n)}}else if(this.config.theme?.name){const n=this.config.theme.name.toLowerCase();document.documentElement.setAttribute("data-theme",n),this.updateStatusDisplays()}}createPaywallModal(){if(document.getElementById("download-limiter-paywall"))return;const n=document.createElement("div");n.id="download-limiter-paywall",n.className="download-limiter-modal",n.innerHTML='\n <div class="download-limiter-content">\n <h3 id="download-limiter-paywall-title">Usage Limit Reached</h3>\n <p id="download-limiter-paywall-subtitle">You\'ve used all your free attempts. Upgrade to premium for unlimited usage!</p>\n\n \x3c!-- Auth Section (shows when not signed in) --\x3e\n <div id="download-limiter-auth-section" style="margin: 20px 0;">\n <p>Sign in to continue or upgrade to premium</p>\n <button id="download-limiter-signin-btn" class="download-limiter-btn google-signin-btn">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none">\n <path d="M16.51 8H8.98v3h4.3c-.18 1-.74 1.48-1.6 2.04v2.01h2.6a8.8 8.8 0 0 0 2.38-5.88c0-.57-.05-.66-.15-1.18z" fill="white"/>\n <path d="M8.98 17c2.16 0 3.97-.72 5.3-1.94l-2.6-2.04a4.8 4.8 0 0 1-2.7.75 4.8 4.8 0 0 1-4.52-3.4H1.83v2.07A8 8 0 0 0 8.98 17z" fill="white"/>\n <path d="M4.46 10.37a4.8 4.8 0 0 1-.25-1.37c0-.48.09-.94.25-1.37V5.56H1.83a8 8 0 0 0 0 6.88l2.63-2.07z" fill="white"/>\n <path d="M8.98 3.77c1.32 0 2.5.45 3.44 1.35l2.58-2.58C13.94.64 11.66 0 8.98 0A8 8 0 0 0 1.83 5.56l2.63 2.07c.61-1.8 2.26-3.86 4.52-3.86z" fill="white"/>\n </svg>\n Sign in with Google\n </button>\n </div>\n\n \x3c!-- Payment Section (shows when signed in) --\x3e\n <div id="download-limiter-payment-section" style="margin: 20px 0; display: none;">\n <button id="download-limiter-upgrade-btn" class="download-limiter-btn upgrade-btn">\n Upgrade to Premium\n </button>\n </div>\n\n <div class="download-limiter-cancel-container">\n <button id="download-limiter-close-btn" class="download-limiter-btn cancel-btn">\n Cancel\n </button>\n </div>\n </div>\n ',document.body.appendChild(n),n.querySelector("#download-limiter-signin-btn").addEventListener("click",async()=>{await this.signIn()}),n.querySelector("#download-limiter-upgrade-btn").addEventListener("click",async()=>{const n=await this.createPayment();n?.checkout_url&&(window.location.href=n.checkout_url)}),n.querySelector("#download-limiter-close-btn").addEventListener("click",()=>{this.config.options?.debug&&(console.log("🔍 DEBUG: Cancel button clicked"),console.log("🔍 DEBUG: this.config.feedback:",this.config.feedback),console.log("🔍 DEBUG: this.config.email:",this.config.email),console.log("🔍 DEBUG: Feedback config exists:",!(!this.config.feedback&&!this.config.email))),this.config.feedback||this.config.email?(this.config.options?.debug&&console.log("🔍 DEBUG: Showing feedback form"),this.showFeedbackForm()):(this.config.options?.debug&&console.log("🔍 DEBUG: No email config, just closing modal"),n.classList.remove("show"))})}createSuccessModal(){if(document.getElementById("download-limiter-success"))return;const n=document.createElement("div");n.id="download-limiter-success",n.className="download-limiter-modal",n.innerHTML='\n <div class="download-limiter-content"> \x3c!-- Use same content class as paywall for theming --\x3e\n <h3 id="download-limiter-success-title">Action Started!</h3>\n <p id="download-limiter-success-message">Your action completed successfully!</p>\n <button id="download-limiter-success-close" class="download-limiter-btn success-btn">\n OK\n </button>\n </div>\n ',document.body.appendChild(n),n.querySelector("#download-limiter-success-close").addEventListener("click",()=>{n.classList.remove("show")}),n.addEventListener("click",t=>{t.target===n&&n.classList.remove("show")})}showFeedbackForm(){const n=document.getElementById("download-limiter-paywall");n&&n.classList.remove("show"),this.createFeedbackModal();const t=document.getElementById("download-limiter-feedback");t&&t.classList.add("show")}createFeedbackModal(){if(document.getElementById("download-limiter-feedback"))return void(this.config.options?.debug&&console.log("🔍 DEBUG: Feedback modal already exists"));const n=this.config.feedback||(this.config.email?{form:{title:"Quick Feedback",description:"Why didn't you upgrade?",option1:"Not useful for my needs",option2:"Didn't find what I was looking for",option3:"Just trying it out"},email:this.config.email}:null);if(this.config.options?.debug&&(console.log("🔍 DEBUG: Feedback config:",n),console.log("🔍 DEBUG: this.config.feedback:",this.config.feedback),console.log("🔍 DEBUG: this.config.email:",this.config.email)),!n)return void(this.config.options?.debug&&console.log("🔍 DEBUG: No feedback config found, not creating modal"));const t=document.createElement("div");t.id="download-limiter-feedback",t.className="download-limiter-modal",t.innerHTML=`\n <div class="download-limiter-content">\n <h3>${n.form.title}</h3>\n <p style="margin-bottom: 20px;">${n.form.description}</p>\n\n <form id="feedback-form" style="text-align: left;">\n <div style="margin-bottom: 15px;">\n <label style="display: block; margin-bottom: 8px;">\n <input type="radio" name="reason" value="option1" style="margin-right: 8px;">\n ${n.form.option1}\n </label>\n <label style="display: block; margin-bottom: 8px;">\n <input type="radio" name="reason" value="option2" style="margin-right: 8px;">\n ${n.form.option2}\n </label>\n <label style="display: block; margin-bottom: 8px;">\n <input type="radio" name="reason" value="option3" style="margin-right: 8px;">\n ${n.form.option3}\n </label>\n </div>\n\n <div style="margin-bottom: 15px;">\n <label for="feedback-details" style="display: block; margin-bottom: 5px;">Tell us more:</label>\n <textarea\n id="feedback-details"\n name="details"\n rows="3"\n style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;"\n placeholder="Your feedback helps us improve..." maxlength="200"></textarea>\n </div>\n\n <div style="margin-bottom: 20px;">\n <label for="feedback-email" style="display: block; margin-bottom: 5px;">\n Email (optional):\n </label>\n <input\n type="email"\n id="feedback-email"\n name="email"\n style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;"\n placeholder="your@email.com">\n <small style="color: #666; display: block; margin-top: 4px;">\n Only if you want us to reach out about what you mentioned above. We don't follow up unless you want us to\n </small>\n </div>\n\n \n <div style="text-align: center;">\n <button type="submit" class="download-limiter-btn success-btn" style="margin-right: 10px;">\n Submit Feedback\n </button>\n <button type="button" id="feedback-skip-btn" class="download-limiter-btn cancel-btn">\n Skip\n </button>\n </div>\n </form>\n </div>\n `,document.body.appendChild(t),this.config.options?.debug&&console.log("🔍 DEBUG: Feedback modal created and added to DOM");const e=t.querySelector("#feedback-form");e.addEventListener("submit",n=>{n.preventDefault(),this.submitFeedback(e)}),t.querySelector("#feedback-skip-btn").addEventListener("click",()=>{t.classList.remove("show")}),t.addEventListener("click",n=>{n.target===t&&t.classList.remove("show")})}async submitFeedback(n){const t=new FormData(n),e=t.get("reason"),a=t.get("details"),o=t.get("email");if(!e)return void alert("Please select a reason");const r={reason:e,details:a,email:o||void 0,timestamp:(new Date).toISOString(),userAgent:navigator.userAgent,appId:this.config.appId};try{await this.sendFeedbackEmail(r);const n=document.getElementById("download-limiter-feedback");n&&n.classList.remove("show"),alert("Thank you for your feedback!")}catch(n){console.error("Failed to send feedback:",n),alert("Failed to send feedback. Please try again.")}}async sendFeedbackEmail(n){const t=this.config.feedback?.email||this.config.email;if(!t)throw new Error("Email configuration not available");const e=`\nNew Feedback from ${this.config.appId}\n\nReason: ${n.reason}\nDetails: ${n.details}\nUser Email: ${n.email||"Not provided"}\nTimestamp: ${n.timestamp}\nUser Agent: ${n.userAgent}\n `.trim(),a=await fetch("https://api.resend.com/emails",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.resendApiKey}`},body:JSON.stringify({from:t.fromEmail,to:[t.fromEmail],subject:`Feedback from ${this.config.appId}`,text:e})});if(!a.ok)throw new Error(`Email API error: ${a.status}`)}createAuthUI(){if(document.getElementById("lead-fast-profile"))return;const n=document.createElement("div");n.id="lead-fast-profile",n.className="lead-fast-profile",document.body.appendChild(n)}createStatusDisplay(){if(document.getElementById("download-limiter-status"))return;const n=document.createElement("div");n.id="download-limiter-status",n.className="download-limiter-status",document.body.appendChild(n)}createGlobalStatusDisplay(){this.createStatusDisplay()}showPaywallInstant(n){this.createPaywallModal();const t=document.getElementById("download-limiter-paywall");if(t){const e=t.querySelector("#download-limiter-paywall-title");e&&(e.textContent=`You've used ${n.limit} free attempts`);const a=t.querySelector("#download-limiter-auth-section"),o=t.querySelector("#download-limiter-payment-section");if(this.currentUser)a.style.display="none",o.style.display="block";else{const n=t.querySelector("#download-limiter-paywall-subtitle");n&&(n.textContent="Sign in to continue. If you're already premium, you'll get unlimited access. New users can upgrade after signing in."),a.style.display="none",o.style.display="none",this.showSingleUpgradeFlow(t)}t.classList.add("show")}}async showPaywall(){const n=await this.getDownloadStatus();this.showPaywallInstant(n)}showSingleUpgradeFlow(n){let t=n.querySelector(".single-upgrade-container");if(!t){t=document.createElement("div"),t.className="single-upgrade-container",t.innerHTML='\n <div class="single-upgrade-content">\n <button class="download-limiter-btn upgrade-btn" id="single-upgrade-btn">\n Continue with Google\n </button>\n \x3c!--<p class="upgrade-description">\n Sign in to restore access. Premium members get unlimited usage immediately.\n </p>--\x3e\n </div>\n ';const e=n.querySelector(".download-limiter-cancel-container");e?n.querySelector(".download-limiter-content")?.insertBefore(t,e):n.querySelector(".download-limiter-content")?.appendChild(t)}t.style.display="block";const e=n.querySelector("#single-upgrade-btn");if(e){e.replaceWith(e.cloneNode(!0));const t=n.querySelector("#single-upgrade-btn");t?.addEventListener("click",async()=>{try{const{error:n}=await this.supabase.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${window.location.origin}${window.location.pathname}?upgrade=true`}});n&&(console.error("Sign in error:",n),this.showError("Sign In Failed","Failed to sign in with Google. Please try again."))}catch(n){console.error("Upgrade flow error:",n),this.showError("Upgrade Failed","Failed to start upgrade process. Please try again.")}})}}showSuccess(n,t){const e=document.getElementById("download-limiter-success");if(e){const a=e.querySelector("#download-limiter-success-title"),o=e.querySelector("#download-limiter-success-message");a&&(a.textContent=n),o&&(o.textContent=t),e.classList.add("show")}}showError(n,t){const e=document.createElement("div");e.style.cssText="\n position: fixed;\n top: 20px;\n right: 20px;\n background: #fee2e2;\n border: 1px solid #fecaca;\n color: #dc2626;\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n line-height: 1.4;\n max-width: 300px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);\n z-index: 10000;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n ",e.innerHTML=`\n <div style="font-weight: 600; margin-bottom: 4px;">${n}</div>\n <div style="font-size: 13px; opacity: 0.9;">${t}</div>\n `,document.body.appendChild(e),setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},5e3),e.addEventListener("click",()=>{e.parentNode&&e.parentNode.removeChild(e)})}showConnectionError(){this.showError("Connection Error","Server connection required for download verification. Please check your configuration and try again.")}showPaymentConfigError(){this.showError("Payment Configuration Error","Payment system is not properly configured. Please contact support.")}disableDownloadButtons(n){const t=document.querySelectorAll("[data-leadfast-attached]"),e={connection:"Download disabled: Server connection required",payment:"Download disabled: Payment configuration error"},a={connection:"⚠️ Connection Error - Downloads Disabled",payment:"⚠️ Payment Config Error - Downloads Disabled"};t.forEach(t=>{const a=t;a.disabled=!0,a.style.opacity="0.5",a.style.cursor="not-allowed",a.title=e[n]});const o=document.querySelector(".lead-fast-user-section");o&&(o.innerHTML=`\n <div style="\n color: #ef4444;\n padding: 6px 8px;\n font-size: 12px;\n font-weight: 500;\n line-height: 1.2;\n border-radius: 4px;\n background: rgba(239, 68, 68, 0.05);\n border: 1px solid rgba(239, 68, 68, 0.2);\n max-width: 200px;\n text-align: center;\n ">\n ${a[n]}\n </div>\n `)}async updateStatusDisplays(){if(this.supabaseConnectionFailed)return void this.disableDownloadButtons("connection");if(this.config.payment&&this.paymentConnectionFailed)return void this.disableDownloadButtons("payment");const n=await this.getDownloadStatus();this.updateUserSection(n)}createTitleBar(){let n=document.getElementById("lead-fast-profile");n||(n=document.createElement("div"),n.id="lead-fast-profile",n.className="lead-fast-profile",document.body.appendChild(n));const t=this.config.titleBar||{},e=t.title||"My App",a=t.titleImage,o=t.links||[];n.innerHTML=`\n <div class="lead-fast-title-bar">\n <div class="lead-fast-title-section">\n <a href="#" class="lead-fast-logo">\n ${a?`<img src="${a}" alt="${e}">`:""}\n <span>${e}</span>\n </a>\n <nav class="lead-fast-nav">\n ${o.map(n=>`\n <a href="${n.url}" class="lead-fast-nav-link" ${n.target?`target="${n.target}"`:""}>\n ${n.text}\n </a>\n `).join("")}\n </nav>\n </div>\n\n <div class="lead-fast-user-section" id="lead-fast-user-section">\n \x3c!-- User section will be populated when logged in --\x3e\n </div>\n\n \x3c!-- <a href="https://www.moneyfast.bar" target="_blank" class="lead-fast-branding" style="text-decoration: none; color: inherit;">moneyfast.bar</a>--\x3e\n </div>\n `}updateUserSection(n){const t=document.getElementById("lead-fast-user-section");if(t)if(this.currentUser){const e=this.currentUser.email.charAt(0).toUpperCase(),a=this.currentUser.email,o=n.isPremium?"premium":"free",r=n.isPremium?"Premium":"Free",i=n.isPremium?"Unlimited":`${n.currentCount}/${n.limit}`;t.innerHTML=`\n <div class="lead-fast-avatar">${e}</div>\n <div class="lead-fast-user-info">\n <div class="lead-fast-user-email">${a}</div>\n <div class="lead-fast-user-status">\n <span class="lead-fast-badge ${o}">${r}</span>\n <span class="lead-fast-count">${i}</span>\n </div>\n </div>\n <button class="lead-fast-signout">signout</button>\n `;const s=document.querySelector(".lead-fast-title-bar");s&&getComputedStyle(s);const d=t.querySelector(".lead-fast-signout");d&&d.addEventListener("click",()=>{this.signOut()})}else{const e=`Attempts: ${n.currentCount}/${n.limit}`;t.innerHTML=`\n <div class="lead-fast-anonymous-status">\n <span class="lead-fast-count">${e}</span>\n </div>\n `}}setupUIUpdates(){this.on("authChanged",async()=>{this.cachedStatus=null,this.updateStatusDisplays();const n=document.getElementById("download-limiter-paywall");n&&n.classList.contains("show")&&(this.updatePaywallDisplay(),this.currentUser&&this.config.payment&&setTimeout(async()=>{if(await this.checkPremiumStatus(this.currentUser.email))n.classList.remove("show");else{const n=await this.createPayment();n?.checkout_url&&(window.location.href=n.checkout_url)}},1e3))}),this.on("countChanged",()=>{this.updateStatusDisplays()}),this.updateStatusDisplays()}updatePaywallDisplay(){const n=document.getElementById("download-limiter-paywall");if(!n)return;const t=n.querySelector("#download-limiter-auth-section"),e=n.querySelector("#download-limiter-payment-section");this.currentUser?(t.style.display="none",e.style.display="block"):(t.style.display="block",e.style.display="none")}on(n,t){this.eventListeners.has(n)||this.eventListeners.set(n,[]),this.eventListeners.get(n).push(t)}off(n,t){const e=this.eventListeners.get(n);if(e){const n=e.indexOf(t);n>-1&&e.splice(n,1)}}emit(n,t){const e=this.eventListeners.get(n);e&&e.forEach(e=>{try{e(t)}catch(t){console.error(`Error in ${n} listener:`,t)}})}validateConfig(){if(!this.config.appId)throw new Error("appId is required");if(!this.config.supabase?.url)throw new Error("supabase.url is required");if(!this.config.supabase?.anonKey)throw new Error("supabase.anonKey is required");if("number"!=typeof this.config.freeDownloadLimit||this.config.freeDownloadLimit<0)throw new Error("freeDownloadLimit must be a non-negative number")}async initializeSupabase(){try{this.supabase=t.createClient(this.config.supabase.url,this.config.supabase.anonKey),this.supabaseConnectionFailed=!1}catch(n){console.error("Failed to initialize Supabase:",n),this.supabaseConnectionFailed=!0}}async initializePayment(){if(!this.config.payment)return;const n=this.config.payment.productId;if(!n||!n.startsWith("pdt_")||n.length<10)return this.paymentConnectionFailed=!0,void(this.config.options?.debug&&console.warn("Invalid payment product ID format:",n));this.paymentConnectionFailed=!1}async initializeFingerprint(){try{this.userFingerprint=await this.generateFingerprint()}catch(n){this.userFingerprint=crypto.randomUUID?crypto.randomUUID():String(Date.now()),this.config.options?.debug&&console.warn("Fingerprint generation failed, using fallback:",n)}}async generateFingerprint(){const n=`${navigator.userAgent||""}||${Intl.DateTimeFormat().resolvedOptions().timeZone||""}||${`${screen.width}x${screen.height}`}||${navigator.language||""}`,t=(new TextEncoder).encode(n),e=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(e)).map(n=>n.toString(16).padStart(2,"0")).join("")}async setupAuthListener(){this.supabase.auth.onAuthStateChange(async(n,t)=>{const e=this.currentUser;this.currentUser=t?.user||null;let a=!1;if(this.currentUser){const n=!e||e.email!==this.currentUser.email,t=!this.cachedPremiumStatus||Date.now()-this.premiumStatusCacheTime>this.STATUS_CACHE_DURATION;n||t?(console.log(`🔥 [SUPABASE API] About to call checkPremiumStatus from setupAuthListener (userChanged: ${n}, cacheExpired: ${t})`),a=await this.checkPremiumStatus(this.currentUser.email),this.cachedPremiumStatus=a,this.premiumStatusCacheTime=Date.now()):(a=this.cachedPremiumStatus,console.log(`🔍 [CACHE] Using cached premium status from auth listener: ${a}`))}else this.cachedPremiumStatus=null,this.premiumStatusCacheTime=0;const o="true"===new URLSearchParams(window.location.search).get("upgrade");if("SIGNED_IN"===n&&!e&&this.currentUser&&this.config.payment&&o)if(a){window.history.replaceState({},document.title,window.location.pathname);const n=document.getElementById("download-limiter-paywall");n&&n.classList.remove("show")}else{const n=await this.createPayment();n?.checkout_url&&(window.history.replaceState({},document.title,window.location.pathname),window.location.href=n.checkout_url)}this.emit("authChanged",{user:this.currentUser,isPremium:a})});const{data:{user:n}}=await this.supabase.auth.getUser();this.currentUser=n}async getDownloadCount(){if(!this.userFingerprint)return 0;console.log(`🔥 [SUPABASE API] getDownloadCount called | Time: ${(new Date).toISOString()}`);try{const n=await fetch(`${this.config.supabase.url}/functions/v1/check-download-limit`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.config.supabase.anonKey}`},body:JSON.stringify({fingerprint:this.userFingerprint,app_id:this.config.appId,action:"check"})});if(console.log(`🔥 [SUPABASE API] getDownloadCount response: ${n.status}`),n.ok){const t=await n.json();return this.supabaseConnectionFailed=!1,t.current_count||0}401!==n.status&&403!==n.status||(console.warn(`Supabase authentication failed: ${n.status} - Invalid anon key`),this.supabaseConnectionFailed=!0)}catch(n){this.supabaseConnectionFailed=!0,this.config.options?.debug&&console.warn("Failed to get server usage count, connection failed:",n)}return 0}async incrementDownloadCount(){if(!this.userFingerprint)return 0;const n={fingerprint:this.userFingerprint,app_id:this.config.appId,action:"increment"};console.log(`🔥 [SUPABASE API] incrementDownloadCount called | Time: ${(new Date).toISOString()}`);try{const t=await fetch(`${this.config.supabase.url}/functions/v1/check-download-limit`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.config.supabase.anonKey}`},body:JSON.stringify(n)});if(console.log(`🔥 [SUPABASE API] incrementDownloadCount response: ${t.status}`),this.config.options?.debug&&!t.ok){const n=await t.text();console.error("🔍 DEBUG: Error response:",n)}if(t.ok){const n=await t.json();return this.supabaseConnectionFailed=!1,n.new_count||0}401!==t.status&&403!==t.status||(console.warn(`Supabase authentication failed: ${t.status} - Invalid anon key`),this.supabaseConnectionFailed=!0)}catch(n){this.supabaseConnectionFailed=!0,this.config.options?.debug&&console.warn("Failed to increment server count, connection failed:",n)}return 0}async checkPremiumStatus(n){console.log(`🔥 [SUPABASE API] checkPremiumStatus called for email: ${n} | Time: ${(new Date).toISOString()}`);try{const t=await fetch(`${this.config.supabase.url}/functions/v1/check-payment-status`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.config.supabase.anonKey}`},body:JSON.stringify({email:n,app_id:this.config.appId})});if(console.log(`🔥 [SUPABASE API] checkPremiumStatus response: ${t.status}`),t.ok){return"completed"===(await t.json()).status}}catch(n){this.config.options?.debug&&console.warn("Failed to check premium status:",n)}return!1}getLocalDownloadCount(){const n=`download_count_${this.config.appId}`,t=parseInt(localStorage.getItem(n)||"0",10);return isNaN(t)?0:t}incrementLocalDownloadCount(){const n=`download_count_${this.config.appId}`,t=this.getLocalDownloadCount()+1;return localStorage.setItem(n,String(t)),t}handleError(n){this.config.options?.debug&&console.error("Lead Fast Error:",n),this.config.callbacks?.onError?this.config.callbacks.onError(n):console.error("Lead Fast:",n.message),this.emit("error",n)}async checkPaymentStatus(){"success"===new URLSearchParams(window.location.search).get("payment")&&setTimeout(async()=>{if(this.currentUser){await this.checkPremiumStatus(this.currentUser.email)?this.showSuccess("Payment Successful!","Welcome to premium! You now have unlimited usage."):this.showSuccess("Processing Payment","Payment is being processed. Please refresh in a few moments.")}else this.showSuccess("Processing Payment","Please wait while we verify your payment...");const n=window.location.href.split("?")[0];window.history.replaceState({},document.title,n)},2e3)}},Object.defineProperty(n,"__esModule",{value:!0})});
|
|
1
|
+
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@supabase/supabase-js")):"function"==typeof define&&define.amd?define(["exports","@supabase/supabase-js"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).MoneyBar={},n.Supabase)}(this,function(n,t){"use strict";n.MoneyBar=class{mergeConfigs(n){const t="undefined"!=typeof window?window.APP_CONFIG:null;if(!n&&!t)throw new Error("MoneyBar: No configuration provided. Either pass config to constructor or set window.APP_CONFIG");return n?t?{...t,...n}:n:t}constructor(n){this.currentUser=null,this.userFingerprint=null,this.eventListeners=new Map,this.supabaseConnectionFailed=!1,this.paymentConnectionFailed=!1,this.cachedStatus=null,this.statusCacheTime=0,this.STATUS_CACHE_DURATION=5e3,this.initializationPromise=null,this.cachedPremiumStatus=null,this.premiumStatusCacheTime=0,this.config=this.mergeConfigs(n),this.config.options,this.validateConfig(),this.initializeSupabase(),this.initializePayment(),this.initializeFingerprint(),this.setupAuthListener(),this.checkPaymentStatus()}async handleDownload(){try{if(this.supabaseConnectionFailed)return void this.config.callbacks?.onError?.(new Error("Server connection required for download verification. Please check your configuration."));if(this.config.payment&&this.paymentConnectionFailed)return void this.config.callbacks?.onError?.(new Error("Payment configuration error. Please contact support."));if(this.currentUser){if(await this.checkPremiumStatus(this.currentUser.email))return void this.config.callbacks?.onPremiumDownload()}const n=await this.getDownloadStatus();if(n.currentCount>=n.limit)return void this.config.callbacks?.onLimitReached(n.currentCount,n.limit);await this.incrementDownloadCount(),this.config.callbacks?.onDownloadAllowed(),this.cachedStatus=null;const t=await this.getDownloadStatus();this.emit("countChanged",{count:t.currentCount,limit:t.limit}),t.currentCount>=t.limit&&setTimeout(()=>{this.config.callbacks?.onLimitReached(t.currentCount,t.limit)},100)}catch(n){this.handleError(n)}}async getDownloadStatus(n=!1){console.log(`🔍 [INIT] getDownloadStatus called (forceRefresh: ${n}) at ${(new Date).toISOString()}`);const t=this.cachedStatus?Date.now()-this.statusCacheTime:-1;if(!n&&this.cachedStatus&&t<this.STATUS_CACHE_DURATION)return console.log(`🔍 [INIT] Using cached status (age: ${t}ms)`),this.cachedStatus;if(!n&&this.initializationPromise)return console.log("🔍 [INIT] Waiting for existing initialization promise"),await this.initializationPromise;console.log(`🔍 [INIT] Starting new status fetch (cache age: ${t}ms)`),this.initializationPromise=this.fetchFreshStatus(n);try{const n=await this.initializationPromise;return console.log("🔍 [INIT] Status fetch completed successfully"),n}finally{this.initializationPromise=null}}async fetchFreshStatus(n){try{let t=0,e=!1;if(t=n||!this.cachedStatus?await this.getDownloadCount():this.cachedStatus.currentCount,this.currentUser){const t=null!==this.cachedPremiumStatus&&Date.now()-this.premiumStatusCacheTime<this.STATUS_CACHE_DURATION;n||!t?(console.log(`🔥 [SUPABASE API] About to call checkPremiumStatus from getDownloadStatus (forceRefresh: ${n}, cacheValid: ${t})`),e=await this.checkPremiumStatus(this.currentUser.email),this.cachedPremiumStatus=e,this.premiumStatusCacheTime=Date.now()):(e=this.cachedPremiumStatus,console.log(`🔍 [CACHE] Using cached premium status from getDownloadStatus: ${e}`))}else e=!1;const a={currentCount:t,limit:this.config.freeAttemptLimit,isPremium:e,isAuthenticated:!!this.currentUser,remaining:Math.max(0,this.config.freeAttemptLimit-t)};return this.cachedStatus=a,this.statusCacheTime=Date.now(),a}catch(n){this.handleError(n);const t={currentCount:0,limit:this.config.freeAttemptLimit,isPremium:!1,isAuthenticated:!1,remaining:this.config.freeAttemptLimit};return this.cachedStatus=t,this.statusCacheTime=Date.now(),t}}async getUserContext(){const n=await this.getDownloadStatus();return{isPremium:n.isPremium,isAuthenticated:n.isAuthenticated,email:this.currentUser?.email,name:this.currentUser?.user_metadata?.full_name||this.currentUser?.user_metadata?.name,currentCount:n.currentCount,remaining:n.remaining,limit:n.limit,user:this.currentUser}}async signIn(){try{const{error:n}=await this.supabase.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${window.location.origin}${window.location.pathname}`}});if(n)throw n}catch(n){this.handleError(n)}}async signOut(){try{await this.supabase.auth.signOut(),this.currentUser=null,this.emit("authChanged",{user:null,isPremium:!1})}catch(n){this.handleError(n)}}async createPayment(){if(!this.currentUser)throw new Error("User must be signed in to create payment");if(!this.config.payment)throw new Error("Payment configuration not provided");const n={email:this.currentUser.email,product_id:this.config.payment.productId,mode:this.config.payment.mode||"test",app_id:this.config.appId,return_url:`${window.location.origin}${window.location.pathname}?payment=success`};console.log(`🔥 [SUPABASE API] createPayment called for email: ${this.currentUser.email} | Time: ${(new Date).toISOString()}`);try{const t=await fetch(`${this.config.supabase.url}/functions/v1/create-payment`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.config.supabase.anonKey}`},body:JSON.stringify(n)});if(console.log(`🔥 [SUPABASE API] createPayment response: ${t.status}`),this.config.options,!t.ok){const n=await t.text();let e;this.config.options?.debug&&console.error("🔍 DEBUG: createPayment error response:",n);try{e=JSON.parse(n)}catch{e={error:n}}throw(n.includes("404")||n.includes("could not be found"))&&(this.paymentConnectionFailed=!0,this.config.options?.debug&&console.warn("Invalid payment product ID detected, disabling downloads"),this.updateStatusDisplays()),new Error(e.error||"Payment creation failed")}const e=await t.json();return this.config.options,e}catch(n){return this.handleError(n),null}}attachToButton(n,t){const e=document.querySelector(n);if(!e)throw new Error(`Button not found: ${n}`);this.injectBaseStyles(),this.createTitleBar(),this.createPaywallModal(),this.createSuccessModal(),this.createAuthUI(),this.createStatusDisplay(),e.setAttribute("data-leadfast-attached","true"),e.onclick=async n=>{n.preventDefault(),await this.handleButtonClick(t)},this.setupUIUpdates()}attachToButtons(n){this.injectBaseStyles(),this.createTitleBar(),this.createPaywallModal(),this.createSuccessModal(),this.createAuthUI(),n.buttons.forEach(n=>{const t=document.querySelector(n.selector);t?(t.setAttribute("data-leadfast-attached","true"),t.onclick=async t=>{t.preventDefault(),await this.handleButtonClick(n.downloadCallback)},this.setupUIUpdates()):console.warn(`Button not found: ${n.selector}`)}),this.createGlobalStatusDisplay()}async handleButtonClick(n){const t=document.querySelector('[data-leadfast-attached="true"]');if(t&&t.disabled)console.log("⚠️ Button click ignored - operation already in progress");else{t&&(t.disabled=!0,t.style.opacity="0.6");try{await this.handleButtonClickInternal(n)}finally{t&&(t.disabled=!1,t.style.opacity="1")}}}async handleButtonClickInternal(n){if(this.supabaseConnectionFailed)return void this.showConnectionError();if(this.config.payment&&this.paymentConnectionFailed)return void this.showPaymentConfigError();const t=this.cachedStatus&&Date.now()-this.statusCacheTime<this.STATUS_CACHE_DURATION?this.cachedStatus:await this.getDownloadStatus();if(t.isPremium){const t=await this.getUserContext();return void(n.length>0?n(t):n())}if(t.currentCount>=t.limit)this.showPaywallInstant(t);else{try{if(n.length>0){const t=await this.getUserContext();t.isPremium||(t.currentCount+=1,t.remaining=Math.max(0,t.limit-t.currentCount)),n(t)}else n();const t=await this.getDownloadStatus(!0);if(t.currentCount>=t.limit)return console.warn(`⚠️ Limit reached during execution (${t.currentCount}/${t.limit}) - canceling increment`),void alert("⚠️ You reached the limit while this action was processing. No attempt was counted.");const e=await this.incrementDownloadCount();if(e>this.config.freeAttemptLimit)return void console.error(`⚠️ Server returned count (${e}) exceeding limit (${this.config.freeAttemptLimit})`);if(!0===this.config.successMessage?.enabled){const n=this.config.successMessage?.title||"Action Completed!",t=this.config.successMessage?.message||"Your action completed successfully!";this.showSuccess(n,t)}}catch(n){return console.error("User function failed:",n),void alert("Action failed. Please check the console for details. No attempt was counted.")}this.cachedStatus=null,this.updateStatusDisplays()}}injectBaseStyles(){if(document.getElementById("lead-fast-styles"))return;this.config.theme?.name&&this.injectDaisyUI();const n=document.createElement("style");n.id="lead-fast-styles";const t=this.config.theme?.primaryColor||"#3182ce";n.textContent=`\n /* User Profile Card - Top Right */\n .lead-fast-profile {\n position: fixed;\n top: 20px;\n left: 50%;\n transform: translateX(-50%);\n z-index: 1000;\n font-family: system-ui, -apple-system, sans-serif;\n width: 90%;\n max-width: 1200px;\n }\n\n .lead-fast-title-bar {\n background: rgba(250, 247, 245, 0.9) !important;\n border: 1px solid rgba(231, 226, 223, 0.6) !important;\n color: #291334 !important;\n border-radius: 16px;\n padding: 12px 24px;\n box-shadow: 0 8px 32px rgb(0 0 0 / 0.1), 0 2px 8px rgb(0 0 0 / 0.05);\n backdrop-filter: blur(20px);\n display: flex;\n align-items: center;\n justify-content: space-between;\n min-height: 60px;\n font-family: system-ui, -apple-system, sans-serif;\n }\n\n /* Theme variations for floating title bar */\n [data-theme="bumblebee"] .lead-fast-title-bar {\n background: rgba(255, 248, 220, 0.9) !important;\n border-color: rgba(254, 215, 170, 0.6) !important;\n color: #1c1917 !important;\n }\n\n [data-theme="garden"] .lead-fast-title-bar {\n background: rgba(240, 253, 244, 0.9) !important;\n border-color: rgba(134, 239, 172, 0.6) !important;\n color: #14532d !important;\n }\n\n [data-theme="emerald"] .lead-fast-title-bar {\n background: rgba(236, 253, 245, 0.9) !important;\n border-color: rgba(167, 243, 208, 0.6) !important;\n color: #065f46 !important;\n }\n\n [data-theme="corporate"] .lead-fast-title-bar {\n background: rgba(248, 250, 252, 0.9) !important;\n border-color: rgba(226, 232, 240, 0.6) !important;\n color: #1e293b !important;\n }\n\n [data-theme="dark"] .lead-fast-title-bar {\n background: rgba(31, 41, 55, 0.9) !important;\n border-color: rgba(55, 65, 81, 0.6) !important;\n color: #f9fafb !important;\n }\n\n [data-theme="cyberpunk"] .lead-fast-title-bar {\n background: rgba(0, 20, 36, 0.9) !important;\n border-color: rgba(7, 89, 133, 0.6) !important;\n color: #0ea5e9 !important;\n box-shadow: 0 8px 32px rgba(14, 165, 233, 0.2), 0 2px 8px rgba(14, 165, 233, 0.1);\n }\n\n [data-theme="valentine"] .lead-fast-title-bar {\n background: rgba(233, 30, 122, 0.15) !important;\n border-color: rgba(233, 30, 122, 0.6) !important;\n color: #831843 !important;\n }\n\n [data-theme="synthwave"] .lead-fast-title-bar {\n background: rgba(32, 20, 64, 0.9) !important;\n border-color: rgba(186, 85, 211, 0.6) !important;\n color: #ff00ff !important;\n box-shadow: 0 8px 32px rgba(255, 0, 255, 0.2), 0 2px 8px rgba(255, 0, 255, 0.1);\n }\n\n [data-theme="dracula"] .lead-fast-title-bar {\n background: rgba(40, 42, 54, 0.9) !important;\n border-color: rgba(98, 114, 164, 0.6) !important;\n color: #f8f8f2 !important;\n }\n\n [data-theme="halloween"] .lead-fast-title-bar {\n background: rgba(26, 26, 26, 0.9) !important;\n border-color: rgba(255, 165, 0, 0.6) !important;\n color: #ff6600 !important;\n }\n\n [data-theme="forest"] .lead-fast-title-bar {\n background: rgba(23, 46, 23, 0.9) !important;\n border-color: rgba(34, 197, 94, 0.6) !important;\n color: #22c55e !important;\n }\n\n [data-theme="luxury"] .lead-fast-title-bar {\n background: rgba(9, 9, 11, 0.9) !important;\n border-color: rgba(212, 175, 55, 0.6) !important;\n color: #d4af37 !important;\n }\n\n [data-theme="night"] .lead-fast-title-bar {\n background: rgba(15, 23, 42, 0.9) !important;\n border-color: rgba(30, 58, 138, 0.6) !important;\n color: #60a5fa !important;\n }\n\n [data-theme="light"] .lead-fast-title-bar {\n background: rgba(255, 255, 255, 0.9) !important;\n border-color: rgba(229, 231, 235, 0.6) !important;\n color: #1f2937 !important;\n }\n\n [data-theme="cupcake"] .lead-fast-title-bar {\n background: rgba(250, 235, 215, 0.9) !important;\n border-color: rgba(219, 185, 156, 0.6) !important;\n color: #8b4513 !important;\n }\n\n [data-theme="retro"] .lead-fast-title-bar {\n background: rgba(212, 165, 116, 0.9) !important;\n border-color: rgba(185, 144, 102, 0.6) !important;\n color: #5d4037 !important;\n }\n\n [data-theme="aqua"] .lead-fast-title-bar {\n background: rgba(240, 253, 250, 0.9) !important;\n border-color: rgba(125, 211, 252, 0.6) !important;\n color: #155e75 !important;\n }\n\n [data-theme="lofi"] .lead-fast-title-bar {\n background: rgba(248, 248, 248, 0.9) !important;\n border-color: rgba(68, 68, 68, 0.6) !important;\n color: #1a1a1a !important;\n }\n\n [data-theme="pastel"] .lead-fast-title-bar {\n background: rgba(254, 251, 255, 0.9) !important;\n border-color: rgba(209, 196, 233, 0.6) !important;\n color: #7c3aed !important;\n }\n\n [data-theme="fantasy"] .lead-fast-title-bar {\n background: rgba(255, 247, 237, 0.9) !important;\n border-color: rgba(249, 168, 212, 0.6) !important;\n color: #be185d !important;\n }\n\n [data-theme="wireframe"] .lead-fast-title-bar {\n background: rgba(223, 223, 223, 0.9) !important;\n border-color: rgba(0, 0, 0, 0.3) !important;\n color: #000000 !important;\n }\n\n [data-theme="black"] .lead-fast-title-bar {\n background: rgba(0, 0, 0, 0.9) !important;\n border-color: rgba(55, 55, 55, 0.6) !important;\n color: #ffffff !important;\n }\n\n [data-theme="cmyk"] .lead-fast-title-bar {\n background: rgba(0, 255, 255, 0.9) !important;\n border-color: rgba(255, 0, 255, 0.6) !important;\n color: #000000 !important;\n }\n\n [data-theme="autumn"] .lead-fast-title-bar {\n background: rgba(139, 69, 19, 0.9) !important;\n border-color: rgba(255, 140, 0, 0.6) !important;\n color: #ff8c00 !important;\n }\n\n [data-theme="business"] .lead-fast-title-bar {\n background: rgba(29, 78, 216, 0.9) !important;\n border-color: rgba(59, 130, 246, 0.6) !important;\n color: #3b82f6 !important;\n }\n\n [data-theme="acid"] .lead-fast-title-bar {\n background: rgba(255, 255, 0, 0.9) !important;\n border-color: rgba(255, 0, 255, 0.6) !important;\n color: #000000 !important;\n }\n\n [data-theme="lemonade"] .lead-fast-title-bar {\n background: rgba(255, 255, 224, 0.9) !important;\n border-color: rgba(34, 197, 94, 0.6) !important;\n color: #15803d !important;\n }\n\n [data-theme="coffee"] .lead-fast-title-bar {\n background: rgba(101, 67, 33, 0.9) !important;\n border-color: rgba(160, 82, 45, 0.6) !important;\n color: #d2b48c !important;\n }\n\n [data-theme="winter"] .lead-fast-title-bar {\n background: rgba(248, 250, 252, 0.9) !important;\n border-color: rgba(59, 130, 246, 0.6) !important;\n color: #1e40af !important;\n }\n\n .lead-fast-title-section {\n display: flex;\n align-items: center;\n gap: 16px;\n }\n\n .lead-fast-logo {\n font-size: 20px;\n font-weight: 700;\n display: flex;\n align-items: center;\n gap: 8px;\n color: inherit;\n text-decoration: none;\n }\n\n .lead-fast-logo img {\n width: 32px;\n height: 32px;\n border-radius: 6px;\n }\n\n .lead-fast-nav {\n display: flex;\n align-items: center;\n gap: 32px;\n margin-left: 24px;\n }\n\n .lead-fast-nav-link {\n color: inherit;\n text-decoration: none;\n font-weight: 500;\n font-size: 14px;\n opacity: 0.8;\n transition: all 0.2s;\n }\n\n .lead-fast-nav-link:hover {\n opacity: 1;\n text-decoration: none;\n }\n\n .lead-fast-user-section {\n display: flex;\n align-items: center;\n gap: 12px;\n }\n\n .lead-fast-avatar {\n width: 36px;\n height: 36px;\n border-radius: 50%;\n background: linear-gradient(135deg, ${t}, #4f46e5);\n display: flex;\n align-items: center;\n justify-content: center;\n color: white;\n font-weight: 600;\n font-size: 14px;\n }\n\n .lead-fast-user-info {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 2px;\n }\n\n .lead-fast-user-email {\n color: inherit !important;\n font-size: 13px;\n font-weight: 500;\n line-height: 1;\n }\n\n .lead-fast-user-status {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n\n .lead-fast-badge {\n padding: 2px 6px;\n border-radius: 12px;\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.025em;\n line-height: 1;\n }\n\n .lead-fast-badge.premium {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n .lead-fast-badge.free {\n background: #65c3c8 !important;\n color: #291334 !important;\n }\n\n [data-theme="dark"] .lead-fast-badge.premium {\n background: #059669 !important;\n color: #ffffff !important;\n }\n\n [data-theme="dark"] .lead-fast-badge.free {\n background: #374151 !important;\n color: #f9fafb !important;\n }\n\n .lead-fast-count {\n font-size: 10px;\n color: inherit !important;\n opacity: 0.7;\n line-height: 1;\n }\n\n .lead-fast-signout {\n background: rgba(0, 0, 0, 0.1) !important;\n border: none;\n color: inherit !important;\n cursor: pointer;\n padding: 6px 12px;\n border-radius: 8px;\n transition: all 0.2s;\n font-size: 11px;\n font-weight: 500;\n margin-left: 8px;\n }\n\n [data-theme="dark"] .lead-fast-signout {\n background: rgba(255, 255, 255, 0.1) !important;\n }\n\n [data-theme="cyberpunk"] .lead-fast-signout {\n background: rgba(14, 165, 233, 0.2) !important;\n }\n\n .lead-fast-signout:hover {\n background: rgba(0, 0, 0, 0.2) !important;\n transform: translateY(-1px);\n }\n\n [data-theme="dark"] .lead-fast-signout:hover {\n background: rgba(255, 255, 255, 0.2) !important;\n }\n\n [data-theme="cyberpunk"] .lead-fast-signout:hover {\n background: rgba(14, 165, 233, 0.3) !important;\n }\n\n .lead-fast-branding {\n position: absolute;\n bottom: -20px;\n left: 24px;\n font-size: 9px;\n color: inherit !important;\n opacity: 0.4;\n font-weight: 500;\n letter-spacing: 0.05em;\n text-transform: lowercase;\n background: rgba(255, 255, 255, 0.8);\n padding: 2px 6px;\n border-radius: 4px;\n backdrop-filter: blur(8px);\n }\n\n [data-theme="dark"] .lead-fast-branding {\n background: rgba(0, 0, 0, 0.6);\n }\n\n [data-theme="cyberpunk"] .lead-fast-branding {\n background: rgba(0, 20, 36, 0.8);\n }\n\n /* Modal Theming */\n .download-limiter-modal {\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0,0,0,0.5);\n z-index: 9999;\n align-items: center;\n justify-content: center;\n }\n .download-limiter-modal.show { display: flex; }\n\n .download-limiter-content {\n background: #faf7f5 !important;\n color: #291334 !important;\n padding: 2rem;\n border-radius: 12px;\n max-width: 400px;\n text-align: center;\n box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);\n border: 1px solid #e7e2df !important;\n font-family: system-ui, -apple-system, sans-serif;\n }\n\n [data-theme="dark"] .download-limiter-content {\n background: #1f2937 !important;\n color: #f9fafb !important;\n border-color: #374151 !important;\n }\n\n [data-theme="cyberpunk"] .download-limiter-content {\n background: #001424 !important;\n color: #0ea5e9 !important;\n border-color: #075985 !important;\n }\n\n [data-theme="valentine"] .download-limiter-content {\n background: rgba(233, 30, 122, 0.05) !important;\n color: #831843 !important;\n border-color: #e91e7a !important;\n }\n\n [data-theme="bumblebee"] .download-limiter-content {\n background: rgba(255, 248, 220, 0.95) !important;\n color: #1c1917 !important;\n border-color: rgba(254, 215, 170, 0.8) !important;\n }\n\n [data-theme="garden"] .download-limiter-content {\n background: rgba(240, 253, 244, 0.95) !important;\n color: #14532d !important;\n border-color: rgba(134, 239, 172, 0.8) !important;\n }\n\n [data-theme="emerald"] .download-limiter-content {\n background: rgba(236, 253, 245, 0.95) !important;\n color: #065f46 !important;\n border-color: rgba(167, 243, 208, 0.8) !important;\n }\n\n [data-theme="corporate"] .download-limiter-content {\n background: rgba(248, 250, 252, 0.95) !important;\n color: #1e293b !important;\n border-color: rgba(226, 232, 240, 0.8) !important;\n }\n\n [data-theme="forest"] .download-limiter-content {\n background: rgba(23, 46, 23, 0.95) !important;\n color: #22c55e !important;\n border-color: rgba(34, 197, 94, 0.8) !important;\n }\n\n [data-theme="halloween"] .download-limiter-content {\n background: rgba(26, 26, 26, 0.95) !important;\n color: #ff6500 !important;\n border-color: rgba(255, 165, 0, 0.3) !important;\n }\n\n [data-theme="synthwave"] .download-limiter-content {\n background: rgba(32, 20, 64, 0.95) !important;\n color: #ba55d3 !important;\n border-color: rgba(186, 85, 211, 0.3) !important;\n }\n\n [data-theme="dracula"] .download-limiter-content {\n background: rgba(40, 42, 54, 0.95) !important;\n color: #f8f8f2 !important;\n border-color: rgba(98, 114, 164, 0.3) !important;\n }\n\n [data-theme="luxury"] .download-limiter-content {\n background: rgba(9, 9, 11, 0.95) !important;\n color: #d4af37 !important;\n border-color: rgba(212, 175, 55, 0.3) !important;\n }\n\n [data-theme="night"] .download-limiter-content {\n background: rgba(15, 23, 42, 0.95) !important;\n color: #1e40af !important;\n border-color: rgba(30, 58, 138, 0.3) !important;\n }\n\n [data-theme="light"] .download-limiter-content {\n background: rgba(255, 255, 255, 0.95) !important;\n color: #1f2937 !important;\n border-color: rgba(229, 231, 235, 0.8) !important;\n }\n\n [data-theme="cupcake"] .download-limiter-content {\n background: rgba(250, 235, 215, 0.95) !important;\n color: #8b4513 !important;\n border-color: rgba(219, 185, 156, 0.8) !important;\n }\n\n [data-theme="retro"] .download-limiter-content {\n background: rgba(212, 165, 116, 0.95) !important;\n color: #5d4037 !important;\n border-color: rgba(185, 144, 102, 0.8) !important;\n }\n\n [data-theme="aqua"] .download-limiter-content {\n background: rgba(240, 253, 250, 0.95) !important;\n color: #155e75 !important;\n border-color: rgba(125, 211, 252, 0.8) !important;\n }\n\n [data-theme="lofi"] .download-limiter-content {\n background: rgba(248, 248, 248, 0.95) !important;\n color: #1a1a1a !important;\n border-color: rgba(68, 68, 68, 0.8) !important;\n }\n\n [data-theme="pastel"] .download-limiter-content {\n background: rgba(254, 251, 255, 0.95) !important;\n color: #7c3aed !important;\n border-color: rgba(209, 196, 233, 0.8) !important;\n }\n\n [data-theme="fantasy"] .download-limiter-content {\n background: rgba(255, 247, 237, 0.95) !important;\n color: #be185d !important;\n border-color: rgba(249, 168, 212, 0.8) !important;\n }\n\n [data-theme="wireframe"] .download-limiter-content {\n background: rgba(255, 255, 255, 0.95) !important;\n color: #000000 !important;\n border-color: rgba(0, 0, 0, 0.3) !important;\n }\n\n [data-theme="black"] .download-limiter-content {\n background: rgba(0, 0, 0, 0.95) !important;\n color: #ffffff !important;\n border-color: rgba(55, 55, 55, 0.8) !important;\n }\n\n [data-theme="cmyk"] .download-limiter-content {\n background: rgba(0, 255, 255, 0.95) !important;\n color: #000000 !important;\n border-color: rgba(255, 0, 255, 0.8) !important;\n }\n\n [data-theme="autumn"] .download-limiter-content {\n background: rgba(139, 69, 19, 0.95) !important;\n color: #ff8c00 !important;\n border-color: rgba(255, 140, 0, 0.8) !important;\n }\n\n [data-theme="business"] .download-limiter-content {\n background: rgba(29, 78, 216, 0.95) !important;\n color: #3b82f6 !important;\n border-color: rgba(59, 130, 246, 0.8) !important;\n }\n\n [data-theme="acid"] .download-limiter-content {\n background: rgba(255, 255, 0, 0.95) !important;\n color: #000000 !important;\n border-color: rgba(255, 0, 255, 0.8) !important;\n }\n\n [data-theme="lemonade"] .download-limiter-content {\n background: rgba(255, 255, 224, 0.95) !important;\n color: #15803d !important;\n border-color: rgba(34, 197, 94, 0.8) !important;\n }\n\n [data-theme="coffee"] .download-limiter-content {\n background: rgba(101, 67, 33, 0.95) !important;\n color: #d2b48c !important;\n border-color: rgba(160, 82, 45, 0.8) !important;\n }\n\n [data-theme="winter"] .download-limiter-content {\n background: rgba(248, 250, 252, 0.95) !important;\n color: #1e40af !important;\n border-color: rgba(59, 130, 246, 0.8) !important;\n }\n\n .download-limiter-content h2 {\n color: inherit !important;\n margin: 0 0 1rem 0;\n font-size: 1.5rem;\n font-weight: 600;\n }\n .download-limiter-content p {\n color: inherit !important;\n margin: 0 0 1.5rem 0;\n line-height: 1.6;\n }\n .download-limiter-signin-btn {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n background: #65c3c8 !important;\n color: #291334 !important;\n border: none;\n padding: 12px 20px;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n text-decoration: none;\n transition: all 0.2s;\n box-shadow: 0 2px 4px rgba(0,0,0,0.1);\n }\n\n [data-theme="dark"] .download-limiter-signin-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cyberpunk"] .download-limiter-signin-btn {\n background: #f59e0b !important;\n color: #000000 !important;\n }\n\n [data-theme="valentine"] .download-limiter-signin-btn {\n background: #e91e7a !important;\n color: #ffffff !important;\n }\n\n [data-theme="bumblebee"] .download-limiter-signin-btn {\n background: #fbbf24 !important;\n color: #1c1917 !important;\n }\n\n [data-theme="garden"] .download-limiter-signin-btn {\n background: #22c55e !important;\n color: #ffffff !important;\n }\n\n [data-theme="emerald"] .download-limiter-signin-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="corporate"] .download-limiter-signin-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="forest"] .download-limiter-signin-btn {\n background: #22c55e !important;\n color: #1a1a1a !important;\n }\n\n [data-theme="halloween"] .download-limiter-signin-btn {\n background: #ff6500 !important;\n color: #1a1a1a !important;\n }\n\n [data-theme="synthwave"] .download-limiter-signin-btn {\n background: #ba55d3 !important;\n color: #201040 !important;\n }\n\n [data-theme="dracula"] .download-limiter-signin-btn {\n background: #8be9fd !important;\n color: #282a36 !important;\n }\n\n [data-theme="luxury"] .download-limiter-signin-btn {\n background: #d4af37 !important;\n color: #09090b !important;\n }\n\n [data-theme="night"] .download-limiter-signin-btn {\n background: #1e40af !important;\n color: #ffffff !important;\n }\n\n [data-theme="light"] .download-limiter-signin-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cupcake"] .download-limiter-signin-btn {\n background: #8b4513 !important;\n color: #ffffff !important;\n }\n\n [data-theme="retro"] .download-limiter-signin-btn {\n background: #d4a574 !important;\n color: #ffffff !important;\n }\n\n [data-theme="aqua"] .download-limiter-signin-btn {\n background: #0891b2 !important;\n color: #ffffff !important;\n }\n\n [data-theme="lofi"] .download-limiter-signin-btn {\n background: #1a1a1a !important;\n color: #ffffff !important;\n }\n\n [data-theme="pastel"] .download-limiter-signin-btn {\n background: #7c3aed !important;\n color: #ffffff !important;\n }\n\n [data-theme="fantasy"] .download-limiter-signin-btn {\n background: #be185d !important;\n color: #ffffff !important;\n }\n\n [data-theme="wireframe"] .download-limiter-signin-btn {\n background: #dfdfdf !important;\n color: #000000 !important;\n border: 1px solid #000000 !important;\n }\n\n [data-theme="black"] .download-limiter-signin-btn {\n background: #ffffff !important;\n color: #000000 !important;\n }\n\n [data-theme="cmyk"] .download-limiter-signin-btn {\n background: #ff00ff !important;\n color: #000000 !important;\n }\n\n [data-theme="autumn"] .download-limiter-signin-btn {\n background: #ff8c00 !important;\n color: #ffffff !important;\n }\n\n [data-theme="business"] .download-limiter-signin-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="acid"] .download-limiter-signin-btn {\n background: #ff00ff !important;\n color: #000000 !important;\n }\n\n [data-theme="lemonade"] .download-limiter-signin-btn {\n background: #22c55e !important;\n color: #ffffff !important;\n }\n\n [data-theme="coffee"] .download-limiter-signin-btn {\n background: #a0522d !important;\n color: #ffffff !important;\n }\n\n [data-theme="winter"] .download-limiter-signin-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n .download-limiter-signin-btn:hover {\n opacity: 0.9;\n transform: translateY(-1px);\n box-shadow: 0 4px 8px rgba(0,0,0,0.15);\n }\n\n /* Upgrade Button Styles for All Themes */\n [data-theme="dark"] .upgrade-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cyberpunk"] .upgrade-btn {\n background: #ff073a !important;\n color: #ffffff !important;\n }\n\n [data-theme="valentine"] .upgrade-btn {\n background: #e91e7a !important;\n color: #ffffff !important;\n }\n\n [data-theme="bumblebee"] .upgrade-btn {\n background: #f59e0b !important;\n color: #ffffff !important;\n }\n\n [data-theme="garden"] .upgrade-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="emerald"] .upgrade-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="corporate"] .upgrade-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="forest"] .upgrade-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="halloween"] .upgrade-btn {\n background: #ff7b00 !important;\n color: #000000 !important;\n }\n\n [data-theme="synthwave"] .upgrade-btn {\n background: #e879f9 !important;\n color: #ffffff !important;\n }\n\n [data-theme="dracula"] .upgrade-btn {\n background: #bd93f9 !important;\n color: #ffffff !important;\n }\n\n [data-theme="luxury"] .upgrade-btn {\n background: #d4af37 !important;\n color: #000000 !important;\n }\n\n [data-theme="night"] .upgrade-btn {\n background: #38bdf8 !important;\n color: #ffffff !important;\n }\n\n [data-theme="light"] .upgrade-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cupcake"] .upgrade-btn {\n background: #f472b6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="retro"] .upgrade-btn {\n background: #d4a574 !important;\n color: #ffffff !important;\n }\n\n [data-theme="aqua"] .upgrade-btn {\n background: #06b6d4 !important;\n color: #ffffff !important;\n }\n\n [data-theme="lofi"] .upgrade-btn {\n background: #a3a3a3 !important;\n color: #000000 !important;\n }\n\n [data-theme="pastel"] .upgrade-btn {\n background: #a78bfa !important;\n color: #ffffff !important;\n }\n\n [data-theme="fantasy"] .upgrade-btn {\n background: #f472b6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="wireframe"] .upgrade-btn {\n background: #dfdfdf !important;\n color: #000000 !important;\n border: 1px solid #000000 !important;\n }\n\n [data-theme="black"] .upgrade-btn {\n background: #ffffff !important;\n color: #000000 !important;\n }\n\n [data-theme="cmyk"] .upgrade-btn {\n background: #0891b2 !important;\n color: #ffffff !important;\n }\n\n [data-theme="autumn"] .upgrade-btn {\n background: #d97706 !important;\n color: #ffffff !important;\n }\n\n [data-theme="business"] .upgrade-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="acid"] .upgrade-btn {\n background: #84cc16 !important;\n color: #000000 !important;\n }\n\n [data-theme="lemonade"] .upgrade-btn {\n background: #22c55e !important;\n color: #ffffff !important;\n }\n\n [data-theme="coffee"] .upgrade-btn {\n background: #a0522d !important;\n color: #ffffff !important;\n }\n\n [data-theme="winter"] .upgrade-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n\n /* Cancel Button Styles for All Themes */\n [data-theme="dark"] .cancel-btn {\n background: #4b5563 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cyberpunk"] .cancel-btn {\n background: #7e22ce !important;\n color: #ffffff !important;\n }\n\n [data-theme="valentine"] .cancel-btn {\n background: #c11560 !important;\n color: #ffffff !important;\n }\n\n [data-theme="bumblebee"] .cancel-btn {\n background: #d97706 !important;\n color: #ffffff !important;\n }\n\n [data-theme="garden"] .cancel-btn {\n background: #059669 !important;\n color: #ffffff !important;\n }\n\n [data-theme="emerald"] .cancel-btn {\n background: #059669 !important;\n color: #ffffff !important;\n }\n\n [data-theme="corporate"] .cancel-btn {\n background: #6b7280 !important;\n color: #ffffff !important;\n }\n\n [data-theme="forest"] .cancel-btn {\n background: #059669 !important;\n color: #ffffff !important;\n }\n\n [data-theme="halloween"] .cancel-btn {\n background: #7c3aed !important;\n color: #ffffff !important;\n }\n\n [data-theme="synthwave"] .cancel-btn {\n background: #7e22ce !important;\n color: #ffffff !important;\n }\n\n [data-theme="dracula"] .cancel-btn {\n background: #6272a4 !important;\n color: #ffffff !important;\n }\n\n [data-theme="luxury"] .cancel-btn {\n background: #8b5cf6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="night"] .cancel-btn {\n background: #0284c7 !important;\n color: #ffffff !important;\n }\n\n [data-theme="light"] .cancel-btn {\n background: #6b7280 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cupcake"] .cancel-btn {\n background: #ec4899 !important;\n color: #ffffff !important;\n }\n\n [data-theme="retro"] .cancel-btn {\n background: #b8925c !important;\n color: #ffffff !important;\n }\n\n [data-theme="aqua"] .cancel-btn {\n background: #0891b2 !important;\n color: #ffffff !important;\n }\n\n [data-theme="lofi"] .cancel-btn {\n background: #6b7280 !important;\n color: #ffffff !important;\n }\n\n [data-theme="pastel"] .cancel-btn {\n background: #8b5cf6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="fantasy"] .cancel-btn {\n background: #ec4899 !important;\n color: #ffffff !important;\n }\n\n [data-theme="wireframe"] .cancel-btn {\n background: #f5f5f5 !important;\n color: #000000 !important;\n border: 1px solid #000000 !important;\n }\n\n [data-theme="black"] .cancel-btn {\n background: #6b7280 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cmyk"] .cancel-btn {\n background: #0369a1 !important;\n color: #ffffff !important;\n }\n\n [data-theme="autumn"] .cancel-btn {\n background: #c2410c !important;\n color: #ffffff !important;\n }\n\n [data-theme="business"] .cancel-btn {\n background: #6b7280 !important;\n color: #ffffff !important;\n }\n\n [data-theme="acid"] .cancel-btn {\n background: #65a30d !important;\n color: #ffffff !important;\n }\n\n [data-theme="lemonade"] .cancel-btn {\n background: #16a34a !important;\n color: #ffffff !important;\n }\n\n [data-theme="coffee"] .cancel-btn {\n background: #8b4513 !important;\n color: #ffffff !important;\n }\n\n [data-theme="winter"] .cancel-btn {\n background: #1e40af !important;\n color: #ffffff !important;\n }\n\n /* Success Button Styles for All Themes */\n [data-theme="dark"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cyberpunk"] .success-btn {\n background: #00ff41 !important;\n color: #000000 !important;\n }\n\n [data-theme="valentine"] .success-btn {\n background: #e91e7a !important;\n color: #ffffff !important;\n }\n\n [data-theme="bumblebee"] .success-btn {\n background: #f59e0b !important;\n color: #ffffff !important;\n }\n\n [data-theme="garden"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="emerald"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="corporate"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="forest"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="halloween"] .success-btn {\n background: #ff7b00 !important;\n color: #000000 !important;\n }\n\n [data-theme="synthwave"] .success-btn {\n background: #00ff41 !important;\n color: #000000 !important;\n }\n\n [data-theme="dracula"] .success-btn {\n background: #50fa7b !important;\n color: #000000 !important;\n }\n\n [data-theme="luxury"] .success-btn {\n background: #d4af37 !important;\n color: #000000 !important;\n }\n\n [data-theme="night"] .success-btn {\n background: #22d3ee !important;\n color: #ffffff !important;\n }\n\n [data-theme="light"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cupcake"] .success-btn {\n background: #f472b6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="retro"] .success-btn {\n background: #d4a574 !important;\n color: #ffffff !important;\n }\n\n [data-theme="aqua"] .success-btn {\n background: #06b6d4 !important;\n color: #ffffff !important;\n }\n\n [data-theme="lofi"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="pastel"] .success-btn {\n background: #34d399 !important;\n color: #ffffff !important;\n }\n\n [data-theme="fantasy"] .success-btn {\n background: #f472b6 !important;\n color: #ffffff !important;\n }\n\n [data-theme="wireframe"] .success-btn {\n background: #dfdfdf !important;\n color: #000000 !important;\n border: 1px solid #000000 !important;\n }\n\n [data-theme="black"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="cmyk"] .success-btn {\n background: #06b6d4 !important;\n color: #ffffff !important;\n }\n\n [data-theme="autumn"] .success-btn {\n background: #d97706 !important;\n color: #ffffff !important;\n }\n\n [data-theme="business"] .success-btn {\n background: #10b981 !important;\n color: #ffffff !important;\n }\n\n [data-theme="acid"] .success-btn {\n background: #84cc16 !important;\n color: #000000 !important;\n }\n\n [data-theme="lemonade"] .success-btn {\n background: #22c55e !important;\n color: #ffffff !important;\n }\n\n [data-theme="coffee"] .success-btn {\n background: #a0522d !important;\n color: #ffffff !important;\n }\n\n [data-theme="winter"] .success-btn {\n background: #3b82f6 !important;\n color: #ffffff !important;\n }\n .download-limiter-signout-btn {\n background: #dc3545;\n color: white;\n border: none;\n padding: 6px 12px;\n border-radius: 4px;\n font-size: 12px;\n cursor: pointer;\n margin-left: 8px;\n }\n .download-limiter-premium-badge {\n background: linear-gradient(45deg, #f39c12, #e74c3c);\n color: white;\n padding: 2px 6px;\n border-radius: 3px;\n font-size: 10px;\n margin-left: 8px;\n font-weight: bold;\n }\n .download-limiter-btn-premium {\n opacity: 0.7;\n }\n .download-limiter-success-modal {\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0,0,0,0.5);\n z-index: 10000;\n align-items: center;\n justify-content: center;\n }\n .download-limiter-success-modal.show { display: flex; }\n .download-limiter-success-content {\n background: white;\n padding: 2rem;\n border-radius: 8px;\n max-width: 400px;\n text-align: center;\n box-shadow: 0 4px 20px rgba(0,0,0,0.15);\n border-left: 4px solid #38a169;\n }\n\n /* Single upgrade flow styles */\n .single-upgrade-container {\n margin: 20px 0;\n text-align: center;\n }\n\n .single-upgrade-content .upgrade-btn {\n background: linear-gradient(135deg, #059669, #0d9488) !important;\n color: white !important;\n border: none !important;\n padding: 16px 32px !important;\n border-radius: 12px !important;\n font-size: 18px !important;\n font-weight: 600 !important;\n cursor: pointer !important;\n transition: all 0.3s ease !important;\n box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3) !important;\n margin-bottom: 16px !important;\n min-width: 200px !important;\n }\n\n .single-upgrade-content .upgrade-btn:hover {\n background: linear-gradient(135deg, #047857, #0f766e) !important;\n transform: translateY(-2px) !important;\n box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4) !important;\n }\n\n .single-upgrade-content .upgrade-description {\n font-size: 14px !important;\n color: #6b7280 !important;\n margin: 12px 0 0 0 !important;\n line-height: 1.5 !important;\n max-width: 300px !important;\n margin-left: auto !important;\n margin-right: auto !important;\n }\n\n /* Anonymous user usage count styles */\n .lead-fast-anonymous-status {\n display: flex;\n align-items: center;\n gap: 12px;\n }\n\n .lead-fast-anonymous-status .lead-fast-count {\n background: rgba(59, 130, 246, 0.1);\n color: #1d4ed8;\n padding: 6px 12px;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n border: 1px solid rgba(59, 130, 246, 0.2);\n }\n\n /* Success button theming */\n .download-limiter-btn.success-btn {\n background: #059669 !important;\n color: white !important;\n border: none !important;\n padding: 12px 24px !important;\n border-radius: 8px !important;\n cursor: pointer !important;\n margin-top: 20px !important;\n font-size: 16px !important;\n font-weight: 500 !important;\n transition: all 0.2s ease !important;\n }\n\n .download-limiter-btn.success-btn:hover {\n background: #047857 !important;\n transform: translateY(-1px) !important;\n }\n\n /* Theme-specific success button colors */\n [data-theme="cyberpunk"] .download-limiter-btn.success-btn {\n background: #0ea5e9 !important;\n box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3) !important;\n }\n\n [data-theme="cyberpunk"] .download-limiter-btn.success-btn:hover {\n background: #0284c7 !important;\n }\n\n [data-theme="valentine"] .download-limiter-btn.success-btn {\n background: #be185d !important;\n }\n\n [data-theme="valentine"] .download-limiter-btn.success-btn:hover {\n background: #9d174d !important;\n }\n\n [data-theme="bumblebee"] .download-limiter-btn.success-btn {\n background: #f59e0b !important;\n }\n\n [data-theme="bumblebee"] .download-limiter-btn.success-btn:hover {\n background: #d97706 !important;\n }\n\n [data-theme="garden"] .download-limiter-btn.success-btn {\n background: #16a34a !important;\n }\n\n [data-theme="garden"] .download-limiter-btn.success-btn:hover {\n background: #15803d !important;\n }\n\n /* Google Sign-in button theming */\n .download-limiter-btn.google-signin-btn {\n background: #4285f4 !important;\n color: white !important;\n border: none !important;\n padding: 12px 24px !important;\n border-radius: 8px !important;\n cursor: pointer !important;\n margin-right: 10px !important;\n display: inline-flex !important;\n align-items: center !important;\n gap: 8px !important;\n font-size: 14px !important;\n font-weight: 500 !important;\n transition: all 0.2s ease !important;\n }\n\n .download-limiter-btn.google-signin-btn:hover {\n background: #3367d6 !important;\n transform: translateY(-1px) !important;\n }\n\n /* Upgrade button theming */\n .download-limiter-btn.upgrade-btn {\n background: #059669 !important;\n color: white !important;\n border: none !important;\n padding: 12px 24px !important;\n border-radius: 8px !important;\n cursor: pointer !important;\n margin-right: 10px !important;\n font-size: 16px !important;\n font-weight: 500 !important;\n transition: all 0.2s ease !important;\n }\n\n .download-limiter-btn.upgrade-btn:hover {\n background: #047857 !important;\n transform: translateY(-1px) !important;\n }\n\n /* Theme-specific button colors */\n [data-theme="cyberpunk"] .download-limiter-btn.upgrade-btn {\n background: #0ea5e9 !important;\n box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3) !important;\n }\n\n [data-theme="valentine"] .download-limiter-btn.upgrade-btn {\n background: #be185d !important;\n }\n\n [data-theme="bumblebee"] .download-limiter-btn.upgrade-btn {\n background: #f59e0b !important;\n }\n\n [data-theme="garden"] .download-limiter-btn.upgrade-btn {\n background: #16a34a !important;\n }\n\n /* Cancel button container and styling - positioned at very bottom */\n .download-limiter-cancel-container {\n margin-top: 30px !important;\n padding-top: 20px !important;\n border-top: 1px solid rgba(0, 0, 0, 0.1) !important;\n text-align: center !important;\n position: relative !important;\n bottom: 0 !important;\n }\n\n .download-limiter-btn.cancel-btn {\n background: transparent !important;\n color: #6b7280 !important;\n border: none !important;\n padding: 8px 16px !important;\n border-radius: 6px !important;\n cursor: pointer !important;\n font-size: 13px !important;\n font-weight: 400 !important;\n transition: all 0.2s ease !important;\n text-decoration: underline !important;\n margin: 0 auto !important;\n display: block !important;\n }\n\n .download-limiter-btn.cancel-btn:hover {\n color: #374151 !important;\n background: rgba(107, 114, 128, 0.1) !important;\n text-decoration: none !important;\n }\n\n /* Theme-specific cancel button border */\n [data-theme="dark"] .download-limiter-cancel-container {\n border-top-color: rgba(255, 255, 255, 0.1) !important;\n }\n\n [data-theme="dark"] .download-limiter-btn.cancel-btn {\n color: #9ca3af !important;\n }\n\n [data-theme="dark"] .download-limiter-btn.cancel-btn:hover {\n color: #d1d5db !important;\n background: rgba(156, 163, 175, 0.1) !important;\n }\n\n [data-theme="cyberpunk"] .download-limiter-cancel-container {\n border-top-color: rgba(14, 165, 233, 0.2) !important;\n }\n\n [data-theme="cyberpunk"] .download-limiter-btn.cancel-btn {\n color: #0ea5e9 !important;\n }\n\n [data-theme="cyberpunk"] .download-limiter-btn.cancel-btn:hover {\n color: #38bdf8 !important;\n background: rgba(14, 165, 233, 0.1) !important;\n }\n `,document.head.appendChild(n)}injectDaisyUI(){if(document.querySelector('link[href*="daisyui"]')){if(this.config.theme?.name){const n=this.config.theme.name.toLowerCase();document.documentElement.setAttribute("data-theme",n)}}else if(this.config.theme?.name){const n=this.config.theme.name.toLowerCase();document.documentElement.setAttribute("data-theme",n),this.updateStatusDisplays()}}createPaywallModal(){if(document.getElementById("download-limiter-paywall"))return;const n=document.createElement("div");n.id="download-limiter-paywall",n.className="download-limiter-modal",n.innerHTML='\n <div class="download-limiter-content">\n <h3 id="download-limiter-paywall-title">Usage Limit Reached</h3>\n <p id="download-limiter-paywall-subtitle">You\'ve used all your free attempts. Upgrade to premium for unlimited usage!</p>\n\n \x3c!-- Auth Section (shows when not signed in) --\x3e\n <div id="download-limiter-auth-section" style="margin: 20px 0;">\n <p>Sign in to continue or upgrade to premium</p>\n <button id="download-limiter-signin-btn" class="download-limiter-btn google-signin-btn">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none">\n <path d="M16.51 8H8.98v3h4.3c-.18 1-.74 1.48-1.6 2.04v2.01h2.6a8.8 8.8 0 0 0 2.38-5.88c0-.57-.05-.66-.15-1.18z" fill="white"/>\n <path d="M8.98 17c2.16 0 3.97-.72 5.3-1.94l-2.6-2.04a4.8 4.8 0 0 1-2.7.75 4.8 4.8 0 0 1-4.52-3.4H1.83v2.07A8 8 0 0 0 8.98 17z" fill="white"/>\n <path d="M4.46 10.37a4.8 4.8 0 0 1-.25-1.37c0-.48.09-.94.25-1.37V5.56H1.83a8 8 0 0 0 0 6.88l2.63-2.07z" fill="white"/>\n <path d="M8.98 3.77c1.32 0 2.5.45 3.44 1.35l2.58-2.58C13.94.64 11.66 0 8.98 0A8 8 0 0 0 1.83 5.56l2.63 2.07c.61-1.8 2.26-3.86 4.52-3.86z" fill="white"/>\n </svg>\n Sign in with Google\n </button>\n </div>\n\n \x3c!-- Payment Section (shows when signed in) --\x3e\n <div id="download-limiter-payment-section" style="margin: 20px 0; display: none;">\n <button id="download-limiter-upgrade-btn" class="download-limiter-btn upgrade-btn">\n Upgrade to Premium\n </button>\n </div>\n\n <div class="download-limiter-cancel-container">\n <button id="download-limiter-close-btn" class="download-limiter-btn cancel-btn">\n Cancel\n </button>\n </div>\n </div>\n ',document.body.appendChild(n),n.querySelector("#download-limiter-signin-btn").addEventListener("click",async()=>{await this.signIn()}),n.querySelector("#download-limiter-upgrade-btn").addEventListener("click",async()=>{const n=await this.createPayment();n?.checkout_url&&(window.location.href=n.checkout_url)}),n.querySelector("#download-limiter-close-btn").addEventListener("click",()=>{this.config.options?.debug&&(console.log("🔍 DEBUG: Cancel button clicked"),console.log("🔍 DEBUG: this.config.feedback:",this.config.feedback),console.log("🔍 DEBUG: this.config.email:",this.config.email),console.log("🔍 DEBUG: Feedback config exists:",!(!this.config.feedback&&!this.config.email))),this.config.feedback||this.config.email?(this.config.options?.debug&&console.log("🔍 DEBUG: Showing feedback form"),this.showFeedbackForm()):(this.config.options?.debug&&console.log("🔍 DEBUG: No email config, just closing modal"),n.classList.remove("show"))})}createSuccessModal(){if(document.getElementById("download-limiter-success"))return;const n=document.createElement("div");n.id="download-limiter-success",n.className="download-limiter-modal",n.innerHTML='\n <div class="download-limiter-content"> \x3c!-- Use same content class as paywall for theming --\x3e\n <h3 id="download-limiter-success-title">Action Started!</h3>\n <p id="download-limiter-success-message">Your action completed successfully!</p>\n <button id="download-limiter-success-close" class="download-limiter-btn success-btn">\n OK\n </button>\n </div>\n ',document.body.appendChild(n),n.querySelector("#download-limiter-success-close").addEventListener("click",()=>{n.classList.remove("show")}),n.addEventListener("click",t=>{t.target===n&&n.classList.remove("show")})}showFeedbackForm(){const n=document.getElementById("download-limiter-paywall");n&&n.classList.remove("show"),this.createFeedbackModal();const t=document.getElementById("download-limiter-feedback");t&&t.classList.add("show")}createFeedbackModal(){if(document.getElementById("download-limiter-feedback"))return void(this.config.options?.debug&&console.log("🔍 DEBUG: Feedback modal already exists"));const n=this.config.feedback||(this.config.email?{form:{title:"Quick Feedback",description:"Why didn't you upgrade?",option1:"Not useful for my needs",option2:"Didn't find what I was looking for",option3:"Just trying it out"},email:this.config.email}:null);if(this.config.options?.debug&&(console.log("🔍 DEBUG: Feedback config:",n),console.log("🔍 DEBUG: this.config.feedback:",this.config.feedback),console.log("🔍 DEBUG: this.config.email:",this.config.email)),!n)return void(this.config.options?.debug&&console.log("🔍 DEBUG: No feedback config found, not creating modal"));const t=document.createElement("div");t.id="download-limiter-feedback",t.className="download-limiter-modal",t.innerHTML=`\n <div class="download-limiter-content">\n <h3>${n.form.title}</h3>\n <p style="margin-bottom: 20px;">${n.form.description}</p>\n\n <form id="feedback-form" style="text-align: left;">\n <div style="margin-bottom: 15px;">\n <label style="display: block; margin-bottom: 8px;">\n <input type="radio" name="reason" value="option1" style="margin-right: 8px;">\n ${n.form.option1}\n </label>\n <label style="display: block; margin-bottom: 8px;">\n <input type="radio" name="reason" value="option2" style="margin-right: 8px;">\n ${n.form.option2}\n </label>\n <label style="display: block; margin-bottom: 8px;">\n <input type="radio" name="reason" value="option3" style="margin-right: 8px;">\n ${n.form.option3}\n </label>\n </div>\n\n <div style="margin-bottom: 15px;">\n <label for="feedback-details" style="display: block; margin-bottom: 5px;">Tell us more:</label>\n <textarea\n id="feedback-details"\n name="details"\n rows="3"\n style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;"\n placeholder="Your feedback helps us improve..." maxlength="200"></textarea>\n </div>\n\n <div style="margin-bottom: 20px;">\n <label for="feedback-email" style="display: block; margin-bottom: 5px;">\n Email (optional):\n </label>\n <input\n type="email"\n id="feedback-email"\n name="email"\n style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;"\n placeholder="your@email.com">\n <small style="color: #666; display: block; margin-top: 4px;">\n Only if you want us to reach out about what you mentioned above. We don't follow up unless you want us to\n </small>\n </div>\n\n \n <div style="text-align: center;">\n <button type="submit" class="download-limiter-btn success-btn" style="margin-right: 10px;">\n Submit Feedback\n </button>\n <button type="button" id="feedback-skip-btn" class="download-limiter-btn cancel-btn">\n Skip\n </button>\n </div>\n </form>\n </div>\n `,document.body.appendChild(t),this.config.options?.debug&&console.log("🔍 DEBUG: Feedback modal created and added to DOM");const e=t.querySelector("#feedback-form");e.addEventListener("submit",n=>{n.preventDefault(),this.submitFeedback(e)}),t.querySelector("#feedback-skip-btn").addEventListener("click",()=>{t.classList.remove("show")}),t.addEventListener("click",n=>{n.target===t&&t.classList.remove("show")})}async submitFeedback(n){const t=new FormData(n),e=t.get("reason"),a=t.get("details"),o=t.get("email");if(!e)return void alert("Please select a reason");const r={reason:e,details:a,email:o||void 0,timestamp:(new Date).toISOString(),userAgent:navigator.userAgent,appId:this.config.appId};try{await this.sendFeedbackEmail(r);const n=document.getElementById("download-limiter-feedback");n&&n.classList.remove("show"),alert("Thank you for your feedback!")}catch(n){console.error("Failed to send feedback:",n),alert("Failed to send feedback. Please try again.")}}async sendFeedbackEmail(n){let t;if(this.config.feedback?.email?t=Array.isArray(this.config.feedback.email)?this.config.feedback.email[0]:this.config.feedback.email:this.config.email&&(t={provider:"resend",apiKey:this.config.email.resendApiKey,fromEmail:this.config.email.fromEmail}),!t)throw new Error("Email configuration not available");const e=`\nNew Feedback from ${this.config.appId}\n\nReason: ${n.reason}\nDetails: ${n.details}\nUser Email: ${n.email||"Not provided"}\nTimestamp: ${n.timestamp}\nUser Agent: ${n.userAgent}\n `.trim();let a;if("resend"!==t.provider&&t.provider)throw new Error(`Unsupported email provider: ${t.provider}`);if(a=await fetch("https://api.resend.com/emails",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.apiKey||t.resendApiKey}`},body:JSON.stringify({from:t.fromEmail,to:[t.fromEmail],subject:`Feedback from ${this.config.appId}`,text:e})}),!a.ok)throw new Error(`Email API error: ${a.status}`)}createAuthUI(){if(document.getElementById("lead-fast-profile"))return;const n=document.createElement("div");n.id="lead-fast-profile",n.className="lead-fast-profile",document.body.appendChild(n)}createStatusDisplay(){if(document.getElementById("download-limiter-status"))return;const n=document.createElement("div");n.id="download-limiter-status",n.className="download-limiter-status",document.body.appendChild(n)}createGlobalStatusDisplay(){this.createStatusDisplay()}showPaywallInstant(n){this.createPaywallModal();const t=document.getElementById("download-limiter-paywall");if(t){const e=t.querySelector("#download-limiter-paywall-title");e&&(e.textContent=`You've used ${n.limit} free attempts`);const a=t.querySelector("#download-limiter-auth-section"),o=t.querySelector("#download-limiter-payment-section");if(this.currentUser)a.style.display="none",o.style.display="block";else{const n=t.querySelector("#download-limiter-paywall-subtitle");n&&(n.textContent="Sign in to continue. If you're already premium, you'll get unlimited access. New users can upgrade after signing in."),a.style.display="none",o.style.display="none",this.showSingleUpgradeFlow(t)}t.classList.add("show")}}async showPaywall(){const n=await this.getDownloadStatus();this.showPaywallInstant(n)}showSingleUpgradeFlow(n){let t=n.querySelector(".single-upgrade-container");if(!t){t=document.createElement("div"),t.className="single-upgrade-container",t.innerHTML='\n <div class="single-upgrade-content">\n <button class="download-limiter-btn upgrade-btn" id="single-upgrade-btn">\n Continue with Google\n </button>\n \x3c!--<p class="upgrade-description">\n Sign in to restore access. Premium members get unlimited usage immediately.\n </p>--\x3e\n </div>\n ';const e=n.querySelector(".download-limiter-cancel-container");e?n.querySelector(".download-limiter-content")?.insertBefore(t,e):n.querySelector(".download-limiter-content")?.appendChild(t)}t.style.display="block";const e=n.querySelector("#single-upgrade-btn");if(e){e.replaceWith(e.cloneNode(!0));const t=n.querySelector("#single-upgrade-btn");t?.addEventListener("click",async()=>{try{const{error:n}=await this.supabase.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${window.location.origin}${window.location.pathname}?upgrade=true`}});n&&(console.error("Sign in error:",n),this.showError("Sign In Failed","Failed to sign in with Google. Please try again."))}catch(n){console.error("Upgrade flow error:",n),this.showError("Upgrade Failed","Failed to start upgrade process. Please try again.")}})}}showSuccess(n,t){const e=document.getElementById("download-limiter-success");if(e){const a=e.querySelector("#download-limiter-success-title"),o=e.querySelector("#download-limiter-success-message");a&&(a.textContent=n),o&&(o.textContent=t),e.classList.add("show")}}showError(n,t){const e=document.createElement("div");e.style.cssText="\n position: fixed;\n top: 20px;\n right: 20px;\n background: #fee2e2;\n border: 1px solid #fecaca;\n color: #dc2626;\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n line-height: 1.4;\n max-width: 300px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);\n z-index: 10000;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n ",e.innerHTML=`\n <div style="font-weight: 600; margin-bottom: 4px;">${n}</div>\n <div style="font-size: 13px; opacity: 0.9;">${t}</div>\n `,document.body.appendChild(e),setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},5e3),e.addEventListener("click",()=>{e.parentNode&&e.parentNode.removeChild(e)})}showConnectionError(){this.showError("Connection Error","Server connection required for download verification. Please check your configuration and try again.")}showPaymentConfigError(){this.showError("Payment Configuration Error","Payment system is not properly configured. Please contact support.")}disableDownloadButtons(n){const t=document.querySelectorAll("[data-leadfast-attached]"),e={connection:"Download disabled: Server connection required",payment:"Download disabled: Payment configuration error"},a={connection:"⚠️ Connection Error - Downloads Disabled",payment:"⚠️ Payment Config Error - Downloads Disabled"};t.forEach(t=>{const a=t;a.disabled=!0,a.style.opacity="0.5",a.style.cursor="not-allowed",a.title=e[n]});const o=document.querySelector(".lead-fast-user-section");o&&(o.innerHTML=`\n <div style="\n color: #ef4444;\n padding: 6px 8px;\n font-size: 12px;\n font-weight: 500;\n line-height: 1.2;\n border-radius: 4px;\n background: rgba(239, 68, 68, 0.05);\n border: 1px solid rgba(239, 68, 68, 0.2);\n max-width: 200px;\n text-align: center;\n ">\n ${a[n]}\n </div>\n `)}async updateStatusDisplays(){if(this.supabaseConnectionFailed)return void this.disableDownloadButtons("connection");if(this.config.payment&&this.paymentConnectionFailed)return void this.disableDownloadButtons("payment");const n=await this.getDownloadStatus();this.updateUserSection(n)}createTitleBar(){let n=document.getElementById("lead-fast-profile");n||(n=document.createElement("div"),n.id="lead-fast-profile",n.className="lead-fast-profile",document.body.appendChild(n));const t=this.config.titleBar||{},e=t.title||"My App",a=t.titleImage,o=t.links||[];n.innerHTML=`\n <div class="lead-fast-title-bar">\n <div class="lead-fast-title-section">\n <a href="#" class="lead-fast-logo">\n ${a?`<img src="${a}" alt="${e}">`:""}\n <span>${e}</span>\n </a>\n <nav class="lead-fast-nav">\n ${o.map(n=>`\n <a href="${n.url}" class="lead-fast-nav-link" ${n.target?`target="${n.target}"`:""}>\n ${n.text}\n </a>\n `).join("")}\n </nav>\n </div>\n\n <div class="lead-fast-user-section" id="lead-fast-user-section">\n \x3c!-- User section will be populated when logged in --\x3e\n </div>\n\n \x3c!-- <a href="https://www.moneyfast.bar" target="_blank" class="lead-fast-branding" style="text-decoration: none; color: inherit;">moneyfast.bar</a>--\x3e\n </div>\n `}updateUserSection(n){const t=document.getElementById("lead-fast-user-section");if(t)if(this.currentUser){const e=this.currentUser.email.charAt(0).toUpperCase(),a=this.currentUser.email,o=n.isPremium?"premium":"free",r=n.isPremium?"Premium":"Free",i=n.isPremium?"Unlimited":`${n.currentCount}/${n.limit}`;t.innerHTML=`\n <div class="lead-fast-avatar">${e}</div>\n <div class="lead-fast-user-info">\n <div class="lead-fast-user-email">${a}</div>\n <div class="lead-fast-user-status">\n <span class="lead-fast-badge ${o}">${r}</span>\n <span class="lead-fast-count">${i}</span>\n </div>\n </div>\n <button class="lead-fast-signout">signout</button>\n `;const s=document.querySelector(".lead-fast-title-bar");s&&getComputedStyle(s);const c=t.querySelector(".lead-fast-signout");c&&c.addEventListener("click",()=>{this.signOut()})}else{const e=`Attempts: ${n.currentCount}/${n.limit}`;t.innerHTML=`\n <div class="lead-fast-anonymous-status">\n <span class="lead-fast-count">${e}</span>\n </div>\n `}}setupUIUpdates(){this.on("authChanged",async()=>{this.cachedStatus=null,this.updateStatusDisplays();const n=document.getElementById("download-limiter-paywall");n&&n.classList.contains("show")&&(this.updatePaywallDisplay(),this.currentUser&&this.config.payment&&setTimeout(async()=>{if(await this.checkPremiumStatus(this.currentUser.email))n.classList.remove("show");else{const n=await this.createPayment();n?.checkout_url&&(window.location.href=n.checkout_url)}},1e3))}),this.on("countChanged",()=>{this.updateStatusDisplays()}),this.updateStatusDisplays()}updatePaywallDisplay(){const n=document.getElementById("download-limiter-paywall");if(!n)return;const t=n.querySelector("#download-limiter-auth-section"),e=n.querySelector("#download-limiter-payment-section");this.currentUser?(t.style.display="none",e.style.display="block"):(t.style.display="block",e.style.display="none")}on(n,t){this.eventListeners.has(n)||this.eventListeners.set(n,[]),this.eventListeners.get(n).push(t)}off(n,t){const e=this.eventListeners.get(n);if(e){const n=e.indexOf(t);n>-1&&e.splice(n,1)}}emit(n,t){const e=this.eventListeners.get(n);e&&e.forEach(e=>{try{e(t)}catch(t){console.error(`Error in ${n} listener:`,t)}})}validateConfig(){if(!this.config.appId)throw new Error("appId is required");if(!this.config.supabase?.url)throw new Error("supabase.url is required");if(!this.config.supabase?.anonKey)throw new Error("supabase.anonKey is required");if("number"!=typeof this.config.freeAttemptLimit||this.config.freeAttemptLimit<0)throw new Error("freeAttemptLimit must be a non-negative number")}async initializeSupabase(){try{this.supabase=t.createClient(this.config.supabase.url,this.config.supabase.anonKey),this.supabaseConnectionFailed=!1}catch(n){console.error("Failed to initialize Supabase:",n),this.supabaseConnectionFailed=!0}}async initializePayment(){if(!this.config.payment)return;const n=this.config.payment.productId;if(!n||!n.startsWith("pdt_")||n.length<10)return this.paymentConnectionFailed=!0,void(this.config.options?.debug&&console.warn("Invalid payment product ID format:",n));this.paymentConnectionFailed=!1}async initializeFingerprint(){try{this.userFingerprint=await this.generateFingerprint()}catch(n){this.userFingerprint=crypto.randomUUID?crypto.randomUUID():String(Date.now()),this.config.options?.debug&&console.warn("Fingerprint generation failed, using fallback:",n)}}async generateFingerprint(){const n=`${navigator.userAgent||""}||${Intl.DateTimeFormat().resolvedOptions().timeZone||""}||${`${screen.width}x${screen.height}`}||${navigator.language||""}`,t=(new TextEncoder).encode(n),e=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(e)).map(n=>n.toString(16).padStart(2,"0")).join("")}async setupAuthListener(){this.supabase.auth.onAuthStateChange(async(n,t)=>{const e=this.currentUser;this.currentUser=t?.user||null;let a=!1;if(this.currentUser){const n=!e||e.email!==this.currentUser.email,t=!this.cachedPremiumStatus||Date.now()-this.premiumStatusCacheTime>this.STATUS_CACHE_DURATION;n||t?(console.log(`🔥 [SUPABASE API] About to call checkPremiumStatus from setupAuthListener (userChanged: ${n}, cacheExpired: ${t})`),a=await this.checkPremiumStatus(this.currentUser.email),this.cachedPremiumStatus=a,this.premiumStatusCacheTime=Date.now()):(a=this.cachedPremiumStatus,console.log(`🔍 [CACHE] Using cached premium status from auth listener: ${a}`))}else this.cachedPremiumStatus=null,this.premiumStatusCacheTime=0;const o="true"===new URLSearchParams(window.location.search).get("upgrade");if("SIGNED_IN"===n&&!e&&this.currentUser&&this.config.payment&&o)if(a){window.history.replaceState({},document.title,window.location.pathname);const n=document.getElementById("download-limiter-paywall");n&&n.classList.remove("show")}else{const n=await this.createPayment();n?.checkout_url&&(window.history.replaceState({},document.title,window.location.pathname),window.location.href=n.checkout_url)}this.emit("authChanged",{user:this.currentUser,isPremium:a})});const{data:{user:n}}=await this.supabase.auth.getUser();this.currentUser=n}async getDownloadCount(){if(!this.userFingerprint)return 0;console.log(`🔥 [SUPABASE API] getDownloadCount called | Time: ${(new Date).toISOString()}`);try{const n=await fetch(`${this.config.supabase.url}/functions/v1/check-download-limit`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.config.supabase.anonKey}`},body:JSON.stringify({fingerprint:this.userFingerprint,app_id:this.config.appId,action:"check"})});if(console.log(`🔥 [SUPABASE API] getDownloadCount response: ${n.status}`),n.ok){const t=await n.json();return this.supabaseConnectionFailed=!1,t.current_count||0}401!==n.status&&403!==n.status||(console.warn(`Supabase authentication failed: ${n.status} - Invalid anon key`),this.supabaseConnectionFailed=!0)}catch(n){this.supabaseConnectionFailed=!0,this.config.options?.debug&&console.warn("Failed to get server usage count, connection failed:",n)}return 0}async incrementDownloadCount(){if(!this.userFingerprint)return 0;const n={fingerprint:this.userFingerprint,app_id:this.config.appId,action:"increment"};console.log(`🔥 [SUPABASE API] incrementDownloadCount called | Time: ${(new Date).toISOString()}`);try{const t=await fetch(`${this.config.supabase.url}/functions/v1/check-download-limit`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.config.supabase.anonKey}`},body:JSON.stringify(n)});if(console.log(`🔥 [SUPABASE API] incrementDownloadCount response: ${t.status}`),this.config.options?.debug&&!t.ok){const n=await t.text();console.error("🔍 DEBUG: Error response:",n)}if(t.ok){const n=await t.json();return this.supabaseConnectionFailed=!1,n.new_count||0}401!==t.status&&403!==t.status||(console.warn(`Supabase authentication failed: ${t.status} - Invalid anon key`),this.supabaseConnectionFailed=!0)}catch(n){this.supabaseConnectionFailed=!0,this.config.options?.debug&&console.warn("Failed to increment server count, connection failed:",n)}return 0}async checkPremiumStatus(n){console.log(`🔥 [SUPABASE API] checkPremiumStatus called for email: ${n} | Time: ${(new Date).toISOString()}`);try{const t=await fetch(`${this.config.supabase.url}/functions/v1/check-payment-status`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.config.supabase.anonKey}`},body:JSON.stringify({email:n,app_id:this.config.appId})});if(console.log(`🔥 [SUPABASE API] checkPremiumStatus response: ${t.status}`),t.ok){return"completed"===(await t.json()).status}}catch(n){this.config.options?.debug&&console.warn("Failed to check premium status:",n)}return!1}getLocalDownloadCount(){const n=`download_count_${this.config.appId}`,t=parseInt(localStorage.getItem(n)||"0",10);return isNaN(t)?0:t}incrementLocalDownloadCount(){const n=`download_count_${this.config.appId}`,t=this.getLocalDownloadCount()+1;return localStorage.setItem(n,String(t)),t}handleError(n){this.config.options?.debug&&console.error("Lead Fast Error:",n),this.config.callbacks?.onError?this.config.callbacks.onError(n):console.error("Lead Fast:",n.message),this.emit("error",n)}async checkPaymentStatus(){"success"===new URLSearchParams(window.location.search).get("payment")&&setTimeout(async()=>{if(this.currentUser){await this.checkPremiumStatus(this.currentUser.email)?this.showSuccess("Payment Successful!","Welcome to premium! You now have unlimited usage."):this.showSuccess("Processing Payment","Payment is being processed. Please refresh in a few moments.")}else this.showSuccess("Processing Payment","Please wait while we verify your payment...");const n=window.location.href.split("?")[0];window.history.replaceState({},document.title,n)},2e3)}},Object.defineProperty(n,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/index.ts"],"sourcesContent":[null],"names":["mergeConfigs","config","windowConfig","window","APP_CONFIG","Error","constructor","this","currentUser","userFingerprint","eventListeners","Map","supabaseConnectionFailed","paymentConnectionFailed","cachedStatus","statusCacheTime","STATUS_CACHE_DURATION","initializationPromise","cachedPremiumStatus","premiumStatusCacheTime","options","validateConfig","initializeSupabase","initializePayment","initializeFingerprint","setupAuthListener","checkPaymentStatus","handleDownload","callbacks","onError","payment","checkPremiumStatus","email","onPremiumDownload","status","getDownloadStatus","currentCount","limit","onLimitReached","incrementDownloadCount","onDownloadAllowed","newStatus","emit","count","setTimeout","error","handleError","forceRefresh","console","log","Date","toISOString","cacheAge","now","fetchFreshStatus","result","isPremium","getDownloadCount","premiumCacheValid","freeDownloadLimit","isAuthenticated","remaining","Math","max","errorStatus","getUserContext","name","user_metadata","full_name","user","signIn","supabase","auth","signInWithOAuth","provider","redirectTo","location","origin","pathname","signOut","createPayment","requestBody","product_id","productId","mode","app_id","appId","return_url","response","fetch","url","method","headers","Authorization","anonKey","body","JSON","stringify","ok","errorText","text","errorData","debug","parse","includes","warn","updateStatusDisplays","json","attachToButton","selector","downloadCallback","button","document","querySelector","injectBaseStyles","createTitleBar","createPaywallModal","createSuccessModal","createAuthUI","createStatusDisplay","setAttribute","onclick","async","e","preventDefault","handleButtonClick","setupUIUpdates","attachToButtons","buttons","forEach","buttonConfig","createGlobalStatusDisplay","disabled","style","opacity","handleButtonClickInternal","showConnectionError","showPaymentConfigError","userContext","length","showPaywallInstant","freshStatus","alert","newCount","successMessage","enabled","title","message","showSuccess","getElementById","theme","injectDaisyUI","styles","createElement","id","primaryColor","textContent","head","appendChild","themeName","toLowerCase","documentElement","modal","className","innerHTML","addEventListener","checkout_url","href","feedback","showFeedbackForm","classList","remove","target","paywall","createFeedbackModal","add","feedbackConfig","form","description","option1","option2","option3","submitFeedback","formData","FormData","reason","get","details","feedbackData","undefined","timestamp","userAgent","navigator","sendFeedbackEmail","emailConfig","emailBody","trim","resendApiKey","from","fromEmail","to","subject","profileContainer","statusDiv","titleEl","authSection","paymentSection","display","subtitleEl","showSingleUpgradeFlow","showPaywall","upgradeContainer","cancelContainer","insertBefore","upgradeBtn","replaceWith","cloneNode","newUpgradeBtn","showError","messageEl","toast","cssText","parentNode","removeChild","disableDownloadButtons","errorType","querySelectorAll","errorMessages","connection","statusMessages","btnElement","cursor","userSection","updateUserSection","profileDiv","titleConfig","titleBar","titleImage","links","map","link","join","userInitial","charAt","toUpperCase","userEmail","badgeClass","badgeText","countText","getComputedStyle","signoutBtn","on","contains","updatePaywallDisplay","event","listener","has","set","push","off","listeners","index","indexOf","splice","data","createClient","startsWith","generateFingerprint","crypto","randomUUID","String","raw","Intl","DateTimeFormat","resolvedOptions","timeZone","screen","width","height","language","buf","TextEncoder","encode","hashBuffer","subtle","digest","Array","Uint8Array","b","toString","padStart","onAuthStateChange","session","previousUser","userChanged","cacheExpired","isUpgradeFlow","URLSearchParams","search","history","replaceState","getUser","fingerprint","action","current_count","new_count","getLocalDownloadCount","key","val","parseInt","localStorage","getItem","isNaN","incrementLocalDownloadCount","next","setItem","cleanUrl","split"],"mappings":"sUA0EU,YAAAA,CAAaC,GAEnB,MAAMC,EAAiC,oBAAXC,OAA0BA,OAAeC,WAAa,KAElF,IAAKH,IAAWC,EACd,MAAM,IAAIG,MAAM,mGAIlB,OAAKJ,EAKAC,EAKE,IACFA,KACAD,GANIA,EALAC,CAaV,CAED,WAAAI,CAAYL,GArCJM,KAAWC,YAAQ,KACnBD,KAAeE,gBAAkB,KACjCF,KAAAG,eAAwD,IAAIC,IAC5DJ,KAAwBK,0BAAY,EACpCL,KAAuBM,yBAAY,EACnCN,KAAYO,aAA0B,KACtCP,KAAeQ,gBAAW,EACjBR,KAAAS,sBAAwB,IACjCT,KAAqBU,sBAAmC,KACxDV,KAAmBW,oBAAmB,KACtCX,KAAsBY,uBAAW,EA6BvCZ,KAAKN,OAASM,KAAKP,aAAaC,GAC5BM,KAAKN,OAAOmB,QAIhBb,KAAKc,iBACLd,KAAKe,qBACLf,KAAKgB,oBACLhB,KAAKiB,wBACLjB,KAAKkB,oBACLlB,KAAKmB,oBACN,CAMM,oBAAMC,GACX,IAEE,GAAIpB,KAAKK,yBAEP,YADAL,KAAKN,OAAO2B,WAAWC,UAAU,IAAIxB,MAAM,2FAK7C,GAAIE,KAAKN,OAAO6B,SAAWvB,KAAKM,wBAE9B,YADAN,KAAKN,OAAO2B,WAAWC,UAAU,IAAIxB,MAAM,yDAK7C,GAAIE,KAAKC,YAAa,CAEpB,SADwBD,KAAKw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AtC,QAAQC,IAAI,kDAAkDuC,EAAStD,UAEnEsD,EAASU,GAAI,CAEf,MAAuB,qBADJV,EAASmB,QAChBzE,MACb,CACF,CAAC,MAAOW,GACHtC,KAAKN,OAAOmB,SAASkF,OACvBtD,QAAQyD,KAAK,kCAAmC5D,EAEnD,CAED,OAAO,CACR,CAEO,qBAAAqQ,GACN,MAAMC,EAAM,kBAAkB5S,KAAKN,OAAOqF,QACpC8N,EAAMC,SAASC,aAAaC,QAAQJ,IAAQ,IAAK,IACvD,OAAOK,MAAMJ,GAAO,EAAIA,CACzB,CAEO,2BAAAK,GACN,MAAMN,EAAM,kBAAkB5S,KAAKN,OAAOqF,QACpCoO,EAAOnT,KAAK2S,wBAA0B,EAE5C,OADAI,aAAaK,QAAQR,EAAKrC,OAAO4C,IAC1BA,CACR,CAEO,WAAA5Q,CAAYD,GACdtC,KAAKN,OAAOmB,SAASkF,OACvBtD,QAAQH,MAAM,mBAAoBA,GAGhCtC,KAAKN,OAAO2B,WAAWC,QACzBtB,KAAKN,OAAO2B,UAAUC,QAAQgB,GAG9BG,QAAQH,MAAM,aAAcA,EAAMsG,SAGpC5I,KAAKmC,KAAK,QAASG,EACpB,CAEO,wBAAMnB,GAGqB,YADf,IAAI+Q,gBAAgBtS,OAAOyE,SAAS8N,QACxChH,IAAI,YAEhB9I,WAAW8E,UACT,GAAInH,KAAKC,YAAa,OACID,KAAKwB,mBAAmBxB,KAAKC,YAAYwB,OAE/DzB,KAAK6I,YAAY,sBAAuB,qDAExC7I,KAAK6I,YAAY,qBAAsB,+DAE1C,MACC7I,KAAK6I,YAAY,qBAAsB,+CAIzC,MAAMwK,EAAWzT,OAAOyE,SAAS2F,KAAKsJ,MAAM,KAAK,GACjD1T,OAAOwS,QAAQC,aAAa,CAAA,EAAI5L,SAASkC,MAAO0K,IAC/C,IAEN"}
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/index.ts"],"sourcesContent":[null],"names":["mergeConfigs","config","windowConfig","window","APP_CONFIG","Error","constructor","this","currentUser","userFingerprint","eventListeners","Map","supabaseConnectionFailed","paymentConnectionFailed","cachedStatus","statusCacheTime","STATUS_CACHE_DURATION","initializationPromise","cachedPremiumStatus","premiumStatusCacheTime","options","validateConfig","initializeSupabase","initializePayment","initializeFingerprint","setupAuthListener","checkPaymentStatus","handleDownload","callbacks","onError","payment","checkPremiumStatus","email","onPremiumDownload","status","getDownloadStatus","currentCount","limit","onLimitReached","incrementDownloadCount","onDownloadAllowed","newStatus","emit","count","setTimeout","error","handleError","forceRefresh","console","log","Date","toISOString","cacheAge","now","fetchFreshStatus","result","isPremium","getDownloadCount","premiumCacheValid","freeAttemptLimit","isAuthenticated","remaining","Math","max","errorStatus","getUserContext","name","user_metadata","full_name","user","signIn","supabase","auth","signInWithOAuth","provider","redirectTo","location","origin","pathname","signOut","createPayment","requestBody","product_id","productId","mode","app_id","appId","return_url","response","fetch","url","method","headers","Authorization","anonKey","body","JSON","stringify","ok","errorText","text","errorData","debug","parse","includes","warn","updateStatusDisplays","json","attachToButton","selector","downloadCallback","button","document","querySelector","injectBaseStyles","createTitleBar","createPaywallModal","createSuccessModal","createAuthUI","createStatusDisplay","setAttribute","onclick","async","e","preventDefault","handleButtonClick","setupUIUpdates","attachToButtons","buttons","forEach","buttonConfig","createGlobalStatusDisplay","disabled","style","opacity","handleButtonClickInternal","showConnectionError","showPaymentConfigError","userContext","length","showPaywallInstant","freshStatus","alert","newCount","successMessage","enabled","title","message","showSuccess","getElementById","theme","injectDaisyUI","styles","createElement","id","primaryColor","textContent","head","appendChild","themeName","toLowerCase","documentElement","modal","className","innerHTML","addEventListener","checkout_url","href","feedback","showFeedbackForm","classList","remove","target","paywall","createFeedbackModal","add","feedbackConfig","form","description","option1","option2","option3","submitFeedback","formData","FormData","reason","get","details","feedbackData","undefined","timestamp","userAgent","navigator","sendFeedbackEmail","emailConfig","Array","isArray","apiKey","resendApiKey","fromEmail","emailBody","trim","from","to","subject","profileContainer","statusDiv","titleEl","authSection","paymentSection","display","subtitleEl","showSingleUpgradeFlow","showPaywall","upgradeContainer","cancelContainer","insertBefore","upgradeBtn","replaceWith","cloneNode","newUpgradeBtn","showError","messageEl","toast","cssText","parentNode","removeChild","disableDownloadButtons","errorType","querySelectorAll","errorMessages","connection","statusMessages","btnElement","cursor","userSection","updateUserSection","profileDiv","titleConfig","titleBar","titleImage","links","map","link","join","userInitial","charAt","toUpperCase","userEmail","badgeClass","badgeText","countText","getComputedStyle","signoutBtn","on","contains","updatePaywallDisplay","event","listener","has","set","push","off","listeners","index","indexOf","splice","data","createClient","startsWith","generateFingerprint","crypto","randomUUID","String","raw","Intl","DateTimeFormat","resolvedOptions","timeZone","screen","width","height","language","buf","TextEncoder","encode","hashBuffer","subtle","digest","Uint8Array","b","toString","padStart","onAuthStateChange","session","previousUser","userChanged","cacheExpired","isUpgradeFlow","URLSearchParams","search","history","replaceState","getUser","fingerprint","action","current_count","new_count","getLocalDownloadCount","key","val","parseInt","localStorage","getItem","isNaN","incrementLocalDownloadCount","next","setItem","cleanUrl","split"],"mappings":"sUA0EU,YAAAA,CAAaC,GAEnB,MAAMC,EAAiC,oBAAXC,OAA0BA,OAAeC,WAAa,KAElF,IAAKH,IAAWC,EACd,MAAM,IAAIG,MAAM,mGAIlB,OAAKJ,EAKAC,EAKE,IACFA,KACAD,GANIA,EALAC,CAaV,CAED,WAAAI,CAAYL,GArCJM,KAAWC,YAAQ,KACnBD,KAAeE,gBAAkB,KACjCF,KAAAG,eAAwD,IAAIC,IAC5DJ,KAAwBK,0BAAY,EACpCL,KAAuBM,yBAAY,EACnCN,KAAYO,aAA0B,KACtCP,KAAeQ,gBAAW,EACjBR,KAAAS,sBAAwB,IACjCT,KAAqBU,sBAAmC,KACxDV,KAAmBW,oBAAmB,KACtCX,KAAsBY,uBAAW,EA6BvCZ,KAAKN,OAASM,KAAKP,aAAaC,GAC5BM,KAAKN,OAAOmB,QAIhBb,KAAKc,iBACLd,KAAKe,qBACLf,KAAKgB,oBACLhB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vBtD,QAAQH,MAAM,mBAAoBA,GAGhCtC,KAAKN,OAAO2B,WAAWC,QACzBtB,KAAKN,OAAO2B,UAAUC,QAAQgB,GAG9BG,QAAQH,MAAM,aAAcA,EAAMsG,SAGpC5I,KAAKmC,KAAK,QAASG,EACpB,CAEO,wBAAMnB,GAGqB,YADf,IAAIiR,gBAAgBxS,OAAOyE,SAASgO,QACxClH,IAAI,YAEhB9I,WAAW8E,UACT,GAAInH,KAAKC,YAAa,OACID,KAAKwB,mBAAmBxB,KAAKC,YAAYwB,OAE/DzB,KAAK6I,YAAY,sBAAuB,qDAExC7I,KAAK6I,YAAY,qBAAsB,+DAE1C,MACC7I,KAAK6I,YAAY,qBAAsB,+CAIzC,MAAM0K,EAAW3T,OAAOyE,SAAS2F,KAAKwJ,MAAM,KAAK,GACjD5T,OAAO0S,QAAQC,aAAa,CAAA,EAAI9L,SAASkC,MAAO4K,IAC/C,IAEN"}
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export interface MoneyBarConfig {
|
|
|
2
2
|
/** Unique identifier for your app (e.g., 'gif-maker', 'pdf-creator') */
|
|
3
3
|
appId: string;
|
|
4
4
|
/** Number of free attempts allowed before paywall */
|
|
5
|
-
|
|
5
|
+
freeAttemptLimit: number;
|
|
6
6
|
/** Supabase configuration */
|
|
7
7
|
supabase: {
|
|
8
8
|
url: string;
|
|
@@ -22,10 +22,11 @@ export interface MoneyBarConfig {
|
|
|
22
22
|
option2: string;
|
|
23
23
|
option3: string;
|
|
24
24
|
};
|
|
25
|
-
email: {
|
|
26
|
-
|
|
25
|
+
email: Array<{
|
|
26
|
+
provider: 'resend' | 'sendgrid' | 'mailgun' | 'ses';
|
|
27
|
+
apiKey: string;
|
|
27
28
|
fromEmail: string;
|
|
28
|
-
}
|
|
29
|
+
}>;
|
|
29
30
|
};
|
|
30
31
|
/** @deprecated Use feedback.email instead - Email service configuration (for feedback and notifications) */
|
|
31
32
|
email?: {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IAEd,qDAAqD;IACrD,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IAEd,qDAAqD;IACrD,gBAAgB,EAAE,MAAM,CAAC;IAEzB,6BAA6B;IAC7B,QAAQ,EAAE;QACR,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF,yCAAyC;IACzC,OAAO,CAAC,EAAE;QACR,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB,CAAC;IAEF,4CAA4C;IAC5C,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM,CAAC;YACd,WAAW,EAAE,MAAM,CAAC;YACpB,OAAO,EAAE,MAAM,CAAC;YAChB,OAAO,EAAE,MAAM,CAAC;YAChB,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;QACF,KAAK,EAAE,KAAK,CAAC;YACX,QAAQ,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,KAAK,CAAC;YACpD,MAAM,EAAE,MAAM,CAAC;YACf,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC,CAAC;KACJ,CAAC;IAEF,4GAA4G;IAC5G,KAAK,CAAC,EAAE;QACN,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAEF,iGAAiG;IACjG,SAAS,CAAC,EAAE;QACV,0EAA0E;QAC1E,iBAAiB,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAA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