@foxford/foxford-js-sdk
Advanced tools
Comparing version 3.2.9 to 3.2.10-beta-7af8adc-20241031
{ | ||
"name": "@foxford/foxford-js-sdk", | ||
"version": "3.2.9", | ||
"version": "3.2.10-beta-7af8adc-20241031", | ||
"description": "Foxford sdk for external projects", | ||
@@ -68,1 +68,2 @@ "homepage": "https://github.com/foxford/foxford-js-sdk", | ||
} | ||
@@ -1,2 +0,2 @@ | ||
'use strict';var or=typeof globalThis!='undefined'?globalThis:typeof window!='undefined'?window:typeof global!='undefined'?global:typeof self!='undefined'?self:{};function ir(e){return e&&e.__esModule&&{}.hasOwnProperty.call(e,'default')?e.default:e}var sr=ir((()=>{function e(e,t,r,a,n){return e<t||r<t?e>r?r+1:e+1:a===n?t:t+1}return(t,r)=>{if(t===r)return 0;if(t.length>r.length){var a=t;t=r,r=a}var n=t.length;var o=r.length;for(;n>0&&t.charCodeAt(n-1)===r.charCodeAt(o-1);)n--,o--;var i=0;for(;i<n&&t.charCodeAt(i)===r.charCodeAt(i);)i++;if(o-=i,(n-=i)==0||o<3)return o;var s=0;var l;var u;var v;var c;var h;var p;var d;var y;var f;var g;var b;var m;var _=[];for(l=0;l<n;l++)_.push(l+1),_.push(t.charCodeAt(i+l));var S=_.length-1;for(;s<o-3;)for(f=r.charCodeAt(i+(u=s)),g=r.charCodeAt(i+(v=s+1)),b=r.charCodeAt(i+(c=s+2)),m=r.charCodeAt(i+(h=s+3)),p=s+=4,l=0;l<S;l+=2)u=e(d=_[l],u,v,f,y=_[l+1]),v=e(u,v,c,g,y),c=e(v,c,h,b,y),p=e(c,h,p,m,y),_[l]=p,h=c,c=v,v=u,u=d;for(;s<o;)for(f=r.charCodeAt(i+(u=s)),p=++s,l=0;l<S;l+=2)_[l]=p=e(d=_[l],u,p,f,_[l+1]),u=d;return p}})());var lr=(e,t)=>e===t||e!=e&&t!=t;var ur=lr;var vr=(e,t)=>{var r=e.length;for(;r--;)if(ur(e[r][0],t))return r;return-1};var cr=vr;var hr=[].splice;var pr=vr;var dr=vr;var yr=vr;function fr(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}fr.prototype.clear=function(){this.__data__=[],this.size=0},fr.prototype.delete=function(e){var t=this.__data__,r=cr(t,e);return!(r<0||(r==t.length-1?t.pop():hr.call(t,r,1),--this.size,0))},fr.prototype.get=function(e){var t=this.__data__,r=pr(t,e);return r<0?void 0:t[r][1]},fr.prototype.has=function(e){return dr(this.__data__,e)>-1},fr.prototype.set=function(e,t){var r=this.__data__,a=yr(r,e);return a<0?(++this.size,r.push([e,t])):r[a][1]=t,this};var gr=fr;var br=gr;var mr=typeof or=='object'&&or&&or.Object===Object&∨var _r=typeof self=='object'&&self&&self.Object===Object&&self;var Sr=mr||_r||Function("","return this")();var Or=Sr.Symbol;var Er=Object.prototype;var wr=Er.hasOwnProperty;var jr=Er.toString;var Ar=Or?Or.toStringTag:void 0;var Cr={}.toString;var xr=Or?Or.toStringTag:void 0;var Vr=e=>e==null?e===void 0?"[object Undefined]":"[object Null]":xr&&xr in Object(e)?(e=>{var t=wr.call(e,Ar),r=e[Ar];try{e[Ar]=void 0;var a=!0}catch(e){}var n=jr.call(e);return a&&(t?e[Ar]=r:delete e[Ar]),n})(e):(e=>Cr.call(e))(e);var Pr=e=>{var t=typeof e;return e!=null&&(t=='object'||t=='function')};var Tr=Vr,Lr=Pr;var zr=e=>{if(!Lr(e))return!1;var t=Tr(e);return t=="[object Function]"||t=="[object GeneratorFunction]"||t=="[object AsyncFunction]"||t=="[object Proxy]"};var kr=Sr['__core-js_shared__'];var Rr=(Fr=/[^.]+$/.exec(kr&&kr.keys&&kr.keys.IE_PROTO||''))?'Symbol(src)_1.'+Fr:'';var Fr;var Dr=(()=>{}).toString;var Hr=zr,Wr=Pr;var Br=/^\[object .+?Constructor\]$/;var Ir=RegExp('^'+(()=>{}).toString.call({}.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,'\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,'$1.*?')+'$');var Mr=(e,t)=>{var r=((e,t)=>e==null?void 0:e[t])(e,t);return(e=>{return!(!Wr(e)||(t=e,Rr&&Rr in t))&&(Hr(e)?Ir:Br).test((e=>{if(e!=null){try{return Dr.call(e)}catch(e){}try{return e+''}catch(e){}}return''})(e));var t})(r)?r:void 0};var Nr=Mr(Sr,'Map');var Ur=Mr(Object,'create');var $r=Ur;var Kr=Ur;var Gr={}.hasOwnProperty;var qr=Ur;var Jr={}.hasOwnProperty;var Qr=Ur;function Xr(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}Xr.prototype.clear=function(){this.__data__=$r?$r(null):{},this.size=0},Xr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Xr.prototype.get=function(e){var t=this.__data__;if(Kr){var r=t[e];return r==="__lodash_hash_undefined__"?void 0:r}return Gr.call(t,e)?t[e]:void 0},Xr.prototype.has=function(e){var t=this.__data__;return qr?t[e]!==void 0:Jr.call(t,e)},Xr.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Qr&&t===void 0?"__lodash_hash_undefined__":t,this};var Yr=Xr,Zr=gr,ea=Nr;var ta=(e,t)=>{var r=e.__data__;return((n=typeof(a=t))=='string'||n=='number'||n=='symbol'||n=='boolean'?a!=='__proto__':a===null)?r[typeof t=='string'?'string':'hash']:r.map;var a,n};var ra=ta;var aa=ta;var na=ta;var oa=ta;function ia(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}ia.prototype.clear=function(){this.size=0,this.__data__={hash:new Yr,map:new(ea||Zr),string:new Yr}},ia.prototype.delete=function(e){var t=ra(this,e).delete(e);return this.size-=t?1:0,t},ia.prototype.get=function(e){return aa(this,e).get(e)},ia.prototype.has=function(e){return na(this,e).has(e)},ia.prototype.set=function(e,t){var r=oa(this,e),a=r.size;return r.set(e,t),this.size+=r.size==a?0:1,this};var sa=gr,la=Nr,ua=ia;var va=gr;function ca(e){var t=this.__data__=new va(e);this.size=t.size}ca.prototype.clear=function(){this.__data__=new br,this.size=0},ca.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},ca.prototype.get=function(e){return this.__data__.get(e)},ca.prototype.has=function(e){return this.__data__.has(e)},ca.prototype.set=function(e,t){var r=this.__data__;if(r instanceof sa){var a=r.__data__;if(!la||a.length<199)return a.push([e,t]),this.size=++r.size,this;r=this.__data__=new ua(a)}return r.set(e,t),this.size=r.size,this};var ha=ca;var pa=Mr;var da=(()=>{try{var e=pa(Object,'defineProperty');return e({},'',{}),e}catch(e){}})();var ya=da;var fa=(e,t,r)=>{t=='__proto__'&&ya?ya(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r};var ga=fa,ba=lr;var ma=(e,t,r)=>{(r!==void 0&&!ba(e[t],r)||r===void 0&&!(t in e))&&ga(e,t,r)};var _a={exports:{}};((e,exports)=>{var t=exports&&!exports.nodeType&&exports;var r=t&&_a&&!_a.nodeType&&_a;var a=r&&r.exports===t?Sr.Buffer:void 0,n=a?a.allocUnsafe:void 0;_a.exports=(e,t)=>{if(t)return e.slice();var r=e.length,a=n?n(r):new e.constructor(r);return e.copy(a),a}})(0,_a.exports);var Sa=_a.exports;var Oa=Sr.Uint8Array;var Ea=Pr;var wa=Object.create;var ja=(()=>{function e(){}return t=>{if(!Ea(t))return{};if(wa)return wa(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();var Aa=(Ca=Object.getPrototypeOf,xa=Object,e=>Ca(xa(e)));var Ca,xa;var Va=Object.prototype;var Pa=e=>{var t=e&&e.constructor;return e===(typeof t=='function'&&t.prototype||Va)};var Ta=ja,La=Aa,za=Pa;var ka=e=>e!=null&&typeof e=='object';var Ra=Vr,Fa=ka;var Da=e=>Fa(e)&&Ra(e)=="[object Arguments]",Ha=ka;var Wa=Object.prototype;var Ba=Wa.hasOwnProperty;var Ia=Wa.propertyIsEnumerable;var Ma=Da(function(){return arguments}())?Da:e=>Ha(e)&&Ba.call(e,'callee')&&!Ia.call(e,'callee');var Na=Array.isArray;var Ua=e=>typeof e=='number'&&e>-1&&e%1==0&&e<=9007199254740991;var $a=zr,Ka=Ua;var Ga=e=>e!=null&&Ka(e.length)&&!$a(e);var qa=Ga,Ja=ka;var Qa={exports:{}};var Xa=()=>!1;((e,exports)=>{var t=exports&&!exports.nodeType&&exports;var r=t&&Qa&&!Qa.nodeType&&Qa;var a=r&&r.exports===t?Sr.Buffer:void 0;Qa.exports=(a?a.isBuffer:void 0)||Xa})(0,Qa.exports);var Ya=Qa.exports;var Za=Vr,en=Aa,tn=ka;var rn=(()=>{}).toString;var an={}.hasOwnProperty;var nn=rn.call(Object);var on=Vr,sn=Ua,ln=ka;var un={};un['[object Float32Array]']=un['[object Float64Array]']=un['[object Int8Array]']=un['[object Int16Array]']=un['[object Int32Array]']=un['[object Uint8Array]']=un['[object Uint8ClampedArray]']=un['[object Uint16Array]']=un['[object Uint32Array]']=!0,un['[object Arguments]']=un['[object Array]']=un['[object ArrayBuffer]']=un['[object Boolean]']=un['[object DataView]']=un['[object Date]']=un['[object Error]']=un['[object Function]']=un['[object Map]']=un['[object Number]']=un['[object Object]']=un['[object RegExp]']=un['[object Set]']=un['[object String]']=un['[object WeakMap]']=!1;var vn={exports:{}};((e,exports)=>{var t=exports&&!exports.nodeType&&exports;var r=t&&e&&!e.nodeType&&e;var a=r&&r.exports===t&&mr.process;var n=(()=>{try{return r&&r.require&&r.require('util').types||a&&a.binding&&a.binding('util')}catch(e){}})();e.exports=n})(vn,vn.exports);var cn=vn.exports;var hn=cn&&cn.isTypedArray;var pn=hn?(e=>t=>e(t))(hn):e=>ln(e)&&sn(e.length)&&!!un[on(e)];var dn=(e,t)=>{if((t!=='constructor'||typeof e[t]!='function')&&t!='__proto__')return e[t]};var yn=fa,fn=lr;var gn={}.hasOwnProperty;var bn=(e,t,r)=>{var a=e[t];gn.call(e,t)&&fn(a,r)&&(r!==void 0||t in e)||yn(e,t,r)},mn=fa;var _n=/^(?:0|[1-9]\d*)$/;var Sn=(e,t)=>{var r=typeof e;return!!(t=t==null?9007199254740991:t)&&(r=='number'||r!='symbol'&&_n.test(e))&&e>-1&&e%1==0&&e<t};var On=Ma,En=Na,wn=Ya,jn=Sn,An=pn;var Cn=Pr,xn=Pa;var Vn={}.hasOwnProperty;var Pn=Ga;var Tn=e=>Pn(e)?(e=>{var t=En(e),r=!t&&On(e),a=!t&&!r&&wn(e),n=!t&&!r&&!a&&An(e),o=t||r||a||n,i=o?((e,t)=>{var r=-1,a=Array(e);for(;++r<e;)a[r]=t(r);return a})(e.length,String):[],s=i.length;for(var l in e)o&&(l=='length'||a&&(l=='offset'||l=='parent')||n&&(l=='buffer'||l=='byteLength'||l=='byteOffset')||jn(l,s))||i.push(l);return i})(e):(e=>{if(!Cn(e))return(e=>{var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t})(e);var t=xn(e),r=[];for(var a in e)(a!='constructor'||!t&&Vn.call(e,a))&&r.push(a);return r})(e);var Ln=Tn;var zn=ma,kn=Sa,Rn=Ma,Fn=Na,Dn=Ya,Hn=zr,Wn=Pr,Bn=pn,In=dn;var Mn=ha,Nn=ma,Un=Pr,$n=Tn,Kn=dn;var Gn=e=>e;var qn=Math.max;var Jn=da;var Qn=Date.now;var Xn=(e=>{var t=0,r=0;return function(a){var n=Qn(),o=16-(n-r);if(r=n,o>0){if(++t>=800)return a}else t=0;return e.apply(void 0,arguments)}})(Jn?(e,t)=>{return Jn(e,'toString',{configurable:!0,enumerable:!1,value:(r=t,()=>r),writable:!0});var r}:Gn);var Yn=Gn,Zn=Xn;var eo=lr,to=Ga,ro=Sn,ao=Pr;var no=function e(t,r,a,n,o){t!==r&&((e,t,r)=>{var a=-1,n=Object(e),o=r(e),i=o.length;for(;i--;){var s=o[++a];if(t(n[s],s)===!1)break}})(r,((i,s)=>{if(o||(o=new Mn),Un(i))((e,t,r,a,n,o,i)=>{var s=In(e,r),l=In(t,r),u=i.get(l);if(u)zn(e,r,u);else{var v=o?o(s,l,r+'',e,t,i):void 0;var c=v===void 0;if(c){var h=Fn(l),p=!h&&Dn(l),d=!h&&!p&&Bn(l);v=l,h||p||d?Fn(s)?v=s:(e=>Ja(e)&&qa(e))(s)?v=((e,t)=>{var r=-1,a=e.length;for(t||(t=Array(a));++r<a;)t[r]=e[r];return t})(s):p?(c=!1,v=kn(l,!0)):d?(c=!1,g=new(f=(y=l).buffer).constructor(f.byteLength),new Oa(g).set(new Oa(f)),v=new y.constructor(g,y.byteOffset,y.length)):v=[]:(e=>{if(!tn(e)||Za(e)!="[object Object]")return!1;var t=en(e);if(t===null)return!0;var r=an.call(t,'constructor')&&t.constructor;return typeof r=='function'&&r instanceof r&&rn.call(r)==nn})(l)||Rn(l)?(v=s,Rn(s)?v=((e,t,r)=>{var a=!r;r||(r={});var n=-1,o=t.length;for(;++n<o;){var i=t[n];var s=void 0;s===void 0&&(s=e[i]),a?mn(r,i,s):bn(r,i,s)}return r})(b=s,Ln(b)):Wn(s)&&!Hn(s)||(v=(e=>typeof e.constructor!='function'||za(e)?{}:Ta(La(e)))(l))):c=!1}c&&(i.set(l,v),n(v,l,a,o,i),i.delete(l)),zn(e,r,v)}var y,f,g;var b})(t,r,s,a,e,n,o);else{var l=n?n(Kn(t,s),i,s+'',t,r,o):void 0;l===void 0&&(l=i),Nn(t,s,l)}}),$n)};var oo=ir((io=(e,t,r)=>{no(e,t,r)},(e=>Zn(function(e,t,r){return t=qn(t===void 0?e.length-1:t,0),function(){var a=arguments,n=-1,o=qn(a.length-t,0),i=Array(o);for(;++n<o;)i[n]=a[t+n];n=-1;var s=Array(t+1);for(;++n<t;)s[n]=a[n];return s[t]=r(i),((e,t,r)=>{switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)})(e,this,s)}}(e,void 0,Yn),e+''))(((e,t)=>{var r=-1,a=t.length,n=a>1?t[a-1]:void 0,o=a>2?t[2]:void 0;for((n=io.length>3&&typeof n=='function'?(a--,n):void 0,o&&((e,t,r)=>{if(!ao(r))return!1;var a=typeof t;return!!(a=='number'?to(r)&&ro(t,r.length):a=='string'&&t in r)&&eo(r[t],e)})(t[0],t[1],o)&&(n=a<3?void 0:n,a=1),e=Object(e));++r<a;){var i=t[r];i&&io(e,i,r)}return e}))));var io;var so={emailDomains:['gmail.com','gmail.ru','mail.ru','mail.com','my.foxford.ru','yandex.ru','ya.ru','yandex.com','yahoo.com','bk.ru','inbox.ru','rambler.ru','foxford.ru','outlook.com','hotmail.com'],suggestionClass:'emailAutoSugg',suggestionColor:'var(--silver, #b8b8b8)',suitableColor:'var(--silver, #b8b8b8)',suitableEmailColor:'var(--accent, #1A96F6)',suitableFontSize:'12px',suitableLineHeight:'1.7',suitableLevenshteinTreshold:5};var lo={TAB:'Tab',RIGHT_ARROW:'ArrowRight',DOWN_ARROW:'ArrowDown',ENTER:'Enter',BACKSPACE:'Backspace',DELETE:'Delete'};exports.EmailAutocomplete=function(){function e(t,r){var a=this;if(((e,t)=>{if(!(this instanceof t))throw new TypeError("Cannot call a class as a function")})(0,e),this.node=void 0,this.nodeRects=void 0,this.nodeStyle=void 0,this.options=so,this.containerValue=null,this.suggOverlay=null,this.value='',this.suggestion='',this.leftOffset=null,this.suitableExists=!1,this.suitableContainer=null,this.events={click:'eac.click',show:'eac.show'},this.bindListeners=()=>{a.suggOverlay&&a.suggOverlay.addEventListener('mousedown touchstart',a.onFocus),a.node.addEventListener('keyup',a.displaySuggestion),a.node.addEventListener('paste',a.onPaste),a.node.addEventListener('blur',a.autocomplete),a.node.addEventListener('keydown',a.onKeydown)},this.onFocus=()=>{a.node.focus()},this.onKeydown=e=>{if([lo.BACKSPACE,lo.DELETE].includes(e.code))a.hideSuitableEmail();else if([lo.DOWN_ARROW,lo.ENTER,lo.RIGHT_ARROW,lo.TAB].includes(e.code)&&(lo.TAB!==e.code||a.suggestion)){a.node.addEventListener('blur',a.autocomplete);var t=e.target;t instanceof HTMLElement&&t.blur()}},this.onPaste=e=>{if(!e.clipboardData)throw new Error('Not found clipboardData');var t=e.clipboardData.getData('text/plain');a.value=t,a.node.removeEventListener('blur',a.autocomplete);var r=a.findSuitableEmails(t);a.showSuitableEmail(r)},this.findSuitableEmails=e=>{var t=e.split('@');var r;if(t.length<=1)return[];r=t.pop()||'';var n=(a.options.emailDomains||[]).map((e=>({item:e,distance:sr(r,e)})));var o=a.options.suitableLevenshteinTreshold;return n.sort(((e,t)=>e.distance-t.distance)).filter((e=>e.distance<=o)).slice(0,3).map((e=>"".concat(t.join(''),"@").concat(e.item)))},this.showSuitableEmail=e=>{if(e.length!==0){a.suitableContainer&&a.hideSuitableEmail();var t=e[0];if(a.value!==t){var r=document.createTextNode('Возможно, вы имели в виду ');var n=document.createElement('span');var o=document.createElement('span');o.style.display='block',o.style.fontFamily=a.nodeStyle.getPropertyValue('font-family'),o.style.fontWeight=a.nodeStyle.getPropertyValue('font-weight'),o.style.letterSpacing=a.nodeStyle.getPropertyValue('letter-spacing'),o.style.color=a.options.suitableColor||'',o.style.fontSize=a.options.suitableFontSize||'',o.style.lineHeight=a.options.suitableLineHeight||'',n.style.fontFamily=a.nodeStyle.getPropertyValue('font-family'),n.style.fontWeight=a.nodeStyle.getPropertyValue('font-weight'),n.style.letterSpacing=a.nodeStyle.getPropertyValue('letter-spacing'),n.style.color=a.options.suitableEmailColor||'',n.style.fontSize=a.options.suitableFontSize||'',n.style.lineHeight=a.options.suitableLineHeight||'',n.style.cursor='pointer',n.textContent=t,o.append(r),o.append(n),a.suitableContainer=o,a.node.after(a.suitableContainer),n.addEventListener('click',a.onClickSuitableEmail,{once:!0}),a.suitableExists=!0,typeof a.options.onShowSuitableEmail=='function'&&a.options.onShowSuitableEmail()}}},this.hideSuitableEmail=()=>{a.suitableContainer&&(a.suitableContainer.remove(),a.suitableContainer=null),a.suggOverlay&&(a.suggOverlay.textContent=''),a.suitableExists=!1,typeof a.options.onHideSuitableEmail=='function'&&a.options.onHideSuitableEmail()},this.onClickSuitableEmail=e=>{e.preventDefault(),e.stopPropagation(),e.target instanceof HTMLSpanElement&&(a.changeValue(e.target.textContent||''),a.hideSuitableEmail(),a.node.addEventListener('blur',a.autocomplete),typeof a.options.onClickSuitableEmail=='function'&&a.options.onClickSuitableEmail())},this.autocomplete=e=>{if(e.stopPropagation(),a.suitableExists&&a.hideSuitableEmail(),a.suggestion===void 0||typeof a.suggestion=='string'&&a.suggestion.length<1){var t=a.findSuitableEmails(a.value||'');return a.showSuitableEmail(t),!1}var r="".concat(a.value||'').concat(a.suggestion||'');return a.clear(),a.changeValue(r),!0},this.changeValue=e=>{typeof a.options.onAutocomplete=='function'?a.options.onAutocomplete(e):a.node.value=e},this.displaySuggestion=e=>{if(a.value=a.node.value,a.suggestion=a.suggest(a.value),a.suggOverlay&&a.containerValue){if(a.suggestion.length?e.preventDefault():a.suggOverlay.textContent='',a.suggOverlay.textContent=a.suggestion,a.containerValue.textContent=a.value||'',a.leftOffset===null){var t=a.node.clientWidth;t-=parseFloat(a.nodeStyle.paddingLeft)+parseFloat(a.nodeStyle.paddingRight),a.leftOffset=(a.node.offsetWidth-t)/2}var r=a.containerValue.clientWidth;a.node.offsetWidth>r&&(a.suggOverlay.style.left="".concat(a.leftOffset+r,"px"))}},this.destroy=()=>{a.suggOverlay&&a.suggOverlay.removeEventListener('mousedown touchstart',a.onFocus),a.node.removeEventListener('keyup',a.displaySuggestion),a.node.removeEventListener('paste',a.onPaste),a.node.removeEventListener('blur',a.autocomplete),a.node.removeEventListener('keydown',a.onKeydown),a.suggOverlay=null,a.containerValue=null,a.suitableContainer=null},this.clear=()=>{a.suggOverlay instanceof HTMLSpanElement&&(a.suggOverlay.textContent=''),a.containerValue instanceof HTMLSpanElement&&(a.containerValue.textContent='')},!(t instanceof HTMLInputElement))throw new TypeError('Node must be html input element');this.node=t,this.nodeRects=this.node.getBoundingClientRect(),this.options=oo(this.options,r),this.suggOverlay=document.createElement('span'),this.containerValue=document.createElement('span'),this.suitableContainer=document.createElement('span'),this.nodeStyle=getComputedStyle(this.node)}var t;return(t=[{key:"apply",value:function(){if(this.node.eac===void 0||this.node.eac===null){this.node.eac=this;var e=this.node.parentElement;var t=0;if(e){var r=e.getBoundingClientRect();t=Math.abs(r.top-this.nodeRects.top)}this.containerValue=document.createElement('span'),this.containerValue.style.visibility='hidden',this.containerValue.style.position='absolute',this.containerValue.style.display='inline-block',this.containerValue.style.fontFamily=this.nodeStyle.getPropertyValue('font-family'),this.containerValue.style.fontWeight=this.nodeStyle.getPropertyValue('font-weight'),this.containerValue.style.fontSize=this.nodeStyle.getPropertyValue('font-size'),this.containerValue.style.letterSpacing=this.nodeStyle.getPropertyValue('letter-spacing');var a=(this.node.offsetHeight-this.node.clientHeight)/2;this.suggOverlay=document.createElement('span'),typeof this.options.suggestionClass=='string'&&this.suggOverlay.classList.add(this.options.suggestionClass),this.suggOverlay.style.display='flex',this.suggOverlay.style.alignItems='center',this.suggOverlay.style.position='absolute',this.suggOverlay.style.top="".concat(t,"px"),this.suggOverlay.style.left='0',this.suggOverlay.style.height="".concat(this.node.offsetHeight,"px"),this.suggOverlay.style.paddingTop="".concat(parseInt(this.nodeStyle.getPropertyValue('padding-top'),10)+a,"px"),this.suggOverlay.style.paddingBottom="".concat(parseInt(this.nodeStyle.getPropertyValue('padding-bottom'),10)+a,"px"),this.suggOverlay.style.lineHeight=this.nodeStyle.getPropertyValue('line-height'),this.suggOverlay.style.fontSize=this.nodeStyle.getPropertyValue('font-size'),this.suggOverlay.style.color=this.options.suggestionColor||'',this.containerValue.style.fontFamily=this.nodeStyle.getPropertyValue('font-family'),this.containerValue.style.fontWeight=this.nodeStyle.getPropertyValue('font-weight'),this.containerValue.style.fontSize=this.nodeStyle.getPropertyValue('font-size'),this.containerValue.style.letterSpacing=this.nodeStyle.getPropertyValue('letter-spacing'),this.node.after(this.containerValue),this.containerValue.after(this.suggOverlay),this.bindListeners()}}},{key:"suggest",value:function(e){var t=e.split('@');var r=e;return t.length>1&&(r=t.pop()||'').length?((this.options.emailDomains||[]).filter((e=>e.indexOf(r)===0)).shift()||'').replace(r,''):''}}])&&((e,t)=>{for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}})(e.prototype,t),e}(); | ||
'use strict';var or=typeof globalThis!='undefined'?globalThis:typeof window!='undefined'?window:typeof global!='undefined'?global:typeof self!='undefined'?self:{};function ir(e){return e&&e.__esModule&&{}.hasOwnProperty.call(e,'default')?e.default:e}var sr=ir((()=>{function e(e,t,r,a,n){return e<t||r<t?e>r?r+1:e+1:a===n?t:t+1}return(t,r)=>{if(t===r)return 0;if(t.length>r.length){var a=t;t=r,r=a}var n=t.length;var o=r.length;for(;n>0&&t.charCodeAt(n-1)===r.charCodeAt(o-1);)n--,o--;var i=0;for(;i<n&&t.charCodeAt(i)===r.charCodeAt(i);)i++;if(o-=i,(n-=i)==0||o<3)return o;var s=0;var l;var u;var c;var v;var h;var p;var d;var y;var f;var g;var b;var m;var _=[];for(l=0;l<n;l++)_.push(l+1),_.push(t.charCodeAt(i+l));var S=_.length-1;for(;s<o-3;)for(f=r.charCodeAt(i+(u=s)),g=r.charCodeAt(i+(c=s+1)),b=r.charCodeAt(i+(v=s+2)),m=r.charCodeAt(i+(h=s+3)),p=s+=4,l=0;l<S;l+=2)u=e(d=_[l],u,c,f,y=_[l+1]),c=e(u,c,v,g,y),v=e(c,v,h,b,y),p=e(v,h,p,m,y),_[l]=p,h=v,v=c,c=u,u=d;for(;s<o;)for(f=r.charCodeAt(i+(u=s)),p=++s,l=0;l<S;l+=2)_[l]=p=e(d=_[l],u,p,f,_[l+1]),u=d;return p}})());var lr=(e,t)=>e===t||e!=e&&t!=t;var ur=lr;var cr=(e,t)=>{var r=e.length;for(;r--;)if(ur(e[r][0],t))return r;return-1};var vr=cr;var hr=[].splice;var pr=cr;var dr=cr;var yr=cr;function fr(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}fr.prototype.clear=function(){this.__data__=[],this.size=0},fr.prototype.delete=function(e){var t=this.__data__,r=vr(t,e);return!(r<0||(r==t.length-1?t.pop():hr.call(t,r,1),--this.size,0))},fr.prototype.get=function(e){var t=this.__data__,r=pr(t,e);return r<0?void 0:t[r][1]},fr.prototype.has=function(e){return dr(this.__data__,e)>-1},fr.prototype.set=function(e,t){var r=this.__data__,a=yr(r,e);return a<0?(++this.size,r.push([e,t])):r[a][1]=t,this};var gr=fr;var br=gr;var mr=typeof or=='object'&&or&&or.Object===Object&∨var _r=typeof self=='object'&&self&&self.Object===Object&&self;var Sr=mr||_r||Function("","return this")();var Or=Sr.Symbol;var Er=Object.prototype;var wr=Er.hasOwnProperty;var jr=Er.toString;var xr=Or?Or.toStringTag:void 0;var Ar={}.toString;var Cr=Or?Or.toStringTag:void 0;var Vr=e=>e==null?e===void 0?"[object Undefined]":"[object Null]":Cr&&Cr in Object(e)?(e=>{var t=wr.call(e,xr),r=e[xr];try{e[xr]=void 0;var a=!0}catch(e){}var n=jr.call(e);return a&&(t?e[xr]=r:delete e[xr]),n})(e):(e=>Ar.call(e))(e);var Pr=e=>{var t=typeof e;return e!=null&&(t=='object'||t=='function')};var Tr=Vr,zr=Pr;var Lr=e=>{if(!zr(e))return!1;var t=Tr(e);return t=="[object Function]"||t=="[object GeneratorFunction]"||t=="[object AsyncFunction]"||t=="[object Proxy]"};var kr=Sr['__core-js_shared__'];var Rr=(Fr=/[^.]+$/.exec(kr&&kr.keys&&kr.keys.IE_PROTO||''))?'Symbol(src)_1.'+Fr:'';var Fr;var Dr=(()=>{}).toString;var Hr=Lr,Wr=Pr;var Br=/^\[object .+?Constructor\]$/;var Ir=RegExp('^'+(()=>{}).toString.call({}.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,'\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,'$1.*?')+'$');var Mr=(e,t)=>{var r=((e,t)=>e==null?void 0:e[t])(e,t);return(e=>{return!(!Wr(e)||(t=e,Rr&&Rr in t))&&(Hr(e)?Ir:Br).test((e=>{if(e!=null){try{return Dr.call(e)}catch(e){}try{return e+''}catch(e){}}return''})(e));var t})(r)?r:void 0};var Nr=Mr(Sr,'Map');var Ur=Mr(Object,'create');var $r=Ur;var Kr=Ur;var Gr={}.hasOwnProperty;var qr=Ur;var Jr={}.hasOwnProperty;var Qr=Ur;function Xr(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}Xr.prototype.clear=function(){this.__data__=$r?$r(null):{},this.size=0},Xr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Xr.prototype.get=function(e){var t=this.__data__;if(Kr){var r=t[e];return r==="__lodash_hash_undefined__"?void 0:r}return Gr.call(t,e)?t[e]:void 0},Xr.prototype.has=function(e){var t=this.__data__;return qr?t[e]!==void 0:Jr.call(t,e)},Xr.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Qr&&t===void 0?"__lodash_hash_undefined__":t,this};var Yr=Xr,Zr=gr,ea=Nr;var ta=(e,t)=>{var r=e.__data__;return((n=typeof(a=t))=='string'||n=='number'||n=='symbol'||n=='boolean'?a!=='__proto__':a===null)?r[typeof t=='string'?'string':'hash']:r.map;var a,n};var ra=ta;var aa=ta;var na=ta;var oa=ta;function ia(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}ia.prototype.clear=function(){this.size=0,this.__data__={hash:new Yr,map:new(ea||Zr),string:new Yr}},ia.prototype.delete=function(e){var t=ra(this,e).delete(e);return this.size-=t?1:0,t},ia.prototype.get=function(e){return aa(this,e).get(e)},ia.prototype.has=function(e){return na(this,e).has(e)},ia.prototype.set=function(e,t){var r=oa(this,e),a=r.size;return r.set(e,t),this.size+=r.size==a?0:1,this};var sa=gr,la=Nr,ua=ia;var ca=gr;function va(e){var t=this.__data__=new ca(e);this.size=t.size}va.prototype.clear=function(){this.__data__=new br,this.size=0},va.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},va.prototype.get=function(e){return this.__data__.get(e)},va.prototype.has=function(e){return this.__data__.has(e)},va.prototype.set=function(e,t){var r=this.__data__;if(r instanceof sa){var a=r.__data__;if(!la||a.length<199)return a.push([e,t]),this.size=++r.size,this;r=this.__data__=new ua(a)}return r.set(e,t),this.size=r.size,this};var ha=va;var pa=Mr;var da=(()=>{try{var e=pa(Object,'defineProperty');return e({},'',{}),e}catch(e){}})();var ya=da;var fa=(e,t,r)=>{t=='__proto__'&&ya?ya(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r};var ga=fa,ba=lr;var ma=(e,t,r)=>{(r!==void 0&&!ba(e[t],r)||r===void 0&&!(t in e))&&ga(e,t,r)};var _a={exports:{}};((e,exports)=>{var t=exports&&!exports.nodeType&&exports;var r=t&&_a&&!_a.nodeType&&_a;var a=r&&r.exports===t?Sr.Buffer:void 0,n=a?a.allocUnsafe:void 0;_a.exports=(e,t)=>{if(t)return e.slice();var r=e.length,a=n?n(r):new e.constructor(r);return e.copy(a),a}})(0,_a.exports);var Sa=_a.exports;var Oa=Sr.Uint8Array;var Ea=Pr;var wa=Object.create;var ja=(()=>{function e(){}return t=>{if(!Ea(t))return{};if(wa)return wa(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();var xa=(Aa=Object.getPrototypeOf,Ca=Object,e=>Aa(Ca(e)));var Aa,Ca;var Va=Object.prototype;var Pa=e=>{var t=e&&e.constructor;return e===(typeof t=='function'&&t.prototype||Va)};var Ta=ja,za=xa,La=Pa;var ka=e=>e!=null&&typeof e=='object';var Ra=Vr,Fa=ka;var Da=e=>Fa(e)&&Ra(e)=="[object Arguments]",Ha=ka;var Wa=Object.prototype;var Ba=Wa.hasOwnProperty;var Ia=Wa.propertyIsEnumerable;var Ma=Da(function(){return arguments}())?Da:e=>Ha(e)&&Ba.call(e,'callee')&&!Ia.call(e,'callee');var Na=Array.isArray;var Ua=e=>typeof e=='number'&&e>-1&&e%1==0&&e<=9007199254740991;var $a=Lr,Ka=Ua;var Ga=e=>e!=null&&Ka(e.length)&&!$a(e);var qa=Ga,Ja=ka;var Qa={exports:{}};var Xa=()=>!1;((e,exports)=>{var t=exports&&!exports.nodeType&&exports;var r=t&&Qa&&!Qa.nodeType&&Qa;var a=r&&r.exports===t?Sr.Buffer:void 0;Qa.exports=(a?a.isBuffer:void 0)||Xa})(0,Qa.exports);var Ya=Qa.exports;var Za=Vr,en=xa,tn=ka;var rn=(()=>{}).toString;var an={}.hasOwnProperty;var nn=rn.call(Object);var on=Vr,sn=Ua,ln=ka;var un={};un['[object Float32Array]']=un['[object Float64Array]']=un['[object Int8Array]']=un['[object Int16Array]']=un['[object Int32Array]']=un['[object Uint8Array]']=un['[object Uint8ClampedArray]']=un['[object Uint16Array]']=un['[object Uint32Array]']=!0,un['[object Arguments]']=un['[object Array]']=un['[object ArrayBuffer]']=un['[object Boolean]']=un['[object DataView]']=un['[object Date]']=un['[object Error]']=un['[object Function]']=un['[object Map]']=un['[object Number]']=un['[object Object]']=un['[object RegExp]']=un['[object Set]']=un['[object String]']=un['[object WeakMap]']=!1;var cn={exports:{}};((e,exports)=>{var t=exports&&!exports.nodeType&&exports;var r=t&&e&&!e.nodeType&&e;var a=r&&r.exports===t&&mr.process;var n=(()=>{try{return r&&r.require&&r.require('util').types||a&&a.binding&&a.binding('util')}catch(e){}})();e.exports=n})(cn,cn.exports);var vn=cn.exports;var hn=vn&&vn.isTypedArray;var pn=hn?(e=>t=>e(t))(hn):e=>ln(e)&&sn(e.length)&&!!un[on(e)];var dn=(e,t)=>{if((t!=='constructor'||typeof e[t]!='function')&&t!='__proto__')return e[t]};var yn=fa,fn=lr;var gn={}.hasOwnProperty;var bn=(e,t,r)=>{var a=e[t];gn.call(e,t)&&fn(a,r)&&(r!==void 0||t in e)||yn(e,t,r)},mn=fa;var _n=/^(?:0|[1-9]\d*)$/;var Sn=(e,t)=>{var r=typeof e;return!!(t=t==null?9007199254740991:t)&&(r=='number'||r!='symbol'&&_n.test(e))&&e>-1&&e%1==0&&e<t};var On=Ma,En=Na,wn=Ya,jn=Sn,xn=pn;var An=Pr,Cn=Pa;var Vn={}.hasOwnProperty;var Pn=Ga;var Tn=e=>Pn(e)?(e=>{var t=En(e),r=!t&&On(e),a=!t&&!r&&wn(e),n=!t&&!r&&!a&&xn(e),o=t||r||a||n,i=o?((e,t)=>{var r=-1,a=Array(e);for(;++r<e;)a[r]=t(r);return a})(e.length,String):[],s=i.length;for(var l in e)o&&(l=='length'||a&&(l=='offset'||l=='parent')||n&&(l=='buffer'||l=='byteLength'||l=='byteOffset')||jn(l,s))||i.push(l);return i})(e):(e=>{if(!An(e))return(e=>{var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t})(e);var t=Cn(e),r=[];for(var a in e)(a!='constructor'||!t&&Vn.call(e,a))&&r.push(a);return r})(e);var zn=Tn;var Ln=ma,kn=Sa,Rn=Ma,Fn=Na,Dn=Ya,Hn=Lr,Wn=Pr,Bn=pn,In=dn;var Mn=ha,Nn=ma,Un=Pr,$n=Tn,Kn=dn;var Gn=e=>e;var qn=Math.max;var Jn=da;var Qn=Date.now;var Xn=(e=>{var t=0,r=0;return function(a){var n=Qn(),o=16-(n-r);if(r=n,o>0){if(++t>=800)return a}else t=0;return e.apply(void 0,arguments)}})(Jn?(e,t)=>{return Jn(e,'toString',{configurable:!0,enumerable:!1,value:(r=t,()=>r),writable:!0});var r}:Gn);var Yn=Gn,Zn=Xn;var eo=lr,to=Ga,ro=Sn,ao=Pr;var no=function e(t,r,a,n,o){t!==r&&((e,t,r)=>{var a=-1,n=Object(e),o=r(e),i=o.length;for(;i--;){var s=o[++a];if(t(n[s],s)===!1)break}})(r,((i,s)=>{if(o||(o=new Mn),Un(i))((e,t,r,a,n,o,i)=>{var s=In(e,r),l=In(t,r),u=i.get(l);if(u)Ln(e,r,u);else{var c=o?o(s,l,r+'',e,t,i):void 0;var v=c===void 0;if(v){var h=Fn(l),p=!h&&Dn(l),d=!h&&!p&&Bn(l);c=l,h||p||d?Fn(s)?c=s:(e=>Ja(e)&&qa(e))(s)?c=((e,t)=>{var r=-1,a=e.length;for(t||(t=Array(a));++r<a;)t[r]=e[r];return t})(s):p?(v=!1,c=kn(l,!0)):d?(v=!1,g=new(f=(y=l).buffer).constructor(f.byteLength),new Oa(g).set(new Oa(f)),c=new y.constructor(g,y.byteOffset,y.length)):c=[]:(e=>{if(!tn(e)||Za(e)!="[object Object]")return!1;var t=en(e);if(t===null)return!0;var r=an.call(t,'constructor')&&t.constructor;return typeof r=='function'&&r instanceof r&&rn.call(r)==nn})(l)||Rn(l)?(c=s,Rn(s)?c=((e,t,r)=>{var a=!r;r||(r={});var n=-1,o=t.length;for(;++n<o;){var i=t[n];var s=void 0;s===void 0&&(s=e[i]),a?mn(r,i,s):bn(r,i,s)}return r})(b=s,zn(b)):Wn(s)&&!Hn(s)||(c=(e=>typeof e.constructor!='function'||La(e)?{}:Ta(za(e)))(l))):v=!1}v&&(i.set(l,c),n(c,l,a,o,i),i.delete(l)),Ln(e,r,c)}var y,f,g;var b})(t,r,s,a,e,n,o);else{var l=n?n(Kn(t,s),i,s+'',t,r,o):void 0;l===void 0&&(l=i),Nn(t,s,l)}}),$n)};var oo=ir((io=(e,t,r)=>{no(e,t,r)},(e=>Zn(function(e,t,r){return t=qn(t===void 0?e.length-1:t,0),function(){var a=arguments,n=-1,o=qn(a.length-t,0),i=Array(o);for(;++n<o;)i[n]=a[t+n];n=-1;var s=Array(t+1);for(;++n<t;)s[n]=a[n];return s[t]=r(i),((e,t,r)=>{switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)})(e,this,s)}}(e,void 0,Yn),e+''))(((e,t)=>{var r=-1,a=t.length,n=a>1?t[a-1]:void 0,o=a>2?t[2]:void 0;for((n=io.length>3&&typeof n=='function'?(a--,n):void 0,o&&((e,t,r)=>{if(!ao(r))return!1;var a=typeof t;return!!(a=='number'?to(r)&&ro(t,r.length):a=='string'&&t in r)&&eo(r[t],e)})(t[0],t[1],o)&&(n=a<3?void 0:n,a=1),e=Object(e));++r<a;){var i=t[r];i&&io(e,i,r)}return e}))));var io;var so={emailDomains:['gmail.com','mail.ru','yandex.ru','icloud.com','bk.ru','list.ru','inbox.ru','rambler.ru','internet.ru','ya.ru','mail.com','yandex.com','foxford.ru','hotmail.com','vk.com','yahoo.com','outlook.com','yandex.by','yandex.kz','xmail.ru','tut.by','msn.com','me.com'],suggestionClass:'emailAutoSugg',suggestionColor:'var(--silver, #b8b8b8)',suitableColor:'var(--silver, #b8b8b8)',suitableEmailColor:'var(--accent, #1A96F6)',suitableFontSize:'12px',suitableLineHeight:'1.7',suitableLevenshteinTreshold:5};var lo={TAB:'Tab',RIGHT_ARROW:'ArrowRight',DOWN_ARROW:'ArrowDown',ENTER:'Enter',BACKSPACE:'Backspace',DELETE:'Delete'};exports.EmailAutocomplete=function(){function e(t,r){var a=this;if(((e,t)=>{if(!(this instanceof t))throw new TypeError("Cannot call a class as a function")})(0,e),this.node=void 0,this.nodeRects=void 0,this.nodeStyle=void 0,this.options=so,this.containerValue=null,this.suggOverlay=null,this.value='',this.suggestion='',this.leftOffset=null,this.suitableExists=!1,this.suitableContainer=null,this.events={click:'eac.click',show:'eac.show'},this.bindListeners=()=>{a.suggOverlay&&a.suggOverlay.addEventListener('mousedown touchstart',a.onFocus),a.node.addEventListener('keyup',a.displaySuggestion),a.node.addEventListener('paste',a.onPaste),a.node.addEventListener('blur',a.autocomplete),a.node.addEventListener('keydown',a.onKeydown)},this.onFocus=()=>{a.node.focus()},this.onKeydown=e=>{if([lo.BACKSPACE,lo.DELETE].includes(e.code))a.hideSuitableEmail();else if([lo.DOWN_ARROW,lo.ENTER,lo.RIGHT_ARROW,lo.TAB].includes(e.code)&&(lo.TAB!==e.code||a.suggestion)){a.node.addEventListener('blur',a.autocomplete);var t=e.target;t instanceof HTMLElement&&t.blur()}},this.onPaste=e=>{if(!e.clipboardData)throw new Error('Not found clipboardData');var t=e.clipboardData.getData('text/plain');a.value=t,a.node.removeEventListener('blur',a.autocomplete);var r=a.findSuitableEmails(t);a.showSuitableEmail(r)},this.findSuitableEmails=e=>{var t=e.split('@');var r;if(t.length<=1)return[];r=t.pop()||'';var n=(a.options.emailDomains||[]).map((e=>({item:e,distance:sr(r,e)})));var o=a.options.suitableLevenshteinTreshold;return n.sort(((e,t)=>e.distance-t.distance)).filter((e=>e.distance<=o)).slice(0,3).map((e=>"".concat(t.join(''),"@").concat(e.item)))},this.showSuitableEmail=e=>{if(e.length!==0){a.suitableContainer&&a.hideSuitableEmail();var t=e[0];if(a.value!==t){var r=document.createTextNode('Возможно, вы имели в виду ');var n=document.createElement('span');var o=document.createElement('span');o.style.display='block',o.style.fontFamily=a.nodeStyle.getPropertyValue('font-family'),o.style.fontWeight=a.nodeStyle.getPropertyValue('font-weight'),o.style.letterSpacing=a.nodeStyle.getPropertyValue('letter-spacing'),o.style.color=a.options.suitableColor||'',o.style.fontSize=a.options.suitableFontSize||'',o.style.lineHeight=a.options.suitableLineHeight||'',n.style.fontFamily=a.nodeStyle.getPropertyValue('font-family'),n.style.fontWeight=a.nodeStyle.getPropertyValue('font-weight'),n.style.letterSpacing=a.nodeStyle.getPropertyValue('letter-spacing'),n.style.color=a.options.suitableEmailColor||'',n.style.fontSize=a.options.suitableFontSize||'',n.style.lineHeight=a.options.suitableLineHeight||'',n.style.cursor='pointer',n.textContent=t,o.append(r),o.append(n),a.suitableContainer=o,a.node.after(a.suitableContainer),n.addEventListener('click',a.onClickSuitableEmail,{once:!0}),a.suitableExists=!0,typeof a.options.onShowSuitableEmail=='function'&&a.options.onShowSuitableEmail()}}},this.hideSuitableEmail=()=>{a.suitableContainer&&(a.suitableContainer.remove(),a.suitableContainer=null),a.suggOverlay&&(a.suggOverlay.textContent=''),a.suitableExists=!1,typeof a.options.onHideSuitableEmail=='function'&&a.options.onHideSuitableEmail()},this.onClickSuitableEmail=e=>{e.preventDefault(),e.stopPropagation(),e.target instanceof HTMLSpanElement&&(a.changeValue(e.target.textContent||''),a.hideSuitableEmail(),a.node.addEventListener('blur',a.autocomplete),typeof a.options.onClickSuitableEmail=='function'&&a.options.onClickSuitableEmail())},this.autocomplete=e=>{if(e.stopPropagation(),a.suitableExists&&a.hideSuitableEmail(),a.suggestion===void 0||typeof a.suggestion=='string'&&a.suggestion.length<1){var t=a.findSuitableEmails(a.value||'');return a.showSuitableEmail(t),!1}var r="".concat(a.value||'').concat(a.suggestion||'');return a.clear(),a.changeValue(r),!0},this.changeValue=e=>{typeof a.options.onAutocomplete=='function'?a.options.onAutocomplete(e):a.node.value=e},this.displaySuggestion=e=>{if(a.value=a.node.value,a.suggestion=a.suggest(a.value),a.suggOverlay&&a.containerValue){if(a.suggestion.length?e.preventDefault():a.suggOverlay.textContent='',a.suggOverlay.textContent=a.suggestion,a.containerValue.textContent=a.value||'',a.leftOffset===null){var t=a.node.clientWidth;t-=parseFloat(a.nodeStyle.paddingLeft)+parseFloat(a.nodeStyle.paddingRight),a.leftOffset=(a.node.offsetWidth-t)/2}var r=a.containerValue.clientWidth;a.node.offsetWidth>r&&(a.suggOverlay.style.left="".concat(a.leftOffset+r,"px"))}},this.destroy=()=>{a.suggOverlay&&a.suggOverlay.removeEventListener('mousedown touchstart',a.onFocus),a.node.removeEventListener('keyup',a.displaySuggestion),a.node.removeEventListener('paste',a.onPaste),a.node.removeEventListener('blur',a.autocomplete),a.node.removeEventListener('keydown',a.onKeydown),a.suggOverlay=null,a.containerValue=null,a.suitableContainer=null},this.clear=()=>{a.suggOverlay instanceof HTMLSpanElement&&(a.suggOverlay.textContent=''),a.containerValue instanceof HTMLSpanElement&&(a.containerValue.textContent='')},!(t instanceof HTMLInputElement))throw new TypeError('Node must be html input element');this.node=t,this.nodeRects=this.node.getBoundingClientRect(),this.options=oo(this.options,r),this.suggOverlay=document.createElement('span'),this.containerValue=document.createElement('span'),this.suitableContainer=document.createElement('span'),this.nodeStyle=getComputedStyle(this.node)}var t;return(t=[{key:"apply",value:function(){if(this.node.eac===void 0||this.node.eac===null){this.node.eac=this;var e=this.node.parentElement;var t=0;if(e){var r=e.getBoundingClientRect();t=Math.abs(r.top-this.nodeRects.top)}this.containerValue=document.createElement('span'),this.containerValue.style.visibility='hidden',this.containerValue.style.position='absolute',this.containerValue.style.display='inline-block',this.containerValue.style.fontFamily=this.nodeStyle.getPropertyValue('font-family'),this.containerValue.style.fontWeight=this.nodeStyle.getPropertyValue('font-weight'),this.containerValue.style.fontSize=this.nodeStyle.getPropertyValue('font-size'),this.containerValue.style.letterSpacing=this.nodeStyle.getPropertyValue('letter-spacing');var a=(this.node.offsetHeight-this.node.clientHeight)/2;this.suggOverlay=document.createElement('span'),typeof this.options.suggestionClass=='string'&&this.suggOverlay.classList.add(this.options.suggestionClass),this.suggOverlay.style.display='flex',this.suggOverlay.style.alignItems='center',this.suggOverlay.style.position='absolute',this.suggOverlay.style.top="".concat(t,"px"),this.suggOverlay.style.left='0',this.suggOverlay.style.height="".concat(this.node.offsetHeight,"px"),this.suggOverlay.style.paddingTop="".concat(parseInt(this.nodeStyle.getPropertyValue('padding-top'),10)+a,"px"),this.suggOverlay.style.paddingBottom="".concat(parseInt(this.nodeStyle.getPropertyValue('padding-bottom'),10)+a,"px"),this.suggOverlay.style.lineHeight=this.nodeStyle.getPropertyValue('line-height'),this.suggOverlay.style.fontSize=this.nodeStyle.getPropertyValue('font-size'),this.suggOverlay.style.color=this.options.suggestionColor||'',this.containerValue.style.fontFamily=this.nodeStyle.getPropertyValue('font-family'),this.containerValue.style.fontWeight=this.nodeStyle.getPropertyValue('font-weight'),this.containerValue.style.fontSize=this.nodeStyle.getPropertyValue('font-size'),this.containerValue.style.letterSpacing=this.nodeStyle.getPropertyValue('letter-spacing'),this.node.after(this.containerValue),this.containerValue.after(this.suggOverlay),this.bindListeners()}}},{key:"suggest",value:function(e){var t=e.split('@');var r=e;return t.length>1&&(r=t.pop()||'').length?((this.options.emailDomains||[]).filter((e=>e.indexOf(r)===0)).shift()||'').replace(r,''):''}}])&&((e,t)=>{for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}})(e.prototype,t),e}(); | ||
//# sourceMappingURL=autocomplete-email.js.map |
@@ -1,2 +0,2 @@ | ||
'use strict';function ko(t,r,e,n,o,i,a){try{var s=t[i](a);var l=s.value}catch(t){return void e(t)}s.done?r(l):Promise.resolve(l).then(n,o)}function Ao(t){return function(){var r=this,e=arguments;return new Promise(((n,o)=>{var i=t.apply(r,e);function a(t){ko(i,n,o,a,s,"next",t)}function s(t){ko(i,n,o,a,s,"throw",t)}a(void 0)}))}}function Bo(t,r){(r==null||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function No(t){return(t=>{if(Array.isArray(t))return Bo(t)})(t)||(t=>{if(typeof Symbol!="undefined"&&Symbol.iterator in Object(t))return Array.from(t)})(t)||((t,r)=>{if(t){if(typeof t=="string")return Bo(t,r);var e={}.toString.call(t).slice(8,-1);return e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set"?Array.from(t):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Bo(t,r):void 0}})(t)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}var vr=typeof globalThis!='undefined'?globalThis:typeof window!='undefined'?window:typeof global!='undefined'?global:typeof self!='undefined'?self:{};var pr=(t,r)=>t===r||t!=t&&r!=r;var dr=pr;var yr=(t,r)=>{var e=t.length;for(;e--;)if(dr(t[e][0],r))return e;return-1};var fr=yr;var gr=[].splice;var br=yr;var mr=yr;var _r=yr;function Sr(t){var r=-1,e=t==null?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}Sr.prototype.clear=function(){this.__data__=[],this.size=0},Sr.prototype.delete=function(t){var r=this.__data__,e=fr(r,t);return!(e<0||(e==r.length-1?r.pop():gr.call(r,e,1),--this.size,0))},Sr.prototype.get=function(t){var r=this.__data__,e=br(r,t);return e<0?void 0:r[e][1]},Sr.prototype.has=function(t){return mr(this.__data__,t)>-1},Sr.prototype.set=function(t,r){var e=this.__data__,n=_r(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this};var Or=Sr;var Er=Or;var wr=typeof vr=='object'&&vr&&vr.Object===Object&&vr;var jr=typeof self=='object'&&self&&self.Object===Object&&self;var Ar=wr||jr||Function("","return this")();var qo=Ar.Symbol;var xr=Object.prototype;var Vr=xr.hasOwnProperty;var Pr=xr.toString;var Tr=qo?qo.toStringTag:void 0;var Lr={}.toString;var zr=qo?qo.toStringTag:void 0;var kr=t=>t==null?t===void 0?"[object Undefined]":"[object Null]":zr&&zr in Object(t)?(t=>{var r=Vr.call(t,Tr),e=t[Tr];try{t[Tr]=void 0;var n=!0}catch(t){}var o=Pr.call(t);return n&&(r?t[Tr]=e:delete t[Tr]),o})(t):(t=>Lr.call(t))(t);var Rr=t=>{var r=typeof t;return t!=null&&(r=='object'||r=='function')};var Fr=kr,Dr=Rr;var Hr=t=>{if(!Dr(t))return!1;var r=Fr(t);return r=="[object Function]"||r=="[object GeneratorFunction]"||r=="[object AsyncFunction]"||r=="[object Proxy]"};var Wr=Ar['__core-js_shared__'];var Br=(Ir=/[^.]+$/.exec(Wr&&Wr.keys&&Wr.keys.IE_PROTO||''))?'Symbol(src)_1.'+Ir:'';var Ir;var Mr=(()=>{}).toString;var Nr=Hr,Ur=Rr;var $r=/^\[object .+?Constructor\]$/;var Kr=RegExp('^'+(()=>{}).toString.call({}.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,'\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,'$1.*?')+'$');var Gr=(t,r)=>{var e=((t,r)=>t==null?void 0:t[r])(t,r);return(t=>{return!(!Ur(t)||(r=t,Br&&Br in r))&&(Nr(t)?Kr:$r).test((t=>{if(t!=null){try{return Mr.call(t)}catch(t){}try{return t+''}catch(t){}}return''})(t));var r})(e)?e:void 0};var qr=Gr(Ar,'Map');var Jr=Gr(Object,'create');var Qr=Jr;var Xr=Jr;var Yr={}.hasOwnProperty;var Zr=Jr;var ea={}.hasOwnProperty;var ta=Jr;function ra(t){var r=-1,e=t==null?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}ra.prototype.clear=function(){this.__data__=Qr?Qr(null):{},this.size=0},ra.prototype.delete=function(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r},ra.prototype.get=function(t){var r=this.__data__;if(Xr){var e=r[t];return e==="__lodash_hash_undefined__"?void 0:e}return Yr.call(r,t)?r[t]:void 0},ra.prototype.has=function(t){var r=this.__data__;return Zr?r[t]!==void 0:ea.call(r,t)},ra.prototype.set=function(t,r){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=ta&&r===void 0?"__lodash_hash_undefined__":r,this};var aa=ra,na=Or,oa=qr;var ia=(t,r)=>{var e=t.__data__;return((o=typeof(n=r))=='string'||o=='number'||o=='symbol'||o=='boolean'?n!=='__proto__':n===null)?e[typeof r=='string'?'string':'hash']:e.map;var n,o};var sa=ia;var la=ia;var ua=ia;var va=ia;function ca(t){var r=-1,e=t==null?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}ca.prototype.clear=function(){this.size=0,this.__data__={hash:new aa,map:new(oa||na),string:new aa}},ca.prototype.delete=function(t){var r=sa(this,t).delete(t);return this.size-=r?1:0,r},ca.prototype.get=function(t){return la(this,t).get(t)},ca.prototype.has=function(t){return ua(this,t).has(t)},ca.prototype.set=function(t,r){var e=va(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this};var ha=Or,pa=qr,da=ca;var ya=Or;function fa(t){var r=this.__data__=new ya(t);this.size=r.size}fa.prototype.clear=function(){this.__data__=new Er,this.size=0},fa.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},fa.prototype.get=function(t){return this.__data__.get(t)},fa.prototype.has=function(t){return this.__data__.has(t)},fa.prototype.set=function(t,r){var e=this.__data__;if(e instanceof ha){var n=e.__data__;if(!pa||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new da(n)}return e.set(t,r),this.size=e.size,this};var ga=fa;var ba=Gr;var ma=(()=>{try{var t=ba(Object,'defineProperty');return t({},'',{}),t}catch(t){}})();var _a=ma;var Sa=(t,r,e)=>{r=='__proto__'&&_a?_a(t,r,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[r]=e};var Oa=Sa,Ea=pr;var wa=(t,r,e)=>{(e!==void 0&&!Ea(t[r],e)||e===void 0&&!(r in t))&&Oa(t,r,e)};var ja={exports:{}};((t,exports)=>{var r=exports&&!exports.nodeType&&exports;var e=r&&ja&&!ja.nodeType&&ja;var n=e&&e.exports===r?Ar.Buffer:void 0,o=n?n.allocUnsafe:void 0;ja.exports=(t,r)=>{if(r)return t.slice();var e=t.length,n=o?o(e):new t.constructor(e);return t.copy(n),n}})(0,ja.exports);var Pa=ja.exports;var Ta=Ar.Uint8Array;var La=Rr;var za=Object.create;var ka=(()=>{function t(){}return r=>{if(!La(r))return{};if(za)return za(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}})();var Ra=(Fa=Object.getPrototypeOf,Da=Object,t=>Fa(Da(t)));var Fa,Da;var Ha=Object.prototype;var Wa=t=>{var r=t&&t.constructor;return t===(typeof r=='function'&&r.prototype||Ha)};var Ba=ka,Ia=Ra,Ma=Wa;var Na=t=>t!=null&&typeof t=='object';var Ua=kr,$a=Na;var Ka=t=>$a(t)&&Ua(t)=="[object Arguments]",Ga=Na;var qa=Object.prototype;var Ja=qa.hasOwnProperty;var Qa=qa.propertyIsEnumerable;var Xa=Ka(function(){return arguments}())?Ka:t=>Ga(t)&&Ja.call(t,'callee')&&!Qa.call(t,'callee');var Ya=Array.isArray;var Za=t=>typeof t=='number'&&t>-1&&t%1==0&&t<=9007199254740991;var en=Hr,tn=Za;var rn=t=>t!=null&&tn(t.length)&&!en(t);var an=rn,nn=Na;var on={exports:{}};var sn=()=>!1;((t,exports)=>{var r=exports&&!exports.nodeType&&exports;var e=r&&on&&!on.nodeType&&on;var n=e&&e.exports===r?Ar.Buffer:void 0;on.exports=(n?n.isBuffer:void 0)||sn})(0,on.exports);var ln=on.exports;var un=kr,vn=Ra,cn=Na;var hn=(()=>{}).toString;var pn={}.hasOwnProperty;var dn=hn.call(Object);var yn=kr,fn=Za,gn=Na;var bn={};bn['[object Float32Array]']=bn['[object Float64Array]']=bn['[object Int8Array]']=bn['[object Int16Array]']=bn['[object Int32Array]']=bn['[object Uint8Array]']=bn['[object Uint8ClampedArray]']=bn['[object Uint16Array]']=bn['[object Uint32Array]']=!0,bn['[object Arguments]']=bn['[object Array]']=bn['[object ArrayBuffer]']=bn['[object Boolean]']=bn['[object DataView]']=bn['[object Date]']=bn['[object Error]']=bn['[object Function]']=bn['[object Map]']=bn['[object Number]']=bn['[object Object]']=bn['[object RegExp]']=bn['[object Set]']=bn['[object String]']=bn['[object WeakMap]']=!1;var mn={exports:{}};((t,exports)=>{var r=exports&&!exports.nodeType&&exports;var e=r&&t&&!t.nodeType&&t;var n=e&&e.exports===r&&wr.process;var o=(()=>{try{return e&&e.require&&e.require('util').types||n&&n.binding&&n.binding('util')}catch(t){}})();t.exports=o})(mn,mn.exports);var _n=mn.exports;var Sn=_n&&_n.isTypedArray;var On=Sn?(cr=Sn,t=>cr(t)):t=>gn(t)&&fn(t.length)&&!!bn[yn(t)];var cr;var En=(t,r)=>{if((r!=='constructor'||typeof t[r]!='function')&&r!='__proto__')return t[r]};var wn=Sa,jn=pr;var An={}.hasOwnProperty;var Cn=(t,r,e)=>{var n=t[r];An.call(t,r)&&jn(n,e)&&(e!==void 0||r in t)||wn(t,r,e)},xn=Sa;var Vn=/^(?:0|[1-9]\d*)$/;var Pn=(t,r)=>{var e=typeof t;return!!(r=r==null?9007199254740991:r)&&(e=='number'||e!='symbol'&&Vn.test(t))&&t>-1&&t%1==0&&t<r};var Tn=Xa,Ln=Ya,zn=ln,kn=Pn,Rn=On;var Fn=Rr,Dn=Wa;var Hn={}.hasOwnProperty;var Wn=rn;var Bn=t=>Wn(t)?(t=>{var r=Ln(t),e=!r&&Tn(t),n=!r&&!e&&zn(t),o=!r&&!e&&!n&&Rn(t),i=r||e||n||o,a=i?((t,r)=>{var e=-1,n=Array(t);for(;++e<t;)n[e]=r(e);return n})(t.length,String):[],s=a.length;for(var l in t)i&&(l=='length'||n&&(l=='offset'||l=='parent')||o&&(l=='buffer'||l=='byteLength'||l=='byteOffset')||kn(l,s))||a.push(l);return a})(t):(t=>{if(!Fn(t))return(t=>{var r=[];if(t!=null)for(var e in Object(t))r.push(e);return r})(t);var r=Dn(t),e=[];for(var n in t)(n!='constructor'||!r&&Hn.call(t,n))&&e.push(n);return e})(t);var In=Bn;var Mn=wa,Nn=Pa,Un=Xa,$n=Ya,Kn=ln,Gn=Hr,qn=Rr,Jn=On,Qn=En;var Xn=ga,Yn=wa,Zn=Rr,eo=Bn,to=En;var ro=t=>t;var ao=Math.max;var no=ma;var oo=Date.now;var io=(t=>{var r=0,e=0;return function(n){var o=oo(),i=16-(o-e);if(e=o,i>0){if(++r>=800)return n}else r=0;return t.apply(void 0,arguments)}})(no?(t,r)=>{return no(t,'toString',{configurable:!0,enumerable:!1,value:(e=r,()=>e),writable:!0});var e}:ro);var so=ro,lo=io;var uo=pr,vo=rn,co=Pn,ho=Rr;var po=function t(r,e,n,o,i){r!==e&&((t,r,e)=>{var n=-1,o=Object(t),i=e(t),a=i.length;for(;a--;){var s=i[++n];if(r(o[s],s)===!1)break}})(e,((a,s)=>{if(i||(i=new Xn),Zn(a))((t,r,e,n,o,i,a)=>{var s=Qn(t,e),l=Qn(r,e),u=a.get(l);if(u)Mn(t,e,u);else{var c=i?i(s,l,e+'',t,r,a):void 0;var f=c===void 0;if(f){var m=$n(l),d=!m&&Kn(l),h=!m&&!d&&Jn(l);c=l,m||d||h?$n(s)?c=s:(t=>nn(t)&&an(t))(s)?c=((t,r)=>{var e=-1,n=t.length;for(r||(r=Array(n));++e<n;)r[e]=t[e];return r})(s):d?(f=!1,c=Nn(l,!0)):h?(f=!1,C=new(v=(p=l).buffer).constructor(v.byteLength),new Ta(C).set(new Ta(v)),c=new p.constructor(C,p.byteOffset,p.length)):c=[]:(t=>{if(!cn(t)||un(t)!="[object Object]")return!1;var r=vn(t);if(r===null)return!0;var e=pn.call(r,'constructor')&&r.constructor;return typeof e=='function'&&e instanceof e&&hn.call(e)==dn})(l)||Un(l)?(c=s,Un(s)?c=((t,r,e)=>{var n=!e;e||(e={});var o=-1,i=r.length;for(;++o<i;){var a=r[o];var s=void 0;s===void 0&&(s=t[a]),n?xn(e,a,s):Cn(e,a,s)}return e})(y=s,In(y)):qn(s)&&!Gn(s)||(c=(t=>typeof t.constructor!='function'||Ma(t)?{}:Ba(Ia(t)))(l))):f=!1}f&&(a.set(l,c),o(c,l,n,i,a),a.delete(l)),Mn(t,e,c)}var p,v,C;var y})(r,e,s,n,t,o,i);else{var l=o?o(to(r,s),a,s+'',r,e,i):void 0;l===void 0&&(l=a),Yn(r,s,l)}}),eo)};var yo=(t=>t&&t.__esModule&&{}.hasOwnProperty.call(t,'default')?t.default:t)((fo=(t,r,e)=>{po(t,r,e)},(t=>lo(function(t,r,e){return r=ao(r===void 0?t.length-1:r,0),function(){var n=arguments,o=-1,i=ao(n.length-r,0),a=Array(i);for(;++o<i;)a[o]=n[r+o];o=-1;var s=Array(r+1);for(;++o<r;)s[o]=n[o];return s[r]=e(a),((t,r,e)=>{switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)})(t,this,s)}}(t,void 0,so),t+''))(((t,r)=>{var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for((o=fo.length>3&&typeof o=='function'?(n--,o):void 0,i&&((t,r,e)=>{if(!ho(e))return!1;var n=typeof r;return!!(n=='number'?vo(e)&&co(r,e.length):n=='string'&&r in e)&&uo(e[r],t)})(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t));++e<n;){var a=r[e];a&&fo(t,a,e)}return t}))));var fo;function Oo(){Oo=()=>r;var t,r={},e=Object.prototype,n=e.hasOwnProperty,o=Object.defineProperty||((t,r,e)=>{t[r]=e.value}),i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(t){u=(t,r,e)=>t[r]=e}function c(t,r,e,n){var i=Object.create((r&&r.prototype instanceof C?r:C).prototype),a=new B(n||[]);return o(i,"_invoke",{value:j(t,e,a)}),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=c;var m="suspendedStart",d="suspendedYield",h="executing",p="completed",v={};function C(){}function y(){}function b(){}var g={};u(g,a,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(N([])));w&&w!==e&&n.call(w,a)&&(g=w);var E=b.prototype=C.prototype=Object.create(g);function L(t){["next","throw","return"].forEach((function(r){u(t,r,(function(t){return this._invoke(r,t)}))}))}function x(t,r){function e(o,i,a,s){var l=f(t[o],t,i);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==typeof c&&n.call(c,"__await")?r.resolve(c.__await).then((t=>{e("next",t,a,s)}),(t=>{e("throw",t,a,s)})):r.resolve(c).then((t=>{u.value=t,a(u)}),(t=>e("throw",t,a,s)))}s(l.arg)}var i;o(this,"_invoke",{value:(t,n)=>{function o(){return new r(((r,o)=>{e(t,n,r,o)}))}return i=i?i.then(o,o):o()}})}function j(r,e,n){var o=m;return(i,a)=>{if(o===h)throw new Error("Generator is already running");if(o===p){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var l=T(s,n);if(l){if(l===v)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===m)throw o=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var u=f(r,e,n);if("normal"===u.type){if(o=n.done?p:d,u.arg===v)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=p,n.method="throw",n.arg=u.arg)}}}function T(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,T(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,v;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,v):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function k(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function A(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function B(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function N(r){if(r||""===r){var e=r[a];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,i=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return y.prototype=b,o(E,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:y,configurable:!0}),y.displayName=u(b,l,"GeneratorFunction"),r.isGeneratorFunction=t=>{var r="function"==typeof t&&t.constructor;return!!r&&(r===y||"GeneratorFunction"===(r.displayName||r.name))},r.mark=t=>(Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,l,"GeneratorFunction")),t.prototype=Object.create(E),t),r.awrap=t=>({__await:t}),L(x.prototype),u(x.prototype,s,(function(){return this})),r.AsyncIterator=x,r.async=(t,e,n,o,i)=>{void 0===i&&(i=Promise);var a=new x(c(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((t=>t.done?t.value:a.next()))},L(E),u(E,l,"Generator"),u(E,a,(function(){return this})),u(E,"toString",(()=>"[object Generator]")),r.keys=t=>{var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=N,B.prototype={constructor:B,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return s.type="throw",s.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(l&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),v},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),A(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;A(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:N(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),v}},r}var go={className:'foxford-phone-confirm',errorClassName:'is-error',disabledClassName:'is-disabled',hiddenClassName:'is-hidden',confirmedInputClassName:'is-confirmed',confirmCodePlaceholderText:'Введите код',confirmCodeInvalidText:'Должен состоять из 4 символов',inputParentsToHide:[],requestButtonText:'Подтвердить',retryButtonText:'Выслать код повторно',sendCodeButtonText:'Отправить код',unconfirmedHintText:'Не подтвержден',untilRetryText:'Выслать код повторно через',userData:{phone:'',phoneConfirmed:!1}};var So={isConfirmRequested:!1,isConfirmed:!1,dataToConfirm:'',confirmedData:''};var Po='Api not specified';exports.ConfirmPhone=function(){function t(r,e){var n=this;((t,r)=>{if(!(this instanceof r))throw new TypeError("Cannot call a class as a function")})(0,t),this.api=void 0,this.fieldType='phone',this.options=void 0,this.formCheckAttrName='data-fields-to-confirm',this.formPreventSubmitAttr='data-prevent-submit',this.state=So,this.formControls=void 0,this.confirmControls=void 0,this.bindListeners=()=>{n.formControls.input.addEventListener('keyup',n.inputListener),n.confirmControls.input&&n.confirmControls.input.addEventListener('input',n.confirmInputListener),n.confirmControls.sendCodeButton&&n.confirmControls.sendCodeButton.addEventListener('click',n.sendCodeListener),n.confirmControls.retryButton&&n.confirmControls.retryButton.addEventListener('click',n.retryListener),n.confirmControls.requestConfirmButton&&n.confirmControls.requestConfirmButton.addEventListener('click',n.requestConfirmListener)},this.inputListener=()=>{n.state.dataToConfirm=n.cleanPhoneFormatting(n.formControls.input.value),n.state.isConfirmed=n.state.dataToConfirm===n.state.confirmedData,n.options.confirmedInputClassName&&(n.hideElement(n.confirmControls.requestConfirmError),n.state.dataToConfirm&&!n.state.isConfirmed?(n.formControls.input.classList.remove(n.options.confirmedInputClassName),n.showConfirmButtonAndHint(),n.addFieldForCheck(),n.disableSubmit()):(n.formControls.input.classList.add(n.options.confirmedInputClassName),n.removeFieldFromCheck(),n.attemptToEnableSubmit(),n.confirmControls.input&&n.hideElement(n.confirmControls.input),n.hideConfirmButtonAndHint()))},this.updateRetryHintText=t=>{n.confirmControls.countDown&&(n.confirmControls.countDown.innerText="".concat(n.options.untilRetryText," ").concat(t))},this.requestConfirmListener=()=>{if(n.state.dataToConfirm&&!n.state.isConfirmed&&!n.state.isConfirmRequested){var t=n.requestData;if(!t)return;n.state.isConfirmRequested=!0,n.options.disabledClassName&&n.confirmControls.requestConfirmButton&&n.confirmControls.requestConfirmButton.classList.add(n.options.disabledClassName),n.requestCode(t).then((t=>{var r=t.nextDeliveryAt;if(r&&typeof r!='function'){var e=n.getDiffSeconds(r);e>0&&!n.state.isConfirmed&&(n.toggleInputParents(!1),n.hideElement(n.formControls.input),n.showElement(n.confirmControls.container),n.showElement(n.confirmControls.input),n.showElement(n.confirmControls.countDown),n.showElement(n.confirmControls.sendCodeButton),n.hideElement(n.confirmControls.retryButton),n.hideElement(n.confirmControls.requestConfirmError),n.updateRetryHintText(e)),n.hideConfirmButtonAndHint(),n.retryCounter(r)}})).catch((t=>{t.errors&&t.errors[n.fieldType]&&n.confirmControls.requestConfirmError&&(n.confirmControls.requestConfirmError.innerText=String(t.errors[n.fieldType]),n.showElement(n.confirmControls.requestConfirmError))})).finally((()=>{n.state.isConfirmRequested=!1,n.options.disabledClassName&&n.confirmControls.requestConfirmButton&&n.confirmControls.requestConfirmButton.classList.remove(n.options.disabledClassName)}))}},this.validateConfirmInput=()=>!(n.confirmControls.input&&!n.confirmControls.input.value||!n.confirmControls.input)&&n.confirmControls.input.value.length===4,this.confirmInputListener=()=>{if(n.confirmControls.sendCodeButton&&n.options.disabledClassName&&n.confirmControls.input){var t=n.confirmControls.input;n.confirmControls.input.value=t.value.replace(/[^0-9]/g,'');var r=n.validateConfirmInput();n.options.errorClassName&&t.classList.remove(n.options.errorClassName),r?n.confirmControls.sendCodeButton.classList.remove(n.options.disabledClassName):n.confirmControls.sendCodeButton.classList.add(n.options.disabledClassName),n.sendCodeListener()}},this.sendCodeListener=()=>{if(n.validateConfirmInput()){var t=n.confirmData;if(t){var r=n.confirmControls.input;r&&(r.setAttribute('disabled','disabled'),n.confirmCode(t).then((t=>{var e=t.verificationToken;n.state.isConfirmed=!0,n.state.confirmedData=n.state.dataToConfirm,n.toggleInputParents(!0),n.showElement(n.formControls.input),n.hideElement(n.confirmControls.input),n.hideElement(n.confirmControls.sendCodeButton),n.hideElement(n.confirmControls.container),n.hideElement(n.confirmControls.countDown),n.hideElement(n.confirmControls.requestConfirmError),n.hideElement(n.confirmControls.requestConfirmContainer),e&&(n.formControls.tokenInput.value=e),n.options.confirmedInputClassName&&n.formControls.input.classList.add(n.options.confirmedInputClassName),r.value='',n.options.errorClassName&&r.classList.remove(n.options.errorClassName),n.removeFieldFromCheck()})).catch((t=>{n.options.errorClassName&&r.classList.add(n.options.errorClassName),t.messages&&n.confirmControls.requestConfirmError&&(n.confirmControls.requestConfirmError.innerText=String(t.messages),n.showElement(n.confirmControls.requestConfirmError))})).finally((()=>{n.attemptToEnableSubmit(),r.removeAttribute('disabled')})))}}},this.addFieldForCheck=()=>{if(n.formControls.form){var t=n.formCheckState;t&&!t.includes(n.fieldType)&&n.formControls.form.setAttribute(n.formCheckAttrName,[].concat(No(t),[n.fieldType]).join(','))}},this.removeFieldFromCheck=()=>{var t=n.formCheckState;if(t.includes(n.fieldType)){var r=t.filter((t=>t!==n.fieldType));if(!n.formControls.form)return;r.length?n.formControls.form.setAttribute(n.formCheckAttrName,r.join(',')):n.formControls.form.removeAttribute(n.formCheckAttrName)}},this.toggleInputParents=t=>{var r=n.options.inputParentsToHide;if(r)for(var e=0;e<=r.length;e++){var o=n.formControls.input.closest(r[e]);o&&n.options.hiddenClassName&&(t?o.classList.remove(n.options.hiddenClassName):o.classList.add(n.options.hiddenClassName))}},this.disableSubmit=()=>{n.formControls.form&&n.formControls.form.setAttribute(n.formPreventSubmitAttr,String(!0)),n.formControls.submitButton&&(n.formControls.submitButton.setAttribute('disabled','disabled'),n.options.disabledClassName&&n.formControls.submitButton.classList.add(n.options.disabledClassName))},this.attemptToEnableSubmit=()=>{n.formCheckState.length===0&&(n.formControls.form&&n.formControls.form.removeAttribute(n.formPreventSubmitAttr),n.formControls.submitButton&&(n.formControls.submitButton.removeAttribute('disabled'),n.options.disabledClassName&&n.formControls.submitButton.classList.remove(n.options.disabledClassName)))},this.retryListener=()=>{var t=n.requestData;t&&n.requestCode(t).then((t=>{n.retryCounter(t.nextDeliveryAt)}))},this.retryCounter=t=>{if(!n.state.isConfirmed)var r=setInterval((()=>{var e=n.getDiffSeconds(t);e>0&&!n.state.isConfirmed?(n.hideElement(n.confirmControls.retryButton),n.showElement(n.confirmControls.countDown),n.updateRetryHintText(e)):(n.state.isConfirmed||n.showElement(n.confirmControls.retryButton),n.hideElement(n.confirmControls.countDown),clearInterval(r))}),1e3)},this.showElement=t=>{t&&t.style.removeProperty('display')},this.hideElement=t=>{t&&(t.style.display='none')},this.getDiffSeconds=t=>Math.round((Date.parse(t)-Date.now())/1e3),this.destroy=()=>{n.formControls.input&&n.formControls.input.removeEventListener('keyup',n.inputListener),n.confirmControls.input&&n.confirmControls.input.removeEventListener('input',n.confirmInputListener),n.confirmControls.sendCodeButton&&n.confirmControls.sendCodeButton.removeEventListener('click',n.sendCodeListener),n.confirmControls.retryButton&&n.confirmControls.retryButton.removeEventListener('click',n.retryListener),n.confirmControls.requestConfirmButton&&n.confirmControls.requestConfirmButton.removeEventListener('click',n.requestConfirmListener),n.confirmControls.container=null,n.confirmControls.input=null,n.confirmControls.countDown=null,n.confirmControls.retryButton=null,n.confirmControls.requestConfirmContainer=null,n.confirmControls.requestConfirmButton=null,n.confirmControls.requestConfirmHint=null,n.confirmControls.requestConfirmError=null,n.confirmControls.sendCodeButton=null},this.options=yo(go,e);var o=r.closest('form');this.formControls={input:r,tokenInput:document.createElement('input'),form:r.closest('form'),submitButton:o?o.querySelector('[type="submit"]'):null},this.formControls.tokenInput.type='hidden',this.formControls.tokenInput.name='verification_token',this.state.isConfirmed=this.isConfirmed,this.state.dataToConfirm=this.userPhoneWithoutFormatting||'',this.state.confirmedData=this.confirmedData,this.confirmControls={container:document.createElement('div'),input:document.createElement('input'),countDown:document.createElement('div'),retryButton:document.createElement('div'),requestConfirmContainer:document.createElement('div'),requestConfirmButton:document.createElement('div'),requestConfirmHint:document.createElement('div'),requestConfirmError:document.createElement('div'),sendCodeButton:document.createElement('div')}}var r,e;var n;var o;return r=t,e=[{key:"apply",value:function(t){var r,e,n,o,i,a;if(this.formControls.input.ffcc===void 0||this.formControls.input.ffcc===null){this.api=t.foxApi,this.formControls.input.ffcc=this;var s=this.state,l=s.isConfirmRequested,u=s.isConfirmed,c=s.dataToConfirm;var f=this.formControls.input;var m=this.confirmControls,d=m.container,h=m.input,p=m.countDown,v=m.retryButton,C=m.requestConfirmContainer,y=m.requestConfirmButton,b=m.requestConfirmHint,g=m.requestConfirmError,_=m.sendCodeButton;if(!this.formControls.form)throw new Error("Form not found");if(!f.parentNode)throw new Error("Input without parent");if(!(h&&d&&p&&v&&C&&y&&b&&g&&_))throw new Error("Initialization failed");var w=["".concat(this.options.className,"__input")].concat(No(Array.from(this.formControls.input.classList)));h.maxLength=4,h.pattern='[0-9]{4}',(r=h.classList).add.apply(r,No(w)),h.placeholder=(e=this.options.confirmCodePlaceholderText)!==null&&e!==void 0?e:'',this.formControls.form.prepend(this.formControls.tokenInput),u&&this.options.confirmedInputClassName&&f.classList.add(this.options.confirmedInputClassName),u||(this.addFieldForCheck(),this.disableSubmit()),l||this.hideElement(h),d.classList.add("".concat(this.options.className)),p.classList.add("".concat(this.options.className,"__countdown")),v.classList.add("".concat(this.options.className,"__button")),v.innerText=(n=this.options.retryButtonText)!==null&&n!==void 0?n:'',_.classList.add("".concat(this.options.className,"__send-code-button")),this.options.disabledClassName&&_.classList.add(this.options.disabledClassName),_.innerText=(o=this.options.sendCodeButtonText)!==null&&o!==void 0?o:'',g.classList.add("".concat(this.options.className,"__error")),d.appendChild(h),d.appendChild(g),d.appendChild(p),d.appendChild(_),d.appendChild(v),f.parentNode.insertBefore(d,f.nextSibling),C.classList.add("".concat(this.options.className,"__button-container")),y.classList.add("".concat(this.options.className,"__button")),y.innerText=(i=this.options.requestButtonText)!==null&&i!==void 0?i:'',b.innerText=(a=this.options.unconfirmedHintText)!==null&&a!==void 0?a:'',b.classList.add("".concat(this.options.className,"__hint")),(!c||c&&u)&&this.hideConfirmButtonAndHint(),this.hideElement(p),this.hideElement(g),this.hideElement(v),this.hideElement(_),C.appendChild(b),C.appendChild(y),d.appendChild(C),this.bindListeners()}}},{key:"requestCode",value:(o=Ao(Oo().mark((function t(r){return Oo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.api){t.next=2;break}throw new Error(Po);case 2:return t.next=4,this.api.post(this.requestUrl,r);case 4:return t.abrupt("return",t.sent.data);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"confirmCode",value:(n=Ao(Oo().mark((function t(r){return Oo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.api){t.next=2;break}throw new Error(Po);case 2:return t.next=4,this.api.post(this.confirmUrl,r);case 4:return t.abrupt("return",t.sent.data);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"isConfirmed",get:function(){return this.options.userData.phoneConfirmed}},{key:"confirmedData",get:function(){return this.isConfirmed?this.userPhoneWithoutFormatting:''}},{key:"userPhoneWithoutFormatting",get:function(){return this.cleanPhoneFormatting(this.options.userData.phone)}},{key:"requestUrl",get:()=>'/api/phone_confirmation_codes'},{key:"confirmUrl",get:()=>'/api/phone_confirmations'},{key:"requestData",get:function(){return{phone:this.state.dataToConfirm,type:'sms'}}},{key:"confirmData",get:function(){return{code:this.confirmControls.input?this.confirmControls.input.value:'',phone:this.state.dataToConfirm}}},{key:"formCheckState",get:function(){if(!this.formControls.form)return[];var t=this.formControls.form.getAttribute(this.formCheckAttrName)||'';return t===''?[]:t.split(',')}},{key:"cleanPhoneFormatting",value:t=>t.replace(/[-+ ()]/g,'')},{key:"showConfirmButtonAndHint",value:function(){this.showElement(this.confirmControls.container),this.showElement(this.confirmControls.requestConfirmContainer),this.showElement(this.confirmControls.requestConfirmButton),this.showElement(this.confirmControls.requestConfirmHint)}},{key:"hideConfirmButtonAndHint",value:function(){this.hideElement(this.confirmControls.requestConfirmButton),this.hideElement(this.confirmControls.requestConfirmHint)}}],e&&((t,r)=>{for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}})(r.prototype,e),t}(); | ||
'use strict';function Ao(t,r,e,n,o,i,a){try{var s=t[i](a);var l=s.value}catch(t){return void e(t)}s.done?r(l):Promise.resolve(l).then(n,o)}function Bo(t){return function(){var r=this,e=arguments;return new Promise(((n,o)=>{var i=t.apply(r,e);function a(t){Ao(i,n,o,a,s,"next",t)}function s(t){Ao(i,n,o,a,s,"throw",t)}a(void 0)}))}}function No(t,r){(r==null||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function qo(t){return(t=>{if(Array.isArray(t))return No(t)})(t)||(t=>{if(typeof Symbol!="undefined"&&Symbol.iterator in Object(t))return Array.from(t)})(t)||((t,r)=>{if(t){if(typeof t=="string")return No(t,r);var e={}.toString.call(t).slice(8,-1);return e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set"?Array.from(t):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?No(t,r):void 0}})(t)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}var cr=typeof globalThis!='undefined'?globalThis:typeof window!='undefined'?window:typeof global!='undefined'?global:typeof self!='undefined'?self:{};var pr=(t,r)=>t===r||t!=t&&r!=r;var dr=pr;var yr=(t,r)=>{var e=t.length;for(;e--;)if(dr(t[e][0],r))return e;return-1};var fr=yr;var gr=[].splice;var br=yr;var mr=yr;var _r=yr;function Sr(t){var r=-1,e=t==null?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}Sr.prototype.clear=function(){this.__data__=[],this.size=0},Sr.prototype.delete=function(t){var r=this.__data__,e=fr(r,t);return!(e<0||(e==r.length-1?r.pop():gr.call(r,e,1),--this.size,0))},Sr.prototype.get=function(t){var r=this.__data__,e=br(r,t);return e<0?void 0:r[e][1]},Sr.prototype.has=function(t){return mr(this.__data__,t)>-1},Sr.prototype.set=function(t,r){var e=this.__data__,n=_r(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this};var Or=Sr;var Er=Or;var wr=typeof cr=='object'&&cr&&cr.Object===Object&&cr;var jr=typeof self=='object'&&self&&self.Object===Object&&self;var Ar=wr||jr||Function("","return this")();var Oo=Ar.Symbol;var xr=Object.prototype;var Vr=xr.hasOwnProperty;var Pr=xr.toString;var Tr=Oo?Oo.toStringTag:void 0;var zr={}.toString;var Lr=Oo?Oo.toStringTag:void 0;var kr=t=>t==null?t===void 0?"[object Undefined]":"[object Null]":Lr&&Lr in Object(t)?(t=>{var r=Vr.call(t,Tr),e=t[Tr];try{t[Tr]=void 0;var n=!0}catch(t){}var o=Pr.call(t);return n&&(r?t[Tr]=e:delete t[Tr]),o})(t):(t=>zr.call(t))(t);var Rr=t=>{var r=typeof t;return t!=null&&(r=='object'||r=='function')};var Fr=kr,Dr=Rr;var Hr=t=>{if(!Dr(t))return!1;var r=Fr(t);return r=="[object Function]"||r=="[object GeneratorFunction]"||r=="[object AsyncFunction]"||r=="[object Proxy]"};var Wr=Ar['__core-js_shared__'];var Br=(Ir=/[^.]+$/.exec(Wr&&Wr.keys&&Wr.keys.IE_PROTO||''))?'Symbol(src)_1.'+Ir:'';var Ir;var Mr=(()=>{}).toString;var Nr=Hr,Ur=Rr;var $r=/^\[object .+?Constructor\]$/;var Kr=RegExp('^'+(()=>{}).toString.call({}.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,'\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,'$1.*?')+'$');var Gr=(t,r)=>{var e=((t,r)=>t==null?void 0:t[r])(t,r);return(t=>{return!(!Ur(t)||(r=t,Br&&Br in r))&&(Nr(t)?Kr:$r).test((t=>{if(t!=null){try{return Mr.call(t)}catch(t){}try{return t+''}catch(t){}}return''})(t));var r})(e)?e:void 0};var qr=Gr(Ar,'Map');var Jr=Gr(Object,'create');var Qr=Jr;var Xr=Jr;var Yr={}.hasOwnProperty;var Zr=Jr;var ea={}.hasOwnProperty;var ta=Jr;function ra(t){var r=-1,e=t==null?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}ra.prototype.clear=function(){this.__data__=Qr?Qr(null):{},this.size=0},ra.prototype.delete=function(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r},ra.prototype.get=function(t){var r=this.__data__;if(Xr){var e=r[t];return e==="__lodash_hash_undefined__"?void 0:e}return Yr.call(r,t)?r[t]:void 0},ra.prototype.has=function(t){var r=this.__data__;return Zr?r[t]!==void 0:ea.call(r,t)},ra.prototype.set=function(t,r){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=ta&&r===void 0?"__lodash_hash_undefined__":r,this};var aa=ra,na=Or,oa=qr;var ia=(t,r)=>{var e=t.__data__;return((o=typeof(n=r))=='string'||o=='number'||o=='symbol'||o=='boolean'?n!=='__proto__':n===null)?e[typeof r=='string'?'string':'hash']:e.map;var n,o};var sa=ia;var la=ia;var ua=ia;var ca=ia;function va(t){var r=-1,e=t==null?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}va.prototype.clear=function(){this.size=0,this.__data__={hash:new aa,map:new(oa||na),string:new aa}},va.prototype.delete=function(t){var r=sa(this,t).delete(t);return this.size-=r?1:0,r},va.prototype.get=function(t){return la(this,t).get(t)},va.prototype.has=function(t){return ua(this,t).has(t)},va.prototype.set=function(t,r){var e=ca(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this};var ha=Or,pa=qr,da=va;var ya=Or;function fa(t){var r=this.__data__=new ya(t);this.size=r.size}fa.prototype.clear=function(){this.__data__=new Er,this.size=0},fa.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},fa.prototype.get=function(t){return this.__data__.get(t)},fa.prototype.has=function(t){return this.__data__.has(t)},fa.prototype.set=function(t,r){var e=this.__data__;if(e instanceof ha){var n=e.__data__;if(!pa||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new da(n)}return e.set(t,r),this.size=e.size,this};var ga=fa;var ba=Gr;var ma=(()=>{try{var t=ba(Object,'defineProperty');return t({},'',{}),t}catch(t){}})();var _a=ma;var Sa=(t,r,e)=>{r=='__proto__'&&_a?_a(t,r,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[r]=e};var Oa=Sa,Ea=pr;var wa=(t,r,e)=>{(e!==void 0&&!Ea(t[r],e)||e===void 0&&!(r in t))&&Oa(t,r,e)};var ja={exports:{}};((t,exports)=>{var r=exports&&!exports.nodeType&&exports;var e=r&&ja&&!ja.nodeType&&ja;var n=e&&e.exports===r?Ar.Buffer:void 0,o=n?n.allocUnsafe:void 0;ja.exports=(t,r)=>{if(r)return t.slice();var e=t.length,n=o?o(e):new t.constructor(e);return t.copy(n),n}})(0,ja.exports);var Pa=ja.exports;var Ta=Ar.Uint8Array;var za=Rr;var La=Object.create;var ka=(()=>{function t(){}return r=>{if(!za(r))return{};if(La)return La(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}})();var Ra=(Fa=Object.getPrototypeOf,Da=Object,t=>Fa(Da(t)));var Fa,Da;var Ha=Object.prototype;var Wa=t=>{var r=t&&t.constructor;return t===(typeof r=='function'&&r.prototype||Ha)};var Ba=ka,Ia=Ra,Ma=Wa;var Na=t=>t!=null&&typeof t=='object';var Ua=kr,$a=Na;var Ka=t=>$a(t)&&Ua(t)=="[object Arguments]",Ga=Na;var qa=Object.prototype;var Ja=qa.hasOwnProperty;var Qa=qa.propertyIsEnumerable;var Xa=Ka(function(){return arguments}())?Ka:t=>Ga(t)&&Ja.call(t,'callee')&&!Qa.call(t,'callee');var Ya=Array.isArray;var Za=t=>typeof t=='number'&&t>-1&&t%1==0&&t<=9007199254740991;var en=Hr,tn=Za;var rn=t=>t!=null&&tn(t.length)&&!en(t);var an=rn,nn=Na;var on={exports:{}};var sn=()=>!1;((t,exports)=>{var r=exports&&!exports.nodeType&&exports;var e=r&&on&&!on.nodeType&&on;var n=e&&e.exports===r?Ar.Buffer:void 0;on.exports=(n?n.isBuffer:void 0)||sn})(0,on.exports);var ln=on.exports;var un=kr,cn=Ra,vn=Na;var hn=(()=>{}).toString;var pn={}.hasOwnProperty;var dn=hn.call(Object);var yn=kr,fn=Za,gn=Na;var bn={};bn['[object Float32Array]']=bn['[object Float64Array]']=bn['[object Int8Array]']=bn['[object Int16Array]']=bn['[object Int32Array]']=bn['[object Uint8Array]']=bn['[object Uint8ClampedArray]']=bn['[object Uint16Array]']=bn['[object Uint32Array]']=!0,bn['[object Arguments]']=bn['[object Array]']=bn['[object ArrayBuffer]']=bn['[object Boolean]']=bn['[object DataView]']=bn['[object Date]']=bn['[object Error]']=bn['[object Function]']=bn['[object Map]']=bn['[object Number]']=bn['[object Object]']=bn['[object RegExp]']=bn['[object Set]']=bn['[object String]']=bn['[object WeakMap]']=!1;var mn={exports:{}};((t,exports)=>{var r=exports&&!exports.nodeType&&exports;var e=r&&t&&!t.nodeType&&t;var n=e&&e.exports===r&&wr.process;var o=(()=>{try{return e&&e.require&&e.require('util').types||n&&n.binding&&n.binding('util')}catch(t){}})();t.exports=o})(mn,mn.exports);var _n=mn.exports;var Sn=_n&&_n.isTypedArray;var On=Sn?(vr=Sn,t=>vr(t)):t=>gn(t)&&fn(t.length)&&!!bn[yn(t)];var vr;var En=(t,r)=>{if((r!=='constructor'||typeof t[r]!='function')&&r!='__proto__')return t[r]};var wn=Sa,jn=pr;var An={}.hasOwnProperty;var Cn=(t,r,e)=>{var n=t[r];An.call(t,r)&&jn(n,e)&&(e!==void 0||r in t)||wn(t,r,e)},xn=Sa;var Vn=/^(?:0|[1-9]\d*)$/;var Pn=(t,r)=>{var e=typeof t;return!!(r=r==null?9007199254740991:r)&&(e=='number'||e!='symbol'&&Vn.test(t))&&t>-1&&t%1==0&&t<r};var Tn=Xa,zn=Ya,Ln=ln,kn=Pn,Rn=On;var Fn=Rr,Dn=Wa;var Hn={}.hasOwnProperty;var Wn=rn;var Bn=t=>Wn(t)?(t=>{var r=zn(t),e=!r&&Tn(t),n=!r&&!e&&Ln(t),o=!r&&!e&&!n&&Rn(t),i=r||e||n||o,a=i?((t,r)=>{var e=-1,n=Array(t);for(;++e<t;)n[e]=r(e);return n})(t.length,String):[],s=a.length;for(var l in t)i&&(l=='length'||n&&(l=='offset'||l=='parent')||o&&(l=='buffer'||l=='byteLength'||l=='byteOffset')||kn(l,s))||a.push(l);return a})(t):(t=>{if(!Fn(t))return(t=>{var r=[];if(t!=null)for(var e in Object(t))r.push(e);return r})(t);var r=Dn(t),e=[];for(var n in t)(n!='constructor'||!r&&Hn.call(t,n))&&e.push(n);return e})(t);var In=Bn;var Mn=wa,Nn=Pa,Un=Xa,$n=Ya,Kn=ln,Gn=Hr,qn=Rr,Jn=On,Qn=En;var Xn=ga,Yn=wa,Zn=Rr,eo=Bn,to=En;var ro=t=>t;var ao=Math.max;var no=ma;var oo=Date.now;var io=(t=>{var r=0,e=0;return function(n){var o=oo(),i=16-(o-e);if(e=o,i>0){if(++r>=800)return n}else r=0;return t.apply(void 0,arguments)}})(no?(t,r)=>{return no(t,'toString',{configurable:!0,enumerable:!1,value:(e=r,()=>e),writable:!0});var e}:ro);var so=ro,lo=io;var uo=pr,co=rn,vo=Pn,ho=Rr;var po=function t(r,e,n,o,i){r!==e&&((t,r,e)=>{var n=-1,o=Object(t),i=e(t),a=i.length;for(;a--;){var s=i[++n];if(r(o[s],s)===!1)break}})(e,((a,s)=>{if(i||(i=new Xn),Zn(a))((t,r,e,n,o,i,a)=>{var s=Qn(t,e),l=Qn(r,e),u=a.get(l);if(u)Mn(t,e,u);else{var c=i?i(s,l,e+'',t,r,a):void 0;var f=c===void 0;if(f){var m=$n(l),d=!m&&Kn(l),h=!m&&!d&&Jn(l);c=l,m||d||h?$n(s)?c=s:(t=>nn(t)&&an(t))(s)?c=((t,r)=>{var e=-1,n=t.length;for(r||(r=Array(n));++e<n;)r[e]=t[e];return r})(s):d?(f=!1,c=Nn(l,!0)):h?(f=!1,C=new(v=(p=l).buffer).constructor(v.byteLength),new Ta(C).set(new Ta(v)),c=new p.constructor(C,p.byteOffset,p.length)):c=[]:(t=>{if(!vn(t)||un(t)!="[object Object]")return!1;var r=cn(t);if(r===null)return!0;var e=pn.call(r,'constructor')&&r.constructor;return typeof e=='function'&&e instanceof e&&hn.call(e)==dn})(l)||Un(l)?(c=s,Un(s)?c=((t,r,e)=>{var n=!e;e||(e={});var o=-1,i=r.length;for(;++o<i;){var a=r[o];var s=void 0;s===void 0&&(s=t[a]),n?xn(e,a,s):Cn(e,a,s)}return e})(y=s,In(y)):qn(s)&&!Gn(s)||(c=(t=>typeof t.constructor!='function'||Ma(t)?{}:Ba(Ia(t)))(l))):f=!1}f&&(a.set(l,c),o(c,l,n,i,a),a.delete(l)),Mn(t,e,c)}var p,v,C;var y})(r,e,s,n,t,o,i);else{var l=o?o(to(r,s),a,s+'',r,e,i):void 0;l===void 0&&(l=a),Yn(r,s,l)}}),eo)};var yo=(t=>t&&t.__esModule&&{}.hasOwnProperty.call(t,'default')?t.default:t)((fo=(t,r,e)=>{po(t,r,e)},(t=>lo(function(t,r,e){return r=ao(r===void 0?t.length-1:r,0),function(){var n=arguments,o=-1,i=ao(n.length-r,0),a=Array(i);for(;++o<i;)a[o]=n[r+o];o=-1;var s=Array(r+1);for(;++o<r;)s[o]=n[o];return s[r]=e(a),((t,r,e)=>{switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)})(t,this,s)}}(t,void 0,so),t+''))(((t,r)=>{var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for((o=fo.length>3&&typeof o=='function'?(n--,o):void 0,i&&((t,r,e)=>{if(!ho(e))return!1;var n=typeof r;return!!(n=='number'?co(e)&&vo(r,e.length):n=='string'&&r in e)&&uo(e[r],t)})(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t));++e<n;){var a=r[e];a&&fo(t,a,e)}return t}))));var fo;function So(){So=()=>r;var t,r={},e=Object.prototype,n=e.hasOwnProperty,o=Object.defineProperty||((t,r,e)=>{t[r]=e.value}),i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(t){u=(t,r,e)=>t[r]=e}function c(t,r,e,n){var i=Object.create((r&&r.prototype instanceof C?r:C).prototype),a=new B(n||[]);return o(i,"_invoke",{value:j(t,e,a)}),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=c;var m="suspendedStart",d="suspendedYield",h="executing",p="completed",v={};function C(){}function y(){}function b(){}var g={};u(g,a,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(N([])));w&&w!==e&&n.call(w,a)&&(g=w);var E=b.prototype=C.prototype=Object.create(g);function L(t){["next","throw","return"].forEach((function(r){u(t,r,(function(t){return this._invoke(r,t)}))}))}function x(t,r){function e(o,i,a,s){var l=f(t[o],t,i);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==typeof c&&n.call(c,"__await")?r.resolve(c.__await).then((t=>{e("next",t,a,s)}),(t=>{e("throw",t,a,s)})):r.resolve(c).then((t=>{u.value=t,a(u)}),(t=>e("throw",t,a,s)))}s(l.arg)}var i;o(this,"_invoke",{value:(t,n)=>{function o(){return new r(((r,o)=>{e(t,n,r,o)}))}return i=i?i.then(o,o):o()}})}function j(r,e,n){var o=m;return(i,a)=>{if(o===h)throw new Error("Generator is already running");if(o===p){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var l=T(s,n);if(l){if(l===v)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===m)throw o=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var u=f(r,e,n);if("normal"===u.type){if(o=n.done?p:d,u.arg===v)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=p,n.method="throw",n.arg=u.arg)}}}function T(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,T(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,v;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,v):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function k(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function A(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function B(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function N(r){if(r||""===r){var e=r[a];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,i=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return y.prototype=b,o(E,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:y,configurable:!0}),y.displayName=u(b,l,"GeneratorFunction"),r.isGeneratorFunction=t=>{var r="function"==typeof t&&t.constructor;return!!r&&(r===y||"GeneratorFunction"===(r.displayName||r.name))},r.mark=t=>(Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,l,"GeneratorFunction")),t.prototype=Object.create(E),t),r.awrap=t=>({__await:t}),L(x.prototype),u(x.prototype,s,(function(){return this})),r.AsyncIterator=x,r.async=(t,e,n,o,i)=>{void 0===i&&(i=Promise);var a=new x(c(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((t=>t.done?t.value:a.next()))},L(E),u(E,l,"Generator"),u(E,a,(function(){return this})),u(E,"toString",(()=>"[object Generator]")),r.keys=t=>{var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=N,B.prototype={constructor:B,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return s.type="throw",s.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(l&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),v},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),A(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;A(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:N(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),v}},r}var go={className:'foxford-phone-confirm',errorClassName:'is-error',disabledClassName:'is-disabled',hiddenClassName:'is-hidden',confirmedInputClassName:'is-confirmed',confirmCodePlaceholderText:'Введите код',confirmCodeInvalidText:'Должен состоять из 4 символов',inputParentsToHide:[],requestButtonText:'Подтвердить',retryButtonText:'Выслать код повторно',sendCodeButtonText:'Отправить код',unconfirmedHintText:'Не подтвержден',untilRetryText:'Выслать код повторно через',userData:{phone:'',phoneConfirmed:!1}};var Po={isConfirmRequested:!1,isConfirmed:!1,dataToConfirm:'',confirmedData:''};var Io='Api not specified';exports.ConfirmPhone=function(){function t(r,e){var n=this;((t,r)=>{if(!(this instanceof r))throw new TypeError("Cannot call a class as a function")})(0,t),this.api=void 0,this.fieldType='phone',this.options=void 0,this.formCheckAttrName='data-fields-to-confirm',this.formPreventSubmitAttr='data-prevent-submit',this.state=Po,this.formControls=void 0,this.confirmControls=void 0,this.bindListeners=()=>{n.formControls.input.addEventListener('keyup',n.inputListener),n.confirmControls.input&&n.confirmControls.input.addEventListener('input',n.confirmInputListener),n.confirmControls.sendCodeButton&&n.confirmControls.sendCodeButton.addEventListener('click',n.sendCodeListener),n.confirmControls.retryButton&&n.confirmControls.retryButton.addEventListener('click',n.retryListener),n.confirmControls.requestConfirmButton&&n.confirmControls.requestConfirmButton.addEventListener('click',n.requestConfirmListener)},this.inputListener=()=>{n.state.dataToConfirm=n.cleanPhoneFormatting(n.formControls.input.value),n.state.isConfirmed=n.state.dataToConfirm===n.state.confirmedData,n.options.confirmedInputClassName&&(n.hideElement(n.confirmControls.requestConfirmError),n.state.dataToConfirm&&!n.state.isConfirmed?(n.formControls.input.classList.remove(n.options.confirmedInputClassName),n.showConfirmButtonAndHint(),n.addFieldForCheck(),n.disableSubmit()):(n.formControls.input.classList.add(n.options.confirmedInputClassName),n.removeFieldFromCheck(),n.attemptToEnableSubmit(),n.confirmControls.input&&n.hideElement(n.confirmControls.input),n.hideConfirmButtonAndHint()))},this.updateRetryHintText=t=>{n.confirmControls.countDown&&(n.confirmControls.countDown.innerText="".concat(n.options.untilRetryText," ").concat(t))},this.requestConfirmListener=()=>{if(n.state.dataToConfirm&&!n.state.isConfirmed&&!n.state.isConfirmRequested){var t=n.requestData;if(!t)return;n.state.isConfirmRequested=!0,n.options.disabledClassName&&n.confirmControls.requestConfirmButton&&n.confirmControls.requestConfirmButton.classList.add(n.options.disabledClassName),n.requestCode(t).then((t=>{var r=t.nextDeliveryAt;if(r&&typeof r!='function'){var e=n.getDiffSeconds(r);e>0&&!n.state.isConfirmed&&(n.toggleInputParents(!1),n.hideElement(n.formControls.input),n.showElement(n.confirmControls.container),n.showElement(n.confirmControls.input),n.showElement(n.confirmControls.countDown),n.showElement(n.confirmControls.sendCodeButton),n.hideElement(n.confirmControls.retryButton),n.hideElement(n.confirmControls.requestConfirmError),n.updateRetryHintText(e)),n.hideConfirmButtonAndHint(),n.retryCounter(r)}})).catch((t=>{t.errors&&t.errors[n.fieldType]&&n.confirmControls.requestConfirmError&&(n.confirmControls.requestConfirmError.innerText=String(t.errors[n.fieldType]),n.showElement(n.confirmControls.requestConfirmError))})).finally((()=>{n.state.isConfirmRequested=!1,n.options.disabledClassName&&n.confirmControls.requestConfirmButton&&n.confirmControls.requestConfirmButton.classList.remove(n.options.disabledClassName)}))}},this.validateConfirmInput=()=>!(n.confirmControls.input&&!n.confirmControls.input.value||!n.confirmControls.input)&&n.confirmControls.input.value.length===4,this.confirmInputListener=()=>{if(n.confirmControls.sendCodeButton&&n.options.disabledClassName&&n.confirmControls.input){var t=n.confirmControls.input;n.confirmControls.input.value=t.value.replace(/[^0-9]/g,'');var r=n.validateConfirmInput();n.options.errorClassName&&t.classList.remove(n.options.errorClassName),r?n.confirmControls.sendCodeButton.classList.remove(n.options.disabledClassName):n.confirmControls.sendCodeButton.classList.add(n.options.disabledClassName),n.sendCodeListener()}},this.sendCodeListener=()=>{if(n.validateConfirmInput()){var t=n.confirmData;if(t){var r=n.confirmControls.input;r&&(r.setAttribute('disabled','disabled'),n.confirmCode(t).then((t=>{var e=t.verificationToken;n.state.isConfirmed=!0,n.state.confirmedData=n.state.dataToConfirm,n.toggleInputParents(!0),n.showElement(n.formControls.input),n.hideElement(n.confirmControls.input),n.hideElement(n.confirmControls.sendCodeButton),n.hideElement(n.confirmControls.container),n.hideElement(n.confirmControls.countDown),n.hideElement(n.confirmControls.requestConfirmError),n.hideElement(n.confirmControls.requestConfirmContainer),e&&(n.formControls.tokenInput.value=e),n.options.confirmedInputClassName&&n.formControls.input.classList.add(n.options.confirmedInputClassName),r.value='',n.options.errorClassName&&r.classList.remove(n.options.errorClassName),n.removeFieldFromCheck()})).catch((t=>{n.options.errorClassName&&r.classList.add(n.options.errorClassName),t.messages&&n.confirmControls.requestConfirmError&&(n.confirmControls.requestConfirmError.innerText=String(t.messages),n.showElement(n.confirmControls.requestConfirmError))})).finally((()=>{n.attemptToEnableSubmit(),r.removeAttribute('disabled')})))}}},this.addFieldForCheck=()=>{if(n.formControls.form){var t=n.formCheckState;t&&!t.includes(n.fieldType)&&n.formControls.form.setAttribute(n.formCheckAttrName,[].concat(qo(t),[n.fieldType]).join(','))}},this.removeFieldFromCheck=()=>{var t=n.formCheckState;if(t.includes(n.fieldType)){var r=t.filter((t=>t!==n.fieldType));if(!n.formControls.form)return;r.length?n.formControls.form.setAttribute(n.formCheckAttrName,r.join(',')):n.formControls.form.removeAttribute(n.formCheckAttrName)}},this.toggleInputParents=t=>{var r=n.options.inputParentsToHide;if(r)for(var e=0;e<=r.length;e++){var o=n.formControls.input.closest(r[e]);o&&n.options.hiddenClassName&&(t?o.classList.remove(n.options.hiddenClassName):o.classList.add(n.options.hiddenClassName))}},this.disableSubmit=()=>{n.formControls.form&&n.formControls.form.setAttribute(n.formPreventSubmitAttr,String(!0)),n.formControls.submitButton&&(n.formControls.submitButton.setAttribute('disabled','disabled'),n.options.disabledClassName&&n.formControls.submitButton.classList.add(n.options.disabledClassName))},this.attemptToEnableSubmit=()=>{n.formCheckState.length===0&&(n.formControls.form&&n.formControls.form.removeAttribute(n.formPreventSubmitAttr),n.formControls.submitButton&&(n.formControls.submitButton.removeAttribute('disabled'),n.options.disabledClassName&&n.formControls.submitButton.classList.remove(n.options.disabledClassName)))},this.retryListener=()=>{var t=n.requestData;t&&n.requestCode(t).then((t=>{n.retryCounter(t.nextDeliveryAt)}))},this.retryCounter=t=>{if(!n.state.isConfirmed)var r=setInterval((()=>{var e=n.getDiffSeconds(t);e>0&&!n.state.isConfirmed?(n.hideElement(n.confirmControls.retryButton),n.showElement(n.confirmControls.countDown),n.updateRetryHintText(e)):(n.state.isConfirmed||n.showElement(n.confirmControls.retryButton),n.hideElement(n.confirmControls.countDown),clearInterval(r))}),1e3)},this.showElement=t=>{t&&t.style.removeProperty('display')},this.hideElement=t=>{t&&(t.style.display='none')},this.getDiffSeconds=t=>Math.round((Date.parse(t)-Date.now())/1e3),this.destroy=()=>{n.formControls.input&&n.formControls.input.removeEventListener('keyup',n.inputListener),n.confirmControls.input&&n.confirmControls.input.removeEventListener('input',n.confirmInputListener),n.confirmControls.sendCodeButton&&n.confirmControls.sendCodeButton.removeEventListener('click',n.sendCodeListener),n.confirmControls.retryButton&&n.confirmControls.retryButton.removeEventListener('click',n.retryListener),n.confirmControls.requestConfirmButton&&n.confirmControls.requestConfirmButton.removeEventListener('click',n.requestConfirmListener),n.confirmControls.container=null,n.confirmControls.input=null,n.confirmControls.countDown=null,n.confirmControls.retryButton=null,n.confirmControls.requestConfirmContainer=null,n.confirmControls.requestConfirmButton=null,n.confirmControls.requestConfirmHint=null,n.confirmControls.requestConfirmError=null,n.confirmControls.sendCodeButton=null},this.options=yo(go,e);var o=r.closest('form');this.formControls={input:r,tokenInput:document.createElement('input'),form:r.closest('form'),submitButton:o?o.querySelector('[type="submit"]'):null},this.formControls.tokenInput.type='hidden',this.formControls.tokenInput.name='verification_token',this.state.isConfirmed=this.isConfirmed,this.state.dataToConfirm=this.userPhoneWithoutFormatting||'',this.state.confirmedData=this.confirmedData,this.confirmControls={container:document.createElement('div'),input:document.createElement('input'),countDown:document.createElement('div'),retryButton:document.createElement('div'),requestConfirmContainer:document.createElement('div'),requestConfirmButton:document.createElement('div'),requestConfirmHint:document.createElement('div'),requestConfirmError:document.createElement('div'),sendCodeButton:document.createElement('div')}}var r,e;var n;var o;return r=t,e=[{key:"apply",value:function(t){var r,e,n,o,i,a;if(this.formControls.input.ffcc===void 0||this.formControls.input.ffcc===null){this.api=t.foxApi,this.formControls.input.ffcc=this;var s=this.state,l=s.isConfirmRequested,u=s.isConfirmed,c=s.dataToConfirm;var f=this.formControls.input;var m=this.confirmControls,d=m.container,h=m.input,p=m.countDown,v=m.retryButton,C=m.requestConfirmContainer,y=m.requestConfirmButton,b=m.requestConfirmHint,g=m.requestConfirmError,_=m.sendCodeButton;if(!this.formControls.form)throw new Error("Form not found");if(!f.parentNode)throw new Error("Input without parent");if(!(h&&d&&p&&v&&C&&y&&b&&g&&_))throw new Error("Initialization failed");var w=["".concat(this.options.className,"__input")].concat(qo(Array.from(this.formControls.input.classList)));h.maxLength=4,h.pattern='[0-9]{4}',(r=h.classList).add.apply(r,qo(w)),h.placeholder=(e=this.options.confirmCodePlaceholderText)!==null&&e!==void 0?e:'',this.formControls.form.prepend(this.formControls.tokenInput),u&&this.options.confirmedInputClassName&&f.classList.add(this.options.confirmedInputClassName),u||(this.addFieldForCheck(),this.disableSubmit()),l||this.hideElement(h),d.classList.add("".concat(this.options.className)),p.classList.add("".concat(this.options.className,"__countdown")),v.classList.add("".concat(this.options.className,"__button")),v.innerText=(n=this.options.retryButtonText)!==null&&n!==void 0?n:'',_.classList.add("".concat(this.options.className,"__send-code-button")),this.options.disabledClassName&&_.classList.add(this.options.disabledClassName),_.innerText=(o=this.options.sendCodeButtonText)!==null&&o!==void 0?o:'',g.classList.add("".concat(this.options.className,"__error")),d.appendChild(h),d.appendChild(g),d.appendChild(p),d.appendChild(_),d.appendChild(v),f.parentNode.insertBefore(d,f.nextSibling),C.classList.add("".concat(this.options.className,"__button-container")),y.classList.add("".concat(this.options.className,"__button")),y.innerText=(i=this.options.requestButtonText)!==null&&i!==void 0?i:'',b.innerText=(a=this.options.unconfirmedHintText)!==null&&a!==void 0?a:'',b.classList.add("".concat(this.options.className,"__hint")),(!c||c&&u)&&this.hideConfirmButtonAndHint(),this.hideElement(p),this.hideElement(g),this.hideElement(v),this.hideElement(_),C.appendChild(b),C.appendChild(y),d.appendChild(C),this.bindListeners()}}},{key:"requestCode",value:(o=Bo(So().mark((function t(r){return So().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.api){t.next=2;break}throw new Error(Io);case 2:return t.next=4,this.api.post(this.requestUrl,r);case 4:return t.abrupt("return",t.sent.data);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"confirmCode",value:(n=Bo(So().mark((function t(r){return So().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.api){t.next=2;break}throw new Error(Io);case 2:return t.next=4,this.api.post(this.confirmUrl,r);case 4:return t.abrupt("return",t.sent.data);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"isConfirmed",get:function(){return this.options.userData.phoneConfirmed}},{key:"confirmedData",get:function(){return this.isConfirmed?this.userPhoneWithoutFormatting:''}},{key:"userPhoneWithoutFormatting",get:function(){return this.cleanPhoneFormatting(this.options.userData.phone)}},{key:"requestUrl",get:()=>'/api/phone_confirmation_codes'},{key:"confirmUrl",get:()=>'/api/phone_confirmations'},{key:"requestData",get:function(){return{phone:this.state.dataToConfirm,type:'sms'}}},{key:"confirmData",get:function(){return{code:this.confirmControls.input?this.confirmControls.input.value:'',phone:this.state.dataToConfirm}}},{key:"formCheckState",get:function(){if(!this.formControls.form)return[];var t=this.formControls.form.getAttribute(this.formCheckAttrName)||'';return t===''?[]:t.split(',')}},{key:"cleanPhoneFormatting",value:t=>t.replace(/[-+ ()]/g,'')},{key:"showConfirmButtonAndHint",value:function(){this.showElement(this.confirmControls.container),this.showElement(this.confirmControls.requestConfirmContainer),this.showElement(this.confirmControls.requestConfirmButton),this.showElement(this.confirmControls.requestConfirmHint)}},{key:"hideConfirmButtonAndHint",value:function(){this.hideElement(this.confirmControls.requestConfirmButton),this.hideElement(this.confirmControls.requestConfirmHint)}}],e&&((t,r)=>{for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}})(r.prototype,e),t}(); | ||
//# sourceMappingURL=confirm-phone.js.map |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
495624
1
2