!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)},l=(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 r{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);r.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],l=void 0!==o;console.info(`🔵 Received event '${t}' (handler=${l}) with data:`,"string"==typeof n?`${n.substring(0,100)}...`:n),l&&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,l=Array.from(o.querySelectorAll(e));return 0!==l.length||n||console.info(`🔵 queryAll() returns ZERO elements with selector '${e}'`),l}catch{}return[]},window.on=o,window.post=l,window.postAsync=async(e,t,r=!1)=>{let i=!1,a=null;for(o(e,((t,n)=>{t===e&&(i=!0,a=n,_webview.removeEvent(e))})),l(e,t,r);!i;)await n(100);return a},window._page||(window._page={lang:{},theme:""}),_page.loadLanguage=r.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":"",l=e.altKey||"alt"===t?"alt":"",r={control:"",shift:"",alt:"",arrowleft:"left",arrowright:"right",arrowup:"up",arrowdown:"down",backspace:"back"," ":"space"};void 0!==r[t]&&(t=r[t]);return[n,o,l,t].filter(Boolean).join("+")};window.onkeydown=e=>{const t=i(e);"escape"===t&&document.querySelector("dialog[open]")||t&&l("KEYDOWN",t)},window.onkeyup=e=>{const t=i(e);t&&l("KEYUP",t)};const a=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;post(t.id)};return query("#BtnImageGlassStore").addEventListener("click",a,!1),query("#BtnUpdate").addEventListener("click",a,!1),query("#BtnClose").addEventListener("click",a,!1),query("#BtnUpdate").focus(),window._page.loadData=(e={})=>{console.info("🔵 Loading data",e),query("#Lbl_CurrentVersion").innerText=e.CurrentVersion||"",query("#LbL_LatestVersion").innerText=e.LatestVersion||"",query("#Lbl_PublishedDate").innerText=e.PublishedDate||"",query("#Lnk_ReleaseLink").innerText=e.ReleaseTitle||"",query("#Lnk_ReleaseLink").setAttribute("href",e.ReleaseLink||""),query("#Section_ReleaseDetails").innerHTML=e.ReleaseDetails||""},t})()));
//# sourceMappingURL=FrmUpdate.js.map