Your IP : 3.144.242.84


Current Path : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/main/core/
Upload File :
Current File : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/main/core/core_ajax.min.js

(function(e){if(e.BX.ajax)return;var t=e.BX,a={},r={method:"GET",dataType:"html",timeout:0,async:true,processData:true,scriptsRunFirst:false,emulateOnload:true,skipAuthCheck:false,start:true,cache:true,preparePost:true,headers:false,lsTimeout:30,lsForce:false},n={},s=[],o={url_utf:/[^\034-\254]+/g,script_self:/\/bitrix\/js\/main\/core\/core(_ajax)*.js$/i,script_self_window:/\/bitrix\/js\/main\/core\/core_window.js$/i,script_self_admin:/\/bitrix\/js\/main\/core\/core_admin.js$/i,script_onload:/window.onload/g};t.ajax=function(e){var n,s;if(!e||!e.url||!t.type.isString(e.url)){return false}for(var u in a)if(typeof e[u]=="undefined")e[u]=a[u];a={};for(u in r)if(typeof e[u]=="undefined")e[u]=r[u];e.method=e.method.toUpperCase();if(!t.localStorage)e.lsId=null;if(t.browser.IsIE()){var l=o.url_utf.exec(e.url);if(l){do{e.url=e.url.replace(l,t.util.urlencode(l));l=o.url_utf.exec(e.url)}while(l)}}if(e.dataType=="json")e.emulateOnload=false;if(!e.cache&&e.method=="GET")e.url=t.ajax._uncache(e.url);if(e.method=="POST"){if(e.preparePost){e.data=t.ajax.prepareData(e.data)}else if(i(e.headers)==="application/json"){const a=t.Type.isPlainObject(e.data)||t.Type.isString(e.data)||t.Type.isNumber(e.data)||t.Type.isBoolean(e.data)||t.Type.isArray(e.data);if(a){e.data=JSON.stringify(e.data)}}}var c=true;if(e.lsId&&!e.lsForce){var f=t.localStorage.get("ajax-"+e.lsId);if(f!==null){c=false;var p=function(a){if(a.key=="ajax-"+e.lsId&&a.value!="BXAJAXWAIT"){var r=a.value,n=!!a.oldValue&&r==null;if(!n)t.ajax.__run(e,r);else if(e.onfailure)e.onfailure("timeout");t.removeCustomEvent("onLocalStorageChange",p)}};if(f=="BXAJAXWAIT"){t.addCustomEvent("onLocalStorageChange",p)}else{setTimeout((function(){p({key:"ajax-"+e.lsId,value:f})}),10)}}}if(c){e.xhr=t.ajax.xhr();if(!e.xhr)return;if(e.lsId){t.localStorage.set("ajax-"+e.lsId,"BXAJAXWAIT",e.lsTimeout)}if(t.Type.isFunction(e.onprogress)){t.bind(e.xhr,"progress",e.onprogress)}if(t.Type.isFunction(e.onprogressupload)&&e.xhr.upload){t.bind(e.xhr.upload,"progress",e.onprogressupload)}e.xhr.open(e.method,e.url,e.async);if(!e.skipBxHeader&&!t.ajax.isCrossDomain(e.url)){e.xhr.setRequestHeader("Bx-ajax","true")}if(e.method=="POST"&&e.preparePost){e.xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}if(typeof e.headers=="object"){for(u=0;u<e.headers.length;u++)e.xhr.setRequestHeader(e.headers[u].name,e.headers[u].value)}var d=false;var h=e.xhr.onreadystatechange=function(a){if(d)return;if(a==="timeout"){if(e.onfailure){e.onfailure("timeout","",e)}t.onCustomEvent(e.xhr,"onAjaxFailure",["timeout","",e]);e.xhr.onreadystatechange=t.DoNothing;e.xhr.abort();if(e.async){e.xhr=null}}else{if(e.xhr.readyState==4||a=="run"){n=t.ajax.xhrSuccess(e.xhr)?"success":"error";d=true;e.xhr.onreadystatechange=t.DoNothing;if(n=="success"){var r=!!e.skipAuthCheck||t.ajax.isCrossDomain(e.url)?false:e.xhr.getResponseHeader("X-Bitrix-Ajax-Status");if(!!r&&r=="Authorize"){if(e.onfailure){e.onfailure("auth",e.xhr.status,e)}t.onCustomEvent(e.xhr,"onAjaxFailure",["auth",e.xhr.status,e])}else{var s=e.xhr.responseText;if(e.lsId){t.localStorage.set("ajax-"+e.lsId,s,e.lsTimeout)}t.ajax.__run(e,s)}}else{if(e.onfailure){e.onfailure("status",e.xhr.status,e)}t.onCustomEvent(e.xhr,"onAjaxFailure",["status",e.xhr.status,e])}if(e.async){e.xhr=null}}}};if(e.async&&e.timeout>0){setTimeout((function(){if(e.xhr&&!d){h("timeout")}}),e.timeout*1e3)}if(e.start){e.xhr.send(e.data);if(!e.async){h("run")}}return e.xhr}};t.ajax.xhr=function(){if(e.XMLHttpRequest){try{return new XMLHttpRequest}catch(e){}}else if(e.ActiveXObject){try{return new e.ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new e.ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new e.ActiveXObject("Msxml2.XMLHTTP")}catch(e){}try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}throw new Error("This browser does not support XMLHttpRequest.")}return null};t.ajax.isCrossDomain=function(a,r){r=r||e.location;if(a.indexOf("//")===0){a=r.protocol+a}if(a.indexOf("http")!==0){return false}var n=e.document.createElement("a");n.href=a;return n.protocol!==r.protocol||n.hostname!==r.hostname||t.ajax.getHostPort(n.protocol,n.host)!==t.ajax.getHostPort(r.protocol,r.host)};t.ajax.getHostPort=function(e,t){var a=/:(\d+)$/.exec(t);if(a){return a[1]}else{if(e==="http:"){return"80"}else if(e==="https:"){return"443"}}return""};t.ajax.__prepareOnload=function(a,r){if(a.length>0){t.ajax["onload_"+r]=null;for(var n=0,s=a.length;n<s;n++){if(a[n].isInternal){a[n].JS=a[n].JS.replace(o.script_onload,"BX.ajax.onload_"+r)}}}t.CaptureEventsGet();t.CaptureEvents(e,"load")};t.ajax.__runOnload=function(a){if(null!=t.ajax["onload_"+a]){t.ajax["onload_"+a].apply(e);t.ajax["onload_"+a]=null}var r=t.CaptureEventsGet();if(r){for(var n=0;n<r.length;n++)r[n].apply(e)}};t.ajax.__run=function(e,a){if(!e.processData){if(e.onsuccess){e.onsuccess(a)}t.onCustomEvent(e.xhr,"onAjaxSuccess",[a,e])}else{a=t.ajax.processRequestData(a,e)}};t.ajax._onParseJSONFailure=function(e){this.jsonFailure=true;this.jsonResponse=e;this.jsonProactive=/^\[WAF\]/.test(e)};t.ajax.processRequestData=function(e,a){var r,n=[],s=[];switch(a.dataType.toUpperCase()){case"JSON":var o=a.xhr||{};t.addCustomEvent(o,"onParseJSONFailure",t.proxy(t.ajax._onParseJSONFailure,a));r=t.parseJSON(e,o);t.removeCustomEvent(o,"onParseJSONFailure",t.proxy(t.ajax._onParseJSONFailure,a));if(!!r&&t.type.isArray(r["bxjs"])){for(var i=0;i<r["bxjs"].length;i++){if(t.type.isNotEmptyString(r["bxjs"][i])){n.push({isInternal:false,JS:r["bxjs"][i],bRunFirst:a.scriptsRunFirst})}else{n.push(r["bxjs"][i])}}}if(!!r&&t.type.isArray(r["bxcss"])){s=r["bxcss"]}break;case"SCRIPT":n.push({isInternal:true,JS:e,bRunFirst:a.scriptsRunFirst});r=e;break;default:var u=t.processHTML(e,a.scriptsRunFirst);r=u.HTML;n=u.SCRIPT;s=u.STYLE;break}if(s.length>0){t.loadCSS(s)}let l=null;if(a.emulateOnload){l=parseInt(Math.random()*1e6);t.ajax.__prepareOnload(n,l)}const c=t.defer((function(){if(a.emulateOnload){t.ajax.__runOnload(l)}t.onCustomEvent(a.xhr,"onAjaxSuccessFinish",[a])}));try{if(!!a.jsonFailure){throw{type:"json_failure",data:a.jsonResponse,bProactive:a.jsonProactive}}a.scripts=n;t.ajax.processScripts(a.scripts,true);if(a.onsuccess){a.onsuccess(r)}t.onCustomEvent(a.xhr,"onAjaxSuccess",[r,a]);t.ajax.processScripts(a.scripts,false,c)}catch(e){if(a.onfailure)a.onfailure("processing",e);t.onCustomEvent(a.xhr,"onAjaxFailure",["processing",e,a])}};t.ajax.processScripts=function(e,a,r){var n=[],s="";r=r||t.DoNothing;for(var o=0,i=e.length;o<i;o++){if(typeof a!="undefined"&&a!=!!e[o].bRunFirst)continue;if(e[o].isInternal)s+=";"+e[o].JS;else n.push(e[o].JS)}n=t.util.array_unique(n);var u=s.length>0?function(){t.evalGlobal(s)}:t.DoNothing;if(n.length>0){t.load(n,(function(){u();r()}))}else{u();r()}};t.ajax.prepareData=function(e,a){var r="";if(t.type.isString(e))r=e;else if(null!=e){for(var n in e){if(e.hasOwnProperty(n)){if(r.length>0)r+="&";var s=t.util.urlencode(n);if(a)s=a+"["+s+"]";if(typeof e[n]=="object")r+=t.ajax.prepareData(e[n],s);else r+=s+"="+t.util.urlencode(e[n])}}}return r};t.ajax.xhrSuccess=function(e){return e.status>=200&&e.status<300||e.status===304||e.status===1223||e.status===0};t.ajax.Setup=function(e,t){t=!!t;for(var n in e){if(t)a[n]=e[n];else r[n]=e[n]}};t.ajax.replaceLocalStorageValue=function(e,a,r){if(!!t.localStorage)t.localStorage.set("ajax-"+e,a,r)};t.ajax._uncache=function(e){return e+((e.indexOf("?")!==-1?"&":"?")+"_="+(new Date).getTime())};t.ajax.get=function(e,a,r){if(t.type.isFunction(a)){r=a;a=""}a=t.ajax.prepareData(a);if(a){e+=(e.indexOf("?")!==-1?"&":"?")+a;a=""}return t.ajax({method:"GET",dataType:"html",url:e,data:"",onsuccess:r})};t.ajax.getCaptcha=function(e){return t.ajax.loadJSON("/bitrix/tools/ajax_captcha.php",e)};t.ajax.insertToNode=function(e,r){r=t(r);if(!!r){var n={cancel:false};t.onCustomEvent("onAjaxInsertToNode",[{url:e,node:r,eventArgs:n}]);if(n.cancel===true){return}var s=null;if(!a.denyShowWait){s=t.showWait(r);delete a.denyShowWait}return t.ajax.get(e,(function(e){r.innerHTML=e;t.closeWait(r,s)}))}};t.ajax.post=function(e,a,r){a=t.ajax.prepareData(a);return t.ajax({method:"POST",dataType:"html",url:e,data:a,onsuccess:r})};t.ajax.promise=function(e){var a=new t.Promise;e.onsuccess=function(e){a.fulfill(e)};e.onfailure=function(e,t,r){a.reject({reason:e,data:t,ajaxConfig:r,xhr:r.xhr})};var r=t.ajax(e);if(r){if(typeof e.onrequeststart==="function"){e.onrequeststart(r)}}else{a.reject({reason:"init",data:false})}return a};t.ajax.loadScriptAjax=function(e,a,r){if(t.type.isArray(e)){for(var s=0,i=e.length;s<i;s++){t.ajax.loadScriptAjax(e[s],a,r)}}else{var u=e.replace(/\.js\?.*/,".js");if(o.script_self.test(u))return;if(o.script_self_window.test(u)&&t.CWindow)return;if(o.script_self_admin.test(u)&&t.admin)return;if(typeof n[u]=="undefined"){if(!!r){n[u]="";return t.loadScript(e)}else{return t.ajax({url:e,method:"GET",dataType:"script",processData:true,emulateOnload:false,scriptsRunFirst:true,async:false,start:true,onsuccess:function(e){n[u]=e;if(a)a(e)}})}}else if(a){a(n[u])}}};t.ajax.loadJSON=function(e,a,r,n){if(t.type.isFunction(a)){n=r;r=a;a=""}a=t.ajax.prepareData(a);if(a){e+=(e.indexOf("?")!==-1?"&":"?")+a;a=""}return t.ajax({method:"GET",dataType:"json",url:e,onsuccess:r,onfailure:n})};var i=function(e){if(!t.Type.isArray(e)){return null}var a=e.filter((function(e){return e.name==="Content-Type"})).pop();return a?a.value:null};const u=function(e){if(!t.Type.isPlainObject(e)){console.error("BX.ajax: {analytics} must be an object.");return false}const a=["event","tool","category"];for(const r of a){if(!t.Type.isStringFilled(e[r])){console.error(`BX.ajax: The "${r}" property in the "analytics" object must be a non-empty string.`);return false}}const r=["p1","p2","p3","p4","p5"];for(const a of r){const r=e[a];if(!t.Type.isStringFilled(r)){continue}if(r.split("_").length>2){console.error(`BX.ajax: The "${a}" property (${r}) in the "analytics" object must be a string containing a single underscore.`);return false}}return true};const l=function(e){const a={};if(t.Type.isStringFilled(e.analyticsLabel)||t.Type.isPlainObject(e.analyticsLabel)){a.analyticsLabel=e.analyticsLabel}if(t.Type.isPlainObject(e.analytics)){if(e.analyticsLabel){delete a.analyticsLabel;console.error("BX.ajax: Only {analytics} or {analyticsLabel} should be used. If both are present, {analyticsLabel} will be ignored.")}if(u(e.analytics)){a.st=e.analytics}else{console.error("BX.ajax: {analytics} is invalid and is skipped.")}}return a};const c=function(e){let t=e.getParameters||{};t={...t,...l(e)};if(typeof e.mode!=="undefined"){t.mode=e.mode}if(e.navigation){if(e.navigation.page){t.nav="page-"+e.navigation.page}if(e.navigation.size){if(t.nav){t.nav+="-"}else{t.nav=""}t.nav+="size-"+e.navigation.size}}return t};var f=function(e){e=t.type.isPlainObject(e)?e:{};e.headers=e.headers||[];e.headers.push({name:"X-Bitrix-Csrf-Token",value:t.bitrix_sessid()});if(t.message.SITE_ID){e.headers.push({name:"X-Bitrix-Site-Id",value:t.message.SITE_ID})}if(typeof e.json!=="undefined"){if(!t.type.isPlainObject(e.json)){throw new Error("Wrong `config.json`, plain object expected.")}e.headers.push({name:"Content-Type",value:"application/json"});e.data=e.json;e.preparePost=false}else if(e.data instanceof FormData){e.preparePost=false;if(typeof e.signedParameters!=="undefined"){e.data.append("signedParameters",e.signedParameters)}}else if(t.type.isPlainObject(e.data)||t.Type.isNil(e.data)){e.data=t.type.isPlainObject(e.data)?e.data:{};if(typeof e.signedParameters!=="undefined"){e.data.signedParameters=e.signedParameters}}if(!e.method){e.method="POST"}return e};var p=function(e,a){a=a||false;var r=t.clone(e);var n=null;var s=e.onrequeststart;e.onrequeststart=function(e){n=e;if(t.type.isFunction(s)){s(e)}};var o=r.onrequeststart;r.onrequeststart=function(e){n=e;if(t.type.isFunction(o)){o(e)}};var i=t.ajax.promise(e);return i.then((function(e){if(!a&&t.type.isPlainObject(e)&&t.type.isArray(e.errors)){var n=false;e.errors.forEach((function(e){if(e.code==="invalid_csrf"&&e.customData.csrf){t.message({bitrix_sessid:e.customData.csrf});r.headers=r.headers||[];r.headers=r.headers.filter((function(e){return e&&e.name!=="X-Bitrix-Csrf-Token"}));r.headers.push({name:"X-Bitrix-Csrf-Token",value:t.bitrix_sessid()});n=true}}));if(n){return p(r,true)}}if(!t.type.isPlainObject(e)||e.status!=="success"){var s=new t.Promise;s.reject(e);return s}return e})).catch((function(e){var a=new t.Promise;var r;if(t.type.isPlainObject(e)&&e.xhr&&e.xhr.responseText){try{r=JSON.parse(e.xhr.responseText);e=r}catch(e){}}if(t.type.isPlainObject(e)&&e.status&&e.hasOwnProperty("data")){a.reject(e)}else{a.reject({status:"error",data:{ajaxRejectData:e},errors:[{code:"NETWORK_ERROR",message:"Network error"}]})}return a})).then((function(e){var a=new t.Promise;var r=n.getAllResponseHeaders().trim().split(/[\r\n]+/);var s={};r.forEach((function(e){var t=e.split(": ");var a=t.shift().toLowerCase();s[a]=t.join(": ")}));if(!s["x-process-assets"]){a.fulfill(e);return a}var o=t.prop.getObject(t.prop.getObject(e,"data",{}),"assets",{});var i=[];if(t.Type.isArrayFilled(o.string)){o.string.reduce((function(e,t){if(String(t).length>0&&!e.includes(t)){e.push(t)}return e}),[]).forEach((function(e){if(String(e).startsWith('<script type="extension/settings"')){t.html(document.head,e,{useAdjacentHTML:true})}else{i.push(e)}}))}var u=new Promise((function(e,a){var r=t.prop.getArray(o,"css",[]);t.load(r,(function(){t.loadScript(t.prop.getArray(o,"js",[]),e)}))}));u.then((function(){var r=i.join("\n");t.html(document.head,r,{useAdjacentHTML:true}).then((function(){a.fulfill(e)}))}));return a}))};t.ajax.runAction=function(e,a){a=f(a);var r=c(a);r.action=e;var n="/bitrix/services/main/ajax.php?"+t.ajax.prepareData(r);return p({method:a.method,dataType:"json",url:n,data:a.data,timeout:a.timeout,preparePost:a.preparePost,headers:a.headers,onrequeststart:a.onrequeststart,onprogress:a.onprogress,onprogressupload:a.onprogressupload})};t.ajax.runComponentAction=function(e,a,r){r=f(r);r.mode=r.mode||"ajax";var n=c(r);n.c=e;n.action=a;var s="/bitrix/services/main/ajax.php?"+t.ajax.prepareData(n);return p({method:r.method,dataType:"json",url:s,data:r.data,timeout:r.timeout,preparePost:r.preparePost,headers:r.headers,onrequeststart:r.onrequeststart?r.onrequeststart:null,onprogress:r.onprogress,onprogressupload:r.onprogressupload})};t.ajax.load=function(e,a){if(!t.type.isArray(e))e=[e];var r=0;if(!t.type.isFunction(a))a=t.DoNothing;var n=function(e){if(t.type.isFunction(this.callback))this.callback(e);if(++r>=o)a()};for(var s=0,o=e.length;s<o;s++){switch(e[s].type.toUpperCase()){case"SCRIPT":t.loadScript([e[s].url],t.proxy(n,e[s]));break;case"CSS":t.loadCSS([e[s].url]);if(++r>=o)a();break;case"JSON":t.ajax.loadJSON(e[s].url,t.proxy(n,e[s]));break;default:t.ajax.get(e[s].url,"",t.proxy(n,e[s]));break}}};t.ajax.submit=function(e,a){if(!e.target){if(null==e.BXFormTarget){var r="formTarget_"+Math.random();e.BXFormTarget=document.body.appendChild(t.create("IFRAME",{props:{name:r,id:r,src:"javascript:void(0)"},style:{display:"none"}}))}e.target=e.BXFormTarget.name}e.BXFormCallback=a;t.bind(e.BXFormTarget,"load",t.proxy(t.ajax._submit_callback,e));t.submit(e);return false};t.ajax.submitComponentForm=function(a,r,n){if(!a.target){if(null==a.BXFormTarget){var s="formTarget_"+Math.random();a.BXFormTarget=document.body.appendChild(t.create("IFRAME",{props:{name:s,id:s,src:"javascript:void(0)"},style:{display:"none"}}))}a.target=a.BXFormTarget.name}if(!!n)var o=t.showWait(r);a.BXFormCallback=function(a){if(!!n)t.closeWait(o);var s=function(){if(!!e.bxcompajaxframeonload){setTimeout((function(){e.bxcompajaxframeonload();e.bxcompajaxframeonload=null}),10)}};t(r).innerHTML=a;t.onCustomEvent("onAjaxSuccess",[null,null,s])};t.bind(a.BXFormTarget,"load",t.proxy(t.ajax._submit_callback,a));return true};t.ajax._submit_callback=function(){try{if(this.BXFormTarget.contentWindow.location.href.indexOf("http")!=0)return}catch(e){return}if(this.BXFormCallback)this.BXFormCallback.apply(this,[this.BXFormTarget.contentWindow.document.body.innerHTML]);t.unbindAll(this.BXFormTarget)};t.ajax.prepareForm=function(e,t){t=!!t?t:{};var a,r,n,s=[],o=e.elements.length,i=0,u=0;if(!!e){for(a=0;a<o;a++){n=e.elements[a];if(n.disabled)continue;if(!n.type)continue;switch(n.type.toLowerCase()){case"text":case"textarea":case"password":case"number":case"hidden":case"select-one":s.push({name:n.name,value:n.value});u+=n.name.length+n.value.length;break;case"file":if(!!n.files){for(r=0;r<n.files.length;r++){i++;s.push({name:n.name,value:n.files[r],file:true});u+=n.files[r].size}}break;case"radio":case"checkbox":if(n.checked){s.push({name:n.name,value:n.value});u+=n.name.length+n.value.length}break;case"select-multiple":for(var l=0;l<n.options.length;l++){if(n.options[l].selected){s.push({name:n.name,value:n.options[l].value});u+=n.name.length+n.options[l].length}}break;default:break}}a=0;u=0;var c=t,f,p,d,h;while(a<s.length){var x=s[a].name.indexOf("[");if(h){c[s[a].name]={};c[s[a].name][h.replace(/\[|\]/gi,"")]=s[a].value;c=t;h=null;a++}else if(x==-1){c[s[a].name]=s[a].value;c=t;a++}else{f=s[a].name.substring(0,x);p=s[a].name.substring(x+1);d=p.indexOf("]");if(d==-1){if(!c[f])c[f]=[];c=t;a++}else if(d==0){if(!c[f])c[f]=[];c=c[f];s[a].name=""+c.length;if(p.substring(d+1).indexOf("[")===0)h=p.substring(0,d)+p.substring(d+1)}else{if(!c[f])c[f]={};c=c[f];s[a].name=p.substring(0,d)+p.substring(d+1)}}}}return{data:t,filesCount:i,roughSize:u}};t.ajax.submitAjax=function(a,r){r=r!==null&&typeof r=="object"?r:{};r.url=r["url"]||a.getAttribute("action");var n=r["data"]||{};r.data=t.ajax.prepareForm(a).data;for(var s in n){if(n.hasOwnProperty(s)){r.data[s]=n[s]}}if(!e["FormData"]){t.ajax(r)}else{var o=function(e){var t=Object.prototype.toString.call(e);return t=="[object File]"||t=="[object Blob]"},i=function(e,t,a){if(!!a&&typeof a=="object"&&!o(a)){for(var r in a){if(a.hasOwnProperty(r)){i(e,t==""?r:t+"["+r+"]",a[r])}}}else e.append(t,!!a?a:"")},u=function(e){var a={};if(null!=e){if(typeof e=="object"){for(var r in e){if(e.hasOwnProperty(r)){var n=t.util.urlencode(r);if(typeof e[r]=="object"&&e[r]["file"]!==true)a[n]=u(e[r]);else if(e[r]["file"]===true)a[n]=e[r]["value"];else a[n]=t.util.urlencode(e[r])}}}else a=t.util.urlencode(e)}return a},l=new e.FormData;if(r.method!=="POST"){r.data=t.ajax.prepareData(r.data);if(r.data){r.url+=(r.url.indexOf("?")!==-1?"&":"?")+r.data;r.data=""}}else{if(r.preparePost===true)r.data=u(r.data);i(l,"",r.data);r.data=l}r.preparePost=false;r.start=false;var c=t.ajax(r);if(!!r["onprogress"])c.upload.addEventListener("progress",(function(e){var t=null;if(e.lengthComputable&&(e.total||e["totalSize"])){t=e.loaded*100/(e.total||e["totalSize"])}r["onprogress"](e,t)}));c.send(l)}};t.ajax.UpdatePageData=function(e){if(e.TITLE)t.ajax.UpdatePageTitle(e.TITLE);if(e.WINDOW_TITLE||e.TITLE)t.ajax.UpdateWindowTitle(e.WINDOW_TITLE||e.TITLE);if(e.NAV_CHAIN)t.ajax.UpdatePageNavChain(e.NAV_CHAIN);if(e.CSS&&e.CSS.length>0)t.loadCSS(e.CSS);if(e.SCRIPTS&&e.SCRIPTS.length>0){var a=function(r,n,s){if(!!n&&t.type.isArray(n.scripts)){for(var o=0,i=e.SCRIPTS.length;o<i;o++){n.scripts.push({isInternal:false,JS:e.SCRIPTS[o]})}}else{t.loadScript(e.SCRIPTS,s)}t.removeCustomEvent("onAjaxSuccess",a)};t.addCustomEvent("onAjaxSuccess",a)}else{var r=function(e,a,n){if(t.type.isFunction(n)){n()}t.removeCustomEvent("onAjaxSuccess",r)};t.addCustomEvent("onAjaxSuccess",r)}};t.ajax.UpdatePageTitle=function(e){var a=t("pagetitle");if(a){t.remove(a.firstChild);if(!a.firstChild)a.appendChild(document.createTextNode(e));else a.insertBefore(document.createTextNode(e),a.firstChild)}};t.ajax.UpdateWindowTitle=function(e){document.title=e};t.ajax.UpdatePageNavChain=function(e){var a=t("navigation");if(a){a.innerHTML=e}};t.userOptions={options:null,bSend:false,delay:5e3,path:"/bitrix/admin/user_options.php?"};t.userOptions.setAjaxPath=function(e){console.warn("BX.userOptions.setAjaxPath is deprecated. There is no way to change ajax path.")};t.userOptions.save=function(e,a,r,n,s){if(t.userOptions.options===null){t.userOptions.options={}}s=Boolean(s);t.userOptions.options[`${e}.${a}.${r}`]=[e,a,r,n,s];const o=t.userOptions.__get();if(o){document.cookie=`${t.message("COOKIE_PREFIX")}_LAST_SETTINGS=${encodeURIComponent(o)}&sessid=${t.bitrix_sessid()}; expires=Thu, 31 Dec ${(new Date).getFullYear()+1} 23:59:59 GMT; path=/;`}if(!t.userOptions.bSend){t.userOptions.bSend=true;setTimeout((()=>{t.userOptions.send(null)}),t.userOptions.delay)}};t.userOptions.send=function(e){const a=t.userOptions.__get_values({backwardCompatibility:true});t.userOptions.options=null;t.userOptions.bSend=false;if(a){document.cookie=`${t.message("COOKIE_PREFIX")}_LAST_SETTINGS=; path=/;`;t.ajax.runAction("main.userOption.saveOptions",{json:{newValues:a}}).then((a=>{if(t.type.isFunction(e)){e(a)}}))}};t.userOptions.del=function(e,a,r,n){t.ajax.runAction("main.userOption.deleteOption",{json:{category:e,name:a,common:r}}).then((e=>{if(t.type.isFunction(n)){n(e)}}))};t.userOptions.__get_values=function({backwardCompatibility:e}){if(!t.userOptions||!t.Type.isPlainObject(t.userOptions.options)){return null}const a=0;const r=1;const n=2;const s=3;const o=4;const i={p:[]};let u=-1;let l="";Object.entries(t.userOptions.options).forEach((([t,c])=>{const f=c[a];const p=c[r];const d=`${f}.${p}`;if(l!==d){u++;i.p.push({c:f,n:p,v:{}});if(c[o]===true){i.p[u].d="Y"}l=d}if(c[n]===null){i.p[u].v=c[s]}else{let t=c[s];if(e&&Array.isArray(c[s])){t=c[s].join(",")}i.p[u].v[c[n]]=t}}));return i.p.length>0?i.p:null};t.userOptions.__get=function(){if(!t.userOptions.options)return"";var e="",a=-1,r="",n,s;for(s in t.userOptions.options){if(t.userOptions.options.hasOwnProperty(s)){n=t.userOptions.options[s];if(r!=n[0]+"."+n[1]){a++;e+="&p["+a+"][c]="+t.util.urlencode(n[0]);e+="&p["+a+"][n]="+t.util.urlencode(n[1]);if(n[4]==true)e+="&p["+a+"][d]=Y";r=n[0]+"."+n[1]}var o=n[2];var i=n[3];if(o===null){e+="&p["+a+"][v]="+t.util.urlencode(i)}else{e+="&p["+a+"][v]["+t.util.urlencode(o)+"]="+t.util.urlencode(i)}}}return e.substr(1)};t.ajax.history={expected_hash:"",obParams:null,obFrame:null,obImage:null,obTimer:null,bInited:false,bHashCollision:false,bPushState:!!(history.pushState&&t.type.isFunction(history.pushState)),startState:null,init:function(a){if(t.ajax.history.bInited)return;this.obParams=a;var r=this.obParams.getState();if(t.ajax.history.bPushState){t.ajax.history.expected_hash=e.location.pathname;if(e.location.search)t.ajax.history.expected_hash+=e.location.search;t.ajax.history.put(r,t.ajax.history.expected_hash,"",true);setTimeout((function(){t.bind(e,"popstate",t.ajax.history.__hashListener)}),500)}else{t.ajax.history.expected_hash=e.location.hash;if(!t.ajax.history.expected_hash||t.ajax.history.expected_hash=="#")t.ajax.history.expected_hash="__bx_no_hash__";d.put(t.ajax.history.expected_hash,r);t.ajax.history.obTimer=setTimeout(t.ajax.history.__hashListener,500);if(t.browser.IsIE()){t.ajax.history.obFrame=document.createElement("IFRAME");t.hide_object(t.ajax.history.obFrame);document.body.appendChild(t.ajax.history.obFrame);t.ajax.history.obFrame.contentWindow.document.open();t.ajax.history.obFrame.contentWindow.document.write(t.ajax.history.expected_hash);t.ajax.history.obFrame.contentWindow.document.close()}else if(t.browser.IsOpera()){t.ajax.history.obImage=document.createElement("IMG");t.hide_object(t.ajax.history.obImage);document.body.appendChild(t.ajax.history.obImage);t.ajax.history.obImage.setAttribute("src","javascript:location.href = 'javascript:BX.ajax.history.__hashListener();';")}}t.ajax.history.bInited=true},__hashListener:function(a){a=a||e.event||{state:false};if(t.ajax.history.bPushState){t.ajax.history.obParams.setState(a.state||t.ajax.history.startState)}else{if(t.ajax.history.obTimer){e.clearTimeout(t.ajax.history.obTimer);t.ajax.history.obTimer=null}var r;if(null!=t.ajax.history.obFrame)r=t.ajax.history.obFrame.contentWindow.document.body.innerText;else r=e.location.hash;if(!r||r=="#")r="__bx_no_hash__";if(r.indexOf("#")==0)r=r.substring(1);if(r!=t.ajax.history.expected_hash){var n=d.get(r);if(n){t.ajax.history.obParams.setState(n);t.ajax.history.expected_hash=r;if(null!=t.ajax.history.obFrame){var s=r=="__bx_no_hash__"?"":r;if(e.location.hash!=s&&e.location.hash!="#"+s)e.location.hash=s}}}t.ajax.history.obTimer=setTimeout(t.ajax.history.__hashListener,500)}},put:function(a,r,n,s){if(this.bPushState){if(!s){history.pushState(a,"",r)}else{t.ajax.history.startState=a}}else{if(typeof n!="undefined")r=n;else r="view"+r;d.put(r,a);t.ajax.history.expected_hash=r;e.location.hash=t.util.urlencode(r);if(null!=t.ajax.history.obFrame){t.ajax.history.obFrame.contentWindow.document.open();t.ajax.history.obFrame.contentWindow.document.write(r);t.ajax.history.obFrame.contentWindow.document.close()}}},checkRedirectStart:function(a,r){var n=e.location.hash;if(n.substring(0,1)=="#")n=n.substring(1);var s=n.substring(0,5);if(s=="view/"||s=="view%"){t.ajax.history.bHashCollision=true;document.write("<"+'div id="__ajax_hash_collision_'+r+'" style="display: none;">')}},checkRedirectFinish:function(a,r){document.write("</div>");var n=e.location.hash;if(n.substring(0,1)=="#")n=n.substring(1);t.ready((function(){var e=n.substring(0,5);if(e=="view/"||e=="view%"){var s=t("__ajax_hash_collision_"+r);var o=s.firstChild;t.cleanNode(o);s.style.display="block";if(e!="view%")n=t.util.urlencode(n);n+=(n.indexOf("%3F")==-1?"%3F":"%26")+a+"="+r;var i="/bitrix/tools/ajax_redirector.php?hash="+n;t.ajax.insertToNode(i,o)}}))}};t.ajax.component=function(e){this.node=e};t.ajax.component.prototype.getState=function(){var a={node:this.node,title:e.document.title,data:t(this.node).innerHTML};var r=t("navigation");if(null!=r)a.nav_chain=r.innerHTML;t.onCustomEvent(t(a.node),"onComponentAjaxHistoryGetState",[a]);return a};t.ajax.component.prototype.setState=function(e){t(e.node).innerHTML=e.data;t.ajax.UpdatePageTitle(e.title);if(e.nav_chain){t.ajax.UpdatePageNavChain(e.nav_chain)}t.onCustomEvent(t(e.node),"onComponentAjaxHistorySetState",[e])};var d={arHistory:{},put:function(e,t){this.arHistory[e]=t},get:function(e){return this.arHistory[e]}};t.ajax.FormData=function(){this.elements=[];this.files=[];this.features={};this.isSupported();this.log("BX FormData init")};t.ajax.FormData.isSupported=function(){var e=new t.ajax.FormData;var a=e.features.supported;e=null;return a};t.ajax.FormData.prototype.log=function(e){if(false){try{if(t.browser.IsIE())e=JSON.stringify(e);console.log(e)}catch(e){}}};t.ajax.FormData.prototype.isSupported=function(){var t={};t.fileReader=e.FileReader&&e.FileReader.prototype.readAsBinaryString;t.readFormData=t.sendFormData=!!e.FormData;t.supported=!!(t.readFormData&&t.sendFormData);this.features=t;this.log("features:");this.log(t);return t.supported};t.ajax.FormData.prototype.append=function(e,t){if(typeof t==="object"){this.files.push({name:e,value:t})}else{this.elements.push({name:e,value:t})}};t.ajax.FormData.prototype.send=function(e,a,r,n){this.log("FD send");this.xhr=t.ajax({method:"POST",dataType:"html",url:e,onsuccess:a,onfailure:n,start:false,preparePost:false});if(r){this.xhr.upload.addEventListener("progress",(function(e){if(e.lengthComputable)r(e.loaded/(e.total||e.totalSize))}),false)}if(this.features.readFormData&&this.features.sendFormData){var s=new FormData;this.log("use browser formdata");for(var o in this.elements){if(this.elements.hasOwnProperty(o))s.append(this.elements[o].name,this.elements[o].value)}for(o in this.files){if(this.files.hasOwnProperty(o))s.append(this.files[o].name,this.files[o].value)}this.xhr.send(s)}return this.xhr};t.addCustomEvent("onAjaxFailure",t.debug)})(window);
//# sourceMappingURL=core_ajax.map.js