blob: bf78d80274d30b68b58c732f4a6efbfe6317e6b2 [file] [log] [blame]
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@angular/flex-layout/core",["exports","@angular/core","@angular/common","rxjs","rxjs/operators"],e):e((t.ng=t.ng||{},t.ng.flexLayout=t.ng.flexLayout||{},t.ng.flexLayout.core={}),t.ng.core,t.ng.common,t.rxjs,t.rxjs.operators)}(this,function(t,e,i,r,n){"use strict";function a(t,e){function i(){this.constructor=t}B(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function o(t,e){return function(){if(i.isPlatformBrowser(e)){var r=/\bflex-layout-.+?\b/g;Array.from(t.querySelectorAll("[class*="+T+"]")).forEach(function(t){t.classList.contains(T+"ssr")&&t.parentNode?t.parentNode.removeChild(t):t.className.replace(r,"")})}}}function s(t,e){return t=t?t.clone():new Q,e&&(t.mqAlias=e.alias,t.mediaQuery=e.mediaQuery,t.suffix=e.suffix,t.priority=e.priority),t}function c(t){var e=u(t);return l(e[0],e[1],e[2])}function u(t){t=t?t.toLowerCase():"";var e=t.split(" "),i=e[0],r=e[1],n=e[2];return F.find(function(t){return t===i})||(i=F[0]),r===V&&(r=n!==V?n:"",n=V),[i,p(r),!!n]}function p(t){if(t)switch(t.toLowerCase()){case"reverse":case"wrap-reverse":case"reverse-wrap":t="wrap-reverse";break;case"no":case"none":case"nowrap":t="nowrap";break;default:t="wrap"}return t}function l(t,e,i){return void 0===e&&(e=null),void 0===i&&(i=!1),{display:i?"inline-flex":"flex","box-sizing":"border-box","flex-direction":t,"flex-wrap":e||null}}function h(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(null==t)throw TypeError("Cannot convert undefined or null to object");for(var r=0,n=e;r<n.length;r++){var a=n[r];if(null!=a)for(var o in a)a.hasOwnProperty(o)&&(t[o]=a[o])}return t}function f(t){var e=t.length>0?t.charAt(0):"",i=t.length>1?t.slice(1):"";return e.toUpperCase()+i}function d(t){return t.replace(G,"|").split("|").map(f).join("")}function y(t){return t.forEach(function(t){t.suffix||(t.suffix=d(t.alias),t.overlapping=!!t.overlapping)}),t}function v(t,e){void 0===e&&(e=[]);var i={};return t.forEach(function(t){i[t.alias]=t}),e.forEach(function(t){i[t.alias]?h(i[t.alias],t):i[t.alias]=t}),y(Object.keys(i).map(function(t){return i[t]}))}function m(t,e){var i=t?t.priority||0:0;return(e?e.priority||0:0)-i}function g(t,e){return(t.priority||0)-(e.priority||0)}function b(t,e){var i=t.filter(function(t){return!et[t]});if(i.length>0){var r=i.join(", ");try{var n=e.createElement("style");if(n.setAttribute("type","text/css"),!n.styleSheet){var a="\n/*\n @angular/flex-layout - workaround for possible browser quirk with mediaQuery listeners\n see http://bit.ly/2sd4HMP\n*/\n@media "+r+" {.fx-query-test{ }}\n";n.appendChild(e.createTextNode(a))}e.head.appendChild(n),i.forEach(function(t){return et[t]=n})}catch(t){console.error(t)}}}function E(t,e){return e&&!!window.matchMedia("all").addListener?window.matchMedia(t):{matches:"all"===t||""===t,media:t,addListener:function(){},removeListener:function(){}}}function A(t){return!!t&&t.mediaQuery.startsWith(at)}function w(t){return Array.isArray(t)?t:[t]}function x(t,e){var i=e.findByAlias(t)||e.findByQuery(t);return i?i.mediaQuery:t}function _(t){return t.map(function(t){return t.split(",")}).reduce(function(t,e){return t.concat(e)}).map(function(t){return t.trim()})}function k(t){for(var e in t){var i=t[e]||"";switch(e){case"display":t.display="flex"===i?["-webkit-flex","flex"]:"inline-flex"===i?["-webkit-inline-flex","inline-flex"]:i;break;case"align-items":case"align-self":case"align-content":case"flex":case"flex-basis":case"flex-flow":case"flex-grow":case"flex-shrink":case"flex-wrap":case"justify-content":t["-webkit-"+e]=i;break;case"flex-direction":i=i||"row",t["-webkit-flex-direction"]=i,t["flex-direction"]=i;break;case"order":t.order=t["-webkit-"+e]=isNaN(+i)?"0":i}}return t}function M(t,e,i){void 0===e&&(e="1"),void 0===i&&(i="1");var r=[e,i,t],n=t.indexOf("calc");if(n>0){r[2]=j(t.substring(n).trim());var a=t.substr(0,n).trim().split(" ");2==a.length&&(r[0]=a[0],r[1]=a[1])}else if(0==n)r[2]=j(t.trim());else{var a=t.split(" ");r=3===a.length?a:[e,i,t]}return r}function j(t){return t.replace(/[\s]/g,"").replace(/[\/\*\+\-]/g," $& ")}function I(t,e,i,r){if(void 0!==r){var n=t.get(e);n||(n=new Map,t.set(e,n)),n.set(i,r)}}var B=function(t,e){return(B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},P=function(){return P=Object.assign||function(t){for(var e,i=1,r=arguments.length;i<r;i++){e=arguments[i];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},P.apply(this,arguments)},O={provide:e.APP_BOOTSTRAP_LISTENER,useFactory:o,deps:[i.DOCUMENT,e.PLATFORM_ID],multi:!0},T="flex-layout-",S=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{providers:[O]}]}],t}(),Q=function(){function t(t,e,i,r,n){void 0===t&&(t=!1),void 0===e&&(e="all"),void 0===i&&(i=""),void 0===r&&(r=""),void 0===n&&(n=0),this.matches=t,this.mediaQuery=e,this.mqAlias=i,this.suffix=r,this.priority=n,this.property=""}return t.prototype.clone=function(){return new t(this.matches,this.mediaQuery,this.mqAlias,this.suffix)},t}(),R=function(){function t(){this.stylesheet=new Map}return t.prototype.addStyleToElement=function(t,e,i){var r=this.stylesheet.get(t);r?r.set(e,i):this.stylesheet.set(t,new Map([[e,i]]))},t.prototype.clearStyles=function(){this.stylesheet.clear()},t.prototype.getStyleForElement=function(t,e){var i=this.stylesheet.get(t),r="";if(i){var n=i.get(e);"number"!=typeof n&&"string"!=typeof n||(r=n+"")}return r},t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ngInjectableDef=e.ɵɵdefineInjectable({factory:function(){return new t},token:t,providedIn:"root"}),t}(),C={addFlexToParent:!0,addOrientationBps:!1,disableDefaultBps:!1,disableVendorPrefixes:!1,serverLoaded:!1,useColumnBasisZero:!0,printWithBreakpoints:[],mediaTriggerAutoRestore:!0,ssrObserveBreakpoints:[]},D=new e.InjectionToken("Flex Layout token, config options for the library",{providedIn:"root",factory:function(){return C}}),L=new e.InjectionToken("FlexLayoutServerLoaded",{providedIn:"root",factory:function(){return!1}}),N=new e.InjectionToken("Flex Layout token, collect all breakpoints into one provider",{providedIn:"root",factory:function(){return null}}),V="inline",F=["row","column","row-reverse","column-reverse"],W=function(){function t(t,e,i,n){this.elementRef=t,this.styleBuilder=e,this.styler=i,this.marshal=n,this.DIRECTIVE_KEY="",this.inputs=[],this.mru={},this.destroySubject=new r.Subject,this.styleCache=new Map}return Object.defineProperty(t.prototype,"parentElement",{get:function(){return this.elementRef.nativeElement.parentElement},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nativeElement",{get:function(){return this.elementRef.nativeElement},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activatedValue",{get:function(){return this.marshal.getValue(this.nativeElement,this.DIRECTIVE_KEY)},set:function(t){this.marshal.setValue(this.nativeElement,this.DIRECTIVE_KEY,t,this.marshal.activatedAlias)},enumerable:!0,configurable:!0}),t.prototype.ngOnChanges=function(t){var e=this;Object.keys(t).forEach(function(i){if(-1!==e.inputs.indexOf(i)){var r=i.split(".").slice(1).join("."),n=t[i].currentValue;e.setValue(n,r)}})},t.prototype.ngOnDestroy=function(){this.destroySubject.next(),this.destroySubject.complete(),this.marshal.releaseElement(this.nativeElement)},t.prototype.init=function(t){void 0===t&&(t=[]),this.marshal.init(this.elementRef.nativeElement,this.DIRECTIVE_KEY,this.updateWithValue.bind(this),this.clearStyles.bind(this),t)},t.prototype.addStyles=function(t,e){var i=this.styleBuilder,r=i.shouldCache,n=this.styleCache.get(t);n&&r||(n=i.buildStyles(t,e),r&&this.styleCache.set(t,n)),this.mru=P({},n),this.applyStyleToElement(n),i.sideEffect(t,n,e)},t.prototype.clearStyles=function(){var t=this;Object.keys(this.mru).forEach(function(e){t.mru[e]=""}),this.applyStyleToElement(this.mru),this.mru={}},t.prototype.triggerUpdate=function(){this.marshal.triggerUpdate(this.nativeElement,this.DIRECTIVE_KEY)},t.prototype.getFlexFlowDirection=function(t,e){if(void 0===e&&(e=!1),t){var i=this.styler.getFlowDirection(t),r=i[0];if(!i[1]&&e){var n=c(r),a=[t];this.styler.applyStyleToElements(n,a)}return r.trim()}return"row"},t.prototype.applyStyleToElement=function(t,e,i){void 0===i&&(i=this.nativeElement),this.styler.applyStyleToElement(i,t,e)},t.prototype.setValue=function(t,e){this.marshal.setValue(this.nativeElement,this.DIRECTIVE_KEY,t,e)},t.prototype.updateWithValue=function(t){this.addStyles(t)},t}(),K=[{alias:"xs",mediaQuery:"screen and (min-width: 0px) and (max-width: 599.99px)",priority:1e3},{alias:"sm",mediaQuery:"screen and (min-width: 600px) and (max-width: 959.99px)",priority:900},{alias:"md",mediaQuery:"screen and (min-width: 960px) and (max-width: 1279.99px)",priority:800},{alias:"lg",mediaQuery:"screen and (min-width: 1280px) and (max-width: 1919.99px)",priority:700},{alias:"xl",mediaQuery:"screen and (min-width: 1920px) and (max-width: 4999.99px)",priority:600},{alias:"lt-sm",overlapping:!0,mediaQuery:"screen and (max-width: 599.99px)",priority:950},{alias:"lt-md",overlapping:!0,mediaQuery:"screen and (max-width: 959.99px)",priority:850},{alias:"lt-lg",overlapping:!0,mediaQuery:"screen and (max-width: 1279.99px)",priority:750},{alias:"lt-xl",overlapping:!0,priority:650,mediaQuery:"screen and (max-width: 1919.99px)"},{alias:"gt-xs",overlapping:!0,mediaQuery:"screen and (min-width: 600px)",priority:-950},{alias:"gt-sm",overlapping:!0,mediaQuery:"screen and (min-width: 960px)",priority:-850},{alias:"gt-md",overlapping:!0,mediaQuery:"screen and (min-width: 1280px)",priority:-750},{alias:"gt-lg",overlapping:!0,mediaQuery:"screen and (min-width: 1920px)",priority:-650}],U="(orientation: portrait) and (max-width: 599.99px)",$="(orientation: portrait) and (min-width: 600px) and (max-width: 839.99px)",q="(orientation: landscape) and (min-width: 960px) and (max-width: 1279.99px)",z="(orientation: portrait) and (min-width: 840px)",H="(orientation: landscape) and (min-width: 1280px)",Y={HANDSET:U+", (orientation: landscape) and (max-width: 959.99px)",TABLET:$+" , "+q,WEB:z+", "+H+" ",HANDSET_PORTRAIT:""+U,TABLET_PORTRAIT:$+" ",WEB_PORTRAIT:""+z,HANDSET_LANDSCAPE:"(orientation: landscape) and (max-width: 959.99px)]",TABLET_LANDSCAPE:""+q,WEB_LANDSCAPE:""+H},Z=[{alias:"handset",priority:2e3,mediaQuery:Y.HANDSET},{alias:"handset.landscape",priority:2e3,mediaQuery:Y.HANDSET_LANDSCAPE},{alias:"handset.portrait",priority:2e3,mediaQuery:Y.HANDSET_PORTRAIT},{alias:"tablet",priority:2100,mediaQuery:Y.TABLET},{alias:"tablet.landscape",priority:2100,mediaQuery:Y.TABLET},{alias:"tablet.portrait",priority:2100,mediaQuery:Y.TABLET_PORTRAIT},{alias:"web",priority:2200,mediaQuery:Y.WEB,overlapping:!0},{alias:"web.landscape",priority:2200,mediaQuery:Y.WEB_LANDSCAPE,overlapping:!0},{alias:"web.portrait",priority:2200,mediaQuery:Y.WEB_PORTRAIT,overlapping:!0}],G=/(\.|-|_)/g,J=new e.InjectionToken("Token (@angular/flex-layout) Breakpoints",{providedIn:"root",factory:function(){var t=e.inject(N),i=e.inject(D),r=[].concat.apply([],(t||[]).map(function(t){return Array.isArray(t)?t:[t]}));return v((i.disableDefaultBps?[]:K).concat(i.addOrientationBps?Z:[]),r)}}),X=function(){function t(t){this.findByMap=new Map,this.items=t.slice().sort(g)}return t.prototype.findByAlias=function(t){return t?this.findWithPredicate(t,function(e){return e.alias==t}):null},t.prototype.findByQuery=function(t){return this.findWithPredicate(t,function(e){return e.mediaQuery==t})},Object.defineProperty(t.prototype,"overlappings",{get:function(){return this.items.filter(function(t){return 1==t.overlapping})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"aliases",{get:function(){return this.items.map(function(t){return t.alias})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"suffixes",{get:function(){return this.items.map(function(t){return t.suffix?t.suffix:""})},enumerable:!0,configurable:!0}),t.prototype.findWithPredicate=function(t,e){var i=this.findByMap.get(t);return i||(i=this.items.find(e)||null,this.findByMap.set(t,i)),i||null},t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:Array,decorators:[{type:e.Inject,args:[J]}]}]},t.ngInjectableDef=e.ɵɵdefineInjectable({factory:function(){return new t(e.ɵɵinject(J))},token:t,providedIn:"root"}),t}(),tt=function(){function t(t,e,i){this._zone=t,this._platformId=e,this._document=i,this.source=new r.BehaviorSubject(new Q(!0)),this.registry=new Map,this._observable$=this.source.asObservable()}return Object.defineProperty(t.prototype,"activations",{get:function(){var t=[];return this.registry.forEach(function(e,i){e.matches&&t.push(i)}),t},enumerable:!0,configurable:!0}),t.prototype.isActive=function(t){var e=this.registry.get(t);return!!e&&e.matches},t.prototype.observe=function(t,e){var i=this;if(void 0===e&&(e=!1),t&&t.length){var a=this._observable$.pipe(n.filter(function(i){return!e||t.indexOf(i.mediaQuery)>-1})),o=new r.Observable(function(e){var r=i.registerQuery(t);if(r.length){var n=r.pop();r.forEach(function(t){e.next(t)}),i.source.next(n)}e.complete()});return r.merge(o,a)}return this._observable$},t.prototype.registerQuery=function(t){var e=this,i=Array.isArray(t)?t:[t],r=[];return b(i,this._document),i.forEach(function(t){var i=function(i){e._zone.run(function(){return e.source.next(new Q(i.matches,t))})},n=e.registry.get(t);n||(n=e.buildMQL(t),n.addListener(i),e.registry.set(t,n)),n.matches&&r.push(new Q(!0,t))}),r},t.prototype.buildMQL=function(t){return E(t,i.isPlatformBrowser(this._platformId))},t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:e.NgZone},{type:Object,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]},{type:void 0,decorators:[{type:e.Inject,args:[i.DOCUMENT]}]}]},t.ngInjectableDef=e.ɵɵdefineInjectable({factory:function(){return new t(e.ɵɵinject(e.NgZone),e.ɵɵinject(e.PLATFORM_ID),e.ɵɵinject(i.DOCUMENT))},token:t,providedIn:"root"}),t}(),et={},it=function(t){function r(e,i,r,n){var a=t.call(this,e,i,r)||this;return a._breakpoints=n,a.autoRegisterQueries=!0,a.useOverlaps=!1,a}return a(r,t),r.prototype.clearAll=function(){this.registry.forEach(function(t){t.destroy()}),this.registry.clear(),this.useOverlaps=!1},r.prototype.activate=function(t,e){return void 0===e&&(e=!1),e=e||this.useOverlaps,t=this._validateQuery(t),!e&&this.isActive(t)||(this._deactivateAll(),this._registerMediaQuery(t),this._activateWithOverlaps(t,e)),this.hasActivated},r.prototype._validateQuery=function(t){var e=this._breakpoints.findByAlias(t);return e&&e.mediaQuery||t},r.prototype._activateWithOverlaps=function(t,e){if(e){var i=this._breakpoints.findByQuery(t),r=i?i.alias:"unknown";switch(r){case"lg":this._activateByAlias("lt-xl");break;case"md":this._activateByAlias("lt-xl, lt-lg");break;case"sm":this._activateByAlias("lt-xl, lt-lg, lt-md");break;case"xs":this._activateByAlias("lt-xl, lt-lg, lt-md, lt-sm")}switch(r){case"xl":this._activateByAlias("gt-lg, gt-md, gt-sm, gt-xs");break;case"lg":this._activateByAlias("gt-md, gt-sm, gt-xs");break;case"md":this._activateByAlias("gt-sm, gt-xs");break;case"sm":this._activateByAlias("gt-xs")}}return this._activateByQuery(t)},r.prototype._activateByAlias=function(t){var e=this,i=function(t){var i=e._breakpoints.findByAlias(t);e._activateByQuery(i?i.mediaQuery:t)};t.split(",").forEach(function(t){return i(t.trim())})},r.prototype._activateByQuery=function(t){var e=this.registry.get(t);return e&&!this.isActive(t)&&this.registry.set(t,e.activate()),this.hasActivated},r.prototype._deactivateAll=function(){return this.registry.forEach(function(t){t.deactivate()}),this},r.prototype._registerMediaQuery=function(t){!this.registry.has(t)&&this.autoRegisterQueries&&this.registerQuery(t)},r.prototype.buildMQL=function(t){return new rt(t)},Object.defineProperty(r.prototype,"hasActivated",{get:function(){return this.activations.length>0},enumerable:!0,configurable:!0}),r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[{type:e.NgZone},{type:Object,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]},{type:void 0,decorators:[{type:e.Inject,args:[i.DOCUMENT]}]},{type:X}]},r}(tt),rt=function(){function t(t){this._mediaQuery=t,this._isActive=!1,this._listeners=[],this.onchange=null}return Object.defineProperty(t.prototype,"matches",{get:function(){return this._isActive},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"media",{get:function(){return this._mediaQuery},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){this.deactivate(),this._listeners=[]},t.prototype.activate=function(){var t=this;return this._isActive||(this._isActive=!0,this._listeners.forEach(function(e){e.call(null,t)})),this},t.prototype.deactivate=function(){var t=this;return this._isActive&&(this._isActive=!1,this._listeners.forEach(function(e){e.call(null,t)})),this},t.prototype.addListener=function(t){if(-1===this._listeners.indexOf(t)&&this._listeners.push(t),this._isActive){t.call(null,this)}},t.prototype.removeListener=function(t){},t.prototype.addEventListener=function(t,e,i){},t.prototype.removeEventListener=function(t,e,i){},t.prototype.dispatchEvent=function(t){return!1},t}(),nt={provide:tt,useClass:it},at="print",ot={alias:at,mediaQuery:at,priority:1e3},st=function(){function t(t,e){this.breakpoints=t,this.layoutConfig=e,this.isPrinting=!1,this.queue=new ct,this.deactivations=[]}return t.prototype.withPrintQuery=function(t){return t.concat([at])},t.prototype.isPrintEvent=function(t){return t.mediaQuery.startsWith(at)},Object.defineProperty(t.prototype,"printAlias",{get:function(){return this.layoutConfig.printWithBreakpoints||[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"printBreakPoints",{get:function(){var t=this;return this.printAlias.map(function(e){return t.breakpoints.findByAlias(e)}).filter(function(t){return null!==t})},enumerable:!0,configurable:!0}),t.prototype.getEventBreakpoints=function(t){var e=t.mediaQuery,i=this.breakpoints.findByQuery(e);return(i?this.printBreakPoints.concat([i]):this.printBreakPoints).sort(m)},t.prototype.updateEvent=function(t){var e=this.breakpoints.findByQuery(t.mediaQuery);return this.isPrintEvent(t)&&(e=this.getEventBreakpoints(t)[0],t.mediaQuery=e?e.mediaQuery:""),s(t,e)},t.prototype.interceptEvents=function(t){var e=this;return function(i){e.isPrintEvent(i)?i.matches&&!e.isPrinting?(e.startPrinting(t,e.getEventBreakpoints(i)),t.updateStyles()):!i.matches&&e.isPrinting&&(e.stopPrinting(t),t.updateStyles()):e.collectActivations(i)}},t.prototype.blockPropagation=function(){var t=this;return function(e){return!(t.isPrinting||t.isPrintEvent(e))}},t.prototype.startPrinting=function(t,e){this.isPrinting=!0,t.activatedBreakpoints=this.queue.addPrintBreakpoints(e)},t.prototype.stopPrinting=function(t){t.activatedBreakpoints=this.deactivations,this.deactivations=[],this.queue.clear(),this.isPrinting=!1},t.prototype.collectActivations=function(t){if(!this.isPrinting)if(t.matches)this.deactivations=[];else{var e=this.breakpoints.findByQuery(t.mediaQuery);e&&(this.deactivations.push(e),this.deactivations.sort(m))}},t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:X},{type:void 0,decorators:[{type:e.Inject,args:[D]}]}]},t.ngInjectableDef=e.ɵɵdefineInjectable({factory:function(){return new t(e.ɵɵinject(X),e.ɵɵinject(D))},token:t,providedIn:"root"}),t}(),ct=function(){function t(){this.printBreakpoints=[]}return t.prototype.addPrintBreakpoints=function(t){var e=this;return t.push(ot),t.sort(m),t.forEach(function(t){return e.addBreakpoint(t)}),this.printBreakpoints},t.prototype.addBreakpoint=function(t){if(t){void 0===this.printBreakpoints.find(function(e){return e.mediaQuery===t.mediaQuery})&&(this.printBreakpoints=A(t)?[t].concat(this.printBreakpoints):this.printBreakpoints.concat([t]))}},t.prototype.clear=function(){this.printBreakpoints=[]},t}(),ut=function(){function t(t,e,i){this.breakpoints=t,this.matchMedia=e,this.hook=i,this.filterOverlaps=!1,this.destroyed$=new r.Subject,this._media$=this.watchActivations(),this.media$=this._media$.pipe(n.filter(function(t){return t.length>0}),n.map(function(t){return t[0]}))}return t.prototype.ngOnDestroy=function(){this.destroyed$.next(),this.destroyed$.complete()},t.prototype.asObservable=function(){return this._media$},t.prototype.isActive=function(t){var e=this;return _(w(t)).some(function(t){var i=x(t,e.breakpoints);return e.matchMedia.isActive(i)})},t.prototype.watchActivations=function(){var t=this.breakpoints.items.map(function(t){return t.mediaQuery});return this.buildObservable(t)},t.prototype.buildObservable=function(t){var e=this,i=function(t){var e=function(t){return t.mediaQuery.length>0};return t.filter(e).length>0},a=function(t){return e.filterOverlaps?t.filter(function(t){var i=e.breakpoints.findByQuery(t.mediaQuery);return!i||!i.overlapping}):t};return this.matchMedia.observe(this.hook.withPrintQuery(t)).pipe(n.filter(function(t){return t.matches}),n.debounceTime(0,r.asapScheduler),n.switchMap(function(t){return r.of(e.findAllActivations())}),n.map(a),n.filter(i),n.takeUntil(this.destroyed$))},t.prototype.findAllActivations=function(){var t=this,e=function(e){return s(e,t.breakpoints.findByQuery(e.mediaQuery))},i=function(e){return t.hook.isPrintEvent(e)?t.hook.updateEvent(e):e};return this.matchMedia.activations.map(function(t){return new Q(!0,t)}).map(i).map(e).sort(m)},t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:X},{type:tt},{type:st}]},t.ngInjectableDef=e.ɵɵdefineInjectable({factory:function(){return new t(e.ɵɵinject(X),e.ɵɵinject(tt),e.ɵɵinject(st))},token:t,providedIn:"root"}),t}(),pt=function(){function t(t,e,i,r,n){this.breakpoints=t,this.matchMedia=e,this.layoutConfig=i,this._platformId=r,this._document=n,this.hasCachedRegistryMatches=!1,this.originalActivations=[],this.originalRegistry=new Map}return t.prototype.activate=function(t){t=t.map(function(t){return t.trim()}),this.saveActivations(),this.deactivateAll(),this.setActivations(t),this.prepareAutoRestore()},t.prototype.restore=function(){if(this.hasCachedRegistryMatches){var t=function(t){return t.mediaQuery},e=this.originalActivations.map(t);try{this.deactivateAll(),this.restoreRegistryMatches(),this.setActivations(e)}finally{this.originalActivations=[],this.resizeSubscription&&this.resizeSubscription.unsubscribe()}}},t.prototype.prepareAutoRestore=function(){if(i.isPlatformBrowser(this._platformId)&&this._document&&this.layoutConfig.mediaTriggerAutoRestore){var t=r.fromEvent(window,"resize").pipe(n.take(1));this.resizeSubscription=t.subscribe(this.restore.bind(this))}},t.prototype.deactivateAll=function(){var t=this.currentActivations;this.forceRegistryMatches(t,!1),this.simulateMediaChanges(t,!1)},t.prototype.saveActivations=function(){var t=this;if(!this.hasCachedRegistryMatches){var e=function(t){return new Q(!0,t)},i=function(e){return s(e,t.breakpoints.findByQuery(e.mediaQuery))};this.originalActivations=this.currentActivations.map(e).map(i).sort(m),this.cacheRegistryMatches()}},t.prototype.setActivations=function(t){this.originalRegistry&&this.forceRegistryMatches(t,!0),this.simulateMediaChanges(t)},t.prototype.simulateMediaChanges=function(t,e){var i=this;void 0===e&&(e=!0);var r=function(t){var e=i.breakpoints,r=e.findByAlias(t)||e.findByQuery(t);return r?r.mediaQuery:t},n=function(t){return i.emitChangeEvent(e,t)};t.map(r).forEach(n)},t.prototype.forceRegistryMatches=function(t,e){var i=new Map;t.forEach(function(t){i.set(t,{matches:e})}),this.matchMedia.registry=i},t.prototype.cacheRegistryMatches=function(){var t=this.originalRegistry;t.clear(),this.matchMedia.registry.forEach(function(e,i){t.set(i,e)}),this.hasCachedRegistryMatches=!0},t.prototype.restoreRegistryMatches=function(){var t=this.matchMedia.registry;t.clear(),this.originalRegistry.forEach(function(e,i){t.set(i,e)}),this.originalRegistry.clear(),this.hasCachedRegistryMatches=!1},t.prototype.emitChangeEvent=function(t,e){this.matchMedia.source.next(new Q(t,e))},Object.defineProperty(t.prototype,"currentActivations",{get:function(){return this.matchMedia.activations},enumerable:!0,configurable:!0}),t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:X},{type:tt},{type:void 0,decorators:[{type:e.Inject,args:[D]}]},{type:Object,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]},{type:void 0,decorators:[{type:e.Inject,args:[i.DOCUMENT]}]}]},t.ngInjectableDef=e.ɵɵdefineInjectable({factory:function(){return new t(e.ɵɵinject(X),e.ɵɵinject(tt),e.ɵɵinject(D),e.ɵɵinject(e.PLATFORM_ID),e.ɵɵinject(i.DOCUMENT))},token:t,providedIn:"root"}),t}(),lt=function(){function t(t,e,i,r){this._serverStylesheet=t,this._serverModuleLoaded=e,this._platformId=i,this.layoutConfig=r}return t.prototype.applyStyleToElement=function(t,e,i){void 0===i&&(i=null);var r={};"string"==typeof e&&(r[e]=i,e=r),r=this.layoutConfig.disableVendorPrefixes?e:k(e),this._applyMultiValueStyleToElement(r,t)},t.prototype.applyStyleToElements=function(t,e){var i=this;void 0===e&&(e=[]);var r=this.layoutConfig.disableVendorPrefixes?t:k(t);e.forEach(function(t){i._applyMultiValueStyleToElement(r,t)})},t.prototype.getFlowDirection=function(t){var e=this.lookupStyle(t,"flex-direction"),r=this.lookupInlineStyle(t,"flex-direction")||i.isPlatformServer(this._platformId)&&this._serverModuleLoaded?e:"";return[e||"row",r]},t.prototype.lookupAttributeValue=function(t,e){return t.getAttribute(e)||""},t.prototype.lookupInlineStyle=function(t,e){return i.isPlatformBrowser(this._platformId)?t.style.getPropertyValue(e):this._getServerStyle(t,e)},t.prototype.lookupStyle=function(t,e,r){void 0===r&&(r=!1);var n="";if(t){(n=this.lookupInlineStyle(t,e))||(i.isPlatformBrowser(this._platformId)?r||(n=getComputedStyle(t).getPropertyValue(e)):this._serverModuleLoaded&&(n=this._serverStylesheet.getStyleForElement(t,e)))}return n?n.trim():""},t.prototype._applyMultiValueStyleToElement=function(t,e){var r=this;Object.keys(t).sort().forEach(function(n){var a=t[n],o=Array.isArray(a)?a:[a];o.sort();for(var s=0,c=o;s<c.length;s++){var u=c[s];u=u?u+"":"",i.isPlatformBrowser(r._platformId)||!r._serverModuleLoaded?i.isPlatformBrowser(r._platformId)?e.style.setProperty(n,u):r._setServerStyle(e,n,u):r._serverStylesheet.addStyleToElement(e,n,u)}})},t.prototype._setServerStyle=function(t,e,i){e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();var r=this._readStyleAttribute(t);r[e]=i||"",this._writeStyleAttribute(t,r)},t.prototype._getServerStyle=function(t,e){return this._readStyleAttribute(t)[e]||""},t.prototype._readStyleAttribute=function(t){var e={},i=t.getAttribute("style");if(i)for(var r=i.split(/;+/g),n=0;n<r.length;n++){var a=r[n].trim();if(a.length>0){var o=a.indexOf(":");if(-1===o)throw new Error("Invalid CSS style: "+a);var s=a.substr(0,o).trim();e[s]=a.substr(o+1).trim()}}return e},t.prototype._writeStyleAttribute=function(t,e){var i="";for(var r in e){e[r]&&(i+=r+":"+e[r]+";")}t.setAttribute("style",i)},t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:R,decorators:[{type:e.Optional}]},{type:Boolean,decorators:[{type:e.Optional},{type:e.Inject,args:[L]}]},{type:Object,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]},{type:void 0,decorators:[{type:e.Inject,args:[D]}]}]},t.ngInjectableDef=e.ɵɵdefineInjectable({factory:function(){return new t(e.ɵɵinject(R,8),e.ɵɵinject(L,8),e.ɵɵinject(e.PLATFORM_ID),e.ɵɵinject(D))},token:t,providedIn:"root"}),t}(),ht=function(){function t(){this.shouldCache=!0}return t.prototype.sideEffect=function(t,e,i){},t}(),ft=function(){function t(t,e,i){this.matchMedia=t,this.breakpoints=e,this.hook=i,this.activatedBreakpoints=[],this.elementMap=new Map,this.elementKeyMap=new WeakMap,this.watcherMap=new WeakMap,this.updateMap=new WeakMap,this.clearMap=new WeakMap,this.subject=new r.Subject,this.observeActivations()}return Object.defineProperty(t.prototype,"activatedAlias",{get:function(){return this.activatedBreakpoints[0]?this.activatedBreakpoints[0].alias:""},enumerable:!0,configurable:!0}),t.prototype.onMediaChange=function(t){var e=this.findByQuery(t.mediaQuery);e&&(t=s(t,e),t.matches&&-1===this.activatedBreakpoints.indexOf(e)?(this.activatedBreakpoints.push(e),this.activatedBreakpoints.sort(m),this.updateStyles()):t.matches||-1===this.activatedBreakpoints.indexOf(e)||(this.activatedBreakpoints.splice(this.activatedBreakpoints.indexOf(e),1),this.activatedBreakpoints.sort(m),this.updateStyles()))},t.prototype.init=function(t,e,i,r,n){void 0===n&&(n=[]),I(this.updateMap,t,e,i),I(this.clearMap,t,e,r),this.buildElementKeyMap(t,e),this.watchExtraTriggers(t,e,n)},t.prototype.getValue=function(t,e,i){var r=this.elementMap.get(t);if(r){var n=void 0!==i?r.get(i):this.getActivatedValues(r,e);if(n)return n.get(e)}},t.prototype.hasValue=function(t,e){var i=this.elementMap.get(t);if(i){var r=this.getActivatedValues(i,e);if(r)return void 0!==r.get(e)||!1}return!1},t.prototype.setValue=function(t,e,i,r){var n=this.elementMap.get(t);if(n){var a=(n.get(r)||new Map).set(e,i);n.set(r,a),this.elementMap.set(t,n)}else n=(new Map).set(r,(new Map).set(e,i)),this.elementMap.set(t,n);var o=this.getValue(t,e);void 0!==o&&this.updateElement(t,e,o)},t.prototype.trackValue=function(t,e){return this.subject.asObservable().pipe(n.filter(function(i){return i.element===t&&i.key===e}))},t.prototype.updateStyles=function(){var t=this;this.elementMap.forEach(function(e,i){var r=new Set(t.elementKeyMap.get(i)),n=t.getActivatedValues(e);n&&n.forEach(function(e,n){t.updateElement(i,n,e),r.delete(n)}),r.forEach(function(r){if(n=t.getActivatedValues(e,r)){var a=n.get(r);t.updateElement(i,r,a)}else t.clearElement(i,r)})})},t.prototype.clearElement=function(t,e){var i=this.clearMap.get(t);if(i){var r=i.get(e);r&&(r(),this.subject.next({element:t,key:e,value:""}))}},t.prototype.updateElement=function(t,e,i){var r=this.updateMap.get(t);if(r){var n=r.get(e);n&&(n(i),this.subject.next({element:t,key:e,value:i}))}},t.prototype.releaseElement=function(t){var e=this.watcherMap.get(t);e&&(e.forEach(function(t){return t.unsubscribe()}),this.watcherMap.delete(t));var i=this.elementMap.get(t);i&&(i.forEach(function(t,e){return i.delete(e)}),this.elementMap.delete(t))},t.prototype.triggerUpdate=function(t,e){var i=this,r=this.elementMap.get(t);if(r){var n=this.getActivatedValues(r,e);n&&(e?this.updateElement(t,e,n.get(e)):n.forEach(function(e,r){return i.updateElement(t,r,e)}))}},t.prototype.buildElementKeyMap=function(t,e){var i=this.elementKeyMap.get(t);i||(i=new Set,this.elementKeyMap.set(t,i)),i.add(e)},t.prototype.watchExtraTriggers=function(t,e,i){var n=this;if(i&&i.length){var a=this.watcherMap.get(t);a||(a=new Map,this.watcherMap.set(t,a));if(!a.get(e)){var o=r.merge.apply(void 0,i).subscribe(function(){var i=n.getValue(t,e);n.updateElement(t,e,i)});a.set(e,o)}}},t.prototype.findByQuery=function(t){return this.breakpoints.findByQuery(t)},t.prototype.getActivatedValues=function(t,e){for(var i=0;i<this.activatedBreakpoints.length;i++){var r=this.activatedBreakpoints[i],n=t.get(r.alias);if(n&&(void 0===e||n.has(e)))return n}var a=t.get("");return void 0===e||a&&a.has(e)?a:void 0},t.prototype.observeActivations=function(){var t=this,e=this.breakpoints.items.map(function(t){return t.mediaQuery});this.matchMedia.observe(this.hook.withPrintQuery(e)).pipe(n.tap(this.hook.interceptEvents(t)),n.filter(this.hook.blockPropagation())).subscribe(this.onMediaChange.bind(this))},t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:tt},{type:X},{type:st}]},
t.ngInjectableDef=e.ɵɵdefineInjectable({factory:function(){return new t(e.ɵɵinject(tt),e.ɵɵinject(X),e.ɵɵinject(st))},token:t,providedIn:"root"}),t}();tMatchMedia=tt,tMockMatchMedia=it,tMockMatchMediaProvider=nt,t.CoreModule=S,t.removeStyles=o,t.BROWSER_PROVIDER=O,t.CLASS_NAME=T,t.MediaChange=Q,t.StylesheetMap=R,t.DEFAULT_CONFIG=C,t.LAYOUT_CONFIG=D,t.SERVER_TOKEN=L,t.BREAKPOINT=N,t.mergeAlias=s,t.BaseDirective2=W,t.DEFAULT_BREAKPOINTS=K,t.ScreenTypes=Y,t.ORIENTATION_BREAKPOINTS=Z,t.BreakPointRegistry=X,t.BREAKPOINTS=J,t.MediaObserver=ut,t.MediaTrigger=pt,t.sortDescendingPriority=m,t.sortAscendingPriority=g,t.coerceArray=w,t.StyleUtils=lt,t.StyleBuilder=ht,t.validateBasis=M,t.MediaMarshaller=ft,t.BREAKPOINT_PRINT=ot,t.PrintHook=st,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=flex-layout-core.umd.min.js.map