@tonysamperi/ts-mapi-core 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.2.0
2
+ * Add smpRxjsCatchOnly operator
3
+
1
4
  ## 1.1.0
2
5
  * Expose SmpErrorResponseCreateOpts
3
6
 
@@ -1,2 +1,2 @@
1
- "use strict";var Ue=Object.defineProperty;var kt=Object.getOwnPropertyDescriptor;var Dr=Object.getOwnPropertyNames;var Mr=Object.prototype.hasOwnProperty;var R=(n,e)=>()=>(n&&(e=n(n=0)),e);var Fe=(n,e)=>{for(var t in e)Ue(n,t,{get:e[t],enumerable:!0})},Sr=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Dr(e))!Mr.call(n,s)&&s!==t&&Ue(n,s,{get:()=>e[s],enumerable:!(r=kt(e,s))||r.enumerable});return n};var xe=n=>Sr(Ue({},"__esModule",{value:!0}),n),S=(n,e,t,r)=>{for(var s=r>1?void 0:r?kt(e,t):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&Ue(e,t,s),s};var Ne,Ut=R(()=>{"use strict";Ne=class{get sessionId(){return this._sessionId||this._storage.getItem(this._sessionIdKey)||void 0}constructor(e="lggr_sid"){this._sessionIdKey=e,this._storage=this._getStorage(),this._sessionId=this.sessionId||this._generateSessionId()}_generateSessionId(){let e=this._generateUUID();return this._storage.setItem(this._sessionIdKey,e),e}_generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}_getStorage(){try{if(typeof window<"u"&&typeof window.sessionStorage==typeof isNaN)return sessionStorage}catch(e){console.warn(`${this.constructor.name}: error while checking sessionStorage`,e)}return{getItem:()=>null,setItem:()=>null,removeItem:()=>null,clear:()=>null}}}});var k,rt=R(()=>{"use strict";(function(n){n[n.OFF=0]="OFF",n[n.ERROR=1]="ERROR",n[n.WARN=2]="WARN",n[n.INFO=3]="INFO",n[n.LOG=4]="LOG",n[n.DEBUG=5]="DEBUG"})(k||(k={}))});function T(){}var De=R(()=>{"use strict"});var st,j,it=R(()=>{"use strict";De();st=class{constructor(){this.group=T,this.groupCollapsed=T,this.groupEnd=T,this.time=T,this.timeEnd=T}},j=class n extends st{constructor(){super(...arguments),this.debug=T,this.error=T,this.info=T,this.log=T,this.warn=T}static describe(){return Object.getOwnPropertyNames(new n).map(e=>e)}}});var Ft,Me,se,Nt=R(()=>{"use strict";Ut();rt();it();De();Me="[DEFAULT]",se=class extends j{static get INSTANCE(){return this.get(Me)}static get INSTANCES(){return this._instances.keys()}static get NOOP_INSTANCE(){return this._noopInstance}get activeLevels(){return Object.values(k).filter(e=>+e>k.OFF&&+e<=this.level).map(e=>k[e])}get appName(){return this._appName}get currentConfig(){return{level:this.level,enableSessionId:this.enableSessionId,enablePreprocessing:this.enablePreprocessing,sensitiveProps:this._sensitiveProps}}get enablePreprocessing(){return this.preprocessArgs!==this._noopPreprocessArgs}get enableSessionId(){return!!this.sessionId}get level(){return this.constructor._level}get sessionId(){return this._sessionId}constructor(e){super(),this._sensitivePropMask="*****",this._sessionManager=new Ne,this._loadConfig(e)}static destroy(e){return this._instances.delete(e)}static get(e=Me){return this._instances.get(e)||this._instances.get(Me)||this._noopInstance}static init(e,t=Me){let r;if(this._instances.has(t)){r=this.get(t);let s=r.currentConfig;r._loadConfig(Object.assign(Object.assign({},s),e))}else this._instances.set(t,new this(e)),r=this.get(t),r._appName=t;return r}static pop(e){let t=this.get(e);return this.destroy(e),t}destroy(){return this.constructor.destroy(this.appName)}filterSensitiveData(e){if(e===null||typeof e!="object"||Array.isArray(e)||e.constructor!==Object)return e;let t={};for(let r in e){let s=e[r];if(!Object.prototype.hasOwnProperty.call(e,r)||s===null||s===void 0){t[r]=s;continue}if(this._sensitiveProps.includes(r)){t[r]=this._sensitivePropMask;continue}t[r]=this.filterSensitiveData(s)}return t}preprocessArgs(e,...t){return this._defaultPreprocessArgs.apply(this,[e,...t])}_defaultPreprocessArgs(e,...t){let r=new Date;return[`${r.toISOString()}`,`${t.shift()}`.trim(),...t.map(s=>({tags:[this._appName,`level-${k[this.level]}`,e],timestamp:+r,sessionId:this.sessionId,metadata:this.filterSensitiveData(s)}))]}_loadConfig({sensitiveProps:e=[],level:t=k.OFF,enablePreprocessing:r=!1,enableSessionId:s=!1}){this._sensitiveProps=[...e,"pwd","password","buffer","token","accessToken","refreshToken"],this.preprocessArgs=r?this.preprocessArgs:this._noopPreprocessArgs,this._sessionId=s?this._sessionManager.sessionId:void 0,this._updateLevel(t)}_noopPreprocessArgs(...e){return e}_setup(e){let t=this.preprocessArgs.bind(this);this.activeLevels.forEach(r=>{let s=`${r}`.toLowerCase();typeof e[s]==typeof isNaN&&(this[s]=function(...i){e[s].apply(e,t.apply(null,[s,...i]))})}),this.level>k.OFF&&console&&(console.group&&console.groupEnd&&(this.group=console.group.bind(console),this.groupEnd=console.groupEnd.bind(console)),console.groupCollapsed&&(this.groupCollapsed=console.groupCollapsed.bind(console)),console.time&&console.timeEnd&&(this.time=console.time.bind(console),this.timeEnd=console.timeEnd.bind(console)))}_updateLevel(e=k.WARN){this.constructor.describe().forEach(t=>{this[t]=T}),this.constructor._level=e,console&&this._setup(console)}};Ft=se;se._instances=new Map;se._level=k.OFF;se._noopInstance=new Ft({level:k.OFF})});var Dt=R(()=>{"use strict"});var Mt=R(()=>{"use strict"});var St=R(()=>{"use strict";Dt();Mt();it();rt();De()});var Ee=R(()=>{"use strict";Nt();St()});var zt,Lr=R(()=>{"use strict";zt=(r=>(r.APPLE="APPLE",r.FACEBOOK="FACEBOOK",r.GOOGLE="GOOGLE",r))(zt||{})});var Kt,zr=R(()=>{"use strict";Kt=(t=>(t.POPUP="POPUP",t.REDIRECT="REDIRECT",t))(Kt||{})});var He,er=R(()=>{"use strict";He=(p=>(p.DIFFERENT_CREDENTIAL="auth/account-exists-with-different-credential",p.DIFFERENT_CREDENTIAL_APPLE="auth/account-exists-with-different-credential/apple",p.DIFFERENT_CREDENTIAL_FACEBOOK="auth/account-exists-with-different-credential/facebook",p.DIFFERENT_CREDENTIAL_GOOGLE="auth/account-exists-with-different-credential/google",p.EMAIL_EXISTS="auth/email-already-exists",p.INVALID_ACTION_CODE="auth/invalid-action-code",p.POPUP_BLOCKED="auth/popup-blocked",p.POPUP_CLOSED_BY_USER="auth/popup-closed-by-user",p.USER_NOT_FOUND="auth/user-not-found",p.WRONG_PASSWORD="auth/wrong-password",p))(He||{})});function Je(n=fs){return e=>e.pipe((0,xr.map)(t=>{if(~gs.indexOf(JSON.stringify(t)))throw n(t);return t}))}var xr,gs,fs,xt=R(()=>{"use strict";xr=require("rxjs");gs=[void 0,null,!1,0,"","0",[],{}].map(n=>JSON.stringify(n)),fs=()=>new Error});function Er(n,e){return t=>t.pipe((0,Ye.filter)(r=>!n(r)),(0,Ye.defaultIfEmpty)(!1),Je(e))}var Ye,Rr=R(()=>{"use strict";Ye=require("rxjs");xt()});var Et={};Fe(Et,{smpRxjsThrowIfEmpty:()=>Je,smpRxjsThrowOnCondition:()=>Er});var Rt=R(()=>{"use strict";xt();Rr()});var Tr={};Fe(Tr,{SmpDynamoService:()=>bt});var br,et,Qe,bt,Ir=R(()=>{"use strict";br=require("@aws-sdk/client-dynamodb"),et=require("@aws-sdk/util-dynamodb");Ee();Qe=(s=>(s.CouldNotDelete="ERR_COULD_NOT_DELETE",s.CouldNotRead="ERR_COULD_NOT_READ",s.CouldNotWrite="ERR_COULD_NOT_WRITE",s.ConditionalCheckFailedException="ERR_DUPE_TOKEN",s))(Qe||{}),bt=class{constructor(e,t){this._config=e;this._tableName=t;this._db=new br.DynamoDB([this._buildConfig()]);this._logger=new j}get marshall(){return et.marshall}get unmarshall(){return et.unmarshall}_buildConfig(){return this._config}_delete(e,t=this._tableName,r){let s={TableName:t,Key:this.marshall(e),...r};return this._db.deleteItem(s).catch(i=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",i),Promise.reject(Qe[i.code]||"ERR_COULD_NOT_DELETE")))}_read(e,t=this._tableName,r){let s={TableName:t,Key:this.marshall(e),...r};return this._db.getItem(s).catch(i=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",i),Promise.reject(Qe[i.code]||"ERR_COULD_NOT_READ")))}_write(e,t=this._tableName,r){let s={TableName:t,Item:this.marshall(e),...r};return this._db.putItem(s).catch(i=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",i),Promise.reject(Qe[i.code]||"ERR_COULD_NOT_WRITE")))}}});var Ar={};Fe(Ar,{SmpFirebaseService:()=>Tt});var ke,m,Tt,Or=R(()=>{"use strict";Ee();ke=require("firebase/app"),m=require("firebase/auth");er();Tt=class n{constructor(e,t){this._enabledSocials=[];this._popupErrors=0;this._socialLoginUxMode="POPUP";this._config=e,this._enabledSocials=t.enabledSocials||[],this._socialLoginUxMode=t.socialLoginUxMode||"POPUP",this._popupFallsBackToRedirect=!!t.popupFallsBackToRedirect,this._buildProviders(),this._logger=t.logger||new j,this._app=(0,ke.getApps)().length?(0,ke.getApps)()[0]:(0,ke.initializeApp)(e),this._watchAuthState()}static get instance(){if(!(this._instance instanceof n))throw Error(`${this.constructor.name} instance doesn't exist! Call ${this.constructor.name}.init first!`);return this._instance}get config(){return this._config}get enabledSocials(){return this._enabledSocials}get loggedUser(){return this._loggedUser||(this._loggedUser=this._readStoredUser()),this._auth.currentUser||this._loggedUser||void 0}get providersRelation(){return{"facebook.com":"FACEBOOK","google.com":"GOOGLE","apple.com":"APPLE"}}get socialLoginUXMode(){return this._socialLoginUxMode}get storedUserKey(){return"firebaseUser"}get _auth(){return(0,m.getAuth)(this._app)}static init(e,t){return this._instance||(this._instance=new n(e,t)),this._instance}addAuthStateChangedCallback(e){return this._auth.onAuthStateChanged(t=>{e(t||this.loggedUser||null)})}checkActionCode(e){return(0,m.checkActionCode)(this._auth,e)}confirmPasswordReset(e,t){return(0,m.confirmPasswordReset)(this._auth,e,t)}fetchSignInMethodsForEmail(e){return(0,m.fetchSignInMethodsForEmail)(this._auth,e).then(t=>t.map(r=>this.providersRelation[r]||r))}getRedirectResult(){return(0,m.getRedirectResult)(this._auth).catch(async e=>(await this._expandDifferentCredential(e),Promise.reject(e)))}initAppCheck(){}sendEmailVerification(e){if(!this.loggedUser)throw Error("Firebase: user is not logged!");return(0,m.sendEmailVerification)(this.loggedUser,e?{url:e}:void 0)}sendPasswordResetEmail(e,t){return(0,m.sendPasswordResetEmail)(this._auth,e,{url:t})}setPersistence(e){return(0,m.setPersistence)(this._auth,e?m.browserLocalPersistence:m.browserSessionPersistence)}signInWithCustomToken(e){return(0,m.signInWithCustomToken)(this._auth,e)}signInWithEmailAndPassword(e,t){return(0,m.signInWithEmailAndPassword)(this._auth,e,t).then(async r=>r.user)}signInWithSocialProvider(e){if(!this._providers[e])throw Error(`Firebase: invalid social key provided! Expected one of ${this.enabledSocials}, got ${e}`);return this._signInWithProvider(this._providers[e])}signOut(){return(0,m.signOut)(this._auth)}updatePassword(e,t){if(!this.loggedUser)throw Error("Firebase: user is not logged!");let r=m.EmailAuthProvider.credential(this.loggedUser.email,e);return(0,m.reauthenticateWithCredential)(this.loggedUser,r).then(()=>(0,m.updatePassword)(this.loggedUser,t))}updateUserProfile(e){if(!this.loggedUser)throw Error("Firebase: user is not logged!");return(0,m.updateProfile)(this.loggedUser,e)}async verifyIdToken(){return this._auth.currentUser?.getIdTokenResult()}_buildProviders(){this._providers=this._enabledSocials.reduce((e,t)=>(t in e&&(e[t]=e[t]),e),{APPLE:new m.OAuthProvider("apple.com"),FACEBOOK:new m.FacebookAuthProvider().setCustomParameters({prompt:"select_account"}),GOOGLE:new m.GoogleAuthProvider().setCustomParameters({prompt:"select_account"})})}async _expandDifferentCredential(e){if(e?.code==="auth/account-exists-with-different-credential"){let t=await this.fetchSignInMethodsForEmail(e.customData.email);throw e.code=He["DIFFERENT_CREDENTIAL_"+t[0]],e}}_readStoredUser(){try{let e=localStorage.getItem(this.storedUserKey);if(e){this._logger?.debug("Firebase: found local user",e);let t=JSON.parse(e);return{...t,getIdToken:()=>Promise.resolve(t.stsTokenManager.accessToken)}}}catch(e){this._logger.debug("Firebase: error while getting stored user",e)}}async _signInWithProvider(e,t=this.socialLoginUXMode){return(t==="POPUP"?m.signInWithPopup:m.signInWithRedirect)(this._auth,e).then(s=>(this._logger.info(`Firebase: signin with provider ${e.providerId} was successful`),s.user)).catch(async s=>s?.code==="auth/popup-blocked"&&(this._logger.warn(`Firebase: social signin popup blocked (${++this._popupErrors}`),this._popupFallsBackToRedirect&&this._popupErrors>1)?(this._popupErrors=0,this._signInWithProvider(e,"REDIRECT")):(this._logger.error(`Firebase: sign in with ${e.providerId} errored`,s),await this._expandDifferentCredential(s),Promise.reject(s)))}_updateLocalUser(e){try{e?localStorage.setItem(this.storedUserKey,JSON.stringify(e)):localStorage.removeItem(this.storedUserKey),this._logger.debug("Firebase: updating local user",e),this._loggedUser=e}catch(t){this._logger.warn("Firebase: couldn't update local user",{user:e,error:t})}}_watchAuthState(){this._auth.onAuthStateChanged(e=>{this._logger.debug("Firebase: firebase detected auth state change",e),this._updateLocalUser(e||void 0)})}}});var us={};Fe(us,{SMP_HEALTHZ:()=>jr,SmpAesCrypt:()=>me,SmpApiCommonUtils:()=>ot,SmpBrowserCache:()=>Pe,SmpCommonUtils:()=>ft,SmpCrypto:()=>Ve,SmpErrorResponse:()=>X,SmpFilterException:()=>mt,SmpFirebaseErrors:()=>He,SmpGenericResponse:()=>Re,SmpGiftcardTransaction:()=>Ze,SmpGiftcardTransactionHashStrategies:()=>Yt,SmpGiftcardTransactionOps:()=>Jt,SmpHttpService:()=>yt,SmpHttpSessionStorageCache:()=>Ce,SmpHttpStatusCodes:()=>Ht,SmpInMemoryCache:()=>Be,SmpMarketingCloudValidators:()=>Qt,SmpRegularExpressions:()=>wt,SmpResponseMessage:()=>N,SmpResponseMessageTypes:()=>jt,SmpRestVerbs:()=>Lt,SmpSecureCode:()=>Xe,SmpSid:()=>_t,SmpSocialSignInKeys:()=>zt,SmpSocialSignInUxModes:()=>Kt,VERSION:()=>ms,smpNoop:()=>T});module.exports=xe(us);Ee();var ot=class{static{this._javascriptVariablePattern="[a-zA-Z_$][a-zA-Z_$0-9]*"}static{this._logger=new j}static{this._pathParamRegex=new RegExp(`\\{(${this._javascriptVariablePattern})\\}`,"g")}static credentialsToBasicAuth(e,t){return`Basic ${Buffer.from(`${e}:${t}`).toString("base64")}`}static fromBearer(e=""){return e.split(" ")[1]}static getCountryFromReferer(e){return this.getLocaleFromReferer(e)?.split("-")[0]?.toUpperCase()}static getLanguageFromReferer(e){return this.getLocaleFromReferer(e)?.split("-")[1]}static getLocaleFromReferer(e){return e?.match(/\/([A-Z]{2}-[A-Z]{2})\//i)?.[1]}static interpolateParams(e,t){try{return e.replace(this._pathParamRegex,(r,s)=>{let i=t[s];return i!==void 0?encodeURIComponent(i):r})}catch(r){this._logger.warn("KikApiCommonUtils: couldn't interpolate params",r)}return e}};var be=require("class-transformer");var V=require("class-transformer");var nt=require("class-transformer");var jt=(s=>(s.INFO="INFO",s.SUCCESS="SUCCESS",s.WARNING="WARNING",s.ERROR="ERROR",s))(jt||{});var ie=class ie{constructor(e,t="ERROR"){this._message=e;this._type=t}get message(){return this._message}get type(){return this._type}static sanitizeMessages(e){return typeof e=="string"?e.length?[new ie(e)]:[]:[e].flat().map(t=>typeof t=="string"?new ie(t):t)}};S([(0,nt.Expose)()],ie.prototype,"message",1),S([(0,nt.Expose)()],ie.prototype,"type",1);var N=ie;var oe=class oe{constructor(e=[],t){this._messages=e;this.data=t}set messages(e){this._messages=N.sanitizeMessages(e)}get messages(){return this._messages}static buildInfo(e,t){return new oe([e].flat().map(r=>new N(r,"INFO")),t)}static buildSuccess(e,t){return new oe([e].flat().map(r=>new N(r,"SUCCESS")),t)}static fromPlain(e){return(0,V.plainToInstance)(oe,e)}isError(){return!this.isSuccess()}isSuccess(){return"_errorCode"in this&&this._errorCode!==null&&this._errorCode!==void 0}serialize(){return(0,V.instanceToPlain)(this,{excludePrefixes:["_"]})}};S([(0,V.Expose)(),(0,V.Transform)(({value:e})=>e?.length?e:void 0)],oe.prototype,"messages",1);var Re=oe;function at(){return[new N("GENERIC_ERROR")]}var J=class J extends Re{constructor(t=at(),r="GENERIC_ERROR",s=500,i){super(t,i);this._errorCode=r;this._status=s;this._timestamp=Date.now()}get errorCode(){return this._errorCode}get status(){return this._status}get timestamp(){return this._timestamp}static build(t=at(),r,s,i){return new J(N.sanitizeMessages(t),r,s,i)}static create({messages:t=at(),...r}){return new J(N.sanitizeMessages(t),r.errorCode,r.status,r.data)}static fromPlain(t){let r=(0,be.plainToInstance)(ct,t,{excludePrefixes:["_"]}),s=new J;return Object.getOwnPropertyNames(r).forEach(i=>{i in s&&(s[i]=r[i])}),s}};S([(0,be.Expose)()],J.prototype,"errorCode",1),S([(0,be.Expose)()],J.prototype,"timestamp",1);var X=J,ct=class extends X{set errorCode(e){this._errorCode=e}set status(e){this._status=e}set timestamp(e){this._timestamp=e}};var jr={status:"OK"};var Lt=(i=>(i.GET="GET",i.POST="POST",i.PUT="PUT",i.DELETE="DELETE",i.PATCH="PATCH",i))(Lt||{});var L=class{static parse(e){let t=e.length,r=[];for(let s=0;s<t;s+=2)r[s>>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new _(r,t/2)}static stringify(e){let t=[];for(let r=0;r<e.sigBytes;r++){let s=e.words[r>>>2]>>>24-r%4*8&255;t.push((s>>>4).toString(16)),t.push((s&15).toString(16))}return t.join("")}};var _=class n{constructor(e,t){this.words=e||[],t!==void 0?this.sigBytes=t:this.sigBytes=this.words.length*4}static random(e){let t=[],r=function(s){let i=987654321,o=4294967295;return function(){i=36969*(i&65535)+(i>>16)&o,s=18e3*(s&65535)+(s>>16)&o;let a=(i<<16)+s&o;return a/=4294967296,a+=.5,a*(Math.random()>.5?1:-1)}};for(let s=0,i;s<e;s+=4){let o=r((i||Math.random())*4294967296);i=o()*987654071,t.push(o()*4294967296|0)}return new n(t,e)}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new n(this.words.slice(0),this.sigBytes)}concat(e){if(this.clamp(),this.sigBytes%4)for(let t=0;t<e.sigBytes;t++){let r=e.words[t>>>2]>>>24-t%4*8&255;this.words[this.sigBytes+t>>>2]|=r<<24-(this.sigBytes+t)%4*8}else for(let t=0;t<e.sigBytes;t+=4)this.words[this.sigBytes+t>>>2]=e.words[t>>>2];return this.sigBytes+=e.sigBytes,this}toString(e){return(e||L).stringify(this)}};var ne=class{static parse(e){let t=e.length,r=[];for(let s=0;s<t;s++)r[s>>>2]|=(e.charCodeAt(s)&255)<<24-s%4*8;return new _(r,t)}static stringify(e){let t=[];for(let r=0;r<e.sigBytes;r++){let s=e.words[r>>>2]>>>24-r%4*8&255;t.push(String.fromCharCode(s))}return t.join("")}};var b=class{static parse(e){return ne.parse(unescape(encodeURIComponent(e)))}static stringify(e){try{return decodeURIComponent(escape(ne.stringify(e)))}catch(t){throw console.error("Malformed UTF-8 data",t),new Error("Malformed UTF-8 data")}}};var ae=class{constructor(e){this._minBufferSize=0,this.cfg=Object.assign({blockSize:1},e),this._data=new _,this._nDataBytes=0}clone(){let e=this.constructor();for(let t in this)Object.prototype.hasOwnProperty.call(this,t)&&(e[t]=this[t]);return e._data=this._data.clone(),e}reset(){this._data=new _,this._nDataBytes=0}_append(e){typeof e=="string"&&(e=b.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}_process(e){if(!this.cfg.blockSize)throw new Error("missing blockSize in config");let t=this.cfg.blockSize*4,r=this._data.sigBytes/t;e?r=Math.ceil(r):r=Math.max((r|0)-this._minBufferSize,0);let s=r*this.cfg.blockSize,i=Math.min(s*4,this._data.sigBytes),o;if(s){for(let a=0;a<s;a+=this.cfg.blockSize)this._doProcessBlock(this._data.words,a);o=this._data.words.splice(0,s),this._data.sigBytes-=i}return new _(o,i)}};var q=class{constructor(e){this.ciphertext=e.ciphertext,this.key=e.key,this.iv=e.iv,this.salt=e.salt,this.algorithm=e.algorithm,this.mode=e.mode,this.padding=e.padding,this.blockSize=e.blockSize,this.formatter=e.formatter}extend(e){return e.ciphertext!==void 0&&(this.ciphertext=e.ciphertext),e.key!==void 0&&(this.key=e.key),e.iv!==void 0&&(this.iv=e.iv),e.salt!==void 0&&(this.salt=e.salt),e.algorithm!==void 0&&(this.algorithm=e.algorithm),e.mode!==void 0&&(this.mode=e.mode),e.padding!==void 0&&(this.padding=e.padding),e.blockSize!==void 0&&(this.blockSize=e.blockSize),e.formatter!==void 0&&(this.formatter=e.formatter),this}toString(e){if(e)return e.stringify(this);if(this.formatter)return this.formatter.stringify(this);throw new Error("cipher needs a formatter to be able to convert the result into a string")}};var D=class{static parse(e){let t=e.length;if(this._reverseMap===void 0){this._reverseMap=[];for(let s=0;s<this._map.length;s++)this._reverseMap[this._map.charCodeAt(s)]=s}let r=this._map.charAt(64);if(r){let s=e.indexOf(r);s!==-1&&(t=s)}return this.parseLoop(e,t,this._reverseMap)}static parseLoop(e,t,r){let s=[],i=0;for(let o=0;o<t;o++)if(o%4){let a=r[e.charCodeAt(o-1)]<<o%4*2,h=r[e.charCodeAt(o)]>>>6-o%4*2;s[i>>>2]|=(a|h)<<24-i%4*8,i++}return new _(s,i)}static stringify(e){e.clamp();let t=[];for(let s=0;s<e.sigBytes;s+=3){let i=e.words[s>>>2]>>>24-s%4*8&255,o=e.words[s+1>>>2]>>>24-(s+1)%4*8&255,a=e.words[s+2>>>2]>>>24-(s+2)%4*8&255,h=i<<16|o<<8|a;for(let g=0;g<4&&s+g*.75<e.sigBytes;g++)t.push(this._map.charAt(h>>>6*(3-g)&63))}let r=this._map.charAt(64);if(r)for(;t.length%4;)t.push(r);return t.join("")}};D._map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";D._reverseMap=void 0;var ce=class{static parse(e){let t=D.parse(e),r;return t.words[0]===1398893684&&t.words[1]===1701076831&&(r=new _(t.words.slice(2,4)),t.words.splice(0,4),t.sigBytes-=16),new q({ciphertext:t,salt:r})}static stringify(e){if(!e.ciphertext)throw new Error("missing ciphertext in params");let t=e.ciphertext,r=e.salt,s;if(r){if(typeof r=="string")throw new Error("salt is expected to be a WordArray");s=new _([1398893684,1701076831]).concat(r).concat(t)}else s=t;return s.toString(D)}};var K=class{static decrypt(e,t,r,s){let i=Object.assign({},this.cfg,s);if(!i.format)throw new Error("could not determine format");if(t=this._parse(t,i.format),!t.ciphertext)throw new Error("could not determine ciphertext");return e.createDecryptor(r,i).finalize(t.ciphertext)}static encrypt(e,t,r,s){let i=Object.assign({},this.cfg,s),o=e.createEncryptor(r,i),a=o.finalize(t);return new q({ciphertext:a,key:r,iv:o.cfg.iv,algorithm:e,mode:o.cfg.mode,padding:o.cfg.padding,blockSize:o.cfg.blockSize,formatter:i.format})}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};K.cfg={blockSize:4,iv:new _([]),format:ce};var x=class extends ae{constructor(e){super(Object.assign({blockSize:512/32},e)),this.reset()}static _createHelper(e){function t(r,s){return new e(s).finalize(r)}return t}finalize(e){return e&&this._append(e),this._doFinalize()}update(e){return this._append(e),this._process(),this}};var d=[];for(let n=0;n<64;n++)d[n]=Math.abs(Math.sin(n+1))*4294967296|0;var M=class n extends x{get hash(){return this._hash}static FF(e,t,r,s,i,o,a){let h=e+(t&r|~t&s)+i+a;return(h<<o|h>>>32-o)+t}static GG(e,t,r,s,i,o,a){let h=e+(t&s|r&~s)+i+a;return(h<<o|h>>>32-o)+t}static HH(e,t,r,s,i,o,a){let h=e+(t^r^s)+i+a;return(h<<o|h>>>32-o)+t}static II(e,t,r,s,i,o,a){let h=e+(r^(t|~s))+i+a;return(h<<o|h>>>32-o)+t}reset(){super.reset(),this._hash=new _([1732584193,4023233417,2562383102,271733878])}_doFinalize(){let e=this._nDataBytes*8,t=this._data.sigBytes*8;this._data.words[t>>>5]|=128<<24-t%32;let r=Math.floor(e/4294967296),s=e;this._data.words[(t+64>>>9<<4)+15]=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360,this._data.words[(t+64>>>9<<4)+14]=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,this._data.sigBytes=(this._data.words.length+1)*4,this._process();for(let i=0;i<4;i++)this._hash.words[i]=(this._hash.words[i]<<8|this._hash.words[i]>>>24)&16711935|(this._hash.words[i]<<24|this._hash.words[i]>>>8)&4278255360;return this._hash}_doProcessBlock(e,t){for(let h=0;h<16;h++){let g=t+h,p=e[g];e[g]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360}let r=Array.from({length:16});for(let h=0;h<16;h++)r[h]=e[t+h];let s=this._hash.words[0],i=this._hash.words[1],o=this._hash.words[2],a=this._hash.words[3];s=n.FF(s,i,o,a,r[0],7,d[0]),a=n.FF(a,s,i,o,r[1],12,d[1]),o=n.FF(o,a,s,i,r[2],17,d[2]),i=n.FF(i,o,a,s,r[3],22,d[3]),s=n.FF(s,i,o,a,r[4],7,d[4]),a=n.FF(a,s,i,o,r[5],12,d[5]),o=n.FF(o,a,s,i,r[6],17,d[6]),i=n.FF(i,o,a,s,r[7],22,d[7]),s=n.FF(s,i,o,a,r[8],7,d[8]),a=n.FF(a,s,i,o,r[9],12,d[9]),o=n.FF(o,a,s,i,r[10],17,d[10]),i=n.FF(i,o,a,s,r[11],22,d[11]),s=n.FF(s,i,o,a,r[12],7,d[12]),a=n.FF(a,s,i,o,r[13],12,d[13]),o=n.FF(o,a,s,i,r[14],17,d[14]),i=n.FF(i,o,a,s,r[15],22,d[15]),s=n.GG(s,i,o,a,r[1],5,d[16]),a=n.GG(a,s,i,o,r[6],9,d[17]),o=n.GG(o,a,s,i,r[11],14,d[18]),i=n.GG(i,o,a,s,r[0],20,d[19]),s=n.GG(s,i,o,a,r[5],5,d[20]),a=n.GG(a,s,i,o,r[10],9,d[21]),o=n.GG(o,a,s,i,r[15],14,d[22]),i=n.GG(i,o,a,s,r[4],20,d[23]),s=n.GG(s,i,o,a,r[9],5,d[24]),a=n.GG(a,s,i,o,r[14],9,d[25]),o=n.GG(o,a,s,i,r[3],14,d[26]),i=n.GG(i,o,a,s,r[8],20,d[27]),s=n.GG(s,i,o,a,r[13],5,d[28]),a=n.GG(a,s,i,o,r[2],9,d[29]),o=n.GG(o,a,s,i,r[7],14,d[30]),i=n.GG(i,o,a,s,r[12],20,d[31]),s=n.HH(s,i,o,a,r[5],4,d[32]),a=n.HH(a,s,i,o,r[8],11,d[33]),o=n.HH(o,a,s,i,r[11],16,d[34]),i=n.HH(i,o,a,s,r[14],23,d[35]),s=n.HH(s,i,o,a,r[1],4,d[36]),a=n.HH(a,s,i,o,r[4],11,d[37]),o=n.HH(o,a,s,i,r[7],16,d[38]),i=n.HH(i,o,a,s,r[10],23,d[39]),s=n.HH(s,i,o,a,r[13],4,d[40]),a=n.HH(a,s,i,o,r[0],11,d[41]),o=n.HH(o,a,s,i,r[3],16,d[42]),i=n.HH(i,o,a,s,r[6],23,d[43]),s=n.HH(s,i,o,a,r[9],4,d[44]),a=n.HH(a,s,i,o,r[12],11,d[45]),o=n.HH(o,a,s,i,r[15],16,d[46]),i=n.HH(i,o,a,s,r[2],23,d[47]),s=n.II(s,i,o,a,r[0],6,d[48]),a=n.II(a,s,i,o,r[7],10,d[49]),o=n.II(o,a,s,i,r[14],15,d[50]),i=n.II(i,o,a,s,r[5],21,d[51]),s=n.II(s,i,o,a,r[12],6,d[52]),a=n.II(a,s,i,o,r[3],10,d[53]),o=n.II(o,a,s,i,r[10],15,d[54]),i=n.II(i,o,a,s,r[1],21,d[55]),s=n.II(s,i,o,a,r[8],6,d[56]),a=n.II(a,s,i,o,r[15],10,d[57]),o=n.II(o,a,s,i,r[6],15,d[58]),i=n.II(i,o,a,s,r[13],21,d[59]),s=n.II(s,i,o,a,r[4],6,d[60]),a=n.II(a,s,i,o,r[11],10,d[61]),o=n.II(o,a,s,i,r[2],15,d[62]),i=n.II(i,o,a,s,r[9],21,d[63]),this._hash.words[0]=this._hash.words[0]+s|0,this._hash.words[1]=this._hash.words[1]+i|0,this._hash.words[2]=this._hash.words[2]+o|0,this._hash.words[3]=this._hash.words[3]+a|0}};var Te=class n{constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:M,iterations:1},e)}static execute(e,t,r){return new n(r).compute(e,t)}compute(e,t){let r=new this.cfg.hasher,s=new _,i;for(;s.words.length<this.cfg.keySize;){i&&r.update(i),i=r.update(e).finalize(t),r.reset();for(let o=1;o<this.cfg.iterations;o++)i=r.finalize(i),r.reset();s.concat(i)}return s.sigBytes=this.cfg.keySize*4,s}};var Se=class{static execute(e,t,r,s){s||(s=_.random(64/8));let i=new Te({keySize:t+r}).compute(e,s),o=new _(i.words.slice(t),r*4);return i.sigBytes=t*4,new q({key:i,iv:o,salt:s})}};var he=class{static decrypt(e,t,r,s){let i=Object.assign({},this.cfg,s);if(i.format===void 0)throw new Error("missing format in config");if(t=this._parse(t,i.format),i.kdf===void 0)throw new Error("the key derivation function must be set");let o=i.kdf.execute(r,e.keySize,e.ivSize,t.salt);return o.iv!==void 0&&(i.iv=o.iv),K.decrypt.call(this,e,t,o.key,i)}static encrypt(e,t,r,s){let i=Object.assign({},this.cfg,s);if(i.kdf===void 0)throw new Error("missing kdf in config");let o=i.kdf.execute(r,e.keySize,e.ivSize);return o.iv!==void 0&&(i.iv=o.iv),K.encrypt.call(this,e,t,o.key,i).extend(o)}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};he.cfg={blockSize:4,iv:new _([]),format:ce,kdf:Se};var je=class{constructor(e){this._cipher=e}decrypt(e,t,r){return typeof t=="string"?he.decrypt(this._cipher,e,t,r):K.decrypt(this._cipher,e,t,r)}encrypt(e,t,r){return typeof t=="string"?he.encrypt(this._cipher,e,t,r):K.encrypt(this._cipher,e,t,r)}};var Z=class extends ae{constructor(e,t,r){super(Object.assign({blockSize:1},r)),this._xformMode=e,this._key=t,this.reset()}static _createHelper(e){return new je(e)}static createDecryptor(e,t){let r=this;return new r(this._DEC_XFORM_MODE,e,t)}static createEncryptor(e,t){return new this(this._ENC_XFORM_MODE,e,t)}finalize(e){return e&&this._append(e),this._doFinalize()}process(e){return this._append(e),this._process()}};Z.ivSize=4;Z.keySize=4;Z._DEC_XFORM_MODE=2;Z._ENC_XFORM_MODE=1;var $=class{constructor(e,t){this.init(e,t)}init(e,t){this._cipher=e,this._iv=t}};var le=class{static createDecryptor(e,t){let r=this.Decryptor;return new r(e,t)}static createEncryptor(e,t){let r=this.Encryptor;return new r(e,t)}};le.Decryptor=$;le.Encryptor=$;var Le=class extends ${get prevBlock(){return this._prevBlock}processBlock(e,t){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");this.xorBlock(e,t,this._cipher.cfg.blockSize),this._cipher.encryptBlock(e,t),this._prevBlock=e.slice(t,t+this._cipher.cfg.blockSize)}xorBlock(e,t,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let i=0;i<r;i++)e[t+i]^=s[i]}};var ze=class extends ${get prevBlock(){return this._prevBlock}processBlock(e,t){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");let r=e.slice(t,t+this._cipher.cfg.blockSize);this._cipher.decryptBlock(e,t),this.xorBlock(e,t,this._cipher.cfg.blockSize),this._prevBlock=r}xorBlock(e,t,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let i=0;i<r;i++)e[t+i]^=s[i]}};var z=class extends le{};z.Decryptor=ze;z.Encryptor=Le;var H=class{static pad(e,t){let r=t*4,s=r-e.sigBytes%r,i=s<<24|s<<16|s<<8|s,o=[];for(let h=0;h<s;h+=4)o.push(i);let a=new _(o,s);e.concat(a)}static unpad(e){let t=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=t}};var de=class extends Z{constructor(e,t,r){super(e,t,Object.assign({blockSize:4,mode:z,padding:H},r))}reset(){if(super.reset(),this.cfg.mode===void 0)throw new Error("missing mode in config");let e;this._xformMode===this.constructor._ENC_XFORM_MODE?e=this.cfg.mode.createEncryptor:(e=this.cfg.mode.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator===e?this._mode.init(this,this.cfg.iv&&this.cfg.iv.words):(this._mode=e.call(this.cfg.mode,this,this.cfg.iv&&this.cfg.iv.words),this._mode.__creator=e)}_doFinalize(){if(this.cfg.padding===void 0)throw new Error("missing padding in config");let e;if(this._xformMode===this.constructor._ENC_XFORM_MODE){if(this.cfg.blockSize===void 0)throw new Error("missing blockSize in config");this.cfg.padding.pad(this._data,this.cfg.blockSize),e=this._process(!0)}else e=this._process(!0),this.cfg.padding.unpad(e);return e}_doProcessBlock(e,t){this._mode.processBlock(e,t)}};var l=class n{constructor(e,t){this.high=e,this.low=t}add(e){let t=this.low+e.low|0,r=t>>>0<this.low>>>0?1:0,s=this.high+e.high+r|0;return new n(s,t)}and(e){return new n(this.high&e.high,this.low&e.low)}not(){return new n(~this.high,~this.low)}or(e){return new n(this.high|e.high,this.low|e.low)}rotL(e){return this.shiftL(e).or(this.shiftR(64-e))}rotR(e){return this.shiftR(e).or(this.shiftL(64-e))}shiftL(e){return e<32?new n(this.high<<e|this.low>>>32-e,this.low<<e):new n(this.low<<e-32,0)}shiftR(e){return e<32?new n(this.high>>>e,this.low>>>e|this.high<<32-e):new n(0,this.high>>>e-32)}xor(e){return new n(this.high^e.high,this.low^e.low)}};var Ke=class n{constructor(e=[],t){this.words=e,this.sigBytes=t!==void 0?t:e.length*8}static create(e=[],t){return new n(e,t)}clone(){let e=this.words.map(t=>new l(t.high,t.low));return new n(e,this.sigBytes)}toX32(){let e=[];for(let t of this.words)e.push(t.high,t.low);return new _(e,this.sigBytes)}};var A=[],$t=[],Gt=[],Wt=[],Vt=[],Xt=[],ht=[],lt=[],dt=[],pt=[];(function(){let n=[];for(let r=0;r<256;r++)r<128?n[r]=r<<1:n[r]=r<<1^283;let e=0,t=0;for(let r=0;r<256;r++){let s=t^t<<1^t<<2^t<<3^t<<4;s=s>>>8^s&255^99,A[e]=s,$t[s]=e;let i=n[e],o=n[i],a=n[o],h=n[s]*257^s*16843008;Gt[e]=h<<24|h>>>8,Wt[e]=h<<16|h>>>16,Vt[e]=h<<8|h>>>24,Xt[e]=h,h=a*16843009^o*65537^i*257^e*16843008,ht[s]=h<<24|h>>>8,lt[s]=h<<16|h>>>16,dt[s]=h<<8|h>>>24,pt[s]=h,e?(e=i^n[n[n[a^i]]],t^=n[n[t]]):e=t=1}})();var Kr=[0,1,2,4,8,16,32,64,128,27,54],pe=class extends de{constructor(e,t,r){super(e,t,r),super.reset()}decryptBlock(e,t){let r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,ht,lt,dt,pt,$t),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r}encryptBlock(e,t){this._doCryptBlock(e,t,this._keySchedule,Gt,Wt,Vt,Xt,A)}reset(){if(super.reset(),this._nRounds&&this._keyPriorReset===this._key)return;let e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=((this._nRounds=r+6)+1)*4,o=this._keySchedule=[];for(let a=0;a<i;a++)if(a<r)o[a]=t[a];else{let h=o[a-1];a%r?r>6&&a%r===4&&(h=A[h>>>24]<<24|A[h>>>16&255]<<16|A[h>>>8&255]<<8|A[h&255]):(h=h<<8|h>>>24,h=A[h>>>24]<<24|A[h>>>16&255]<<16|A[h>>>8&255]<<8|A[h&255],h^=Kr[a/r|0]<<24),o[a]=o[a-r]^h}this._invKeySchedule=[];for(let a=0;a<i;a++){let h=i-a,g;a%4?g=o[h]:g=o[h-4],a<4||h<=4?this._invKeySchedule[a]=g:this._invKeySchedule[a]=ht[A[g>>>24]]^lt[A[g>>>16&255]]^dt[A[g>>>8&255]]^pt[A[g&255]]}}_doCryptBlock(e,t,r,s,i,o,a,h){let g=e[t]^r[0],p=e[t+1]^r[1],u=e[t+2]^r[2],f=e[t+3]^r[3],E=4;for(let I=1;I<this._nRounds;I++){let w=s[g>>>24]^i[p>>>16&255]^o[u>>>8&255]^a[f&255]^r[E++],y=s[p>>>24]^i[u>>>16&255]^o[f>>>8&255]^a[g&255]^r[E++],C=s[u>>>24]^i[f>>>16&255]^o[g>>>8&255]^a[p&255]^r[E++],tt=s[f>>>24]^i[g>>>16&255]^o[p>>>8&255]^a[u&255]^r[E++];g=w,p=y,u=C,f=tt}let O=(h[g>>>24]<<24|h[p>>>16&255]<<16|h[u>>>8&255]<<8|h[f&255])^r[E++],F=(h[p>>>24]<<24|h[u>>>16&255]<<16|h[f>>>8&255]<<8|h[g&255])^r[E++],P=(h[u>>>24]<<24|h[f>>>16&255]<<16|h[g>>>8&255]<<8|h[p&255])^r[E++],B=(h[f>>>24]<<24|h[g>>>16&255]<<16|h[p>>>8&255]<<8|h[u&255])^r[E++];e[t]=O,e[t+1]=F,e[t+2]=P,e[t+3]=B}};pe.keySize=256/32;var $r=[1732584193,4023233417,2562383102,271733878,3285377520],Y=new Array(80),G=class extends x{get hash(){return this._hash}reset(){super.reset(),this._hash=new _($r.slice(0))}_doFinalize(){let e=this._nDataBytes*8,t=this._data.sigBytes*8;return this._data.words[t>>>5]|=128<<24-t%32,this._data.words[(t+64>>>9<<4)+14]=Math.floor(e/4294967296),this._data.words[(t+64>>>9<<4)+15]=e,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(e,t){let r=this._hash.words[0],s=this._hash.words[1],i=this._hash.words[2],o=this._hash.words[3],a=this._hash.words[4];for(let h=0;h<80;h++){if(h<16)Y[h]=e[t+h]|0;else{let f=Y[h-3]^Y[h-8]^Y[h-14]^Y[h-16];Y[h]=f<<1|f>>>31}let g,p;h<20?(g=s&i|~s&o,p=1518500249):h<40?(g=s^i^o,p=1859775393):h<60?(g=s&i|s&o|i&o,p=2400959708):(g=s^i^o,p=3395469782);let u=(r<<5|r>>>27)+g+a+p+Y[h];a=o,o=i,i=s<<30|s>>>2,s=r,r=u|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+s|0,this._hash.words[2]=this._hash.words[2]+i|0,this._hash.words[3]=this._hash.words[3]+o|0,this._hash.words[4]=this._hash.words[4]+a|0}};var qt=[],Zt=[];(function(){function n(s){let i=Math.sqrt(s);for(let o=2;o<=i;o++)if(!(s%o))return!1;return!0}function e(s){return(s-(s|0))*4294967296|0}let t=2,r=0;for(;r<64;)n(t)&&(r<8&&(qt[r]=e(Math.pow(t,1/2))),Zt[r]=e(Math.pow(t,1/3)),r++),t++})();var Q=[],ee=class extends x{constructor(){super()}reset(){super.reset(),this._hash=new _(qt.slice(0))}_doFinalize(){let e=this._nDataBytes*8,t=this._data.sigBytes*8;return this._data.words[t>>>5]|=128<<24-t%32,this._data.words[(t+64>>>9<<4)+14]=Math.floor(e/4294967296),this._data.words[(t+64>>>9<<4)+15]=e,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(e,t){let r=this._hash.words[0],s=this._hash.words[1],i=this._hash.words[2],o=this._hash.words[3],a=this._hash.words[4],h=this._hash.words[5],g=this._hash.words[6],p=this._hash.words[7];for(let u=0;u<64;u++){if(u<16)Q[u]=e[t+u]|0;else{let I=Q[u-15],w=(I<<25|I>>>7)^(I<<14|I>>>18)^I>>>3,y=Q[u-2],C=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;Q[u]=w+Q[u-7]+C+Q[u-16]}let f=a&h^~a&g,E=r&s^r&i^s&i,O=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),F=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),P=p+F+f+Zt[u]+Q[u],B=O+E;p=g,g=h,h=a,a=o+P|0,o=i,i=s,s=r,r=P+B|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+s|0,this._hash.words[2]=this._hash.words[2]+i|0,this._hash.words[3]=this._hash.words[3]+o|0,this._hash.words[4]=this._hash.words[4]+a|0,this._hash.words[5]=this._hash.words[5]+h|0,this._hash.words[6]=this._hash.words[6]+g|0,this._hash.words[7]=this._hash.words[7]+p|0}};var gt=[new l(1116352408,3609767458),new l(1899447441,602891725),new l(3049323471,3964484399),new l(3921009573,2173295548),new l(961987163,4081628472),new l(1508970993,3053834265),new l(2453635748,2937671579),new l(2870763221,3664609560),new l(3624381080,2734883394),new l(310598401,1164996542),new l(607225278,1323610764),new l(1426881987,3590304994),new l(1925078388,4068182383),new l(2162078206,991336113),new l(2614888103,633803317),new l(3248222580,3479774868),new l(3835390401,2666613458),new l(4022224774,944711139),new l(264347078,2341262773),new l(604807628,2007800933),new l(770255983,1495990901),new l(1249150122,1856431235),new l(1555081692,3175218132),new l(1996064986,2198950837),new l(2554220882,3999719339),new l(2821834349,766784016),new l(2952996808,2566594879),new l(3210313671,3203337956),new l(3336571891,1034457026),new l(3584528711,2466948901),new l(113926993,3758326383),new l(338241895,168717936),new l(666307205,1188179964),new l(773529912,1546045734),new l(1294757372,1522805485),new l(1396182291,2643833823),new l(1695183700,2343527390),new l(1986661051,1014477480),new l(2177026350,1206759142),new l(2456956037,344077627),new l(2730485921,1290863460),new l(2820302411,3158454273),new l(3259730800,3505952657),new l(3345764771,106217008),new l(3516065817,3606008344),new l(3600352804,1432725776),new l(4094571909,1467031594),new l(275423344,851169720),new l(430227734,3100823752),new l(506948616,1363258195),new l(659060556,3750685593),new l(883997877,3785050280),new l(958139571,3318307427),new l(1322822218,3812723403),new l(1537002063,2003034995),new l(1747873779,3602036899),new l(1955562222,1575990012),new l(2024104815,1125592928),new l(2227730452,2716904306),new l(2361852424,442776044),new l(2428436474,593698344),new l(2756734187,3733110249),new l(3204031479,2999351573),new l(3329325298,3815920427),new l(3391569614,3928383900),new l(3515267271,566280711),new l(3940187606,3454069534),new l(4118630271,4000239992),new l(116418474,1914138554),new l(174292421,2731055270),new l(289380356,3203993006),new l(460393269,320620315),new l(685471733,587496836),new l(852142971,1086792851),new l(1017036298,365543100),new l(1126000580,2618297676),new l(1288033470,3409855158),new l(1501505948,4234509866),new l(1607167915,987167468),new l(1816402316,1246189591)],U=[];(function(){for(let n=0;n<80;n++)U[n]=new l(void 0,void 0)})();var Ie=class extends x{constructor(){super({blockSize:1024/32})}reset(){super.reset(),this._hash=new Ke([new l(1779033703,4089235720),new l(3144134277,2227873595),new l(1013904242,4271175723),new l(2773480762,1595750129),new l(1359893119,2917565137),new l(2600822924,725511199),new l(528734635,4215389547),new l(1541459225,327033209)])}_doFinalize(){let e=this._data,t=e.words,r=this._nDataBytes*8,s=e.sigBytes*8;return t[s>>>5]|=128<<24-s%32,t[(s+128>>>10<<5)+30]=Math.floor(r/4294967296),t[(s+128>>>10<<5)+31]=r,e.sigBytes=t.length*4,this._process(),this._hash.toX32()}_doProcessBlock(e,t){let r=this._hash.words[0].high,s=this._hash.words[0].low,i=this._hash.words[1].high,o=this._hash.words[1].low,a=this._hash.words[2].high,h=this._hash.words[2].low,g=this._hash.words[3].high,p=this._hash.words[3].low,u=this._hash.words[4].high,f=this._hash.words[4].low,E=this._hash.words[5].high,O=this._hash.words[5].low,F=this._hash.words[6].high,P=this._hash.words[6].low,B=this._hash.words[7].high,I=this._hash.words[7].low;for(let w=0;w<80;w++){let y,C;if(w<16)C=U[w].high=e[t+w*2]|0,y=U[w].low=e[t+w*2+1]|0;else{let vt=U[w-15],te=vt.high,we=vt.low,Fr=(te>>>1|we<<31)^(te>>>8|we<<24)^te>>>7,Pt=(we>>>1|te<<31)^(we>>>8|te<<24)^(we>>>7|te<<25),Bt=U[w-2],re=Bt.high,ye=Bt.low,Nr=(re>>>19|ye<<13)^(re<<3|ye>>>29)^re>>>6,Ct=(ye>>>19|re<<13)^(ye<<3|re>>>29)^(ye>>>6|re<<26);y=Pt+U[w-7].low,C=Fr+U[w-7].high+(y>>>0<Pt>>>0?1:0),y=y+Ct,C=C+Nr+(y>>>0<Ct>>>0?1:0),y=y+U[w-16].low,C=C+U[w-16].high+(y>>>0<U[w-16].low>>>0?1:0),U[w].high=C,U[w].low=y}let tt=u&E^~u&F,It=f&O^~f&P,vr=r&i^r&a^i&a,Pr=s&o^s&h^o&h,Br=(r>>>28|s<<4)^(r<<30|s>>>2)^(r<<25|s>>>7),At=(s>>>28|r<<4)^(s<<30|r>>>2)^(s<<25|r>>>7),Cr=(u>>>14|f<<18)^(u>>>18|f<<14)^(u<<23|f>>>9),kr=(f>>>14|u<<18)^(f>>>18|u<<14)^(f<<23|u>>>9),v=I+kr,W=B+Cr+(v>>>0<I>>>0?1:0);v=v+It,W=W+tt+(v>>>0<It>>>0?1:0),v=v+gt[w].low,W=W+gt[w].high+(v>>>0<gt[w].low>>>0?1:0),v=v+y,W=W+C+(v>>>0<y>>>0?1:0);let Ot=At+Pr,Ur=Br+vr+(Ot>>>0<At>>>0?1:0);B=F,I=P,F=E,P=O,E=u,O=f,f=p+v|0,u=g+W+(f>>>0<p>>>0?1:0)|0,g=a,p=h,a=i,h=o,i=r,o=s,s=v+Ot|0,r=W+Ur+(s>>>0<v>>>0?1:0)|0}this._hash.words[0].low=this._hash.words[0].low=this._hash.words[0].low+s,this._hash.words[0].high=this._hash.words[0].high+r+(this._hash.words[0].low>>>0<s>>>0?1:0),this._hash.words[1].low=this._hash.words[1].low=this._hash.words[1].low+o,this._hash.words[1].high=this._hash.words[1].high+i+(this._hash.words[1].low>>>0<o>>>0?1:0),this._hash.words[2].low=this._hash.words[2].low=this._hash.words[2].low+h,this._hash.words[2].high=this._hash.words[2].high+a+(this._hash.words[2].low>>>0<h>>>0?1:0),this._hash.words[3].low=this._hash.words[3].low=this._hash.words[3].low+p,this._hash.words[3].high=this._hash.words[3].high+g+(this._hash.words[3].low>>>0<p>>>0?1:0),this._hash.words[4].low=this._hash.words[4].low=this._hash.words[4].low+f,this._hash.words[4].high=this._hash.words[4].high+u+(this._hash.words[4].low>>>0<f>>>0?1:0),this._hash.words[5].low=this._hash.words[5].low=this._hash.words[5].low+O,this._hash.words[5].high=this._hash.words[5].high+E+(this._hash.words[5].low>>>0<O>>>0?1:0),this._hash.words[6].low=this._hash.words[6].low=this._hash.words[6].low+P,this._hash.words[6].high=this._hash.words[6].high+F+(this._hash.words[6].low>>>0<P>>>0?1:0),this._hash.words[7].low=this._hash.words[7].low=this._hash.words[7].low+I,this._hash.words[7].high=this._hash.words[7].high+B+(this._hash.words[7].low>>>0<I>>>0?1:0)}};var $e=class{constructor(e,t){this._hasher=new e;let r=typeof t=="string"?b.parse(t):t,s=this._hasher.cfg.blockSize,i=s*4;r.sigBytes>i&&(r=this._hasher.finalize(r)),r.clamp();let o=this._oKey=r.clone(),a=this._iKey=r.clone(),h=o.words,g=a.words;for(let p=0;p<s;p++)h[p]^=1549556828,g[p]^=909522486;o.sigBytes=a.sigBytes=i,this.reset()}finalize(e){let t=this._hasher.finalize(e);return this._hasher.reset(),this._hasher.finalize(this._oKey.clone().concat(t))}reset(){this._hasher.reset(),this._hasher.update(this._iKey)}update(e){return this._hasher.update(e),this}};var Ae=class n{constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:ee,iterations:25e4},e)}static execute(e,t,r){return new n(r).compute(e,t)}compute(e,t){let r=this.cfg,s=new $e(r.hasher,e),i=new _,o=new _([1]),a=i.words,h=o.words,g=r.keySize,p=r.iterations;for(;a.length<g;){let u=s.update(t).finalize(o);s.reset();let f=u.words,E=f.length,O=u;for(let F=1;F<p;F++){O=s.finalize(O),s.reset();let P=O.words;for(let B=0;B<E;B++)f[B]^=P[B]}i.concat(u),h[0]++}return i.sigBytes=g*4,i}};var Oe=de._createHelper(pe);var ge=x._createHelper(M);var fe=x._createHelper(G);var Ge=x._createHelper(ee);var We=x._createHelper(Ie);var me=class{constructor(e,t,r){this._password=e;this._salt=t;this._initVector=r;this._mode=z;this._padding=H}get _iv(){return this._initVector?L.parse(this._initVector):void 0}decryptAES(e){return Oe.decrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString(b)}encryptAES(e){return Oe.encrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString()}_buildKey(){return Ae.execute(this._password,L.parse(this._salt),{keySize:256/32,iterations:1e3,hasher:G})}};var Ve=class{static base64Decode(e){return b.stringify(D.parse(e))}static base64Encode(e){return D.stringify(b.parse(e))}static md5(e){return ge(e).toString()}static sha1(e){return fe(e).toString()}static sha256(e){return Ge(e).toString()}static sha512(e){return We(e).toString()}};var Ht=(c=>(c[c.Continue=100]="Continue",c[c.SwitchingProtocols=101]="SwitchingProtocols",c[c.Processing=102]="Processing",c[c.EarlyHints=103]="EarlyHints",c[c.Ok=200]="Ok",c[c.Created=201]="Created",c[c.Accepted=202]="Accepted",c[c.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",c[c.NoContent=204]="NoContent",c[c.ResetContent=205]="ResetContent",c[c.PartialContent=206]="PartialContent",c[c.MultiStatus=207]="MultiStatus",c[c.AlreadyReported=208]="AlreadyReported",c[c.ImUsed=226]="ImUsed",c[c.MultipleChoices=300]="MultipleChoices",c[c.MovedPermanently=301]="MovedPermanently",c[c.Found=302]="Found",c[c.SeeOther=303]="SeeOther",c[c.NotModified=304]="NotModified",c[c.UseProxy=305]="UseProxy",c[c.Unused=306]="Unused",c[c.TemporaryRedirect=307]="TemporaryRedirect",c[c.PermanentRedirect=308]="PermanentRedirect",c[c.BadRequest=400]="BadRequest",c[c.Unauthorized=401]="Unauthorized",c[c.PaymentRequired=402]="PaymentRequired",c[c.Forbidden=403]="Forbidden",c[c.NotFound=404]="NotFound",c[c.MethodNotAllowed=405]="MethodNotAllowed",c[c.NotAcceptable=406]="NotAcceptable",c[c.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",c[c.RequestTimeout=408]="RequestTimeout",c[c.Conflict=409]="Conflict",c[c.Gone=410]="Gone",c[c.LengthRequired=411]="LengthRequired",c[c.PreconditionFailed=412]="PreconditionFailed",c[c.PayloadTooLarge=413]="PayloadTooLarge",c[c.UriTooLong=414]="UriTooLong",c[c.UnsupportedMediaType=415]="UnsupportedMediaType",c[c.RangeNotSatisfiable=416]="RangeNotSatisfiable",c[c.ExpectationFailed=417]="ExpectationFailed",c[c.ImATeapot=418]="ImATeapot",c[c.MisdirectedRequest=421]="MisdirectedRequest",c[c.UnprocessableEntity=422]="UnprocessableEntity",c[c.Locked=423]="Locked",c[c.FailedDependency=424]="FailedDependency",c[c.TooEarly=425]="TooEarly",c[c.UpgradeRequired=426]="UpgradeRequired",c[c.PreconditionRequired=428]="PreconditionRequired",c[c.TooManyRequests=429]="TooManyRequests",c[c.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",c[c.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",c[c.InternalServerError=500]="InternalServerError",c[c.NotImplemented=501]="NotImplemented",c[c.BadGateway=502]="BadGateway",c[c.ServiceUnavailable=503]="ServiceUnavailable",c[c.GatewayTimeout=504]="GatewayTimeout",c[c.HttpVersionNotSupported=505]="HttpVersionNotSupported",c[c.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",c[c.InsufficientStorage=507]="InsufficientStorage",c[c.LoopDetected=508]="LoopDetected",c[c.NotExtended=510]="NotExtended",c[c.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",c))(Ht||{});var Xe=class{constructor(e){this._baseCode=e;this._crcLength=5;this._seed="changeme"}get baseCode(){return this._baseCode}get secureCode(){return this._encode()}static check(e,t){if(new this(e).secureCode!==t)throw X.build("WRONG_SECURE_CODE","WRONG_SECURE_CODE",400)}_encode(){let e=new M;return e.update(b.parse(this._seed+this._baseCode)),e.finalize().toString(L).substring(0,this._crcLength).toUpperCase()}};var ue=require("class-transformer"),qe=require("ts-luxon");var Jt=(f=>(f.ACTIVATE="ACTIVATE",f.BLOCK="BLOCK",f.CHECK="CHECK",f.DIGITAL_ACTIVATE="DIGITAL_ACTIVATE",f.FREEZE="FREEZE",f.PURCHASE="PURCHASE",f.RECHARGE="RECHARGE",f.ROLLBACK="ROLLBACK",f.TRANSACTION="TRANSACTION",f.TRANSACTION_DETAIL="TRANSACTION_DETAIL",f.UNFREEZE="UNFREEZE",f.XREFUND="XREFUND",f))(Jt||{});var Yt=(s=>(s.MD5="MD5",s.MD5_HMAC="MD5_HMAC",s.SHA1="SHA1",s.SHA1_HMAC="SHA1_HMAC",s))(Yt||{});var Ze=class{constructor(e="ACTIVATION",t,r,s){this.gc=e;this.op=t;this.ot=r;this._hashStrategies={MD5:e=>ge(e),MD5_HMAC:e=>{let t=new M;return t.update(b.parse(e)),t.finalize()},SHA1:e=>fe(e),SHA1_HMAC:e=>{let t=new G;return t.update(b.parse(e)),t.finalize()}};this._hashStrategy=this._hashStrategies.MD5;this._dto=typeof s=="number"&&s>=0?qe.DateTime.fromMillis(+`${s}000`.slice(0,13)):qe.DateTime.local()}static{this._AES_ENCODER=new me("changeme","5f6eae61d2428b99","d92fbf214e16a79fd36f9a5185ae733f")}static{this._LOGGER=console}static{this._OP_CODES={CHECK:"",TRANSACTION:"",TRANSACTION_DETAIL:"",ACTIVATE:"A",BLOCK:"B",DIGITAL_ACTIVATE:"D",FREEZE:"F",PURCHASE:"P",RECHARGE:"G",ROLLBACK:"R",UNFREEZE:"U",XREFUND:"X"}}static{this._SEP="_"}get dto(){return this._dto}get hash(){return this._hashStrategy(this.toString()).toString()}get iso(){return this.dto.toUTC().toISO()}get ts(){return this._dto.ts}static build({gc:e,op:t,ot:r,dto:s}){return new this(e,t,r,s?.ts)}static explode(e){let t=this.constructor,r=(e||"").split(t._SEP);if(r.length<4)throw new Error(`INVALID_TRANSACTION "${e}"`);return this.build({gc:r[1],op:t.prefixToOperation(r[2]),dto:qe.DateTime.fromSeconds(+r[3])})}static isBase64(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)&&e.length%4===0}static parse(e){this._LOGGER.info(`${this.constructor.name}: trying to parse ${e}`);try{if(this.isBase64(e)){let t=this.constructor._AES_ENCODER.decryptAES(e),r=JSON.parse(t);return(0,ue.plainToInstance)(this,r)}else return this.explode(e)}catch(t){throw this._LOGGER.error(`${this.constructor.name}: failed to parse ${e}`,t),new Error(`UNPARSEABLE "${e}"`)}}static prefixToOperation(e){return Object.entries(this._OP_CODES).find(([,r])=>r===e)[0]}serialize(){return(0,ue.instanceToPlain)(this,{excludePrefixes:["_"]})}toString(){let e=JSON.stringify(this.serialize());return this.constructor._AES_ENCODER.encryptAES(e)}};S([(0,ue.Expose)()],Ze.prototype,"ts",1);var Qt=(r=>(r.ListDetectiveValidator="ListDetectiveValidator",r.MXValidator="MXValidator",r.SyntaxValidator="SyntaxValidator",r))(Qt||{});var Gr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function tr(n){return n.match(Gr)}var ar="\\ud800-\\udfff",Wr="\\u0300-\\u036f",Vr="\\ufe20-\\ufe2f",Xr="\\u20d0-\\u20ff",qr="\\u1ab0-\\u1aff",Zr="\\u1dc0-\\u1dff",Hr=Wr+Vr+Xr+qr+Zr,cr="\\u2700-\\u27bf",hr="a-z\\xdf-\\xf6\\xf8-\\xff",Jr="\\xac\\xb1\\xd7\\xf7",Yr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Qr="\\u2000-\\u206f",es=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",lr="A-Z\\xc0-\\xd6\\xd8-\\xde",ts="\\ufe0e\\ufe0f",dr=Jr+Yr+Qr+es,pr="['\u2019]",rr=`[${dr}]`,rs=`[${Hr}]`,gr="\\d",ss=`[${cr}]`,fr=`[${hr}]`,mr=`[^${ar}${dr+gr+cr+hr+lr}]`,is="\\ud83c[\\udffb-\\udfff]",os=`(?:${rs}|${is})`,ns=`[^${ar}]`,ur="(?:\\ud83c[\\udde6-\\uddff]){2}",_r="[\\ud800-\\udbff][\\udc00-\\udfff]",_e=`[${lr}]`,as="\\u200d",sr=`(?:${fr}|${mr})`,cs=`(?:${_e}|${mr})`,ir=`(?:${pr}(?:d|ll|m|re|s|t|ve))?`,or=`(?:${pr}(?:D|LL|M|RE|S|T|VE))?`,wr=`${os}?`,yr=`[${ts}]?`,hs=`(?:${as}(?:${[ns,ur,_r].join("|")})${yr+wr})*`,ls="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ds="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ps=yr+wr+hs,nr=`(?:${[ss,ur,_r].join("|")})${ps}`,ve=class{static{this.HAS_UNICODE_WORD=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/)}static{this.RE_UNICODE_WORDS=RegExp([`${_e}?${fr}+${ir}(?=${[rr,_e,"$"].join("|")})`,`${cs}+${or}(?=${[rr,_e+sr,"$"].join("|")})`,`${_e}?${sr}+${ir}`,`${_e}+${or}`,ds,ls,`${gr}+`,nr].join("|"),"g")}static{this.RS_EMOJI=nr}static unicodeWords(e){return e.match(this.RE_UNICODE_WORDS)}};var ft=class n{static arrayRemove(e,t){let r=[],s=e.filter((i,o)=>t(i,o)&&r.push(o));return r.reverse().forEach(i=>e.splice(i,1)),s}static assertIsArray(e,t){if(!Array.isArray(e))throw new Error(t||"KikCommonUtils => val was not an array")}static assertIsBoolean(e,t){if(!this.isBoolean(e))throw new Error(t||"KikCommonUtils => val was not boolean")}static assertIsFunction(e,t){if(!this.isFunction(e))throw new Error(t||"KikCommonUtils => entity was not a function")}static assertIsInstance(e,t,r){if(!(e instanceof t))throw new Error(r||"KikCommonUtils => val was not instance of class")}static assertIsNotEmpty(e,t){if(this.isEmpty(e))throw new Error(t||"KikCommonUtils => entity was empty")}static assertIsNumber(e,t){if(typeof e!="number")throw new Error(t||"KikCommonUtils => val was not numeric")}static assertIsNumeric(e,t){if(!this.isNumeric(e))throw new Error(t||"KikCommonUtils => val was not numeric")}static assertIsObject(e,t){if(!this.isObject(e))throw new Error(t||"KikCommonUtils => val was not an object")}static assertIsString(e,t){if(!this.isString(e))throw new Error(t||"KikCommonUtils => val was not a string")}static assertIsTruthy(e,t){if(!e)throw new Error(t||"KikCommonUtils => condition wasn't truthy")}static buildPath(...e){let t=e.filter(r=>!!r).join("/").replace(/(?<!:)\/\/+/g,"/");return t.startsWith("http")&&!t.endsWith("/")?`${t}/`:t}static downloadBlob(e,t){let r=window.URL.createObjectURL(e),s=document.createElement("a");s.href=r,s.setAttribute("download",t),document.body.appendChild(s),s.click()}static generateRandomHexString(e=12){let t="0123456789abcdef",r="";for(let s=0;s<e;s++){let i=Math.floor(Math.random()*t.length);r+=t[i]}return r}static generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}static getDecimalPrecision(e){if(this.assertIsNumeric(e),!isFinite(+e))return 0;let t=1,r=0;for(;Math.round(+e*t)/t!==e;)t*=10,r++;return r}static getType(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}static isBoolean(e){return typeof e=="boolean"}static isColor(e){if(!e||!this.isString(e))return!1;let t=new Option().style;return t.color=e,t.color!==""}static isEmpty(e){return!e&&e!==0}static isEqual(e,t){function r(){if(e.length!==t.length)return!1;for(let h=0;h<e.length;h++)if(!n.isEqual(e[h],t[h]))return!1;return!0}function s(){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let h in e)if(Object.prototype.hasOwnProperty.call(e,h)&&!n.isEqual(e[h],t[h]))return!1;return!0}function i(){return e.toString()===t.toString()}function o(){return e===t}let a=this.getType(e);return a!==this.getType(t)?!1:a==="array"?r():a==="object"?s():a==="function"?i():o()}static isFormField(e){return/^(?:input|select|textarea|button)$/i.test(e.nodeName)}static isFunction(e){return typeof e==typeof isNaN}static isNotEmpty(e){return!this.isEmpty(e)}static isNumber(e){return typeof e=="number"&&this.isNumeric(e)}static isNumeric(e){return!isNaN(e)}static isObject(e){return!!e&&e===Object(e)&&e.constructor===Object}static isPrimitive(e){let t=this.getType(e);return t!=="function"&&(t!=="object"||!e)}static isString(e){return typeof e=="string"}static isWindows(){return navigator.userAgent.toLowerCase().includes("win")}static mapObject(e,t){if(this.assertIsFunction(t,`CommonUtils => expected type of iteratee to be Function, got ${typeof t}`),this.isObject(e))return Object.entries(e).reduce((r,[s,i])=>(r.push(t(i,s)),r),[]);if(Array.isArray(e))return e.map(t);throw new Error(`CommonUtils => invalid object provided. Expected Object or Array, got ${typeof t}`)}static mapObjectKeys(e,t){return Object.entries(e).reduce((r,[s,i])=>(r[s]=t.call(null,s,i),r),{})}static mapObjectValues(e,t){return this.isObject(e)?Object.entries(e).reduce((r,[s,i])=>(r[s]=t.call(null,i,s),r),{}):{}}static noop(){}static objectHasValue(e,t){return!!~Object.values(e).filter(r=>this.isEqual(r,t))}static parseBoolean(e){return e?/^true$/i.test(e):!1}static parseJsonSafely(e){try{return JSON.parse(e)}catch(t){console.warn("KikCommonUtils => couldn't parse json string",{str:e,error:t});return}}static pick(e,t){return t.reduce((r,s)=>(s in e&&(r[s]=e[s]),r),{})}static runSafely(e,t=null,r=[]){if(this.isFunction(e))return e.apply(t,r)}static sleep(e){return new Promise(t=>setTimeout(t,e))}static sprintf(e,...t){return this.isString(e)&&t.length?this.sprintf(e.replace("%s",String(t.shift())),...t):e}static stripComments(e){return typeof e=="string"?e.replace(/(<!--.*?-->)|(<!--[\S\s]+?-->)|(<!--[\S\s]*?$)/g,""):e}static submitFakeForm({action:e,method:t="POST",data:r,target:s}){let i=Object.entries(r||{}).map(([a,h])=>`<input name="${a}" type="hidden" value="${h}" />`),o=document.createElement("form");o.method=t,o.action=e,o.innerHTML=`${i}`,o.target=s||"_self",document.body.append(o),o.submit()}static toCamelCase(e){return this.words(e.replace(/['\u2019]/g,"")).reduce((t,r,s)=>(r=r.toLowerCase(),t+(s?r.charAt(0).toUpperCase()+r.slice(1):r)),"")}static toKebabCase(e){return this.words(e.replace(/['\u2019]/g,"")).join("-").toLowerCase()}static toPascalCase(e){return this.toCamelCase(e).replace(/^(.)/,t=>t.toUpperCase())}static toSnakeCase(e){return this.words(e.replace(/['\u2019]/g,"")).join("_").toLowerCase()}static toUpperSnakeCase(e){return this.toSnakeCase(e).toUpperCase()}static words(e,t){return t===void 0?(ve.HAS_UNICODE_WORD(e)?ve.unicodeWords(e):tr(e))||[]:e.match(t)||[]}};var mt=class extends Error{constructor(t="Filter Exception",r){super();this.message=t;this.data=r}};var ut=require("ts-luxon"),_t=class n{constructor(e=`gcpsid-xxxx-${+ut.DateTime.now().ts}`,t=0){this.value=e;this.expiry=t;this._controlSuffix="$1"}get active(){return this.value.endsWith(this._controlSuffix)}get expired(){return ut.DateTime.now().ts>this.expiry}get valid(){return!this.expired}static parse(e){return new n(e.value,e.expiry)}toPlain(){return{value:this.value,expiry:this.expiry}}};Ee();var wt=class{static get COUNTRY(){return this._country}static get DOMAIN(){return/^(?!www)(\w)([\w.-])*\.[a-z]{2,6}$/}static get EMAIL(){return/^[^\\|!"£$%&/()='?^€*[\]°#§<>,;:\s]+@[a-z0-9.-]+\.[a-z]{2,6}$/}static get LANGUAGE(){return this._language}static get LATIN_CHARS(){return/^[\u0000-\u024F\u1E00-\u1EFF\u2C60-\u2C7F\uA720-\uA7FF]+/}static get LOCALE(){return new RegExp(`${this._country.source}-${this._language.source}`)}static get NO_EMOJI_NO_PUNCTUATION(){return/[^\p{Emoji_Presentation}|\p{P}]/gu}static get PHONE_NUMBER(){return/^(\+\d{1,4}\s)(\d{4,15})$/}static get PHONE_NUMBER_BY_PREFIX(){return{"+971":{dontStartWithZero:/^(\+\d{3}\s)([1-9])/,typeExactlyNineDigits:/^(\+\d{3}\s)([1-9]\d{8}$)/}}}static get TAXCODE_BY_COUNTRY(){return{ES:{DNI:/^\d{8}[A-Z]$/,NIE:/^[A-Z]\d{7}[A-Z]$/,CIF:/^[A-Z]\d{8}$/}}}static{this._country=/[a-zA-Z]{2}/}static{this._language=/[a-z]{2}/}};var Pe=class{constructor(e,t){this._storage=e;this._prefix=t}flush(){Object.keys(this._storage).filter(e=>e.startsWith(this._prefix)).forEach(this.remove.bind(this))}read(e){let t=this._storage.getItem(this._prefix+e);try{return t?JSON.parse(t):void 0}catch{return}}remove(e){this._storage.removeItem(this._prefix+e)}write(e,t){this._storage.setItem(this._prefix+e,JSON.stringify(t))}};var Be=class{static{this._storage=new Map}get staticStorage(){return this.constructor._storage}flush(){this.staticStorage.clear()}read(e){return this.staticStorage.get(e)}remove(e){this.staticStorage.delete(e)}write(e,t){this.staticStorage.set(e,t)}};var Ce=class extends Pe{constructor(){super(sessionStorage,"smp_rest_cache_")}};var yt=class{static{this._cachePrefix="kik_rest_cache_"}static{this._cacheStrategy=typeof sessionStorage<"u"?new Ce:new Be}static{this._config={cachePrefix:this._cachePrefix,shared:new Map}}static{this._errorClass=X}static{this._mergeParamsFallbackBaseUrl="https://ts-mapi-core"}static $http(e){return this._generateAjax(e)}static async _generateAjax(e){if(e.cacheKey){let t=this._cacheRead(e.cacheKey);return t?Promise.resolve(t):this._generateAjaxBase(e).then(r=>(e.cacheKey&&this._cacheWrite(e.cacheKey,r),r))}return this._generateAjaxBase(e)}static async _generateAjaxBase(e){let t=await this._preprocessRequest(e),r={method:t.method,headers:new Headers({"content-type":"application/json",...t.headers}),body:t.body?JSON.stringify(t.body):null};return t.useCredentials&&(r.credentials="include"),t.url=this.mergeQueryParams(t.url,t.queryParams),fetch(t.url,r).then(s=>this._preprocessResponse(e,s)).then(s=>{if(s.ok){if(s.status===204||s.headers.get("content-length")==="0")return null;switch(t.responseType){case"blob":return s.blob();case"arraybuffer":return s.arrayBuffer();case"text":return s.text();case"json":default:return s.json()}}return s.json().then(i=>{let o=i;try{o=this._errorClass.fromPlain(i)}catch(a){console.debug("http: failed to parse error response into ErrorResponse",a)}return Promise.reject({status:s.status,message:s.statusText,body:o})})})}static cacheFlush(){this._cacheStrategy.flush()}static mergeQueryParams(e,t){let r=e.startsWith("http");if(t){let s=new URL(e,globalThis?.location?.origin||this._mergeParamsFallbackBaseUrl),i=Object.fromEntries(s.searchParams.entries());s.search=new URLSearchParams({...i,...Object.fromEntries(Object.entries(t).map(([o,a])=>[o,`${a}`]))}).toString(),e=r?s.href:s.pathname+s.search}return e}static _cacheKey(e){return`${this._config.cachePrefix}${e}`}static _cachePop(e){let t=this._cacheRead(e);return this._cacheRemove(e),t}static _cacheRead(e){return this._cacheStrategy.read(this._cacheKey(e))}static _cacheRemove(e){this._cacheStrategy.remove(this._cacheKey(e))}static _cacheWrite(e,t){this._cacheStrategy.write(this._cacheKey(e),t)}static async _preprocessRequest(e){return e}static async _preprocessResponse(e,t){return t}};var ms="1.1.0";Object.defineProperties(module.exports,{smpRxjsThrowIfEmpty:{get:()=>(Rt(),xe(Et)).smpRxjsThrowIfEmpty},smpRxjsThrowOnCondition:{get:()=>(Rt(),xe(Et)).smpRxjsThrowOnCondition},SmpDynamoService:{get:()=>(Ir(),xe(Tr)).SmpDynamoService},SmpFirebaseService:{get:()=>(Or(),xe(Ar)).SmpFirebaseService}});0&&(module.exports={SMP_HEALTHZ,SmpAesCrypt,SmpApiCommonUtils,SmpBrowserCache,SmpCommonUtils,SmpCrypto,SmpErrorResponse,SmpFilterException,SmpFirebaseErrors,SmpGenericResponse,SmpGiftcardTransaction,SmpGiftcardTransactionHashStrategies,SmpGiftcardTransactionOps,SmpHttpService,SmpHttpSessionStorageCache,SmpHttpStatusCodes,SmpInMemoryCache,SmpMarketingCloudValidators,SmpRegularExpressions,SmpResponseMessage,SmpResponseMessageTypes,SmpRestVerbs,SmpSecureCode,SmpSid,SmpSocialSignInKeys,SmpSocialSignInUxModes,VERSION,smpNoop});
1
+ "use strict";var Fe=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var Sr=Object.getOwnPropertyNames;var Lr=Object.prototype.hasOwnProperty;var x=(n,e)=>()=>(n&&(e=n(n=0)),e);var Ue=(n,e)=>{for(var t in e)Fe(n,t,{get:e[t],enumerable:!0})},zr=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Sr(e))!Lr.call(n,s)&&s!==t&&Fe(n,s,{get:()=>e[s],enumerable:!(r=Ft(e,s))||r.enumerable});return n};var se=n=>zr(Fe({},"__esModule",{value:!0}),n),j=(n,e,t,r)=>{for(var s=r>1?void 0:r?Ft(e,t):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&Fe(e,t,s),s};var Ne,Ut=x(()=>{"use strict";Ne=class{get sessionId(){return this._sessionId||this._storage.getItem(this._sessionIdKey)||void 0}constructor(e="lggr_sid"){this._sessionIdKey=e,this._storage=this._getStorage(),this._sessionId=this.sessionId||this._generateSessionId()}_generateSessionId(){let e=this._generateUUID();return this._storage.setItem(this._sessionIdKey,e),e}_generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}_getStorage(){try{if(typeof window<"u"&&typeof window.sessionStorage==typeof isNaN)return sessionStorage}catch(e){console.warn(`${this.constructor.name}: error while checking sessionStorage`,e)}return{getItem:()=>null,setItem:()=>null,removeItem:()=>null,clear:()=>null}}}});var k,ot=x(()=>{"use strict";(function(n){n[n.OFF=0]="OFF",n[n.ERROR=1]="ERROR",n[n.WARN=2]="WARN",n[n.INFO=3]="INFO",n[n.LOG=4]="LOG",n[n.DEBUG=5]="DEBUG"})(k||(k={}))});function T(){}var De=x(()=>{"use strict"});var nt,S,at=x(()=>{"use strict";De();nt=class{constructor(){this.group=T,this.groupCollapsed=T,this.groupEnd=T,this.time=T,this.timeEnd=T}},S=class n extends nt{constructor(){super(...arguments),this.debug=T,this.error=T,this.info=T,this.log=T,this.warn=T}static describe(){return Object.getOwnPropertyNames(new n).map(e=>e)}}});var Nt,Me,ie,Dt=x(()=>{"use strict";Ut();ot();at();De();Me="[DEFAULT]",ie=class extends S{static get INSTANCE(){return this.get(Me)}static get INSTANCES(){return this._instances.keys()}static get NOOP_INSTANCE(){return this._noopInstance}get activeLevels(){return Object.values(k).filter(e=>+e>k.OFF&&+e<=this.level).map(e=>k[e])}get appName(){return this._appName}get currentConfig(){return{level:this.level,enableSessionId:this.enableSessionId,enablePreprocessing:this.enablePreprocessing,sensitiveProps:this._sensitiveProps}}get enablePreprocessing(){return this.preprocessArgs!==this._noopPreprocessArgs}get enableSessionId(){return!!this.sessionId}get level(){return this.constructor._level}get sessionId(){return this._sessionId}constructor(e){super(),this._sensitivePropMask="*****",this._sessionManager=new Ne,this._loadConfig(e)}static destroy(e){return this._instances.delete(e)}static get(e=Me){return this._instances.get(e)||this._instances.get(Me)||this._noopInstance}static init(e,t=Me){let r;if(this._instances.has(t)){r=this.get(t);let s=r.currentConfig;r._loadConfig(Object.assign(Object.assign({},s),e))}else this._instances.set(t,new this(e)),r=this.get(t),r._appName=t;return r}static pop(e){let t=this.get(e);return this.destroy(e),t}destroy(){return this.constructor.destroy(this.appName)}filterSensitiveData(e){if(e===null||typeof e!="object"||Array.isArray(e)||e.constructor!==Object)return e;let t={};for(let r in e){let s=e[r];if(!Object.prototype.hasOwnProperty.call(e,r)||s===null||s===void 0){t[r]=s;continue}if(this._sensitiveProps.includes(r)){t[r]=this._sensitivePropMask;continue}t[r]=this.filterSensitiveData(s)}return t}preprocessArgs(e,...t){return this._defaultPreprocessArgs.apply(this,[e,...t])}_defaultPreprocessArgs(e,...t){let r=new Date;return[`${r.toISOString()}`,`${t.shift()}`.trim(),...t.map(s=>({tags:[this._appName,`level-${k[this.level]}`,e],timestamp:+r,sessionId:this.sessionId,metadata:this.filterSensitiveData(s)}))]}_loadConfig({sensitiveProps:e=[],level:t=k.OFF,enablePreprocessing:r=!1,enableSessionId:s=!1}){this._sensitiveProps=[...e,"pwd","password","buffer","token","accessToken","refreshToken"],this.preprocessArgs=r?this.preprocessArgs:this._noopPreprocessArgs,this._sessionId=s?this._sessionManager.sessionId:void 0,this._updateLevel(t)}_noopPreprocessArgs(...e){return e}_setup(e){let t=this.preprocessArgs.bind(this);this.activeLevels.forEach(r=>{let s=`${r}`.toLowerCase();typeof e[s]==typeof isNaN&&(this[s]=function(...i){e[s].apply(e,t.apply(null,[s,...i]))})}),this.level>k.OFF&&console&&(console.group&&console.groupEnd&&(this.group=console.group.bind(console),this.groupEnd=console.groupEnd.bind(console)),console.groupCollapsed&&(this.groupCollapsed=console.groupCollapsed.bind(console)),console.time&&console.timeEnd&&(this.time=console.time.bind(console),this.timeEnd=console.timeEnd.bind(console)))}_updateLevel(e=k.WARN){this.constructor.describe().forEach(t=>{this[t]=T}),this.constructor._level=e,console&&this._setup(console)}};Nt=ie;ie._instances=new Map;ie._level=k.OFF;ie._noopInstance=new Nt({level:k.OFF})});var Mt=x(()=>{"use strict"});var jt=x(()=>{"use strict"});var St=x(()=>{"use strict";Mt();jt();at();ot();De()});var Ee=x(()=>{"use strict";Dt();St()});var Kt,$r=x(()=>{"use strict";Kt=(r=>(r.APPLE="APPLE",r.FACEBOOK="FACEBOOK",r.GOOGLE="GOOGLE",r))(Kt||{})});var $t,Gr=x(()=>{"use strict";$t=(t=>(t.POPUP="POPUP",t.REDIRECT="REDIRECT",t))($t||{})});var He,tr=x(()=>{"use strict";He=(p=>(p.DIFFERENT_CREDENTIAL="auth/account-exists-with-different-credential",p.DIFFERENT_CREDENTIAL_APPLE="auth/account-exists-with-different-credential/apple",p.DIFFERENT_CREDENTIAL_FACEBOOK="auth/account-exists-with-different-credential/facebook",p.DIFFERENT_CREDENTIAL_GOOGLE="auth/account-exists-with-different-credential/google",p.EMAIL_EXISTS="auth/email-already-exists",p.INVALID_ACTION_CODE="auth/invalid-action-code",p.POPUP_BLOCKED="auth/popup-blocked",p.POPUP_CLOSED_BY_USER="auth/popup-closed-by-user",p.USER_NOT_FOUND="auth/user-not-found",p.WRONG_PASSWORD="auth/wrong-password",p))(He||{})});function Er(n,e){return t=>t.pipe((0,Je.catchError)(r=>r instanceof n?e(r):(0,Je.throwError)(()=>r)))}var Je,Rr=x(()=>{"use strict";Je=require("rxjs")});function Ye(n=_s){return e=>e.pipe((0,br.map)(t=>{if(~us.indexOf(JSON.stringify(t)))throw n(t);return t}))}var br,us,_s,bt=x(()=>{"use strict";br=require("rxjs");us=[void 0,null,!1,0,"","0",[],{}].map(n=>JSON.stringify(n)),_s=()=>new Error});function Tr(n,e){return t=>t.pipe((0,Qe.filter)(r=>!n(r)),(0,Qe.defaultIfEmpty)(!1),Ye(e))}var Qe,Or=x(()=>{"use strict";Qe=require("rxjs");bt()});var et={};Ue(et,{smpRxjsCatchOnly:()=>Er,smpRxjsThrowIfEmpty:()=>Ye,smpRxjsThrowOnCondition:()=>Tr});var tt=x(()=>{"use strict";Rr();bt();Or()});var Ar={};Ue(Ar,{SmpDynamoService:()=>Tt});var Ir,st,rt,Tt,vr=x(()=>{"use strict";Ir=require("@aws-sdk/client-dynamodb"),st=require("@aws-sdk/util-dynamodb");Ee();rt=(s=>(s.CouldNotDelete="ERR_COULD_NOT_DELETE",s.CouldNotRead="ERR_COULD_NOT_READ",s.CouldNotWrite="ERR_COULD_NOT_WRITE",s.ConditionalCheckFailedException="ERR_DUPE_TOKEN",s))(rt||{}),Tt=class{constructor(e,t){this._config=e;this._tableName=t;this._db=new Ir.DynamoDB([this._buildConfig()]);this._logger=new S}get marshall(){return st.marshall}get unmarshall(){return st.unmarshall}_buildConfig(){return this._config}_delete(e,t=this._tableName,r){let s={TableName:t,Key:this.marshall(e),...r};return this._db.deleteItem(s).catch(i=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",i),Promise.reject(rt[i.code]||"ERR_COULD_NOT_DELETE")))}_read(e,t=this._tableName,r){let s={TableName:t,Key:this.marshall(e),...r};return this._db.getItem(s).catch(i=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",i),Promise.reject(rt[i.code]||"ERR_COULD_NOT_READ")))}_write(e,t=this._tableName,r){let s={TableName:t,Item:this.marshall(e),...r};return this._db.putItem(s).catch(i=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",i),Promise.reject(rt[i.code]||"ERR_COULD_NOT_WRITE")))}}});var Pr={};Ue(Pr,{SmpFirebaseService:()=>Ot});var ke,m,Ot,Cr=x(()=>{"use strict";Ee();ke=require("firebase/app"),m=require("firebase/auth");tr();Ot=class n{constructor(e,t){this._enabledSocials=[];this._popupErrors=0;this._socialLoginUxMode="POPUP";this._config=e,this._enabledSocials=t.enabledSocials||[],this._socialLoginUxMode=t.socialLoginUxMode||"POPUP",this._popupFallsBackToRedirect=!!t.popupFallsBackToRedirect,this._buildProviders(),this._logger=t.logger||new S,this._app=(0,ke.getApps)().length?(0,ke.getApps)()[0]:(0,ke.initializeApp)(e),this._watchAuthState()}static get instance(){if(!(this._instance instanceof n))throw Error(`${this.constructor.name} instance doesn't exist! Call ${this.constructor.name}.init first!`);return this._instance}get config(){return this._config}get enabledSocials(){return this._enabledSocials}get loggedUser(){return this._loggedUser||(this._loggedUser=this._readStoredUser()),this._auth.currentUser||this._loggedUser||void 0}get providersRelation(){return{"facebook.com":"FACEBOOK","google.com":"GOOGLE","apple.com":"APPLE"}}get socialLoginUXMode(){return this._socialLoginUxMode}get storedUserKey(){return"firebaseUser"}get _auth(){return(0,m.getAuth)(this._app)}static init(e,t){return this._instance||(this._instance=new n(e,t)),this._instance}addAuthStateChangedCallback(e){return this._auth.onAuthStateChanged(t=>{e(t||this.loggedUser||null)})}checkActionCode(e){return(0,m.checkActionCode)(this._auth,e)}confirmPasswordReset(e,t){return(0,m.confirmPasswordReset)(this._auth,e,t)}fetchSignInMethodsForEmail(e){return(0,m.fetchSignInMethodsForEmail)(this._auth,e).then(t=>t.map(r=>this.providersRelation[r]||r))}getRedirectResult(){return(0,m.getRedirectResult)(this._auth).catch(async e=>(await this._expandDifferentCredential(e),Promise.reject(e)))}initAppCheck(){}sendEmailVerification(e){if(!this.loggedUser)throw Error("Firebase: user is not logged!");return(0,m.sendEmailVerification)(this.loggedUser,e?{url:e}:void 0)}sendPasswordResetEmail(e,t){return(0,m.sendPasswordResetEmail)(this._auth,e,{url:t})}setPersistence(e){return(0,m.setPersistence)(this._auth,e?m.browserLocalPersistence:m.browserSessionPersistence)}signInWithCustomToken(e){return(0,m.signInWithCustomToken)(this._auth,e)}signInWithEmailAndPassword(e,t){return(0,m.signInWithEmailAndPassword)(this._auth,e,t).then(async r=>r.user)}signInWithSocialProvider(e){if(!this._providers[e])throw Error(`Firebase: invalid social key provided! Expected one of ${this.enabledSocials}, got ${e}`);return this._signInWithProvider(this._providers[e])}signOut(){return(0,m.signOut)(this._auth)}updatePassword(e,t){if(!this.loggedUser)throw Error("Firebase: user is not logged!");let r=m.EmailAuthProvider.credential(this.loggedUser.email,e);return(0,m.reauthenticateWithCredential)(this.loggedUser,r).then(()=>(0,m.updatePassword)(this.loggedUser,t))}updateUserProfile(e){if(!this.loggedUser)throw Error("Firebase: user is not logged!");return(0,m.updateProfile)(this.loggedUser,e)}async verifyIdToken(){return this._auth.currentUser?.getIdTokenResult()}_buildProviders(){this._providers=this._enabledSocials.reduce((e,t)=>(t in e&&(e[t]=e[t]),e),{APPLE:new m.OAuthProvider("apple.com"),FACEBOOK:new m.FacebookAuthProvider().setCustomParameters({prompt:"select_account"}),GOOGLE:new m.GoogleAuthProvider().setCustomParameters({prompt:"select_account"})})}async _expandDifferentCredential(e){if(e?.code==="auth/account-exists-with-different-credential"){let t=await this.fetchSignInMethodsForEmail(e.customData.email);throw e.code=He["DIFFERENT_CREDENTIAL_"+t[0]],e}}_readStoredUser(){try{let e=localStorage.getItem(this.storedUserKey);if(e){this._logger?.debug("Firebase: found local user",e);let t=JSON.parse(e);return{...t,getIdToken:()=>Promise.resolve(t.stsTokenManager.accessToken)}}}catch(e){this._logger.debug("Firebase: error while getting stored user",e)}}async _signInWithProvider(e,t=this.socialLoginUXMode){return(t==="POPUP"?m.signInWithPopup:m.signInWithRedirect)(this._auth,e).then(s=>(this._logger.info(`Firebase: signin with provider ${e.providerId} was successful`),s.user)).catch(async s=>s?.code==="auth/popup-blocked"&&(this._logger.warn(`Firebase: social signin popup blocked (${++this._popupErrors}`),this._popupFallsBackToRedirect&&this._popupErrors>1)?(this._popupErrors=0,this._signInWithProvider(e,"REDIRECT")):(this._logger.error(`Firebase: sign in with ${e.providerId} errored`,s),await this._expandDifferentCredential(s),Promise.reject(s)))}_updateLocalUser(e){try{e?localStorage.setItem(this.storedUserKey,JSON.stringify(e)):localStorage.removeItem(this.storedUserKey),this._logger.debug("Firebase: updating local user",e),this._loggedUser=e}catch(t){this._logger.warn("Firebase: couldn't update local user",{user:e,error:t})}}_watchAuthState(){this._auth.onAuthStateChanged(e=>{this._logger.debug("Firebase: firebase detected auth state change",e),this._updateLocalUser(e||void 0)})}}});var ys={};Ue(ys,{SMP_HEALTHZ:()=>Kr,SmpAesCrypt:()=>ue,SmpApiCommonUtils:()=>ct,SmpBrowserCache:()=>Pe,SmpCommonUtils:()=>_t,SmpCrypto:()=>Ve,SmpErrorResponse:()=>q,SmpFilterException:()=>wt,SmpFirebaseErrors:()=>He,SmpGenericResponse:()=>Re,SmpGiftcardTransaction:()=>Ze,SmpGiftcardTransactionHashStrategies:()=>Qt,SmpGiftcardTransactionOps:()=>Yt,SmpHttpService:()=>Rt,SmpHttpSessionStorageCache:()=>Be,SmpHttpStatusCodes:()=>Jt,SmpInMemoryCache:()=>Ce,SmpMarketingCloudValidators:()=>er,SmpRegularExpressions:()=>Et,SmpResponseMessage:()=>N,SmpResponseMessageTypes:()=>Lt,SmpRestVerbs:()=>zt,SmpSecureCode:()=>qe,SmpSid:()=>xt,SmpSocialSignInKeys:()=>Kt,SmpSocialSignInUxModes:()=>$t,VERSION:()=>ws,smpNoop:()=>T});module.exports=se(ys);Ee();var ct=class{static{this._javascriptVariablePattern="[a-zA-Z_$][a-zA-Z_$0-9]*"}static{this._logger=new S}static{this._pathParamRegex=new RegExp(`\\{(${this._javascriptVariablePattern})\\}`,"g")}static credentialsToBasicAuth(e,t){return`Basic ${Buffer.from(`${e}:${t}`).toString("base64")}`}static fromBearer(e=""){return e.split(" ")[1]}static getCountryFromReferer(e){return this.getLocaleFromReferer(e)?.split("-")[0]?.toUpperCase()}static getLanguageFromReferer(e){return this.getLocaleFromReferer(e)?.split("-")[1]}static getLocaleFromReferer(e){return e?.match(/\/([A-Z]{2}-[A-Z]{2})\//i)?.[1]}static interpolateParams(e,t){try{return e.replace(this._pathParamRegex,(r,s)=>{let i=t[s];return i!==void 0?encodeURIComponent(i):r})}catch(r){this._logger.warn("KikApiCommonUtils: couldn't interpolate params",r)}return e}};var be=require("class-transformer");var V=require("class-transformer");var ht=require("class-transformer");var Lt=(s=>(s.INFO="INFO",s.SUCCESS="SUCCESS",s.WARNING="WARNING",s.ERROR="ERROR",s))(Lt||{});var oe=class oe{constructor(e,t="ERROR"){this._message=e;this._type=t}get message(){return this._message}get type(){return this._type}static sanitizeMessages(e){return typeof e=="string"?e.length?[new oe(e)]:[]:[e].flat().map(t=>typeof t=="string"?new oe(t):t)}};j([(0,ht.Expose)()],oe.prototype,"message",1),j([(0,ht.Expose)()],oe.prototype,"type",1);var N=oe;var ne=class ne{constructor(e=[],t){this._messages=e;this.data=t}set messages(e){this._messages=N.sanitizeMessages(e)}get messages(){return this._messages}static buildInfo(e,t){return new ne([e].flat().map(r=>new N(r,"INFO")),t)}static buildSuccess(e,t){return new ne([e].flat().map(r=>new N(r,"SUCCESS")),t)}static fromPlain(e){return(0,V.plainToInstance)(ne,e)}isError(){return!this.isSuccess()}isSuccess(){return"_errorCode"in this&&this._errorCode!==null&&this._errorCode!==void 0}serialize(){return(0,V.instanceToPlain)(this,{excludePrefixes:["_"]})}};j([(0,V.Expose)(),(0,V.Transform)(({value:e})=>e?.length?e:void 0)],ne.prototype,"messages",1);var Re=ne;function lt(){return[new N("GENERIC_ERROR")]}var J=class J extends Re{constructor(t=lt(),r="GENERIC_ERROR",s=500,i){super(t,i);this._errorCode=r;this._status=s;this._timestamp=Date.now()}get errorCode(){return this._errorCode}get status(){return this._status}get timestamp(){return this._timestamp}static build(t=lt(),r,s,i){return new J(N.sanitizeMessages(t),r,s,i)}static create({messages:t=lt(),...r}){return new J(N.sanitizeMessages(t),r.errorCode,r.status,r.data)}static fromPlain(t){let r=(0,be.plainToInstance)(dt,t,{excludePrefixes:["_"]}),s=new J;return Object.getOwnPropertyNames(r).forEach(i=>{i in s&&(s[i]=r[i])}),s}};j([(0,be.Expose)()],J.prototype,"errorCode",1),j([(0,be.Expose)()],J.prototype,"timestamp",1);var q=J,dt=class extends q{set errorCode(e){this._errorCode=e}set status(e){this._status=e}set timestamp(e){this._timestamp=e}};var Kr={status:"OK"};var zt=(i=>(i.GET="GET",i.POST="POST",i.PUT="PUT",i.DELETE="DELETE",i.PATCH="PATCH",i))(zt||{});var L=class{static parse(e){let t=e.length,r=[];for(let s=0;s<t;s+=2)r[s>>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new _(r,t/2)}static stringify(e){let t=[];for(let r=0;r<e.sigBytes;r++){let s=e.words[r>>>2]>>>24-r%4*8&255;t.push((s>>>4).toString(16)),t.push((s&15).toString(16))}return t.join("")}};var _=class n{constructor(e,t){this.words=e||[],t!==void 0?this.sigBytes=t:this.sigBytes=this.words.length*4}static random(e){let t=[],r=function(s){let i=987654321,o=4294967295;return function(){i=36969*(i&65535)+(i>>16)&o,s=18e3*(s&65535)+(s>>16)&o;let a=(i<<16)+s&o;return a/=4294967296,a+=.5,a*(Math.random()>.5?1:-1)}};for(let s=0,i;s<e;s+=4){let o=r((i||Math.random())*4294967296);i=o()*987654071,t.push(o()*4294967296|0)}return new n(t,e)}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new n(this.words.slice(0),this.sigBytes)}concat(e){if(this.clamp(),this.sigBytes%4)for(let t=0;t<e.sigBytes;t++){let r=e.words[t>>>2]>>>24-t%4*8&255;this.words[this.sigBytes+t>>>2]|=r<<24-(this.sigBytes+t)%4*8}else for(let t=0;t<e.sigBytes;t+=4)this.words[this.sigBytes+t>>>2]=e.words[t>>>2];return this.sigBytes+=e.sigBytes,this}toString(e){return(e||L).stringify(this)}};var ae=class{static parse(e){let t=e.length,r=[];for(let s=0;s<t;s++)r[s>>>2]|=(e.charCodeAt(s)&255)<<24-s%4*8;return new _(r,t)}static stringify(e){let t=[];for(let r=0;r<e.sigBytes;r++){let s=e.words[r>>>2]>>>24-r%4*8&255;t.push(String.fromCharCode(s))}return t.join("")}};var b=class{static parse(e){return ae.parse(unescape(encodeURIComponent(e)))}static stringify(e){try{return decodeURIComponent(escape(ae.stringify(e)))}catch(t){throw console.error("Malformed UTF-8 data",t),new Error("Malformed UTF-8 data")}}};var ce=class{constructor(e){this._minBufferSize=0,this.cfg=Object.assign({blockSize:1},e),this._data=new _,this._nDataBytes=0}clone(){let e=this.constructor();for(let t in this)Object.prototype.hasOwnProperty.call(this,t)&&(e[t]=this[t]);return e._data=this._data.clone(),e}reset(){this._data=new _,this._nDataBytes=0}_append(e){typeof e=="string"&&(e=b.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}_process(e){if(!this.cfg.blockSize)throw new Error("missing blockSize in config");let t=this.cfg.blockSize*4,r=this._data.sigBytes/t;e?r=Math.ceil(r):r=Math.max((r|0)-this._minBufferSize,0);let s=r*this.cfg.blockSize,i=Math.min(s*4,this._data.sigBytes),o;if(s){for(let a=0;a<s;a+=this.cfg.blockSize)this._doProcessBlock(this._data.words,a);o=this._data.words.splice(0,s),this._data.sigBytes-=i}return new _(o,i)}};var X=class{constructor(e){this.ciphertext=e.ciphertext,this.key=e.key,this.iv=e.iv,this.salt=e.salt,this.algorithm=e.algorithm,this.mode=e.mode,this.padding=e.padding,this.blockSize=e.blockSize,this.formatter=e.formatter}extend(e){return e.ciphertext!==void 0&&(this.ciphertext=e.ciphertext),e.key!==void 0&&(this.key=e.key),e.iv!==void 0&&(this.iv=e.iv),e.salt!==void 0&&(this.salt=e.salt),e.algorithm!==void 0&&(this.algorithm=e.algorithm),e.mode!==void 0&&(this.mode=e.mode),e.padding!==void 0&&(this.padding=e.padding),e.blockSize!==void 0&&(this.blockSize=e.blockSize),e.formatter!==void 0&&(this.formatter=e.formatter),this}toString(e){if(e)return e.stringify(this);if(this.formatter)return this.formatter.stringify(this);throw new Error("cipher needs a formatter to be able to convert the result into a string")}};var D=class{static parse(e){let t=e.length;if(this._reverseMap===void 0){this._reverseMap=[];for(let s=0;s<this._map.length;s++)this._reverseMap[this._map.charCodeAt(s)]=s}let r=this._map.charAt(64);if(r){let s=e.indexOf(r);s!==-1&&(t=s)}return this.parseLoop(e,t,this._reverseMap)}static parseLoop(e,t,r){let s=[],i=0;for(let o=0;o<t;o++)if(o%4){let a=r[e.charCodeAt(o-1)]<<o%4*2,h=r[e.charCodeAt(o)]>>>6-o%4*2;s[i>>>2]|=(a|h)<<24-i%4*8,i++}return new _(s,i)}static stringify(e){e.clamp();let t=[];for(let s=0;s<e.sigBytes;s+=3){let i=e.words[s>>>2]>>>24-s%4*8&255,o=e.words[s+1>>>2]>>>24-(s+1)%4*8&255,a=e.words[s+2>>>2]>>>24-(s+2)%4*8&255,h=i<<16|o<<8|a;for(let g=0;g<4&&s+g*.75<e.sigBytes;g++)t.push(this._map.charAt(h>>>6*(3-g)&63))}let r=this._map.charAt(64);if(r)for(;t.length%4;)t.push(r);return t.join("")}};D._map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";D._reverseMap=void 0;var he=class{static parse(e){let t=D.parse(e),r;return t.words[0]===1398893684&&t.words[1]===1701076831&&(r=new _(t.words.slice(2,4)),t.words.splice(0,4),t.sigBytes-=16),new X({ciphertext:t,salt:r})}static stringify(e){if(!e.ciphertext)throw new Error("missing ciphertext in params");let t=e.ciphertext,r=e.salt,s;if(r){if(typeof r=="string")throw new Error("salt is expected to be a WordArray");s=new _([1398893684,1701076831]).concat(r).concat(t)}else s=t;return s.toString(D)}};var K=class{static decrypt(e,t,r,s){let i=Object.assign({},this.cfg,s);if(!i.format)throw new Error("could not determine format");if(t=this._parse(t,i.format),!t.ciphertext)throw new Error("could not determine ciphertext");return e.createDecryptor(r,i).finalize(t.ciphertext)}static encrypt(e,t,r,s){let i=Object.assign({},this.cfg,s),o=e.createEncryptor(r,i),a=o.finalize(t);return new X({ciphertext:a,key:r,iv:o.cfg.iv,algorithm:e,mode:o.cfg.mode,padding:o.cfg.padding,blockSize:o.cfg.blockSize,formatter:i.format})}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};K.cfg={blockSize:4,iv:new _([]),format:he};var E=class extends ce{constructor(e){super(Object.assign({blockSize:512/32},e)),this.reset()}static _createHelper(e){function t(r,s){return new e(s).finalize(r)}return t}finalize(e){return e&&this._append(e),this._doFinalize()}update(e){return this._append(e),this._process(),this}};var d=[];for(let n=0;n<64;n++)d[n]=Math.abs(Math.sin(n+1))*4294967296|0;var M=class n extends E{get hash(){return this._hash}static FF(e,t,r,s,i,o,a){let h=e+(t&r|~t&s)+i+a;return(h<<o|h>>>32-o)+t}static GG(e,t,r,s,i,o,a){let h=e+(t&s|r&~s)+i+a;return(h<<o|h>>>32-o)+t}static HH(e,t,r,s,i,o,a){let h=e+(t^r^s)+i+a;return(h<<o|h>>>32-o)+t}static II(e,t,r,s,i,o,a){let h=e+(r^(t|~s))+i+a;return(h<<o|h>>>32-o)+t}reset(){super.reset(),this._hash=new _([1732584193,4023233417,2562383102,271733878])}_doFinalize(){let e=this._nDataBytes*8,t=this._data.sigBytes*8;this._data.words[t>>>5]|=128<<24-t%32;let r=Math.floor(e/4294967296),s=e;this._data.words[(t+64>>>9<<4)+15]=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360,this._data.words[(t+64>>>9<<4)+14]=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,this._data.sigBytes=(this._data.words.length+1)*4,this._process();for(let i=0;i<4;i++)this._hash.words[i]=(this._hash.words[i]<<8|this._hash.words[i]>>>24)&16711935|(this._hash.words[i]<<24|this._hash.words[i]>>>8)&4278255360;return this._hash}_doProcessBlock(e,t){for(let h=0;h<16;h++){let g=t+h,p=e[g];e[g]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360}let r=Array.from({length:16});for(let h=0;h<16;h++)r[h]=e[t+h];let s=this._hash.words[0],i=this._hash.words[1],o=this._hash.words[2],a=this._hash.words[3];s=n.FF(s,i,o,a,r[0],7,d[0]),a=n.FF(a,s,i,o,r[1],12,d[1]),o=n.FF(o,a,s,i,r[2],17,d[2]),i=n.FF(i,o,a,s,r[3],22,d[3]),s=n.FF(s,i,o,a,r[4],7,d[4]),a=n.FF(a,s,i,o,r[5],12,d[5]),o=n.FF(o,a,s,i,r[6],17,d[6]),i=n.FF(i,o,a,s,r[7],22,d[7]),s=n.FF(s,i,o,a,r[8],7,d[8]),a=n.FF(a,s,i,o,r[9],12,d[9]),o=n.FF(o,a,s,i,r[10],17,d[10]),i=n.FF(i,o,a,s,r[11],22,d[11]),s=n.FF(s,i,o,a,r[12],7,d[12]),a=n.FF(a,s,i,o,r[13],12,d[13]),o=n.FF(o,a,s,i,r[14],17,d[14]),i=n.FF(i,o,a,s,r[15],22,d[15]),s=n.GG(s,i,o,a,r[1],5,d[16]),a=n.GG(a,s,i,o,r[6],9,d[17]),o=n.GG(o,a,s,i,r[11],14,d[18]),i=n.GG(i,o,a,s,r[0],20,d[19]),s=n.GG(s,i,o,a,r[5],5,d[20]),a=n.GG(a,s,i,o,r[10],9,d[21]),o=n.GG(o,a,s,i,r[15],14,d[22]),i=n.GG(i,o,a,s,r[4],20,d[23]),s=n.GG(s,i,o,a,r[9],5,d[24]),a=n.GG(a,s,i,o,r[14],9,d[25]),o=n.GG(o,a,s,i,r[3],14,d[26]),i=n.GG(i,o,a,s,r[8],20,d[27]),s=n.GG(s,i,o,a,r[13],5,d[28]),a=n.GG(a,s,i,o,r[2],9,d[29]),o=n.GG(o,a,s,i,r[7],14,d[30]),i=n.GG(i,o,a,s,r[12],20,d[31]),s=n.HH(s,i,o,a,r[5],4,d[32]),a=n.HH(a,s,i,o,r[8],11,d[33]),o=n.HH(o,a,s,i,r[11],16,d[34]),i=n.HH(i,o,a,s,r[14],23,d[35]),s=n.HH(s,i,o,a,r[1],4,d[36]),a=n.HH(a,s,i,o,r[4],11,d[37]),o=n.HH(o,a,s,i,r[7],16,d[38]),i=n.HH(i,o,a,s,r[10],23,d[39]),s=n.HH(s,i,o,a,r[13],4,d[40]),a=n.HH(a,s,i,o,r[0],11,d[41]),o=n.HH(o,a,s,i,r[3],16,d[42]),i=n.HH(i,o,a,s,r[6],23,d[43]),s=n.HH(s,i,o,a,r[9],4,d[44]),a=n.HH(a,s,i,o,r[12],11,d[45]),o=n.HH(o,a,s,i,r[15],16,d[46]),i=n.HH(i,o,a,s,r[2],23,d[47]),s=n.II(s,i,o,a,r[0],6,d[48]),a=n.II(a,s,i,o,r[7],10,d[49]),o=n.II(o,a,s,i,r[14],15,d[50]),i=n.II(i,o,a,s,r[5],21,d[51]),s=n.II(s,i,o,a,r[12],6,d[52]),a=n.II(a,s,i,o,r[3],10,d[53]),o=n.II(o,a,s,i,r[10],15,d[54]),i=n.II(i,o,a,s,r[1],21,d[55]),s=n.II(s,i,o,a,r[8],6,d[56]),a=n.II(a,s,i,o,r[15],10,d[57]),o=n.II(o,a,s,i,r[6],15,d[58]),i=n.II(i,o,a,s,r[13],21,d[59]),s=n.II(s,i,o,a,r[4],6,d[60]),a=n.II(a,s,i,o,r[11],10,d[61]),o=n.II(o,a,s,i,r[2],15,d[62]),i=n.II(i,o,a,s,r[9],21,d[63]),this._hash.words[0]=this._hash.words[0]+s|0,this._hash.words[1]=this._hash.words[1]+i|0,this._hash.words[2]=this._hash.words[2]+o|0,this._hash.words[3]=this._hash.words[3]+a|0}};var Te=class n{constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:M,iterations:1},e)}static execute(e,t,r){return new n(r).compute(e,t)}compute(e,t){let r=new this.cfg.hasher,s=new _,i;for(;s.words.length<this.cfg.keySize;){i&&r.update(i),i=r.update(e).finalize(t),r.reset();for(let o=1;o<this.cfg.iterations;o++)i=r.finalize(i),r.reset();s.concat(i)}return s.sigBytes=this.cfg.keySize*4,s}};var je=class{static execute(e,t,r,s){s||(s=_.random(64/8));let i=new Te({keySize:t+r}).compute(e,s),o=new _(i.words.slice(t),r*4);return i.sigBytes=t*4,new X({key:i,iv:o,salt:s})}};var le=class{static decrypt(e,t,r,s){let i=Object.assign({},this.cfg,s);if(i.format===void 0)throw new Error("missing format in config");if(t=this._parse(t,i.format),i.kdf===void 0)throw new Error("the key derivation function must be set");let o=i.kdf.execute(r,e.keySize,e.ivSize,t.salt);return o.iv!==void 0&&(i.iv=o.iv),K.decrypt.call(this,e,t,o.key,i)}static encrypt(e,t,r,s){let i=Object.assign({},this.cfg,s);if(i.kdf===void 0)throw new Error("missing kdf in config");let o=i.kdf.execute(r,e.keySize,e.ivSize);return o.iv!==void 0&&(i.iv=o.iv),K.encrypt.call(this,e,t,o.key,i).extend(o)}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};le.cfg={blockSize:4,iv:new _([]),format:he,kdf:je};var Se=class{constructor(e){this._cipher=e}decrypt(e,t,r){return typeof t=="string"?le.decrypt(this._cipher,e,t,r):K.decrypt(this._cipher,e,t,r)}encrypt(e,t,r){return typeof t=="string"?le.encrypt(this._cipher,e,t,r):K.encrypt(this._cipher,e,t,r)}};var Z=class extends ce{constructor(e,t,r){super(Object.assign({blockSize:1},r)),this._xformMode=e,this._key=t,this.reset()}static _createHelper(e){return new Se(e)}static createDecryptor(e,t){let r=this;return new r(this._DEC_XFORM_MODE,e,t)}static createEncryptor(e,t){return new this(this._ENC_XFORM_MODE,e,t)}finalize(e){return e&&this._append(e),this._doFinalize()}process(e){return this._append(e),this._process()}};Z.ivSize=4;Z.keySize=4;Z._DEC_XFORM_MODE=2;Z._ENC_XFORM_MODE=1;var $=class{constructor(e,t){this.init(e,t)}init(e,t){this._cipher=e,this._iv=t}};var de=class{static createDecryptor(e,t){let r=this.Decryptor;return new r(e,t)}static createEncryptor(e,t){let r=this.Encryptor;return new r(e,t)}};de.Decryptor=$;de.Encryptor=$;var Le=class extends ${get prevBlock(){return this._prevBlock}processBlock(e,t){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");this.xorBlock(e,t,this._cipher.cfg.blockSize),this._cipher.encryptBlock(e,t),this._prevBlock=e.slice(t,t+this._cipher.cfg.blockSize)}xorBlock(e,t,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let i=0;i<r;i++)e[t+i]^=s[i]}};var ze=class extends ${get prevBlock(){return this._prevBlock}processBlock(e,t){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");let r=e.slice(t,t+this._cipher.cfg.blockSize);this._cipher.decryptBlock(e,t),this.xorBlock(e,t,this._cipher.cfg.blockSize),this._prevBlock=r}xorBlock(e,t,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let i=0;i<r;i++)e[t+i]^=s[i]}};var z=class extends de{};z.Decryptor=ze;z.Encryptor=Le;var H=class{static pad(e,t){let r=t*4,s=r-e.sigBytes%r,i=s<<24|s<<16|s<<8|s,o=[];for(let h=0;h<s;h+=4)o.push(i);let a=new _(o,s);e.concat(a)}static unpad(e){let t=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=t}};var pe=class extends Z{constructor(e,t,r){super(e,t,Object.assign({blockSize:4,mode:z,padding:H},r))}reset(){if(super.reset(),this.cfg.mode===void 0)throw new Error("missing mode in config");let e;this._xformMode===this.constructor._ENC_XFORM_MODE?e=this.cfg.mode.createEncryptor:(e=this.cfg.mode.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator===e?this._mode.init(this,this.cfg.iv&&this.cfg.iv.words):(this._mode=e.call(this.cfg.mode,this,this.cfg.iv&&this.cfg.iv.words),this._mode.__creator=e)}_doFinalize(){if(this.cfg.padding===void 0)throw new Error("missing padding in config");let e;if(this._xformMode===this.constructor._ENC_XFORM_MODE){if(this.cfg.blockSize===void 0)throw new Error("missing blockSize in config");this.cfg.padding.pad(this._data,this.cfg.blockSize),e=this._process(!0)}else e=this._process(!0),this.cfg.padding.unpad(e);return e}_doProcessBlock(e,t){this._mode.processBlock(e,t)}};var l=class n{constructor(e,t){this.high=e,this.low=t}add(e){let t=this.low+e.low|0,r=t>>>0<this.low>>>0?1:0,s=this.high+e.high+r|0;return new n(s,t)}and(e){return new n(this.high&e.high,this.low&e.low)}not(){return new n(~this.high,~this.low)}or(e){return new n(this.high|e.high,this.low|e.low)}rotL(e){return this.shiftL(e).or(this.shiftR(64-e))}rotR(e){return this.shiftR(e).or(this.shiftL(64-e))}shiftL(e){return e<32?new n(this.high<<e|this.low>>>32-e,this.low<<e):new n(this.low<<e-32,0)}shiftR(e){return e<32?new n(this.high>>>e,this.low>>>e|this.high<<32-e):new n(0,this.high>>>e-32)}xor(e){return new n(this.high^e.high,this.low^e.low)}};var Ke=class n{constructor(e=[],t){this.words=e,this.sigBytes=t!==void 0?t:e.length*8}static create(e=[],t){return new n(e,t)}clone(){let e=this.words.map(t=>new l(t.high,t.low));return new n(e,this.sigBytes)}toX32(){let e=[];for(let t of this.words)e.push(t.high,t.low);return new _(e,this.sigBytes)}};var I=[],Gt=[],Wt=[],Vt=[],qt=[],Xt=[],pt=[],gt=[],ft=[],mt=[];(function(){let n=[];for(let r=0;r<256;r++)r<128?n[r]=r<<1:n[r]=r<<1^283;let e=0,t=0;for(let r=0;r<256;r++){let s=t^t<<1^t<<2^t<<3^t<<4;s=s>>>8^s&255^99,I[e]=s,Gt[s]=e;let i=n[e],o=n[i],a=n[o],h=n[s]*257^s*16843008;Wt[e]=h<<24|h>>>8,Vt[e]=h<<16|h>>>16,qt[e]=h<<8|h>>>24,Xt[e]=h,h=a*16843009^o*65537^i*257^e*16843008,pt[s]=h<<24|h>>>8,gt[s]=h<<16|h>>>16,ft[s]=h<<8|h>>>24,mt[s]=h,e?(e=i^n[n[n[a^i]]],t^=n[n[t]]):e=t=1}})();var Wr=[0,1,2,4,8,16,32,64,128,27,54],ge=class extends pe{constructor(e,t,r){super(e,t,r),super.reset()}decryptBlock(e,t){let r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,pt,gt,ft,mt,Gt),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r}encryptBlock(e,t){this._doCryptBlock(e,t,this._keySchedule,Wt,Vt,qt,Xt,I)}reset(){if(super.reset(),this._nRounds&&this._keyPriorReset===this._key)return;let e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=((this._nRounds=r+6)+1)*4,o=this._keySchedule=[];for(let a=0;a<i;a++)if(a<r)o[a]=t[a];else{let h=o[a-1];a%r?r>6&&a%r===4&&(h=I[h>>>24]<<24|I[h>>>16&255]<<16|I[h>>>8&255]<<8|I[h&255]):(h=h<<8|h>>>24,h=I[h>>>24]<<24|I[h>>>16&255]<<16|I[h>>>8&255]<<8|I[h&255],h^=Wr[a/r|0]<<24),o[a]=o[a-r]^h}this._invKeySchedule=[];for(let a=0;a<i;a++){let h=i-a,g;a%4?g=o[h]:g=o[h-4],a<4||h<=4?this._invKeySchedule[a]=g:this._invKeySchedule[a]=pt[I[g>>>24]]^gt[I[g>>>16&255]]^ft[I[g>>>8&255]]^mt[I[g&255]]}}_doCryptBlock(e,t,r,s,i,o,a,h){let g=e[t]^r[0],p=e[t+1]^r[1],u=e[t+2]^r[2],f=e[t+3]^r[3],R=4;for(let O=1;O<this._nRounds;O++){let w=s[g>>>24]^i[p>>>16&255]^o[u>>>8&255]^a[f&255]^r[R++],y=s[p>>>24]^i[u>>>16&255]^o[f>>>8&255]^a[g&255]^r[R++],B=s[u>>>24]^i[f>>>16&255]^o[g>>>8&255]^a[p&255]^r[R++],it=s[f>>>24]^i[g>>>16&255]^o[p>>>8&255]^a[u&255]^r[R++];g=w,p=y,u=B,f=it}let A=(h[g>>>24]<<24|h[p>>>16&255]<<16|h[u>>>8&255]<<8|h[f&255])^r[R++],U=(h[p>>>24]<<24|h[u>>>16&255]<<16|h[f>>>8&255]<<8|h[g&255])^r[R++],P=(h[u>>>24]<<24|h[f>>>16&255]<<16|h[g>>>8&255]<<8|h[p&255])^r[R++],C=(h[f>>>24]<<24|h[g>>>16&255]<<16|h[p>>>8&255]<<8|h[u&255])^r[R++];e[t]=A,e[t+1]=U,e[t+2]=P,e[t+3]=C}};ge.keySize=256/32;var Vr=[1732584193,4023233417,2562383102,271733878,3285377520],Y=new Array(80),G=class extends E{get hash(){return this._hash}reset(){super.reset(),this._hash=new _(Vr.slice(0))}_doFinalize(){let e=this._nDataBytes*8,t=this._data.sigBytes*8;return this._data.words[t>>>5]|=128<<24-t%32,this._data.words[(t+64>>>9<<4)+14]=Math.floor(e/4294967296),this._data.words[(t+64>>>9<<4)+15]=e,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(e,t){let r=this._hash.words[0],s=this._hash.words[1],i=this._hash.words[2],o=this._hash.words[3],a=this._hash.words[4];for(let h=0;h<80;h++){if(h<16)Y[h]=e[t+h]|0;else{let f=Y[h-3]^Y[h-8]^Y[h-14]^Y[h-16];Y[h]=f<<1|f>>>31}let g,p;h<20?(g=s&i|~s&o,p=1518500249):h<40?(g=s^i^o,p=1859775393):h<60?(g=s&i|s&o|i&o,p=2400959708):(g=s^i^o,p=3395469782);let u=(r<<5|r>>>27)+g+a+p+Y[h];a=o,o=i,i=s<<30|s>>>2,s=r,r=u|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+s|0,this._hash.words[2]=this._hash.words[2]+i|0,this._hash.words[3]=this._hash.words[3]+o|0,this._hash.words[4]=this._hash.words[4]+a|0}};var Zt=[],Ht=[];(function(){function n(s){let i=Math.sqrt(s);for(let o=2;o<=i;o++)if(!(s%o))return!1;return!0}function e(s){return(s-(s|0))*4294967296|0}let t=2,r=0;for(;r<64;)n(t)&&(r<8&&(Zt[r]=e(Math.pow(t,1/2))),Ht[r]=e(Math.pow(t,1/3)),r++),t++})();var Q=[],ee=class extends E{constructor(){super()}reset(){super.reset(),this._hash=new _(Zt.slice(0))}_doFinalize(){let e=this._nDataBytes*8,t=this._data.sigBytes*8;return this._data.words[t>>>5]|=128<<24-t%32,this._data.words[(t+64>>>9<<4)+14]=Math.floor(e/4294967296),this._data.words[(t+64>>>9<<4)+15]=e,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(e,t){let r=this._hash.words[0],s=this._hash.words[1],i=this._hash.words[2],o=this._hash.words[3],a=this._hash.words[4],h=this._hash.words[5],g=this._hash.words[6],p=this._hash.words[7];for(let u=0;u<64;u++){if(u<16)Q[u]=e[t+u]|0;else{let O=Q[u-15],w=(O<<25|O>>>7)^(O<<14|O>>>18)^O>>>3,y=Q[u-2],B=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;Q[u]=w+Q[u-7]+B+Q[u-16]}let f=a&h^~a&g,R=r&s^r&i^s&i,A=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),U=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),P=p+U+f+Ht[u]+Q[u],C=A+R;p=g,g=h,h=a,a=o+P|0,o=i,i=s,s=r,r=P+C|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+s|0,this._hash.words[2]=this._hash.words[2]+i|0,this._hash.words[3]=this._hash.words[3]+o|0,this._hash.words[4]=this._hash.words[4]+a|0,this._hash.words[5]=this._hash.words[5]+h|0,this._hash.words[6]=this._hash.words[6]+g|0,this._hash.words[7]=this._hash.words[7]+p|0}};var ut=[new l(1116352408,3609767458),new l(1899447441,602891725),new l(3049323471,3964484399),new l(3921009573,2173295548),new l(961987163,4081628472),new l(1508970993,3053834265),new l(2453635748,2937671579),new l(2870763221,3664609560),new l(3624381080,2734883394),new l(310598401,1164996542),new l(607225278,1323610764),new l(1426881987,3590304994),new l(1925078388,4068182383),new l(2162078206,991336113),new l(2614888103,633803317),new l(3248222580,3479774868),new l(3835390401,2666613458),new l(4022224774,944711139),new l(264347078,2341262773),new l(604807628,2007800933),new l(770255983,1495990901),new l(1249150122,1856431235),new l(1555081692,3175218132),new l(1996064986,2198950837),new l(2554220882,3999719339),new l(2821834349,766784016),new l(2952996808,2566594879),new l(3210313671,3203337956),new l(3336571891,1034457026),new l(3584528711,2466948901),new l(113926993,3758326383),new l(338241895,168717936),new l(666307205,1188179964),new l(773529912,1546045734),new l(1294757372,1522805485),new l(1396182291,2643833823),new l(1695183700,2343527390),new l(1986661051,1014477480),new l(2177026350,1206759142),new l(2456956037,344077627),new l(2730485921,1290863460),new l(2820302411,3158454273),new l(3259730800,3505952657),new l(3345764771,106217008),new l(3516065817,3606008344),new l(3600352804,1432725776),new l(4094571909,1467031594),new l(275423344,851169720),new l(430227734,3100823752),new l(506948616,1363258195),new l(659060556,3750685593),new l(883997877,3785050280),new l(958139571,3318307427),new l(1322822218,3812723403),new l(1537002063,2003034995),new l(1747873779,3602036899),new l(1955562222,1575990012),new l(2024104815,1125592928),new l(2227730452,2716904306),new l(2361852424,442776044),new l(2428436474,593698344),new l(2756734187,3733110249),new l(3204031479,2999351573),new l(3329325298,3815920427),new l(3391569614,3928383900),new l(3515267271,566280711),new l(3940187606,3454069534),new l(4118630271,4000239992),new l(116418474,1914138554),new l(174292421,2731055270),new l(289380356,3203993006),new l(460393269,320620315),new l(685471733,587496836),new l(852142971,1086792851),new l(1017036298,365543100),new l(1126000580,2618297676),new l(1288033470,3409855158),new l(1501505948,4234509866),new l(1607167915,987167468),new l(1816402316,1246189591)],F=[];(function(){for(let n=0;n<80;n++)F[n]=new l(void 0,void 0)})();var Oe=class extends E{constructor(){super({blockSize:1024/32})}reset(){super.reset(),this._hash=new Ke([new l(1779033703,4089235720),new l(3144134277,2227873595),new l(1013904242,4271175723),new l(2773480762,1595750129),new l(1359893119,2917565137),new l(2600822924,725511199),new l(528734635,4215389547),new l(1541459225,327033209)])}_doFinalize(){let e=this._data,t=e.words,r=this._nDataBytes*8,s=e.sigBytes*8;return t[s>>>5]|=128<<24-s%32,t[(s+128>>>10<<5)+30]=Math.floor(r/4294967296),t[(s+128>>>10<<5)+31]=r,e.sigBytes=t.length*4,this._process(),this._hash.toX32()}_doProcessBlock(e,t){let r=this._hash.words[0].high,s=this._hash.words[0].low,i=this._hash.words[1].high,o=this._hash.words[1].low,a=this._hash.words[2].high,h=this._hash.words[2].low,g=this._hash.words[3].high,p=this._hash.words[3].low,u=this._hash.words[4].high,f=this._hash.words[4].low,R=this._hash.words[5].high,A=this._hash.words[5].low,U=this._hash.words[6].high,P=this._hash.words[6].low,C=this._hash.words[7].high,O=this._hash.words[7].low;for(let w=0;w<80;w++){let y,B;if(w<16)B=F[w].high=e[t+w*2]|0,y=F[w].low=e[t+w*2+1]|0;else{let Pt=F[w-15],te=Pt.high,ye=Pt.low,Mr=(te>>>1|ye<<31)^(te>>>8|ye<<24)^te>>>7,Ct=(ye>>>1|te<<31)^(ye>>>8|te<<24)^(ye>>>7|te<<25),Bt=F[w-2],re=Bt.high,xe=Bt.low,jr=(re>>>19|xe<<13)^(re<<3|xe>>>29)^re>>>6,kt=(xe>>>19|re<<13)^(xe<<3|re>>>29)^(xe>>>6|re<<26);y=Ct+F[w-7].low,B=Mr+F[w-7].high+(y>>>0<Ct>>>0?1:0),y=y+kt,B=B+jr+(y>>>0<kt>>>0?1:0),y=y+F[w-16].low,B=B+F[w-16].high+(y>>>0<F[w-16].low>>>0?1:0),F[w].high=B,F[w].low=y}let it=u&R^~u&U,It=f&A^~f&P,Br=r&i^r&a^i&a,kr=s&o^s&h^o&h,Fr=(r>>>28|s<<4)^(r<<30|s>>>2)^(r<<25|s>>>7),At=(s>>>28|r<<4)^(s<<30|r>>>2)^(s<<25|r>>>7),Ur=(u>>>14|f<<18)^(u>>>18|f<<14)^(u<<23|f>>>9),Nr=(f>>>14|u<<18)^(f>>>18|u<<14)^(f<<23|u>>>9),v=O+Nr,W=C+Ur+(v>>>0<O>>>0?1:0);v=v+It,W=W+it+(v>>>0<It>>>0?1:0),v=v+ut[w].low,W=W+ut[w].high+(v>>>0<ut[w].low>>>0?1:0),v=v+y,W=W+B+(v>>>0<y>>>0?1:0);let vt=At+kr,Dr=Fr+Br+(vt>>>0<At>>>0?1:0);C=U,O=P,U=R,P=A,R=u,A=f,f=p+v|0,u=g+W+(f>>>0<p>>>0?1:0)|0,g=a,p=h,a=i,h=o,i=r,o=s,s=v+vt|0,r=W+Dr+(s>>>0<v>>>0?1:0)|0}this._hash.words[0].low=this._hash.words[0].low=this._hash.words[0].low+s,this._hash.words[0].high=this._hash.words[0].high+r+(this._hash.words[0].low>>>0<s>>>0?1:0),this._hash.words[1].low=this._hash.words[1].low=this._hash.words[1].low+o,this._hash.words[1].high=this._hash.words[1].high+i+(this._hash.words[1].low>>>0<o>>>0?1:0),this._hash.words[2].low=this._hash.words[2].low=this._hash.words[2].low+h,this._hash.words[2].high=this._hash.words[2].high+a+(this._hash.words[2].low>>>0<h>>>0?1:0),this._hash.words[3].low=this._hash.words[3].low=this._hash.words[3].low+p,this._hash.words[3].high=this._hash.words[3].high+g+(this._hash.words[3].low>>>0<p>>>0?1:0),this._hash.words[4].low=this._hash.words[4].low=this._hash.words[4].low+f,this._hash.words[4].high=this._hash.words[4].high+u+(this._hash.words[4].low>>>0<f>>>0?1:0),this._hash.words[5].low=this._hash.words[5].low=this._hash.words[5].low+A,this._hash.words[5].high=this._hash.words[5].high+R+(this._hash.words[5].low>>>0<A>>>0?1:0),this._hash.words[6].low=this._hash.words[6].low=this._hash.words[6].low+P,this._hash.words[6].high=this._hash.words[6].high+U+(this._hash.words[6].low>>>0<P>>>0?1:0),this._hash.words[7].low=this._hash.words[7].low=this._hash.words[7].low+O,this._hash.words[7].high=this._hash.words[7].high+C+(this._hash.words[7].low>>>0<O>>>0?1:0)}};var $e=class{constructor(e,t){this._hasher=new e;let r=typeof t=="string"?b.parse(t):t,s=this._hasher.cfg.blockSize,i=s*4;r.sigBytes>i&&(r=this._hasher.finalize(r)),r.clamp();let o=this._oKey=r.clone(),a=this._iKey=r.clone(),h=o.words,g=a.words;for(let p=0;p<s;p++)h[p]^=1549556828,g[p]^=909522486;o.sigBytes=a.sigBytes=i,this.reset()}finalize(e){let t=this._hasher.finalize(e);return this._hasher.reset(),this._hasher.finalize(this._oKey.clone().concat(t))}reset(){this._hasher.reset(),this._hasher.update(this._iKey)}update(e){return this._hasher.update(e),this}};var Ie=class n{constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:ee,iterations:25e4},e)}static execute(e,t,r){return new n(r).compute(e,t)}compute(e,t){let r=this.cfg,s=new $e(r.hasher,e),i=new _,o=new _([1]),a=i.words,h=o.words,g=r.keySize,p=r.iterations;for(;a.length<g;){let u=s.update(t).finalize(o);s.reset();let f=u.words,R=f.length,A=u;for(let U=1;U<p;U++){A=s.finalize(A),s.reset();let P=A.words;for(let C=0;C<R;C++)f[C]^=P[C]}i.concat(u),h[0]++}return i.sigBytes=g*4,i}};var Ae=pe._createHelper(ge);var fe=E._createHelper(M);var me=E._createHelper(G);var Ge=E._createHelper(ee);var We=E._createHelper(Oe);var ue=class{constructor(e,t,r){this._password=e;this._salt=t;this._initVector=r;this._mode=z;this._padding=H}get _iv(){return this._initVector?L.parse(this._initVector):void 0}decryptAES(e){return Ae.decrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString(b)}encryptAES(e){return Ae.encrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString()}_buildKey(){return Ie.execute(this._password,L.parse(this._salt),{keySize:256/32,iterations:1e3,hasher:G})}};var Ve=class{static base64Decode(e){return b.stringify(D.parse(e))}static base64Encode(e){return D.stringify(b.parse(e))}static md5(e){return fe(e).toString()}static sha1(e){return me(e).toString()}static sha256(e){return Ge(e).toString()}static sha512(e){return We(e).toString()}};var Jt=(c=>(c[c.Continue=100]="Continue",c[c.SwitchingProtocols=101]="SwitchingProtocols",c[c.Processing=102]="Processing",c[c.EarlyHints=103]="EarlyHints",c[c.Ok=200]="Ok",c[c.Created=201]="Created",c[c.Accepted=202]="Accepted",c[c.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",c[c.NoContent=204]="NoContent",c[c.ResetContent=205]="ResetContent",c[c.PartialContent=206]="PartialContent",c[c.MultiStatus=207]="MultiStatus",c[c.AlreadyReported=208]="AlreadyReported",c[c.ImUsed=226]="ImUsed",c[c.MultipleChoices=300]="MultipleChoices",c[c.MovedPermanently=301]="MovedPermanently",c[c.Found=302]="Found",c[c.SeeOther=303]="SeeOther",c[c.NotModified=304]="NotModified",c[c.UseProxy=305]="UseProxy",c[c.Unused=306]="Unused",c[c.TemporaryRedirect=307]="TemporaryRedirect",c[c.PermanentRedirect=308]="PermanentRedirect",c[c.BadRequest=400]="BadRequest",c[c.Unauthorized=401]="Unauthorized",c[c.PaymentRequired=402]="PaymentRequired",c[c.Forbidden=403]="Forbidden",c[c.NotFound=404]="NotFound",c[c.MethodNotAllowed=405]="MethodNotAllowed",c[c.NotAcceptable=406]="NotAcceptable",c[c.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",c[c.RequestTimeout=408]="RequestTimeout",c[c.Conflict=409]="Conflict",c[c.Gone=410]="Gone",c[c.LengthRequired=411]="LengthRequired",c[c.PreconditionFailed=412]="PreconditionFailed",c[c.PayloadTooLarge=413]="PayloadTooLarge",c[c.UriTooLong=414]="UriTooLong",c[c.UnsupportedMediaType=415]="UnsupportedMediaType",c[c.RangeNotSatisfiable=416]="RangeNotSatisfiable",c[c.ExpectationFailed=417]="ExpectationFailed",c[c.ImATeapot=418]="ImATeapot",c[c.MisdirectedRequest=421]="MisdirectedRequest",c[c.UnprocessableEntity=422]="UnprocessableEntity",c[c.Locked=423]="Locked",c[c.FailedDependency=424]="FailedDependency",c[c.TooEarly=425]="TooEarly",c[c.UpgradeRequired=426]="UpgradeRequired",c[c.PreconditionRequired=428]="PreconditionRequired",c[c.TooManyRequests=429]="TooManyRequests",c[c.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",c[c.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",c[c.InternalServerError=500]="InternalServerError",c[c.NotImplemented=501]="NotImplemented",c[c.BadGateway=502]="BadGateway",c[c.ServiceUnavailable=503]="ServiceUnavailable",c[c.GatewayTimeout=504]="GatewayTimeout",c[c.HttpVersionNotSupported=505]="HttpVersionNotSupported",c[c.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",c[c.InsufficientStorage=507]="InsufficientStorage",c[c.LoopDetected=508]="LoopDetected",c[c.NotExtended=510]="NotExtended",c[c.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",c))(Jt||{});var qe=class{constructor(e){this._baseCode=e;this._crcLength=5;this._seed="changeme"}get baseCode(){return this._baseCode}get secureCode(){return this._encode()}static check(e,t){if(new this(e).secureCode!==t)throw q.build("WRONG_SECURE_CODE","WRONG_SECURE_CODE",400)}_encode(){let e=new M;return e.update(b.parse(this._seed+this._baseCode)),e.finalize().toString(L).substring(0,this._crcLength).toUpperCase()}};var _e=require("class-transformer"),Xe=require("ts-luxon");var Yt=(f=>(f.ACTIVATE="ACTIVATE",f.BLOCK="BLOCK",f.CHECK="CHECK",f.DIGITAL_ACTIVATE="DIGITAL_ACTIVATE",f.FREEZE="FREEZE",f.PURCHASE="PURCHASE",f.RECHARGE="RECHARGE",f.ROLLBACK="ROLLBACK",f.TRANSACTION="TRANSACTION",f.TRANSACTION_DETAIL="TRANSACTION_DETAIL",f.UNFREEZE="UNFREEZE",f.XREFUND="XREFUND",f))(Yt||{});var Qt=(s=>(s.MD5="MD5",s.MD5_HMAC="MD5_HMAC",s.SHA1="SHA1",s.SHA1_HMAC="SHA1_HMAC",s))(Qt||{});var Ze=class{constructor(e="ACTIVATION",t,r,s){this.gc=e;this.op=t;this.ot=r;this._hashStrategies={MD5:e=>fe(e),MD5_HMAC:e=>{let t=new M;return t.update(b.parse(e)),t.finalize()},SHA1:e=>me(e),SHA1_HMAC:e=>{let t=new G;return t.update(b.parse(e)),t.finalize()}};this._hashStrategy=this._hashStrategies.MD5;this._dto=typeof s=="number"&&s>=0?Xe.DateTime.fromMillis(+`${s}000`.slice(0,13)):Xe.DateTime.local()}static{this._AES_ENCODER=new ue("changeme","5f6eae61d2428b99","d92fbf214e16a79fd36f9a5185ae733f")}static{this._LOGGER=console}static{this._OP_CODES={CHECK:"",TRANSACTION:"",TRANSACTION_DETAIL:"",ACTIVATE:"A",BLOCK:"B",DIGITAL_ACTIVATE:"D",FREEZE:"F",PURCHASE:"P",RECHARGE:"G",ROLLBACK:"R",UNFREEZE:"U",XREFUND:"X"}}static{this._SEP="_"}get dto(){return this._dto}get hash(){return this._hashStrategy(this.toString()).toString()}get iso(){return this.dto.toUTC().toISO()}get ts(){return this._dto.ts}static build({gc:e,op:t,ot:r,dto:s}){return new this(e,t,r,s?.ts)}static explode(e){let t=this.constructor,r=(e||"").split(t._SEP);if(r.length<4)throw new Error(`INVALID_TRANSACTION "${e}"`);return this.build({gc:r[1],op:t.prefixToOperation(r[2]),dto:Xe.DateTime.fromSeconds(+r[3])})}static isBase64(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)&&e.length%4===0}static parse(e){this._LOGGER.info(`${this.constructor.name}: trying to parse ${e}`);try{if(this.isBase64(e)){let t=this.constructor._AES_ENCODER.decryptAES(e),r=JSON.parse(t);return(0,_e.plainToInstance)(this,r)}else return this.explode(e)}catch(t){throw this._LOGGER.error(`${this.constructor.name}: failed to parse ${e}`,t),new Error(`UNPARSEABLE "${e}"`)}}static prefixToOperation(e){return Object.entries(this._OP_CODES).find(([,r])=>r===e)[0]}serialize(){return(0,_e.instanceToPlain)(this,{excludePrefixes:["_"]})}toString(){let e=JSON.stringify(this.serialize());return this.constructor._AES_ENCODER.encryptAES(e)}};j([(0,_e.Expose)()],Ze.prototype,"ts",1);var er=(r=>(r.ListDetectiveValidator="ListDetectiveValidator",r.MXValidator="MXValidator",r.SyntaxValidator="SyntaxValidator",r))(er||{});var qr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function rr(n){return n.match(qr)}var cr="\\ud800-\\udfff",Xr="\\u0300-\\u036f",Zr="\\ufe20-\\ufe2f",Hr="\\u20d0-\\u20ff",Jr="\\u1ab0-\\u1aff",Yr="\\u1dc0-\\u1dff",Qr=Xr+Zr+Hr+Jr+Yr,hr="\\u2700-\\u27bf",lr="a-z\\xdf-\\xf6\\xf8-\\xff",es="\\xac\\xb1\\xd7\\xf7",ts="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",rs="\\u2000-\\u206f",ss=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",dr="A-Z\\xc0-\\xd6\\xd8-\\xde",is="\\ufe0e\\ufe0f",pr=es+ts+rs+ss,gr="['\u2019]",sr=`[${pr}]`,os=`[${Qr}]`,fr="\\d",ns=`[${hr}]`,mr=`[${lr}]`,ur=`[^${cr}${pr+fr+hr+lr+dr}]`,as="\\ud83c[\\udffb-\\udfff]",cs=`(?:${os}|${as})`,hs=`[^${cr}]`,_r="(?:\\ud83c[\\udde6-\\uddff]){2}",wr="[\\ud800-\\udbff][\\udc00-\\udfff]",we=`[${dr}]`,ls="\\u200d",ir=`(?:${mr}|${ur})`,ds=`(?:${we}|${ur})`,or=`(?:${gr}(?:d|ll|m|re|s|t|ve))?`,nr=`(?:${gr}(?:D|LL|M|RE|S|T|VE))?`,yr=`${cs}?`,xr=`[${is}]?`,ps=`(?:${ls}(?:${[hs,_r,wr].join("|")})${xr+yr})*`,gs="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",fs="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ms=xr+yr+ps,ar=`(?:${[ns,_r,wr].join("|")})${ms}`,ve=class{static{this.HAS_UNICODE_WORD=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/)}static{this.RE_UNICODE_WORDS=RegExp([`${we}?${mr}+${or}(?=${[sr,we,"$"].join("|")})`,`${ds}+${nr}(?=${[sr,we+ir,"$"].join("|")})`,`${we}?${ir}+${or}`,`${we}+${nr}`,fs,gs,`${fr}+`,ar].join("|"),"g")}static{this.RS_EMOJI=ar}static unicodeWords(e){return e.match(this.RE_UNICODE_WORDS)}};var _t=class n{static arrayRemove(e,t){let r=[],s=e.filter((i,o)=>t(i,o)&&r.push(o));return r.reverse().forEach(i=>e.splice(i,1)),s}static assertIsArray(e,t){if(!Array.isArray(e))throw new Error(t||"KikCommonUtils => val was not an array")}static assertIsBoolean(e,t){if(!this.isBoolean(e))throw new Error(t||"KikCommonUtils => val was not boolean")}static assertIsFunction(e,t){if(!this.isFunction(e))throw new Error(t||"KikCommonUtils => entity was not a function")}static assertIsInstance(e,t,r){if(!(e instanceof t))throw new Error(r||"KikCommonUtils => val was not instance of class")}static assertIsNotEmpty(e,t){if(this.isEmpty(e))throw new Error(t||"KikCommonUtils => entity was empty")}static assertIsNumber(e,t){if(typeof e!="number")throw new Error(t||"KikCommonUtils => val was not numeric")}static assertIsNumeric(e,t){if(!this.isNumeric(e))throw new Error(t||"KikCommonUtils => val was not numeric")}static assertIsObject(e,t){if(!this.isObject(e))throw new Error(t||"KikCommonUtils => val was not an object")}static assertIsString(e,t){if(!this.isString(e))throw new Error(t||"KikCommonUtils => val was not a string")}static assertIsTruthy(e,t){if(!e)throw new Error(t||"KikCommonUtils => condition wasn't truthy")}static buildPath(...e){let t=e.filter(r=>!!r).join("/").replace(/(?<!:)\/\/+/g,"/");return t.startsWith("http")&&!t.endsWith("/")?`${t}/`:t}static downloadBlob(e,t){let r=window.URL.createObjectURL(e),s=document.createElement("a");s.href=r,s.setAttribute("download",t),document.body.appendChild(s),s.click()}static generateRandomHexString(e=12){let t="0123456789abcdef",r="";for(let s=0;s<e;s++){let i=Math.floor(Math.random()*t.length);r+=t[i]}return r}static generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}static getDecimalPrecision(e){if(this.assertIsNumeric(e),!isFinite(+e))return 0;let t=1,r=0;for(;Math.round(+e*t)/t!==e;)t*=10,r++;return r}static getType(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}static isBoolean(e){return typeof e=="boolean"}static isColor(e){if(!e||!this.isString(e))return!1;let t=new Option().style;return t.color=e,t.color!==""}static isEmpty(e){return!e&&e!==0}static isEqual(e,t){function r(){if(e.length!==t.length)return!1;for(let h=0;h<e.length;h++)if(!n.isEqual(e[h],t[h]))return!1;return!0}function s(){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let h in e)if(Object.prototype.hasOwnProperty.call(e,h)&&!n.isEqual(e[h],t[h]))return!1;return!0}function i(){return e.toString()===t.toString()}function o(){return e===t}let a=this.getType(e);return a!==this.getType(t)?!1:a==="array"?r():a==="object"?s():a==="function"?i():o()}static isFormField(e){return/^(?:input|select|textarea|button)$/i.test(e.nodeName)}static isFunction(e){return typeof e==typeof isNaN}static isNotEmpty(e){return!this.isEmpty(e)}static isNumber(e){return typeof e=="number"&&this.isNumeric(e)}static isNumeric(e){return!isNaN(e)}static isObject(e){return!!e&&e===Object(e)&&e.constructor===Object}static isPrimitive(e){let t=this.getType(e);return t!=="function"&&(t!=="object"||!e)}static isString(e){return typeof e=="string"}static isWindows(){return navigator.userAgent.toLowerCase().includes("win")}static mapObject(e,t){if(this.assertIsFunction(t,`CommonUtils => expected type of iteratee to be Function, got ${typeof t}`),this.isObject(e))return Object.entries(e).reduce((r,[s,i])=>(r.push(t(i,s)),r),[]);if(Array.isArray(e))return e.map(t);throw new Error(`CommonUtils => invalid object provided. Expected Object or Array, got ${typeof t}`)}static mapObjectKeys(e,t){return Object.entries(e).reduce((r,[s,i])=>(r[s]=t.call(null,s,i),r),{})}static mapObjectValues(e,t){return this.isObject(e)?Object.entries(e).reduce((r,[s,i])=>(r[s]=t.call(null,i,s),r),{}):{}}static noop(){}static objectHasValue(e,t){return!!~Object.values(e).filter(r=>this.isEqual(r,t))}static parseBoolean(e){return e?/^true$/i.test(e):!1}static parseJsonSafely(e){try{return JSON.parse(e)}catch(t){console.warn("KikCommonUtils => couldn't parse json string",{str:e,error:t});return}}static pick(e,t){return t.reduce((r,s)=>(s in e&&(r[s]=e[s]),r),{})}static runSafely(e,t=null,r=[]){if(this.isFunction(e))return e.apply(t,r)}static sleep(e){return new Promise(t=>setTimeout(t,e))}static sprintf(e,...t){return this.isString(e)&&t.length?this.sprintf(e.replace("%s",String(t.shift())),...t):e}static stripComments(e){return typeof e=="string"?e.replace(/(<!--.*?-->)|(<!--[\S\s]+?-->)|(<!--[\S\s]*?$)/g,""):e}static submitFakeForm({action:e,method:t="POST",data:r,target:s}){let i=Object.entries(r||{}).map(([a,h])=>`<input name="${a}" type="hidden" value="${h}" />`),o=document.createElement("form");o.method=t,o.action=e,o.innerHTML=`${i}`,o.target=s||"_self",document.body.append(o),o.submit()}static toCamelCase(e){return this.words(e.replace(/['\u2019]/g,"")).reduce((t,r,s)=>(r=r.toLowerCase(),t+(s?r.charAt(0).toUpperCase()+r.slice(1):r)),"")}static toKebabCase(e){return this.words(e.replace(/['\u2019]/g,"")).join("-").toLowerCase()}static toPascalCase(e){return this.toCamelCase(e).replace(/^(.)/,t=>t.toUpperCase())}static toSnakeCase(e){return this.words(e.replace(/['\u2019]/g,"")).join("_").toLowerCase()}static toUpperSnakeCase(e){return this.toSnakeCase(e).toUpperCase()}static words(e,t){return t===void 0?(ve.HAS_UNICODE_WORD(e)?ve.unicodeWords(e):rr(e))||[]:e.match(t)||[]}};var wt=class extends Error{constructor(t="Filter Exception",r){super();this.message=t;this.data=r}};var yt=require("ts-luxon"),xt=class n{constructor(e=`gcpsid-xxxx-${+yt.DateTime.now().ts}`,t=0){this.value=e;this.expiry=t;this._controlSuffix="$1"}get active(){return this.value.endsWith(this._controlSuffix)}get expired(){return yt.DateTime.now().ts>this.expiry}get valid(){return!this.expired}static parse(e){return new n(e.value,e.expiry)}toPlain(){return{value:this.value,expiry:this.expiry}}};Ee();var Et=class{static get COUNTRY(){return this._country}static get DOMAIN(){return/^(?!www)(\w)([\w.-])*\.[a-z]{2,6}$/}static get EMAIL(){return/^[^\\|!"£$%&/()='?^€*[\]°#§<>,;:\s]+@[a-z0-9.-]+\.[a-z]{2,6}$/}static get LANGUAGE(){return this._language}static get LATIN_CHARS(){return/^[\u0000-\u024F\u1E00-\u1EFF\u2C60-\u2C7F\uA720-\uA7FF]+/}static get LOCALE(){return new RegExp(`${this._country.source}-${this._language.source}`)}static get NO_EMOJI_NO_PUNCTUATION(){return/[^\p{Emoji_Presentation}|\p{P}]/gu}static get PHONE_NUMBER(){return/^(\+\d{1,4}\s)(\d{4,15})$/}static get PHONE_NUMBER_BY_PREFIX(){return{"+971":{dontStartWithZero:/^(\+\d{3}\s)([1-9])/,typeExactlyNineDigits:/^(\+\d{3}\s)([1-9]\d{8}$)/}}}static get TAXCODE_BY_COUNTRY(){return{ES:{DNI:/^\d{8}[A-Z]$/,NIE:/^[A-Z]\d{7}[A-Z]$/,CIF:/^[A-Z]\d{8}$/}}}static{this._country=/[a-zA-Z]{2}/}static{this._language=/[a-z]{2}/}};var Pe=class{constructor(e,t){this._storage=e;this._prefix=t}flush(){Object.keys(this._storage).filter(e=>e.startsWith(this._prefix)).forEach(this.remove.bind(this))}read(e){let t=this._storage.getItem(this._prefix+e);try{return t?JSON.parse(t):void 0}catch{return}}remove(e){this._storage.removeItem(this._prefix+e)}write(e,t){this._storage.setItem(this._prefix+e,JSON.stringify(t))}};var Ce=class{static{this._storage=new Map}get staticStorage(){return this.constructor._storage}flush(){this.staticStorage.clear()}read(e){return this.staticStorage.get(e)}remove(e){this.staticStorage.delete(e)}write(e,t){this.staticStorage.set(e,t)}};var Be=class extends Pe{constructor(){super(sessionStorage,"smp_rest_cache_")}};var Rt=class{static{this._cachePrefix="kik_rest_cache_"}static{this._cacheStrategy=typeof sessionStorage<"u"?new Be:new Ce}static{this._config={cachePrefix:this._cachePrefix,shared:new Map}}static{this._errorClass=q}static{this._mergeParamsFallbackBaseUrl="https://ts-mapi-core"}static $http(e){return this._generateAjax(e)}static async _generateAjax(e){if(e.cacheKey){let t=this._cacheRead(e.cacheKey);return t?Promise.resolve(t):this._generateAjaxBase(e).then(r=>(e.cacheKey&&this._cacheWrite(e.cacheKey,r),r))}return this._generateAjaxBase(e)}static async _generateAjaxBase(e){let t=await this._preprocessRequest(e),r={method:t.method,headers:new Headers({"content-type":"application/json",...t.headers}),body:t.body?JSON.stringify(t.body):null};return t.useCredentials&&(r.credentials="include"),t.url=this.mergeQueryParams(t.url,t.queryParams),fetch(t.url,r).then(s=>this._preprocessResponse(e,s)).then(s=>{if(s.ok){if(s.status===204||s.headers.get("content-length")==="0")return null;switch(t.responseType){case"blob":return s.blob();case"arraybuffer":return s.arrayBuffer();case"text":return s.text();case"json":default:return s.json()}}return s.json().then(i=>{let o=i;try{o=this._errorClass.fromPlain(i)}catch(a){console.debug("http: failed to parse error response into ErrorResponse",a)}return Promise.reject({status:s.status,message:s.statusText,body:o})})})}static cacheFlush(){this._cacheStrategy.flush()}static mergeQueryParams(e,t){let r=e.startsWith("http");if(t){let s=new URL(e,globalThis?.location?.origin||this._mergeParamsFallbackBaseUrl),i=Object.fromEntries(s.searchParams.entries());s.search=new URLSearchParams({...i,...Object.fromEntries(Object.entries(t).map(([o,a])=>[o,`${a}`]))}).toString(),e=r?s.href:s.pathname+s.search}return e}static _cacheKey(e){return`${this._config.cachePrefix}${e}`}static _cachePop(e){let t=this._cacheRead(e);return this._cacheRemove(e),t}static _cacheRead(e){return this._cacheStrategy.read(this._cacheKey(e))}static _cacheRemove(e){this._cacheStrategy.remove(this._cacheKey(e))}static _cacheWrite(e,t){this._cacheStrategy.write(this._cacheKey(e),t)}static async _preprocessRequest(e){return e}static async _preprocessResponse(e,t){return t}};var ws="1.2.0";Object.defineProperties(module.exports,{smpRxjsCatchOnly:{get:()=>(tt(),se(et)).smpRxjsCatchOnly},smpRxjsThrowIfEmpty:{get:()=>(tt(),se(et)).smpRxjsThrowIfEmpty},smpRxjsThrowOnCondition:{get:()=>(tt(),se(et)).smpRxjsThrowOnCondition},SmpDynamoService:{get:()=>(vr(),se(Ar)).SmpDynamoService},SmpFirebaseService:{get:()=>(Cr(),se(Pr)).SmpFirebaseService}});0&&(module.exports={SMP_HEALTHZ,SmpAesCrypt,SmpApiCommonUtils,SmpBrowserCache,SmpCommonUtils,SmpCrypto,SmpErrorResponse,SmpFilterException,SmpFirebaseErrors,SmpGenericResponse,SmpGiftcardTransaction,SmpGiftcardTransactionHashStrategies,SmpGiftcardTransactionOps,SmpHttpService,SmpHttpSessionStorageCache,SmpHttpStatusCodes,SmpInMemoryCache,SmpMarketingCloudValidators,SmpRegularExpressions,SmpResponseMessage,SmpResponseMessageTypes,SmpRestVerbs,SmpSecureCode,SmpSid,SmpSocialSignInKeys,SmpSocialSignInUxModes,VERSION,smpNoop});
2
2
  //# sourceMappingURL=index.cjs.map