diff --git a/packages/builder-integrations/src/bricks_builder.ts b/packages/builder-integrations/src/bricks_builder.ts index 215807c..7ec582b 100644 --- a/packages/builder-integrations/src/bricks_builder.ts +++ b/packages/builder-integrations/src/bricks_builder.ts @@ -185,16 +185,17 @@ type Styles = Record>; return children.find((child) => child.textContent?.trim().includes(data.family)); }; + let themeToggleInitialized = false; const addThemeToggleButton = () => { - if (!assertOption("bricks_enable_dark_mode_preview")) { + if (themeToggleInitialized || !assertOption("bricks_enable_dark_mode_preview")) { return; } + themeToggleInitialized = true; const themeMode = window?.core_framework_connector?.theme_mode ?? "light"; - const leftPanel = - document.querySelector("#bricks-toolbar .group-wrapper.left") || - document.querySelector("#bricks-toolbar .group-wrapper.start"); const THEME_TOGGLE_BUTTON_CLASS = "cf-theme-toggle-button"; + const toolbarSelector = "#bricks-toolbar, .bricks-toolbar"; + const groupSelector = ":is(#bricks-toolbar, .bricks-toolbar) .group-wrapper"; // Sun icon (shown in light mode — click to switch to dark) const sunIcon = ``; @@ -205,45 +206,18 @@ type Styles = Record>; // Small CF badge const cfBadge = `${coreIconSvg}`; - if (!leftPanel) { - log("Left panel not found"); - return; - } - - const liButton = - leftPanel.querySelector("li.settings") || - leftPanel.querySelector("li.pages") || - leftPanel.querySelector("li:not(.logo)"); - const toggleButton = liButton?.cloneNode(true) as HTMLLIElement; - - if (!toggleButton) { - log("Button not found"); - return; - } - - toggleButton.classList.remove("settings"); - toggleButton.classList.remove("pages"); + // Own the markup so Bricks' active state, IDs and inline order aren't cloned. + const toggleButton = document.createElement("li"); toggleButton.classList.add("theme-toggle", "cf-theme-toggle"); toggleButton.setAttribute("data-balloon", "Toggle Core Framework theme"); - - const svg = toggleButton.querySelector("svg"); - svg?.remove(); - - const span = toggleButton.querySelector("span"); - - leftPanel.appendChild(toggleButton); - - // Set initial icon content (sun/moon + CF badge) - const savedTheme = window?.localStorage?.getItem("cf-theme") as "dark" | "light" | "auto" | null; - const isDarkInitial = savedTheme === "dark"; - - if (span) { - span.innerHTML = sunIcon + moonIcon + cfBadge; - const sunEl = span.querySelector(".cf-theme-icon--sun") as HTMLElement; - const moonEl = span.querySelector(".cf-theme-icon--moon") as HTMLElement; - if (sunEl) sunEl.style.display = isDarkInitial ? "none" : "block"; - if (moonEl) moonEl.style.display = isDarkInitial ? "block" : "none"; - } + toggleButton.setAttribute("aria-label", "Toggle Core Framework theme"); + toggleButton.setAttribute("role", "button"); + toggleButton.tabIndex = 0; + const span = document.createElement("span"); + span.className = "bricks-svg-wrapper"; + span.setAttribute("aria-hidden", "true"); + span.innerHTML = sunIcon + moonIcon + cfBadge; + toggleButton.appendChild(span); // Inject CF theme toggle styles const cfToggleStyle = document.createElement("style"); @@ -252,7 +226,7 @@ type Styles = Record>; .cf-theme-toggle { position: relative; } - .cf-theme-toggle span { + .cf-theme-toggle > .bricks-svg-wrapper { position: relative; display: flex; align-items: center; @@ -292,38 +266,50 @@ type Styles = Record>; const moonEl = toggleButton.querySelector(".cf-theme-icon--moon") as HTMLElement; if (sunEl) sunEl.style.display = isDark ? "none" : "block"; if (moonEl) moonEl.style.display = isDark ? "block" : "none"; + toggleButton.setAttribute("aria-pressed", String(isDark)); }; - (document.getElementById(IFRAME_ID) as HTMLIFrameElement)?.addEventListener("load", () => - setTimeout(() => { - const iframeDocument = (document.getElementById(IFRAME_ID) as HTMLIFrameElement)?.contentDocument; - const iframeHtml = iframeDocument?.querySelector("html"); - const html = document.querySelector("html") as HTMLHtmlElement; + const syncTheme = () => { + const iframeDocument = (document.getElementById(IFRAME_ID) as HTMLIFrameElement)?.contentDocument; + const iframeHtml = iframeDocument?.querySelector("html"); + const html = document.querySelector("html") as HTMLHtmlElement; - if (iframeDocument && iframeHtml) { - iframeHtml.classList.remove(...[ThemeClasses.DARK, ThemeClasses.LIGHT]); - html?.classList?.remove(...[ThemeClasses.DARK, ThemeClasses.LIGHT]); + if (iframeDocument && iframeHtml) { + iframeHtml.classList.remove(...[ThemeClasses.DARK, ThemeClasses.LIGHT]); + html?.classList?.remove(...[ThemeClasses.DARK, ThemeClasses.LIGHT]); - const savedTheme = window?.localStorage?.getItem("cf-theme") as "dark" | "light" | "auto" | null; - const defaultTheme = String(themeMode === "auto" ? getSystemThemeClass() : `cf-theme-${themeMode}`); + const savedTheme = window?.localStorage?.getItem("cf-theme") as "dark" | "light" | "auto" | null; + const selectedTheme = savedTheme ?? themeMode; + const themeClass = selectedTheme === "auto" ? getSystemThemeClass() : `cf-theme-${selectedTheme}`; - iframeHtml.classList.add(savedTheme ? `cf-theme-${savedTheme}` : defaultTheme); - html?.classList?.add(savedTheme ? `cf-theme-${savedTheme}` : defaultTheme); - } + iframeHtml.classList.add(themeClass); + html?.classList?.add(themeClass); + } - updateToggleIcons(html?.classList?.contains(ThemeClasses.DARK) ?? false); + updateToggleIcons(html?.classList?.contains(ThemeClasses.DARK) ?? false); - if (!iframeDocument) { - log("Iframe document not found"); - return; - } + if (!iframeDocument) { + log("Iframe document not found"); + return; + } - [...iframeDocument.getElementsByClassName(THEME_TOGGLE_BUTTON_CLASS)].forEach((button) => { - button.classList.add( - html?.classList?.contains(ThemeClasses.DARK) ? ThemeClasses.LIGHT : ThemeClasses.DARK, - ); - }); - }, 5), + [...iframeDocument.getElementsByClassName(THEME_TOGGLE_BUTTON_CLASS)].forEach((button) => { + button.classList.remove(ThemeClasses.DARK, ThemeClasses.LIGHT); + button.classList.add( + html?.classList?.contains(ThemeClasses.DARK) ? ThemeClasses.LIGHT : ThemeClasses.DARK, + ); + }); + }; + + // Capture iframe loads even when Vue creates or replaces the iframe later. + document.addEventListener( + "load", + (event) => { + if (event.target instanceof HTMLIFrameElement && event.target.id === IFRAME_ID) { + setTimeout(syncTheme, 5); + } + }, + true, ); toggleButton.addEventListener("click", (e) => { @@ -364,6 +350,60 @@ type Styles = Record>; button.className = classes.join(" "); }); }); + + toggleButton.addEventListener("keydown", (event) => { + if (event.key === "Enter" || event.key === " ") { + event.preventDefault(); + event.stopPropagation(); + toggleButton.click(); + } + }); + + const mountToggle = () => { + const groups = [...document.querySelectorAll(groupSelector)].filter( + (group) => !group.matches(".is-hidden, .is-empty"), + ); + // Bricks 2.4 can move/hide the start group or replace entire toolbars. + const group = groups.find((candidate) => candidate.matches(".left, .start")) ?? groups[0]; + if (!group) return; + + const siblings = [...group.children].filter((child) => child !== toggleButton); + // Bricks 2.4 uses CSS order, so appending alone doesn't place the toggle last. + const order = String( + Math.max(0, ...siblings.map((child) => Number(getComputedStyle(child).order) || 0)) + 1, + ); + if (toggleButton.style.order !== order) toggleButton.style.order = order; + const tooltipPosition = + siblings.find((child) => child.hasAttribute("data-balloon-pos"))?.getAttribute("data-balloon-pos") ?? + "bottom"; + toggleButton.setAttribute("data-balloon-pos", tooltipPosition); + if (toggleButton.parentElement !== group) group.appendChild(toggleButton); + }; + + // Ignore editor/content mutations; only toolbar structure, visibility and order matter. + const toolbarObserver = new MutationObserver((mutations) => { + const toolbarChanged = mutations.some((mutation) => { + const target = mutation.target; + if (!(target instanceof Element) || target === toggleButton) return false; + if (target.matches(toolbarSelector) || target.matches(groupSelector)) return true; + if (mutation.type === "attributes") { + return mutation.attributeName === "style" && target.parentElement?.matches(groupSelector); + } + return [...mutation.addedNodes, ...mutation.removedNodes].some( + (node) => + node instanceof Element && (node.matches(toolbarSelector) || node.querySelector(toolbarSelector)), + ); + }); + if (toolbarChanged) mountToggle(); + }); + toolbarObserver.observe(document.querySelector("#bricks-workspace") ?? document.body, { + childList: true, + subtree: true, + attributes: true, + attributeFilter: ["class", "style"], + }); + mountToggle(); + syncTheme(); }; const applyClassOnHover = () => { diff --git a/packages/wp/assets/public/js/bricks_builder.js b/packages/wp/assets/public/js/bricks_builder.js index e588a0a..b24b3b7 100644 --- a/packages/wp/assets/public/js/bricks_builder.js +++ b/packages/wp/assets/public/js/bricks_builder.js @@ -1,4 +1,4 @@ -"use strict";(()=>{var me=Object.defineProperty,he=Object.defineProperties;var fe=Object.getOwnPropertyDescriptors;var J=Object.getOwnPropertySymbols;var be=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable;var z=(_,A,P)=>A in _?me(_,A,{enumerable:!0,configurable:!0,writable:!0,value:P}):_[A]=P,B=(_,A)=>{for(var P in A||(A={}))be.call(A,P)&&z(_,P,A[P]);if(J)for(var P of J(A))ge.call(A,P)&&z(_,P,A[P]);return _},W=(_,A)=>he(_,fe(A));{const _={vue:()=>{var a;return(a=document==null?void 0:document.querySelector(".brx-body"))==null?void 0:a.__vue_app__},config:()=>{var a,e;return(e=(a=document.querySelector(".brx-body"))==null?void 0:a.__vue_app__)==null?void 0:e.config},globalProperties:()=>{var a,e,t;return(t=(e=(a=document.querySelector(".brx-body"))==null?void 0:a.__vue_app__)==null?void 0:e.config)==null?void 0:t.globalProperties}},A="bricks-builder-iframe",P={theme_mode:"light",bricks_enable_dark_mode_preview:!0,bricks_enable_variable_dropdown:!0,bricks_variable_ui:!0,bricks_enable_variable_ui_auto_hide:!0,bricks_enable_variable_ui_hint:!0,bricks_apply_class_on_hover:!0,bricks_apply_variable_on_hover:!0,bricks_enable_variable_context_menu:!0,bricks_bem_generator:!0,oxygen_enable_variable_dropdown:!0,oxygen_enable_dark_mode_preview:!0,oxygen_enable_variable_ui_auto_hide:!0,oxygen_variable_ui:!0,oxygen_enable_variable_context_menu:!0,oxygen_enable_variable_ui_hint:!0,oxygen_apply_class_on_hover:!0,oxygen_enable_unit_and_value_preview:!0},q={includedFields:['div[data-control="number"]','div[data-control].has-variables:not([data-control="number"])',{selector:'div[data-control="text"]',hasChild:["#_cssTransition","#_transformOrigin","#_flexBasis","#_overflow","#_gridTemplateColumns","#_gridTemplateRows","#_gridAutoColumns","#_gridAutoRows","#_objectPosition",'[id^="raw-"]']}],excludedFields:[".control-query",'div[data-controlkey="start"]','div[data-controlkey="perPage"]','div[data-controlkey="perMove"]','div[data-controlkey="speed"]']},X=({selector:a,callback:e,options:t})=>{const o=new MutationObserver(e),s=document.querySelector(a);if(!s){k(`Target not found for selector: ${a}`);return}const n={childList:!0,subtree:!0};return o.observe(s,B(B({},n),t)),o},$=a=>{const e={};for(const t in a){const o=a[t];if(!o)continue;const s=new Set;e[t]=Object.keys(o).reduce((n,r)=>{const i=o[r];return r==="Contextual variables"&&Array.isArray(i)?(n[r]=i,i.forEach(c=>s.add(c))):Array.isArray(i)&&(n[r]=i.filter(c=>!s.has(c)&&s.add(c))),n},{})}return e},ee=()=>{var a;return(a=window==null?void 0:window.core_framework_connector)!=null?a:P},D=a=>{var e,t;return(t=(e=ee())==null?void 0:e[a])!=null?t:!1},te=` +"use strict";(()=>{var he=Object.defineProperty,fe=Object.defineProperties;var be=Object.getOwnPropertyDescriptors;var z=Object.getOwnPropertySymbols;var ge=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var X=(D,I,H)=>I in D?he(D,I,{enumerable:!0,configurable:!0,writable:!0,value:H}):D[I]=H,B=(D,I)=>{for(var H in I||(I={}))ge.call(I,H)&&X(D,H,I[H]);if(z)for(var H of z(I))ve.call(I,H)&&X(D,H,I[H]);return D},W=(D,I)=>fe(D,be(I));{const D={vue:()=>{var a;return(a=document==null?void 0:document.querySelector(".brx-body"))==null?void 0:a.__vue_app__},config:()=>{var a,e;return(e=(a=document.querySelector(".brx-body"))==null?void 0:a.__vue_app__)==null?void 0:e.config},globalProperties:()=>{var a,e,t;return(t=(e=(a=document.querySelector(".brx-body"))==null?void 0:a.__vue_app__)==null?void 0:e.config)==null?void 0:t.globalProperties}},I="bricks-builder-iframe",H={theme_mode:"light",bricks_enable_dark_mode_preview:!0,bricks_enable_variable_dropdown:!0,bricks_variable_ui:!0,bricks_enable_variable_ui_auto_hide:!0,bricks_enable_variable_ui_hint:!0,bricks_apply_class_on_hover:!0,bricks_apply_variable_on_hover:!0,bricks_enable_variable_context_menu:!0,bricks_bem_generator:!0,oxygen_enable_variable_dropdown:!0,oxygen_enable_dark_mode_preview:!0,oxygen_enable_variable_ui_auto_hide:!0,oxygen_variable_ui:!0,oxygen_enable_variable_context_menu:!0,oxygen_enable_variable_ui_hint:!0,oxygen_apply_class_on_hover:!0,oxygen_enable_unit_and_value_preview:!0},K={includedFields:['div[data-control="number"]','div[data-control].has-variables:not([data-control="number"])',{selector:'div[data-control="text"]',hasChild:["#_cssTransition","#_transformOrigin","#_flexBasis","#_overflow","#_gridTemplateColumns","#_gridTemplateRows","#_gridAutoColumns","#_gridAutoRows","#_objectPosition",'[id^="raw-"]']}],excludedFields:[".control-query",'div[data-controlkey="start"]','div[data-controlkey="perPage"]','div[data-controlkey="perMove"]','div[data-controlkey="speed"]']},$=({selector:a,callback:e,options:t})=>{const o=new MutationObserver(e),r=document.querySelector(a);if(!r){L(`Target not found for selector: ${a}`);return}const n={childList:!0,subtree:!0};return o.observe(r,B(B({},n),t)),o},ee=a=>{const e={};for(const t in a){const o=a[t];if(!o)continue;const r=new Set;e[t]=Object.keys(o).reduce((n,s)=>{const i=o[s];return s==="Contextual variables"&&Array.isArray(i)?(n[s]=i,i.forEach(c=>r.add(c))):Array.isArray(i)&&(n[s]=i.filter(c=>!r.has(c)&&r.add(c))),n},{})}return e},te=()=>{var a;return(a=window==null?void 0:window.core_framework_connector)!=null?a:H},P=a=>{var e,t;return(t=(e=te())==null?void 0:e[a])!=null?t:!1},ne=` - `,k=(a,...e)=>console.log("[Core Framework]",a,...e),ne=(a,e)=>a.find(t=>{var o;return(o=t.textContent)==null?void 0:o.trim().includes(e.family)}),oe=()=>{var p,C,E,b;if(!D("bricks_enable_dark_mode_preview"))return;const a=(C=(p=window==null?void 0:window.core_framework_connector)==null?void 0:p.theme_mode)!=null?C:"light",e=document.querySelector("#bricks-toolbar .group-wrapper.left")||document.querySelector("#bricks-toolbar .group-wrapper.start"),t="cf-theme-toggle-button",o='',s='',n=`${te}`;if(!e){k("Left panel not found");return}const r=e.querySelector("li.settings")||e.querySelector("li.pages")||e.querySelector("li:not(.logo)"),i=r==null?void 0:r.cloneNode(!0);if(!i){k("Button not found");return}i.classList.remove("settings"),i.classList.remove("pages"),i.classList.add("theme-toggle","cf-theme-toggle"),i.setAttribute("data-balloon","Toggle Core Framework theme");const c=i.querySelector("svg");c==null||c.remove();const h=i.querySelector("span");e.appendChild(i);const l=((E=window==null?void 0:window.localStorage)==null?void 0:E.getItem("cf-theme"))==="dark";if(h){h.innerHTML=o+s+n;const d=h.querySelector(".cf-theme-icon--sun"),g=h.querySelector(".cf-theme-icon--moon");d&&(d.style.display=l?"none":"block"),g&&(g.style.display=l?"block":"none")}const u=document.createElement("style");u.appendChild(document.createTextNode(` + `,L=(a,...e)=>console.log("[Core Framework]",a,...e),oe=(a,e)=>a.find(t=>{var o;return(o=t.textContent)==null?void 0:o.trim().includes(e.family)});let Q=!1;const re=()=>{var f,T,E;if(Q||!P("bricks_enable_dark_mode_preview"))return;Q=!0;const a=(T=(f=window==null?void 0:window.core_framework_connector)==null?void 0:f.theme_mode)!=null?T:"light",e="cf-theme-toggle-button",t="#bricks-toolbar, .bricks-toolbar",o=":is(#bricks-toolbar, .bricks-toolbar) .group-wrapper",r='',n='',s=`${ne}`,i=document.createElement("li");i.classList.add("theme-toggle","cf-theme-toggle"),i.setAttribute("data-balloon","Toggle Core Framework theme"),i.setAttribute("aria-label","Toggle Core Framework theme"),i.setAttribute("role","button"),i.tabIndex=0;const c=document.createElement("span");c.className="bricks-svg-wrapper",c.setAttribute("aria-hidden","true"),c.innerHTML=r+n+s,i.appendChild(c);const b=document.createElement("style");b.appendChild(document.createTextNode(` .cf-theme-toggle { position: relative; } - .cf-theme-toggle span { + .cf-theme-toggle > .bricks-svg-wrapper { position: relative; display: flex; align-items: center; @@ -39,15 +39,15 @@ width: 10px !important; height: 10px !important; } - `)),document.head.appendChild(u);const m=()=>window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"cf-theme-dark":"cf-theme-light",f=d=>{const g=i.querySelector(".cf-theme-icon--sun"),v=i.querySelector(".cf-theme-icon--moon");g&&(g.style.display=d?"none":"block"),v&&(v.style.display=d?"block":"none")};(b=document.getElementById(A))==null||b.addEventListener("load",()=>setTimeout(()=>{var w,L,V,M,x,H;const d=(w=document.getElementById(A))==null?void 0:w.contentDocument,g=d==null?void 0:d.querySelector("html"),v=document.querySelector("html");if(d&&g){g.classList.remove("cf-theme-dark","cf-theme-light"),(L=v==null?void 0:v.classList)==null||L.remove("cf-theme-dark","cf-theme-light");const I=(V=window==null?void 0:window.localStorage)==null?void 0:V.getItem("cf-theme"),T=String(a==="auto"?m():`cf-theme-${a}`);g.classList.add(I?`cf-theme-${I}`:T),(M=v==null?void 0:v.classList)==null||M.add(I?`cf-theme-${I}`:T)}if(f((H=(x=v==null?void 0:v.classList)==null?void 0:x.contains("cf-theme-dark"))!=null?H:!1),!d){k("Iframe document not found");return}[...d.getElementsByClassName(t)].forEach(I=>{var T;I.classList.add((T=v==null?void 0:v.classList)!=null&&T.contains("cf-theme-dark")?"cf-theme-light":"cf-theme-dark")})},5)),i.addEventListener("click",d=>{var V,M,x,H;d.preventDefault(),d.stopPropagation();const g=(V=document.getElementById(A))==null?void 0:V.contentDocument;if(!g){k("Iframe document not found");return}const v=g.querySelector("html"),w=document.querySelector("html");if(!v){k("Iframe html not found");return}v.classList.toggle("cf-theme-dark"),v.classList.toggle("cf-theme-light"),(M=w==null?void 0:w.classList)==null||M.toggle("cf-theme-dark"),(x=w==null?void 0:w.classList)==null||x.toggle("cf-theme-light");const L=v.classList.contains("cf-theme-dark");f(L),(H=window==null?void 0:window.localStorage)==null||H.setItem("cf-theme",L?"dark":"light"),[...g.getElementsByClassName(t)].forEach(I=>{const T=[...I.classList].filter(K=>!["cf-theme-dark","cf-theme-light"].includes(K));T.push(L?"cf-theme-light":"cf-theme-dark"),I.className=T.join(" ")})})},se=()=>{var a,e;try{const t=_.globalProperties();if(!(t!=null&&t.$_state)||t.$_state.activePanel!=="element")return;const o=(a=t.$_state)==null?void 0:a.activeElement,s=o==null?void 0:o.id;if(!s)return;const n=(e=document.getElementById(A))==null?void 0:e.contentWindow;if(!n)return;const r=o.settings._cssId?`#${o.settings._cssId}`:`#brxe-${s}`,i=n.document.querySelector(r);if(!i)return;const c=document.querySelectorAll("div.bricks-control-popup li[data-class-id]");if(c.length<1)return;c.forEach(h=>{var u;const y=(u=h.querySelector("span.name"))==null?void 0:u.textContent;if(!y)return;const l=y.substring(1);h.onmouseenter=()=>{i.classList.add(l)},h.onmouseleave=()=>{i.classList.remove(l)},h.onclick=()=>{i.classList.remove(l)}})}catch(t){k("applyClassOnHover error:",t)}},re=()=>{if(!D("bricks_apply_class_on_hover"))return;const a=document.querySelector("#bricks-panel-inner");if(!a){k("Panel not found, can't initialize preview of classes on hover");return}new MutationObserver(se).observe(a,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class"]})},G=a=>{var t,o,s,n,r;if(!a)return!1;let e=a.closest("[data-controlkey], [data-control]");for(;e;){const i=(o=(t=e.dataset.controlkey)==null?void 0:t.toLowerCase())!=null?o:"",c=e.id.toLowerCase();if(i.includes("csscustom")||c.includes("csscustom")||e.querySelector("[id='_cssCustom'], [id='raw-_cssCustom']")||((n=(s=e.querySelector("label"))==null?void 0:s.textContent)==null?void 0:n.trim().toLowerCase())==="custom css")return!0;e=(r=e.parentElement)==null?void 0:r.closest("[data-controlkey], [data-control]")}return!1},Q=a=>{var e,t,o;return(o=(t=(e=a==null?void 0:a.closest(".options-wrapper"))==null?void 0:e.parentElement)==null?void 0:t.querySelector(".variable-picker-button"))!=null?o:document.querySelector(".variable-picker-button.open")},F=(a,e)=>{const t=Q(a);return G(t)||G(e)||G(a)},ie=()=>{var m,f,p,C;const a=_.globalProperties();if(a.$_state.activePanel!=="element"||!((f=(m=a.$_state)==null?void 0:m.activeElement)!=null&&f.id))return;const e=document.querySelector(".expand .options-wrapper"),t=e==null?void 0:e.querySelector(".searchable"),o=e==null?void 0:e.querySelector(".dropdown"),s=o==null?void 0:o.querySelectorAll(".variable-picker-item:not(.title)"),n=(p=document.querySelector(".variable-picker-button.open"))==null?void 0:p.previousElementSibling;if(!n||!(s!=null&&s.length)||!e||!o||!t||F(e,n))return;const r=E=>`var(--${E})`,i=E=>{n.value=E,n.dispatchEvent(new Event("input")),n.focus()};let c=(C=n.value)!=null?C:" ";const h=[];s.forEach(E=>{var g,v,w,L;const b=(v=(g=E.querySelector("span:first-of-type"))==null?void 0:g.textContent)!=null?v:"",d=(L=(w=E.querySelector("span.option-value"))==null?void 0:w.textContent)!=null?L:"";h.push({[b]:d})}),o.remove();const y=document.createElement("ul");y.classList.add("custom-dropdown"),y.setAttribute("style",` + `)),document.head.appendChild(b);const v=()=>window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"cf-theme-dark":"cf-theme-light",l=u=>{const m=i.querySelector(".cf-theme-icon--sun"),p=i.querySelector(".cf-theme-icon--moon");m&&(m.style.display=u?"none":"block"),p&&(p.style.display=u?"block":"none"),i.setAttribute("aria-pressed",String(u))},d=()=>{var y,k,w,M,S,C;const u=(y=document.getElementById(I))==null?void 0:y.contentDocument,m=u==null?void 0:u.querySelector("html"),p=document.querySelector("html");if(u&&m){m.classList.remove("cf-theme-dark","cf-theme-light"),(k=p==null?void 0:p.classList)==null||k.remove("cf-theme-dark","cf-theme-light");const O=(w=window==null?void 0:window.localStorage)==null?void 0:w.getItem("cf-theme"),x=O!=null?O:a,_=x==="auto"?v():`cf-theme-${x}`;m.classList.add(_),(M=p==null?void 0:p.classList)==null||M.add(_)}if(l((C=(S=p==null?void 0:p.classList)==null?void 0:S.contains("cf-theme-dark"))!=null?C:!1),!u){L("Iframe document not found");return}[...u.getElementsByClassName(e)].forEach(O=>{var x;O.classList.remove("cf-theme-dark","cf-theme-light"),O.classList.add((x=p==null?void 0:p.classList)!=null&&x.contains("cf-theme-dark")?"cf-theme-light":"cf-theme-dark")})};document.addEventListener("load",u=>{u.target instanceof HTMLIFrameElement&&u.target.id===I&&setTimeout(d,5)},!0),i.addEventListener("click",u=>{var w,M,S,C;u.preventDefault(),u.stopPropagation();const m=(w=document.getElementById(I))==null?void 0:w.contentDocument;if(!m){L("Iframe document not found");return}const p=m.querySelector("html"),y=document.querySelector("html");if(!p){L("Iframe html not found");return}p.classList.toggle("cf-theme-dark"),p.classList.toggle("cf-theme-light"),(M=y==null?void 0:y.classList)==null||M.toggle("cf-theme-dark"),(S=y==null?void 0:y.classList)==null||S.toggle("cf-theme-light");const k=p.classList.contains("cf-theme-dark");l(k),(C=window==null?void 0:window.localStorage)==null||C.setItem("cf-theme",k?"dark":"light"),[...m.getElementsByClassName(e)].forEach(O=>{const x=[...O.classList].filter(_=>!["cf-theme-dark","cf-theme-light"].includes(_));x.push(k?"cf-theme-light":"cf-theme-dark"),O.className=x.join(" ")})}),i.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),i.click())});const h=()=>{var w,M,S;const u=[...document.querySelectorAll(o)].filter(C=>!C.matches(".is-hidden, .is-empty")),m=(w=u.find(C=>C.matches(".left, .start")))!=null?w:u[0];if(!m)return;const p=[...m.children].filter(C=>C!==i),y=String(Math.max(0,...p.map(C=>Number(getComputedStyle(C).order)||0))+1);i.style.order!==y&&(i.style.order=y);const k=(S=(M=p.find(C=>C.hasAttribute("data-balloon-pos")))==null?void 0:M.getAttribute("data-balloon-pos"))!=null?S:"bottom";i.setAttribute("data-balloon-pos",k),i.parentElement!==m&&m.appendChild(i)};new MutationObserver(u=>{u.some(p=>{var k;const y=p.target;return!(y instanceof Element)||y===i?!1:y.matches(t)||y.matches(o)?!0:p.type==="attributes"?p.attributeName==="style"&&((k=y.parentElement)==null?void 0:k.matches(o)):[...p.addedNodes,...p.removedNodes].some(w=>w instanceof Element&&(w.matches(t)||w.querySelector(t)))})&&h()}).observe((E=document.querySelector("#bricks-workspace"))!=null?E:document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style"]}),h(),d()},se=()=>{var a,e;try{const t=D.globalProperties();if(!(t!=null&&t.$_state)||t.$_state.activePanel!=="element")return;const o=(a=t.$_state)==null?void 0:a.activeElement,r=o==null?void 0:o.id;if(!r)return;const n=(e=document.getElementById(I))==null?void 0:e.contentWindow;if(!n)return;const s=o.settings._cssId?`#${o.settings._cssId}`:`#brxe-${r}`,i=n.document.querySelector(s);if(!i)return;const c=document.querySelectorAll("div.bricks-control-popup li[data-class-id]");if(c.length<1)return;c.forEach(b=>{var d;const v=(d=b.querySelector("span.name"))==null?void 0:d.textContent;if(!v)return;const l=v.substring(1);b.onmouseenter=()=>{i.classList.add(l)},b.onmouseleave=()=>{i.classList.remove(l)},b.onclick=()=>{i.classList.remove(l)}})}catch(t){L("applyClassOnHover error:",t)}},ie=()=>{if(!P("bricks_apply_class_on_hover"))return;const a=document.querySelector("#bricks-panel-inner");if(!a){L("Panel not found, can't initialize preview of classes on hover");return}new MutationObserver(se).observe(a,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class"]})},G=a=>{var t,o,r,n,s;if(!a)return!1;let e=a.closest("[data-controlkey], [data-control]");for(;e;){const i=(o=(t=e.dataset.controlkey)==null?void 0:t.toLowerCase())!=null?o:"",c=e.id.toLowerCase();if(i.includes("csscustom")||c.includes("csscustom")||e.querySelector("[id='_cssCustom'], [id='raw-_cssCustom']")||((n=(r=e.querySelector("label"))==null?void 0:r.textContent)==null?void 0:n.trim().toLowerCase())==="custom css")return!0;e=(s=e.parentElement)==null?void 0:s.closest("[data-controlkey], [data-control]")}return!1},Y=a=>{var e,t,o;return(o=(t=(e=a==null?void 0:a.closest(".options-wrapper"))==null?void 0:e.parentElement)==null?void 0:t.querySelector(".variable-picker-button"))!=null?o:document.querySelector(".variable-picker-button.open")},F=(a,e)=>{const t=Y(a);return G(t)||G(e)||G(a)},ae=()=>{var h,g,f,T;const a=D.globalProperties();if(a.$_state.activePanel!=="element"||!((g=(h=a.$_state)==null?void 0:h.activeElement)!=null&&g.id))return;const e=document.querySelector(".expand .options-wrapper"),t=e==null?void 0:e.querySelector(".searchable"),o=e==null?void 0:e.querySelector(".dropdown"),r=o==null?void 0:o.querySelectorAll(".variable-picker-item:not(.title)"),n=(f=document.querySelector(".variable-picker-button.open"))==null?void 0:f.previousElementSibling;if(!n||!(r!=null&&r.length)||!e||!o||!t||F(e,n))return;const s=E=>`var(--${E})`,i=E=>{n.value=E,n.dispatchEvent(new Event("input")),n.focus()};let c=(T=n.value)!=null?T:" ";const b=[];r.forEach(E=>{var p,y,k,w;const u=(y=(p=E.querySelector("span:first-of-type"))==null?void 0:p.textContent)!=null?y:"",m=(w=(k=E.querySelector("span.option-value"))==null?void 0:k.textContent)!=null?w:"";b.push({[u]:m})}),o.remove();const v=document.createElement("ul");v.classList.add("custom-dropdown"),v.setAttribute("style",` max-height: calc(32px * 10); overflow: hidden; overflow-y: auto; position: relative; scrollbar-color: rgba(0,0,0,.4) rgba(0,0,0,.2); scrollbar-width: thin; - `);const l=(E,b)=>{E.forEach(d=>{const[g,v]=Object.entries(d)[0]||[];b.insertAdjacentHTML("beforeend",` + `);const l=(E,u)=>{E.forEach(m=>{const[p,y]=Object.entries(m)[0]||[];u.insertAdjacentHTML("beforeend",`
  • - ${g} - ${v} + ${p} + ${y}
  • - `)}),b.querySelectorAll(".variable-picker-item").forEach(d=>{d.addEventListener("mouseenter",()=>{var v,w;const g=(w=(v=d.querySelector("span:first-of-type"))==null?void 0:v.textContent)!=null?w:"";g&&i(r(g))}),d.addEventListener("click",()=>{var v,w;const g=(w=(v=d.querySelector("span:first-of-type"))==null?void 0:v.textContent)!=null?w:"";g&&(c=r(g),n.value=c,n.click())})})};l(h,y),e.appendChild(y),t.addEventListener("click",E=>{E.preventDefault(),E.stopPropagation()}),t.addEventListener("input",()=>{const E=t.value.toLowerCase(),b=h.filter(d=>{var g,v;return((v=(g=Object.keys(d)[0])==null?void 0:g.toLowerCase())!=null?v:"").includes(E)});y.innerHTML="",l(b,y)});const u=new IntersectionObserver(E=>{E.forEach(b=>{b.isIntersecting&&!b.target.classList.contains("open")&&b.target.click()})},{root:n.parentElement});e.addEventListener("mouseleave",()=>{i(c),u.observe(n.nextElementSibling)}),u.disconnect()},ae=()=>{var i,c,h,y;const a=document.querySelectorAll(".variable-picker-item:not(.cf-b22-processed):not(.title)");if(!a.length)return;let e="",t=!1,o=null;const s=l=>{var m;const u=Q(l);return(m=u==null?void 0:u.closest("[data-control]"))==null?void 0:m.querySelector("input")},n=(l,u,m=!1)=>{l.value=u,l.dispatchEvent(new Event("input",{bubbles:!0})),m&&l.dispatchEvent(new Event("change",{bubbles:!0}))};a.forEach(l=>{var f;l.classList.add("cf-b22-processed");const u=(f=l.querySelector("span:first-of-type"))==null?void 0:f.textContent;if(!u)return;const m=`var(--${u})`;l.addEventListener("mouseenter",()=>{const p=s(l);p&&(F(l,p)||(t||(e=p.value,o=p,t=!0),n(p,m)))}),l.addEventListener("click",()=>{const p=o!=null?o:s(l);p&&(F(l,p)||(t=!1,n(p,m,!0),o=null))})});const r=(y=(i=a[0])==null?void 0:i.closest(".options-wrapper"))!=null?y:(h=(c=a[0])==null?void 0:c.closest("ul"))==null?void 0:h.parentElement;r&&!r.classList.contains("cf-b22-wrapper-processed")&&(r.classList.add("cf-b22-wrapper-processed"),r.addEventListener("mouseleave",()=>{t&&o&&(n(o,e),t=!1,o=null)}))},le=()=>{if(!D("bricks_apply_variable_on_hover"))return;const a=document.querySelector("#bricks-panel-inner:not(div.bricks-control-popup *)");if(!a){k("Inner panel not found, can't initialize preview of variables on hover");return}let e=!1;const t=100;new MutationObserver(()=>{ie(),e||(e=!0,setTimeout(()=>{ae(),e=!1},t))}).observe(a,{subtree:!0,childList:!0,attributes:!0})};class ve{constructor(){this.variables=[];this.variablesGroups={};this.colorVariables=[];this.previewOnHover=!0;this.init(),this.boundOnInputFocus=this.onInputFocus.bind(this)}async init(){var r,i,c;if(!D("bricks_enable_variable_dropdown"))return;if((c=(i=(r=window==null?void 0:window.ADMINBRXC)==null?void 0:r.globalSettings)==null?void 0:i.classFeatures)!=null&&c.includes("autocomplete-variable")){k("Autocomplete variable feature already enabled in Advanced Themer. Only one instance of this feature can be enabled at a time.");return}if(!await this.getVariables())return;const t=document.querySelector("#bricks-panel-inner");if(!t)return;const o=100;let s=!1;new MutationObserver(()=>{s||(s=!0,this.setVariableAutocomplete(),setTimeout(()=>{s=!1},o))}).observe(t,{subtree:!0,childList:!0})}autoComplete({input:e,variables:t,type:o,ignorePreview:s=!1}){const n=this;let r=0;if(e.dataset.autocomplete==="true")return;function i(m){var p;if(!m.length)return!1;c(m),r>=m.length&&(r=0),r<0&&(r=m.length-1),(p=m[r])==null||p.classList.add("selected");const f=m[r];f==null||f.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})}function c(m){for(const f of m)f.classList.remove("selected")}function h(m,f){var C;const p=document.getElementsByClassName("autocomplete-items");for(const E of p)(f||m!=E&&m!==e)&&((C=E==null?void 0:E.parentNode)==null||C.removeChild(E))}e.setAttribute("data-autocomplete","true");function y(m){var w;if(m.metaKey||m.altKey||m.key==="Meta"||m.key==="Alt"||m.keyCode==40||m.keyCode==38||m.keyCode==13)return;let f,p,C,E,b;const d=m.target,g=d.value;if(h(),!g)return!1;if(r=-1,f=document.createElement("div"),f.setAttribute("id","autocomplete-list"),f.setAttribute("class","autocomplete-items bricks-control-popup bottom cf-variable-autocomplete"),f.style.gap="0px",D("bricks_enable_variable_ui_hint")&&D("bricks_variable_ui")){const L=document.createElement("div");L.classList.add("cf-variable-dropdown-hint"),L.classList.add("variable-dropdown-item"),L.textContent="Right-click to open Variable UI",L.style.padding="4px 10px",L.style.color="var(var(--cf-ui--text), white)",L.style.opacity="0.7",L.style.fontSize="12px",f.appendChild(L)}for((w=d==null?void 0:d.parentNode)==null||w.appendChild(f),b=document.createElement("ul"),f.appendChild(b),C=0,E=0;C{var T;d.value=(T=d.dataset.autocompleteInitial)!=null?T:"";const I=new Event("input",{bubbles:!1,cancelable:!0});d.dispatchEvent(I),d.removeAttribute("data-autocomplete-initial")},0)}),p.addEventListener("mouseenter",function(H){setTimeout(()=>{var T,K;if(d.setAttribute("data-autocomplete-initial",d.value),x===!1)return;d.value=String((K=(T=this.getElementsByTagName("input"))==null?void 0:T[0])==null?void 0:K.value);const I=new Event("input",{bubbles:!1,cancelable:!0});d.dispatchEvent(I),x=!1},0)})}b.appendChild(p)}}E===0&&h()}e.removeEventListener("keyup",y),e.addEventListener("keyup",y);const l=m=>{var C,E;const f=document.getElementById(`${e.id}autocomplete-list`);if(!f)return;const p=[...f.getElementsByTagName("li")];switch(m.key){case"ArrowDown":{if(m.preventDefault(),!(p.length>0&&p.length>r+1))return;r++,i(p);const d=p.find(w=>w.classList.contains("selected")),g=(d==null?void 0:d.querySelector('input[type="hidden"]')).value;e.value=g;const v=new Event("input",{bubbles:!1,cancelable:!0});e.dispatchEvent(v);return}case"ArrowUp":{if(m.preventDefault(),!(p.length&&r-1>=0))return;r--,i(p);const d=p.find(w=>w.classList.contains("selected")),g=(C=d==null?void 0:d.querySelector('input[type="hidden"]'))==null?void 0:C.value;e.value=g;const v=new Event("input",{bubbles:!1,cancelable:!0});e.dispatchEvent(v);return}case"Enter":{m.preventDefault(),r>-1&&p.length&&((E=p==null?void 0:p[r])==null||E.click());return}case"Escape":case"Tab":h()}};e.removeEventListener("keydown",l),e.addEventListener("keydown",l);const u=m=>{m.target!==e&&h()};document.removeEventListener("click",u),document.addEventListener("click",u)}sortVariables(e){var c,h,y;const t=e.closest("[data-controlkey]"),o=(c=t==null?void 0:t.dataset.controlkey)==null?void 0:c.toLocaleLowerCase(),s=["typography","font"].some(l=>o==null?void 0:o.includes(l)),n=["padding","margin","gap","width","height"].some(l=>o==null?void 0:o.includes(l)),r=(y=(h=e.parentElement)==null?void 0:h.parentElement)==null?void 0:y.classList.contains("color-input");let i=[];for(const[l,u]of Object.entries(this.variablesGroups)){if(r&&l==="colorStyles"){i=[...u];break}if(l!=="colorStyles"){if(s&&l==="typographyStyles"){i.unshift(...u);continue}if(!s&&l==="typographyStyles"){i.push(...u);continue}if(n&&l==="spacingStyles"){i.unshift(...u);continue}if(!n&&l==="spacingStyles"){i.push(...u);continue}i.push(...u)}}return i=i.map(l=>`var(--${l})`),this.variables=i,i}onInputFocus(e){if(!e.isTrusted||e!=null&&e.metaKey||e!=null&&e.altKey)return;const t=e.target;if(!t)return;const o=this.sortVariables(t);this.autoComplete({input:t,variables:o,type:"style"})}setVariableAutocomplete(){setTimeout(()=>{q.includedFields.forEach(e=>{let t;typeof e=="string"?t=Array.from(document.querySelectorAll(e)):t=Array.from(document.querySelectorAll(e.selector)).filter(n=>e.hasChild.some(r=>n.querySelector(r))),t.filter(s=>{var n,r,i;return!((i=(n=s==null?void 0:s.parentNode)==null?void 0:n.closest)!=null&&i.call(n,(r=q==null?void 0:q.excludedFields)==null?void 0:r.join(",")))&&!s.classList.contains("autocomplete-active")}).forEach(s=>{s.classList.add("autocomplete-active");const n=s.querySelector("input[type='text']");n==null||n.removeEventListener("focus",this.boundOnInputFocus),n==null||n.addEventListener("focus",this.boundOnInputFocus)})})},100)}async getVariables(){var e;window.coreframework={nonce:window.wpApiSettings.nonce,rest_url:window.wpApiSettings.root,core_api_url:`${window.wpApiSettings.root}core-framework/v2/`};try{const t=await fetch(`${window.coreframework.core_api_url}get-variables?type=bricks_dropdown`,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":window.coreframework.nonce}});if(t.status!==200)return k("Failed to load variables."),!1;const o=await t.json();return o!=null&&o.variables?(this.variablesGroups=o.variables,this.colorVariables=((e=this.variablesGroups.colorStyles)!=null?e:[]).map(s=>`var(--${s})`),!0):(k("No variables found. Please save changes again in the Core Framework plugin."),!1)}catch(t){return k("Failed to load variables."),!1}}}class Y{constructor(){this.variables={};this.colorSystemData=null;this.variablePrefix="";this.fluid_typography_naming_convention=null;this.fluid_spacing_naming_convention=null;this.recentColorPickerTarget=null;this.recentVariableSelectionTimestamp=0;this.HOVER_VARIABLE_PREVIEW_TIMEOUT=1e3;this.instance=null;this.focusedInput=null;this.tempInputValue=null;this.isOpen=!1;this.stylesGroupsLabelMap={colorStyles:"Colors",typographyStyles:"Typography",spacingStyles:"Spacing",layoutsStyles:"Layouts",designStyles:"Design",componentsStyles:"Components",otherStyles:"Other"};this.logoData="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJUAAAB1CAYAAABH5qPNAAAACXBIWXMAAAhOAAAITgGMMQDsAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAChHSURBVHgB7V3tr2ZXVV9rP3daWkEHE+Mn7YXEDyQmjH9B76AkIBpK8IUYY6cJYCVohzdFY9Ki0WBiwhD9UNDQCyIS/QAaE78YGfSTiUmngICgzIW2lLaUTt+n997nLPfea/3WWvvc2zL0de69z27vPM9zXvbeZ+/f/q3fWnufc5gOcDp9i6xfsbs8Ma1N60UW1wjLcRFZL1zWiaQeIevELMztK3H9r22sH+1/S3Vb+808ZC12kG5tefTvQvhtGXLPUvPHdsbxfWfb3c+s1ajba+qfHOVrIe0Y0c3FTsRxlsVwPDJHpZj9KsnKsH1aHs2uWbMnVNwLQDbeDqgez3/rtcxa7fy731FeuUYHKL33D3c2JpYTtQmurRd1rUzL49OiXuRU6uVNvX+LN4o4GGSSjJqhIdCn4nixzQoP7IxeYf2tHSOkzcoGQuExTzR6O5wF38hqZ8f26hVFI7rTcNTQ4MDRnhfdJXaUsJelYBRxrEgfT22bZtGBQLrNr59LHyDixWj+eswMNKnt9gAqXdxlDarKRMfLcudUrf8b63WeqNd9nG3YKzFQGy69E6UBqH6doiVaE2pvRwpO0Q5AH/nOgXEoeGZPEgqgGTMgewF74FzJiFGSC3ZybugHt2vpYyCV2bmP2JGPEoqBRC+WJV2FsxEoiX20AKdWSRG/8JHRxFm1bUvtJLN23MNYlx2oOpC2d66rl/MbtLt70gaQXr+yBNmQYBtYOkSnurdgu43m9r8YgGbDTiR1Wpgo0L/+I+iDRFoNv8iKM64kMZkNdmcVwcjXDGGiDJeWiST2SkQlVnnrdAEbMugLIINN7UArxPOh4J0/MJayH9iac3WZozpIGIxA036MddmAqukj2t69nnZ2T09cGam3tSOIrV29J7TpWBwNZaR50mM6gxmTAFnG8U4jusuYzkoU1nMDIER2jI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fZjJurk2PQ4qyKd+4cfTSC7aUrLHWFSydtbSrsQ4YL/LOt96Na7XIlxfjdbrWkZQi+RrPkuGY9ukTxBQRA6MYNXsBXF9tAWfCb9gA4ruZHYAEZyB7p6jfKqTwAqQu4itrTWV6Zf151gOS5OvQNYl7ecRJuAeAyKW8LWOhIDBObn7vd4/Wh8TyU4nngEgeoutyq04zqcXQHovyvCCfe1oEoR7J9KIsev10B9dLTta+qn90FjdUcIjv2U3DwlNljwk3QNhbcjI7EVFoIYk7hwE/TA+5oA/g6VE670ixYsa8woUiVrVb13idqWKinGC3iV0qMh1h6/figAqpPb3vk7e+5GTFxcnaDZvDA9f8e7jrWaDDnkHj8GgGKV4WQCan2E0g2d0/ertYPCkwrZPiMJNaD79Rw1ZeDAzFwVS6tCYE+1FMl8Xy/Aauv7n1yhvWSF5RGWmzdseWhwz6wzsE0zv93Tjo+cY9k7Dk7gMvIUjKABQFE2qQXEMZiC0l2hEeM6QGPrtjmWk2LwiHIQHQyzmqwc/Ldjj9+o1PbCxKuX4S2ah9fw155wvFiywlReUVdRqxt5v1TG/p8udJzxe/r0/Y71uUXDQeK0Mo7KlrKa7p9Kef1D8qtb5m8y+vOktHLB0Iju4AWyzeOE3Tidp/G/P9fhEKmj7XiKe19ASFxi7u080/5LYtN4ZNegPGOovJ+K6AHJ9WE3qvA7nnWU4eRVAdCIbuT04mfX9Oe8zR7sWLJ9YKv7oKp43ac+u1B0+g4111wWdzEcUhsUyMi2RSGiAVwk7zknAviXw5DtlkwOAksoR0O5rp0KjJBjbavXii6p/jVXgdp7J2jT7BrN1qX2b9O9829TVa06TbSv09NR3Vjiuq40qXn217+066v0z6fl89qT97vh9l+6ZSNjfPXLVFq7RKq/Ts0v8D4+WejbzFd30AAAAASUVORK5CYII=";this.handleDrag=null;this.endDragging=null;this.boundOnKeyDown=null;this.boundOnClick=null;this.innerPanelObserver=null;this.COLOR_STYLE_MAP=[{property:"color",control:"typography"},{property:"backgroundColor",control:"background"},{property:"borderColor",control:"border"}];this.init(),this.boundOnInputClick=this.onInputClick.bind(this),this.boundOnFocusCallback=this.onFocusCallback.bind(this)}getActiveElement(){var s;const e=_.globalProperties();if(e.$_state.activePanel!=="element")return null;const t=(s=e.$_state)==null?void 0:s.activeElement.id,o=e.$_getIframeDoc();return o==null?void 0:o.getElementById(`brxe-${t}`)}applyValueToInput(e,t=!1){this.focusedInput&&(this.focusedInput.value=e,this.focusedInput.dispatchEvent(new Event("input",{bubbles:!0})),t&&this.focusedInput.dispatchEvent(new Event("change",{bubbles:!0})),this.focusedInput.focus())}async init(){var r;if(!D("bricks_variable_ui")||!await this.getVariables())return;const t="bricks-panel-inner";if(!document.getElementById(t))return;const s=100;let n=!1;this.innerPanelObserver=(r=X({selector:`#${t}`,options:{subtree:!0,childList:!0},callback:()=>{n||(n=!0,this.addTriggers(),setTimeout(()=>{n=!1},s))}}))!=null?r:null,this.createInstance(),this.addTriggers(),this.addListeners()}getPrefixedVariableName(e){return e.startsWith(this.variablePrefix)?e:`${this.variablePrefix}${e}`}createVarButton({variable:e,label:t,color:o,transparent:s}){const n=document.createElement("button");if(n.classList.add("cf-variable-ui-list-item"),n.dataset.cftooltip=`var(--${e})`,n.textContent=t!=null?t:e,o){const r=document.createElement("span");r.style.backgroundColor=o,s&&(r.style.opacity=(s/100).toString()),n.prepend(r)}return n.addEventListener("click",()=>{if(!this.focusedInput)return;const r=e.startsWith("var(--")?e:`var(--${e})`;this.applyValueToInput(r,!0),this.tempInputValue=r,this.recentVariableSelectionTimestamp=performance.now(),D("bricks_enable_variable_ui_auto_hide")&&this.close()}),n.addEventListener("mouseenter",()=>{if(performance.now()-this.recentVariableSelectionTimestamp{!this.focusedInput||this.tempInputValue===null||this.applyValueToInput(this.tempInputValue)}),n}createVarWithValueButton({variable:e,value:t,label:o,color:s,transparent:n}){const r=document.createElement("button");if(r.classList.add("cf-variable-ui-list-item"),r.dataset.cftooltip=e,r.textContent=o!=null?o:e,s){const i=document.createElement("span");i.style.backgroundColor=s,n&&(i.style.opacity=(n/100).toString()),r.prepend(i)}return r.addEventListener("click",()=>{this.focusedInput&&(this.applyValueToInput(t,!0),this.tempInputValue=t,this.recentVariableSelectionTimestamp=performance.now(),D("bricks_enable_variable_ui_auto_hide")&&this.close())}),r.addEventListener("mouseenter",()=>{performance.now()-this.recentVariableSelectionTimestamp{!this.focusedInput||this.tempInputValue===null||this.applyValueToInput(this.tempInputValue)}),r}applyColorPreview(e,t){const o=this.getActiveElement();if(o)for(const{property:s,control:n}of this.COLOR_STYLE_MAP)t!=null&&t.closest(`[data-control="${n}"]`)&&(o.style[s]=e)}createColorButton({variable:e,color:t,id:o,darkColor:s,transparent:n}){e=this.getPrefixedVariableName(e);const r=document.createElement("button");if(r.dataset.cftooltip=`var(--${e})`,r.classList.add("cf-variable-ui-list-item-color"),t)if(n!==void 0){r.style.padding="0";const c=document.createElement("div");c.style.setProperty("--cf-variable-ui-color",t),c.style.setProperty("--cf-variable-ui-color-dark",s!=null?s:t),c.style.opacity=(n/100).toString(),c.style.width="100%",c.style.height="100%",r.appendChild(c)}else r.style.setProperty("--cf-variable-ui-color",t),r.style.setProperty("--cf-variable-ui-color-dark",s!=null?s:t);const i=e.startsWith("var(--")?e:`var(--${e})`;return r.addEventListener("click",async c=>{if(c.stopPropagation(),c.preventDefault(),!this.focusedInput){const h=this.recentColorPickerTarget;this.selectColor({name:e}),this.recentVariableSelectionTimestamp=performance.now(),setTimeout(()=>this.applyColorPreview("",h),5);return}this.applyValueToInput(i,!0),this.tempInputValue=i,this.recentVariableSelectionTimestamp=performance.now(),D("bricks_enable_variable_ui_auto_hide")&&this.close()}),r.addEventListener("mouseenter",()=>{if(!(performance.now()-this.recentVariableSelectionTimestamp{var h;if(!this.focusedInput||this.tempInputValue===null){this.applyColorPreview("",this.recentColorPickerTarget);return}this.applyValueToInput(this.tempInputValue);const c=(h=this.focusedInput.previousElementSibling)!=null&&h.classList.contains("oxygen-color-picker-color")?"color":this.focusedInput.getAttribute("data-option");try{window==null||window.$scope.iframeScope.setOptionUnit(c," ")}catch(y){}}),r}createCategoryTitle(e){const t=document.createElement("div");t.classList.add("cf-variable-ui-category-title");const o=document.createElement("b");o.textContent=e,t.appendChild(o);const s=document.createElement("button");return s.classList.add("cf-variable-ui-section-toggle"),t.appendChild(s),t}allowDrag(e){const t=e.querySelector("#cf-variable-ui-header");if(!t)return;let o=!1,s=0,n=0;const r=i=>{[...document.querySelectorAll("iframe")].forEach(h=>{h.style.pointerEvents="none",h.style.userSelect="none"}),o=!0;const c=t.getBoundingClientRect();s=i.clientX-c.left,n=i.clientY-c.top,t&&(t.style.transition="none")};t.removeEventListener("mousedown",r),t.addEventListener("mousedown",r),this.handleDrag&&document.removeEventListener("mousemove",this.handleDrag),this.handleDrag=i=>{if(!o)return;const c=t.getBoundingClientRect(),h=i.clientX,y=i.clientY,l=h-s,u=y-n,m=(l<0?0:l>window.innerWidth-c.width?window.innerWidth-c.width:l)+10,f=u<0?0:u>window.innerHeight-c.height?window.innerHeight-c.height:u;e.style.left=`${m}px`,e.style.top=`${f}px`},document.addEventListener("mousemove",this.handleDrag),this.endDragging&&document.removeEventListener("mouseup",this.endDragging),this.endDragging=i=>{[...document.querySelectorAll("iframe")].forEach(c=>{c.style.pointerEvents="auto",c.style.userSelect="auto"}),o=!1},document.addEventListener("mouseup",this.endDragging)}createExpandableWrapper({title:e}){const t="cf-variable-ui-wrapper",o=document.createElement("div");o.dataset.groupExpand="false",o.classList.add(t);const s=this.createCategoryTitle(e);return s.addEventListener("click",()=>{o.dataset.groupExpand=o.dataset.groupExpand==="true"?"false":"true"}),o.appendChild(s),o}createInstance(){var u,m;const e=document.createElement("cf-variable-ui");e.classList.add("cf-variable-ui"),e.classList.add("is-bricks"),e.style.position="fixed",e.style.display="none",e.style.width="300px",e.style.height="500px",e.style.zIndex="99999999999",e.style.left=`${(window.innerWidth/2-200).toString()}px`,e.style.top=`${(window.innerHeight/2-300).toString()}px`;const t=document.createElement("div");t.id="cf-variable-ui-header",t.style.width="100%";const o=document.createElement("img");o.src=this.logoData,o.classList.add("cf-variable-ui-logo"),o.style.setProperty("width","30px");const s=document.createElement("a");s.href=`${new URL(window.location.href).origin}/wp-admin/admin.php?page=core-framework`,s.target="_blank",s.textContent="Open",s.dataset.cftooltip="Open Core Framework plugin",s.classList.add("cf-variable-ui-open-core-framework");const n=document.createElement("button");n.innerHTML='',n.classList.add("cf-variable-ui-close-button"),n.dataset.cftooltip="Close",n.addEventListener("click",()=>this.close()),t.appendChild(o),t.appendChild(s),t.appendChild(n),e.appendChild(t);const r=(m=(u=this.colorSystemData)==null?void 0:u.groups)!=null?m:[],i=this.createExpandableWrapper({title:"Color System"});i.dataset.type="color-system",r.forEach(({colors:f,name:p,isDisabled:C})=>{if(C)return;const E=document.createElement("div");E.classList.add("cf-variable-ui-color-wrapper"),f.forEach(b=>{var M,x,H,I,T,K;const d=this.createColorButton({variable:b.name,color:b.value,darkColor:b.darkValue,id:b.id}),g=document.createElement("div"),v=document.createElement("div");v.classList.add("cf-variable-ui-color-title"),v.textContent=this.getPrefixedVariableName(b.name),v.style.setProperty("font-weight","bold"),g.classList.add("cf-variable-ui-color-wrapper-second"),g.appendChild(v),g.appendChild(d);const w=(x=(M=b.shades)==null?void 0:M.map((S,O)=>{var U,N;const R=(N=(U=b.darkShades)==null?void 0:U[O])==null?void 0:N.value;return this.createColorButton({variable:S.name,color:S.value,id:`${b.id}.d.${O}`,darkColor:R})}))!=null?x:[];if(b.isShades&&w.length){const S=document.createElement("div");S.classList.add("cf-variable-ui-color-title"),S.textContent=`Shades of ${this.getPrefixedVariableName(b.name)}`;const O=document.createElement("div");O.classList.add("cf-variable-ui-shades-wrapper"),w.forEach(R=>{O.appendChild(R)}),g.appendChild(S),g.appendChild(O)}const L=(I=(H=b.tints)==null?void 0:H.map((S,O)=>{var U,N;const R=(N=(U=b.darkTints)==null?void 0:U[O])==null?void 0:N.value;return this.createColorButton({variable:S.name,color:S.value,darkColor:R,id:`${b.id}.l.${O}`})}))!=null?I:[];if(b.isTints&&L.length){const S=document.createElement("div");S.classList.add("cf-variable-ui-color-title"),S.textContent=`Tints of ${this.getPrefixedVariableName(b.name)}`;const O=document.createElement("div");O.classList.add("cf-variable-ui-tints-wrapper"),L.forEach(R=>{O.appendChild(R)}),g.appendChild(S),g.appendChild(O)}const V=(K=(T=b.transparentVariables)==null?void 0:T.map(S=>this.createColorButton({variable:`${b.name}-${S}`,color:b.value,darkColor:b.darkValue,transparent:Number(S),id:`${b.id}.t.${b.name.split("-").slice(-1)[0]}`})))!=null?K:[];if(b.transparent&&V.length){const S=document.createElement("div");S.classList.add("cf-variable-ui-color-title"),S.textContent=`Transparent values of ${this.getPrefixedVariableName(b.name)}`;const O=document.createElement("div");O.classList.add("cf-variable-ui-transparent-wrapper"),V.forEach(R=>{O.appendChild(R)}),g.appendChild(S),g.appendChild(O)}E.appendChild(g)}),i.appendChild(E)});const c=document.createElement("div");c.classList.add("cf-variable-ui-scroll-container"),c.appendChild(i),Object.entries(this.variables).forEach(([f,p])=>{var b;if(Object.keys(p).length===0)return;const E=this.createExpandableWrapper({title:(b=this.stylesGroupsLabelMap[f])!=null?b:f});E.dataset.type=f,Object.entries(p).forEach(([d,g])=>{const v=M=>{if(d==="Fluid Typography"||d==="Fluid Spacing"){const x=`${this.variablePrefix+(d==="Fluid Typography"?this.fluid_typography_naming_convention:this.fluid_spacing_naming_convention)}-`;return M.replace(x,"")}return M},w=document.createElement("div"),L=document.createElement("b");L.textContent=d,L.classList.add("cf-variable-ui-row-title"),w.appendChild(L),w.classList.add("cf-variable-ui-group");const V=document.createElement("div");V.classList.add("cf-variable-ui-container"),g.forEach(M=>{const x=this.createVarButton({variable:M,label:v(M)});V.appendChild(x)}),w.appendChild(V),E.appendChild(w)}),c.appendChild(E)});const h=new Array(12).fill(0).map((f,p)=>({variable:String(p+1),value:`repeat(${p+1}, minmax(0, 1fr))`})),y=[{variable:"1 / 2",value:"minmax(0, 1fr) minmax(0, 2fr)"},{variable:"2 / 1",value:"minmax(0, 2fr) minmax(0, 1fr)"},{variable:"1 / 3",value:"minmax(0, 1fr) minmax(0, 3fr)"},{variable:"3 / 1",value:"minmax(0, 3fr) minmax(0, 1fr)"},{variable:"2 / 3",value:"minmax(0, 2fr) minmax(0, 3fr)"},{variable:"3 / 2",value:"minmax(0, 3fr) minmax(0, 2fr)"},{variable:"1 / 4",value:"minmax(0, 1fr) minmax(0, 4fr)"},{variable:"4 / 1",value:"minmax(0, 4fr) minmax(0, 1fr)"},{variable:"3 / 4",value:"minmax(0, 3fr) minmax(0, 4fr)"},{variable:"4 / 3",value:"minmax(0, 4fr) minmax(0, 3fr)"}],l=this.createExpandableWrapper({title:"Grid"});l.dataset.type="_gridVariables",[h,y].forEach((f,p)=>{const C=document.createElement("div"),E=document.createElement("b");E.textContent=p===0?"Symmetric Grids":"Asymmetric Grids",E.classList.add("cf-variable-ui-row-title"),C.appendChild(E),C.classList.add("cf-variable-ui-group");const b=document.createElement("div");b.classList.add("cf-variable-ui-container"),f.forEach(d=>{const g=this.createVarWithValueButton({variable:d.value,value:d.value,label:d.variable});b.appendChild(g)}),C.appendChild(b),l.appendChild(C)}),c.appendChild(l),e.appendChild(c),document.body.appendChild(e),this.instance=e,this.allowDrag(e),setTimeout(()=>{this.reposition()},100)}open(){if(!this.instance)return;this.instance.style.setProperty("display","block"),this.isOpen=!0;const e=document.querySelector("html");e&&(e.dataset.cfVariableUiOpen="true")}close(){if(!this.instance)return;this.instance.style.setProperty("display","none"),this.tempInputValue=null,this.recentColorPickerTarget=null,this.isOpen=!1;const e=document.querySelector("html");e&&(e.dataset.cfVariableUiOpen="false")}destroy(){this.boundOnKeyDown&&(document.removeEventListener("keydown",this.boundOnKeyDown),this.boundOnKeyDown=null),this.boundOnClick&&(document.removeEventListener("click",this.boundOnClick),this.boundOnClick=null),this.handleDrag&&(document.removeEventListener("mousemove",this.handleDrag),this.handleDrag=null),this.endDragging&&(document.removeEventListener("mouseup",this.endDragging),this.endDragging=null),this.innerPanelObserver&&(this.innerPanelObserver.disconnect(),this.innerPanelObserver=null),this.instance&&(this.instance.remove(),this.instance=null)}async getVariables(){window.coreframework={nonce:window.wpApiSettings.nonce,rest_url:window.wpApiSettings.root,core_api_url:`${window.wpApiSettings.root}core-framework/v2/`};const e="Please save changes again in the Core Framework plugin. Make sure the Bricks integration is enabled. If the error persists, please contact support at https://coreframework.com/";try{const t=await fetch(`${window.coreframework.core_api_url}builders-var-ui`,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":window.coreframework.nonce}});if(t.status!==200)return k(`Failed to load variables. ${e}`),!1;const o=await t.json();return o!=null&&o.variables?(this.variables=$(o.variables),o.color_system_data?(this.colorSystemData=o.color_system_data,this.variablePrefix=o.variable_prefix,this.fluid_typography_naming_convention=o.fluid_typography_naming_convention,this.fluid_spacing_naming_convention=o.fluid_spacing_naming_convention,!0):(k(`No color system data found. ${e}`),!1)):(k(`No variables found. ${e}`),!1)}catch(t){return k(`Failed to load variables. ${e}`),!1}}reposition(){this.instance&&(this.instance.style.top=`${(window.innerHeight/2-300).toString()}px`,this.instance.style.left="320px")}setWrapperVisibility(e){if(!this.instance)return;const t=[["color-system",e.color],["typographyStyles",e.typography],["spacingStyles",e.spacing],["designStyles",e.design],["_gridVariables",e.grid]];for(const[o,s]of t){const n=this.instance.querySelector(`.cf-variable-ui-wrapper[data-type='${o}']`);n&&(n.dataset.groupExpand=s?"true":"false",e.color&&!e.typography&&!e.spacing&&!e.design&&!e.grid?n.dataset.hidden=o==="color-system"?"false":"true":n.dataset.hidden=o==="color-system"&&!e.color?"true":"false")}}onInputClick(e){var i,c,h,y,l;const t=e.type==="contextmenu"&&D("bricks_enable_variable_context_menu");if(t&&(e.preventDefault(),e.stopPropagation()),!this.isOpen&&!(e!=null&&e.metaKey||e!=null&&e.altKey)&&!t)return;const o=e.target;if(!o)return;(i=document==null?void 0:document.getSelection())==null||i.removeAllRanges(),e.preventDefault(),e.stopPropagation(),this.focusedInput=o,this.tempInputValue=o.value;const s=o.closest("[data-controlkey]"),n=(h=(c=s==null?void 0:s.dataset.controlkey)==null?void 0:c.toLocaleLowerCase())!=null?h:"",r=(l=(y=o.parentElement)==null?void 0:y.parentElement)==null?void 0:l.classList.contains("color-input");this.setWrapperVisibility({color:!!r,typography:["typography","font"].some(u=>n.includes(u)),spacing:["padding","margin","gap","width","height"].some(u=>n.includes(u)),design:n==="_border",grid:["_gridtemplatecolumns","_gridtemplaterows"].some(u=>n.includes(u))}),this.open()}onFocusCallback(e){const t=e.target;this.focusedInput=t}showBricksColorPopUp(){document.querySelectorAll(".cf-variable-ui-style").forEach(e=>{e.remove()})}hideBricksColorPopUp(){if(document.querySelector(".cf-variable-ui-style"))return;const e=".bricks-control-popup { display: none !important; }",t=document.createElement("style");t.id="cf-variable-ui-bricks-popup",t.appendChild(document.createTextNode(e)),t.classList.add("cf-variable-ui-style"),document.head.appendChild(t)}async selectColor({name:e}){var n,r,i,c,h,y;this.hideBricksColorPopUp();const t=e.startsWith("var(--")?e:`var(--${e})`,o=document.querySelector(".bricks-control-popup .color-palette.grid"),s=document.querySelector(".bricks-control-popup .color-palette");if(o&&((r=(n=o.querySelector(`[data-balloon="${t}"]`))==null?void 0:n.parentElement)==null||r.click()),s){const l=s.querySelectorAll(".color-name>span"),u=Array.from(l).reverse().find(m=>t.includes(m.textContent));(i=u==null?void 0:u.parentElement)==null||i.click()}else k("Failed to select color. Color grid not found.");o||((h=(c=this.recentColorPickerTarget)==null?void 0:c.closest(".bricks-control-preview"))==null||h.click(),await new Promise(l=>setTimeout(l,25))),(y=document.body)==null||y.click(),await new Promise(l=>setTimeout(l,2)),document.querySelector(".bricks-control-popup")?(setTimeout(()=>{var l;(l=document.body)==null||l.click(),setTimeout(()=>this.showBricksColorPopUp(),5)},5),k("Failed to close color picker. Delaying close.")):this.showBricksColorPopUp()}handleColorVariableUiColorTriggerClick({target:e}){var n,r,i,c;(n=document==null?void 0:document.getSelection())==null||n.removeAllRanges(),this.setWrapperVisibility({color:!0}),document.querySelector(".bricks-control-popup .color-palette")||e.click(),this.recentColorPickerTarget=e;const o=(i=e.closest(".has-variables"))!=null?i:(r=e.closest(".control-inner"))==null?void 0:r.querySelector(".has-variables"),s=o==null?void 0:o.querySelector("input");this.focusedInput=s,this.tempInputValue=(c=s==null?void 0:s.value)!=null?c:null,this.open()}addTriggers(){setTimeout(()=>{q.includedFields.forEach(t=>{(typeof t=="string"?[...document.querySelectorAll(t)]:[...document.querySelectorAll(t.selector)].filter(s=>t.hasChild.some(n=>s.querySelector(n)))).forEach(s=>{var r;const n=(r=s.querySelector("input[type='text']"))!=null?r:s.querySelector("input:not([type='hidden']):not([type='checkbox']):not([type='radio'])");!n||n.getAttribute("cf-variable-ui")==="true"||(n.removeEventListener("click",this.boundOnInputClick),n.addEventListener("click",this.boundOnInputClick),n.removeEventListener("focus",this.boundOnFocusCallback),n.addEventListener("focus",this.boundOnFocusCallback),D("bricks_enable_variable_context_menu")&&(n.removeEventListener("contextmenu",this.boundOnInputClick),n.addEventListener("contextmenu",this.boundOnInputClick)),n.setAttribute("cf-variable-ui","true"))})}),[...document.querySelectorAll(".bricks-control-preview")].filter(t=>{var n;const o=t.closest(".control-inner"),s=(n=o==null?void 0:o.querySelector("label"))==null?void 0:n.getAttribute("for");return["color","fill","stroke"].includes(s!=null?s:"")}).forEach(t=>{const o=t.querySelector(".color-value-tooltip");o&&!o.getAttribute("data-balloon")&&o.setAttribute("data-balloon","Right click to open variable UI"),t.addEventListener("contextmenu",s=>{s.preventDefault(),s.stopPropagation();const n=s.target;n&&this.handleColorVariableUiColorTriggerClick({target:n})})})},100)}addListeners(){this.boundOnKeyDown=e=>{var t;e.key==="Escape"&&((t=this.instance)==null?void 0:t.style.getPropertyValue("display"))==="block"&&this.close()},document.addEventListener("keydown",this.boundOnKeyDown),this.boundOnClick=e=>{var t,o,s,n;this.isOpen&&!((t=this==null?void 0:this.instance)!=null&&t.contains(e.target))&&!((o=e.target)!=null&&o.classList.contains("cf-variable-ui-trigger"))&&!((n=(s=e.target)==null?void 0:s.parentElement)!=null&&n.classList.contains("cf-variable-ui-trigger"))&&this.close()},D("bricks_enable_variable_ui_auto_hide")&&(document.removeEventListener("click",this.boundOnClick),document.addEventListener("click",this.boundOnClick))}}const Z=(a,e)=>{if(typeof a!="object"||a===null)return null;const t=a;if(Object.prototype.hasOwnProperty.call(t,e))return t[e];for(const o of Object.keys(t)){const s=t[o];if(typeof s=="object"&&s!==null){const n=Z(s,e);if(n!==null)return n}}return null},ce=async()=>{window.coreframework={nonce:window.wpApiSettings.nonce,rest_url:window.wpApiSettings.root,core_api_url:`${window.wpApiSettings.root}core-framework/v2/`};try{const a=await fetch(`${window.coreframework.core_api_url}get-core-fonts`,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":window.coreframework.nonce}}),{fonts:e}=await a.json();return e.filter(t=>t.enable)}catch(a){return[]}},ue=a=>{const e=document.querySelector("#bricks-panel-inner:not(div.bricks-control-popup *)"),t=parseFloat(window.bricksData.version);if(!e){k("Inner panel not found, can't initialize preview of variables on hover");return}new MutationObserver(s=>{var h;let n;if(t>=2){const y=(h=document.querySelector("label[for='font-family']"))==null?void 0:h.nextElementSibling;n=y==null?void 0:y.querySelector("ul")}else{const y=document.querySelectorAll("#bricks-panel-inner .options-wrapper .title"),l=Array.from(y).find(u=>u.textContent==="Core Framework");n=l==null?void 0:l.closest("ul")}const r=n==null?void 0:n.querySelectorAll(".core-icon"),i=document.getElementById("core-group"),c=s.some(y=>Array.from(y.addedNodes).some(l=>l.nodeType===Node.ELEMENT_NODE&&l.id==="core-group"||l.id==="core-icon"));if(n&&!c){r==null||r.forEach(u=>u.remove()),i==null||i.remove();const y=Array.from(n.children);a.sort((u,m)=>(t>=2&&([m,u]=[u,m]),u.family.localeCompare(m.family))).forEach(u=>{const m=ne(y,u);if(m){Object.assign(m.style,{display:"flex","justify-content":"space-between","align-items":"center"});const f=document.createElement("span");f.style.setProperty("width","13px"),f.style.setProperty("height","13px"),f.classList.add("core-icon"),f.setAttribute("id","core-icon"),f.innerHTML=` + `)}),u.querySelectorAll(".variable-picker-item").forEach(m=>{m.addEventListener("mouseenter",()=>{var y,k;const p=(k=(y=m.querySelector("span:first-of-type"))==null?void 0:y.textContent)!=null?k:"";p&&i(s(p))}),m.addEventListener("click",()=>{var y,k;const p=(k=(y=m.querySelector("span:first-of-type"))==null?void 0:y.textContent)!=null?k:"";p&&(c=s(p),n.value=c,n.click())})})};l(b,v),e.appendChild(v),t.addEventListener("click",E=>{E.preventDefault(),E.stopPropagation()}),t.addEventListener("input",()=>{const E=t.value.toLowerCase(),u=b.filter(m=>{var p,y;return((y=(p=Object.keys(m)[0])==null?void 0:p.toLowerCase())!=null?y:"").includes(E)});v.innerHTML="",l(u,v)});const d=new IntersectionObserver(E=>{E.forEach(u=>{u.isIntersecting&&!u.target.classList.contains("open")&&u.target.click()})},{root:n.parentElement});e.addEventListener("mouseleave",()=>{i(c),d.observe(n.nextElementSibling)}),d.disconnect()},le=()=>{var i,c,b,v;const a=document.querySelectorAll(".variable-picker-item:not(.cf-b22-processed):not(.title)");if(!a.length)return;let e="",t=!1,o=null;const r=l=>{var h;const d=Y(l);return(h=d==null?void 0:d.closest("[data-control]"))==null?void 0:h.querySelector("input")},n=(l,d,h=!1)=>{l.value=d,l.dispatchEvent(new Event("input",{bubbles:!0})),h&&l.dispatchEvent(new Event("change",{bubbles:!0}))};a.forEach(l=>{var g;l.classList.add("cf-b22-processed");const d=(g=l.querySelector("span:first-of-type"))==null?void 0:g.textContent;if(!d)return;const h=`var(--${d})`;l.addEventListener("mouseenter",()=>{const f=r(l);f&&(F(l,f)||(t||(e=f.value,o=f,t=!0),n(f,h)))}),l.addEventListener("click",()=>{const f=o!=null?o:r(l);f&&(F(l,f)||(t=!1,n(f,h,!0),o=null))})});const s=(v=(i=a[0])==null?void 0:i.closest(".options-wrapper"))!=null?v:(b=(c=a[0])==null?void 0:c.closest("ul"))==null?void 0:b.parentElement;s&&!s.classList.contains("cf-b22-wrapper-processed")&&(s.classList.add("cf-b22-wrapper-processed"),s.addEventListener("mouseleave",()=>{t&&o&&(n(o,e),t=!1,o=null)}))},ce=()=>{if(!P("bricks_apply_variable_on_hover"))return;const a=document.querySelector("#bricks-panel-inner:not(div.bricks-control-popup *)");if(!a){L("Inner panel not found, can't initialize preview of variables on hover");return}let e=!1;const t=100;new MutationObserver(()=>{ae(),e||(e=!0,setTimeout(()=>{le(),e=!1},t))}).observe(a,{subtree:!0,childList:!0,attributes:!0})};class ye{constructor(){this.variables=[];this.variablesGroups={};this.colorVariables=[];this.previewOnHover=!0;this.init(),this.boundOnInputFocus=this.onInputFocus.bind(this)}async init(){var s,i,c;if(!P("bricks_enable_variable_dropdown"))return;if((c=(i=(s=window==null?void 0:window.ADMINBRXC)==null?void 0:s.globalSettings)==null?void 0:i.classFeatures)!=null&&c.includes("autocomplete-variable")){L("Autocomplete variable feature already enabled in Advanced Themer. Only one instance of this feature can be enabled at a time.");return}if(!await this.getVariables())return;const t=document.querySelector("#bricks-panel-inner");if(!t)return;const o=100;let r=!1;new MutationObserver(()=>{r||(r=!0,this.setVariableAutocomplete(),setTimeout(()=>{r=!1},o))}).observe(t,{subtree:!0,childList:!0})}autoComplete({input:e,variables:t,type:o,ignorePreview:r=!1}){const n=this;let s=0;if(e.dataset.autocomplete==="true")return;function i(h){var f;if(!h.length)return!1;c(h),s>=h.length&&(s=0),s<0&&(s=h.length-1),(f=h[s])==null||f.classList.add("selected");const g=h[s];g==null||g.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})}function c(h){for(const g of h)g.classList.remove("selected")}function b(h,g){var T;const f=document.getElementsByClassName("autocomplete-items");for(const E of f)(g||h!=E&&h!==e)&&((T=E==null?void 0:E.parentNode)==null||T.removeChild(E))}e.setAttribute("data-autocomplete","true");function v(h){var k;if(h.metaKey||h.altKey||h.key==="Meta"||h.key==="Alt"||h.keyCode==40||h.keyCode==38||h.keyCode==13)return;let g,f,T,E,u;const m=h.target,p=m.value;if(b(),!p)return!1;if(s=-1,g=document.createElement("div"),g.setAttribute("id","autocomplete-list"),g.setAttribute("class","autocomplete-items bricks-control-popup bottom cf-variable-autocomplete"),g.style.gap="0px",P("bricks_enable_variable_ui_hint")&&P("bricks_variable_ui")){const w=document.createElement("div");w.classList.add("cf-variable-dropdown-hint"),w.classList.add("variable-dropdown-item"),w.textContent="Right-click to open Variable UI",w.style.padding="4px 10px",w.style.color="var(var(--cf-ui--text), white)",w.style.opacity="0.7",w.style.fontSize="12px",g.appendChild(w)}for((k=m==null?void 0:m.parentNode)==null||k.appendChild(g),u=document.createElement("ul"),g.appendChild(u),T=0,E=0;T{var _;m.value=(_=m.dataset.autocompleteInitial)!=null?_:"";const x=new Event("input",{bubbles:!1,cancelable:!0});m.dispatchEvent(x),m.removeAttribute("data-autocomplete-initial")},0)}),f.addEventListener("mouseenter",function(O){setTimeout(()=>{var _,U;if(m.setAttribute("data-autocomplete-initial",m.value),C===!1)return;m.value=String((U=(_=this.getElementsByTagName("input"))==null?void 0:_[0])==null?void 0:U.value);const x=new Event("input",{bubbles:!1,cancelable:!0});m.dispatchEvent(x),C=!1},0)})}u.appendChild(f)}}E===0&&b()}e.removeEventListener("keyup",v),e.addEventListener("keyup",v);const l=h=>{var T,E;const g=document.getElementById(`${e.id}autocomplete-list`);if(!g)return;const f=[...g.getElementsByTagName("li")];switch(h.key){case"ArrowDown":{if(h.preventDefault(),!(f.length>0&&f.length>s+1))return;s++,i(f);const m=f.find(k=>k.classList.contains("selected")),p=(m==null?void 0:m.querySelector('input[type="hidden"]')).value;e.value=p;const y=new Event("input",{bubbles:!1,cancelable:!0});e.dispatchEvent(y);return}case"ArrowUp":{if(h.preventDefault(),!(f.length&&s-1>=0))return;s--,i(f);const m=f.find(k=>k.classList.contains("selected")),p=(T=m==null?void 0:m.querySelector('input[type="hidden"]'))==null?void 0:T.value;e.value=p;const y=new Event("input",{bubbles:!1,cancelable:!0});e.dispatchEvent(y);return}case"Enter":{h.preventDefault(),s>-1&&f.length&&((E=f==null?void 0:f[s])==null||E.click());return}case"Escape":case"Tab":b()}};e.removeEventListener("keydown",l),e.addEventListener("keydown",l);const d=h=>{h.target!==e&&b()};document.removeEventListener("click",d),document.addEventListener("click",d)}sortVariables(e){var c,b,v;const t=e.closest("[data-controlkey]"),o=(c=t==null?void 0:t.dataset.controlkey)==null?void 0:c.toLocaleLowerCase(),r=["typography","font"].some(l=>o==null?void 0:o.includes(l)),n=["padding","margin","gap","width","height"].some(l=>o==null?void 0:o.includes(l)),s=(v=(b=e.parentElement)==null?void 0:b.parentElement)==null?void 0:v.classList.contains("color-input");let i=[];for(const[l,d]of Object.entries(this.variablesGroups)){if(s&&l==="colorStyles"){i=[...d];break}if(l!=="colorStyles"){if(r&&l==="typographyStyles"){i.unshift(...d);continue}if(!r&&l==="typographyStyles"){i.push(...d);continue}if(n&&l==="spacingStyles"){i.unshift(...d);continue}if(!n&&l==="spacingStyles"){i.push(...d);continue}i.push(...d)}}return i=i.map(l=>`var(--${l})`),this.variables=i,i}onInputFocus(e){if(!e.isTrusted||e!=null&&e.metaKey||e!=null&&e.altKey)return;const t=e.target;if(!t)return;const o=this.sortVariables(t);this.autoComplete({input:t,variables:o,type:"style"})}setVariableAutocomplete(){setTimeout(()=>{K.includedFields.forEach(e=>{let t;typeof e=="string"?t=Array.from(document.querySelectorAll(e)):t=Array.from(document.querySelectorAll(e.selector)).filter(n=>e.hasChild.some(s=>n.querySelector(s))),t.filter(r=>{var n,s,i;return!((i=(n=r==null?void 0:r.parentNode)==null?void 0:n.closest)!=null&&i.call(n,(s=K==null?void 0:K.excludedFields)==null?void 0:s.join(",")))&&!r.classList.contains("autocomplete-active")}).forEach(r=>{r.classList.add("autocomplete-active");const n=r.querySelector("input[type='text']");n==null||n.removeEventListener("focus",this.boundOnInputFocus),n==null||n.addEventListener("focus",this.boundOnInputFocus)})})},100)}async getVariables(){var e;window.coreframework={nonce:window.wpApiSettings.nonce,rest_url:window.wpApiSettings.root,core_api_url:`${window.wpApiSettings.root}core-framework/v2/`};try{const t=await fetch(`${window.coreframework.core_api_url}get-variables?type=bricks_dropdown`,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":window.coreframework.nonce}});if(t.status!==200)return L("Failed to load variables."),!1;const o=await t.json();return o!=null&&o.variables?(this.variablesGroups=o.variables,this.colorVariables=((e=this.variablesGroups.colorStyles)!=null?e:[]).map(r=>`var(--${r})`),!0):(L("No variables found. Please save changes again in the Core Framework plugin."),!1)}catch(t){return L("Failed to load variables."),!1}}}class Z{constructor(){this.variables={};this.colorSystemData=null;this.variablePrefix="";this.fluid_typography_naming_convention=null;this.fluid_spacing_naming_convention=null;this.recentColorPickerTarget=null;this.recentVariableSelectionTimestamp=0;this.HOVER_VARIABLE_PREVIEW_TIMEOUT=1e3;this.instance=null;this.focusedInput=null;this.tempInputValue=null;this.isOpen=!1;this.stylesGroupsLabelMap={colorStyles:"Colors",typographyStyles:"Typography",spacingStyles:"Spacing",layoutsStyles:"Layouts",designStyles:"Design",componentsStyles:"Components",otherStyles:"Other"};this.logoData="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJUAAAB1CAYAAABH5qPNAAAACXBIWXMAAAhOAAAITgGMMQDsAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAChHSURBVHgB7V3tr2ZXVV9rP3daWkEHE+Mn7YXEDyQmjH9B76AkIBpK8IUYY6cJYCVohzdFY9Ki0WBiwhD9UNDQCyIS/QAaE78YGfSTiUmngICgzIW2lLaUTt+n997nLPfea/3WWvvc2zL0de69z27vPM9zXvbeZ+/f/q3fWnufc5gOcDp9i6xfsbs8Ma1N60UW1wjLcRFZL1zWiaQeIevELMztK3H9r22sH+1/S3Vb+808ZC12kG5tefTvQvhtGXLPUvPHdsbxfWfb3c+s1ajba+qfHOVrIe0Y0c3FTsRxlsVwPDJHpZj9KsnKsH1aHs2uWbMnVNwLQDbeDqgez3/rtcxa7fy731FeuUYHKL33D3c2JpYTtQmurRd1rUzL49OiX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yzmqwc/Ldjj9+o1PbCxKuX4S2ah9fw155wvFiywlReUVdRqxt5v1TG/p8udJzxe/r0/Y71uUXDQeK0Mo7KlrKa7p9Kef1D8qtb5m8y+vOktHLB0Iju4AWyzeOE3Tidp/G/P9fhEKmj7XiKe19ASFxi7u080/5LYtN4ZNegPGOovJ+K6AHJ9WE3qvA7nnWU4eRVAdCIbuT04mfX9Oe8zR7sWLJ9YKv7oKp43ac+u1B0+g4111wWdzEcUhsUyMi2RSGiAVwk7zknAviXw5DtlkwOAksoR0O5rp0KjJBjbavXii6p/jVXgdp7J2jT7BrN1qX2b9O9829TVa06TbSv09NR3Vjiuq40qXn217+066v0z6fl89qT97vh9l+6ZSNjfPXLVFq7RKq/Ts0v8D4+WejbzFd30AAAAASUVORK5CYII=";this.handleDrag=null;this.endDragging=null;this.boundOnKeyDown=null;this.boundOnClick=null;this.innerPanelObserver=null;this.COLOR_STYLE_MAP=[{property:"color",control:"typography"},{property:"backgroundColor",control:"background"},{property:"borderColor",control:"border"}];this.init(),this.boundOnInputClick=this.onInputClick.bind(this),this.boundOnFocusCallback=this.onFocusCallback.bind(this)}getActiveElement(){var r;const e=D.globalProperties();if(e.$_state.activePanel!=="element")return null;const t=(r=e.$_state)==null?void 0:r.activeElement.id,o=e.$_getIframeDoc();return o==null?void 0:o.getElementById(`brxe-${t}`)}applyValueToInput(e,t=!1){this.focusedInput&&(this.focusedInput.value=e,this.focusedInput.dispatchEvent(new Event("input",{bubbles:!0})),t&&this.focusedInput.dispatchEvent(new Event("change",{bubbles:!0})),this.focusedInput.focus())}async init(){var s;if(!P("bricks_variable_ui")||!await this.getVariables())return;const t="bricks-panel-inner";if(!document.getElementById(t))return;const r=100;let n=!1;this.innerPanelObserver=(s=$({selector:`#${t}`,options:{subtree:!0,childList:!0},callback:()=>{n||(n=!0,this.addTriggers(),setTimeout(()=>{n=!1},r))}}))!=null?s:null,this.createInstance(),this.addTriggers(),this.addListeners()}getPrefixedVariableName(e){return e.startsWith(this.variablePrefix)?e:`${this.variablePrefix}${e}`}createVarButton({variable:e,label:t,color:o,transparent:r}){const n=document.createElement("button");if(n.classList.add("cf-variable-ui-list-item"),n.dataset.cftooltip=`var(--${e})`,n.textContent=t!=null?t:e,o){const s=document.createElement("span");s.style.backgroundColor=o,r&&(s.style.opacity=(r/100).toString()),n.prepend(s)}return n.addEventListener("click",()=>{if(!this.focusedInput)return;const s=e.startsWith("var(--")?e:`var(--${e})`;this.applyValueToInput(s,!0),this.tempInputValue=s,this.recentVariableSelectionTimestamp=performance.now(),P("bricks_enable_variable_ui_auto_hide")&&this.close()}),n.addEventListener("mouseenter",()=>{if(performance.now()-this.recentVariableSelectionTimestamp{!this.focusedInput||this.tempInputValue===null||this.applyValueToInput(this.tempInputValue)}),n}createVarWithValueButton({variable:e,value:t,label:o,color:r,transparent:n}){const s=document.createElement("button");if(s.classList.add("cf-variable-ui-list-item"),s.dataset.cftooltip=e,s.textContent=o!=null?o:e,r){const i=document.createElement("span");i.style.backgroundColor=r,n&&(i.style.opacity=(n/100).toString()),s.prepend(i)}return s.addEventListener("click",()=>{this.focusedInput&&(this.applyValueToInput(t,!0),this.tempInputValue=t,this.recentVariableSelectionTimestamp=performance.now(),P("bricks_enable_variable_ui_auto_hide")&&this.close())}),s.addEventListener("mouseenter",()=>{performance.now()-this.recentVariableSelectionTimestamp{!this.focusedInput||this.tempInputValue===null||this.applyValueToInput(this.tempInputValue)}),s}applyColorPreview(e,t){const o=this.getActiveElement();if(o)for(const{property:r,control:n}of this.COLOR_STYLE_MAP)t!=null&&t.closest(`[data-control="${n}"]`)&&(o.style[r]=e)}createColorButton({variable:e,color:t,id:o,darkColor:r,transparent:n}){e=this.getPrefixedVariableName(e);const s=document.createElement("button");if(s.dataset.cftooltip=`var(--${e})`,s.classList.add("cf-variable-ui-list-item-color"),t)if(n!==void 0){s.style.padding="0";const c=document.createElement("div");c.style.setProperty("--cf-variable-ui-color",t),c.style.setProperty("--cf-variable-ui-color-dark",r!=null?r:t),c.style.opacity=(n/100).toString(),c.style.width="100%",c.style.height="100%",s.appendChild(c)}else s.style.setProperty("--cf-variable-ui-color",t),s.style.setProperty("--cf-variable-ui-color-dark",r!=null?r:t);const i=e.startsWith("var(--")?e:`var(--${e})`;return s.addEventListener("click",async c=>{if(c.stopPropagation(),c.preventDefault(),!this.focusedInput){const b=this.recentColorPickerTarget;this.selectColor({name:e}),this.recentVariableSelectionTimestamp=performance.now(),setTimeout(()=>this.applyColorPreview("",b),5);return}this.applyValueToInput(i,!0),this.tempInputValue=i,this.recentVariableSelectionTimestamp=performance.now(),P("bricks_enable_variable_ui_auto_hide")&&this.close()}),s.addEventListener("mouseenter",()=>{if(!(performance.now()-this.recentVariableSelectionTimestamp{var b;if(!this.focusedInput||this.tempInputValue===null){this.applyColorPreview("",this.recentColorPickerTarget);return}this.applyValueToInput(this.tempInputValue);const c=(b=this.focusedInput.previousElementSibling)!=null&&b.classList.contains("oxygen-color-picker-color")?"color":this.focusedInput.getAttribute("data-option");try{window==null||window.$scope.iframeScope.setOptionUnit(c," ")}catch(v){}}),s}createCategoryTitle(e){const t=document.createElement("div");t.classList.add("cf-variable-ui-category-title");const o=document.createElement("b");o.textContent=e,t.appendChild(o);const r=document.createElement("button");return r.classList.add("cf-variable-ui-section-toggle"),t.appendChild(r),t}allowDrag(e){const t=e.querySelector("#cf-variable-ui-header");if(!t)return;let o=!1,r=0,n=0;const s=i=>{[...document.querySelectorAll("iframe")].forEach(b=>{b.style.pointerEvents="none",b.style.userSelect="none"}),o=!0;const c=t.getBoundingClientRect();r=i.clientX-c.left,n=i.clientY-c.top,t&&(t.style.transition="none")};t.removeEventListener("mousedown",s),t.addEventListener("mousedown",s),this.handleDrag&&document.removeEventListener("mousemove",this.handleDrag),this.handleDrag=i=>{if(!o)return;const c=t.getBoundingClientRect(),b=i.clientX,v=i.clientY,l=b-r,d=v-n,h=(l<0?0:l>window.innerWidth-c.width?window.innerWidth-c.width:l)+10,g=d<0?0:d>window.innerHeight-c.height?window.innerHeight-c.height:d;e.style.left=`${h}px`,e.style.top=`${g}px`},document.addEventListener("mousemove",this.handleDrag),this.endDragging&&document.removeEventListener("mouseup",this.endDragging),this.endDragging=i=>{[...document.querySelectorAll("iframe")].forEach(c=>{c.style.pointerEvents="auto",c.style.userSelect="auto"}),o=!1},document.addEventListener("mouseup",this.endDragging)}createExpandableWrapper({title:e}){const t="cf-variable-ui-wrapper",o=document.createElement("div");o.dataset.groupExpand="false",o.classList.add(t);const r=this.createCategoryTitle(e);return r.addEventListener("click",()=>{o.dataset.groupExpand=o.dataset.groupExpand==="true"?"false":"true"}),o.appendChild(r),o}createInstance(){var d,h;const e=document.createElement("cf-variable-ui");e.classList.add("cf-variable-ui"),e.classList.add("is-bricks"),e.style.position="fixed",e.style.display="none",e.style.width="300px",e.style.height="500px",e.style.zIndex="99999999999",e.style.left=`${(window.innerWidth/2-200).toString()}px`,e.style.top=`${(window.innerHeight/2-300).toString()}px`;const t=document.createElement("div");t.id="cf-variable-ui-header",t.style.width="100%";const o=document.createElement("img");o.src=this.logoData,o.classList.add("cf-variable-ui-logo"),o.style.setProperty("width","30px");const r=document.createElement("a");r.href=`${new URL(window.location.href).origin}/wp-admin/admin.php?page=core-framework`,r.target="_blank",r.textContent="Open",r.dataset.cftooltip="Open Core Framework plugin",r.classList.add("cf-variable-ui-open-core-framework");const n=document.createElement("button");n.innerHTML='',n.classList.add("cf-variable-ui-close-button"),n.dataset.cftooltip="Close",n.addEventListener("click",()=>this.close()),t.appendChild(o),t.appendChild(r),t.appendChild(n),e.appendChild(t);const s=(h=(d=this.colorSystemData)==null?void 0:d.groups)!=null?h:[],i=this.createExpandableWrapper({title:"Color System"});i.dataset.type="color-system",s.forEach(({colors:g,name:f,isDisabled:T})=>{if(T)return;const E=document.createElement("div");E.classList.add("cf-variable-ui-color-wrapper"),g.forEach(u=>{var S,C,O,x,_,U;const m=this.createColorButton({variable:u.name,color:u.value,darkColor:u.darkValue,id:u.id}),p=document.createElement("div"),y=document.createElement("div");y.classList.add("cf-variable-ui-color-title"),y.textContent=this.getPrefixedVariableName(u.name),y.style.setProperty("font-weight","bold"),p.classList.add("cf-variable-ui-color-wrapper-second"),p.appendChild(y),p.appendChild(m);const k=(C=(S=u.shades)==null?void 0:S.map((A,V)=>{var N,q;const R=(q=(N=u.darkShades)==null?void 0:N[V])==null?void 0:q.value;return this.createColorButton({variable:A.name,color:A.value,id:`${u.id}.d.${V}`,darkColor:R})}))!=null?C:[];if(u.isShades&&k.length){const A=document.createElement("div");A.classList.add("cf-variable-ui-color-title"),A.textContent=`Shades of ${this.getPrefixedVariableName(u.name)}`;const V=document.createElement("div");V.classList.add("cf-variable-ui-shades-wrapper"),k.forEach(R=>{V.appendChild(R)}),p.appendChild(A),p.appendChild(V)}const w=(x=(O=u.tints)==null?void 0:O.map((A,V)=>{var N,q;const R=(q=(N=u.darkTints)==null?void 0:N[V])==null?void 0:q.value;return this.createColorButton({variable:A.name,color:A.value,darkColor:R,id:`${u.id}.l.${V}`})}))!=null?x:[];if(u.isTints&&w.length){const A=document.createElement("div");A.classList.add("cf-variable-ui-color-title"),A.textContent=`Tints of ${this.getPrefixedVariableName(u.name)}`;const V=document.createElement("div");V.classList.add("cf-variable-ui-tints-wrapper"),w.forEach(R=>{V.appendChild(R)}),p.appendChild(A),p.appendChild(V)}const M=(U=(_=u.transparentVariables)==null?void 0:_.map(A=>this.createColorButton({variable:`${u.name}-${A}`,color:u.value,darkColor:u.darkValue,transparent:Number(A),id:`${u.id}.t.${u.name.split("-").slice(-1)[0]}`})))!=null?U:[];if(u.transparent&&M.length){const A=document.createElement("div");A.classList.add("cf-variable-ui-color-title"),A.textContent=`Transparent values of ${this.getPrefixedVariableName(u.name)}`;const V=document.createElement("div");V.classList.add("cf-variable-ui-transparent-wrapper"),M.forEach(R=>{V.appendChild(R)}),p.appendChild(A),p.appendChild(V)}E.appendChild(p)}),i.appendChild(E)});const c=document.createElement("div");c.classList.add("cf-variable-ui-scroll-container"),c.appendChild(i),Object.entries(this.variables).forEach(([g,f])=>{var u;if(Object.keys(f).length===0)return;const E=this.createExpandableWrapper({title:(u=this.stylesGroupsLabelMap[g])!=null?u:g});E.dataset.type=g,Object.entries(f).forEach(([m,p])=>{const y=S=>{if(m==="Fluid Typography"||m==="Fluid Spacing"){const C=`${this.variablePrefix+(m==="Fluid Typography"?this.fluid_typography_naming_convention:this.fluid_spacing_naming_convention)}-`;return S.replace(C,"")}return S},k=document.createElement("div"),w=document.createElement("b");w.textContent=m,w.classList.add("cf-variable-ui-row-title"),k.appendChild(w),k.classList.add("cf-variable-ui-group");const M=document.createElement("div");M.classList.add("cf-variable-ui-container"),p.forEach(S=>{const C=this.createVarButton({variable:S,label:y(S)});M.appendChild(C)}),k.appendChild(M),E.appendChild(k)}),c.appendChild(E)});const b=new Array(12).fill(0).map((g,f)=>({variable:String(f+1),value:`repeat(${f+1}, minmax(0, 1fr))`})),v=[{variable:"1 / 2",value:"minmax(0, 1fr) minmax(0, 2fr)"},{variable:"2 / 1",value:"minmax(0, 2fr) minmax(0, 1fr)"},{variable:"1 / 3",value:"minmax(0, 1fr) minmax(0, 3fr)"},{variable:"3 / 1",value:"minmax(0, 3fr) minmax(0, 1fr)"},{variable:"2 / 3",value:"minmax(0, 2fr) minmax(0, 3fr)"},{variable:"3 / 2",value:"minmax(0, 3fr) minmax(0, 2fr)"},{variable:"1 / 4",value:"minmax(0, 1fr) minmax(0, 4fr)"},{variable:"4 / 1",value:"minmax(0, 4fr) minmax(0, 1fr)"},{variable:"3 / 4",value:"minmax(0, 3fr) minmax(0, 4fr)"},{variable:"4 / 3",value:"minmax(0, 4fr) minmax(0, 3fr)"}],l=this.createExpandableWrapper({title:"Grid"});l.dataset.type="_gridVariables",[b,v].forEach((g,f)=>{const T=document.createElement("div"),E=document.createElement("b");E.textContent=f===0?"Symmetric Grids":"Asymmetric Grids",E.classList.add("cf-variable-ui-row-title"),T.appendChild(E),T.classList.add("cf-variable-ui-group");const u=document.createElement("div");u.classList.add("cf-variable-ui-container"),g.forEach(m=>{const p=this.createVarWithValueButton({variable:m.value,value:m.value,label:m.variable});u.appendChild(p)}),T.appendChild(u),l.appendChild(T)}),c.appendChild(l),e.appendChild(c),document.body.appendChild(e),this.instance=e,this.allowDrag(e),setTimeout(()=>{this.reposition()},100)}open(){if(!this.instance)return;this.instance.style.setProperty("display","block"),this.isOpen=!0;const e=document.querySelector("html");e&&(e.dataset.cfVariableUiOpen="true")}close(){if(!this.instance)return;this.instance.style.setProperty("display","none"),this.tempInputValue=null,this.recentColorPickerTarget=null,this.isOpen=!1;const e=document.querySelector("html");e&&(e.dataset.cfVariableUiOpen="false")}destroy(){this.boundOnKeyDown&&(document.removeEventListener("keydown",this.boundOnKeyDown),this.boundOnKeyDown=null),this.boundOnClick&&(document.removeEventListener("click",this.boundOnClick),this.boundOnClick=null),this.handleDrag&&(document.removeEventListener("mousemove",this.handleDrag),this.handleDrag=null),this.endDragging&&(document.removeEventListener("mouseup",this.endDragging),this.endDragging=null),this.innerPanelObserver&&(this.innerPanelObserver.disconnect(),this.innerPanelObserver=null),this.instance&&(this.instance.remove(),this.instance=null)}async getVariables(){window.coreframework={nonce:window.wpApiSettings.nonce,rest_url:window.wpApiSettings.root,core_api_url:`${window.wpApiSettings.root}core-framework/v2/`};const e="Please save changes again in the Core Framework plugin. Make sure the Bricks integration is enabled. If the error persists, please contact support at https://coreframework.com/";try{const t=await fetch(`${window.coreframework.core_api_url}builders-var-ui`,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":window.coreframework.nonce}});if(t.status!==200)return L(`Failed to load variables. ${e}`),!1;const o=await t.json();return o!=null&&o.variables?(this.variables=ee(o.variables),o.color_system_data?(this.colorSystemData=o.color_system_data,this.variablePrefix=o.variable_prefix,this.fluid_typography_naming_convention=o.fluid_typography_naming_convention,this.fluid_spacing_naming_convention=o.fluid_spacing_naming_convention,!0):(L(`No color system data found. ${e}`),!1)):(L(`No variables found. ${e}`),!1)}catch(t){return L(`Failed to load variables. ${e}`),!1}}reposition(){this.instance&&(this.instance.style.top=`${(window.innerHeight/2-300).toString()}px`,this.instance.style.left="320px")}setWrapperVisibility(e){if(!this.instance)return;const t=[["color-system",e.color],["typographyStyles",e.typography],["spacingStyles",e.spacing],["designStyles",e.design],["_gridVariables",e.grid]];for(const[o,r]of t){const n=this.instance.querySelector(`.cf-variable-ui-wrapper[data-type='${o}']`);n&&(n.dataset.groupExpand=r?"true":"false",e.color&&!e.typography&&!e.spacing&&!e.design&&!e.grid?n.dataset.hidden=o==="color-system"?"false":"true":n.dataset.hidden=o==="color-system"&&!e.color?"true":"false")}}onInputClick(e){var i,c,b,v,l;const t=e.type==="contextmenu"&&P("bricks_enable_variable_context_menu");if(t&&(e.preventDefault(),e.stopPropagation()),!this.isOpen&&!(e!=null&&e.metaKey||e!=null&&e.altKey)&&!t)return;const o=e.target;if(!o)return;(i=document==null?void 0:document.getSelection())==null||i.removeAllRanges(),e.preventDefault(),e.stopPropagation(),this.focusedInput=o,this.tempInputValue=o.value;const r=o.closest("[data-controlkey]"),n=(b=(c=r==null?void 0:r.dataset.controlkey)==null?void 0:c.toLocaleLowerCase())!=null?b:"",s=(l=(v=o.parentElement)==null?void 0:v.parentElement)==null?void 0:l.classList.contains("color-input");this.setWrapperVisibility({color:!!s,typography:["typography","font"].some(d=>n.includes(d)),spacing:["padding","margin","gap","width","height"].some(d=>n.includes(d)),design:n==="_border",grid:["_gridtemplatecolumns","_gridtemplaterows"].some(d=>n.includes(d))}),this.open()}onFocusCallback(e){const t=e.target;this.focusedInput=t}showBricksColorPopUp(){document.querySelectorAll(".cf-variable-ui-style").forEach(e=>{e.remove()})}hideBricksColorPopUp(){if(document.querySelector(".cf-variable-ui-style"))return;const e=".bricks-control-popup { display: none !important; }",t=document.createElement("style");t.id="cf-variable-ui-bricks-popup",t.appendChild(document.createTextNode(e)),t.classList.add("cf-variable-ui-style"),document.head.appendChild(t)}async selectColor({name:e}){var n,s,i,c,b,v;this.hideBricksColorPopUp();const t=e.startsWith("var(--")?e:`var(--${e})`,o=document.querySelector(".bricks-control-popup .color-palette.grid"),r=document.querySelector(".bricks-control-popup .color-palette");if(o&&((s=(n=o.querySelector(`[data-balloon="${t}"]`))==null?void 0:n.parentElement)==null||s.click()),r){const l=r.querySelectorAll(".color-name>span"),d=Array.from(l).reverse().find(h=>t.includes(h.textContent));(i=d==null?void 0:d.parentElement)==null||i.click()}else L("Failed to select color. Color grid not found.");o||((b=(c=this.recentColorPickerTarget)==null?void 0:c.closest(".bricks-control-preview"))==null||b.click(),await new Promise(l=>setTimeout(l,25))),(v=document.body)==null||v.click(),await new Promise(l=>setTimeout(l,2)),document.querySelector(".bricks-control-popup")?(setTimeout(()=>{var l;(l=document.body)==null||l.click(),setTimeout(()=>this.showBricksColorPopUp(),5)},5),L("Failed to close color picker. Delaying close.")):this.showBricksColorPopUp()}handleColorVariableUiColorTriggerClick({target:e}){var n,s,i,c;(n=document==null?void 0:document.getSelection())==null||n.removeAllRanges(),this.setWrapperVisibility({color:!0}),document.querySelector(".bricks-control-popup .color-palette")||e.click(),this.recentColorPickerTarget=e;const o=(i=e.closest(".has-variables"))!=null?i:(s=e.closest(".control-inner"))==null?void 0:s.querySelector(".has-variables"),r=o==null?void 0:o.querySelector("input");this.focusedInput=r,this.tempInputValue=(c=r==null?void 0:r.value)!=null?c:null,this.open()}addTriggers(){setTimeout(()=>{K.includedFields.forEach(t=>{(typeof t=="string"?[...document.querySelectorAll(t)]:[...document.querySelectorAll(t.selector)].filter(r=>t.hasChild.some(n=>r.querySelector(n)))).forEach(r=>{var s;const n=(s=r.querySelector("input[type='text']"))!=null?s:r.querySelector("input:not([type='hidden']):not([type='checkbox']):not([type='radio'])");!n||n.getAttribute("cf-variable-ui")==="true"||(n.removeEventListener("click",this.boundOnInputClick),n.addEventListener("click",this.boundOnInputClick),n.removeEventListener("focus",this.boundOnFocusCallback),n.addEventListener("focus",this.boundOnFocusCallback),P("bricks_enable_variable_context_menu")&&(n.removeEventListener("contextmenu",this.boundOnInputClick),n.addEventListener("contextmenu",this.boundOnInputClick)),n.setAttribute("cf-variable-ui","true"))})}),[...document.querySelectorAll(".bricks-control-preview")].filter(t=>{var n;const o=t.closest(".control-inner"),r=(n=o==null?void 0:o.querySelector("label"))==null?void 0:n.getAttribute("for");return["color","fill","stroke"].includes(r!=null?r:"")}).forEach(t=>{const o=t.querySelector(".color-value-tooltip");o&&!o.getAttribute("data-balloon")&&o.setAttribute("data-balloon","Right click to open variable UI"),t.addEventListener("contextmenu",r=>{r.preventDefault(),r.stopPropagation();const n=r.target;n&&this.handleColorVariableUiColorTriggerClick({target:n})})})},100)}addListeners(){this.boundOnKeyDown=e=>{var t;e.key==="Escape"&&((t=this.instance)==null?void 0:t.style.getPropertyValue("display"))==="block"&&this.close()},document.addEventListener("keydown",this.boundOnKeyDown),this.boundOnClick=e=>{var t,o,r,n;this.isOpen&&!((t=this==null?void 0:this.instance)!=null&&t.contains(e.target))&&!((o=e.target)!=null&&o.classList.contains("cf-variable-ui-trigger"))&&!((n=(r=e.target)==null?void 0:r.parentElement)!=null&&n.classList.contains("cf-variable-ui-trigger"))&&this.close()},P("bricks_enable_variable_ui_auto_hide")&&(document.removeEventListener("click",this.boundOnClick),document.addEventListener("click",this.boundOnClick))}}const j=(a,e)=>{if(typeof a!="object"||a===null)return null;const t=a;if(Object.prototype.hasOwnProperty.call(t,e))return t[e];for(const o of Object.keys(t)){const r=t[o];if(typeof r=="object"&&r!==null){const n=j(r,e);if(n!==null)return n}}return null},ue=async()=>{window.coreframework={nonce:window.wpApiSettings.nonce,rest_url:window.wpApiSettings.root,core_api_url:`${window.wpApiSettings.root}core-framework/v2/`};try{const a=await fetch(`${window.coreframework.core_api_url}get-core-fonts`,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":window.coreframework.nonce}}),{fonts:e}=await a.json();return e.filter(t=>t.enable)}catch(a){return[]}},de=a=>{const e=document.querySelector("#bricks-panel-inner:not(div.bricks-control-popup *)"),t=parseFloat(window.bricksData.version);if(!e){L("Inner panel not found, can't initialize preview of variables on hover");return}new MutationObserver(r=>{var b;let n;if(t>=2){const v=(b=document.querySelector("label[for='font-family']"))==null?void 0:b.nextElementSibling;n=v==null?void 0:v.querySelector("ul")}else{const v=document.querySelectorAll("#bricks-panel-inner .options-wrapper .title"),l=Array.from(v).find(d=>d.textContent==="Core Framework");n=l==null?void 0:l.closest("ul")}const s=n==null?void 0:n.querySelectorAll(".core-icon"),i=document.getElementById("core-group"),c=r.some(v=>Array.from(v.addedNodes).some(l=>l.nodeType===Node.ELEMENT_NODE&&l.id==="core-group"||l.id==="core-icon"));if(n&&!c){s==null||s.forEach(d=>d.remove()),i==null||i.remove();const v=Array.from(n.children);a.sort((d,h)=>(t>=2&&([h,d]=[d,h]),d.family.localeCompare(h.family))).forEach(d=>{const h=oe(v,d);if(h){Object.assign(h.style,{display:"flex","justify-content":"space-between","align-items":"center"});const g=document.createElement("span");g.style.setProperty("width","13px"),g.style.setProperty("height","13px"),g.classList.add("core-icon"),g.setAttribute("id","core-icon"),g.innerHTML=` - `,m.appendChild(f),t>=2&&(n==null||n.insertBefore(m,n.firstChild))}});const l=n.querySelector(".title");if(document.querySelectorAll(".core-icon").length===a.length&&l&&t>=2){const u=l==null?void 0:l.cloneNode();u.setAttribute("id","core-group"),u.textContent="Core Framework",n.prepend(u)}}}).observe(e,{subtree:!0,childList:!0,attributes:!1})},de=async()=>{const a=await ce(),e=window.bricksData,t=Z(e,"fonts"),o=a.reduce((n,r)=>W(B({},n),{[r.family]:r.family}),{}),s={coreFontsGroupTitle:"Core Framework"};if(a.length&&t){if(t.options=B(B(B({},s),o),t.options),t.core=a.map(n=>W(B({},n),{files:[]})),parseFloat(e.version)>=2){const n=a.reduce((r,i)=>W(B({},r),{[i.family]:{id:i.id,family:i.family,fontFace:null}}),{});t.custom=Object.assign(t.custom||{},n)}ue(a)}},j=(a,e)=>{const t=a.querySelectorAll('link[rel="stylesheet"][href*="core_framework.css"], link[rel="stylesheet"][href*="core_framework_"]');let o=0;return t.forEach(s=>{var i;const n=a.createElement("link");n.rel="stylesheet",n.type=s.type||"text/css",n.media=s.media||"all",s.id&&(n.id=s.id);const r=s.href.split("?")[0];n.href=r+"?ver="+Date.now(),(i=s.parentNode)==null||i.insertBefore(n,s),n.onload=()=>{s.remove(),k(`${e} stylesheet loaded successfully`)},n.onerror=()=>{k(`${e} stylesheet failed to load, keeping old one`),n.remove()},o++}),o},pe=async()=>{oe(),re(),le(),await de();let a=new Y;try{const e=new BroadcastChannel("cf_push_sync");e.onmessage=async t=>{var o,s,n;if(((o=t.data)==null?void 0:o.type)==="push_complete"){k("Push detected, re-syncing Bricks...");try{const r=document.getElementById(A),i=r==null?void 0:r.contentDocument;if(i){const h=j(i,"Iframe");k(h?`Reloading ${h} CSS stylesheet(s) in iframe`:"No core-framework stylesheet found in iframe")}const c=j(document,"Main");c&&k(`Reloading ${c} CSS stylesheet(s) in main document`),a&&a.destroy(),a=new Y;try{const h=await fetch(`${window.coreframework.core_api_url}get-bricks-sync-data`,{method:"GET",headers:{"X-WP-Nonce":window.coreframework.nonce}});if(h.ok){const y=await h.json(),l=(s=window.bricksData)==null?void 0:s.loadData,u=(n=_.globalProperties())==null?void 0:n.$_state,m=["globalClasses","colorPalette","globalVariables","globalVariablesCategories"];for(const f of m){const p=y[f];!p||!(u!=null&&u[f])||(u[f].splice(0,u[f].length,...p),l&&(l[f]=p),k(`Synced ${p.length} ${f}`))}if(y.globalClasses&&(u!=null&&u.globalClassIndexById)){const f={};y.globalClasses.forEach((p,C)=>{f[p.id]=C});for(const p of Object.keys(u.globalClassIndexById))delete u.globalClassIndexById[p];Object.assign(u.globalClassIndexById,f)}}else k("Failed to fetch Bricks sync data:",h.status)}catch(h){k("Bricks class/color sync failed:",h)}k("Bricks re-sync complete.")}catch(r){k("Re-sync failed:"),k("Error:",r)}}}}catch(e){}};document.addEventListener("DOMContentLoaded",pe)}})(); + `,h.appendChild(g),t>=2&&(n==null||n.insertBefore(h,n.firstChild))}});const l=n.querySelector(".title");if(document.querySelectorAll(".core-icon").length===a.length&&l&&t>=2){const d=l==null?void 0:l.cloneNode();d.setAttribute("id","core-group"),d.textContent="Core Framework",n.prepend(d)}}}).observe(e,{subtree:!0,childList:!0,attributes:!1})},pe=async()=>{const a=await ue(),e=window.bricksData,t=j(e,"fonts"),o=a.reduce((n,s)=>W(B({},n),{[s.family]:s.family}),{}),r={coreFontsGroupTitle:"Core Framework"};if(a.length&&t){if(t.options=B(B(B({},r),o),t.options),t.core=a.map(n=>W(B({},n),{files:[]})),parseFloat(e.version)>=2){const n=a.reduce((s,i)=>W(B({},s),{[i.family]:{id:i.id,family:i.family,fontFace:null}}),{});t.custom=Object.assign(t.custom||{},n)}de(a)}},J=(a,e)=>{const t=a.querySelectorAll('link[rel="stylesheet"][href*="core_framework.css"], link[rel="stylesheet"][href*="core_framework_"]');let o=0;return t.forEach(r=>{var i;const n=a.createElement("link");n.rel="stylesheet",n.type=r.type||"text/css",n.media=r.media||"all",r.id&&(n.id=r.id);const s=r.href.split("?")[0];n.href=s+"?ver="+Date.now(),(i=r.parentNode)==null||i.insertBefore(n,r),n.onload=()=>{r.remove(),L(`${e} stylesheet loaded successfully`)},n.onerror=()=>{L(`${e} stylesheet failed to load, keeping old one`),n.remove()},o++}),o},me=async()=>{re(),ie(),ce(),await pe();let a=new Z;try{const e=new BroadcastChannel("cf_push_sync");e.onmessage=async t=>{var o,r,n;if(((o=t.data)==null?void 0:o.type)==="push_complete"){L("Push detected, re-syncing Bricks...");try{const s=document.getElementById(I),i=s==null?void 0:s.contentDocument;if(i){const b=J(i,"Iframe");L(b?`Reloading ${b} CSS stylesheet(s) in iframe`:"No core-framework stylesheet found in iframe")}const c=J(document,"Main");c&&L(`Reloading ${c} CSS stylesheet(s) in main document`),a&&a.destroy(),a=new Z;try{const b=await fetch(`${window.coreframework.core_api_url}get-bricks-sync-data`,{method:"GET",headers:{"X-WP-Nonce":window.coreframework.nonce}});if(b.ok){const v=await b.json(),l=(r=window.bricksData)==null?void 0:r.loadData,d=(n=D.globalProperties())==null?void 0:n.$_state,h=["globalClasses","colorPalette","globalVariables","globalVariablesCategories"];for(const g of h){const f=v[g];!f||!(d!=null&&d[g])||(d[g].splice(0,d[g].length,...f),l&&(l[g]=f),L(`Synced ${f.length} ${g}`))}if(v.globalClasses&&(d!=null&&d.globalClassIndexById)){const g={};v.globalClasses.forEach((f,T)=>{g[f.id]=T});for(const f of Object.keys(d.globalClassIndexById))delete d.globalClassIndexById[f];Object.assign(d.globalClassIndexById,g)}}else L("Failed to fetch Bricks sync data:",b.status)}catch(b){L("Bricks class/color sync failed:",b)}L("Bricks re-sync complete.")}catch(s){L("Re-sync failed:"),L("Error:",s)}}}}catch(e){}};document.addEventListener("DOMContentLoaded",me)}})();