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AAM,CAAG,iBAAe,CAAG,GAAC,CAAC,CAAC;IACjD;AAAA,AAEA,OAAI,SAAQ,AAAC,CAAC,kBAAiB,CAAC,CAAG;AACjC,AAAI,QAAA,CAAA,aAAY,EAAI,CAAA,gBAAe,AAAC,CAAC,cAAa,AAAC,CAAC,kBAAiB,CAAC,CAAC,CAAC;AACxE,QAAE,aAAa,AAAC,CAAC,OAAM,CAAG,cAAY,CAAG,GAAC,CAAC,CAAC;IAC9C;AAAA,EACF;AAAA,AACF;AAAA,AAlEA,KAAK,eAAe,AAAC,+CACb,EAAC,GAAE,CAAG,UAAS,AAAD,CAAG;AAAC,YA0BE,YAAW,IAAqB,gBAAe,OA1B1B;EAAC,CAAC,CAAC,CAAC;AADrD,KAAK,eAAe,AAAC,6EACb,EAAC,GAAE,CAAG,UAAS,AAAD,CAAG;AAAC,YAD1B,MAAK,KAAgB,WAArB,MAAK,KAAgB,cAC4B;EAAC,CAAC,CAAC,CAAC;AADrD,KAAK,eAAe,AAAC,wEACb,EAAC,GAAE,CAAG,UAAS,AAAD,CAAG;AAAC,YAD1B,MAAK,KAAgB,WAArB,MAAK,KAAgB,cAC4B;EAAC,CAAC,CAAC,CAAC;AAkErD","file":"angular2/src/render/dom/shadow_dom/emulated_scoped_shadow_dom_strategy.es6","sourcesContent":["import {isBlank, isPresent} from 'angular2/src/facade/lang';\nimport {PromiseWrapper, Promise} from 'angular2/src/facade/async';\n\nimport {DOM} from 'angular2/src/dom/dom_adapter';\n\nimport {StyleInliner} from 'angular2/src/render/dom/shadow_dom/style_inliner';\nimport {StyleUrlResolver} from 'angular2/src/render/dom/shadow_dom/style_url_resolver';\nimport {EmulatedUnscopedShadowDomStrategy} from './emulated_unscoped_shadow_dom_strategy';\nimport {\n  getContentAttribute, getHostAttribute, getComponentId, shimCssForComponent, insertStyleElement\n} from './util';\n\n/**\n * This strategy emulates the Shadow DOM for the templates, styles **included**:\n * - components templates are added as children of their component element,\n * - both the template and the styles are modified so that styles are scoped to the component\n *   they belong to,\n * - styles are moved from the templates to the styleHost (i.e. the document head).\n *\n * Notes:\n * - styles are scoped to their component and will apply only to it,\n * - a common subset of shadow DOM selectors are supported,\n * - see `ShadowCss` for more information and limitations.\n */\nexport class EmulatedScopedShadowDomStrategy extends EmulatedUnscopedShadowDomStrategy {\n  styleInliner: StyleInliner;\n\n  constructor(styleInliner: StyleInliner, styleUrlResolver: StyleUrlResolver, styleHost) {\n    super(styleUrlResolver, styleHost);\n    this.styleInliner = styleInliner;\n  }\n\n  processStyleElement(hostComponentId:string, templateUrl:string, styleEl):Promise {\n    var cssText = DOM.getText(styleEl);\n\n    cssText = this.styleUrlResolver.resolveUrls(cssText, templateUrl);\n    var css = this.styleInliner.inlineImports(cssText, templateUrl);\n\n    if (PromiseWrapper.isPromise(css)) {\n      DOM.setText(styleEl, '');\n      return css.then((css) => {\n        css = shimCssForComponent(css, hostComponentId);\n        DOM.setText(styleEl, css);\n      });\n    } else {\n      css = shimCssForComponent(css, hostComponentId);\n      DOM.setText(styleEl, css);\n    }\n\n    DOM.remove(styleEl);\n    insertStyleElement(this.styleHost, styleEl);\n    return null;\n  }\n\n  processElement(hostComponentId:string, elementComponentId:string, element) {\n    // Shim the element as a child of the compiled component\n    if (isPresent(hostComponentId)) {\n      var contentAttribute = getContentAttribute(getComponentId(hostComponentId));\n      DOM.setAttribute(element, contentAttribute, '');\n    }\n    // If the current element is also a component, shim it as a host\n    if (isPresent(elementComponentId)) {\n      var hostAttribute = getHostAttribute(getComponentId(elementComponentId));\n      DOM.setAttribute(element, hostAttribute, '');\n    }\n  }\n}\n"]}