(()=>{var n={436(n,e,o){window?.sugar_calendar_bookings_admin?.build_url&&(o.p=window.sugar_calendar_bookings_admin.build_url)}},e={};function o(t){var a=e[t];if(void 0!==a)return a.exports;var i=e[t]={exports:{}};return n[t](i,i.exports,o),i.exports}o.n=n=>{var e=n&&n.__esModule?()=>n.default:()=>n;return o.d(e,{a:e}),e},o.d=(n,e)=>{for(var t in e)o.o(e,t)&&!o.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},o.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),(()=>{var n;globalThis.importScripts&&(n=globalThis.location+"");var e=globalThis.document;if(!n&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(n=e.currentScript.src),!n)){var t=e.getElementsByTagName("script");if(t.length)for(var a=t.length-1;a>-1&&(!n||!/^http(s?):/.test(n));)n=t[a--].src}if(!n)throw new Error("Automatic publicPath is not supported in this browser");n=n.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=n+"../../"})(),(()=>{"use strict";o(436);const n=window.wp.i18n,e=window.jQuery;var t=o.n(e);function a(){t()("#sugar-calendar-bookings-confirmation-modal").fadeOut(200),t()("body").removeClass("modal-open")}const i={init(){t()(i.ready)},ready(){(function(){const n=t()("#sugar-calendar-bookings-confirmation-modal");if(0===n.length)return;const e=t()("[data-confirm]",n),o=t()("[data-cancel]",n),i=t()("[data-close]",n);!function(n,e,o,a,i=null){e.off("click").on("click",(function(n){n.preventDefault(),o()})),t()(document).off(`keydown.${a}`).on(`keydown.${a}`,(function(e){"Escape"===e.key&&n.is(":visible")&&o()})),i?n.find(i).off("click").on("click",(function(n){t()(n.target).hasClass(i.substring(1))&&o()})):n.off("click").on("click",(function(n){n.target===this&&o()}))}(n,o,a,"modal"),i.off("click").on("click",(function(n){n.preventDefault(),a()})),e.off("click").on("click",(function(n){n.preventDefault();const e=t()(this).data("on-confirm");e&&"function"==typeof e&&e(t()(this))}))})(),t()("#sugar-calendar-bookings-setting-stripe_test_mode").on("change",i.onTestModeChange),t()("#payment_gateway_stripe_enabled").on("change",i.onStripeToggleChange),t()("#sugar-calendar-bookings-btn-stripe--disconnect").on("click",i.onStripeDisconnect),i.updateOnsiteToggleState()},onStripeDisconnect(e){e.preventDefault();const o=t()(this).attr("href");!function(n){const e=t()("#sugar-calendar-bookings-confirmation-modal");if(0===e.length)return;const o=e.find(".sugar-calendar-bookings-modal-title"),a=e.find(".sugar-calendar-bookings-modal-message"),i=e.find(".sugar-calendar-bookings-modal-icon"),r=e.find("[data-confirm]"),s=e.find("[data-cancel]"),{type:c="info",title:l="",message:d="",html:g="",confirmText:u="",cancelText:f="",showConfirm:p=!0,showCancel:m=!0,hideIcon:h=!1,onConfirm:b=()=>{}}=n;e.removeClass(((n,e)=>(e.match(/sugar-calendar-bookings-confirmation-modal--\S+/g)||[]).join(" "))),e.addClass(`sugar-calendar-bookings-confirmation-modal--${c}`),h?(e.addClass("sugar-calendar-bookings-confirmation-modal--no-icon"),i.hide()):(e.removeClass("sugar-calendar-bookings-confirmation-modal--no-icon"),i.show()),o.text(l),g?a.html(g):a.text(d),r.text(u).data("on-confirm",b),s.text(f),p?r.show():r.hide(),m?s.show():s.hide();const k=e.find(".sugar-calendar-bookings-modal-buttons");p||m?k.show():k.hide(),e.fadeIn(200),t()("body").addClass("modal-open"),setTimeout((()=>{m?s.focus():r.focus()}),250)}({type:"error",title:(0,n.__)("Disconnect Stripe","sugar-calendar-bookings-scheduling-appointments-lite"),message:(0,n.__)("Are you sure you want to disconnect your Stripe account? You will no longer be able to accept payments through Stripe.","sugar-calendar-bookings-scheduling-appointments-lite"),confirmText:(0,n.__)("Yes","sugar-calendar-bookings-scheduling-appointments-lite"),cancelText:(0,n.__)("No","sugar-calendar-bookings-scheduling-appointments-lite"),onConfirm:()=>{a(),window.location.href=o}})},onTestModeChange(n){const e=t()(n.target),o=t()("#sugar-calendar-bookings-btn-stripe--connect");e.is(":checked")?o.attr("href",o.attr("data-test-url")):o.attr("href",o.attr("data-live-url"))},onStripeToggleChange(){i.updateOnsiteToggleState()},updateOnsiteToggleState(){const n=t()("#payment_gateway_stripe_enabled"),e=t()("#payment_gateway_onsite_enabled");n.length>0&&n.is(":checked")?e.prop("disabled",!1):e.prop("disabled",!0).prop("checked",!0)}};i.init()})()})();