@cat-of-summer/st-script 1.5.0 → 1.6.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/dist/app/datepicker.min.js +3 -3
- package/dist/app/datepicker.min.js.map +3 -3
- package/dist/app/form.min.js +1 -1
- package/dist/app/form.min.js.map +3 -3
- package/dist/app.esm.min.js +1 -1
- package/dist/app.esm.min.js.map +3 -3
- package/dist/app.min.js +1 -1
- package/dist/app.min.js.map +3 -3
- package/dist/core.esm.min.js +1 -1
- package/dist/core.esm.min.js.map +3 -3
- package/dist/core.min.js +1 -1
- package/dist/core.min.js.map +3 -3
- package/dist/loader.esm.min.js +1 -1
- package/dist/loader.esm.min.js.map +3 -3
- package/dist/loader.min.js +1 -1
- package/dist/loader.min.js.map +3 -3
- package/dist/mask.esm.min.js +1 -1
- package/dist/mask.esm.min.js.map +3 -3
- package/dist/mask.min.js +1 -1
- package/dist/mask.min.js.map +3 -3
- package/dist/modal.esm.min.js +1 -1
- package/dist/modal.esm.min.js.map +3 -3
- package/dist/modal.min.js +1 -1
- package/dist/modal.min.js.map +3 -3
- package/dist/observer.esm.min.js +1 -1
- package/dist/observer.esm.min.js.map +3 -3
- package/dist/observer.min.js +1 -1
- package/dist/observer.min.js.map +3 -3
- package/dist/route.esm.min.js.map +2 -2
- package/dist/route.min.js +1 -1
- package/dist/route.min.js.map +2 -2
- package/dist/select.esm.min.js +1 -1
- package/dist/select.esm.min.js.map +3 -3
- package/dist/select.min.js +1 -1
- package/dist/select.min.js.map +3 -3
- package/dist/shape.esm.min.js +1 -1
- package/dist/shape.esm.min.js.map +3 -3
- package/dist/shape.min.js +1 -1
- package/dist/shape.min.js.map +3 -3
- package/dist/toggle.esm.min.js +1 -1
- package/dist/toggle.esm.min.js.map +3 -3
- package/dist/toggle.min.js +1 -1
- package/dist/toggle.min.js.map +3 -3
- package/dist/typograf.esm.min.js +1 -1
- package/dist/typograf.esm.min.js.map +3 -3
- package/dist/typograf.min.js +1 -1
- package/dist/typograf.min.js.map +3 -3
- package/dist/uploader.esm.min.js +1 -1
- package/dist/uploader.esm.min.js.map +3 -3
- package/dist/uploader.min.js +1 -1
- package/dist/uploader.min.js.map +3 -3
- package/dist/validator.esm.min.js +1 -1
- package/dist/validator.esm.min.js.map +3 -3
- package/dist/validator.min.js +1 -1
- package/dist/validator.min.js.map +3 -3
- package/docs/README.md +59 -5
- package/docs/src/app/index.js.md +91 -7
- package/docs/src/core/index.js.md +52 -6
- package/docs/src/loader/index.js.md +2 -1
- package/docs/src/mask/index.js.md +2 -1
- package/docs/src/modal/index.js.md +14 -2
- package/docs/src/observer/index.js.md +2 -2
- package/docs/src/select/index.js.md +1 -1
- package/docs/src/shape/index.js.md +2 -1
- package/docs/src/toggle/index.js.md +53 -21
- package/docs/src/typograf/index.js.md +2 -2
- package/docs/src/uploader/index.js.md +2 -1
- package/docs/src/validator/index.js.md +2 -1
- package/package.json +1 -1
- package/src/_traits/hasInstanceSymbol.js +14 -1
- package/src/app/index.js +102 -15
- package/src/core/index.js +84 -14
- package/src/loader/index.js +13 -3
- package/src/mask/index.js +21 -2
- package/src/modal/index.js +16 -6
- package/src/observer/index.js +3 -3
- package/src/select/index.js +24 -4
- package/src/shape/index.js +9 -0
- package/src/toggle/index.js +85 -28
- package/src/typograf/index.js +3 -3
- package/src/uploader/index.js +32 -9
- package/src/validator/index.js +20 -2
package/dist/mask.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var Mask=(()=>{var N=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var me=Object.prototype.hasOwnProperty;var pe=(i,e)=>{for(var t in e)N(i,t,{get:e[t],enumerable:!0})},ge=(i,e,t,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of de(e))!me.call(i,r)&&r!==t&&N(i,r,{get:()=>e[r],enumerable:!(l=ce(e,r))||l.enumerable});return i};var ye=i=>ge(N({},"__esModule",{value:!0}),i);var Ee={};pe(Ee,{default:()=>C});var $=Symbol(),z=Symbol(),P=i=>{try{return i instanceof Element?i:document.querySelector(i)}catch{return}},j=i=>{if(i==null)return[];if(i instanceof Element)return[i];if(i instanceof NodeList||i instanceof HTMLCollection)return[...i];if(Array.isArray(i))return i.flatMap(j);try{return[...document.querySelectorAll(i)]}catch{return[]}},F=i=>P(i)?.[$],H=(i,e)=>(i&&(i[$]=e),i),J=(i,e)=>{if(!i)return i;let t=i[z]??=new Set;for(let[l,r]of Object.entries(e)){if(l in i&&!t.has(l)){console.warn(`\u0418\u043C\u044F "${l}" \u0443\u0436\u0435 \u0437\u0430\u043D\u044F\u0442\u043E \u043D\u0430 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0435 \u2014 \u043C\u0435\u0442\u043E\u0434 \u043D\u0435 \u043E\u043F\u0443\u0431\u043B\u0438\u043A\u043E\u0432\u0430\u043D`,i);continue}Object.defineProperty(i,l,{value:r,writable:!0,configurable:!0,enumerable:!1}),t.add(l)}return i},Z=(i,e,t=[])=>{if(!i)return i;i[$]===e&&delete i[$];let l=i[z];for(let r of t)l?.has(r)&&(delete i[r],l.delete(r));return i};var Q={0:/^[0-9]$/,a:/^\p{L}$/u,"*":/^[^\n]$/},W=/^[\p{L}\p{N}]$/u,X=i=>i.replace(/\\(.)/g,"$1"),Y=i=>i.global?new RegExp(i.source,i.flags.replace("g","")):i;function K(i,e){let t=i[e],l=t=="{"?"}":"]",r=0;for(let n=e;n<i.length;n++){let s=i[n];if(s=="\\"){n++;continue}if(t=="["&&s=="{"){if((n=K(i,n))<0)return-1}else if(s==t)r++;else if(s==l&&--r==0)return n}return-1}function ee(i,e){let t=0,l=-1;for(let r=0;r<i.length;r++){if(i[r]=="\\"){r++;continue}i[r]=="{"||i[r]=="["?t++:i[r]=="}"||i[r]=="]"?t--:t==0&&i.startsWith(e,r)&&(l=r)}return l}function te(i,e){return i.every(t=>t.group==null&&(t.group=e,!t.children||te(t.children,e)))}function _e(i){let e=()=>(console.warn("\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0431\u043B\u043E\u043A \u043C\u0430\u0441\u043A\u0438",`{${i}}`),[...`{${i}}`].map(n=>({type:"literal",char:n}))),t=/^([A-Za-z_]\w*):/.exec(i);if(t){let n=I(i.slice(t[0].length));return te(n,t[1])?n:e()}let l=ee(i,";");if(l>0){let n=i.slice(l+1);if(/^(\d+|\d*-\d*)$/.test(n)&&n!="-"){let[s,a]=/^\d+$/.test(n)?[+n,+n]:n.split("-").map((h,c)=>h===""?c?1/0:0:+h);return a<s?e():[{type:"repeat",children:I(i.slice(0,l)),min:s,max:a}]}}if(i[0]=="{"&&i.at(-1)=="}")try{return[{type:"slot",test:new RegExp(`^(?:${i.slice(1,-1)})$`,"u")}]}catch{return e()}let r=ee(i,"=>");if(r>0){let n=X(i.slice(0,r)),s=X(i.slice(r+2));return n.length!=1||!s?e():[{type:"transform",from:n,to:s}]}return e()}function I(i){let e=[];for(let t=0;t<i.length;t++){let l=i[t],r;l=="\\"?e.push({type:"literal",char:i[++t]??"\\"}):l=="["&&(r=K(i,t))>=0?(e.push({type:"optional",children:I(i.slice(t+1,r))}),t=r):l=="{"&&(r=K(i,t))>=0?(e.push(..._e(i.slice(t+1,r))),t=r):e.push(Q[l]?{type:"slot",test:Q[l]}:{type:"literal",char:l})}return e}function le(i){return i.every(e=>e.type=="literal"||e.type=="slot"||e.type=="repeat"&&e.min==e.max&&le(e.children))}function re(i,e=new Set){for(let t of i)t.group!=null&&e.add(t.group),t.children&&re(t.children,e);return e}function w(i,e={}){if(i&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof RegExp)&&i.pattern==null&&i.filter==null&&i.numeral==null)return Object.entries(i).flatMap(([l,r])=>w(r,e).map(n=>({...n,key:l})));let t=(Array.isArray(i)?i:[i]).map(l=>{if(typeof l=="function")return{fn:l,base:e};if(l instanceof RegExp&&(l={filter:l}),typeof l=="string"&&(l={pattern:l}),l.numeral){let s={fraction:0,group:" ",decimal:",",prefix:"",suffix:"",sign:!1,...l.numeral};return{numeral:s,fixed:!1,valid:null,message:l.message??s.message,filler:l.filler??e.filler,before_char:null,before_slot:null}}let r=l.pattern!=null?I(l.pattern):[{type:"repeat",min:0,max:l.max_length??1/0,greedy:!0,children:[{type:"slot",test:Y(l.filter)}]}],n=l.groups??e.groups??{};return{nodes:r,names:[...re(r)],fills:Object.fromEntries(Object.entries(n).filter(([,s])=>s?.filler!=null).map(([s,a])=>[s,a.filler])),fixed:l.pattern!=null&&le(r),valid:l.valid?Y(l.valid):l.filter?/./:null,message:l.message,filler:l.filler??e.filler,before_char:l.before_char??e.before_char,before_slot:l.before_slot??e.before_slot}});return t.forEach((l,r)=>l.key??=r),t}function B(i,e,t,l){let r=i.fills?.[t];return r==null&&(r=i.filler??"_",l=e),r[l]??r.at(-1)??"_"}function k(i,e,t){let l=[...String(e??"")];return i.before_char?l.flatMap(r=>{let n=i.before_char(t?.input,{char:r});return n===!1||n===""||n===null?[]:typeof n=="string"?[...n]:[r]}):l}function xe(i,e,t){return i.type=="slot"?i.test.test(e):i.type=="transform"?i.from===e||t.input.slice(t.ip,t.ip+i.to.length).join("")===i.to:i.type=="repeat"?L(i.children,e,t):!1}function L(i,e,t,l){for(let r of i){if(r.type=="literal"){if(!l&&r.char===e)return!0;continue}if(r.type=="optional"||r.type=="repeat"&&r.min==0){if(L(r.children,e,t,l))return!0;continue}return xe(r,e,t)}return l?i.some(r=>r.type=="literal"&&r.char===e):!1}function T(i,e,t,l="char",r=null,n=null){i.units.push({kind:l,ordinal:r,group:n,stream_start:i.stream.length,stream_end:i.stream.length+e.length,fmt_start:i.formatted.length,fmt_end:i.formatted.length+t.length}),i.stream+=e,l=="char"&&(i.raw+=e),l=="char"&&n!=null&&(i.groups[n]+=e),r!=null&&(i.cells[r]=l=="char"?e:null),i.formatted+=t}function U(i){i.stop_fmt<0&&(i.stop_fmt=i.formatted.length+i.tail.length)}function O(i,e=null){i.rejected.push({at:i.ip,slot:e}),i.ip++}function D(i){i.complete=!1,i.done=!0,U(i)}function v(i,e,t){for(let l=0;l<i.length;l++){let r=i[l];if(r.type=="literal")e.done?e.ph+=r.char:e.ip<e.input.length?e.input[e.ip]===r.char?(e.ip++,e.consumed++,!e.diverged&&W.test(r.char)&&e.lead++,T(e,r.char,r.char,"literal")):(W.test(r.char)&&(!e.diverged&&e.raw===""&&(e.lead=0),e.diverged=!0),e.formatted+=r.char):e.tail+=r.char;else if(r.type=="slot"){let n=e.ordinal++,s=r.group??null,a=s==null?null:e.local[s]=(e.local[s]??-1)+1,h=B(t,n,s,a);if(e.done){e.ph_slots.push({fmt:e.formatted.length+e.tail.length+e.ph.length,node:r,fill:h}),e.ph+=h;continue}let c=!1;for(;;){if(e.ip>=e.input.length){D(e),e.ph_slots.push({fmt:e.formatted.length+e.tail.length,node:r,fill:h}),e.ph+=h;break}let o=e.input[e.ip];if(r.test.test(o)){if(t.before_slot&&!c){let u=t.before_slot(e.ctx?.input,{char:o,slot:n,cells:e.cells,raw:e.raw,node:r});if(u===!1){O(e,n);continue}if(typeof u=="string"&&u!==o){e.input.splice(e.ip,1,...u),c=!0;continue}}T(e,o,o,"char",n,s)}else if(o===h&&e.ctx?.holes!==!1)e.complete=!1,T(e,o,o,"hole",n,s);else{O(e,n);continue}e.ip++,e.consumed++;break}}else if(r.type=="transform"){if(e.done){e.ph+=r.to;continue}for(;;){if(e.ip>=e.input.length){D(e),e.ph+=r.to;break}if(e.input.slice(e.ip,e.ip+r.to.length).join("")===r.to)e.ip+=r.to.length,e.consumed+=r.to.length;else if(e.input[e.ip]===r.from)e.ip++,e.consumed++;else{O(e);continue}e.diverged||e.lead++,T(e,r.to,r.to);break}}else if(r.type=="repeat"){if(e.done){for(let s=0;s<r.min;s++)v(r.children,e,t);continue}let n=0;for(;n<r.max;){if(e.ip>=e.input.length){if(n<r.min){D(e);for(let a=n;a<r.min;a++)v(r.children,e,t)}else U(e);break}if(!L(r.children,e.input[e.ip],e)){if(!r.greedy&&n>=r.min)break;O(e);continue}let s=e.ip;if(v(r.children,e,t),e.done){for(let a=n+1;a<r.min;a++)v(r.children,e,t);break}if(e.ip===s)break;n++}}else if(r.type=="optional"){if(e.done)continue;let n=i.slice(l+1),s=!1;for(;e.ip<e.input.length;){let a=e.input[e.ip];if(L(r.children,a,e,!0)){s=!0,v(r.children,e,t);break}if(L(n,a,e))break;O(e)}!s&&e.ip>=e.input.length&&U(e)}}}function we(i,e){let t=i.numeral,l=String(e??""),r=t.sign&&l.includes("-"),n;if(t.decimal&&(l.includes(t.decimal)||l.includes("."))){let g=he=>he.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=l.replace(new RegExp(`[^0-9${g(t.decimal)}.]`,"g"),"").replace(t.decimal,"."),V=parseFloat(A);n=Number.isFinite(V)?String(Math.round(V*10**t.fraction)):""}else{let g=l.replace(/\D/g,"");n=g===""?"":g.replace(/^0+/,"")||"0"}if(!n){let g=t.prefix+B(i,0);if(t.fraction){g+=t.decimal;for(let A=1;A<=t.fraction;A++)g+=B(i,A)}return{stream:"",raw:"",formatted:"",tail:"",ph:g+t.suffix,ph_slots:[],complete:!1,consumed:0,lead:0,units:[],cells:[],groups:{},stop_fmt:g.length}}let s=t.fraction,a=n.padStart(s+1,"0"),h=(s?a.slice(0,-s):a).replace(/^0+(?=\d)/,""),c=s?a.slice(-s):"",o=h.length+c.length-n.length,u=(r?"-":"")+n,p="",m=[],d=0,f=0,_=g=>{p+=g},x=g=>{m.push({kind:"char",ordinal:null,stream_start:d,stream_end:d+1,fmt_start:p.length,fmt_end:p.length+1}),p+=g,d++};_(t.prefix),r&&x("-");for(let g=0;g<h.length;g++,f++)g&&(h.length-g)%3==0&&_(t.group),f>=o?x(h[g]):_(h[g]);if(s){_(t.decimal);for(let g=0;g<c.length;g++,f++)f>=o?x(c[g]):_(c[g])}let M=p.length;_(t.suffix);let y=(r?-1:1)*parseFloat(h+(s?"."+c:"")),b=(t.min==null||y>=t.min)&&(t.max==null||y<=t.max);return{stream:u,raw:u,formatted:p,tail:"",ph:"",ph_slots:[],complete:b,consumed:u.length,lead:0,units:m,cells:[],groups:{},stop_fmt:M}}function E(i,e,t){if(i.numeral)return we(i,e);let l={input:k(i,e,t),ctx:t,ip:0,stream:"",raw:"",formatted:"",tail:"",ph:"",ph_slots:[],units:[],cells:[],groups:Object.fromEntries((i.names??[]).map(s=>[s,""])),local:{},consumed:0,lead:0,diverged:!1,ordinal:0,complete:!0,done:!1,stop_fmt:-1,rejected:[]};v(i.nodes,l,i),l.stop_fmt<0&&(l.stop_fmt=l.formatted.length),i.valid&&(l.complete=l.complete&&i.valid.test(l.raw));let r=i.seps??=ie(i.nodes),n=l.rejected.map(({at:s,slot:a})=>({at:s,char:l.input[s],slot:a,reason:r.has(l.input[s])?"literal":"slot"}));for(let s=l.ip;s<l.input.length;s++)n.push({at:s,char:l.input[s],slot:null,reason:"full"});return{stream:l.stream,raw:l.raw,formatted:l.formatted,tail:l.tail,ph:l.ph,ph_slots:l.ph_slots,complete:l.complete,consumed:l.consumed,lead:l.lead,units:l.units,cells:l.cells,groups:l.groups,stop_fmt:l.stop_fmt,rejected:n}}function ie(i,e=new Set){for(let t of i)t.type=="literal"&&!W.test(t.char)&&e.add(t.char),t.children&&ie(t.children,e);return e}function q(i,e,t={}){let l=[];t={...t,stream:String(e??"")};for(let n of i)n.fn?l.push(...w(n.fn(t),n.base).map(s=>({...s,key:n.key??s.key}))):l.push(n);let r=null;for(let n of l){let s=E(n,e,t);(!r||be(s,r.result))&&(r={result:s,def:n,mask_id:n.key})}return r}function be(i,e){return i.consumed!=e.consumed?i.consumed>e.consumed:i.lead>e.lead}function S(i,e){return e=="always"?i.formatted+i.tail+i.ph:e===!1?i.formatted:i.formatted+i.tail}function ne(i,e){for(let t of i.units)if(t.kind!="literal"&&(e<=t.stream_start||e<t.stream_end))return t.fmt_start;return i.stop_fmt}function se(i,e){let t=i.units.filter(l=>l.kind=="char");return t.length>e?t[e-1].stream_end:i.stream.length}var ve=["edit","pad","align","min","max"];function ae(i,e){let t=[];i.slots.forEach((l,r)=>{let n=l.node.group??null,s=t.at(-1);if(!s||s.name!==n){let a=Object.fromEntries(ve.map(h=>[h,e[h]]));n!=null&&Object.assign(a,e.groups?.[n]),t.push(s={name:n,first:r,fmts:[],digits:!0,opts:a})}s.fmts.push(l.fmt),s.last=r,s.digits&&=l.node.test.test("0")&&!l.node.test.test("a")});for(let l of t)[l.start,l.end]=[l.fmts[0],l.fmts.at(-1)+1];return t}function G(i,e){let t=i.fmts.length,l=[...e].slice(-t),r=Array(t-l.length).fill(i.opts.pad??null);return i.opts.align=="right"?[...r,...l]:[...l,...r]}function oe(i,e,t){let{max:l}=i.opts,r=i.digits&&l!=null;return e+=t,r&&+e>l&&(e=String(l)),{buffer:e,cells:G(i,e),advance:e.length>=i.fmts.length||r&&+e*10>l}}function R(i,e){let{min:t}=i.opts,l=i.fmts.length;return!i.digits||t==null||e.includes(null)||+e.join("")>=t?e:G(i,String(t).padStart(l,"0"))}function fe(i,e,t){if(!i.digits)return null;let l=i.fmts.length,r=e.join(""),{min:n=null,max:s=null}=i.opts;n??=0,s??=10**l-1;let a=r===""?t>0?n:s:+r+t;return a>s?a=n:a<n&&(a=s),G(i,String(a).padStart(l,"0"))}function ue(i,e,t){return(i.length?i:[null]).every(l=>{let r={min:t.min,max:t.max,...l!=null&&t.groups?.[l]},n=e[l];return r.min==null&&r.max==null||!/^\d+$/.test(n??"")?!0:(r.min==null||+n>=r.min)&&(r.max==null||+n<=r.max)})}var ke=["before_init","on_init","before_char","before_slot","before_input","on_input","before_paste","on_paste","on_accept","on_complete","on_incomplete","on_mask_change","on_reject"],C=class i{static#v=["target","mask"];static#k=["text","search","tel","url","password"];static#E(e){let t=E(e,""),l=0;return t.slots=t.ph_slots,t.parts=t.slots.map((r,n)=>n&&r.fmt>t.slots[n-1].fmt+1?++l:l),t.template=S(t,"always"),t}static#S(e){if(!/^\s*[[{]/.test(e))return e;let t=l=>typeof l=="string"||Array.isArray(l)&&l.every(r=>typeof r=="string");try{let l=JSON.parse(e);if(Array.isArray(l)?t(l):l&&typeof l=="object"&&Object.values(l).every(t))return l}catch{}return e}#e={};#g={};#o=null;#t=new WeakMap;#i=[];#y=new AbortController;static find=F;get params(){return this.#e}get value(){return this.#i.map(e=>e.value)}clone(e){return new i({...this.#e,...this.#g,...e,parent:this})}constructor(e){e={target:"input[mask]",mask:null,numeral:null,filler:"_",placeholder:!0,edit:"free",pad:null,align:"left",min:null,max:null,groups:{},caret:!0,coerce_type:!0,max_raw:null,validate:null,validation_message:null,...Object.fromEntries(ke.map(t=>[t,()=>{}])),...e};for(let[t,l]of Object.entries(e))typeof l=="function"&&!i.#v.includes(t)?(this[t]=l.bind(this),this.#g[t]=l):this.#e[t]=l;this.before_init(this.#e),this.#e.numeral!=null?this.#o=w({numeral:this.#e.numeral},this.#n()):this.#e.mask!=null&&(this.#o=w(this.#e.mask,this.#n()));for(let t of j(this.#e.target))this.#j(t);this.on_init(this.#e)}raw(e=this.#d()){return this.#t.get(P(e))?.result?.raw??""}state(e=this.#d()){let t=P(e),l=this.#t.get(t);return l?.result?this.#c(t,l):null}set(e,t){arguments.length<2&&([e,t]=[this.#d(),e]);for(let l of j(e))if(this.#t.has(l)){let r=l.value;this.#r(l,String(t??""),{prefix:String(t??"")}),this.#f(l,r,"insertReplacementText")}}clear(e=this.#i){this.set(e,"")}destroy(){this.#y.abort();for(let e of this.#i){let{original:t}=this.#t.get(e)??{};t&&(e.type!=t.type&&(e.type=t.type),t.maxlength!=null&&e.setAttribute("maxlength",t.maxlength),e.style.removeProperty("caret-color"),t.caret[0]&&e.style.setProperty("caret-color",...t.caret)),this.#t.delete(e),Z(e,this,["raw","state","set","clear","set_mask"])}this.#i=[]}#d(){if(this.#i.length!=1)throw new Error(`Mask: \u043C\u0430\u0441\u043A\u0430 \u043F\u0440\u0438\u0432\u044F\u0437\u0430\u043D\u0430 \u043A ${this.#i.length} \u043F\u043E\u043B\u044F\u043C \u2014 \u0443\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u043E\u043B\u0435 \u044F\u0432\u043D\u043E`);return this.#i[0]}set_mask(e,t=null){let l=w(e,this.#n());t||(this.#o=l);for(let r of t?j(t):this.#i){let n=this.#t.get(r);if(!n)continue;n.defs=l,n.seg=null;let s=r.value;this.#r(r,n.stream,{}),this.#f(r,s,"insertReplacementText")}}#f(e,t,l,r=null){e.value!==t&&(this.#t.get(e).handled=!0,e.dispatchEvent(new InputEvent("input",{bubbles:!0,inputType:l,data:r})))}#n(){return{filler:this.#e.filler,groups:this.#e.groups,before_char:this.before_char,before_slot:this.before_slot}}#A(e){return e=="email"?w({filter:/[a-z0-9@._%+-]/i,valid:/^[^@\s]+@[^@\s]+\.[^@\s]{2,}$/},this.#n()):e=="number"?w({numeral:{}},this.#n()):null}#j(e){if(F(e))throw new Error("\u041C\u0430\u0441\u043A\u0430 \u0443\u0436\u0435 \u043F\u0440\u0438\u0432\u044F\u0437\u0430\u043D\u0430 \u043A \u044D\u0442\u043E\u043C\u0443 \u043F\u043E\u043B\u044E");H(e,this);let t=this.#y.signal,l={type:e.type,maxlength:e.getAttribute("maxlength"),caret:[e.style.getPropertyValue("caret-color"),e.style.getPropertyPriority("caret-color")]},r=null;this.#e.coerce_type!==!1&&(e.type=="number"||e.type=="email")&&(r=e.type,e.inputMode=r=="number"?"numeric":"email",e.type="text"),i.#k.includes(e.type)||console.warn(`Mask: \u043F\u043E\u043B\u0435 type="${e.type}" \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043A\u0430\u0440\u0435\u0442\u043A\u043E\u0439 \u2014 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 type="text" \u0438\u043B\u0438 "tel"`,e);let n=e.getAttribute("maxlength");n!=null&&e.removeAttribute("maxlength");let s=this.#e.max_raw??(n!=null?+n:null),a=e.getAttribute("mask"),h=this.#o??(a?w(i.#S(a),this.#n()):this.#A(r));if(!h){console.warn("Mask: \u0434\u043B\u044F \u043F\u043E\u043B\u044F \u043D\u0435 \u0437\u0430\u0434\u0430\u043D\u0430 \u043C\u0430\u0441\u043A\u0430 (\u043D\u0438 \u0432 params.mask, \u043D\u0438 \u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435 mask)",e);return}let c=r=="number"||this.#e.numeral!=null,o={defs:h,def:null,stream:"",result:null,mask_id:null,rendered:"",seg:null,composing:!1,handled:!1,coerced:r,max_raw:s,numeric:c,original:l};this.#t.set(e,o),this.#i.push(e),J(e,{raw:()=>this.raw(e),state:()=>this.state(e),set:d=>this.set(e,d),clear:()=>this.clear(e),set_mask:d=>this.set_mask(d,e)});let u=()=>this.#e.caret=="hide"&&e.style.setProperty("caret-color","transparent","important");u(),e.addEventListener("beforeinput",d=>this.#O(e,d),{signal:t});let p=[this.#e.edit,...Object.values(this.#e.groups??{}).map(d=>d?.edit)];if(p.includes("whole")&&(this.#e.placeholder!="always"||h.length>1||h.some(d=>!d.fixed&&!d.fn))&&console.warn("Mask: edit: 'whole' \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u0441 \u043E\u0434\u043D\u043E\u0439 \u0444\u0438\u043A\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u043E\u0439 \u043C\u0430\u0441\u043A\u043E\u0439 \u0438 placeholder: 'always' - \u0438\u043D\u0430\u0447\u0435 \u0432\u0435\u0434\u0451\u0442 \u0441\u0435\u0431\u044F \u043A\u0430\u043A 'end'",e),p.some(d=>d&&d!="free")){let d=f=>this.#R(e,f.type=="click");for(let f of["selectionchange","click","keyup","select"])e.addEventListener(f,d,{signal:t});e.addEventListener("keydown",f=>this.#T(e,f),{signal:t})}let m=()=>{if(o.handled){o.handled=!1;return}o.composing||this.#p(e)};e.addEventListener("input",m,{signal:t}),e.addEventListener("change",m,{signal:t}),e.addEventListener("compositionstart",()=>o.composing=!0,{signal:t}),e.addEventListener("compositionend",()=>{o.composing=!1,this.#p(e)},{signal:t}),e.addEventListener("focus",d=>{u(),this.#r(e,o.stream,{prefix:o.stream,silent:!0}),this.#I(e,d.relatedTarget)},{signal:t}),e.addEventListener("blur",()=>{this.#m(e),o.seg=null,this.#r(e,o.stream,{silent:!0})},{signal:t}),e.closest("form")?.addEventListener("reset",()=>queueMicrotask(()=>this.#p(e)),{signal:t}),this.#r(e,e.value,{silent:!0})}#O(e,t){let l=this.#t.get(e),r=t.inputType??"insertText";if(t.isComposing||r=="insertCompositionText"||r=="deleteCompositionText"){l.composing=!0;return}if(r=="historyUndo"||r=="historyRedo")return;let n=e.selectionStart??0,s=e.selectionEnd??n,{g:a,edit:h}=this.#a(l,n,s);h=="end"&&l.result&&!(n==0&&s==e.value.length)&&!(a&&n==a.start&&s==a.end)&&(n=s=this.#w(e,l,a)),t.preventDefault();let c=r.startsWith("delete"),o="",u=[];if(!c){if(r=="insertLineBreak"||r=="insertParagraph")return;if(o=t.data??t.dataTransfer?.getData("text/plain")??"",r=="insertFromPaste"){let m=this.before_paste(e,o);if(m===!1)return;typeof m=="string"&&(o=m)}if(l.numeric){let m=l.defs.some(f=>f.numeral?.sign),d="";for(let f of o)f>="0"&&f<="9"||m&&f=="-"?d+=f:u.push({char:f,slot:null,reason:"slot"});o=d}}if(this.before_input(e,{type:r,insert:o,start:n,end:s})===!1)return;let p=e.value;h=="whole"?u.push(...this.#P(e,r,c?"":o)):this.#l(l)?u.push(...this.#$(e,r,n,s,c?"":o)):u.push(...this.#M(e,n,s,c?"":o,r)),r=="insertFromPaste"&&this.on_paste(e,this.#c(e,l));for(let m of u)this.on_reject(e,{...m,type:r});t.defaultPrevented&&this.#f(e,p,r,o||null)}#L(e,{def:t,full:l,cut:r},n,s){let a={input:e},h=k(t,n,a).length,c=k(t,s,a),o=h+c.length,u=(l.rejected??[]).filter(p=>p.at>=h&&p.at<o);if(r!=null){let p=Math.max(0,r-E(t,n,a).stream.length),m=c.map((d,f)=>h+f).filter(d=>!u.some(f=>f.at==d));for(let d of m.slice(p))u.push({at:d,char:c[d-h],slot:null,reason:"full"});u.sort((d,f)=>d.at-f.at)}return u.map(({char:p,slot:m,reason:d})=>({char:p,slot:m,reason:d}))}#M(e,t,l,r,n){let s=this.#t.get(e),a=s.result?.units??[],h,c,o;if(t!=l){let d=a.filter(f=>f.fmt_start<l&&f.fmt_end>t);h=d.length?d[0].stream_start:this.#b(a,t),c=d.length?d.at(-1).stream_end:h}else if(!n.startsWith("delete"))h=c=this.#b(a,t);else{if(n.includes("Forward"))o=a.find(d=>d.fmt_end>t&&d.kind!="literal")??a.find(d=>d.fmt_end>t);else{let d;for(let f of a)f.fmt_start<t&&(f.kind=="literal"?d=f:o=f);o??=d}if(!o)return[];h=o.stream_start,c=o.stream_end}let u=s.stream.slice(0,h),p=u+r,m=this.#r(e,p+s.stream.slice(c),{prefix:p});return r&&m?this.#L(e,m,u,r):[]}#$(e,t,l,r,n){let s=this.#t.get(e),a=s.def,h=this.#l(s),{slots:c,parts:o}=h,u=c.length,p=this.#u(s,h),m=y=>{let b=c.findIndex(g=>g.fmt>=y);return b<0?u:b},d=y=>h.template.slice(c[y-1].fmt+1,c[y].fmt),f;if(l!=r){f=m(l);for(let y=f;y<u&&c[y].fmt<r;y++)p[y]=null}else if(!n&&t.startsWith("delete")){if(t.includes("Forward")){for(f=m(l);f<u&&p[f]==null;)f++;if(f>=u)return[]}else{f=-1;for(let y=0;y<u;y++)c[y].fmt<l&&(f=y);for(;f>=0&&p[f]==null;)f--;if(f<0)return[]}p[f]=null}else f=m(l),f>=u&&(f=p.indexOf(null))<0&&(f=u);let _=[];for(let y of k(a,n,{input:e})){if(f>=u){_.push({char:y,slot:null,reason:"full"});continue}if(!c[f].node.test.test(y)){let b=o.lastIndexOf(o[f]);b+1<u&&d(b+1).includes(y)?f=b+1:_.push(i.#_(a,y,f));continue}p[f++]=y}let x=this.#h(h,p),M=Math.min(E(a,x.slice(0,f),{input:e}).stream.length,u);return this.#r(e,x,{caret_fmt:M<u?c[M].fmt:c[u-1].fmt+1}),_}static#_(e,t,l){return{char:t,slot:l,reason:e.seps?.has(t)?"literal":"slot"}}#P(e,t,l){let r=this.#t.get(e),n=this.#l(r),s=n.spans,a=this.#x(e,r),h=this.#u(r,n),c=m=>h.slice(m.first,m.last+1),o=(m,d)=>h.splice(m.first,d.length,...d),u=s[a.gi],p=[];if(t.startsWith("delete")){if(c(u).every(m=>m==null))return t.includes("Backward")&&a.gi>0&&this.#s(e,a.gi-1),[];o(u,c(u).fill(null)),a.buffer=""}else{t=="insertFromPaste"&&(a.buffer="");for(let m of k(r.def,l,{input:e})){u=s[a.gi];let d=s[a.gi+1];if(d&&n.template.slice(u.end,d.start).includes(m)){a.buffer&&(o(u,R(u,c(u))),a.gi++,a.buffer="");continue}let f=u.first+Math.min(a.buffer.length,u.fmts.length-1);if(!n.slots[f].node.test.test(m)){p.push(i.#_(r.def,m,f));continue}let _=oe(u,a.buffer,m);o(u,_.cells),a.buffer=_.buffer,_.advance&&(o(u,R(u,c(u))),a.buffer="",d&&a.gi++)}}return this.#r(e,this.#h(n,h),{}),this.#s(e,a.gi,!1),p}#T(e,t){let l=this.#t.get(e);if(t.altKey||t.ctrlKey||t.metaKey||!l?.result)return;let{g:r,edit:n}=this.#a(l,e.selectionStart??0,e.selectionEnd??0);if(n!="whole")return;let s=this.#l(l).spans,a=s.length-1,h=this.#x(e,l).gi,c;switch(t.key){case"ArrowLeft":c=h-1;break;case"ArrowRight":c=h+1;break;case"Home":c=0;break;case"End":c=a;break;case"Tab":if(c=h+(t.shiftKey?-1:1),c<0||c>a)return;break;case"ArrowUp":case"ArrowDown":{t.preventDefault();let o=this.#l(l),u=this.#u(l,o),p=fe(s[h],u.slice(s[h].first,s[h].last+1),t.key=="ArrowUp"?1:-1);if(!p)return;u.splice(s[h].first,p.length,...p);let m=e.value;this.#r(e,this.#h(o,u),{}),this.#s(e,h),this.#f(e,m,"insertReplacementText");return}default:return}t.preventDefault(),this.#s(e,Math.max(0,Math.min(c,a)))}#s(e,t,l=!0){let r=this.#t.get(e);r.seg&&r.seg.gi!==t&&this.#m(e),(l||r.seg?.gi!==t)&&(r.seg={gi:t,buffer:""});let n=this.#l(r).spans[t];document.activeElement===e&&e.setSelectionRange(n.start,n.end)}#x(e,t){let{g:l}=this.#a(t,e.selectionStart??0,e.selectionEnd??0),r=this.#l(t).spans.indexOf(l);return t.seg?.gi!==r&&(this.#m(e),t.seg={gi:r,buffer:""}),t.seg}#m(e){let t=this.#t.get(e),l=this.#l(t);if(!t.seg?.buffer||!l)return;let r=l.spans[t.seg.gi],n=this.#u(t,l),s=n.slice(r.first,r.last+1),a=R(r,s);t.seg.buffer="",a!==s&&(n.splice(r.first,a.length,...a),this.#r(e,this.#h(l,n),{}))}#I(e,t){let l=this.#t.get(e),r=this.#l(l);if(!r||this.#a(l,0).edit!="whole")return;let n=t&&e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING;this.#s(e,n?r.spans.length-1:0)}#R(e,t=!1){let l=this.#t.get(e);if(document.activeElement!==e||!l?.result)return;let r=e.selectionStart,n=e.selectionEnd;if(r==null)return;let{g:s,edit:a}=this.#a(l,r,n);if(a=="whole"){let c=this.#l(l).spans.indexOf(s);return!t&&l.seg?.gi===c&&r==s.start&&n==s.end?void 0:this.#s(e,c,t||l.seg?.gi!==c)}if(a!="end")return;if(r!==n){let[c,o]=s?[s.start,s.end]:[0,e.value.length];(r!=0||n!=e.value.length)&&(r!=c||n!=o)&&e.setSelectionRange(c,o);return}if(r===l.caret)return;let h=this.#w(e,l,s);r!==h&&e.setSelectionRange(h,h),l.caret=h}#w(e,t,l){if(l){let r=this.#l(t).slots;for(let n=l.first;n<r.length;n++)if(t.result.cells?.[n]==null)return r[n].fmt;return r.at(-1).fmt+1}return Math.min(t.result.stop_fmt,e.value.length)}#l(e){let t=e.def;if(this.#e.placeholder!="always"||e.defs.length>1||!t?.fixed)return null;let l=t.layout??=i.#E(t);return l.spans??=ae(l,this.#e),l}#a(e,t,l=t){let r=this.#l(e)?.spans??[],n=r.find(a=>t!=l&&a.start==t&&a.end==l)??r.find(a=>t<=a.end)??r.at(-1)??null,s=n?n.opts.edit:this.#e.edit;return{g:n,edit:s=="whole"&&!n?"end":s}}#u(e,t){return t.slots.map((l,r)=>e.result?.cells?.[r]??null)}#h(e,t){let l=t.reduce((r,n,s)=>n!=null?s:r,-1);return t.slice(0,l+1).map((r,n)=>r??e.slots[n].fill).join("")}#b(e,t){let l=0;for(let r of e)(r.fmt_end<=t||r.fmt_start<t)&&(l=r.stream_end);return l}#p(e){let t=this.#t.get(e);if(e.value===t.rendered)return;t.seg=null;let l=e.selectionStart??e.value.length;this.#r(e,e.value,{prefix:e.value.slice(0,l)})}#r(e,t,{prefix:l=null,caret_fmt:r=null,silent:n=!1}={}){let s=this.#t.get(e),a=this.#C(s),h={raw:s.result?.raw??"",value:e.value,input:e,holes:a},c=q(s.defs,t,h);if(!c)return null;let{result:o,def:u,mask_id:p}=c,m={def:u,full:o,cut:null};s.max_raw!=null&&o.raw.length>s.max_raw&&(m.cut=se(o,s.max_raw),c=q(s.defs,o.stream.slice(0,m.cut),h),{result:o,def:u,mask_id:p}=c),!u.numeral&&!ue(u.names,{...o.groups,null:o.raw},this.#e)&&(o.complete=!1);let d=this.#N(e,o);e.value!==d&&(e.value=d),s.rendered=d,r==null&&l!=null&&document.activeElement===e&&(r=ne(o,E(u,l,{input:e,holes:a}).stream.length)),r!=null&&document.activeElement===e&&(r=Math.min(r,d.length),e.setSelectionRange(r,r),s.caret=r);let f=s.result,_=s.mask_id;if(s.result=o,s.stream=o.stream,s.def=u,s.mask_id=p,e.setAttribute("mask_id",p),e.setAttribute("progress",o.raw.length),e.setAttribute("is_complete",o.complete),this.#F(s)&&e.setCustomValidity&&e.setCustomValidity(!o.stream||o.complete?"":this.#D(e,s)),n)return m;let x=this.#c(e,s);return this.on_input(e,x),o.raw!==(f?.raw??"")&&this.on_accept(e,x),o.complete&&!f?.complete&&this.on_complete(e,x),!o.complete&&f?.complete&&this.on_incomplete(e,x),f&&p!==_&&this.on_mask_change(e,x),m}#C(e){let[t]=e.defs;return this.#e.placeholder=="always"&&e.defs.length==1&&!!(t.fixed||t.fn)}#N(e,t){let{placeholder:l}=this.#e;return t.stream?S(t,l):document.activeElement!==e?"":l=="always"?S(t,"always"):l==!1||l=="typed"?"":S(t,!0)}#c(e,t){return{raw:t.result?.raw??"",formatted:e.value,complete:t.result?.complete??!1,mask_id:t.mask_id,progress:t.result?.raw.length??0,groups:{...t.result?.groups},empty:!t.stream,skeleton:t.result?S(t.result,"always"):""}}#F(e){let t=this.#e.validate;return t===!0||t==null&&e.coerced!=null}#D(e,t){let l=typeof this.validation_message=="function"?this.validation_message:this.#e.validation_message??t.def?.message;return typeof l=="function"?l(e,this.#c(e,t))||"":typeof l=="string"?l:t.coerced=="email"?"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0430\u0434\u0440\u0435\u0441 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0447\u0442\u044B":t.coerced=="number"||t.def?.numeral?"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043B\u043E \u0432 \u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u043E\u043C \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D\u0435":"\u0417\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u043F\u043E\u043B\u0435 \u043F\u043E\u043B\u043D\u043E\u0441\u0442\u044C\u044E"}};return ye(Ee);})();
|
|
1
|
+
var Mask=(()=>{var F=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var ge=Object.prototype.hasOwnProperty;var ye=(i,e)=>{for(var t in e)F(i,t,{get:e[t],enumerable:!0})},_e=(i,e,t,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of pe(e))!ge.call(i,r)&&r!==t&&F(i,r,{get:()=>e[r],enumerable:!(l=me(e,r))||l.enumerable});return i};var xe=i=>_e(F({},"__esModule",{value:!0}),i);var Ae={};ye(Ae,{default:()=>N});var $=Symbol(),H=Symbol(),P=i=>{try{return i instanceof Element?i:document.querySelector(i)}catch{return}},v=i=>{if(i==null)return[];if(typeof i=="function")return v(i());if(i instanceof Element)return[i];if(i instanceof NodeList||i instanceof HTMLCollection)return[...i];if(Array.isArray(i))return i.flatMap(v);try{return[...document.querySelectorAll(i)]}catch{return[]}},J=i=>typeof i=="string"||typeof i=="function",Z=i=>{let e=new AbortController;return i.addEventListener("abort",()=>e.abort(),{once:!0,signal:e.signal}),e},T=i=>P(i)?.[$],Q=(i,e)=>(i&&(i[$]=e),i),X=(i,e)=>{if(!i)return i;let t=i[H]??=new Set;for(let[l,r]of Object.entries(e)){if(l in i&&!t.has(l)){console.warn(`\u0418\u043C\u044F "${l}" \u0443\u0436\u0435 \u0437\u0430\u043D\u044F\u0442\u043E \u043D\u0430 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0435 \u2014 \u043C\u0435\u0442\u043E\u0434 \u043D\u0435 \u043E\u043F\u0443\u0431\u043B\u0438\u043A\u043E\u0432\u0430\u043D`,i);continue}Object.defineProperty(i,l,{value:r,writable:!0,configurable:!0,enumerable:!1}),t.add(l)}return i},D=(i,e,t=[])=>{if(!i)return i;i[$]===e&&delete i[$];let l=i[H];for(let r of t)l?.has(r)&&(delete i[r],l.delete(r));return i};var Y={0:/^[0-9]$/,a:/^\p{L}$/u,"*":/^[^\n]$/},K=/^[\p{L}\p{N}]$/u,ee=i=>i.replace(/\\(.)/g,"$1"),te=i=>i.global?new RegExp(i.source,i.flags.replace("g","")):i;function B(i,e){let t=i[e],l=t=="{"?"}":"]",r=0;for(let n=e;n<i.length;n++){let s=i[n];if(s=="\\"){n++;continue}if(t=="["&&s=="{"){if((n=B(i,n))<0)return-1}else if(s==t)r++;else if(s==l&&--r==0)return n}return-1}function le(i,e){let t=0,l=-1;for(let r=0;r<i.length;r++){if(i[r]=="\\"){r++;continue}i[r]=="{"||i[r]=="["?t++:i[r]=="}"||i[r]=="]"?t--:t==0&&i.startsWith(e,r)&&(l=r)}return l}function re(i,e){return i.every(t=>t.group==null&&(t.group=e,!t.children||re(t.children,e)))}function we(i){let e=()=>(console.warn("\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0431\u043B\u043E\u043A \u043C\u0430\u0441\u043A\u0438",`{${i}}`),[...`{${i}}`].map(n=>({type:"literal",char:n}))),t=/^([A-Za-z_]\w*):/.exec(i);if(t){let n=I(i.slice(t[0].length));return re(n,t[1])?n:e()}let l=le(i,";");if(l>0){let n=i.slice(l+1);if(/^(\d+|\d*-\d*)$/.test(n)&&n!="-"){let[s,a]=/^\d+$/.test(n)?[+n,+n]:n.split("-").map((c,h)=>c===""?h?1/0:0:+c);return a<s?e():[{type:"repeat",children:I(i.slice(0,l)),min:s,max:a}]}}if(i[0]=="{"&&i.at(-1)=="}")try{return[{type:"slot",test:new RegExp(`^(?:${i.slice(1,-1)})$`,"u")}]}catch{return e()}let r=le(i,"=>");if(r>0){let n=ee(i.slice(0,r)),s=ee(i.slice(r+2));return n.length!=1||!s?e():[{type:"transform",from:n,to:s}]}return e()}function I(i){let e=[];for(let t=0;t<i.length;t++){let l=i[t],r;l=="\\"?e.push({type:"literal",char:i[++t]??"\\"}):l=="["&&(r=B(i,t))>=0?(e.push({type:"optional",children:I(i.slice(t+1,r))}),t=r):l=="{"&&(r=B(i,t))>=0?(e.push(...we(i.slice(t+1,r))),t=r):e.push(Y[l]?{type:"slot",test:Y[l]}:{type:"literal",char:l})}return e}function ie(i){return i.every(e=>e.type=="literal"||e.type=="slot"||e.type=="repeat"&&e.min==e.max&&ie(e.children))}function ne(i,e=new Set){for(let t of i)t.group!=null&&e.add(t.group),t.children&&ne(t.children,e);return e}function w(i,e={}){if(i&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof RegExp)&&i.pattern==null&&i.filter==null&&i.numeral==null)return Object.entries(i).flatMap(([l,r])=>w(r,e).map(n=>({...n,key:l})));let t=(Array.isArray(i)?i:[i]).map(l=>{if(typeof l=="function")return{fn:l,base:e};if(l instanceof RegExp&&(l={filter:l}),typeof l=="string"&&(l={pattern:l}),l.numeral){let s={fraction:0,group:" ",decimal:",",prefix:"",suffix:"",sign:!1,...l.numeral};return{numeral:s,fixed:!1,valid:null,message:l.message??s.message,filler:l.filler??e.filler,before_char:null,before_slot:null}}let r=l.pattern!=null?I(l.pattern):[{type:"repeat",min:0,max:l.max_length??1/0,greedy:!0,children:[{type:"slot",test:te(l.filter)}]}],n=l.groups??e.groups??{};return{nodes:r,names:[...ne(r)],fills:Object.fromEntries(Object.entries(n).filter(([,s])=>s?.filler!=null).map(([s,a])=>[s,a.filler])),fixed:l.pattern!=null&&ie(r),valid:l.valid?te(l.valid):l.filter?/./:null,message:l.message,filler:l.filler??e.filler,before_char:l.before_char??e.before_char,before_slot:l.before_slot??e.before_slot}});return t.forEach((l,r)=>l.key??=r),t}function U(i,e,t,l){let r=i.fills?.[t];return r==null&&(r=i.filler??"_",l=e),r[l]??r.at(-1)??"_"}function E(i,e,t){let l=[...String(e??"")];return i.before_char?l.flatMap(r=>{let n=i.before_char(t?.input,{char:r});return n===!1||n===""||n===null?[]:typeof n=="string"?[...n]:[r]}):l}function be(i,e,t){return i.type=="slot"?i.test.test(e):i.type=="transform"?i.from===e||t.input.slice(t.ip,t.ip+i.to.length).join("")===i.to:i.type=="repeat"?L(i.children,e,t):!1}function L(i,e,t,l){for(let r of i){if(r.type=="literal"){if(!l&&r.char===e)return!0;continue}if(r.type=="optional"||r.type=="repeat"&&r.min==0){if(L(r.children,e,t,l))return!0;continue}return be(r,e,t)}return l?i.some(r=>r.type=="literal"&&r.char===e):!1}function C(i,e,t,l="char",r=null,n=null){i.units.push({kind:l,ordinal:r,group:n,stream_start:i.stream.length,stream_end:i.stream.length+e.length,fmt_start:i.formatted.length,fmt_end:i.formatted.length+t.length}),i.stream+=e,l=="char"&&(i.raw+=e),l=="char"&&n!=null&&(i.groups[n]+=e),r!=null&&(i.cells[r]=l=="char"?e:null),i.formatted+=t}function q(i){i.stop_fmt<0&&(i.stop_fmt=i.formatted.length+i.tail.length)}function O(i,e=null){i.rejected.push({at:i.ip,slot:e}),i.ip++}function W(i){i.complete=!1,i.done=!0,q(i)}function k(i,e,t){for(let l=0;l<i.length;l++){let r=i[l];if(r.type=="literal")e.done?e.ph+=r.char:e.ip<e.input.length?e.input[e.ip]===r.char?(e.ip++,e.consumed++,!e.diverged&&K.test(r.char)&&e.lead++,C(e,r.char,r.char,"literal")):(K.test(r.char)&&(!e.diverged&&e.raw===""&&(e.lead=0),e.diverged=!0),e.formatted+=r.char):e.tail+=r.char;else if(r.type=="slot"){let n=e.ordinal++,s=r.group??null,a=s==null?null:e.local[s]=(e.local[s]??-1)+1,c=U(t,n,s,a);if(e.done){e.ph_slots.push({fmt:e.formatted.length+e.tail.length+e.ph.length,node:r,fill:c}),e.ph+=c;continue}let h=!1;for(;;){if(e.ip>=e.input.length){W(e),e.ph_slots.push({fmt:e.formatted.length+e.tail.length,node:r,fill:c}),e.ph+=c;break}let u=e.input[e.ip];if(r.test.test(u)){if(t.before_slot&&!h){let f=t.before_slot(e.ctx?.input,{char:u,slot:n,cells:e.cells,raw:e.raw,node:r});if(f===!1){O(e,n);continue}if(typeof f=="string"&&f!==u){e.input.splice(e.ip,1,...f),h=!0;continue}}C(e,u,u,"char",n,s)}else if(u===c&&e.ctx?.holes!==!1)e.complete=!1,C(e,u,u,"hole",n,s);else{O(e,n);continue}e.ip++,e.consumed++;break}}else if(r.type=="transform"){if(e.done){e.ph+=r.to;continue}for(;;){if(e.ip>=e.input.length){W(e),e.ph+=r.to;break}if(e.input.slice(e.ip,e.ip+r.to.length).join("")===r.to)e.ip+=r.to.length,e.consumed+=r.to.length;else if(e.input[e.ip]===r.from)e.ip++,e.consumed++;else{O(e);continue}e.diverged||e.lead++,C(e,r.to,r.to);break}}else if(r.type=="repeat"){if(e.done){for(let s=0;s<r.min;s++)k(r.children,e,t);continue}let n=0;for(;n<r.max;){if(e.ip>=e.input.length){if(n<r.min){W(e);for(let a=n;a<r.min;a++)k(r.children,e,t)}else q(e);break}if(!L(r.children,e.input[e.ip],e)){if(!r.greedy&&n>=r.min)break;O(e);continue}let s=e.ip;if(k(r.children,e,t),e.done){for(let a=n+1;a<r.min;a++)k(r.children,e,t);break}if(e.ip===s)break;n++}}else if(r.type=="optional"){if(e.done)continue;let n=i.slice(l+1),s=!1;for(;e.ip<e.input.length;){let a=e.input[e.ip];if(L(r.children,a,e,!0)){s=!0,k(r.children,e,t);break}if(L(n,a,e))break;O(e)}!s&&e.ip>=e.input.length&&q(e)}}}function ve(i,e){let t=i.numeral,l=String(e??""),r=t.sign&&l.includes("-"),n;if(t.decimal&&(l.includes(t.decimal)||l.includes("."))){let g=de=>de.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=l.replace(new RegExp(`[^0-9${g(t.decimal)}.]`,"g"),"").replace(t.decimal,"."),z=parseFloat(j);n=Number.isFinite(z)?String(Math.round(z*10**t.fraction)):""}else{let g=l.replace(/\D/g,"");n=g===""?"":g.replace(/^0+/,"")||"0"}if(!n){let g=t.prefix+U(i,0);if(t.fraction){g+=t.decimal;for(let j=1;j<=t.fraction;j++)g+=U(i,j)}return{stream:"",raw:"",formatted:"",tail:"",ph:g+t.suffix,ph_slots:[],complete:!1,consumed:0,lead:0,units:[],cells:[],groups:{},stop_fmt:g.length}}let s=t.fraction,a=n.padStart(s+1,"0"),c=(s?a.slice(0,-s):a).replace(/^0+(?=\d)/,""),h=s?a.slice(-s):"",u=c.length+h.length-n.length,f=(r?"-":"")+n,p="",m=[],d=0,o=0,_=g=>{p+=g},x=g=>{m.push({kind:"char",ordinal:null,stream_start:d,stream_end:d+1,fmt_start:p.length,fmt_end:p.length+1}),p+=g,d++};_(t.prefix),r&&x("-");for(let g=0;g<c.length;g++,o++)g&&(c.length-g)%3==0&&_(t.group),o>=u?x(c[g]):_(c[g]);if(s){_(t.decimal);for(let g=0;g<h.length;g++,o++)o>=u?x(h[g]):_(h[g])}let M=p.length;_(t.suffix);let y=(r?-1:1)*parseFloat(c+(s?"."+h:"")),b=(t.min==null||y>=t.min)&&(t.max==null||y<=t.max);return{stream:f,raw:f,formatted:p,tail:"",ph:"",ph_slots:[],complete:b,consumed:f.length,lead:0,units:m,cells:[],groups:{},stop_fmt:M}}function S(i,e,t){if(i.numeral)return ve(i,e);let l={input:E(i,e,t),ctx:t,ip:0,stream:"",raw:"",formatted:"",tail:"",ph:"",ph_slots:[],units:[],cells:[],groups:Object.fromEntries((i.names??[]).map(s=>[s,""])),local:{},consumed:0,lead:0,diverged:!1,ordinal:0,complete:!0,done:!1,stop_fmt:-1,rejected:[]};k(i.nodes,l,i),l.stop_fmt<0&&(l.stop_fmt=l.formatted.length),i.valid&&(l.complete=l.complete&&i.valid.test(l.raw));let r=i.seps??=se(i.nodes),n=l.rejected.map(({at:s,slot:a})=>({at:s,char:l.input[s],slot:a,reason:r.has(l.input[s])?"literal":"slot"}));for(let s=l.ip;s<l.input.length;s++)n.push({at:s,char:l.input[s],slot:null,reason:"full"});return{stream:l.stream,raw:l.raw,formatted:l.formatted,tail:l.tail,ph:l.ph,ph_slots:l.ph_slots,complete:l.complete,consumed:l.consumed,lead:l.lead,units:l.units,cells:l.cells,groups:l.groups,stop_fmt:l.stop_fmt,rejected:n}}function se(i,e=new Set){for(let t of i)t.type=="literal"&&!K.test(t.char)&&e.add(t.char),t.children&&se(t.children,e);return e}function G(i,e,t={}){let l=[];t={...t,stream:String(e??"")};for(let n of i)n.fn?l.push(...w(n.fn(t),n.base).map(s=>({...s,key:n.key??s.key}))):l.push(n);let r=null;for(let n of l){let s=S(n,e,t);(!r||ke(s,r.result))&&(r={result:s,def:n,mask_id:n.key})}return r}function ke(i,e){return i.consumed!=e.consumed?i.consumed>e.consumed:i.lead>e.lead}function A(i,e){return e=="always"?i.formatted+i.tail+i.ph:e===!1?i.formatted:i.formatted+i.tail}function ae(i,e){for(let t of i.units)if(t.kind!="literal"&&(e<=t.stream_start||e<t.stream_end))return t.fmt_start;return i.stop_fmt}function oe(i,e){let t=i.units.filter(l=>l.kind=="char");return t.length>e?t[e-1].stream_end:i.stream.length}var Ee=["edit","pad","align","min","max"];function fe(i,e){let t=[];i.slots.forEach((l,r)=>{let n=l.node.group??null,s=t.at(-1);if(!s||s.name!==n){let a=Object.fromEntries(Ee.map(c=>[c,e[c]]));n!=null&&Object.assign(a,e.groups?.[n]),t.push(s={name:n,first:r,fmts:[],digits:!0,opts:a})}s.fmts.push(l.fmt),s.last=r,s.digits&&=l.node.test.test("0")&&!l.node.test.test("a")});for(let l of t)[l.start,l.end]=[l.fmts[0],l.fmts.at(-1)+1];return t}function V(i,e){let t=i.fmts.length,l=[...e].slice(-t),r=Array(t-l.length).fill(i.opts.pad??null);return i.opts.align=="right"?[...r,...l]:[...l,...r]}function ue(i,e,t){let{max:l}=i.opts,r=i.digits&&l!=null;return e+=t,r&&+e>l&&(e=String(l)),{buffer:e,cells:V(i,e),advance:e.length>=i.fmts.length||r&&+e*10>l}}function R(i,e){let{min:t}=i.opts,l=i.fmts.length;return!i.digits||t==null||e.includes(null)||+e.join("")>=t?e:V(i,String(t).padStart(l,"0"))}function he(i,e,t){if(!i.digits)return null;let l=i.fmts.length,r=e.join(""),{min:n=null,max:s=null}=i.opts;n??=0,s??=10**l-1;let a=r===""?t>0?n:s:+r+t;return a>s?a=n:a<n&&(a=s),V(i,String(a).padStart(l,"0"))}function ce(i,e,t){return(i.length?i:[null]).every(l=>{let r={min:t.min,max:t.max,...l!=null&&t.groups?.[l]},n=e[l];return r.min==null&&r.max==null||!/^\d+$/.test(n??"")?!0:(r.min==null||+n>=r.min)&&(r.max==null||+n<=r.max)})}var Se=["before_init","on_init","before_char","before_slot","before_input","on_input","before_paste","on_paste","on_accept","on_complete","on_incomplete","on_mask_change","on_reject"],N=class i{static#E=["target","mask"];static#S=["text","search","tel","url","password"];static#A(e){let t=S(e,""),l=0;return t.slots=t.ph_slots,t.parts=t.slots.map((r,n)=>n&&r.fmt>t.slots[n-1].fmt+1?++l:l),t.template=A(t,"always"),t}static#j(e){if(!/^\s*[[{]/.test(e))return e;let t=l=>typeof l=="string"||Array.isArray(l)&&l.every(r=>typeof r=="string");try{let l=JSON.parse(e);if(Array.isArray(l)?t(l):l&&typeof l=="object"&&Object.values(l).every(t))return l}catch{}return e}#e={};#g={};#o=null;#t=new WeakMap;#l=[];#y=new AbortController;#_=new WeakMap;static find=T;get params(){return this.#e}get value(){return this.#l.map(e=>e.value)}clone(e){return new i({...this.#e,...this.#g,...e,parent:this})}constructor(e){e={target:"input[mask]",mask:null,numeral:null,filler:"_",placeholder:!0,edit:"free",pad:null,align:"left",min:null,max:null,groups:{},caret:!0,coerce_type:!0,max_raw:null,validate:null,validation_message:null,...Object.fromEntries(Se.map(t=>[t,()=>{}])),...e};for(let[t,l]of Object.entries(e))typeof l=="function"&&!i.#E.includes(t)?(this[t]=l.bind(this),this.#g[t]=l):this.#e[t]=l;this.before_init(this.#e),this.#e.numeral!=null?this.#o=w({numeral:this.#e.numeral},this.#n()):this.#e.mask!=null&&(this.#o=w(this.#e.mask,this.#n()));for(let t of v(this.#e.target))this.#x(t);this.on_init(this.#e)}raw(e=this.#d()){return this.#t.get(P(e))?.result?.raw??""}state(e=this.#d()){let t=P(e),l=this.#t.get(t);return l?.result?this.#c(t,l):null}set(e,t){arguments.length<2&&([e,t]=[this.#d(),e]);for(let l of v(e))if(this.#t.has(l)){let r=l.value;this.#i(l,String(t??""),{prefix:String(t??"")}),this.#f(l,r,"insertReplacementText")}}clear(e=this.#l){this.set(e,"")}destroy(){this.#y.abort();for(let e of this.#l){let{original:t}=this.#t.get(e)??{};t&&(e.type!=t.type&&(e.type=t.type),t.maxlength!=null&&e.setAttribute("maxlength",t.maxlength),e.style.removeProperty("caret-color"),t.caret[0]&&e.style.setProperty("caret-color",...t.caret)),this.#t.delete(e),D(e,this,["raw","state","set","clear","set_mask"])}this.#l=[]}refresh(){for(let e of this.#l.filter(t=>!t.isConnected))this.#_.get(e)?.abort(),this.#t.delete(e),D(e,this,["raw","state","set","clear","set_mask"]);if(this.#l=this.#l.filter(e=>e.isConnected),J(this.#e.target))for(let e of v(this.#e.target))T(e)||this.#x(e);return this}#d(){if(this.#l.length!=1)throw new Error(`Mask: \u043C\u0430\u0441\u043A\u0430 \u043F\u0440\u0438\u0432\u044F\u0437\u0430\u043D\u0430 \u043A ${this.#l.length} \u043F\u043E\u043B\u044F\u043C \u2014 \u0443\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u043E\u043B\u0435 \u044F\u0432\u043D\u043E`);return this.#l[0]}set_mask(e,t=null){let l=w(e,this.#n());t||(this.#o=l);for(let r of t?v(t):this.#l){let n=this.#t.get(r);if(!n)continue;n.defs=l,n.seg=null;let s=r.value;this.#i(r,n.stream,{}),this.#f(r,s,"insertReplacementText")}}#f(e,t,l,r=null){e.value!==t&&(this.#t.get(e).handled=!0,e.dispatchEvent(new InputEvent("input",{bubbles:!0,inputType:l,data:r})))}#n(){return{filler:this.#e.filler,groups:this.#e.groups,before_char:this.before_char,before_slot:this.before_slot}}#O(e){return e=="email"?w({filter:/[a-z0-9@._%+-]/i,valid:/^[^@\s]+@[^@\s]+\.[^@\s]{2,}$/},this.#n()):e=="number"?w({numeral:{}},this.#n()):null}#x(e){if(T(e))throw new Error("\u041C\u0430\u0441\u043A\u0430 \u0443\u0436\u0435 \u043F\u0440\u0438\u0432\u044F\u0437\u0430\u043D\u0430 \u043A \u044D\u0442\u043E\u043C\u0443 \u043F\u043E\u043B\u044E");Q(e,this);let t=Z(this.#y.signal),l=t.signal;this.#_.set(e,t);let r={type:e.type,maxlength:e.getAttribute("maxlength"),caret:[e.style.getPropertyValue("caret-color"),e.style.getPropertyPriority("caret-color")]},n=null;this.#e.coerce_type!==!1&&(e.type=="number"||e.type=="email")&&(n=e.type,e.inputMode=n=="number"?"numeric":"email",e.type="text"),i.#S.includes(e.type)||console.warn(`Mask: \u043F\u043E\u043B\u0435 type="${e.type}" \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043A\u0430\u0440\u0435\u0442\u043A\u043E\u0439 \u2014 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 type="text" \u0438\u043B\u0438 "tel"`,e);let s=e.getAttribute("maxlength");s!=null&&e.removeAttribute("maxlength");let a=this.#e.max_raw??(s!=null?+s:null),c=e.getAttribute("mask"),h=this.#o??(c?w(i.#j(c),this.#n()):this.#O(n));if(!h){console.warn("Mask: \u0434\u043B\u044F \u043F\u043E\u043B\u044F \u043D\u0435 \u0437\u0430\u0434\u0430\u043D\u0430 \u043C\u0430\u0441\u043A\u0430 (\u043D\u0438 \u0432 params.mask, \u043D\u0438 \u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435 mask)",e);return}let u=n=="number"||this.#e.numeral!=null,f={defs:h,def:null,stream:"",result:null,mask_id:null,rendered:"",seg:null,composing:!1,handled:!1,coerced:n,max_raw:a,numeric:u,original:r};this.#t.set(e,f),this.#l.push(e),X(e,{raw:()=>this.raw(e),state:()=>this.state(e),set:o=>this.set(e,o),clear:()=>this.clear(e),set_mask:o=>this.set_mask(o,e)});let p=()=>this.#e.caret=="hide"&&e.style.setProperty("caret-color","transparent","important");p(),e.addEventListener("beforeinput",o=>this.#L(e,o),{signal:l});let m=[this.#e.edit,...Object.values(this.#e.groups??{}).map(o=>o?.edit)];if(m.includes("whole")&&(this.#e.placeholder!="always"||h.length>1||h.some(o=>!o.fixed&&!o.fn))&&console.warn("Mask: edit: 'whole' \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u0441 \u043E\u0434\u043D\u043E\u0439 \u0444\u0438\u043A\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u043E\u0439 \u043C\u0430\u0441\u043A\u043E\u0439 \u0438 placeholder: 'always' - \u0438\u043D\u0430\u0447\u0435 \u0432\u0435\u0434\u0451\u0442 \u0441\u0435\u0431\u044F \u043A\u0430\u043A 'end'",e),m.some(o=>o&&o!="free")){let o=_=>this.#R(e,_.type=="click");for(let _ of["selectionchange","click","keyup","select"])e.addEventListener(_,o,{signal:l});e.addEventListener("keydown",_=>this.#C(e,_),{signal:l})}let d=()=>{if(f.handled){f.handled=!1;return}f.composing||this.#p(e)};e.addEventListener("input",d,{signal:l}),e.addEventListener("change",d,{signal:l}),e.addEventListener("compositionstart",()=>f.composing=!0,{signal:l}),e.addEventListener("compositionend",()=>{f.composing=!1,this.#p(e)},{signal:l}),e.addEventListener("focus",o=>{p(),this.#i(e,f.stream,{prefix:f.stream,silent:!0}),this.#I(e,o.relatedTarget)},{signal:l}),e.addEventListener("blur",()=>{this.#m(e),f.seg=null,this.#i(e,f.stream,{silent:!0})},{signal:l}),e.closest("form")?.addEventListener("reset",()=>queueMicrotask(()=>this.#p(e)),{signal:l}),this.#i(e,e.value,{silent:!0})}#L(e,t){let l=this.#t.get(e),r=t.inputType??"insertText";if(t.isComposing||r=="insertCompositionText"||r=="deleteCompositionText"){l.composing=!0;return}if(r=="historyUndo"||r=="historyRedo")return;let n=e.selectionStart??0,s=e.selectionEnd??n,{g:a,edit:c}=this.#a(l,n,s);c=="end"&&l.result&&!(n==0&&s==e.value.length)&&!(a&&n==a.start&&s==a.end)&&(n=s=this.#v(e,l,a)),t.preventDefault();let h=r.startsWith("delete"),u="",f=[];if(!h){if(r=="insertLineBreak"||r=="insertParagraph")return;if(u=t.data??t.dataTransfer?.getData("text/plain")??"",r=="insertFromPaste"){let m=this.before_paste(e,u);if(m===!1)return;typeof m=="string"&&(u=m)}if(l.numeric){let m=l.defs.some(o=>o.numeral?.sign),d="";for(let o of u)o>="0"&&o<="9"||m&&o=="-"?d+=o:f.push({char:o,slot:null,reason:"slot"});u=d}}if(this.before_input(e,{type:r,insert:u,start:n,end:s})===!1)return;let p=e.value;c=="whole"?f.push(...this.#T(e,r,h?"":u)):this.#r(l)?f.push(...this.#P(e,r,n,s,h?"":u)):f.push(...this.#$(e,n,s,h?"":u,r)),r=="insertFromPaste"&&this.on_paste(e,this.#c(e,l));for(let m of f)this.on_reject(e,{...m,type:r});t.defaultPrevented&&this.#f(e,p,r,u||null)}#M(e,{def:t,full:l,cut:r},n,s){let a={input:e},c=E(t,n,a).length,h=E(t,s,a),u=c+h.length,f=(l.rejected??[]).filter(p=>p.at>=c&&p.at<u);if(r!=null){let p=Math.max(0,r-S(t,n,a).stream.length),m=h.map((d,o)=>c+o).filter(d=>!f.some(o=>o.at==d));for(let d of m.slice(p))f.push({at:d,char:h[d-c],slot:null,reason:"full"});f.sort((d,o)=>d.at-o.at)}return f.map(({char:p,slot:m,reason:d})=>({char:p,slot:m,reason:d}))}#$(e,t,l,r,n){let s=this.#t.get(e),a=s.result?.units??[],c,h,u;if(t!=l){let d=a.filter(o=>o.fmt_start<l&&o.fmt_end>t);c=d.length?d[0].stream_start:this.#k(a,t),h=d.length?d.at(-1).stream_end:c}else if(!n.startsWith("delete"))c=h=this.#k(a,t);else{if(n.includes("Forward"))u=a.find(d=>d.fmt_end>t&&d.kind!="literal")??a.find(d=>d.fmt_end>t);else{let d;for(let o of a)o.fmt_start<t&&(o.kind=="literal"?d=o:u=o);u??=d}if(!u)return[];c=u.stream_start,h=u.stream_end}let f=s.stream.slice(0,c),p=f+r,m=this.#i(e,p+s.stream.slice(h),{prefix:p});return r&&m?this.#M(e,m,f,r):[]}#P(e,t,l,r,n){let s=this.#t.get(e),a=s.def,c=this.#r(s),{slots:h,parts:u}=c,f=h.length,p=this.#u(s,c),m=y=>{let b=h.findIndex(g=>g.fmt>=y);return b<0?f:b},d=y=>c.template.slice(h[y-1].fmt+1,h[y].fmt),o;if(l!=r){o=m(l);for(let y=o;y<f&&h[y].fmt<r;y++)p[y]=null}else if(!n&&t.startsWith("delete")){if(t.includes("Forward")){for(o=m(l);o<f&&p[o]==null;)o++;if(o>=f)return[]}else{o=-1;for(let y=0;y<f;y++)h[y].fmt<l&&(o=y);for(;o>=0&&p[o]==null;)o--;if(o<0)return[]}p[o]=null}else o=m(l),o>=f&&(o=p.indexOf(null))<0&&(o=f);let _=[];for(let y of E(a,n,{input:e})){if(o>=f){_.push({char:y,slot:null,reason:"full"});continue}if(!h[o].node.test.test(y)){let b=u.lastIndexOf(u[o]);b+1<f&&d(b+1).includes(y)?o=b+1:_.push(i.#w(a,y,o));continue}p[o++]=y}let x=this.#h(c,p),M=Math.min(S(a,x.slice(0,o),{input:e}).stream.length,f);return this.#i(e,x,{caret_fmt:M<f?h[M].fmt:h[f-1].fmt+1}),_}static#w(e,t,l){return{char:t,slot:l,reason:e.seps?.has(t)?"literal":"slot"}}#T(e,t,l){let r=this.#t.get(e),n=this.#r(r),s=n.spans,a=this.#b(e,r),c=this.#u(r,n),h=m=>c.slice(m.first,m.last+1),u=(m,d)=>c.splice(m.first,d.length,...d),f=s[a.gi],p=[];if(t.startsWith("delete")){if(h(f).every(m=>m==null))return t.includes("Backward")&&a.gi>0&&this.#s(e,a.gi-1),[];u(f,h(f).fill(null)),a.buffer=""}else{t=="insertFromPaste"&&(a.buffer="");for(let m of E(r.def,l,{input:e})){f=s[a.gi];let d=s[a.gi+1];if(d&&n.template.slice(f.end,d.start).includes(m)){a.buffer&&(u(f,R(f,h(f))),a.gi++,a.buffer="");continue}let o=f.first+Math.min(a.buffer.length,f.fmts.length-1);if(!n.slots[o].node.test.test(m)){p.push(i.#w(r.def,m,o));continue}let _=ue(f,a.buffer,m);u(f,_.cells),a.buffer=_.buffer,_.advance&&(u(f,R(f,h(f))),a.buffer="",d&&a.gi++)}}return this.#i(e,this.#h(n,c),{}),this.#s(e,a.gi,!1),p}#C(e,t){let l=this.#t.get(e);if(t.altKey||t.ctrlKey||t.metaKey||!l?.result)return;let{g:r,edit:n}=this.#a(l,e.selectionStart??0,e.selectionEnd??0);if(n!="whole")return;let s=this.#r(l).spans,a=s.length-1,c=this.#b(e,l).gi,h;switch(t.key){case"ArrowLeft":h=c-1;break;case"ArrowRight":h=c+1;break;case"Home":h=0;break;case"End":h=a;break;case"Tab":if(h=c+(t.shiftKey?-1:1),h<0||h>a)return;break;case"ArrowUp":case"ArrowDown":{t.preventDefault();let u=this.#r(l),f=this.#u(l,u),p=he(s[c],f.slice(s[c].first,s[c].last+1),t.key=="ArrowUp"?1:-1);if(!p)return;f.splice(s[c].first,p.length,...p);let m=e.value;this.#i(e,this.#h(u,f),{}),this.#s(e,c),this.#f(e,m,"insertReplacementText");return}default:return}t.preventDefault(),this.#s(e,Math.max(0,Math.min(h,a)))}#s(e,t,l=!0){let r=this.#t.get(e);r.seg&&r.seg.gi!==t&&this.#m(e),(l||r.seg?.gi!==t)&&(r.seg={gi:t,buffer:""});let n=this.#r(r).spans[t];document.activeElement===e&&e.setSelectionRange(n.start,n.end)}#b(e,t){let{g:l}=this.#a(t,e.selectionStart??0,e.selectionEnd??0),r=this.#r(t).spans.indexOf(l);return t.seg?.gi!==r&&(this.#m(e),t.seg={gi:r,buffer:""}),t.seg}#m(e){let t=this.#t.get(e),l=this.#r(t);if(!t.seg?.buffer||!l)return;let r=l.spans[t.seg.gi],n=this.#u(t,l),s=n.slice(r.first,r.last+1),a=R(r,s);t.seg.buffer="",a!==s&&(n.splice(r.first,a.length,...a),this.#i(e,this.#h(l,n),{}))}#I(e,t){let l=this.#t.get(e),r=this.#r(l);if(!r||this.#a(l,0).edit!="whole")return;let n=t&&e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING;this.#s(e,n?r.spans.length-1:0)}#R(e,t=!1){let l=this.#t.get(e);if(document.activeElement!==e||!l?.result)return;let r=e.selectionStart,n=e.selectionEnd;if(r==null)return;let{g:s,edit:a}=this.#a(l,r,n);if(a=="whole"){let h=this.#r(l).spans.indexOf(s);return!t&&l.seg?.gi===h&&r==s.start&&n==s.end?void 0:this.#s(e,h,t||l.seg?.gi!==h)}if(a!="end")return;if(r!==n){let[h,u]=s?[s.start,s.end]:[0,e.value.length];(r!=0||n!=e.value.length)&&(r!=h||n!=u)&&e.setSelectionRange(h,u);return}if(r===l.caret)return;let c=this.#v(e,l,s);r!==c&&e.setSelectionRange(c,c),l.caret=c}#v(e,t,l){if(l){let r=this.#r(t).slots;for(let n=l.first;n<r.length;n++)if(t.result.cells?.[n]==null)return r[n].fmt;return r.at(-1).fmt+1}return Math.min(t.result.stop_fmt,e.value.length)}#r(e){let t=e.def;if(this.#e.placeholder!="always"||e.defs.length>1||!t?.fixed)return null;let l=t.layout??=i.#A(t);return l.spans??=fe(l,this.#e),l}#a(e,t,l=t){let r=this.#r(e)?.spans??[],n=r.find(a=>t!=l&&a.start==t&&a.end==l)??r.find(a=>t<=a.end)??r.at(-1)??null,s=n?n.opts.edit:this.#e.edit;return{g:n,edit:s=="whole"&&!n?"end":s}}#u(e,t){return t.slots.map((l,r)=>e.result?.cells?.[r]??null)}#h(e,t){let l=t.reduce((r,n,s)=>n!=null?s:r,-1);return t.slice(0,l+1).map((r,n)=>r??e.slots[n].fill).join("")}#k(e,t){let l=0;for(let r of e)(r.fmt_end<=t||r.fmt_start<t)&&(l=r.stream_end);return l}#p(e){let t=this.#t.get(e);if(e.value===t.rendered)return;t.seg=null;let l=e.selectionStart??e.value.length;this.#i(e,e.value,{prefix:e.value.slice(0,l)})}#i(e,t,{prefix:l=null,caret_fmt:r=null,silent:n=!1}={}){let s=this.#t.get(e),a=this.#N(s),c={raw:s.result?.raw??"",value:e.value,input:e,holes:a},h=G(s.defs,t,c);if(!h)return null;let{result:u,def:f,mask_id:p}=h,m={def:f,full:u,cut:null};s.max_raw!=null&&u.raw.length>s.max_raw&&(m.cut=oe(u,s.max_raw),h=G(s.defs,u.stream.slice(0,m.cut),c),{result:u,def:f,mask_id:p}=h),!f.numeral&&!ce(f.names,{...u.groups,null:u.raw},this.#e)&&(u.complete=!1);let d=this.#F(e,u);e.value!==d&&(e.value=d),s.rendered=d,r==null&&l!=null&&document.activeElement===e&&(r=ae(u,S(f,l,{input:e,holes:a}).stream.length)),r!=null&&document.activeElement===e&&(r=Math.min(r,d.length),e.setSelectionRange(r,r),s.caret=r);let o=s.result,_=s.mask_id;if(s.result=u,s.stream=u.stream,s.def=f,s.mask_id=p,e.setAttribute("mask_id",p),e.setAttribute("progress",u.raw.length),e.setAttribute("is_complete",u.complete),this.#D(s)&&e.setCustomValidity&&e.setCustomValidity(!u.stream||u.complete?"":this.#W(e,s)),n)return m;let x=this.#c(e,s);return this.on_input(e,x),u.raw!==(o?.raw??"")&&this.on_accept(e,x),u.complete&&!o?.complete&&this.on_complete(e,x),!u.complete&&o?.complete&&this.on_incomplete(e,x),o&&p!==_&&this.on_mask_change(e,x),m}#N(e){let[t]=e.defs;return this.#e.placeholder=="always"&&e.defs.length==1&&!!(t.fixed||t.fn)}#F(e,t){let{placeholder:l}=this.#e;return t.stream?A(t,l):document.activeElement!==e?"":l=="always"?A(t,"always"):l==!1||l=="typed"?"":A(t,!0)}#c(e,t){return{raw:t.result?.raw??"",formatted:e.value,complete:t.result?.complete??!1,mask_id:t.mask_id,progress:t.result?.raw.length??0,groups:{...t.result?.groups},empty:!t.stream,skeleton:t.result?A(t.result,"always"):""}}#D(e){let t=this.#e.validate;return t===!0||t==null&&e.coerced!=null}#W(e,t){let l=typeof this.validation_message=="function"?this.validation_message:this.#e.validation_message??t.def?.message;return typeof l=="function"?l(e,this.#c(e,t))||"":typeof l=="string"?l:t.coerced=="email"?"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0430\u0434\u0440\u0435\u0441 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0447\u0442\u044B":t.coerced=="number"||t.def?.numeral?"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043B\u043E \u0432 \u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u043E\u043C \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D\u0435":"\u0417\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u043F\u043E\u043B\u0435 \u043F\u043E\u043B\u043D\u043E\u0441\u0442\u044C\u044E"}};return xe(Ae);})();
|
|
2
2
|
if(typeof Mask!=="undefined"&&Mask&&Mask.default)globalThis.Mask=Mask.default;
|