(function(){typeof window.bootstrap>"u"?document.addEventListener("DOMContentLoaded",i):i();function i(){const o=document.querySelectorAll("[data-integration-modal]");if(!o.length)return;const r=new Map,u=window.integrationModalsConfig&&window.integrationModalsConfig.unsavedWarning||"You have unsaved changes. Close anyway?";o.forEach(e=>{const n=e.id;e.addEventListener("show.bs.modal",()=>{r.set(n,d(e))}),e.addEventListener("hide.bs.modal",t=>{const a=r.get(n);if(a&&h(e,a)&&(t.preventDefault(),window.confirm(u))){f(e,a),r.delete(n);const s=window.bootstrap.Modal.getInstance(e);s&&s.hide()}})});function d(e){const n={};return e.querySelectorAll("input, select, textarea").forEach(t=>{t.name&&(n[t.name]=c(t))}),n}function f(e,n){e.querySelectorAll("input, select, textarea").forEach(t=>{!t.name||!(t.name in n)||l(t,n[t.name])})}function h(e,n){let t=!1;return e.querySelectorAll("input, select, textarea").forEach(a=>{!a.name||!(a.name in n)||c(a)!==n[a.name]&&(t=!0)}),t}function c(e){return e.type==="checkbox"||e.type==="radio"?e.checked?"1":"0":e.value}function l(e,n){e.type==="checkbox"||e.type==="radio"?e.checked=n==="1":e.value=n}}})();
