(()=>{(function(){"use strict";const l="fleekdash-wpwrap-surface-pin";let s=null,c=!1,u=null,o=null;const b=new Set(["fleekdash-palette-vars","fleekdash-active-palette-vars"]);function w(e){const t=document.documentElement;return t?getComputedStyle(t).getPropertyValue(e).trim():""}function f(){const e=document.documentElement;return e?e.classList.contains("fleek-mode-trusted"):!1}function m(){const e=document.documentElement,t=w("--card");return t||(e&&e.classList.contains("dark")?"#101722":"#ffffff")}function y(){if(f())return"html.fleek-mode-trusted.fleekdash-inside-iframe #wpwrap,html.fleekdash-inside-iframe.fleek-mode-trusted #wpwrap,html.fleek-mode-trusted body.wp-admin #wpwrap,html.fleek-mode-trusted #wpwrap{background:transparent!important;background-color:transparent!important}";const e=m();return`html:not(.fleek-mode-trusted) body.wp-admin #wpwrap,html:not(.fleek-mode-trusted) #wpwrap,html:not(.fleek-mode-trusted) #wpwrap:has(.boot-layout){background:${e}!important;background-color:${e}!important}`}function p(){u=null}function a(){p(),o!==null&&cancelAnimationFrame(o),n(),o=requestAnimationFrame(function(){o=null,p(),n()})}function k(){const e=document.getElementById("wpwrap");if(!e)return;const t=f()?"transparent":m();u!==t&&(u=t,e.style.setProperty("background-color",t,"important"),e.style.setProperty("background",t,"important"))}function n(){const e=y();if(!e)return;let t=document.getElementById(l);t||(t=document.createElement("style"),t.id=l,t.setAttribute("data-fleekdash-wpwrap-surface-pin","true"),document.head.appendChild(t)),t.textContent!==e&&(t.textContent=e),k()}function i(e){if(!e||e.tagName!=="STYLE")return!1;const t=e.id;if(t&&b.has(t))return!0;const r=e.textContent||"";return r.includes("wpds")||r.includes("#wpwrap")||r.includes("boot-layout")}function E(e){return e.nodeType!==Node.ELEMENT_NODE?!1:i(e)}function g(e){if(e.type==="childList"){for(const r of e.addedNodes)if(E(r))return!0;const t=e.target;if(t.nodeType===Node.ELEMENT_NODE&&i(t))return!0}if(e.type==="characterData"){const t=e.target.parentElement;if(i(t))return!0}return!1}function v(){const e=document.documentElement;if(!e)return;new MutationObserver(function(r){for(const h of r)if(h.attributeName==="class"||h.attributeName==="data-theme"){a();return}}).observe(e,{attributes:!0,attributeFilter:["class","data-theme"]})}function T(){globalThis.addEventListener("storage",function(e){(e.key==="fleekdash-dark-mode"||e.key==="fleekdash-theme"||e.key==="fleekdash:palette-vars"||e.key==="fleekdash-color-mode-preference")&&a()})}function d(){const e=document.getElementById("wpwrap");!e||s||(s=new MutationObserver(a),s.observe(e,{attributes:!0,attributeFilter:["style","class"]}))}function O(){if(v(),T(),document.head&&new MutationObserver(function(t){for(const r of t)if(g(r)){a();return}}).observe(document.head,{childList:!0,subtree:!0,characterData:!0}),document.body){new MutationObserver(()=>{n(),d()}).observe(document.body,{childList:!0,subtree:!1}),d();return}document.addEventListener("DOMContentLoaded",()=>{n(),d()},{once:!0})}function L(){n(),!c&&(c=!0,O())}globalThis.FleekDashIframeWpwrapPin={apply:n,refresh:a,init:L}})();})();
