You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
aliseptik/local/templates/.default/js/libs/imask.min.js

1 lines
57 KiB

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).IMask={})}(this,function(t){"use strict";function u(t){return"string"==typeof t||t instanceof String}function i(t){return"object"==typeof t&&null!=t&&"Object"===(null==t||null==(t=t.constructor)?void 0:t.name)}const p={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function d(t){switch(t){case p.LEFT:return p.FORCE_LEFT;case p.RIGHT:return p.FORCE_RIGHT;default:return t}}function s(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function h(t,e){if(e===t)return!0;const s=Array.isArray(e),i=Array.isArray(t);let a;if(s&&i){if(e.length!=t.length)return!1;for(a=0;a<e.length;a++)if(!h(e[a],t[a]))return!1;return!0}if(s!=i)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){const s=e instanceof Date,i=t instanceof Date;if(s&&i)return e.getTime()==t.getTime();if(s!=i)return!1;var r=e instanceof RegExp,u=t instanceof RegExp;if(r&&u)return e.toString()==t.toString();if(r!=u)return!1;var n=Object.keys(e);for(a=0;a<n.length;a++)if(!Object.prototype.hasOwnProperty.call(t,n[a]))return!1;for(a=0;a<n.length;a++)if(!h(t[n[a]],e[n[a]]))return!1;return!0}return!(!e||!t||"function"!=typeof e||"function"!=typeof t)&&e.toString()===t.toString()}class P{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?p.NONE:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?p.LEFT:p.RIGHT}}function o(t,e){return new o.InputMask(t,e)}function a(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?o.MaskedRegExp:u(t)?o.MaskedPattern:t===Date?o.MaskedDate:t===Number?o.MaskedNumber:Array.isArray(t)||t===Array?o.MaskedDynamic:o.Masked&&t.prototype instanceof o.Masked?t:o.Masked&&t instanceof o.Masked?t.constructor:t instanceof Function?o.MaskedFunction:(console.warn("Mask not found for mask",t),o.Masked)}function c(t){if(!t)throw new Error("Options in not defined");if(o.Masked){if(t.prototype instanceof o.Masked)return{mask:t};const{mask:e,...s}=t instanceof o.Masked?{mask:t}:i(t)&&t.mask instanceof o.Masked?t:{};if(e){const t=e.mask;return{...function t(e,i){return Array.isArray(i)?t(e,(t,e)=>i.includes(e)):Object.entries(e).reduce((t,e)=>{var[e,s]=e;return i(s,e)&&(t[e]=s),t},{})}(e,(t,e)=>!e.startsWith("_")),mask:e.constructor,_mask:t,...s}}}return i(t)?{...t}:{mask:t}}function g(t){if(o.Masked&&t instanceof o.Masked)return t;var t=c(t),e=a(t.mask);if(e)return t.mask===e&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new e(t);throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.")}o.createMask=g;class r{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return null!=t?t:this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return null!=t?t:this.value.length}select(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch{}}get isActive(){return!1}}class e extends(o.MaskElement=r){constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,e;return null!=(t=null==(t=(e=this.input).getRootNode)?void 0:t.call(e))?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){return this._handlers.redo&&(90===t.keyCode&&t.shiftKey&&(t.metaKey||t.ctrlKey)||89===t.keyCode&&t.ctrlKey)?(t.preventDefault(),this._handlers.redo(t)):this._handlers.undo&&90===t.keyCode&&(t.metaKey||t.ctrlKey)?(t.preventDefault(),this._handlers.undo(t)):void(t.isComposing||this._handlers.selectionChange(t))}_onBeforeinput(t){return"historyUndo"===t.inputType&&this._handlers.undo?(t.preventDefault(),this._handlers.undo(t)):"historyRedo"===t.inputType&&this._handlers.redo?(t.preventDefault(),this._handlers.redo(t)):void 0}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}class n extends(o.HTMLMaskElement=e){constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}}class l extends(o.HTMLMaskElement=e){get _unsafeSelectionStart(){var t=this.rootElement,t=t.getSelection&&t.getSelection(),e=t&&t.anchorOffset,t=t&&t.focusOffset;return null==t||null==e||e<t?e:t}get _unsafeSelectionEnd(){var t=this.rootElement,t=t.getSelection&&t.getSelection(),e=t&&t.anchorOffset,t=t&&t.focusOffset;return null==t||null==e||t<e?e:t}_unsafeSelect(t,e){var s;this.rootElement.createRange&&((s=this.rootElement.createRange()).setStart(this.input.firstChild||this.input,t),s.setEnd(this.input.lastChild||this.input,e),e=(t=this.rootElement).getSelection&&t.getSelection())&&(e.removeAllRanges(),e.addRange(s))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}o.HTMLContenteditableMaskElement=l;class k{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>k.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}k.MAX_LENGTH=100;class m{constructor(t,e){this.el=t instanceof r?t:new(t.isContentEditable&&"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName?l:n)(t),this.masked=g(e),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new k,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var e;return null==t||(null==(e=this.masked)?void 0:e.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){var e;this.maskEquals(t)||(t instanceof o.Masked||this.masked.constructor!==a(t)?((e=t instanceof o.Masked?t:g({mask:t})).unmaskedValue=this.masked.unmaskedValue,this.masked=e):this.masked.updateOptions({mask:t}))}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,e){t=this._listeners[t];t&&t.forEach(t=>t(e))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){this.el&&this.el.isActive&&(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){var e=this.masked.unmaskedValue,s=this.masked.value,i=this.masked.rawInputValue,a=this.displayValue,r=this.unmaskedValue!==e||this.value!==s||this._rawInputValue!==i;this._unmaskedValue=e,this._value=s,this._rawInputValue=i,this.el.value!==a&&(this.el.value=a),"auto"===t?this.alignCursor():null!=t&&(this.cursorPos=t),r&&this._fireChangeEvents(),this._historyChanging||!r&&!this.history.isEmpty||this.history.push({unmaskedValue:e,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:e,...s}=t,i=!this.maskEquals(e),a=this.masked.optionsIsChanged(s);i&&(this.mask=e),a&&this.masked.updateOptions(s),(i||a)&&this.updateControl()}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,p.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){return this._listeners[t]&&(e?0<=(e=this._listeners[t].indexOf(e))&&this._listeners[t].splice(e,1):delete this._listeners[t]),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();var t=new P({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),e=this.masked.rawInputValue,s=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,e=e===this.masked.rawInputValue?t.removeDirection:p.NONE;let i=this.masked.nearestInputPos(t.startChangePos+s,e);e!==p.NONE&&(i=this.masked.nearestInputPos(i,p.NONE)),this.updateControl(i),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}o.InputMask=m;class _{static normalize(t){return Array.isArray(t)?t:[t,new _]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}o.ChangeDetails=_;class v{constructor(t,e,s){void 0===e&&(e=0),this.value=t=void 0===t?"":t,this.from=e,this.stop=s}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){return!this.value.length||null!=t&&this.from>=t?"":(t=this.value[0],this.value=this.value.slice(1),t)}shift(){var t;return this.value.length?(t=this.value[this.value.length-1],this.value=this.value.slice(0,-1),t):""}}class f{constructor(t){this._value="",this._update({...f.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,e){void 0===e&&(e={input:!0}),this.reset(),this.append(t,e,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,e){return t}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),Math.min(this.displayValue.length,e-t)}extractInput(t,e,s){return void 0===e&&(e=this.displayValue.length),this.displayValue.slice(t=void 0===t?0:t,e)}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new v(this.extractInput(t,e),t)}appendTail(t){return(t=u(t)?new v(String(t)):t).appendTo(this)}_appendCharRaw(t,e){return t?(this._value+=t,new _({inserted:t,rawInserted:t})):new _}_appendChar(e,i,a){void 0===i&&(i={});var r=this.state;let u;if([e,u]=this.doPrepareChar(e,i),e&&!(u=u.aggregate(this._appendCharRaw(e,i))).rawInserted&&"pad"===this.autofix){const a=this.state;this.state=r;let t=this.pad(i);e=this._appendCharRaw(e,i);t=t.aggregate(e),e.rawInserted||t.equals(u)?u=t:this.state=a}if(u.inserted){let e,s=!1!==this.doValidate(i);if(s&&null!=a){const i=this.state;if(!0===this.overwrite){e=a.state;for(let t=0;t<u.rawInserted.length;++t)a.unshift(this.displayValue.length-u.tailShift)}let t=this.appendTail(a);if(!((s=t.rawInserted.length===a.toString().length)&&t.inserted||"shift"!==this.overwrite)){this.state=i,e=a.state;for(let t=0;t<u.rawInserted.length;++t)a.shift();t=this.appendTail(a),s=t.rawInserted.length===a.toString().length}s&&t.inserted&&(this.state=i)}s||(u=new _,this.state=r,a&&e&&(a.state=e))}return u}_appendPlaceholder(){return new _}_appendEager(){return new _}append(e,s,i){if(!u(e))throw new Error("value should be string");var a,r=u(i)?new v(String(i)):i;null!=s&&s.tail&&(s._beforeTailState=this.state),[e,a]=this.doPrepare(e,s);for(let t=0;t<e.length;++t){const i=this._appendChar(e[t],s,r);if(!i.rawInserted&&!this.doSkipInvalid(e[t],s,r))break;a.aggregate(i)}return(!0===this.eager||"append"===this.eager)&&null!=s&&s.input&&e&&a.aggregate(this._appendEager()),null!=r&&(a.tailShift+=this.appendTail(r).tailShift),a}remove(t,e){return void 0===e&&(e=this.displayValue.length),this._value=this.displayValue.slice(0,t=void 0===t?0:t)+this.displayValue.slice(e),new _}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;var e=this.rawInputValue,s=this.value,t=t();return this.rawInputValue=e,this.value&&this.value!==s&&0===s.indexOf(this.value)&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,t}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;var e=this.state,t=t(this);return this.state=e,delete this._isolated,t}doSkipInvalid(t,e,s){return Boolean(this.skipInvalid)}doPrepare(t,e){return void 0===e&&(e={}),_.normalize(this.prepare?this.prepare(t,this,e):t)}doPrepareChar(t,e){return void 0===e&&(e={}),_.normalize(this.prepareChar?this.prepareChar(t,this,e):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,e,s,i,a){void 0===s&&(s=""),void 0===i&&(i=p.NONE),void 0===a&&(a={input:!0});var r=t+e,u=this.extractTail(r),n=!0===this.eager||"remove"===this.eager;let h,l=(n&&(i=d(i),h=this.extractInput(0,r,{raw:!0})),t);var o=new _;if(i!==p.NONE&&(l=this.nearestInputPos(t,1<e&&0!==t&&!n?p.NONE:i),o.tailShift=l-t),o.aggregate(this.remove(l)),n&&i!==p.NONE&&h===this.rawInputValue)if(i===p.FORCE_LEFT){let t;for(;h===this.rawInputValue&&(t=this.displayValue.length);)o.aggregate(new _({tailShift:-1})).aggregate(this.remove(t-1))}else i===p.FORCE_RIGHT&&u.unshift();return o.aggregate(this.append(s,a,u))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!h(this,t)}typedValueEquals(t){var e=this.typedValue;return t===e||f.EMPTY_VALUES.includes(t)&&f.EMPTY_VALUES.includes(e)||!!this.format&&this.format(t,this)===this.format(this.typedValue,this)}pad(t){return new _}}f.DEFAULTS={skipInvalid:!0},f.EMPTY_VALUES=[void 0,null,""],o.Masked=f;class E{constructor(t,e){void 0===e&&(e=0),this.chunks=t=void 0===t?[]:t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(t){if(String(t)){t=u(t)?new v(String(t)):t;var e,s=this.chunks[this.chunks.length-1],i=s&&(s.stop===t.stop||null==t.stop)&&t.from===s.from+s.toString().length;if(t instanceof v)i?s.extend(t.toString()):this.chunks.push(t);else if(t instanceof E){if(null==t.stop)for(;t.chunks.length&&null==t.chunks[0].stop;)(e=t.chunks.shift()).from+=t.from,this.extend(e);t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}}appendTo(s){if(!(s instanceof o.MaskedPattern))return new v(this.toString()).appendTo(s);var i=new _;for(let e=0;e<this.chunks.length;++e){var a=this.chunks[e],r=s._mapPosToBlock(s.displayValue.length),u=a.stop;let t;null!=u&&(!r||r.index<=u)&&((a instanceof E||0<=s._stops.indexOf(u))&&i.aggregate(s._appendPlaceholder(u)),t=a instanceof E&&s._blocks[u]),t?(r=t.appendTail(a),i.aggregate(r),(u=a.toString().slice(r.rawInserted.length))&&i.aggregate(s.append(u,{tail:!0}))):i.aggregate(s.append(a.toString(),{tail:!0}))}return i}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e,...s}=t;Object.assign(this,s),this.chunks=e.map(t=>{var e=new("chunks"in t?E:v);return e.state=t,e})}unshift(e){if(this.chunks.length&&!(null!=e&&this.from>=e)){var s=null!=e?e-this.from:e;let t=0;for(;t<this.chunks.length;){const e=this.chunks[t],i=e.unshift(s);if(e.toString()){if(!i)break;++t}else this.chunks.splice(t,1);if(i)return i}}return""}shift(){if(this.chunks.length){let t=this.chunks.length-1;for(;0<=t;){var e=this.chunks[t],s=e.shift();if(e.toString()){if(!s)break;--t}else this.chunks.splice(t,1);if(s)return s}}return""}}class O{constructor(t,e){this.masked=t,this._log=[];var{offset:t,index:e}=t._mapPosToBlock(e)||(e<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=t,this.index=e,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){var t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(e=this.block)?void 0:e.displayValue.length)||0){var e;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,p.FORCE_LEFT),0!==this.offset||void 0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,p.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,p.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,p.FORCE_RIGHT),this.offset!==this.block.value.length||void 0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,p.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,p.NONE),!0})}}class C{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,e){return void 0===e&&(e=this._value.length),this._value=this._value.slice(0,t=void 0===t?0:t)+this._value.slice(e),this._value||(this._isRawInput=!1),new _}nearestInputPos(t,e){void 0===e&&(e=p.NONE);var s=this._value.length;switch(e){case p.LEFT:case p.FORCE_LEFT:return 0;default:return s}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._isRawInput?e-t:0}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),(s=void 0===s?{}:s).raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(t,e){var s;return void 0===e&&(e={}),this.isFilled?new _:(s=!0===this.eager||"append"===this.eager,t=this.char===t&&(this.isUnmasking||e.input||e.raw)&&(!e.raw||!s)&&!e.tail,s=new _({inserted:this.char,rawInserted:t?this.char:""}),this._value=this.char,this._isRawInput=t&&(e.raw||e.input),s)}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){var t=new _;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new v("")}appendTail(t){return(t=u(t)?new v(String(t)):t).appendTo(this)}append(t,e,s){t=this._appendChar(t[0],e);return null!=s&&(t.tailShift+=this.appendTail(s).tailShift),t}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=Boolean(t._rawInputValue)}pad(t){return this._appendPlaceholder()}}class A{constructor(t){const{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:r,eager:u,...n}=t;this.masked=g(n),Object.assign(this,{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:r,eager:u})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,e){return void 0===e&&(e=this.value.length),0===(t=void 0===t?0:t)&&1<=e?(this.isFilled=!1,this.masked.remove(t,e)):new _}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new _;var s=this.masked.state;let i=this.masked._appendChar(t,this.currentMaskFlags(e));return i.inserted&&!1===this.doValidate(e)&&(i=new _,this.masked.state=s),i.inserted||this.isOptional||this.lazy||e.input||(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=Boolean(i.inserted),i}append(t,e,s){return this.masked.append(t,this.currentMaskFlags(e),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new _:(this.isFilled=!0,new _({inserted:this.placeholderChar}))}_appendEager(){return new _}extractTail(t,e){return this.masked.extractTail(t,e)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,e,s){return void 0===e&&(e=this.value.length),this.masked.extractInput(t=void 0===t?0:t,e,s)}nearestInputPos(t,e){void 0===e&&(e=p.NONE);var s=this.value.length,i=Math.min(Math.max(t,0),s);switch(e){case p.LEFT:case p.FORCE_LEFT:return this.isComplete?i:0;case p.RIGHT:case p.FORCE_RIGHT:return this.isComplete?i:s;default:return i}}totalInputPositions(t,e){return void 0===e&&(e=this.value.length),this.value.slice(t=void 0===t?0:t,e).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var e;return{...t,_beforeTailState:(null==t||null==(e=t._beforeTailState)?void 0:e.masked)||(null==t?void 0:t._beforeTailState)}}pad(t){return new _}}A.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class F extends f{updateOptions(t){super.updateOptions(t)}_update(t){const e=t.mask;e&&(t.validate=t=>0<=t.search(e)),super._update(t)}}o.MaskedRegExp=F;class x extends f{constructor(t){super({...x.DEFAULTS,...t,definitions:Object.assign({},A.DEFAULT_DEFINITIONS,null==t?void 0:t.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const r=this.definitions,u=(this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={},this.mask);if(u&&r){let i=!1,a=!1;for(let s=0;s<u.length;++s){if(this.blocks){const r=u.slice(s),t=Object.keys(this.blocks).filter(t=>0===r.indexOf(t)),e=(t.sort((t,e)=>e.length-t.length),t[0]);if(e){const{expose:r,repeat:u,...t}=c(this.blocks[e]),h={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...t,repeat:u,parent:this},l=null!=u?new o.RepeatBlock(h):g(h);l&&(this._blocks.push(l),r&&(this.exposeBlock=l),this._maskedBlocks[e]||(this._maskedBlocks[e]=[]),this._maskedBlocks[e].push(this._blocks.length-1)),s+=e.length-1;continue}}let t=u[s],e=t in r;if(t===x.STOP_CHAR)this._stops.push(this._blocks.length);else if("{"===t||"}"===t)i=!i;else if("["===t||"]"===t)a=!a;else{if(t===x.ESCAPE_CHAR){if(++s,!(t=u[s]))break;e=!1}var n=e?new A({isOptional:a,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...c(r[t]),parent:this}):new C({char:t,eager:this.eager,isUnmasking:i});this._blocks.push(n)}}}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(t){const{_blocks:s,...e}=t;this._blocks.forEach((t,e)=>t.state=s[e]),super.state=e}else this.reset()}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,e)=>t+e.unmaskedValue,"")}set unmaskedValue(t){var e;this.exposeBlock?(e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length),this.exposeBlock.unmaskedValue=t,this.appendTail(e),this.doCommit()):super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,e)=>t+e.value,"")}set value(t){var e;this.exposeBlock?(e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length),this.exposeBlock.value=t,this.appendTail(e),this.doCommit()):super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){var e;this.exposeBlock?(e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length),this.exposeBlock.typedValue=t,this.appendTail(e),this.doCommit()):super.typedValue=t}get displayValue(){return this._blocks.reduce((t,e)=>t+e.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t,e=new _;let s=null==(t=this._mapPosToBlock(this.displayValue.length))?void 0:t.index;if(null!=s){this._blocks[s].isFilled&&++s;for(let t=s;t<this._blocks.length;++t){const s=this._blocks[t]._appendEager();if(!s.inserted)break;e.aggregate(s)}}return e}_appendCharRaw(s,i){void 0===i&&(i={});const a=this._mapPosToBlock(this.displayValue.length),r=new _;if(a)for(let t,e=a.index;t=this._blocks[e];++e){var u;const a=t._appendChar(s,{...i,_beforeTailState:null==(u=i._beforeTailState)||null==(u=u._blocks)?void 0:u[e]});if(r.aggregate(a),a.consumed)break}return r}extractTail(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const a=new E;return t!==e&&this._forEachBlocksInRange(t,e,(t,e,s,i)=>{t=t.extractTail(s,i);t.stop=this._findStopBefore(e),t.from=this._blockStartPos(e),t instanceof E&&(t.blockIndex=e),a.extend(t)}),a}extractInput(t,e,a){if(void 0===e&&(e=this.displayValue.length),void 0===a&&(a={}),(t=void 0===t?0:t)===e)return"";let r="";return this._forEachBlocksInRange(t,e,(t,e,s,i)=>{r+=t.extractInput(s,i,a)}),r}_findStopBefore(e){let s;for(let t=0;t<this._stops.length;++t){var i=this._stops[t];if(!(i<=e))break;s=i}return s}_appendPlaceholder(e){const s=new _;var t,i;return this.lazy&&null==e||(t=this._mapPosToBlock(this.displayValue.length))&&(t=t.index,i=null!=e?e:this._blocks.length,this._blocks.slice(t,i).forEach(t=>{t.lazy&&null==e||s.aggregate(t._appendPlaceholder(null==(t=t._blocks)?void 0:t.length))})),s}_mapPosToBlock(e){let s="";for(let t=0;t<this._blocks.length;++t){var i=this._blocks[t],a=s.length;if(e<=(s+=i.displayValue).length)return{index:t,offset:e-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((t,e)=>t+e.displayValue.length,0)}_forEachBlocksInRange(e,t,s){void 0===t&&(t=this.displayValue.length);var i=this._mapPosToBlock(e);if(i){const e=this._mapPosToBlock(t),a=e&&i.index===e.index,r=i.offset,u=e&&a?e.offset:this._blocks[i.index].displayValue.length;if(s(this._blocks[i.index],i.index,r,u),e&&!a){for(let t=i.index+1;t<e.index;++t)s(this._blocks[t],t,0,this._blocks[t].displayValue.length);s(this._blocks[e.index],e.index,0,e.offset)}}}remove(t,e){void 0===e&&(e=this.displayValue.length);const a=super.remove(t=void 0===t?0:t,e);return this._forEachBlocksInRange(t,e,(t,e,s,i)=>{a.aggregate(t.remove(s,i))}),a}nearestInputPos(t,e){if(void 0===e&&(e=p.NONE),!this._blocks.length)return 0;var s=new O(this,t);if(e===p.NONE)return s.pushRightBeforeInput()||(s.popState(),s.pushLeftBeforeInput())?s.pos:this.displayValue.length;if(e!==p.LEFT&&e!==p.FORCE_LEFT)return e===p.RIGHT||e===p.FORCE_RIGHT?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:e===p.FORCE_RIGHT?this.displayValue.length:(s.popState(),s.ok||(s.popState(),s.ok)?s.pos:this.nearestInputPos(t,p.LEFT))):t;if(e===p.LEFT){if(s.pushRightBeforeFilled(),s.ok&&s.pos===t)return t;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),e===p.LEFT){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=t)return s.pos;if(s.popState(),s.ok&&s.pos<=t)return s.pos;s.popState()}return s.ok||e!==p.FORCE_LEFT&&(s.popState(),s.ok||(s.popState(),s.ok))?s.pos:0}totalInputPositions(t,e){void 0===e&&(e=this.displayValue.length);let a=0;return this._forEachBlocksInRange(t=void 0===t?0:t,e,(t,e,s,i)=>{a+=t.totalInputPositions(s,i)}),a}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){t=this._maskedBlocks[t];return t?t.map(t=>this._blocks[t]):[]}pad(e){const s=new _;return this._forEachBlocksInRange(0,this.displayValue.length,t=>s.aggregate(t.pad(e))),s}}x.DEFAULTS={...f.DEFAULTS,lazy:!0,placeholderChar:"_"},x.STOP_CHAR="`",x.ESCAPE_CHAR="\\",x.InputDefinition=A,x.FixedDefinition=C;class S extends(o.MaskedPattern=x){get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:e=this.to||0,from:s=this.from||0,maxLength:i=this.maxLength||0,autofix:a=this.autofix,...r}=t;this.to=e,this.from=s,this.maxLength=Math.max(String(e).length,i),this.autofix=a;var u=String(this.from).padStart(this.maxLength,"0"),n=String(this.to).padStart(this.maxLength,"0");let h=0;for(;h<n.length&&n[h]===u[h];)++h;r.mask=n.slice(0,h).replace(/0/g,"\\0")+"0".repeat(this.maxLength-h),super._update(r)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(t){let e="",s="";var[,t,i]=t.match(/^(\D*)(\d*)(\D*)/)||[];return i&&(e="0".repeat(t.length)+i,s="9".repeat(t.length)+i),e=e.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[e,s]}doPrepareChar(t,e){return void 0===e&&(e={}),[t,e]=super.doPrepareChar(t.replace(/\D/g,""),e),t||(e.skip=!this.isComplete),[t,e]}_appendCharRaw(t,e){var s,i,a,r;return void 0===e&&(e={}),!this.autofix||this.value.length+1>this.maxLength?super._appendCharRaw(t,e):(s=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[a,r]=this.boundaries(this.value+t),Number(r)<this.from?super._appendCharRaw(s[this.value.length],e):Number(a)>this.to?!e.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],e).aggregate(this._appendCharRaw(t,e)):super._appendCharRaw(i[this.value.length],e):super._appendCharRaw(t,e))}doValidate(t){var e,s=this.value;return-1===s.search(/[^0]/)&&s.length<=this._matchFrom||([s,e]=this.boundaries(s),this.from<=Number(e)&&Number(s)<=this.to&&super.doValidate(t))}pad(e){var s=new _;if(this.value.length!==this.maxLength){var t=this.value,i=this.maxLength-this.value.length;if(i){this.reset();for(let t=0;t<i;++t)s.aggregate(super._appendCharRaw("0",e));t.split("").forEach(t=>this._appendCharRaw(t))}}return s}}o.MaskedRange=S;class B extends x{static extractPatternOptions(t){const{mask:e,pattern:s,...i}=t;return{...i,mask:u(e)?e:s}}constructor(t){super(B.extractPatternOptions({...B.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:e,pattern:s,blocks:i,...a}={...B.DEFAULTS,...t},r=Object.assign({},B.GET_DEFAULT_BLOCKS());t.min&&(r.Y.from=t.min.getFullYear()),t.max&&(r.Y.to=t.max.getFullYear()),t.min&&t.max&&r.Y.from===r.Y.to&&(r.m.from=t.min.getMonth()+1,r.m.to=t.max.getMonth()+1,r.m.from===r.m.to)&&(r.d.from=t.min.getDate(),r.d.to=t.max.getDate()),Object.assign(r,this.blocks,i),super._update({...a,mask:u(e)?e:s,blocks:r})}doValidate(t){var e=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&null!=e&&(null==this.min||this.min<=e)&&(null==this.max||e<=this.max))}isDateExist(t){return 0<=this.format(this.parse(t,this),this).indexOf(t)}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(B.extractPatternOptions(t))}}B.GET_DEFAULT_BLOCKS=()=>({d:{mask:S,from:1,to:31,maxLength:2},m:{mask:S,from:1,to:12,maxLength:2},Y:{mask:S,from:1900,to:9999}}),B.DEFAULTS={...x.DEFAULTS,mask:Date,pattern:"d{.}`m{.}`Y",format:(t,e)=>t?[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join("."):"",parse:(t,e)=>{var[t,s,i]=t.split(".").map(Number);return new Date(i,s-1,t)}},o.MaskedDate=B;class b extends f{constructor(t){super({...b.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(t=>{const{expose:e,...s}=c(t),i=g({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return e&&(this.exposeMask=i),i}):[])}_appendCharRaw(t,e){var s=this._applyDispatch(t,e=void 0===e?{}:e);return this.currentMask&&s.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(e))),s}_applyDispatch(t,e,s){void 0===t&&(t=""),void 0===s&&(s="");var i=(e=void 0===e?{}:e).tail&&null!=e._beforeTailState?e._beforeTailState._value:this.value,a=this.rawInputValue,r=e.tail&&null!=e._beforeTailState?e._beforeTailState._rawInputValue:a,a=a.slice(r.length),u=this.currentMask,n=new _,h=null==u?void 0:u.state;return this.currentMask=this.doDispatch(t,{...e},s),this.currentMask&&(this.currentMask!==u?(this.currentMask.reset(),r&&(this.currentMask.append(r,{raw:!0}),n.tailShift=this.currentMask.value.length-i.length),a&&(n.tailShift+=this.currentMask.append(a,{raw:!0,tail:!0}).tailShift)):h&&(this.currentMask.state=h)),n}_appendPlaceholder(){var t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){var t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){var e=new _;return t&&e.aggregate(this._applyDispatch("",{},t)),e.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var e;return{...t,_beforeTailState:(null==(e=t._beforeTailState)?void 0:e.currentMaskRef)===this.currentMask&&(null==(e=t._beforeTailState)?void 0:e.currentMask)||t._beforeTailState}}doDispatch(t,e,s){return this.dispatch(t,this,e=void 0===e?{}:e,s=void 0===s?"":s)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,e){let[s,i]=super.doPrepare(t,e=void 0===e?{}:e);return this.currentMask&&([s,t]=super.doPrepare(s,this.currentMaskFlags(e)),i=i.aggregate(t)),[s,i]}doPrepareChar(t,e){let[s,i]=super.doPrepareChar(t,e=void 0===e?{}:e);return this.currentMask&&([s,t]=super.doPrepareChar(s,this.currentMaskFlags(e)),i=i.aggregate(t)),[s,i]}reset(){var t;null!=(t=this.currentMask)&&t.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask)this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();else{let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isComplete)}get isFilled(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isFilled)}remove(t,e){var s=new _;return this.currentMask&&s.aggregate(this.currentMask.remove(t,e)).aggregate(this._applyDispatch()),s}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:null==(t=this.currentMask)?void 0:t.state}}set state(t){const{compiledMasks:s,currentMaskRef:e,currentMask:i,...a}=t;s&&this.compiledMasks.forEach((t,e)=>t.state=s[e]),null!=e&&(this.currentMask=e,this.currentMask.state=i),super.state=a}extractInput(t,e,s){return this.currentMask?this.currentMask.extractInput(t,e,s):""}extractTail(t,e){return this.currentMask?this.currentMask.extractTail(t,e):super.extractTail(t,e)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,e){return this.currentMask?this.currentMask.nearestInputPos(t,e):super.nearestInputPos(t,e)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(a){return Array.isArray(a)?this.compiledMasks.every((t,e)=>{if(a[e]){const{mask:s,...i}=a[e];return h(t,i)&&t.maskEquals(s)}}):super.maskEquals(a)}typedValueEquals(t){var e;return Boolean(null==(e=this.currentMask)?void 0:e.typedValueEquals(t))}}b.DEFAULTS={...f.DEFAULTS,dispatch:(a,r,u,n)=>{if(r.compiledMasks.length){const h=r.rawInputValue,t=r.compiledMasks.map((t,e)=>{var s=r.currentMask===t,i=s?t.displayValue.length:t.nearestInputPos(t.displayValue.length,p.FORCE_LEFT);return t.rawInputValue!==h?(t.reset(),t.append(h,{raw:!0})):s||t.remove(i),t.append(a,r.currentMaskFlags(u)),t.appendTail(n),{index:e,weight:t.rawInputValue.length,totalInputPositions:t.totalInputPositions(0,Math.max(i,t.nearestInputPos(t.displayValue.length,p.FORCE_LEFT)))}});return t.sort((t,e)=>e.weight-t.weight||e.totalInputPositions-t.totalInputPositions),r.compiledMasks[t[0].index]}}},o.MaskedDynamic=b;class D extends x{constructor(t){super({...D.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:e,...s}=t;if(e){const t=e.map(t=>t.length),i=Math.min(...t),a=Math.max(...t)-i;s.mask="*".repeat(i),a&&(s.mask+="["+"*".repeat(a)+"]"),this.enum=e}super._update(s)}_appendCharRaw(e,i){void 0===i&&(i={});const s=Math.min(this.nearestInputPos(0,p.FORCE_RIGHT),this.value.length),a=this.enum.filter(t=>this.matchValue(t,this.unmaskedValue+e,s));if(a.length){1===a.length&&this._forEachBlocksInRange(0,this.value.length,(t,e)=>{var s=a[0][e];e>=this.value.length||s===t.value||(t.reset(),t._appendChar(s,i))});const e=super._appendCharRaw(a[0][this.value.length],i);return 1===a.length&&a[0].slice(this.unmaskedValue.length).split("").forEach(t=>e.aggregate(super._appendCharRaw(t))),e}return new _({skip:!this.isComplete})}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new v("",t)}remove(t,e){if((t=void 0===t?0:t)===(e=void 0===e?this.displayValue.length:e))return new _;const s=Math.min(super.nearestInputPos(0,p.FORCE_RIGHT),this.value.length);let i;for(i=t;0<=i&&!(1<this.enum.filter(t=>this.matchValue(t,this.value.slice(s,i),s)).length);--i);e=super.remove(i,e);return e.tailShift+=i-t,e}get isComplete(){return 0<=this.enum.indexOf(this.value)}}D.DEFAULTS={...x.DEFAULTS,matchValue:(t,e,s)=>t.indexOf(e,s)===s},o.MaskedEnum=D;class y extends f{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}var M;o.MaskedFunction=y;class I extends f{constructor(t){super({...I.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){var t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"("+s(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(s).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(s(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){t=t.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepareChar(t,e){void 0===e&&(e={});var[e,s]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(e.input&&e.raw||!e.input&&!e.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),e);return t&&!e&&(s.skip=!0),!e||this.allowPositive||this.value||"-"===e||s.aggregate(this._appendChar("-")),[e,s]}_separatorsCount(e,s){void 0===s&&(s=!1);let i=0;for(let t=0;t<e;++t)this._value.indexOf(this.thousandsSeparator,t)===t&&(++i,s)&&(e+=this.thousandsSeparator.length);return i}_separatorsCountFromSlice(t){return void 0===t&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,s))}_appendCharRaw(t,e){var s=((e=void 0===e?{}:e).tail&&e._beforeTailState?e._beforeTailState:this)._value,s=this._separatorsCountFromSlice(s),i=(this._value=this._removeThousandsSeparators(this.value),this._value),a=(this._value+=t,this.number);let r,u=!isNaN(a),n=!1;if(u){let t;null!=this.min&&this.min<0&&this.number<this.min&&(t=this.min),null!=(t=null!=this.max&&0<this.max&&this.number>this.max?this.max:t)&&(this.autofix?(this._value=this.format(t,this).replace(I.UNMASKED_RADIX,this.radix),n=n||i===this._value&&!e.tail):u=!1),u=u&&Boolean(this._value.match(this._numberRegExp))}r=u?new _({inserted:this._value.slice(i.length),rawInserted:n?"":t,skip:n}):(this._value=i,new _),this._value=this._insertThousandsSeparators(this._value);a=(e.tail&&e._beforeTailState?e._beforeTailState:this)._value,t=this._separatorsCountFromSlice(a);return r.tailShift+=(t-s)*this.thousandsSeparator.length,r}_findSeparatorAround(t){if(this.thousandsSeparator){var e=t-this.thousandsSeparator.length+1,e=this.value.indexOf(this.thousandsSeparator,e);if(e<=t)return e}return-1}_adjustRangeWithSeparators(t,e){var s=this._findSeparatorAround(t),s=(0<=s&&(t=s),this._findSeparatorAround(e));return[t,e=0<=s?s+this.thousandsSeparator.length:e]}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e);var t=this.value.slice(0,t),e=this.value.slice(e),s=this._separatorsCount(t.length),e=(this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(t+e)),this._separatorsCountFromSlice(t));return new _({tailShift:(e-s)*this.thousandsSeparator.length})}nearestInputPos(t,e){if(this.thousandsSeparator)switch(e){case p.NONE:case p.LEFT:case p.FORCE_LEFT:var s=this._findSeparatorAround(t-1);if(0<=s){var i=s+this.thousandsSeparator.length;if(t<i||this.value.length<=i||e===p.FORCE_LEFT)return s}break;case p.RIGHT:case p.FORCE_RIGHT:{const e=this._findSeparatorAround(t);if(0<=e)return e+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){var s=this.number;let t=s,e=(null!=this.min&&(t=Math.max(t,this.min)),(t=null!=this.max?Math.min(t,this.max):t)!==s&&(this.unmaskedValue=this.format(t,this)),this.value);this.normalizeZeros&&(e=this._normalizeZeros(e)),this.padFractionalZeros&&0<this.scale&&(e=this._padFractionalZeros(e)),this._value=e}super.doCommit()}_normalizeZeros(t){var e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,(t,e,s,i)=>e+i),t.length&&!/\d$/.test(e[0])&&(e[0]=e[0]+"0"),1<e.length&&(e[1]=e[1].replace(/0*$/,""),e[1].length||(e.length=1)),this._insertThousandsSeparators(e.join(this.radix))}_padFractionalZeros(t){var e;return t&&((e=t.split(this.radix)).length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix))}doSkipInvalid(t,e,s){void 0===e&&(e={});var i=0===this.scale&&t!==this.thousandsSeparator&&(t===this.radix||t===I.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,e,s)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,I.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(I.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return null!=this.min&&this.min<0||null!=this.max&&this.max<0}get allowPositive(){return null!=this.min&&0<this.min||null!=this.max&&0<this.max}typedValueEquals(t){return(super.typedValueEquals(t)||I.EMPTY_VALUES.includes(t)&&I.EMPTY_VALUES.includes(this.typedValue))&&!(0===t&&""===this.value)}}(M=I).UNMASKED_RADIX=".",I.EMPTY_VALUES=[...f.EMPTY_VALUES,0],I.DEFAULTS={...f.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[M.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:t=>t.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},o.MaskedNumber=I;const V={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function T(t,s,i){void 0===s&&(s=V.MASKED),void 0===i&&(i=V.MASKED);const a=g(t);return e=>a.runIsolated(t=>(t[s]=e,t[i]))}function w(t,e,s,i){return T(e,s,i)(t)}o.PIPE_TYPE=V,o.createPipe=T,o.pipe=w;class R extends x{get repeatFrom(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?t:0}get repeatTo(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var e;const{repeat:s,...i}=c(t);this._blockOpts=Object.assign({},this._blockOpts,i);t=g(this._blockOpts);this.repeat=null!=(e=null!=(e=null!=s?s:t.repeat)?e:this.repeat)?e:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&(null==(e=this._blocks)?void 0:e.length)||0,this.repeatFrom)),blocks:{m:t},eager:t.eager,overwrite:t.overwrite,skipInvalid:t.skipInvalid,lazy:t.lazy,placeholderChar:t.placeholderChar,displayChar:t.displayChar})}_allocateBlock(t){return t<this._blocks.length?this._blocks[t]:this.repeatTo===1/0||this._blocks.length<this.repeatTo?(this._blocks.push(g(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]):void 0}_appendCharRaw(i,a){void 0===a&&(a={});var r=new _;for(let t,e,s=null!=(u=null==(u=this._mapPosToBlock(this.displayValue.length))?void 0:u.index)?u:Math.max(this._blocks.length-1,0);t=null!=(n=this._blocks[s])?n:e=!e&&this._allocateBlock(s);++s){var u,n=t._appendChar(i,{...a,_beforeTailState:null==(n=a._beforeTailState)||null==(n=n._blocks)?void 0:n[s]});if(n.skip&&e){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(r.aggregate(n),n.consumed)break}return r}_trimEmptyTail(e,s){void 0===e&&(e=0);var i=Math.max((null==(e=this._mapPosToBlock(e))?void 0:e.index)||0,this.repeatFrom,0);let a,r=0;for(let t=a=null==(a=null!=s?null==(e=this._mapPosToBlock(s))?void 0:e.index:a)?this._blocks.length-1:a;i<=t&&!this._blocks[t].unmaskedValue;--t,++r);r&&(this._blocks.splice(a-r+1,r),this.mask=this.mask.slice(r))}reset(){super.reset(),this._trimEmptyTail()}remove(t,e){void 0===e&&(e=this.displayValue.length);var s=super.remove(t=void 0===t?0:t,e);return this._trimEmptyTail(t,e),s}totalInputPositions(t,e){return void 0===t&&(t=0),null==e&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,e)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}o.RepeatBlock=R;try{globalThis.IMask=o}catch{}t.ChangeDetails=_,t.ChunksTailDetails=E,t.DIRECTION=p,t.HTMLContenteditableMaskElement=l,t.HTMLInputMaskElement=n,t.HTMLMaskElement=e,t.InputMask=m,t.MaskElement=r,t.Masked=f,t.MaskedDate=B,t.MaskedDynamic=b,t.MaskedEnum=D,t.MaskedFunction=y,t.MaskedNumber=I,t.MaskedPattern=x,t.MaskedRange=S,t.MaskedRegExp=F,t.PIPE_TYPE=V,t.PatternFixedDefinition=C,t.PatternInputDefinition=A,t.RepeatBlock=R,t.createMask=g,t.createPipe=T,t.default=o,t.forceDirection=d,t.normalizeOpts=c,t.pipe=w,Object.defineProperty(t,"__esModule",{value:!0})});