(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(n,o,a){if(!o||"object"!==t(o)||o instanceof Date||o instanceof File||o instanceof Blob){var s=null==o?"":o;n.append(a,s)}else Object.keys(o).forEach((function(t){e(n,o[t],a?"".concat(a,"[").concat(t,"]"):t)}));return n}var n=function(t,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(!1,function(t){if(null==t)throw new TypeError("Cannot destructure "+t)}(false),false),a=new FormData;return"GET"===t?(n=n.indexOf("?")>-1?n:n+"?",n+="query_timestamp="+Date.now(),Object.keys(o).forEach((function(t){n+="&".concat(t,"=").concat(o[t])}))):(o.query_timestamp=Date.now(),a=e(a,o)),new Promise((function(e,o){var s=new XMLHttpRequest;s.responseType="json",s.open(t,n),s.onload=function(){s.status>=200&&s.status<300?e(s.response):o({status:s.status,statusText:s.statusText,response:s.response})},s.onerror=function(){o({status:s.status,statusText:s.statusText})},s.send(a)}))};document.addEventListener("DOMContentLoaded",(function(){({register:function(){this.initCancellation()},initCancellation:function(){var t=document.getElementById("fcal_cancellation_form");if(!t)return!1;t.addEventListener("submit",(function(e){e.preventDefault();var o=new FormData(e.target),a={};o.forEach((function(t,e){a[e]=t}));var s=document.querySelector(".fcal_cancel_btn");s.classList.add("fcal_cancel_btn_loading"),s.setAttribute("disabled","disabled");var r=document.querySelector(".fcal_error_message");r&&r.remove(),n("POST",t.action,a).then((function(e){e.message&&(t.innerHTML=e.message)})).catch((function(e){var n,o=(null===(n=e.response)||void 0===n?void 0:n.message)||"Something is wrong!",a=document.createElement("div");a.classList.add("fcal_error_message"),a.innerHTML=o,t.appendChild(a)})).finally((function(){s.classList.remove("fcal_cancel_btn_loading"),s.removeAttribute("disabled")}))}))}}).register()}))})();