{"version":3,"sources":["webpack:///./node_modules/@ionic/core/dist/esm-es5/shadow-css-4889ae62-23996f3f.js"],"names":["safeSelector","selector","placeholders","index","content","replace","_","keep","replaceBy","push","pseudo","exp","restoreSafeSelector","_polyfillHost","_polyfillSlotted","_polyfillHostContext","_parenSuffix","_cssColonHostRe","RegExp","_cssColonHostContextRe","_cssColonSlottedRe","_polyfillHostNoCombinator","_polyfillHostNoCombinatorRe","_shadowDOMSelectorsRe","_selectorReSuffix","_polyfillHostRe","_colonHostRe","_colonSlottedRe","_colonHostContextRe","_commentRe","_commentWithHashRe","_ruleRe","_curlyRe","OPEN_CURLY","CLOSE_CURLY","BLOCK_PLACEHOLDER","processRules","input","ruleCallback","inputWithEscapedBlocks","escapeBlocks","nextBlockIndex","escapedString","m","_i","arguments","length","suffix","contentPrefix","startsWith","blocks","substring","rule","inputParts","split","resultParts","escapedBlocks","bracketCount","currentBlockParts","partIndex","part","join","insertPolyfillHostInCssText","convertColonRule","cssText","regExp","partReplacer","parts","r","i","p","trim","colonHostPartReplacer","host","convertColonHost","colonHostContextPartReplacer","indexOf","convertColonSlotted","slotAttr","compound","convertColonHostContext","convertShadowDOMSelectors","reduce","result","pattern","makeScopeMatcher","scopeSelector","selectorNeedsScoping","test","applySimpleSelectorScope","hostSelector","replaceBy_1","lastIndex","before","colon","after","applyStrictSelectorScope","className","_scopeSelectorPart","scopedP","t","matches","match","safeContent","scopedSelector","startIndex","sep","shouldScope","res","exec","separator","part_1","slice","scopeSelectorText","slotSelector","map","shallowPart","scopeSelectors","commentOriginalSelector","scopeCss","scopeId","processCommentedSelector_1","hostScopeId","slotScopeId","commentsWithHash","orgSelectors","scopedCssText","placeholder","comment","forEach","_a"],"mappings":"+FAAA,8DAYIA,EAAe,SAAUC,GACzB,IAAIC,EAAe,GACfC,EAAQ,EAsBZ,MAJS,CACLC,SAfJH,EAAWA,EAASI,QAAQ,gBAAiB,SAAUC,EAAGC,GACtD,IAAIC,EAAY,QAAUL,EAAQ,KAGl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A,GAFIA,EADAwD,EACUH,EAAerD,EAASwD,EAASE,EAAaC,CAAW,EAE7D3D,GAAQ3D,QAAQ,gCAAiC,IAAMqH,CAAW,GAC1DrH,QAAQ,uBAAwB,MAAM,GACzCkE,KAAK,GAoCpB,OAPAP,EAAU,YAAe,CAAC8D,GAAgBF,CAAgB,EAAE/D,KAAK,IAAI,EACjEyD,GACAO,EAAaI,QAAQ,SAAUC,GAC3B,IAAIH,EAAcG,EAAGH,YACrB/D,EAAUA,EAAQ3D,QAAQ0H,EADkBG,EAAGF,OACD,CAClD,CAAC,EAEEhE,CACX,C","file":"js/chunk-2d0aef65.df978d37.js","sourcesContent":["import { __spreadArrays } from \"tslib\";\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n *\n * This file is a port of shadowCSS from webcomponents.js to TypeScript.\n * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js\n * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts\n */\nvar safeSelector = function (selector) {\n var placeholders = [];\n var index = 0;\n var content;\n // Replaces attribute selectors with placeholders.\n // The WS in [attr=\"va lue\"] would otherwise be interpreted as a selector separator.\n selector = selector.replace(/(\\[[^\\]]*\\])/g, function (_, keep) {\n var replaceBy = \"__ph-\" + index + \"__\";\n placeholders.push(keep);\n index++;\n return replaceBy;\n });\n // Replaces the expression in `:nth-child(2n + 1)` with a placeholder.\n // WS and \"+\" would otherwise be interpreted as selector separators.\n content = selector.replace(/(:nth-[-\\w]+)(\\([^)]+\\))/g, function (_, pseudo, exp) {\n var replaceBy = \"__ph-\" + index + \"__\";\n placeholders.push(exp);\n index++;\n return pseudo + replaceBy;\n });\n var ss = {\n content: content,\n placeholders: placeholders,\n };\n return ss;\n};\nvar restoreSafeSelector = function (placeholders, content) {\n return content.replace(/__ph-(\\d+)__/g, function (_, index) { return placeholders[+index]; });\n};\nvar _polyfillHost = '-shadowcsshost';\nvar _polyfillSlotted = '-shadowcssslotted';\n// note: :host-context pre-processed to -shadowcsshostcontext.\nvar _polyfillHostContext = '-shadowcsscontext';\nvar _parenSuffix = ')(?:\\\\((' +\n '(?:\\\\([^)(]*\\\\)|[^)(]*)+?' +\n ')\\\\))?([^,{]*)';\nvar _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim');\nvar _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim');\nvar _cssColonSlottedRe = new RegExp('(' + _polyfillSlotted + _parenSuffix, 'gim');\nvar _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';\nvar _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\\s]*)/;\nvar _shadowDOMSelectorsRe = [\n /::shadow/g,\n /::content/g\n];\nvar _selectorReSuffix = '([>\\\\s~+\\[.,{:][\\\\s\\\\S]*)?$';\nvar _polyfillHostRe = /-shadowcsshost/gim;\nvar _colonHostRe = /:host/gim;\nvar _colonSlottedRe = /::slotted/gim;\nvar _colonHostContextRe = /:host-context/gim;\nvar _commentRe = /\\/\\*\\s*[\\s\\S]*?\\*\\//g;\nvar stripComments = function (input) {\n return input.replace(_commentRe, '');\n};\nvar _commentWithHashRe = /\\/\\*\\s*#\\s*source(Mapping)?URL=[\\s\\S]+?\\*\\//g;\nvar extractCommentsWithHash = function (input) {\n return input.match(_commentWithHashRe) || [];\n};\nvar _ruleRe = /(\\s*)([^;\\{\\}]+?)(\\s*)((?:{%BLOCK%}?\\s*;?)|(?:\\s*;))/g;\nvar _curlyRe = /([{}])/g;\nvar OPEN_CURLY = '{';\nvar CLOSE_CURLY = '}';\nvar BLOCK_PLACEHOLDER = '%BLOCK%';\nvar processRules = function (input, ruleCallback) {\n var inputWithEscapedBlocks = escapeBlocks(input);\n var nextBlockIndex = 0;\n return inputWithEscapedBlocks.escapedString.replace(_ruleRe, function () {\n var m = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n m[_i] = arguments[_i];\n }\n var selector = m[2];\n var content = '';\n var suffix = m[4];\n var contentPrefix = '';\n if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {\n content = inputWithEscapedBlocks.blocks[nextBlockIndex++];\n suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);\n contentPrefix = '{';\n }\n var cssRule = {\n selector: selector,\n content: content\n };\n var rule = ruleCallback(cssRule);\n return \"\" + m[1] + rule.selector + m[3] + contentPrefix + rule.content + suffix;\n });\n};\nvar escapeBlocks = function (input) {\n var inputParts = input.split(_curlyRe);\n var resultParts = [];\n var escapedBlocks = [];\n var bracketCount = 0;\n var currentBlockParts = [];\n for (var partIndex = 0; partIndex < inputParts.length; partIndex++) {\n var part = inputParts[partIndex];\n if (part === CLOSE_CURLY) {\n bracketCount--;\n }\n if (bracketCount > 0) {\n currentBlockParts.push(part);\n }\n else {\n if (currentBlockParts.length > 0) {\n escapedBlocks.push(currentBlockParts.join(''));\n resultParts.push(BLOCK_PLACEHOLDER);\n currentBlockParts = [];\n }\n resultParts.push(part);\n }\n if (part === OPEN_CURLY) {\n bracketCount++;\n }\n }\n if (currentBlockParts.length > 0) {\n escapedBlocks.push(currentBlockParts.join(''));\n resultParts.push(BLOCK_PLACEHOLDER);\n }\n var strEscapedBlocks = {\n escapedString: resultParts.join(''),\n blocks: escapedBlocks\n };\n return strEscapedBlocks;\n};\nvar insertPolyfillHostInCssText = function (selector) {\n selector = selector\n .replace(_colonHostContextRe, _polyfillHostContext)\n .replace(_colonHostRe, _polyfillHost)\n .replace(_colonSlottedRe, _polyfillSlotted);\n return selector;\n};\nvar convertColonRule = function (cssText, regExp, partReplacer) {\n // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule\n return cssText.replace(regExp, function () {\n var m = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n m[_i] = arguments[_i];\n }\n if (m[2]) {\n var parts = m[2].split(',');\n var r = [];\n for (var i = 0; i < parts.length; i++) {\n var p = parts[i].trim();\n if (!p)\n break;\n r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));\n }\n return r.join(',');\n }\n else {\n return _polyfillHostNoCombinator + m[3];\n }\n });\n};\nvar colonHostPartReplacer = function (host, part, suffix) {\n return host + part.replace(_polyfillHost, '') + suffix;\n};\nvar convertColonHost = function (cssText) {\n return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer);\n};\nvar colonHostContextPartReplacer = function (host, part, suffix) {\n if (part.indexOf(_polyfillHost) > -1) {\n return colonHostPartReplacer(host, part, suffix);\n }\n else {\n return host + part + suffix + ', ' + part + ' ' + host + suffix;\n }\n};\nvar convertColonSlotted = function (cssText, slotAttr) {\n var regExp = _cssColonSlottedRe;\n return cssText.replace(regExp, function () {\n var m = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n m[_i] = arguments[_i];\n }\n if (m[2]) {\n var compound = m[2].trim();\n var suffix = m[3];\n var sel = '.' + slotAttr + ' > ' + compound + suffix;\n return sel;\n }\n else {\n return _polyfillHostNoCombinator + m[3];\n }\n });\n};\nvar convertColonHostContext = function (cssText) {\n return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer);\n};\nvar convertShadowDOMSelectors = function (cssText) {\n return _shadowDOMSelectorsRe.reduce(function (result, pattern) { return result.replace(pattern, ' '); }, cssText);\n};\nvar makeScopeMatcher = function (scopeSelector) {\n var lre = /\\[/g;\n var rre = /\\]/g;\n scopeSelector = scopeSelector.replace(lre, '\\\\[').replace(rre, '\\\\]');\n return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');\n};\nvar selectorNeedsScoping = function (selector, scopeSelector) {\n var re = makeScopeMatcher(scopeSelector);\n return !re.test(selector);\n};\nvar applySimpleSelectorScope = function (selector, scopeSelector, hostSelector) {\n // In Android browser, the lastIndex is not reset when the regex is used in String.replace()\n _polyfillHostRe.lastIndex = 0;\n if (_polyfillHostRe.test(selector)) {\n var replaceBy_1 = \".\" + hostSelector;\n return selector\n .replace(_polyfillHostNoCombinatorRe, function (_, selector) {\n return selector.replace(/([^:]*)(:*)(.*)/, function (_, before, colon, after) {\n return before + replaceBy_1 + colon + after;\n });\n })\n .replace(_polyfillHostRe, replaceBy_1 + ' ');\n }\n return scopeSelector + ' ' + selector;\n};\nvar applyStrictSelectorScope = function (selector, scopeSelector, hostSelector) {\n var isRe = /\\[is=([^\\]]*)\\]/g;\n scopeSelector = scopeSelector.replace(isRe, function (_) {\n var parts = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n parts[_i - 1] = arguments[_i];\n }\n return parts[0];\n });\n var className = '.' + scopeSelector;\n var _scopeSelectorPart = function (p) {\n var scopedP = p.trim();\n if (!scopedP) {\n return '';\n }\n if (p.indexOf(_polyfillHostNoCombinator) > -1) {\n scopedP = applySimpleSelectorScope(p, scopeSelector, hostSelector);\n }\n else {\n // remove :host since it should be unnecessary\n var t = p.replace(_polyfillHostRe, '');\n if (t.length > 0) {\n var matches = t.match(/([^:]*)(:*)(.*)/);\n if (matches) {\n scopedP = matches[1] + className + matches[2] + matches[3];\n }\n }\n }\n return scopedP;\n };\n var safeContent = safeSelector(selector);\n selector = safeContent.content;\n var scopedSelector = '';\n var startIndex = 0;\n var res;\n var sep = /( |>|\\+|~(?!=))\\s*/g;\n // If a selector appears before :host it should not be shimmed as it\n // matches on ancestor elements and not on elements in the host's shadow\n // `:host-context(div)` is transformed to\n // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`\n // the `div` is not part of the component in the 2nd selectors and should not be scoped.\n // Historically `component-tag:host` was matching the component so we also want to preserve\n // this behavior to avoid breaking legacy apps (it should not match).\n // The behavior should be:\n // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)\n // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a\n // `:host-context(tag)`)\n var hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;\n // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present\n var shouldScope = !hasHost;\n while ((res = sep.exec(selector)) !== null) {\n var separator = res[1];\n var part_1 = selector.slice(startIndex, res.index).trim();\n shouldScope = shouldScope || part_1.indexOf(_polyfillHostNoCombinator) > -1;\n var scopedPart = shouldScope ? _scopeSelectorPart(part_1) : part_1;\n scopedSelector += scopedPart + \" \" + separator + \" \";\n startIndex = sep.lastIndex;\n }\n var part = selector.substring(startIndex);\n shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;\n scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;\n // replace the placeholders with their original values\n return restoreSafeSelector(safeContent.placeholders, scopedSelector);\n};\nvar scopeSelector = function (selector, scopeSelectorText, hostSelector, slotSelector) {\n return selector.split(',')\n .map(function (shallowPart) {\n if (slotSelector && shallowPart.indexOf('.' + slotSelector) > -1) {\n return shallowPart.trim();\n }\n if (selectorNeedsScoping(shallowPart, scopeSelectorText)) {\n return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim();\n }\n else {\n return shallowPart.trim();\n }\n })\n .join(', ');\n};\nvar scopeSelectors = function (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) {\n return processRules(cssText, function (rule) {\n var selector = rule.selector;\n var content = rule.content;\n if (rule.selector[0] !== '@') {\n selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);\n }\n else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||\n rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) {\n content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector);\n }\n var cssRule = {\n selector: selector.replace(/\\s{2,}/g, ' ').trim(),\n content: content\n };\n return cssRule;\n });\n};\nvar scopeCssText = function (cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector) {\n cssText = insertPolyfillHostInCssText(cssText);\n cssText = convertColonHost(cssText);\n cssText = convertColonHostContext(cssText);\n cssText = convertColonSlotted(cssText, slotScopeId);\n cssText = convertShadowDOMSelectors(cssText);\n if (scopeId) {\n cssText = scopeSelectors(cssText, scopeId, hostScopeId, slotScopeId);\n }\n cssText = cssText.replace(/-shadowcsshost-no-combinator/g, \".\" + hostScopeId);\n cssText = cssText.replace(/>\\s*\\*\\s+([^{, ]+)/gm, ' $1 ');\n return cssText.trim();\n};\nvar scopeCss = function (cssText, scopeId, commentOriginalSelector) {\n var hostScopeId = scopeId + '-h';\n var slotScopeId = scopeId + '-s';\n var commentsWithHash = extractCommentsWithHash(cssText);\n cssText = stripComments(cssText);\n var orgSelectors = [];\n if (commentOriginalSelector) {\n var processCommentedSelector_1 = function (rule) {\n var placeholder = \"/*!@___\" + orgSelectors.length + \"___*/\";\n var comment = \"/*!@\" + rule.selector + \"*/\";\n orgSelectors.push({ placeholder: placeholder, comment: comment });\n rule.selector = placeholder + rule.selector;\n return rule;\n };\n cssText = processRules(cssText, function (rule) {\n if (rule.selector[0] !== '@') {\n return processCommentedSelector_1(rule);\n }\n else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||\n rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) {\n rule.content = processRules(rule.content, processCommentedSelector_1);\n return rule;\n }\n return rule;\n });\n }\n var scopedCssText = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId);\n cssText = __spreadArrays([scopedCssText], commentsWithHash).join('\\n');\n if (commentOriginalSelector) {\n orgSelectors.forEach(function (_a) {\n var placeholder = _a.placeholder, comment = _a.comment;\n cssText = cssText.replace(placeholder, comment);\n });\n }\n return cssText;\n};\nexport { scopeCss };\n"],"sourceRoot":""}