(window.webpackJsonp__wix_chat_widget=window.webpackJsonp__wix_chat_widget||[]).push([[44],{1084:function(t,e,n){"use strict";var i=n(1097);n.o(i,"parseLeanSchemaRef")&&n.d(e,"parseLeanSchemaRef",(function(){return i.parseLeanSchemaRef})),n.o(i,"resolveUrl")&&n.d(e,"resolveUrl",(function(){return i.resolveUrl})),n.o(i,"toURLSearchParams")&&n.d(e,"toURLSearchParams",(function(){return i.toURLSearchParams}));var r=n(1103);n.d(e,"resolveUrl",(function(){return r.a}));var s=n(1100);n.d(e,"toURLSearchParams",(function(){return s.a}));n(1101)},1097:function(t,e,n){"use strict";var i=n(1098);n.o(i,"parseLeanSchemaRef")&&n.d(e,"parseLeanSchemaRef",(function(){return i.parseLeanSchemaRef})),n.o(i,"resolveUrl")&&n.d(e,"resolveUrl",(function(){return i.resolveUrl})),n.o(i,"toURLSearchParams")&&n.d(e,"toURLSearchParams",(function(){return i.toURLSearchParams}));var r=n(1099);n.d(e,"parseLeanSchemaRef",(function(){return r.a}))},1098:function(t,e){},1099:function(t,e,n){"use strict";function i(t){void 0===t&&(t="");var e=r(t),n=e[0],i=e[1];return i?{schemaName:i,schemaType:n}:{schemaName:n}}n.d(e,"a",(function(){return i}));var r=function(t){return t.split("#")}},1100:function(t,e,n){"use strict";function i(t){var e=function t(e,n){void 0===n&&(n="");var i={};return Object.entries(e).forEach((function(e){var r=e[0],s=e[1],o="object"==typeof s&&!Array.isArray(s),u=function(t,e){return t+(t?".":"")+e}(n,r);if(o){var a=t(s,u);Object.assign(i,a)}else i[u]=s})),i}(t);return Object.entries(e).reduce((function(t,e){var n=e[0],i=e[1];return Array.isArray(i)?i.forEach((function(e){t.append(n,e)})):t.append(n,i),t}),new URLSearchParams)}n.d(e,"a",(function(){return i}))},1101:function(t,e,n){"use strict"},1103:function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var i=/{(.*)}/,r=new RegExp("\\.("+["wix.com","editorx.com"].join("|")+")$"),s=new RegExp("\\.("+["42.wixprod.net"].join("|")+")$");function o(t){var e,n,o=function(t,e){var n=e[t]||e._;return n}(t.host.replace(r,"._base_domain_").replace(s,"._api_base_domain_"),t.domainToMappings);return function(t,e){var n=null==e?void 0:e.find((function(e){return t.startsWith(e.destPath)}));if(!n)return t;return n.srcPath+t.slice(n.destPath.length)}((e=t.protoPath,n=t.data||{},e.split("/").map((function(t){return function(t,e){var n=(t.match(i)||[])[1];return n?function(t,e){return e.split(".").reduce((function(t,e){return t[e]}),t)}(e,n):t}(t,n)})).join("/")),o)}},1171:function(t,e){t.exports=i;var n=null;try{n=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}function i(t,e,n){this.low=0|t,this.high=0|e,this.unsigned=!!n}function r(t){return!0===(t&&t.__isLong__)}i.prototype.__isLong__,Object.defineProperty(i.prototype,"__isLong__",{value:!0}),i.isLong=r;var s={},o={};function u(t,e){var n,i,r;return e?(r=0<=(t>>>=0)&&t<256)&&(i=o[t])?i:(n=c(t,(0|t)<0?-1:0,!0),r&&(o[t]=n),n):(r=-128<=(t|=0)&&t<128)&&(i=s[t])?i:(n=c(t,t<0?-1:0,!1),r&&(s[t]=n),n)}function a(t,e){if(isNaN(t))return e?_:m;if(e){if(t<0)return _;if(t>=p)return O}else{if(t<=-v)return y;if(t+1>=v)return b}return t<0?a(-t,e).neg():c(t%d|0,t/d|0,e)}function c(t,e,n){return new i(t,e,n)}i.fromInt=u,i.fromNumber=a,i.fromBits=c;var h=Math.pow;function l(t,e,n){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return m;if("number"==typeof e?(n=e,e=!1):e=!!e,(n=n||10)<2||360)throw Error("interior hyphen");if(0===i)return l(t.substring(1),e,n).neg();for(var r=a(h(n,8)),s=m,o=0;o>>0:this.low},E.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},E.toString=function(t){if((t=t||10)<2||36>>0).toString(t);if((s=u).isZero())return c+o;for(;c.length<6;)c="0"+c;o=""+c+o}},E.getHighBits=function(){return this.high},E.getHighBitsUnsigned=function(){return this.high>>>0},E.getLowBits=function(){return this.low},E.getLowBitsUnsigned=function(){return this.low>>>0},E.getNumBitsAbs=function(){if(this.isNegative())return this.eq(y)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<=0},E.isOdd=function(){return 1==(1&this.low)},E.isEven=function(){return 0==(1&this.low)},E.equals=function(t){return r(t)||(t=f(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},E.eq=E.equals,E.notEquals=function(t){return!this.eq(t)},E.neq=E.notEquals,E.ne=E.notEquals,E.lessThan=function(t){return this.comp(t)<0},E.lt=E.lessThan,E.lessThanOrEqual=function(t){return this.comp(t)<=0},E.lte=E.lessThanOrEqual,E.le=E.lessThanOrEqual,E.greaterThan=function(t){return this.comp(t)>0},E.gt=E.greaterThan,E.greaterThanOrEqual=function(t){return this.comp(t)>=0},E.gte=E.greaterThanOrEqual,E.ge=E.greaterThanOrEqual,E.compare=function(t){if(r(t)||(t=f(t)),this.eq(t))return 0;var e=this.isNegative(),n=t.isNegative();return e&&!n?-1:!e&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},E.comp=E.compare,E.negate=function(){return!this.unsigned&&this.eq(y)?y:this.not().add(I)},E.neg=E.negate,E.add=function(t){r(t)||(t=f(t));var e=this.high>>>16,n=65535&this.high,i=this.low>>>16,s=65535&this.low,o=t.high>>>16,u=65535&t.high,a=t.low>>>16,h=0,l=0,d=0,p=0;return d+=(p+=s+(65535&t.low))>>>16,l+=(d+=i+a)>>>16,h+=(l+=n+u)>>>16,h+=e+o,c((d&=65535)<<16|(p&=65535),(h&=65535)<<16|(l&=65535),this.unsigned)},E.subtract=function(t){return r(t)||(t=f(t)),this.add(t.neg())},E.sub=E.subtract,E.multiply=function(t){if(this.isZero())return m;if(r(t)||(t=f(t)),n)return c(n.mul(this.low,this.high,t.low,t.high),n.get_high(),this.unsigned);if(t.isZero())return m;if(this.eq(y))return t.isOdd()?y:m;if(t.eq(y))return this.isOdd()?y:m;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(g)&&t.lt(g))return a(this.toNumber()*t.toNumber(),this.unsigned);var e=this.high>>>16,i=65535&this.high,s=this.low>>>16,o=65535&this.low,u=t.high>>>16,h=65535&t.high,l=t.low>>>16,d=65535&t.low,p=0,v=0,_=0,I=0;return _+=(I+=o*d)>>>16,v+=(_+=s*d)>>>16,_&=65535,v+=(_+=o*l)>>>16,p+=(v+=i*d)>>>16,v&=65535,p+=(v+=s*l)>>>16,v&=65535,p+=(v+=o*h)>>>16,p+=e*d+i*l+s*h+o*u,c((_&=65535)<<16|(I&=65535),(p&=65535)<<16|(v&=65535),this.unsigned)},E.mul=E.multiply,E.divide=function(t){if(r(t)||(t=f(t)),t.isZero())throw Error("division by zero");var e,i,s;if(n)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?c((this.unsigned?n.div_u:n.div_s)(this.low,this.high,t.low,t.high),n.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?_:m;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return _;if(t.gt(this.shru(1)))return S;s=_}else{if(this.eq(y))return t.eq(I)||t.eq(w)?y:t.eq(y)?I:(e=this.shr(1).div(t).shl(1)).eq(m)?t.isNegative()?I:w:(i=this.sub(t.mul(e)),s=e.add(i.div(t)));if(t.eq(y))return this.unsigned?_:m;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();s=m}for(i=this;i.gte(t);){e=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var o=Math.ceil(Math.log(e)/Math.LN2),u=o<=48?1:h(2,o-48),l=a(e),d=l.mul(t);d.isNegative()||d.gt(i);)d=(l=a(e-=u,this.unsigned)).mul(t);l.isZero()&&(l=I),s=s.add(l),i=i.sub(d)}return s},E.div=E.divide,E.modulo=function(t){return r(t)||(t=f(t)),n?c((this.unsigned?n.rem_u:n.rem_s)(this.low,this.high,t.low,t.high),n.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},E.mod=E.modulo,E.rem=E.modulo,E.not=function(){return c(~this.low,~this.high,this.unsigned)},E.and=function(t){return r(t)||(t=f(t)),c(this.low&t.low,this.high&t.high,this.unsigned)},E.or=function(t){return r(t)||(t=f(t)),c(this.low|t.low,this.high|t.high,this.unsigned)},E.xor=function(t){return r(t)||(t=f(t)),c(this.low^t.low,this.high^t.high,this.unsigned)},E.shiftLeft=function(t){return r(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?c(this.low<>>32-t,this.unsigned):c(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):c(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},E.shr=E.shiftRight,E.shiftRightUnsigned=function(t){if(r(t)&&(t=t.toInt()),0===(t&=63))return this;var e=this.high;return t<32?c(this.low>>>t|e<<32-t,e>>>t,this.unsigned):c(32===t?e:e>>>t-32,0,this.unsigned)},E.shru=E.shiftRightUnsigned,E.shr_u=E.shiftRightUnsigned,E.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},E.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},E.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},E.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},E.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},i.fromBytes=function(t,e,n){return n?i.fromBytesLE(t,e):i.fromBytesBE(t,e)},i.fromBytesLE=function(t,e){return new i(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},i.fromBytesBE=function(t,e){return new i(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)}},1192:function(t,e,n){"use strict";n.r(e),n.d(e,"Scope",(function(){return o})),n.d(e,"Status",(function(){return s})),n.d(e,"ActivityStatus",(function(){return u})),n.d(e,"DeviceType",(function(){return j}));var i=n(1);function r(t,e){if(!t)throw new a(e)}var s,o,u,a=function(t){function e(n){var i=t.call(this,n)||this;return Object.setPrototypeOf(i,e.prototype),i}return Object(i.__extends)(e,t),e}(Error),c=function(){function t(t){var e=this;this.opts=t,this.state={active:!1,running:!1},this.onIdle=function(){e.state.active=!1,e.opts.onIdle()},this.onAliveness=function(){e.state.active||e.opts.onActive(),e.state.active=!0,e.removeEventListeners(),e.clearTimeouts(),e.scheduleSample()},r("number"==typeof t.isIdleTime&&t.isIdleTime>=6e4,"isIdleTime must be a number, bigger than 1 min"),r("function"==typeof t.onIdle,"onIdle must be a function"),r("function"==typeof t.onActive,"onActive must be a function")}return t.prototype.listen=function(){this.state.running||(this.state.running=!0,this.state.active=!0,this.scheduleSample())},t.prototype.stop=function(){this.state.running=!1,this.clearTimeouts(),this.removeEventListeners()},t.prototype.scheduleSample=function(){var t=this;this.sampleTimeout=setTimeout((function(){t.sample()}),3e4)},t.prototype.sample=function(){this.addEventListeners(),this.idleTimeout=setTimeout(this.onIdle,this.opts.isIdleTime)},t.prototype.addEventListeners=function(){document.addEventListener("mousemove",this.onAliveness),document.addEventListener("keydown",this.onAliveness)},t.prototype.removeEventListeners=function(){document.removeEventListener("mousemove",this.onAliveness),document.removeEventListener("keydown",this.onAliveness)},t.prototype.clearTimeouts=function(){clearTimeout(this.idleTimeout),clearTimeout(this.sampleTimeout)},t}();function h(t){return new c(t)}function l(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}function f(t){return JSON.parse(JSON.stringify(t))}!function(t){t.ONLINE="ONLINE",t.OFFLINE="OFFLINE"}(s||(s={})),function(t){t.EDITOR_X="editor-x",t.VIEWER="viewer"}(o||(o={})),function(t){t[t.ACTIVE=0]="ACTIVE",t[t.IDLE=1]="IDLE"}(u||(u={}));var d,p;!function(t){t[t.INIT=0]="INIT",t[t.SUBSCRIBED=1]="SUBSCRIBED"}(d||(d={})),function(t){t[t.NONE=0]="NONE",t[t.STATE=1]="STATE",t[t.ACTIVITY=2]="ACTIVITY"}(p||(p={}));var v,g,m=function(){function t(t){var e,n,r=this,s=t.getPresenceConnection,o=t.scope,u=t.getSignedInstance,a=t.initialState,c=void 0===a?{}:a,f=t.keepAliveInterval,v=void 0===f?24e4:f,g=t.isIdleMs,m=t.onIdle,_=t.onActive;this.onStateChangeFn=function(){},this.sessionId=l(),this.trackState=d.INIT,this.lastInactivity=null,this.list=[],this.onDisconnectFn=function(){},this.shuoldWatchGroup=!0,this.onIdle=function(){r.lastInactivity=Date.now()-r.isIdleMs,r.refreshState(),r.onIdleFn()},this.onActive=function(){r.lastInactivity=null,r.refreshState(),r.onActiveFn()},this.watchGroup=function(){return Object(i.__awaiter)(r,void 0,void 0,(function(){var t=this;return Object(i.__generator)(this,(function(e){switch(e.label){case 0:return this.shuoldWatchGroup?[4,this.presenceClient()]:[3,2];case 1:e.sent().watch({scope:this.scope}).catch((function(){})),e.label=2;case 2:return this.watchGroupTimer&&clearTimeout(this.watchGroupTimer),this.watchGroupTimer=setTimeout((function(){return t.watchGroup()}),6e5),[2]}}))}))},this.onSubscribe=function(){return Object(i.__awaiter)(r,void 0,void 0,(function(){var t=this;return Object(i.__generator)(this,(function(e){switch(e.label){case 0:return this.list=[],this.trackState=d.INIT,this.initBatchTimer&&clearTimeout(this.initBatchTimer),this.watchGroup(),[4,this.keepAlive()];case 1:return e.sent(),this.idle.listen(),this.initBatchTimer=setTimeout((function(){t.trackState=d.SUBSCRIBED,t.onStateChange()}),2e3),[2]}}))}))},this.handleStateChanges=function(t){t.data=t.data||{};var e=r.updateList(t);r.trackState===d.SUBSCRIBED&&e===p.STATE&&r.onStateChange(t)},this.getPresenceConnection=s,this.getSignedInstance=u,this.keepAliveInterval=v,this.scope=o,this.storeState(c),this.isIdleMs=null!==(n=null!==(e=window.__PRESENCE_IDLE_TIME)&&void 0!==e?e:g)&&void 0!==n?n:6e5,this.onIdleFn=null!=m?m:function(){},this.onActiveFn=null!=_?_:function(){},this.idle=h({isIdleTime:this.isIdleMs,onIdle:this.onIdle,onActive:this.onActive})}return t.prototype.initPresenceApi=function(){return Object(i.__awaiter)(this,void 0,void 0,(function(){var t;return Object(i.__generator)(this,(function(e){switch(e.label){case 0:return this.presenceApi?[3,2]:[4,n.e(45).then(n.t.bind(null,1190,7))];case 1:t=e.sent().PresenceService,this.presenceApi=t("/_api/presence-service",{ignoredProtoHttpUrlPart:"/api"}).PresenceService(),e.label=2;case 2:return[2]}}))}))},t.prototype.track=function(t,e){var n;this.onStateChangeFn=t,this.shuoldWatchGroup=null!==(n=null==e?void 0:e.watchGroup)&&void 0!==n?n:this.shuoldWatchGroup,this.connection=this.getPresenceConnection();var i={presenceSessionId:this.sessionId,watchGroup:null==e?void 0:e.watchGroup};return this.connection.on("@duplexer:disconnected",this.onDisconnectFn),this.connection.subscribe(this.scope,{info:i}).on("@duplexer:subscription_succeeded",this.onSubscribe).on("update-state",this.handleStateChanges)},t.prototype.disconnect=function(){this.connection&&(this.connection.disconnect(),this.connection=void 0)},t.prototype.onDisconnect=function(t){this.onDisconnectFn=t},t.prototype.setState=function(t){return Object(i.__awaiter)(this,void 0,void 0,(function(){return Object(i.__generator)(this,(function(e){switch(e.label){case 0:return this.storeState(t),this.connection?[4,this.presenceClient()]:[3,3];case 1:return[4,e.sent().setData({sessionId:this.sessionId,scope:this.scope,data:this.state})];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},t.prototype.getSessionId=function(){return this.sessionId},t.prototype.emptyGroup=function(){return Object(i.__awaiter)(this,void 0,void 0,(function(){return Object(i.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.presenceClient()];case 1:return[4,t.sent().resetScope({scope:this.scope})];case 2:return t.sent(),[2]}}))}))},t.prototype.storeState=function(t){this.state=Object(i.__assign)(Object(i.__assign)({},t),{__lastInactivity:this.lastInactivity})},t.prototype.refreshState=function(){return this.setState(this.state)},t.prototype.keepAlive=function(){return Object(i.__awaiter)(this,void 0,void 0,(function(){var t=this;return Object(i.__generator)(this,(function(e){switch(e.label){case 0:return this.connection?[4,this.refreshState().catch((function(){}))]:(clearTimeout(this.keepAliveTimer),[2]);case 1:return e.sent(),this.keepAliveTimer&&clearTimeout(this.keepAliveTimer),this.keepAliveTimer=setTimeout((function(){return t.keepAlive()}),this.keepAliveInterval),[2]}}))}))},t.prototype.onStateChange=function(t){this.onStateChangeFn(f(this.list),t?f(t):void 0)},t.prototype.updateList=function(t){var e,n,i=this.list.find((function(e){return e.userId===t.userId&&e.sessionId===t.sessionId}));return t.activity=function(t){return"number"==typeof t.data.__lastInactivity?{status:u.IDLE,lastSeen:t.data.__lastInactivity}:{status:u.ACTIVE,lastSeen:null}}(t),i&&(e=i,n=t,JSON.stringify(e)===JSON.stringify(n))?p.NONE:(i&&(this.list=this.list.filter((function(t){return t!==i}))),t.status===s.ONLINE&&this.list.push(t),p.STATE)},t.prototype.presenceClient=function(){return Object(i.__awaiter)(this,void 0,void 0,(function(){return Object(i.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.initPresenceApi()];case 1:return t.sent(),[2,this.presenceApi({Authorization:this.getSignedInstance()})]}}))}))},t}(),_=n(1084);function I(t,e,n){return void 0===e&&(e={}),function(i,r){return void 0===i&&(i={}),"string"==typeof i?i:s(t,i);function s(t,e){var n={};return Object.entries(e).forEach((function(e){var i,r,s,a,c=e[0],h=e[1],l=t[c],f=Object(_.parseLeanSchemaRef)(l),d=f.schemaName,p="Map"===f.schemaType;a=(null!==(s=null===(r=null===(i=u(d))||void 0===i?void 0:i.checkRepetable)||void 0===r?void 0:r.call(i,h))&&void 0!==s?s:Array.isArray(h))?h.map((function(t){return o(t,d)})):p?function(t,e){return Object.entries(t).reduce((function(t,n){var i=n[0],r=n[1];return t[i]=o(r,e),t}),{})}(h,d):o(h,d),n[c]=a})),n}function o(t,n){if(!n)return t;var i=e[n];if(u(n))return u(n).transfrom(t);if(i)return s(i,t);throw new Error(n+" is neither schema nor serializable type")}function u(t){var e;return null===(e=n[t])||void 0===e?void 0:e[r]}}}!function(t){t[t.TO_JSON=0]="TO_JSON",t[t.FROM_JSON=1]="FROM_JSON"}(v||(v={}));var S,w,b,O,y=((g={types:["google.protobuf.Timestamp"]})[v.TO_JSON]={transfrom:function(t){return t.toISOString()}},g[v.FROM_JSON]={transfrom:function(t){return new Date(t)}},g),E=((S={types:["google.protobuf.FieldMask"]})[v.TO_JSON]={transfrom:function(t){return t.join(",")},checkRepetable:function(t){return t.some((function(t){return Array.isArray(t)}))}},S[v.FROM_JSON]={transfrom:function(t){return"object"==typeof t?t.paths:t.split(",")}},S),N=((w={types:["google.protobuf.BytesValue","BYTES"]})[v.TO_JSON]={transfrom:function(t){var e=t.reduce((function(t,e){return t+String.fromCharCode(e)}),"");return btoa(e)}},w[v.FROM_JSON]={transfrom:function(t){return Uint8Array.from(atob(t),(function(t){return t.charCodeAt(0)}))}},w),T=n(1171),A=n.n(T);function L(t){var e=0;if(void 0!==t){var n=3-t.length/3;e=parseInt(t,10)*Math.pow(1e3,n)}return e}var R=[y,E,N,((b={types:["google.protobuf.Duration"]})[v.TO_JSON]={transfrom:function(t){var e=t.seconds,n=void 0===e?0:e,i=t.nanos,r=void 0===i?0:i,s="";return 0!==r&&(s="."+r.toString().padStart(9,"0")),""+n+s+"s"}},b[v.FROM_JSON]={transfrom:function(t){var e=t.substring(0,t.length-1).split("."),n=e[0],i=e[1];return{seconds:A.a.fromString(n),nanos:L(i)}}},b),((O={types:["FLOAT","DOUBLE","google.protobuf.FloatValue","google.protobuf.DoubleValue"]})[v.TO_JSON]={transfrom:function(t){return isFinite(t)?t:t.toString()}},O[v.FROM_JSON]={transfrom:function(t){return"NaN"===t?NaN:"Infinity"===t?1/0:"-Infinity"===t?-1/0:t}},O)];var x=Object(i.__spreadArrays)(R).reduce((function(t,e){var n=e.types.reduce((function(t,n){var r;return Object(i.__assign)(Object(i.__assign)({},t),((r={})[n]=e,r))}),{});return Object(i.__assign)(Object(i.__assign)({},t),n)}),{});function C(t,e){void 0===e&&(e={});var n=I(t,e,x);return{fromJSON:function(t){var e=function(t){try{return JSON.parse(t)}catch(t){}}(t)||t;return n(e,v.FROM_JSON)},toJSON:function(t){return n(t,v.TO_JSON)}}}var P,j,k,D={sessionStartDate:"google.protobuf.Timestamp",lastActiveDate:"google.protobuf.Timestamp"},U={payload:"_payload"},F={presence:"_presence"},M={},B={mask:"google.protobuf.FieldMask",presence:"_presence"},q={};function J(t){return Object(_.resolveUrl)(Object.assign(t,{domainToMappings:{"www._base_domain_":[{srcPath:"/_api/chat-presence-server",destPath:"/api"}],"api._api_base_domain_":[{srcPath:"/presence-server",destPath:""}],"engage.wixapps.net":[{srcPath:"/_api/chat-presence-server",destPath:"/api"}],"manage._base_domain_":[{srcPath:"/_api/chat-presence-server",destPath:"/api"}],_:[{srcPath:"/_api/chat-presence-server",destPath:"/api"}]}}))}function V(t){return function(e){var n=e.host,i=C(F,{_payload:D,_presence:U}).toJSON,r=C(M,{}).fromJSON,s=i(t);return{method:"POST",url:J({protoPath:"/api/v2/presences/{presence.scope}",data:s,host:n}),data:s,transformResponse:r}}}!function(t){t.UNKNOWN="UNKNOWN",t.ACTIVE="ACTIVE",t.OFFLINE="OFFLINE"}(P||(P={})),function(t){t.UNKNOWN="UNKNOWN",t.DESKTOP="DESKTOP",t.MOBILE="MOBILE"}(j||(j={})),function(t){t.UNDEFINED="UNDEFINED",t.VIEWER="VIEWER",t.EDITOR_X="EDITOR_X"}(k||(k={}));var G=function(){function t(t){var e,n,r=this,s=t.getPresenceConnection,o=t.scope,u=t.httpClient,a=t.initialState,c=void 0===a?{}:a,f=t.keepAliveInterval,d=void 0===f?24e4:f,p=t.isIdleMs,v=t.onIdle,g=t.onActive;this.sessionId=l(),this.onDisconnectFn=function(){},this.shouldWatchGroup=!0,this.onIdle=function(){r.updatePresence({}),r.onIdleFn()},this.onActive=function(){var t=r.preparePayload(),e=t.payload,n=t.mask;n.push("status"),r.updateState({mask:n,presence:{scope:r.scope,sessionId:r.sessionId,status:P.ACTIVE,payload:e}}),r.onActiveFn()},this.onSubscribe=function(){return Object(i.__awaiter)(r,void 0,void 0,(function(){return Object(i.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.keepAlive()];case 1:return t.sent(),this.idle.listen(),[2]}}))}))},this.getPresenceConnection=s,this.keepAliveInterval=d,this.scope=this.convertScope(o),this.isIdleMs=null!==(n=null!==(e=window.__PRESENCE_IDLE_TIME)&&void 0!==e?e:p)&&void 0!==n?n:6e5,this.onIdleFn=null!=v?v:function(){},this.onActiveFn=null!=g?g:function(){},this.initialState=c,this.idle=h({isIdleTime:this.isIdleMs,onIdle:this.onIdle,onActive:this.onActive}),this.httpClient=u}return t.prototype.track=function(t){var e;this.shouldWatchGroup=null!==(e=null==t?void 0:t.watchGroup)&&void 0!==e?e:this.shouldWatchGroup,this.connection=this.getPresenceConnection(),this.createState(this.initialState);var n={presenceSessionId:this.sessionId,watchGroup:null==t?void 0:t.watchGroup};return this.connection.on("@duplexer:disconnected",this.onDisconnectFn),this.connection.subscribe(this.getConnectionScope(this.scope),{info:n}).on("@duplexer:subscription_succeeded",this.onSubscribe)},t.prototype.disconnect=function(){this.connection&&(this.connection.disconnect(),this.connection=void 0)},t.prototype.onDisconnect=function(t){this.onDisconnectFn=t},t.prototype.createState=function(t){return Object(i.__awaiter)(this,void 0,void 0,(function(){var e;return Object(i.__generator)(this,(function(n){switch(n.label){case 0:return e={payload:t,scope:this.scope,sessionId:this.sessionId,status:P.ACTIVE},[4,this.httpClient.request(V({presence:e}))];case 1:return n.sent(),[2]}}))}))},t.prototype.updateState=function(t){return Object(i.__awaiter)(this,void 0,void 0,(function(){return Object(i.__generator)(this,(function(e){switch(e.label){case 0:return this.connection?[4,this.httpClient.request((n=t,function(t){var e=t.host,i=C(B,{_payload:D,_presence:U}).toJSON,r=C(q,{}).fromJSON,s=i(n);return{method:"PATCH",url:J({protoPath:"/api/v2/presences/{presence.scope}",data:s,host:e}),data:s,transformResponse:r}}))]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}var n}))}))},t.prototype.preparePayload=function(t){void 0===t&&(t={});var e=Object(i.__assign)({lastActiveDate:new Date},t);return{payload:e,mask:Object.keys(e).map((function(t){return"payload."+t}))}},t.prototype.updatePresence=function(t,e){return void 0===e&&(e=[]),Object(i.__awaiter)(this,void 0,void 0,(function(){var n,r,s,o;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return n=this.preparePayload(t),r=n.payload,s=n.mask,o=Array.from(new Set(s.concat(e))),[4,this.updateState({mask:o,presence:{payload:r,scope:this.scope,sessionId:this.sessionId,status:P.ACTIVE}})];case 1:return i.sent(),[2]}}))}))},t.prototype.getSessionId=function(){return this.sessionId},t.prototype.refreshState=function(){return this.updatePresence({})},t.prototype.keepAlive=function(){return Object(i.__awaiter)(this,void 0,void 0,(function(){var t=this;return Object(i.__generator)(this,(function(e){switch(e.label){case 0:return this.connection?[4,this.refreshState().catch((function(){}))]:(clearTimeout(this.keepAliveTimer),[2]);case 1:return e.sent(),this.keepAliveTimer&&clearTimeout(this.keepAliveTimer),this.keepAliveTimer=setTimeout((function(){return t.keepAlive()}),this.keepAliveInterval),[2]}}))}))},t.prototype.getConnectionScope=function(t){switch(t){case k.VIEWER:return o.VIEWER;case k.EDITOR_X:return o.EDITOR_X;default:return""}},t.prototype.convertScope=function(t){switch(t){case o.EDITOR_X:return k.EDITOR_X;case o.VIEWER:return k.VIEWER;default:return k.UNDEFINED}},t}(),W=function(){function t(t){var e=t.duplexer,n=t.getSignedInstance,i=t.httpClient;this.duplexer=e,this.getSignedInstance=null!=n?n:function(){return""},this.httpClient=i}return t.prototype.group=function(t,e){var n=this;!function(t){if(!Object.values(o).includes(t))throw new Error("scope "+t+" is invalid!")}(t);return new m({getPresenceConnection:function(){return n.getConnection()},scope:t,getSignedInstance:this.getSignedInstance,initialState:null==e?void 0:e.initialState,keepAliveInterval:null==e?void 0:e.keepAliveInterval,onIdle:null==e?void 0:e.onIdle,onActive:null==e?void 0:e.onActive,isIdleMs:null==e?void 0:e.isIdleMs})},t.prototype.groupV2=function(t,e){var n=this;if(!this.httpClient)throw new Error("Cannot init presence GroupV2 without HttpClient instance");return new G({getPresenceConnection:function(){return n.getConnection()},scope:t,httpClient:this.httpClient,initialState:null==e?void 0:e.initialState,keepAliveInterval:null==e?void 0:e.keepAliveInterval,onIdle:null==e?void 0:e.onIdle,onActive:null==e?void 0:e.onActive,isIdleMs:null==e?void 0:e.isIdleMs})},t.prototype.getConnection=function(){return this.duplexer.connect({appDefId:"401c08e7-b43e-4323-99f9-1f9f8138ff88"})},t}();e.default=W}}]); //# sourceMappingURL=44.chunk.min.js.map