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CAAC,sBAAsB,CAAC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC5E,IAAI,UAAU,GAAG,IAAI,CAAC,sBAAsB,CAAC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAE7E,iBAAiB,CAAC,OAAO,EAAK,SAAS,SAAI,UAAY,CAAC,CAAC;QAEzD,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,+FAA+F;IACvF,uDAAsB,GAA9B,UAA+B,WAAmB,EAAE,MAAgB;QAClE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAG,WAAW,SAAI,CAAC,OAAG,EAAtB,CAAsB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3D,CAAC;IACH,6BAAC;AAAD,CAxGA,AAwGC,IAAA","file":"core/overlay/position/global-position-strategy.js","sourcesContent":["import {applyCssTransform} from '@angular2-material/core';\nimport {PositionStrategy} from './position-strategy';\n\n\n/**\n * A strategy for positioning overlays. Using this strategy, an overlay is given an\n * explicit position relative to the browser's viewport.\n */\nexport class GlobalPositionStrategy implements PositionStrategy {\n private _cssPosition: string = 'absolute';\n private _top: string = '';\n private _bottom: string = '';\n private _left: string = '';\n private _right: string = '';\n\n /** Array of individual applications of translateX(). Currently only for centering. */\n private _translateX: string[] = [];\n\n /** Array of individual applications of translateY(). Currently only for centering. */\n private _translateY: string[] = [];\n\n /** Sets the element to usee CSS position: fixed */\n fixed() {\n this._cssPosition = 'fixed';\n return this;\n }\n\n /** Sets the element to usee CSS position: absolute. This is the default. */\n absolute() {\n this._cssPosition = 'absolute';\n return this;\n }\n\n /** Sets the top position of the overlay. Clears any previously set vertical position. */\n top(value: string) {\n this._bottom = '';\n this._translateY = [];\n this._top = value;\n return this;\n }\n\n /** Sets the left position of the overlay. Clears any previously set horizontal position. */\n left(value: string) {\n this._right = '';\n this._translateX = [];\n this._left = value;\n return this;\n }\n\n /** Sets the bottom position of the overlay. Clears any previously set vertical position. */\n bottom(value: string) {\n this._top = '';\n this._translateY = [];\n this._bottom = value;\n return this;\n }\n\n /** Sets the right position of the overlay. Clears any previously set horizontal position. */\n right(value: string) {\n this._left = '';\n this._translateX = [];\n this._right = value;\n return this;\n }\n\n /**\n * Centers the overlay horizontally with an optional offset.\n * Clears any previously set horizontal position.\n */\n centerHorizontally(offset = '0px') {\n this._left = '50%';\n this._right = '';\n this._translateX = ['-50%', offset];\n return this;\n }\n\n /**\n * Centers the overlay vertically with an optional offset.\n * Clears any previously set vertical position.\n */\n centerVertically(offset = '0px') {\n this._top = '50%';\n this._bottom = '';\n this._translateY = ['-50%', offset];\n return this;\n }\n\n /**\n * Apply the position to the element.\n * TODO: internal\n */\n apply(element: HTMLElement): Promise<void> {\n element.style.position = this._cssPosition;\n element.style.top = this._top;\n element.style.left = this._left;\n element.style.bottom = this._bottom;\n element.style.right = this._right;\n\n // TODO(jelbourn): we don't want to always overwrite the transform property here,\n // because it will need to be used for animations.\n let tranlateX = this._reduceTranslateValues('translateX', this._translateX);\n let translateY = this._reduceTranslateValues('translateY', this._translateY);\n\n applyCssTransform(element, `${tranlateX} ${translateY}`);\n\n return Promise.resolve(null);\n }\n\n /** Reduce a list of translate values to a string that can be used in the transform property */\n private _reduceTranslateValues(translateFn: string, values: string[]) {\n return values.map(t => `${translateFn}(${t})`).join(' ');\n }\n}\n"],"sourceRoot":"/source/"}
\No newline at end of file