text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("@hyperblob/ngx-wheel-selector",["exports","@angular/core","@angular/common"],t):t(((e=e||self).hyperblob=e.hyperblob||{},e.hyperblob["ngx-wheel-selector"]={}),e.ng.core,e.ng.common)}(this,function(e,t,n){"use strict";function r(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function i(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}var o=function(){function e(e){this.data=[],this.change=new t.EventEmitter,this.touchOrMouse={isTouchable:"ontouchstart"in window,isMouseDown:!1},this.draggingInfo={isDragging:!1,groupIndex:null,startPageY:null},this.itemPerDegree=23,this.safeDoTimeoutId=null}var n,o;return e.prototype.ngOnInit=function(){this.currentIndexList=this.getInitialCurrentIndexList(),this.lastCurrentIndexList=[].concat(this.currentIndexList),this.groupsRectList=new Array(this.data.length),this.eventsRegister(),window.addEventListener("resize",this.safeGetRectsBindEvents.bind(this))},e.prototype.ngAfterViewInit=function(){this.getGroupsRectList()},e.prototype.ngOnDestroy=function(){window.removeEventListener("resize",this.safeGetRectsBindEvents.bind(this))},e.prototype.setGroupData=function(e,t){this.currentIndexList||(this.currentIndexList=this.getInitialCurrentIndexList()),this.data[e]=t;var n=t.currentIndex,r=0;"number"==typeof n&&n>=0&&t.list&&t.list.length&&n<=t.list.length-1&&(r=Math.round(n)),this.currentIndexList[e]=r,this.lastCurrentIndexList=[].concat(this.currentIndexList)},e.prototype.getInitialCurrentIndexList=function(){return this.data.map(function(e,t){var n=e.currentIndex;return"number"==typeof n&&n>=0&&e.list&&e.list.length&&n<=e.list.length-1?Math.round(n):0})},e.prototype.safeGetRectsBindEvents=function(){var e=this;this.safeDoTimeoutId&&clearTimeout(this.safeDoTimeoutId),this.safeDoTimeoutId=setTimeout(function(){e.getGroupsRectList()},200)},e.prototype.getGroupsRectList=function(){var e=this;this.pickerGroupLayer&&this.pickerGroupLayer.toArray().forEach(function(t,n){e.groupsRectList[n]=t.nativeElement.getBoundingClientRect()})},e.prototype.eventsRegister=function(){var e=this.pickerHandleLayer.nativeElement;e&&this.addEventsForElement(e)},e.prototype.addEventsForElement=function(e){var t=this,n=this.touchOrMouse.isTouchable,r=[{name:n?"touchstart":"mousedown",handler:this.handleStart},{name:n?"touchmove":"mousemove",handler:this.handleMove},{name:n?"touchend":"mouseup",handler:this.handleEnd},{name:n?"touchcancel":"mouseleave",handler:this.handleCancel}];n||r.push({name:"wheel",handler:this.handleWheel}),r.forEach(function(n,r){e.removeEventListener(n.name,n.handler,!1),e.addEventListener(n.name,n.handler.bind(t),!1)})},e.prototype.triggerMiddleLayerGroupClick=function(e){var t=this.data;"number"==typeof e&&"function"==typeof t[e].onClick&&t[e].onClick(e,this.currentIndexList[e])},e.prototype.triggerAboveLayerClick=function(e,t){var n=this.currentIndexList[t]+1;this.currentIndexList[t]=n,this.correctionCurrentIndex(e,t)},e.prototype.triggerMiddleLayerClick=function(e,t){this.triggerMiddleLayerGroupClick(t)},e.prototype.triggerBelowLayerClick=function(e,t){var n=this.currentIndexList[t]-1;this.currentIndexList[t]=n,this.correctionCurrentIndex(e,t)},e.prototype.getTouchInfo=function(e){return this.touchOrMouse.isTouchable?e.changedTouches[0]||e.touches[0]:e},e.prototype.getGroupIndexBelongsEvent=function(e){for(var t=this.getTouchInfo(e),n=0;n<this.groupsRectList.length;n++){var r=this.groupsRectList[n];if(r.left<t.pageX&&t.pageX<r.right)return n}return null},e.prototype.handleEventClick=function(e){var t=this.getGroupIndexBelongsEvent(e);switch(e.target.dataset.type){case"top":this.triggerAboveLayerClick(e,t);break;case"middle":this.triggerMiddleLayerClick(e,t);break;case"bottom":this.triggerBelowLayerClick(e,t)}},e.prototype.handleStart=function(e){e.cancelable&&(e.preventDefault(),e.stopPropagation());var t=this.getTouchInfo(e);this.draggingInfo.startPageY=t.pageY,this.touchOrMouse.isTouchable||(this.touchOrMouse.isMouseDown=!0)},e.prototype.handleMove=function(e){e.preventDefault(),e.stopPropagation(),(this.touchOrMouse.isTouchable||this.touchOrMouse.isMouseDown)&&(this.draggingInfo.isDragging=!0,this.setCurrentIndexOnMove(e))},e.prototype.handleEnd=function(e){e.preventDefault(),e.stopPropagation(),this.draggingInfo.isDragging||this.handleEventClick(e),this.draggingInfo.isDragging=!1,this.touchOrMouse.isMouseDown=!1,this.correctionAfterDragging(e)},e.prototype.handleCancel=function(e){e.preventDefault(),e.stopPropagation(),(this.touchOrMouse.isTouchable||this.touchOrMouse.isMouseDown)&&(this.correctionAfterDragging(e),this.touchOrMouse.isMouseDown=!1,this.draggingInfo.isDragging=!1)},e.prototype.handleWheel=function(e){this.setCurrentIndexOnWheel(e),this.correctionAfterDragging(e)},e.prototype.setCurrentIndexOnWheel=function(e){var t=this.getGroupIndexBelongsEvent(e);if("number"!=typeof t||!this.data[t].divider&&this.data[t].list){var n=this.currentIndexList[t]+e.deltaY/53;this.currentIndexList[t]=n,this.correctionCurrentIndex(e,t)}},e.prototype.setCurrentIndexOnMove=function(e){var t=this.getTouchInfo(e);null===this.draggingInfo.groupIndex&&(this.draggingInfo.groupIndex=this.getGroupIndexBelongsEvent(e));var n=this.draggingInfo.groupIndex;if("number"!=typeof n||!this.data[n].divider&&this.data[n].list){var r=(this.draggingInfo.startPageY-t.pageY)/32,i=this.currentIndexList[n]+r;this.currentIndexList[n]=i,this.draggingInfo.startPageY=t.pageY}},e.prototype.correctionAfterDragging=function(e){var t=this.draggingInfo.groupIndex;this.correctionCurrentIndex(e,t),this.draggingInfo.groupIndex=null,this.draggingInfo.startPageY=null},e.prototype.correctionCurrentIndex=function(e,t){var n=this;setTimeout(function(){if("number"==typeof t&&!0!==n.data[t].divider&&n.data[t].list.length>0){var e=n.currentIndexList[t],r=e;e>n.data[t].list.length-1?r=n.data[t].list.length-1:e<0&&(r=0),r=Math.round(r),n.currentIndexList[t]=r,r!==n.lastCurrentIndexList[t]&&n.change.emit({gIndex:t,iIndex:r}),n.lastCurrentIndexList=[].concat(n.currentIndexList)}},100)},e.prototype.isCurrentItem=function(e,t){return this.currentIndexList[e]===t},e.prototype.getCurrentIndexList=function(){return this.currentIndexList},e.prototype.getGroupClass=function(e){var t=this.data[e],n=["weight-"+(t.weight||1)];return t.className&&n.push(t.className),n},e.prototype.getItemClass=function(e,t,n){void 0===n&&(n=!1);var r=this.data[e],i=[];return!n&&this.isCurrentItem(e,t)&&i.push("smooth-item-selected"),r.textAlign&&i.push("text-"+r.textAlign),i},e.prototype.getItemStyle=function(e,t){var n=this.currentIndexList[e]-t;if(Math.abs(n)<90/this.itemPerDegree){var r={transform:"rotateX("+n*this.itemPerDegree+"deg) translate3d(0, 0, 5.625em)",opacity:(1-Math.abs(n)/(90/this.itemPerDegree)).toString()};return this.draggingInfo.isDragging||(r.transition="transform 150ms ease-out"),r}return n>0?{transform:"rotateX(90deg) translate3d(0, 0, 5.625em)"}:{transform:"rotateX(-90deg) translate3d(0, 0, 5.625em)"}},r([t.ViewChildren("pickerGroupLayer"),i("design:type",Object)],e.prototype,"pickerGroupLayer",void 0),r([t.ViewChild("pickerHandleLayer"),i("design:type",Object)],e.prototype,"pickerHandleLayer",void 0),r([t.Input(),i("design:type",Array)],e.prototype,"data",void 0),r([t.Output(),i("design:type",t.EventEmitter)],e.prototype,"change",void 0),e=r([t.Component({selector:"ngx-wheel-selector",template:'<div class="ng-data-picker flex-box">\n\n  \x3c!-- picker-group-layer --\x3e\n  <div #pickerGroupLayer *ngFor="let group of data; let gIndex = index"\n    class="picker-group" [ngClass]="getGroupClass(gIndex)">\n\n    <div class="picker-list">\n      <ng-container *ngFor="let item of group.list; let iIndex = index">\n        <div *ngIf="group.divider else ngIfElse"\n          class="picker-item divider" [ngClass]="getItemClass(gIndex, iIndex, true)">\n          {{ group.text }}\n        </div>\n  \n        <ng-template #ngIfElse>\n          <div \n            class="picker-item" [ngClass]="getItemClass(gIndex, iIndex)" [ngStyle]="getItemStyle(gIndex, iIndex)">\n            {{ item.value || item }}\n          </div>\n        </ng-template>\n      </ng-container>\n    </div>\n\n  </div>\n\n  <div #pickerHandleLayer class="picker-handle-layer flex-box dir-column">\n    <div data-type="top" class="picker-top weight-1"></div>\n    <div data-type="middle" class="picker-middle"></div>\n    <div data-type="bottom" class="picker-bottom weight-1"></div>\n  </div>\n\n</div>',styles:[".ng-data-picker{font-size:1rem;height:10em;position:relative;background-color:#fff;overflow:hidden}.ng-data-picker.black{color:#fff}.ng-data-picker .picker-item{position:absolute;top:0;left:0;overflow:hidden;width:100%;text-overflow:ellipsis;white-space:nowrap;display:block;text-align:center;will-change:transform;contain:strict;height:2em;line-height:2;font-size:1em}.ng-data-picker .picker-list{height:6.25em;position:relative;top:4em}.ng-data-picker .picker-handle-layer{position:absolute;width:100%;height:calc(100% + 2px);left:0;right:0;top:-1px;bottom:-1px}.ng-data-picker .picker-handle-layer .picker-top{border-bottom:.55px solid rgba(74,73,89,.5);background:linear-gradient(to bottom,#fff 2%,rgba(255,255,255,.1) 100%);-webkit-transform:translate3d(0,0,5.625em);transform:translate3d(0,0,5.625em)}.ng-data-picker .picker-handle-layer .picker-middle{height:2em}.ng-data-picker .picker-handle-layer .picker-bottom{border-top:.55px solid rgba(74,73,89,.5);background:linear-gradient(to top,#fff 2%,rgba(255,255,255,.1) 100%);-webkit-transform:translate3d(0,0,5.625em);transform:translate3d(0,0,5.625em)}.flex-box{display:flex}.flex-box.dir-column{flex-direction:column}.flex-box.dir-row{flex-direction:row}.flex-box .weight-1{flex:1}.flex-box .weight-2{flex:2}.flex-box .weight-3{flex:3}.flex-box .weight-4{flex:4}.flex-box .weight-5{flex:5}.flex-box .weight-6{flex:6}.flex-box .weight-7{flex:7}.flex-box .weight-8{flex:8}.flex-box .weight-9{flex:9}.flex-box .weight-10{flex:10}.flex-box .weight-11{flex:11}.flex-box .weight-12{flex:12}"]}),(n=0,o=t.Inject(t.ElementRef),function(e,t){o(e,t,n)}),i("design:paramtypes",[t.ElementRef])],e)}(),s=function(){function e(){}return e=r([t.NgModule({imports:[n.CommonModule],declarations:[o],exports:[o]})],e)}();e.WheelSelectorComponent=o,e.WheelSelectorModule=s,Object.defineProperty(e,"__esModule",{value:!0})});
  //# sourceMappingURL=hyperblob-ngx-wheel-selector.umd.min.js.map