2 lines
107 KiB
JavaScript
Executable File
2 lines
107 KiB
JavaScript
Executable File
!function(){"use strict";var E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function R(t,e){return t(e={exports:{}},e.exports),e.exports}var F="object"==typeof E&&E&&E.Object===Object&&E,t="object"==typeof self&&self&&self.Object===Object&&self,i=F||t||Function("return this")(),t=i.Symbol;var P=function(t,e){for(var n=-1,i=null==t?0:t.length,o=Array(i);++n<i;)o[n]=e(t[n],n,t);return o},h=Array.isArray,e=Object.prototype,H=e.hasOwnProperty,z=e.toString,D=t?t.toStringTag:void 0;var U=function(t){var e=H.call(t,D),n=t[D];try{var i=!(t[D]=void 0)}catch(t){}var o=z.call(t);return i&&(e?t[D]=n:delete t[D]),o},G=Object.prototype.toString;var V=function(t){return G.call(t)},W=t?t.toStringTag:void 0;var n=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(W&&W in Object(t)?U:V)(t)};var s=function(t){return null!=t&&"object"==typeof t};var K=function(t){return"symbol"==typeof t||s(t)&&"[object Symbol]"==n(t)},e=t?t.prototype:void 0,X=e?e.toString:void 0;var Y=function t(e){if("string"==typeof e)return e;if(h(e))return P(e,t)+"";if(K(e))return X?X.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n};var q=function(t){return null==t?"":Y(t)};var Z=function(t,e,n){for(var i=-1,o=t.length,r=((n=o<n?o:n)<0&&(n+=o),o=n<(e=e<0?o<-e?0:o+e:e)?0:n-e>>>0,e>>>=0,Array(o));++i<o;)r[i]=t[i+e];return r};var J=function(t,e,n){var i=t.length;return n=void 0===n?i:n,!e&&i<=n?t:Z(t,e,n)},$=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Q=function(t){return $.test(t)};var tt=function(t){return t.split("")},e="\\ud800-\\udfff",o="["+e+"]",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",a="\\ud83c[\\udffb-\\udfff]",e="[^"+e+"]",c="(?:\\ud83c[\\udde6-\\uddff]){2}",l="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",d="[\\ufe0e\\ufe0f]?",d=d+u+("(?:\\u200d(?:"+[e,c,l].join("|")+")"+d+u+")*"),u="(?:"+[e+r+"?",r,c,l,o].join("|")+")",et=RegExp(a+"(?="+a+")|"+u+d,"g");var nt=function(t){return t.match(et)||[]};var it=function(t){return(Q(t)?nt:tt)(t)};var ot=function(i){return function(t){t=q(t);var e=Q(t)?it(t):void 0,n=e?e[0]:t.charAt(0),e=e?J(e,1).join(""):t.slice(1);return n[i]()+e}}("toUpperCase");var rt=function(t){return ot(q(t).toLowerCase())};var st=function(t,e){for(var n=-1,i=null==t?0:t.length,o=0,r=[];++n<i;){var s=t[n];e(s,n,t)&&(r[o++]=s)}return r};var at=function(c){return function(t,e,n){for(var i=-1,o=Object(t),r=n(t),s=r.length;s--;){var a=r[c?s:++i];if(!1===e(o[a],a,o))break}return t}}();var ct=function(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i};var e=function(t){return s(t)&&"[object Arguments]"==n(t)},r=Object.prototype,lt=r.hasOwnProperty,ut=r.propertyIsEnumerable,ht=e(function(){return arguments}())?e:function(t){return s(t)&<.call(t,"callee")&&!ut.call(t,"callee")};function dt(){return!1}var pt=R(function(t,e){var e=e&&!e.nodeType&&e,n=e&&t&&!t.nodeType&&t,n=n&&n.exports===e?i.Buffer:void 0,e=n?n.isBuffer:void 0;t.exports=e||dt}),ft=/^(?:0|[1-9]\d*)$/;var mt=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&ft.test(t))&&-1<t&&t%1==0&&t<e};var vt=function(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991},p={};p["[object Float32Array]"]=p["[object Float64Array]"]=p["[object Int8Array]"]=p["[object Int16Array]"]=p["[object Int32Array]"]=p["[object Uint8Array]"]=p["[object Uint8ClampedArray]"]=p["[object Uint16Array]"]=p["[object Uint32Array]"]=!0,p["[object Arguments]"]=p["[object Array]"]=p["[object ArrayBuffer]"]=p["[object Boolean]"]=p["[object DataView]"]=p["[object Date]"]=p["[object Error]"]=p["[object Function]"]=p["[object Map]"]=p["[object Number]"]=p["[object Object]"]=p["[object RegExp]"]=p["[object Set]"]=p["[object String]"]=p["[object WeakMap]"]=!1;function gt(t){return s(t)&&vt(t.length)&&!!p[n(t)]}var c=function(e){return function(t){return e(t)}},l=R(function(t,e){var e=e&&!e.nodeType&&e,n=e&&t&&!t.nodeType&&t,i=n&&n.exports===e&&F.process,e=function(){try{var t=n&&n.require&&n.require("util").types;return t?t:i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=e}),o=l&&l.isTypedArray,_t=o?c(o):gt,yt=Object.prototype.hasOwnProperty;var bt=function(t,e){var n,i=h(t),o=!i&&ht(t),r=!i&&!o&&pt(t),s=!i&&!o&&!r&&_t(t),a=i||o||r||s,c=a?ct(t.length,String):[],l=c.length;for(n in t)!e&&!yt.call(t,n)||a&&("length"==n||r&&("offset"==n||"parent"==n)||s&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||mt(n,l))||c.push(n);return c},wt=Object.prototype;var Ct=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||wt)};var It=function(e,n){return function(t){return e(n(t))}}(Object.keys,Object),kt=Object.prototype.hasOwnProperty;var St=function(t){if(!Ct(t))return It(t);var e,n=[];for(e in Object(t))kt.call(t,e)&&"constructor"!=e&&n.push(e);return n};var _=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};var At=function(t){return!!_(t)&&("[object Function]"==(t=n(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)};var f=function(t){return null!=t&&vt(t.length)&&!At(t)};var m=function(t){return(f(t)?bt:St)(t)};var Ot=function(r,s){return function(t,e){if(null==t)return t;if(!f(t))return r(t,e);for(var n=t.length,i=s?n:-1,o=Object(t);(s?i--:++i<n)&&!1!==e(o[i],i,o););return t}}(function(t,e){return t&&at(t,e,m)});function Et(t,i){var o=[];return Ot(t,function(t,e,n){i(t,e,n)&&o.push(t)}),o}var Tt=function(t,e){return t===e||t!=t&&e!=e};var xt=function(t,e){for(var n=t.length;n--;)if(Tt(t[n][0],e))return n;return-1},Mt=Array.prototype.splice;function jt(t){var e=this.__data__;return!((t=xt(e,t))<0)&&(t==e.length-1?e.pop():Mt.call(e,t,1),--this.size,!0)}function Lt(t){var e=this.__data__;return(t=xt(e,t))<0?void 0:e[t][1]}function Nt(t){return-1<xt(this.__data__,t)}function Bt(t,e){var n=this.__data__,i=xt(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}function v(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}v.prototype.clear=function(){this.__data__=[],this.size=0},v.prototype.delete=jt,v.prototype.get=Lt,v.prototype.has=Nt,v.prototype.set=Bt;var Rt=v;function Ft(){this.__data__=new Rt,this.size=0}function Pt(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t}function Ht(t){return this.__data__.get(t)}function zt(t){return this.__data__.has(t)}var a=i["__core-js_shared__"],Dt=(u=/[^.]+$/.exec(a&&a.keys&&a.keys.IE_PROTO||""))?"Symbol(src)_1."+u:"";var Ut=function(t){return!!Dt&&Dt in t},Gt=Function.prototype.toString;var g=function(t){if(null!=t){try{return Gt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Vt=/^\[object .+?Constructor\]$/,d=Function.prototype,r=Object.prototype,e=d.toString,l=r.hasOwnProperty,Wt=RegExp("^"+e.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Kt=function(t){return!(!_(t)||Ut(t))&&(At(t)?Wt:Vt).test(g(t))};var Xt=function(t,e){return null==t?void 0:t[e]};var y=function(t,e){return t=Xt(t,e),Kt(t)?t:void 0},Yt=y(i,"Map"),qt=y(Object,"create");function Zt(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t}var Jt=Object.prototype.hasOwnProperty;function $t(t){var e,n=this.__data__;return qt?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:Jt.call(n,t)?n[t]:void 0}var Qt=Object.prototype.hasOwnProperty;function te(t){var e=this.__data__;return qt?void 0!==e[t]:Qt.call(e,t)}function ee(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=qt&&void 0===e?"__lodash_hash_undefined__":e,this}function b(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}b.prototype.clear=function(){this.__data__=qt?qt(null):{},this.size=0},b.prototype.delete=Zt,b.prototype.get=$t,b.prototype.has=te,b.prototype.set=ee;var ne=b;var ie=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var oe=function(t,e){return t=t.__data__,ie(e)?t["string"==typeof e?"string":"hash"]:t.map};function re(t){return t=oe(this,t).delete(t),this.size-=t?1:0,t}function se(t){return oe(this,t).get(t)}function ae(t){return oe(this,t).has(t)}function ce(t,e){var n=oe(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}function w(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}w.prototype.clear=function(){this.size=0,this.__data__={hash:new ne,map:new(Yt||Rt),string:new ne}},w.prototype.delete=re,w.prototype.get=se,w.prototype.has=ae,w.prototype.set=ce;var le=w;function ue(t,e){var n=this.__data__;if(n instanceof Rt){var i=n.__data__;if(!Yt||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new le(i)}return n.set(t,e),this.size=n.size,this}function he(t){t=this.__data__=new Rt(t);this.size=t.size}he.prototype.clear=Ft,he.prototype.delete=Pt,he.prototype.get=Ht,he.prototype.has=zt,he.prototype.set=ue;var de=he;function pe(t){return this.__data__.has(t)}function fe(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new le;++e<n;)this.add(t[e])}fe.prototype.add=fe.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},fe.prototype.has=pe;var me=fe;var ve=function(t,e){for(var n=-1,i=null==t?0:t.length;++n<i;)if(e(t[n],n,t))return!0;return!1};var ge=function(t,e){return t.has(e)};var _e=function(t,e,n,i,o,r){var s=1&n,a=t.length,c=e.length;if(a!=c&&!(s&&a<c))return!1;if((c=r.get(t))&&r.get(e))return c==e;var l=-1,u=!0,h=2&n?new me:void 0;for(r.set(t,e),r.set(e,t);++l<a;){var d,p=t[l],f=e[l];if(void 0!==(d=i?s?i(f,p,l,e,t,r):i(p,f,l,t,e,r):d)){if(d)continue;u=!1;break}if(h){if(!ve(e,function(t,e){if(!ge(h,e)&&(p===t||o(p,t,n,i,r)))return h.push(e)})){u=!1;break}}else if(p!==f&&!o(p,f,n,i,r)){u=!1;break}}return r.delete(t),r.delete(e),u},ye=i.Uint8Array;function be(t){var n=-1,i=Array(t.size);return t.forEach(function(t,e){i[++n]=[e,t]}),i}function we(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var c=t?t.prototype:void 0,Ce=c?c.valueOf:void 0;var Ie=function(t,e,n,i,o,r,s){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return t.byteLength==e.byteLength&&r(new ye(t),new ye(e))?!0:!1;case"[object Boolean]":case"[object Date]":case"[object Number]":return Tt(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=be;case"[object Set]":a=a||we;if(t.size!=e.size&&!(1&i))return!1;var c=s.get(t);if(c)return c==e;i|=2,s.set(t,e);c=_e(a(t),a(e),i,o,r,s);return s.delete(t),c;case"[object Symbol]":if(Ce)return Ce.call(t)==Ce.call(e)}return!1};var ke=function(t,e){for(var n=-1,i=e.length,o=t.length;++n<i;)t[o+n]=e[n];return t};var Se=function(t,e,n){return e=e(t),h(t)?e:ke(e,n(t))};var Ae=Object.prototype.propertyIsEnumerable,Oe=Object.getOwnPropertySymbols,Ee=Oe?function(e){return null==e?[]:(e=Object(e),st(Oe(e),function(t){return Ae.call(e,t)}))}:function(){return[]};var Te=function(t){return Se(t,m,Ee)},xe=Object.prototype.hasOwnProperty;var Me=function(t,e,n,i,o,r){var s=1&n,a=Te(t),c=a.length;if(c!=Te(e).length&&!s)return!1;for(var l=c;l--;){var u=a[l];if(!(s?u in e:xe.call(e,u)))return!1}var h=r.get(t);if(h&&r.get(e))return h==e;for(var d,p=!0,f=(r.set(t,e),r.set(e,t),s);++l<c;){var m,v=t[u=a[l]],g=e[u];if(!(void 0===(m=i?s?i(g,v,u,e,t,r):i(v,g,u,t,e,r):m)?v===g||o(v,g,n,i,r):m)){p=!1;break}f=f||"constructor"==u}return p&&!f&&(h=t.constructor)!=(d=e.constructor)&&"constructor"in t&&"constructor"in e&&!("function"==typeof h&&h instanceof h&&"function"==typeof d&&d instanceof d)&&(p=!1),r.delete(t),r.delete(e),p},o=y(i,"DataView"),a=y(i,"Promise"),u=y(i,"Set"),d=y(i,"WeakMap"),je="[object Map]",Le="[object Promise]",Ne="[object Set]",Be="[object WeakMap]",Re="[object DataView]",Fe=g(o),Pe=g(Yt),He=g(a),ze=g(u),De=g(d),r=n,Ue=r=o&&r(new o(new ArrayBuffer(1)))!=Re||Yt&&r(new Yt)!=je||a&&r(a.resolve())!=Le||u&&r(new u)!=Ne||d&&r(new d)!=Be?function(t){var e=n(t),t="[object Object]"==e?t.constructor:void 0,t=t?g(t):"";if(t)switch(t){case Fe:return Re;case Pe:return je;case He:return Le;case ze:return Ne;case De:return Be}return e}:r,Ge="[object Arguments]",Ve="[object Array]",We="[object Object]",Ke=Object.prototype.hasOwnProperty;var Xe=function(t,e,n,i,o,r){var s=h(t),a=h(e),c=s?Ve:Ue(t),a=a?Ve:Ue(e),l=(c=c==Ge?We:c)==We,u=(a=a==Ge?We:a)==We;if((a=c==a)&&pt(t)){if(!pt(e))return!1;l=!(s=!0)}if(a&&!l)return r=r||new de,s||_t(t)?_e(t,e,n,i,o,r):Ie(t,e,c,n,i,o,r);if(!(1&n)){s=l&&Ke.call(t,"__wrapped__"),c=u&&Ke.call(e,"__wrapped__");if(s||c)return o(s?t.value():t,c?e.value():e,n,i,r=r||new de)}return!!a&&(r=r||new de,Me(t,e,n,i,o,r))};var Ye=function t(e,n,i,o,r){return e===n||(null==e||null==n||!s(e)&&!s(n)?e!=e&&n!=n:Xe(e,n,i,o,t,r))};var qe=function(t,e,n,i){var o=n.length,r=o,s=!i;if(null==t)return!r;for(t=Object(t);o--;){var a=n[o];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<r;){var c=(a=n[o])[0],l=t[c],u=a[1];if(s&&a[2]){if(void 0===l&&!(c in t))return!1}else{var h,d=new de;if(!(void 0===(h=i?i(l,u,c,t,e,d):h)?Ye(u,l,3,i,d):h))return!1}}return!0};var Ze=function(t){return t==t&&!_(t)};var Je=function(t){for(var e=m(t),n=e.length;n--;){var i=e[n],o=t[i];e[n]=[i,o,Ze(o)]}return e};var $e=function(e,n){return function(t){return null!=t&&(t[e]===n&&(void 0!==n||e in Object(t)))}};var Qe=function(e){var n=Je(e);return 1==n.length&&n[0][2]?$e(n[0][0],n[0][1]):function(t){return t===e||qe(t,e,n)}},tn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,en=/^\w*$/;var nn=function(t,e){if(h(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!K(t))||(en.test(t)||!tn.test(t)||null!=e&&t in Object(e))};function on(i,o){if("function"!=typeof i||null!=o&&"function"!=typeof o)throw new TypeError("Expected a function");function r(){var t=arguments,e=o?o.apply(this,t):t[0],n=r.cache;return n.has(e)?n.get(e):(t=i.apply(this,t),r.cache=n.set(e,t)||n,t)}return r.cache=new(on.Cache||le),r}on.Cache=le;var rn=on;var sn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,an=/\\(\\)?/g,cn=function(t){var e=(t=rn(t,function(t){return 500===e.size&&e.clear(),t})).cache;return t}(function(t){var o=[];return 46===t.charCodeAt(0)&&o.push(""),t.replace(sn,function(t,e,n,i){o.push(n?i.replace(an,"$1"):e||t)}),o});var ln=function(t,e){return h(t)?t:nn(t,e)?[t]:cn(q(t))};var un=function(t){if("string"==typeof t||K(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e};var hn=function(t,e){for(var n=0,i=(e=ln(e,t)).length;null!=t&&n<i;)t=t[un(e[n++])];return n&&n==i?t:void 0};var dn=function(t,e,n){return void 0===(t=null==t?void 0:hn(t,e))?n:t};function pn(t,e){return null!=t&&e in Object(t)}var fn=function(t,e,n){for(var i=-1,o=(e=ln(e,t)).length,r=!1;++i<o;){var s=un(e[i]);if(!(r=null!=t&&n(t,s)))break;t=t[s]}return r||++i!=o?r:!!(o=null==t?0:t.length)&&vt(o)&&mt(s,o)&&(h(t)||ht(t))};var mn=function(t,e){return null!=t&&fn(t,e,pn)};var vn=function(n,i){return nn(n)&&Ze(i)?$e(un(n),i):function(t){var e=dn(t,n);return void 0===e&&e===i?mn(t,n):Ye(i,e,3)}};function gn(t){return t}var _n=function(e){return function(t){return null==t?void 0:t[e]}};var yn=function(e){return function(t){return hn(t,e)}};var bn=function(t){return nn(t)?_n(un(t)):yn(t)};var wn=function(t){return"function"==typeof t?t:null==t?gn:"object"==typeof t?h(t)?vn(t[0],t[1]):Qe(t):bn(t)};var Cn=function(e){if("function"!=typeof e)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}};function In(){return C.promo}var kn=function(t,e){return(h(t)?st:Et)(t,Cn(wn(e)))},Sn=R(function(t,e){var n=E,i=e&&!e.nodeType&&e,e=t&&!t.nodeType&&t,o="object"==typeof E&&E;o.global!==o&&o.window!==o&&o.self!==o||(n=o);var r,s,v=2147483647,g=36,_=26,a=38,c=700,l=/^xn--/,u=/[^\x20-\x7E]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=g-1,y=Math.floor,b=String.fromCharCode;function w(t){throw new RangeError(d[t])}function f(t,e){for(var n=t.length,i=[];n--;)i[n]=e(t[n]);return i}function m(t,e){var n=t.split("@"),i="",n=(1<n.length&&(i=n[0]+"@",t=n[1]),(t=t.replace(h,".")).split("."));return i+f(n,e).join(".")}function C(t){for(var e,n,i=[],o=0,r=t.length;o<r;)55296<=(e=t.charCodeAt(o++))&&e<=56319&&o<r?56320==(64512&(n=t.charCodeAt(o++)))?i.push(((1023&e)<<10)+(1023&n)+65536):(i.push(e),o--):i.push(e);return i}function I(t){return f(t,function(t){var e="";return 65535<t&&(e+=b((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=b(t)}).join("")}function k(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function S(t,e,n){var i=0;for(t=n?y(t/c):t>>1,t+=y(t/e);p*_>>1<t;i+=g)t=y(t/p);return y(i+(p+1)*t/(t+a))}function A(t){var e,n,i,o,r,s,a,c=[],l=t.length,u=0,h=128,d=72,p=t.lastIndexOf("-");for(p<0&&(p=0),n=0;n<p;++n)128<=t.charCodeAt(n)&&w("not-basic"),c.push(t.charCodeAt(n));for(i=0<p?p+1:0;i<l;){for(o=u,r=1,s=g;l<=i&&w("invalid-input"),a=t.charCodeAt(i++),(g<=(a=a-48<10?a-22:a-65<26?a-65:a-97<26?a-97:g)||a>y((v-u)/r))&&w("overflow"),u+=a*r,!(a<(a=s<=d?1:d+_<=s?_:s-d));s+=g)r>y(v/(a=g-a))&&w("overflow"),r*=a;d=S(u-o,e=c.length+1,0==o),y(u/e)>v-h&&w("overflow"),h+=y(u/e),u%=e,c.splice(u++,0,h)}return I(c)}function O(t){for(var e,n,i,o,r,s,a,c,l,u,h=[],d=(t=C(t)).length,p=128,f=72,m=e=0;m<d;++m)(a=t[m])<128&&h.push(b(a));for(n=i=h.length,i&&h.push("-");n<d;){for(o=v,m=0;m<d;++m)p<=(a=t[m])&&a<o&&(o=a);for(o-p>y((v-e)/(c=n+1))&&w("overflow"),e+=(o-p)*c,p=o,m=0;m<d;++m)if((a=t[m])<p&&++e>v&&w("overflow"),a==p){for(r=e,s=g;!(r<(l=s<=f?1:f+_<=s?_:s-f));s+=g)h.push(b(k(l+(u=r-l)%(l=g-l),0))),r=y(u/l);h.push(b(k(r,0))),f=S(e,c,n==i),e=0,++n}++e,++p}return h.join("")}if(r={version:"1.4.1",ucs2:{decode:C,encode:I},decode:A,encode:O,toASCII:function(t){return m(t,function(t){return u.test(t)?"xn--"+O(t):t})},toUnicode:function(t){return m(t,function(t){return l.test(t)?A(t.slice(4).toLowerCase()):t})}},i&&e)if(t.exports==i)e.exports=r;else for(s in r)r.hasOwnProperty(s)&&(i[s]=r[s]);else n.punycode=r}),C={gso:"",forms:"",button:"",promo:""};function An(t){return On(window[t])?null:window[t]}function I(t){for(var e=[],n=arguments.length-1;0<n--;)e[n]=arguments[n+1];Tn[t]&&Tn[t].forEach(function(t){return t.apply({},e)})}var On=function(t){return void 0===t},En="amocrm_applebm",Tn={};var xn=!1,Mn=[],jn=["runChatShutdown","runChatShow","runChatHide","runDestroy","sendKeyActionHook","setupContactForHuman"],Ln=function(t,e){for(var n=[],i=arguments.length-2;0<i--;)n[i]=arguments[i+2];var o=t("livechat"),r=t("keyactions"),s=t("button");if(!xn&&-1<jn.indexOf(e))Mn.push(arguments);else switch(e){case"onChatShow":case"onChatRenderDone":case"onChatHide":case"onChatMessage":case"onChatReady":case"onChatShutdown":case"onButtonClick":case"onConversationsChange":!function(t,e){Tn[t]||(Tn[t]=[]),Tn[t].push(e)}.apply(null,[e].concat(n));break;case"runChatShutdown":o&&o.shutdown();break;case"runChatShow":o&&o.show();break;case"runChatHide":o&&o.hide();break;case"runDestroy":s&&s.destroy();break;case"sendKeyActionHook":r&&r.reachHook(n[0]);break;case"setupContactForHuman":s&&s.setupContactForHuman(n[0])}};function Nn(t){var e,n=void 0!==window.amoSocialButton?"amoSocialButton":"crmPlugin";window[n]=(e=t,(t=void 0===(t=(window[n]||{}).q)?[]:t).forEach(function(t){Ln.apply(null,[e].concat(Array.prototype.slice.apply(t)))}),t.slice(0,0),Ln.bind(null,e))}e=function(r){return function(t,e,n){var i,o=Object(t),e=(f(t)||(i=wn(e),t=m(t),e=function(t){return i(o[t],t,o)}),r(t,e,n));return-1<e?o[i?t[e]:e]:void 0}};var Bn=function(t,e,n,i){for(var o=t.length,r=n+(i?1:-1);i?r--:++r<o;)if(e(t[r],r,t))return r;return-1},Rn=/^\s+|\s+$/g,Fn=/^[-+]0x[0-9a-f]+$/i,Pn=/^0b[01]+$/i,Hn=/^0o[0-7]+$/i,zn=parseInt;var Dn=function(t){if("number"==typeof t)return t;if(K(t))return NaN;if(_(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=_(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=t.replace(Rn,"");var e=Pn.test(t);return e||Hn.test(t)?zn(t.slice(2),e?2:8):Fn.test(t)?NaN:+t};var Un=function(t){return t?(t=Dn(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0};var Gn=function(t){var e=(t=Un(t))%1;return t==t?e?t-e:t:0},Vn=Math.max;var Wn=e(function(t,e,n){var i=null==t?0:t.length;return i?((n=null==n?0:Gn(n))<0&&(n=Vn(i+n,0)),Bn(t,wn(e),n)):-1}),Kn=0;function Xn(t){return window.addEventListener?!qn||(console.error("Cannot "+t+" event. EventController is stopped."),!1):(console.error("addEventListener is not available."),!1)}var Yn=function(t){var e=++Kn;return q(t)+e},qn=!1,k={},S={add:function(t){var e=t.target,n=t.eventName,t=t.handler;if(!Xn("add"))return!1;if(Boolean(Wn(k,{target:e,eventName:n,handler:t})))return!1;e.addEventListener(n,t);var i=Yn("event_");return k[i]={target:e,eventName:n,handler:t},i},remove:function(t){if(!Xn("remove"))return!1;if("string"==typeof t){var e=k[t];if(!e)return console.error("There is no event with that token:",t),!1;var n=e.target,i=e.eventName,e=e.handler;return n.removeEventListener(i,e),delete k[t],!0}var o,r=!1,s=t.target,a=t.eventName,c=t.handler;for(o in k){var l=k[o];if(s===l.target&&a===l.eventName&&c===l.handler){s.removeEventListener(a,c),delete k[o],r=!0;break}}return r},removeAll:function(){var t,e=!1;for(t in k)var n=this.remove(t),e=e||n;return e},stop:function(){qn=!0}},Zn=Object.prototype.hasOwnProperty;var Jn=function(t){if(null==t)return!0;if(f(t)&&(h(t)||"string"==typeof t||"function"==typeof t.splice||pt(t)||_t(t)||ht(t)))return!t.length;var e,n=Ue(t);if("[object Map]"==n||"[object Set]"==n)return!t.size;if(Ct(t))return!St(t).length;for(e in t)if(Zn.call(t,e))return!1;return!0};function $n(t,e){for(var n=-1,i=null==t?0:t.length;++n<i&&!1!==e(t[n],n,t););return t}var Qn=function(t){return"function"==typeof t?t:gn};function ti(t,e){var n=Number.parseFloat(t.style.right);n&&t.style.setProperty("right",n+e+"px")}function ei(t){ri=window.innerWidth-document.documentElement.clientWidth,si=document.body.style.getPropertyValue("overflow"),document.body.style.setProperty("overflow","hidden"),ri&&(document.documentElement.style.setProperty("margin-right",ri+"px"),oi(t,function(t){ti(t,ri)}))}function ni(t){si?(document.body.style.setProperty("overflow",si),si=null):document.body.style.removeProperty("overflow"),ri&&(document.documentElement.style.removeProperty("margin-right"),oi(t,function(t){ti(t,-ri)}))}function ii(t){var e=t.button_holder,t=t.amoforms_url;this.button_holder=e,this.amoforms_url=t,this.is_loading=!1,this.waiting_to_show={},this.handleWindowMessageBound=this.handleWindowMessage.bind(this)}var oi=function(t,e){return(h(t)?$n:Ot)(t,Qn(e))},ri=0,si=null;ii.prototype.show=function(t){var e=t.id,t=t.hash;this.is_loading?this.waiting={id:e,hash:t}:(void 0!==window.amo_forms_params&&(this.buffer_amo_forms_params=Object.assign({},window.amo_forms_params)),this.hide(),window.amo_forms_params={id:e,hash:t,locale:"ru"},S.add({target:window,eventName:"message",handler:this.handleWindowMessageBound}),this.modal=document.createElement("div"),this.script=document.createElement("script"),e=document.createElement("div"),t=document.createElement("span"),this.modal.style="\n position: fixed;\n z-index: 2147483647;\n background: rgba(0,0,0,.4);\n top: 0;\n left: 0;\n right: 0;\n bottom:0;\n opacity: 0;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n overflow: auto;\n ",S.add({target:this.modal,eventName:"click",handler:this.hide.bind(this)}),e.style="\n position: relative;\n margin: auto;\n width: calc(100% - 90px);\n padding-top: 40px;\n ",S.add({target:e,eventName:"click",handler:function(t){return t.stopPropagation()}}),t.style="\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n position: absolute;\n top: 0;\n left: 100%;\n height: 60px;\n width: 43px;\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n ",t.innerHTML='\n <svg width="15" height="16" viewBox="0 0 15 16" xmlns="http://www.w3.org/2000/svg">\n <path fill="#fff" fill-rule="evenodd" clip-rule="evenodd" d="M7.49998 9.63673L1.97906 15.1577C1.52604 15.6107 0.791253 15.6127 0.339281 15.1607C-0.115843 14.7056 -0.111341 13.9746 0.342318 13.5209L5.86324 8L0.342318 2.47906C-0.110696 2.02604 -0.112692 1.29124 0.339281 0.839272C0.794404 0.384148 1.5254 0.388668 1.97906 0.842327L7.49998 6.36326L13.0209 0.842327C13.474 0.389313 14.2087 0.387299 14.6607 0.839272C15.1158 1.2944 15.1113 2.0254 14.6577 2.47906L9.13672 8L14.6577 13.5209C15.1107 13.974 15.1127 14.7088 14.6607 15.1607C14.2056 15.6159 13.4746 15.6113 13.0209 15.1577L7.49998 9.63673Z" />\n </svg>\n ',S.add({target:t,eventName:"click",handler:this.hide.bind(this)}),this.script.id="amoforms_script",this.script.src=this.amoforms_url,e.appendChild(this.script),e.appendChild(t),this.modal.appendChild(e),document.body.appendChild(this.modal),ei([this.button_holder]),this.is_loading=!0)},ii.prototype.hide=function(){this.modal&&(this.modal&&this.modal.parentNode.removeChild(this.modal),this.script&&this.script.parentNode.removeChild(this.script),window.removeEventListener("message",this.handleWindowMessageBound),void 0!==this.buffer_amo_forms_params?(window.amo_forms_params=Object.assign({},this.buffer_amo_forms_params),delete this.buffer_amo_forms_params):delete window.amo_forms_params,ni([this.button_holder]),this.modal=null)},ii.prototype.handleWindowMessage=function(t){var e=this,n=null;try{n=JSON.parse(t.data)}catch(t){n=null}if(n&&_(n))switch(n.func){case"resizeForm":var i=document.getElementById(n.iframe_id);setTimeout(function(){if(e.is_loading=!1,!Jn(e.waiting))return e.show(e.waiting),void(e.waiting={});i.style.position="relative",n.max_width&&(i.parentNode.style.maxWidth=n.max_width+"px"),e.modal.style.opacity=1});break;case"amoformsSuccessSubmit":setTimeout(function(){return e.hide()},1e3)}};var ai=function(e,t){return P(t,function(t){return e[t]})};var ci=function(t){return null==t?[]:ai(t,m(t))},li=function(){try{var t=y(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var ui=function(t,e,n){"__proto__"==e&&li?li(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},hi=Object.prototype.hasOwnProperty;var di=function(t,e,n){var i=t[e];hi.call(t,e)&&Tt(i,n)&&(void 0!==n||e in t)||ui(t,e,n)};var pi=function(t,e,n,i){if(!_(t))return t;for(var o=-1,r=(e=ln(e,t)).length,s=r-1,a=t;null!=a&&++o<r;){var c,l=un(e[o]),u=n;o!=s&&(c=a[l],void 0===(u=i?i(c,l,a):void 0)&&(u=_(c)?c:mt(e[o+1])?[]:{})),di(a,l,u),a=a[l]}return t};var fi=function(t,e,n){for(var i=-1,o=e.length,r={};++i<o;){var s=e[i],a=hn(t,s);n(a,s)&&pi(r,ln(s,t),a)}return r};var mi=function(n,t){return fi(n,t,function(t,e){return mn(n,e)})},vi=t?t.isConcatSpreadable:void 0;function gi(t){return h(t)||ht(t)||!!(vi&&t&&t[vi])}var _i=function t(e,n,i,o,r){var s=-1,a=e.length;for(i=i||gi,r=r||[];++s<a;){var c=e[s];0<n&&i(c)?1<n?t(c,n-1,i,o,r):ke(r,c):o||(r[r.length]=c)}return r};function yi(t){return(null==t?0:t.length)?_i(t,1):[]}var bi=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},wi=Math.max;var Ci=function(r,s,a){return s=wi(void 0===s?r.length-1:s,0),function(){for(var t=arguments,e=-1,n=wi(t.length-s,0),i=Array(n);++e<n;)i[e]=t[s+e];for(var e=-1,o=Array(s+1);++e<s;)o[e]=t[e];return o[s]=a(i),bi(r,this,o)}};var Ii=function(t){return function(){return t}},ki=Date.now;var Si=function(n){var i=0,o=0;return function(){var t=ki(),e=16-(t-o);if(o=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(li?function(t,e){return li(t,"toString",{configurable:!0,enumerable:!1,value:Ii(e),writable:!0})}:gn);function Ai(t){t=t||21;for(var e="",n=Ti.getRandomValues(new Uint8Array(t));t--;)e+=xi[63&n[t]];return e}var Oi=function(t){return Si(Ci(t,void 0,yi),t+"")}(function(t,e){return null==t?{}:mi(t,e)}),Ei=R(function(t,e){var n;n=function(){function a(){for(var t=arguments,e=0,n={};e<arguments.length;e++){var i,o=t[e];for(i in o)n[i]=o[i]}return n}function l(t){return t.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function t(c){function s(){}function n(t,e,n){if("undefined"!=typeof document){"number"==typeof(n=a({path:"/"},s.defaults,n)).expires&&(n.expires=new Date(+new Date+864e5*n.expires)),n.expires=n.expires?n.expires.toUTCString():"";try{var i=JSON.stringify(e);/^[\{\[]/.test(i)&&(e=i)}catch(t){}e=c.write?c.write(e,t):encodeURIComponent(String(e)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var o,r="";for(o in n)n[o]&&(r+="; "+o,!0!==n[o]&&(r+="="+n[o].split(";")[0]));return document.cookie=t+"="+e+r}}function e(t,e){if("undefined"!=typeof document){for(var n={},i=document.cookie?document.cookie.split("; "):[],o=0;o<i.length;o++){var r=i[o].split("="),s=r.slice(1).join("=");e||'"'!==s.charAt(0)||(s=s.slice(1,-1));try{var a=l(r[0]),s=(c.read||c)(s,a)||l(s);if(e)try{s=JSON.parse(s)}catch(t){}if(n[a]=s,t===a)break}catch(t){}}return t?n[t]:n}}return s.set=n,s.get=function(t){return e(t,!1)},s.getJSON=function(t){return e(t,!0)},s.remove=function(t,e){n(t,"",a(e,{expires:-1}))},s.defaults={},s.withConverter=t,s}(function(){})},t.exports=n()}),Ti=self.crypto||self.msCrypto,xi="Uint8ArdomValuesObj012345679BCDEFGHIJKLMNPQRSTWXYZ_cfghkpqvwxyz-",Mi=function(){return i.Date.now()},ji=Math.max,Li=Math.min;function A(t,e){var n=this,i=parseFloat(sessionStorage.getItem("amo_social_button_tracking_time"))||0;if(this.scrollParams={scrolled_unit:t.scrolled_unit,scrolled_value:parseInt(t.scrolled_value)},t&&"Y"===t.enabled&&t.message){var o=parseInt(t.frequency);this.onShow=e.bind(this),this.displayGreeting=this.displayGreeting.bind(this),this.displayGreetingOnScrollListener=this.displayGreetingOnScrollListener.bind(this);var r=i<(r=1e3*t.timeout)?r-i:r;if(2!==o||"true"!==sessionStorage.getItem(Bi))if(3===o)this.checkFrequencyDay();else switch(this.scrollParams.scrolled_value&&this.afterScrollGreeting(),!0){case this.pageCompare(t):case this.hitsCompare(t):this.displayGreeting();break;default:this.timeout=setTimeout(function(){return n.displayGreeting()},r)}}}var Ni=function(i,n,t){var o,r,s,a,c,l,u=0,h=!1,d=!1,e=!0;if("function"!=typeof i)throw new TypeError("Expected a function");function p(t){var e=o,n=r;return o=r=void 0,u=t,a=i.apply(n,e)}function f(t){var e=t-l;return void 0===l||n<=e||e<0||d&&s<=t-u}function m(){var t,e=Mi();if(f(e))return v(e);c=setTimeout(m,(t=n-((e=e)-l),d?Li(t,s-(e-u)):t))}function v(t){return c=void 0,e&&o?p(t):(o=r=void 0,a)}function g(){var t=Mi(),e=f(t);if(o=arguments,r=this,l=t,e){if(void 0===c)return u=t=l,c=setTimeout(m,n),h?p(t):a;if(d)return clearTimeout(c),c=setTimeout(m,n),p(l)}return void 0===c&&(c=setTimeout(m,n)),a}return n=Dn(n)||0,_(t)&&(h=!!t.leading,d="maxWait"in t,s=d?ji(Dn(t.maxWait)||0,n):s,e="trailing"in t?!!t.trailing:e),g.cancel=function(){void 0!==c&&clearTimeout(c),o=l=r=c=void(u=0)},g.flush=function(){return void 0===c?a:v(Mi())},g},Bi="amo_social_button_banner_shown_at";A.prototype.destroy=function(){this.scrollParams.scrolled_value&&S.remove({target:window,eventName:"scroll",handler:this.debouncedDisplayGreetingOnScrollListener}),clearTimeout(this.timeout)},A.prototype.displayGreetingOnScrollListener=function(t){var e=this.scrollParams,n=e.scrolled_unit,e=e.scrolled_value,i=window.innerHeight*(window.innerHeight/document.documentElement.scrollHeight),n="%"===n?document.documentElement.scrollHeight*e/100:e;window.pageYOffset+i>=i+n&&(this.scrollParams.is_scroll="N",this.displayGreeting())},A.prototype.afterScrollGreeting=function(){this.debouncedDisplayGreetingOnScrollListener=Ni(this.displayGreetingOnScrollListener,100),S.add({target:window,eventName:"scroll",handler:this.debouncedDisplayGreetingOnScrollListener}),this.displayGreetingOnScrollListener()},A.prototype.checkFrequencyDay=function(){var t=this,e=(parseInt(localStorage.getItem(Bi))||0)+864e5;Date.now()<e?(e=e-Date.now())/1e3<900&&(this.timeout=setTimeout(function(){return t.checkFrequencyDay()},e)):this.displayGreeting()},A.prototype.pageCompare=function(t){var e=window.location.pathname,t=t.page||{value:"",mask:1};return this.compareWithMask(e,t.value,t.mask)},A.prototype.compareWithMask=function(t,e,n){var i=!1;switch(t=t.toString(),e=e.toString(),parseInt(n)){case 1:i=t===e;break;case 2:i=t!==e;break;case 3:i=t.startsWith(e);break;case 4:i=t.endsWith(e);break;case 5:i=t.includes(e);break;case 6:i=!t.includes(e)}return i},A.prototype.hitsCompare=function(t){var e=parseInt(sessionStorage.getItem("amo_social_button_tracking_hits"))||0,t=parseInt(t.hits)||0;return 0!==e&&0!==t&&t<=e},A.prototype.displayGreeting=function(){this.onShow(),localStorage.setItem(Bi,Date.now().toString()),sessionStorage.setItem(Bi,"true"),this.destroy()};var Ri=function(t,e,n,i){for(var o=!n,r=(n=n||{},-1),s=e.length;++r<s;){var a=e[r],c=i?i(n[a],t[a],a,n,t):void 0;void 0===c&&(c=t[a]),(o?ui:di)(n,a,c)}return n};var Fi=function(t,e){return Si(Ci(t,e,gn),t+"")};var Pi=function(t,e,n){if(!_(n))return!1;var i=typeof e;return!!("number"==i?f(n)&&mt(e,n.length):"string"==i&&e in n)&&Tt(n[e],t)};var l=function(a){return Fi(function(t,e){var n=-1,i=e.length,o=1<i?e[i-1]:void 0,r=2<i?e[2]:void 0,o=3<a.length&&"function"==typeof o?(i--,o):void 0;for(r&&Pi(e[0],e[1],r)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var s=e[n];s&&a(t,s,n,o)}return t})},Hi=Object.prototype.hasOwnProperty,zi=l(function(t,e){if(Ct(e)||f(e))Ri(e,m(e),t);else for(var n in e)Hi.call(e,n)&&di(t,n,e[n])});Di="AMO_LIVECHAT_IFRAME";var Di,Ui,Gi={subscribeToBus:function(n){function t(t){try{var e=JSON.parse(t.data);e.origin===An(Di)&&n(e)}catch(t){throw new Error(t)}}return window.addEventListener("message",t),function(){return window.removeEventListener("message",t)}},sendBusMessage:function(t){window.parent.postMessage(JSON.stringify(_(t)?zi({},t,{origin:An(Di)}):t),"*")}}.sendBusMessage,Vi={Conversation:"Беседа",Conversations:"Список бесед",Today:"Сегодня",Yesterday:"Вчера","Show all":"Показать все","Create new conversation":"Создать новую беседу",You:"Вы"},Wi={Conversation:"Conversation",Conversations:"Conversations",Today:"Today",Yesterday:"Yesterday","Show all":"Show all","Create new conversation":"Create new conversation",You:"You"},Ki={Conversation:"Conversación",Conversations:"Conversaciones",Today:"Hoy",Yesterday:"Ayer","Show all":"Mostrar todo","Create new conversation":"Crear nueva conversación",You:"Tú:"},Xi={Conversation:"Conversa",Conversations:"Conversas",Today:"Hoje",Yesterday:"Ontem","Show all":"Mostrar tudo","Create new conversation":"Criar nova conversa",You:"Você"};function O(t){var e;switch(Ui){case"ru":e=Vi;break;case"es":e=Ki;break;case"pt":e=Xi;break;default:e=Wi}return e&&e[t]||t}function T(t){var e=t.context,n=t.conversations,i=t.selectorWrapper,o=t.onOpenAllClick,r=(void 0===o&&(o=function(){}),t.onSelectorToggle),s=(void 0===r&&(r=function(){}),t.onConversationClick);void 0===s&&(s=function(){}),void 0===(t=t.onAddConversationClick)&&(t=function(){}),this.view=i,this.context=e,this.isSelectorOpened=!0,this.isBlockedCloseSelector=!0,this.isOpenedAll=!1,this.firstRender=!0,this.parentHeight=0,this.conversations=n||[],this.selectedConversation="",this.onOpenAllClick=o,this.onSelectorToggle=r,this.onConversationClick=s,this.onAddConversationClick=t,this.triggerOnConversationsChange(),this.initMediaMatcher()}function x(t){this.props=t=void 0===t?{}:t;var e=(t=this.props).config,t=t.brandName,t=(this.brandName=t,0<=["widget","frame"].indexOf(e.mode)?e.mode:"widget");this.chatContainer=null,"frame"===e.mode&&e.container&&document.querySelector(e.container)&&(t="frame",this.chatContainer=document.querySelector(e.container)),this.mode=t,this.userData=e.params||{},this.userProfile=Oi(e.profile,["name","email","phone","avatar"]),this.locale=e.locale||null,this.theme=e.theme||null,e.user_id&&(this.custom_user_id=e.user_id),this.isEnabled=this.props.enabled,this.isActive=!1,this.isInited=!1,this.isInline=this.props.isInline,this.isGreetingAwaited=!1,this.areKeyactionsActive=this.props.has_keyactions,this.hasGreetingReaction=this.props.has_greeting_reaction,this.name="amo-livechat-iframe-"+Ai(8),this.activeClassName=this.name+"-active",this.socialServiceSize=this.props.serviceSize||50,this.socialServiceSizeWithMargin=this.socialServiceSize+4,this.servicesCount=this.props.servicesCount,this.indexLivechatInChats=this.props.indexLivechatInChats,this.handleWindowResize=this.handleWindowResize.bind(this),this.handleBusMessage=this.handleBusMessage.bind(this),S.add({target:window,eventName:"message",handler:this.handleBusMessage}),this.iframe_wrapper=this.setupIframe()}function Yi(){}function M(t){var e=t.keyactions,n=(void 0===e&&(e=[]),t.sendCRMReactions),i=(void 0===n&&(n=Yi),t.showAnimation),o=(void 0===i&&(i=Yi),t.showForm);void 0===o&&(o=Yi),void 0===(t=t.showGreeting)&&(t=Yi),this.reached={},this.conditions={},this.reactions={},this.constraintTimeouts={},this.conditionTimeouts={},this.sendCRMReactions=n,this.showAnimation=i,this.showForm=o,this.showGreeting=t,this.parse(e),this.run()}function j(t){this.props=t=void 0===t?{}:t,t=this.props.brandName,this.brandName=t,this.initModalIframe()}function qi(){return Array.prototype.slice.call(document.all).reduce(function(t,e){return Math.max(t,+window.getComputedStyle(e).zIndex||0)},0)}var c={isMobile:{configurable:!0},selectedConversationId:{configurable:!0},shouldOpenSelector:{configurable:!0},isOpenedAll:{configurable:!0}},Zi=(T.prototype.getSelectors=function(){return{selector:".conversation-selector",header:".conversation-selector__header",mobileHeader:".conversation-selector__header--mobile",closeMobile:".conversation-selector__header-close",conversationsWrapper:".conversation-selector__conversations",openAll:".conversation-selector__open-all",addConversation:".conversation-selector__add-button",headerIcon:".conversation-selector__header-icon",conversationItem:".conversation-selector__item"}},T.prototype.getConversationTemplate=function(t){var e=t.id,n=t.name,i=t.date,o=t.author,r=t.message;return'\n <div class="conversation-selector__item '+(t.selected?"selected":"")+'" data-id="'+e+'">\n <div class="conversation-selector__item-wrapper">\n <div class="conversation-selector__item-header">\n <div class="conversation-selector__name-wrapper">\n <span>'+O("Conversation")+'</span>\n <span class="conversation-selector__conversation-id">\n '+n+'\n </span>\n </div>\n <div class="conversation-selector__item-header-date">\n '+i+'\n </div>\n </div>\n <div class="conversation-selector__item-message">\n '+o+": "+r+"\n </div>\n </div>\n </div>\n "},T.prototype.getSelectorTemplate=function(){return'\n <div class="conversation-selector">\n <div class="conversation-selector__inner">\n <div class="conversation-selector__header">\n <div class="conversation-selector__header-text">'+O("Conversations")+'</div>\n\n <div class="conversation-selector__header-icon">\n <svg xmlns="http://www.w3.org/2000/svg" width="12" height="7" viewBox="0 0 12 7" fill="none">\n <path d="M10.2929 0.292892C10.6834 -0.0976314 11.3166 -0.0976315 11.7071 0.292892C12.0976 0.683417 12.0976 1.31658 11.7071 1.70711L10.2929 0.292892ZM6 6L6.70711 6.70711C6.51957 6.89464 6.26522 7 6 7C5.73478 7 5.48043 6.89464 5.29289 6.70711L6 6ZM0.292893 1.70711C-0.0976316 1.31658 -0.0976317 0.683417 0.292893 0.292893C0.683417 -0.0976309 1.31658 -0.097631 1.70711 0.292893L0.292893 1.70711ZM11.7071 1.70711L6.70711 6.70711L5.29289 5.29289L10.2929 0.292892L11.7071 1.70711ZM5.29289 6.70711L0.292893 1.70711L1.70711 0.292893L6.70711 5.29289L5.29289 6.70711Z" fill="#313942"/>\n </svg>\n </div>\n\n <div class="conversation-selector__header-close">\n <svg width="15" height="16" viewBox="0 0 15 16" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.49998 9.63673L1.97906 15.1577C1.52604 15.6107 0.791253 15.6127 0.339281 15.1607C-0.115843 14.7056 -0.111341 13.9746 0.342318 13.5209L5.86324 8L0.342318 2.47906C-0.110696 2.02604 -0.112692 1.29124 0.339281 0.839272C0.794404 0.384148 1.5254 0.388668 1.97906 0.842327L7.49998 6.36326L13.0209 0.842327C13.474 0.389313 14.2087 0.387299 14.6607 0.839272C15.1158 1.2944 15.1113 2.0254 14.6577 2.47906L9.13672 8L14.6577 13.5209C15.1107 13.974 15.1127 14.7088 14.6607 15.1607C14.2056 15.6159 13.4746 15.6113 13.0209 15.1577L7.49998 9.63673Z" />\n </svg>\n </div>\n </div>\n\n <div class="conversation-selector__wrapper">\n <div class="conversation-selector__conversations"></div>\n <div class="conversation-selector__action-button conversation-selector__open-all">\n '+O("Show all")+'\n </div>\n <div class="conversation-selector__action-button conversation-selector__add-button">\n '+O("Create new conversation")+"\n </div>\n </div>\n </div>\n </div>\n "},T.prototype.getFormattedDate=function(t){var t=new Date(t),e=new Date,n=new Date(Date.now()-864e5),i=t.getDate(),o=t.getMonth()+1,t=t.getFullYear();return i===e.getDate()&&o===e.getMonth()+1&&t===e.getFullYear()?O("Today"):i===n.getDate()&&o===n.getMonth()+1&&t===n.getFullYear()?O("Yesterday"):(i=i<10?"0"+i:i)+"."+(o=o<10?"0"+o:o)+"."+t},T.prototype.getNode=function(t){var e=this.view.querySelector(t);return e||(console.error(t+" node not found"),!1)},T.prototype.initMediaMatcher=function(){var e=this;this._mediaMatcher=matchMedia("(max-width: 450px)"),this._mediaMatcher.onchange=function(t){e.onMediaChange(t.matches)}},c.isMobile.get=function(){return this._mediaMatcher.matches},T.prototype.onMediaChange=function(){this.renderConversations()},T.prototype.calculateSelectorHeight=function(){var t,e,n;this.parentHeight&&(t=this.getNode(this.getSelectors().conversationsWrapper),e=this.visibleConversationsCount,n=this.isOpenedAll?1:2,this.visibleConversationsCount=Math.floor((this.parentHeight-44-42*n-16)/69),this.visibleConversationsCount=this.visibleConversationsCount<2?2:this.visibleConversationsCount,this.visibleConversationsCount>=this.conversations.length?(this.visibleConversationsCount=this.conversations.length,this.setVisibilityAllButton(!1)):this.setVisibilityAllButton(!this.isOpenedAll),this.isMobile?t.style.height="":t.style.height=69*this.visibleConversationsCount+"px",e!==this.visibleConversationsCount&&this.renderConversations())},T.prototype.openSelector=function(t){this.toggleSelector(!0),t&&(this.isBlockedCloseSelector=t,this.getNode(this.getSelectors().headerIcon).classList.add("invisible"))},T.prototype.getHeight=function(){return this.getNode(this.getSelectors().selector).offsetHeight},T.prototype.renderConversations=function(){var n=this;if(!this.conversations.length&&!this.selectedConversation)return this.view.style.display="none",void this.toggleSelector(!1);this.view.style.display="block";var t=this.getNode(this.getSelectors().conversationsWrapper),i=(t||this.render(),"");this.conversations.forEach(function(t,e){e>n.visibleConversationsCount-1&&!n.isOpenedAll||(e={id:t.id,name:t.name,selected:n.selectedConversationId===t.id},(t=t.last_message)?(e.date=n.getFormattedDate(t.created_at),e.author=t.author?t.author.name:O("You"),e.message=t.text):console.error("last message not defined"),i+=n.getConversationTemplate(e))}),t.innerHTML=i,this.setConversationsEvents(),this.calculateSelectorHeight()},c.selectedConversationId.get=function(){return this.selectedConversation?this.selectedConversation.id:null},T.prototype.render=function(){this._shouldOpenSelector=this.firstRender;var t=this.getSelectorTemplate();this.view.innerHTML=t;try{this.renderConversations()}catch(t){console.error("render conversations failure"),console.error(t)}this.conversations.length<2?(this.isSelectorOpened=!1,this.isBlockedCloseSelector=!1,this._shouldOpenSelector=!1,this.toggleSelector(!1)):this.getNode(this.getSelectors().headerIcon).classList.add("invisible"),this.toggleSelector(this._shouldOpenSelector),this.firstRender=!1,this.initDomEvents()},c.shouldOpenSelector.get=function(){return this._shouldOpenSelector},T.prototype.initDomEvents=function(){var e=this;S.add({target:this.getNode(this.getSelectors().selector),eventName:"click",handler:function(t){t.preventDefault()}}),S.add({target:this.getNode(this.getSelectors().header),eventName:"click",handler:function(t){e.isMobile?e.handleMobileHeaderClick(t):e.handleSelectorClick(t)}}),S.add({target:this.getNode(this.getSelectors().addConversation),eventName:"click",handler:function(t){e._shouldOpenSelector=!1,e.setSelectedConversation(null),e.handleAddConversationClick(t),e.onAddConversationClick(t)}}),S.add({target:this.getNode(this.getSelectors().openAll),eventName:"click",handler:function(t){e.handleOpenAllClick(t),e.onOpenAllClick(t)}})},T.prototype.setConversationsEvents=function(){var e=this;this.view.querySelectorAll(this.getSelectors().conversationItem).forEach(function(t){S.add({target:t,eventName:"click",handler:function(t){e._shouldOpenSelector=!1,e.handleItemClick(t),e.onConversationClick(t)}})})},T.prototype.setVisibilityAllButton=function(t){this.getNode(this.getSelectors().openAll).classList.toggle("invisible",!t)},T.prototype.setConversations=function(t){var e;this.selectedConversation&&(e=Wn(t,{id:this.selectedConversation.id}))&&(this.selectedConversation=e),this.conversations=t,this.renderConversations(),this.triggerOnConversationsChange()},T.prototype.setSelectedConversation=function(t){t?(this.context.sendBusMessage({method:"select_conversation",payload:t}),this.selectedConversation=Wn(this.conversations,{id:t})):this.selectedConversation=t,this.renderConversations()},T.prototype.setParentHeight=function(t){t&&(this.parentHeight=parseInt(t),this.calculateSelectorHeight())},T.prototype.busHeaderClick=function(){this.tryToToggleSelector()},T.prototype.handleSelectorClick=function(t){t.stopPropagation(),this.tryToToggleSelector()},T.prototype.tryToToggleSelector=function(){!this.view||this.firstRender||this.isBlockedCloseSelector||this.toggleSelector()},T.prototype.handleMobileHeaderClick=function(t){t.stopPropagation(),t.target.closest(this.getSelectors().closeMobile)?Gi("click_button"):this.tryToToggleSelector()},T.prototype.handleOpenAllClick=function(t){t.stopPropagation(),this.setVisibilityAllButton(!1),this.isOpenedAll=!0,this.renderConversations(),this.calculateSelectorHeight()},c.isOpenedAll.get=function(){return this._isOpenedAll||this.isMobile},c.isOpenedAll.set=function(t){return this._isOpenedAll=t},T.prototype.handleAddConversationClick=function(t){t.stopPropagation(),this.context.sendBusMessage({method:"add_conversation"}),this.toggleSelector(!1),this.isBlockedCloseSelector=!1,this.getNode(this.getSelectors().headerIcon).classList.toggle("invisible",this.isBlockedCloseSelector),this.conversations.length||this.triggerOnConversationsChange()},T.prototype.handleItemClick=function(t){t.stopPropagation();t=t.currentTarget.getAttribute("data-id");this.selectedConversationId!==t&&this.setSelectedConversation(t),this.toggleSelector(!1),this.isBlockedCloseSelector=!1,this.getNode(this.getSelectors().headerIcon).classList.toggle("invisible",this.isBlockedCloseSelector)},T.prototype.triggerOnConversationsChange=function(){function n(t){var e,n,i,o,r,s,a=t.name,c=t.is_closed;return(t=t.last_message)&&(e=t.created_at,n=t.is_out,i=t.text,s=t.media_url,o=t.type,r=t.author,o="picture"===o?"photo":o,s={media:s?{url:s,thumbnail:t[o]?t[o].thumbnail:void 0}:void 0,created_at:e,is_out:n,text:i,type:o,author:r=r?{name:r.name}:void 0}),{name:a,is_closed:c,last_message:s}}var i=this,o=!1,t=this.conversations.map(function(t){var e=t.id;return o=o||e===i.selectedConversationId,n(t)});this.selectedConversation&&!o&&t.push(Object.assign({},n(this.selectedConversation),{is_closed:!0})),I("onConversationsChange",t)},T.prototype.toggleSelector=function(t){void 0===t&&(t=!this.isSelectorOpened),this.isSelectorOpened=t;t="closed";this.isSelectorOpened&&(t=this.shouldOpenSelector?"opened-fully":"opened"),this.getNode(this.getSelectors().selector).classList.toggle("opened",this.isSelectorOpened),this.context.sendBusMessage({method:"selector_open_state",payload:t}),this.onSelectorToggle(t)},Object.defineProperties(T.prototype,c),"amo-livechat"),Ji="amo-livechat_bubble",$i="amo-livechat_chat",Qi="amo-livechat_opening",to="amo-livechat_hiding",eo="amo-livechat_hidden",no="amo-livechat-id",io=(x.prototype.show=function(){var t=this;!this.isActive&&this.isEnabled&&this.isInited&&(this.isActive=!0,this.hideBubble(),this.getUUID()||this.setUUID(),setTimeout(function(){document.documentElement.classList.add(t.activeClassName),t.iframe_wrapper.classList.remove(Qi),t.iframe.focus()},200),document.documentElement.classList.add(this.name),this.iframe_wrapper.style.bottom="",this.iframe_wrapper.classList.remove(eo),this.iframe_wrapper.classList.add(Qi),this.iframe_wrapper.classList.add($i),this.isInline&&"vertical"===this.props.orientation&&(this.iframe_wrapper.style[this.props.position.h]=this.socialServiceSizeWithMargin+25+"px",this.iframe_wrapper.style[this.props.position.v]="top"===this.props.position.v?"-19px":"-22px"),this.sendBusMessage({method:"livechat:onShow"},"socials"),this.sendBusMessage({method:"toggle",payload:{state:!0}},"livechat"),this.handleWindowResize(),I("onChatShow"))},x.prototype.hide=function(){var t=this;this.isActive&&this.isEnabled&&this.isInited&&(this.isActive=!1,document.documentElement.classList.remove(this.activeClassName),this.iframe_wrapper.classList.add(to),setTimeout(function(){document.documentElement.classList.remove(t.name),t.iframe_wrapper.classList.remove(to),t.iframe_wrapper.classList.remove($i),t.iframe_wrapper.classList.contains(Ji)||(t.iframe_wrapper.classList.add(eo),t.iframe_wrapper.style.height="")},200),this.sendBusMessage({method:"toggle",payload:{state:!1}}),I("onChatHide"))},x.prototype.awaitLivechatAnimation=function(t){function e(){return i.iframe_wrapper.classList.contains(Qi)}function n(){return i.iframe_wrapper.classList.contains(to)}var i=this;switch(!0){case e():var o=setInterval(function(){i.isActive?e()||(clearInterval(o),t()):clearInterval(o)},20);break;case n():var r=setInterval(function(){i.isActive?clearInterval(r):n()||(clearInterval(r),t())},20);break;default:t()}},x.prototype.showBubble=function(){var t=this;this.awaitLivechatAnimation(function(){t.isActive||t.props.isButtonOpened()||("widget"===t.mode&&(t.sendBusMessage({method:"bubble",payload:{state:!0}}),t.iframe_wrapper.classList.remove(eo),t.iframe_wrapper.classList.add(Ji)),t.showBadge())})},x.prototype.hideBubble=function(){this.sendBusMessage({method:"bubble",payload:{state:!1}}),this.iframe_wrapper.classList.remove(Ji),this.iframe_wrapper.classList.add(eo),this.resizeIframeWrapper(null),this.hideBadge()},x.prototype.showGreeting=function(){this.isInited?this.isActive||this.sendBusMessage({method:"greeting"}):this.isGreetingAwaited=!0},x.prototype.resizeIframeWrapper=function(t){if(null===t)return this.iframe_wrapper.style.height=null,void(this.iframe_wrapper.style.width=null);this.iframe_wrapper.style.height=parseFloat(t.height)+"px",this.iframe_wrapper.style.width=parseFloat(t.width)+"px"},x.prototype.centrifyIframeWrapper=function(t){var e,t=t.bubbleHeight,n=this.props.container,i=this.iframe_wrapper,o=this.props.position.v;(n||i||o)&&(n=(t-(t=n.offsetHeight))/2,i.style[o]=null,e=getComputedStyle(i).getPropertyValue(o),e=parseInt(e,10)-n,"top"===o?e+=9:"bottom"===o&&t<50&&(e+=2),i.style[o]=e+"px")},x.prototype.updateBadge=function(t){this.badgeCount=t,0<(this.badge.innerText=t)&&!this.isActive&&!this.props.isButtonOpened()?this.showBadge():this.hideBadge(),this.sendBusMessage({method:"badge",payload:{count:t}},"socials")},x.prototype.showBadge=function(){0<this.badgeCount&&!this.props.isButtonOpened()&&(this.badge.style.display=null)},x.prototype.hideBadge=function(){this.badge.style.display="none"},x.prototype.getUUID=function(){if(this.custom_user_id)return this.custom_user_id;var t=Ei.get(no);return t||(t=Ai(),Ei.set(no,t,{expires:365})),t},x.prototype.setUUID=function(){var t=this.getUUID();this.sendBusMessage({method:"init",payload:{uuid:t}})},x.prototype.setupIframe=function(){var t=this,e=this.props,n=e.account_name,i=e.button,o=e.close_button,r=e.container,s=e.greeting,a=e.greeting_bot_params,c=e.host,l=e.locale,u=e.orientation,h=e.position,d=e.socket_url,p=e.session_uid,f=e.isCopyrightVisible,e=document.createElement("div"),m=(e.id="amo-livechat",e.className=[Zi,eo].concat("frame"===this.mode?["amo-livechat_frame"]:[Zi+"_"+h.v+"-"+h.h,Zi+"_"+u]).join(" "),e.style.background="frame"===this.mode?"none":"",document.createElement("style")),v=(m.id="","\n html."+this.name+" .amo-brand {\n display: none;\n }\n ");return this.chatContainer?e.classList.add("amo-livechat--no-mobile"):v+="\n @media (max-width: 450px) {\n html."+this.activeClassName+" {\n overflow: hidden !important;\n }\n html."+this.activeClassName+" > body {\n background: #fff !important;\n overflow: hidden !important;\n }\n html."+this.activeClassName+" > body > *:not(.amo-button-holder):not(.amo-livechat-first-container) {\n display: none;\n }\n ."+$i+" {\n position: fixed;\n top: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n left: 0 !important;\n width: 100%;\n height: 100%;\n max-height: unset;\n min-height: unset;\n border-radius: 0;\n }\n }",m.innerHTML=v,this.iframe=document.createElement("iframe"),this.iframe.title=this.brandName+" Live Chat",this.iframe.name=this.name,this.iframe.src=c+"/livechat/index.html?kZPXAMXzQc2tCy0Tr5Qxd",Ui=l,this.iframe.onload=function(){t.isInited=!0,t.iframe.contentWindow.postMessage(JSON.stringify({method:"configure",payload:{AMO_LIVECHAT_MODE:t.mode,AMO_LIVECHAT_USER_PARAMS:t.userData,AMO_LIVECHAT_USER_PROFILE:t.userProfile,AMO_LIVECHAT_USER_LOCALE:t.locale,AMO_LIVECHAT_THEME:t.theme,AMO_LIVECHAT_UUID:t.isEnabled&&t.getUUID(),AMO_LIVECHAT_SOCKET_URL:d,AMO_LIVECHAT_SESSION_UID:p,AMO_LIVECHAT_BUTTON_ID:i.id,AMO_LIVECHAT_BUTTON_HASH:i.hash,AMO_LIVECHAT_BUTTON_HEIGHT:t.props.container.offsetHeight,AMO_LIVECHAT_IFRAME:t.name,AMO_LIVECHAT_LOCALE:l,AMO_LIVECHAT_GREETING:s?s.message:"",AMO_LIVECHAT_GREETING_BUTTONS:s?ci(s.message_buttons):[],AMO_LIVECHAT_GREETING_BOT:s?s.bot:{},AMO_LIVECHAT_GREETING_BOT_PARAMS:a||{},AMO_LIVECHAT_HEADER_COLOR:i.color,AMO_LIVECHAT_POSITION:h.v+"-"+h.h,AMO_LIVECHAT_ORIENTATION:u,AMO_LIVECHAT_DEFAULT_AVATAR:s&&s.chat_avatar_path?s.chat_avatar_path:"",AMO_LIVECHAT_TITLE:s&&s.chat_header?s.chat_header:n,AMO_LIVECHAT_USE_RESP_AVATAR:!s||""!==s.use_avatar,AMO_LIVECHAT_USE_NAME:!!s&&"Y"===s.use_name,AMO_LIVECHAT_CLOSE_VISIBLE:!!o,AMO_LIVECHAT_IS_COPYRIGHT_VISIBLE:f,AMO_BRAND_NAME:t.brandName}}),c),I("onChatReady"),"function"==typeof t.props.onIframeLoaded&&t.props.onIframeLoaded()},this.badge=document.createElement("div"),this.badge.className="amo-button-greeting-badge",this.hideBadge(),e.appendChild(this.iframe),(this.chatContainer||r).appendChild(e),r.appendChild(m),r.appendChild(this.badge),S.add({target:window,eventName:"resize",handler:this.handleWindowResize}),e},x.prototype.sendBusMessage=function(t,e){switch(e=void 0===e?"livechat":e){case"livechat":if(!this.iframe)return;this.iframe.contentWindow.postMessage(JSON.stringify(Object.assign({},{origin:this.name},t)),this.props.host);break;case"socials":var n=window.frames&&window.frames.social_iframe;n&&n.postMessage(t,"*");break;default:throw new Error("Unknown recipient name.")}},x.prototype.handleBusMessage=function(t){var e=this,n=this.props,i=n.greeting,o=n.host,r=n.modal;if(t.origin===o)try{var s=JSON.parse(t.data);if(s&&s.origin===this.name)switch(s.method){case"livechat:rendered":this.handleWindowResize(),I("onChatRenderDone");break;case"bubble":this.showBubble();break;case"bubble:hide":this.hideBubble();break;case"bubble:click":"function"==typeof this.props.forceButtonCollapse&&this.props.forceButtonCollapse(),this.show();break;case"bubble:autosize":var a=s.payload,c=a.height,l=a.width;this.resizeIframeWrapper({height:c,width:l});break;case"bubble:centrify":this.centrifyIframeWrapper(s.payload);break;case"badge":this.updateBadge(s.count||0);break;case"modal":r&&r.show(s.payload,this.sendBusMessage.bind(this));break;case"greeting:init":this.sendBusMessage({method:"toggle",payload:{state:this.isActive}}),this.isGreetingAwaited&&(this.isGreetingAwaited=!1,this.showGreeting()),this.hasGreetingReaction||(this.greeting=new A(i,function(){return e.showGreeting()}));break;case"conversations:received":this.renderConversationSelector({conversations:s.payload,selected:s.selected});break;case"conversations:update":s.selected&&this.conversationSelector.setSelectedConversation(s.selected),this.conversationSelector.setConversations(s.payload);break;case"conversation_selector:header-click":this.conversationSelector.busHeaderClick();break;case"livechat:multi-dialogs-enabled":this.isMultiDialogsEnabled=s.payload,this.isMultiDialogsEnabled||I("onConversationsChange",!1);break;default:throw new Error("Unexpected bus message method - "+s.method)}}catch(t){}},x.prototype.renderConversationSelector=function(t){var e,n=this,i=t.conversations,t=t.selected;this.conversationSelector||((e=document.createElement("div")).classList.add("amo-livechat__dialogs-selector"),this.iframe_wrapper.append(e),this.conversationSelector=new T({context:this,conversations:i,selectorWrapper:e,onConversationClick:function(){n.handleWindowResize()},onAddConversationClick:function(){n.handleWindowResize()},onOpenAllClick:function(){n.handleWindowResize()},onSelectorToggle:function(t){t="closed"!==t;n.iframe_wrapper.classList.toggle("amo-livechat--selector-opened",t),e.classList.toggle("amo-livechat__dialogs-selector--opened",t)}}),this.conversationSelector.render(),t&&this.conversationSelector.setSelectedConversation(t),this.livechatHeight&&this.conversationSelector.setParentHeight(this.livechatHeight))},x.prototype.handleWindowResize=function(){if(this.isActive){var t,e=window.innerHeight,n=window.innerWidth,i=this.iframe.parentNode.getBoundingClientRect(),o="top"===this.props.position.v?i.top:i.bottom,i=window.innerWidth<=450,r=0;switch(!0){case"top"===this.props.position.v:r=o+120;break;case"page"===this.props.position.v:r=240;break;default:r=e-o+120}this.livechatHeight=i?this.iframe.parentNode.offsetHeight:e-r,this._livechatHeight=this.livechatHeight,this.conversationSelector&&(t=i?this.iframe.parentNode.offsetHeight:this._livechatHeight,this.conversationSelector.setParentHeight(t),this.conversationSelector.shouldOpenSelector&&(t=this.conversationSelector.getHeight(),this.livechatHeight=360<t?t+45:400)),this.iframe.parentNode.style.height=i?"":this.livechatHeight+"px",this.sendBusMessage({method:"resize",payload:{width:n}})}},x.prototype.destroy=function(){this.greeting&&this.greeting.destroy()},{}),oo=(M.getConditionsItems=function(i){return void 0===i&&(i={}),Object.keys(i).reduce(function(t,e){var e=i[e],n=e.conditions[0]||{};return n&&(t[e.type]=n),t},{})},M.getKey=function(t){return"keyaction_reached"+t},M.compareWithMask=function(t,e,n){void 0===t&&(t=""),void 0===e&&(e="");var i=!1;switch(parseInt(n,10)){case 1:i=t===e;break;case 2:i=t!==e;break;case 3:i=t.startsWith(e);break;case 4:i=t.endsWith(e);break;case 5:i=t.includes(e);break;case 6:i=!t.includes(e);break;default:i=!1}return i},M.prototype.parse=function(e){var n=this;Object.keys(e).forEach(function(t){var i=e[t],t=Object.keys(i.conditions);n.reactions[i.id]=i.reactions,t.length?n.conditions=t.reduce(function(t,e){var e=i.conditions[e],n=Ai();return t[n]={id:n,keyaction_id:i.id,constraint:i.constraint,items:M.getConditionsItems(e.settings)},t},n.conditions):n.react({keyaction_id:i.id,constraint:i.constraint})})},M.prototype.run=function(){var o=this,r=(this.listenPageScroll(),window.location.pathname),s=parseInt(sessionStorage.getItem("amo_social_button_tracking_hits"),10)||0;Object.keys(this.conditions).forEach(function(t){var e=o.conditions[t].items,n=e.url_visited,i=e.page_hits,e=e.time_on_site;i&&i.value&&s>i.value&&o.reach(t,"page_hits"),n&&M.compareWithMask(r,n.value,n.mask)&&o.reach(t,"url_visited"),e&&e.value&&(o.conditionTimeouts[t]=setTimeout(o.reach.bind(o,t,"time_on_site"),1e3*e.value))})},M.prototype.reach=function(t,e){void 0===e&&(e=null);var n=this.conditions[t];n&&(this.reached[t]||(this.reached[t]=[]),e&&-1===this.reached[t].indexOf(e)&&this.reached[t].push(e),this.reached[t].length===Object.keys(n.items).length&&this.react(n))},M.prototype.reachHook=function(n){var i=this;Object.keys(this.conditions).forEach(function(t){var t=i.conditions[t],e=(t.items||{}).custom_hook;e&&e.value===n&&i.reach(t.id,"custom_hook")})},M.prototype.react=function(t){var o,r=this;this.checkConstraint(t)&&(o=this.reactions[t.keyaction_id],Object.keys(o).forEach(function(t){var e=o[t];switch(e.action){case"amobutton_form":var n=e.settings.form.split("_"),i=n[0],n=n[1];r.showForm(i,n);break;case"amobutton_greeting":r.showGreeting();break;case"amobutton_animate":r.showAnimation(parseInt(e.settings.animation,10))}}),this.sendCRMReactions(t.keyaction_id),this.constraintTimeouts[t.keyaction_id]&&clearTimeout(this.constraintTimeouts[t.keyaction_id]),this.conditionTimeouts[t.id]&&clearTimeout(this.conditionTimeouts[t.id]))},M.prototype.checkConstraint=function(t){var e=t.keyaction_id,n=!1;try{switch(parseInt(t.constraint,10)){case 2:sessionStorage.getItem(M.getKey(e))||(sessionStorage.setItem(M.getKey(e),"y"),n=!0);break;case 4:localStorage.getItem(M.getKey(e))||(localStorage.setItem(M.getKey(e),"y"),n=!0);break;case 3:var i,o=(parseInt(localStorage.getItem(M.getKey(e,"shown_at")),10)||0)+864e5;Date.now()<o?(i=o-Date.now())/1e3<900&&(this.constraintTimeouts[e]=setTimeout(this.react.bind(this,t),i)):n=!0;break;default:io[M.getKey(e)]||(io[M.getKey(e)]="y",n=!0)}}catch(t){n=!1}return n},M.prototype.listenPageScroll=function(){for(var t=Object.keys(this.conditions),e=!1,n=0,i=t.length;n<i&&!(e=!!this.conditions[t[n]].items.scrolled_value);n+=1);e&&(this.handlePageScrollDebounced=Ni(this.handlePageScroll.bind(this),100),S.add({target:window,eventName:"scroll",handler:this.handlePageScrollDebounced}),this.handlePageScroll())},M.prototype.handlePageScroll=function(){var i=this,o=window.innerHeight*(window.innerHeight/document.documentElement.scrollHeight),r=window.pageYOffset+o;Object.keys(this.conditions).forEach(function(t){var e,n=i.conditions[t].items.scrolled_value;n&&(e=n.unit,n=n.value,e="%"===e?document.documentElement.scrollHeight*n/100:n,o+e<=r&&i.reach(t,"scrolled_value"))})},"amo-modal"),ro="amo-modal_hidden";j.prototype.initModalIframe=function(){var e=this;this.isActive=!1,this.name="amo-modal-iframe-"+Ai(8),S.add({target:window,eventName:"message",handler:function(t){return e.handleBusMessage(t)}}),this.iframe_wrapper=this.setupIframe()},j.prototype.setupIframe=function(){var t=this,e=this.props,n=e.host,e=e.container,i=document.createElement("div"),o=(i.id="amo-modal",i.className=[oo,ro].join(" "),document.createElement("style"));return o.type="text/css",o.id="",o.innerHTML="\n ."+oo+" {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n z-index: 2147483648;\n }\n ."+oo+" > iframe {\n border: none;\n width: 100%;\n height: 100%;\n }\n ."+ro+" {\n display: none;\n }\n ",this.iframe=document.createElement("iframe"),this.iframe.title=this.brandName+" Media Modal",this.iframe.name=this.name,this.iframe.src=n+"/modal/index.html?kZPXAMXzQc2tCy0Tr5Qxd",this.iframe.onload=function(){t.iframe.contentWindow.postMessage(JSON.stringify({method:"configure",payload:{AMO_MODAL_IFRAME:t.name}}),n)},i.appendChild(this.iframe),i.appendChild(o),e.appendChild(i),i},j.prototype.show=function(t,e){this.isActive||(this.isActive=!0,this.sendBusMessageToLivechat=e,this.iframe_wrapper.classList.remove(ro),document.documentElement.classList.add(this.name),ei([this.props.container]),this.iframe.focus(),this.sendBusMessage({method:"show",payload:t}))},j.prototype.close=function(){this.isActive&&(this.isActive=!1,ni([this.props.container]),document.documentElement.classList.remove(this.name),this.iframe_wrapper.classList.add(ro),document.removeEventListener("keydown",this.closeOnEsc),this.sendBusMessage({method:"clear"}))},j.prototype.sendBusMessage=function(t){this.iframe&&this.iframe.contentWindow.postMessage(JSON.stringify(Object.assign({},{origin:this.name},t)),this.props.host)},j.prototype.handleBusMessage=function(t){if(t.origin===this.props.host)try{var e=JSON.parse(t.data);if(e&&e.origin===this.name)switch(e.method){case"close":this.close();break;case"event":this.sendBusMessageToLivechat({method:"event",payload:e.payload});break;default:throw new Error("Unexpected bus message method - "+e.method)}}catch(t){}};o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==E?E:"undefined"!=typeof self?self:{};function so(t,e){return t(e={exports:{}},e.exports),e.exports}for(var ao=so(function(t){var e,n,i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);i?(e=new Uint8Array(16),t.exports=function(){return i(e),e}):(n=new Array(16),t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),n[e]=t>>>((3&e)<<3)&255;return n})}),co=[],lo=0;lo<256;++lo)co[lo]=(lo+256).toString(16).substr(1);function uo(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(Io&&Io in Object(t)?bo:Co)(t)}function ho(t){return null!=t&&"object"==typeof t}var po=function(t,e){var e=e||0,n=co;return[n[t[e++]],n[t[e++]],n[t[e++]],n[t[e++]],"-",n[t[e++]],n[t[e++]],"-",n[t[e++]],n[t[e++]],"-",n[t[e++]],n[t[e++]],"-",n[t[e++]],n[t[e++]],n[t[e++]],n[t[e++]],n[t[e++]],n[t[+e]]].join("")},fo=function(t,e){for(var n=-1,i=null==t?0:t.length,o=Array(i);++n<i;)o[n]=e(t[n],n,t);return o},mo="object"==typeof o&&o&&o.Object===Object&&o,o="object"==typeof self&&self&&self.Object===Object&&self,vo=mo||o||Function("return this")(),o=vo.Symbol,go=(a=Object.prototype).hasOwnProperty,_o=a.toString,yo=o?o.toStringTag:void 0,bo=function(t){var e=go.call(t,yo),n=t[yo];try{var i=!(t[yo]=void 0)}catch(t){}var o=_o.call(t);return i&&(e?t[yo]=n:delete t[yo]),o},wo=Object.prototype.toString,Co=function(t){return wo.call(t)},Io=o?o.toStringTag:void 0,a=function(t){return ho(t)&&"[object Arguments]"==uo(t)},ko=(o=Object.prototype).hasOwnProperty,So=o.propertyIsEnumerable,Ao=a(function(){return arguments}())?a:function(t){return ho(t)&&ko.call(t,"callee")&&!So.call(t,"callee")},Oo=Array.isArray;function Eo(){return!1}function To(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991}var xo=so(function(t,e){var n=(e=e&&!e.nodeType&&e)&&t&&!t.nodeType&&t,e=(n=n&&n.exports===e?vo.Buffer:void 0)?n.isBuffer:void 0;t.exports=e||Eo}),Mo=/^(?:0|[1-9]\d*)$/,L={};function jo(t){return null==t?[]:(t=(Uo(t=e=t)?Fo:Do)(t),fo(t,function(t){return e[t]}));var e}L["[object Float32Array]"]=L["[object Float64Array]"]=L["[object Int8Array]"]=L["[object Int16Array]"]=L["[object Int32Array]"]=L["[object Uint8Array]"]=L["[object Uint8ClampedArray]"]=L["[object Uint16Array]"]=L["[object Uint32Array]"]=!0,L["[object Arguments]"]=L["[object Array]"]=L["[object ArrayBuffer]"]=L["[object Boolean]"]=L["[object DataView]"]=L["[object Date]"]=L["[object Error]"]=L["[object Function]"]=L["[object Map]"]=L["[object Number]"]=L["[object Object]"]=L["[object RegExp]"]=L["[object Set]"]=L["[object String]"]=L["[object WeakMap]"]=!1;var Lo,No,o=function(e){return function(t){return e(t)}},Bo=(a=(a=so(function(t,e){var n=(e=e&&!e.nodeType&&e)&&t&&!t.nodeType&&t,i=n&&n.exports===e&&mo.process,e=function(){try{var t=n&&n.require&&n.require("util").types;return t||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=e}))&&a.isTypedArray)?o(a):function(t){return ho(t)&&To(t.length)&&!!L[uo(t)]},Ro=Object.prototype.hasOwnProperty,Fo=function(t,e){var n,i,o,r,s=Oo(t),a=!s&&Ao(t),c=!s&&!a&&xo(t),l=!s&&!a&&!c&&Bo(t),u=s||a||c||l,h=u?function(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}(t.length,String):[],d=h.length;for(n in t)!e&&!Ro.call(t,n)||u&&("length"==n||c&&("offset"==n||"parent"==n)||l&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||(r=void 0,r=typeof(i=n),!!(o=null==(o=d)?9007199254740991:o)&&("number"==r||"symbol"!=r&&Mo.test(i))&&-1<i&&i%1==0&&i<o))||h.push(n);return h},Po=Object.prototype,Ho=(Lo=Object.keys,No=Object,function(t){return Lo(No(t))}),zo=Object.prototype.hasOwnProperty,Do=function(t){if(n=(e=t)&&e.constructor,e!==("function"==typeof n&&n.prototype||Po))return Ho(t);var e,n,i,o=[];for(i in Object(t))zo.call(t,i)&&"constructor"!=i&&o.push(i);return o},Uo=function(t){return null!=t&&To(t.length)&&(e=typeof(t=t),!!(null==t||"object"!=e&&"function"!=e||"[object Function]"!=(t=uo(t))&&"[object GeneratorFunction]"!=t&&"[object AsyncFunction]"!=t&&"[object Proxy]"!=t));var e},N={TRACKING_PAGES:"amo_social_button_tracking_pages",TRACKING_HITS:"amo_social_button_tracking_hits",TRACKING_TIME:"amo_social_button_tracking_time",TRACKING_REFERRER:"amo_social_button_tracking_referrer",TRACKING_UUID:"amo_social_button_tracking_uuid",TRACKING_SESSION_ID:"amo_social_button_tracking_session_id",LINKED_CONTACTS:"amo_social_button_linked_contacts",IS_TRACKING_LINK_SENT:"is_send_follow_link"},Go=!1,Vo=null;function Wo(){return document.title?document.title+" ("+window.location.pathname+")":window.location.pathname}function Ko(){var t=window.sessionStorage.getItem(N.TRACKING_UUID);return t||(t=function(t,e,n){var i=e&&n||0,o=("string"==typeof t&&(e="binary"===t?new Array(16):null,t=null),(t=t||{}).random||(t.rng||ao)());if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var r=0;r<16;++r)e[i+r]=o[r];return e||po(o)}(),window.sessionStorage.setItem(N.TRACKING_UUID,t)),t}function Xo(){var t=window.sessionStorage.getItem(N.TRACKING_SESSION_ID);return t||(t=function(t){void 0===t&&(t=21);for(var e="",n=crypto.getRandomValues(new Uint8Array(t));t--;){var i=63&n[t];e+=i<36?i.toString(36):i<62?(i-26).toString(36).toUpperCase():i<63?"_":"-"}return e}(11),window.sessionStorage.setItem(N.TRACKING_SESSION_ID,t)),t}var o="%[a-f0-9]{2}",Yo=new RegExp(o,"gi"),qo=new RegExp("("+o+")+","gi");function Zo(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){for(var n=e,i={"%FE%FF":"<22><>","%FF%FE":"<22><>"},o=qo.exec(n);o;){try{i[o[0]]=decodeURIComponent(o[0])}catch(t){var r=function(e){try{return decodeURIComponent(e)}catch(t){for(var n=e.match(Yo),i=1;i<n.length;i++)n=(e=function t(e,n){try{return decodeURIComponent(e.join(""))}catch(t){}if(1===e.length)return e;var i=e.slice(0,n=n||1),e=e.slice(n);return Array.prototype.concat.call([],t(i),t(e))}(n,i).join("")).match(Yo);return e}}(o[0]);r!==o[0]&&(i[o[0]]=r)}o=qo.exec(n)}i["%C2"]="<22>";for(var s=Object.keys(i),a=0;a<s.length;a++)var c=s[a],n=n.replace(new RegExp(c,"g"),i[c]);return n}}function Jo(t,e){if("string"!=typeof t||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[t];var n=t.indexOf(e);return-1===n?[t]:[t.slice(0,n),t.slice(n+e.length)]}var $o=so(function(t,a){function m(t){if("string"!=typeof t||1!==t.length)throw new TypeError("arrayFormatSeparator must be single character string")}function c(t,e){return e.encode?e.strict?encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()}):encodeURIComponent(t):t}function v(t,e){return e.decode?Zo(t):t}function l(t){var e=t.indexOf("#");return-1!==e?t.slice(0,e):t}function o(t){var e=(t=l(t)).indexOf("?");return-1===e?"":t.slice(e+1)}function g(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&"string"==typeof t&&""!==t.trim()?t=Number(t):!e.parseBooleans||null===t||"true"!==t.toLowerCase()&&"false"!==t.toLowerCase()||(t="true"===t.toLowerCase()),t}function r(t,e){m((e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e)).arrayFormatSeparator);var n=function(i){var o;switch(i.arrayFormat){case"index":return function(t,e,n){o=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),o?(void 0===n[t]&&(n[t]={}),n[t][o[1]]=e):n[t]=e};case"bracket":return function(t,e,n){o=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),o?void 0===n[t]?n[t]=[e]:n[t]=[].concat(n[t],e):n[t]=e};case"comma":case"separator":return function(t,e,n){e="string"==typeof e&&-1<e.split("").indexOf(i.arrayFormatSeparator)?e.split(i.arrayFormatSeparator).map(function(t){return v(t,i)}):null===e?e:v(e,i),n[t]=e};default:return function(t,e,n){void 0===n[t]?n[t]=e:n[t]=[].concat(n[t],e)}}}(e),i=Object.create(null);if("string"!=typeof t)return i;if(!(t=t.trim().replace(/^[?#&]/,"")))return i;for(var o=0,r=t.split("&");o<r.length;o+=1){var s=r[o],a=(s=Jo(e.decode?s.replace(/\+/g," "):s,"="))[0],s=void 0===(s=s[1])?null:["comma","separator"].includes(e.arrayFormat)?s:v(s,e);n(v(a,e),s,i)}for(var c=0,l=Object.keys(i);c<l.length;c+=1){var u=l[c],h=i[u];if("object"==typeof h&&null!==h)for(var d=0,p=Object.keys(h);d<p.length;d+=1){var f=p[d];h[f]=g(h[f],e)}else i[u]=g(h,e)}return!1===e.sort?i:(!0===e.sort?Object.keys(i).sort():Object.keys(i).sort(e.sort)).reduce(function(t,e){var n=i[e];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?t[e]=function t(e){return Array.isArray(e)?e.sort():"object"==typeof e?t(Object.keys(e)).sort(function(t,e){return Number(t)-Number(e)}).map(function(t){return e[t]}):e}(n):t[e]=n,t},Object.create(null))}a.extract=o,a.parse=r,a.stringify=function(n,i){if(!n)return"";m((i=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},i)).arrayFormatSeparator);for(var o=function(o){switch(o.arrayFormat){case"index":return function(i){return function(t,e){var n=t.length;return void 0===e||o.skipNull&&null===e||o.skipEmptyString&&""===e?t:null===e?t.concat([[c(i,o),"[",n,"]"].join("")]):t.concat([[c(i,o),"[",c(n,o),"]=",c(e,o)].join("")])}};case"bracket":return function(n){return function(t,e){return void 0===e||o.skipNull&&null===e||o.skipEmptyString&&""===e?t:null===e?t.concat([[c(n,o),"[]"].join("")]):t.concat([[c(n,o),"[]=",c(e,o)].join("")])}};case"comma":case"separator":return function(n){return function(t,e){return null==e||0===e.length?t:0===t.length?[[c(n,o),"=",c(e,o)].join("")]:[[t,c(e,o)].join(o.arrayFormatSeparator)]}};default:return function(n){return function(t,e){return void 0===e||o.skipNull&&null===e||o.skipEmptyString&&""===e?t:null===e?t.concat([c(n,o)]):t.concat([[c(n,o),"=",c(e,o)].join("")])}}}}(i),t={},e=0,r=Object.keys(n);e<r.length;e+=1){var s=r[e];i.skipNull&&null==n[s]||i.skipEmptyString&&""===n[s]||(t[s]=n[s])}var a=Object.keys(t);return!1!==i.sort&&a.sort(i.sort),a.map(function(t){var e=n[t];return void 0===e?"":null===e?c(t,i):Array.isArray(e)?e.reduce(o(t),[]).join("&"):c(t,i)+"="+c(e,i)}).filter(function(t){return 0<t.length}).join("&")},a.parseUrl=function(t,e){e=Object.assign({decode:!0},e);var n=(i=Jo(t,"#"))[0],i=i[1];return Object.assign({url:n.split("?")[0]||"",query:r(o(t),e)},e&&e.parseFragmentIdentifier&&i?{fragmentIdentifier:v(i,e)}:{})},a.stringifyUrl=function(t,e){e=Object.assign({encode:!0,strict:!0},e);var n,i,o=l(t.url).split("?")[0]||"",r=a.extract(t.url),r=a.parse(r,{sort:!1}),r=Object.assign(r,t.query),r=(r=a.stringify(r,e))&&"?"+r,s=(n="",n=-1!==(i=(s=t.url).indexOf("#"))?s.slice(i):n);return""+o+r+(t.fragmentIdentifier?"#"+c(t.fragmentIdentifier,e):s)}}),Qo=($o.extract,$o.parse,$o.stringify,$o.parseUrl,$o.stringifyUrl,["from","openstat_service","openstat_campaign","openstat_ad","openstat_source","utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_referrer","gсlid","fbclid","yclid","referrer"]),tr={baseURL:""},er=!1,nr=!1;function ir(t){switch(t.data){case"SET_AMO_PIXEL_READY":nr=!(er=!0);break;case"IS_AMO_PIXEL_READY?":er?t.source.postMessage("AMO_PIXEL_READY",t.origin):nr?t.source.postMessage("AMO_PIXEL_LOADING",t.origin):(nr=!0,t.source.postMessage("AMO_PIXEL_NOT_READY",t.origin))}}window.AMO_PIXEL_CLIENT||(window.addEventListener("message",ir),window.AMO_PIXEL_CLIENT={getSessionUid:Ko,getShortSessionId:Xo,getTrackingLink:function(){if(!window.AMOCRM_NO_TRACKING&&!window.sessionStorage.getItem(N.IS_TRACKING_LINK_SENT))return window.sessionStorage.setItem(N.IS_TRACKING_LINK_SENT,"y"),document.location.href},makeMetadata:function(){if(!Vo){var t,e;try{t=JSON.parse(window.sessionStorage.getItem(N.TRACKING_PAGES)||{})}catch(e){t={}}e=(parseFloat(window.sessionStorage.getItem(N.TRACKING_TIME))||0)/1e3,Vo={hits:parseInt(window.sessionStorage.getItem(N.TRACKING_HITS),10)||0,pages:Object.keys(t),referrer:window.sessionStorage.getItem(N.TRACKING_REFERRER),time:parseInt(e,10),page:""},window.AMOCRM_NO_TRACKING||(Vo.page=Wo())}return Vo},registerHit:function(){if(!Go){var t,e=window.sessionStorage.getItem(N.TRACKING_REFERRER),n=document.referrer.split("/")[2],i=window.location.hostname,o=parseInt(window.sessionStorage.getItem(N.TRACKING_HITS),10)||0,r=parseFloat(window.sessionStorage.getItem(N.TRACKING_TIME),10)||0;Ko(),Xo();try{t=JSON.parse(window.sessionStorage.getItem(N.TRACKING_PAGES)||{})}catch(e){t={}}n&&n!==e&&n!==i&&(window.sessionStorage.setItem(N.TRACKING_REFERRER,n),window.sessionStorage.setItem(N.TRACKING_TIME,"0"),o=0,t={}),window.AMOCRM_NO_TRACKING||(t[Wo()]=!0,window.sessionStorage.setItem(N.TRACKING_PAGES,JSON.stringify(t))),window.sessionStorage.setItem(N.TRACKING_TIME,r.toString()),window.sessionStorage.setItem(N.TRACKING_HITS,(o+1).toString()),window.sessionStorage.setItem(N.TRACKING_TIME,r.toString()),window.window.addEventListener("beforeunload",function(){r+=performance.now(),window.sessionStorage.setItem(N.TRACKING_TIME,r.toString())}),Go=!0}},extractTrackingParamsFromUrl:function(){return n=$o.parse(location.search),e=Qo,Object.keys(n).filter(function(t){return 0<=e.indexOf(t)}).reduce(function(t,e){return Object.assign(t,((t={})[e]=n[e],t))},{});var n,e},extractTrackingParamsFromTrackers:function(l){var t=function(){var i,t;function o(t){"undefined"!=typeof ga?ga(function(){t([ga.getAll().map(function(t){return{key:"gclientid",value:t.get("clientId")}})[0]])}):t([])}function r(e){var n;"undefined"!=typeof Ya?(n=(Ya.Metrika||Ya.Metrika2).counters().map(function(t){return t&&t.id}).filter(function(t){return t})[0],"undefined"!=typeof ym?ym(n,"getClientID",function(t){e([{key:"_ym_counter",value:n},{key:"_ym_uid",value:t}])}):void 0!==window["yaCounter"+n]?e([{key:"_ym_counter",value:n},{key:"_ym_uid",value:window["yaCounter"+n].getClientID()}]):e([])):e([])}function s(t){void 0!==window.roistat?t([{key:"roistat",value:window.roistat.getVisit()}]):t([])}i=function(t){function e(){c=0,n.forEach(function(t){c++;try{t(function(t){var e,t=s.indexOf(t);-1<t&&((e=Array.prototype.slice.call(arguments,1))&&e.length&&e.filter(function(t){return t.length}).length&&(s.splice(t,1),r=r.concat(e)),s.length||(clearTimeout(a),clearInterval(o),window.removeEventListener("beforeunload",i.bind(null,r)),i(r)))}.bind(null,c))}catch(t){}})}var n,i,o,r,s,a,c;n=t,i=l,r=[],s=[],a=setTimeout(function(){clearInterval(o),i(r),window.removeEventListener("beforeunload",i.bind(null,r))},5e3),window.addEventListener("beforeunload",i.bind(null,r)),c=0,n.forEach(function(){c++,s.push(c)}),e(),s.length&&(o=setInterval(function(){n.length&&e()},500))},(t=new XMLHttpRequest).onload=function(){var e;try{e=JSON.parse(t.response)}catch(t){e={}}var n=[o,r,s];Object.keys(e).forEach(function(t){n.push(new Function(e[t]))}),i(n)},t.onerror=function(t){var e=[o,r,s];console.error("Failed to get custom trackers "+t.currentTarget.statusText),i(e)},t.open("GET",tr.baseURL+"/callbacks/?id="+tr.id+"&hash="+tr.hash),t.send()};"complete"===document.readyState?t():document.onreadystatechange=function(){"complete"===document.readyState&&t()}},configure:function(t){Object.assign(tr,t)},canSetupContactForHuman:function(t){var e;try{e=JSON.parse(window.sessionStorage.getItem(N.LINKED_CONTACTS))}catch(t){}if(-1===(e=e||[]).indexOf(t))return e.push(t),window.sessionStorage.setItem(N.LINKED_CONTACTS,JSON.stringify(e)),t},destroy:function(){window.removeEventListener("message",ir),jo(N).forEach(function(t){window.sessionStorage.removeItem(t)}),delete window.AMO_PIXEL_CLIENT}});function B(t){this.document=document,this.window=window,this.meta_params=t,this.bot_params={},this.init(t)}B.prototype.init=function(t){var e,n,i=this,o=(t=t||{}).id||0,r=t.hash||!1,s="ru"!==t.locale?"com":"ru",t=t.locale&&-1<["en","ru","es","pt"].indexOf(t.locale)?t.locale:"en",a=i.document.querySelector("#crm_plugin_script")||i.document.querySelector("#amo_social_button_script"),c=a.parentNode,a=a.src;i.id=o,i.hash=r,i.collapsed=!0,i.lang_id=t,i.modal=null,i.greetingAwaited=!1,i.keyactionsAwaited=[],i.user_config=window.amoSocialButtonConfig||window.crmPluginConfig||{},i.socialFrameReady=!1,i.DEFAULT_Z_INDEX=parseInt(qi()),i.parent_node="HEAD"!==c.tagName?c:i.document.body,t=a,t=new URL(t),c=t.protocol,t=t.hostname.split("."),a=t[0],e=t.slice(1).join("."),n="",a.slice(0,a.length-2)in C&&(n=a.slice(-2)),C.gso=c+"//gso"+n+"."+e,C.forms=c+"//forms"+n+"."+e,C.button=c+"//button"+n+"."+e,n="",3<t.length&&(n="com"===t[t.length-1]?"en":"ru"),C.promo=c+"//www"+n+"."+e,i.server_host=C.gso,i.forms_host=C.forms+"/forms/assets/js/amoforms.js",i.locale=s,0<o&&r&&i.get_settings(o,r),i.langs={en:{made_by:"Made by "},ru:{made_by:"Сделано в "},es:{made_by:"Hecho por "},pt:{made_by:"Feito por "}}},B.prototype.get_settings=function(s,t){var a=this,t=a.server_host+"/social_button/settings/?client_version=3&id="+s+"&hash="+t,c=new XMLHttpRequest;c.onload=function(){if(200===c.status){var t,n=Sn.toASCII(a.window.location.hostname),i=!1,o={},e=n.split("."),r=(e.shift(),e.join("."));try{if(t=JSON.parse(c.response),o=t.response.result?t.response:t.response[s],!/Macintosh|iPad|iPhone/.test(navigator.userAgent)&&o.settings.social_services&&(o.settings.social_services=Object.assign({},kn(o.settings.social_services,{type:En}))),!Object.keys(o.settings.social_services).length)return;Object.keys(o.domains).map(function(t,e){if(!1===i&&-1!==Sn.toASCII(o.domains[t]).search(n))return i=!0,a.check_settings(o),AMO_PIXEL_CLIENT.registerHit(),a.render(),!1}),!i&&o.settings&&o.settings.base_domains&&Object.keys(o.settings.base_domains).map(function(t,e){if(!1===i){t=Sn.toASCII(o.settings.base_domains[t]);if(r===t)return i=!0,a.check_settings(o),AMO_PIXEL_CLIENT.registerHit(),a.render(),!1}})}catch(t){console.error(t)}a.meta_params.inline=a.meta_params.inline&&!a.isOnlyOneButton()}},c.open("GET",t),c.send()},B.prototype.check_settings=function(t){var e,n;switch(this.settings=t.settings,this.settings.button.size=this.meta_params.inline?this.settings.button.size-10:this.settings.button.size,this.settings.date_update=t.date_update,this.settings.keyactions=t.key_actions||{},this.settings.brandName=t.brand_name,this.getVersion()){case 3:case 2:e=parseInt(this.settings.button.size),n=parseInt(this.settings.button.radius),this.orientation=parseInt(this.settings.button.orientation),this.settings.button.size=isNaN(e)?50:e,this.settings.button.radius=isNaN(n)?35:n,"Y"===this.settings.button.fixed&&(this.parent_node=document.body);break;default:e=parseInt(this.settings.button.button_size),this.settings.button.button_size=isNaN(e)?50:e,this.orientation=parseInt(this.settings.button.orient),this.settings.button.is_fixed||this._checkIfVerticalNotFixed(),"Y"===this.settings.button.is_fixed&&(this.parent_node=document.body)}this.services_count=Object.keys(this.settings.social_services).length},B.prototype.getVersion=function(){return this.settings?this.settings.version||1:2},B.prototype._checkIfVerticalNotFixed=function(){this.settings.button.button_position="bottom-left"},B.prototype.render=function(){var n=this,i=n.getVersion(),o=1===i?[n.server_host+"/css/main.css"]:[n.server_host+"/css/v"+i+"/main.css?kZPXAMXzQc2tCy0Tr5Qxd",n.server_host+"/css/v"+i+"/livechat.css?kZPXAMXzQc2tCy0Tr5Qxd",n.server_host+"/css/v"+i+"/keyframes.css?kZPXAMXzQc2tCy0Tr5Qxd"],r=0;o.forEach(function(t){var e=document.createElement("link");e.rel="stylesheet",e.href=t,e.onload=function(){++r===o.length&&(1===i?n.render_frame():n.renderFrame())},n.document.head.appendChild(e)})},B.prototype.getZIndexForElement=function(t){switch(t){case"mainHolder":return this.DEFAULT_Z_INDEX+1;case"socialIFrame":return this.DEFAULT_Z_INDEX+2;case"livechat":return this.DEFAULT_Z_INDEX+3;default:return this.DEFAULT_Z_INDEX}},B.prototype.renderFrame=function(){var e=this,n=this,t=n.getVersion(),i=this.server_host+"/buttons/v"+t+"/html/"+this.hash+".html?"+this.settings.date_update,o=this.document.createElement("iframe"),r={button:null,holder:null,link_holder:null,animation:this.getAnimation(),theme:this.settings.button.theme,size:parseInt(this.settings.button.size),position:this.makePositionParams(),orientation:parseInt(this.settings.button.orientation),is_fixed:"Y"===this.settings.button.fixed};r.holder=this.renderHolder(r),r.button=this.renderMainButton(r),this.buttonHolderEl=r.holder,this.setFrame(o,i,t,r),r.holder.insertBefore(o,r.holder.children[0]),r.link_holder=this.renderBrand(r),this.setOrientation(o,r),this.setBrandPosition(r),this.setPosition(r),this.displayAnimation(r),o.onload=function(){n.set_social(n.settings),n.initApiMeta(),S.add({target:r.button,eventName:"click",handler:function(t){return t.stopPropagation(),n.onButtonClick(r),!1}}),n.forceButtonCollapse=function(){n.onButtonClick(r,{collapseSocials:!0})},n.addClicksListener()},this.initModal(r),this.initFormModal(r),this.initKeyActions(r),Nn(function(t){switch(t){case"livechat":return e.livechat;case"keyactions":return e.keyactions;case"button":return{setupContactForHuman:e.setupContactForHuman.bind(e),destroy:e.destroy.bind(e)};default:return null}})},B.prototype.isOnlyOneButton=function(){var t=Object.keys(this.settings.social_services);return 1===t.length&&this.settings.social_services[t[0]].type||""},B.prototype.getButtonColor=function(){return this.user_config.color||this.settings.button.color},B.prototype.getButtonRadius=function(){return this.user_config.radius||this.settings.button.radius},B.prototype.getAnimation=function(){return this.settings.button.animation?parseInt(this.settings.button.animation):0},B.prototype.onButtonClick=function(t,e){var n,i,o,r=this;this.meta_params.inline&&this.is_not_first_click?this.onMessage({data:"click_button"}):(this.is_not_first_click=!0,e=e&&e.collapseSocials||!1,n=!t.button.classList.contains("amo-button--only-livechat"),i=this.getParamToNull(),o=rt(i),this.collapsed?(this.collapsed=!1,n&&!e&&(this.soc_frame.elem[i]=this.soc_frame[i],this.soc_frame.elem.style["min"+o]=this.soc_frame[i]+"px"),t.button.classList.add("maincollapsed"),this.meta_params.inline?(this.setBackgroundColor(t.button,"transparent"),this.setBorderColor(t.button,"transparent")):(this.setBackgroundColor(t.button,"white"===t.theme?"#FFF":"#000"),this.setBorderColor(t.button,"white"===t.theme?this.getButtonColor():"#FFF")),this.setHolderPadding(t),t.link_holder.classList.add("collapsed"),this.hideAnimation(t.button),this.livechat&&(this.livechat.hideBubble(),n||this.livechat.show())):(this.collapsed=!0,t.button.classList.remove("maincollapsed"),t.link_holder.classList.remove("collapsed"),this.resetHolderPadding(t),this.livechat&&(this.livechat.hide(),this.livechat.isEnabled&&this.livechat.showBubble()),this.is_form_shown&&this.hideForm(),this.setBackgroundColor(t.button,this.getButtonColor()),this.setBorderColor(t.button,""),this.displayAnimation(t),setTimeout(function(){!0===r.collapsed&&(r.soc_frame.elem[i]=0,r.soc_frame.elem.style["min"+o]="0px")},1e3)),this.soc_frame.elem.contentWindow.postMessage({method:"button:click",payload:{showSocials:!this.collapsed&&!e,isInline:this.meta_params.inline,buttonTheme:t.theme}},"*"))},B.prototype.displayAnimation=function(t){var e="";switch(t.animation){case 0:return;case 1:e="amo_animation_waves";break;case 2:e="amo_animation_tremble";break;case 3:e="amo_animation_shake"}e&&(t.button.className+=" "+e)},B.prototype.hideAnimation=function(t){t.className=t.className.replace(/\bamo_animation_[a-z]+\b/g,"")},B.prototype.isMobileDevice=function(){return(0<window.innerWidth?window.innerWidth:screen.width)<640},B.prototype.makePositionParams=function(){var t,e=this.isMobileDevice(),n=parseInt(this.settings.button.position)%2==0?"right":"left",i=2<parseInt(this.settings.button.position)?"bottom":"top",e=e?(t=this.settings.button.x_offset_m,this.settings.button.y_offset_m):(t=this.settings.button.x_offset,this.settings.button.y_offset);return{x:t,y:e,v:i,h:n}},B.prototype.setBrandPosition=function(t){if(this.disable_titles=!1,2===t.orientation){if(t.position.y<24)return void(t.link_holder.style.display="none");"top"===t.position.v&&(t.link_holder.style.top="-20px"),"bottom"===t.position.v&&(t.link_holder.style.bottom="-18px")}else{if("bottom"===t.position.v&&t.position.y<24)return this.disable_titles=!0,void(t.link_holder.style.display="none");this.meta_params.inline&&(t.link_holder.style[t.position.h]=0),t.link_holder.style.bottom="-18px"}t.position.x<20&&t.link_holder.classList.add("amo-brand_to-"+t.position.h)},B.prototype.renderHolder=function(t){var e=this.document.createElement("div"),n=this.isOnlyOneButton(),i="livechat"===n,n=n&&!i?n:"";return e.className="amo-button-holder "+(2===t.orientation?"amo-vertical":"amo-horisontal"),e.style.position=t.is_fixed?"fixed":"absolute",e.innerHTML=['<div class="amo-button amo-button--main '+(i?"amo-button--only-livechat":"")+" "+(n?"amo-button--only-social":"")+' js-amo-button" id="amobutton" data-social="'+n+'" style="width: '+t.size+"px; height:"+t.size+"px; z-index: "+this.getZIndexForElement("livechat")+'">','<div class="amo-button--main-icon'+(this.meta_params.inline?" amo-button--no-fill":"")+'">',3===this.getVersion()?'<svg class="amo-button--close-icon" width="19" height="19" viewBox="0 0 19 19" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9.33274 11.3695L2.46267 18.2395C1.89896 18.8032 0.98461 18.8057 0.42219 18.2433C-0.144151 17.677 -0.138549 16.7673 0.42597 16.2028L7.29603 9.33276L0.42597 2.46267C-0.137747 1.89896 -0.14023 0.984599 0.42219 0.422179C0.988531 -0.144162 1.89816 -0.138538 2.46267 0.425981L9.33274 7.29605L16.2028 0.425981C16.7666 -0.137736 17.6809 -0.140241 18.2433 0.422179C18.8097 0.98852 18.8041 1.89816 18.2395 2.46267L11.3694 9.33276L18.2395 16.2028C18.8033 16.7665 18.8057 17.6809 18.2433 18.2433C17.677 18.8097 16.7674 18.804 16.2028 18.2395L9.33274 11.3695Z" />/svg>':"","</div>","</div>"].join(""),t.is_fixed&&(e.style.zIndex=this.getZIndexForElement("mainHolder")),this.parent_node.appendChild(e),e},B.prototype.renderMainButton=function(t){var e=t.holder.querySelector(".js-amo-button");return this.setBackgroundColor(e,this.getButtonColor()),this.setBorderRadius(e,this.getButtonRadius()),e.style.float=""===t.is_fixed?"left":t.position.h,this.user_config.hidden&&(e.style.display="none"),e},B.prototype.setBackgroundColor=function(t,e){t.style.backgroundColor=e},B.prototype.setBorderRadius=function(t,e){t.style.borderRadius=e+"px"},B.prototype.setBorderColor=function(t,e){3===this.getVersion()&&(t.style.borderColor=e,t.style.fill=e)},B.prototype.renderBrand=function(t){var e=this.document.createElement("div"),n=In(),i=this.langs[this.lang_id].made_by+" "+this.settings.brandName;return"es"===this.lang_id&&(n+="/es/"),e.className="amo-brand",e.id="amo_brand",e.style.width=t.size+(this.meta_params.inline?7:0)+"px",e.innerHTML='<p class="amo-brand__link-holder"><a target="_blank" href="'+n+'" class="amo-brand__link">'+i+"</a></p>",t.holder.appendChild(e),e},B.prototype.setHolderPadding=function(t){if(!this.meta_params.inline&&2===t.orientation){var e=7+(t.size+10)*this.services_count+"px";switch(t.position.v){case"top":t.holder.style.paddingBottom=e;break;case"bottom":t.holder.style.paddingTop=e}}},B.prototype.resetHolderPadding=function(t){if(2===t.orientation)switch(t.position.v){case"top":t.holder.style.paddingBottom="0px";break;case"bottom":t.holder.style.paddingTop="0px"}},B.prototype.setOrientation=function(t,e){if(this.isOnlyOneButton())return t.style.top="7px",void(t.style.left="7px");if(2===e.orientation){var n=(this.meta_params.inline?-15:e.size-5)+"px",i=this.meta_params.inline?"-4px":0;switch(e.position.v){case"top":t.style.top=n,t.style.bottom="inherit","right"===e.position.h?(t.style.right=i,t.style.left="inherit"):(t.style.left=i,t.style.right="inherit");break;case"bottom":t.style.top="inherit",t.style.bottom=n,"right"===e.position.h?(t.style.right=i,t.style.left="inherit"):(t.style.left=i,t.style.right="inherit")}}else{switch("bottom"===e.position.v&&(t.style.top="auto",t.style.bottom=this.meta_params.inline?"-25px":"-20px"),e.position.v){case"bottom":t.style.top="auto",t.style.bottom=this.meta_params.inline?"-25px":"-20px";break;case"top":t.style.top=this.meta_params.inline&&"-4.5px"}var o=this.meta_params.inline?"-33px":e.size-15+"px";switch(e.position.h){case"left":t.style.left=o,t.style.right="inherit";break;case"right":t.style.left="inherit",t.style.right=o}}},B.prototype.setPosition=function(t){if(t.holder.style[t.position.h]=t.position.x+"px",t.holder.style[t.position.v]=t.position.y+"px",this.meta_params.inline){var e,n=0;for(e in this.settings.social_services)"livechat"===this.settings.social_services[e].type&&(n=e);var i=t.holder.querySelector(".amo-button--main");i.style.pointerEvents="none",i.style.backgroundColor="transparent",1===t.orientation?i.style[t.position.h]=(t.size+4)*n-7+"px":i.style[t.position.v]=(t.size+4)*n-7+8+"px"}},B.prototype.checkIfFormsNeeds=function(){0!==parseInt(this.settings.button.form)&&this.renderForms()},B.prototype.renderForms=function(){var t=this.getFormData();this.insertForms(t)},B.prototype.render_frame=function(){var e,n=this,t=n.settings.button.is_fixed,i=n.document.createElement("iframe"),o=n.document.createElement("div"),r=n.document.createElement("div"),s=n.server_host+"/buttons/html/"+n.hash+".html?"+n.settings.date_update,a=n.settings.button.button_position.split("-"),c=In();if("es"===n.lang_id&&(c+="/es/"),o.className="amo-button-holder "+(2===n.orientation?"amo-vertical":"amo-horisontal"),o.style.position=t?"fixed":"absolute",o.innerHTML='<div class="amo-button amo-button--main js-amo-button" id="amobutton" style="width:'+n.settings.button.button_size+"px; height:"+n.settings.button.button_size+'px"></div>',t&&(o.style.zIndex=parseInt(qi())),n.parent_node.appendChild(o),n.button_holder=o,e=o.querySelector(".js-amo-button"),n.settings.button.hasOwnProperty("color")&&(e.style.backgroundColor=n.settings.button.color),e.style.float=""===n.settings.button.is_fixed?"left":a[1],this.setFrame(i,s,1),o.insertBefore(i,o.children[0]),o.style.height=n.soc_frame.height+"px",2===this.orientation)switch(a[0]){case"top":o.style.paddingBottom=7+(n.settings.button.button_size+10)*n.services_count+"px";break;case"bottom":o.style.paddingTop=7+(n.settings.button.button_size+10)*n.services_count+"px"}r.className="amo-brand",r.id="amo_brand",n.brand_holder=r,1===n.orientation&&(r.style[t?a[1]:"left"]="7px"),r.innerHTML='<p class="amo-brand__link-holder" style="float: '+(t?a[1]:"left")+'">'+n.langs[n.lang_id].made_by+' <a target="_blank" href="'+c+'" class="amo-brand__link">amoCRM</a></p>',o.appendChild(r),2===n.orientation&&n.setVerticalBrandPos(a),"Y"===n.settings.button.is_fixed?(o.style[a[1]]=(""===n.settings.button.horisontal_position?0:n.settings.button.horisontal_position)+"px",o.style[a[0]]=(""===n.settings.button.vertical_position?0:n.settings.button.vertical_position)+"px","right"==a[1]&&i.setAttribute("style","right:0; left: inherit")):2===n.orientation&&(o.style.bottom=0),i.onload=function(){n.set_social(n.settings),n.initApiMeta(),S.add({target:e,eventName:"click",handler:function(t){return t.stopPropagation(),n.onButtonClickV1(e,r),!1}}),n.checkIfFormsNeeds()}},B.prototype.initApiMeta=function(){var n=this;if(n.meta_params.setMeta=function(t){var e=n.window.frames.social_iframe;"object"==typeof t&&Object.assign(n.bot_params,t.bot_params||{}),e.postMessage({method:"send_meta",payload:{metaData:t}},"*")},n.meta_params.params){for(var t in n.meta_params.params)n.meta_params.setMeta(n.meta_params.params[t]);delete n.meta_params.params}AMO_PIXEL_CLIENT.configure({baseURL:n.server_host,id:n.id,hash:n.hash});var o=AMO_PIXEL_CLIENT.extractTrackingParamsFromUrl();AMO_PIXEL_CLIENT.extractTrackingParamsFromTrackers(function(t){var i=[];t.forEach(function(t){0<t.length&&t.forEach(function(t){t.key&&t.value&&i.push({field_code:t.key.toUpperCase(),values:[{value:t.value}]})})}),Object.keys(o).map(function(t,e){var n=o[t];i.push({field_code:t.toUpperCase(),values:[{value:n}]})}),0<i.length&&n.meta_params.setMeta({lead:{custom_fields_values:i}})})},B.prototype.onButtonClickV1=function(t,e){var n=this,i=this.getParamToNull();this.collapsed?(this.collapsed=!1,this.soc_frame.elem[i]=this.soc_frame[i],t.classList.add("maincollapsed"),e.classList.add("collapsed")):(this.collapsed=!0,t.classList.remove("maincollapsed"),e.classList.remove("collapsed"),this.is_form_shown&&this.hideForm(),setTimeout(function(){!0===n.collapsed&&(n.soc_frame.elem[i]=0)},1e3)),this.soc_frame.elem.contentWindow.postMessage({method:"button:click",payload:{showSocials:!this.collapsed}},"*")},B.prototype.getParamToNull=function(){return 1===parseInt(this.orientation)?"width":"height"},B.prototype.setFrame=function(t,e,n,i){void 0===i&&(i={});var o=this.isOnlyOneButton();this.soc_frame={},this.soc_frame.elem=t,this.setSizes(n),t.id="social_iframe",t.setAttribute("name","social_iframe"),t.src=e,t.scrolling="no",t.className="amo-button__iframe",o&&"livechat"!==o&&(t.style.opacity=0),i.is_fixed&&(t.style.zIndex=this.getZIndexForElement("socialIFrame"))},B.prototype.isFirstSourceApple=function(){var t=Object.keys(this.settings.social_services).length;return this.settings.social_services[t-1].type===En},B.prototype.setSizes=function(t){var e=this.isOnlyOneButton();3===t&&e&&"livechat"!==e?this.setOnlySizes():(1===t?2===parseInt(this.orientation):2===parseInt(this.settings.button.orientation))?this.setVerticalSizes(t):this.setHorisontalSizes(t)},B.prototype.setOnlySizes=function(){this.soc_frame.width=this.settings.button.size,this.soc_frame.height=this.settings.button.size,this.soc_frame.elem.width=this.settings.button.size,this.soc_frame.elem.height=this.settings.button.size},B.prototype.setVerticalSizes=function(t){var e=this.services_count,n=this.meta_params.inline?this.settings.button.size+10:this.settings.button.size;1===t?(this.soc_frame.width=this.settings.button.button_size+14,this.soc_frame.height=this.settings.button.button_size+14+(this.settings.button.button_size+10)*e,this.soc_frame.elem.width=this.soc_frame.width):(this.soc_frame.width=n+100,this.soc_frame.height=(n-6)*e+40,this.soc_frame.elem.width=this.soc_frame.width,this.soc_frame.elem.style.minWidth=this.soc_frame.width+"px"),this.soc_frame.elem.height=0},B.prototype.setHorisontalSizes=function(t){var e,n,i,o,r=this.services_count,s=this.makePositionParams(),a="bottom"===s.v?36:38,c=this.meta_params.inline?this.settings.button.size+4:this.settings.button.size-10+4;1===t?(this.soc_frame.width=this.settings.button.button_size+14+(this.settings.button.button_size+10)*r,this.soc_frame.height=this.settings.button.button_size+14+20,this.soc_frame.elem.width=0,this.soc_frame.elem.height=this.soc_frame.height):(3===t?(t=this.settings.button.size+4,this.meta_params.inline||(t-=10),i=this.isFirstSourceApple()?23:15,o=this.meta_params.inline?0:this.settings.button.size,o=window.innerWidth-s.x-o-29-i,e=Math.min(t*r+29+i,o),n=Math.floor(e/t),e===o&&(o=Math.floor((e+i)/t),e+=29,n===o&&(e+=i))):(e=Math.min((this.settings.button.size-6)*r+40,window.innerWidth-s.x-this.settings.button.size-15),this.meta_params.inline&&(e+=this.settings.button.size),n=Math.floor(e/this.settings.button.size)),this.soc_frame.width=e,this.soc_frame.height=Math.ceil(Object.keys(this.settings.social_services).length/n)*c+a,this.soc_frame.elem.width=0,this.soc_frame.elem.height=this.soc_frame.height,this.soc_frame.elem.style.minHeight=this.soc_frame.height+"px")},B.prototype.set_social=function(t){var e=this;this.session_uid=AMO_PIXEL_CLIENT.getSessionUid(),this.session_id=AMO_PIXEL_CLIENT.getShortSessionId(),t.locale=this.locale,t.button.id=this.id,t.button.hash=this.hash,t.session_uid=this.session_uid,t.session_id=this.session_id,t.metadata=AMO_PIXEL_CLIENT.makeMetadata(),t.link=AMO_PIXEL_CLIENT.getTrackingLink(),t.disable_titles=this.disable_titles,t.isMobile=this.isMobileDevice(),this.window.frames.social_iframe.postMessage({method:"set_social",payload:{data:t}},"*"),this.socialFrameReady=!0,this.keyactionsAwaited.forEach(function(t){return e.sendCRMReactions(t)}),this.keyactionsAwaited=[]},B.prototype.setVerticalBrandPos=function(t){var e=this.brand_holder,n=e.offsetWidth,i=t[1],t=t[0];if(e.style[t]="7px","bottom"===t)switch(i){case"left":e.style.left="-3px",e.className+=" amo-brand--bl";break;case"right":e.style.bottom="-10px",e.style.right="-"+(n+3)+"px",e.className+=" amo-brand--br"}else if("top"===t)switch(i){case"left":e.style.top="-10px",e.style.left="-"+(n+3)+"px",e.className+=" amo-brand--tl";break;case"right":e.style.right="-3px",e.className+=" amo-brand--tr"}},B.prototype.insertForms=function(t){var e=document.createElement("script"),n=this.createFormWrapper();window.amo_forms_params=t||{},e.id="amoforms_script",e.src=this.forms_host,n.appendChild(e),this.addClicksListener()},B.prototype.setupContactForHuman=function(t){(t=AMO_PIXEL_CLIENT.canSetupContactForHuman(t))&&this.window.frames.social_iframe.postMessage({method:"setup_contact_for_human",payload:{contactId:t}},"*")},B.prototype.addClicksListener=function(){var e=this;S.add({target:window,eventName:"message",handler:function(t){e.onMessage(t)}})},B.prototype.onMessage=function(t){var e,n=this,i=t.data;try{i=JSON.parse(i)}catch(t){}switch(!0){case"click_button"===i:this.meta_params.inline?(n.livechat.hide(),document.querySelector(".amo-button--main").style.pointerEvents="none",this.window.frames.social_iframe.postMessage({method:"livechat:click"},"*")):document.getElementById("amobutton").click(),I("onChatHide"),this.soc_frame.elem.style.zIndex=this.getZIndexForElement("socialIFrame");break;case"livechat:show"===i:n.livechat.show(),this.meta_params.inline&&(e=document.querySelector(".amo-button--main"),this.setBorderColor(e,"white"===this.settings.button.theme?this.getButtonColor():"#FFF"),this.setBackgroundColor(e,this.settings.button.theme),e.querySelector(".amo-button--close-icon").style.display="block",e.style.pointerEvents=""),this.isMobileDevice()&&(this.soc_frame.elem.style.zIndex="");break;case"livechat:hide"===i:n.livechat.hide(),this.meta_params.inline&&(e=document.querySelector(".amo-button--main"),this.setBorderColor(e,"transparent"),this.setBackgroundColor(e,"transparent"),e.querySelector(".amo-button--close-icon").style.display="",e.style.pointerEvents="none");break;case"click_form"===i:n.showForm();break;case"pixel_ready"===i:n.initLivechat(),xn=!0,Mn.forEach(function(t){return Ln.apply(void 0,t)});break;case!("object"!=typeof i||!i.func||"buttonClick"!==i.func||!i.service):I("onButtonClick",i.service,i.link);break;case 1===this.getVersion()&&!("object"!=typeof i||!i.func||"resizeForm"!==i.func||!i.height):n.resizeFormFrame(i.height)}},B.prototype.resizeFormFrame=function(t){this.form_wrapper.style.height=t+"px",this.setFormPosition(t)},B.prototype.showForm=function(){var e=this,t="amo-form-wrapper_shown";this.form_wrapper.classList?this.form_wrapper.classList.add(t):this.form_wrapper.className+=" "+t,e.is_form_shown=!0,S.add({target:document,eventName:"click",handler:function(t){e.hideForm(t)}})},B.prototype.hideForm=function(){var t="amo-form-wrapper_shown";this.form_wrapper.classList?this.form_wrapper.classList.remove(t):this.form_wrapper.className=this.form_wrapper.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," "),this.is_form_shown&&(this.is_form_shown=!1)},B.prototype.getFormData=function(){var t,e=this.settings.social_services,n={};for(t in e)if("form"===e[t].type){n={id:e[t].id,hash:e[t].link,locale:this.locale,type:"gso"};break}return n},B.prototype.createFormWrapper=function(){var t=document.createElement("div"),e="306px",n="500px";return t.style.width=e,t.style.height=n,t.className="amo-form-wrapper",this.form_wrapper=t,this.button_holder.appendChild(t),t},B.prototype.setFormPosition=function(t){var e=this,n=e.settings.button.button_position.split("-");2===e.orientation?(e.form_wrapper.style[n[1]]=e.soc_frame.width+10+"px",e.form_wrapper.style[n[0]]=0):1===e.orientation&&(e.form_wrapper.style[n[0]]=e.soc_frame.height+10+"px",e.form_wrapper.style[n[1]]=0)},B.prototype.initModal=function(t){this.modal=new j({container:t.holder,brandName:this.settings.brandName,host:this.server_host})},B.prototype.initFormModal=function(t){this.form_modal=new ii({amoforms_url:this.forms_host,button_holder:t.holder})},B.prototype.initKeyActions=function(e){var n=this;void 0===e&&(e={}),this.keyactions=new M({keyactions:this.settings.keyactions,sendCRMReactions:function(t){return n.sendCRMReactions(t)},showForm:function(t,e){return n.form_modal.show({id:t,hash:e})},showGreeting:function(){n.livechat?n.livechat.showGreeting():n.greetingAwaited=!0},showAnimation:function(t){n.collapsed&&(n.hideAnimation(e.button),n.displayAnimation({animation:t,button:e.button}),setTimeout(function(){n.hideAnimation(e.button),n.displayAnimation({animation:n.getAnimation(),button:e.button})},2e3))}})},B.prototype.sendCRMReactions=function(t){this.socialFrameReady?this.window.frames.social_iframe.postMessage({method:"send_keyaction",payload:{keyaction_id:t}},"*"):this.keyactionsAwaited.push(t)},B.prototype.initLivechat=function(){var t,n=this,e=this;if(!this.livechat&&3===this.getVersion()){var i=document.getElementById("amobutton"),o={};for(t in this.settings.social_services){var r=this.settings.social_services[t];"livechat"===r.type&&(o=r)}this.livechat=new x({config:this.user_config.onlinechat||{},host:this.server_host,socket_url:o.link,session_uid:this.session_uid,session_id:this.session_id,container:i,enabled:o.id,account_name:o.account_name,position:this.makePositionParams(),orientation:2===parseInt(this.settings.button.orientation)?"vertical":"horizontal",button:{id:this.settings.button.id,hash:this.settings.button.hash,color:this.getButtonColor()},locale:this.lang_id,greeting:this.settings.greeting,greeting_bot_params:this.bot_params,has_keyactions:0<Object.keys(this.settings.keyactions).length,has_greeting_reaction:0<Object.keys(this.settings.keyactions).filter(function(e){return n.settings.keyactions[e].reactions&&0<Object.keys(n.settings.keyactions[e].reactions).filter(function(t){return"amobutton_greeting"===n.settings.keyactions[e].reactions[t].action}).length}).length,modal:this.modal,forceButtonCollapse:!this.meta_params.inline&&this.forceButtonCollapse,isButtonOpened:function(){return!e.collapsed},isInline:this.meta_params.inline,isCopyrightVisible:!1!==this.settings.is_copyright_visible,servicesCount:this.services_count,serviceSize:this.settings.button.size-10,brandName:this.settings.brandName,onIframeLoaded:function(){e.meta_params.inline&&1<this.services_count?i.click():i.style.opacity="1"}.bind(this)}),this.greetingAwaited&&this.livechat.showGreeting()}},B.prototype.destroy=function(){S.removeAll(),S.stop(),this.buttonHolderEl&&this.buttonHolderEl.remove(),this.livechat&&this.livechat.destroy();window.AMO_PIXEL_CLIENT&&window.AMO_PIXEL_CLIENT.destroy(),window.AMOPIXEL_IDENTIFIER&&window.AMOPIXEL_IDENTIFIER.destroy(),["amoSocialButton","crmPlugin","amo_social_button","crm_plugin","amoSocialButtonConfig","crmPluginConfig"].forEach(function(e){try{delete window[e]||(window[e]=void 0)}catch(t){window[e]=void 0}})},new B(window.amo_social_button||window.crm_plugin||{})}();
|