!function(){"use strict";class GuardedExtractor{constructor(){this.initialized=!1,this.sessionManager=null,this.isProManager=null}async initialize(){this.initialized||("undefined"!=typeof window&&(this.sessionManager=window.sessionManager||null,this.isProManager=window.isProManagerV2||window.isProManager||null),this.initialized=!0)}async getCurrentUserId(){return new Promise(e=>{chrome.storage.local.get(["auth_user"],a=>{e(a.auth_user?.uid||null)})})}async getAuthToken(){try{if("undefined"!=typeof firebase&&firebase.auth().currentUser)return await firebase.auth().currentUser.getIdToken()}catch(e){}return null}async checkFeatureAccess(e,a=1){return{allowed:!0,plan:"unlimited",leadsUsed:0,leadsRemaining:999999,features:["basic_extraction","email_extraction","social_media_extraction","ai_automation","lead_qualification"]}}async extractEmails(e,a={}){await this.initialize();const t=await this.checkFeatureAccess("email_extraction",e.length);if(!t.allowed)return{success:!1,error:t.reason,featureNotAvailable:t.featureNotAvailable,quotaExceeded:t.quotaExceeded,upgrade:t.upgrade,currentPlan:t.currentPlan,results:[]};try{let r;if("undefined"!=typeof EmailExtractorV2)r=await EmailExtractorV2.extractMultiple(e,a);else{if("undefined"==typeof window||!window.EmailExtractor)return{success:!1,error:"Email extractor not loaded. Please refresh the page.",results:[]};r=await window.EmailExtractor.extractMultiple(e,a)}return{success:!0,plan:t.plan,leadsUsed:t.leadsUsed,leadsRemaining:t.leadsRemaining,results:r}}catch(e){return{success:!1,error:e.message,results:[]}}}async extractSocialMedia(e,a={}){await this.initialize();const t=await this.checkFeatureAccess("social_media_extraction",e.length);if(!t.allowed)return{success:!1,error:t.reason,featureNotAvailable:t.featureNotAvailable,quotaExceeded:t.quotaExceeded,upgrade:t.upgrade,currentPlan:t.currentPlan,results:[]};try{let r;if("undefined"!=typeof SocialMediaExtractor)r=await SocialMediaExtractor.extractFromWebsites(e,a);else{if("undefined"==typeof window||!window.SocialMediaExtractor)return{success:!1,error:"Social media extractor not loaded. Please refresh the page.",results:[]};r=await window.SocialMediaExtractor.extractFromWebsites(e,a)}return{success:!0,plan:t.plan,leadsUsed:t.leadsUsed,leadsRemaining:t.leadsRemaining,results:r}}catch(e){return{success:!1,error:e.message,results:[]}}}async extractBasicInfo(e){await this.initialize();const a=await this.checkFeatureAccess("basic_extraction",e.length);if(!a.allowed&&a.quotaExceeded)return{success:!1,error:a.reason,quotaExceeded:!0,upgrade:a.upgrade,results:[]};const t=e.map(e=>({...e,extractedAt:(new Date).toISOString()}));return{success:!0,plan:a.plan||"free",leadsUsed:a.leadsUsed,leadsRemaining:a.leadsRemaining,results:t}}async canUseFeature(e){return await this.initialize(),(await this.checkFeatureAccess(e,0)).allowed}async getCurrentPlanInfo(){return{plan:"unlimited",isPro:!0,leadLimit:999999,leadsUsed:0,leadsRemaining:999999,features:["basic_extraction","email_extraction","social_media_extraction","ai_automation","lead_qualification","no_website_filter","high_volume_limits"],authenticated:!0}}}"undefined"!=typeof window&&(window.GuardedExtractor=GuardedExtractor,window.guardedExtractor=new GuardedExtractor),"undefined"!=typeof module&&module.exports&&(module.exports=GuardedExtractor)}();