Your IP : 18.118.28.31


Current Path : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/location/core/dist/
Upload File :
Current File : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/location/core/dist/core.bundle.min.js

this.BX=this.BX||{};this.BX.Location=this.BX.Location||{};(function(e,t,r,n,i){"use strict";function a(e,t,r){l(e,t);t.set(e,r)}function l(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var s=new WeakMap;var o=function(){function e(t){babelHelpers.classCallCheck(this,e);a(this,s,{writable:true,value:void 0});if(typeof t.type==="undefined"){throw new Error("Field type must be defined")}babelHelpers.classPrivateFieldSet(this,s,parseInt(t.type))}babelHelpers.createClass(e,[{key:"type",get:function e(){return babelHelpers.classPrivateFieldGet(this,s)}}]);return e}();function u(e,t){var r=typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=c(e))||t&&e&&typeof e.length==="number"){if(r)e=r;var n=0;var i=function e(){};return{s:i,n:function t(){if(n>=e.length)return{done:true};return{done:false,value:e[n++]}},e:function e(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a=true,l=false,s;return{s:function t(){r=r.call(e)},n:function e(){var t=r.next();a=t.done;return t},e:function e(t){l=true;s=t},f:function e(){try{if(!a&&r["return"]!=null)r["return"]()}finally{if(l)throw s}}}}function c(e,t){if(!e)return;if(typeof e==="string")return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor)r=e.constructor.name;if(r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}function f(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function p(e,t,r){b(e,t);t.set(e,r)}function b(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var d=new WeakMap;var h=function(){function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);p(this,d,{writable:true,value:{}});this.fields=t.fields?t.fields:[]}babelHelpers.createClass(e,[{key:"isFieldExists",value:function e(t){return typeof babelHelpers.classPrivateFieldGet(this,d)[t]!=="undefined"}},{key:"getField",value:function e(t){return this.isFieldExists(t)?babelHelpers.classPrivateFieldGet(this,d)[t]:null}},{key:"setField",value:function e(t){if(!(t instanceof o)){throw new Error("Argument field must be instance of Field!")}babelHelpers.classPrivateFieldGet(this,d)[t.type]=t;return this}},{key:"deleteField",value:function e(t){if(this.isFieldExists(t)){delete babelHelpers.classPrivateFieldGet(this,d)[t]}}},{key:"getMaxFieldType",value:function e(){var t=Object.keys(babelHelpers.classPrivateFieldGet(this,d)).sort((function(e,t){return parseInt(e)-parseInt(t)}));var r=0;if(t.length>0){r=t[t.length-1]}return r}},{key:"isEqual",value:function t(r,n){return e.areEqual(this,r,n)&&e.areEqual(r,this,n)}},{key:"fields",set:function e(t){if(!Array.isArray(t)){throw new Error("Items must be array!")}var r=u(t),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;this.setField(i)}}catch(e){r.e(e)}finally{r.f()}return this},get:function e(){return babelHelpers.classPrivateFieldGet(this,d)}}],[{key:"areEqual",value:function e(t,r,n){for(var i in t.fields){if(i>n){continue}var a=r.getField(i);if(!a){return false}if(t.fields[i].value!==a.value){return false}}return true}}]);return e}();function v(e,t,r){y(e,t);t.set(e,r)}function y(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var g=new WeakMap;var E=function(e){babelHelpers.inherits(t,e);function t(e){var r;babelHelpers.classCallCheck(this,t);r=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));v(babelHelpers.assertThisInitialized(r),g,{writable:true,value:void 0});babelHelpers.classPrivateFieldSet(babelHelpers.assertThisInitialized(r),g,e.value||"");return r}babelHelpers.createClass(t,[{key:"value",get:function e(){return babelHelpers.classPrivateFieldGet(this,g)},set:function e(t){babelHelpers.classPrivateFieldSet(this,g,t);return this}}]);return t}(o);var w=function(e){babelHelpers.inherits(t,e);function t(){babelHelpers.classCallCheck(this,t);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).apply(this,arguments))}babelHelpers.createClass(t,[{key:"getFieldValue",value:function e(t){var r=null;if(this.isFieldExists(t)){var n=this.getField(t);if(n){r=n.value}}return r}},{key:"setFieldValue",value:function e(t,r){this.setField(new E({type:t,value:r}));return this}}]);return t}(h);function H(e,t,r){T(e,t);t.set(e,r)}function T(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var m=new WeakMap;var P=new WeakMap;var C=function(){function e(t){babelHelpers.classCallCheck(this,e);H(this,m,{writable:true,value:void 0});H(this,P,{writable:true,value:void 0});babelHelpers.classPrivateFieldSet(this,m,t.entityId);babelHelpers.classPrivateFieldSet(this,P,t.entityType)}babelHelpers.createClass(e,[{key:"entityId",get:function e(){return babelHelpers.classPrivateFieldGet(this,m)}},{key:"entityType",get:function e(){return babelHelpers.classPrivateFieldGet(this,P)}}]);return e}();function k(e,t){var r=typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=F(e))||t&&e&&typeof e.length==="number"){if(r)e=r;var n=0;var i=function e(){};return{s:i,n:function t(){if(n>=e.length)return{done:true};return{done:false,value:e[n++]}},e:function e(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a=true,l=false,s;return{s:function t(){r=r.call(e)},n:function e(){var t=r.next();a=t.done;return t},e:function e(t){l=true;s=t},f:function e(){try{if(!a&&r["return"]!=null)r["return"]()}finally{if(l)throw s}}}}function F(e,t){if(!e)return;if(typeof e==="string")return S(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor)r=e.constructor.name;if(r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(e,t)}function S(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function A(e,t,r){_(e,t);t.set(e,r)}function _(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var I=new WeakMap;var R=function(){function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);A(this,I,{writable:true,value:[]});this.links=!!t.links?t.links:[]}babelHelpers.createClass(e,[{key:"addLink",value:function e(t){if(!(t instanceof C)){throw new Error("Argument link must be instance of Field!")}babelHelpers.classPrivateFieldGet(this,I).push(t)}},{key:"clearLinks",value:function e(){babelHelpers.classPrivateFieldSet(this,I,[])}},{key:"links",set:function e(t){if(!Array.isArray(t)){throw new Error("links must be array!")}var r=k(t),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;this.addLink(i)}}catch(e){r.e(e)}finally{r.f()}},get:function e(){return babelHelpers.classPrivateFieldGet(this,I)}}]);return e}();function O(e,t,r){L(e,t);t.set(e,r)}function L(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var x=new WeakMap;var M=new WeakMap;var G=new WeakMap;var j=function(e){babelHelpers.inherits(t,e);function t(e){var r;babelHelpers.classCallCheck(this,t);r=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));O(babelHelpers.assertThisInitialized(r),x,{writable:true,value:void 0});O(babelHelpers.assertThisInitialized(r),M,{writable:true,value:void 0});O(babelHelpers.assertThisInitialized(r),G,{writable:true,value:void 0});babelHelpers.classPrivateFieldSet(babelHelpers.assertThisInitialized(r),x,parseInt(e.sort));babelHelpers.classPrivateFieldSet(babelHelpers.assertThisInitialized(r),M,e.name||"");babelHelpers.classPrivateFieldSet(babelHelpers.assertThisInitialized(r),G,e.description||"");return r}babelHelpers.createClass(t,[{key:"sort",get:function e(){return babelHelpers.classPrivateFieldGet(this,x)},set:function e(t){babelHelpers.classPrivateFieldSet(this,x,t)}},{key:"name",get:function e(){return babelHelpers.classPrivateFieldGet(this,M)},set:function e(t){babelHelpers.classPrivateFieldSet(this,M,t)}},{key:"description",get:function e(){return babelHelpers.classPrivateFieldGet(this,G)},set:function e(t){babelHelpers.classPrivateFieldSet(this,G,t)}}]);return t}(o);var N=function(e){babelHelpers.inherits(t,e);function t(){babelHelpers.classCallCheck(this,t);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).apply(this,arguments))}babelHelpers.createClass(t,[{key:"initFields",value:function e(t){var r=this;if(Array.isArray(t)){t.forEach((function(e){var t=new j(e);if(t){r.setField(t)}}))}}}]);return t}(h);var B=function e(){babelHelpers.classCallCheck(this,e)};babelHelpers.defineProperty(B,"UNKNOWN",0);babelHelpers.defineProperty(B,"COUNTRY",100);babelHelpers.defineProperty(B,"ADM_LEVEL_1",200);babelHelpers.defineProperty(B,"ADM_LEVEL_2",210);babelHelpers.defineProperty(B,"ADM_LEVEL_3",220);babelHelpers.defineProperty(B,"ADM_LEVEL_4",230);babelHelpers.defineProperty(B,"LOCALITY",300);babelHelpers.defineProperty(B,"SUB_LOCALITY",310);babelHelpers.defineProperty(B,"SUB_LOCALITY_LEVEL_1",320);babelHelpers.defineProperty(B,"SUB_LOCALITY_LEVEL_2",330);babelHelpers.defineProperty(B,"STREET",340);babelHelpers.defineProperty(B,"BUILDING",400);babelHelpers.defineProperty(B,"ADDRESS_LINE_1",410);babelHelpers.defineProperty(B,"FLOOR",420);babelHelpers.defineProperty(B,"ROOM",430);babelHelpers.defineProperty(B,"TMP_TYPE_HINT",5010);babelHelpers.defineProperty(B,"TMP_TYPE_CLARIFICATION",5020);var D=function(e){babelHelpers.inherits(t,e);function t(){babelHelpers.classCallCheck(this,t);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).apply(this,arguments))}return t}(B);babelHelpers.defineProperty(D,"POSTAL_CODE",50);babelHelpers.defineProperty(D,"ADDRESS_LINE_2",600);babelHelpers.defineProperty(D,"RECIPIENT_COMPANY",700);babelHelpers.defineProperty(D,"RECIPIENT",710);babelHelpers.defineProperty(D,"PO_BOX",800);var Y=function e(t,r){babelHelpers.classCallCheck(this,e);this.type=t;this.template=r};function W(e,t,r){U(e,t);t.set(e,r)}function U(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var z=new WeakMap;var J=function(){function e(t){babelHelpers.classCallCheck(this,e);W(this,z,{writable:true,value:{}});for(var r in t){if(t.hasOwnProperty(r)){this.setTemplate(new Y(r,t[r]))}}}babelHelpers.createClass(e,[{key:"isTemplateExists",value:function e(t){return typeof babelHelpers.classPrivateFieldGet(this,z)[t]!=="undefined"}},{key:"getTemplate",value:function e(t){return this.isTemplateExists(t)?babelHelpers.classPrivateFieldGet(this,z)[t]:null}},{key:"setTemplate",value:function e(t){if(!(t instanceof Y)){throw new Error("Argument template must be instance of FormatTemplate!")}babelHelpers.classPrivateFieldGet(this,z)[t.type]=t}}]);return e}();var V=function e(){babelHelpers.classCallCheck(this,e)};babelHelpers.defineProperty(V,"DEFAULT","DEFAULT");babelHelpers.defineProperty(V,"AUTOCOMPLETE","AUTOCOMPLETE");babelHelpers.defineProperty(V,"ADDRESS_LINE_1","ADDRESS_LINE_1");var X=function(){function e(r){babelHelpers.classCallCheck(this,e);if(t.Type.isUndefined(r.languageId)){throw new TypeError("LanguageId must be defined")}this.languageId=r.languageId;this.code=r.code||"";this.name=r.name||"";this.templateAutocomplete=r.templateAutocomplete||"";this.templateAddressLine1=r.templateAddressLine1||"";this.description=r.description||"";this.delimiter=r.delimiter||", ";this.fieldForUnRecognized=r.fieldForUnRecognized||D.UNKNOWN;this.fieldCollection=new N;if(t.Type.isObject(r.fieldCollection)){this.fieldCollection.initFields(r.fieldCollection)}var n={};if(t.Type.isObject(r.templateCollection)){n=r.templateCollection}this.templateCollection=new J(n)}babelHelpers.createClass(e,[{key:"getField",value:function e(t){return this.fieldCollection.getField(t)}},{key:"isFieldExists",value:function e(t){return this.fieldCollection.isFieldExists(t)}},{key:"getTemplate",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:V.DEFAULT;return this.templateCollection.getTemplate(t)}},{key:"isTemplateExists",value:function e(t){return this.templateCollection.isTemplateExists(t)}},{key:"template",get:function e(){return this.templateCollection.getTemplate()}}]);return e}();function q(e,t){K(e,t);t.add(e)}function $(e,t,r){K(e,t);t.set(e,r)}function K(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function Z(e,t,r){if(!t.has(e)){throw new TypeError("attempted to get private field on non-instance")}return r}var Q="#S#";var ee="\\s*,\\s*";var te='(\\"([^"\\\\]*|\\\\"|\\\\\\\\|\\\\)*")';var re=te;var ne="([a-zA-Z][a-zA-Z_0-9]*(:(NU|UN|N|U))?)";var ie="\\s*\\]";var ae=ie;var le="\\s*,\\s*\\[\\s*";var se='(([^\\[\\\\]|\\\\\\[|\\\\\\\\)*)(\\[\\s*)("([^"\\\\]*|\\\\"|\\\\\\\\|\\\\)*")\\s*,\\s*\\[\\s*';var oe=1100;var ue=1110;var ce=1120;var fe=1130;var pe=1140;var be=1150;var de=1160;var he=1170;var ve=1180;var ye=1190;var ge=1200;var Ee=1210;var we=new WeakMap;var He=new WeakMap;var Te=new WeakMap;var me=new WeakMap;var Pe=new WeakSet;var Ce=new WeakSet;var ke=new WeakSet;var Fe=function(){function e(t,r,n){var i=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;babelHelpers.classCallCheck(this,e);q(this,ke);q(this,Ce);q(this,Pe);$(this,we,{writable:true,value:""});$(this,He,{writable:true,value:""});$(this,Te,{writable:true,value:false});$(this,me,{writable:true,value:null});babelHelpers.classPrivateFieldSet(this,we,t);babelHelpers.classPrivateFieldSet(this,He,r);babelHelpers.classPrivateFieldSet(this,Te,n);babelHelpers.classPrivateFieldSet(this,me,i)}babelHelpers.createClass(e,[{key:"getErrorCodes",value:function e(){var t={};t[oe]="ERR_PARSE_GROUP_START_POSITION";t[ue]="ERR_PARSE_GROUP_START";t[ce]="ERR_PARSE_GROUP_DELIMITER";t[fe]="ERR_PARSE_PART_FROM_DELIMITER_TO_FIELD_LIST";t[pe]="ERR_PARSE_GROUP_FIELD_TEXT";t[be]="ERR_PARSE_GROUP_FIELD_NAME";t[de]="ERR_PARSE_GROUP_FIELD";t[he]="ERR_PARSE_GROUP_FIELD_LIST";t[ve]="ERR_PARSE_GROUP_FIELD_LIST_DELIMITER";t[ye]="ERR_PARSE_GROUP_FIELD_LIST_END";t[ge]="ERR_PARSE_GROUP_END";t[Ee]="ERR_PARSE_GROUP";return t}},{key:"getErrorsText",value:function e(r){var n="";var i=this.getErrorCodes();var a=r["error"]["errors"];for(var l=0;l<a.length;l++){n+="Error: ".concat(a[l]["position"],", ").concat(i[a[l]["code"]],"\n");if(a[l].hasOwnProperty("info")&&t.Type.isPlainObject(a[l]["info"])){var s=a[l]["info"];var o=true;for(var u in s){if(s.hasOwnProperty(u)){var c=s[u];var f=false;if(t.Type.isString(c)){c='"'.concat(c,'"');f=true}else if(t.Type.isNumber(c)||t.Type.isFloat(c)){f=true}else if(t.Type.isBoolean(c)){c=c?"true":"false";f=true}else if(t.Type.isArray(c)){c="[...]";f=true}else if(t.Type.isObject(c)){c="{...}";f=true}if(f){if(o){n+="  Error info:\n";o=false}n+="    ".concat(u,": ").concat(c,"\n")}}}}}var p=r["template"].replace("\n","\\n");p=p.replace('"','\\"');n+='Template: "'.concat(p,'"\n\n');return n}},{key:"createContext",value:function e(){return{level:0,position:0,template:"",address:null,info:{},hasError:false,error:{code:0,position:0,errors:[],info:{}}}}},{key:"clearContextInfo",value:function e(t){t["info"]={};return t}},{key:"clearContextError",value:function e(t){t["hasError"]=false;t["error"]={code:0,position:0,errors:[],info:{}};return t}},{key:"clearContextInfoAndError",value:function e(t){return this.clearContextError(this.clearContextInfo(t))}},{key:"unescapeText",value:function e(t){var r="";var n;for(n=0;n<t.length;n++){if(t[n]==="\\"){if(t.length-n>1){r+=t[++n]}}else{r+=t[n]}}return r}},{key:"parseGroupDelimiter",value:function e(t){var r=t["position"];var n=new RegExp(te,"mg");n.lastIndex=r;var i=n.exec(t["template"]);if(i&&i.index===r){t["info"]={position:r,end:r+i[0].length,value:this.unescapeText(t["template"].substr(r+1,i[0].length-2))};t["position"]=t["info"]["end"]}else{this.addContextError(t,ce,r)}return t}},{key:"parseFieldText",value:function e(t){var r=t["position"];var n=new RegExp(re,"mg");n.lastIndex=r;var i=n.exec(t["template"]);if(i&&i.index===r){t["info"]={type:"text",position:r,end:r+i[0].length,value:this.unescapeText(t["template"].substr(r+1,i[0].length-2))};t["position"]=t["info"]["end"]}else{this.addContextError(t,pe,r)}return t}},{key:"splitFieldName",value:function e(t){var r=t.split(":");var n=r[0];var i=r.length>1?r[1]:"";return[n,i]}},{key:"getAddressFieldValue",value:function e(r,n,i){var a="";if(!t.Type.isUndefined(D[n])){if(n==="ADM_LEVEL_1"||n==="ADM_LEVEL_2"){a=Z(this,ke,_e).call(this,r,D[n])}else{a=r.getFieldValue(D[n])}if(a===null){a=Z(this,Ce,Ae).call(this,n,r)}}if(!t.Type.isString(a)){a=""}if(a!==""){if(i.indexOf("N")>=0){a=a.replace(/(\r\n|\n|\r)/g,"#S#")}if(i.indexOf("U")>=0){a=a.toUpperCase()}}return a}},{key:"parseFieldName",value:function e(t){var r=t["position"];var n=new RegExp(ne,"mg");n.lastIndex=r;var i=n.exec(t["template"]);if(i&&i.index===r){t["position"]=r+i[0].length;var a=this.splitFieldName(i[0]);var l=a[0];var s=a[1];var o=this.getAddressFieldValue(t["address"],l,s);t["info"]={type:"field",position:r,end:t["position"],modifiers:s,name:l,value:o}}else{this.addContextError(t,be,r)}return t}},{key:"parseFieldListDelimiter",value:function e(t){var r=t["position"];var n=new RegExp(ee,"mg");n.lastIndex=r;var i=n.exec(t["template"]);if(i&&i.index===r){t["position"]=r+i[0].length}else{this.addContextError(t,ve,r)}return t}},{key:"parseFieldListEnd",value:function e(t){var r=t["position"];var n=new RegExp(ie,"mg");n.lastIndex=r;var i=n.exec(t["template"]);if(i&&i.index===r){t["position"]=r+i[0].length}else{this.addContextError(t,ye,r)}return t}},{key:"parseField",value:function e(t){var r=[];var n=t["position"];var i=[];t=this.parseFieldText(t);if(t["hasError"]){this.unshiftError(i,t["error"]["code"],t["error"]["position"]);t=this.clearContextInfoAndError(t);t=this.parseFieldName(t)}if(t["hasError"]){this.unshiftError(i,t["error"]["code"],t["error"]["position"]);t=this.clearContextInfoAndError(t);t=this.parseGroup(t);if(t["hasError"]){this.unshiftError(i,t["error"]["code"],t["error"]["position"])}else if(t["info"]["position"]>n){this.addContextError(t,oe,n);this.unshiftError(i,t["error"]["code"],t["error"]["position"])}}if(!t["hasError"]){r=t["info"];r["isFieldListEnd"]=false;t=this.clearContextInfo(t);t=this.parseFieldListDelimiter(t);if(t["hasError"]){this.unshiftError(i,t["error"]["code"],t["error"]["position"]);t=this.clearContextInfoAndError(t);t=this.parseFieldListEnd(t);if(t["hasError"]){this.unshiftError(i,t["error"]["code"],t["error"]["position"])}else{r["isFieldListEnd"]=true}}}if(t["hasError"]){this.unshiftError(i,de,n);this.addContextErrors(t,i)}else{t["info"]=r}return t}},{key:"parseGroupFieldList",value:function e(t){var r=t["position"];var n=[];var i=new RegExp(le,"mg");i.lastIndex=r;var a=i.exec(t["template"]);if(a&&a.index===r){t["position"]=r+a[0].length;var l=false;while(!(t["hasError"]||l)){t=this.parseField(t);if(!t["hasError"]){l=t["info"].hasOwnProperty("isFieldListEnd")&&t["info"]["isFieldListEnd"];if(t["info"]["value"]!==""){n.push(t["info"]["value"])}t=this.clearContextInfo(t)}}if(!t["hasError"]){t["info"]={fieldValues:n}}}else{this.addContextError(t,fe,r)}if(t["hasError"]){this.addContextError(t,he,r)}return t}},{key:"parseGroupStart",value:function e(t){var r=new RegExp(se,"mg");r.lastIndex=t["position"];var n=r.exec(t["template"]);if(n){t["info"]["groupStartPosition"]=n.index+n[1].length;t["info"]["groupDelimiterStartPosition"]=n.index+n[1].length+n[3].length}else{this.addContextError(t,ue,t["position"])}return t}},{key:"parseGroupEnd",value:function e(t){var r=t["position"];var n=new RegExp(ae,"mg");n.lastIndex=r;var i=n.exec(t["template"]);if(i&&i.index===r){t["position"]=r+i[0].length}else{this.addContextError(t,ge,r)}return t}},{key:"parseGroup",value:function e(t){var r=t["position"];var n=0;var i="";var a=[];t["level"]++;t=this.parseGroupStart(t);if(!t["hasError"]){n=t["info"]["groupStartPosition"];t["position"]=t["info"]["groupDelimiterStartPosition"];t=this.clearContextInfo(t);t=this.parseGroupDelimiter(t)}if(!t["hasError"]){i=t["info"]["value"];t=this.clearContextInfo(t);t=this.parseGroupFieldList(t)}if(!t["hasError"]){a=t["info"]["fieldValues"];t=this.clearContextInfo(t);t=this.parseGroupEnd(t)}if(!t["hasError"]){a=babelHelpers.toConsumableArray(new Set(a));var l=a.join(i);var s=new RegExp("(".concat(i,"){2,}"),"gim");l=l.replace(new RegExp(s),i);t["info"]={type:"group",position:n,end:t["position"],value:l}}t["level"]--;if(t["hasError"]){this.addContextError(t,Ee,r,{groupStartPosition:n})}return t}},{key:"appendTextBlock",value:function e(t,r,n){var i=t.length-1;var a=i>=0?t[i]:null;if(a&&a.hasOwnProperty("type")&&a["type"]==="text"){t[i]["value"]+=n;t[i]["length"]+=n.length}else{t[++i]={type:"text",position:r,length:n.length,value:n}}}},{key:"appendGroupBlock",value:function e(t,r,n){t.push({type:"group",position:r,length:n.length,value:n})}},{key:"unshiftError",value:function e(r,n,i){var a=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;r.unshift({code:n,position:i,info:t.Type.isPlainObject(a)?a:{}})}},{key:"addContextError",value:function e(r,n,i){var a=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;r["hasError"]=true;r["error"]["code"]=n;r["error"]["position"]=i;r["error"]["info"]=t.Type.isPlainObject(a)?a:{};this.unshiftError(r["error"]["errors"],n,i,a)}},{key:"addContextErrors",value:function e(r,n){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;r["hasError"]=true;r["error"]["code"]=n[0]["code"];r["error"]["position"]=n[0]["position"];r["error"]["info"]=t.Type.isPlainObject(i)?i:{};r["error"]["errors"].splice(0,0,n)}},{key:"parseBlocks",value:function e(r){var n=[];var i=r["template"].length;while(r["position"]<i){var a=r["position"];r=this.parseGroup(r);if(r["hasError"]){var l=r["error"]["info"];var s=void 0;if(!t.Type.isPlainObject(l)&&l.hasOwnProperty("groupStartPosition")&&l["groupStartPosition"]>a){s=l["groupStartPosition"]-a+1}else{s=1}this.appendTextBlock(n,r["error"]["position"],r["template"].substr(a,s));r=this.clearContextInfoAndError(r);r["position"]=a+s}else{var o=r["info"]["position"];if(o>a){this.appendTextBlock(n,a,r["template"].substr(a,o-a))}if(r["info"]["value"]!==""){this.appendGroupBlock(n,o,r["info"]["value"])}r=this.clearContextInfo(r)}}if(!r["hasError"]){r["info"]={blocks:n}}return r}},{key:"convert",value:function e(r){var n="";var i=this.createContext();i["template"]=babelHelpers.classPrivateFieldGet(this,we);i["address"]=r;i=this.parseBlocks(i);if(!i["hasError"]){var a=i["info"]["blocks"];for(var l=0;l<a.length;l++){if(a[l]["type"]==="text"){n+=this.unescapeText(a[l]["value"])}else{n+=a[l]["value"]}}}if(n!==""){var s=n.split(Q);var o=[];for(var u=0;u<s.length;u++){if(s[u]!==""){o.push(s[u])}}if(babelHelpers.classPrivateFieldGet(this,Te)&&o.length>0){for(var c=0;c<o.length;c++){o[c]=t.Text.encode(o[c])}}n=o.join(babelHelpers.classPrivateFieldGet(this,He))}return n}}]);return e}();function Se(e){return babelHelpers.classPrivateFieldGet(this,me)&&babelHelpers.classPrivateFieldGet(this,me).getTemplate(e)!==null}function Ae(e,t){if(!Z(this,Pe,Se).call(this,e)){return null}var r=babelHelpers.classPrivateFieldGet(this,me).getTemplate(e).template;var n=new Fe(r,babelHelpers.classPrivateFieldGet(this,He),babelHelpers.classPrivateFieldGet(this,Te),babelHelpers.classPrivateFieldGet(this,me));return n.convert(t)}function _e(e,r){var n=e.getFieldValue(D.LOCALITY);n=t.Type.isString(n)?n:"";var i=e.getFieldValue(r);if(!t.Type.isString(i)){i=""}if(i!==""&&n!==""){var a=n.toUpperCase();var l=i.toUpperCase();if(l.length>=a.length){var s=l.substr(l.length-a.length);if(a===s){i=""}}}return i}var Ie=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"convertAddressToString",value:function t(r,n,i,a){var l;if(i===e.STRATEGY_TYPE_TEMPLATE||i===e.STRATEGY_TYPE_TEMPLATE_COMMA||i===e.STRATEGY_TYPE_TEMPLATE_NL||i===e.STRATEGY_TYPE_TEMPLATE_BR){var s=null;switch(i){case e.STRATEGY_TYPE_TEMPLATE_COMMA:s=", ";break;case e.STRATEGY_TYPE_TEMPLATE_NL:s="\n";break;case e.STRATEGY_TYPE_TEMPLATE_BR:s="<br />";break}l=e.convertAddressToStringTemplate(r,n.getTemplate(),a,s,n)}else if(i===e.STRATEGY_TYPE_FIELD_SORT){var o=function e(t,r){return t.sort-r.sort};l=e.convertAddressToStringByField(r,n,o,a)}else if(i===e.STRATEGY_TYPE_FIELD_TYPE){var u=function e(t,r){var n;if(t.type===0){n=1}else if(r.type===0){n=-1}else{n=t.type-r.type}return n};l=e.convertAddressToStringByField(r,n,u,a)}else{throw TypeError("Wrong strategyType")}return l}},{key:"convertAddressToStringTemplate",value:function t(r,n,i){var a=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var l=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;var s=i===e.CONTENT_TYPE_HTML;if(a===null){a=s?"<br />":"\n"}var o=new Fe(n.template,a,s,l);return o.convert(r)}},{key:"convertAddressToStringByField",value:function r(n,i,a,l){if(!(i instanceof X)){BX.debug("format must be instance of Format")}if(!(n instanceof qe)){BX.debug("address must be instance of Address")}var s=i.fieldCollection;if(!s){return""}var o=Object.values(s.fields);o.sort(a);var u="";for(var c=0,f=o;c<f.length;c++){var p=f[c];var b=n.getFieldValue(p.type);if(b===null){continue}if(l===e.CONTENT_TYPE_HTML){b=t.Text.encode(b)}if(u!==""){u+=i.delimiter}u+=b}return u}}]);return e}();babelHelpers.defineProperty(Ie,"STRATEGY_TYPE_TEMPLATE","template");babelHelpers.defineProperty(Ie,"STRATEGY_TYPE_TEMPLATE_COMMA","template_comma");babelHelpers.defineProperty(Ie,"STRATEGY_TYPE_TEMPLATE_NL","template_nl");babelHelpers.defineProperty(Ie,"STRATEGY_TYPE_TEMPLATE_BR","template_br");babelHelpers.defineProperty(Ie,"STRATEGY_TYPE_FIELD_SORT","field_sort");babelHelpers.defineProperty(Ie,"STRATEGY_TYPE_FIELD_TYPE","field_type");babelHelpers.defineProperty(Ie,"CONTENT_TYPE_HTML","html");babelHelpers.defineProperty(Ie,"CONTENT_TYPE_TEXT","text");function Re(e,t,r){Oe(e,t);return r}function Oe(e,t){if(e!==t){throw new TypeError("Private static access of wrong provenance")}}var Le=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"convertJsonToAddress",value:function e(t){return new qe(t)}},{key:"convertAddressToJson",value:function t(r){var n={id:r.id,languageId:r.languageId,latitude:r.latitude,longitude:r.longitude,fieldCollection:Re(e,e,xe).call(e,r.fieldCollection),links:Re(e,e,Me).call(e,r.links),location:null};if(r.location){n.location=JSON.parse(r.location.toJson())}return JSON.stringify(n)}}]);return e}();function xe(e){var t={};Object.values(e.fields).forEach((function(e){t[e.type]=e.value}));return t}function Me(e){return e.map((function(e){return{entityId:e.entityId,entityType:e.entityType}}))}function Ge(e,t){var r=typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=je(e))||t&&e&&typeof e.length==="number"){if(r)e=r;var n=0;var i=function e(){};return{s:i,n:function t(){if(n>=e.length)return{done:true};return{done:false,value:e[n++]}},e:function e(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a=true,l=false,s;return{s:function t(){r=r.call(e)},n:function e(){var t=r.next();a=t.done;return t},e:function e(t){l=true;s=t},f:function e(){try{if(!a&&r["return"]!=null)r["return"]()}finally{if(l)throw s}}}}function je(e,t){if(!e)return;if(typeof e==="string")return Ne(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor)r=e.constructor.name;if(r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ne(e,t)}function Ne(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Be(e,t,r){De(e,t);t.set(e,r)}function De(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var Ye=new WeakMap;var We=new WeakMap;var Ue=new WeakMap;var ze=new WeakMap;var Je=new WeakMap;var Ve=new WeakMap;var Xe=new WeakMap;var qe=function(){function e(r){babelHelpers.classCallCheck(this,e);Be(this,Ye,{writable:true,value:void 0});Be(this,We,{writable:true,value:void 0});Be(this,Ue,{writable:true,value:void 0});Be(this,ze,{writable:true,value:void 0});Be(this,Je,{writable:true,value:void 0});Be(this,Ve,{writable:true,value:void 0});Be(this,Xe,{writable:true,value:void 0});if(t.Type.isUndefined(r.languageId)){throw new TypeError("languageId must be defined")}babelHelpers.classPrivateFieldSet(this,We,r.languageId);babelHelpers.classPrivateFieldSet(this,Ye,r.id||0);babelHelpers.classPrivateFieldSet(this,Ue,r.latitude||"");babelHelpers.classPrivateFieldSet(this,ze,r.longitude||"");babelHelpers.classPrivateFieldSet(this,Je,new w);if(t.Type.isObject(r.fieldCollection)){for(var n=0,i=Object.entries(r.fieldCollection);n<i.length;n++){var a=babelHelpers.slicedToArray(i[n],2),l=a[0],s=a[1];this.setFieldValue(l,s)}}babelHelpers.classPrivateFieldSet(this,Ve,new R);if(t.Type.isArray(r.links)){var o=Ge(r.links),u;try{for(o.s();!(u=o.n()).done;){var c=u.value;this.addLink(c.entityId,c.entityType)}}catch(e){o.e(e)}finally{o.f()}}babelHelpers.classPrivateFieldSet(this,Xe,null);if(r.location){if(r.location instanceof Ht){babelHelpers.classPrivateFieldSet(this,Xe,r.location)}else if(t.Type.isObject(r.location)){babelHelpers.classPrivateFieldSet(this,Xe,new Ht(r.location))}else{BX.debug("Wrong typeof props.location")}}}babelHelpers.createClass(e,[{key:"setFieldValue",value:function e(t,r){babelHelpers.classPrivateFieldGet(this,Je).setFieldValue(t,r)}},{key:"getFieldValue",value:function e(t){return babelHelpers.classPrivateFieldGet(this,Je).getFieldValue(t)}},{key:"isFieldExists",value:function e(t){return babelHelpers.classPrivateFieldGet(this,Je).isFieldExists(t)}},{key:"toJson",value:function e(){return Le.convertAddressToJson(this)}},{key:"toString",value:function e(t,r,n){if(!(t instanceof X)){console.error("format must be instance of Format");return""}var i=r||Ie.STRATEGY_TYPE_TEMPLATE;var a=n||Ie.CONTENT_TYPE_HTML;return Ie.convertAddressToString(this,t,i,a)}},{key:"toLocation",value:function e(){var t=null;if(this.location){var r=JSON.parse(this.location.toJson());r.address=JSON.parse(this.toJson());t=new Ht(r)}return t}},{key:"getType",value:function e(){return babelHelpers.classPrivateFieldGet(this,Je).getMaxFieldType()}},{key:"addLink",value:function e(t,r){babelHelpers.classPrivateFieldGet(this,Ve).addLink(new C({entityId:t,entityType:r}))}},{key:"clearLinks",value:function e(){babelHelpers.classPrivateFieldGet(this,Ve).clearLinks()}},{key:"id",get:function e(){return babelHelpers.classPrivateFieldGet(this,Ye)},set:function e(t){babelHelpers.classPrivateFieldSet(this,Ye,t)}},{key:"location",get:function e(){return babelHelpers.classPrivateFieldGet(this,Xe)},set:function e(t){babelHelpers.classPrivateFieldSet(this,Xe,t)}},{key:"languageId",get:function e(){return babelHelpers.classPrivateFieldGet(this,We)}},{key:"fieldCollection",get:function e(){return babelHelpers.classPrivateFieldGet(this,Je)}},{key:"latitude",get:function e(){return babelHelpers.classPrivateFieldGet(this,Ue)},set:function e(t){babelHelpers.classPrivateFieldSet(this,Ue,t)}},{key:"longitude",get:function e(){return babelHelpers.classPrivateFieldGet(this,ze)},set:function e(t){babelHelpers.classPrivateFieldSet(this,ze,t)}},{key:"links",get:function e(){return babelHelpers.classPrivateFieldGet(this,Ve).links}}]);return e}();function $e(e,t,r){Ke(e,t);t.set(e,r)}function Ke(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var Ze=new WeakMap;var Qe=function(e){babelHelpers.inherits(t,e);function t(e){var r;babelHelpers.classCallCheck(this,t);r=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));$e(babelHelpers.assertThisInitialized(r),Ze,{writable:true,value:void 0});babelHelpers.classPrivateFieldSet(babelHelpers.assertThisInitialized(r),Ze,e.value||"");return r}babelHelpers.createClass(t,[{key:"value",get:function e(){return babelHelpers.classPrivateFieldGet(this,Ze)},set:function e(t){babelHelpers.classPrivateFieldSet(this,Ze,t)}}]);return t}(o);var et=function(e){babelHelpers.inherits(t,e);function t(){babelHelpers.classCallCheck(this,t);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).apply(this,arguments))}babelHelpers.createClass(t,[{key:"getFieldValue",value:function e(t){var r=null;if(this.isFieldExists(t)){var n=this.getField(t);if(n){r=n.value}}return r}},{key:"setFieldValue",value:function e(t,r){this.setField(new Qe({type:t,value:r}));return this}}]);return t}(h);function tt(e,t,r){rt(e,t);return r}function rt(e,t){if(e!==t){throw new TypeError("Private static access of wrong provenance")}}var nt=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"convertLocationToObject",value:function t(r){if(!(r instanceof Ht)){throw new TypeError("location must be type of location")}var n={id:r.id,code:r.code,externalId:r.externalId,sourceCode:r.sourceCode,type:r.type,name:r.name,languageId:r.languageId,latitude:r.latitude,longitude:r.longitude,fieldCollection:tt(e,e,it).call(e,r.fieldCollection),address:null};if(r.address){n.address=JSON.parse(r.address.toJson())}return n}}]);return e}();function it(e){var t={};Object.values(e.fields).forEach((function(e){t[e.type]=e.value}));return t}function at(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function lt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?at(Object(r),!0).forEach((function(t){babelHelpers.defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):at(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var st=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"convertJsonToLocation",value:function e(t){var r=lt({},t);if(t.address){r.address=new qe(t.address)}return new Ht(r)}},{key:"convertLocationToJson",value:function e(t){if(!(t instanceof Ht)){throw new TypeError("location must be type of location")}var r=nt.convertLocationToObject(t);return r?JSON.stringify(r):""}}]);return e}();function ot(e,t,r){ut(e,t);t.set(e,r)}function ut(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var ct=new WeakMap;var ft=new WeakMap;var pt=new WeakMap;var bt=new WeakMap;var dt=new WeakMap;var ht=new WeakMap;var vt=new WeakMap;var yt=new WeakMap;var gt=new WeakMap;var Et=new WeakMap;var wt=new WeakMap;var Ht=function(){function e(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);ot(this,ct,{writable:true,value:void 0});ot(this,ft,{writable:true,value:void 0});ot(this,pt,{writable:true,value:void 0});ot(this,bt,{writable:true,value:void 0});ot(this,dt,{writable:true,value:void 0});ot(this,ht,{writable:true,value:void 0});ot(this,vt,{writable:true,value:void 0});ot(this,yt,{writable:true,value:void 0});ot(this,gt,{writable:true,value:void 0});ot(this,Et,{writable:true,value:void 0});ot(this,wt,{writable:true,value:void 0});babelHelpers.classPrivateFieldSet(this,ct,parseInt(r.id)||0);babelHelpers.classPrivateFieldSet(this,ft,r.code||"");babelHelpers.classPrivateFieldSet(this,pt,r.externalId||"");babelHelpers.classPrivateFieldSet(this,bt,r.sourceCode||"");babelHelpers.classPrivateFieldSet(this,dt,parseInt(r.type)||0);babelHelpers.classPrivateFieldSet(this,ht,r.name||"");babelHelpers.classPrivateFieldSet(this,vt,r.languageId||"");babelHelpers.classPrivateFieldSet(this,yt,r.latitude||"");babelHelpers.classPrivateFieldSet(this,gt,r.longitude||"");babelHelpers.classPrivateFieldSet(this,wt,new et);if(t.Type.isObject(r.fieldCollection)){for(var n=0,i=Object.entries(r.fieldCollection);n<i.length;n++){var a=babelHelpers.slicedToArray(i[n],2),l=a[0],s=a[1];this.setFieldValue(l,s)}}babelHelpers.classPrivateFieldSet(this,Et,null);if(r.address){if(r.address instanceof qe){babelHelpers.classPrivateFieldSet(this,Et,r.address)}else if(babelHelpers["typeof"](r.address)==="object"){babelHelpers.classPrivateFieldSet(this,Et,new qe(r.address))}else{BX.debug("Wrong typeof props.address")}}}babelHelpers.createClass(e,[{key:"toJson",value:function e(){return st.convertLocationToJson(this)}},{key:"toAddress",value:function e(){var t=null;if(this.address){var r=JSON.parse(this.address.toJson());r.location=JSON.parse(this.toJson());t=new qe(r)}return t}},{key:"setFieldValue",value:function e(t,r){babelHelpers.classPrivateFieldGet(this,wt).setFieldValue(t,r)}},{key:"getFieldValue",value:function e(t){return babelHelpers.classPrivateFieldGet(this,wt).getFieldValue(t)}},{key:"isFieldExists",value:function e(t){return babelHelpers.classPrivateFieldGet(this,wt).isFieldExists(t)}},{key:"hasExternalRelation",value:function e(){return babelHelpers.classPrivateFieldGet(this,pt)&&babelHelpers.classPrivateFieldGet(this,bt)}},{key:"id",get:function e(){return babelHelpers.classPrivateFieldGet(this,ct)},set:function e(t){babelHelpers.classPrivateFieldSet(this,ct,t)}},{key:"code",get:function e(){return babelHelpers.classPrivateFieldGet(this,ft)},set:function e(t){babelHelpers.classPrivateFieldSet(this,ft,t)}},{key:"externalId",get:function e(){return babelHelpers.classPrivateFieldGet(this,pt)},set:function e(t){babelHelpers.classPrivateFieldSet(this,pt,t)}},{key:"sourceCode",get:function e(){return babelHelpers.classPrivateFieldGet(this,bt)},set:function e(t){babelHelpers.classPrivateFieldSet(this,bt,t)}},{key:"type",get:function e(){return babelHelpers.classPrivateFieldGet(this,dt)},set:function e(t){babelHelpers.classPrivateFieldSet(this,dt,t)}},{key:"name",get:function e(){return babelHelpers.classPrivateFieldGet(this,ht)},set:function e(t){babelHelpers.classPrivateFieldSet(this,ht,t)}},{key:"languageId",get:function e(){return babelHelpers.classPrivateFieldGet(this,vt)},set:function e(t){babelHelpers.classPrivateFieldSet(this,vt,t)}},{key:"latitude",get:function e(){return babelHelpers.classPrivateFieldGet(this,yt)},set:function e(t){babelHelpers.classPrivateFieldSet(this,yt,t)}},{key:"longitude",get:function e(){return babelHelpers.classPrivateFieldGet(this,gt)},set:function e(t){babelHelpers.classPrivateFieldSet(this,gt,t)}},{key:"address",set:function e(t){babelHelpers.classPrivateFieldSet(this,Et,t)},get:function e(){return babelHelpers.classPrivateFieldGet(this,Et)}},{key:"fieldCollection",get:function e(){return babelHelpers.classPrivateFieldGet(this,wt)}}]);return e}();function Tt(e,t,r){mt(e,t);t.set(e,r)}function mt(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var Pt=new WeakMap;var Ct=function(){function e(t){babelHelpers.classCallCheck(this,e);Tt(this,Pt,{writable:true,value:""});if(!t.path){throw new Error("props.path must not be empty!")}babelHelpers.classPrivateFieldSet(this,Pt,t.path)}babelHelpers.createClass(e,[{key:"run",value:function e(t,r){if(!t){throw new Error("action can not be empty!")}return BX.ajax.runAction("".concat(babelHelpers.classPrivateFieldGet(this,Pt),".").concat(t),{data:r})}}]);return e}();function kt(e,t){var r=typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ft(e))||t&&e&&typeof e.length==="number"){if(r)e=r;var n=0;var i=function e(){};return{s:i,n:function t(){if(n>=e.length)return{done:true};return{done:false,value:e[n++]}},e:function e(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a=true,l=false,s;return{s:function t(){r=r.call(e)},n:function e(){var t=r.next();a=t.done;return t},e:function e(t){l=true;s=t},f:function e(){try{if(!a&&r["return"]!=null)r["return"]()}finally{if(l)throw s}}}}function Ft(e,t){if(!e)return;if(typeof e==="string")return St(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor)r=e.constructor.name;if(r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return St(e,t)}function St(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function At(e,t,r){_t(e,t);t.set(e,r)}function _t(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var It=new WeakMap;var Rt=function(){function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);At(this,It,{writable:true,value:null});this._path=t.path;if(t.actionRunner&&t.actionRunner instanceof Ct){babelHelpers.classPrivateFieldSet(this,It,t.actionRunner)}else{babelHelpers.classPrivateFieldSet(this,It,new Ct({path:this._path}))}}babelHelpers.createClass(e,[{key:"processResponse",value:function e(t){if(t.status!=="success"){BX.debug("Request was not successful");var r="";if(Array.isArray(t.errors)&&t.errors.length>0){var n=kt(t.errors),i;try{for(n.s();!(i=n.n()).done;){var a=i.value;if(typeof a.message==="string"&&a.message!==""){r+="".concat(a,"\n")}}}catch(e){n.e(e)}finally{n.f()}}throw new Error(r)}return t.data?t.data:null}},{key:"path",get:function e(){return this._path}},{key:"actionRunner",get:function e(){return babelHelpers.classPrivateFieldGet(this,It)}}]);return e}();function Ot(e,t){Lt(e,t);t.add(e)}function Lt(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function xt(e,t,r){if(!t.has(e)){throw new TypeError("attempted to get private field on non-instance")}return r}var Mt=new WeakSet;var Gt=new WeakSet;var jt=function(e){babelHelpers.inherits(t,e);function t(){var e;var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,t);r.path=r.path||"location.api.location";e=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,r));Ot(babelHelpers.assertThisInitialized(e),Gt);Ot(babelHelpers.assertThisInitialized(e),Mt);return e}babelHelpers.createClass(t,[{key:"findParents",value:function e(t){if(!(t instanceof Ht)){throw new TypeError("location must be type of Location")}return this.actionRunner.run("findParents",{location:nt.convertLocationToObject(t)}).then(this.processResponse.bind(this)).then(xt(this,Mt,Nt).bind(this))}},{key:"findByExternalId",value:function e(t,r,n){if(!t||!r||!n){throw new Error("externalId and sourceCode and languageId must be defined")}return this.actionRunner.run("findByExternalId",{externalId:t,sourceCode:r,languageId:n}).then(this.processResponse.bind(this)).then(xt(this,Gt,Bt).bind(this))}},{key:"findById",value:function e(t,r){if(!t||!r){throw new Error("locationId and languageId must be defined")}return this.actionRunner.run("findById",{id:t,languageId:r}).then(this.processResponse.bind(this)).then(xt(this,Gt,Bt).bind(this))}}]);return t}(Rt);function Nt(e){var t=this;if(!Array.isArray(e)){throw new Error("Can't convert location collection data")}var r=[];e.forEach((function(e){r.push(xt(t,Gt,Bt).call(t,e))}));return r}function Bt(e){if(!e){return null}if(babelHelpers["typeof"](e)!=="object"){throw new Error("Can't convert location data")}return st.convertJsonToLocation(e)}var Dt=function(e){babelHelpers.inherits(t,e);function t(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,t);e.path="location.api.address";return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e))}babelHelpers.createClass(t,[{key:"findById",value:function e(t){var r=this;if(t<=0){throw new Error("addressId must be more than zero")}return this.actionRunner.run("findById",{addressId:t}).then(this.processResponse).then((function(e){var t=null;if(e){t=r.convertJsonToAddress(e)}return t}))}},{key:"save",value:function e(t){var r=this;if(!t){throw new Error("address must be defined")}return this.actionRunner.run("save",{address:t}).then(this.processResponse).then((function(e){var t=null;if(babelHelpers["typeof"](e)==="object"){t=r.convertJsonToAddress(e)}return t}))}},{key:"convertJsonToAddress",value:function e(t){return new n.Address(t)}}]);return t}(Rt);var Yt=function(e){babelHelpers.inherits(r,e);function r(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,r);e.path="location.api.format";return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(r).call(this,e))}babelHelpers.createClass(r,[{key:"findAll",value:function e(r){var n=this;if(!t.Type.isString(r)){throw new TypeError("languageId must be type of string")}return this.actionRunner.run("findAll",{languageId:r}).then(this.processResponse).then((function(e){return n.convertFormatCollection(e)}))}},{key:"findByCode",value:function e(r,n){if(!t.Type.isString(r)){throw new TypeError("formatCode must be type of string")}if(!t.Type.isString(n)){throw new TypeError("languageId must be type of string")}return this.actionRunner.run("findByCode",{formatCode:r,languageId:n}).then(this.processResponse).then(this.convertFormatData)}},{key:"findDefault",value:function e(r){if(!t.Type.isString(r)){throw new TypeError("languageId must be type of string")}return this.actionRunner.run("findDefault",{languageId:r}).then(this.processResponse).then(this.convertFormatData)}},{key:"convertFormatCollection",value:function e(r){var n=this;if(!t.Type.isArray(r)){throw new TypeError("Can't convert format collection data")}var i=[];r.forEach((function(e){i.push(n.convertFormatData(e))}));return i}},{key:"convertFormatData",value:function e(r){if(!t.Type.isObject(r)){throw new TypeError("Can't convert format data")}return new X(r)}}]);return r}(Rt);var Wt=function(e){babelHelpers.inherits(t,e);function t(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,t);e.path="location.api.source";return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e))}babelHelpers.createClass(t,[{key:"getProps",value:function e(){return this.actionRunner.run("getProps",{}).then(this.processResponse)}}]);return t}(Rt);var Ut=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,[{key:"autocomplete",value:function e(t,r){throw new Error("Method autocomplete() Must be implemented")}}]);return e}();function zt(e,t){var r=typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Jt(e))||t&&e&&typeof e.length==="number"){if(r)e=r;var n=0;var i=function e(){};return{s:i,n:function t(){if(n>=e.length)return{done:true};return{done:false,value:e[n++]}},e:function e(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a=true,l=false,s;return{s:function t(){r=r.call(e)},n:function e(){var t=r.next();a=t.done;return t},e:function e(t){l=true;s=t},f:function e(){try{if(!a&&r["return"]!=null)r["return"]()}finally{if(l)throw s}}}}function Jt(e,t){if(!e)return;if(typeof e==="string")return Vt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor)r=e.constructor.name;if(r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Vt(e,t)}function Vt(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Xt(e,t,r){qt(e,t);return r}function qt(e,t){if(e!==t){throw new TypeError("Private static access of wrong provenance")}}var $t=100;var Kt=5*1024*1024;var Zt=3600;var Qt=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"set",value:function t(r,n,i){var a=Xt(e,e,tr).call(e,r);a.push({hash:Xt(e,e,rr).call(e,n),data:i});BX.localStorage.set(Xt(e,e,nr).call(e,r),Xt(e,e,er).call(e,a),Zt)}},{key:"get",value:function t(r,n){var i=Xt(e,e,rr).call(e,n);var a=Xt(e,e,tr).call(e,r);var l=zt(a),s;try{for(l.s();!(s=l.n()).done;){var o=s.value;if(o&&o.hash===i){return o}}}catch(e){l.e(e)}finally{l.f()}return null}}]);return e}();function er(e){if(new Blob([JSON.stringify(e)]).size>Kt){return[]}if(e.length>$t){return e.slice(e.length-$t)}return e}function tr(e){var t=BX.localStorage.get(Xt(Qt,Qt,nr).call(Qt,e));return Array.isArray(t)?t:[]}function rr(e){return r.md5(JSON.stringify(e))}function nr(e){return"location".concat(e,"AutocompleteCache")}var ir=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,[{key:"requestPhotos",value:function e(t){throw new Error("Must be implemented")}}]);return e}();var ar=function(e){babelHelpers.inherits(t,e);function t(){var e;babelHelpers.classCallCheck(this,t);e=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this));e.setEventNamespace("BX.Location.Core.MapBase");return e}babelHelpers.createClass(t,[{key:"render",value:function e(t){throw new Error("Must be implemented")}},{key:"panTo",value:function e(t,r){throw new Error("Must be implemented")}},{key:"onLocationChangedEventSubscribe",value:function e(t){throw new Error("Must be implemented")}},{key:"onMapShow",value:function e(){}},{key:"destroy",value:function e(){}},{key:"location",set:function e(t){throw new Error("Must be implemented")}},{key:"mode",set:function e(t){throw new Error("Must be implemented")}},{key:"zoom",set:function e(t){throw new Error("Must be implemented")}}],[{key:"getZoomByLocation",value:function e(t){var r=18;if(!t){return r}var i=t.type;if(i<=0){return r}if(i<n.LocationType.COUNTRY){return 1}else if(i===n.LocationType.COUNTRY){return 4}else if(i<=n.LocationType.ADM_LEVEL_1){return 6}else if(i<=n.LocationType.LOCALITY){return 11}else if(i<=n.LocationType.STREET){return 16}return r}}]);return t}(i.EventEmitter);var lr=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,[{key:"sourceCode",get:function e(){throw new Error("Must be implemented")}},{key:"map",get:function e(){throw new Error("Must be implemented")}},{key:"autocompleteService",get:function e(){throw new Error("Must be implemented")}},{key:"photoService",get:function e(){throw new Error("Must be implemented")}},{key:"geocodingService",get:function e(){throw new Error("Must be implemented")}}]);return e}();var sr=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,[{key:"geocode",value:function e(t){if(!t){return Promise.resolve([])}return this.geocodeConcrete(t)}},{key:"geocodeConcrete",value:function e(t){throw new Error("Method geocodeConcrete() must be implemented")}}]);return e}();var or=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"isValid",value:function t(r){return r===e.edit||r===e.view}},{key:"edit",get:function e(){return"edit"}},{key:"view",get:function e(){return"view"}}]);return e}();var ur=function e(){babelHelpers.classCallCheck(this,e)};babelHelpers.defineProperty(ur,"POSTAL_CODE",50);babelHelpers.defineProperty(ur,"ISO_3166_1_ALPHA_2",1e3);var cr=function(e){babelHelpers.inherits(t,e);function t(){babelHelpers.classCallCheck(this,t);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).apply(this,arguments))}return t}(babelHelpers.wrapNativeSuper(Error));var fr=function(e){babelHelpers.inherits(t,e);function t(){babelHelpers.classCallCheck(this,t);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).apply(this,arguments))}return t}(babelHelpers.wrapNativeSuper(Error));function pr(e,t,r,n){vr(e,t);hr(r,"set");br(e,r,n);return n}function br(e,t,r){if(t.set){t.set.call(e,r)}else{if(!t.writable){throw new TypeError("attempted to set read only private field")}t.value=r}}function dr(e,t,r){vr(e,t);hr(r,"get");return yr(e,r)}function hr(e,t){if(e===undefined){throw new TypeError("attempted to "+t+" private static field before its declaration")}}function vr(e,t){if(e!==t){throw new TypeError("Private static access of wrong provenance")}}function yr(e,t){if(t.get){return t.get.call(e)}return t.value}var gr=function(e){babelHelpers.inherits(t,e);babelHelpers.createClass(t,null,[{key:"getInstance",value:function e(){if(dr(t,t,Er)===null){pr(t,t,Er,new t)}return dr(t,t,Er)}}]);function t(){var e;babelHelpers.classCallCheck(this,t);e=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this));e.setEventNamespace("BX.Location.Core.ErrorPublisher");return e}babelHelpers.createClass(t,[{key:"notify",value:function e(r){this.emit(dr(t,t,wr),{errors:r})}},{key:"subscribe",value:function e(r){babelHelpers.get(babelHelpers.getPrototypeOf(t.prototype),"subscribe",this).call(this,dr(t,t,wr),r)}}]);return t}(i.EventEmitter);var Er={writable:true,value:null};var wr={writable:true,value:"onError"};function Hr(e,t,r){Tr(e,t);t.set(e,r)}function Tr(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function mr(e,t,r,n){Fr(e,t);kr(r,"set");Pr(e,r,n);return n}function Pr(e,t,r){if(t.set){t.set.call(e,r)}else{if(!t.writable){throw new TypeError("attempted to set read only private field")}t.value=r}}function Cr(e,t,r){Fr(e,t);kr(r,"get");return Sr(e,r)}function kr(e,t){if(e===undefined){throw new TypeError("attempted to "+t+" private static field before its declaration")}}function Fr(e,t){if(e!==t){throw new TypeError("Private static access of wrong provenance")}}function Sr(e,t){if(t.get){return t.get.call(e)}return t.value}var Ar=new WeakMap;var _r=function(){function e(){babelHelpers.classCallCheck(this,e);Hr(this,Ar,{writable:true,value:"bitrixLocationLastAddress"})}babelHelpers.createClass(e,[{key:"lastAddress",set:function e(t){if(t){BX.localStorage.set(babelHelpers.classPrivateFieldGet(this,Ar),{json:t.toJson()},86400*30)}},get:function e(){var t=BX.localStorage.get(babelHelpers.classPrivateFieldGet(this,Ar));if(t&&t["json"]){try{return Le.convertJsonToAddress(JSON.parse(t["json"]))}catch(e){}}return null}}],[{key:"getInstance",value:function t(){if(Cr(e,e,Ir)===null){mr(e,e,Ir,new e)}return Cr(e,e,Ir)}}]);return e}();var Ir={writable:true,value:null};function Rr(e,t,r){Or(e,t);t.set(e,r)}function Or(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var Lr=new WeakMap;var xr=new WeakMap;var Mr=function(){function e(t,r){babelHelpers.classCallCheck(this,e);Rr(this,Lr,{writable:true,value:void 0});Rr(this,xr,{writable:true,value:void 0});babelHelpers.classPrivateFieldSet(this,Lr,t);babelHelpers.classPrivateFieldSet(this,xr,r)}babelHelpers.createClass(e,[{key:"toArray",value:function e(){return[this.latitude,this.longitude]}},{key:"latitude",get:function e(){return babelHelpers.classPrivateFieldGet(this,Lr)}},{key:"longitude",get:function e(){return babelHelpers.classPrivateFieldGet(this,xr)}}],[{key:"fromJson",value:function t(r){return new e(r.latitude,r.longitude)}}]);return e}();var Gr=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"getDistanceFromLatLonInKm",value:function t(r,n,i,a){var l=6371;var s=e.deg2rad(i-r);var o=e.deg2rad(a-n);var u=Math.sin(s/2)*Math.sin(s/2)+Math.cos(e.deg2rad(r))*Math.cos(e.deg2rad(i))*Math.sin(o/2)*Math.sin(o/2);var c=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u));return l*c}},{key:"deg2rad",value:function e(t){return t*(Math.PI/180)}}]);return e}();e.Location=Ht;e.Address=qe;e.Format=X;e.AddressType=D;e.LocationType=B;e.LocationFieldType=ur;e.FormatTemplateType=V;e.FormatTemplate=Y;e.FormatTemplateCollection=J;e.LocationRepository=jt;e.AddressRepository=Dt;e.FormatRepository=Yt;e.SourceRepository=Wt;e.AddressStringConverter=Ie;e.AutocompleteServiceBase=Ut;e.AutocompleteCache=Qt;e.PhotoServiceBase=ir;e.BaseSource=lr;e.MapBase=ar;e.GeocodingServiceBase=sr;e.LocationJsonConverter=st;e.ControlMode=or;e.SourceCreationError=cr;e.MethodNotImplemented=fr;e.ErrorPublisher=gr;e.Storage=_r;e.Point=Mr;e.DistanceCalculator=Gr})(this.BX.Location.Core=this.BX.Location.Core||{},BX,BX,BX.Location.Core,BX.Event);
//# sourceMappingURL=core.bundle.map.js