!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("ig-ui",[],t):"object"==typeof exports?exports["ig-ui"]=t():e["ig-ui"]=t()}(this,(()=>(()=>{"use strict";var e={r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p:"./dist/"},t={};e.r(t);e.p;const n=(e,t)=>new Promise((n=>{setTimeout((()=>n(t)),e)})),o=(e,t)=>{_webview.addEvent(e,t)},r=(e,t,n=!1)=>{if(t instanceof FileList&&!n)return console.info("🔵 Calling webview.postMessageWithAdditionalObjects(): ",e,t),void window.chrome.webview?.postMessageWithAdditionalObjects({name:e,data:null},t);const o=n?JSON.stringify(t):t;console.info("🔵 Calling webview.postMessage(): ",e,o),window.chrome.webview?.postMessage({name:e,data:o})};class l{static load(){for(const e in _page.lang){if(!Object.prototype.hasOwnProperty.call(_page.lang,e))continue;const t=_page.lang[e];queryAll(`[lang-text="${e}"]`,null,!0).forEach((e=>{e.innerText=t})),queryAll(`[lang-title="${e}"]`,null,!0).forEach((e=>{e.title=t})),queryAll(`[lang-html="${e}"]`,null,!0).forEach((e=>{let n=t;for(let t=0;t<e.childElementCount;t++)n=n.replaceAll(`{${t}}`,e.children.item(t).outerHTML);e.innerHTML=n}))}}static loadForEl(e){[e,...queryAll("[lang-text]",e)].forEach((e=>{const t=e.getAttribute("lang-text")||"",n=_page.lang[t]||"";n&&(e.innerText=n)}));[e,...queryAll("[lang-title]",e)].forEach((e=>{const t=e.getAttribute("lang-title")||"",n=_page.lang[t]||"";n&&(e.title=n)}));[e,...queryAll("[lang-html]",e)].forEach((e=>{const t=e.getAttribute("lang-html")||"",n=_page.lang[t]||"";if(n){let t=n;for(let n=0;n<e.childElementCount;n++)t=t.replaceAll(`{${n}}`,e.children.item(n).outerHTML);e.innerHTML=t}}))}static loadFor(e){const t=query(e);l.loadForEl(t)}}window._webview=new class{eventHandlers={};addEvent(e,t){this.eventHandlers[e]=t}removeEvent(e){delete this.eventHandlers[e]}startListening(){window.chrome.webview?.addEventListener("message",(({data:e})=>{const t=e?.Name??"",n=e?.Data??"",o=this.eventHandlers[t],r=void 0!==o;console.info(`🔵 Received event '${t}' (handler=${r}) with data:`,"string"==typeof n?`${n.substring(0,100)}...`:n),r&&o(t,n)}))}},_webview.startListening(),window.query=(e,t=null,n=!1)=>{try{const o=(t??document).querySelector(e);return o||n||console.warn(`🟠 query() returns NULL with selector '${e}'`),o}catch{}return null},window.queryAll=(e,t=null,n=!1)=>{try{const o=t??document,r=Array.from(o.querySelectorAll(e));return 0!==r.length||n||console.info(`🔵 queryAll() returns ZERO elements with selector '${e}'`),r}catch{}return[]},window.on=o,window.post=r,window.postAsync=async(e,t,l=!1)=>{let i=!1,a=null;for(o(e,((t,n)=>{t===e&&(i=!0,a=n,_webview.removeEvent(e))})),r(e,t,l);!i;)await n(100);return a},window._page||(window._page={lang:{},theme:""}),_page.loadLanguage=l.load,n(1e3).then((()=>{document.documentElement.style.setProperty("--transitionMs","300ms")}));const i=e=>{let t=e.key.toLowerCase();const n=e.ctrlKey||"control"===t?"ctrl":"",o=e.shiftKey||"shift"===t?"shift":"",r=e.altKey||"alt"===t?"alt":"",l={control:"",shift:"",alt:"",arrowleft:"left",arrowright:"right",arrowup:"up",arrowdown:"down",backspace:"back"," ":"space"};void 0!==l[t]&&(t=l[t]);return[n,o,r,t].filter(Boolean).join("+")};window.onkeydown=e=>{const t=i(e);"escape"===t&&document.querySelector("dialog[open]")||t&&r("KEYDOWN",t)},window.onkeyup=e=>{const t=i(e);t&&r("KEYUP",t)};const a=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;post(t.id)};return query("#BtnImageGlassStore").addEventListener("click",a,!1),query("#BtnCheckForUpdate").addEventListener("click",a,!1),query("#BtnDonate").addEventListener("click",a,!1),query("#BtnClose").addEventListener("click",a,!1),queryAll("[data-license]").forEach((e=>{e.addEventListener("click",(()=>post("ViewLicenseFile",e.getAttribute("data-license"))),!1)})),query("#BtnCheckForUpdate").focus(),window._page.loadData=(e={})=>{console.info("🔵 Loading data",e),query("#Lbl_CopyrightsYear").innerText=`2010-${(new Date).getUTCFullYear()}`,query("#Img_AppLogo").setAttribute("src",e.AppLogo||""),query("#Img_AppLogo").toggleAttribute("hidden",!1),query("#Img_AppLogo").addEventListener("click",(async()=>{const e=!query("#app").style.filter;query("#app").style.filter=e?'url("#effectWaving")':""})),query("#Lbl_AppCode").innerText=e.AppCode||"",query("#Lbl_AppVersion").innerText=e.AppVersion||"",query("#Lbl_AppArchitecture").innerText=e.AppArchitecture||"",query("#Lbl_AppRuntime").innerText=e.AppRuntime||"",query("#Lbl_MagickNET").innerText=e.MagickNET||"",query("#Lbl_WebView2Runtime").innerText=e.WebView2Runtime||""},t})()));
//# sourceMappingURL=FrmAbout.js.map