(()=>{"use strict";var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{X:()=>a,u:()=>n});var o=["about","avatars","verified-accounts","links","interests","contact-info","wallet","photos","design","privacy"],n=function(){function e(e){var t=this,n=e.email,a=e.scope,r=void 0===a?[]:a,i=e.locale,c=e.onProfileUpdated,s=e.onOpened,d=e.onClosed,l=e.utm;this._window=null,this.open=function(e){if(!(e=e||t._email))return console.error("Gravatar Quick Editor: Email not provided"),!1;e=encodeURIComponent(e);var o=encodeURIComponent(t._scope.join(",")),n=window.screenLeft+(window.outerWidth-400)/2,a="popup,width=400,height=720,top="+(window.screenTop+(window.outerHeight-720)/2)+",left="+n,r=(t._locale?"https://"+t._locale+".gravatar.com":"https://gravatar.com")+"/profile?email="+e+"&scope="+o+"&is_quick_editor=true"+(t._utm?"&utm="+encodeURIComponent(t._utm):"");if(t._window=window.open(r,t._name,a),null===t._window)return console.error("Gravatar Quick Editor: Could not open window"),!1;if(t._onOpened&&t._onOpened(),t._onClosed)var i=setInterval((function(){t._window.closed&&(clearInterval(i),t._onClosed())}),500);return!0},this.close=function(){t._window&&t._window.close()},this.isOpen=function(){return null!==t._window&&!t._window.closed},this._name=this._getName(),this._email=n,this._scope=r,this._locale=i,this._onProfileUpdated=c,this._onOpened=s,this._onClosed=d,this._utm=l,this._scope.every((function(e){return o.includes(e)}))||(console.error("Gravatar Quick Editor: Invalid scope definition. Available scope: "+o.join(", ")),this._scope=this._scope.filter((function(e){return o.includes(e)}))),window.addEventListener("message",this._onMessage.bind(this))}var t=e.prototype;return t._getName=function(){return"GravatarQuickEditor_"+(new Date).getTime()+Math.floor(8999*Math.random()+1e3)},t._onMessage=function(e){var t;this._onProfileUpdated&&e.origin.match(/https:\/\/([a-z\-]{2,5}\.)?gravatar.com/)&&(null==(t=e.data)?void 0:t.name)===this._name&&this._onProfileUpdated(e.data.type)},e}(),a=function(){function e(e){var t=e.email,o=e.editorTriggerSelector,a=e.avatarSelector,r=e.scope,i=e.locale,c=e.avatarRefreshDelay;this._avatarList=document.querySelectorAll(a),this._avatarRefreshDelay=c||1e3;var s=document.querySelector(o),d=new n({email:t,scope:r,locale:i,onProfileUpdated:this._onProfileUpdated.bind(this)});null==s||s.addEventListener("click",(function(){return d.open()}))}return e.prototype._onProfileUpdated=function(e){var t=this;"avatar_updated"===e&&0!==this._avatarList.length&&this._avatarList.forEach((function(e){if(URL.canParse(e.src)&&e.src.includes("gravatar.com/avatar")){var o=new URL(e.src);o.searchParams.set("t",(new Date).getTime().toString()),setTimeout((function(){e.src=o.toString()}),t._avatarRefreshDelay)}}))},e}(),r=t.u;const i="avatar-loading";function c(e){const t=new URL(e,window.location.origin);return t.searchParams.set("t",Date.now().toString()),t.toString()}function s(){if("undefined"==typeof geWcMyAccount||!geWcMyAccount)return;const e=document.querySelector(".woocommerce-account-gravatar__edit-wrapper");if(!e)return;e.addEventListener("click",(e=>{var t;e.preventDefault(),t=["avatars"],new r({email:geWcMyAccount.email,locale:geWcMyAccount.locale,scope:t,onProfileUpdated:e=>{"avatar_updated"===e&&function(){const e=document.querySelectorAll(".woocommerce-account-gravatar__avatar");e.forEach((e=>{e.classList.add(i)})),setTimeout((()=>{e.forEach((e=>{e.src=c(e.src),e.srcset&&(e.srcset=e.srcset.split(",").map((e=>{const[t,o]=e.trim().split(" "),n=c(t);return o?`${n} ${o}`:n})).join(", ")),e.classList.remove(i)}))}),4e3)}()}}).open()}))}document.addEventListener("DOMContentLoaded",(()=>{s()}))})();