381 lines
38 KiB
JavaScript
381 lines
38 KiB
JavaScript
import { CommonModule } from '@angular/common';
|
|
import { ChangeDetectionStrategy, Component, ContentChildren, EventEmitter, Input, NgModule, Output, ViewEncapsulation, booleanAttribute, forwardRef } from '@angular/core';
|
|
import { PrimeTemplate, SharedModule } from 'primeng/api';
|
|
import { InputTextModule } from 'primeng/inputtext';
|
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
import { AutoFocusModule } from 'primeng/autofocus';
|
|
import * as i0 from "@angular/core";
|
|
import * as i1 from "@angular/common";
|
|
import * as i2 from "primeng/inputtext";
|
|
import * as i3 from "primeng/autofocus";
|
|
export const INPUT_OTP_VALUE_ACCESSOR = {
|
|
provide: NG_VALUE_ACCESSOR,
|
|
useExisting: forwardRef(() => InputOtp),
|
|
multi: true
|
|
};
|
|
/**
|
|
* Input Otp is used to enter one time passwords.
|
|
* @group Components
|
|
*/
|
|
export class InputOtp {
|
|
cd;
|
|
/**
|
|
* When present, it specifies that the component should have invalid state style.
|
|
* @group Props
|
|
*/
|
|
invalid = false;
|
|
/**
|
|
* When present, it specifies that the component should be disabled.
|
|
* @group Props
|
|
*/
|
|
disabled = false;
|
|
/**
|
|
* When present, it specifies that an input field is read-only.
|
|
* @group Props
|
|
*/
|
|
readonly = false;
|
|
/**
|
|
* Specifies the input variant of the component.
|
|
* @group Props
|
|
*/
|
|
variant = 'outlined';
|
|
/**
|
|
* Index of the element in tabbing order.
|
|
* @group Props
|
|
*/
|
|
tabindex = null;
|
|
/**
|
|
* Number of characters to initiate.
|
|
* @group Props
|
|
*/
|
|
length = 4;
|
|
/**
|
|
* Mask pattern.
|
|
* @group Props
|
|
*/
|
|
mask = false;
|
|
/**
|
|
* When present, it specifies that an input field is integer-only.
|
|
* @group Props
|
|
*/
|
|
integerOnly = false;
|
|
/**
|
|
* When present, it specifies that the component should automatically get focus on load.
|
|
* @group Props
|
|
*/
|
|
autofocus;
|
|
/**
|
|
* Callback to invoke on value change.
|
|
* @group Emits
|
|
*/
|
|
onChange = new EventEmitter();
|
|
/**
|
|
* Callback to invoke when the component receives focus.
|
|
* @param {Event} event - Browser event.
|
|
* @group Emits
|
|
*/
|
|
onFocus = new EventEmitter();
|
|
/**
|
|
* Callback to invoke when the component loses focus.
|
|
* @param {Event} event - Browser event.
|
|
* @group Emits
|
|
*/
|
|
onBlur = new EventEmitter();
|
|
templates;
|
|
inputTemplate;
|
|
tokens = [];
|
|
onModelChange = () => { };
|
|
onModelTouched = () => { };
|
|
value;
|
|
get inputMode() {
|
|
return this.integerOnly ? 'numeric' : 'text';
|
|
}
|
|
get inputType() {
|
|
return this.mask ? 'password' : 'text';
|
|
}
|
|
constructor(cd) {
|
|
this.cd = cd;
|
|
}
|
|
ngAfterContentInit() {
|
|
this.templates.forEach((item) => {
|
|
switch (item.getType()) {
|
|
case 'input':
|
|
this.inputTemplate = item.template;
|
|
break;
|
|
default:
|
|
this.inputTemplate = item.template;
|
|
break;
|
|
}
|
|
});
|
|
}
|
|
getToken(index) {
|
|
return this.tokens[index];
|
|
}
|
|
getTemplateEvents(index) {
|
|
return {
|
|
input: (event) => this.onInput(event, index),
|
|
keydown: (event) => this.onKeyDown(event),
|
|
focus: (event) => this.onFocus.emit(event),
|
|
blur: (event) => this.onBlur.emit(event),
|
|
paste: (event) => this.onPaste(event)
|
|
};
|
|
}
|
|
onInput(event, index) {
|
|
this.tokens[index] = event.target.value;
|
|
this.updateModel(event);
|
|
if (event.inputType === 'deleteContentBackward') {
|
|
this.moveToPrev(event);
|
|
}
|
|
else if (event.inputType === 'insertText' || event.inputType === 'deleteContentForward') {
|
|
this.moveToNext(event);
|
|
}
|
|
}
|
|
updateModel(event) {
|
|
const newValue = this.tokens.join('');
|
|
this.onModelChange(newValue);
|
|
this.onChange.emit({
|
|
originalEvent: event,
|
|
value: newValue
|
|
});
|
|
}
|
|
writeValue(value) {
|
|
if (value) {
|
|
if (Array.isArray(value) && value.length > 0) {
|
|
this.value = value.slice(0, this.length);
|
|
}
|
|
else {
|
|
this.value = value.toString().split('').slice(0, this.length);
|
|
}
|
|
}
|
|
else {
|
|
this.value = value;
|
|
}
|
|
this.updateTokens();
|
|
this.cd.markForCheck();
|
|
}
|
|
updateTokens() {
|
|
if (this.value !== null && this.value !== undefined) {
|
|
if (Array.isArray(this.value)) {
|
|
this.tokens = [...this.value];
|
|
}
|
|
else {
|
|
this.tokens = this.value.toString().split('');
|
|
}
|
|
}
|
|
else {
|
|
this.tokens = [];
|
|
}
|
|
}
|
|
getModelValue(i) {
|
|
return this.tokens[i - 1] || '';
|
|
}
|
|
getAutofocus(i) {
|
|
if (i === 1) {
|
|
return this.autofocus;
|
|
}
|
|
return false;
|
|
}
|
|
registerOnChange(fn) {
|
|
this.onModelChange = fn;
|
|
}
|
|
registerOnTouched(fn) {
|
|
this.onModelTouched = fn;
|
|
}
|
|
moveToPrev(event) {
|
|
let prevInput = this.findPrevInput(event.target);
|
|
if (prevInput) {
|
|
prevInput.focus();
|
|
prevInput.select();
|
|
}
|
|
}
|
|
moveToNext(event) {
|
|
let nextInput = this.findNextInput(event.target);
|
|
if (nextInput) {
|
|
nextInput.focus();
|
|
nextInput.select();
|
|
}
|
|
}
|
|
findNextInput(element) {
|
|
let nextElement = element.nextElementSibling;
|
|
if (!nextElement)
|
|
return;
|
|
return nextElement.nodeName === 'INPUT' ? nextElement : this.findNextInput(nextElement);
|
|
}
|
|
findPrevInput(element) {
|
|
let prevElement = element.previousElementSibling;
|
|
if (!prevElement)
|
|
return;
|
|
return prevElement.nodeName === 'INPUT' ? prevElement : this.findPrevInput(prevElement);
|
|
}
|
|
onInputFocus(event) {
|
|
event.target.select();
|
|
this.onFocus.emit(event);
|
|
}
|
|
onInputBlur(event) {
|
|
this.onBlur.emit(event);
|
|
}
|
|
onKeyDown(event) {
|
|
if (event.altKey || event.ctrlKey || event.metaKey) {
|
|
return;
|
|
}
|
|
switch (event.code) {
|
|
case 'ArrowLeft':
|
|
this.moveToPrev(event);
|
|
event.preventDefault();
|
|
break;
|
|
case 'ArrowUp':
|
|
case 'ArrowDown':
|
|
event.preventDefault();
|
|
break;
|
|
case 'Backspace':
|
|
if (event.target.value.length === 0) {
|
|
this.moveToPrev(event);
|
|
event.preventDefault();
|
|
}
|
|
break;
|
|
case 'ArrowRight':
|
|
this.moveToNext(event);
|
|
event.preventDefault();
|
|
break;
|
|
default:
|
|
if ((this.integerOnly && !((event.code.startsWith('Digit') || event.code.startsWith('Numpad')) && Number(event.key) >= 0 && Number(event.key) <= 9)) || (this.tokens.join('').length >= this.length && event.code !== 'Delete')) {
|
|
event.preventDefault();
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
onPaste(event) {
|
|
let paste = event.clipboardData.getData('text');
|
|
if (paste.length) {
|
|
let pastedCode = paste.substring(0, this.length + 1);
|
|
if (!this.integerOnly || !isNaN(pastedCode)) {
|
|
this.tokens = pastedCode.split('');
|
|
this.updateModel(event);
|
|
}
|
|
}
|
|
event.preventDefault();
|
|
}
|
|
getRange(n) {
|
|
return Array.from({ length: n }, (_, index) => index + 1);
|
|
}
|
|
trackByFn(index) {
|
|
return index;
|
|
}
|
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: InputOtp, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.3.7", type: InputOtp, selector: "p-inputOtp", inputs: { invalid: "invalid", disabled: "disabled", readonly: "readonly", variant: "variant", tabindex: "tabindex", length: "length", mask: "mask", integerOnly: "integerOnly", autofocus: ["autofocus", "autofocus", booleanAttribute] }, outputs: { onChange: "onChange", onFocus: "onFocus", onBlur: "onBlur" }, host: { classAttribute: "p-inputotp p-component" }, providers: [INPUT_OTP_VALUE_ACCESSOR], queries: [{ propertyName: "templates", predicate: PrimeTemplate }], ngImport: i0, template: `
|
|
<ng-container *ngFor="let i of getRange(length); trackBy: trackByFn">
|
|
<ng-container *ngIf="!inputTemplate">
|
|
<input
|
|
type="text"
|
|
pInputText
|
|
[value]="getModelValue(i)"
|
|
[maxLength]="1"
|
|
[type]="inputType"
|
|
class="p-inputotp-input"
|
|
[inputmode]="inputMode"
|
|
[variant]="variant"
|
|
[readonly]="readonly"
|
|
[disabled]="disabled"
|
|
[invalid]="invalid"
|
|
[tabindex]="tabindex"
|
|
[unstyled]="unstyled"
|
|
(input)="onInput($event, i - 1)"
|
|
(focus)="onInputFocus($event)"
|
|
(blur)="onInputBlur($event)"
|
|
(paste)="onPaste($event)"
|
|
(keydown)="onKeyDown($event)"
|
|
pAutoFocus
|
|
[autofocus]="getAutofocus(i)"
|
|
/>
|
|
</ng-container>
|
|
<ng-container *ngIf="inputTemplate">
|
|
<ng-container *ngTemplateOutlet="inputTemplate; context: { $implicit: getToken(i - 1), events: getTemplateEvents(i - 1), index: i }"> </ng-container>
|
|
</ng-container>
|
|
</ng-container>
|
|
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "directive", type: i3.AutoFocus, selector: "[pAutoFocus]", inputs: ["autofocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: InputOtp, decorators: [{
|
|
type: Component,
|
|
args: [{
|
|
selector: 'p-inputOtp',
|
|
template: `
|
|
<ng-container *ngFor="let i of getRange(length); trackBy: trackByFn">
|
|
<ng-container *ngIf="!inputTemplate">
|
|
<input
|
|
type="text"
|
|
pInputText
|
|
[value]="getModelValue(i)"
|
|
[maxLength]="1"
|
|
[type]="inputType"
|
|
class="p-inputotp-input"
|
|
[inputmode]="inputMode"
|
|
[variant]="variant"
|
|
[readonly]="readonly"
|
|
[disabled]="disabled"
|
|
[invalid]="invalid"
|
|
[tabindex]="tabindex"
|
|
[unstyled]="unstyled"
|
|
(input)="onInput($event, i - 1)"
|
|
(focus)="onInputFocus($event)"
|
|
(blur)="onInputBlur($event)"
|
|
(paste)="onPaste($event)"
|
|
(keydown)="onKeyDown($event)"
|
|
pAutoFocus
|
|
[autofocus]="getAutofocus(i)"
|
|
/>
|
|
</ng-container>
|
|
<ng-container *ngIf="inputTemplate">
|
|
<ng-container *ngTemplateOutlet="inputTemplate; context: { $implicit: getToken(i - 1), events: getTemplateEvents(i - 1), index: i }"> </ng-container>
|
|
</ng-container>
|
|
</ng-container>
|
|
`,
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
encapsulation: ViewEncapsulation.None,
|
|
host: {
|
|
class: 'p-inputotp p-component'
|
|
},
|
|
providers: [INPUT_OTP_VALUE_ACCESSOR]
|
|
}]
|
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { invalid: [{
|
|
type: Input
|
|
}], disabled: [{
|
|
type: Input
|
|
}], readonly: [{
|
|
type: Input
|
|
}], variant: [{
|
|
type: Input
|
|
}], tabindex: [{
|
|
type: Input
|
|
}], length: [{
|
|
type: Input
|
|
}], mask: [{
|
|
type: Input
|
|
}], integerOnly: [{
|
|
type: Input
|
|
}], autofocus: [{
|
|
type: Input,
|
|
args: [{ transform: booleanAttribute }]
|
|
}], onChange: [{
|
|
type: Output
|
|
}], onFocus: [{
|
|
type: Output
|
|
}], onBlur: [{
|
|
type: Output
|
|
}], templates: [{
|
|
type: ContentChildren,
|
|
args: [PrimeTemplate]
|
|
}] } });
|
|
export class InputOtpModule {
|
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: InputOtpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.7", ngImport: i0, type: InputOtpModule, declarations: [InputOtp], imports: [CommonModule, SharedModule, InputTextModule, AutoFocusModule], exports: [InputOtp, SharedModule] });
|
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: InputOtpModule, imports: [CommonModule, SharedModule, InputTextModule, AutoFocusModule, SharedModule] });
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: InputOtpModule, decorators: [{
|
|
type: NgModule,
|
|
args: [{
|
|
imports: [CommonModule, SharedModule, InputTextModule, AutoFocusModule],
|
|
exports: [InputOtp, SharedModule],
|
|
declarations: [InputOtp]
|
|
}]
|
|
}] });
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXRvdHAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXBwL2NvbXBvbmVudHMvaW5wdXRvdHAvaW5wdXRvdHAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQy9DLE9BQU8sRUFBb0IsdUJBQXVCLEVBQXFCLFNBQVMsRUFBRSxlQUFlLEVBQUUsWUFBWSxFQUFFLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUEwQixpQkFBaUIsRUFBRSxnQkFBZ0IsRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDek8sT0FBTyxFQUFFLGFBQWEsRUFBRSxZQUFZLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDMUQsT0FBTyxFQUFFLG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ICAgICAgICAgICAgW21heExlbmd0aF09XCIxXCJcbiAgICAgICAgICAgICAgICAgICAgW3R5cGVdPVwiaW5wdXRUeXBlXCJcbiAgICAgICAgICAgICAgICAgICAgY2xhc3M9XCJwLWlucHV0b3RwLWlucHV0XCJcbiAgICAgICAgICAgICAgICAgICAgW2lucHV0bW9kZV09XCJpbnB1dE1vZGVcIlxuICAgICAgICAgICAgICAgICAgICBbdmFyaWFudF09XCJ2YXJpYW50XCJcbiAgICAgICAgICAgICAgICAgICAgW3JlYWRvbmx5XT1cInJlYWRvbmx5XCJcbiAgICAgICAgICAgICAgICAgICAgW2Rpc2FibGVkXT1cImRpc2FibGVkXCJcbiAgICAgICAgICAgICAgICAgICAgW2ludmFsaWRdPVwiaW52YWxpZFwiXG4gICAgICAgICAgICAgICAgICAgIFt0YWJpbmRleF09XCJ0YWJpbmRleFwiXG4gICAgICAgICAgICAgICAgICAgIFt1bnN0eWxlZF09XCJ1bnN0eWxlZFwiXG4gICAgICAgICAgICAgICAgICAgIChpbnB1dCk9XCJvbklucHV0KCRldmVudCwgaSAtIDEpXCJcbiAgICAgICAgICAgICAgICAgICAgKGZvY3VzKT1cIm9uSW5wdXRGb2N1cygkZXZlbnQpXCJcbiAgICAgICAgICAgICAgICAgICAgKGJsdXIpPVwib25JbnB1dEJsdXIoJGV2ZW50KVwiXG4gICAgICAgICAgICAgICAgICAgIChwYXN0ZSk9XCJvblBhc3RlKCRldmVudClcIlxuICAgICAgICAgICAgICAgICAgICAoa2V5ZG93bik9XCJvbktleURvd24oJGV2ZW50KVwiXG4gICAgICAgICAgICAgICAgICAgIHBBdXRvRm9jdXNcbiAgICAgICAgICAgICAgICAgICAgW2F1dG9mb2N1c109XCJnZXRBdXRvZm9jdXMoaSlcIlxuICAgICAgICAgICAgICAgIC8+XG4gICAgICAgICAgICA8L25nLWNvbnRhaW5lcj5cbiAgICAgICAgICAgIDxuZy1jb250YWluZXIgKm5nSWY9XCJpbnB1dFRlbXBsYXRlXCI+XG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FrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICBnZXRUb2tlbihpbmRleCkge1xuICAgICAgICByZXR1cm4gdGhpcy50b2tlbnNbaW5kZXhdO1xuICAgIH1cblxuICAgIGdldFRlbXBsYXRlRXZlbnRzKGluZGV4KSB7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBpbnB1dDogKGV2ZW50KSA9PiB0aGlzLm9uSW5wdXQoZXZlbnQsIGluZGV4KSxcbiAgICAgICAgICAgIGtleWRvd246IChldmVudCkgPT4gdGhpcy5vbktleURvd24oZXZlbnQpLFxuICAgICAgICAgICAgZm9jdXM6IChldmVudCkgPT4gdGhpcy5vbkZvY3VzLmVtaXQoZXZlbnQpLFxuICAgICAgICAgICAgYmx1cjogKGV2ZW50KSA9PiB0aGlzLm9uQmx1ci5lbWl0KGV2ZW50KSxcbiAgICAgICAgICAgIHBhc3RlOiAoZXZlbnQpID0+IHRoaXMub25QYXN0ZShldmVudClcbiAgICAgICAgfTtcbiAgICB9XG5cbiAgICBvbklucHV0KGV2ZW50LCBpbmRleCkge1xuICAgICAgICB0aGlzLnRva2Vuc1tpbmRleF0gPSBldmVudC50YXJnZXQudmFsdWU7XG4gICAgICAgIHRoaXMudXBkYXRlTW9kZWwoZXZlbnQpO1xuXG4gICAgICAgIGlmIChldmVudC5pbnB1dFR5cGUgPT09ICdkZWxldGVDb250ZW50QmFja3dhcmQnKSB7XG4gICAgICAgICAgICB0aGlzLm1vdmVUb1ByZXYoZXZlbnQpO1xuICAgICAgICB9IGVsc2UgaWYgKGV2ZW50LmlucHV0VHlwZSA9PT0gJ2luc2VydFRleHQnIHx8IGV2ZW50LmlucHV0VHlwZSA9PT0gJ2RlbGV0ZUNvbnRlbnRGb3J3YXJkJykge1xuICAgICAgICAgICAgdGhpcy5tb3ZlVG9OZXh0KGV2ZW50KTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHVwZGF0ZU1vZGVsKGV2ZW50OiB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ICAgICAgICAgICAgICAgIHRoaXMudG9rZW5zID0gdGhpcy52YWx1ZS50b1N0cmluZygpLnNwbGl0KCcnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMudG9rZW5zID0gW107XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBnZXRNb2RlbFZhbHVlKGk6IG51bWJlcikge1xuICAgICAgICByZXR1cm4gdGhpcy50b2tlbnNbaSAtIDFdIHx8ICcnO1xuICAgIH1cblxuICAgIGdldEF1dG9mb2N1cyhpOiBudW1iZXIpOiBib29sZWFuIHtcbiAgICAgICAgaWYgKGkgPT09IDEpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmF1dG9mb2N1cztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxuXG4gICAgcmVnaXN0ZXJPbkNoYW5nZShmbjogRnVuY3Rpb24pOiB2b2lkIHtcbiAgICAgICAgdGhpcy5vbk1vZGVsQ2hhbmdlID0gZm47XG4gICAgfVxuXG4gICAgcmVnaXN0ZXJPblRvdWNoZWQoZm46IEZ1bmN0aW9uKTogdm9pZCB7XG4gICAgICAgIHRoaXMub25Nb2RlbFRvdWNoZWQgPSBmbjtcbiAgICB9XG5cbiAgICBtb3ZlVG9QcmV2KGV2ZW50KSB7XG4gICAgICAgIGxldCBwcmV2SW5wdXQgPSB0aGlzLmZpbmRQcmV2SW5wdXQoZXZlbnQudGFyZ2V0KTtcblxuICAgICAgICBpZiAocHJldklucHV0KSB7XG4gICAgICAgICAgICBwcmV2SW5wdXQuZm9jdXMoKTtcbiAgICAgICAgICAgIHByZXZJbnB1dC5zZWxlY3QoKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIG1vdmVUb05leHQoZXZlbnQpIHtcbiAgICAgICAgbGV0IG5leHRJbnB1dCA9IHRoaXMuZmluZE5leHRJbnB1dChldmVudC50YXJnZXQpO1xuXG4gICAgICAgIGlmIChuZXh0SW5wdXQpIHtcbiAgICAgICAgICAgIG5leHRJbnB1dC5mb2N1cygpO1xuICAgICAgICAgICAgbmV4dElucHV0LnNlbGVjdCgpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgZmluZE5leHRJbnB1dChlbGVtZW50KSB7XG4gICAgICAgIGxldCBuZXh0RWxlbWVudCA9IGVsZW1lbnQubmV4dEVsZW1lbnRTaWJsaW5nO1xuXG4gICAgICAgIGlmICghbmV4dEVsZW1lbnQpIHJldHVybjtcblxuICAgICAgICByZXR1cm4gbmV4dEVsZW1lbnQubm9kZU5hbWUgPT09ICdJTlBVVCcgPyBuZXh0RWxlbWVudCA6IHRoaXMuZmluZE5leHRJbnB1dChuZXh0RWxlbWVudCk7XG4gICAgfVxuXG4gICAgZmluZFByZXZJbnB1dChlbGVtZW50KSB7XG4gICAgICAgIGxldCBwcmV2RWxlbWVudCA9IGVsZW1lbnQucHJldmlvdXNFbGVtZW50U2libGluZztcblxuICAgICAgICBpZiAoIXByZXZFbGVtZW50KSByZXR1cm47XG5cbiAgICAgICAgcmV0dXJuIHByZXZFbGVtZW50Lm5vZGVOYW1lID09PSAnSU5QVVQnID8gcHJldkVsZW1lbnQgOiB0aGlzLmZpbmRQcmV2SW5wdXQocHJldkVsZW1lbnQpO1xuICAgIH1cblxuICAgIG9uSW5wdXRGb2N1cyhldmVudCkge1xuICAgICAgICBldmVudC50YXJnZXQuc2VsZWN0KCk7XG4gICAgICAgIHRoaXMub25Gb2N1cy5lbWl0KGV2ZW50KTtcbiAgICB9XG5cbiAgICBvbklucHV0Qmx1cihldmVudCkge1xuICAgICAgICB0aGlzLm9uQmx1ci5lbWl0KGV2ZW50KTtcbiAgICB9XG5cbiAgICBvbktleURvd24oZXZlbnQpIHtcbiAgICAgICAgaWYgKGV2ZW50LmFsdEtleSB8fCBldmVudC5jdHJsS2V5IHx8IGV2ZW50Lm1ldGFLZXkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIHN3aXRjaCAoZXZlbnQuY29kZSkge1xuICAgICAgICAgICAgY2FzZSAnQXJyb3dMZWZ0JzpcbiAgICAgICAgICAgICAgICB0aGlzLm1vdmVUb1ByZXYoZXZlbnQpO1xuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG5cbiAgICAgICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgICAgY2FzZSAnQXJyb3dVcCc6XG4gICAgICAgICAgICBjYXNlICdBcnJvd0Rvd24nOlxuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG5cbiAgICAgICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgICAgY2FzZSAnQmFja3NwYWNlJzpcbiAgICAgICAgICAgICAgICBpZiAoZXZlbnQudGFyZ2V0LnZhbHVlLmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm1vdmVUb1ByZXYoZXZlbnQpO1xuICAgICAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICBjYXNlICdBcnJvd1JpZ2h0JzpcbiAgICAgICAgICAgICAgICB0aGlzLm1vdmVUb05leHQoZXZlbnQpO1xuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG5cbiAgICAgICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICBpZiAoKHRoaXMuaW50ZWdlck9ubHkgJiYgISgoZXZlbnQuY29kZS5zdGFydHNXaXRoKCdEaWdpdCcpIHx8IGV2ZW50LmNvZGUuc3RhcnRzV2l0aCgnTnVtcGFkJykpICYmIE51bWJlcihldmVudC5rZXkpID49IDAgJiYgTnVtYmVyKGV2ZW50LmtleSkgPD0gOSkpIHx8ICh0aGlzLnRva2Vucy5qb2luK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