1const e="idle",t="loading",i="verified",o="rejected",n="age_verified",s="true",a=["vendor-terms-and-conditions","privacy-policy","terms-and-conditions","terms","privacy"];function r(r={}){return{state:e,isVisible:!1,checked:!1,ageLimit:r.ageLimit||21,get isLoading(){return this.state===t},get isVerified(){return this.state===i},get isRejected(){return this.state===o},init(){return this._isWhitelisted()||this._isVerified()?(this.state=i,this.isVisible=!1,void this._notifyVerified()):(this.isVisible=!0,this.state=e,this._preventBodyScroll(),this._notifyShown(),this._bindKeyboardEvents(),void this.$nextTick((()=>{const e=document.getElementById("age_gate_verification");e&&e.focus()})))},handleCheckboxChange(e){this.checked=e.target.checked},async handleEnter(o){if(o.preventDefault(),this.checked&&!this.isLoading)try{this.state=t,await this._setVerificationCookie(),this.state=i,this.isVisible=!1,this._restoreBodyScroll(),this._notifyVerified()}catch(n){this._handleError(n)}finally{this.state=e}},handleExit(e){e.preventDefault(),this.state=o,this._notifyRejected(),this._redirectToExit()},_bindKeyboardEvents(){const e=e=>{"Enter"===e.key&&this.checked&&!this.isLoading&&(e.preventDefault(),this.handleEnter(e)),"Escape"!==e.key||this.isLoading||(e.preventDefault(),this.handleExit(e))};document.addEventListener("keydown",e),this._keyboardHandler=e},_isWhitelisted(){const e=window.location.pathname.toLowerCase();return a.some((t=>e.includes(t)))},_isVerified(){const e=document.cookie.split(";");for(const t of e){const[e,i]=t.trim().split("=");if(e===n&&i===s)return!0}return!1},_handleWhitelistedLinks(){},async _setVerificationCookie(){return new Promise((e=>{const t=new Date;t.setTime(t.getTime()+2592e6);const i=["".concat(n,"=").concat(s),"expires=".concat(t.toUTCString()),"path=".concat("/"),"SameSite=".concat("Lax")].join("; ");document.cookie=i,setTimeout((()=>{this._isVerified()||(document.cookie=i),e()}),100)}))},_preventBodyScroll(){document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden"},_restoreBodyScroll(){document.body.style.overflow="",document.documentElement.style.overflow=""},_redirectToExit(){window.opener?window.close():window.location.href="https://www.google.com"},_handleError(t){this.state=e,window.dispatchEvent(new CustomEvent("lookah:toast:show",{detail:{type:"error",message:"An error occurred during age verification. Please try again."}}))},_notifyShown(){window.dispatchEvent(new CustomEvent("lookah:age-gate:shown",{detail:{timestamp:(new Date).toISOString(),ageLimit:this.ageLimit}}))},_notifyVerified(){window.dispatchEvent(new CustomEvent("lookah:age-gate:verified",{detail:{timestamp:(new Date).toISOString(),ageLimit:this.ageLimit}}))},_notifyRejected(){window.dispatchEvent(new CustomEvent("lookah:age-gate:rejected",{detail:{timestamp:(new Date).toISOString(),ageLimit:this.ageLimit}}))},destroy(){this._restoreBodyScroll(),this._keyboardHandler&&document.removeEventListener("keydown",this._keyboardHandler)}}}export{r as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.