(()=>{var e={},{DiviDynamicContentHelperPublicData:t={}}=window;e.helpers={urlParams:new URLSearchParams(window.location.search),randomID:Math.random().toString(36).slice(2,9),isTouchDevice:"ontouchstart"in window||0<navigator.maxTouchPoints,isMobileDevice:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i.test(navigator.userAgent)},e.settings={isImprovedInterfaceTerminologyEnabled:t.settings.isImprovedInterfaceTerminologyEnabled||!1,isHideDiviGlobalVariablesSection:t.settings.isHideDiviGlobalVariablesSection||!1,isMoveGlobalSourcesSectionToTop:t.settings.isMoveGlobalSourcesSectionToTop||!1,isAnyTooltipEnabled:t.settings.isAnyTooltipEnabled||!1,isAdminbarObjectIdEnabled:t.settings.isAdminbarObjectIdEnabled||!1,isDynamicMapEnabled:t.settings.isDynamicMapEnabled||!1},e.strings={variableSettingText:t.strings.variableSettingText,detachFromVariableText:t.strings.detachFromVariableText,removeVariableText:t.strings.removeVariableText,myGlobalStringsText:t.strings.myGlobalStringsText,manageGlobalStringsText:t.strings.manageGlobalStringsText},window.PAC_DDCH_PUB=e,document.addEventListener("DOMContentLoaded",()=>{PAC_DDCH_PUB.settings.isAdminbarObjectIdEnabled&&!PAC_DDCH_PUB.helpers.urlParams.has("et_fb")&&PAC_DDCH_PUB.handleCopyToClipboard(),PAC_DDCH_PUB.settings.isAnyTooltipEnabled&&!PAC_DDCH_PUB.helpers.urlParams.has("et_fb")&&PAC_DDCH_PUB.handleDynamicContentTooltip(),PAC_DDCH_PUB.helpers.urlParams.has("ddch_opn_vm")&&PAC_DDCH_PUB.handleVariableManagerModal(),PAC_DDCH_PUB.helpers.urlParams.has("ddch_opn_dcfh")&&PAC_DDCH_PUB.handleCustomFieldHelperModal(),PAC_DDCH_PUB.helpers.urlParams.has("et_fb")&&PAC_DDCH_PUB.handleDynamicMutationObservers()})})(jQuery),PAC_DDCH_PUB.handleCopyToClipboard=()=>{$("#wp-admin-bar-pac-ddh-current-post-id a").on("click",function(t){t.preventDefault();let e=$(this),i=e.text();t=e.closest("li").attr("class").split(/\s+/).find(e=>e.startsWith("post-id-"));if(t){t=t.replace("post-id-",""),t=$("<input>").val(t).appendTo("body").select();try{var a=document.execCommand ("copy");t.remove(),a&&(e.text("Copied!"),setTimeout(()=>e.text(i),500))}catch(e){console.error("Failed to copy text: ",e),t.remove()}}})},PAC_DDCH_PUB.handleCustomFieldHelperModal=()=>{window.divi&&window.divi.data&&window.divi.data.select&&window.divi.data.select("divi/modal-library")&&window.divi.data.dispatch("divi/modal-library").open({name:"divi/divi-custom-fields-helper"})},PAC_DDCH_PUB.handleDynamicContentTooltip=()=>{document.querySelectorAll(".ddch-highlighted-tooltip").forEach(e=>{let t=e.querySelector(".content"),i,a;var o=()=>{clearTimeout(a),i=setTimeout(()=>{t.style.display="block",requestAnimationFrame(()=>{t.style.opacity="1",t.style.visibility="visible"})},100)},n=()=>{clearTimeout(i),a=setTimeout(()=>{e.matches(":hover")||t.matches(":hover")||(t.style.opacity="0",t.style.visibility="hidden",setTimeout(()=>{e.matches(":hover")||t.matches(":hover")||(t.style.display="none")},200))},350)};e.addEventListener("mouseenter",o),e.addEventListener("mouseleave",n),t.addEventListener("mouseenter",()=>{clearTimeout(a)}),t.addEventListener("mouseleave",n),e.addEventListener("focus",o),e.addEventListener("blur",n)})},PAC_DDCH_PUB.handleDynamicMutationObservers=()=>{let a={childList:!0,subtree:!0},o=null;(o=new MutationObserver(e=>{var t,i;o.disconnect(),PAC_DDCH_PUB.settings.isMoveGlobalSourcesSectionToTop&&(i=document.querySelector(".et-vb-option-subgroup")?.closest("ul"),t=document.querySelector('p.et-vb-subgroup-title[data-value="Global Dynamic Content Sources (DDCH)"]')?.closest("li"),i)&&t&&i.firstElementChild!==t&&i.insertBefore(t,i.firstElementChild),PAC_DDCH_PUB.settings.isImprovedInterfaceTerminologyEnabled&&(document.querySelectorAll(".select-option-item").forEach(e=>{var t=e.textContent.trim().toLowerCase(),i=e.querySelector(".et-vb-dynamic-content-variable-button");t.includes("variable settings")?e.textContent=PAC_DDCH_PUB.strings.variableSettingText:t.includes("remove variable")?e.textContent=PAC_DDCH_PUB.strings.removeVariableText:t.includes("detach from variable")&&(e.textContent=PAC_DDCH_PUB.strings.detachFromVariableText),i&&"manage global strings"===i.textContent.trim().toLowerCase()&&(i.textContent=PAC_DDCH_PUB.strings.manageGlobalStringsText)}),t=document.querySelector('p.et-vb-subgroup-title[data-value="global_variable_options"]'))&&(t.textContent=PAC_DDCH_PUB.strings.myGlobalStringsText),PAC_DDCH_PUB.settings.isHideDiviGlobalVariablesSection&&(i=document.querySelector('p.et-vb-subgroup-title[data-value="global_variable_options"]'))&&(i?.closest("li.et-vb-option-subgroup").remove(),document.querySelector(".select-option-item-manageGlobalVariable--strings")?.remove()),o.observe(document.body,a)})).observe(document.body,a)},PAC_DDCH_PUB.handleMoveGlobalContentToTop=()=>{function e(){var e=document.querySelector(".et-vb-option-subgroup")?.closest("ul"),t=document.querySelector('p.et-vb-subgroup-title[data-value="Global Dynamic Content Sources (DDCH)"]')?.closest("li");e&&t&&e.firstElementChild!==t&&e.insertBefore(t,e.firstElementChild)}e(),new MutationObserver(()=>{e()}).observe(document.body,{childList:!0,subtree:!0})},PAC_DDCH_PUB.handleVariableManagerModal=()=>{window.divi&&window.divi.data&&window.divi.data.select&&window.divi.data.select("divi/modal-library")&&window.divi.data.dispatch("divi/modal-library").open({name:"divi/manage-global-variable"})};