@ldmjs/ui 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +402 -1
- package/dist/calendar.js +1 -0
- package/dist/css/calendar.css +29 -0
- package/dist/css/index.css +36 -0
- package/dist/css/root.css +86 -0
- package/dist/floating.js +1 -0
- package/dist/fonts/Roboto-Regular.ttf +0 -0
- package/dist/fonts/Roboto-Regular.woff +0 -0
- package/dist/fonts/Roboto-Regular.woff2 +0 -0
- package/dist/imask.js +1 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +11231 -0
- package/dist/multiselect.js +1 -0
- package/dist/runtime-template.js +1 -0
- package/dist/scss/_breadcrumbs.scss +48 -0
- package/dist/scss/_buttons.scss +301 -0
- package/dist/scss/_calendar.scss +25 -0
- package/dist/scss/_chip.scss +68 -0
- package/dist/scss/_colors.scss +73 -0
- package/dist/scss/_fonts.scss +13 -0
- package/dist/scss/_inputs.scss +171 -0
- package/dist/scss/_multiselect.scss +164 -0
- package/dist/scss/_toolbar.scss +16 -0
- package/dist/scss/_variables.scss +25 -0
- package/dist/scss/index.scss +10 -0
- package/dist/types/breadcrumbs.d.ts +22 -0
- package/dist/types/options.d.ts +47 -0
- package/dist/types/validation.d.ts +16 -0
- package/package.json +82 -6
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--primary-d-1: hsla(210, 100%, 18%, 100%);
|
|
3
|
+
--primary: hsla(210, 100%, 26%, 100%);
|
|
4
|
+
--primary-l-1: hsla(210, 100%, 34%, 100%);
|
|
5
|
+
--primary-l-2: hsla(210, 100%, 42%, 100%);
|
|
6
|
+
--primary-l-3: hsla(210, 100%, 50%, 100%);
|
|
7
|
+
--primary-l-4: hsla(210, 100%, 58%, 100%);
|
|
8
|
+
--primary-l-5: hsla(210, 100%, 66%, 100%);
|
|
9
|
+
--primary-l-6: hsla(210, 100%, 74%, 100%);
|
|
10
|
+
--primary-l-7: hsla(210, 100%, 82%, 100%);
|
|
11
|
+
--primary-l-8: hsla(210, 100%, 90%, 100%);
|
|
12
|
+
|
|
13
|
+
--dark: hsla(219, 83%, 14%, 100%);
|
|
14
|
+
--dark-l-1-09: hsla(219, 83%, 14%, 90%);
|
|
15
|
+
--dark-l-2-08: hsla(219, 83%, 14%, 80%);
|
|
16
|
+
--dark-l-3-07: hsla(219, 83%, 14%, 70%);
|
|
17
|
+
--dark-l-4-06: hsla(219, 83%, 14%, 60%);
|
|
18
|
+
--dark-l-5-05: hsla(219, 83%, 14%, 50%);
|
|
19
|
+
--dark-l-6-04: hsla(219, 83%, 14%, 40%);
|
|
20
|
+
--dark-l-7-03: hsla(219, 83%, 14%, 30%);
|
|
21
|
+
--dark-l-8-02: hsla(219, 83%, 14%, 20%);
|
|
22
|
+
--dark-l-9-01: hsla(219, 83%, 14%, 10%);
|
|
23
|
+
|
|
24
|
+
--secondary-d-4: hsla(204, 100%, 18%, 100%);
|
|
25
|
+
--secondary-d-3: hsla(204, 100%, 26%, 100%);
|
|
26
|
+
--secondary-d-2: hsla(204, 100%, 34%, 100%);
|
|
27
|
+
--secondary-d-1: hsla(204, 100%, 42%, 100%);
|
|
28
|
+
--secondary: hsla(204, 100%, 50%, 100%);
|
|
29
|
+
--secondary-l-1: hsla(204, 100%, 58%, 100%);
|
|
30
|
+
--secondary-l-2: hsla(204, 100%, 66%, 100%);
|
|
31
|
+
--secondary-l-3: hsla(204, 100%, 74%, 100%);
|
|
32
|
+
--secondary-l-4: hsla(204, 100%, 82%, 100%);
|
|
33
|
+
--secondary-l-5: hsla(204, 100%, 90%, 100%);
|
|
34
|
+
|
|
35
|
+
--success-d-3: hsla(135, 59%, 17%, 100%);
|
|
36
|
+
--success-d-2: hsla(135, 59%, 25%, 100%);
|
|
37
|
+
--success-d-1: hsla(135, 59%, 33%, 100%);
|
|
38
|
+
--success: hsla(135, 59%, 41%, 100%);
|
|
39
|
+
--success-l-1: hsla(135, 59%, 49%, 100%);
|
|
40
|
+
--success-l-2: hsla(135, 59%, 57%, 100%);
|
|
41
|
+
--success-l-3: hsla(135, 59%, 65%, 100%);
|
|
42
|
+
--success-l-4: hsla(135, 59%, 73%, 100%);
|
|
43
|
+
--success-l-5: hsla(135, 59%, 81%, 100%);
|
|
44
|
+
--success-l-6: hsla(135, 59%, 89%, 100%);
|
|
45
|
+
|
|
46
|
+
--error-d-3: hsla(7, 82%, 18%, 100%);
|
|
47
|
+
--error-d-2: hsla(7, 82%, 26%, 100%);
|
|
48
|
+
--error-d-1: hsla(7, 82%, 34%, 100%);
|
|
49
|
+
--error: hsla(7, 82%, 42%, 100%);
|
|
50
|
+
--error-l-1: hsla(7, 82%, 50%, 100%);
|
|
51
|
+
--error-l-2: hsla(7, 82%, 58%, 100%);
|
|
52
|
+
--error-l-3: hsla(7, 82%, 66%, 100%);
|
|
53
|
+
--error-l-4: hsla(7, 82%, 74%, 100%);
|
|
54
|
+
--error-l-5: hsla(7, 82%, 82%, 100%);
|
|
55
|
+
--error-l-6: hsla(7, 82%, 90%, 100%);
|
|
56
|
+
|
|
57
|
+
--warning-d-4: hsla(24, 100%, 18%, 100%);
|
|
58
|
+
--warning-d-3: hsla(24, 100%, 26%, 100%);
|
|
59
|
+
--warning-d-2: hsla(24, 100%, 34%, 100%);
|
|
60
|
+
--warning-d-1: hsla(24, 100%, 42%, 100%);
|
|
61
|
+
--warning: hsla(24, 100%, 50%, 100%);
|
|
62
|
+
--warning-l-1: hsla(24, 100%, 58%, 100%);
|
|
63
|
+
--warning-l-2: hsla(24, 100%, 66%, 100%);
|
|
64
|
+
--warning-l-3: hsla(24, 100%, 74%, 100%);
|
|
65
|
+
--warning-l-4: hsla(24, 100%, 82%, 100%);
|
|
66
|
+
--warning-l-5: hsla(24, 100%, 90%, 100%);
|
|
67
|
+
|
|
68
|
+
--grey-d-3: hsla(0, 0%, 14%, 100%);
|
|
69
|
+
--grey-d-2: hsla(0, 0%, 23%, 100%);
|
|
70
|
+
--grey-d-1: hsla(0, 0%, 32%, 100%);
|
|
71
|
+
--grey: hsla(0, 0%, 41%, 100%);
|
|
72
|
+
--grey-l-1: hsla(0, 0%, 50%, 100%);
|
|
73
|
+
--grey-l-2: hsla(0, 0%, 59%, 100%);
|
|
74
|
+
--grey-l-3: hsla(0, 0%, 68%, 100%);
|
|
75
|
+
--grey-l-4: hsla(0, 0%, 77%, 100%);
|
|
76
|
+
--grey-l-5: hsla(0, 0%, 86%, 100%);
|
|
77
|
+
--grey-l-6: hsla(0, 0%, 95%, 100%);
|
|
78
|
+
|
|
79
|
+
--black: hsla(0, 0%, 0%, 100%);
|
|
80
|
+
|
|
81
|
+
--white: hsla(0, 0%, 100%, 100%);
|
|
82
|
+
|
|
83
|
+
--text: hsla(0, 0%, 13%, 100%);
|
|
84
|
+
|
|
85
|
+
--label: hsla(0, 0%, 47%, 100%);
|
|
86
|
+
}
|
package/dist/floating.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["ldmui"]=t():e["ldmui"]=t()})(self,(()=>(()=>{"use strict";var e={};(()=>{e.d=(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})}})(),(()=>{e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{e.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var t={};e.r(t),e.d(t,{arrow:()=>v,autoPlacement:()=>m,autoUpdate:()=>autoUpdate,computePosition:()=>floating_ui_dom_esm_computePosition,detectOverflow:()=>detectOverflow,flip:()=>h,getOverflowAncestors:()=>getOverflowAncestors,hide:()=>w,inline:()=>x,limitShift:()=>b,offset:()=>offset,platform:()=>d,shift:()=>p,size:()=>y});const n=["top","right","bottom","left"],o=["start","end"],i=n.reduce(((e,t)=>e.concat(t,t+"-"+o[0],t+"-"+o[1])),[]),r=Math.min,l=Math.max,s=Math.round,c=Math.floor,createCoords=e=>({x:e,y:e}),a={left:"right",right:"left",bottom:"top",top:"bottom"},f={start:"end",end:"start"};function clamp(e,t,n){return l(e,r(t,n))}function evaluate(e,t){return"function"===typeof e?e(t):e}function getSide(e){return e.split("-")[0]}function getAlignment(e){return e.split("-")[1]}function getOppositeAxis(e){return"x"===e?"y":"x"}function getAxisLength(e){return"y"===e?"height":"width"}function getSideAxis(e){return["top","bottom"].includes(getSide(e))?"y":"x"}function getAlignmentAxis(e){return getOppositeAxis(getSideAxis(e))}function getAlignmentSides(e,t,n){void 0===n&&(n=!1);const o=getAlignment(e),i=getAlignmentAxis(e),r=getAxisLength(i);let l="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[r]>t.floating[r]&&(l=getOppositePlacement(l)),[l,getOppositePlacement(l)]}function getExpandedPlacements(e){const t=getOppositePlacement(e);return[getOppositeAlignmentPlacement(e),t,getOppositeAlignmentPlacement(t)]}function getOppositeAlignmentPlacement(e){return e.replace(/start|end/g,(e=>f[e]))}function getSideList(e,t,n){const o=["left","right"],i=["right","left"],r=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:o:t?o:i;case"left":case"right":return t?r:l;default:return[]}}function getOppositeAxisPlacements(e,t,n,o){const i=getAlignment(e);let r=getSideList(getSide(e),"start"===n,o);return i&&(r=r.map((e=>e+"-"+i)),t&&(r=r.concat(r.map(getOppositeAlignmentPlacement)))),r}function getOppositePlacement(e){return e.replace(/left|right|bottom|top/g,(e=>a[e]))}function expandPaddingObject(e){return{top:0,right:0,bottom:0,left:0,...e}}function getPaddingObject(e){return"number"!==typeof e?expandPaddingObject(e):{top:e,right:e,bottom:e,left:e}}function rectToClientRect(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function computeCoordsFromPlacement(e,t,n){let{reference:o,floating:i}=e;const r=getSideAxis(t),l=getAlignmentAxis(t),s=getAxisLength(l),c=getSide(t),a="y"===r,f=o.x+o.width/2-i.width/2,g=o.y+o.height/2-i.height/2,u=o[s]/2-i[s]/2;let d;switch(c){case"top":d={x:f,y:o.y-i.height};break;case"bottom":d={x:f,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:g};break;case"left":d={x:o.x-i.width,y:g};break;default:d={x:o.x,y:o.y}}switch(getAlignment(t)){case"start":d[l]-=u*(n&&a?-1:1);break;case"end":d[l]+=u*(n&&a?-1:1);break}return d}const computePosition=async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:l}=n,s=r.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:g}=computeCoordsFromPlacement(a,o,c),u=o,d={},m=0;for(let n=0;n<s.length;n++){const{name:r,fn:p}=s[n],{x:h,y,data:w,reset:v}=await p({x:f,y:g,initialPlacement:o,placement:u,strategy:i,middlewareData:d,rects:a,platform:l,elements:{reference:e,floating:t}});f=null!=h?h:f,g=null!=y?y:g,d={...d,[r]:{...d[r],...w}},v&&m<=50&&(m++,"object"===typeof v&&(v.placement&&(u=v.placement),v.rects&&(a=!0===v.rects?await l.getElementRects({reference:e,floating:t,strategy:i}):v.rects),({x:f,y:g}=computeCoordsFromPlacement(a,u,c))),n=-1)}return{x:f,y:g,placement:u,strategy:i,middlewareData:d}};async function detectOverflow(e,t){var n;void 0===t&&(t={});const{x:o,y:i,platform:r,rects:l,elements:s,strategy:c}=e,{boundary:a="clippingAncestors",rootBoundary:f="viewport",elementContext:g="floating",altBoundary:u=!1,padding:d=0}=evaluate(t,e),m=getPaddingObject(d),p="floating"===g?"reference":"floating",h=s[u?p:g],y=rectToClientRect(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(h)))||n?h:h.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:a,rootBoundary:f,strategy:c})),w="floating"===g?{...l.floating,x:o,y:i}:l.reference,v=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),x=await(null==r.isElement?void 0:r.isElement(v))&&await(null==r.getScale?void 0:r.getScale(v))||{x:1,y:1},b=rectToClientRect(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:v,strategy:c}):w);return{top:(y.top-b.top+m.top)/x.y,bottom:(b.bottom-y.bottom+m.bottom)/x.y,left:(y.left-b.left+m.left)/x.x,right:(b.right-y.right+m.right)/x.x}}const arrow=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:i,rects:l,platform:s,elements:c,middlewareData:a}=t,{element:f,padding:g=0}=evaluate(e,t)||{};if(null==f)return{};const u=getPaddingObject(g),d={x:n,y:o},m=getAlignmentAxis(i),p=getAxisLength(m),h=await s.getDimensions(f),y="y"===m,w=y?"top":"left",v=y?"bottom":"right",x=y?"clientHeight":"clientWidth",b=l.reference[p]+l.reference[m]-d[m]-l.floating[p],A=d[m]-l.reference[m],R=await(null==s.getOffsetParent?void 0:s.getOffsetParent(f));let O=R?R[x]:0;O&&await(null==s.isElement?void 0:s.isElement(R))||(O=c.floating[x]||l.floating[p]);const S=b/2-A/2,C=O/2-h[p]/2-1,E=r(u[w],C),T=r(u[v],C),P=E,L=O-h[p]-T,N=O/2-h[p]/2+S,D=clamp(P,N,L),B=!a.arrow&&null!=getAlignment(i)&&N!==D&&l.reference[p]/2-(N<P?E:T)-h[p]/2<0,W=B?N<P?N-P:N-L:0;return{[m]:d[m]+W,data:{[m]:D,centerOffset:N-D-W,...B&&{alignmentOffset:W}},reset:B}}});function getPlacementList(e,t,n){const o=e?[...n.filter((t=>getAlignment(t)===e)),...n.filter((t=>getAlignment(t)!==e))]:n.filter((e=>getSide(e)===e));return o.filter((n=>!e||(getAlignment(n)===e||!!t&&getOppositeAlignmentPlacement(n)!==n)))}const autoPlacement=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,o,r;const{rects:l,middlewareData:s,placement:c,platform:a,elements:f}=t,{crossAxis:g=!1,alignment:u,allowedPlacements:d=i,autoAlignment:m=!0,...p}=evaluate(e,t),h=void 0!==u||d===i?getPlacementList(u||null,m,d):d,y=await detectOverflow(t,p),w=(null==(n=s.autoPlacement)?void 0:n.index)||0,v=h[w];if(null==v)return{};const x=getAlignmentSides(v,l,await(null==a.isRTL?void 0:a.isRTL(f.floating)));if(c!==v)return{reset:{placement:h[0]}};const b=[y[getSide(v)],y[x[0]],y[x[1]]],A=[...(null==(o=s.autoPlacement)?void 0:o.overflows)||[],{placement:v,overflows:b}],R=h[w+1];if(R)return{data:{index:w+1,overflows:A},reset:{placement:R}};const O=A.map((e=>{const t=getAlignment(e.placement);return[e.placement,t&&g?e.overflows.slice(0,2).reduce(((e,t)=>e+t),0):e.overflows[0],e.overflows]})).sort(((e,t)=>e[1]-t[1])),S=O.filter((e=>e[2].slice(0,getAlignment(e[0])?2:3).every((e=>e<=0)))),C=(null==(r=S[0])?void 0:r[0])||O[0][0];return C!==c?{data:{index:w+1,overflows:A},reset:{placement:C}}:{}}}},flip=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:i,middlewareData:r,rects:l,initialPlacement:s,platform:c,elements:a}=t,{mainAxis:f=!0,crossAxis:g=!0,fallbackPlacements:u,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:p=!0,...h}=evaluate(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const y=getSide(i),w=getSide(s)===s,v=await(null==c.isRTL?void 0:c.isRTL(a.floating)),x=u||(w||!p?[getOppositePlacement(s)]:getExpandedPlacements(s));u||"none"===m||x.push(...getOppositeAxisPlacements(s,p,m,v));const b=[s,...x],A=await detectOverflow(t,h),R=[];let O=(null==(o=r.flip)?void 0:o.overflows)||[];if(f&&R.push(A[y]),g){const e=getAlignmentSides(i,l,v);R.push(A[e[0]],A[e[1]])}if(O=[...O,{placement:i,overflows:R}],!R.every((e=>e<=0))){var S,C;const e=((null==(S=r.flip)?void 0:S.index)||0)+1,t=b[e];if(t)return{data:{index:e,overflows:O},reset:{placement:t}};let n=null==(C=O.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:C.placement;if(!n)switch(d){case"bestFit":{var E;const e=null==(E=O.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:E[0];e&&(n=e);break}case"initialPlacement":n=s;break}if(i!==n)return{reset:{placement:n}}}return{}}}};function getSideOffsets(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function isAnySideFullyClipped(e){return n.some((t=>e[t]>=0))}const hide=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...i}=evaluate(e,t);switch(o){case"referenceHidden":{const e=await detectOverflow(t,{...i,elementContext:"reference"}),o=getSideOffsets(e,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:isAnySideFullyClipped(o)}}}case"escaped":{const e=await detectOverflow(t,{...i,altBoundary:!0}),o=getSideOffsets(e,n.floating);return{data:{escapedOffsets:o,escaped:isAnySideFullyClipped(o)}}}default:return{}}}}};function getBoundingRect(e){const t=r(...e.map((e=>e.left))),n=r(...e.map((e=>e.top))),o=l(...e.map((e=>e.right))),i=l(...e.map((e=>e.bottom)));return{x:t,y:n,width:o-t,height:i-n}}function getRectsByLine(e){const t=e.slice().sort(((e,t)=>e.y-t.y)),n=[];let o=null;for(let e=0;e<t.length;e++){const i=t[e];!o||i.y-o.y>o.height/2?n.push([i]):n[n.length-1].push(i),o=i}return n.map((e=>rectToClientRect(getBoundingRect(e))))}const inline=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:o,rects:i,platform:s,strategy:c}=t,{padding:a=2,x:f,y:g}=evaluate(e,t),u=Array.from(await(null==s.getClientRects?void 0:s.getClientRects(o.reference))||[]),d=getRectsByLine(u),m=rectToClientRect(getBoundingRect(u)),p=getPaddingObject(a);function getBoundingClientRect(){if(2===d.length&&d[0].left>d[1].right&&null!=f&&null!=g)return d.find((e=>f>e.left-p.left&&f<e.right+p.right&&g>e.top-p.top&&g<e.bottom+p.bottom))||m;if(d.length>=2){if("y"===getSideAxis(n)){const e=d[0],t=d[d.length-1],o="top"===getSide(n),i=e.top,r=t.bottom,l=o?e.left:t.left,s=o?e.right:t.right,c=s-l,a=r-i;return{top:i,bottom:r,left:l,right:s,width:c,height:a,x:l,y:i}}const e="left"===getSide(n),t=l(...d.map((e=>e.right))),o=r(...d.map((e=>e.left))),i=d.filter((n=>e?n.left===o:n.right===t)),s=i[0].top,c=i[i.length-1].bottom,a=o,f=t,g=f-a,u=c-s;return{top:s,bottom:c,left:a,right:f,width:g,height:u,x:a,y:s}}return m}const h=await s.getElementRects({reference:{getBoundingClientRect},floating:o.floating,strategy:c});return i.reference.x!==h.reference.x||i.reference.y!==h.reference.y||i.reference.width!==h.reference.width||i.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}};async function convertValueToCoords(e,t){const{placement:n,platform:o,elements:i}=e,r=await(null==o.isRTL?void 0:o.isRTL(i.floating)),l=getSide(n),s=getAlignment(n),c="y"===getSideAxis(n),a=["left","top"].includes(l)?-1:1,f=r&&c?-1:1,g=evaluate(t,e);let{mainAxis:u,crossAxis:d,alignmentAxis:m}="number"===typeof g?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...g};return s&&"number"===typeof m&&(d="end"===s?-1*m:m),c?{x:d*f,y:u*a}:{x:u*a,y:d*f}}const offset=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:r,placement:l,middlewareData:s}=t,c=await convertValueToCoords(t,e);return l===(null==(n=s.offset)?void 0:n.placement)&&null!=(o=s.arrow)&&o.alignmentOffset?{}:{x:i+c.x,y:r+c.y,data:{...c,placement:l}}}}},shift=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=evaluate(e,t),a={x:n,y:o},f=await detectOverflow(t,c),g=getSideAxis(getSide(i)),u=getOppositeAxis(g);let d=a[u],m=a[g];if(r){const e="y"===u?"top":"left",t="y"===u?"bottom":"right",n=d+f[e],o=d-f[t];d=clamp(n,d,o)}if(l){const e="y"===g?"top":"left",t="y"===g?"bottom":"right",n=m+f[e],o=m-f[t];m=clamp(n,m,o)}const p=s.fn({...t,[u]:d,[g]:m});return{...p,data:{x:p.x-n,y:p.y-o}}}}},limitShift=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:i,rects:r,middlewareData:l}=t,{offset:s=0,mainAxis:c=!0,crossAxis:a=!0}=evaluate(e,t),f={x:n,y:o},g=getSideAxis(i),u=getOppositeAxis(g);let d=f[u],m=f[g];const p=evaluate(s,t),h="number"===typeof p?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const e="y"===u?"height":"width",t=r.reference[u]-r.floating[e]+h.mainAxis,n=r.reference[u]+r.reference[e]-h.mainAxis;d<t?d=t:d>n&&(d=n)}if(a){var y,w;const e="y"===u?"width":"height",t=["top","left"].includes(getSide(i)),n=r.reference[g]-r.floating[e]+(t&&(null==(y=l.offset)?void 0:y[g])||0)+(t?0:h.crossAxis),o=r.reference[g]+r.reference[e]+(t?0:(null==(w=l.offset)?void 0:w[g])||0)-(t?h.crossAxis:0);m<n?m=n:m>o&&(m=o)}return{[u]:d,[g]:m}}}},size=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:o,platform:i,elements:s}=t,{apply:c=(()=>{}),...a}=evaluate(e,t),f=await detectOverflow(t,a),g=getSide(n),u=getAlignment(n),d="y"===getSideAxis(n),{width:m,height:p}=o.floating;let h,y;"top"===g||"bottom"===g?(h=g,y=u===(await(null==i.isRTL?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(y=g,h="end"===u?"top":"bottom");const w=p-f[h],v=m-f[y],x=!t.middlewareData.shift;let b=w,A=v;if(d){const e=m-f.left-f.right;A=u||x?r(v,e):e}else{const e=p-f.top-f.bottom;b=u||x?r(w,e):e}if(x&&!u){const e=l(f.left,0),t=l(f.right,0),n=l(f.top,0),o=l(f.bottom,0);d?A=m-2*(0!==e||0!==t?e+t:l(f.left,f.right)):b=p-2*(0!==n||0!==o?n+o:l(f.top,f.bottom))}await c({...t,availableWidth:A,availableHeight:b});const R=await i.getDimensions(s.floating);return m!==R.width||p!==R.height?{reset:{rects:!0}}:{}}}};function getNodeName(e){return isNode(e)?(e.nodeName||"").toLowerCase():"#document"}function getWindow(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function getDocumentElement(e){var t;return null==(t=(isNode(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function isNode(e){return e instanceof Node||e instanceof getWindow(e).Node}function isElement(e){return e instanceof Element||e instanceof getWindow(e).Element}function isHTMLElement(e){return e instanceof HTMLElement||e instanceof getWindow(e).HTMLElement}function isShadowRoot(e){return"undefined"!==typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof getWindow(e).ShadowRoot)}function isOverflowElement(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=getComputedStyle(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(i)}function isTableElement(e){return["table","td","th"].includes(getNodeName(e))}function isContainingBlock(e){const t=isWebKit(),n=getComputedStyle(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function getContainingBlock(e){let t=getParentNode(e);while(isHTMLElement(t)&&!isLastTraversableNode(t)){if(isContainingBlock(t))return t;t=getParentNode(t)}return null}function isWebKit(){return!("undefined"===typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function isLastTraversableNode(e){return["html","body","#document"].includes(getNodeName(e))}function getComputedStyle(e){return getWindow(e).getComputedStyle(e)}function getNodeScroll(e){return isElement(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function getParentNode(e){if("html"===getNodeName(e))return e;const t=e.assignedSlot||e.parentNode||isShadowRoot(e)&&e.host||getDocumentElement(e);return isShadowRoot(t)?t.host:t}function getNearestOverflowAncestor(e){const t=getParentNode(e);return isLastTraversableNode(t)?e.ownerDocument?e.ownerDocument.body:e.body:isHTMLElement(t)&&isOverflowElement(t)?t:getNearestOverflowAncestor(t)}function getOverflowAncestors(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=getNearestOverflowAncestor(e),r=i===(null==(o=e.ownerDocument)?void 0:o.body),l=getWindow(i);return r?t.concat(l,l.visualViewport||[],isOverflowElement(i)?i:[],l.frameElement&&n?getOverflowAncestors(l.frameElement):[]):t.concat(i,getOverflowAncestors(i,[],n))}function getCssDimensions(e){const t=getComputedStyle(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=isHTMLElement(e),r=i?e.offsetWidth:n,l=i?e.offsetHeight:o,c=s(n)!==r||s(o)!==l;return c&&(n=r,o=l),{width:n,height:o,$:c}}function unwrapElement(e){return isElement(e)?e:e.contextElement}function getScale(e){const t=unwrapElement(e);if(!isHTMLElement(t))return createCoords(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=getCssDimensions(t);let l=(r?s(n.width):n.width)/o,c=(r?s(n.height):n.height)/i;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const g=createCoords(0);function getVisualOffsets(e){const t=getWindow(e);return isWebKit()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:g}function shouldAddVisualOffsets(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==getWindow(e))&&t}function getBoundingClientRect(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),r=unwrapElement(e);let l=createCoords(1);t&&(o?isElement(o)&&(l=getScale(o)):l=getScale(e));const s=shouldAddVisualOffsets(r,n,o)?getVisualOffsets(r):createCoords(0);let c=(i.left+s.x)/l.x,a=(i.top+s.y)/l.y,f=i.width/l.x,g=i.height/l.y;if(r){const e=getWindow(r),t=o&&isElement(o)?getWindow(o):o;let n=e,i=n.frameElement;while(i&&o&&t!==n){const e=getScale(i),t=i.getBoundingClientRect(),o=getComputedStyle(i),r=t.left+(i.clientLeft+parseFloat(o.paddingLeft))*e.x,l=t.top+(i.clientTop+parseFloat(o.paddingTop))*e.y;c*=e.x,a*=e.y,f*=e.x,g*=e.y,c+=r,a+=l,n=getWindow(i),i=n.frameElement}}return rectToClientRect({width:f,height:g,x:c,y:a})}const u=[":popover-open",":modal"];function isTopLayer(e){return u.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function convertOffsetParentRelativeRectToViewportRelativeRect(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r="fixed"===i,l=getDocumentElement(o),s=!!t&&isTopLayer(t.floating);if(o===l||s&&r)return n;let c={scrollLeft:0,scrollTop:0},a=createCoords(1);const f=createCoords(0),g=isHTMLElement(o);if((g||!g&&!r)&&(("body"!==getNodeName(o)||isOverflowElement(l))&&(c=getNodeScroll(o)),isHTMLElement(o))){const e=getBoundingClientRect(o);a=getScale(o),f.x=e.x+o.clientLeft,f.y=e.y+o.clientTop}return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-c.scrollLeft*a.x+f.x,y:n.y*a.y-c.scrollTop*a.y+f.y}}function getClientRects(e){return Array.from(e.getClientRects())}function getWindowScrollBarX(e){return getBoundingClientRect(getDocumentElement(e)).left+getNodeScroll(e).scrollLeft}function getDocumentRect(e){const t=getDocumentElement(e),n=getNodeScroll(e),o=e.ownerDocument.body,i=l(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=l(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+getWindowScrollBarX(e);const c=-n.scrollTop;return"rtl"===getComputedStyle(o).direction&&(s+=l(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:s,y:c}}function getViewportRect(e,t){const n=getWindow(e),o=getDocumentElement(e),i=n.visualViewport;let r=o.clientWidth,l=o.clientHeight,s=0,c=0;if(i){r=i.width,l=i.height;const e=isWebKit();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:r,height:l,x:s,y:c}}function getInnerBoundingClientRect(e,t){const n=getBoundingClientRect(e,!0,"fixed"===t),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=isHTMLElement(e)?getScale(e):createCoords(1),l=e.clientWidth*r.x,s=e.clientHeight*r.y,c=i*r.x,a=o*r.y;return{width:l,height:s,x:c,y:a}}function getClientRectFromClippingAncestor(e,t,n){let o;if("viewport"===t)o=getViewportRect(e,n);else if("document"===t)o=getDocumentRect(getDocumentElement(e));else if(isElement(t))o=getInnerBoundingClientRect(t,n);else{const n=getVisualOffsets(e);o={...t,x:t.x-n.x,y:t.y-n.y}}return rectToClientRect(o)}function hasFixedPositionAncestor(e,t){const n=getParentNode(e);return!(n===t||!isElement(n)||isLastTraversableNode(n))&&("fixed"===getComputedStyle(n).position||hasFixedPositionAncestor(n,t))}function getClippingElementAncestors(e,t){const n=t.get(e);if(n)return n;let o=getOverflowAncestors(e,[],!1).filter((e=>isElement(e)&&"body"!==getNodeName(e))),i=null;const r="fixed"===getComputedStyle(e).position;let l=r?getParentNode(e):e;while(isElement(l)&&!isLastTraversableNode(l)){const t=getComputedStyle(l),n=isContainingBlock(l);n||"fixed"!==t.position||(i=null);const s=r?!n&&!i:!n&&"static"===t.position&&!!i&&["absolute","fixed"].includes(i.position)||isOverflowElement(l)&&!n&&hasFixedPositionAncestor(e,l);s?o=o.filter((e=>e!==l)):i=t,l=getParentNode(l)}return t.set(e,o),o}function getClippingRect(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const s="clippingAncestors"===n?getClippingElementAncestors(t,this._c):[].concat(n),c=[...s,o],a=c[0],f=c.reduce(((e,n)=>{const o=getClientRectFromClippingAncestor(t,n,i);return e.top=l(o.top,e.top),e.right=r(o.right,e.right),e.bottom=r(o.bottom,e.bottom),e.left=l(o.left,e.left),e}),getClientRectFromClippingAncestor(t,a,i));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function getDimensions(e){const{width:t,height:n}=getCssDimensions(e);return{width:t,height:n}}function getRectRelativeToOffsetParent(e,t,n){const o=isHTMLElement(t),i=getDocumentElement(t),r="fixed"===n,l=getBoundingClientRect(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const c=createCoords(0);if(o||!o&&!r)if(("body"!==getNodeName(t)||isOverflowElement(i))&&(s=getNodeScroll(t)),o){const e=getBoundingClientRect(t,!0,r,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&(c.x=getWindowScrollBarX(i));const a=l.left+s.scrollLeft-c.x,f=l.top+s.scrollTop-c.y;return{x:a,y:f,width:l.width,height:l.height}}function getTrueOffsetParent(e,t){return isHTMLElement(e)&&"fixed"!==getComputedStyle(e).position?t?t(e):e.offsetParent:null}function getOffsetParent(e,t){const n=getWindow(e);if(!isHTMLElement(e)||isTopLayer(e))return n;let o=getTrueOffsetParent(e,t);while(o&&isTableElement(o)&&"static"===getComputedStyle(o).position)o=getTrueOffsetParent(o,t);return o&&("html"===getNodeName(o)||"body"===getNodeName(o)&&"static"===getComputedStyle(o).position&&!isContainingBlock(o))?n:o||getContainingBlock(e)||n}const getElementRects=async function(e){const t=this.getOffsetParent||getOffsetParent,n=this.getDimensions;return{reference:getRectRelativeToOffsetParent(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}};function isRTL(e){return"rtl"===getComputedStyle(e).direction}const d={convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement,getClippingRect,getOffsetParent,getElementRects,getClientRects,getDimensions,getScale,isElement,isRTL};function observeMove(e,t){let n,o=null;const i=getDocumentElement(e);function cleanup(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}function refresh(s,a){void 0===s&&(s=!1),void 0===a&&(a=1),cleanup();const{left:f,top:g,width:u,height:d}=e.getBoundingClientRect();if(s||t(),!u||!d)return;const m=c(g),p=c(i.clientWidth-(f+u)),h=c(i.clientHeight-(g+d)),y=c(f),w=-m+"px "+-p+"px "+-h+"px "+-y+"px",v={rootMargin:w,threshold:l(0,r(1,a))||1};let x=!0;function handleObserve(e){const t=e[0].intersectionRatio;if(t!==a){if(!x)return refresh();t?refresh(!1,t):n=setTimeout((()=>{refresh(!1,1e-7)}),100)}x=!1}try{o=new IntersectionObserver(handleObserve,{...v,root:i.ownerDocument})}catch(e){o=new IntersectionObserver(handleObserve,v)}o.observe(e)}return refresh(!0),cleanup}function autoUpdate(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l="function"===typeof ResizeObserver,layoutShift:s="function"===typeof IntersectionObserver,animationFrame:c=!1}=o,a=unwrapElement(e),f=i||r?[...a?getOverflowAncestors(a):[],...getOverflowAncestors(t)]:[];f.forEach((e=>{i&&e.addEventListener("scroll",n,{passive:!0}),r&&e.addEventListener("resize",n)}));const g=a&&s?observeMove(a,n):null;let u,d=-1,m=null;l&&(m=new ResizeObserver((e=>{let[o]=e;o&&o.target===a&&m&&(m.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame((()=>{var e;null==(e=m)||e.observe(t)}))),n()})),a&&!c&&m.observe(a),m.observe(t));let p=c?getBoundingClientRect(e):null;function frameLoop(){const t=getBoundingClientRect(e);!p||t.x===p.x&&t.y===p.y&&t.width===p.width&&t.height===p.height||n(),p=t,u=requestAnimationFrame(frameLoop)}return c&&frameLoop(),n(),()=>{var e;f.forEach((e=>{i&&e.removeEventListener("scroll",n),r&&e.removeEventListener("resize",n)})),null==g||g(),null==(e=m)||e.disconnect(),m=null,c&&cancelAnimationFrame(u)}}const m=autoPlacement,p=shift,h=flip,y=size,w=hide,v=arrow,x=inline,b=limitShift,floating_ui_dom_esm_computePosition=(e,t,n)=>{const o=new Map,i={platform:d,...n},r={...i.platform,_c:o};return computePosition(e,t,{...i,platform:r})};return t})()));
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/imask.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define(["vue"],t):"object"===typeof exports?exports["ldmui"]=t(require("vue")):e["ldmui"]=t(e["vue"])})(self,(e=>(()=>{"use strict";var t={2380:t=>{t.exports=e}},s={};function __webpack_require__(e){var a=s[e];if(void 0!==a)return a.exports;var i=s[e]={exports:{}};return t[e](i,i.exports,__webpack_require__),i.exports}(()=>{__webpack_require__.d=(e,t)=>{for(var s in t)__webpack_require__.o(t,s)&&!__webpack_require__.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})}})(),(()=>{__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{__webpack_require__.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var a={};return(()=>{function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var s,a,i={},n=Object.keys(e);for(a=0;a<n.length;a++)s=n[a],t.indexOf(s)>=0||(i[s]=e[s]);return i}function IMask(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new IMask.InputMask(e,t)}__webpack_require__.r(a),__webpack_require__.d(a,{IMask:()=>IMask,IMaskComponent:()=>m,IMaskDirective:()=>v,IMaskProps:()=>p,useIMask:()=>useIMask});class ChangeDetails{constructor(e){Object.assign(this,{inserted:"",rawInserted:"",skip:!1,tailShift:0},e)}aggregate(e){return this.rawInserted+=e.rawInserted,this.skip=this.skip||e.skip,this.inserted+=e.inserted,this.tailShift+=e.tailShift,this}get offset(){return this.tailShift+this.inserted.length}}function isString(e){return"string"===typeof e||e instanceof String}IMask.ChangeDetails=ChangeDetails;const e={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function forceDirection(t){switch(t){case e.LEFT:return e.FORCE_LEFT;case e.RIGHT:return e.FORCE_RIGHT;default:return t}}function escapeRegExp(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function normalizePrepare(e){return Array.isArray(e)?e:[e,new ChangeDetails]}function objectIncludes(e,t){if(t===e)return!0;var s,a=Array.isArray(t),i=Array.isArray(e);if(a&&i){if(t.length!=e.length)return!1;for(s=0;s<t.length;s++)if(!objectIncludes(t[s],e[s]))return!1;return!0}if(a!=i)return!1;if(t&&e&&"object"===typeof t&&"object"===typeof e){var n=t instanceof Date,u=e instanceof Date;if(n&&u)return t.getTime()==e.getTime();if(n!=u)return!1;var r=t instanceof RegExp,l=e instanceof RegExp;if(r&&l)return t.toString()==e.toString();if(r!=l)return!1;var o=Object.keys(t);for(s=0;s<o.length;s++)if(!Object.prototype.hasOwnProperty.call(e,o[s]))return!1;for(s=0;s<o.length;s++)if(!objectIncludes(e[o[s]],t[o[s]]))return!1;return!0}return!(!t||!e||"function"!==typeof t||"function"!==typeof e)&&t.toString()===e.toString()}class ActionDetails{constructor(e,t,s,a){this.value=e,this.cursorPos=t,this.oldValue=s,this.oldSelection=a;while(this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos))--this.oldSelection.start}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?e.NONE:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?e.LEFT:e.RIGHT}}class ContinuousTailDetails{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2?arguments[2]:void 0;this.value=e,this.from=t,this.stop=s}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||null!=e&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class Masked{constructor(e){this._value="",this._update(Object.assign({},Masked.DEFAULTS,e)),this.isInitialized=!0}updateOptions(e){Object.keys(e).length&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e)}resolve(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{input:!0};return this.reset(),this.append(e,t,""),this.doCommit(),this.value}get unmaskedValue(){return this.value}set unmaskedValue(e){this.reset(),this.append(e,{},""),this.doCommit()}get typedValue(){return this.doParse(this.value)}set typedValue(e){this.value=this.doFormat(e)}get rawInputValue(){return this.extractInput(0,this.value.length,{raw:!0})}set rawInputValue(e){this.reset(),this.append(e,{raw:!0},""),this.doCommit()}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return Math.min(this.value.length,t-e)}extractInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this.value.slice(e,t)}extractTail(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return new ContinuousTailDetails(this.extractInput(e,t),e)}appendTail(e){return isString(e)&&(e=new ContinuousTailDetails(String(e))),e.appendTo(this)}_appendCharRaw(e){return e?(this._value+=e,new ChangeDetails({inserted:e,rawInserted:e})):new ChangeDetails}_appendChar(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;const a=this.state;let i;if([e,i]=normalizePrepare(this.doPrepare(e,t)),i=i.aggregate(this._appendCharRaw(e,t)),i.inserted){let e,n=!1!==this.doValidate(t);if(n&&null!=s){const t=this.state;!0===this.overwrite&&(e=s.state,s.unshift(this.value.length-i.tailShift));let a=this.appendTail(s);n=a.rawInserted===s.toString(),n&&a.inserted||"shift"!==this.overwrite||(this.state=t,e=s.state,s.shift(),a=this.appendTail(s),n=a.rawInserted===s.toString()),n&&a.inserted&&(this.state=t)}n||(i=new ChangeDetails,this.state=a,s&&e&&(s.state=e))}return i}_appendPlaceholder(){return new ChangeDetails}_appendEager(){return new ChangeDetails}append(e,t,s){if(!isString(e))throw new Error("value should be string");const a=new ChangeDetails,i=isString(s)?new ContinuousTailDetails(String(s)):s;null!==t&&void 0!==t&&t.tail&&(t._beforeTailState=this.state);for(let s=0;s<e.length;++s){const n=this._appendChar(e[s],t,i);if(!n.rawInserted&&!this.doSkipInvalid(e[s],t,i))break;a.aggregate(n)}return(!0===this.eager||"append"===this.eager)&&null!==t&&void 0!==t&&t.input&&e&&a.aggregate(this._appendEager()),null!=i&&(a.tailShift+=this.appendTail(i).tailShift),a}remove(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this._value=this.value.slice(0,e)+this.value.slice(t),new ChangeDetails}withValueRefresh(e){if(this._refreshing||!this.isInitialized)return e();this._refreshing=!0;const t=this.rawInputValue,s=this.value,a=e();return this.rawInputValue=t,this.value&&this.value!==s&&0===s.indexOf(this.value)&&this.append(s.slice(this.value.length),{},""),delete this._refreshing,a}runIsolated(e){if(this._isolated||!this.isInitialized)return e(this);this._isolated=!0;const t=this.state,s=e(this);return this.state=t,delete this._isolated,s}doSkipInvalid(e){return this.skipInvalid}doPrepare(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.prepare?this.prepare(e,this,t):e}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}doFormat(e){return this.format?this.format(e,this):e}doParse(e){return this.parse?this.parse(e,this):e}splice(t,s,a,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{input:!0};const u=t+s,r=this.extractTail(u),l=!0===this.eager||"remove"===this.eager;let o;l&&(i=forceDirection(i),o=this.extractInput(0,u,{raw:!0}));let h=t;const d=new ChangeDetails;if(i!==e.NONE&&(h=this.nearestInputPos(t,s>1&&0!==t&&!l?e.NONE:i),d.tailShift=h-t),d.aggregate(this.remove(h)),l&&i!==e.NONE&&o===this.rawInputValue)if(i===e.FORCE_LEFT){let e;while(o===this.rawInputValue&&(e=this.value.length))d.aggregate(new ChangeDetails({tailShift:-1})).aggregate(this.remove(e-1))}else i===e.FORCE_RIGHT&&r.unshift();return d.aggregate(this.append(a,n,r))}maskEquals(e){return this.mask===e}typedValueEquals(e){const t=this.typedValue;return e===t||Masked.EMPTY_VALUES.includes(e)&&Masked.EMPTY_VALUES.includes(t)||this.doFormat(e)===this.doFormat(this.typedValue)}}function maskedClass(e){if(null==e)throw new Error("mask property should be defined");return e instanceof RegExp?IMask.MaskedRegExp:isString(e)?IMask.MaskedPattern:e instanceof Date||e===Date?IMask.MaskedDate:e instanceof Number||"number"===typeof e||e===Number?IMask.MaskedNumber:Array.isArray(e)||e===Array?IMask.MaskedDynamic:IMask.Masked&&e.prototype instanceof IMask.Masked?e:e instanceof IMask.Masked?e.constructor:e instanceof Function?IMask.MaskedFunction:(console.warn("Mask not found for mask",e),IMask.Masked)}function createMask(e){if(IMask.Masked&&e instanceof IMask.Masked)return e;e=Object.assign({},e);const t=e.mask;if(IMask.Masked&&t instanceof IMask.Masked)return t;const s=maskedClass(t);if(!s)throw new Error("Masked class is not found for provided mask, appropriate module needs to be import manually before creating mask.");return new s(e)}Masked.DEFAULTS={format:String,parse:e=>e,skipInvalid:!0},Masked.EMPTY_VALUES=[void 0,null,""],IMask.Masked=Masked,IMask.createMask=createMask;const t=["parent","isOptional","placeholderChar","displayChar","lazy","eager"],s={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 PatternInputDefinition{constructor(e){const{parent:s,isOptional:a,placeholderChar:i,displayChar:n,lazy:u,eager:r}=e,l=_objectWithoutPropertiesLoose(e,t);this.masked=createMask(l),Object.assign(this,{parent:s,isOptional:a,placeholderChar:i,displayChar:n,lazy:u,eager:r})}reset(){this.isFilled=!1,this.masked.reset()}remove(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return 0===e&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new ChangeDetails}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.isFilled)return new ChangeDetails;const s=this.masked.state,a=this.masked._appendChar(e,t);return a.inserted&&!1===this.doValidate(t)&&(a.inserted=a.rawInserted="",this.masked.state=s),a.inserted||this.isOptional||this.lazy||t.input||(a.inserted=this.placeholderChar),a.skip=!a.inserted&&!this.isOptional,this.isFilled=Boolean(a.inserted),a}append(){return this.masked.append(...arguments)}_appendPlaceholder(){const e=new ChangeDetails;return this.isFilled||this.isOptional||(this.isFilled=!0,e.inserted=this.placeholderChar),e}_appendEager(){return new ChangeDetails}extractTail(){return this.masked.extractTail(...arguments)}appendTail(){return this.masked.appendTail(...arguments)}extractInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,s=arguments.length>2?arguments[2]:void 0;return this.masked.extractInput(e,t,s)}nearestInputPos(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.NONE;const a=0,i=this.value.length,n=Math.min(Math.max(t,a),i);switch(s){case e.LEFT:case e.FORCE_LEFT:return this.isComplete?n:a;case e.RIGHT:case e.FORCE_RIGHT:return this.isComplete?n:i;case e.NONE:default:return n}}totalInputPositions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this.value.slice(e,t).length}doValidate(){return this.masked.doValidate(...arguments)&&(!this.parent||this.parent.doValidate(...arguments))}doCommit(){this.masked.doCommit()}get state(){return{masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}}class PatternFixedDefinition{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._value.length;return this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new ChangeDetails}nearestInputPos(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.NONE;const a=0,i=this._value.length;switch(s){case e.LEFT:case e.FORCE_LEFT:return a;case e.NONE:case e.RIGHT:case e.FORCE_RIGHT:default:return i}}totalInputPositions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._value.length;return this._isRawInput?t-e:0}extractInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._value.length,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new ChangeDetails;if(this.isFilled)return s;const a=!0===this.eager||"append"===this.eager,i=this.char===e,n=i&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!a)&&!t.tail;return n&&(s.rawInserted=this.char),this._value=s.inserted=this.char,this._isRawInput=n&&(t.raw||t.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new ChangeDetails;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return arguments.length>1&&void 0!==arguments[1]||this.value.length,new ContinuousTailDetails("")}appendTail(e){return isString(e)&&(e=new ContinuousTailDetails(String(e))),e.appendTo(this)}append(e,t,s){const a=this._appendChar(e[0],t);return null!=s&&(a.tailShift+=this.appendTail(s).tailShift),a}doCommit(){}get state(){return{_value:this._value,_isRawInput:this._isRawInput}}set state(e){Object.assign(this,e)}}const i=["chunks"];class ChunksTailDetails{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;isString(e)&&(e=new ContinuousTailDetails(String(e)));const t=this.chunks[this.chunks.length-1],s=t&&(t.stop===e.stop||null==e.stop)&&e.from===t.from+t.toString().length;if(e instanceof ContinuousTailDetails)s?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof ChunksTailDetails){if(null==e.stop){let t;while(e.chunks.length&&null==e.chunks[0].stop)t=e.chunks.shift(),t.from+=e.from,this.extend(t)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof IMask.MaskedPattern)){const t=new ContinuousTailDetails(this.toString());return t.appendTo(e)}const t=new ChangeDetails;for(let s=0;s<this.chunks.length&&!t.skip;++s){const a=this.chunks[s],i=e._mapPosToBlock(e.value.length),n=a.stop;let u;if(null!=n&&(!i||i.index<=n)){if(a instanceof ChunksTailDetails||e._stops.indexOf(n)>=0){const s=e._appendPlaceholder(n);t.aggregate(s)}u=a instanceof ChunksTailDetails&&e._blocks[n]}if(u){const s=u.appendTail(a);s.skip=!1,t.aggregate(s),e._value+=s.inserted;const i=a.toString().slice(s.rawInserted.length);i&&t.aggregate(e.append(i,{tail:!0}))}else t.aggregate(e.append(a.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map((e=>e.state)),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t}=e,s=_objectWithoutPropertiesLoose(e,i);Object.assign(this,s),this.chunks=t.map((e=>{const t="chunks"in e?new ChunksTailDetails:new ContinuousTailDetails;return t.state=e,t}))}unshift(e){if(!this.chunks.length||null!=e&&this.from>=e)return"";const t=null!=e?e-this.from:e;let s=0;while(s<this.chunks.length){const e=this.chunks[s],a=e.unshift(t);if(e.toString()){if(!a)break;++s}else this.chunks.splice(s,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;while(0<=e){const t=this.chunks[e],s=t.shift();if(t.toString()){if(!s)break;--e}else this.chunks.splice(e,1);if(s)return s}return""}}class PatternCursor{constructor(e,t){this.masked=e,this._log=[];const{offset:s,index:a}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=a,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(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return this.state=e,e}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.value.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null===(t=this.block)||void 0===t?void 0:t.value.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())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,e.FORCE_LEFT),0!==this.offset||void 0}))}pushLeftBeforeInput(){return this._pushLeft((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,e.LEFT),!0}))}pushLeftBeforeRequired(){return this._pushLeft((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,e.LEFT),!0}))}pushRightBeforeFilled(){return this._pushRight((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,e.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,e.NONE),!0}))}pushRightBeforeRequired(){return this._pushRight((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,e.NONE),!0}))}}class MaskedRegExp extends Masked{_update(e){e.mask&&(e.validate=t=>t.search(e.mask)>=0),super._update(e)}}IMask.MaskedRegExp=MaskedRegExp;const n=["_blocks"];class MaskedPattern extends Masked{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.definitions=Object.assign({},s,e.definitions),super(Object.assign({},MaskedPattern.DEFAULTS,e))}_update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this._stops=[],this._maskedBlocks={};let t=this.mask;if(!t||!e)return;let s=!1,a=!1;for(let u=0;u<t.length;++u){var i,n;if(this.blocks){const e=t.slice(u),s=Object.keys(this.blocks).filter((t=>0===e.indexOf(t)));s.sort(((e,t)=>t.length-e.length));const a=s[0];if(a){const e=createMask(Object.assign({parent:this,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite},this.blocks[a]));e&&(this._blocks.push(e),this._maskedBlocks[a]||(this._maskedBlocks[a]=[]),this._maskedBlocks[a].push(this._blocks.length-1)),u+=a.length-1;continue}}let r=t[u],l=r in e;if(r===MaskedPattern.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===r||"}"===r){s=!s;continue}if("["===r||"]"===r){a=!a;continue}if(r===MaskedPattern.ESCAPE_CHAR){if(++u,r=t[u],!r)break;l=!1}const o=null===(i=e[r])||void 0===i||!i.mask||(null===(n=e[r])||void 0===n?void 0:n.mask.prototype)instanceof IMask.Masked?{mask:e[r]}:e[r],h=l?new PatternInputDefinition(Object.assign({parent:this,isOptional:a,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar},o)):new PatternFixedDefinition({char:r,eager:this.eager,isUnmasking:s});this._blocks.push(h)}}get state(){return Object.assign({},super.state,{_blocks:this._blocks.map((e=>e.state))})}set state(e){const{_blocks:t}=e,s=_objectWithoutPropertiesLoose(e,n);this._blocks.forEach(((e,s)=>e.state=t[s])),super.state=s}reset(){super.reset(),this._blocks.forEach((e=>e.reset()))}get isComplete(){return this._blocks.every((e=>e.isComplete))}get isFilled(){return this._blocks.every((e=>e.isFilled))}get isFixed(){return this._blocks.every((e=>e.isFixed))}get isOptional(){return this._blocks.every((e=>e.isOptional))}doCommit(){this._blocks.forEach((e=>e.doCommit())),super.doCommit()}get unmaskedValue(){return this._blocks.reduce(((e,t)=>e+t.unmaskedValue),"")}set unmaskedValue(e){super.unmaskedValue=e}get value(){return this._blocks.reduce(((e,t)=>e+t.value),"")}set value(e){super.value=e}get displayValue(){return this._blocks.reduce(((e,t)=>e+t.displayValue),"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new ChangeDetails;let s=null===(e=this._mapPosToBlock(this.value.length))||void 0===e?void 0:e.index;if(null==s)return t;this._blocks[s].isFilled&&++s;for(let e=s;e<this._blocks.length;++e){const s=this._blocks[e]._appendEager();if(!s.inserted)break;t.aggregate(s)}return t}_appendCharRaw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=this._mapPosToBlock(this.value.length),a=new ChangeDetails;if(!s)return a;for(let u=s.index;;++u){var i,n;const s=this._blocks[u];if(!s)break;const r=s._appendChar(e,Object.assign({},t,{_beforeTailState:null===(i=t._beforeTailState)||void 0===i||null===(n=i._blocks)||void 0===n?void 0:n[u]})),l=r.skip;if(a.aggregate(r),l||r.rawInserted)break}return a}extractTail(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;const s=new ChunksTailDetails;return e===t||this._forEachBlocksInRange(e,t,((e,t,a,i)=>{const n=e.extractTail(a,i);n.stop=this._findStopBefore(t),n.from=this._blockStartPos(t),n instanceof ChunksTailDetails&&(n.blockIndex=t),s.extend(n)})),s}extractInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e===t)return"";let a="";return this._forEachBlocksInRange(e,t,((e,t,i,n)=>{a+=e.extractInput(i,n,s)})),a}_findStopBefore(e){let t;for(let s=0;s<this._stops.length;++s){const a=this._stops[s];if(!(a<=e))break;t=a}return t}_appendPlaceholder(e){const t=new ChangeDetails;if(this.lazy&&null==e)return t;const s=this._mapPosToBlock(this.value.length);if(!s)return t;const a=s.index,i=null!=e?e:this._blocks.length;return this._blocks.slice(a,i).forEach((s=>{if(!s.lazy||null!=e){const e=null!=s._blocks?[s._blocks.length]:[],a=s._appendPlaceholder(...e);this._value+=a.inserted,t.aggregate(a)}})),t}_mapPosToBlock(e){let t="";for(let s=0;s<this._blocks.length;++s){const a=this._blocks[s],i=t.length;if(t+=a.value,e<=t.length)return{index:s,offset:e-i}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce(((e,t)=>e+t.value.length),0)}_forEachBlocksInRange(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,s=arguments.length>2?arguments[2]:void 0;const a=this._mapPosToBlock(e);if(a){const e=this._mapPosToBlock(t),i=e&&a.index===e.index,n=a.offset,u=e&&i?e.offset:this._blocks[a.index].value.length;if(s(this._blocks[a.index],a.index,n,u),e&&!i){for(let t=a.index+1;t<e.index;++t)s(this._blocks[t],t,0,this._blocks[t].value.length);s(this._blocks[e.index],e.index,0,e.offset)}}}remove(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;const s=super.remove(e,t);return this._forEachBlocksInRange(e,t,((e,t,a,i)=>{s.aggregate(e.remove(a,i))})),s}nearestInputPos(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.NONE;if(!this._blocks.length)return 0;const a=new PatternCursor(this,t);if(s===e.NONE)return a.pushRightBeforeInput()?a.pos:(a.popState(),a.pushLeftBeforeInput()?a.pos:this.value.length);if(s===e.LEFT||s===e.FORCE_LEFT){if(s===e.LEFT){if(a.pushRightBeforeFilled(),a.ok&&a.pos===t)return t;a.popState()}if(a.pushLeftBeforeInput(),a.pushLeftBeforeRequired(),a.pushLeftBeforeFilled(),s===e.LEFT){if(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.ok&&a.pos<=t)return a.pos;if(a.popState(),a.ok&&a.pos<=t)return a.pos;a.popState()}return a.ok?a.pos:s===e.FORCE_LEFT?0:(a.popState(),a.ok?a.pos:(a.popState(),a.ok?a.pos:0))}return s===e.RIGHT||s===e.FORCE_RIGHT?(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.pushRightBeforeFilled()?a.pos:s===e.FORCE_RIGHT?this.value.length:(a.popState(),a.ok?a.pos:(a.popState(),a.ok?a.pos:this.nearestInputPos(t,e.LEFT)))):t}totalInputPositions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,s=0;return this._forEachBlocksInRange(e,t,((e,t,a,i)=>{s+=e.totalInputPositions(a,i)})),s}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map((e=>this._blocks[e])):[]}}MaskedPattern.DEFAULTS={lazy:!0,placeholderChar:"_"},MaskedPattern.STOP_CHAR="`",MaskedPattern.ESCAPE_CHAR="\\",MaskedPattern.InputDefinition=PatternInputDefinition,MaskedPattern.FixedDefinition=PatternFixedDefinition,IMask.MaskedPattern=MaskedPattern;class MaskedRange extends MaskedPattern{get _matchFrom(){return this.maxLength-String(this.from).length}_update(e){e=Object.assign({to:this.to||0,from:this.from||0,maxLength:this.maxLength||0},e);let t=String(e.to).length;null!=e.maxLength&&(t=Math.max(t,e.maxLength)),e.maxLength=t;const s=String(e.from).padStart(t,"0"),a=String(e.to).padStart(t,"0");let i=0;while(i<a.length&&a[i]===s[i])++i;e.mask=a.slice(0,i).replace(/0/g,"\\0")+"0".repeat(t-i),super._update(e)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(e){let t="",s="";const[,a,i]=e.match(/^(\D*)(\d*)(\D*)/)||[];return i&&(t="0".repeat(a.length)+i,s="9".repeat(a.length)+i),t=t.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[t,s]}doPrepare(e){let t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if([e,t]=normalizePrepare(super.doPrepare(e.replace(/\D/g,""),s)),!this.autofix||!e)return e;const a=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0");let n=this.value+e;if(n.length>this.maxLength)return"";const[u,r]=this.boundaries(n);return Number(r)<this.from?a[n.length-1]:Number(u)>this.to?"pad"===this.autofix&&n.length<this.maxLength?["",t.aggregate(this.append(a[n.length-1]+e,s))]:i[n.length-1]:e}doValidate(){const e=this.value,t=e.search(/[^0]/);if(-1===t&&e.length<=this._matchFrom)return!0;const[s,a]=this.boundaries(e);return this.from<=Number(a)&&Number(s)<=this.to&&super.doValidate(...arguments)}}IMask.MaskedRange=MaskedRange;class MaskedDate extends MaskedPattern{constructor(e){super(Object.assign({},MaskedDate.DEFAULTS,e))}_update(e){e.mask===Date&&delete e.mask,e.pattern&&(e.mask=e.pattern);const t=e.blocks;e.blocks=Object.assign({},MaskedDate.GET_DEFAULT_BLOCKS()),e.min&&(e.blocks.Y.from=e.min.getFullYear()),e.max&&(e.blocks.Y.to=e.max.getFullYear()),e.min&&e.max&&e.blocks.Y.from===e.blocks.Y.to&&(e.blocks.m.from=e.min.getMonth()+1,e.blocks.m.to=e.max.getMonth()+1,e.blocks.m.from===e.blocks.m.to&&(e.blocks.d.from=e.min.getDate(),e.blocks.d.to=e.max.getDate())),Object.assign(e.blocks,this.blocks,t),Object.keys(e.blocks).forEach((t=>{const s=e.blocks[t];!("autofix"in s)&&"autofix"in e&&(s.autofix=e.autofix)})),super._update(e)}doValidate(){const e=this.date;return super.doValidate(...arguments)&&(!this.isComplete||this.isDateExist(this.value)&&null!=e&&(null==this.min||this.min<=e)&&(null==this.max||e<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}}MaskedDate.DEFAULTS={pattern:"d{.}`m{.}`Y",format:e=>{if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),s=String(e.getMonth()+1).padStart(2,"0"),a=e.getFullYear();return[t,s,a].join(".")},parse:e=>{const[t,s,a]=e.split(".");return new Date(a,s-1,t)}},MaskedDate.GET_DEFAULT_BLOCKS=()=>({d:{mask:MaskedRange,from:1,to:31,maxLength:2},m:{mask:MaskedRange,from:1,to:12,maxLength:2},Y:{mask:MaskedRange,from:1900,to:9999}}),IMask.MaskedDate=MaskedDate;class MaskElement{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch(e){}return null!=e?e:this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch(e){}return null!=e?e:this.value.length}select(e,t){if(null!=e&&null!=t&&(e!==this.selectionStart||t!==this.selectionEnd))try{this._unsafeSelect(e,t)}catch(e){}}_unsafeSelect(e,t){}get isActive(){return!1}bindEvents(e){}unbindEvents(){}}IMask.MaskElement=MaskElement;class HTMLMaskElement extends MaskElement{constructor(e){super(),this.input=e,this._handlers={}}get rootElement(){var e,t,s;return null!==(e=null===(t=(s=this.input).getRootNode)||void 0===t?void 0:t.call(s))&&void 0!==e?e:document}get isActive(){return this.input===this.rootElement.activeElement}get _unsafeSelectionStart(){return this.input.selectionStart}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}bindEvents(e){Object.keys(e).forEach((t=>this._toggleEventHandler(HTMLMaskElement.EVENTS_MAP[t],e[t])))}unbindEvents(){Object.keys(this._handlers).forEach((e=>this._toggleEventHandler(e)))}_toggleEventHandler(e,t){this._handlers[e]&&(this.input.removeEventListener(e,this._handlers[e]),delete this._handlers[e]),t&&(this.input.addEventListener(e,t),this._handlers[e]=t)}}HTMLMaskElement.EVENTS_MAP={selectionChange:"keydown",input:"input",drop:"drop",click:"click",focus:"focus",commit:"blur"},IMask.HTMLMaskElement=HTMLMaskElement;class HTMLContenteditableMaskElement extends HTMLMaskElement{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,a=t&&t.focusOffset;return null==a||null==s||s<a?s:a}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,a=t&&t.focusOffset;return null==a||null==s||s>a?s:a}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,e),s.setEnd(this.input.lastChild||this.input,t);const a=this.rootElement,i=a.getSelection&&a.getSelection();i&&(i.removeAllRanges(),i.addRange(s))}get value(){return this.input.textContent}set value(e){this.input.textContent=e}}IMask.HTMLContenteditableMaskElement=HTMLContenteditableMaskElement;const u=["mask"];class InputMask{constructor(e,t){this.el=e instanceof MaskElement?e:e.isContentEditable&&"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?new HTMLContenteditableMaskElement(e):new HTMLMaskElement(e),this.masked=createMask(t),this._listeners={},this._value="",this._unmaskedValue="",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.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}get mask(){return this.masked.mask}maskEquals(e){var t;return null==e||(null===(t=this.masked)||void 0===t?void 0:t.maskEquals(e))}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof IMask.Masked)&&this.masked.constructor===maskedClass(e))return void this.masked.updateOptions({mask:e});const t=createMask({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl(),this.alignCursor())}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl(),this.alignCursor())}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})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];const i=this._listeners[e];i&&i.forEach((e=>e(...s)))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){this.el&&this.el.isActive&&(this.el.select(e,e),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}updateControl(){const e=this.masked.unmaskedValue,t=this.masked.value,s=this.displayValue,a=this.unmaskedValue!==e||this.value!==t;this._unmaskedValue=e,this._value=t,this.el.value!==s&&(this.el.value=s),a&&this._fireChangeEvents()}updateOptions(e){const{mask:t}=e,s=_objectWithoutPropertiesLoose(e,u),a=!this.maskEquals(t),i=!objectIncludes(this.masked,s);a&&(this.mask=t),i&&this.masked.updateOptions(s),(a||i)&&this.updateControl()}updateCursor(e){null!=e&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,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,e.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const s=this._listeners[e].indexOf(t);return s>=0&&this._listeners[e].splice(s,1),this}_onInput(t){if(this._inputEvent=t,this._abortUpdateCursor(),!this._selection)return this.updateValue();const s=new ActionDetails(this.el.value,this.cursorPos,this.displayValue,this._selection),a=this.masked.rawInputValue,i=this.masked.splice(s.startChangePos,s.removed.length,s.inserted,s.removeDirection,{input:!0,raw:!0}).offset,n=a===this.masked.rawInputValue?s.removeDirection:e.NONE;let u=this.masked.nearestInputPos(s.startChangePos+i,n);n!==e.NONE&&(u=this.masked.nearestInputPos(u,e.NONE)),this.updateControl(),this.updateCursor(u),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}IMask.InputMask=InputMask;class MaskedEnum extends MaskedPattern{_update(e){e.enum&&(e.mask="*".repeat(e.enum[0].length)),super._update(e)}doValidate(){return this.enum.some((e=>e.indexOf(this.unmaskedValue)>=0))&&super.doValidate(...arguments)}}IMask.MaskedEnum=MaskedEnum;class MaskedNumber extends Masked{constructor(e){super(Object.assign({},MaskedNumber.DEFAULTS,e))}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){let e="^"+(this.allowNegative?"[+|\\-]?":""),t="\\d*",s=(this.scale?"(".concat(escapeRegExp(this.radix),"\\d{0,").concat(this.scale,"})?"):"")+"$";this._numberRegExp=new RegExp(e+t+s),this._mapToRadixRegExp=new RegExp("[".concat(this.mapToRadix.map(escapeRegExp).join(""),"]"),"g"),this._thousandsSeparatorRegExp=new RegExp(escapeRegExp(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepare(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(t.input&&t.raw||!t.input&&!t.raw)?e.replace(this._mapToRadixRegExp,this.radix):e);const[s,a]=normalizePrepare(super.doPrepare(e,t));return e&&!s&&(a.skip=!0),[s,a]}_separatorsCount(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=0;for(let a=0;a<e;++a)this._value.indexOf(this.thousandsSeparator,a)===a&&(++s,t&&(e+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._value;return this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,s=arguments.length>2?arguments[2]:void 0;return[e,t]=this._adjustRangeWithSeparators(e,t),this._removeThousandsSeparators(super.extractInput(e,t,s))}_appendCharRaw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.thousandsSeparator)return super._appendCharRaw(e,t);const s=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,a=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const i=super._appendCharRaw(e,t);this._value=this._insertThousandsSeparators(this._value);const n=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,u=this._separatorsCountFromSlice(n);return i.tailShift+=(u-a)*this.thousandsSeparator.length,i.skip=!i.rawInserted&&e===this.thousandsSeparator,i}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,t);if(s<=e)return s}return-1}_adjustRangeWithSeparators(e,t){const s=this._findSeparatorAround(e);s>=0&&(e=s);const a=this._findSeparatorAround(t);return a>=0&&(t=a+this.thousandsSeparator.length),[e,t]}remove(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;[e,t]=this._adjustRangeWithSeparators(e,t);const s=this.value.slice(0,e),a=this.value.slice(t),i=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+a));const n=this._separatorsCountFromSlice(s);return new ChangeDetails({tailShift:(n-i)*this.thousandsSeparator.length})}nearestInputPos(t,s){if(!this.thousandsSeparator)return t;switch(s){case e.NONE:case e.LEFT:case e.FORCE_LEFT:{const a=this._findSeparatorAround(t-1);if(a>=0){const i=a+this.thousandsSeparator.length;if(t<i||this.value.length<=i||s===e.FORCE_LEFT)return a}break}case e.RIGHT:case e.FORCE_RIGHT:{const e=this._findSeparatorAround(t);if(e>=0)return e+this.thousandsSeparator.length}}return t}doValidate(e){let t=Boolean(this._removeThousandsSeparators(this.value).match(this._numberRegExp));if(t){const e=this.number;t=t&&!isNaN(e)&&(null==this.min||this.min>=0||this.min<=this.number)&&(null==this.max||this.max<=0||this.number<=this.max)}return t&&super.doValidate(e)}doCommit(){if(this.value){const e=this.number;let t=e;null!=this.min&&(t=Math.max(t,this.min)),null!=this.max&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=this.doFormat(t));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&this.scale>0&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,((e,t,s,a)=>t+a)),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}doSkipInvalid(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;const a=0===this.scale&&e!==this.thousandsSeparator&&(e===this.radix||e===MaskedNumber.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,s)&&!a}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,MaskedNumber.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.doParse(this.unmaskedValue)}set typedValue(e){this.rawInputValue=this.doFormat(e).replace(MaskedNumber.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return this.signed||null!=this.min&&this.min<0||null!=this.max&&this.max<0}typedValueEquals(e){return(super.typedValueEquals(e)||MaskedNumber.EMPTY_VALUES.includes(e)&&MaskedNumber.EMPTY_VALUES.includes(this.typedValue))&&!(0===e&&""===this.value)}}MaskedNumber.UNMASKED_RADIX=".",MaskedNumber.DEFAULTS={radix:",",thousandsSeparator:"",mapToRadix:[MaskedNumber.UNMASKED_RADIX],scale:2,signed:!1,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:e=>e.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},MaskedNumber.EMPTY_VALUES=[...Masked.EMPTY_VALUES,0],IMask.MaskedNumber=MaskedNumber;class MaskedFunction extends Masked{_update(e){e.mask&&(e.validate=e.mask),super._update(e)}}IMask.MaskedFunction=MaskedFunction;const r=["compiledMasks","currentMaskRef","currentMask"],l=["mask"];class MaskedDynamic extends Masked{constructor(e){super(Object.assign({},MaskedDynamic.DEFAULTS,e)),this.currentMask=null}_update(e){super._update(e),"mask"in e&&(this.compiledMasks=Array.isArray(e.mask)?e.mask.map((e=>createMask(e))):[])}_appendCharRaw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=this._applyDispatch(e,t);return this.currentMask&&s.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),s}_applyDispatch(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const a=t.tail&&null!=t._beforeTailState?t._beforeTailState._value:this.value,i=this.rawInputValue,n=t.tail&&null!=t._beforeTailState?t._beforeTailState._rawInputValue:i,u=i.slice(n.length),r=this.currentMask,l=new ChangeDetails,o=null===r||void 0===r?void 0:r.state;if(this.currentMask=this.doDispatch(e,Object.assign({},t),s),this.currentMask)if(this.currentMask!==r){if(this.currentMask.reset(),n){const e=this.currentMask.append(n,{raw:!0});l.tailShift=e.inserted.length-a.length}u&&(l.tailShift+=this.currentMask.append(u,{raw:!0,tail:!0}).tailShift)}else this.currentMask.state=o;return l}_appendPlaceholder(){const e=this._applyDispatch(...arguments);return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch(...arguments);return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new ChangeDetails;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,s;return Object.assign({},e,{_beforeTailState:(null===(t=e._beforeTailState)||void 0===t?void 0:t.currentMaskRef)===this.currentMask&&(null===(s=e._beforeTailState)||void 0===s?void 0:s.currentMask)||e._beforeTailState})}doDispatch(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this.dispatch(e,this,t,s)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},[s,a]=normalizePrepare(super.doPrepare(e,t));if(this.currentMask){let e;[s,e]=normalizePrepare(super.doPrepare(s,this.currentMaskFlags(t))),a=a.aggregate(e)}return[s,a]}reset(){var e;null===(e=this.currentMask)||void 0===e||e.reset(),this.compiledMasks.forEach((e=>e.reset()))}get value(){return this.currentMask?this.currentMask.value:""}set value(e){super.value=e}get unmaskedValue(){return this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.currentMask?this.currentMask.typedValue:""}set typedValue(e){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 e;return Boolean(null===(e=this.currentMask)||void 0===e?void 0:e.isComplete)}get isFilled(){var e;return Boolean(null===(e=this.currentMask)||void 0===e?void 0:e.isFilled)}remove(){const e=new ChangeDetails;return this.currentMask&&e.aggregate(this.currentMask.remove(...arguments)).aggregate(this._applyDispatch()),e}get state(){var e;return Object.assign({},super.state,{_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map((e=>e.state)),currentMaskRef:this.currentMask,currentMask:null===(e=this.currentMask)||void 0===e?void 0:e.state})}set state(e){const{compiledMasks:t,currentMaskRef:s,currentMask:a}=e,i=_objectWithoutPropertiesLoose(e,r);this.compiledMasks.forEach(((e,s)=>e.state=t[s])),null!=s&&(this.currentMask=s,this.currentMask.state=a),super.state=i}extractInput(){return this.currentMask?this.currentMask.extractInput(...arguments):""}extractTail(){return this.currentMask?this.currentMask.extractTail(...arguments):super.extractTail(...arguments)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(){return this.currentMask?this.currentMask.nearestInputPos(...arguments):super.nearestInputPos(...arguments)}get overwrite(){return this.currentMask?this.currentMask.overwrite:super.overwrite}set overwrite(e){console.warn('"overwrite" option is not available in dynamic mask, use this option in siblings')}get eager(){return this.currentMask?this.currentMask.eager:super.eager}set eager(e){console.warn('"eager" option is not available in dynamic mask, use this option in siblings')}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:super.skipInvalid}set skipInvalid(e){(this.isInitialized||e!==Masked.DEFAULTS.skipInvalid)&&console.warn('"skipInvalid" option is not available in dynamic mask, use this option in siblings')}maskEquals(e){return Array.isArray(e)&&this.compiledMasks.every(((t,s)=>{if(!e[s])return;const a=e[s],{mask:i}=a,n=_objectWithoutPropertiesLoose(a,l);return objectIncludes(t,n)&&t.maskEquals(i)}))}typedValueEquals(e){var t;return Boolean(null===(t=this.currentMask)||void 0===t?void 0:t.typedValueEquals(e))}}MaskedDynamic.DEFAULTS={dispatch:(t,s,a,i)=>{if(!s.compiledMasks.length)return;const n=s.rawInputValue,u=s.compiledMasks.map(((u,r)=>{const l=s.currentMask===u,o=l?u.value.length:u.nearestInputPos(u.value.length,e.FORCE_LEFT);return u.rawInputValue!==n?(u.reset(),u.append(n,{raw:!0})):l||u.remove(o),u.append(t,s.currentMaskFlags(a)),u.appendTail(i),{index:r,weight:u.rawInputValue.length,totalInputPositions:u.totalInputPositions(0,Math.max(o,u.nearestInputPos(u.value.length,e.FORCE_LEFT)))}}));return u.sort(((e,t)=>t.weight-e.weight||t.totalInputPositions-e.totalInputPositions)),s.compiledMasks[u[0].index]}},IMask.MaskedDynamic=MaskedDynamic;const o={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function createPipe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.MASKED,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o.MASKED;const a=createMask(e);return e=>a.runIsolated((a=>(a[t]=e,a[s])))}function pipe(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];return createPipe(...s)(e)}IMask.PIPE_TYPE=o,IMask.createPipe=createPipe,IMask.pipe=pipe;try{globalThis.IMask=IMask}catch(e){}var h=__webpack_require__(2380),d=!0;var p={mask:{},prepare:Function,validate:Function,commit:Function,overwrite:{type:Boolean,required:!1,default:void 0},placeholderChar:String,lazy:{type:Boolean,required:!1,default:void 0},definitions:Object,blocks:Object,pattern:String,format:Function,parse:Function,autofix:{type:Boolean,required:!1,default:void 0},radix:String,thousandsSeparator:String,mapToRadix:Array,scale:Number,signed:{type:Boolean,required:!1,default:void 0},normalizeZeros:{type:Boolean,required:!1,default:void 0},padFractionalZeros:{type:Boolean,required:!1,default:void 0},min:[Number,Date],max:[Number,Date],dispatch:Function};function useIMask(e){let{emit:t,onAccept:s,onComplete:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=(0,h.isRef)(e)?e:(0,h.ref)(e);const i=(0,h.ref)(),n=(0,h.ref)(),u=(0,h.ref)(),r=(0,h.ref)(),l=(0,h.ref)();let o,d,p,c;function _onAccept(){c=l.value=n.value.typedValue,p=r.value=n.value.unmaskedValue,d=u.value=n.value.value,t&&(t("accept",d),t("accept:masked",d),t("accept:typed",c),t("accept:unmasked",p)),s&&s()}function _onComplete(){t&&(t("complete",d),t("complete:masked",d),t("complete:typed",c),t("complete:unmasked",p)),a&&a()}function _initMask(){o=i.value;const t=e.value;o&&null!==t&&void 0!==t&&t.mask&&(n.value=IMask(o,t).on("accept",_onAccept).on("complete",_onComplete),_onAccept())}function _destroyMask(){n.value&&(n.value.destroy(),n.value=null)}return(0,h.onMounted)(_initMask),(0,h.onUnmounted)(_destroyMask),(0,h.watch)(r,(()=>{n.value&&(p=n.value.unmaskedValue=r.value)})),(0,h.watch)(u,(()=>{n.value&&(d=n.value.value=u.value)})),(0,h.watch)(l,(()=>{n.value&&(c=n.value.typedValue=l.value)})),(0,h.watch)([i,e],(()=>{const t=i.value,s=e.value;null!==s&&void 0!==s&&s.mask&&t===o||_destroyMask(),t&&(n.value?n.value.updateOptions(s):_initMask())})),{el:i,mask:(0,h.readonly)(n),masked:u,unmasked:r,typed:l}}const c=["typed","unmasked","value","modelValue"];function _extractOptionsFromProps(e){return e=Object.assign({},e),Object.keys(e).filter((t=>void 0===e[t])).forEach((t=>{delete e[t]})),c.forEach((t=>delete e[t])),e}var k={name:"imask-input",inheritAttrs:!1,setup(e,t){let{attrs:s,slots:a,emit:i}=t;const{el:n,mask:u,masked:r,unmasked:l,typed:o}=useIMask(_extractOptionsFromProps(e),{emit:i,onAccept:()=>{const e=r.value;i("accept:value",e),i("update:value",e),i("update:masked",e),i("update:modelValue",e),i("update:unmasked",l.value),i("update:typed",o.value)},onComplete:()=>{i("complete:value",r.value)}}),d=(0,h.toRef)(e,"value"),p=(0,h.toRef)(e,"modelValue"),c=(0,h.toRef)(e,"unmasked"),k=(0,h.toRef)(e,"typed");return r.value=p.value||d.value||"",l.value=c.value,o.value=k.value,(0,h.watch)(d,(e=>r.value=e)),(0,h.watch)(p,(e=>r.value=e)),(0,h.watch)(c,(e=>l.value=e)),(0,h.watch)(k,(e=>o.value=e)),()=>{const t=Object.assign({},s,{value:null!=e.value?e.value:e.modelValue,ref:n});return e.mask||(t.onInput=e=>{i("update:modelValue",e.target.value),i("update:value",e.target.value)}),(0,h.h)("input",t)}},props:Object.assign({modelValue:String,value:String,unmasked:String,typed:{}},p),emits:["update:modelValue","update:masked","update:value","update:unmasked","update:typed","accept","accept:value","accept:masked","accept:unmasked","accept:typed","complete","complete:value","complete:masked","complete:unmasked","complete:typed"]},g={name:"imask-input",render(e){const t={domProps:{value:this.maskRef?this.maskRef.value:this.value},on:Object.assign({},this.$listeners)};return this.$props.mask?delete t.on.input:t.on.input=e=>this.$emit("input",e.target.value),e("input",t)},mounted(){this.$props.mask&&this._initMask()},destroyed(){this._destroyMask()},computed:{maskOptions(){return this._extractOptionsFromProps(this.$props)}},watch:{$props:{handler(e){const t=this.maskOptions;t.mask?this.maskRef?(this.maskRef.updateOptions(t),"value"in e&&this._updateValue()):(this._initMask(t),e.value!==this._maskValue()&&this._onAccept()):(this._destroyMask(),"value"in e&&(this.$el.value=e.value))},deep:!0}},methods:{_extractOptionsFromProps(e){return e=Object.assign({},e),Object.keys(e).filter((t=>void 0===e[t])).forEach((t=>{delete e[t]})),delete e.value,delete e.unmask,e},_maskValue(){return"typed"===this.unmask?this.maskRef.typedValue:this.unmask?this.maskRef.unmaskedValue:this.maskRef.value},_updateValue(){const e=null==this.value&&"typed"!==this.unmask?"":this.value;"typed"===this.unmask?this.maskRef.typedValue=e:this.unmask?this.maskRef.unmaskedValue=e:this.maskRef.value=e},_onAccept(){const e=this._maskValue();this.$emit("input",e),this.$emit("accept",e)},_onComplete(){this.$emit("complete",this._maskValue())},_initMask(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.maskOptions;this.maskRef=IMask(this.$el,e).on("accept",this._onAccept.bind(this)).on("complete",this._onComplete.bind(this)),this._updateValue()},_destroyMask(){this.maskRef&&(this.maskRef.destroy(),delete this.maskRef)}},props:Object.assign({value:{},unmask:{validator:function(e){return"typed"===e||"boolean"===typeof e}}},p)},m=d?k:g,v={name:"imask",[d?"beforeMount":"bind"]:(e,t)=>{let{value:s}=t;s&&initMask(e,s)},[d?"updated":"update"]:(e,t)=>{let{value:s}=t;s?e.maskRef?(e.maskRef.updateOptions(s),e.value!==e.maskRef.value&&e.maskRef._onChange()):initMask(e,s):destroyMask(e)},[d?"unmounted":"unbind"]:e=>{destroyMask(e)}};function fireEvent(e,t,s){var a=document.createEvent("CustomEvent");a.initCustomEvent(t,!0,!0,s),e.dispatchEvent(a)}function initMask(e,t){e.maskRef=IMask(e,t).on("accept",(()=>fireEvent(e,"accept",e.maskRef))).on("complete",(()=>fireEvent(e,"complete",e.maskRef)))}function destroyMask(e){e.maskRef&&(e.maskRef.destroy(),delete e.maskRef)}})(),a})()));
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ldmuiOptions } from './types/options'
|
|
2
|
+
import { IInput, IWatcher } from './types/validation';
|
|
3
|
+
import { Vue } from 'vue-class-component';
|
|
4
|
+
|
|
5
|
+
declare const defaults: Record<string, unknown>;
|
|
6
|
+
declare function getAliases(components: Record<string, unknown>): Record<string, unknown>;
|
|
7
|
+
declare function isDefined(value: unknown): boolean;
|
|
8
|
+
declare function uidGen(len?: number, format?: string): string | number;
|
|
9
|
+
declare function delay(timeout: number): Promise<void>;
|
|
10
|
+
declare function deepValueGetter(obj: Record<string, unknown>, path: string): unknown;
|
|
11
|
+
declare function isObjectEmpty(obj: Record<string, unknown>): boolean;
|
|
12
|
+
declare const urlRegexp: RegExp;
|
|
13
|
+
declare const datetime: {
|
|
14
|
+
dateLocalToISO: (value: string) => string;
|
|
15
|
+
toServerString: (value: Date) => string;
|
|
16
|
+
}
|
|
17
|
+
declare class ValidateMixin extends Vue {
|
|
18
|
+
inputs: Array<IInput>;
|
|
19
|
+
watchers: Array<IWatcher>;
|
|
20
|
+
errorBag: Record<number, boolean>;
|
|
21
|
+
lazyValidation: boolean;
|
|
22
|
+
isValid: boolean;
|
|
23
|
+
section: number | string;
|
|
24
|
+
validate: () => boolean;
|
|
25
|
+
register: (input: Vue, section: number | string) => void;
|
|
26
|
+
unregister: (input: IInput) => void;
|
|
27
|
+
validateSection: (section: number | string) => boolean;
|
|
28
|
+
customValidateFunc: () => string | boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare const ValidateMixinOptions: Record<string, any>;
|
|
32
|
+
|
|
33
|
+
declare const ldmui: {
|
|
34
|
+
install(vue: any, options?: ldmuiOptions): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default ldmui;
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
defaults,
|
|
41
|
+
getAliases,
|
|
42
|
+
isDefined,
|
|
43
|
+
delay,
|
|
44
|
+
uidGen,
|
|
45
|
+
deepValueGetter,
|
|
46
|
+
isObjectEmpty,
|
|
47
|
+
urlRegexp,
|
|
48
|
+
datetime,
|
|
49
|
+
ValidateMixin,
|
|
50
|
+
ValidateMixinOptions
|
|
51
|
+
}
|