%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 18.217.104.118
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64
User : www-root ( 1010)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/dev.artlot24.ru/bitrix/js/main/phonenumber/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/js/main/phonenumber/phonenumber.min.js
(function(){if(BX.PhoneNumber)return;var t;var e=null;var r=false;var n="/bitrix/js/main/phonenumber/metadata.json";var a="/bitrix/tools/phone_number.php";var o={};var i;var u=3;var s=2;var l=17;var h=250;var f="+";var c="0-9";var p="-";var m="/";var y=".";var N="\\s";var g="()\\[\\]";var d="~";var v=";#";var b=",";var P="["+f+c+"]";var C="[^"+c+v+b+"]+$";var x="["+c+"]{"+s+"}";var B=p+m+y+N+g+d+v+b;var X=c+f+v+b;var w="["+f+"]{0,1}"+"(?:"+"["+B+"]*"+"["+c+"]"+"){3,}"+"["+B+c+"]*";var F="^(?:"+"^"+x+"$"+"|"+"^"+w+"$"+")$";var I=function(){if(r){var t=new BX.Promise;t.fulfill({codeToCountries:i,metadata:o});return t}else if(e){return e}else{e=new BX.Promise;BX.ajax.load({url:n,type:"json",callback:function(t){i=t.codeToCountries;o=t.metadata;t.metadata.forEach(function(t){o[t["id"]]=t});r=true;e.fulfill({codeToCountries:i,metadata:o})}});return e}};BX.PhoneNumber=function(){this.rawNumber=null;this.country=null;this.valid=false;this.countryCode=null;this.nationalNumber=null;this.numberType=null;this.extension=null;this.extensionSeparator=null;this.international=false;this.nationalPrefix=null;this.hasPlusChar=false};BX.PhoneNumber.Format={E164:"E.164",INTERNATIONAL:"International",NATIONAL:"National"};BX.PhoneNumber.getDefaultCountry=function(){return BX.message("phone_number_default_country")};BX.PhoneNumber.getUserDefaultCountry=function(){return BX.message("user_default_country")};BX.PhoneNumber.getIncompleteFormatter=function(t){var e=new BX.Promise;if(r){e.fulfill(new BX.PhoneNumber.IncompleteFormatter(t))}else{I().then(function(){e.fulfill(new BX.PhoneNumber.IncompleteFormatter(t))})}return e};BX.PhoneNumber.getValidNumberPattern=function(){return w};BX.PhoneNumber.getValidNumberRegex=function(){return new RegExp(w)};BX.PhoneNumber.prototype.format=function(t){if(this.valid){if(!t){return BX.PhoneNumberFormatter.formatOriginal(this)}else{return BX.PhoneNumberFormatter.format(this,t)}}else{if(z.isApplicable(this.getRawNumber())){return z.format(this.getRawNumber())}else{return this.rawNumber}}};BX.PhoneNumber.prototype.getRawNumber=function(){return this.rawNumber};BX.PhoneNumber.prototype.setRawNumber=function(t){this.rawNumber=t};BX.PhoneNumber.prototype.getCountry=function(){return this.country};BX.PhoneNumber.prototype.setCountry=function(t){this.country=t};BX.PhoneNumber.prototype.isValid=function(){return this.valid};BX.PhoneNumber.prototype.setValid=function(t){this.valid=t};BX.PhoneNumber.prototype.getCountryCode=function(){return this.countryCode};BX.PhoneNumber.prototype.setCountryCode=function(t){this.countryCode=t};BX.PhoneNumber.prototype.getNationalNumber=function(){return this.nationalNumber};BX.PhoneNumber.prototype.setNationalNumber=function(t){this.nationalNumber=t};BX.PhoneNumber.prototype.getNumberType=function(){return this.numberType};BX.PhoneNumber.prototype.setNumberType=function(t){this.numberType=t};BX.PhoneNumber.prototype.hasExtension=function(){return!!this.extension};BX.PhoneNumber.prototype.getExtension=function(){return this.extension};BX.PhoneNumber.prototype.setExtension=function(t){this.extension=t};BX.PhoneNumber.prototype.getExtensionSeparator=function(){return this.extensionSeparator};BX.PhoneNumber.prototype.setExtensionSeparator=function(t){this.extensionSeparator=t};BX.PhoneNumber.prototype.isInternational=function(){return this.international};BX.PhoneNumber.prototype.setInternational=function(t){this.international=t};BX.PhoneNumber.prototype.getNationalPrefix=function(){return this.nationalPrefix};BX.PhoneNumber.prototype.setNationalPrefix=function(t){this.nationalPrefix=t};BX.PhoneNumber.prototype.hasPlus=function(){return this.hasPlusChar};BX.PhoneNumber.prototype.setHasPlus=function(t){this.hasPlusChar=t};BX.PhoneNumberParser=function(){};BX.PhoneNumberParser.getInstance=function(){if(!(t instanceof BX.PhoneNumberParser))t=new BX.PhoneNumberParser;return t};BX.PhoneNumberParser.prototype.parse=function(t,e){var n=this;var a=new BX.Promise;if(!e)e=BX.PhoneNumber.getDefaultCountry();if(r){a.fulfill(n._realParse(t,e))}else{I().then(function(){a.fulfill(n._realParse(t,e))})}return a};BX.PhoneNumberParser.prototype._realParse=function(t,e){var r=new BX.PhoneNumber;r.setRawNumber(t);var n=W(t);if(!j(n)){return r}var a=U(n);var o=a.extension;var i=a.extensionSeparator;n=a.phoneNumber;var u=H(n);if(u===false){return r}var s;var h=u["countryCode"];var f=u["localNumber"];var c;var p;var m=false;if(h){c=true;m=true;p=G(h);s=null}else if(!e){return r}else{s=e;p=nt(s);if(!p)return r;h=p["countryCode"];var y=Z(f,p);c=y!==f;f=y}if(!p){return r}var N=J(f,p);var g=false;var d="";if(N!==f){g=Q(N,p);if(g){d=f.substr(0,f.length-N.length);f=N}}if(s===null){s=K(h,f);if(!s){return r}p=nt(s)}if(f.length>l){return r}var v=new RegExp("^(?:"+p["generalDesc"]["nationalNumberPattern"]+")$");if(!f.match(v)){return r}var b=q(f,s);r.setCountry(s);r.setCountryCode(h);r.setNationalNumber(f);r.setNumberType(b);r.setInternational(c);r.setHasPlus(m);r.setNationalPrefix(d);r.setExtension(o);r.setExtensionSeparator(i);r.setValid(b!==false);return r};BX.PhoneNumberFormatter={};BX.PhoneNumberFormatter.format=function(t,e){if(!(t instanceof BX.PhoneNumber)){throw new Error("number should be instance of BX.PhoneNumber")}if(!r){throw new Error("Metadata should be loaded prior to calling format")}if(!t.isValid())return t.getRawNumber();if(e===BX.PhoneNumber.Format.E164){var n="+"+t.getCountryCode()+t.getNationalNumber()+(t.hasExtension()?t.getExtensionSeparator()+" "+t.getExtension():"");return n}var a=nt(t.getCountry());var o=e===BX.PhoneNumber.Format.INTERNATIONAL;var i=this.selectFormatForNumber(t.getNationalNumber(),o,a);if(i){var u=this.formatNationalNumber(t.getNationalNumber(),o,a,i)}else{u=t.getNationalNumber()}if(t.hasExtension()){u+=t.getExtensionSeparator()+" "+t.getExtension()}if(e===BX.PhoneNumber.Format.INTERNATIONAL){return"+"+t.getCountryCode()+" "+u}else if(e===BX.PhoneNumber.Format.NATIONAL){return u}return t.getRawNumber()};BX.PhoneNumberFormatter.formatOriginal=function(t){if(!t.isValid())return t.getRawNumber();var e=this.selectOriginalFormatForNumber(t);if(!e)return t.getRawNumber();var r=this.formatNationalNumberWithOriginalFormat(t,e);if(t.hasExtension()){r+=t.getExtensionSeparator()+" "+t.getExtension()}if(t.isInternational()){var n=(t.hasPlus()?"+":"")+t.getCountryCode()+" "+r}else{n=r}var a=mt(n);var o=mt(t.getRawNumber());if(a!==o){n=t.getRawNumber()}return n};BX.PhoneNumberFormatter.selectFormatForNumber=function(t,e,r){var n=it(r);for(var a=0;a<n.length;a++){var o=n[a];if(e&&o.hasOwnProperty("intlFormat")&&o["intlFormat"]==="NA")continue;if(o.hasOwnProperty("leadingDigits")&&!ct(t,o["leadingDigits"])){continue}var i=new RegExp("^"+o["pattern"]+"$");if(t.match(i)){return o}}return false};BX.PhoneNumberFormatter.selectOriginalFormatForNumber=function(t){var e=t.getNationalNumber();var r=t.isInternational();var n=t.getNationalPrefix()!="";var a=nt(t.getCountry());var o=it(a);for(var i=0;i<o.length;i++){var u=o[i];if(r){if(u.hasOwnProperty("intlFormat")&&u["intlFormat"]==="NA"){continue}}else{if(n&&!ft(u,a)){continue}}if(u.hasOwnProperty("leadingDigits")&&!ct(e,u["leadingDigits"])){continue}var s=new RegExp("^"+u["pattern"]+"$");if(e.match(s)){return u}}return false};BX.PhoneNumberFormatter.formatNationalNumber=function(t,e,r,n){var a=n.hasOwnProperty("intlFormat")&&e?n["intlFormat"]:n["format"];var o=new RegExp(n["pattern"]);if(!e){var i=st(n,r);if(i!=""){i=i.replace("$NP",r["nationalPrefix"]).replace("$FG","$1");a=a.replace(new RegExp("(\\$\\d)"),i)}else{a=r["nationalPrefix"]+" "+a}}return t.replace(o,a)};BX.PhoneNumberFormatter.formatNationalNumberWithOriginalFormat=function(t,e){var r=t.isInternational();var n=e.hasOwnProperty("intlFormat")&&r?e["intlFormat"]:e["format"];var a=new RegExp(e["pattern"]);var o=t.getNationalNumber();var i=nt(t.getCountry());var u=ut(i,true);var s=lt(t.getRawNumber(),u,i);if(!r&&s){var l=st(e,i);if(l!=""){l=l.replace("$NP",u).replace("$FG","$1");n=n.replace(new RegExp("(\\$\\d)"),l)}else{n=u+" "+n}}return o.replace(a,n)};BX.PhoneNumberFormatter.getNationalPrefixFormattingRule=function(t,e){var r=st(e,t);return r.replace("$NP",t["nationalPrefix"]).replace("$FG","$1")};BX.PhoneNumberFormatter.getNationalPrefixOptional=function(t,e){if(BX.type.isPlainObject(e)&&e.hasOwnProperty("nationalPrefixOptionalWhenFormatting"))return e["nationalPrefixOptionalWhenFormatting"];else if(t.hasOwnProperty("nationalPrefixOptionalWhenFormatting"))return t["nationalPrefixOptionalWhenFormatting"];else return false};var E="9";var T=new RegExp(E,"g");var R=15;var O=vt(E,R);var S="x";var _=new RegExp(S);var D=new RegExp(S,"g");var L=new RegExp("\\[([^\\[\\]])*\\]","g");var $=new RegExp("\\d(?=[^,}][^,}])","g");var k=new RegExp("^"+"["+B+"]*"+"(\\$\\d["+B+"]*)+"+"$");var A=3;var V="["+f+"]{0,1}"+"["+B+c+"]*";var M=new RegExp("^"+V+"$","i");BX.PhoneNumber.IncompleteFormatter=function(t){if(!r){throw new Error("Metadata is not loaded yet. Do not construct this class directly, use BX.PhoneNumber.getIncompleteFormatter instead")}this.defaultCountry=t||BX.PhoneNumber.getDefaultCountry();this.rawInput="";this.country="";this.countryCode="";this.countryMetadata=null;this.nationalPrefix="";this.nationalNumber="";this.isInternational=false;this.hasNationalPrefix=false;this.hasPlusChar=false;this.formattedNumber=null;this.extension="";this.extensionSeparator=""};BX.PhoneNumber.IncompleteFormatter.prototype.format=function(t){this.resetState();var e=W(t);if(!e&&t[0]===f){this.rawInput=t;this.formattedNumber=t;return t}this.isInternational=e[0]===f;var r=U(e);e=r.phoneNumber;this.extension=r.extension;this.extensionSeparator=r.extensionSeparator;e=mt(e);this.rawInput=e;if(this.isInternational){this.hasPlusChar=true;this.rawInput=f+e}if(this.isInternational){this.extractCountryCode();if(!this.countryCode){return this.rawInput}this.findSuitableCountry()}else if(!this.defaultCountry){return this.rawInput}else{this.country=this.defaultCountry;this.countryMetadata=nt(this.country);if(!this.countryMetadata){return this.rawInput}this.nationalNumber=this.rawInput;this.extractNationalPrefix();if(!this.hasNationalPrefix){this.tryToStripCountryCode()}}return this.getFormattedNumber()};BX.PhoneNumber.IncompleteFormatter.prototype.getFormattedNumber=function(){var t=this.formatNationalNumber();var e=t?t:this.rawInput;if(this.extensionSeparator){e+=this.extensionSeparator+" "+this.extension}return e};BX.PhoneNumber.IncompleteFormatter.prototype.extractCountryCode=function(){var t=H(this.rawInput);if(t&&t["countryCode"]){this.countryCode=t["countryCode"];this.nationalNumber=t["localNumber"]}};BX.PhoneNumber.IncompleteFormatter.prototype.tryToStripCountryCode=function(){var t=this.countryMetadata["countryCode"];var e;if(this.nationalNumber.indexOf(t)===0){e=this.nationalNumber.substr(t.length);if(Y(e,this.countryMetadata,true,false)){this.isInternational=true;this.countryCode=t;this.nationalNumber=e}}};BX.PhoneNumber.IncompleteFormatter.prototype.extractNationalPrefix=function(){var t=J(this.nationalNumber,this.countryMetadata);if(t!==this.nationalNumber){if(!Y(t,this.countryMetadata,false,true)){return false}this.hasNationalPrefix=true;this.nationalPrefix=this.countryMetadata["nationalPrefix"];this.nationalNumber=t;return true}return false};BX.PhoneNumber.IncompleteFormatter.prototype.resetState=function(){this.country=null;this.countryCode="";this.nationalPrefix="";this.nationalNumber=null;this.isInternational=false;this.hasNationalPrefix=false;this.hasPlusChar=false;this.selectedFormat=null;this.formattedNumber=null;this.formattingTemplate=null;this.extension="";this.extensionSeparator=""};BX.PhoneNumber.IncompleteFormatter.prototype.findSuitableCountry=function(){var t=K(this.countryCode,this.nationalNumber);if(t)this.country=t;else this.country=rt(this.countryCode);this.countryMetadata=nt(this.country)};BX.PhoneNumber.IncompleteFormatter.prototype.formatNationalNumber=function(){if(this.isCompleteNumber()){return this.formatCompleteNumber(this.nationalNumber)}if(!this.isInternational&&this.countryCode===""&&this.nationalPrefix===""&&z.isApplicable(this.rawInput)){return z.format(this.rawInput)}if(this.selectFormat()){this.formattedNumber=this.formatUsingTemplate();if(this.isInternational){var t=(this.hasPlusChar?f:"")+this.countryCode+" "+this.formattedNumber}else{t=this.formattedNumber}var e=mt(t);var r=mt(this.rawInput);if(e!==r){t=this.rawInput}return t}};BX.PhoneNumber.IncompleteFormatter.prototype.isCompleteNumber=function(){return q(this.nationalNumber,this.country)?true:false};BX.PhoneNumber.IncompleteFormatter.prototype.selectFormat=function(){var t=it(this.countryMetadata);for(var e=0;e<t.length;e++){var r=t[e];if(!this.isFormatSuitable(r))continue;if(r.hasOwnProperty("leadingDigits")&&!ct(this.nationalNumber,r["leadingDigits"]))continue;if(!this.createFormattingTemplate(r))continue;this.selectedFormat=r;return true}return false};BX.PhoneNumber.IncompleteFormatter.prototype.createFormattingTemplate=function(t){var e=t["pattern"];if(e.indexOf("|")!==-1)return false;this.formattingTemplate="";var r=this.getFormattingTemplate(e,t);if(r){this.formattingTemplate=r;return true}return false};BX.PhoneNumber.IncompleteFormatter.prototype.getFormattingTemplate=function(t,e){var r=pt(e,this.isInternational);var n=t.replace(L,"\\d");n=n.replace($,"\\d");var a=O.match(new RegExp(n))[0];if(this.nationalNumber.length>a.length)return false;if(this.hasNationalPrefix){var o=st(e,this.countryMetadata);if(o){o=o.replace("$NP",this.nationalPrefix).replace("$FG","$1");r=r.replace(new RegExp("(\\$\\d)"),o)}else{r=this.nationalPrefix+" "+r}}var i=a.replace(new RegExp(n,"g"),r);i=i.replace(T,S);return i};BX.PhoneNumber.IncompleteFormatter.prototype.formatUsingTemplate=function(){if(!this.formattingTemplate)return false;var t=this.formattingTemplate;var e;for(var r=0;r<this.nationalNumber.length;r++){e=t.search(_);if(e===-1)return false;t=t.replace(_,this.nationalNumber[r])}t=this.closeLastBracket(t,e+1);return t};BX.PhoneNumber.IncompleteFormatter.prototype.closeLastBracket=function(t,e){var r=t.substr(e);var n=r.indexOf("(");var a=r.indexOf(")");if(a!==-1&&(n===-1||n>a)){e=e+a+1}return t.substr(0,e).replace(D," ")};BX.PhoneNumber.IncompleteFormatter.prototype.formatCompleteNumber=function(){var t=new BX.PhoneNumber;t.setRawNumber(this.rawInput);t.setHasPlus(this.hasPlusChar);t.setInternational(this.isInternational);t.setNationalPrefix(this.nationalPrefix);t.setNationalNumber(this.nationalNumber);t.setCountry(this.country);t.setCountryCode(this.countryCode);var e=BX.PhoneNumberFormatter.selectOriginalFormatForNumber(t);if(!e)return false;var r=BX.PhoneNumberFormatter.formatNationalNumberWithOriginalFormat(t,e);if(this.isInternational){r=(this.hasPlusChar?f:"")+this.countryCode+" "+r}this.selectedFormat=e;return r};BX.PhoneNumber.IncompleteFormatter.prototype.isFormatSuitable=function(t){if(this.isInternational){return ot(t)?true:false}else{return!this.hasNationalPrefix||ft(t,this.countryMetadata)}};BX.PhoneNumber.IncompleteFormatter.prototype.replaceCountry=function(t){this.isInternational=true;this.hasPlusChar=true;this.country=t;this.countryMetadata=nt(this.country);this.countryCode=this.countryMetadata["countryCode"];this.rawInput="+"+this.countryCode+this.nationalNumber;this.nationalPrefix=""};BX.PhoneNumber.Input=function(t){if(!BX.type.isDomNode(t.node)||t.node.nodeName!=="INPUT"||t.node.type!=="text"){throw new Error("params.node should be text input node")}this.inputNode=t.node;this.defaultCountry=t.defaultCountry||BX.PhoneNumber.getDefaultCountry();this.userDefaultCountry=BX.PhoneNumber.getUserDefaultCountry();this.forceLeadingPlus=t.forceLeadingPlus===true;this.flagNode=BX.type.isDomNode(t.flagNode)?t.flagNode:null;this.flagSize=[16,24,32].indexOf(t.flagSize)!==-1?t.flagSize:16;this.countryPopupHeight=t.countryPopupHeight||180;this.countryPopupClassName=t.countryPopupClassName||"";this.countryTopList=t.countryTopList||[];this.flagNodeInitialClass="";this.countries=null;this.callbacks={initialize:BX.type.isFunction(t.onInitialize)?t.onInitialize:BX.DoNothing,change:BX.type.isFunction(t.onChange)?t.onChange:BX.DoNothing,countryChange:BX.type.isFunction(t.onCountryChange)?t.onCountryChange:BX.DoNothing};this.formatter=null;this.countrySelectPopup=null;this._lastCaretPosition=null;this._digitsToTheLeft=0;this._digitsToTheRight=0;this._digitsCount=0;this._selectedDigitsBeforeAction=0;this._countryBefore="";this.initialized=false;this.initializationPromises=[];this.init();this.bindEvents()};BX.PhoneNumber.Input.prototype.init=function(){var t=this;if(this.flagNode){this.flagNodeInitialClass=this.flagNode.className;BX.adjust(this.flagNode,{style:{cursor:"pointer",display:"inline-block"}})}BX.PhoneNumber.getIncompleteFormatter(this.defaultCountry).then(function(e){t.formatter=e;if(t.inputNode.value){t.inputNode.value=t.formatter.format(t.inputNode.value)}else if(t.userDefaultCountry!=""&&t.userDefaultCountry!==t.defaultCountry){t.formatter.replaceCountry(t.userDefaultCountry);t.inputNode.value=t.formatter.getFormattedNumber()}t.drawCountryFlag();t.initialized=true;t.initializationPromises.forEach(function(t){t.resolve()});t.callbacks.initialize()})};BX.PhoneNumber.Input.prototype.bindEvents=function(){this.inputNode.addEventListener("keydown",this._onKeyDown.bind(this));this.inputNode.addEventListener("input",this._onInput.bind(this));if(this.flagNode){this.flagNode.addEventListener("click",this._onFlagClick.bind(this))}};BX.PhoneNumber.Input.prototype.setValue=function(t){this.waitForInitialization().then(function(){this.inputNode.value=this.formatter.format(t.toString());this.callbacks.change({value:this.getValue(),formattedValue:this.getFormattedValue(),country:this.getCountry(),countryCode:this.getCountryCode()});if(this._countryBefore!==this.getCountry()){this.drawCountryFlag();this.callbacks.countryChange({country:this.getCountry(),countryCode:this.getCountryCode()})}}.bind(this))};BX.PhoneNumber.Input.prototype.waitForInitialization=function(){var t=new BX.Promise;if(this.initialized){t.resolve();return t}this.initializationPromises.push(t);return t};BX.PhoneNumber.Input.prototype.getValue=function(){return yt(this.inputNode.value)};BX.PhoneNumber.Input.prototype.getFormattedValue=function(){return this.inputNode.value};BX.PhoneNumber.Input.prototype.getCountry=function(){return this.formatter.country||this.formatter.defaultCountry};BX.PhoneNumber.Input.prototype.getCountryCode=function(){var t=nt(this.getCountry());return t?t["countryCode"]:false};BX.PhoneNumber.Input.prototype.drawCountryFlag=function(){if(!this.flagNode)return;var t=this.getCountry();if(!BX.type.isNotEmptyString(t))return;t=t.toLowerCase();BX.adjust(this.flagNode,{props:{className:this.flagNodeInitialClass+" bx-flag-"+this.flagSize+" "+t}})};BX.PhoneNumber.Input.prototype._onKeyDown=function(t){if(!t.key)return;var e=this.inputNode.selectionEnd-this.inputNode.selectionStart;if(t.key===f){if(this.inputNode.selectionStart!==0){t.preventDefault();t.stopPropagation();return}}else if(t.key.length===1&&t.key.search(/[\d,;#]/)!==0&&!t.ctrlKey&&!t.metaKey){t.preventDefault();t.stopPropagation();return}var r=dt(this.inputNode.value);this._lastCaretPosition=this.inputNode.selectionStart;this._digitsToTheLeft=gt(X,this.inputNode.value.substr(0,this._lastCaretPosition));this._digitsToTheRight=gt(X,this.inputNode.value.substr(this._lastCaretPosition));this._digitsCount=gt(X,this.inputNode.value);this._countryBefore=this.getCountry();if(e>0){var n=this.inputNode.value.substr(this.inputNode.selectionStart,e);this._selectedDigitsBeforeAction=gt(X,n)}else{this._selectedDigitsBeforeAction=0}var a=null;if(t.key==="Backspace"&&e===0){a=r[this._digitsToTheLeft-1]+1}if(t.key==="Delete"&&e===0&&this._digitsToTheRight>0){a=r[this._digitsToTheLeft]}if(a!==null){this.inputNode.setSelectionRange(a,a)}};BX.PhoneNumber.Input.prototype._onInput=function(t){var e=null;if(this.formatter){var r=this.formatter.format(this.inputNode.value);var n=dt(r);var a=this._digitsCount;var o=this._selectedDigitsBeforeAction;var i=gt(X,r);var u=i-a;var s=u+o;if(this._lastCaretPosition!==null){switch(t.inputType){case"deleteContentBackward":if(u==-1)e=n[this._digitsToTheLeft+u-1]+1;else e=n[this._digitsToTheLeft];break;case"deleteContentForward":if(this._digitsToTheLeft===0){e=n[0]}else{e=n[this._digitsToTheLeft-1]+1}break;case"insertText":case"insertFromPaste":e=n[this._digitsToTheLeft-1+s]+1;break}}this.inputNode.value=r;if(e!==null){this.inputNode.setSelectionRange(e,e)}this.callbacks.change({value:this.getValue(),formattedValue:this.getFormattedValue(),country:this.getCountry(),countryCode:this.getCountryCode()});if(this._countryBefore!==this.getCountry()){this.drawCountryFlag();this.callbacks.countryChange({country:this.getCountry(),countryCode:this.getCountryCode()})}}this._lastCaretPosition=null};BX.PhoneNumber.Input.prototype._onFlagClick=function(t){this.selectCountry({node:this.flagNode,countryPopupHeight:this.countryPopupHeight,countryPopupClassName:this.countryPopupClassName,countryTopList:this.countryTopList,onSelect:this._onCountrySelect.bind(this)})};BX.PhoneNumber.Input.prototype._onCountrySelect=function(t){var e=t.country;if(e===this.getCountry())return false;this.formatter.replaceCountry(e);this.inputNode.value=this.formatter.getFormattedNumber();this.drawCountryFlag();this.callbacks.change({value:this.getValue(),formattedValue:this.getFormattedValue(),country:this.getCountry(),countryCode:this.getCountryCode()});this.callbacks.countryChange({country:this.getCountry(),countryCode:this.getCountryCode()});BX.userOptions.save("main","phone_number","default_country",e)};BX.PhoneNumber.Input.prototype.loadCountries=function(){var t=new BX.Promise;if(this.countries){t.fulfill();return t}BX.ajax.runAction("main.phonenumber.getCountries").then(function(e){this.countries=e.data;t.fulfill()}.bind(this)).catch(function(t){if(t.errors){t.errors.map(function(t){console.error(t.message)})}else{console.error(t)}});return t};BX.PhoneNumber.Input.prototype.selectCountry=function(t){var e=this;var r=BX.type.isFunction(t.onSelect)?t.onSelect:BX.DoNothing;var n=BX.create("span",{events:{click:BX.delegateEvent({attribute:"data-country"},function(){e.countrySelectPopup.close();r({country:this.getAttribute("data-country")})})}});var a=null;var o={};if(t.countryTopList&&t.countryTopList.length>0){a=n.appendChild(BX.create("span",{props:{className:"main-phonenumber-country-separator"}}))}this.loadCountries().then(function(){e.countries.forEach(function(e){var r=e.CODE;var a=at(r);if(!a)return;var i=n.appendChild(BX.create("div",{props:{className:"main-phonenumber-country"},attrs:{"data-country":e.CODE},children:[BX.create("span",{props:{className:"main-phonenumber-country-flag bx-flag-16 "+r.toLowerCase()}}),BX.create("span",{props:{className:"main-phonenumber-country-name"},text:e.NAME+" (+"+a+")"})]}));if(t.countryTopList.indexOf(e.CODE)>=0){o[e.CODE]=i.cloneNode(true)}});if(t.countryTopList&&t.countryTopList.length>0){t.countryTopList.forEach(function(t){if(typeof o[t]!=="undefined"){n.insertBefore(o[t],a)}});if(n.firstChild===a){n.removeChild(a)}}e.countrySelectPopup=new BX.PopupWindow("phoneNumberInputSelectCountry",t.node,{className:t.countryPopupClassName||"",autoHide:true,closeByEsc:true,bindOptions:{position:"top"},height:t.countryPopupHeight,offsetRight:35,padding:0,contentPadding:10,angle:{offset:33},overlay:{backgroundColor:"white",opacity:0},content:n,events:{onPopupClose:function(){e.countrySelectPopup.destroy()},onPopupDestroy:function(){e.countrySelectPopup=null}}});e.countrySelectPopup.show()})};var z={templates:{3:"x-xx",4:"xx-xx",5:"x-xx-xx",6:"xx-xx-xx",7:"xxx-xx-xx"},format:function(t){var e=this.templates[t.length];if(!e){return t}var r=0;var n=new RegExp(e.replace(/[^x]/g,"").replace(/x/g,"(\\d)"));var a=e.replace(/x/g,function(){return"$"+ ++r});return t.replace(n,a)},isApplicable:function(t){return/^\d{3,7}$/.test(t)}};var W=function(t){if(!t||t.length>h){return""}var e=t.search(new RegExp(P));if(e<0){return""}var r=t.substr(e);r=r.replace(new RegExp(C),"");return r};var H=function(t){t=yt(t);if(!t)return false;if(t[0]!==f){return{countryCode:"",localNumber:t}}t=t.substr(1);if(t[0]==="0"){return false}for(var e=u;e>0;e--){var r=t.substr(0,e);if(tt(r)){return{countryCode:r,localNumber:t.substr(e)}}}return false};var j=function(t){return t.length>=s&&t.search(new RegExp(F))!==-1};var U=function(t){var e="";var r="";var n=t.search(new RegExp("["+v+"]"));if(n>=0){r=t[n];e=t.substr(n);t=t.substr(0,n)}return{extensionSeparator:r,extension:Nt(e,b+c),phoneNumber:t}};var G=function(t){if(!tt(t)){return false}var e=et(t);return nt(e[0])};var K=function(t,e){if(!t||!e)return false;var r=et(t);var n;var a;if(r.length===1){return r[0]}for(var o=0;o<r.length;o++){n=r[o];a=nt(n);if(a.hasOwnProperty("leadingDigits")){var i="^("+a["leadingDigits"]+")";if(e.match(new RegExp(i))){return n}}else if(q(e,n)){return n}}return false};var q=function(t,e){var r=nt(e);var n;if(!r)return false;if(!BX.type.isNotEmptyString(t))return false;if(r["generalDesc"]&&r["generalDesc"]["nationalNumberPattern"]){if(!t.match(new RegExp("^(?:"+r["generalDesc"]["nationalNumberPattern"]+")$")))return false}var a=["noInternationalDialling","areaCodeOptional","fixedLine","mobile","pager","tollFree","premiumRate","sharedCost","personalNumber","voip","uan","voicemail"];for(var o=0;o<a.length;o++){n=a[o];if(r[n]&&r[n]["nationalNumberPattern"]){if(t.match(new RegExp("^"+r[n]["nationalNumberPattern"]+"$"))){return n}}}return false};var J=function(t,e){var r=e.hasOwnProperty("nationalPrefixForParsing")?e["nationalPrefixForParsing"]:e["nationalPrefix"];if(t==""||r=="")return t;var n="^(?:"+r+")";var a=t.match(new RegExp(n));if(!a){return t}var o=e["nationalPrefixTransformRule"];var i;if(o&&a.length>1){i=t.replace(n,o)}else{i=t.substr(a[0].length)}return i};var Q=function(t,e){var r=new RegExp("^(?:"+e["generalDesc"]["nationalNumberPattern"]+")$");if(t.match(r,t))return true;else return false};var Y=function(t,e,r,n){if(!e["availableFormats"])return true;for(var a=0;a<e.availableFormats.length;a++){var o=e.availableFormats[a];if(r&&o["intlFormat"]==="NA")continue;if(n){var i=st(o,e);if(i&&i.search(/\$NP/)===-1)continue}if(o["leadingDigits"]&&!ct(t,o["leadingDigits"]))continue;return true}return false};var Z=function(t,e){var r=e["countryCode"];if(t.search(r)!==0)return t;var n=t.substr(r.length);var a=new RegExp("^(?:"+e["generalDesc"]["nationalNumberPattern"]+")$");if(t.match(a)&&!n.match(a)){return t}return n};var tt=function(t){t=t.toString();return i.hasOwnProperty(t)};var et=function(t){t=t.toString();return i.hasOwnProperty(t)?i[t]:[]};var rt=function(t){t=t.toString();return i.hasOwnProperty(t)?i[t][0]:false};var nt=function(t){t=t.toUpperCase();return o.hasOwnProperty(t)?o[t]:false};var at=function(t){t=t.toUpperCase();return o.hasOwnProperty(t)?o[t]["countryCode"]:false};var ot=function(t){if(t.hasOwnProperty("intlFormat")){if(t["intlFormat"]==="NA")return false;else return t["intlFormat"]}return t["format"]};var it=function(t){if(BX.type.isArray(t["availableFormats"]))return t["availableFormats"];var e=t["countryCode"];var r=et(e);var n=r[0];var a=nt(n);return BX.type.isArray(a["availableFormats"])?a["availableFormats"]:[]};var ut=function(t,e){if(!t.hasOwnProperty("nationalPrefix")){return""}var r=t["nationalPrefix"];if(e){r=mt(r)}return r};var st=function(t,e){if(t.hasOwnProperty("nationalPrefixFormattingRule")){return t["nationalPrefixFormattingRule"]}else{var r=e["countryCode"];var n=et(r);var a=n[0];var o=nt(a);return o["nationalPrefixFormattingRule"]||""}};var lt=function(t,e,r){if(t.indexOf(e)===0){var n=t.substr(e.length);return BX.PhoneNumberParser.getInstance()._realParse(n,r["id"]).isValid()}else{return false}};var ht=function(t,e){if(t.hasOwnProperty("nationalPrefixOptionalWhenFormatting"))return t["nationalPrefixOptionalWhenFormatting"];else if(e.hasOwnProperty("nationalPrefixOptionalWhenFormatting"))return e["nationalPrefixOptionalWhenFormatting"];else return false};var ft=function(t,e){var r=st(t,e);return!r||r.search(/\$NP/)!==-1};var ct=function(t,e){var r;var n;if(BX.type.isArray(e)){for(var a=0;a<e.length;a++){r=new RegExp("^("+e[a]+")");n=t.match(r);if(n){return n}}}else{r=new RegExp("^("+e+")");n=t.match(r);if(n){return n}}return false};var pt=function(t,e){if(e&&t.hasOwnProperty("intlFormat"))return t["intlFormat"];else return t["format"]};var mt=function(t){return Nt(t,c)};var yt=function(t){return Nt(t,X)};var Nt=function(t,e){return t.replace(new RegExp("[^"+e+"]","g"),"")};var gt=function(t,e){var r=e.match(t instanceof RegExp?t:new RegExp("["+t+"]","g"));return r?r.length:0};var dt=function(t){var e=new RegExp("["+X+"]","g");var r=[];var n;while((n=e.exec(t))!==null){r.push(n.index)}return r};function vt(t,e){var r="";if(e<=0)return"";for(var n=0;n<e;n++)r+=t;return r}})();
//# sourceMappingURL=phonenumber.map.js

Youez - 2016 - github.com/yon3zu
LinuXploit