From 88ea061a69160004a019d7a4421914cc39bc626a Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 8 Apr 2024 01:08:16 +0000 Subject: [PATCH] Update self hosted dependency --- libs/deps/imslib.min.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/libs/deps/imslib.min.js b/libs/deps/imslib.min.js index 57efbcc43f..079ea01d6e 100644 --- a/libs/deps/imslib.min.js +++ b/libs/deps/imslib.min.js @@ -1,14 +1,16 @@ var roll=function(){ - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};function t(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var r=function(){return(r=Object.assign||function(e){for(var t,r=1,i=arguments.length;r0&&o[o.length-1])&&(6===n[0]||2===n[0])){s=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]0)&&!(i=n.next()).done;)s.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function a(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(Object.keys(a)),u=c.next();!u.done;u=c.next()){var l=u.value;if(r===l||r.endsWith("."+l))return new e(!0,a[l],o)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(s=c.return)&&s.call(c)}finally{if(n)throw n.error}}}return new e(!1,o)},e.prototype.shouldFallbackToAdobe=function(e){return!!this.proxied&&("feature_disabled"===e.error&&"cdsc"===e.error_description)},e.THIRD_PARTY_DOMAINS_PROD={"behance.net":"https://sso.behance.net"},e.THIRD_PARTY_DOMAINS_STAGE={"s2stagehance.com":"https://sso.s2stagehance.com"},e}(),g=new(function(){function e(){this.baseUrlAdobe="",this.baseUrlServices="",this.checkTokenEndpoint=new m,this.jslibver="v2-v0.40.0-17-g241fb07"}return e.prototype.loadEnvironment=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r="");var i=e===l.STAGE;i?(this.baseUrlAdobe="https://ims-na1-stg1.adobelogin.com",this.baseUrlServices="https://adobeid-na1-stg1.services.adobe.com"):(this.baseUrlAdobe="https://ims-na1.adobelogin.com",this.baseUrlServices="https://adobeid-na1.services.adobe.com"),this.checkTokenEndpoint=m.computeEndpoint(t,r,i,this.baseUrlServices)},e}());function y(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)}function k(e,t){if(null==e)return t;if(e===t)return e;if(!y(e))return e;var r=Object.assign({},e);return y(t)&&Object.keys(t).forEach((function(i){var o,n;y(t[i])?i in e?r[i]=k(e[i],t[i]):Object.assign(r,((o={})[i]=t[i],o)):Object.assign(r,((n={})[i]=t[i],n))})),r}var w=new(function(){function e(){this.getCustomApiParameters=function(e,t){return e[t]||{}}}return e.prototype.mergeExternalParameters=function(e,t,r){return k(this.getCustomApiParameters(t,r),e)},e.prototype.toJson=function(e){try{return"string"!=typeof e?e:JSON.parse(e)}catch(e){return null}},e}()),b=function(){function e(){}return e.getInitialRedirectUri=function(e,t){var r=e.redirect_uri||t||window.location.href,i="function"==typeof r?r():r,o=i.indexOf("from_ims");return-1===o?i:("#"===i[o-1]&&o--,i.substr(0,o))},e.createDefaultRedirectUrl=function(e,t,r,i){var o=this.getInitialRedirectUri(r,e),n=this.createOldHash(o);return n.indexOf("?")>0?n+"&client_id="+t+"&api="+i:n+"?client_id="+t+"&api="+i},e.createRedirectUrl=function(e,t,r,i,o){void 0===o&&(o="");var n=this.createDefaultRedirectUrl(e,t,r,i);(o=o||r.scope||"")&&(n=n+"&scope="+o);var s=r.reauth||"";return s&&(n=n+"&reauth="+s),n},e.createOldHash=function(e){var t=e.indexOf("#");return t<0?e+"#old_hash=&from_ims=true":e.substring(0,t)+"#old_hash="+e.substring(t+1)+"&from_ims=true"},e.mergeApiParamsWithExternalParams=function(e,t,r){return k(w.getCustomApiParameters(e,r),t)},e}(),S=function(){var e=this;this.composeRedirectUrl=function(e){var t=e.apiParameters,i=e.externalParameters,o=void 0===i?{}:i,n=e.adobeIdRedirectUri,s=void 0===n?"":n,a=e.clientId,c=e.locale,u=e.state,l=void 0===u?{}:u,d=e.scope,p=void 0===d?o.scope||t.scope||"":d,h=b.mergeApiParamsWithExternalParams(t,o,"authorize");l&&(h.state=k(h.state||{},l));var f=b.createRedirectUrl(s,a,h,"authorize",p),v=o.locale||c||"",m=e.response_type,y=void 0===m?h.response_type||"":m;return r(r({},h),{client_id:a,scope:p,locale:v,response_type:y,jslVersion:g.jslibver,redirect_uri:f})},this.createRedirectUrl=function(t){var r=e.composeRedirectUrl(t),i=v.uriEncodeData(r);return g.baseUrlAdobe+"/ims/authorize/v1?"+i}},I=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.signIn=function(e){var r=t.createRedirectUrl(e);v.setHrefUrl(r)},t.authorizeToken=function(e,r){var i=t.composeRedirectUrl(r);e&&(i.user_assertion=e,i.user_assertion_type="urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),t.createAuthorizeForm(i).submit()},t}return t(r,e),r.prototype.createAuthorizeForm=function(e){var t=g.baseUrlAdobe+"/ims/authorize/v1",r=document.createElement("form");r.style.display="none",r.setAttribute("method","post"),r.setAttribute("action",t);var i=null,o=null,n="";for(var s in e){if("object"==typeof(o=e[s])){if(0===Object.keys(o).length)continue;n=JSON.stringify(o)}else n=o;""!==n&&(i=this.createFormElement("input","text",s,n),r.appendChild(i))}return document.getElementsByTagName("body")[0].appendChild(r),r},r.prototype.createFormElement=function(e,t,r,i){var o=document.createElement(e);return o.setAttribute("type",t),o.setAttribute("name",r),o.setAttribute("value",i),o},r}(S),_=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/,T=["https://auth.services.adobe.com","https://auth-stg1.services.adobe.com","https://localhost.corp.adobe.com:9000"],P=new function(){var e=this;this.windowObjectReference=null,this.previousUrl="",this.openSignInWindow=function(t,r,i,o){e.onProcessLocation=o,e.allowOrigin=i.allowOrigin,e.timerId&&clearInterval(e.timerId),window.removeEventListener("message",e.receiveMessage),window.addEventListener("message",e.receiveMessage),e.broadcastChannel&&e.broadcastChannel.close(),e.broadcastChannel=new BroadcastChannel("imslib"),e.broadcastChannel.onmessage=e.receiveMessage;var n="popup=yes, width="+i.width+", height="+i.height+", top="+i.top+", left="+i.left;!e.windowObjectReference||e.windowObjectReference&&e.windowObjectReference.closed?e.windowObjectReference=window.open(t,i.title,n):e.previousUrl!==t?(e.windowObjectReference=window.open(t,i.title,n),e.windowObjectReference&&e.windowObjectReference.focus()):e.windowObjectReference.focus(),e.previousUrl=t},this.receiveMessage=function(t){if(a(T,[e.allowOrigin]).includes(t.origin)){try{if(!_.test(t.data))return void console.warn("refused to receive message containing unknown data format",t.data)}catch(e){return void console.error(e)}e.broadcastChannel&&e.broadcastChannel.close(),e.onProcessLocation&&e.onProcessLocation(t.data)}else console.warn("refused to receive message from origin not whitelisted",t.origin)}},R=function(e){function i(t,i){var o=e.call(this)||this;return o.signIn=function(e){e.state=r(r({},e.state),{imslibmodal:!0});var t=e.state.nonce,i=o.createRedirectUrl(e);P.openSignInWindow(i,t,o.popupSettings,o.onPopupMessage)},o.onPopupMessage=t,o.popupSettings=i,o}return t(i,e),i}(S),E=function(){function e(e,t){this.status=0,this.data="",this.status=e,this.data=this.toJson(t)}return e.prototype.toJson=function(e){try{return"string"!=typeof e?e:JSON.parse(e)}catch(t){return e}},e}(),A=new(function(){function e(){}return e.prototype.http=function(e){return new Promise((function(t,r){var i=new(0,window.XMLHttpRequest);"boolean"==typeof e.withCredentials?i.withCredentials=e.withCredentials:i.withCredentials=!0,"number"==typeof e.timeout&&(i.timeout=e.timeout),i.open(e.method,e.url,!0);var o;i.onload=function(){return this.status>=200&&this.status<300?t(new E(this.status,this.response)):r(new E(this.status,this.response))},i.onerror=function(){var e=new E(this.status,this.response);return r(e)},i.ontimeout=function(){var e=new E(0,"timeout");return r(e)},i.onabort=function(){var e=new E(0,"aborted");return r(e)},(o=e.headers)&&Object.keys(o).forEach((function(e){i.setRequestHeader(e,o[e])})),i.send(e.data)}))},e.prototype.post=function(e,t,r,i,o){return void 0===r&&(r={}),this.http({headers:r,method:"POST",url:e,data:t,withCredentials:i,timeout:o})},e.prototype.get=function(e,t,r,i){return void 0===t&&(t={}),this.http({headers:t,method:"GET",url:e,withCredentials:r,timeout:i})},e}()),O=function(){this.probe=function(e,t,r){if(void 0===r&&(r=2e3),!e||0===e.length)return Promise.resolve([]);for(var i={"Content-Type":"application/json","Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache",Expires:0,"X-IMS-CLIENTID":t},o="/ims/cdsc_probe?"+v.uriEncodeData({client_id:t}),n=[],s=[],a=function(t){var a=e[t]+o;s.push(A.post(a,{},i,!1,r).then((function(e){return 200==e.status&&n.push(t)})).catch((function(){})))},c=0;c=0?new q("ride_pba_idle_session","",!0):null;var o=this.addRedirectUriToJump(r,i);return new q(r,o)},e.prototype.addRedirectUriToJump=function(e,t){if(!t||"string"!=typeof t)return"";var r=t;this.adobeIdThinData||(this.adobeIdThinData=new H);var i=this.adobeIdThinData.computeRideRedirectUri(e);if(!i||0===i.length)return r;try{var o=new URL(r);return o.searchParams.append("redirect_uri",i),o.toString()}catch(e){return r}},e.prototype.isUnauthorizedException=function(e){var t=e.status;return 401===(void 0===t?0:t)},e}()),B=new(function(){function e(){this.triggerOnError=null}return e.prototype.post=function(e,t,r){var i=this;void 0===r&&(r={});var o=z.getCachedApiResponse(e,t);if(o){var n=o.status,s=o.data;return 200===n?Promise.resolve(s):Promise.reject(s)}return A.post(e,t,r).then((function(r){return i.storeApiResponse(e,JSON.stringify(t),r)})).catch((function(r){return i.verifyError(e,JSON.stringify(t),r)}))},e.prototype.get=function(e,t){var r=this;void 0===t&&(t={});var i=z.getCachedApiResponse(e);if(i){var o=i.status,n=i.data;return 200===o?Promise.resolve(n):Promise.reject(n)}return A.get(e,t).then((function(t){return r.storeApiResponse(e,"",t)})).catch((function(t){return r.verifyError(e,"",t)}))},e.prototype.verifyError=function(e,t,r){this.storeApiResponse(e,t,r);var i=K.verify(r,e);return Promise.reject(i||r.data)},e.prototype.storeApiResponse=function(e,t,r){return void 0===t&&(t=""),z.storeApiResponse(e,t,r),Promise.resolve(r.data)},e}()),W=function(){function e(e){void 0===e&&(e={}),this.CONTENT_FORM_ENCODED="application/x-www-form-urlencoded;charset=utf-8",this.apiParameters=e}return e.prototype.validateToken=function(e){var t=e.token,i=e.client_id,o=v.uriEncodeData(r(r({},w.getCustomApiParameters(this.apiParameters,"validate_token")),{type:"access_token",client_id:i,token:t})),n=g.baseUrlAdobe+"/ims/validate_token/v1?jslVersion="+g.jslibver,s=this.formEncoded();return this.addClientIdInHeader(i,s),B.post(n,o,s)},e.prototype.getProfile=function(e){var t=e.token,i=e.client_id,o=r({},w.getCustomApiParameters(this.apiParameters,"profile")),n=this.createAuthorizationHeader(t);this.addClientIdInHeader(i,n);var s=v.uriEncodeData(r({client_id:i},o)),a=g.baseUrlAdobe+"/ims/profile/v1?"+s+"&jslVersion="+g.jslibver;return B.get(a,n)},e.prototype.getUserInfo=function(e){var t=e.token,i=e.client_id,o=r({},w.getCustomApiParameters(this.apiParameters,"userinfo")),n=this.createAuthorizationHeader(t);this.addClientIdInHeader(i,n);var s=v.uriEncodeData(r({client_id:i},o)),a=g.baseUrlAdobe+"/ims/userinfo/v1?"+s+"&jslVersion="+g.jslibver;return B.get(a,n)},e.prototype.logoutToken=function(e){var t=e.client_id,i=e.token,o=r({},w.getCustomApiParameters(this.apiParameters,"logout_token")),n=g.baseUrlServices+"/ims/logout/v1?jslVersion="+g.jslibver,s=this.addClientIdInHeader(t);return B.post(n,r({client_id:t,access_token:i},o),s)},e.prototype.checkStatus=function(){var e=g.baseUrlServices+"/ims/check/v1/status";return B.get(e)},e.prototype.checkToken=function(e,t,i){var o=e.client_id,n=e.scope,s=r({},w.mergeExternalParameters(t,this.apiParameters,"check_token")),a=r(r({},s),{client_id:o,scope:n});return i&&(a.user_id=i),this.callCheckToken(v.uriEncodeData(a),o,"/check/v6/token?jslVersion="+g.jslibver)},e.prototype.switchProfile=function(e,t,i){void 0===i&&(i="");var o=e.client_id,n=e.scope,s=void 0===n?"":n,a=r({},w.mergeExternalParameters(t,this.apiParameters,"check_token")),c=v.uriEncodeData(r(r({},a),{client_id:o,scope:s,user_id:i}));return this.callCheckToken(c,o,"/check/v6/token?jslVersion="+g.jslibver)},e.prototype.listSocialProviders=function(e){var t=e.client_id,i=r({},w.getCustomApiParameters(this.apiParameters,"providers")),o=v.uriEncodeData(r({client_id:t},i)),n=g.baseUrlServices+"/ims/social/v1/providers?"+o+"&jslVersion="+g.jslibver,s=this.addClientIdInHeader(t);return B.get(n,s)},e.prototype.exchangeIjt=function(e,t){var i=e.client_id,o=r({},w.getCustomApiParameters(this.apiParameters,"ijt")),n=g.baseUrlServices+"/ims/jump/implicit/"+t,s=v.uriEncodeData(r({client_id:i},o)),a=n+"?"+s+"&jslVersion="+g.jslibver;a.length>2048&&(delete o.redirect_uri,a=n+"?"+(s=v.uriEncodeData(o)));var c=this.addClientIdInHeader(i);return B.get(a,c)},e.prototype.avatarUrl=function(e){return g.baseUrlAdobe+"/ims/avatar/download/"+e},e.prototype.getReleaseFlags=function(e){var t=e.token,i=e.client_id,o=r({},w.getCustomApiParameters(this.apiParameters,"fg_value")),n=this.createAuthorizationHeader(t);this.addClientIdInHeader(i,n);var s=v.uriEncodeData(r({client_id:i},o)),a=g.baseUrlAdobe+"/ims/fg/value/v1?"+s+"&jslVersion="+g.jslibver;return B.get(a,n)},e.prototype.getTransitoryAuthorizationCode=function(e,t,i){void 0===t&&(t={});var o=r({},w.mergeExternalParameters(t,this.apiParameters,"check_token")),n=v.uriEncodeData(r(r({},o),e));return this.callCheckToken(n,i,"/check/v6/token?client_id="+i+"&jslVersion="+g.jslibver)},e.prototype.getTokenFromCode=function(e,t){void 0===t&&(t={});var i=r({},w.mergeExternalParameters(t,this.apiParameters,"token"));i.grant_type="authorization_code",delete e.other;var o=g.baseUrlServices+"/ims/token/v3?jslVersion="+g.jslibver,n=v.uriEncodeData(r(r({},i),e)),s=this.formEncoded();return this.addClientIdInHeader(e.client_id,s),B.post(o,n,s)},e.prototype.jumpToken=function(e,t,i){void 0===t&&(t={});var o=r({},w.mergeExternalParameters(t,this.apiParameters,"jumptoken")),n=g.baseUrlServices+"/ims/jumptoken/v1?client_id="+i+"&jslVersion="+g.jslibver,s=v.uriEncodeData(r(r({},o),e)),a=this.formEncoded();return this.addClientIdInHeader(i,a),B.post(n,s,a)},e.prototype.socialHeadlessSignIn=function(e,t){void 0===t&&(t={});var i=r({},w.mergeExternalParameters(t,this.apiParameters,"jumptoken")),o=g.baseUrlServices+"/ims/social/v2/native?jslVersion="+g.jslibver,n=v.uriEncodeData(r(r(r({},i),e),{response_type:"implicit_jump"}));return B.post(o,n,this.formEncoded())},e.prototype.createAuthorizationHeader=function(e){var t={};return e&&(t[d]="Bearer "+e),t},e.prototype.formEncoded=function(e){return void 0===e&&(e={}),e["content-type"]=this.CONTENT_FORM_ENCODED,e},e.prototype.addClientIdInHeader=function(e,t){return void 0===t&&(t={}),t.client_id=e,t},e.prototype.callCheckToken=function(e,t,r){var i=this.formEncoded();return this.addClientIdInHeader(t,i),B.post(g.checkTokenEndpoint.url+"/ims"+r,e,i).catch((function(t){if(!g.checkTokenEndpoint.shouldFallbackToAdobe(t))throw t;return B.post(g.checkTokenEndpoint.fallbackUrl+"/ims"+r,e,i)}))},e}();!function(e){e.INITIALIZE_ERROR="initialize_error",e.HTTP="http",e.FRAGMENT="fragment",e.CSRF="csrf",e.NOT_ALLOWED="not_allowed",e.PROFILE_EXCEPTION="profile_exception",e.TOKEN_EXPIRED="token_expired",e.SOCIAL_PROVIDERS="SOCIAL_PROVIDERS",e.RIDE_EXCEPTION="ride_exception"}(N||(N={}));var G=function(e){this.message=null,this.errorType=N.PROFILE_EXCEPTION,this.message=e};function X(e){return e.split(",").sort().join(",")}var Z,Y=function(){function e(e){this.profileServiceRequest=e,this.storage=h.getStorageByName(c.SessionStorage)}return e.prototype.getProfile=function(e){var t=this,r=this.profileServiceRequest,i=r.clientId,o=r.imsApis,n=this.getProfileFromStorage();return n?Promise.resolve(n):o.getProfile({client_id:i,token:e}).then((function(e){if(!e)throw new G("NO profile response");if(0===Object.keys(e).length)throw new G("NO profile value");return t.saveProfileToStorage(e),Promise.resolve(e)})).catch((function(e){return e instanceof J?Promise.reject(e):(t.removeProfile(),Promise.reject(e))}))},e.prototype.getProfileStorageKey=function(){var e=this.profileServiceRequest;return"adobeid_ims_profile/"+e.clientId+"/"+!1+"/"+X(e.scope)},e.prototype.getProfileFromStorage=function(){var e=this.getProfileStorageKey(),t=this.storage.getItem(e);return t&&JSON.parse(t)},e.prototype.saveProfileToStorage=function(e){var t=this.getProfileStorageKey();this.storage.setItem(t,JSON.stringify(e))},e.prototype.removeProfile=function(){var e=this.getProfileStorageKey();this.storage.removeItem(e)},e.prototype.removeProfileIfOtherUser=function(e){if(e){var t=this.getProfileFromStorage();t&&t.userId!==e&&this.removeProfile()}},e}(),Q=function(){function e(e,t){var r=this;this.REAUTH_SCOPE="reauthenticated",this.valid=!1,this.isReauth=function(){return r.scope.indexOf(r.REAUTH_SCOPE)>=0},this.client_id="",this.scope="",this.expire=new Date,this.user_id="",this.tokenValue="",this.sid="",this.state=null,this.fromFragment=!1,this.impersonatorId="",this.isImpersonatedSession=!1;var i=e.valid,o=e.tokenValue,n=e.access_token,s=e.state,a=e.other,c=o||n,u=this.parseJwt(c);if(!u)throw new Error("token cannot be decoded "+c);this.state=w.toJson(s);var l=u.client_id,d=u.user_id,p=u.scope,h=u.sid,f=u.imp_id,v=u.imp_sid,m=u.pba;this.client_id=l,this.expire=t,this.user_id=d,this.scope=p,this.valid=i,this.tokenValue=c,this.sid=h,this.other=a,this.impersonatorId=f||"",this.isImpersonatedSession=!!v,this.pbaSatisfiedPolicies=m&&m.split(",")||[]}return e.prototype.parseJwt=function(e){if(!e)return null;try{return JSON.parse(atob(e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/")))}catch(t){return p.error("error on decoding token ",e,t),null}},e.prototype.validate=function(e,t){var r,i,o,n=this.valid,s=this.client_id,a=this.scope,c=this.expire;return c0&&(r=new Array(i+1).join(e)+r),r}("0",5,e.toString(2))},ae=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("Data is not a string");var r=e.toLowerCase().split("");!function(e){if(e.length%8!=0)throw new Error("Data length is not a multiple of 8");e.forEach((function(e){if(!(e in ne))throw new Error("Unknown encoded character "+e)}));var t=!1;e.forEach((function(e){if("="!==e&&t)throw new Error("Found padding char in the middle of the string");"="===e&&(t=!0)}))}(r);var i=function(e){for(var t=e.length-1,r=0;"="===e[t];)++r,--t;return r}(r),o=[];r.forEach((function(e){o.push(se(ne[e]))}));var n=o.join("");return i>0&&(n=n.slice(0,-5*i)),n.length%8!=0&&(n=n.slice(0,n.length%8*-1)),t?function(e){var t="";if(e.length%8!=0)throw new Error("Length must be a multiple of 8");for(var r=0,i=e.length;rde.lastUserInteraction&&(de.lastUserInteraction=o)}return i.tokenService.refreshToken(e).then((function(e){return i.onTokenProfileReceived(e)})).catch((function(e){if(p.error("refresh token error",e),e instanceof J)return Promise.reject(e);var t=i.verifyRideErrorExceptionStrict(e);return t||(i.profileService.removeProfile(),i.onTokenExpired(),Promise.reject(e))}))},this.switchProfile=function(e,t){return void 0===t&&(t={}),e?i.tokenService.switchProfile(e,t).then((function(e){return i.onTokenProfileReceived(e)})).catch((function(e){return i.verifyRideErrorException(e)})):Promise.reject(new Error("Please provide the user id for switchProfile"))},this.executeErrorCallback=function(e){if(p.info("initialize exception ended",e),!e||e.type!==Z.LOGOUT){var t=i.adobeIdData.onError;t&&t(N.HTTP,"Initialization error")}},this.triggerOnImsInstance=function(e){var t=document.createEvent("CustomEvent"),r={clientId:i.adobeIdData.client_id,instance:e};t.initCustomEvent("onImsLibInstance",!1,!1,r),window.dispatchEvent(t)},this.processInitializeException=function(e){return void 0===e&&(e={}),p.warn("initialize",e),i.restoreHash(),Promise.reject(e)},this.verifyModalSignInEvent=function(e){return e instanceof oe?i.notifyParentAboutModalSignIn(e):Promise.reject(e)},this.verifyTokenExpiredException=function(e){return e instanceof re?(i.adobeIdData.handlers.triggerOnAccessTokenHasExpired(),Promise.resolve()):Promise.reject(e)},this.verifyRideErrorException=function(e){return o(i,void 0,Promise,(function(){return n(this,(function(t){switch(t.label){case 0:return e instanceof q?this.adobeIdData.overrideErrorHandler&&!this.adobeIdData.overrideErrorHandler(e)?[2,Promise.reject(e)]:e.isPbaExpiredIdleSessionWorkaround?[4,this.signIn()]:[3,2]:[3,4];case 1:return t.sent(),[3,4];case 2:return e.jump?[4,v.replaceUrlAndWait(e.jump,1e4)]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2,Promise.reject(e)]}}))}))},this.verifyRideErrorExceptionStrict=function(e){return e instanceof q?i.verifyRideErrorException(e):null},this.verifyCsrfException=function(e){var t=e.type;return t&&t===N.CSRF&&i.signOut(),Promise.reject(e)},this.processTokenResponse=function(e){var t=i.adobeIdData.handlers,r=e.tokenFields,o=e.profile,n=r.tokenValue,s=r.state,a=r.expire,c=r.sid,u=r.user_id,l=r.other,d=void 0===l?{}:l,h=r.impersonatorId,f=r.isImpersonatedSession,m=r.pbaSatisfiedPolicies;p.info("token",n),d.from_ims&&v.setHash(d.old_hash||""),i.profileService.removeProfileIfOtherUser(u);var g={token:n,expire:a,sid:c,impersonatorId:h,isImpersonatedSession:f,pbaSatisfiedPolicies:m};return r.isReauth()?t.triggerOnReauthAccessToken(g):i.tokenReceived(g),o&&i.profileService.saveProfileToStorage(o),Promise.resolve(s)},this.exchangeIjt=function(e){var t=i.adobeIdData.ijt;return e||t?i.tokenService.exchangeIjt(e||t).then((function(e){return e.profile?i.profileService.saveProfileToStorage(e.profile):i.profileService.removeProfile(),Promise.resolve(e)})):Promise.reject(new Error("please set the adobeid.ijt value"))},this.adobeIdData=new L(e),t&&(this.instanceKey=t);var s=this.adobeIdData,a=s.api_parameters,c=void 0===a?{}:a,u=s.client_id,l=s.scope,d=s.useLocalStorage,h=s.autoValidateToken,m=s.modalMode,g=s.modalSettings;this.imsApis=new W(c),this.csrfService=new f(u,this.instanceKey),this.serviceRequest={clientId:u,scope:l,imsApis:this.imsApis},this.tokenService=new ue(r(r({},this.serviceRequest),{useLocalStorage:d,autoValidateToken:h}),this.csrfService),this.profileService=new Y(this.serviceRequest),this.signInservice=m?new R(this.onPopupMessage,g):new I}return Object.defineProperty(e.prototype,"version",{get:function(){return g.jslibver},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"adobeid",{get:function(){return r({},this.adobeIdData)},enumerable:!0,configurable:!0}),e.prototype.enableLogging=function(){p.enableLogging()},e.prototype.disableLogging=function(){p.disableLogging()},e.prototype.checkInitialized=function(){this.initialized},e.prototype.signUp=function(e,t){var r=this;void 0===e&&(e={}),this.checkInitialized();var i=this.adobeIdData,o=this.csrfService;if(!i)throw new Error("no adobeId on reAuthenticate");var n=o.initialize();return i.createSignUpRedirectRequest(e,t,n).then((function(e){r.signInservice.signIn(e)}))},e.prototype.isSignedInUser=function(){return!(!this.getAccessToken()&&!this.getReauthAccessToken())},e.prototype.getProfile=function(){var e=this,t=this.profileService.getProfileFromStorage();if(t)return Promise.resolve(t);var r=this.getAccessToken()||this.getReauthAccessToken();if(!r){return Promise.reject(new G("please login before getting the profile"))}return this.profileService.getProfile(r.token).then((function(e){return Promise.resolve(e)})).catch((function(t){return p.error("get profile exception ",t),t instanceof J?e.refreshToken().then((function(e){return Promise.resolve(e.profile)})):Promise.reject(new G(t.message||t))}))},e.prototype.avatarUrl=function(e){return this.imsApis.avatarUrl(e)},e.prototype.getReleaseFlags=function(e){return void 0===e&&(e=!1),e?this.tokenService.getDecodedReleaseFlags():this.tokenService.getReleaseFlags()},e.prototype.getAccessToken=function(){return this.getTokenFromStorage(!1)},e.prototype.getReauthAccessToken=function(){return this.getTokenFromStorage(!0)},e.prototype.getTokenFromStorage=function(e){var t=this.tokenService.getTokenFieldsFromStorage(e);return t?{token:t.tokenValue,expire:t.expire,sid:t.sid,impersonatorId:t.impersonatorId,isImpersonatedSession:t.isImpersonatedSession,pbaSatisfiedPolicies:t.pbaSatisfiedPolicies}:null},e.prototype.listSocialProviders=function(){var e=this;return new Promise((function(t,r){var i=e.adobeIdData.client_id;e.imsApis.listSocialProviders({client_id:i}).then((function(e){t(e)})).catch((function(e){r(e)}))}))},e.prototype.tokenReceived=function(e){this.adobeIdData.handlers.triggerOnAccessToken(e),de.startAutoRefreshFlow({expire:e.expire,refreshTokenMethod:this.refreshToken})},e.prototype.onTokenProfileReceived=function(e){var t=e.tokenInfo,r=e.profile;return p.info("token",t),this.tokenReceived(t),this.profileService.saveProfileToStorage(r),Promise.resolve(e)},e.prototype.validateToken=function(){var e=this;return this.tokenService.validateToken().then((function(){return Promise.resolve(!0)})).catch((function(t){return p.warn("validate token exception",t),t instanceof J?Promise.reject(!1):(e.profileService.removeProfile(),Promise.reject(!1))}))},e.prototype.onTokenExpired=function(){var e=this.adobeIdData.handlers;this.tokenService.purge(),e.triggerOnAccessTokenHasExpired()},e.prototype.setStandAloneToken=function(e){return this.tokenService.setStandAloneToken(e)},e.prototype.initialize=function(){var e=this,t=this.adobeIdData,r=t.handlers,i=t.standalone,o=t.ijt,n=t.alwaysRemoveTokenFromUrl,s=null;return i&&this.setStandAloneToken(i),(o?this.exchangeIjt:this.tokenService.getTokenAndProfile)().then(this.processTokenResponse,this.processError.apply(this)).then((function(e){s=e})).finally((function(){p.info("onReady initialization"),window.addEventListener("getImsLibInstance",(function(){e.triggerOnImsInstance(e)}),!1),n&&v.setHash($.removeAccessToken()),r.triggerOnReady(s?s.context:null),e.triggerOnImsInstance(e),e.initialized=!0}))},e.prototype.processError=function(){var e=this;return function(t){return e.verifyModalSignInEvent(t).catch(e.processInitializeException).catch(e.verifyTokenExpiredException).catch(e.verifyRideErrorException).catch(e.verifyCsrfException).catch(e.executeErrorCallback)}},e.prototype.notifyParentAboutModalSignIn=function(e){var t=window.location.href.replace("imslibmodal","wasmodal");if(window.opener)window.opener.postMessage(t,window.location.origin),window.close();else{var r=new BroadcastChannel("imslib");r.postMessage(t),r.close(),window.close()}return Promise.reject("popup")},e.prototype.restoreHash=function(){var e=$.fragmentToObject();e&&e.from_ims&&v.setHash(e.old_hash||"")},e.prototype.getTransitoryAuthorizationCode=function(e,t){return void 0===t&&(t={}),(e=e||{}).response_type=e.response_type||"code",e.target_client_id=e.target_client_id||this.adobeIdData.client_id,e.target_scope=e.target_scope||this.adobeIdData.scope,this.imsApis.getTransitoryAuthorizationCode(e,t,this.adobeIdData.client_id)},e.prototype.jumpToken=function(e,t){return void 0===t&&(t={}),e.target_client_id=e.target_client_id||this.adobeIdData.client_id,e.target_scope=e.target_scope||this.adobeIdData.scope,this.imsApis.jumpToken(e,t,this.adobeIdData.client_id)},e.prototype.getVerifierByKey=function(e){return(new M).getVerifierByKey(e)},e.prototype.socialHeadlessSignIn=function(e,t){return void 0===t&&(t={}),o(this,void 0,Promise,(function(){var r=this;return n(this,(function(i){return[2,this.imsApis.socialHeadlessSignIn(e,t).then((function(e){return r.exchangeIjt(e.token)})).catch((function(t){return"ride_AdobeID_social"===t.error&&r.signIn({idp_flow:"social.native",provider_id:e.provider_id,idp_token:e.idp_token}),Promise.reject(t)}))]}))}))},e}(),he=new(function(){function e(){this.createIMSLib=function(e,t){void 0===e&&(e=null),void 0===t&&(t="adobeIMS");var r=new pe(e,t);return window[t]=r,r}}return e.prototype.initAdobeIms=function(){window.adobeImsFactory={createIMSLib:this.createIMSLib};var e=window.adobeIMS||null;if(!e){var t=window.adobeid;if(!t||!t.client_id)return;(e=this.createIMSLib(t,"adobeIMS")).initialize()}},e}());return new(function(){function e(){he.initAdobeIms()}return e.prototype.initialize=function(){return!0},e}())}(); +/*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ +var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};function t(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var r=function(){return(r=Object.assign||function(e){for(var t,r=1,i=arguments.length;r0&&o[o.length-1])&&(6===n[0]||2===n[0])){s=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]0)&&!(i=n.next()).done;)s.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function a(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(Object.keys(a)),u=c.next();!u.done;u=c.next()){var l=u.value;if(r===l||r.endsWith("."+l))return new e(!0,a[l],o)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(s=c.return)&&s.call(c)}finally{if(n)throw n.error}}}return new e(!1,o)},e.prototype.shouldFallbackToAdobe=function(e){return!!this.proxied&&("feature_disabled"===e.error&&"cdsc"===e.error_description)},e.THIRD_PARTY_DOMAINS_PROD={"behance.net":"https://sso.behance.net"},e.THIRD_PARTY_DOMAINS_STAGE={"s2stagehance.com":"https://sso.s2stagehance.com"},e}(),g=new(function(){function e(){this.baseUrlAdobe="",this.baseUrlServices="",this.checkTokenEndpoint=new m,this.jslibver="v2-v0.40.0-17-g241fb07"}return e.prototype.loadEnvironment=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r="");var i=e===l.STAGE;i?(this.baseUrlAdobe="https://ims-na1-stg1.adobelogin.com",this.baseUrlServices="https://adobeid-na1-stg1.services.adobe.com"):(this.baseUrlAdobe="https://ims-na1.adobelogin.com",this.baseUrlServices="https://adobeid-na1.services.adobe.com"),this.checkTokenEndpoint=m.computeEndpoint(t,r,i,this.baseUrlServices)},e}());function y(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)}function k(e,t){if(null==e)return t;if(e===t)return e;if(!y(e))return e;var r=Object.assign({},e);return y(t)&&Object.keys(t).forEach((function(i){var o,n;y(t[i])?i in e?r[i]=k(e[i],t[i]):Object.assign(r,((o={})[i]=t[i],o)):Object.assign(r,((n={})[i]=t[i],n))})),r}var w=new(function(){function e(){this.getCustomApiParameters=function(e,t){return e[t]||{}}}return e.prototype.mergeExternalParameters=function(e,t,r){return k(this.getCustomApiParameters(t,r),e)},e.prototype.toJson=function(e){try{return"string"!=typeof e?e:JSON.parse(e)}catch(e){return null}},e}()),b=function(){function e(){}return e.getInitialRedirectUri=function(e,t){var r=e.redirect_uri||t||window.location.href,i="function"==typeof r?r():r,o=i.indexOf("from_ims");return-1===o?i:("#"===i[o-1]&&o--,i.substr(0,o))},e.createDefaultRedirectUrl=function(e,t,r,i){var o=this.getInitialRedirectUri(r,e),n=this.createOldHash(o);return n.indexOf("?")>0?n+"&client_id="+t+"&api="+i:n+"?client_id="+t+"&api="+i},e.createRedirectUrl=function(e,t,r,i,o){void 0===o&&(o="");var n=this.createDefaultRedirectUrl(e,t,r,i);(o=o||r.scope||"")&&(n=n+"&scope="+o);var s=r.reauth||"";return s&&(n=n+"&reauth="+s),n},e.createOldHash=function(e){var t=e.indexOf("#");return t<0?e+"#old_hash=&from_ims=true":e.substring(0,t)+"#old_hash="+e.substring(t+1)+"&from_ims=true"},e.mergeApiParamsWithExternalParams=function(e,t,r){return k(w.getCustomApiParameters(e,r),t)},e}(),S=function(){var e=this;this.composeRedirectUrl=function(e){var t=e.apiParameters,i=e.externalParameters,o=void 0===i?{}:i,n=e.adobeIdRedirectUri,s=void 0===n?"":n,a=e.clientId,c=e.locale,u=e.state,l=void 0===u?{}:u,d=e.scope,p=void 0===d?o.scope||t.scope||"":d,h=b.mergeApiParamsWithExternalParams(t,o,"authorize");l&&(h.state=k(h.state||{},l));var f=b.createRedirectUrl(s,a,h,"authorize",p),v=o.locale||c||"",m=e.response_type,y=void 0===m?h.response_type||"":m;return r(r({},h),{client_id:a,scope:p,locale:v,response_type:y,jslVersion:g.jslibver,redirect_uri:f})},this.createRedirectUrl=function(t){var r=e.composeRedirectUrl(t),i=v.uriEncodeData(r);return g.baseUrlAdobe+"/ims/authorize/v1?"+i}},I=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.signIn=function(e){var r=t.createRedirectUrl(e);v.setHrefUrl(r)},t.authorizeToken=function(e,r){var i=t.composeRedirectUrl(r);e&&(i.user_assertion=e,i.user_assertion_type="urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),t.createAuthorizeForm(i).submit()},t}return t(r,e),r.prototype.createAuthorizeForm=function(e){var t=g.baseUrlAdobe+"/ims/authorize/v1",r=document.createElement("form");r.style.display="none",r.setAttribute("method","post"),r.setAttribute("action",t);var i=null,o=null,n="";for(var s in e){if("object"==typeof(o=e[s])){if(0===Object.keys(o).length)continue;n=JSON.stringify(o)}else n=o;""!==n&&(i=this.createFormElement("input","text",s,n),r.appendChild(i))}return document.getElementsByTagName("body")[0].appendChild(r),r},r.prototype.createFormElement=function(e,t,r,i){var o=document.createElement(e);return o.setAttribute("type",t),o.setAttribute("name",r),o.setAttribute("value",i),o},r}(S),_=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/,T=["https://auth.services.adobe.com","https://auth-stg1.services.adobe.com","https://localhost.corp.adobe.com:9000"],P=new function(){var e=this;this.windowObjectReference=null,this.previousUrl="",this.openSignInWindow=function(t,r,i,o){e.onProcessLocation=o,e.allowOrigin=i.allowOrigin,e.timerId&&clearInterval(e.timerId),window.removeEventListener("message",e.receiveMessage),window.addEventListener("message",e.receiveMessage),e.broadcastChannel&&e.broadcastChannel.close(),e.broadcastChannel=new BroadcastChannel("imslib"),e.broadcastChannel.onmessage=e.receiveMessage;var n="popup=yes, width="+i.width+", height="+i.height+", top="+i.top+", left="+i.left;!e.windowObjectReference||e.windowObjectReference&&e.windowObjectReference.closed?e.windowObjectReference=window.open(t,i.title,n):e.previousUrl!==t?(e.windowObjectReference=window.open(t,i.title,n),e.windowObjectReference&&e.windowObjectReference.focus()):e.windowObjectReference.focus(),e.previousUrl=t},this.receiveMessage=function(t){if(a(T,[e.allowOrigin]).includes(t.origin)){try{if(!_.test(t.data))return void console.warn("refused to receive message containing unknown data format",t.data)}catch(e){return void console.error(e)}e.broadcastChannel&&e.broadcastChannel.close(),e.onProcessLocation&&e.onProcessLocation(t.data)}else console.warn("refused to receive message from origin not whitelisted",t.origin)}},R=function(e){function i(t,i){var o=e.call(this)||this;return o.signIn=function(e){e.state=r(r({},e.state),{imslibmodal:!0});var t=e.state.nonce,i=o.createRedirectUrl(e);P.openSignInWindow(i,t,o.popupSettings,o.onPopupMessage)},o.onPopupMessage=t,o.popupSettings=i,o}return t(i,e),i}(S),E=function(){function e(e,t){this.status=0,this.data="",this.status=e,this.data=this.toJson(t)}return e.prototype.toJson=function(e){try{return"string"!=typeof e?e:JSON.parse(e)}catch(t){return e}},e}(),A=new(function(){function e(){}return e.prototype.http=function(e){return new Promise((function(t,r){var i=new(0,window.XMLHttpRequest);"boolean"==typeof e.withCredentials?i.withCredentials=e.withCredentials:i.withCredentials=!0,"number"==typeof e.timeout&&(i.timeout=e.timeout),i.open(e.method,e.url,!0);var o;i.onload=function(){return this.status>=200&&this.status<300?t(new E(this.status,this.response)):r(new E(this.status,this.response))},i.onerror=function(){var e=new E(this.status,this.response);return r(e)},i.ontimeout=function(){var e=new E(0,"timeout");return r(e)},i.onabort=function(){var e=new E(0,"aborted");return r(e)},(o=e.headers)&&Object.keys(o).forEach((function(e){i.setRequestHeader(e,o[e])})),i.send(e.data)}))},e.prototype.post=function(e,t,r,i,o){return void 0===r&&(r={}),this.http({headers:r,method:"POST",url:e,data:t,withCredentials:i,timeout:o})},e.prototype.get=function(e,t,r,i){return void 0===t&&(t={}),this.http({headers:t,method:"GET",url:e,withCredentials:r,timeout:i})},e}()),O=function(){this.probe=function(e,t,r){if(void 0===r&&(r=2e3),!e||0===e.length)return Promise.resolve([]);for(var i={"Content-Type":"application/json","Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache",Expires:0,"X-IMS-CLIENTID":t},o="/ims/cdsc_probe?"+v.uriEncodeData({client_id:t}),n=[],s=[],a=function(t){var a=e[t]+o;s.push(A.post(a,{},i,!1,r).then((function(e){return 200==e.status&&n.push(t)})).catch((function(){})))},c=0;c=0?new q("ride_pba_idle_session","",!0):null;var o=this.addRedirectUriToJump(r,i);return new q(r,o)},e.prototype.addRedirectUriToJump=function(e,t){if(!t||"string"!=typeof t)return"";var r=t;this.adobeIdThinData||(this.adobeIdThinData=new H);var i=this.adobeIdThinData.computeRideRedirectUri(e);if(!i||0===i.length)return r;try{var o=new URL(r);return o.searchParams.append("redirect_uri",i),o.toString()}catch(e){return r}},e.prototype.isUnauthorizedException=function(e){var t=e.status;return 401===(void 0===t?0:t)},e}()),B=new(function(){function e(){this.triggerOnError=null}return e.prototype.post=function(e,t,r){var i=this;void 0===r&&(r={});var o=z.getCachedApiResponse(e,t);if(o){var n=o.status,s=o.data;return 200===n?Promise.resolve(s):Promise.reject(s)}return A.post(e,t,r).then((function(r){return i.storeApiResponse(e,JSON.stringify(t),r)})).catch((function(r){return i.verifyError(e,JSON.stringify(t),r)}))},e.prototype.get=function(e,t){var r=this;void 0===t&&(t={});var i=z.getCachedApiResponse(e);if(i){var o=i.status,n=i.data;return 200===o?Promise.resolve(n):Promise.reject(n)}return A.get(e,t).then((function(t){return r.storeApiResponse(e,"",t)})).catch((function(t){return r.verifyError(e,"",t)}))},e.prototype.verifyError=function(e,t,r){this.storeApiResponse(e,t,r);var i=K.verify(r,e);return Promise.reject(i||r.data)},e.prototype.storeApiResponse=function(e,t,r){return void 0===t&&(t=""),z.storeApiResponse(e,t,r),Promise.resolve(r.data)},e}()),W=function(){function e(e){void 0===e&&(e={}),this.CONTENT_FORM_ENCODED="application/x-www-form-urlencoded;charset=utf-8",this.apiParameters=e}return e.prototype.validateToken=function(e){var t=e.token,i=e.client_id,o=v.uriEncodeData(r(r({},w.getCustomApiParameters(this.apiParameters,"validate_token")),{type:"access_token",client_id:i,token:t})),n=g.baseUrlAdobe+"/ims/validate_token/v1?jslVersion="+g.jslibver,s=this.formEncoded();return this.addClientIdInHeader(i,s),B.post(n,o,s)},e.prototype.getProfile=function(e){var t=e.token,i=e.client_id,o=r({},w.getCustomApiParameters(this.apiParameters,"profile")),n=this.createAuthorizationHeader(t);this.addClientIdInHeader(i,n);var s=v.uriEncodeData(r({client_id:i},o)),a=g.baseUrlAdobe+"/ims/profile/v1?"+s+"&jslVersion="+g.jslibver;return B.get(a,n)},e.prototype.getUserInfo=function(e){var t=e.token,i=e.client_id,o=r({},w.getCustomApiParameters(this.apiParameters,"userinfo")),n=this.createAuthorizationHeader(t);this.addClientIdInHeader(i,n);var s=v.uriEncodeData(r({client_id:i},o)),a=g.baseUrlAdobe+"/ims/userinfo/v1?"+s+"&jslVersion="+g.jslibver;return B.get(a,n)},e.prototype.logoutToken=function(e){var t=e.client_id,i=e.token,o=r({},w.getCustomApiParameters(this.apiParameters,"logout_token")),n=g.baseUrlServices+"/ims/logout/v1?jslVersion="+g.jslibver,s=this.addClientIdInHeader(t);return B.post(n,r({client_id:t,access_token:i},o),s)},e.prototype.checkStatus=function(){var e=g.baseUrlServices+"/ims/check/v1/status";return B.get(e)},e.prototype.checkToken=function(e,t,i){var o=e.client_id,n=e.scope,s=r({},w.mergeExternalParameters(t,this.apiParameters,"check_token")),a=r(r({},s),{client_id:o,scope:n});return i&&(a.user_id=i),this.callCheckToken(v.uriEncodeData(a),o,"/check/v6/token?jslVersion="+g.jslibver)},e.prototype.switchProfile=function(e,t,i){void 0===i&&(i="");var o=e.client_id,n=e.scope,s=void 0===n?"":n,a=r({},w.mergeExternalParameters(t,this.apiParameters,"check_token")),c=v.uriEncodeData(r(r({},a),{client_id:o,scope:s,user_id:i}));return this.callCheckToken(c,o,"/check/v6/token?jslVersion="+g.jslibver)},e.prototype.listSocialProviders=function(e){var t=e.client_id,i=r({},w.getCustomApiParameters(this.apiParameters,"providers")),o=v.uriEncodeData(r({client_id:t},i)),n=g.baseUrlServices+"/ims/social/v1/providers?"+o+"&jslVersion="+g.jslibver,s=this.addClientIdInHeader(t);return B.get(n,s)},e.prototype.exchangeIjt=function(e,t){var i=e.client_id,o=r({},w.getCustomApiParameters(this.apiParameters,"ijt")),n=g.baseUrlServices+"/ims/jump/implicit/"+t,s=v.uriEncodeData(r({client_id:i},o)),a=n+"?"+s+"&jslVersion="+g.jslibver;a.length>2048&&(delete o.redirect_uri,a=n+"?"+(s=v.uriEncodeData(o)));var c=this.addClientIdInHeader(i);return B.get(a,c)},e.prototype.avatarUrl=function(e){return g.baseUrlAdobe+"/ims/avatar/download/"+e},e.prototype.getReleaseFlags=function(e){var t=e.token,i=e.client_id,o=r({},w.getCustomApiParameters(this.apiParameters,"fg_value")),n=this.createAuthorizationHeader(t);this.addClientIdInHeader(i,n);var s=v.uriEncodeData(r({client_id:i},o)),a=g.baseUrlAdobe+"/ims/fg/value/v1?"+s+"&jslVersion="+g.jslibver;return B.get(a,n)},e.prototype.getTransitoryAuthorizationCode=function(e,t,i){void 0===t&&(t={});var o=r({},w.mergeExternalParameters(t,this.apiParameters,"check_token")),n=v.uriEncodeData(r(r({},o),e));return this.callCheckToken(n,i,"/check/v6/token?client_id="+i+"&jslVersion="+g.jslibver)},e.prototype.getTokenFromCode=function(e,t){void 0===t&&(t={});var i=r({},w.mergeExternalParameters(t,this.apiParameters,"token"));i.grant_type="authorization_code",delete e.other;var o=g.baseUrlServices+"/ims/token/v3?jslVersion="+g.jslibver,n=v.uriEncodeData(r(r({},i),e)),s=this.formEncoded();return this.addClientIdInHeader(e.client_id,s),B.post(o,n,s)},e.prototype.jumpToken=function(e,t,i){void 0===t&&(t={});var o=r({},w.mergeExternalParameters(t,this.apiParameters,"jumptoken")),n=g.baseUrlServices+"/ims/jumptoken/v1?client_id="+i+"&jslVersion="+g.jslibver,s=v.uriEncodeData(r(r({},o),e)),a=this.formEncoded();return this.addClientIdInHeader(i,a),B.post(n,s,a)},e.prototype.socialHeadlessSignIn=function(e,t){void 0===t&&(t={});var i=r({},w.mergeExternalParameters(t,this.apiParameters,"jumptoken")),o=g.baseUrlServices+"/ims/social/v2/native?jslVersion="+g.jslibver,n=v.uriEncodeData(r(r(r({},i),e),{response_type:"implicit_jump"}));return B.post(o,n,this.formEncoded())},e.prototype.createAuthorizationHeader=function(e){var t={};return e&&(t[d]="Bearer "+e),t},e.prototype.formEncoded=function(e){return void 0===e&&(e={}),e["content-type"]=this.CONTENT_FORM_ENCODED,e},e.prototype.addClientIdInHeader=function(e,t){return void 0===t&&(t={}),t.client_id=e,t},e.prototype.callCheckToken=function(e,t,r){var i=this.formEncoded();return this.addClientIdInHeader(t,i),B.post(g.checkTokenEndpoint.url+"/ims"+r,e,i).catch((function(t){if(!g.checkTokenEndpoint.shouldFallbackToAdobe(t))throw t;return B.post(g.checkTokenEndpoint.fallbackUrl+"/ims"+r,e,i)}))},e}();!function(e){e.INITIALIZE_ERROR="initialize_error",e.HTTP="http",e.FRAGMENT="fragment",e.CSRF="csrf",e.NOT_ALLOWED="not_allowed",e.PROFILE_EXCEPTION="profile_exception",e.TOKEN_EXPIRED="token_expired",e.SOCIAL_PROVIDERS="SOCIAL_PROVIDERS",e.RIDE_EXCEPTION="ride_exception"}(N||(N={}));var G=function(e){this.message=null,this.errorType=N.PROFILE_EXCEPTION,this.message=e};function X(e){return e.split(",").sort().join(",")}var Z,Y=function(){function e(e){this.profileServiceRequest=e,this.storage=h.getStorageByName(c.SessionStorage)}return e.prototype.getProfile=function(e){var t=this,r=this.profileServiceRequest,i=r.clientId,o=r.imsApis,n=this.getProfileFromStorage();return n?Promise.resolve(n):o.getProfile({client_id:i,token:e}).then((function(e){if(!e)throw new G("NO profile response");if(0===Object.keys(e).length)throw new G("NO profile value");return t.saveProfileToStorage(e),Promise.resolve(e)})).catch((function(e){return e instanceof J?Promise.reject(e):(t.removeProfile(),Promise.reject(e))}))},e.prototype.getProfileStorageKey=function(){var e=this.profileServiceRequest;return"adobeid_ims_profile/"+e.clientId+"/"+!1+"/"+X(e.scope)},e.prototype.getProfileFromStorage=function(){var e=this.getProfileStorageKey(),t=this.storage.getItem(e);return t&&JSON.parse(t)},e.prototype.saveProfileToStorage=function(e){var t=this.getProfileStorageKey();this.storage.setItem(t,JSON.stringify(e))},e.prototype.removeProfile=function(){var e=this.getProfileStorageKey();this.storage.removeItem(e)},e.prototype.removeProfileIfOtherUser=function(e){if(e){var t=this.getProfileFromStorage();t&&t.userId!==e&&this.removeProfile()}},e}(),Q=function(){function e(e,t){var r=this;this.REAUTH_SCOPE="reauthenticated",this.valid=!1,this.isReauth=function(){return r.scope.indexOf(r.REAUTH_SCOPE)>=0},this.client_id="",this.scope="",this.expire=new Date,this.user_id="",this.tokenValue="",this.sid="",this.state=null,this.fromFragment=!1,this.impersonatorId="",this.isImpersonatedSession=!1;var i=e.valid,o=e.tokenValue,n=e.access_token,s=e.state,a=e.other,c=o||n,u=this.parseJwt(c);if(!u)throw new Error("token cannot be decoded "+c);this.state=w.toJson(s);var l=u.client_id,d=u.user_id,p=u.scope,h=u.sid,f=u.imp_id,v=u.imp_sid,m=u.pba;this.client_id=l,this.expire=t,this.user_id=d,this.scope=p,this.valid=i,this.tokenValue=c,this.sid=h,this.other=a,this.impersonatorId=f||"",this.isImpersonatedSession=!!v,this.pbaSatisfiedPolicies=m&&m.split(",")||[]}return e.prototype.parseJwt=function(e){if(!e)return null;try{return JSON.parse(atob(e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/")))}catch(t){return p.error("error on decoding token ",e,t),null}},e.prototype.validate=function(e,t){var r,i,o,n=this.valid,s=this.client_id,a=this.scope,c=this.expire;return c0&&(r=new Array(i+1).join(e)+r),r}("0",5,e.toString(2))},ae=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("Data is not a string");var r=e.toLowerCase().split("");!function(e){if(e.length%8!=0)throw new Error("Data length is not a multiple of 8");e.forEach((function(e){if(!(e in ne))throw new Error("Unknown encoded character "+e)}));var t=!1;e.forEach((function(e){if("="!==e&&t)throw new Error("Found padding char in the middle of the string");"="===e&&(t=!0)}))}(r);var i=function(e){for(var t=e.length-1,r=0;"="===e[t];)++r,--t;return r}(r),o=[];r.forEach((function(e){o.push(se(ne[e]))}));var n=o.join("");return i>0&&(n=n.slice(0,-5*i)),n.length%8!=0&&(n=n.slice(0,n.length%8*-1)),t?function(e){var t="";if(e.length%8!=0)throw new Error("Length must be a multiple of 8");for(var r=0,i=e.length;rde.lastUserInteraction&&(de.lastUserInteraction=o)}return i.tokenService.refreshToken(e).then((function(e){return i.onTokenProfileReceived(e)})).catch((function(e){if(p.error("refresh token error",e),e instanceof J)return Promise.reject(e);var t=i.verifyRideErrorExceptionStrict(e);return t||(i.profileService.removeProfile(),i.onTokenExpired(),Promise.reject(e))}))},this.switchProfile=function(e,t){return void 0===t&&(t={}),e?i.tokenService.switchProfile(e,t).then((function(e){return i.onTokenProfileReceived(e)})).catch((function(e){return i.verifyRideErrorException(e)})):Promise.reject(new Error("Please provide the user id for switchProfile"))},this.executeErrorCallback=function(e){if(p.info("initialize exception ended",e),!e||e.type!==Z.LOGOUT){var t=i.adobeIdData.onError;t&&t(N.HTTP,"Initialization error")}},this.triggerOnImsInstance=function(e){var t=document.createEvent("CustomEvent"),r={clientId:i.adobeIdData.client_id,instance:e};t.initCustomEvent("onImsLibInstance",!1,!1,r),window.dispatchEvent(t)},this.processInitializeException=function(e){return void 0===e&&(e={}),p.warn("initialize",e),i.restoreHash(),Promise.reject(e)},this.verifyModalSignInEvent=function(e){return e instanceof oe?i.notifyParentAboutModalSignIn(e):Promise.reject(e)},this.verifyTokenExpiredException=function(e){return e instanceof re?(i.adobeIdData.handlers.triggerOnAccessTokenHasExpired(),Promise.resolve()):Promise.reject(e)},this.verifyRideErrorException=function(e){return o(i,void 0,Promise,(function(){return n(this,(function(t){switch(t.label){case 0:return e instanceof q?this.adobeIdData.overrideErrorHandler&&!this.adobeIdData.overrideErrorHandler(e)?[2,Promise.reject(e)]:e.isPbaExpiredIdleSessionWorkaround?[4,this.signIn()]:[3,2]:[3,4];case 1:return t.sent(),[3,4];case 2:return e.jump?[4,v.replaceUrlAndWait(e.jump,1e4)]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2,Promise.reject(e)]}}))}))},this.verifyRideErrorExceptionStrict=function(e){return e instanceof q?i.verifyRideErrorException(e):null},this.verifyCsrfException=function(e){var t=e.type;return t&&t===N.CSRF&&i.signOut(),Promise.reject(e)},this.processTokenResponse=function(e){var t=i.adobeIdData.handlers,r=e.tokenFields,o=e.profile,n=r.tokenValue,s=r.state,a=r.expire,c=r.sid,u=r.user_id,l=r.other,d=void 0===l?{}:l,h=r.impersonatorId,f=r.isImpersonatedSession,m=r.pbaSatisfiedPolicies;p.info("token",n),d.from_ims&&v.setHash(d.old_hash||""),i.profileService.removeProfileIfOtherUser(u);var g={token:n,expire:a,sid:c,impersonatorId:h,isImpersonatedSession:f,pbaSatisfiedPolicies:m};return r.isReauth()?t.triggerOnReauthAccessToken(g):i.tokenReceived(g),o&&i.profileService.saveProfileToStorage(o),Promise.resolve(s)},this.exchangeIjt=function(e){var t=i.adobeIdData.ijt;return e||t?i.tokenService.exchangeIjt(e||t).then((function(e){return e.profile?i.profileService.saveProfileToStorage(e.profile):i.profileService.removeProfile(),Promise.resolve(e)})):Promise.reject(new Error("please set the adobeid.ijt value"))},this.adobeIdData=new L(e),t&&(this.instanceKey=t);var s=this.adobeIdData,a=s.api_parameters,c=void 0===a?{}:a,u=s.client_id,l=s.scope,d=s.useLocalStorage,h=s.autoValidateToken,m=s.modalMode,g=s.modalSettings;this.imsApis=new W(c),this.csrfService=new f(u,this.instanceKey),this.serviceRequest={clientId:u,scope:l,imsApis:this.imsApis},this.tokenService=new ue(r(r({},this.serviceRequest),{useLocalStorage:d,autoValidateToken:h}),this.csrfService),this.profileService=new Y(this.serviceRequest),this.signInservice=m?new R(this.onPopupMessage,g):new I}return Object.defineProperty(e.prototype,"version",{get:function(){return g.jslibver},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"adobeid",{get:function(){return r({},this.adobeIdData)},enumerable:!0,configurable:!0}),e.prototype.enableLogging=function(){p.enableLogging()},e.prototype.disableLogging=function(){p.disableLogging()},e.prototype.checkInitialized=function(){this.initialized},e.prototype.signUp=function(e,t){var r=this;void 0===e&&(e={}),this.checkInitialized();var i=this.adobeIdData,o=this.csrfService;if(!i)throw new Error("no adobeId on reAuthenticate");var n=o.initialize();return i.createSignUpRedirectRequest(e,t,n).then((function(e){r.signInservice.signIn(e)}))},e.prototype.isSignedInUser=function(){return!(!this.getAccessToken()&&!this.getReauthAccessToken())},e.prototype.getProfile=function(){var e=this,t=this.profileService.getProfileFromStorage();if(t)return Promise.resolve(t);var r=this.getAccessToken()||this.getReauthAccessToken();if(!r){return Promise.reject(new G("please login before getting the profile"))}return this.profileService.getProfile(r.token).then((function(e){return Promise.resolve(e)})).catch((function(t){return p.error("get profile exception ",t),t instanceof J?e.refreshToken().then((function(e){return Promise.resolve(e.profile)})):Promise.reject(new G(t.message||t))}))},e.prototype.avatarUrl=function(e){return this.imsApis.avatarUrl(e)},e.prototype.getReleaseFlags=function(e){return void 0===e&&(e=!1),e?this.tokenService.getDecodedReleaseFlags():this.tokenService.getReleaseFlags()},e.prototype.getAccessToken=function(){return this.getTokenFromStorage(!1)},e.prototype.getReauthAccessToken=function(){return this.getTokenFromStorage(!0)},e.prototype.getTokenFromStorage=function(e){var t=this.tokenService.getTokenFieldsFromStorage(e);return t?{token:t.tokenValue,expire:t.expire,sid:t.sid,impersonatorId:t.impersonatorId,isImpersonatedSession:t.isImpersonatedSession,pbaSatisfiedPolicies:t.pbaSatisfiedPolicies}:null},e.prototype.listSocialProviders=function(){var e=this;return new Promise((function(t,r){var i=e.adobeIdData.client_id;e.imsApis.listSocialProviders({client_id:i}).then((function(e){t(e)})).catch((function(e){r(e)}))}))},e.prototype.tokenReceived=function(e){this.adobeIdData.handlers.triggerOnAccessToken(e),de.startAutoRefreshFlow({expire:e.expire,refreshTokenMethod:this.refreshToken})},e.prototype.onTokenProfileReceived=function(e){var t=e.tokenInfo,r=e.profile;return p.info("token",t),this.tokenReceived(t),this.profileService.saveProfileToStorage(r),Promise.resolve(e)},e.prototype.validateToken=function(){var e=this;return this.tokenService.validateToken().then((function(){return Promise.resolve(!0)})).catch((function(t){return p.warn("validate token exception",t),t instanceof J?Promise.reject(!1):(e.profileService.removeProfile(),Promise.reject(!1))}))},e.prototype.onTokenExpired=function(){var e=this.adobeIdData.handlers;this.tokenService.purge(),e.triggerOnAccessTokenHasExpired()},e.prototype.setStandAloneToken=function(e){return this.tokenService.setStandAloneToken(e)},e.prototype.initialize=function(){var e=this,t=this.adobeIdData,r=t.handlers,i=t.standalone,o=t.ijt,n=t.alwaysRemoveTokenFromUrl,s=null;return i&&this.setStandAloneToken(i),(o?this.exchangeIjt:this.tokenService.getTokenAndProfile)().then(this.processTokenResponse,this.processError.apply(this)).then((function(e){s=e})).finally((function(){p.info("onReady initialization"),window.addEventListener("getImsLibInstance",(function(){e.triggerOnImsInstance(e)}),!1),n&&v.setHash($.removeAccessToken()),r.triggerOnReady(s?s.context:null),e.triggerOnImsInstance(e),e.initialized=!0}))},e.prototype.processError=function(){var e=this;return function(t){return e.verifyModalSignInEvent(t).catch(e.processInitializeException).catch(e.verifyTokenExpiredException).catch(e.verifyRideErrorException).catch(e.verifyCsrfException).catch(e.executeErrorCallback)}},e.prototype.notifyParentAboutModalSignIn=function(e){var t=window.location.href.replace("imslibmodal","wasmodal");if(window.opener)window.opener.postMessage(t,window.location.origin),window.close();else{var r=new BroadcastChannel("imslib");r.postMessage(t),r.close(),window.close()}return Promise.reject("popup")},e.prototype.restoreHash=function(){var e=$.fragmentToObject();e&&e.from_ims&&v.setHash(e.old_hash||"")},e.prototype.getTransitoryAuthorizationCode=function(e,t){return void 0===t&&(t={}),(e=e||{}).response_type=e.response_type||"code",e.target_client_id=e.target_client_id||this.adobeIdData.client_id,e.target_scope=e.target_scope||this.adobeIdData.scope,this.imsApis.getTransitoryAuthorizationCode(e,t,this.adobeIdData.client_id)},e.prototype.jumpToken=function(e,t){return void 0===t&&(t={}),e.target_client_id=e.target_client_id||this.adobeIdData.client_id,e.target_scope=e.target_scope||this.adobeIdData.scope,this.imsApis.jumpToken(e,t,this.adobeIdData.client_id)},e.prototype.getVerifierByKey=function(e){return(new M).getVerifierByKey(e)},e.prototype.socialHeadlessSignIn=function(e,t){return void 0===t&&(t={}),o(this,void 0,Promise,(function(){var r=this;return n(this,(function(i){return[2,this.imsApis.socialHeadlessSignIn(e,t).then((function(e){return r.exchangeIjt(e.token)})).catch((function(t){return"ride_AdobeID_social"===t.error&&r.signIn({idp_flow:"social.native",provider_id:e.provider_id,idp_token:e.idp_token}),Promise.reject(t)}))]}))}))},e}(),he=new(function(){function e(){this.createIMSLib=function(e,t){void 0===e&&(e=null),void 0===t&&(t="adobeIMS");var r=new pe(e,t);return window[t]=r,r}}return e.prototype.initAdobeIms=function(){window.adobeImsFactory={createIMSLib:this.createIMSLib};var e=window.adobeIMS||null;if(!e){var t=window.adobeid;if(!t||!t.client_id)return;(e=this.createIMSLib(t,"adobeIMS")).initialize()}},e}());return new(function(){function e(){he.initAdobeIms()}return e.prototype.initialize=function(){return!0},e}())}();