import{$ as c}from"./vendor-BXhsOH2H.js";class l{constructor(){this.init()}init(){this.eventHandlers(),this.graphinaFeatureRequest()}eventHandlers(){jQuery(document.body).on("submit",".graphina-password-restricted-form",this.handleChartAccess.bind(this))}graphinaFeatureRequest(){if(parent.document.querySelector(".elementor-editor-active")!==null){let e="",r="https://iqonic.design/feature-request/?for_product=graphina";setInterval(function(){parent.document.querySelector("[class*=elementor-control-iq]")!=null&&(e=parent.document.querySelector("#elementor-panel__editor__help__link"),e!=null&&e.getAttribute("href")!==r&&(e.setAttribute("href",r),e.innerHTML=" Graphina Feature Request "))},3e3)}}handleChartAccess(e){e.preventDefault();const r=new FormData(e.currentTarget),t=Object.fromEntries(r.entries()),a={chart_password:t.chart_password,chart_type:t.chart_type,chart_id:t.chart_id,nonce:t.nonce,action:t.action,graphina_password:t.graphina_password};jQuery.ajax({type:"GET",url:gcfe_public_localize.ajaxurl,data:a,dataType:"json",contentType:"application/json",success:(function(n){n.status===!0?(this.graphinasetCookie(n.chart,!0,1),location.reload()):jQuery(e.currentTarget).find(".elementor-alert-danger").show()}).bind(this),error:function(n,o,s){console.error("Ajax Request Failed:",o,s)}})}graphinasetCookie(e,r,t){var a=new Date;a.setTime(a.getTime()+t*24*60*60*1e3);var n="expires="+a.toUTCString();document.cookie=e+"="+r+";"+n+";path=/"}}c(function(){const i={GraphinaPublic:new l};window.GraphinaPublicMain=i}); //# sourceMappingURL=publicMain-CJ4VfnKA.js.map