/*!
 * Webcom. Build realtime apps. Share and sync data instantly between your clients
 *
 * Module name: Webcom
 * Version:     3.2.0
 * Created:     2022-07-28T09:14:35.591Z
 *
 * Copyright (C) <2015-2022> Orange
 *
 * This software is confidential and proprietary information of Orange.
 * You shall not disclose such Confidential Information and shall use it only in
 * accordance with the terms of the agreement you entered into.
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 *
 * If you are Orange employee you shall use this software in accordance with
 * the Orange Source Charter (http://opensource.itn.ftgroup/index.php/Orange_Source_Charter)
 */(()=>{var t={228:t=>{t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},t.exports.__esModule=!0,t.exports.default=t.exports},858:t=>{t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},646:(t,e,n)=>{var r=n(228);t.exports=function(t){if(Array.isArray(t))return r(t)},t.exports.__esModule=!0,t.exports.default=t.exports},575:t=>{t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},100:(t,e,n)=>{var r=n(489),o=n(67);function i(e,n,s){return o()?(t.exports=i=Reflect.construct,t.exports.__esModule=!0,t.exports.default=t.exports):(t.exports=i=function(t,e,n){var o=[null];o.push.apply(o,e);var i=new(Function.bind.apply(t,o));return n&&r(i,n.prototype),i},t.exports.__esModule=!0,t.exports.default=t.exports),i.apply(null,arguments)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},913:t=>{function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},67:t=>{t.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}},t.exports.__esModule=!0,t.exports.default=t.exports},860:t=>{t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports},884:t=>{t.exports=function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],s=!0,u=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);s=!0);}catch(t){u=!0,o=t}finally{try{s||null==n.return||n.return()}finally{if(u)throw o}}return i}},t.exports.__esModule=!0,t.exports.default=t.exports},521:t=>{t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},206:t=>{t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},489:t=>{function e(n,r){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n,r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},38:(t,e,n)=>{var r=n(858),o=n(884),i=n(379),s=n(521);t.exports=function(t,e){return r(t)||o(t,e)||i(t,e)||s()},t.exports.__esModule=!0,t.exports.default=t.exports},319:(t,e,n)=>{var r=n(646),o=n(860),i=n(379),s=n(206);t.exports=function(t){return r(t)||o(t)||i(t)||s()},t.exports.__esModule=!0,t.exports.default=t.exports},8:t=>{function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},379:(t,e,n)=>{var r=n(228);t.exports=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},722:(t,e,n)=>{"use strict";n.d(e,{Yk:()=>E,hu:()=>D,ZP:()=>U});var r=n(319),o=n.n(r),i=n(575),s=n.n(i),u=n(913),a=n.n(u),c=n(24),h=n(28),l=n(303),f="console",d=h.sZ.console,p=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var i=function(t){return(0,l.Kn)(t)?JSON.stringify(t):(t||"undefined").toString()};if((0,l.HD)(t)){var s=0;return[t=t.replace(/%(.)/g,(function(t,e){switch(e){case"%":return"%";case"s":case"o":case"O":return i(n[s++]);case"d":case"i":case"f":return n[s++];default:return t}}))].concat(o()(n.slice(s).map(i))).join(" ")}return[t].concat(n).map(i).join(" ")};function v(t,e,n,r,o){if(!n||!r||!o){var i=e,s=function(t){return function(e){return i("[".concat(t,"] ").concat(e))}};n=n||s("INFO"),r=r||s("WARN"),o=o||s("ERR!"),e=s("LOG ")}return{log:function(){return e.call(t,p.apply(void 0,arguments))},info:function(){return n.call(t,p.apply(void 0,arguments))},warn:function(){return r.call(t,p.apply(void 0,arguments))},error:function(){return o.call(t,p.apply(void 0,arguments))}}}if((0,l.mf)(d))d=v(c.Z,d);else if((0,l.Kn)(d)&&d){var g=d,y=g.log,_=g.info,m=g.warn,b=g.error;d=v(d,y,_,m,b)}else{var k=function(t,e,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];(0,l.HD)(n)?(n="[".concat(t,"] ")+n,e.apply(void 0,[n].concat(o))):e.apply(void 0,["[".concat(t,"] "),n].concat(o))};d={log:k.bind(void 0,"LOG ",c.Z.console.log),info:k.bind(void 0,"INFO",c.Z.console.info),warn:k.bind(void 0,"WARN",c.Z.console.warn),error:k.bind(void 0,"ERR!",c.Z.console.error)}}(0,h.x$)(f,(function(){return d}),(function(t){return d=t}));var x=n(41),w=n(455),S={};function R(t,e){var n=t.length;return n>=e?t.substring(0,e):t+E.substring(0,e-n)}function A(t){return t.map((function(t){return(0,l.mf)(t)?t():t}))}var O=function(){function t(e,n,r,o){s()(this,t),this._name=e,this._prefix=n,this._count=void 0===S[e]?S[e]=0:++S[e],this.displayTimestamp=r,this.setPrefixWidth(o||8),this._log=this._emitLog.bind(this,d.log),this._info=this._emitLog.bind(this,d.info),this._warn=this._emitLog.bind(this,d.warn),this._error=this._emitLog.bind(this,d.error),this._enabled=!0}return a()(t,[{key:"name",get:function(){return this._name}},{key:"_emitLog",value:function(t,e){var n=this.displayTimestamp?[(new Date).toISOString()]:[];n.push(this._displayedPrefix);for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];(0,l.HD)(e)?(n.push(e),e=n.join(" "),t.apply(void 0,[e].concat(o()(A(i))))):t.apply(void 0,n.concat(o()(A([e].concat(i)))))}},{key:"setPrefixWidth",value:function(t){this._displayedPrefix="".concat(R(this._prefix,t)," #").concat(R(this._count.toString(),3))}},{key:"setLevel",value:function(t){this._enabled=t>=0,this.log=t>=U.LOG?this._log:w.ZT,this.info=t>=U.INFO?this._info:w.ZT,this.warn=t>=U.WARN?this._warn:w.ZT,this.error=t>=U.ERROR?this._error:w.ZT}},{key:"updateLevel",value:function(t){this._enabled&&this.setLevel(t)}}]),t}(),T=-1,E="                                                  ",P=!1,I=15,N=[],C=[""];function j(t,e,n){t.name.substring(0,e.length)===e&&t.setLevel(n)}function Z(t){P=t,N.forEach((function(t){return t.displayTimestamp=P}))}function H(t,e){for(var n={index:-1,subsumed:!1},r=!!e,o=0;o<C.length;++o){var i=C[o];if(t===i){if(n.index=o,!r||n.subsumed)break}else if(!n.subsumed)if(t.substring(0,i.length)===i){if(n.subsumed=!0,r&&e.splice(0,e.length),n.index>-1)break}else r&&i.substring(0,t.length)===t&&e.push(i)}return n}var F="LogManager",U=function(){function t(){s()(this,t)}return a()(t,null,[{key:"enable",value:function(t){(0,x.T2)([F,".enable"],arguments,x.Z_),1===C.length&&""===C[0]&&(C.splice(0,1),N.forEach((function(t){return j(t,"",T)})));var e=H(t),n=e.index,r=e.subsumed;n<0&&(C.push(t),r||N.forEach((function(e){return j(e,t,L)})))}},{key:"disable",value:function(t){(0,x.T2)([F,".disable"],arguments,x.Z_);var e=[],n=H(t,e),r=n.index,o=n.subsumed;r>=0&&(C.splice(r,1),o||N.forEach((function(n){for(var r=!0,o=0;o<e.length;++o){var i=e[o];if(n.name.substring(0,i.length)===i){r=!1;break}}r&&j(n,t,T)})))}},{key:"showTimestamp",value:function(){(0,x.T2)([F,".showTimestamp"],arguments),Z(!0)}},{key:"hideTimestamp",value:function(){(0,x.T2)([F,".hideTimestamp"],arguments),Z(!1)}},{key:"setPrefixWidth",value:function(t){(0,x.T2)([F,".setPrefixWidth"],arguments,x.Rx),t<0?t=0:t>E.length&&(t=E.length),I=t,N.forEach((function(t){return t.setPrefixWidth(I)}))}},{key:"level",get:function(){return L},set:function(t){(0,x.T2)([F,".level"],arguments,x.Rx),t>T&&t!==L&&(N.forEach((function(e){return e.updateLevel(t)})),L=t)}},{key:"LOG",get:function(){return 4}},{key:"INFO",get:function(){return 3}},{key:"WARN",get:function(){return 2}},{key:"ERROR",get:function(){return 1}},{key:"NONE",get:function(){return 0}},{key:"debugOnCallback",value:function(t){var e=t&&t.toUpperCase();return function(t,n){return d.log("********** UPDATE ".concat(e||t.ref().pathString()," **********"),t.toString(),n?"[<<".concat(n,"]"):"")}}},{key:"debugOnCompletionCallback",value:function(t,e){var n=t&&t.toUpperCase();return function(t){return t?d.log("********** REVOKED ".concat(n," **********"),t):d.log("********** COMPLETED ".concat(n," **********")),e}}},{key:"debugOnCallbackWithCancel",value:function(e){var n=e&&e.toUpperCase();return[t.debugOnCallback(e),function(t){return d.log.apply(d,["********** COMPLETE ".concat(n," **********")].concat(o()(t?["FAILED:",t.code,t.message]:["cancelled"])))}]}}]),t}();function D(t,e){var n=new O(t,e||t,P,I);return N.push(n),n.setLevel(L),n}var L=U.INFO},466:(t,e,n)=>{"use strict";n.d(e,{DV:()=>h,RY:()=>l});n(24);var r=n(28),o="browser",i="mobile/",s="node",u="".concat(i,"android"),a="".concat(i,"iOS"),c={browser:"b"};c[u]="a",c[a]="i",c.node="n";var h,l=!0,f="device",d=r.sZ.device;d||p(s);function p(t){d=t,l=t===o,0===t.indexOf(i),h=(c[t]||"")+"3.2.0"}(0,r.x$)(f,(function(){return d}),(function(t){return p(t)}))},28:(t,e,n)=>{"use strict";n.d(e,{HO:()=>o,sZ:()=>r,x$:()=>i});var r=n(24).Z.WebcomDependencies||{},o={};function i(t,e,n){Object.defineProperty(o,t,{enumerable:!0,get:e,set:n})}},618:(t,e,n)=>{"use strict";n.d(e,{Zi:()=>h,cv:()=>f,iK:()=>s});var r=n(24),o=n(28),i="setTimeout",s=o.sZ.setTimeout;s||(s=r.Z.setTimeout),(0,o.x$)(i,(function(){return s}),(function(t){return s=t})),r.Z.setTimeout||(r.Z.setTimeout=s),r.Z.setImmediate||(r.Z.setImmediate=s);var u="clearTimeout",a=o.sZ.clearTimeout;a||(a=r.Z.clearTimeout),(0,o.x$)(u,(function(){return a}),(function(t){return a=t})),r.Z.clearTimeout||(r.Z.clearTimeout=a),r.Z.clearImmediate||(r.Z.clearImmediate=a);var c="setInterval",h=o.sZ.setInterval;h||(h=r.Z.setInterval),(0,o.x$)(c,(function(){return h}),(function(t){return h=t}));var l="clearInterval",f=o.sZ.clearInterval;f||(f=r.Z.clearInterval),(0,o.x$)(l,(function(){return f}),(function(t){return f=t}))},286:(t,e,n)=>{"use strict";n.d(e,{h:()=>S});var r=n(38),o=n.n(r),i=n(575),s=n.n(i),u=n(913),a=n.n(u),c=n(28),h="env",l=c.sZ.env;l||(l=process.env),(0,c.x$)(h,(function(){return l}),(function(t){return l=t}));var f,d,p,v,g=(0,n(722).hu)("network","nodeProxy");function y(t){try{return new URL(t)}catch(t){return null}}!function(){if(f=y(l.http_proxy||l.HTTP_PROXY),d=y(l.https_proxy||l.HTTPS_PROXY),p=l.no_proxy||l.NO_PROXY,g.log("Node.js proxy layer set to: http_proxy='".concat(f,"'; https_proxy='").concat(d,"'; no_proxy=").concat(p)),p){var t=p.split(",");v=t.indexOf("*")<0?function(e){return t.every((function(t){return!e.origin.endsWith(t)}))}:function(){return!1}}else v=function(){return!0}}();const _=require("http");var m=n.n(_);const b=require("https");var k=n.n(b),x=n(303),w=n(41),S=function(){function t(){s()(this,t),this.readyState=0,this._headers={},this.status=0}return a()(t,[{key:"open",value:function(t,e){this._method=t,this._href=e}},{key:"setRequestHeader",value:function(t,e){this._headers[t]=e}},{key:"send",value:function(t){(0,x.mf)(this.onreadystatechange)||(0,w._y)("NodeXmlHttpRequest","missing onreadystatechange event handler"),t&&(this._headers["Content-Length"]=t.length,t=Buffer.from(t)),A.call(this,t)}},{key:"getAllResponseHeaders",value:function(){return Object.entries(this._headers).reduce((function(t,e){var n=o()(e,2),r=n[0],i=n[1];return"".concat(t,"\n").concat(r," :").concat(i)}),"")}}],[{key:"DONE",get:function(){return 4}}]),t}();function R(t){this.responseText=t.message,this._headers={},this.readyState=4,this.onreadystatechange()}function A(t){var e=this,n=function(t){var e=new URL(t);switch(e.protocol){case"http:":case"ws:":return f&&v(e)?{url:e,secure:!1,proxy:f}:{url:e,secure:!1};case"https:":case"wss:":return d&&v(e)?{url:e,secure:!0,proxy:d}:{url:e,secure:!0};default:return{url:e,secure:!1}}}(this._href),r=n.url,o=n.secure,i=n.proxy;if(i)if(o){var s=r.hostname+":443",u=m().request({protocol:i.protocol,hostname:i.hostname,port:i.port,method:"CONNECT",path:s});u.on("connect",(function(n,o){if(200===n.statusCode){var i=k().request({host:r.host,path:r.pathname+r.search+r.hash,method:e._method,agent:new(k().Agent)({socket:o})});O.call(e,i,t)}else R.call(e,new Error("Status ".concat(n.statusCode)))})),u.on("error",R.bind(this)),u.setHeader("Host",s),u.end()}else{var a=m().request({protocol:i.protocol,hostname:i.hostname,port:i.port,method:this._method,path:r.href});a.setHeader("Host",r.host),O.call(this,a,t)}else{var c=(o?k():m()).request({protocol:r.protocol,hostname:r.hostname,port:r.port,method:this._method,path:r.pathname+r.search+r.hash});c.setHeader("Host",r.host),O.call(this,c,t)}}function O(t,e){var n=this;Object.entries(this._headers).forEach((function(e){var n=o()(e,2),r=n[0],i=n[1];return t.setHeader(r,i)})),e&&t.write(e),t.on("error",R.bind(this)),t.on("response",(function(t){var r=[];t.on("data",(function(t){return r.push(t)})),t.on("error",R.bind(n)),t.on("end",(function(){n.status=t.statusCode,[301,302,303,307,308].indexOf(n.status)&&t.headers.location?A.call(n,e):(n.readyState=4,n.responseText=Buffer.concat(r).toString("utf8"),n._headers=t.headers,n.onreadystatechange())}))})),t.end()}},455:(t,e,n)=>{"use strict";n.d(e,{ZT:()=>r});n(618);var r=Function.prototype},24:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});var r=function(){if("undefined"!=typeof globalThis)return globalThis;return global}()},303:(t,e,n)=>{"use strict";n.d(e,{HD:()=>u,Kn:()=>h,hj:()=>a,jn:()=>s,lk:()=>l,mf:()=>c});var r=n(8),o=n.n(r),i=n(466);function s(t){return"boolean"==typeof t}function u(t){return"string"==typeof t}function a(t){return"number"==typeof t}function c(t){return"function"==typeof t}function h(t){return"object"===o()(t)}function l(){return i.RY&&(window.navigator.userAgent.match(/CriOS|Twitter for iPhone|FBAN\/FBIOS|Windows Phone/)||window.navigator.standalone)}},41:(t,e,n)=>{"use strict";n.d(e,{Hk:()=>A,O4:()=>a,O7:()=>x,Q3:()=>p,Rx:()=>w,Ry:()=>S,T2:()=>d,Yl:()=>k,Z_:()=>b,__:()=>y,_y:()=>f,hu:()=>c,jt:()=>v,l4:()=>_,vA:()=>g,wB:()=>T,wE:()=>R});var r=n(8),o=n.n(r),i=n(319),s=n.n(i),u=n(303),a="Webcom internal error";function c(t,e){t||f(a,e)}var h={values:[]};function l(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];Object.assign(h,{method:t,args:e||[],checkers:r})}var f=function(t,e){var n;throw new Error("".concat((n="").concat.apply(n,s()(t)),": ").concat(e))};function d(t,e){if(!h.method){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];l.apply(void 0,[t,e].concat(r))}var i=h.method,s=h.args,u=h.checkers,a=h.values;Object.assign(h,{method:void 0,args:void 0,checkers:void 0,values:[]}),s.length>u.length&&f(i,"too many arguments, ".concat(s.length," instead of ").concat(u.length)),u.forEach((function(t,e){return p(t,s[e],i,(function(t){return"argument #".concat(e+1," ").concat(t)}))})),a.forEach((function(t){var e=t.name,n=t.value;return p(t.checker,n,i,(function(t){return"".concat(e," ").concat(t)}))}))}function p(t,e,n,r){var o=t(e);o&&f(n,r(o))}function v(t){return function(e){return m("undefined")(e)&&t&&t(e)}}function g(t){return function(e){return null===e?"must not be null":t&&t(e)}}var y=function(t){return void 0===t?"is missing":""};function _(t){return function(e){return!(e instanceof t)&&"must be an instance of ".concat(t.name)}}function m(t){return function(e){return o()(e)!==t&&"must be a ".concat(t)}}var b=m("string"),k=m("function"),x=m("boolean"),w=m("number"),S=m("object");function R(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(t){return e.every((function(e){return e(t)}))&&"either ".concat(e.map((function(e){return e(t)})).join(" or "))}}function A(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(t){var n;return e.some((function(e){return n=e(t)}))&&n}}function O(t,e){return function(n){return!t(n)&&(e||"is not valid")}}O((function(t){return(0,u.hj)(t)&&Math.floor(t)===t}),"must be an integer");function T(t,e){return O((function(e){return t.test(e)}),e)}},113:t=>{"use strict";t.exports=require("crypto")},147:t=>{"use strict";t.exports=require("fs")}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,n),i.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var r={};(()=>{"use strict";n.d(r,{default:()=>et});var t=n(24),e=n(575),o=n.n(e),i=n(913),s=n.n(i),u=n(38),a=n.n(u),c=n(41),h=n(722),l=n(303),f="WebcomApp",d=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o()(this,t),this._logger=(0,h.hu)("api.WebcomApp",f),this._logger.log("Initializing ".concat(e," with options ").concat(n)),this._services={},this.appId=e,this.config={},(0,l.HD)(n)&&(n=Object.keys(v).reduce((function(t,e){return t[e]={baseUrl:n},t}),{})),this._fillConfig(n)}return s()(t,[{key:"dispose",value:function(){(0,c.T2)([f,"#dispose"],arguments),Object.values(this._services).forEach((function(t){return t._dispose()})),this._services={}}},{key:"_fillConfig",value:function(t){p.call(this,t,v)}},{key:"toString",value:function(){return"".concat(this.appId,"{").concat(Object.keys(this._services).join(","),"}")}}]),t}();function p(t,e){var n=this;!function t(e,r,o,i){Object.entries(o).forEach((function(o){var s=a()(o,2),u=s[0],h=s[1];if(h instanceof Object&&!(h instanceof Array))e[u]=e[u]||{},t(e[u],r[u]||{},h,i.concat(u));else{var l=r[u],d=h[1]||function(t){return t};try{e[u]=d(void 0===l?void 0===e[u]?h.length?h[0]:h:e[u]:l)}catch(t){var p="".concat(f,".Configuration.").concat(i.concat(u).join("."));void 0===t.value?(0,c._y)(p,t.message):(n._logger.warn("%s: %s",p,t.message),e[u]=t.value)}}}))}(this.config,t,e,[])}var v={},g=n(28),y=n(8),_=n.n(y);function m(t,e){if(0===t.length||0===e.length)return t.concat(e);var n=t[t.length-1],r=x(n);return 32===r?t.concat(e):w(e,r,0|n,t.slice(0,t.length-1))}function b(t){var e=t.length;return 0===e?0:32*(e-1)+x(t[e-1])}function k(t,e,n){return 32===t?e:(n?0|e:e<<32-t)+1099511627776*t}function x(t){return Math.round(t/1099511627776)||32}function w(t,e,n,r){var o,i;for(void 0===r&&(r=[]);e>=32;e-=32)r.push(n),n=0;if(0===e)return r.concat(t);for(o=0;o<t.length;o++)r.push(n|t[o]>>>e),n=t[o]<<32-e;return i=x(t.length?t[t.length-1]:0),r.push(k(e+i&31,e+i>32?n:r.pop(),1)),r}(function(){function t(e){o()(this,t),this.message=e}s()(t,[{key:"toString",value:function(){return"CORRUPT: "+this.message}}])})(),function(){function t(e){o()(this,t),this.message=e}s()(t,[{key:"toString",value:function(){return"INVALID: "+this.message}}])}(),function(){function t(e){o()(this,t),this.message=e}s()(t,[{key:"toString",value:function(){return"BUG: "+this.message}}])}(),function(){function t(e){o()(this,t),this.message=e}s()(t,[{key:"toString",value:function(){return"NOT READY: "+this.message}}])}();var S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var R=[1732584193,4023233417,2562383102,271733878,3285377520],A=[1518500249,1859775393,2400959708,3395469782],O=function(){function t(e){o()(this,t),e?(this._h=e._h.slice(0),this._buffer=e._buffer.slice(0),this._length=e._length):this.reset()}return s()(t,[{key:"reset",value:function(){return this._h=R.slice(0),this._buffer=[],this._length=0,this}},{key:"update",value:function(t){"string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));var e,n=[],r=0;for(e=0;e<t.length;e++)r=r<<8|t.charCodeAt(e),3==(3&e)&&(n.push(r),r=0);return 3&e&&n.push(k(8*(3&e),r)),n}(t));var e,n=this._buffer=m(this._buffer,t),r=this._length,o=this._length=r+b(t);for(e=512+r&-512;e<=o;e+=512)this._block(n.splice(0,16));return this}},{key:"finalize",value:function(){var t,e=this._buffer,n=this._h;for(t=(e=m(e,[k(1,1)])).length+2;15&t;t++)e.push(0);for(e.push(Math.floor(this._length/4294967296)),e.push(0|this._length);e.length;)this._block(e.splice(0,16));return this.reset(),n}},{key:"_f",value:function(t,e,n,r){return t<=19?e&n|~e&r:t<=39?e^n^r:t<=59?e&n|e&r|n&r:t<=79?e^n^r:void 0}},{key:"_S",value:function(t,e){return e<<t|e>>>32-t}},{key:"_block",value:function(t){var e,n,r,o,i,s,u,a=t.slice(0),c=this._h;for(r=c[0],o=c[1],i=c[2],s=c[3],u=c[4],e=0;e<=79;e++)e>=16&&(a[e]=this._S(1,a[e-3]^a[e-8]^a[e-14]^a[e-16])),n=this._S(5,r)+this._f(e,o,i,s)+u+a[e]+A[Math.floor(e/20)]|0,u=s,s=i,i=this._S(30,o),o=r,r=n;c[0]=c[0]+r|0,c[1]=c[1]+o|0,c[2]=c[2]+i|0,c[3]=c[3]+s|0,c[4]=c[4]+u|0}}],[{key:"hash",value:function(e){return(new t).update(e).finalize()}}]),t}();function T(t){return decodeURIComponent(t.replace(/\+/g," "))}function E(){var t=2147483648;return Math.floor(Math.random()*t).toString(36)+Math.abs(Math.floor(Math.random()*t)^Date.now()).toString(36)}function P(t){var e={};return t.replace(/^[^?]*\?/,"").split("&").forEach((function(t){var n=t.indexOf("=");if(n<0)e[T(t)]=!0;else{var r=T(t.substring(0,n));e[r]=T(t.substring(n+1))}})),e}function I(t){if(!t)return"";var e=[];return Object.entries(t).forEach((function(t){var n=a()(t,2),r=n[0],o=n[1];null!=o&&((0,l.Kn)(o)&&(o=JSON.stringify(o)),e.push(encodeURIComponent(r)+"="+encodeURIComponent(o)))})),e.join("&")}function N(t,e){var n=(t.indexOf("?")<0?"?":"&")+I(e),r=t.indexOf("#");return r<0?t+n:t.substring(0,r)+n+t.substring(r)}function C(t,e){return function(t,e,n){var r,o="",i=0,s=S,u=0,a=b(t);for(n&&(s=s.substr(0,62)+"-_"),r=0;6*o.length<a;)o+=s.charAt((u^t[r]>>>i)>>>26),i<6?(u=t[r]<<6-i,i+=26,r++):(u<<=6,i-=6);for(;3&o.length&&!e;)o+="=";return o}(O.hash(t),!1,e)}function j(t){return t!=t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY}var Z=n(319),H=n.n(Z),F=/^(?:#|\.hash\.)(.+)$/,U=function(){function t(e,n){switch(o()(this,t),arguments.length){case 0:this.isRoot_=!0,this.pieces_=[],this.pieceNum_=0;break;case 1:(0,l.jn)(e)?(this.isRoot_=e,this.pieces_=[]):(this.isRoot_=!0,this.pieces_=e.split("/").filter((function(t){return t.length>0}))),this.pieceNum_=0;break;default:this.isRoot_=!0,this.pieces_=e,this.pieceNum_=n}}return s()(t,[{key:"getFront",value:function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]}},{key:"popFront",value:function(){var e=this.pieceNum_;return e<this.pieces_.length&&e++,new t(this.pieces_,e)}},{key:"getBack",value:function(){return this.pieceNum_<this.pieces_.length?this.pieces_[this.pieces_.length-1]:null}},{key:"toString",value:function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)this.pieces_[e]&&(t+="/"+this.pieces_[e]);return t||"/"}},{key:"parent",value:function(){if(this.pieceNum_>=this.pieces_.length)return null;for(var e=[],n=this.pieceNum_;n<this.pieces_.length-1;n++)e.push(this.pieces_[n]);return new t(e,0)}},{key:"child",value:function(e){var n=this,r=function(t,e){return(0,c.Q3)(e,t,"Invalid path",(function(e){return"".concat(t," ").concat(e)}))},o=this.pieces_.slice(this.pieceNum_);return e instanceof t?o.push.apply(o,H()(e.pieces_.slice(e.pieceNum_))):(r(e,c.Z_),e.split("/").forEach((function(e){switch(e){case"":case".":break;case"..":o.pop();break;case t.InfoKey:if(n.isRoot_&&0===o.length){o.push(e);break}default:var i=F.exec(e);if(i){var s=i[1];r(s,z);var u=C(s,!0);o.push(".list."+u.substring(0,2)),o.push(u.substring(2,4)),o.push(u.substring(4,6)),o.push(s)}else r(e,z),o.push(e)}}))),new t(o,0)}},{key:"isEmpty",value:function(){return this.pieceNum_>=this.pieces_.length}},{key:"length",value:function(){return this.pieces_.length-this.pieceNum_}},{key:"contains",value:function(t){if(this.length()>t.length())return!1;for(var e=this.pieceNum_,n=t.pieceNum_;e<this.pieces_.length;){if(this.pieces_[e]!==t.pieces_[n])return!1;++e,++n}return!0}}],[{key:"RelativePath",value:function(e,n){var r=e.getFront(),o=n.getFront();return null===r?n:r===o?t.RelativePath(e.popFront(),n.popFront()):void(0,c._y)(c.O4,"innerPath (".concat(n,") is not within outerPath (").concat(e,")"))}},{key:"Empty",get:function(){return D}},{key:"Info",get:function(){return L}},{key:"InfoKey",get:function(){return".info"}}]),t}(),D=new U,L=new U(U.InfoKey),M="child_added",W="child_removed",K="child_changed",q="child_ack",J="value",Y="value_ack",V=(function(){function t(e,n,r){var i=r.childName,s=r.prevChildName,u=r.acknowledged;o()(this,t),this.type=e,this.snapshotNode=n,this.childName=i,this.prevName=s,this.acknowledged=u}s()(t,null,[{key:"Value",value:function(e,n){return new t(n?Y:J,e,{acknowledged:e.acknowledged()})}},{key:"ChildChanged",value:function(e,n,r,o){return new t(o?q:K,e,{childName:n,prevChildName:r,acknowledged:e.acknowledged()})}},{key:"ChildRemoved",value:function(e,n,r){return e.isEmpty()?new t(q,e,{childName:n,acknowledged:r}):new t(W,e,{childName:n,acknowledged:r})}},{key:"ChildAdded",value:function(e,n,r){return new t(M,e,{childName:n,prevChildName:r,acknowledged:e.acknowledged()})}}])}(),10485760),$="(?:".concat(["list","item"].map((function(t){return"\\.".concat(t,"\\.")})).join("|"),")?").concat("[^.$\\[\\]#/\\u0000-\\u001f\\u007f]","+"),G=new RegExp("^".concat($,"$"));function B(t,e){if(e.length>1e3)return"contains a cyclic object value (".concat(e.slice(0,100).join("."),"...)");switch(_()(t)){case"undefined":return"contains undefined".concat(Q(e));case"function":return"contains a function".concat(Q(e));case"number":return j(t)?"contains ".concat(t).concat(Q(e)):"";case"string":return t.length>V/3&&function(t){for(var e,n,r=[],o=0,i=0;i<t.length;i++)(e=t.charCodeAt(i))>=55296&&e<=56319&&(n=e-55296,i++,(0,c.hu)(i<t.length,"Surrogate pair missing trail surrogate."),e=65536+(n<<10)+(t.charCodeAt(i)-56320)),e<128?r[o++]=e:e<2048?(r[o++]=e>>6|192,r[o++]=63&e|128):e<65536?(r[o++]=e>>12|224,r[o++]=e>>6&63|128,r[o++]=63&e|128):(r[o++]=e>>18|240,r[o++]=e>>12&63|128,r[o++]=e>>6&63|128,r[o++]=63&e|128);return r}(t).length>V?"contains a string greater than ".concat(V," utf8 bytes").concat(Q(e)," ('").concat(t.substring(0,50),"...')"):"";case"object":if(t){var n="";return Object.entries(t).some((function(t){var r=a()(t,2),o=r[0],i=r[1];return n=".sv"!==o&&!G.test(o)&&"contains an invalid key (".concat(o,")").concat(Q(e))||B(i,e.concat(o))})),n}default:return""}}function Q(t){return t.length?" in property '".concat(t.join("."),"'"):""}(0,c.Hk)((0,c.vA)(c.Ry),(function(t){return B(t,[])}));var z=(0,c.wB)(G,"must be a valid key (non-empty, with no '.', '#', '$', '/', '[' nor ']')"),X=(0,c.Hk)(c.Z_,z),tt="Webcom",et=function(){function t(){o()(this,t),this._init.apply(this,arguments)}return s()(t,[{key:"_init",value:function(){(0,c._y)(["new ",tt],"this static class cannot be instantiated")}}],[{key:"SDK_VERSION",get:function(){return"3.2.0"}},{key:"Log",get:function(){return h.ZP}},{key:"App",value:function(t,e){return(0,c.T2)([tt,".App"],arguments,X,(0,c.jt)((0,c.wE)(c.Ry,c.Z_))),new d(t,e)}},{key:"dependencies",get:function(){return g.HO}}]),t}(),nt=n(466);function rt(t){"http:"===t.protocol&&nt.RY&&"https:"===window.location.protocol&&this._logger.warn("Insecure access to a Webcom service from a secure page. Please setup your service with an https protocol.")}var ot=new RegExp("^(?:([^:]+:)//)?(?:[^/@]+@)?([^/:]+(?::\\d+)?)(?:/.*)?$"),it="io.datasync.orange.com";function st(t,e){return function(n){var r=t(n);if(r)throw new Error(r);return e?e(n):n}}function ut(t,e,n,r){return at(t,e,{value:n},r)}function at(t,e,n,r){return Object.defineProperty(t,e,Object.assign(n,{enumerable:r,configurable:!0}))}var ct="some",ht="required",lt="none",ft=function(){function t(e,n){o()(this,t),(0,c.hu)(e===ct||e===ht||e===lt,"Wrong state value for a new State object: expecting 'some', 'required' or 'none'."),this.state=e,(0,c.hu)(e!==ct||n&&n.webcomAuthToken,"Missing details or webcomAuthToken for a new 'some' State"),this.details=n}return s()(t,[{key:"isUnauthenticated",value:function(){return this.state===lt}},{key:"isAuthenticated",value:function(){return this.state===ct}},{key:"isRequired",value:function(){return this.state===ht}},{key:"isSameAs",value:function(t){return this.state===t.state&&(this.state!==ct||this.details.webcomAuthToken===t.details.webcomAuthToken)}}]),t}(),dt=new ft(lt),pt=(new ft(ht),function(t){return new ft(ct,t)});var vt,gt,yt,_t,mt="Authentication";v.Authentication={from:[void 0,st((0,c.jt)((0,c.l4)(d)))],baseUrl:[null,function(e){if(e&&(t.Z.URL&&e instanceof URL||e.href&&e.protocol&&e.host))return e;var n=e?ot.exec(e):[it,void 0,it];if(n){var r=a()(n,3),o=r[0],i=r[1],s=r[2];return i||(o="".concat(i="https:","//").concat(o)),{href:o,protocol:i,host:s}}throw new Error("cannot parse base URL: ".concat(e))}],storage:[void 0,st((0,c.jt)((0,c.wE)(c.Z_,c.Yl)))],initialState:[void 0,function(t){return t&&JSON.parse(t)}]},gt="authentication",yt=function(){var t=this._services.Authentication;if(!t){var e=this.config.Authentication.from;t=e?e.authentication:vt(this),this._services.Authentication=t}return t},function(t,e,n,r){at(t,e,{get:n},r)}(d.prototype,gt,yt,_t);var bt=n(618);function kt(t){var e=t.code||"UNKNOWN_ERROR",n=t.message||JSON.stringify(t),r=new Error("".concat("Authentication",": ").concat(e,"[").concat(n,"]"));return r.code=e,r}var xt=function(){function t(){o()(this,t),this.cache_={}}return s()(t,[{key:"length",get:function(){return Object.keys(this.cache_).length}},{key:"key",value:function(t){var e=Object.keys(this.cache_);return 0<=t&&t<e.length?e[t]:null}},{key:"getItem",value:function(t){return this.cache_.hasOwnProperty(t)?this.cache_[t]:null}},{key:"setItem",value:function(t,e){this.cache_[t]=e}},{key:"removeItem",value:function(t){delete this.cache_[t]}},{key:"clear",value:function(){this.cache_={}}}]),t}(),wt="localStorage",St=g.sZ.localStorage;St||(St=t.Z.localStorage||new xt),(0,g.x$)(wt,(function(){return St}),(function(t){return St=t}));var Rt="sessionStorage",At=g.sZ.sessionStorage;function Ot(t){return"webcom:"+t}At||(At=t.Z.sessionStorage||null),(0,g.x$)(Rt,(function(){return At}),(function(t){return At=t}));var Tt=s()((function t(e,n){if(o()(this,t),e){var r=Ot("sentinel");e.setItem(r,""),e.removeItem(r),this.set=function(t,n){null===n?e.removeItem(Ot(t)):e.setItem(Ot(t),JSON.stringify(n))},this.get=function(t){var n=e.getItem(Ot(t));return n&&JSON.parse(n)},this.remove=function(t){e.removeItem(Ot(t))}}else this.set=this.get=this.remove=function(){(0,c._y)("JSONStorage","the ".concat(n," implementation could not be found!"))}})),Et=new Tt(St,"localStorage"),Pt=new Tt(At,"sessionStorage"),It=n(100),Nt=n.n(It);var Ct="XMLHttpRequest",jt=g.sZ.XMLHttpRequest;jt||(jt=n(286).h),(0,g.x$)(Ct,(function(){return jt}),(function(t){return jt=t}));var Zt=(0,h.hu)("network.HttpRequest","HttpRequest"),Ht="application/x-www-form-urlencoded",Ft="application/json",Ut="Content-Type",Dt="PUT",Lt="PATCH",Mt="POST",Wt="DELETE",Kt="GET",qt=s()((function t(e,n){o()(this,t),this.name=e,this.value=n})),Jt="HttpRequest",Yt=function(){function t(e){o()(this,t);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];this.url=N(r.filter((function(t){return t&&t.length})).join("/"),{c:nt.DV}),this.method=e.toUpperCase(),this.headers={Accept:"application/json;text/plain"}}return s()(t,[{key:"addQueryParameters",value:function(t){return this.url=N(this.url,t),this}},{key:"addJson",value:function(t){return this.contentType=Ft,this.data=t,this}},{key:"addForm",value:function(t){return this.contentType=Ht,this.data=t,this}},{key:"addHeader",value:function(t){return(0,c.T2)([Jt,"#addHeader"],arguments,(0,c.l4)(qt)),this.headers[t.name]=t.value,this}},{key:"readResponseHeaders",value:function(){return this.readHeaders=!0,this}},{key:"send",value:function(){var t=this;return new Promise((function(e,n){Zt.log("==> ".concat(t.method," ").concat(t.url)),Object.keys(t.headers).forEach((function(e){return Zt.log("  > HEADER ".concat(e,": ").concat(t.headers[e]))})),t.data&&Zt.log("  > DATA: ".concat(JSON.stringify(t.data)));var r=null;void 0!==t.data&&[Mt,Dt,Lt].indexOf(t.method)>=0&&((r=t.contentType===Ht?I(t.data):t.contentType===Ft?JSON.stringify(t.data):t.data)?t.headers[Ut]=t.contentType:delete t.headers[Ut]),Vt.call(t,r,e,(function(t){Zt.log("<== ERROR: ".concat(JSON.stringify(t))),n(kt(t))}))}))}}]),t}();function Vt(t,e,n){var r=this,o=new jt;o.onreadystatechange=function(){if(4===o.readyState)try{var t=o.responseText,i=o.status,s=t.length?JSON.parse(t):{};if(i>=400&&i<500)n(s.error||s);else if(i>=200&&i<300||304===i||1223===i){var u={body:s},a=u.body.error||null;a?n((0,l.Kn)(a)?a:{code:u.body.status,message:a}):(r.readHeaders&&(u.headers=function(t){return function(){var e=t.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};return e.forEach((function(t){var e=t.indexOf(": "),r=t.substring(0,e).toLowerCase();n[r]=t.substring(e+2)})),n}}(o)),Zt.log("<== ".concat(JSON.stringify(u))),e(u))}else n({code:"RESPONSE_PAYLOAD_ERROR",message:"HTTP status ".concat(i)})}catch(t){n({code:"RESPONSE_PAYLOAD_ERROR",message:t.toString()})}},o.open(this.method,this.url,!0),Object.entries(this.headers).forEach((function(t){var e=a()(t,2),n=e[0],r=e[1];return o.setRequestHeader(n,r)})),o.send(t)}function $t(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Nt()(Yt,[Kt].concat(e))}function Gt(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Nt()(Yt,[Dt].concat(e))}function Bt(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Nt()(Yt,[Mt].concat(e))}function Qt(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Nt()(Yt,[Wt].concat(e))}function zt(t){return new qt("Authorization","Bearer ".concat(t))}ut(et,"avatarURL",(function(t){switch((0,c.T2)([tt,".avatarURL"],arguments,c.Ry),t&&t.provider){case"facebook":return"https://graph.facebook.com/".concat(t.providerUid,"/picture?type=large");case"github":return t.providerProfile.avatar_url;case"gitlab":case"google":return t.providerProfile.picture}}));var Xt=n(455),te={code:"USER_DENIED",message:"The user aborted authentication"},ee={facebook:{height:650,width:680},google:{height:460,width:490},github:{height:760,width:340},gitlab:{height:710,width:800},orange:{height:700,width:1e3},mobileconnectOFR:{height:540,width:700}},ne={menubar:0,location:0,resizable:0,scrollbars:1,status:0,dialog:1,width:700,height:375},re={};function oe(t,e,n){return(0,l.HD)(t.storage)?t.storage:"auth:".concat(e,":").concat(n)}function ie(t,e,n){(0,bt.iK)((function(){return t(e,n)}))}var se=function(){function t(e){o()(this,t),this._logger=(0,h.hu)("api.Authentication",mt),this._logger.log("Initializing with options ".concat(JSON.stringify(e.config.Authentication))),this._app=e,this._init(e)}return s()(t,[{key:"_init",value:function(t){var e=t.config.Authentication;rt.call(this,e.baseUrl);var n,r,o,i=(r=t,o=e.baseUrl,(n="/".concat(o.protocol.slice(0,-1),"/").concat(o.host,"/").concat(r.appId,"/"))+(re[n]=(re[n]||0)+1));this._currentState=function(t){try{return new ft(t.state,t.details)}catch(t){return dt}}(function(t,e){return t.initialState||((0,l.mf)(t.storage)?{}:Et.get(oe(t,"state",e)))}(e,i)),this._authStateSetter=function(t,e){if((0,l.mf)(t.storage))return function(e){return t.storage(JSON.stringify(e))};var n=oe(t,"state",e);return function(t){return t&&!t.isUnauthenticated()?Et.set(n,t):Et.remove(n)}}(e,i),this._oauthSessionKey=oe({},"ongoing",i),this.isAuthContextual=!1,this._firstSubscriptions=[],this._lastSubscriptions=[],this._authRoute="".concat(e.baseUrl.href,"/auth/v2/").concat(t.appId),this._resumeAuthState(),this._logger.log("Initialized for appId %s",t.appId)}},{key:"_dispose",value:function(){}},{key:"currentState",get:function(){return this._currentState},set:function(t){this._currentState.isSameAs(t)||(this._currentState=function(t){if(t.isAuthenticated()){var e=Object.assign({},t.details);return delete e.extra,pt(e)}return t}(t),this._authStateSetter(this._currentState),this._notifyErrorOrAuthStateChanged(null,t))}},{key:"_resumeAuthState",value:function(){var t=this;if(nt.RY){if(Et.get(this._oauthSessionKey))return document.body.style.display="none",void Et.set(this._oauthSessionKey,P(location.search).__wcsession);var e=Pt.get(this._oauthSessionKey);if(e){var n=P(location.search);return void this.resumeSession(n.__wcsession,e).finally((function(){return Pt.remove(t._oauthSessionKey)})).catch(Xt.ZT)}}this._logger.info("Authentication state resumed: %s",this.currentState.state),this._logger.log("Authentication details are: %o",this.currentState.details)}},{key:"subscribe",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return(0,c.T2)([mt,"#subscribe"],arguments,c.Yl,(0,c.jt)(c.O7)),e?this._firstSubscriptions.push(t):this._lastSubscriptions.unshift(t),ie(t,null,this.currentState),t}},{key:"unsubscribe",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;(0,c.T2)([mt,"#unsubscribe"],arguments,(0,c.jt)(c.Yl),(0,c.jt)(c.O7));var n=this._firstSubscriptions.length+this._lastSubscriptions.length,r=function(e){return t&&t!==e};return!1!==e&&(this._firstSubscriptions=this._firstSubscriptions.filter(r)),!0!==e&&(this._lastSubscriptions=this._lastSubscriptions.filter(r)),n-this._firstSubscriptions.length-this._lastSubscriptions.length}},{key:"_notifyErrorOrAuthStateChanged",value:function(t,e){this._firstSubscriptions.forEach((function(n){return ie(n,t,e)})),this._lastSubscriptions.forEach((function(n){return ie(n,t,e)}))}},{key:"authenticationRevoked",value:function(t,e){(0,c.T2)([mt,"#authenticationRevoked"],arguments,(0,c.l4)(ft),c.Z_);var n=new Error("Authentication was revoked by the server: ".concat(e));n.code="AUTH_REVOKED",this._notifyErrorOrAuthStateChanged(n,null),this.currentState=t}},{key:"resumeSession",value:function(t,e){return(0,c.T2)("AuthenticationImpl#resumeSession",arguments,c.Z_,c.Z_),this._logger.info("fetching authentication state from an ongoing OAuth2 session..."),Bt(this._authRoute,"session").addJson({sessionKey:t,requestKey:e}).send().then(this._updateStateFromHttpResponse(),this._notifyErrorFromHttpResponse.bind(this))}},{key:"_extendHttpRequest",value:function(t){var e=this,n=t;return n.addAuthContext=function(){var n=e._contextAuthToken();return n?t.addHeader(zt(n)):t},n}},{key:"_httpGet",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this._extendHttpRequest($t.apply(void 0,[this._authRoute].concat(e)))}},{key:"_httpPost",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this._extendHttpRequest(Bt.apply(void 0,[this._authRoute].concat(e)))}},{key:"_httpPut",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this._extendHttpRequest(Gt.apply(void 0,[this._authRoute].concat(e)))}},{key:"_httpDelete",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this._extendHttpRequest(Qt.apply(void 0,[this._authRoute].concat(e)))}},{key:"_updateStateFromHttpResponse",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t};return function(n){var r=e(n).body,o=r.token,i=r.user;if(o)return i.webcomAuthToken=o,t.currentState=pt(i),new Promise((function(t){return(0,bt.iK)((function(){return t(i)}))}));throw kt({code:"UNEXPECTED_RESPONSE",message:"the 'token' property is missing."})}}},{key:"_notifyErrorFromHttpResponse",value:function(t){throw this._notifyErrorOrAuthStateChanged(t,null),t}},{key:"useCurrentContextForNextAuthOperation",value:function(){(0,c.T2)([mt,"#useCurrentContextForNextAuthOperation"],arguments),this.isAuthContextual=!0}},{key:"useNewContextForNextAuthOperation",value:function(){(0,c.T2)([mt,"#useNewContextForNextAuthOperation"],arguments),this.isAuthContextual=!1}},{key:"_contextAuthToken",value:function(){var t=this.isAuthContextual?this.currentState.details:null;return this.isAuthContextual=!1,t&&t.webcomAuthToken}},{key:"signInWithToken",value:function(t){return(0,c.T2)([mt,"#signInWithToken"],arguments,c.Z_),this._httpGet("decode").addHeader(zt(t)).send().then(this._updateStateFromHttpResponse((function(e){var n=e.body;return{body:{token:t,user:n.data}}})),this._notifyErrorFromHttpResponse.bind(this))}},{key:"signInAsGuest",value:function(){return(0,c.T2)([mt,"#signInAsGuest"],arguments),this._httpPost("anonymous","signin").addAuthContext().send().then(this._updateStateFromHttpResponse(),this._notifyErrorFromHttpResponse.bind(this))}},{key:"signInWithCredentials",value:function(t,e){return(0,c.T2)([mt,"#signInWithCredentials"],arguments,c.Z_,c.Ry),this._httpPost(t,"signin").addAuthContext().addJson(e).send().then(this._updateStateFromHttpResponse(),this._notifyErrorFromHttpResponse.bind(this))}},{key:"sendOtp",value:function(t,e,n){return(0,c.T2)([mt,"#sendOtp"],arguments,c.Z_,c.Z_,(0,c.jt)(c.Ry)),this._httpPost(t,"otps").addQueryParameters(n).addJson(e).send().then((function(t){return t.body}))}},{key:"signInWithCustomProvider",value:function(t,e){return(0,c.T2)([mt,"#signInWithCustomProvider"],arguments,c.Z_,c.Z_),this._httpPost("custom.".concat(t),"signin").addAuthContext().addForm({token:e}).send().then(this._updateStateFromHttpResponse(),this._notifyErrorFromHttpResponse.bind(this))}},{key:"signInWithOAuth",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,c.T2)([mt,"#signInWithOAuth"],arguments,c.Z_,(0,c.jt)(c.Ry)),e.mode=e.mode||"popup";var n=e.mode;return"code"===n?this._loginViaOAuthCode(t,e):this._loginViaOAuth(t,e)}},{key:"signInWithWassup",value:function(t){return(0,c.T2)([mt,"#signInWithWassup"],arguments,c.Ry),this._httpPost("wassup","signin").addAuthContext().addForm(t).send().then(this._updateStateFromHttpResponse(),this._notifyErrorFromHttpResponse.bind(this))}},{key:"signOut",value:function(){return(0,c.T2)([mt,"#signOut"],arguments),this.currentState=dt,new Promise((function(t){return(0,bt.iK)((function(){return t()}))}))}},{key:"_loginViaOAuthCode",value:function(t,e){return e.code&&e.state||this._logger.warn("authWithOAuth(): options.code or options.state is missing!"),this._httpGet(t,"callback").addQueryParameters(e).send().then(this._updateStateFromHttpResponse(),this._notifyErrorFromHttpResponse.bind(this))}},{key:"_loginViaOAuth",value:function(t,e){if(nt.RY&&(Pt.get(this._oauthSessionKey)||Et.get(this._oauthSessionKey)))return Promise.reject(kt({code:"ONGOING_OAUTH",message:"An OAuth authentication is already ongoing"}));var n=!nt.RY||"redirect"===e.mode||l.lk();e.token=this._contextAuthToken(),e.mode="redirect",!e.to&&nt.RY&&(e.to=location.href.replace(/[?&]__wcsession=[^&]+/,"")),!e.from&&nt.RY&&(e.from=E()+E()+E()+E());var r=e.from;e.from=C(r,!0),e.pm="1";var o=e.popupFeatures||{};delete e.popupFeatures;var i=N("".concat(this._authRoute,"/").concat(t,"/signin"),e);if(!n)return this._oauthLoginViaPopup(t,o,i,r);try{return nt.RY&&(Pt.set(this._oauthSessionKey,r),document.location=i),Promise.resolve(i)}catch(t){return Promise.reject(t)}}},{key:"_oauthLoginViaPopup",value:function(t,e,n,r){var o=this,i=Object.assign({},ne,ee[t],e),s=i.target||"_blank";delete i.target,Et.set(this._oauthSessionKey,"popup");var u=window.open(n,s,Object.entries(i).map((function(t){var e=a()(t,2),n=e[0],r=e[1];return"".concat(n,"=").concat(r)})).join(","));return new Promise((function(t,e){if(u)var i=(0,bt.Zi)((function(){var n=Et.get(o._oauthSessionKey);(u.closed||"popup"!==n)&&((0,bt.cv)(i),u.close(),Et.remove(o._oauthSessionKey),"popup"===n?e(kt(te)):t(o.resumeSession(n,r)))}),250);else e(kt(function(t){return{code:"POPUP_FAILED",message:"Could not open popup at ".concat(t)}}(n)))}))}},{key:"addIdentity",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,c.T2)([mt,"#addIdentity"],arguments,c.Z_,c.Ry,(0,c.jt)(c.Ry)),this._httpPost(t,"identities").addAuthContext().addQueryParameters(n).addJson(e).send().then((function(t){return t.body}))}},{key:"removeIdentity",value:function(){var t=[mt,"#removeIdentity"];(0,c.T2)(t,arguments);try{var e=this._getCurrentAuthenticationDetails(t);return this._httpDelete(e.provider,"identities",encodeURIComponent(e.providerUid)).addHeader(zt(e.webcomAuthToken)).send().then((function(){}))}catch(t){return Promise.reject(t)}}},{key:"removeAccount",value:function(){var t=[mt,"#removeAccount"];(0,c.T2)(t,arguments);try{var e=this._getCurrentAuthenticationDetails(t);return this._httpDelete("accounts",e.uid).addHeader(zt(e.webcomAuthToken)).send().then((function(){}))}catch(t){return Promise.reject(t)}}},{key:"verifyIdentity",value:function(t,e,n){return(0,c.T2)([mt,"#verifyIdentity"],arguments,c.Z_,c.Z_,c.Ry),n.auth&&(n.challenge=n.auth.verificationPending,delete n.auth),this._httpPost(t,"identities",e,"verify").addAuthContext().addJson(n).send().then(this._updateStateFromHttpResponse(),this._notifyErrorFromHttpResponse.bind(this))}},{key:"updateIdentityProfile",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=[mt,"#updateIdentityProfile"];(0,c.T2)(n,arguments,c.__,(0,c.jt)(c.Z_));try{var r=this._getCurrentAuthenticationDetails(n);return this._httpPut(r.provider,"identities",encodeURIComponent(r.providerUid),"providerProfile",e).addHeader(zt(r.webcomAuthToken)).addJson(t).send().then((function(t){return t.body}))}catch(t){return Promise.reject(t)}}},{key:"_getCurrentAuthenticationDetails",value:function(t){var e;if(!this.currentState.isAuthenticated())throw kt({code:"AUTH_MISSING",message:"".concat((e="").concat.apply(e,H()(t))," failed: needs to be authenticated")});return this.currentState.details}},{key:"updatePassword",value:function(t,e,n){return(0,c.T2)([mt,"#updatePassword"],arguments,c.Z_,c.Z_,c.Z_),this._httpPut("password","identities",encodeURIComponent(t),"password").addForm({password:e,newPassword:n}).send().then((function(t){return t.body}))}},{key:"sendPasswordResetCode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,c.T2)([mt,"#sendPasswordResetCode"],arguments,c.Z_,c.Z_,(0,c.jt)(c.Ry)),this._httpPost(t,"identities",encodeURIComponent(e),"reset").addQueryParameters(n).send().then((function(t){return t.body}))}},{key:"sendVerificationCode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,c.T2)([mt,"#sendVerificationCode"],arguments,c.Z_,c.Z_,(0,c.jt)(c.Ry)),this._httpPost(t,"identities",e,"sendVerification").addQueryParameters(n).send().then((function(t){return t.body}))}}]),t}(),ue=n(113),ae=n(147),ce=function(t){return t.replace(/\+|\/|=+$/g,(function(t){switch(t){case"+":return"-";case"/":return"_";default:return""}}))},he=ce(Buffer.from('{"alg":"RS512","typ":"JWT"}').toString("base64"));!function(t,e,n,r){ut(t.prototype,e,n,r)}(se,"signInWithServerKey",(function(t,e){var n,r=this;if((0,c.T2)([mt,"#signInWithServerKey"],arguments,c.Z_,(0,c.wE)(c.Z_,c.Ry)),(0,l.HD)(e))try{e=ae.readFileSync(e).toString()}catch(t){return Promise.reject(t)}else e=e.key;var o=ce(Buffer.from('{"id":"'.concat(t,'","timestamp":').concat(Date.now(),"}")).toString("base64"));try{var i=ue.createSign("RSA-SHA512");i.update(he+"."+o);var s=ce(i.sign(e,"base64"));n=he+"."+o+"."+s}catch(t){return Promise.reject(t)}return this._httpPost("server","signin").addAuthContext().addForm({token:n}).send().then(this._updateStateFromHttpResponse(),(function(t){return r._notifyErrorFromHttpResponse(t)}))})),vt=function(t){return new se(t)},t.Z.Webcom=et})(),module.exports=r.default})();