1/*! 2 * @package [FS] Modal element for YOOtheme Pro 3 * @subpackage fs-modal 4 * 5 * @author Flart Studio https://flart.studio 6 * @copyright Copyright (C) 2008-2026 Flart Studio. All rights reserved. 7 * @license Proprietary â https://flart.studio/license 8 * @link https://flart.studio/yootheme-pro/modal 9 * @build (FLART_BUILD_NUMBER) 10 * 11 * PROPRIETARY AND CONFIDENTIAL 12 * Unauthorized sharing, redistribution, or modification prohibited. 13 */ 14(()=>{"use strict";const e="fs-modal-root";if(document.body&&!document.getElementById(e)){const t=document.createElement("div");t.id=e,document.body.appendChild(t)}const t="[data-fs-modal]:not([data-disabled]):not([data-initialized]):not([data-initializing])",o="[data-fs-modal-container]",i="[data-fs-modal-lazy-load] .uk-modal-body > template",s="[data-fs-modal]:not([data-disabled])",d="data-initialized",a="data-initializing",n="data-init-failed",r={container:document.body,debug:!1,builderIntegration:!0,observeDOM:!0};class l{static#e=null;static getInstance(e={}){return l.#e||(l.#e=new l(e)),l.#e}constructor(e={}){if(l.#e)return l.#e;this.options={...r,...e},this.modals=new Map,this.modalRoot=null,this.domObserver=null,this.builderObserver=null,this.isBuilderContext=!1,this.#t()}#t(){this.#o()&&(this.#i(),this.#s(),this.#d(),this.options.builderIntegration&&this.isBuilderContext&&this.#a(),this.options.observeDOM&&this.#n(),this.#r("info","Modal manager initialized"))}#o(){return!("undefined"==typeof UIkit||!UIkit.modal)||(this.#r("error","UIkit.modal is required but not found"),!1)}#i(){this.modalRoot=document.getElementById(e),this.modalRoot||(this.#r("warn","Modal root container not found, creating fallback"),this.modalRoot=document.createElement("div"),this.modalRoot.id=e,document.body.appendChild(this.modalRoot))}#s(){try{this.isBuilderContext=!(!window.parent||window.parent===window||!window.parent.Vue?.events)}catch{this.isBuilderContext=!1}}#d(){const e=this.options.container.querySelectorAll(t);let o=0;e.forEach((e=>{this.#l(e)&&o++})),o>0&&this.#r("info",`Processed ${o} modal(s)`)}#l(e){if(this.modals.has(e))return!1;e.setAttribute(a,"true");try{const t=Array.from(e.querySelectorAll(o)).find((t=>t.closest(s)===e));if(!t)return this.#r("error","Modal container not found in wrapper",e),this.#u(e),!1;const n=t.querySelector(i),r=t.getAttribute("id")||e.getAttribute("id"),l={wrapper:e,container:t,template:n,id:r,lazyLoadHandler:null,initialized:!0};return this.modals.set(e,l),n&&this.#c(l),e.removeAttribute(a),e.setAttribute(d,"true"),this.#r("info",`Modal initialized: ${r||"unnamed"}`,this.getModal(e)),!0}catch(t){return this.#r("error","Failed to initialize modal",t),this.#u(e),this.modals.delete(e),!1}}#u(e){e.removeAttribute(a),e.removeAttribute(d),e.setAttribute(n,"true")}#c(e){const{container:t}=e,o=()=>{setTimeout((()=>{try{const i=UIkit.modal(t);i?.isToggled()?this.#h(e):(this.#r("debug","Phantom trigger detected, re-attaching listener"),UIkit.util.once(t,"beforeshow",o))}catch(e){this.#r("error","Failed during lazy load",e)}}),0)};e.lazyLoadHandler=o,UIkit.util.once(t,"beforeshow",o)}#h(e){const{container:t,template:o}=e;if(o&&o.parentNode)try{const i=o.content.cloneNode(!0);o.parentNode.replaceChild(i,o),e.template=null,UIkit.update&&UIkit.update(t),this.#r("info",`Template loaded for modal: ${e.id||"unnamed"}`)}catch(e){this.#r("error","Failed to load template",e)}else this.#r("warn","Template or parent not found")}#m(e){if(!this.isBuilderContext||!this.modalRoot)return;this.modalRoot.querySelectorAll(o).forEach((t=>{const o=t.getAttribute("id");if(!o)return;if(this.options.container.querySelector(`${s} #${o}[uk-modal]`)){const e=t.classList.contains("uk-open");return t.remove(),void(e?(this.#r("info",`Reopening fresh modal: ${o}`),setTimeout((()=>{const e=document.querySelector(`#${o}[uk-modal]`);e&&(UIkit.modal(e)?.show(),this.#r("info",`Reopened modal: ${o}`))}),100)):this.#r("info",`Removed stale modal: ${o}`))}if(!e.has(o))return;const i=t.classList.contains("uk-open");t.remove(),this.#r("info",i?`Closed modal (edit mode): ${o}`:`Removed stale modal: ${o}`)}))}#a(){if(this.isBuilderContext)try{window.parent.Vue.events.on("loadPreview",(()=>{this.#g()}),{priority:-10}),this.#r("info","Builder integration successful")}
14catch(e){this.#r("warn","Failed to setup Builder integration",e),this.#b()}else this.#b()}#b(){this.builderObserver||(this.builderObserver=new MutationObserver((e=>{for(const t of e)for(const e of t.addedNodes)if("customizer-data"===e.id)return this.#r("info","Customizer update detected (fallback)"),void this.#g()})),this.builderObserver.observe(document.head,{childList:!0}),this.#r("info","Fallback observer attached"))}#g(){this.#r("info","Builder update detected")}#n(){this.domObserver||(this.domObserver=new MutationObserver((o=>{const i=new Set,n=new Set;for(const r of o)if("childList"===r.type&&r.target.id!==e&&!r.target.closest?.(`#${e}`)){for(const e of r.addedNodes)e.nodeType===Node.ELEMENT_NODE&&(e.matches?.(s)?e.hasAttribute(d)||e.hasAttribute(a)||i.add(e):e.querySelector?.(t)&&e.querySelectorAll(t).forEach((e=>i.add(e))));for(const e of r.removedNodes)e.nodeType===Node.ELEMENT_NODE&&(this.modals.has(e)?n.add(e):this.modals.size>0&&e.querySelectorAll&&e.querySelectorAll(s).forEach((e=>{this.modals.has(e)&&n.add(e)})))}(n.size>0||i.size>0)&&this.#f(i,n)})),this.domObserver.observe(this.options.container,{childList:!0,subtree:!0}),this.#r("info","DOM observer started"))}#f(e,t){const o=new Set;t.forEach((e=>{const t=this.modals.get(e);t?.id&&o.add(t.id),this.#p(e)}));let i=0;e.forEach((e=>{this.#l(e)&&i++})),i>0&&this.#r("info",`Processed ${i} new modal(s)`),this.isBuilderContext&&this.#m(o)}#p(e){const t=this.modals.get(e);t&&(e.removeAttribute(d),e.removeAttribute(a),e.removeAttribute(n),this.modals.delete(e),this.#r("info",`Cleaned up modal: ${t.id||"unnamed"}`))}get debug(){return this.options.debug}set debug(e){this.options.debug=!!e,this.#r("info","Debug mode "+(this.options.debug?"enabled":"disabled"))}getModal(e){return this.modals.get(e)||null}refresh(){this.#r("info","Refreshing all modals"),this.modals.forEach(((e,t)=>{t.removeAttribute(d),t.removeAttribute(a),t.removeAttribute(n)})),this.modals.clear(),this.#d()}destroy(){this.#r("info","Destroying modal manager");try{this.domObserver&&(this.domObserver.disconnect(),this.domObserver=null),this.builderObserver&&(this.builderObserver.disconnect(),this.builderObserver=null),this.modals.forEach(((e,t)=>{this.#p(t)})),this.modals.clear(),this.modalRoot&&!this.modalRoot.hasChildNodes()&&this.modalRoot.remove(),this.modalRoot=null,l.#e=null,window.FSModalManager===this&&delete window.FSModalManager,this.#r("info","Modal manager destroyed")}catch(e){console.error("[FSModalManager] Error during destruction:",e)}}#r(e,t,...o){if(!this.options.debug)return;console["error"===e?"error":"warn"===e?"warn":"debug"===e?"debug":"log"]("[FSModalManager]",t,...o)}}function u(){const e=l.getInstance({debug:!1});"undefined"!=typeof window&&(window.FSModalManager=e)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",u):u()})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.