{"version":3,"sources":["init.ts"],"sourcesContent":["\n// global event listeners\n\nimport { Datex } from \"datex-core-legacy\";\n\nimport { client_type } from \"datex-core-legacy/utils/constants.ts\";\nimport { addStyleSheetLink } from \"../utils/css-style-compat.ts\";\n\nimport { UIX } from \"../../uix.ts\";\n\nimport { initSession } from \"../session/frontend.ts\";\n\n// custom dom elements\nimport \"../html/light-root.ts\"\n// import { overrideEventTargetPrototype } from \"datex-core-legacy/utils/persistent-listeners.ts\";\nimport { enableErrorReporting } from \"datex-core-legacy/utils/error-reporting.ts\";\nimport { getErrorReportingPreference } from \"../utils/error-reporting-preference.ts\";\nimport { enableUnhandledRejectionHandler } from \"datex-core-legacy/utils/error-handling.ts\";\n\nif (client_type == \"browser\") {\n\tawait initSession();\n}\n\n// catch unhandledrejections\nif (client_type == \"deno\") enableUnhandledRejectionHandler()\n\nenableErrorReporting(await getErrorReportingPreference())\n\nif (UIX.context == \"frontend\") {\n\n\t// TODO: keep this? only required when using document.write\n\t// overrideEventTargetPrototype()\n\n    // keyboard overlay content (on chrome)\n    if ('virtualKeyboard' in navigator) {\n        // @ts-ignore\n        navigator.virtualKeyboard.overlaysContent = true\n    }\n\n    // header meta tag for mobile viewport sizing, allow content over notch\n\tif (!document.querySelector(\"meta[name=viewport]\")) document.head.insertAdjacentHTML('beforeend', '<meta name=\"viewport\" content=\"viewport-fit=cover, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\"/>')\n    // to change app color\n    if (!document.querySelector(\"meta[name=theme-color]\")) document.head.insertAdjacentHTML('beforeend', '<meta name=\"theme-color\"/>')\n\n\n\t// Activate if Safari sucks:\n\t// if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n\t//     globalThis.location.href = \"https://www.google.com/chrome/\"\n\t// }\n\t\n\t// handle invalid images (TODO) ....\n\n\n\t// load document + body style, if not yet added\n\n\tconst body_style_url = new URL(\"../style/body.css\", import.meta.url).toString();\n\tconst document_style_url = new URL(\"../style/document.css\", import.meta.url).toString();\n\n\tif (UIX.context == \"frontend\" && !document.head.querySelector(\"link[href='\"+document_style_url+\"']\")) addStyleSheetLink(document.head, document_style_url);\n\tif (UIX.context == \"frontend\" && document.body.shadowRoot && !document.body.shadowRoot.querySelector(\"link[href='\"+body_style_url+\"']\")) addStyleSheetLink(document.body.shadowRoot, body_style_url);\n}\n\n\n// Debug shortcuts\n\n// Res.addShortcut(\"uix_debug\", \"ctrl+i\")\n// Handlers.handleShortcut(globalThis.window, \"uix_debug\", Debug.toggleDebugMode);\n\n\n// Res.addShortcut(\"uix_theme\", \"ctrl+t\")\n// Handlers.handleShortcut(globalThis.window, \"uix_theme\", ()=>{\n//     if (Theme.mode.val == \"dark\") Theme.setMode(\"light\")\n//     else Theme.setMode(\"dark\")\n// });\n\n// Res.addShortcut(\"uix_lang\", \"ctrl+l\")\n// Handlers.handleShortcut(globalThis.window, \"uix_lang\", ()=>{\n//     if (Datex.Runtime.ENV.LANG == 'en') Datex.Runtime.ENV.LANG = 'de'\n//     else Datex.Runtime.ENV.LANG = 'en'\n// });\n\n// // reset pointer storage\n// Res.addShortcut(\"reset\", \"ctrl+shift+r\")\n// Handlers.handleShortcut(globalThis.window, \"reset\", State.resetPage);\n// // reset pointer storage and endpoint\n// Res.addShortcut(\"reset_clear_endpoint\", \"ctrl+r\")\n// Handlers.handleShortcut(globalThis.window, \"reset_clear_endpoint\", State.resetPageAndClearEndpoint);\n\n// // Unyt Pen\n\n// Res.addShortcut(\"connect_unyt_pen\", {macos:\"cmd+e\", windows:\"ctrl+e\"})\n// // debugging shortcuts\n// Handlers.handleShortcut(globalThis.window, \"connect_unyt_pen\", async ()=>{\n//     await UnytPen.connect();\n// });\n\n// // strings and shortcuts\n// await Res.initShortcuts();\n\nDatex.Unyt.setUIXData(UIX.version);\n"],"names":["Datex","client_type","addStyleSheetLink","UIX","initSession","enableErrorReporting","getErrorReportingPreference","enableUnhandledRejectionHandler","context","navigator","virtualKeyboard","overlaysContent","document","querySelector","head","insertAdjacentHTML","body_style_url","URL","url","toString","document_style_url","body","shadowRoot","Unyt","setUIXData","version"],"mappings":"AAGA,SAASA,KAAK,QAAQ,oBAAoB;AAE1C,SAASC,WAAW,QAAQ,uCAAuC;AACnE,SAASC,iBAAiB,QAAQ,+BAA+B;AAEjE,SAASC,GAAG,QAAQ,eAAe;AAEnC,SAASC,WAAW,QAAQ,yBAAyB;AAGrD,OAAO,wBAAuB;AAE9B,SAASC,oBAAoB,QAAQ,6CAA6C;AAClF,SAASC,2BAA2B,QAAQ,yCAAyC;AACrF,SAASC,+BAA+B,QAAQ,4CAA4C;AAW5F,IATmB,aAAfN,eACH,MAAMG,eAIY,UAAfH,eAAuBM,mCAE3BF,qBAAqB,MAAMC,gCAEvBH,AAAe,cAAfA,IAAIK,OAAO,EAAgB;IAMvB,qBAAqBC,aAErBA,CAAAA,UAAUC,eAAe,CAACC,eAAe,GAAG,CAAA,CAAG,GAIjDC,SAASC,aAAa,CAAC,0BAAwBD,SAASE,IAAI,CAACC,kBAAkB,CAAC,aAAa,qIAE1FH,SAASC,aAAa,CAAC,6BAA2BD,SAASE,IAAI,CAACC,kBAAkB,CAAC,aAAa;IAaxG,IAAMC,iBAAiB,IAAIC,IAAI,qBAAqB,YAAYC,GAAG,EAAEC,QAAQ,IACvEC,qBAAqB,IAAIH,IAAI,yBAAyB,YAAYC,GAAG,EAAEC,QAAQ;IAElE,cAAfhB,IAAIK,OAAO,IAAmBI,SAASE,IAAI,CAACD,aAAa,CAAC,gBAAcO,qBAAmB,SAAOlB,kBAAkBU,SAASE,IAAI,EAAEM,qBACpH,cAAfjB,IAAIK,OAAO,IAAkBI,SAASS,IAAI,CAACC,UAAU,IAAI,CAACV,SAASS,IAAI,CAACC,UAAU,CAACT,aAAa,CAAC,gBAAcG,iBAAe,SAAOd,kBAAkBU,SAASS,IAAI,CAACC,UAAU,EAAEN;AACtL;AAuCAhB,MAAMuB,IAAI,CAACC,UAAU,CAACrB,IAAIsB,OAAO","sourceRoot":"/lib/uix-0.4.39/src/base/","file":"init.ts"}