const F=`<div id="template-customizer" class="card rounded-0">
  <a href="javascript:void(0)" class="template-customizer-open-btn" tabindex="-1"></a>

  <div class="p-6 m-0 lh-1 border-bottom template-customizer-header position-relative py-4">
    <h6 class="template-customizer-t-panel_header mb-1"></h6>
    <p class="template-customizer-t-panel_sub_header mb-0 small"></p>
    <div class="d-flex align-items-center gap-2 position-absolute end-0 top-0 mt-6 me-5">
      <a
        href="javascript:void(0)"
        class="template-customizer-reset-btn text-heading"
        data-bs-toggle="tooltip"
        data-bs-placement="bottom"
        title="Reset Customizer"
        ><i class="icon-base ti tabler-refresh icon-lg"></i
        ><span class="badge rounded-pill bg-danger badge-dot badge-notifications d-none"></span
      ></a>
      <a href="javascript:void(0)" class="template-customizer-close-btn fw-light text-heading" tabindex="-1">
        <i class="icon-base ti tabler-x icon-lg"></i>
      </a>
    </div>
  </div>

  <div class="template-customizer-inner pt-6">
    <!-- Theming -->
    <div class="template-customizer-theming">
      <h5 class="m-0 px-6 pb-6">
        <span class="template-customizer-t-theming_header bg-label-primary rounded-1 py-1 px-3 small"></span>
      </h5>

      <!-- Color -->
      <div class="m-0 px-6 pb-6 template-customizer-color w-100">
        <label for="customizerColor" class="form-label d-block template-customizer-t-color_label mb-2"></label>
        <div class="row template-customizer-colors-options"></div>
      </div>

      <!-- Theme -->
      <div class="m-0 px-6 pb-6 template-customizer-theme w-100">
        <label for="customizerTheme" class="form-label d-block template-customizer-t-theme_label mb-2"></label>
        <div class="row px-1 template-customizer-themes-options"></div>
      </div>

      <!-- Skins -->
      <div class="m-0 px-6 pb-6 template-customizer-skins w-100">
        <label for="customizerSkin" class="form-label template-customizer-t-skin_label mb-2"></label>
        <div class="row px-1 template-customizer-skins-options"></div>
      </div>

      <!-- Semi Dark -->
      <div class="m-0 px-6 template-customizer-semiDark w-100 d-flex justify-content-between pe-12">
        <span class="form-label template-customizer-t-semiDark_label"></span>
        <label class="switch template-customizer-t-semiDark_label">
          <input type="checkbox" class="template-customizer-semi-dark-switch switch-input" />
          <span class="switch-toggle-slider">
            <span class="switch-on"></span>
            <span class="switch-off"></span>
          </span>
        </label>
      </div>
      <hr class="m-0 px-6 my-6" />
    </div>
    <!--/ Theming -->

    <!-- Layout -->
    <div class="template-customizer-layout">
      <h5 class="m-0 px-6 pb-6">
        <span class="template-customizer-t-layout_header bg-label-primary rounded-2 py-1 px-3 small"></span>
      </h5>

      <!-- Layout(Menu) -->
      <div class="m-0 px-6 pb-6 d-block template-customizer-layouts">
        <label for="customizerStyle" class="form-label d-block template-customizer-t-layout_label mb-2"></label>
        <div class="row px-1 template-customizer-layouts-options"></div>
      </div>

      <!-- Header Options for Horizontal -->
      <div class="m-0 px-6 pb-6 template-customizer-headerOptions w-100">
        <label for="customizerHeader" class="form-label template-customizer-t-layout_header_label mb-2"></label>
        <div class="row px-1 template-customizer-header-options"></div>
      </div>

      <!-- Fixed navbar -->
      <div class="m-0 px-6 pb-6 template-customizer-layoutNavbarOptions w-100">
        <label for="customizerNavbar" class="form-label template-customizer-t-layout_navbar_label mb-2"></label>
        <div class="row px-1 template-customizer-navbar-options"></div>
      </div>

      <!-- Content -->
      <div class="m-0 px-6 pb-6 template-customizer-content w-100">
        <label for="customizerContent" class="form-label template-customizer-t-content_label mb-2"></label>
        <div class="row px-1 template-customizer-content-options"></div>
      </div>

      <!-- Directions -->
      <div class="m-0 px-6 pb-6 template-customizer-directions w-100">
        <label for="customizerDirection" class="form-label template-customizer-t-direction_label mb-2"></label>
        <div class="row px-1 template-customizer-directions-options"></div>
      </div>
    </div>
    <!--/ Layout -->
  </div>
</div>
`,I=["color","theme","skins","semiDark","contentLayout","headerType","layoutCollapsed","layoutNavbarOptions","rtl","layoutFooterFixed","showDropdownOnHover"],R=["light","dark","system"];let x;const O=document.documentElement.classList;O.contains("layout-navbar-fixed")?x="sticky":O.contains("layout-navbar-hidden")?x="hidden":x="static";const $=!0,P=document.documentElement.getAttribute("data-bs-theme")||"light",M=document.getElementsByTagName("HTML")[0].getAttribute("data-skin")||0,B=O.contains("layout-wide")?"wide":"compact";let A;O.contains("layout-menu-offcanvas")?A="static-offcanvas":O.contains("layout-menu-fixed")?A="fixed":O.contains("layout-menu-fixed-offcanvas")?A="fixed-offcanvas":A="static";const U=A,W=!!O.contains("layout-menu-collapsed"),V=x,G=document.documentElement.getAttribute("dir")==="rtl",X=!!O.contains("layout-footer-fixed"),Y=!0;let H;const q=getComputedStyle(document.documentElement);class f{constructor({displayCustomizer:e,lang:t,defaultPrimaryColor:s,defaultSkin:i,defaultTheme:o,defaultSemiDark:l,defaultContentLayout:m,defaultHeaderType:g,defaultMenuCollapsed:u,defaultNavbarType:p,defaultTextDir:b,defaultFooterFixed:k,defaultShowDropdownOnHover:C,controls:L,themes:w,availableColors:T,availableSkins:z,availableThemes:N,availableContentLayouts:a,availableHeaderTypes:h,availableMenuCollapsed:c,availableNavbarOptions:r,availableDirections:_,onSettingsChange:v}){if(!this._ssr){if(!window.Helpers)throw new Error("window.Helpers required.");if(this.settings={},this.settings.displayCustomizer=typeof e<"u"?e:$,this.settings.lang=t||"en",s?(this.settings.defaultPrimaryColor=s,H=!0):(this.settings.defaultPrimaryColor=q.getPropertyValue("--bs-primary").trim(),H=!1),this.settings.defaultTheme=o||P,this.settings.defaultSemiDark=typeof l<"u"?l:!1,this.settings.defaultContentLayout=typeof m<"u"?m:B,this.settings.defaultHeaderType=g||U,this.settings.defaultMenuCollapsed=typeof u<"u"?u:W,this.settings.defaultNavbarType=typeof p<"u"?p:V,this.settings.defaultTextDir=b==="rtl"?!0:G,this.settings.defaultFooterFixed=typeof k<"u"?k:X,this.settings.defaultShowDropdownOnHover=typeof C<"u"?C:Y,this.settings.controls=L||I,this.settings.availableColors=T||f.COLORS,this.settings.availableSkins=z||f.SKINS,this.settings.availableThemes=N||f.THEMES,this.settings.availableContentLayouts=a||f.CONTENT,this.settings.availableHeaderTypes=h||f.HEADER_TYPES,this.settings.availableMenuCollapsed=c||f.LAYOUTS,this.settings.availableNavbarOptions=r||f.NAVBAR_OPTIONS,this.settings.availableDirections=_||f.DIRECTIONS,this.settings.defaultSkin=this._getDefaultSkin(typeof i<"u"?i:M),this.settings.themes=w||R,this.settings.themes.length<2){const d=this.settings.controls.indexOf("theme");d!==-1&&(this.settings.controls=this.settings.controls.slice(0,d).concat(this.settings.controls.slice(d+1)))}this.settings.onSettingsChange=typeof v=="function"?v:()=>{},this._loadSettings(),this._listeners=[],this._controls={},this._initDirection(),this.setContentLayout(this.settings.contentLayout,!1),this.setHeaderType(this.settings.headerType,!1),this.setLayoutNavbarOption(this.settings.layoutNavbarOptions,!1),this.setLayoutFooterFixed(this.settings.layoutFooterFixed,!1),this.setDropdownOnHover(this.settings.showDropdownOnHover,!1),this._setup()}}setColor(e,t=!1){const s=this._getSetting("PrimaryColor"),i=f.COLORS[0].color;if(e&&(e!==s||t)){window.Helpers.setColor(e,t);const g=this._isAdminLayout()?"admin-primaryColor":"front-primaryColor";e===i&&!t?this._deleteCookie(g):this._setCookie(g,e,365),this._setSetting("PrimaryColor",e)}const o=document.querySelectorAll('.template-customizer-color .template-customizer-colors-options input[type="radio"]');let l=!1;if(o.forEach(m=>{const g=m.value===e;m.checked=g,g&&(l=!0,typeof window.Helpers.updateCustomOptionCheck=="function"&&window.Helpers.updateCustomOptionCheck(m))}),!l){const m=document.querySelector('.template-customizer-colors-options input[value="picker"]');if(m){m.checked=!0,typeof window.Helpers.updateCustomOptionCheck=="function"&&window.Helpers.updateCustomOptionCheck(m);const g=document.querySelector(".custom-option-content .pcr-button");g&&g.style.setProperty("--pcr-color",e)}}}setTheme(e){const s=!this._getLayoutName().includes("front");this._setSetting("Theme",e);const i=s?"admin-mode":"front-mode",o=s?"admin-colorPref":"front-colorPref";e!==""&&this._checkCookie(i)?e==="system"?(this._setCookie(i,"system",365),window.matchMedia("(prefers-color-scheme: dark)").matches?this._setCookie(o,"dark",365):this._setCookie(o,"light",365)):e==="dark"?(this._setCookie(i,"dark",365),this._setCookie(o,"dark",365)):(this._setCookie(i,"light",365),this._setCookie(o,"light",365)):this._setCookie(i,e||"light",365)}setSkin(e,t=!0,s=null){if(!this._hasControls("skins"))return;let i;if(isNaN(parseInt(e))){if(i=this.settings.availableSkins.find(l=>l.name===e),!i)return}else{const l=parseInt(e);if(i=this.settings.availableSkins.find(m=>m.id===l),!i)return;e=i.name}this.settings.skin=i;const o=document.querySelectorAll('.template-customizer-skin-options input[type="radio"]');o.length&&o.forEach(l=>{l.value===i.name?(l.checked=!0,l.closest(".custom-option")&&window.Helpers&&typeof window.Helpers.updateCustomOptionCheck=="function"&&window.Helpers.updateCustomOptionCheck(l)):l.checked=!1}),document.documentElement.setAttribute("data-skin",i.name),t&&(this._setSetting("Skin",e),this._isAdminLayout()&&this._setCookie("customize_skin",i.name,365),this.settings.onSettingsChange.call(this,this.settings)),s&&s()}setLayoutNavbarOption(e,t=!0){this._hasControls("layoutNavbarOptions")&&(this.settings.layoutNavbarOptions=e,t&&this._setSetting("FixedNavbarOption",e),window.Helpers.setNavbar(e),t&&this.settings.onSettingsChange.call(this,this.settings))}setContentLayout(e,t=!0){this._hasControls("contentLayout")&&(this.settings.contentLayout=e,t&&this._setSetting("contentLayout",e),window.Helpers.setContentLayout(e),t&&this.settings.onSettingsChange.call(this,this.settings))}setHeaderType(e,t=!0){if(!this._hasControls("headerType")||!["static","static-offcanvas","fixed","fixed-offcanvas"].includes(e))return;this.settings.headerType=e,t&&this._setSetting("HeaderType",e),window.Helpers.setPosition(e==="fixed"||e==="fixed-offcanvas",e==="static-offcanvas"||e==="fixed-offcanvas"),t&&this.settings.onSettingsChange.call(this,this.settings);let s=window.Helpers.menuPsScroll;const i=window.PerfectScrollbar;this.settings.headerType==="fixed"||this.settings.headerType==="fixed-offcanvas"?i&&s&&(window.Helpers.menuPsScroll.destroy(),s=new i(document.querySelector(".menu-inner"),{suppressScrollX:!0,wheelPropagation:!1}),window.Helpers.menuPsScroll=s):s&&window.Helpers.menuPsScroll.destroy()}setLayoutFooterFixed(e,t=!0){this.settings.layoutFooterFixed=e,t&&this._setSetting("FixedFooter",e),window.Helpers.setFooterFixed(e),t&&this.settings.onSettingsChange.call(this,this.settings)}setDropdownOnHover(e,t=!0){if(!this._hasControls("showDropdownOnHover"))return;const s=typeof e=="string"?e==="true":!!e;if(this.settings.showDropdownOnHover=s,document.querySelector(".layout-menu-horizontal.menu, .layout-menu-horizontal .menu")){if(window.Helpers.mainMenu){window.Helpers.mainMenu.destroy();const{Menu:i}=window;window.Helpers.mainMenu=new i(document.getElementById("layout-menu"),{orientation:"horizontal",closeChildren:!0,showDropdownOnHover:s})}t&&(this._setSetting("ShowDropdownOnHover",s),this._setCookie("showDropdownOnHover",s.toString(),365)),t&&this.settings.onSettingsChange.call(this,this.settings)}}setRtl(e){this._hasControls("rtl")&&(this._setSetting("Rtl",String(e)),this._setCookie("direction",e?"true":"false",365))}setLang(e,t=!0,s=!1){if(e===this.settings.lang&&!s)return;if(!f.LANGUAGES[e])throw new Error(`Language "${e}" not found!`);const i=f.LANGUAGES[e];["panel_header","panel_sub_header","theming_header","color_label","theme_label","style_switch_light","style_switch_dark","layout_header","layout_label","layout_header_label","content_label","layout_static","layout_offcanvas","layout_fixed","layout_fixed_offcanvas","layout_dd_open_label","layout_navbar_label","layout_footer_label","misc_header","skin_label","semiDark_label","direction_label"].forEach(o=>{const l=this.container.querySelector(`.template-customizer-t-${o}`);l&&(l.textContent=i[o])}),this.settings.lang=e,t&&this._setSetting("Lang",e),t&&this.settings.onSettingsChange.call(this,this.settings)}update(){if(this._ssr)return;const e=!!document.querySelector(".layout-navbar"),t=!!document.querySelector(".layout-menu"),s=!!document.querySelector(".layout-menu-horizontal.menu, .layout-menu-horizontal .menu"),i=!!document.querySelector(".content-footer");this._controls.showDropdownOnHover&&(t?(this._controls.showDropdownOnHover.setAttribute("disabled","disabled"),this._controls.showDropdownOnHover.classList.add("disabled")):(this._controls.showDropdownOnHover.removeAttribute("disabled"),this._controls.showDropdownOnHover.classList.remove("disabled"))),this._controls.layoutNavbarOptions&&(e?(this._controls.layoutNavbarOptions.removeAttribute("disabled"),this._controls.layoutNavbarOptionsW.classList.remove("disabled")):(this._controls.layoutNavbarOptions.setAttribute("disabled","disabled"),this._controls.layoutNavbarOptionsW.classList.add("disabled")),s&&e&&this.settings.headerType==="fixed"&&(this._controls.layoutNavbarOptions.setAttribute("disabled","disabled"),this._controls.layoutNavbarOptionsW.classList.add("disabled"))),this._controls.layoutFooterFixed&&(i?(this._controls.layoutFooterFixed.removeAttribute("disabled"),this._controls.layoutFooterFixedW.classList.remove("disabled")):(this._controls.layoutFooterFixed.setAttribute("disabled","disabled"),this._controls.layoutFooterFixedW.classList.add("disabled"))),this._controls.headerType&&(t||s?this._controls.headerType.removeAttribute("disabled"):this._controls.headerType.setAttribute("disabled","disabled"))}clearLocalStorage(){if(this._ssr)return;const e=this._getLayoutName();["Color","Theme","Skin","SemiDark","LayoutCollapsed","FixedNavbarOption","HeaderType","contentLayout","Rtl","Lang"].forEach(i=>{const o=`templateCustomizer-${e}--${i}`;localStorage.removeItem(o)}),["customize_skin","customize_semi_dark","direction","LayoutCollapsed","contentLayout","navbarType","headerType","admin-mode","front-mode","admin-colorPref","front-colorPref","admin-primaryColor","front-primaryColor"].forEach(i=>{this._deleteCookie(i)}),this._showResetBtnNotification(!1)}destroy(){this._ssr||(this._cleanup(),this.settings=null,this.container.parentNode.removeChild(this.container),this.container=null)}_loadSettings(){const e=this._getSetting("Rtl"),t=this._getSetting("Color"),s=this._getSetting("Theme"),i=this._getSetting("Skin"),o=this._getSetting("SemiDark"),l=this._getSetting("contentLayout"),m=this._getSetting("LayoutCollapsed"),g=this._getSetting("ShowDropdownOnHover"),u=this._getSetting("FixedNavbarOption"),p=this._getSetting("FixedFooter"),b=this._getSetting("HeaderType"),C=!this._getLayoutName().includes("front"),L=C?"admin-mode":"front-mode",w=C?"admin-colorPref":"front-colorPref",T=this._getCookie("showDropdownOnHover"),z=T!==null?T==="true":g?g==="true":this.settings.defaultShowDropdownOnHover;e||s||i||l||m||u||b||t||o?this._showResetBtnNotification(!0):this._showResetBtnNotification(!1),this.settings.headerType=["static","static-offcanvas","fixed","fixed-offcanvas"].includes(b)?b:this.settings.defaultHeaderType,this.settings.rtl=e!==""?e==="true":this.settings.defaultTextDir,t&&(H=!0),this.settings.color=t||this.settings.defaultPrimaryColor,this.setColor(this.settings.color,H),this.settings.themesOpt=this.settings.themes.includes(s)?s:this.settings.defaultTheme;const N=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";let a;this.settings.themes.includes(s)?a=s==="system"?N:s:this.settings.defaultTheme==="system"?a=N:a=this.settings.defaultTheme,this.settings.theme=this.settings.defaultTheme,document.documentElement.setAttribute("data-bs-theme",a),this._getCookie(L)==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?(this._setCookie(w,"dark",365),this.settings.theme="dark"):(this._setCookie(w,"light",365),this.settings.theme="light"):this.settings.themesOpt==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?this.settings.theme="dark":this.settings.theme="light":this.settings.theme=this.settings.themes.includes(s)?s:this.settings.themesOpt;const h=this._getSetting("Skin");if(this._isAdminLayout()){const r=this._getCookie("customize_skin"),_=document.documentElement.getAttribute("data-skin"),v=h||r||_||this.settings.defaultSkin.name;this.settings.skin=this._getSkinByName(v,!0),this.settings.skin&&this.settings.skin.name&&document.documentElement.setAttribute("data-skin",this.settings.skin.name);const d=this._getSetting("SemiDark"),n=this._getCookie("customize_semi_dark"),S=d||n||this.settings.defaultSemiDark.toString();if(this.settings.semiDark=S==="true",this.settings.semiDark){document.documentElement.setAttribute("data-semidark-menu",!0);const D=document.getElementById("layout-menu");D&&D.setAttribute("data-bs-theme","dark")}}else this.settings.skin=this._getSkinByName("default",!0),document.documentElement.setAttribute("data-skin","default"),this.settings.semiDark=!1,document.documentElement.removeAttribute("data-semidark-menu");if(this.settings.contentLayout=l||this.settings.defaultContentLayout,this.settings.layoutCollapsed=m?m==="true":this.settings.defaultMenuCollapsed,this.settings.layoutCollapsed&&document.documentElement.classList.add("layout-menu-collapsed"),document.querySelector(".layout-menu-horizontal.menu, .layout-menu-horizontal .menu")){if(this.settings.showDropdownOnHover=z,window.Helpers.mainMenu){window.Helpers.mainMenu.destroy();const{Menu:c}=window;window.Helpers.mainMenu=new c(document.getElementById("layout-menu"),{orientation:"horizontal",closeChildren:!0,showDropdownOnHover:z})}}else this.settings.showDropdownOnHover=!1;this.settings.layoutNavbarOptions=["static","sticky","hidden"].includes(u)?u:this.settings.defaultNavbarType,this.settings.layoutFooterFixed=p?p==="true":this.settings.defaultFooterFixed,this._hasControls("rtl")||(this.settings.rtl=document.documentElement.getAttribute("dir")==="rtl"),this._hasControls("theme")||(this.settings.theme=window.Helpers.isDarkStyle()?"dark":"light"),this._hasControls("contentLayout")||(this.settings.contentLayout=null),this._hasControls("headerType")||(this.settings.headerType=null),this._hasControls("layoutCollapsed")||(this.settings.layoutCollapsed=null),this._hasControls("layoutNavbarOptions")||(this.settings.layoutNavbarOptions=null),this._hasControls("skins")||(this.settings.skin=null),this._hasControls("semiDark")||(this.settings.semiDark=null)}_setup(e=document){const t=(a,h,c,r,_=!1)=>{const v=document.createElement("div");v.classList.add("col-4","px-2");const d=_?"custom-option custom-option-icon":"custom-option custom-option-image custom-option-image-radio";return v.innerHTML=`
        <div class="form-check ${d} mb-0">
          <label class="form-check-label custom-option-content p-0" for="${c}${a}">
            <span class="custom-option-body mb-0 scaleX-n1-rtl"></span>
          </label>
          <input
            name="${c}"
            class="form-check-input d-none"
            type="radio"
            value="${a}"
            id="${c}${a}" />
        </div>
        <label class="form-check-label small text-nowrap text-body" for="${c}${a}">${h}</label>
      `,_?v.querySelector(".custom-option-body").innerHTML=r:fetch(`${assetsPath}img/customizer/${r}`).then(y=>y.text()).then(y=>{v.querySelector(".custom-option-body").innerHTML=y}).catch(y=>console.error("Error loading SVG:",y)),v};this._cleanup(),this.container=this._getElementFromString(F),this.container.setAttribute("style",`visibility: ${this.settings.displayCustomizer?"visible":"hidden"}`);const s=this.container.querySelector(".template-customizer-open-btn"),i=()=>{this.container.classList.add("template-customizer-open"),this.update(),this._updateInterval&&clearInterval(this._updateInterval),this._updateInterval=setInterval(()=>{this.update()},500)};s.addEventListener("click",i),this._listeners.push([s,"click",i]);const o=this.container.querySelector(".template-customizer-reset-btn"),l=()=>{this.clearLocalStorage(),window.location.reload()};o.addEventListener("click",l),this._listeners.push([o,"click",l]);const m=this.container.querySelector(".template-customizer-close-btn"),g=()=>{this.container.classList.remove("template-customizer-open"),this._updateInterval&&(clearInterval(this._updateInterval),this._updateInterval=null)};m.addEventListener("click",g),this._listeners.push([m,"click",g]);const u=this.container.querySelector(".template-customizer-color"),p=u.querySelector(".template-customizer-colors-options");if(!this._hasControls("color"))u.parentNode.removeChild(u);else{const a="colorRadioIcon";this.settings.availableColors.forEach(r=>{const _=`<div class="form-check custom-option custom-option-icon mb-0">
          <label class="form-check-label custom-option-content p-0" for="${a}${r.name}">
            <span class="custom-option-body mb-0 scaleX-n1-rtl" style="background-color: ${r.color};"></span>
          </label>
          <input
            name="${a}"
            class="form-check-input d-none"
            type="radio"
            value="${r.color}"
            data-color="${r.color}"
            id="${a}${r.name}" />
        </div>`,v=this._getElementFromString(_);p.appendChild(v)}),p.appendChild(this._getElementFromString('<div class="form-check custom-option custom-option-icon mb-0"><label class="form-check-label custom-option-content" for="colorRadioIcon"><span class="custom-option-body customizer-nano-picker mb-50"><i class="ti tabler-color-picker icon-base"></i></span></label><input name="colorRadioIcon" class="form-check-input picker d-none" type="radio" value="picker" id="colorRadioIcon" /> </div>'));const h=p.querySelector(`input[value="${this.settings.color}"]`);h?(h.setAttribute("checked","checked"),p.querySelector('input[value="picker"]').removeAttribute("checked")):p.querySelector('input[value="picker"]').setAttribute("checked","checked");const c=r=>{r.target.value==="picker"?document.querySelector(".custom-option-content .pcr-button").click():(this._setSetting("Color",r.target.dataset.color),this.setColor(r.target.dataset.color,()=>{this._loadingState(!1)},!0))};p.addEventListener("change",c),this._listeners.push([p,"change",c])}const b=this.container.querySelector(".template-customizer-theme"),k=b.querySelector(".template-customizer-themes-options");if(!this._hasControls("theme"))b.parentNode.removeChild(b);else{this.settings.availableThemes.forEach(h=>{const c=t(h.name,h.title,"customRadioIcon",h.image,!0);k.appendChild(c)}),k.querySelector(`input[value="${this.settings.themesOpt}"]`)&&k.querySelector(`input[value="${this.settings.themesOpt}"]`).setAttribute("checked","checked");const a=h=>{if(document.documentElement.setAttribute("data-bs-theme",h.target.value),this._hasControls("semiDark")){const c=this.container.querySelector(".template-customizer-semiDark");h.target.value==="dark"?c.classList.add("d-none"):c.classList.remove("d-none")}window.Helpers.syncThemeToggles(h.target.value),this.setTheme(h.target.value,!0,()=>{this._loadingState(!1)})};k.addEventListener("change",a),this._listeners.push([k,"change",a])}const C=this.container.querySelector(".template-customizer-skins"),L=C.querySelector(".template-customizer-skins-options");if(!this._hasControls("skins"))C.parentNode.removeChild(C);else{this.settings.availableSkins.forEach(r=>{const _=t(r.name,r.title,"skinRadios",r.image);L.appendChild(_)});const a=this.settings.skin.name||document.documentElement.getAttribute("data-skin")||"default",h=L.querySelector(`input[value="${a}"]`);h&&(h.setAttribute("checked","checked"),h.closest(".custom-option")&&window.Helpers&&typeof window.Helpers.updateCustomOptionCheck=="function"&&window.Helpers.updateCustomOptionCheck(h)),document.documentElement.setAttribute("data-skin",a);const c=r=>{document.documentElement.setAttribute("data-skin",r.target.value),this.setSkin(r.target.value,!0,()=>{this._loadingState(!1,!0)})};L.addEventListener("change",c),this._listeners.push([L,"change",c])}const w=this.container.querySelector(".template-customizer-semi-dark-switch"),T=this.container.querySelector(".template-customizer-semiDark");if(document.documentElement.getAttribute("data-bs-theme")==="dark"&&T.classList.add("d-none"),!this._hasControls("semiDark"))T.remove();else if(this._hasControls("semiDark")&&this._getSetting("Theme")==="dark")w.classList.add("d-none");else{this.settings.semiDark?w.checked=!0:w.checked=!1;const a=h=>{const c=h.target.checked,r=c?"dark":"light";this._isAdminLayout()&&(r==="dark"?(document.getElementById("layout-menu").setAttribute("data-bs-theme",r),document.documentElement.setAttribute("data-semidark-menu",!0)):(document.getElementById("layout-menu").removeAttribute("data-bs-theme"),document.documentElement.removeAttribute("data-semidark-menu")),this._setSetting("SemiDark",c),this._setCookie("customize_semi_dark",c.toString(),365))};w.addEventListener("change",a),this._listeners.push([w,"change",a])}const z=this.container.querySelector(".template-customizer-theming");!this._hasControls("color")&&!this._hasControls("theme")&&!this._hasControls("skins")&&!this._hasControls("semiDark")&&z.parentNode.removeChild(z);const N=this.container.querySelector(".template-customizer-layout");if(!this._hasControls("contentLayout headerType layoutCollapsed layoutNavbarOptions rtl",!0))N.parentNode.removeChild(N);else{const a=this.container.querySelector(".template-customizer-layouts");if(!this._hasControls("layoutCollapsed"))a.parentNode.removeChild(a);else{setTimeout(()=>{document.querySelector(".layout-menu-horizontal")&&a.parentNode.removeChild(a)},100);const d=a.querySelector(".template-customizer-layouts-options");this.settings.availableMenuCollapsed.forEach(n=>{const S=t(n.name,n.title,"layoutsRadios",n.image);d.appendChild(S)}),d.querySelector(`input[value="${this.settings.layoutCollapsed?"collapsed":"expanded"}"]`).setAttribute("checked","checked");const y=n=>{window.Helpers.setCollapsed(n.target.value==="collapsed",!0),this._setSetting("LayoutCollapsed",n.target.value==="collapsed"),this._setCookie("LayoutCollapsed",n.target.value==="collapsed",365)};d.addEventListener("change",y),this._listeners.push([d,"change",y])}const h=this.container.querySelector(".template-customizer-content");if(!this._hasControls("contentLayout"))h.parentNode.removeChild(h);else{const d=h.querySelector(".template-customizer-content-options");this.settings.availableContentLayouts.forEach(n=>{const S=t(n.name,n.title,"contentRadioIcon",n.image);d.appendChild(S)}),d.querySelector(`input[value="${this.settings.contentLayout}"]`).setAttribute("checked","checked");const y=n=>{this._loading=!0,this._loadingState(!0,!0),this.setContentLayout(n.target.value,!0,()=>{this._loading=!1,this._loadingState(!1,!0)}),this._setCookie("contentLayout",n.target.value,365)};d.addEventListener("change",y),this._listeners.push([d,"change",y])}const c=this.container.querySelector(".template-customizer-headerOptions"),r=document.documentElement.getAttribute("data-template").split("-");if(!this._hasControls("headerType"))c.parentNode.removeChild(c);else{const d=c.querySelector(".template-customizer-header-options");setTimeout(()=>{r.includes("vertical")&&c.parentNode.removeChild(c)},100),this.settings.availableHeaderTypes.forEach(n=>{const S=t(n.name,n.title,"headerRadioIcon",n.image);d.appendChild(S)}),d.querySelector(`input[value="${this.settings.headerType}"]`).setAttribute("checked","checked");const y=n=>{this.setHeaderType(n.target.value),this._setCookie("headerType",n.target.value,365)};d.addEventListener("change",y),this._listeners.push([d,"change",y])}const _=this.container.querySelector(".template-customizer-layoutNavbarOptions");if(!this._hasControls("layoutNavbarOptions"))_.parentNode.removeChild(_);else{setTimeout(()=>{r.includes("horizontal")&&_.parentNode.removeChild(_)},100);const d=_.querySelector(".template-customizer-navbar-options");this.settings.availableNavbarOptions.forEach(n=>{const S=t(n.name,n.title,"navbarOptionRadios",n.image);d.appendChild(S)}),d.querySelector(`input[value="${this.settings.layoutNavbarOptions}"]`).setAttribute("checked","checked");const y=n=>{this._loading=!0,this._loadingState(!0,!0),this.setLayoutNavbarOption(n.target.value,!0,()=>{this._loading=!1,this._loadingState(!1,!0)}),this._setCookie("navbarType",n.target.value,365)};d.addEventListener("change",y),this._listeners.push([d,"change",y])}const v=this.container.querySelector(".template-customizer-directions");if(!this._hasControls("rtl"))v.parentNode.removeChild(v);else{const d=v.querySelector(".template-customizer-directions-options");this.settings.availableDirections.forEach(n=>{const S=t(n.name,n.title,"directionRadioIcon",n.image);d.appendChild(S)}),d.querySelector(`input[value="${this.settings.rtl?"rtl":"ltr"}"]`).setAttribute("checked","checked");const y=n=>{this._setSetting("Lang",this.settings.lang==="ar"?"en":"ar"),this.settings.rtl=n.target.value==="rtl";const S=this._getSetting("Lang"),D=document.querySelector(".dropdown-language .dropdown-menu");D&&D.querySelector(`[data-language="${S}"]`).click(),this._initDirection(),this.setRtl(n.target.value==="rtl",!0,()=>{this._loadingState(!1)}),!(document.documentElement.getAttribute("data-template")||"").includes("front")?n.target.value==="rtl"?window.location.href=baseUrl+"lang/ar":window.location.href=baseUrl+"lang/en":window.location.reload()};d.addEventListener("change",y),this._listeners.push([d,"change",y])}}setTimeout(()=>{const a=this.container.querySelector(".template-customizer-layout"),h=this.container.querySelector(".template-customizer-theming"),c=document.documentElement.getAttribute("data-bs-theme");let r=!1;c==="light"&&document.querySelector(".layout-menu")&&(document.querySelector(".layout-menu").getAttribute("data-bs-theme")==="dark"&&(r=!0),r===!0&&h.querySelector(".template-customizer-semi-dark-switch").setAttribute("checked","checked")),document.querySelector(".menu-vertical")?this._hasControls("rtl contentLayout layoutCollapsed layoutNavbarOptions",!0)||a&&a.parentNode.removeChild(a):document.querySelector(".menu-horizontal")&&(this._hasControls("rtl contentLayout headerType",!0)||a&&a.parentNode.removeChild(a))},100),this.setLang(this.settings.lang,!1,!0),e===document?e.body?e.body.appendChild(this.container):window.addEventListener("DOMContentLoaded",()=>e.body.appendChild(this.container)):e.appendChild(this.container)}_initDirection(){this._hasControls("rtl")&&document.documentElement.setAttribute("dir",this._checkCookie("direction")?this._getCookie("direction")==="true"?"rtl":"ltr":this.settings.rtl?"rtl":"ltr")}_loadingState(e,t){this.container.classList[e?"add":"remove"](`template-customizer-loading${t?"-theme":""}`)}_getElementFromString(e){const t=document.createElement("div");return t.innerHTML=e,t.firstChild}_setSetting(e,t){const s=this._getLayoutName();try{localStorage.setItem(`templateCustomizer-${s}--${e}`,String(t)),this._showResetBtnNotification()}catch{}}_getSetting(e){let t=null;const s=this._getLayoutName();try{t=localStorage.getItem(`templateCustomizer-${s}--${e}`)}catch{}return String(t||"")}_showResetBtnNotification(e=!0){setTimeout(()=>{const t=this.container.querySelector(".template-customizer-reset-btn .badge");e?t.classList.remove("d-none"):t.classList.add("d-none")},200)}_getLayoutName(){return document.getElementsByTagName("HTML")[0].getAttribute("data-template")}_removeListeners(){for(let e=0,t=this._listeners.length;e<t;e++)this._listeners[e][0].removeEventListener(this._listeners[e][1],this._listeners[e][2])}_cleanup(){this._removeListeners(),this._listeners=[],this._controls={},this._updateInterval&&(clearInterval(this._updateInterval),this._updateInterval=null)}get _ssr(){return typeof window>"u"}_hasControls(e,t=!1){return e.split(" ").reduce((s,i)=>(this.settings.controls.indexOf(i)!==-1?(t||s!==!1)&&(s=!0):(!t||s!==!0)&&(s=!1),s),null)}_getDefaultSkin(e){const t=this.settings.availableSkins;let s=null;if(isNaN(parseInt(e)))typeof e=="string"&&(s=t.find(i=>i.name===e));else{const i=parseInt(e);s=t.find(o=>o.id===i)}if(!s&&t.length>0&&(s=t[0]),!s)throw new Error(`Skin "${e}" not found!`);return s}_getSkinByName(e,t=!1){const s=this.settings.availableSkins;for(let i=0,o=s.length;i<o;i++)if(s[i].name===e)return s[i];if(!isNaN(parseInt(e))){const i=parseInt(e),o=s.find(l=>l.id===i);if(o)return o}if(t){const i=s.find(o=>o.name==="default");return i||(s.length>0?s[0]:null)}return null}_setCookie(e,t,s,i="/",o=""){const l=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;let m="";if(s){const p=new Date;p.setTime(p.getTime()+s*24*60*60*1e3),m=`; expires=${p.toUTCString()}`}const g=`; path=${i}`,u=o?`; domain=${o}`:"";document.cookie=`${l}${m}${g}${u}`}_getCookie(e){const t=document.cookie.split("; ");for(let s=0;s<t.length;s++){const[i,o]=t[s].split("=");if(decodeURIComponent(i)===e)return decodeURIComponent(o)}return null}_checkCookie(e){return this._getCookie(e)!==null}_deleteCookie(e){document.cookie=e+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"}_isAdminLayout(){return!this._getLayoutName().includes("front")}}f.COLORS=[{name:"primary",title:"Primary",color:q.getPropertyValue("--bs-primary").trim()},{name:"success",title:"Success",color:"#0D9394"},{name:"warning",title:"Warning",color:"#FFAB1D"},{name:"danger",title:"Danger",color:"#EB3D63"},{name:"info",title:"Info",color:"#2092EC"}];f.THEMES=[{name:"light",title:"Light",image:'<i class="ti tabler-sun icon-base mb-0"></i>'},{name:"dark",title:"Dark",image:'<i class="ti tabler-moon icon-base mb-0"></i>'},{name:"system",title:"System",image:'<i class="ti tabler-device-desktop-analytics icon-base mb-0"></i>'}];f.SKINS=[{id:0,name:"default",title:"Default",image:"skin-default.svg"},{id:1,name:"bordered",title:"Bordered",image:"skin-border.svg"}];f.LAYOUTS=[{name:"expanded",title:"Expanded",image:"layouts-expanded.svg"},{name:"collapsed",title:"Collapsed",image:"layouts-collapsed.svg"}];f.NAVBAR_OPTIONS=[{name:"sticky",title:"Sticky",image:"navbar-sticky.svg"},{name:"static",title:"Static",image:"navbar-static.svg"},{name:"hidden",title:"Hidden",image:"navbar-hidden.svg"}];f.HEADER_TYPES=[{name:"fixed",title:"Fixed",image:"horizontal-fixed.svg"},{name:"static",title:"Static",image:"horizontal-static.svg"}];f.CONTENT=[{name:"compact",title:"Compact",image:"content-compact.svg"},{name:"wide",title:"Wide",image:"content-wide.svg"}];f.DIRECTIONS=[{name:"ltr",title:"Left to Right (En)",image:"direction-ltr.svg"},{name:"rtl",title:"Right to Left (Ar)",image:"direction-rtl.svg"}];f.LANGUAGES={en:{panel_header:"Template Customizer",panel_sub_header:"Customize and preview in real time",theming_header:"Theming",color_label:"Primary Color",theme_label:"Theme",skin_label:"Skins",semiDark_label:"Semi Dark",layout_header:"Layout",layout_label:"Menu (Navigation)",layout_header_label:"Header Types",content_label:"Content",layout_navbar_label:"Navbar Type",direction_label:"Direction"},fr:{panel_header:"Modèle De Personnalisation",panel_sub_header:"Personnalisez et prévisualisez en temps réel",theming_header:"Thématisation",color_label:"Couleur primaire",theme_label:"Thème",skin_label:"Peaux",semiDark_label:"Demi-foncé",layout_header:"Disposition",layout_label:"Menu (Navigation)",layout_header_label:"Types d'en-tête",content_label:"Contenu",layout_navbar_label:"Type de barre de navigation",direction_label:"Direction"},ar:{panel_header:"أداة تخصيص القالب",panel_sub_header:"تخصيص ومعاينة في الوقت الحقيقي",theming_header:"السمات",color_label:"اللون الأساسي",theme_label:"سمة",skin_label:"جلود",semiDark_label:"شبه داكن",layout_header:"تَخطِيط",layout_label:"القائمة (الملاحة)",layout_header_label:"أنواع الرأس",content_label:"محتوى",layout_navbar_label:"نوع شريط التنقل",direction_label:"اتجاه"},de:{panel_header:"Vorlagen-Anpasser",panel_sub_header:"Anpassen und Vorschau in Echtzeit",theming_header:"Themen",color_label:"Grundfarbe",theme_label:"Thema",skin_label:"Skins",semiDark_label:"Halbdunkel",layout_header:"Layout",layout_label:"Menü (Navigation)",layout_header_label:"Header-Typen",content_label:"Inhalt",layout_navbar_label:"Art der Navigationsleiste",direction_label:"Richtung"}};window.TemplateCustomizer=f;const j=()=>{const E={pickerWrapper:document.querySelector('.template-customizer-colors-options input[value="picker"]'),pickerEl:document.querySelector(".customizer-nano-picker"),pcrButton:document.querySelector(".custom-option-content .pcr-button")};if(!E.pickerWrapper||!E.pickerEl){console.warn("Required color picker elements not found");return}const s=!(document.documentElement.getAttribute("data-template")||"").includes("front")?"admin-primaryColor":"front-primaryColor";function i(u){const p=document.cookie.split("; ");for(let b=0;b<p.length;b++){const[k,C]=p[b].split("=");if(decodeURIComponent(k)===u)return decodeURIComponent(C)}return null}const o=E.pickerWrapper.checked||E.pickerWrapper.getAttribute("checked")==="checked",l=i(s),m=o?l||window.templateCustomizer._getSetting("Color")||"#FF4961":window.templateCustomizer.settings.defaultPrimaryColor,g=new Pickr({el:E.pickerEl,theme:"nano",default:m,defaultRepresentation:"HEX",comparison:!1,components:{hue:!0,preview:!0,interaction:{input:!0}}});g._root.button.classList.add("ti","tabler-color-picker"),g.on("change",u=>{var k;const p=u.toHEXA().toString(),b=u.toRGBA().toString();(k=E.pcrButton)==null||k.style.setProperty("--pcr-color",b),E.pickerWrapper.checked=!0,window.Helpers.updateCustomOptionCheck(E.pickerWrapper),window.templateCustomizer._setSetting("Color",p),window.templateCustomizer.setColor(p,!0)})};window.onload=()=>{j();const t=!(document.documentElement.getAttribute("data-template")||"").includes("front")?"admin-primaryColor":"front-primaryColor";function s(u){const p=document.cookie.split("; ");for(let b=0;b<p.length;b++){const[k,C]=p[b].split("=");if(decodeURIComponent(k)===u)return decodeURIComponent(C)}return null}const i=s(t)||window.templateCustomizer.settings.defaultPrimaryColor,o=f.COLORS[0].color,l=document.querySelector(".custom-option-content .pcr-button");l&&l.style.setProperty("--pcr-color",i);const m=document.querySelectorAll('.template-customizer-color .template-customizer-colors-options input[type="radio"]');let g=!1;if(m.forEach(u=>{u.value===i&&(u.checked=!0,g=!0,typeof window.Helpers.updateCustomOptionCheck=="function"&&window.Helpers.updateCustomOptionCheck(u))}),!g&&m.length>0&&i!==o){const u=document.querySelector('.template-customizer-colors-options input[value="picker"]');u&&(u.checked=!0,typeof window.Helpers.updateCustomOptionCheck=="function"&&window.Helpers.updateCustomOptionCheck(u))}else if(!g&&i===o){const u=m[0];u&&(u.checked=!0,typeof window.Helpers.updateCustomOptionCheck=="function"&&window.Helpers.updateCustomOptionCheck(u))}};
