blob: 476ed32465ed7d5df48cb5533fb6895e7d1fc67c [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(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/common"),require("@angular/core"),require("@angular/flex-layout/core"),require("@angular/platform-server")):"function"==typeof define&&define.amd?define("@angular/flex-layout/server",["exports","@angular/common","@angular/core","@angular/flex-layout/core","@angular/platform-server"],t):t((e.ng=e.ng||{},e.ng.flexLayout=e.ng.flexLayout||{},e.ng.flexLayout.server={}),e.ng.common,e.ng.core,e.ng.flexLayout.core,e.ng.platformServer)}(this,function(e,t,r,n,o){"use strict";function i(e,t){function r(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function a(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),o=0,t=0;t<r;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function s(e,t,r){var o=new Map,i=new Map(e.stylesheet);_=0;var s=u(i,"all",o);return a(r).sort(n.sortAscendingPriority).forEach(function(n,i){e.clearStyles(),t.activateBreakpoint(n);var a=new Map(e.stylesheet);a.size>0&&(s+=u(a,n.mediaQuery,o)),t.deactivateBreakpoint(r[i])}),s}function c(e,t,r,o){return function(){var i=r.createElement("style"),a=s(e,t,o);i.classList.add(n.CLASS_NAME+"ssr"),i.textContent=a,r.head.appendChild(i)}}function u(e,t,r){var n="";return e.forEach(function(e,t){var o="",i=l(t,r);e.forEach(function(e,t){o+=e?f(t+":"+e+";"):""}),n+=f("."+i+" {",o,"}")}),f("@media "+t+" {",n,"}")}function f(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r="";return e.forEach(function(e,t){r+=g?p(e,0!==t):e}),r}function p(e,t){return void 0===t&&(t=!0),t?"\n"+e:e+"\n"}function l(e,t){var r=t.get(e);return r||(r=""+n.CLASS_NAME+_++,t.set(e,r)),e.classList.add(r),r}var d=function(e,t){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},y=function(){function e(e,t){void 0===t&&(t=!1),this._mediaQuery=e,this._isActive=t,this._listeners=[],this.onchange=null}return Object.defineProperty(e.prototype,"matches",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"media",{get:function(){return this._mediaQuery},enumerable:!1,configurable:!0}),e.prototype.destroy=function(){this.deactivate(),this._listeners=[]},e.prototype.activate=function(){var e=this;return this._isActive||(this._isActive=!0,this._listeners.forEach(function(t){t.call(e,{matches:e.matches,media:e.media})})),this},e.prototype.deactivate=function(){var e=this;return this._isActive&&(this._isActive=!1,this._listeners.forEach(function(t){t.call(e,{matches:e.matches,media:e.media})})),this},e.prototype.addListener=function(e){if(-1===this._listeners.indexOf(e)&&this._listeners.push(e),this._isActive){e.call(this,{matches:this.matches,media:this.media})}},e.prototype.removeListener=function(e){},e.prototype.addEventListener=function(e,t,r){},e.prototype.removeEventListener=function(e,t,r){},e.prototype.dispatchEvent=function(e){return!1},e}(),v=function(e){function o(t,r,n,o,i){var a=e.call(this,t,r,n)||this;a._zone=t,a._platformId=r,a._document=n,a.breakpoints=o,a.layoutConfig=i,a._activeBreakpoints=[];var s=i.ssrObserveBreakpoints;return s&&(a._activeBreakpoints=s.reduce(function(e,t){var r=o.find(function(e){return t===e.alias});return r?e.push(r):console.warn('FlexLayoutServerModule: unknown breakpoint alias "'+t+'"'),e},[])),a}return i(o,e),o.prototype.activateBreakpoint=function(e){var t=this.registry.get(e.mediaQuery);t&&t.activate()},o.prototype.deactivateBreakpoint=function(e){var t=this.registry.get(e.mediaQuery);t&&t.deactivate()},o.prototype.buildMQL=function(e){var t=this._activeBreakpoints.some(function(t){return t.mediaQuery===e});return new y(e,t)},o.decorators=[{type:r.Injectable}],o.ctorParameters=function(){return[{type:r.NgZone},{type:Object,decorators:[{type:r.Inject,args:[r.PLATFORM_ID]}]},{type:void 0,decorators:[{type:r.Inject,args:[t.DOCUMENT]}]},{type:Array,decorators:[{type:r.Inject,args:[n.BREAKPOINTS]}]},{type:void 0,decorators:[{type:r.Inject,args:[n.LAYOUT_CONFIG]}]}]},o}(nMatchMedia),h=[{provide:o.BEFORE_APP_SERIALIZED,useFactory:c,deps:[n.StylesheetMap,nMatchMedia,t.DOCUMENT,n.BREAKPOINTS],multi:!0},{provide:n.SERVER_TOKEN,useValue:!0},{provide:nMatchMedia,useClass:v}],_=0,g=!1,m=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{providers:[h]}]}],e}();e.FlexLayoutServerModule=m,e.generateStaticFlexLayoutStyles=s,e.FLEX_SSR_SERIALIZER_FACTORY=c,e.SERVER_PROVIDERS=h,eserver_privatea=v,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=flex-layout-server.umd.min.js.map