(()=>{"use strict";const e=window.wc.customerEffortScore;function t(e){const t=e.querySelectorAll("input, select, textarea"),c={};for(const e of t){const t=e.name||e.id;if("button"!==e.type&&"image"!==e.type&&"submit"!==e.type&&"hidden"!==e.type&&t)switch(e.type){case"checkbox":c[t]=+e.checked;break;case"radio":void 0===c[t]&&(c[t]=""),e.checked&&(c[t]=e.value);break;case"select-multiple":const o=[];for(const t of e.options)t.selected&&o.push(t.value);c[t]=o;break;default:c[t]=e.value}}return c}const c=document.forms;if(c&&c.mainform){let o=!1;const n=document.querySelector(".woocommerce-save-button");n&&n.addEventListener("click",()=>{o=!0});const s=t(c.mainform);(0,e.addCustomerEffortScoreExitPageListener)("settings_change",()=>{if(o)return!1;const e=c.mainform?t(c.mainform):{};let n=!1;for(const t of Object.keys(s))if(("object"==typeof s[t]?JSON.stringify(s[t]):s[t])!==("object"==typeof e[t]?JSON.stringify(e[t]):e[t])){n=!0;break}return n})}const o=window.wc.tracks;(()=>{const e=document.querySelector(".wc-settings-marketplace-link");if(!e)return;const t=e.querySelector("a"),c=e.getAttribute("data-settings-tab"),n=e.getAttribute("data-settings-section");t&&c&&t.addEventListener("click",()=>{(0,o.recordEvent)("settings_marketplace_link_click",{settings_area:c,settings_section:n||void 0})})})(),(window.wc=window.wc||{}).settingsTracking={}})();