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8BACA,iDACA,oCACA,8BACA,iCACA,6DACA,kCACA,wBACA,0BACA,gBACA,gCACA,2BACA,2BACA,aACA,2BACA,4BACA,mBACA,gBACA,oCACA,0BACA,iCACA,yEACA,mCACA,oBACA,4BACA,uDACA,cACA,YACA,cACA,wFAEEC,YAAc,CAChB,SACA,yBACA,sCACA,uCACA,oBACA,qBACA,qBACA,gCAEEC,YAAc,CAChB,uBACA,cAEEC,YAAc,CAChB,wDACA,sDACA,gDAEEC,aAAe,CACjB,qBACA,6BACA,6DACA,wCACA,qCACA,mBAEEC,aAAe,CACjB,YACA,cACA,gBACA,yBACA,0BAwBJ,OAtBIX,mBAAmBM,cACnBhB,oBAAoBe,KAAK,OAEzBL,mBAAmBO,cACnBjB,oBAAoBe,KAAK,OAEzBL,mBAAmBQ,cACnBlB,oBAAoBe,KAAK,OAEzBL,mBAAmBS,cACnBnB,oBAAoBe,KAAK,OAEzBL,mBAAmBU,eACnBpB,oBAAoBe,KAAK,QAEzBL,mBAAmBW,eACnBrB,oBAAoBe,KAAK,QAET,mBAATO,OACPtB,oBAAoBe,KAAK,SAGtB,CACH/C,SAAUgC,oBACV/B,YAAagC,uBAErB,E","sources":["webpack://UnsupportedBrowserCheck/webpack/bootstrap","webpack://UnsupportedBrowserCheck/webpack/runtime/define property getters","webpack://UnsupportedBrowserCheck/webpack/runtime/hasOwnProperty shorthand","webpack://UnsupportedBrowserCheck/webpack/runtime/make namespace object","webpack://UnsupportedBrowserCheck/./src/index.ts"],"sourcesContent":["// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import unsupportedHtml from \"./unsupported.html\";\r\nimport unsupportedCss from \"./unsupported.css\";\r\n\r\n/**\r\n * Unsupported features info\r\n */\r\ntype UnsupportedInfo = {\r\n /** Unsuported features */\r\n features: string[],\r\n\r\n /** Unsuported expressions */\r\n expressions: string[]\r\n}\r\n\r\n/**\r\n * Run unsupported browser detection logic. Use contentId to locate textarea with protected scripts. When browser is supported\r\n * those scripts are inserted as html elements and executed.\r\n *\r\n * @param {string} contentId Used to locate textarea with protected scripts and insert target script tags\r\n * @param {string} logoUrl Url to logo used in unsupported page layout\r\n */\r\nexport const run = (contentId: string, logoUrl: string) => {\r\n var unsupportedInfo: UnsupportedInfo;\r\n\r\n // support testing using ubc-force-error and ubc-force-ok url tags\r\n if (window.location.href.indexOf(\"ubc-force-error\") >= 0) {\r\n unsupportedInfo = {\r\n features: [ \"TEST\" ],\r\n expressions: []\r\n }\r\n } else if (window.location.href.indexOf(\"ubc-force-ok\") >= 0) {\r\n unsupportedInfo = {\r\n features: [],\r\n expressions: []\r\n }\r\n } else {\r\n unsupportedInfo = getUnsupportedFeatures();\r\n }\r\n\r\n if (unsupportedInfo.features.length > 0) {\r\n handleBrowserUnsupported(unsupportedInfo, logoUrl);\r\n } else {\r\n handleBrowserSupported(contentId);\r\n }\r\n}\r\n\r\n/**\r\n * Handles supported browser case\r\n * - scripts from textarea are included as script tags to dom and loaded\r\n *\r\n * @param {string} contentId Enclosing div id\r\n */\r\nconst handleBrowserSupported = (contentId: string) => {\r\n // get wrapper div element to operate on.\r\n const wrapperEl = document.getElementById(contentId);\r\n if (!wrapperEl) {\r\n throw new Error(\"No enclosing div with id \"+ contentId);\r\n }\r\n\r\n // get html content from textarea\r\n const textAreas = wrapperEl.getElementsByTagName(\"textarea\");\r\n if (textAreas.length === 0) {\r\n throw new Error(\"No textarea inside #\"+ contentId);\r\n }\r\n const conentToInclude = textAreas[0].childNodes.length === 0 ? \"\" : textAreas[0].childNodes[0].nodeValue;\r\n\r\n // get all scripts from textarea content\r\n const tempEl = document.createElement(\"div\");\r\n tempEl.innerHTML = conentToInclude ?? \"\";\r\n\r\n // scripts inserted via innerHtml would not execute - https://www.w3.org/TR/2008/WD-html5-20080610/dom.html#innerhtml0\r\n tempEl.querySelectorAll(\"script\").forEach(scriptEl => {\r\n // clone element and copy all attributes\r\n var cloned = document.createElement(\"script\");\r\n\r\n Array.from(scriptEl.attributes).forEach(attr => cloned.setAttribute(attr.name, attr.value));\r\n wrapperEl.insertAdjacentElement(\"beforeend\", cloned)\r\n });\r\n}\r\n\r\n/**\r\n * Handle unsupported browser detected case\r\n * - report unsupported features to AI and console\r\n * - show unsupported browser screen\r\n *\r\n * @param {UnsupportedInfo} unsupported Unsupported features info\r\n * @param {string} logoUrl Logo url to replace in unsupported screen template\r\n */\r\nconst handleBrowserUnsupported = (unsupported: UnsupportedInfo, logoUrl: string) => {\r\n // report unsuported features to console and maybe loaded AI\r\n if (typeof appInsights !== \"undefined\") {\r\n appInsights.trackEvent({\r\n name: \"BrowserBlocked\"\r\n }, {\r\n unsupportedFeatures: unsupported.features,\r\n unsupportedExpressions: unsupported.expressions\r\n }); // Send App insights event about browser being blocked\r\n appInsights.flush();\r\n }\r\n\r\n // write unsupported info\r\n if (unsupported.features.length > 0) {\r\n console.error(\"Unsupported features detected:\", unsupported.features);\r\n }\r\n if (unsupported.expressions.length > 0) {\r\n console.error(\"Unsupported expressions detected:\", unsupported.expressions);\r\n }\r\n\r\n // replace logo path\r\n var replacedCss = unsupportedCss.replace('__LOGO_URL__', logoUrl);\r\n\r\n // show unsupported screen\r\n document.body.innerHTML = unsupportedHtml;\r\n\r\n var styleEl = document.createElement('style');\r\n styleEl.innerHTML = replacedCss;\r\n document.body.appendChild(styleEl);\r\n}\r\n\r\n/**\r\n * Check unsupported features and return unsupported runtime list\r\n *\r\n * @returns Unsupported features info\r\n */\r\nconst getUnsupportedFeatures = (): UnsupportedInfo => {\r\n var unsupportedFeatures: string[] = []; // Browser is supported if it has Proxy class and can evaluate ES6 JavaScript\r\n var unsupportedExpressions: string[] = [];\r\n\r\n const checkIfUnsupported = (expressions: string[]) => {\r\n let isUnsupported = false;\r\n for (var i = 0; i < expressions.length; i++) {\r\n try {\r\n eval(expressions[i]);\r\n } catch (e) {\r\n unsupportedExpressions.push(expressions[i]);\r\n isUnsupported = true;\r\n }\r\n }\r\n return isUnsupported;\r\n }\r\n\r\n const es6Features = [ // Source: http://es6-features.org/#Constants\r\n \"() => true\",\r\n \"() => { return true; }\",\r\n \"(x = 7) => x\",\r\n \"(...args) => args\",\r\n \"[1, 2, ...[3, 4]]\",\r\n \"`${1} + ${2}`\",\r\n \"0b111110111\",\r\n \"'𠮷'.codePointAt(0)\",\r\n \"/\\s*/y\",\r\n \"var x = 1; var y = 2; const obj = {x, y}\",\r\n \"({ ['1' + '1']: 2 })\",\r\n \"({ foo(a, b) { return a + b; } })\",\r\n \"var [red, blue = 'blue', yellow] = ['red', 'blue', 'yellow']\",\r\n \"var { red = 1, blue: { green: green2 }, yellow } = { red: 1, blue: { green: 2 }, yellow: 3 }\",\r\n \"([red, blue]) => red + blue\",\r\n \"({ set lang(length) { this._lang = length } })\",\r\n \"({ get lang() { return 'cz'; } })\",\r\n \"for (let n of [1, 2, 3]) {}\",\r\n \"function* range() { yield 1; }\",\r\n \"async function* load() { yield await Promise.resolve(1); }\",\r\n \"var set = new Set(); set.add(1)\",\r\n \"var set = new WeakSet\",\r\n \"var set = new WeakMap()\",\r\n \"' '.repeat(4)\",\r\n \"'hello'.startsWith('ello', 1)\",\r\n \"'hello'.endsWith('ello')\",\r\n \"'hello'.includes('ello')\",\r\n \"isNaN(NaN)\",\r\n \"Number.isSafeInteger(42)\",\r\n \"Number.EPSILON.toString()\",\r\n \"Math.trunc(42.7)\",\r\n \"Math.sign(-1)\",\r\n \"new Promise(resolve => resolve())\",\r\n \"new Intl.Collator('de')\",\r\n \"new Intl.NumberFormat('en-US')\",\r\n \"new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' })\",\r\n \"new Intl.DateTimeFormat('en-US')\",\r\n \"new Uint32Array()\",\r\n \"Object.assign({}, {}, {})\",\r\n \"[1].find(i => i === 1); [1].findIndex(i => i === 1);\",\r\n \"const i = 1\",\r\n \"let i = 1\",\r\n \"Symbol('3')\",\r\n \"class Demo { static property2 = 1; *bar() { yield 1; } } class Demo2 extends Demo {}\"\r\n ];\r\n const es7Features = [ // Source: https://gist.github.com/rajaramtt/7df3702a04c644b0b62c9a64f48f3dbf#2-ecmascript-2016---es-7\r\n \"2 ** 8\",\r\n \"async () => await true\",\r\n \"async function* nums() { yield 1; }\",\r\n \"Object.getOwnPropertyDescriptors({})\",\r\n \"Object.values({})\",\r\n \"Object.entries({})\",\r\n \"[7, 8].includes(2)\",\r\n \"class Demo { property = 0; }\"\r\n ];\r\n const es8Features = [ // Source: https://gist.github.com/rajaramtt/7df3702a04c644b0b62c9a64f48f3dbf#2-ecmascript-2016---es-7\r\n \"'1699'.padStart(7,0)\",\r\n \"[1, 2, 3,]\"\r\n ];\r\n const es9Features = [ // Source: https://gist.github.com/rajaramtt/7df3702a04c644b0b62c9a64f48f3dbf#2-ecmascript-2016---es-7\r\n \"new Promise((resolve) => resolve()).finally(() => {})\",\r\n \"(async () => { for await (let value of [1]) {} })()\",\r\n \"const { a, ...other } = { a: 5, b: 7, c: 8 }\"\r\n ];\r\n const es10Features = [ // Source: https://gist.github.com/rajaramtt/7df3702a04c644b0b62c9a64f48f3dbf#2-ecmascript-2016---es-7\r\n \"[[1], [2]].flat(2)\",\r\n \"[[1], [2]].flatMap(i => i)\",\r\n \"Object.fromEntries([['one', 1], ['two', 2], ['three', 3]])\",\r\n \"' string '.trimStart().trimEnd()\",\r\n \"Symbol('3').description.toString()\",\r\n \"try {} catch {}\"\r\n ];\r\n const es11Features = [ // Source: https://gist.github.com/rajaramtt/7df3702a04c644b0b62c9a64f48f3dbf#2-ecmascript-2016---es-7\r\n \"BigInt(5)\",\r\n \"({a: 5}?.b)\",\r\n \"true ?? false\",\r\n \"Promise.allSettled([])\",\r\n \"'str'.matchAll(/str/g)\"\r\n ];\r\n if (checkIfUnsupported(es6Features)) {\r\n unsupportedFeatures.push(\"ES6\");\r\n }\r\n if (checkIfUnsupported(es7Features)) {\r\n unsupportedFeatures.push(\"ES7\");\r\n }\r\n if (checkIfUnsupported(es8Features)) {\r\n unsupportedFeatures.push(\"ES8\");\r\n }\r\n if (checkIfUnsupported(es9Features)) {\r\n unsupportedFeatures.push(\"ES9\");\r\n }\r\n if (checkIfUnsupported(es10Features)) {\r\n unsupportedFeatures.push(\"ES10\");\r\n }\r\n if (checkIfUnsupported(es11Features)) {\r\n unsupportedFeatures.push(\"ES11\");\r\n }\r\n if (typeof Proxy != \"function\") { // Proxy class prototype either does not exist or is not a function.\r\n unsupportedFeatures.push(\"Proxy\");\r\n }\r\n\r\n return {\r\n features: unsupportedFeatures,\r\n expressions: unsupportedExpressions\r\n };\r\n}"],"names":["__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","run","contentId","logoUrl","unsupportedInfo","window","location","href","indexOf","features","expressions","getUnsupportedFeatures","length","handleBrowserUnsupported","handleBrowserSupported","wrapperEl","document","getElementById","Error","textAreas","getElementsByTagName","conentToInclude","childNodes","nodeValue","tempEl","createElement","innerHTML","querySelectorAll","forEach","scriptEl","cloned","Array","from","attributes","attr","setAttribute","name","insertAdjacentElement","unsupported","appInsights","trackEvent","unsupportedFeatures","unsupportedExpressions","flush","console","error","replacedCss","replace","body","styleEl","appendChild","checkIfUnsupported","isUnsupported","i","eval","e","push","es6Features","es7Features","es8Features","es9Features","es10Features","es11Features","Proxy"],"sourceRoot":""}