import { NgModule, Component, Input, Output, EventEmitter, forwardRef, ViewChild, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DomHandler } from 'primeng/dom';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
export const SLIDER_VALUE_ACCESSOR = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => Slider),
multi: true
};
export class Slider {
constructor(el, renderer, ngZone, cd) {
this.el = el;
this.renderer = renderer;
this.ngZone = ngZone;
this.cd = cd;
this.min = 0;
this.max = 100;
this.orientation = 'horizontal';
this.tabindex = 0;
this.onChange = new EventEmitter();
this.onSlideEnd = new EventEmitter();
this.handleValues = [];
this.onModelChange = () => { };
this.onModelTouched = () => { };
this.handleIndex = 0;
}
onMouseDown(event, index) {
if (this.disabled) {
return;
}
this.dragging = true;
this.updateDomData();
this.sliderHandleClick = true;
if (this.range && this.handleValues && this.handleValues[0] === this.max) {
this.handleIndex = 0;
}
else {
this.handleIndex = index;
}
this.bindDragListeners();
event.target.focus();
event.preventDefault();
if (this.animate) {
DomHandler.removeClass(this.el.nativeElement.children[0], 'p-slider-animate');
}
}
onTouchStart(event, index) {
if (this.disabled) {
return;
}
var touchobj = event.changedTouches[0];
this.startHandleValue = (this.range) ? this.handleValues[index] : this.handleValue;
this.dragging = true;
if (this.range && this.handleValues && this.handleValues[0] === this.max) {
this.handleIndex = 0;
}
else {
this.handleIndex = index;
}
if (this.orientation === 'horizontal') {
this.startx = parseInt(touchobj.clientX, 10);
this.barWidth = this.el.nativeElement.children[0].offsetWidth;
}
else {
this.starty = parseInt(touchobj.clientY, 10);
this.barHeight = this.el.nativeElement.children[0].offsetHeight;
}
if (this.animate) {
DomHandler.removeClass(this.el.nativeElement.children[0], 'p-slider-animate');
}
event.preventDefault();
}
onTouchMove(event, index) {
if (this.disabled) {
return;
}
var touchobj = event.changedTouches[0], handleValue = 0;
if (this.orientation === 'horizontal') {
handleValue = Math.floor(((parseInt(touchobj.clientX, 10) - this.startx) * 100) / (this.barWidth)) + this.startHandleValue;
}
else {
handleValue = Math.floor(((this.starty - parseInt(touchobj.clientY, 10)) * 100) / (this.barHeight)) + this.startHandleValue;
}
this.setValueFromHandle(event, handleValue);
event.preventDefault();
}
onTouchEnd(event, index) {
if (this.disabled) {
return;
}
this.dragging = false;
if (this.range)
this.onSlideEnd.emit({ originalEvent: event, values: this.values });
else
this.onSlideEnd.emit({ originalEvent: event, value: this.value });
if (this.animate) {
DomHandler.addClass(this.el.nativeElement.children[0], 'p-slider-animate');
}
event.preventDefault();
}
onBarClick(event) {
if (this.disabled) {
return;
}
if (!this.sliderHandleClick) {
this.updateDomData();
this.handleChange(event);
}
this.sliderHandleClick = false;
}
onHandleKeydown(event, handleIndex) {
if (this.disabled) {
return;
}
if (event.which == 38 || event.which == 39) {
this.spin(event, 1, handleIndex);
}
else if (event.which == 37 || event.which == 40) {
this.spin(event, -1, handleIndex);
}
}
spin(event, dir, handleIndex) {
let step = (this.step || 1) * dir;
if (this.range) {
this.handleIndex = handleIndex;
this.updateValue(this.values[this.handleIndex] + step);
this.updateHandleValue();
}
else {
this.updateValue(this.value + step);
this.updateHandleValue();
}
event.preventDefault();
}
handleChange(event) {
let handleValue = this.calculateHandleValue(event);
this.setValueFromHandle(event, handleValue);
}
bindDragListeners() {
this.ngZone.runOutsideAngular(() => {
const documentTarget = this.el ? this.el.nativeElement.ownerDocument : 'document';
if (!this.dragListener) {
this.dragListener = this.renderer.listen(documentTarget, 'mousemove', (event) => {
if (this.dragging) {
this.ngZone.run(() => {
this.handleChange(event);
});
}
});
}
if (!this.mouseupListener) {
this.mouseupListener = this.renderer.listen(documentTarget, 'mouseup', (event) => {
if (this.dragging) {
this.dragging = false;
this.ngZone.run(() => {
if (this.range)
this.onSlideEnd.emit({ originalEvent: event, values: this.values });
else
this.onSlideEnd.emit({ originalEvent: event, value: this.value });
if (this.animate) {
DomHandler.addClass(this.el.nativeElement.children[0], 'p-slider-animate');
}
});
}
});
}
});
}
unbindDragListeners() {
if (this.dragListener) {
this.dragListener();
}
if (this.mouseupListener) {
this.mouseupListener();
}
}
setValueFromHandle(event, handleValue) {
this.sliderHandleClick = false;
let newValue = this.getValueFromHandle(handleValue);
if (this.range) {
if (this.step) {
this.handleStepChange(newValue, this.values[this.handleIndex]);
}
else {
this.handleValues[this.handleIndex] = handleValue;
this.updateValue(newValue, event);
}
}
else {
if (this.step) {
this.handleStepChange(newValue, this.value);
}
else {
this.handleValue = handleValue;
this.updateValue(newValue, event);
}
}
this.cd.markForCheck();
}
handleStepChange(newValue, oldValue) {
let diff = (newValue - oldValue);
let val = oldValue;
if (diff < 0) {
val = oldValue + Math.ceil(newValue / this.step - oldValue / this.step) * this.step;
}
else if (diff > 0) {
val = oldValue + Math.floor(newValue / this.step - oldValue / this.step) * this.step;
}
this.updateValue(val);
this.updateHandleValue();
}
writeValue(value) {
if (this.range)
this.values = value || [0, 0];
else
this.value = value || 0;
this.updateHandleValue();
this.cd.markForCheck();
}
registerOnChange(fn) {
this.onModelChange = fn;
}
registerOnTouched(fn) {
this.onModelTouched = fn;
}
setDisabledState(val) {
this.disabled = val;
this.cd.markForCheck();
}
get rangeStartLeft() {
return this.isVertical() ? 'auto' : this.handleValues[0] + '%';
}
get rangeStartBottom() {
return this.isVertical() ? this.handleValues[0] + '%' : 'auto';
}
get rangeEndLeft() {
return this.isVertical() ? 'auto' : this.handleValues[1] + '%';
}
get rangeEndBottom() {
return this.isVertical() ? this.handleValues[1] + '%' : 'auto';
}
isVertical() {
return this.orientation === 'vertical';
}
updateDomData() {
let rect = this.el.nativeElement.children[0].getBoundingClientRect();
this.initX = rect.left + DomHandler.getWindowScrollLeft();
this.initY = rect.top + DomHandler.getWindowScrollTop();
this.barWidth = this.el.nativeElement.children[0].offsetWidth;
this.barHeight = this.el.nativeElement.children[0].offsetHeight;
}
calculateHandleValue(event) {
if (this.orientation === 'horizontal')
return ((event.pageX - this.initX) * 100) / (this.barWidth);
else
return (((this.initY + this.barHeight) - event.pageY) * 100) / (this.barHeight);
}
updateHandleValue() {
if (this.range) {
this.handleValues[0] = (this.values[0] < this.min ? 0 : this.values[0] - this.min) * 100 / (this.max - this.min);
this.handleValues[1] = (this.values[1] > this.max ? 100 : this.values[1] - this.min) * 100 / (this.max - this.min);
}
else {
if (this.value < this.min)
this.handleValue = 0;
else if (this.value > this.max)
this.handleValue = 100;
else
this.handleValue = (this.value - this.min) * 100 / (this.max - this.min);
}
}
updateValue(val, event) {
if (this.range) {
let value = val;
if (this.handleIndex == 0) {
if (value < this.min) {
value = this.min;
this.handleValues[0] = 0;
}
else if (value > this.values[1]) {
value = this.values[1];
this.handleValues[0] = this.handleValues[1];
}
this.sliderHandleStart.nativeElement.focus();
}
else {
if (value > this.max) {
value = this.max;
this.handleValues[1] = 100;
}
else if (value < this.values[0]) {
value = this.values[0];
this.handleValues[1] = this.handleValues[0];
}
this.sliderHandleEnd.nativeElement.focus();
}
this.values[this.handleIndex] = this.getNormalizedValue(value);
this.values = this.values.slice();
this.onModelChange(this.values);
this.onChange.emit({ event: event, values: this.values });
}
else {
if (val < this.min) {
val = this.min;
this.handleValue = 0;
}
else if (val > this.max) {
val = this.max;
this.handleValue = 100;
}
this.value = this.getNormalizedValue(val);
this.onModelChange(this.value);
this.onChange.emit({ event: event, value: this.value });
this.sliderHandle.nativeElement.focus();
}
}
getValueFromHandle(handleValue) {
return (this.max - this.min) * (handleValue / 100) + this.min;
}
getDecimalsCount(value) {
if (value && Math.floor(value) !== value)
return value.toString().split(".")[1].length || 0;
return 0;
}
getNormalizedValue(val) {
let decimalsCount = this.getDecimalsCount(this.step);
if (decimalsCount > 0) {
return +val.toFixed(decimalsCount);
}
else {
return Math.floor(val);
}
}
ngOnDestroy() {
this.unbindDragListeners();
}
}
Slider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Slider, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
Slider.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: Slider, selector: "p-slider", inputs: { animate: "animate", disabled: "disabled", min: "min", max: "max", orientation: "orientation", step: "step", range: "range", style: "style", styleClass: "styleClass", ariaLabelledBy: "ariaLabelledBy", tabindex: "tabindex" }, outputs: { onChange: "onChange", onSlideEnd: "onSlideEnd" }, host: { classAttribute: "p-element" }, providers: [SLIDER_VALUE_ACCESSOR], viewQueries: [{ propertyName: "sliderHandle", first: true, predicate: ["sliderHandle"], descendants: true }, { propertyName: "sliderHandleStart", first: true, predicate: ["sliderHandleStart"], descendants: true }, { propertyName: "sliderHandleEnd", first: true, predicate: ["sliderHandleEnd"], descendants: true }], ngImport: i0, template: `
`, isInline: true, styles: [".p-slider{position:relative}.p-slider .p-slider-handle{position:absolute;cursor:grab;touch-action:none;display:block}.p-slider-range{position:absolute;display:block}.p-slider-horizontal .p-slider-range{top:0;left:0;height:100%}.p-slider-horizontal .p-slider-handle{top:50%}.p-slider-vertical{height:100px}.p-slider-vertical .p-slider-handle{left:50%}.p-slider-vertical .p-slider-range{bottom:0;left:0;width:100%}\n"], directives: [{ type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Slider, decorators: [{
type: Component,
args: [{ selector: 'p-slider', template: `
`, providers: [SLIDER_VALUE_ACCESSOR], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
'class': 'p-element'
}, styles: [".p-slider{position:relative}.p-slider .p-slider-handle{position:absolute;cursor:grab;touch-action:none;display:block}.p-slider-range{position:absolute;display:block}.p-slider-horizontal .p-slider-range{top:0;left:0;height:100%}.p-slider-horizontal .p-slider-handle{top:50%}.p-slider-vertical{height:100px}.p-slider-vertical .p-slider-handle{left:50%}.p-slider-vertical .p-slider-range{bottom:0;left:0;width:100%}\n"] }]
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { animate: [{
type: Input
}], disabled: [{
type: Input
}], min: [{
type: Input
}], max: [{
type: Input
}], orientation: [{
type: Input
}], step: [{
type: Input
}], range: [{
type: Input
}], style: [{
type: Input
}], styleClass: [{
type: Input
}], ariaLabelledBy: [{
type: Input
}], tabindex: [{
type: Input
}], onChange: [{
type: Output
}], onSlideEnd: [{
type: Output
}], sliderHandle: [{
type: ViewChild,
args: ["sliderHandle"]
}], sliderHandleStart: [{
type: ViewChild,
args: ["sliderHandleStart"]
}], sliderHandleEnd: [{
type: ViewChild,
args: ["sliderHandleEnd"]
}] } });
export class SliderModule {
}
SliderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: SliderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
SliderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: SliderModule, declarations: [Slider], imports: [CommonModule], exports: [Slider] });
SliderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: SliderModule, imports: [[CommonModule]] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: SliderModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule],
exports: [Slider],
declarations: [Slider]
}]
}] });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xpZGVyLmpzIiwic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AgICAgIHRoaXMuZHJhZ2dpbmcgPSB0cnVlO1xuICAgICAgICBpZiAodGhpcy5yYW5nZSAmJiB0aGlzLmhhbmRsZVZhbHVlcyAmJiB0aGlzLmhhbmRsZVZhbHVlc1swXSA9PT0gdGhpcy5tYXgpIHtcbiAgICAgICAgICAgIHRoaXMuaGFuZGxlSW5kZXggPSAwO1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5oYW5kbGVJbmRleCA9IGluZGV4O1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHRoaXMub3JpZW50YXRpb24gPT09ICdob3Jpem9udGFsJykge1xuICAgICAgICAgICAgdGhpcy5zdGFydHggPSBwYXJzZUludCh0b3VjaG9iai5jbGllbnRYLCAxMCk7XG4gICAgICAgICAgICB0aGlzLmJhcldpZHRoID0gdGhpcy5lbC5uYXRpdmVFbGVtZW50LmNoaWxkcmVuWzBdLm9mZnNldFdpZHRoO1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5zdGFydHkgPSBwYXJzZUludCh0b3VjaG9iai5jbGllbnRZLCAxMCk7XG4gICAgICAgICAgICB0aGlzLmJhckhlaWdodCA9IHRoaXMuZWwubmF0aXZlRWxlbWVudC5jaGlsZHJlblswXS5vZmZzZXRIZWlnaHQ7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodGhpcy5hbmltYXRlKSB7XG4gICAgICAgICAgICBEb21IYW5kbGVyLnJlbW92ZUNsYXNzKHRoaXMuZWwubmF0aXZlRWxlbWVudC5jaGlsZHJlblswXSwgJ3Atc2xpZGVyLWFuaW1hdGUnKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgfVxuXG4gICAgb25Ub3VjaE1vdmUoZXZlbnQsIGluZGV4PzpudW1iZXIpIHtcbiAgICAgICAgaWYgKHRoaXMuZGlzYWJsZWQpIHtcbiAgICAgICAgICA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Lm9uU2xpZGVFbmQuZW1pdCh7b3JpZ2luYWxFdmVudDogZXZlbnQsIHZhbHVlOiB0aGlzLnZhbHVlfSk7XG5cbiAgICAgICAgaWYgKHRoaXMuYW5pbWF0ZSkge1xuICAgICAgICAgICAgRG9tSGFuZGxlci5hZGRDbGFzcyh0aGlzLmVsLm5hdGl2ZUVsZW1lbnQuY2hpbGRyZW5bMF0sICdwLXNsaWRlci1hbmltYXRlJyk7XG4gICAgICAgIH1cblxuICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgIH1cblxuICAgIG9uQmFyQ2xpY2soZXZlbnQpIHtcbiAgICAgICAgaWYgKHRoaXMuZGlzYWJsZWQpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICghdGhpcy5zbGlkZXJIYW5kbGVDbGljaykge1xuICAgICAgICAgICAgdGhpcy51cGRhdGVEb21EYXRhKCk7XG4gICAgICAgICAgICB0aGlzLmhhbmRsZUNoYW5nZShldmVudCk7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLnNsaWRlckhhbmRsZUNsaWNrID0gZmFsc2U7XG4gICAgfVxuXG4gICAgb25IYW5kbGVLZXlkb3duKGV2ZW50LCBoYW5kbGVJbmRleD86bnVtYmVyKSB7XG4gICAgICAgIGlmICh0aGlzLmRpc2FibGVkKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGV2ZW50LndoaWNoID09IDM4IHx8IGV2ZW50LndoaWNoID09IDM5KSB7XG4gICAgICAgICAgICB0aGlzLnNwaW4oZXZlbnQsIDEsIGhhbmRsZUluZGV4KTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmIChldmVudC53aGljaCA9PSAzNyB8fCBldmVudC53aGljaCA9PSA0MCkge1xuICAgICAgICAgICAgdGhpcy5zcGluKGV2ZW50LCAtMSwgaGFuZGxlSW5kZXgpO1xuICAgICAgICB9XG4gICAgfV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uZXIpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmRyYWdMaXN0ZW5lciA9IHRoaXMucmVuZGVyZXIubGlzdGVuKGRvY3VtZW50VGFyZ2V0LCAnbW91c2Vtb3ZlJywgKGV2ZW50KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmRyYWdnaW5nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm5nWm9uZS5ydW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaGFuZGxlQ2hhbmdlKGV2ZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghdGhpcy5tb3VzZXVwTGlzdGVuZXIpIHtcbiAgICAgICAgICAgICAgICB0aGlzLm1vdXNldXBMaXN0ZW5lciA9IHRoaXMucmVuZGVyZXIubGlzdGVuKGRvY3VtZW50VGFyZ2V0LCAnbW91c2V1cCcsIChldmVudCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5kcmFnZ2luZykge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5kcmFnZ2luZyA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5uZ1pvbmUucnVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5yYW5nZSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5vblNsaWRlRW5kLmVtaXQoe29yaWdpbmFsRXZlbnQ6IGV2ZW50LCB2YWx1ZXM6IHRoaXMudmFsdWVzfSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm9uU2xpZGVFbmQuZW1pdCh7b3JpZ2luYWxFdmVudDogZXZlbnQsIHZhbHVlOiB0aGlzLnZhbHVlfSk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5hbmltYXRlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERvbUhhbmRsZXIuYWRkQ2xhc3ModGhpcy5lbC5uYXRpdmVFbGVtZW50LmNoaWxkcmVuWzBdLCAncC1zbGlkZXItYW5pbWF0ZScpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH1cblxuICAgIHVuYmluZERyYWdMaXN0ZW5lcnMoKSB7XG4gICAgICAgIGlmICh0aGlzLmRyYWdMaXN0ZW5lcikge1xuICAgICAgICAgICAgdGhpcy5kcmFnTGlzdGVuZXIoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh0aGlzLm1vdXNldXBMaXN0ZW5lcikge1xuICAgICAgICAgICAgdGhpcy5tb3VzZXVwTGlzdGVuZXIoKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHNldFZhbHVlRnJvbUhhbmRsZShldmVudDogRXZlbnQsIGhhbmRsZVZhbHVlOiBhbnkpIHtcbiAgICAgICAgdGhpcy5zbGlkZXJIYW5kbGVDbGljayA9IGZhbHNlO1xuICAgICAgICBsZXQgbmV3VmFsdWUgPSB0aGlzLmdldFZhbHVlRnJvbUhhbmRsZShoYW5kbGVWYWx1ZSk7XG5cbiAgICAgICAgaWYgKHRoaXMucmFuZ2UpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnN0ZXApIHtcbiAgICAgICAgICAgICAgICB0aGlzLmhhbmRsZVN0ZXBDaGFuZ2UobmV3VmFsdWUsIHRoaXMudmFsdWVzW3RoaXMuaGFuZGxlSW5kZXhdKTtcbiAgICAgICAgICAgIH1cbiAgIC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aWYgKHRoaXMub3JpZW50YXRpb24gPT09ICdob3Jpem9udGFsJylcbiAgICAgICAgICAgIHJldHVybiAoKGV2ZW50LnBhZ2VYIC0gdGhpcy5pbml0WCkgKiAxMDApIC8gKHRoaXMuYmFyV2lkdGgpO1xuICAgICAgICBlbHNlXG4gICAgICAgICAgICByZXR1cm4oKCh0aGlzLmluaXRZICsgdGhpcy5iYXJIZWlnaHQpIC0gZXZlbnQucGFnZVkpICogMTAwKSAvICh0aGlzLmJhckhlaWdodCk7XG4gICAgfVxuXG4gICAgdXBkYXRlSGFuZGxlVmFsdWUoKTogdm9pZCB7XG4gICAgICAgIGlmICh0aGlzLnJhbmdlKSB7XG4gICAgICAgICAgICB0aGlzLmhhbmRsZVZhbHVlc1swXSA9ICh0aGlzLnZhbHVlc1swXSA8IHRoaXMubWluID8gMCA6IHRoaXMudmFsdWVzWzBdIC0gdGhpcy5taW4pICogMTAwIC8gKHRoaXMubWF4IC0gdGhpcy5taW4pO1xuICAgICAgICAgICAgdGhpcy5oYW5kbGVWYWx1ZXNbMV0gPSAodGhpcy52YWx1ZXNbMV0gPiB0aGlzLm1heCA/IDEwMCA6IHRoaXMudmFsdWVzWzFdIC0gdGhpcy5taW4pICogMTAwIC8gKHRoaXMubWF4IC0gdGhpcy5taW4pO1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgaWYgKHRoaXMudmFsdWUgPCB0aGlzLm1pbilcbiAgICAgICAgICAgICAgICB0aGlzLmhhbmRsZVZhbHVlID0gMDtcbiAgICAgICAgICAgIGVsc2UgaWYgKHRoaXMudmFsdWUgPiB0aGlzLm1heClcbiAgICAgICAgICAgICAgICB0aGlzLmhhbmRsZVZhbHVlID0gMTAwO1xuICAgICAgICAgICAgZWxzZVxuICAgICAgICAgICAgICAgIHRoaXMuaGFuZGxlVmFsdWUgPSAodGhpcy52YWx1ZSAtIHRoaXMubWluKSAqIDEwMCAvICh0aGlzLm1heCAtIHRoaXMubWluKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHVwZGF0ZVZhbHVlKHZhbDogbnVtYmVyLCBldmVudD86IEV2ZW50KTogdm9pZCB7XG4gICAgICAgIGlmICh0aGlzLnJhbmdlKSB7XG4gICAgICAgICAgICBsZXQgdmFsdWUgPSB2YWw7XG5cbiAgICAgICAgICAgIGlmICh0aGlzLmhhbmRsZUluZGV4ID09IDApIHtcbiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPCB0aGlzLm1pbikge1xuICAgICAgICAgICAgICAgICAgICB2YWx1ZSA9IHRoaXMubWluO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmhhbmRsZVZhbHVlc1swXSA9IDA7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKHZhbHVlID4gdGhpcy52YWx1ZXNbMV0pIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsdWUgPSB0aGlzLnZhbHVlc1sxXTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5oYW5kbGVWYWx1ZXNbMF0gPSB0aGlzLmhhbmRsZVZhbHVlc1sxXTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0aGlzLnNsaWRlckhhbmRsZVN0YXJ0Lm5hdGl2ZUVsZW1lbnQuZm9jdXMoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSA+IHRoaXMubWF4KSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbHVlID0gdGhpcy5tYXg7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuaGFuZGxlVmFsdWVzWzFdID0gMTAwO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIGlmICh2YWx1ZSA8IHRoaXMudmFsdWVzWzBdKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbHVlID0gdGhpcy52YWx1ZXNbMF07XG4gICAgICAgICAgICAgICAgIC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