webcom
Version:
Webcom library
20 lines • 121 kB
JavaScript
/*!
* Webcom. Build realtime apps. Share and sync data instantly between your clients
*
* Module name: Webcom
* Version: 3.10.1
* Created: 2025-11-07T12:56:57.688Z
*
* Copyright (C) <2015-2025> 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)
*/
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,()=>(()=>{var t={172:t=>{t.exports=function(t,e){this.v=t,this.k=e},t.exports.__esModule=!0,t.exports.default=t.exports},373:t=>{t.exports=function(t){var e=Object(t),n=[];for(var r in e)n.unshift(r);return function t(){for(;n.length;)if((r=n.pop())in e)return t.value=r,t.done=!1,t;return t.done=!0,t}},t.exports.__esModule=!0,t.exports.default=t.exports},546:t=>{function e(n,r,i,o){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}t.exports=e=function(t,n,r,i){function o(n,r){e(t,n,function(t){return this._invoke(n,r,t)})}n?a?a(t,n,{value:r,enumerable:!i,configurable:!i,writable:!i}):t[n]=r:(o("next",0),o("throw",1),o("return",2))},t.exports.__esModule=!0,t.exports.default=t.exports,e(n,r,i,o)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},579:(t,e,n)=>{var r=n(738).default;t.exports=function(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(r(t)+" is not iterable")},t.exports.__esModule=!0,t.exports.default=t.exports},633:(t,e,n)=>{var r=n(172),i=n(993),o=n(869),a=n(887),u=n(791),s=n(373),c=n(579);function l(){"use strict";var e=i(),n=e.m(l),h=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function f(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))}var d={throw:1,return:2,break:3,continue:3};function v(t){var e,n;return function(r){e||(e={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(t,e){return n(r.a,d[t],e)},delegateYield:function(t,i,o){return e.resultName=i,n(r.d,c(t),o)},finish:function(t){return n(r.f,t)}},n=function(t,n,i){r.p=e.prev,r.n=e.next;try{return t(n,i)}finally{e.next=r.n}}),e.resultName&&(e[e.resultName]=r.v,e.resultName=void 0),e.sent=r.v,e.next=r.n;try{return t.call(this,e)}finally{r.p=e.prev,r.n=e.next}}}return(t.exports=l=function(){return{wrap:function(t,n,r,i){return e.w(v(t),n,r,i&&i.reverse())},isGeneratorFunction:f,mark:e.m,awrap:function(t,e){return new r(t,e)},AsyncIterator:u,async:function(t,e,n,r,i){return(f(e)?a:o)(v(t),e,n,r,i)},keys:s,values:c}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=l,t.exports.__esModule=!0,t.exports.default=t.exports},738: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},756:(t,e,n)=>{var r=n(633)();t.exports=r;try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},779:(t,e)=>{"use strict";var n,r={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(t){this.toString=function(){return"CORRUPT: "+this.message},this.message=t},invalid:function(t){this.toString=function(){return"INVALID: "+this.message},this.message=t},bug:function(t){this.toString=function(){return"BUG: "+this.message},this.message=t},notReady:function(t){this.toString=function(){return"NOT READY: "+this.message},this.message=t}}};r.bitArray={bitSlice:function(t,e,n){return t=r.bitArray._shiftRight(t.slice(e/32),32-(31&e)).slice(1),void 0===n?t:r.bitArray.clamp(t,n-e)},extract:function(t,e,n){var r=Math.floor(-e-n&31);return(-32&(e+n-1^e)?t[e/32|0]<<32-r^t[e/32+1|0]>>>r:t[e/32|0]>>>r)&(1<<n)-1},concat:function(t,e){if(0===t.length||0===e.length)return t.concat(e);var n=t[t.length-1],i=r.bitArray.getPartial(n);return 32===i?t.concat(e):r.bitArray._shiftRight(e,i,0|n,t.slice(0,t.length-1))},bitLength:function(t){var e,n=t.length;return 0===n?0:(e=t[n-1],32*(n-1)+r.bitArray.getPartial(e))},clamp:function(t,e){if(32*t.length<e)return t;var n=(t=t.slice(0,Math.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=r.bitArray.partial(e,t[n-1]&2147483648>>e-1,1)),t},partial:function(t,e,n){return 32===t?e:(n?0|e:e<<32-t)+1099511627776*t},getPartial:function(t){return Math.round(t/1099511627776)||32},equal:function(t,e){if(r.bitArray.bitLength(t)!==r.bitArray.bitLength(e))return!1;var n,i=0;for(n=0;n<t.length;n++)i|=t[n]^e[n];return 0===i},_shiftRight:function(t,e,n,i){var o,a,u;for(void 0===i&&(i=[]);e>=32;e-=32)i.push(n),n=0;if(0===e)return i.concat(t);for(o=0;o<t.length;o++)i.push(n|t[o]>>>e),n=t[o]<<32-e;return a=t.length?t[t.length-1]:0,u=r.bitArray.getPartial(a),i.push(r.bitArray.partial(e+u&31,e+u>32?n:i.pop(),1)),i},_xor4:function(t,e){return[t[0]^e[0],t[1]^e[1],t[2]^e[2],t[3]^e[3]]},byteswapM:function(t){var e,n;for(e=0;e<t.length;++e)n=t[e],t[e]=n>>>24|n>>>8&65280|(65280&n)<<8|n<<24;return t}},r.codec.utf8String={fromBits:function(t){var e,n,i="",o=r.bitArray.bitLength(t);for(e=0;e<o/8;e++)3&e||(n=t[e/4]),i+=String.fromCharCode(n>>>8>>>8>>>8),n<<=8;return decodeURIComponent(escape(i))},toBits:function(t){t=unescape(encodeURIComponent(t));var e,n=[],i=0;for(e=0;e<t.length;e++)i=i<<8|t.charCodeAt(e),3&~e||(n.push(i),i=0);return 3&e&&n.push(r.bitArray.partial(8*(3&e),i)),n}},r.codec.base64={_chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(t,e,n){var i,o="",a=0,u=r.codec.base64._chars,s=0,c=r.bitArray.bitLength(t);for(n&&(u=u.substr(0,62)+"-_"),i=0;6*o.length<c;)o+=u.charAt((s^t[i]>>>a)>>>26),a<6?(s=t[i]<<6-a,a+=26,i++):(s<<=6,a-=6);for(;3&o.length&&!e;)o+="=";return o},toBits:function(t,e){t=t.replace(/\s|=/g,"");var n,i,o=[],a=0,u=r.codec.base64._chars,s=0;for(e&&(u=u.substr(0,62)+"-_"),n=0;n<t.length;n++){if((i=u.indexOf(t.charAt(n)))<0)throw new r.exception.invalid("this isn't base64!");a>26?(a-=26,o.push(s^i>>>a),s=i<<32-a):s^=i<<32-(a+=6)}return 56&a&&o.push(r.bitArray.partial(56&a,s,1)),o}},r.codec.base64url={fromBits:function(t){return r.codec.base64.fromBits(t,1,1)},toBits:function(t){return r.codec.base64.toBits(t,1)}},r.hash.sha256=function(t){this._key[0]||this._precompute(),t?(this._h=t._h.slice(0),this._buffer=t._buffer.slice(0),this._length=t._length):this.reset()},r.hash.sha256.hash=function(t){return(new r.hash.sha256).update(t).finalize()},r.hash.sha256.prototype={blockSize:512,reset:function(){return this._h=this._init.slice(0),this._buffer=[],this._length=0,this},update:function(t){"string"==typeof t&&(t=r.codec.utf8String.toBits(t));var e,n=this._buffer=r.bitArray.concat(this._buffer,t),i=this._length,o=this._length=i+r.bitArray.bitLength(t);if(o>9007199254740991)throw new r.exception.invalid("Cannot hash more than 2^53 - 1 bits");if("undefined"!=typeof Uint32Array){var a=new Uint32Array(n),u=0;for(e=512+i-(512+i&511);e<=o;e+=512)this._block(a.subarray(16*u,16*(u+1))),u+=1;n.splice(0,16*u)}else for(e=512+i-(512+i&511);e<=o;e+=512)this._block(n.splice(0,16));return this},finalize:function(){var t,e=this._buffer,n=this._h;for(t=(e=r.bitArray.concat(e,[r.bitArray.partial(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},_init:[],_key:[],_precompute:function(){var t,e,n=0,r=2;function i(t){return 4294967296*(t-Math.floor(t))|0}for(;n<64;r++){for(e=!0,t=2;t*t<=r;t++)if(r%t===0){e=!1;break}e&&(n<8&&(this._init[n]=i(Math.pow(r,.5))),this._key[n]=i(Math.pow(r,1/3)),n++)}},_block:function(t){var e,n,r,i,o=this._h,a=this._key,u=o[0],s=o[1],c=o[2],l=o[3],h=o[4],f=o[5],d=o[6],v=o[7];for(e=0;e<64;e++)e<16?n=t[e]:(r=t[e+1&15],i=t[e+14&15],n=t[15&e]=(r>>>7^r>>>18^r>>>3^r<<25^r<<14)+(i>>>17^i>>>19^i>>>10^i<<15^i<<13)+t[15&e]+t[e+9&15]|0),n=n+v+(h>>>6^h>>>11^h>>>25^h<<26^h<<21^h<<7)+(d^h&(f^d))+a[e],v=d,d=f,f=h,h=l+n|0,l=c,c=s,u=n+((s=u)&c^l&(s^c))+(s>>>2^s>>>13^s>>>22^s<<30^s<<19^s<<10)|0;o[0]=o[0]+u|0,o[1]=o[1]+s|0,o[2]=o[2]+c|0,o[3]=o[3]+l|0,o[4]=o[4]+h|0,o[5]=o[5]+f|0,o[6]=o[6]+d|0,o[7]=o[7]+v|0}},r.hash.sha1=function(t){t?(this._h=t._h.slice(0),this._buffer=t._buffer.slice(0),this._length=t._length):this.reset()},r.hash.sha1.hash=function(t){return(new r.hash.sha1).update(t).finalize()},r.hash.sha1.prototype={blockSize:512,reset:function(){return this._h=this._init.slice(0),this._buffer=[],this._length=0,this},update:function(t){"string"==typeof t&&(t=r.codec.utf8String.toBits(t));var e,n=this._buffer=r.bitArray.concat(this._buffer,t),i=this._length,o=this._length=i+r.bitArray.bitLength(t);if(o>9007199254740991)throw new r.exception.invalid("Cannot hash more than 2^53 - 1 bits");if("undefined"!=typeof Uint32Array){var a=new Uint32Array(n),u=0;for(e=this.blockSize+i-(this.blockSize+i&this.blockSize-1);e<=o;e+=this.blockSize)this._block(a.subarray(16*u,16*(u+1))),u+=1;n.splice(0,16*u)}else for(e=this.blockSize+i-(this.blockSize+i&this.blockSize-1);e<=o;e+=this.blockSize)this._block(n.splice(0,16));return this},finalize:function(){var t,e=this._buffer,n=this._h;for(t=(e=r.bitArray.concat(e,[r.bitArray.partial(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},_init:[1732584193,4023233417,2562383102,271733878,3285377520],_key:[1518500249,1859775393,2400959708,3395469782],_f: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},_S:function(t,e){return e<<t|e>>>32-t},_block:function(t){var e,n,r,i,o,a,u,s,c=this._h;if("undefined"!=typeof Uint32Array){s=Array(80);for(var l=0;l<16;l++)s[l]=t[l]}else s=t;for(r=c[0],i=c[1],o=c[2],a=c[3],u=c[4],e=0;e<=79;e++)e>=16&&(s[e]=this._S(1,s[e-3]^s[e-8]^s[e-14]^s[e-16])),n=this._S(5,r)+this._f(e,i,o,a)+u+s[e]+this._key[Math.floor(e/20)]|0,u=a,a=o,o=this._S(30,i),i=r,r=n;c[0]=c[0]+r|0,c[1]=c[1]+i|0,c[2]=c[2]+o|0,c[3]=c[3]+a|0,c[4]=c[4]+u|0}},t.exports&&(t.exports=r),void 0===(n=function(){return r}.apply(e,[]))||(t.exports=n)},791:(t,e,n)=>{var r=n(172),i=n(546);t.exports=function t(e,n){function o(t,i,a,u){try{var s=e[t](i),c=s.value;return c instanceof r?n.resolve(c.v).then(function(t){o("next",t,a,u)},function(t){o("throw",t,a,u)}):n.resolve(c).then(function(t){s.value=t,a(s)},function(t){return o("throw",t,a,u)})}catch(t){u(t)}}var a;this.next||(i(t.prototype),i(t.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),i(this,"_invoke",function(t,e,r){function i(){return new n(function(e,n){o(t,r,e,n)})}return a=a?a.then(i,i):i()},!0)},t.exports.__esModule=!0,t.exports.default=t.exports},869:(t,e,n)=>{var r=n(887);t.exports=function(t,e,n,i,o){var a=r(t,e,n,i,o);return a.next().then(function(t){return t.done?t.value:a.next()})},t.exports.__esModule=!0,t.exports.default=t.exports},887:(t,e,n)=>{var r=n(993),i=n(791);t.exports=function(t,e,n,o,a){return new i(r().w(t,e,n,o),a||Promise)},t.exports.__esModule=!0,t.exports.default=t.exports},993:(t,e,n)=>{var r=n(546);function i(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
var e,n,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",u=o.toStringTag||"@@toStringTag";function s(t,i,o,a){var u=i&&i.prototype instanceof l?i:l,s=Object.create(u.prototype);return r(s,"_invoke",function(t,r,i){var o,a,u,s=0,l=i||[],h=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,a=0,u=e,f.n=n,c}};function d(t,r){for(a=t,u=r,n=0;!h&&s&&!i&&n<l.length;n++){var i,o=l[n],d=f.p,v=o[2];t>3?(i=v===r)&&(u=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=t<2&&d<o[1])?(a=0,f.v=r,f.n=o[1]):d<v&&(i=t<3||o[0]>r||r>v)&&(o[4]=t,o[5]=r,f.n=v,a=0))}if(i||t>1)return c;throw h=!0,r}return function(i,l,v){if(s>1)throw TypeError("Generator is already running");for(h&&1===l&&d(l,v),a=l,u=v;(n=a<2?e:u)||!h;){o||(a?a<3?(a>1&&(f.n=-1),d(a,u)):f.n=u:f.v=u);try{if(s=2,o){if(a||(i="next"),n=o[i]){if(!(n=n.call(o,u)))throw TypeError("iterator result is not an object");if(!n.done)return n;u=n.value,a<2&&(a=0)}else 1===a&&(n=o.return)&&n.call(o),a<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),a=1);o=e}else if((n=(h=f.n<0)?u:t.call(r,f))!==c)break}catch(t){o=e,a=1,u=t}finally{s=1}}return{value:n,done:h}}}(t,o,a),!0),s}var c={};function l(){}function h(){}function f(){}n=Object.getPrototypeOf;var d=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),v=f.prototype=l.prototype=Object.create(d);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,r(t,u,"GeneratorFunction")),t.prototype=Object.create(v),t}return h.prototype=f,r(v,"constructor",f),r(f,"constructor",h),h.displayName="GeneratorFunction",r(f,u,"GeneratorFunction"),r(v),r(v,u,"Generator"),r(v,a,function(){return this}),r(v,"toString",function(){return"[object Generator]"}),(t.exports=i=function(){return{w:s,m:p}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r](o,o.exports,n),o.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.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var r={};return(()=>{"use strict";n.d(r,{default:()=>Kt});var t=function(){if("undefined"!=typeof globalThis)return globalThis;return"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:Function("return this")()}();function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t){return i="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},i(t)}function o(t){var e=function(t,e){if("object"!=i(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==i(e)?e:e+""}function a(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,o(r.key),r)}}function u(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function c(t,e){if(t){if("string"==typeof t)return s(t,e);var n={}.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)?s(t,e):void 0}}function l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,u=[],s=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(u.push(r.value),u.length!==e);s=!0);}catch(t){c=!0,i=t}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return u}}(t,e)||c(t,e)||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.")}()}function h(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||c(t)||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.")}()}var f=t.WebcomDependencies||{},d={};function v(t,e,n){Object.defineProperty(d,t,{enumerable:!0,get:e,set:n})}var p="browser",y="mobile/",g="".concat(y,"android"),m="".concat(y,"iOS"),w={};w[p]="b",w[g]="a",w[m]="i",w.node="n";var b,k=!0,_=!1,A="device",S=f[A];if(!S){var O=t.window;O&&O.location?O.location.href.indexOf("webview.datasync.orange.com")<0?x(p):x(g):x(m)}function x(t){S=t,k=t===p,_=0===t.indexOf(y),b=(w[t]||"")+"3.10.1"}function j(t){return"string"==typeof t}function E(t){return"function"==typeof t}function R(t){return"object"===i(t)}v(A,function(){return S},function(t){return x(t)});var D="Webcom internal error";function I(t,e){t||C(D,e)}var P={values:[]};function M(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];Object.assign(P,{method:t,args:e||[],checkers:r})}var C=function(t,e){var n;throw new Error("".concat((n="").concat.apply(n,h(t)),": ").concat(e))};function W(t,e){if(!P.method){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];M.apply(void 0,[t,e].concat(r))}var o=P.method,a=P.args,u=P.checkers,s=P.values;Object.assign(P,{method:void 0,args:void 0,checkers:void 0,values:[]}),a.length>u.length&&C(o,"too many arguments, ".concat(a.length," instead of ").concat(u.length)),u.forEach(function(t,e){return q(t,a[e],o,function(t){return"argument #".concat(e+1," ").concat(t)})}),s.forEach(function(t){var e=t.name,n=t.value;return q(t.checker,n,o,function(t){return"".concat(e," ").concat(t)})})}function q(t,e,n,r){var i=t(e);i&&C(n,r(i))}function T(t){return function(e){return F("undefined")(e)&&t&&t(e)}}var N=function(t){return void 0===t?"is missing":""};function U(t){return function(e){return!(e instanceof t)&&"must be an instance of ".concat(t.name)}}function F(t){return function(e){return i(e)!==t&&"must be a ".concat(t)}}var L=F("undefined"),H=F("string"),B=F("function"),z=F("boolean"),G=Q(Number.isFinite,"must be a finite number"),J=F("object");function K(){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 "))}}var V="is not valid";function Q(t,e){return function(n){return!t(n)&&(e||V)}}Q(function(t){return"number"==typeof t&&Math.floor(t)===t},"must be an integer");var $="console",X=f[$],Y=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 R(t)?JSON.stringify(t):(t||"undefined").toString()};if(j(t)){var o=0;return[t=t.replace(/%(.)/g,function(t,e){switch(e){case"%":return"%";case"s":case"o":case"O":return i(n[o++]);case"d":case"i":case"f":return n[o++];default:return t}})].concat(h(n.slice(o).map(i))).join(" ")}return[t].concat(n).map(i).join(" ")};function Z(t,e,n,r,i){if(!n||!r||!i){var o=e,a=function(t){return function(e){return o("[".concat(t,"] ").concat(e))}};n=n||a("INFO"),r=r||a("WARN"),i=i||a("ERR!"),e=a("LOG ")}return{log:function(){return e.call(t,Y.apply(void 0,arguments))},info:function(){return n.call(t,Y.apply(void 0,arguments))},warn:function(){return r.call(t,Y.apply(void 0,arguments))},error:function(){return i.call(t,Y.apply(void 0,arguments))}}}if(E(X))X=Z(t,X);else if(R(X)&&X){var tt=X,et=tt.log,nt=tt.info,rt=tt.warn,it=tt.error;X=Z(X,et,nt,rt,it)}else{X=Z(t[$],t[$].log,t[$].info,t[$].warn,t[$].error)}v($,function(){return X},function(t){return X=t});var ot="setTimeout",at=f[ot];at||(at=t[ot]),v(ot,function(){return at},function(t){return at=t}),t[ot]||(t[ot]=at),t.setImmediate||(t.setImmediate=at);var ut="clearTimeout",st=f[ut];st||(st=t[ut]),v(ut,function(){return st},function(t){return st=t}),t[ut]||(t[ut]=st),t.clearImmediate||(t.clearImmediate=st);var ct="setInterval",lt=f[ct];lt||(lt=t[ct]),v(ct,function(){return lt},function(t){return lt=t});var ht="clearInterval",ft=f[ht];ft||(ft=t[ht]),v(ht,function(){return ft},function(t){return ft=t});var dt=Function.prototype;var vt={};function pt(t,e){var n=t.length;return n>=e?t.substring(0,e):t+mt.substring(0,e-n)}function yt(t){return t.map(function(t){return E(t)?t():t})}var gt=u(function t(n,r,i,o){e(this,t),this._fqdn=n,this._prefix=r;var a=n.join(".");this._count=void 0===vt[a]?vt[a]=0:++vt[a],this.displayTimestamp=i,this.setPrefixWidth(o||8),this._log=this._emitLog.bind(this,X.log),this._info=this._emitLog.bind(this,X.info),this._warn=this._emitLog.bind(this,X.warn),this._error=this._emitLog.bind(this,X.error),this._enabled=!0},[{key:"fqdn",get:function(){return this._fqdn}},{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),o=2;o<r;o++)i[o-2]=arguments[o];j(e)?(n.push(e),e=n.join(" "),t.apply(void 0,[e].concat(h(yt(i))))):t.apply(void 0,n.concat(h(yt([e].concat(i)))))}},{key:"setPrefixWidth",value:function(t){this._displayedPrefix="".concat(pt(this._prefix,t)," #").concat(pt(this._count.toString(),3))}},{key:"setLevel",value:function(t){this._enabled=t>=0,this.log=t>=Wt.LOG?this._log:dt,this.info=t>=Wt.INFO?this._info:dt,this.warn=t>=Wt.WARN?this._warn:dt,this.error=t>=Wt.ERROR?this._error:dt}},{key:"updateLevel",value:function(t){this._enabled&&this.setLevel(t)}}]),mt=" ",wt=!1,bt=15,kt=[],_t={},At={},St={},Ot="_leaf_";function xt(t){return t?t.split("."):[]}function jt(t){return{disabledDepth:Dt(t,St),enabledDepth:Dt(t,At)}}function Et(t,e,n,r){for(var i=0;i<t.length;){var o=t[i++];e.hasOwnProperty(o)||(e[o]={}),e=e[o]}r&&Object.keys(e).forEach(function(t){return delete e[t]}),e[Ot]=n}function Rt(t,e){for(var n=0;n<t.length;){var r=t[n++];if(!e.hasOwnProperty(r))return;e=e[r]}delete e[Ot]}function Dt(t,e){var n=-1,r=0;do{e.hasOwnProperty(Ot)&&(n=r)}while(r<t.length&&(e=e[t[r++]]));return n}function It(t,e){Object.entries(t||{}).forEach(function(t){var n=l(t,2),r=n[0],i=n[1];r===Ot?e(i):It(i,e)})}function Pt(t,e){for(var n=[],r=0;e&&r<t.length;)e=e[t[r++]];return It(e,function(t){return n.push(t)}),n}function Mt(t){wt=t,kt.forEach(function(t){return t.displayTimestamp=wt})}var Ct="LogManager",Wt=function(){function t(){e(this,t)}return u(t,null,[{key:"enable",value:function(e){W([Ct,".enable"],arguments,T(H));var n=xt(e),r=jt(n),i=r.enabledDepth,o=r.disabledDepth;i<=o&&(o<0&&t.disable(),Et(n,At,!0,!0),Rt(n,St),Pt(n,_t).forEach(function(t){return t.setLevel(Tt)}))}},{key:"disable",value:function(t){W([Ct,".disable"],arguments,T(H));var e=xt(t),n=jt(e),r=n.enabledDepth;n.disabledDepth<=r&&(Et(e,St,!0,!0),Rt(e,At),Pt(e,_t).forEach(function(t){return t.setLevel(-1)}))}},{key:"showTimestamp",value:function(){W([Ct,".showTimestamp"],arguments),Mt(!0)}},{key:"hideTimestamp",value:function(){W([Ct,".hideTimestamp"],arguments),Mt(!1)}},{key:"setPrefixWidth",value:function(t){W([Ct,".setPrefixWidth"],arguments,G),t<0?t=0:t>mt.length&&(t=mt.length),bt=t,kt.forEach(function(t){return t.setPrefixWidth(bt)})}},{key:"level",get:function(){return Tt},set:function(t){W([Ct,".level"],arguments,G),t>-1&&t!==Tt&&(kt.forEach(function(e){return e.updateLevel(t)}),Tt=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 X.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?X.log("********** REVOKED ".concat(n," **********"),t):X.log("********** COMPLETED ".concat(n," **********")),e}}},{key:"debugOnCallbackWithCancel",value:function(e){var n=e&&e.toUpperCase();return[t.debugOnCallback(e),function(t){return X.log.apply(X,["********** COMPLETE ".concat(n," **********")].concat(h(t?["FAILED:",t.code,t.message]:["cancelled"])))}]}}])}();function qt(t,e){var n=xt(t),r=new gt(n,e||n[n.length-1],wt,bt);return function(t){var e=t.fqdn;Et(e,_t,t),kt.push(t);var n=jt(e),r=n.disabledDepth,i=n.enabledDepth;t.setLevel(i>=r?Tt:-1)}(r),r}var Tt=Wt.INFO,Nt="WebcomApp",Ut=u(function t(n){var r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e(this,t),W(["new ",Nt],arguments,(r=/^[a-z0-9](?:[-a-z0-9]{0,38}[a-z0-9])?$/,Q(function(t){return r.test(t)},i)),T(K(J,H))),this._logger=qt("api.WebcomApp",Nt),this._services={},this.appId=n,this.config={},j(o)&&(o=Object.keys(Ht).reduce(function(t,e){return t[e]={baseUrl:o},t},{})),this._fillConfig(o),this._logger.log("Initialized %s with options %s",n,JSON.stringify(this.config))},[{key:"dispose",value:function(){W([Nt,"#dispose"],arguments),Object.values(this._services).forEach(function(t){return t._dispose()}),this._services={}}},{key:"_fillConfig",value:function(t){Ft.call(this,t,Ht)}},{key:"toString",value:function(){return"".concat(this.appId,"{").concat(Object.keys(this._services).join(","),"}")}}]);function Ft(t,e){var n=this,r=function(t,e,i,o){var a=function(t){return"".concat(Nt,".Configuration.").concat(o.concat(t).join("."))};e=Object.assign({},e),Object.entries(i).forEach(function(i){var u=l(i,2),s=u[0],c=u[1];if(c instanceof Object&&!(c instanceof Array))t[s]=t[s]||{},r(t[s],e[s]||{},c,o.concat(s));else{var h=e[s],f=c[1]||function(t){return t};try{t[s]=f(void 0===h?void 0===t[s]?c.length?c[0]:c:t[s]:h)}catch(e){var d=a(s);void 0===e.value?C(d,e.message):(n._logger.warn("%s: %s",d,e.message),t[s]=e.value)}}delete e[s]}),Object.keys(e).forEach(function(t){return n._logger.warn("%s: unknown config key",a(t))})};r(this.config,t,e,[])}function Lt(t,e,n){return"".concat(n.key,":").concat(e,":").concat(function(t,e){var n=e.baseUrl;return"/".concat(n.protocol.slice(0,-1),"/").concat(n.host,"/").concat(t.appId,"/")}(t,n))}var Ht={},Bt="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",zt=0,Gt=[];var Jt="Webcom",Kt=u(function t(){e(this,t),this._init.apply(this,arguments)},[{key:"_init",value:function(){C(["new ",Jt],"this static class cannot be instantiated")}}],[{key:"SDK_VERSION",get:function(){return"3.10.1"}},{key:"Log",get:function(){return Wt}},{key:"App",value:function(t,e){return new Ut(t,e)}},{key:"getUniqueKeyDate",value:function(t){return new Date(function(t){for(var e=t.substring(0,8),n=0,r=0;r<8;++r)n=64*n+Bt.indexOf(e[r]);return n}(t))}},{key:"dependencies",get:function(){return d}}]),Vt=qt("api.Webcom",Jt);function Qt(t){"http:"===t.protocol&&k&&"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 $t=new RegExp("^(?:([^:]+:)//)?(?:[^/@]+@)?([^/:]+(?::\\d+)?)(?:/.*)?$"),Xt="io.datasync.orange.com";function Yt(e){if(e&&(t.URL&&e instanceof URL||e.href&&e.protocol&&e.host))return e;var n=e?$t.exec(e):[Xt,void 0,Xt];if(n){var r=l(n,3),i=r[0],o=r[1],a=r[2];return o||(i="".concat(o="https:","//").concat(i)),{href:i,protocol:o,host:a}}throw new Error("cannot parse base URL: ".concat(e))}function Zt(t,e){return function(n){var r=t(n);if(r)throw new Error(r);return e?e(n):n}}function te(t,e,n){return function(r){if(void 0!==t&&r<t){var i="must be higher than ".concat(t);throw n?{value:t,message:i}:new Error(i)}if(void 0!==e&&r>e){var o="must be lower than ".concat(e);throw n?{value:e,message:o}:new Error(o)}return r}}function ee(t,e,n,r){return re(t.prototype,e,n,r)}function ne(t,e,n,r){return ie(t,e,{value:n},r)}function re(t,e,n,r){return ie(t,e,{get:n},r)}function ie(t,e,n,r){return Object.defineProperty(t,e,Object.assign(n,{enumerable:r,configurable:!0}))}function oe(t,e){var n=i(t);if(n!==i(e))return!1;if("object"!==n)return t===e;if(t===e)return!0;if(!t||!e)return!1;var r=Object.entries(t);return r.length===Object.keys(e).length&&r.every(function(t){var n=l(t,2),r=n[0];return oe(n[1],e[r])})}var ae="some",ue="required",se="none",ce=u(function t(n,r){e(this,t),I(n===ae||n===ue||n===se,"Wrong state value for a new State object: expecting 'some', 'required' or 'none'."),this.state=n,I(n!==ae||r&&r.webcomAuthToken,"Missing details or webcomAuthToken for a new 'some' State"),this.details=r},[{key:"isUnauthenticated",value:function(){return this.state===se}},{key:"isAuthenticated",value:function(){return this.state===ae}},{key:"isRequired",value:function(){return this.state===ue}},{key:"isSameAs",value:function(t){return this.state===t.state&&(this.state!==ae||this.details.webcomAuthToken===t.details.webcomAuthToken)}}]),le=new ce(se),he=new ce(ue),fe=function(t){return new ce(ae,t)};var de,ve="Authentication";function pe(t){switch(W([Jt,".avatarURL"],arguments,J),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}}function ye(t){var e=t.code||"UNKNOWN_ERROR",n=t.message||JSON.stringify(t),r=new Error("".concat(e,"[").concat(n,"]"));return r.code=e,r}Ht[ve]={from:[void 0,Zt(T(U(Ut)))],baseUrl:[null,Yt],storage:[void 0,Zt(T(K(H,B)))],initialState:[void 0,function(t){return t&&JSON.parse(t)}],key:[void 0,Zt(L,function(){return"auth"})]},ee(Ut,"authentication",function(){var t=this._services[ve];if(!t){var e=this.config[ve].from;t=e?e.authentication:de(this),this._services[ve]=t}return t});var ge=u(function t(){e(this,t),this.cache_={}},[{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_={}}}]),me="localStorage",we=f[me];we||(we=t[me]||new ge),v(me,function(){return we},function(t){return we=t});var be="sessionStorage",ke=f[be];function _e(t){return"webcom:"+t}ke||(ke=t[be]||null),v(be,function(){return ke},function(t){return ke=t});var Ae=u(function t(n,r){e(this,t);var i=n();if(i){var o=_e("sentinel");i.setItem(o,""),i.removeItem(o)}function a(){return n()||C("JSONStorage","the ".concat(r," implementation could not be found!"))}this.set=function(t,e){if(null===e)a().removeItem(_e(t));else{var n=JSON.stringify(e);a().setItem(_e(t),"string"==typeof n?n:"null")}},this.get=function(t){var e=a().getItem(_e(t));return e&&JSON.parse(e)},this.remove=function(t){a().removeItem(_e(t))}}),Se=new Ae(function(){return we},"localStorage"),Oe=new Ae(function(){return ke},"sessionStorage"),xe=n(779),je=n.n(xe);function Ee(t){return decodeURIComponent(t.replace(/\+/g," "))}function Re(){var t=2147483648;return Math.floor(Math.random()*t).toString(36)+Math.abs(Math.floor(Math.random()*t)^Date.now()).toString(36)}function De(t){var e={};return t.replace(/^[^?]*\?/,"").split("&").forEach(function(t){var n=t.indexOf("=");if(n<0)e[Ee(t)]=!0;else{var r=Ee(t.substring(0,n));e[r]=Ee(t.substring(n+1))}}),e}function Ie(t){if(!t)return"";var e=[];return Object.entries(t).forEach(function(t){var n=l(t,2),r=n[0],i=n[1];null!=i&&(R(i)&&(i=JSON.stringify(i)),e.push(encodeURIComponent(r)+"="+encodeURIComponent(i)))}),e.join("&")}function Pe(t,e){var n=t.indexOf("?"),r=e?(n<0?"?":"&")+Ie(e):"",i=t.indexOf("#");return i<0?t+r:t.substring(0,i)+r+t.substring(i)}function Me(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Me=function(){return!!t})()}function Ce(t,e){return Ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ce(t,e)}function We(t,e,n){if(Me())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&Ce(i,n.prototype),i}var qe="XMLHttpRequest",Te=f[qe];Te||(void 0===(Te=t[qe])||function(){if(k&&"Microsoft Internet Explorer"===window.navigator.appName){var t=window.navigator.userAgent.match(/MSIE (\d+[.\d]*)/);return t&&t.length>1&&parseFloat(t[1])<10}return!1}())&&C(D,"XMLHttpRequest not found"),v(qe,function(){return Te},function(t){return Te=t});var Ne=qt("network.HttpRequest","HttpRequest"),Ue="application/x-www-form-urlencoded",Fe="application/json",Le="Content-Type",He="PUT",Be="PATCH",ze="POST",Ge="DELETE",Je="GET",Ke=u(function t(n,r){e(this,t),this.name=n,this.value=r}),Ve=u(function t(n,r){e(this,t);for(var i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];this.url=Pe([r].concat(h(o.filter(function(t){return t&&t.length}).map(function(t){return encodeURIComponent(t)}))).join("/"),{c:b}),this.method=n.toUpperCase(),this.headers={Accept:"application/json, text/plain"}},[{key:"addQueryParameters",value:function(t){return this.url=Pe(this.url,t),this}},{key:"addJson",value:function(t){return this.contentType=Fe,this.data=t,this}},{key:"addForm",value:function(t){return this.contentType=Ue,this.data=t,this}},{key:"addHeader",value:function(t){return W(["HttpRequest","#addHeader"],arguments,T(U(Ke))),t&&(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){var r=null;void 0!==t.data&&[ze,He,Be].indexOf(t.method)>=0&&((r=t.contentType===Ue?Ie(t.data):t.contentType===Fe?JSON.stringify(t.data):t.data)?t.headers[Le]=t.contentType:delete t.headers[Le]),Ne.log("==> ".concat(t.method," ").concat(t.url)),Object.keys(t.headers).forEach(function(e){return Ne.log(" > HEADER ".concat(e,": ").concat(t.headers[e]))}),r&&Ne.log(" > DATA: ".concat(r)),t._open(r,e,function(t){Ne.log("<== ERROR: ".concat(JSON.stringify(t))),n(ye(t))})})}},{key:"_open",value:function(t,e,n){var r=this,i=new Te,o="RESPONSE_PAYLOAD_ERROR";i.onreadystatechange=function(){if(4===i.readyState){var t=i.responseText,a=i.status;if(a>=500)n({code:o,message:"HTTP status ".concat(a)});else try{var u=t.length?JSON.parse(t):{};if(a>=400)n(u.error||u);else if(a>=200&&a<300||304===a){var s={body:u},c=s.body.error||null;c?n(R(c)?c:{code:s.body.status,message:c}):(r.readHeaders&&(s.headers=function(t){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}(i)),Ne.log("<== ".concat(JSON.stringify(s))),e(s))}else n({code:o,message:"HTTP status ".concat(a)})}catch(t){n({code:o,message:"invalid response payload, not a Json content type"})}}},i.open(this.method,this.url,!0),Object.entries(this.headers).forEach(function(t){var e=l(t,2),n=e[0],r=e[1];return i.setRequestHeader(n,r)}),i.send(t)}}]);function Qe(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return We(Ve,[Je,t].concat(n))}function $e(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return We(Ve,[He,t].concat(n))}function Xe(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return We(Ve,[ze,t].concat(n))}function Ye(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return We(Ve,[Ge,t].concat(n))}function Ze(t){if(t)return new Ke("Authorization","Bearer ".concat(t))}var tn=new(u(function t(n){e(this,t),ne(this,"name",n),this.counters_={}},[{key:"attach",value:function(t){this.counters_=t.counters_}},{key:"incrementCounter",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.counters_[t]=(this.counters_[t]||0)+e}},{key:"get",value:function(){return Object.assign({},this.counters_)}}]))("deprecated");function en(t,e,n,r){r=r&&r.concat(": ")||"",n=n?"use ".concat(n," instead"):"it should no longer be used",t.warn("".concat(r).concat(e," is deprecated, ").concat(n,".")),tn.incrementCounter(e)}ne(Wt,"showDeprecations",function(){W([Ct,"showDeprecations"],arguments),nn=en}),ne(Wt,"hideDeprecations",function(){W([Ct,"hideDeprecations"],arguments),nn=dt});var nn=en;ne(Kt,"Authentication",{avatarURL:pe}),re(Kt,"avatarURL",function(){return nn(Vt,"Webcom.avatarURL","Webcom.Authentication.avatarURL"),pe});var rn={code:"USER_DENIED",message:"The user aborted authentication"},on={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}},an={menubar:0,location:0,resizable:0,scrollbars:1,status:0,dialog:1,width:700,height:375};function un(t,e){var n=t.config[ve];return j(n.storage)?n.storage:Lt(t,"state",n)+e}function sn(t,e,n){at(function(){return t(e,n)})}function cn(){return k&&(Oe.get(this._oauthSessionKey)||Se.get(this._oauthSessionKey))}var ln=u(function t(n){e(this,t),this._logger=qt("api.Authentication",ve),this._logger.log("Initializing with options ".concat(JSON.stringify(n.config[ve]))),this._app=n,this._init(n)},[{key:"_init",value:function(t){var e=t.config[ve];Qt.call(this,e.baseUrl);var n=this._logger._count;this._currentState=function(t){try{return new ce(t.state,t.details)}catch(t){return le}}(function(t,e){var n=t.config[ve];return n.initialState||(E(n.storage)?{}:Se.get(un(t,e)))}(t,n)),this._authStateSetter=function(t,e){var n=t.config[ve];if(E(n.storage))return function(t){return n.storage(JSON.stringify(t))};var r=un(t,e);return function(t){return t&&!t.isUnauthenticated()?Se.set(r,t):Se.remove(r)}}(t,n),this._oauthSessionKey=Lt(t,"ongoing",e)+n,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,fe(e)}return t}(t),this._authStateSetter(this._currentState),this._notifyErrorOrAuthStateChanged(null,t))}},{key:"_resumeAuthState",value:function(){var t=this;if(k)if("popup"===Se.get(this._oauthSessionKey))document.body.style.display="none",Se.set(this._oauthSessionKey,De(location.search).__wcsession),window.close();else{var e=Oe.get(this._oauthSessionKey);if(e){var n=De(location.search).__wcsession;if(n)return void(this._oauthSessionPromise=this.resumeSession(n,e).finally(function(){delete t._oauthSessionPromise,Oe.remove(t._oauthSessionKey)}).catch(dt));Oe.remove(this._oauthSessionKey)}}this._logger.info("Authentication state resumed: %s",this.currentState.state),this._logger.log("Authentication details are: %o",this.currentState.details)}},{key:"getAccountDetails",value:function(){var t=[ve,"#removeIdentity"];try{W(t,arguments);var e=this._getCurrentAuthenticationDetails(t);return this._httpGet("accounts",e.uid).addHeader(Ze(e.webcomAuthToken)).send().then(function(t){for(var e={},n=0,r=Object.entries(t.body);n<r.length;n++){var i=l(r[n],2),o=i[0],a=i[1];switch(o){case"providers":for(var u={},s=0,c=Object.entries(a);s<c.length;s++){var h=l(c[s],2),f=h[0],d=h[1];u[f]=Object.keys(d)}e.identities=u;break;case"createdOn":e[o]=new Date(a);break;default:e[o]=a}}return e})}catch(t){return Promise.reject(t)}}},{key:"subscribe",value:function(t,e){return W([ve,"#subscribe"],arguments,B,T(z)),e?this._firstSubscriptions.push(t):this._lastSubscriptions.push(t),cn.call(this)?this._logger.log("Notification not sent, because an OAuth authentication is ongoing."):sn(t,null,this.currentState),t}},{key:"unsubscribe",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;W([ve,"#unsubscribe"],arguments,T(B),T(z));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.concat(this._lastSubscriptions).forEach(function(n){return sn(n,t,e)})}},{key:"authenticationRevoked",value:function(t,e){W([ve,"#authenticationRevoked"],arguments,U(ce),H);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 W("AuthenticationImpl#resumeSession",arguments,H,H),this._logger.info("fetching authentication state from an ongoing OAuth2 session..."),Xe(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(Ze(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(Qe.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(Xe.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($e.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(Ye.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,i=r.token,o=r.user;if(i)return o.webcomAuthToken=i,t.currentState=fe(o),new Promise(function(t){return at(function(){return t(o)})});throw ye({code:"UNEXPECTED_RESPONSE",message:"the 'token' property is missing."})}}},{key:"_notifyErrorFromHttpResponse",value:function(t){throw this._notifyErrorOrAuthStateChanged(t,null),t}},{key:"useCurrentContextForNextAuthOperation",value:function(){W([ve,"#useCurrentContextForNextAuthOperation"],arguments),this.isAuthContextual=!0}},{key:"useNewContextForNextAuthOperation",value:function(){W([ve,"#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){try{return W([ve,"#signInWithToken"],arguments,H),this._httpGet("decode").addHeader(Ze(t)).send().then(this._updateStateFromHttpResponse(function(e){var n=e.body;return{body:{token:t,user:n.data}}}),this._notifyErrorFromHttpResponse.bind(this))}catch(t){return Promise.reject(t)}}},{key:"signInAsGuest",value:function(){try{return W([ve,"#signInAsGuest"],arguments),this._httpPost("anonymous","signin").addAuthContext().send().then(this._updateStateFromHttpResponse(),this._notifyErrorFromHttpResponse.bind(this))}catch(t){return Promise.reject(t)}}},{key:"signInWithCredentials",value:function(t,e){try{return W([ve,"#signInWithCredentials"],arguments,H,J),this._httpPost(t,"signin").addAuthContext().addJson(e).send().then(this._updateStateFromHttpResponse(),this._notifyErrorFromHttpResponse.bind(this))}catch(t){return Promise.reject(t)}}},{key:"sendOtp",value:function(t,e,n){try{return W([ve,"#sendOtp"],arguments,H,H,T(J)),this._httpPost(t,"otps").addQueryParameters(n).addJson(e).send().then(function(t){return t.body})}catch(t){return Promise.reject(t)}}},{key:"signInWithCustomProvider",value:function(t,e){try{return W([ve,"#signInWithCustomProvider"],arguments,H,H),this._httpPost("custom.".concat(t),"signin").addAuthContext().addForm({token:e}).send().then(this._updateStateFromHttpResponse(),this._notifyErrorFromHttpResponse.bind(this))}catch(t){return Promise.reject(t)}}},{key:"signInWithOAuth",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{return W([ve,"#signInWithOAuth"],arguments,H,T(J)),e.mode=e.mode||"popup","code"===e.mode?this._loginViaOAuthCode(t,e):this._loginViaOAuth(t,e)}catch(t){return Promise.reject(t)}}},{key:"signInWithWassup",value:function(t){try{return W([ve,"#signInWithWassup"],arguments,J),this._httpPost("wassup","signin").addAuthContext().addForm(t).send().then(this._updateStateFromHttpResponse(),this._notifyErrorFromHttpResponse.bind(this))}catch(t){return Promise.reject(t)}}},{key:"signOut",value:function(){try{return W([ve,"#signOut"],arguments),this.currentState=le,new Promise(function(t){return at(function(){return t()})})}catch(t){return Promise.reject(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(cn.call(this))return this._oauthSessionPromise||Promise.reject(ye({code:"ONGOING_OAUTH",message:"An OAuth authentication is already ongoing"}));var n=!k||"redirect"===e.mode||k&&(window.navigator.userAgent.match(/CriOS|Twitter for iPhone|FBAN\/FBIOS|Windows Phone/)||window.navigator.standalone);e.token=this._contextAuthToken(),e.mode="redirect",!e.to&&k&&(e.to=location.href.replace(/[?&]__wcsession=[^&]+/,"")),!e.from&&k&&(e.from=Re()+Re()+Re()+Re());var r,i,o=e.from;e.from=(r=o,i=!0,je().codec.base64.fromBits(je().hash.sha256.hash(r),!1,i)),e.pm="2";var a=e.popupFeatures||{};delete e.popupFeatures;var u=Pe("".concat(this._authRoute,"/").concat(t,"/signin"),e);if(!n)return this._oauthLoginViaPopup(t,a,u,o);try{return k&&(Oe.set(this._oauthSessionKey,o),document.location=u),Promise.resolve(u)}catch(t){return Promise.reject(t)}}},{key:"_oauthLoginViaPopup",value:function(t,e,n,r){var i=this,o=Object.assign({},an,on[t],e),a=o.target||"_blank";delete o.target;var u=window.open(n,a,Object.entries(o).map(function(t){var e=l(t,2),n=e[0],r=e[1];return"".concat(n,"=").concat(r)}).join(","));return new Promise(function(t,e){if(u){Se.set(i._oauthSessionKey,"popup");var o=function(){u.close(),Se.remove(i._oauthSessionKey)};window.addEventListener("beforeunload",o);var a=lt(function(){if(u.closed){ft(a),window.removeEventListener("beforeunload",o);var n=Se.get(i._oauthSessionKey);o(),"popup"===n?e(ye(rn)):t(i.resumeSession(n,r))}},250)}else e(ye(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]:{};try{return W([ve,"#addIdentity"],arguments,H,J,T(J)),this._httpPost(t,"identities").addAuthContext().addQueryParameters(n).addJson(e).send().then(function(t){return t.body})}catch(t){return Promise.reject(t)}}},{key:"removeIdentity",value:function(){var t=[ve,"#removeIdentity"];try{W(t,arguments);var e=this._getCurrentAuthenticationDetails(t);return this._httpDelete(e.provider,"identities",e.providerUid).addHeader(Ze(e.webcomAuthToken)).send().then(function(){})}catch(t){return Promise.reject(t)}}},{key:"removeAccount",value:function(){var t=[ve,"#removeAccount"];try{W(t,arguments);var e=this._getCurrentAuthenticationDetails(t);return this._httpDelete("accounts",e.uid).addHeader(Ze(e.webcomAuthToken)).send().then(function(){})}catch(t){return Promise.reject(t)}}},{key:"verifyIdentity",value:function(t,e,n){try{return W([ve,"#verifyIdentity"],arguments,H,H,J),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))}catch(t){return Promise.reject(t)}}},{key:"updateIdentityProfile",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=[ve,"#updateIdentityProfile"];try{W(n,arguments,N,T(H));var r=this._getCurrentAuthenticationDetails(n);return this._httpPut(r.provider,"identities",r.providerUid,"providerProfile",e).addHeader(Ze(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 ye({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){try{return W([ve,"#updatePassword"],arguments,H,H,H),this._httpPut("password","identities",t,"password").addForm({password:e,newPassword:n}).send().then(function(t){return t.body})}catch(t){return Promise.reject(t)}}},{key:"sendPasswordResetCode",value:function(t,e){var n=arguments