@angular/material
Version:
Angular Material
10 lines • 33.7 kB
JavaScript
/**
* @license
* Copyright Google Inc. 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/cdk/observers"),require("@angular/cdk/platform"),require("@angular/core"),require("@angular/cdk/bidi"),require("@angular/cdk/coercion"),require("rxjs/Subject"),require("@angular/platform-browser"),require("@angular/common"),require("@angular/cdk/keycodes"),require("@angular/cdk/a11y"),require("@angular/forms")):"function"==typeof define&&define.amd?define(["exports","@angular/cdk/observers","@angular/cdk/platform","@angular/core","@angular/cdk/bidi","@angular/cdk/coercion","rxjs/Subject","@angular/platform-browser","@angular/common","@angular/cdk/keycodes","@angular/cdk/a11y","@angular/forms"],t):t((e.ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material["slide-toggle"]=e.ng.material["slide-toggle"]||{}),e.ng.cdk.observers,e.ng.cdk.platform,e.ng.core,e.ng.cdk.bidi,e.ng.cdk.coercion,e.Rx,e.ng.platformBrowser,e.ng.common,e.ng.cdk.keycodes,e.ng.cdk.a11y,e.ng.forms)}(this,function(e,t,n,r,o,i,a,s,l,c,p,d){"use strict";function u(e,t){function n(){this.constructor=e}_(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function h(e){return function(e){function t(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=e.apply(this,t)||this;return r._disabled=!1,r}return u(t,e),Object.defineProperty(t.prototype,"disabled",{get:function(){return this._disabled},set:function(e){this._disabled=i.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),t}(e)}function g(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(null==e)throw TypeError("Cannot convert undefined or null to object");for(var r=0,o=t;r<o.length;r++){var i=o[r];if(null!=i)for(var a in i)i.hasOwnProperty(a)&&(e[a]=i[a])}return e}function m(e,t){for(var n=Array(e),r=0;r<e;r++)n[r]=t(r);return n}function f(e){window.getComputedStyle(e).getPropertyValue("opacity")}function b(e,t,n){var r=Math.max(Math.abs(e-n.left),Math.abs(e-n.right)),o=Math.max(Math.abs(t-n.top),Math.abs(t-n.bottom));return Math.sqrt(r*r+o*o)}function y(e,t){var n=t.trim();e.style.transform=n,e.style.webkitTransform=n}var _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},v=(new r.InjectionToken("md-compatibility-mode"),function(){function e(){}return e.decorators=[{type:r.Directive,args:[{selector:"\n [mat-button],\n [mat-fab],\n [mat-icon-button],\n [mat-mini-fab],\n [mat-raised-button],\n [matCardSubtitle],\n [matCardTitle],\n [matCellDef],\n [matColumnDef],\n [matDialogActions],\n [matDialogClose],\n [matDialogContent],\n [matDialogTitle],\n [matHeaderCellDef],\n [matHeaderRowDef],\n [matLine],\n [matRowDef],\n [matStepLabel],\n [matStepperNext],\n [matStepperPrevious],\n [matTabLabel],\n [matTabLink],\n [matTabNav],\n [matTooltip],\n [matInput],\n [matPrefix],\n [matSuffix],\n mat-autocomplete,\n mat-button-toggle,\n mat-button-toggle,\n mat-button-toggle-group,\n mat-card,\n mat-card-actions,\n mat-card-content,\n mat-card-footer,\n mat-card-header,\n mat-card-subtitle,\n mat-card-title,\n mat-card-title-group,\n mat-cell,\n mat-checkbox,\n mat-chip,\n mat-dialog-actions,\n mat-dialog-container,\n mat-dialog-content,\n mat-divider,\n mat-error,\n mat-grid-list,\n mat-grid-tile,\n mat-grid-tile-footer,\n mat-grid-tile-header,\n mat-header-cell,\n mat-header-row,\n mat-hint,\n mat-horizontal-stepper,\n mat-icon,\n mat-input-container,\n mat-form-field,\n mat-list,\n mat-list-item,\n mat-menu,\n mat-nav-list,\n mat-option,\n mat-placeholder,\n mat-progress-bar,\n mat-pseudo-checkbox,\n mat-radio-button,\n mat-radio-group,\n mat-row,\n mat-select,\n mat-sidenav,\n mat-sidenav-container,\n mat-slider,\n mat-spinner,\n mat-step,\n mat-tab,\n mat-table,\n mat-tab-group,\n mat-toolbar,\n mat-vertical-stepper"}]}],e.ctorParameters=function(){return[]},e}()),D=function(){function e(){}return e.decorators=[{type:r.Directive,args:[{selector:"\n [md-button],\n [md-fab],\n [md-icon-button],\n [md-mini-fab],\n [md-raised-button],\n [mdCardSubtitle],\n [mdCardTitle],\n [mdCellDef],\n [mdColumnDef],\n [mdDialogActions],\n [mdDialogClose],\n [mdDialogContent],\n [mdDialogTitle],\n [mdHeaderCellDef],\n [mdHeaderRowDef],\n [mdLine],\n [mdRowDef],\n [mdStepLabel],\n [mdStepperNext],\n [mdStepperPrevious],\n [mdTabLabel],\n [mdTabLink],\n [mdTabNav],\n [mdTooltip],\n [mdInput],\n [mdPrefix],\n [mdSuffix],\n md-autocomplete,\n md-button-toggle,\n md-button-toggle,\n md-button-toggle-group,\n md-card,\n md-card-actions,\n md-card-content,\n md-card-footer,\n md-card-header,\n md-card-subtitle,\n md-card-title,\n md-card-title-group,\n md-cell,\n md-checkbox,\n md-chip,\n md-dialog-actions,\n md-dialog-container,\n md-dialog-content,\n md-divider,\n md-error,\n md-grid-list,\n md-grid-tile,\n md-grid-tile-footer,\n md-grid-tile-header,\n md-header-cell,\n md-header-row,\n md-hint,\n md-horizontal-stepper,\n md-icon,\n md-input-container,\n md-form-field,\n md-list,\n md-list-item,\n md-menu,\n md-nav-list,\n md-option,\n md-placeholder,\n md-progress-bar,\n md-pseudo-checkbox,\n md-radio-button,\n md-radio-group,\n md-row,\n md-select,\n md-sidenav,\n md-sidenav-container,\n md-slider,\n md-spinner,\n md-step,\n md-tab,\n md-table,\n md-tab-group,\n md-toolbar,\n md-vertical-stepper"}]}],e.ctorParameters=function(){return[]},e}(),C=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{declarations:[v,D],exports:[v,D]}]}],e.ctorParameters=function(){return[]},e}(),k=new r.InjectionToken("mat-sanity-checks"),w=function(){function e(e){this._hasDoneGlobalChecks=!1,this._document="object"==typeof document&&document?document:null,e&&!this._hasDoneGlobalChecks&&r.isDevMode()&&(this._checkDoctype(),this._checkTheme(),this._hasDoneGlobalChecks=!0)}return e.prototype._checkDoctype=function(){this._document&&!this._document.doctype&&console.warn("Current document does not have a doctype. This may cause some Angular Material components not to behave as expected.")},e.prototype._checkTheme=function(){if(this._document&&"function"==typeof getComputedStyle){var e=this._document.createElement("div");e.classList.add("mat-theme-loaded-marker"),this._document.body.appendChild(e);var t=getComputedStyle(e);t&&"none"!==t.display&&console.warn("Could not find Angular Material core theme. Most Material components may not work as expected. For more info refer to the theming guide: https://material.angular.io/guide/theming"),this._document.body.removeChild(e)}},e.decorators=[{type:r.NgModule,args:[{imports:[C,o.BidiModule],exports:[C,o.BidiModule],providers:[{provide:k,useValue:!0}]}]}],e.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Optional},{type:r.Inject,args:[k]}]}]},e}(),I=new r.InjectionToken("MAT_DATE_LOCALE"),E=function(){function e(){this._localeChanges=new a.Subject}return Object.defineProperty(e.prototype,"localeChanges",{get:function(){return this._localeChanges},enumerable:!0,configurable:!0}),e.prototype.getYear=function(e){},e.prototype.getMonth=function(e){},e.prototype.getDate=function(e){},e.prototype.getDayOfWeek=function(e){},e.prototype.getMonthNames=function(e){},e.prototype.getDateNames=function(){},e.prototype.getDayOfWeekNames=function(e){},e.prototype.getYearName=function(e){},e.prototype.getFirstDayOfWeek=function(){},e.prototype.getNumDaysInMonth=function(e){},e.prototype.clone=function(e){},e.prototype.createDate=function(e,t,n){},e.prototype.today=function(){},e.prototype.parse=function(e,t){},e.prototype.format=function(e,t){},e.prototype.addCalendarYears=function(e,t){},e.prototype.addCalendarMonths=function(e,t){},e.prototype.addCalendarDays=function(e,t){},e.prototype.toIso8601=function(e){},e.prototype.fromIso8601=function(e){},e.prototype.isDateInstance=function(e){},e.prototype.isValid=function(e){},e.prototype.setLocale=function(e){this.locale=e,this._localeChanges.next()},e.prototype.compareDate=function(e,t){return this.getYear(e)-this.getYear(t)||this.getMonth(e)-this.getMonth(t)||this.getDate(e)-this.getDate(t)},e.prototype.sameDate=function(e,t){return e&&t?!this.compareDate(e,t):e==t},e.prototype.clampDate=function(e,t,n){return t&&this.compareDate(e,t)<0?t:n&&this.compareDate(e,n)>0?n:e},e}(),R="undefined"!=typeof Intl,x={long:["January","February","March","April","May","June","July","August","September","October","November","December"],short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],narrow:["J","F","M","A","M","J","J","A","S","O","N","D"]},T=m(31,function(e){return String(e+1)}),O={long:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],narrow:["S","M","T","W","T","F","S"]},M=/^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?)?$/,P=(function(e){function t(t){var n=e.call(this)||this;return n.useUtcForDisplay=!0,e.prototype.setLocale.call(n,t),n}u(t,e),t.prototype.getYear=function(e){return e.getFullYear()},t.prototype.getMonth=function(e){return e.getMonth()},t.prototype.getDate=function(e){return e.getDate()},t.prototype.getDayOfWeek=function(e){return e.getDay()},t.prototype.getMonthNames=function(e){var t=this;if(R){var n=new Intl.DateTimeFormat(this.locale,{month:e});return m(12,function(e){return t._stripDirectionalityCharacters(n.format(new Date(2017,e,1)))})}return x[e]},t.prototype.getDateNames=function(){var e=this;if(R){var t=new Intl.DateTimeFormat(this.locale,{day:"numeric"});return m(31,function(n){return e._stripDirectionalityCharacters(t.format(new Date(2017,0,n+1)))})}return T},t.prototype.getDayOfWeekNames=function(e){var t=this;if(R){var n=new Intl.DateTimeFormat(this.locale,{weekday:e});return m(7,function(e){return t._stripDirectionalityCharacters(n.format(new Date(2017,0,e+1)))})}return O[e]},t.prototype.getYearName=function(e){if(R){var t=new Intl.DateTimeFormat(this.locale,{year:"numeric"});return this._stripDirectionalityCharacters(t.format(e))}return String(this.getYear(e))},t.prototype.getFirstDayOfWeek=function(){return 0},t.prototype.getNumDaysInMonth=function(e){return this.getDate(this._createDateWithOverflow(this.getYear(e),this.getMonth(e)+1,0))},t.prototype.clone=function(e){return this.createDate(this.getYear(e),this.getMonth(e),this.getDate(e))},t.prototype.createDate=function(e,t,n){if(t<0||t>11)throw Error('Invalid month index "'+t+'". Month index has to be between 0 and 11.');if(n<1)throw Error('Invalid date "'+n+'". Date has to be greater than 0.');var r=this._createDateWithOverflow(e,t,n);if(r.getMonth()!=t)throw Error('Invalid date "'+n+'" for month with index "'+t+'".');return r},t.prototype.today=function(){return new Date},t.prototype.parse=function(e){return"number"==typeof e?new Date(e):e?new Date(Date.parse(e)):null},t.prototype.format=function(e,t){if(!this.isValid(e))throw Error("NativeDateAdapter: Cannot format invalid date.");if(R){this.useUtcForDisplay&&(e=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())),t=g({},t,{timeZone:"utc"}));var n=new Intl.DateTimeFormat(this.locale,t);return this._stripDirectionalityCharacters(n.format(e))}return this._stripDirectionalityCharacters(e.toDateString())},t.prototype.addCalendarYears=function(e,t){return this.addCalendarMonths(e,12*t)},t.prototype.addCalendarMonths=function(e,t){var n=this._createDateWithOverflow(this.getYear(e),this.getMonth(e)+t,this.getDate(e));return this.getMonth(n)!=((this.getMonth(e)+t)%12+12)%12&&(n=this._createDateWithOverflow(this.getYear(n),this.getMonth(n),0)),n},t.prototype.addCalendarDays=function(e,t){return this._createDateWithOverflow(this.getYear(e),this.getMonth(e),this.getDate(e)+t)},t.prototype.toIso8601=function(e){return[e.getUTCFullYear(),this._2digit(e.getUTCMonth()+1),this._2digit(e.getUTCDate())].join("-")},t.prototype.fromIso8601=function(e){if(M.test(e)){var t=new Date(e);if(this.isValid(t))return t}return null},t.prototype.isDateInstance=function(e){return e instanceof Date},t.prototype.isValid=function(e){return!isNaN(e.getTime())},t.prototype._createDateWithOverflow=function(e,t,n){var r=new Date(e,t,n);return e>=0&&e<100&&r.setFullYear(this.getYear(r)-1900),r},t.prototype._2digit=function(e){return("00"+e).slice(-2)},t.prototype._stripDirectionalityCharacters=function(e){return e.replace(/[\u200e\u200f]/g,"")},t.decorators=[{type:r.Injectable}],t.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Optional},{type:r.Inject,args:[I]}]}]}}(E),new r.InjectionToken("mat-date-formats"),function(e){function t(){var t=e.call(this)||this;return t._hammer="undefined"!=typeof window?window.Hammer:null,t.events=t._hammer?["longpress","slide","slidestart","slideend","slideright","slideleft"]:[],!t._hammer&&r.isDevMode()&&console.warn("Could not find HammerJS. Certain Angular Material components may not work correctly."),t}return u(t,e),t.prototype.buildHammer=function(e){var t=new this._hammer(e),n=new this._hammer.Pan,r=new this._hammer.Swipe,o=new this._hammer.Press,i=this._createRecognizer(n,{event:"slide",threshold:0},r),a=this._createRecognizer(o,{event:"longpress",time:500});return n.recognizeWith(r),t.add([r,o,n,i,a]),t},t.prototype._createRecognizer=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=new e.constructor(t);return n.push(e),n.forEach(function(e){return o.recognizeWith(e)}),o},t.decorators=[{type:r.Injectable}],t.ctorParameters=function(){return[]},t}(s.HammerGestureConfig)),S={};S.FADING_IN=0,S.VISIBLE=1,S.FADING_OUT=2,S.HIDDEN=3,S[S.FADING_IN]="FADING_IN",S[S.VISIBLE]="VISIBLE",S[S.FADING_OUT]="FADING_OUT",S[S.HIDDEN]="HIDDEN";var F=function(){function e(e,t,n){this._renderer=e,this.element=t,this.config=n,this.state=S.HIDDEN}return e.prototype.fadeOut=function(){this._renderer.fadeOutRipple(this)},e}(),N=function(){function e(e,t,n){this._ngZone=t,this._isPointerDown=!1,this._triggerEvents=new Map,this._activeRipples=new Set,this.rippleConfig={},this.rippleDisabled=!1,n.isBrowser&&(this._containerElement=e.nativeElement,this._triggerEvents.set("mousedown",this.onMousedown.bind(this)),this._triggerEvents.set("touchstart",this.onTouchstart.bind(this)),this._triggerEvents.set("mouseup",this.onPointerUp.bind(this)),this._triggerEvents.set("touchend",this.onPointerUp.bind(this)),this._triggerEvents.set("mouseleave",this.onPointerLeave.bind(this)),this.setTriggerElement(this._containerElement))}return e.prototype.fadeInRipple=function(e,t,n){var r=this;void 0===n&&(n={});var o=this._containerElement.getBoundingClientRect();n.centered&&(e=o.left+o.width/2,t=o.top+o.height/2);var i=n.radius||b(e,t,o),a=1/(n.speedFactor||1)*450,s=e-o.left,l=t-o.top,c=document.createElement("div");c.classList.add("mat-ripple-element"),c.style.left=s-i+"px",c.style.top=l-i+"px",c.style.height=2*i+"px",c.style.width=2*i+"px",c.style.backgroundColor=n.color||null,c.style.transitionDuration=a+"ms",this._containerElement.appendChild(c),f(c),c.style.transform="scale(1)";var p=new F(this,c,n);return p.state=S.FADING_IN,this._activeRipples.add(p),this.runTimeoutOutsideZone(function(){p.state=S.VISIBLE,n.persistent||r._isPointerDown||p.fadeOut()},a),p},e.prototype.fadeOutRipple=function(e){if(this._activeRipples.delete(e)){var t=e.element;t.style.transitionDuration="400ms",t.style.opacity="0",e.state=S.FADING_OUT,this.runTimeoutOutsideZone(function(){e.state=S.HIDDEN,t.parentNode.removeChild(t)},400)}},e.prototype.fadeOutAll=function(){this._activeRipples.forEach(function(e){return e.fadeOut()})},e.prototype.setTriggerElement=function(e){var t=this;this._triggerElement&&this._triggerEvents.forEach(function(e,n){t._triggerElement.removeEventListener(n,e)}),e&&this._ngZone.runOutsideAngular(function(){t._triggerEvents.forEach(function(t,n){return e.addEventListener(n,t)})}),this._triggerElement=e},e.prototype.onMousedown=function(e){this.rippleDisabled||(this._isPointerDown=!0,this.fadeInRipple(e.clientX,e.clientY,this.rippleConfig))},e.prototype.onPointerUp=function(){this._isPointerDown=!1,this._activeRipples.forEach(function(e){e.config.persistent||e.state!==S.VISIBLE||e.fadeOut()})},e.prototype.onPointerLeave=function(){this._isPointerDown&&this.onPointerUp()},e.prototype.onTouchstart=function(e){if(!this.rippleDisabled){var t=e.touches[0],n=t.clientX,r=t.clientY;this._isPointerDown=!0,this.fadeInRipple(n,r,this.rippleConfig)}},e.prototype.runTimeoutOutsideZone=function(e,t){void 0===t&&(t=0),this._ngZone.runOutsideAngular(function(){return setTimeout(e,t)})},e}(),A=new r.InjectionToken("mat-ripple-global-options"),j=function(){function e(e,t,n,r){this.radius=0,this.speedFactor=1,this._rippleRenderer=new N(e,t,n),this._globalOptions=r||{},this._updateRippleRenderer()}return e.prototype.ngOnChanges=function(e){(e.trigger||e._matRippleTrigger)&&this.trigger&&this._rippleRenderer.setTriggerElement(this.trigger),this._updateRippleRenderer()},e.prototype.ngOnDestroy=function(){this._rippleRenderer.setTriggerElement(null)},e.prototype.launch=function(e,t,n){return void 0===n&&(n=this.rippleConfig),this._rippleRenderer.fadeInRipple(e,t,n)},e.prototype.fadeOutAll=function(){this._rippleRenderer.fadeOutAll()},Object.defineProperty(e.prototype,"rippleConfig",{get:function(){return{centered:this.centered,speedFactor:this.speedFactor*(this._globalOptions.baseSpeedFactor||1),radius:this.radius,color:this.color}},enumerable:!0,configurable:!0}),e.prototype._updateRippleRenderer=function(){this._rippleRenderer.rippleDisabled=this._globalOptions.disabled||this.disabled,this._rippleRenderer.rippleConfig=this.rippleConfig},e.decorators=[{type:r.Directive,args:[{selector:"[mat-ripple], [matRipple]",exportAs:"matRipple",host:{class:"mat-ripple","[class.mat-ripple-unbounded]":"unbounded"}}]}],e.ctorParameters=function(){return[{type:r.ElementRef},{type:r.NgZone},{type:n.Platform},{type:void 0,decorators:[{type:r.Optional},{type:r.Inject,args:[A]}]}]},e.propDecorators={trigger:[{type:r.Input,args:["matRippleTrigger"]}],centered:[{type:r.Input,args:["matRippleCentered"]}],disabled:[{type:r.Input,args:["matRippleDisabled"]}],radius:[{type:r.Input,args:["matRippleRadius"]}],speedFactor:[{type:r.Input,args:["matRippleSpeedFactor"]}],color:[{type:r.Input,args:["matRippleColor"]}],unbounded:[{type:r.Input,args:["matRippleUnbounded"]}]},e}(),L=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{imports:[w,n.PlatformModule],exports:[j,w],declarations:[j]}]}],e.ctorParameters=function(){return[]},e}(),V=function(){function e(){}return e}(),W=h(V),q=0,B=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._labelId="mat-optgroup-label-"+q++,t}return u(t,e),t.decorators=[{type:r.Component,args:[{selector:"mat-optgroup",exportAs:"matOptgroup",template:'<label class="mat-optgroup-label" [id]="_labelId">{{ label }}</label><ng-content select="mat-option"></ng-content>',encapsulation:r.ViewEncapsulation.None,preserveWhitespaces:!1,changeDetection:r.ChangeDetectionStrategy.OnPush,inputs:["disabled"],host:{class:"mat-optgroup",role:"group","[class.mat-optgroup-disabled]":"disabled","[attr.aria-disabled]":"disabled.toString()","[attr.aria-labelledby]":"_labelId"}}]}],t.ctorParameters=function(){return[]},t.propDecorators={label:[{type:r.Input}]},t}(W),Y=0,H=function(){function e(e,t){void 0===t&&(t=!1),this.source=e,this.isUserInput=t}return e}(),U=(function(){function e(e,t,n){this._element=e,this._changeDetectorRef=t,this.group=n,this._selected=!1,this._active=!1,this._multiple=!1,this._disableRipple=!1,this._disabled=!1,this._id="mat-option-"+Y++,this.onSelectionChange=new r.EventEmitter}Object.defineProperty(e.prototype,"multiple",{get:function(){return this._multiple},set:function(e){e!==this._multiple&&(this._multiple=e,this._changeDetectorRef.markForCheck())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selected",{get:function(){return this._selected},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return this.group&&this.group.disabled||this._disabled},set:function(e){this._disabled=i.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"disableRipple",{get:function(){return this._disableRipple},set:function(e){this._disableRipple=e,this._changeDetectorRef.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"active",{get:function(){return this._active},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewValue",{get:function(){return(this._getHostElement().textContent||"").trim()},enumerable:!0,configurable:!0}),e.prototype.select=function(){this._selected=!0,this._changeDetectorRef.markForCheck(),this._emitSelectionChangeEvent()},e.prototype.deselect=function(){this._selected=!1,this._changeDetectorRef.markForCheck(),this._emitSelectionChangeEvent()},e.prototype.focus=function(){var e=this._getHostElement();"function"==typeof e.focus&&e.focus()},e.prototype.setActiveStyles=function(){this._active||(this._active=!0,this._changeDetectorRef.markForCheck())},e.prototype.setInactiveStyles=function(){this._active&&(this._active=!1,this._changeDetectorRef.markForCheck())},e.prototype.getLabel=function(){return this.viewValue},e.prototype._handleKeydown=function(e){e.keyCode!==c.ENTER&&e.keyCode!==c.SPACE||(this._selectViaInteraction(),e.preventDefault())},e.prototype._selectViaInteraction=function(){this.disabled||(this._selected=!this.multiple||!this._selected,this._changeDetectorRef.markForCheck(),this._emitSelectionChangeEvent(!0))},e.prototype._getTabIndex=function(){return this.disabled?"-1":"0"},e.prototype._getHostElement=function(){return this._element.nativeElement},e.prototype._emitSelectionChangeEvent=function(e){void 0===e&&(e=!1),this.onSelectionChange.emit(new H(this,e))},e.countGroupLabelsBeforeOption=function(e,t,n){if(n.length){for(var r=t.toArray(),o=n.toArray(),i=0,a=0;a<e+1;a++)r[a].group&&r[a].group===o[i]&&i++;return i}return 0},e.decorators=[{type:r.Component,args:[{selector:"mat-option",exportAs:"matOption",host:{role:"option","[attr.tabindex]":"_getTabIndex()","[class.mat-selected]":"selected","[class.mat-option-multiple]":"multiple","[class.mat-active]":"active","[id]":"id","[attr.aria-selected]":"selected.toString()","[attr.aria-disabled]":"disabled.toString()","[class.mat-option-disabled]":"disabled","(click)":"_selectViaInteraction()","(keydown)":"_handleKeydown($event)",class:"mat-option"},template:'<span *ngIf="multiple"><mat-pseudo-checkbox class="mat-option-pseudo-checkbox" [state]="selected ? \'checked\' : \'\'" [disabled]="disabled"></mat-pseudo-checkbox></span><span class="mat-option-text"><ng-content></ng-content></span><div class="mat-option-ripple" mat-ripple [matRippleTrigger]="_getHostElement()" [matRippleDisabled]="disabled || disableRipple"></div>',encapsulation:r.ViewEncapsulation.None,preserveWhitespaces:!1,changeDetection:r.ChangeDetectionStrategy.OnPush}]}],e.ctorParameters=function(){return[{type:r.ElementRef},{type:r.ChangeDetectorRef},{type:B,decorators:[{type:r.Optional}]}]},e.propDecorators={value:[{type:r.Input}],disabled:[{type:r.Input}],onSelectionChange:[{type:r.Output}]}}(),new r.InjectionToken("mat-placeholder-global-options"),0),G={provide:d.NG_VALUE_ACCESSOR,useExisting:r.forwardRef(function(){return $}),multi:!0},z=function(){function e(){}return e}(),J=function(){function e(e,t){this._renderer=e,this._elementRef=t}return e}(),Z=function(e,t){return void 0===t&&(t=0),function(e){function n(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=e.apply(this,n)||this;return o._tabIndex=t,o}return u(n,e),Object.defineProperty(n.prototype,"tabIndex",{get:function(){return this.disabled?-1:this._tabIndex},set:function(e){this._tabIndex=null!=e?e:t},enumerable:!0,configurable:!0}),n}(e)}(function(e,t){return function(e){function n(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=e.apply(this,n)||this;return o.color=t,o}return u(n,e),Object.defineProperty(n.prototype,"color",{get:function(){return this._color},set:function(e){var n=e||t;n!==this._color&&(this._color&&this._renderer.removeClass(this._elementRef.nativeElement,"mat-"+this._color),n&&this._renderer.addClass(this._elementRef.nativeElement,"mat-"+n),this._color=n)},enumerable:!0,configurable:!0}),n}(e)}(function(e){return function(e){function t(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=e.apply(this,t)||this;return r._disableRipple=!1,r}return u(t,e),Object.defineProperty(t.prototype,"disableRipple",{get:function(){return this._disableRipple},set:function(e){this._disableRipple=i.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),t}(e)}(h(J)),"accent")),$=function(e){function t(t,n,o,i,a,s){var l=e.call(this,n,t)||this;return l._platform=o,l._focusMonitor=i,l._changeDetectorRef=a,l.onChange=function(e){},l.onTouched=function(){},l._uniqueId="mat-slide-toggle-"+ ++U,l._required=!1,l._checked=!1,l.name=null,l.id=l._uniqueId,l.labelPosition="after",l.ariaLabel=null,l.ariaLabelledby=null,l.change=new r.EventEmitter,l.tabIndex=parseInt(s)||0,l}return u(t,e),Object.defineProperty(t.prototype,"required",{get:function(){return this._required},set:function(e){this._required=i.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"checked",{get:function(){return this._checked},set:function(e){this._checked=!!e,this._changeDetectorRef.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputId",{get:function(){return(this.id||this._uniqueId)+"-input"},enumerable:!0,configurable:!0}),t.prototype.ngAfterContentInit=function(){var e=this;this._slideRenderer=new X(this._elementRef,this._platform),this._focusMonitor.monitor(this._inputElement.nativeElement,this._renderer,!1).subscribe(function(t){return e._onInputFocusChange(t)})},t.prototype.ngOnDestroy=function(){this._focusMonitor.stopMonitoring(this._inputElement.nativeElement)},t.prototype._onChangeEvent=function(e){e.stopPropagation(),this.checked=this._inputElement.nativeElement.checked,this._emitChangeEvent()},t.prototype._onInputClick=function(e){this._slideRenderer.dragging&&e.preventDefault(),e.stopPropagation()},t.prototype.writeValue=function(e){this.checked=!!e},t.prototype.registerOnChange=function(e){this.onChange=e},t.prototype.registerOnTouched=function(e){this.onTouched=e},t.prototype.setDisabledState=function(e){this.disabled=e,this._changeDetectorRef.markForCheck()},t.prototype.focus=function(){this._focusMonitor.focusVia(this._inputElement.nativeElement,"keyboard")},t.prototype.toggle=function(){this.checked=!this.checked},t.prototype._onInputFocusChange=function(e){this._focusRipple||"keyboard"!==e?e||(this.onTouched(),this._focusRipple&&(this._focusRipple.fadeOut(),this._focusRipple=null)):this._focusRipple=this._ripple.launch(0,0,{persistent:!0,centered:!0})},t.prototype._emitChangeEvent=function(){var e=new z;e.source=this,e.checked=this.checked,this.onChange(this.checked),this.change.emit(e)},t.prototype._onDragStart=function(){this.disabled||this._slideRenderer.startThumbDrag(this.checked)},t.prototype._onDrag=function(e){this._slideRenderer.dragging&&this._slideRenderer.updateThumbPosition(e.deltaX)},t.prototype._onDragEnd=function(){var e=this;if(this._slideRenderer.dragging){var t=this.checked;this.checked=this._slideRenderer.dragPercentage>50,t!==this.checked&&this._emitChangeEvent(),setTimeout(function(){return e._slideRenderer.stopThumbDrag()})}},t.prototype._onLabelTextChange=function(){this._changeDetectorRef.markForCheck()},t.decorators=[{type:r.Component,args:[{selector:"mat-slide-toggle",host:{class:"mat-slide-toggle","[id]":"id","[class.mat-checked]":"checked","[class.mat-disabled]":"disabled","[class.mat-slide-toggle-label-before]":'labelPosition == "before"'},template:'<label class="mat-slide-toggle-label" #label><div class="mat-slide-toggle-bar" [class.mat-slide-toggle-bar-no-side-margin]="!labelContent.textContent || !labelContent.textContent.trim()"><input #input class="mat-slide-toggle-input cdk-visually-hidden" type="checkbox" [id]="inputId" [required]="required" [tabIndex]="tabIndex" [checked]="checked" [disabled]="disabled" [attr.name]="name" [attr.aria-label]="ariaLabel" [attr.aria-labelledby]="ariaLabelledby" (change)="_onChangeEvent($event)" (click)="_onInputClick($event)"><div class="mat-slide-toggle-thumb-container" (slidestart)="_onDragStart()" (slide)="_onDrag($event)" (slideend)="_onDragEnd()"><div class="mat-slide-toggle-thumb"></div><div class="mat-slide-toggle-ripple" mat-ripple [matRippleTrigger]="label" [matRippleCentered]="true" [matRippleDisabled]="disableRipple || disabled"></div></div></div><span class="mat-slide-toggle-content" #labelContent (cdkObserveContent)="_onLabelTextChange()"><ng-content></ng-content></span></label>',styles:[".mat-slide-toggle{display:inline-block;height:24px;line-height:24px;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:0}.mat-slide-toggle.mat-checked .mat-slide-toggle-thumb-container{transform:translate3d(16px,0,0)}.mat-slide-toggle.mat-disabled .mat-slide-toggle-label,.mat-slide-toggle.mat-disabled .mat-slide-toggle-thumb-container{cursor:default}.mat-slide-toggle-label{display:flex;flex:1;flex-direction:row;align-items:center;cursor:pointer}.mat-slide-toggle-label-before .mat-slide-toggle-label{order:1}.mat-slide-toggle-label-before .mat-slide-toggle-bar{order:2}.mat-slide-toggle-bar,[dir=rtl] .mat-slide-toggle-label-before .mat-slide-toggle-bar{margin-right:8px;margin-left:0}.mat-slide-toggle-label-before .mat-slide-toggle-bar,[dir=rtl] .mat-slide-toggle-bar{margin-left:8px;margin-right:0}.mat-slide-toggle-bar-no-side-margin{margin-left:0;margin-right:0}.mat-slide-toggle-thumb-container{position:absolute;z-index:1;width:20px;height:20px;top:-3px;left:0;transform:translate3d(0,0,0);transition:all 80ms linear;transition-property:transform;cursor:-webkit-grab;cursor:grab}.mat-slide-toggle-thumb-container.mat-dragging,.mat-slide-toggle-thumb-container:active{cursor:-webkit-grabbing;cursor:grabbing;transition-duration:0s}.mat-slide-toggle-thumb{height:20px;width:20px;border-radius:50%;box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12)}@media screen and (-ms-high-contrast:active){.mat-slide-toggle-thumb{background:#fff;border:solid 1px #000}}.mat-slide-toggle-bar{position:relative;width:36px;height:14px;border-radius:8px}@media screen and (-ms-high-contrast:active){.mat-slide-toggle-bar{background:#fff}}.mat-slide-toggle-input{bottom:0;left:10px}.mat-slide-toggle-bar,.mat-slide-toggle-thumb{transition:all 80ms linear;transition-property:background-color;transition-delay:50ms}.mat-slide-toggle-ripple{position:absolute;top:-13px;left:-13px;height:46px;width:46px;border-radius:50%;z-index:1;pointer-events:none}"],providers:[G],inputs:["disabled","disableRipple","color","tabIndex"],encapsulation:r.ViewEncapsulation.None,preserveWhitespaces:!1,changeDetection:r.ChangeDetectionStrategy.OnPush}]}],t.ctorParameters=function(){return[{type:r.ElementRef},{type:r.Renderer2},{type:n.Platform},{type:p.FocusMonitor},{type:r.ChangeDetectorRef},{type:void 0,decorators:[{type:r.Attribute,args:["tabindex"]}]}]},t.propDecorators={name:[{type:r.Input}],id:[{type:r.Input}],labelPosition:[{type:r.Input}],ariaLabel:[{type:r.Input,args:["aria-label"]}],ariaLabelledby:[{type:r.Input,args:["aria-labelledby"]}],required:[{type:r.Input}],checked:[{type:r.Input}],change:[{type:r.Output}],_inputElement:[{type:r.ViewChild,args:["input"]}],_ripple:[{type:r.ViewChild,args:[j]}]},t}(Z),X=function(){function e(e,t){this.dragging=!1,
t.isBrowser&&(this._thumbEl=e.nativeElement.querySelector(".mat-slide-toggle-thumb-container"),this._thumbBarEl=e.nativeElement.querySelector(".mat-slide-toggle-bar"))}return e.prototype.startThumbDrag=function(e){this.dragging||(this._thumbBarWidth=this._thumbBarEl.clientWidth-this._thumbEl.clientWidth,this._thumbEl.classList.add("mat-dragging"),this._previousChecked=e,this.dragging=!0)},e.prototype.stopThumbDrag=function(){return!!this.dragging&&(this.dragging=!1,this._thumbEl.classList.remove("mat-dragging"),y(this._thumbEl,""),this.dragPercentage>50)},e.prototype.updateThumbPosition=function(e){this.dragPercentage=this._getDragPercentage(e);var t=this.dragPercentage/100*this._thumbBarWidth;y(this._thumbEl,"translate3d("+t+"px, 0, 0)")},e.prototype._getDragPercentage=function(e){var t=e/this._thumbBarWidth*100;return this._previousChecked&&(t+=100),Math.max(0,Math.min(t,100))},e}(),K=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{imports:[L,w,n.PlatformModule,t.ObserversModule,p.A11yModule],exports:[$,w],declarations:[$],providers:[{provide:s.HAMMER_GESTURE_CONFIG,useClass:P}]}]}],e.ctorParameters=function(){return[]},e}();e.MatSlideToggleModule=K,e.MAT_SLIDE_TOGGLE_VALUE_ACCESSOR=G,e.MatSlideToggleChange=z,e.MatSlideToggleBase=J,e._MatSlideToggleMixinBase=Z,e.MatSlideToggle=$,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=/Users/karakara/repos/material2/dist/bundles/material-slide-toggle.umd.min.js.map