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EAAMwB,SAAS,qBACzC1B,EAAmBC,EAAMC,GAAO,OAC3B,CACLV,OAAOC,SAASC,KAAOF,OAAOC,SAASkC,OAAS,eAAiB1B,EAAO,UAAYC,EAEpF,MAAM0B,EAwBV,SAA0BC,EAAWC,GACnC,MACMlC,EADQ,IAAIC,OAAOiC,GACHhC,KAAK+B,GAE3B,IAAKjC,EACH,OAAO,KAGT,OAAOA,EAAQ,EACjB,CAjCsBmC,CAAiB7B,EAAO,8BAExCV,OAAOC,SAASC,KADdkC,EACqBpC,OAAOC,SAASkC,OAAS,KAAKC,IAE9BpC,OAAOC,SAASkC,OAAS,eAAiB1B,EAAO,UAAYC,C","sources":["webpack://@bitwarden/web-vault/webpack/bootstrap","webpack://@bitwarden/web-vault/./src/connectors/common.ts","webpack://@bitwarden/web-vault/./src/connectors/sso.ts","webpack://@bitwarden/web-vault/webpack/runtime/make namespace object"],"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","export function getQsParam(name: string) {\n const url = window.location.href;\n // eslint-disable-next-line\n name = name.replace(/[\\[\\]]/g, \"\\\\$&\");\n const regex = new RegExp(\"[?&]\" + name + \"(=([^&#]*)|&|#|$)\");\n const results = regex.exec(url);\n\n if (!results) {\n return null;\n }\n if (!results[2]) {\n return \"\";\n }\n\n return decodeURIComponent(results[2].replace(/\\+/g, \" \"));\n}\n\nexport function b64Decode(str: string, spaceAsPlus = false) {\n if (spaceAsPlus) {\n str = str.replace(/ /g, \"+\");\n }\n\n return decodeURIComponent(\n Array.prototype.map\n .call(atob(str), (c: string) => {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(\"\"),\n );\n}\n","import { getQsParam } from \"./common\";\n\nrequire(\"./sso.scss\");\n\nwindow.addEventListener(\"load\", () => {\n const code = getQsParam(\"code\");\n const state = getQsParam(\"state\");\n const lastpass = getQsParam(\"lp\");\n\n if (lastpass === \"1\") {\n initiateBrowserSso(code, state, true);\n } else if (state != null && state.includes(\":clientId=browser\")) {\n initiateBrowserSso(code, state, false);\n } else {\n window.location.href = window.location.origin + \"/#/sso?code=\" + code + \"&state=\" + state;\n // Match any characters between \"_returnUri='\" and the next \"'\"\n const returnUri = extractFromRegex(state, \"(?<=_returnUri=')(.*)(?=')\");\n if (returnUri) {\n window.location.href = window.location.origin + `/#${returnUri}`;\n } else {\n window.location.href = window.location.origin + \"/#/sso?code=\" + code + \"&state=\" + state;\n }\n }\n});\n\nfunction initiateBrowserSso(code: string, state: string, lastpass: boolean) {\n window.postMessage({ command: \"authResult\", code: code, state: state, lastpass: lastpass }, \"*\");\n const handOffMessage = (\"; \" + document.cookie)\n .split(\"; ssoHandOffMessage=\")\n .pop()\n .split(\";\")\n .shift();\n document.cookie = \"ssoHandOffMessage=;SameSite=strict;max-age=0\";\n const content = document.getElementById(\"content\");\n content.innerHTML = \"\";\n const p = document.createElement(\"p\");\n p.innerText = handOffMessage;\n content.appendChild(p);\n}\n\nfunction extractFromRegex(s: string, regexString: string) {\n const regex = new RegExp(regexString);\n const results = regex.exec(s);\n\n if (!results) {\n return null;\n }\n\n return results[0];\n}\n","// 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};"],"names":["__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","getQsParam","name","url","window","location","href","replace","results","RegExp","exec","decodeURIComponent","initiateBrowserSso","code","state","lastpass","postMessage","command","handOffMessage","document","cookie","split","pop","shift","content","getElementById","innerHTML","p","createElement","innerText","appendChild","r","Symbol","toStringTag","Object","defineProperty","value","addEventListener","includes","origin","returnUri","s","regexString","extractFromRegex"],"sourceRoot":""}