((t,a,i,n)=>{"use strict";const o=async()=>{t.loadJs(t.url+"js/admin/notification",!!a.TF_Notification),await t.loadJs(t.url+"js/admin/panel",!!a.ThemifyPanel);const o=i.tfId("tb_panel"),e=o.firstElementChild,s=i.createDocumentFragment(),c=i.tfId("tf_svg").cloneNode(!0);s.appendChild(c),e&&(o.attachShadow({mode:e.getAttribute("shadowrootmode")}).appendChild(e.content),e.remove()),o.shadowRoot.prepend(s);new ThemifyPanel(o.shadowRoot.querySelector(".container"),n.nonce,n.data,n.options,n.labels).el.querySelector("#main").tfOn("submit",(async i=>{i.preventDefault(),i.stopPropagation();const o=Array.from(new FormData(i.currentTarget)),e={};await t.loadJs(t.url+"js/admin/notification",!!a.TF_Notification);for(let t=o.length-1;t>-1;--t)""!==o[t][1]&&"default"!==o[t][1]&&(e[o[t][0]]=o[t][1]);const s={action:"themify_builder_settings_save",nonce:n.nonce,data:JSON.stringify(e)};try{await TF_Notification.show("info","Saving");const a=await t.fetch(s);if(!a.success)throw a}catch(i){try{s.data=new Blob([s.data],{type:"application/json"});const a=await t.fetch(s);if(!a.success)throw a}catch(i){throw i}}await TF_Notification.showHide("done")}))};!0===a.loaded?o():a.tfOn("load",o,{once:!0,passive:!0})})(Themify,window,document,tb_settings);