(()=>{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(i){var a=e[i];if(void 0!==a)return a.exports;var t=e[i]={exports:{}};return n[i](t,t.exports,o),t.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 i in e)o.o(e,i)&&!o.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:e[i]})},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 i=e.getElementsByTagName("script");if(i.length)for(var a=i.length-1;a>-1&&(!n||!/^http(s?):/.test(n));)n=i[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 i=o.n(e);function a(n){const e=i()("#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"),t=e.find(".sugar-calendar-bookings-modal-icon"),s=e.find("[data-confirm]"),c=e.find("[data-cancel]"),{type:l="info",title:r="",message:d="",html:g="",confirmText:u="",cancelText:f="",showConfirm:m=!0,showCancel:p=!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--${l}`),h?(e.addClass("sugar-calendar-bookings-confirmation-modal--no-icon"),t.hide()):(e.removeClass("sugar-calendar-bookings-confirmation-modal--no-icon"),t.show()),o.text(r),g?a.html(g):a.text(d),s.text(u).data("on-confirm",b),c.text(f),m?s.show():s.hide(),p?c.show():c.hide();const k=e.find(".sugar-calendar-bookings-modal-buttons");m||p?k.show():k.hide(),e.fadeIn(200),i()("body").addClass("modal-open"),setTimeout((()=>{p?c.focus():s.focus()}),250)}function t(){i()("#sugar-calendar-bookings-confirmation-modal").fadeOut(200),i()("body").removeClass("modal-open")}const s=window.SugarCalendarBookings||{};s.Admin=s.Admin||{},s.Admin.MiscSettings={init(){(function(){const n=i()("#sugar-calendar-bookings-confirmation-modal");if(0===n.length)return;const e=i()("[data-confirm]",n),o=i()("[data-cancel]",n),a=i()("[data-close]",n);!function(n,e,o,a,t=null){e.off("click").on("click",(function(n){n.preventDefault(),o()})),i()(document).off(`keydown.${a}`).on(`keydown.${a}`,(function(e){"Escape"===e.key&&n.is(":visible")&&o()})),t?n.find(t).off("click").on("click",(function(n){i()(n.target).hasClass(t.substring(1))&&o()})):n.off("click").on("click",(function(n){n.target===this&&o()}))}(n,o,t,"modal"),a.off("click").on("click",(function(n){n.preventDefault(),t()})),e.off("click").on("click",(function(n){n.preventDefault();const e=i()(this).data("on-confirm");e&&"function"==typeof e&&e(i()(this))}))})(),this.initDeleteToggle(),this.initDisableIntegrationsToggle()},initDeleteToggle(){const e=i()("#sugar-calendar-bookings-setting-misc_delete_data_on_uninstall");e.on("change",(function(o){this.checked&&(o.preventDefault(),this.checked=!1,a({type:"warning",title:(0,n.__)("Enable Data Deletion?","sugar-calendar-bookings-scheduling-appointments-lite"),message:(0,n.__)("When this plugin is uninstalled, all appointments, settings, and related data will be permanently deleted. This cannot be undone.","sugar-calendar-bookings-scheduling-appointments-lite"),confirmText:(0,n.__)("Yes, Enable","sugar-calendar-bookings-scheduling-appointments-lite"),cancelText:(0,n.__)("Cancel","sugar-calendar-bookings-scheduling-appointments-lite"),onConfirm(){e.prop("checked",!0),t()}}))}))},initDisableIntegrationsToggle(){const e=i()("#sugar-calendar-bookings-setting-misc_disable_integrations");e.on("change",(function(o){this.checked&&(o.preventDefault(),this.checked=!1,a({type:"warning",title:(0,n.__)("Disable Integrations?","sugar-calendar-bookings-scheduling-appointments-lite"),message:(0,n.__)("All existing integration connections will be permanently removed. This action cannot be undone.","sugar-calendar-bookings-scheduling-appointments-lite"),confirmText:(0,n.__)("Yes, Disable","sugar-calendar-bookings-scheduling-appointments-lite"),cancelText:(0,n.__)("Cancel","sugar-calendar-bookings-scheduling-appointments-lite"),onConfirm(){e.prop("checked",!0),t()}}))}))}},s.Admin.MiscSettings.init(),window.SugarCalendarBookings=s})()})();