1import{i as o,x as p,b as d,P as r,N as g,M as _,r as n}from"./storefrontApp.CsApItsi.min.js";import{S}from"./chunk-storefront_settings_constants.DIF02Gz.js";import"./chunk-vendor-di.Bh23gdA.js";import"./chunk-vendor-lit.NvY0u02.js";import"./chunk-vendor-lodash.CWHFt7Z.js";import"./chunk-vendor-rxjs.Dp7kflo.js";import"./chunk-vendor-phoenix.cdKS79L.js";class y extends o{constructor(e){super(),this.moduleName=p.api,this.#e=e}#e;isRecaptchaEnabled(){return this.#e.isRecaptchaEnabled()}async getRecaptchaReadyInstance(){return this.#e.ready()}async getToken(e){return this.#e.execute(e)}}class u extends d{constructor({settingsApi:e,messageStorageApi:t}){super(),this.moduleName="RecaptchaService",this._renderRecaptcha=async()=>{const c=await this.ready();this._regenerateKey=c.render("my-grecaptcha-badge",{sitekey:this._recaptchaSiteKey,size:"invisible"})},this._settingsApi=e,this._recaptchaSiteKey=this._settingsApi.getSkinSettings().recaptchaSiteKey||"",this._recaptchaEnabled=this._settingsApi.getSkinSettings().recaptchaEnabled||"",this._regenerateKey=this._recaptchaSiteKey,this.isRecaptchaEnabled()&&(async()=>{await this._getRecaptcha();const a=t.getChannelMessages(r.loaded);a&&a.length>0&&this._renderRecaptcha(),this.eventBus.on(r.loaded,this._renderRecaptcha)})()}async _getRecaptcha(){return window.grecaptcha?window.grecaptcha:await this._injectScript("recaptcha")}_injectScript(e){return new Promise(t=>{const c=document.getElementsByTagName("script")[0],a=document.createElement("script");a.id=e,a.src="https://www.google.com/recaptcha/api.js?render=explicit",a.async=!0,a.onload=()=>{t(grecaptcha)},c.parentNode?.insertBefore(a,c)})}async ready(){const e=await this._getRecaptcha();return new Promise(t=>{e.ready(()=>{t(e)})})}async execute(e){return await(await this.ready()).execute(this._regenerateKey,{action:e})}isRecaptchaEnabled(){return this._settingsApi.isFeatureEnabled("dev_recaptcha_fix")?this._recaptchaEnabled==="1"&&this._recaptchaSiteKey!=="":this._recaptchaSiteKey!==""}}class b extends g{static{this.featureName=p.feature}async init(){const e=await this.getApi(S.api),t=e.getSkinSettings();if((e.isFeatureEnabled("dev_recaptcha_fix")?!!t.recaptchaEnabled&&!!t.recaptchaSiteKey:t.recaptchaSiteKey)&&this._isInTopWindow()){const a=this.getApiSync(_),i=new u({settingsApi:e,messageStorageApi:a}),h=new y(i);return{cores:[{type:n.service,instance:[i]},{type:n.api,instance:[h]}]}}}_isInTopWindow(){return window===window.top}}export{b as RecaptchaInitializer};
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.