dash-button-web 0.0.2 → 0.0.5
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/dist/cjs/dash-button.cjs.entry.js +101 -6
- package/dist/cjs/dash-button.cjs.entry.js.map +1 -1
- package/dist/cjs/{index-8282b36b.js → index-991e75df.js} +45 -10
- package/dist/cjs/index-991e75df.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/web-compnont.cjs.js +2 -2
- package/dist/collection/components/my-component/dash-button.css +61 -0
- package/dist/collection/components/my-component/dash-button.js +173 -5
- package/dist/collection/components/my-component/dash-button.js.map +1 -1
- package/dist/components/dash-button.js +106 -6
- package/dist/components/dash-button.js.map +1 -1
- package/dist/esm/dash-button.entry.js +101 -6
- package/dist/esm/dash-button.entry.js.map +1 -1
- package/dist/esm/{index-2b6c17bc.js → index-8310c457.js} +45 -10
- package/dist/esm/index-8310c457.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/web-compnont.js +3 -3
- package/dist/types/components/my-component/dash-button.d.ts +8 -1
- package/dist/types/components.d.ts +8 -0
- package/dist/web-compnont/p-4bd42d49.js +3 -0
- package/dist/web-compnont/p-4bd42d49.js.map +1 -0
- package/dist/web-compnont/{p-4356bec1.entry.js → p-89ceb862.entry.js} +3 -3
- package/dist/web-compnont/p-89ceb862.entry.js.map +1 -0
- package/dist/web-compnont/web-compnont.esm.js +1 -1
- package/dist/web-compnont/web-compnont.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/index-8282b36b.js.map +0 -1
- package/dist/esm/index-2b6c17bc.js.map +0 -1
- package/dist/web-compnont/p-35259f64.js +0 -3
- package/dist/web-compnont/p-35259f64.js.map +0 -1
- package/dist/web-compnont/p-4356bec1.entry.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e,h as t,g as n}from"./p-
|
|
1
|
+
import{r as e,h as t,g as n}from"./p-4bd42d49.js";var r=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function i(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:true});Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:true,get:function(){return e[n]}})}));return t}var o={};o.byteLength=h;o.toByteArray=v;o.fromByteArray=b;var a=[];var s=[];var c=typeof Uint8Array!=="undefined"?Uint8Array:Array;var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var u=0,l=f.length;u<l;++u){a[u]=f[u];s[f.charCodeAt(u)]=u}s["-".charCodeAt(0)]=62;s["_".charCodeAt(0)]=63;function d(e){var t=e.length;if(t%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var n=e.indexOf("=");if(n===-1)n=t;var r=n===t?0:4-n%4;return[n,r]}function h(e){var t=d(e);var n=t[0];var r=t[1];return(n+r)*3/4-r}function p(e,t,n){return(t+n)*3/4-n}function v(e){var t;var n=d(e);var r=n[0];var i=n[1];var o=new c(p(e,r,i));var a=0;var f=i>0?r-4:r;var u;for(u=0;u<f;u+=4){t=s[e.charCodeAt(u)]<<18|s[e.charCodeAt(u+1)]<<12|s[e.charCodeAt(u+2)]<<6|s[e.charCodeAt(u+3)];o[a++]=t>>16&255;o[a++]=t>>8&255;o[a++]=t&255}if(i===2){t=s[e.charCodeAt(u)]<<2|s[e.charCodeAt(u+1)]>>4;o[a++]=t&255}if(i===1){t=s[e.charCodeAt(u)]<<10|s[e.charCodeAt(u+1)]<<4|s[e.charCodeAt(u+2)]>>2;o[a++]=t>>8&255;o[a++]=t&255}return o}function w(e){return a[e>>18&63]+a[e>>12&63]+a[e>>6&63]+a[e&63]}function g(e,t,n){var r;var i=[];for(var o=t;o<n;o+=3){r=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255);i.push(w(r))}return i.join("")}function b(e){var t;var n=e.length;var r=n%3;var i=[];var o=16383;for(var s=0,c=n-r;s<c;s+=o){i.push(g(e,s,s+o>c?c:s+o))}if(r===1){t=e[n-1];i.push(a[t>>2]+a[t<<4&63]+"==")}else if(r===2){t=(e[n-2]<<8)+e[n-1];i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"=")}return i.join("")}var k={exports:{}};const m={};const y=Object.freeze({__proto__:null,default:m});const x=i(y);
|
|
2
2
|
/**
|
|
3
3
|
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
4
4
|
*
|
|
@@ -6,5 +6,5 @@ import{r as e,h as t,g as n}from"./p-35259f64.js";var r=typeof globalThis!=="und
|
|
|
6
6
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
7
7
|
* @copyright Chen, Yi-Cyuan 2014-2023
|
|
8
8
|
* @license MIT
|
|
9
|
-
*/(function(e){(function(){var t="input is invalid type";var n=typeof window==="object";var i=n?window:{};if(i.JS_SHA256_NO_WINDOW){n=false}var o=!n&&typeof self==="object";var a=!i.JS_SHA256_NO_NODE_JS&&typeof process==="object"&&process.versions&&process.versions.node;if(a){i=r}else if(o){i=self}var s=!i.JS_SHA256_NO_COMMON_JS&&"object"==="object"&&e.exports;var f=!i.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!=="undefined";var c="0123456789abcdef".split("");var u=[-2147483648,8388608,32768,128];var l=[24,16,8,0];var d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];var h=["hex","array","digest","arrayBuffer"];var v=[];if(i.JS_SHA256_NO_NODE_JS||!Array.isArray){Array.isArray=function(e){return Object.prototype.toString.call(e)==="[object Array]"}}if(f&&(i.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)){ArrayBuffer.isView=function(e){return typeof e==="object"&&e.buffer&&e.buffer.constructor===ArrayBuffer}}var p=function(e,t){return function(n){return new m(t,true).update(n)[e]()}};var w=function(e){var t=p("hex",e);if(a){t=g(t,e)}t.create=function(){return new m(e)};t.update=function(e){return t.create().update(e)};for(var n=0;n<h.length;++n){var r=h[n];t[r]=p(r,e)}return t};var g=function(e,n){var r=x;var o=x.Buffer;var a=n?"sha224":"sha256";var s;if(o.from&&!i.JS_SHA256_NO_BUFFER_FROM){s=o.from}else{s=function(e){return new o(e)}}var f=function(n){if(typeof n==="string"){return r.createHash(a).update(n,"utf8").digest("hex")}else{if(n===null||n===undefined){throw new Error(t)}else if(n.constructor===ArrayBuffer){n=new Uint8Array(n)}}if(Array.isArray(n)||ArrayBuffer.isView(n)||n.constructor===o){return r.createHash(a).update(s(n)).digest("hex")}else{return e(n)}};return f};var b=function(e,t){return function(n,r){return new y(n,t,true).update(r)[e]()}};var k=function(e){var t=b("hex",e);t.create=function(t){return new y(t,e)};t.update=function(e,n){return t.create(e).update(n)};for(var n=0;n<h.length;++n){var r=h[n];t[r]=b(r,e)}return t};function m(e,t){if(t){v[0]=v[16]=v[1]=v[2]=v[3]=v[4]=v[5]=v[6]=v[7]=v[8]=v[9]=v[10]=v[11]=v[12]=v[13]=v[14]=v[15]=0;this.blocks=v}else{this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}if(e){this.h0=3238371032;this.h1=914150663;this.h2=812702999;this.h3=4144912697;this.h4=4290775857;this.h5=1750603025;this.h6=1694076839;this.h7=3204075428}else{this.h0=1779033703;this.h1=3144134277;this.h2=1013904242;this.h3=2773480762;this.h4=1359893119;this.h5=2600822924;this.h6=528734635;this.h7=1541459225}this.block=this.start=this.bytes=this.hBytes=0;this.finalized=this.hashed=false;this.first=true;this.is224=e}m.prototype.update=function(e){if(this.finalized){return}var n,r=typeof e;if(r!=="string"){if(r==="object"){if(e===null){throw new Error(t)}else if(f&&e.constructor===ArrayBuffer){e=new Uint8Array(e)}else if(!Array.isArray(e)){if(!f||!ArrayBuffer.isView(e)){throw new Error(t)}}}else{throw new Error(t)}n=true}var i,o=0,a,s=e.length,c=this.blocks;while(o<s){if(this.hashed){this.hashed=false;c[0]=this.block;c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0}if(n){for(a=this.start;o<s&&a<64;++o){c[a>>2]|=e[o]<<l[a++&3]}}else{for(a=this.start;o<s&&a<64;++o){i=e.charCodeAt(o);if(i<128){c[a>>2]|=i<<l[a++&3]}else if(i<2048){c[a>>2]|=(192|i>>6)<<l[a++&3];c[a>>2]|=(128|i&63)<<l[a++&3]}else if(i<55296||i>=57344){c[a>>2]|=(224|i>>12)<<l[a++&3];c[a>>2]|=(128|i>>6&63)<<l[a++&3];c[a>>2]|=(128|i&63)<<l[a++&3]}else{i=65536+((i&1023)<<10|e.charCodeAt(++o)&1023);c[a>>2]|=(240|i>>18)<<l[a++&3];c[a>>2]|=(128|i>>12&63)<<l[a++&3];c[a>>2]|=(128|i>>6&63)<<l[a++&3];c[a>>2]|=(128|i&63)<<l[a++&3]}}}this.lastByteIndex=a;this.bytes+=a-this.start;if(a>=64){this.block=c[16];this.start=a-64;this.hash();this.hashed=true}else{this.start=a}}if(this.bytes>4294967295){this.hBytes+=this.bytes/4294967296<<0;this.bytes=this.bytes%4294967296}return this};m.prototype.finalize=function(){if(this.finalized){return}this.finalized=true;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block;e[t>>2]|=u[t&3];this.block=e[16];if(t>=56){if(!this.hashed){this.hash()}e[0]=this.block;e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0}e[14]=this.hBytes<<3|this.bytes>>>29;e[15]=this.bytes<<3;this.hash()};m.prototype.hash=function(){var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,o=this.h5,a=this.h6,s=this.h7,f=this.blocks,c,u,l,h,v,p,w,g,b,k,m;for(c=16;c<64;++c){v=f[c-15];u=(v>>>7|v<<25)^(v>>>18|v<<14)^v>>>3;v=f[c-2];l=(v>>>17|v<<15)^(v>>>19|v<<13)^v>>>10;f[c]=f[c-16]+u+f[c-7]+l<<0}m=t&n;for(c=0;c<64;c+=4){if(this.first){if(this.is224){g=300032;v=f[0]-1413257819;s=v-150054599<<0;r=v+24177077<<0}else{g=704751109;v=f[0]-210244248;s=v-1521486534<<0;r=v+143694565<<0}this.first=false}else{u=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10);l=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7);g=e&t;h=g^e&n^m;w=i&o^~i&a;v=s+l+w+d[c]+f[c];p=u+h;s=r+v<<0;r=v+p<<0}u=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10);l=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7);b=r&e;h=b^r&t^g;w=s&i^~s&o;v=a+l+w+d[c+1]+f[c+1];p=u+h;a=n+v<<0;n=v+p<<0;u=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10);l=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7);k=n&r;h=k^n&e^b;w=a&s^~a&i;v=o+l+w+d[c+2]+f[c+2];p=u+h;o=t+v<<0;t=v+p<<0;u=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10);l=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7);m=t&n;h=m^t&r^k;w=o&a^~o&s;v=i+l+w+d[c+3]+f[c+3];p=u+h;i=e+v<<0;e=v+p<<0;this.chromeBugWorkAround=true}this.h0=this.h0+e<<0;this.h1=this.h1+t<<0;this.h2=this.h2+n<<0;this.h3=this.h3+r<<0;this.h4=this.h4+i<<0;this.h5=this.h5+o<<0;this.h6=this.h6+a<<0;this.h7=this.h7+s<<0};m.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,o=this.h5,a=this.h6,s=this.h7;var f=c[e>>28&15]+c[e>>24&15]+c[e>>20&15]+c[e>>16&15]+c[e>>12&15]+c[e>>8&15]+c[e>>4&15]+c[e&15]+c[t>>28&15]+c[t>>24&15]+c[t>>20&15]+c[t>>16&15]+c[t>>12&15]+c[t>>8&15]+c[t>>4&15]+c[t&15]+c[n>>28&15]+c[n>>24&15]+c[n>>20&15]+c[n>>16&15]+c[n>>12&15]+c[n>>8&15]+c[n>>4&15]+c[n&15]+c[r>>28&15]+c[r>>24&15]+c[r>>20&15]+c[r>>16&15]+c[r>>12&15]+c[r>>8&15]+c[r>>4&15]+c[r&15]+c[i>>28&15]+c[i>>24&15]+c[i>>20&15]+c[i>>16&15]+c[i>>12&15]+c[i>>8&15]+c[i>>4&15]+c[i&15]+c[o>>28&15]+c[o>>24&15]+c[o>>20&15]+c[o>>16&15]+c[o>>12&15]+c[o>>8&15]+c[o>>4&15]+c[o&15]+c[a>>28&15]+c[a>>24&15]+c[a>>20&15]+c[a>>16&15]+c[a>>12&15]+c[a>>8&15]+c[a>>4&15]+c[a&15];if(!this.is224){f+=c[s>>28&15]+c[s>>24&15]+c[s>>20&15]+c[s>>16&15]+c[s>>12&15]+c[s>>8&15]+c[s>>4&15]+c[s&15]}return f};m.prototype.toString=m.prototype.hex;m.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,o=this.h5,a=this.h6,s=this.h7;var f=[e>>24&255,e>>16&255,e>>8&255,e&255,t>>24&255,t>>16&255,t>>8&255,t&255,n>>24&255,n>>16&255,n>>8&255,n&255,r>>24&255,r>>16&255,r>>8&255,r&255,i>>24&255,i>>16&255,i>>8&255,i&255,o>>24&255,o>>16&255,o>>8&255,o&255,a>>24&255,a>>16&255,a>>8&255,a&255];if(!this.is224){f.push(s>>24&255,s>>16&255,s>>8&255,s&255)}return f};m.prototype.array=m.prototype.digest;m.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32);var t=new DataView(e);t.setUint32(0,this.h0);t.setUint32(4,this.h1);t.setUint32(8,this.h2);t.setUint32(12,this.h3);t.setUint32(16,this.h4);t.setUint32(20,this.h5);t.setUint32(24,this.h6);if(!this.is224){t.setUint32(28,this.h7)}return e};function y(e,n,r){var i,o=typeof e;if(o==="string"){var a=[],s=e.length,c=0,u;for(i=0;i<s;++i){u=e.charCodeAt(i);if(u<128){a[c++]=u}else if(u<2048){a[c++]=192|u>>6;a[c++]=128|u&63}else if(u<55296||u>=57344){a[c++]=224|u>>12;a[c++]=128|u>>6&63;a[c++]=128|u&63}else{u=65536+((u&1023)<<10|e.charCodeAt(++i)&1023);a[c++]=240|u>>18;a[c++]=128|u>>12&63;a[c++]=128|u>>6&63;a[c++]=128|u&63}}e=a}else{if(o==="object"){if(e===null){throw new Error(t)}else if(f&&e.constructor===ArrayBuffer){e=new Uint8Array(e)}else if(!Array.isArray(e)){if(!f||!ArrayBuffer.isView(e)){throw new Error(t)}}}else{throw new Error(t)}}if(e.length>64){e=new m(n,true).update(e).array()}var l=[],d=[];for(i=0;i<64;++i){var h=e[i]||0;l[i]=92^h;d[i]=54^h}m.call(this,n,r);this.update(d);this.oKeyPad=l;this.inner=true;this.sharedMemory=r}y.prototype=new m;y.prototype.finalize=function(){m.prototype.finalize.call(this);if(this.inner){this.inner=false;var e=this.array();m.call(this,this.is224,this.sharedMemory);this.update(this.oKeyPad);this.update(e);m.prototype.finalize.call(this)}};var _=w();_.sha256=_;_.sha224=w(true);_.sha256.hmac=k();_.sha224.hmac=k(true);if(s){e.exports=_}else{i.sha256=_.sha256;i.sha224=_.sha224}})()})(k);const _=k.exports;class I extends Error{}I.prototype.name="InvalidTokenError";function C(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();if(n.length<2){n="0"+n}return"%"+n})))}function A(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return C(t)}catch(e){return atob(t)}}function O(e,t){if(typeof e!=="string"){throw new I("Invalid token specified: must be a string")}t||(t={});const n=t.header===true?0:1;const r=e.split(".")[n];if(typeof r!=="string"){throw new I(`Invalid token specified: missing part #${n+1}`)}let i;try{i=A(r)}catch(e){throw new I(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new I(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}if(typeof Promise==="undefined"){throw Error("Keycloak requires an environment that supports Promises. Make sure that you include the appropriate polyfill.")}function U(e){if(!(this instanceof U)){throw new Error("The 'Keycloak' constructor must be invoked with 'new'.")}var t=this;var n;var r=[];var i;var a={enable:true,callbackList:[],interval:5};var s=document.getElementsByTagName("script");for(var f=0;f<s.length;f++){if((s[f].src.indexOf("keycloak.js")!==-1||s[f].src.indexOf("keycloak.min.js")!==-1)&&s[f].src.indexOf("version=")!==-1){t.iframeVersion=s[f].src.substring(s[f].src.indexOf("version=")+8).split("&")[0]}}var c=true;var u=z(console.info);var l=z(console.warn);t.init=function(e){if(t.didInitialize){throw new Error("A 'Keycloak' instance can only be initialized once.")}t.didInitialize=true;t.authenticated=false;i=J();var r=["default","cordova","cordova-native"];if(e&&r.indexOf(e.adapter)>-1){n=K(e.adapter)}else if(e&&typeof e.adapter==="object"){n=e.adapter}else{if(window.Cordova||window.cordova){n=K("cordova")}else{n=K()}}if(e){if(typeof e.useNonce!=="undefined"){c=e.useNonce}if(typeof e.checkLoginIframe!=="undefined"){a.enable=e.checkLoginIframe}if(e.checkLoginIframeInterval){a.interval=e.checkLoginIframeInterval}if(e.onLoad==="login-required"){t.loginRequired=true}if(e.responseMode){if(e.responseMode==="query"||e.responseMode==="fragment"){t.responseMode=e.responseMode}else{throw"Invalid value for responseMode"}}if(e.flow){switch(e.flow){case"standard":t.responseType="code";break;case"implicit":t.responseType="id_token token";break;case"hybrid":t.responseType="code id_token token";break;default:throw"Invalid value for flow"}t.flow=e.flow}if(e.timeSkew!=null){t.timeSkew=e.timeSkew}if(e.redirectUri){t.redirectUri=e.redirectUri}if(e.silentCheckSsoRedirectUri){t.silentCheckSsoRedirectUri=e.silentCheckSsoRedirectUri}if(typeof e.silentCheckSsoFallback==="boolean"){t.silentCheckSsoFallback=e.silentCheckSsoFallback}else{t.silentCheckSsoFallback=true}if(e.pkceMethod){if(e.pkceMethod!=="S256"){throw"Invalid value for pkceMethod"}t.pkceMethod=e.pkceMethod}if(typeof e.enableLogging==="boolean"){t.enableLogging=e.enableLogging}else{t.enableLogging=false}if(typeof e.scope==="string"){t.scope=e.scope}if(typeof e.acrValues==="string"){t.acrValues=e.acrValues}if(typeof e.messageReceiveTimeout==="number"&&e.messageReceiveTimeout>0){t.messageReceiveTimeout=e.messageReceiveTimeout}else{t.messageReceiveTimeout=1e4}}if(!t.responseMode){t.responseMode="fragment"}if(!t.responseType){t.responseType="code";t.flow="standard"}var o=R();var s=R();s.promise.then((function(){t.onReady&&t.onReady(t.authenticated);o.setSuccess(t.authenticated)})).catch((function(e){o.setError(e)}));var f=m();function u(){var n=function(n){if(!n){i.prompt="none"}if(e&&e.locale){i.locale=e.locale}t.login(i).then((function(){s.setSuccess()})).catch((function(e){s.setError(e)}))};var r=function(){var e=document.createElement("iframe");var n=t.createLoginUrl({prompt:"none",redirectUri:t.silentCheckSsoRedirectUri});e.setAttribute("src",n);e.setAttribute("sandbox","allow-storage-access-by-user-activation allow-scripts allow-same-origin");e.setAttribute("title","keycloak-silent-check-sso");e.style.display="none";document.body.appendChild(e);var r=function(t){if(t.origin!==window.location.origin||e.contentWindow!==t.source){return}var n=C(t.data);k(n,s);document.body.removeChild(e);window.removeEventListener("message",r)};window.addEventListener("message",r)};var i={};switch(e.onLoad){case"check-sso":if(a.enable){j().then((function(){N().then((function(e){if(!e){t.silentCheckSsoRedirectUri?r():n(false)}else{s.setSuccess()}})).catch((function(e){s.setError(e)}))}))}else{t.silentCheckSsoRedirectUri?r():n(false)}break;case"login-required":n(true);break;default:throw"Invalid value for onLoad"}}function l(){var n=C(window.location.href);if(n){window.history.replaceState(window.history.state,null,n.newUrl)}if(n&&n.valid){return j().then((function(){k(n,s)})).catch((function(e){s.setError(e)}))}else if(e){if(e.token&&e.refreshToken){x(e.token,e.refreshToken,e.idToken);if(a.enable){j().then((function(){N().then((function(e){if(e){t.onAuthSuccess&&t.onAuthSuccess();s.setSuccess();E()}else{s.setSuccess()}})).catch((function(e){s.setError(e)}))}))}else{t.updateToken(-1).then((function(){t.onAuthSuccess&&t.onAuthSuccess();s.setSuccess()})).catch((function(n){t.onAuthError&&t.onAuthError();if(e.onLoad){u()}else{s.setError(n)}}))}}else if(e.onLoad){u()}else{s.setSuccess()}}else{s.setSuccess()}}function d(){var e=R();var t=function(){if(document.readyState==="interactive"||document.readyState==="complete"){document.removeEventListener("readystatechange",t);e.setSuccess()}};document.addEventListener("readystatechange",t);t();return e.promise}f.then((function(){d().then(M).then(l).catch((function(e){o.setError(e)}))}));f.catch((function(e){o.setError(e)}));return o.promise};t.login=function(e){return n.login(e)};function d(e){var t=null;var n=window.crypto||window.msCrypto;if(n&&n.getRandomValues&&window.Uint8Array){t=new Uint8Array(e);n.getRandomValues(t);return t}t=new Array(e);for(var r=0;r<t.length;r++){t[r]=Math.floor(256*Math.random())}return t}function h(e){return v(e,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")}function v(e,t){var n=d(e);var r=new Array(e);for(var i=0;i<e;i++){r[i]=t.charCodeAt(n[i]%t.length)}return String.fromCharCode.apply(null,r)}function p(e,t){switch(e){case"S256":var n=new Uint8Array(_.arrayBuffer(t));var r=o.fromByteArray(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"");return r;default:throw"Invalid value for pkceMethod"}}function w(e){var t={id_token:{acr:e}};return JSON.stringify(t)}t.createLoginUrl=function(e){var r=I();var o=I();var a=n.redirectUri(e);var s={state:r,nonce:o,redirectUri:encodeURIComponent(a)};if(e&&e.prompt){s.prompt=e.prompt}var f;if(e&&e.action=="register"){f=t.endpoints.register()}else{f=t.endpoints.authorize()}var u=e&&e.scope||t.scope;if(!u){u="openid"}else if(u.indexOf("openid")===-1){u="openid "+u}var l=f+"?client_id="+encodeURIComponent(t.clientId)+"&redirect_uri="+encodeURIComponent(a)+"&state="+encodeURIComponent(r)+"&response_mode="+encodeURIComponent(t.responseMode)+"&response_type="+encodeURIComponent(t.responseType)+"&scope="+encodeURIComponent(u);if(c){l=l+"&nonce="+encodeURIComponent(o)}if(e&&e.prompt){l+="&prompt="+encodeURIComponent(e.prompt)}if(e&&e.maxAge){l+="&max_age="+encodeURIComponent(e.maxAge)}if(e&&e.loginHint){l+="&login_hint="+encodeURIComponent(e.loginHint)}if(e&&e.idpHint){l+="&kc_idp_hint="+encodeURIComponent(e.idpHint)}if(e&&e.action&&e.action!="register"){l+="&kc_action="+encodeURIComponent(e.action)}if(e&&e.locale){l+="&ui_locales="+encodeURIComponent(e.locale)}if(e&&e.acr){var d=w(e.acr);l+="&claims="+encodeURIComponent(d)}if(e&&e.acrValues||t.acrValues){l+="&acr_values="+encodeURIComponent(e.acrValues||t.acrValues)}if(t.pkceMethod){var v=h(96);s.pkceCodeVerifier=v;var g=p(t.pkceMethod,v);l+="&code_challenge="+g;l+="&code_challenge_method="+t.pkceMethod}i.add(s);return l};t.logout=function(e){return n.logout(e)};t.createLogoutUrl=function(e){var r=t.endpoints.logout()+"?client_id="+encodeURIComponent(t.clientId)+"&post_logout_redirect_uri="+encodeURIComponent(n.redirectUri(e,false));if(t.idToken){r+="&id_token_hint="+encodeURIComponent(t.idToken)}return r};t.register=function(e){return n.register(e)};t.createRegisterUrl=function(e){if(!e){e={}}e.action="register";return t.createLoginUrl(e)};t.createAccountUrl=function(e){var r=g();var i=undefined;if(typeof r!=="undefined"){i=r+"/account"+"?referrer="+encodeURIComponent(t.clientId)+"&referrer_uri="+encodeURIComponent(n.redirectUri(e))}return i};t.accountManagement=function(){return n.accountManagement()};t.hasRealmRole=function(e){var n=t.realmAccess;return!!n&&n.roles.indexOf(e)>=0};t.hasResourceRole=function(e,n){if(!t.resourceAccess){return false}var r=t.resourceAccess[n||t.clientId];return!!r&&r.roles.indexOf(e)>=0};t.loadUserProfile=function(){var e=g()+"/account";var n=new XMLHttpRequest;n.open("GET",e,true);n.setRequestHeader("Accept","application/json");n.setRequestHeader("Authorization","bearer "+t.token);var r=R();n.onreadystatechange=function(){if(n.readyState==4){if(n.status==200){t.profile=JSON.parse(n.responseText);r.setSuccess(t.profile)}else{r.setError()}}};n.send();return r.promise};t.loadUserInfo=function(){var e=t.endpoints.userinfo();var n=new XMLHttpRequest;n.open("GET",e,true);n.setRequestHeader("Accept","application/json");n.setRequestHeader("Authorization","bearer "+t.token);var r=R();n.onreadystatechange=function(){if(n.readyState==4){if(n.status==200){t.userInfo=JSON.parse(n.responseText);r.setSuccess(t.userInfo)}else{r.setError()}}};n.send();return r.promise};t.isTokenExpired=function(e){if(!t.tokenParsed||!t.refreshToken&&t.flow!="implicit"){throw"Not authenticated"}if(t.timeSkew==null){u("[KEYCLOAK] Unable to determine if token is expired as timeskew is not set");return true}var n=t.tokenParsed["exp"]-Math.ceil((new Date).getTime()/1e3)+t.timeSkew;if(e){if(isNaN(e)){throw"Invalid minValidity"}n-=e}return n<0};t.updateToken=function(e){var n=R();if(!t.refreshToken){n.setError();return n.promise}e=e||5;var i=function(){var i=false;if(e==-1){i=true;u("[KEYCLOAK] Refreshing token: forced refresh")}else if(!t.tokenParsed||t.isTokenExpired(e)){i=true;u("[KEYCLOAK] Refreshing token: token expired")}if(!i){n.setSuccess(false)}else{var o="grant_type=refresh_token&"+"refresh_token="+t.refreshToken;var a=t.endpoints.token();r.push(n);if(r.length==1){var s=new XMLHttpRequest;s.open("POST",a,true);s.setRequestHeader("Content-type","application/x-www-form-urlencoded");s.withCredentials=true;o+="&client_id="+encodeURIComponent(t.clientId);var f=(new Date).getTime();s.onreadystatechange=function(){if(s.readyState==4){if(s.status==200){u("[KEYCLOAK] Token refreshed");f=(f+(new Date).getTime())/2;var e=JSON.parse(s.responseText);x(e["access_token"],e["refresh_token"],e["id_token"],f);t.onAuthRefreshSuccess&&t.onAuthRefreshSuccess();for(var n=r.pop();n!=null;n=r.pop()){n.setSuccess(true)}}else{l("[KEYCLOAK] Failed to refresh token");if(s.status==400){t.clearToken()}t.onAuthRefreshError&&t.onAuthRefreshError();for(var n=r.pop();n!=null;n=r.pop()){n.setError(true)}}}};s.send(o)}}};if(a.enable){var o=N();o.then((function(){i()})).catch((function(e){n.setError(e)}))}else{i()}return n.promise};t.clearToken=function(){if(t.token){x(null,null,null);t.onAuthLogout&&t.onAuthLogout();if(t.loginRequired){t.login()}}};function g(){if(typeof t.authServerUrl!=="undefined"){if(t.authServerUrl.charAt(t.authServerUrl.length-1)=="/"){return t.authServerUrl+"realms/"+encodeURIComponent(t.realm)}else{return t.authServerUrl+"/realms/"+encodeURIComponent(t.realm)}}else{return undefined}}function b(){if(!window.location.origin){return window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}else{return window.location.origin}}function k(e,n){var r=e.code;var i=e.error;var o=e.prompt;var a=(new Date).getTime();if(e["kc_action_status"]){t.onActionUpdate&&t.onActionUpdate(e["kc_action_status"])}if(i){if(o!="none"){var s={error:i,error_description:e.error_description};t.onAuthError&&t.onAuthError(s);n&&n.setError(s)}else{n&&n.setSuccess()}return}else if(t.flow!="standard"&&(e.access_token||e.id_token)){h(e.access_token,null,e.id_token,true)}if(t.flow!="implicit"&&r){var f="code="+r+"&grant_type=authorization_code";var l=t.endpoints.token();var d=new XMLHttpRequest;d.open("POST",l,true);d.setRequestHeader("Content-type","application/x-www-form-urlencoded");f+="&client_id="+encodeURIComponent(t.clientId);f+="&redirect_uri="+e.redirectUri;if(e.pkceCodeVerifier){f+="&code_verifier="+e.pkceCodeVerifier}d.withCredentials=true;d.onreadystatechange=function(){if(d.readyState==4){if(d.status==200){var e=JSON.parse(d.responseText);h(e["access_token"],e["refresh_token"],e["id_token"],t.flow==="standard");E()}else{t.onAuthError&&t.onAuthError();n&&n.setError()}}};d.send(f)}function h(r,i,o,s){a=(a+(new Date).getTime())/2;x(r,i,o,a);if(c&&(t.tokenParsed&&t.tokenParsed.nonce!=e.storedNonce||t.refreshTokenParsed&&t.refreshTokenParsed.nonce!=e.storedNonce||t.idTokenParsed&&t.idTokenParsed.nonce!=e.storedNonce)){u("[KEYCLOAK] Invalid nonce, clearing token");t.clearToken();n&&n.setError()}else{if(s){t.onAuthSuccess&&t.onAuthSuccess();n&&n.setSuccess()}}}}function m(n){var r=R();var i;if(!e){i="keycloak.json"}else if(typeof e==="string"){i=e}function o(e){if(!e){t.endpoints={authorize:function(){return g()+"/protocol/openid-connect/auth"},token:function(){return g()+"/protocol/openid-connect/token"},logout:function(){return g()+"/protocol/openid-connect/logout"},checkSessionIframe:function(){var e=g()+"/protocol/openid-connect/login-status-iframe.html";if(t.iframeVersion){e=e+"?version="+t.iframeVersion}return e},thirdPartyCookiesIframe:function(){var e=g()+"/protocol/openid-connect/3p-cookies/step1.html";if(t.iframeVersion){e=e+"?version="+t.iframeVersion}return e},register:function(){return g()+"/protocol/openid-connect/registrations"},userinfo:function(){return g()+"/protocol/openid-connect/userinfo"}}}else{t.endpoints={authorize:function(){return e.authorization_endpoint},token:function(){return e.token_endpoint},logout:function(){if(!e.end_session_endpoint){throw"Not supported by the OIDC server"}return e.end_session_endpoint},checkSessionIframe:function(){if(!e.check_session_iframe){throw"Not supported by the OIDC server"}return e.check_session_iframe},register:function(){throw'Redirection to "Register user" page not supported in standard OIDC mode'},userinfo:function(){if(!e.userinfo_endpoint){throw"Not supported by the OIDC server"}return e.userinfo_endpoint}}}}if(i){var a=new XMLHttpRequest;a.open("GET",i,true);a.setRequestHeader("Accept","application/json");a.onreadystatechange=function(){if(a.readyState==4){if(a.status==200||y(a)){var e=JSON.parse(a.responseText);t.authServerUrl=e["auth-server-url"];t.realm=e["realm"];t.clientId=e["resource"];o(null);r.setSuccess()}else{r.setError()}}};a.send()}else{if(!e.clientId){throw"clientId missing"}t.clientId=e.clientId;var s=e["oidcProvider"];if(!s){if(!e["url"]){var f=document.getElementsByTagName("script");for(var c=0;c<f.length;c++){if(f[c].src.match(/.*keycloak\.js/)){e.url=f[c].src.substr(0,f[c].src.indexOf("/js/keycloak.js"));break}}}if(!e.realm){throw"realm missing"}t.authServerUrl=e.url;t.realm=e.realm;o(null);r.setSuccess()}else{if(typeof s==="string"){var u;if(s.charAt(s.length-1)=="/"){u=s+".well-known/openid-configuration"}else{u=s+"/.well-known/openid-configuration"}var a=new XMLHttpRequest;a.open("GET",u,true);a.setRequestHeader("Accept","application/json");a.onreadystatechange=function(){if(a.readyState==4){if(a.status==200||y(a)){var e=JSON.parse(a.responseText);o(e);r.setSuccess()}else{r.setError()}}};a.send()}else{o(s);r.setSuccess()}}}return r.promise}function y(e){return e.status==0&&e.responseText&&e.responseURL.startsWith("file:")}function x(e,n,r,i){if(t.tokenTimeoutHandle){clearTimeout(t.tokenTimeoutHandle);t.tokenTimeoutHandle=null}if(n){t.refreshToken=n;t.refreshTokenParsed=O(n)}else{delete t.refreshToken;delete t.refreshTokenParsed}if(r){t.idToken=r;t.idTokenParsed=O(r)}else{delete t.idToken;delete t.idTokenParsed}if(e){t.token=e;t.tokenParsed=O(e);t.sessionId=t.tokenParsed.session_state;t.authenticated=true;t.subject=t.tokenParsed.sub;t.realmAccess=t.tokenParsed.realm_access;t.resourceAccess=t.tokenParsed.resource_access;if(i){t.timeSkew=Math.floor(i/1e3)-t.tokenParsed.iat}if(t.timeSkew!=null){u("[KEYCLOAK] Estimated time difference between browser and server is "+t.timeSkew+" seconds");if(t.onTokenExpired){var o=(t.tokenParsed["exp"]-(new Date).getTime()/1e3+t.timeSkew)*1e3;u("[KEYCLOAK] Token expires in "+Math.round(o/1e3)+" s");if(o<=0){t.onTokenExpired()}else{t.tokenTimeoutHandle=setTimeout(t.onTokenExpired,o)}}}}else{delete t.token;delete t.tokenParsed;delete t.subject;delete t.realmAccess;delete t.resourceAccess;t.authenticated=false}}function I(){var e="0123456789abcdef";var t=v(36,e).split("");t[14]="4";t[19]=e.substr(t[19]&3|8,1);t[8]=t[13]=t[18]=t[23]="-";var n=t.join("");return n}function C(e){var t=A(e);if(!t){return}var n=i.get(t.state);if(n){t.valid=true;t.redirectUri=n.redirectUri;t.storedNonce=n.nonce;t.prompt=n.prompt;t.pkceCodeVerifier=n.pkceCodeVerifier}return t}function A(e){var n;switch(t.flow){case"standard":n=["code","state","session_state","kc_action_status","iss"];break;case"implicit":n=["access_token","token_type","id_token","state","session_state","expires_in","kc_action_status","iss"];break;case"hybrid":n=["access_token","token_type","id_token","code","state","session_state","expires_in","kc_action_status","iss"];break}n.push("error");n.push("error_description");n.push("error_uri");var r=e.indexOf("?");var i=e.indexOf("#");var o;var a;if(t.responseMode==="query"&&r!==-1){o=e.substring(0,r);a=S(e.substring(r+1,i!==-1?i:e.length),n);if(a.paramsString!==""){o+="?"+a.paramsString}if(i!==-1){o+=e.substring(i)}}else if(t.responseMode==="fragment"&&i!==-1){o=e.substring(0,i);a=S(e.substring(i+1),n);if(a.paramsString!==""){o+="#"+a.paramsString}}if(a&&a.oauthParams){if(t.flow==="standard"||t.flow==="hybrid"){if((a.oauthParams.code||a.oauthParams.error)&&a.oauthParams.state){a.oauthParams.newUrl=o;return a.oauthParams}}else if(t.flow==="implicit"){if((a.oauthParams.access_token||a.oauthParams.error)&&a.oauthParams.state){a.oauthParams.newUrl=o;return a.oauthParams}}}}function S(e,t){var n=e.split("&");var r={paramsString:"",oauthParams:{}};for(var i=0;i<n.length;i++){var o=n[i].indexOf("=");var a=n[i].slice(0,o);if(t.indexOf(a)!==-1){r.oauthParams[a]=n[i].slice(o+1)}else{if(r.paramsString!==""){r.paramsString+="&"}r.paramsString+=n[i]}}return r}function R(){var e={setSuccess:function(t){e.resolve(t)},setError:function(t){e.reject(t)}};e.promise=new Promise((function(t,n){e.resolve=t;e.reject=n}));return e}function L(e,t,n){var r=null;var i=new Promise((function(e,i){r=setTimeout((function(){i({error:n||"Promise is not settled within timeout of "+t+"ms"})}),t)}));return Promise.race([e,i]).finally((function(){clearTimeout(r)}))}function j(){var e=R();if(!a.enable){e.setSuccess();return e.promise}if(a.iframe){e.setSuccess();return e.promise}var n=document.createElement("iframe");a.iframe=n;n.onload=function(){var n=t.endpoints.authorize();if(n.charAt(0)==="/"){a.iframeOrigin=b()}else{a.iframeOrigin=n.substring(0,n.indexOf("/",8))}e.setSuccess()};var r=t.endpoints.checkSessionIframe();n.setAttribute("src",r);n.setAttribute("sandbox","allow-storage-access-by-user-activation allow-scripts allow-same-origin");n.setAttribute("title","keycloak-session-iframe");n.style.display="none";document.body.appendChild(n);var i=function(e){if(e.origin!==a.iframeOrigin||a.iframe.contentWindow!==e.source){return}if(!(e.data=="unchanged"||e.data=="changed"||e.data=="error")){return}if(e.data!="unchanged"){t.clearToken()}var n=a.callbackList.splice(0,a.callbackList.length);for(var r=n.length-1;r>=0;--r){var i=n[r];if(e.data=="error"){i.setError()}else{i.setSuccess(e.data=="unchanged")}}};window.addEventListener("message",i,false);return e.promise}function E(){if(a.enable){if(t.token){setTimeout((function(){N().then((function(e){if(e){E()}}))}),a.interval*1e3)}}}function N(){var e=R();if(a.iframe&&a.iframeOrigin){var n=t.clientId+" "+(t.sessionId?t.sessionId:"");a.callbackList.push(e);var r=a.iframeOrigin;if(a.callbackList.length==1){a.iframe.contentWindow.postMessage(n,r)}}else{e.setSuccess()}return e.promise}function M(){var e=R();if(a.enable||t.silentCheckSsoRedirectUri){var n=document.createElement("iframe");n.setAttribute("src",t.endpoints.thirdPartyCookiesIframe());n.setAttribute("sandbox","allow-storage-access-by-user-activation allow-scripts allow-same-origin");n.setAttribute("title","keycloak-3p-check-iframe");n.style.display="none";document.body.appendChild(n);var r=function(i){if(n.contentWindow!==i.source){return}if(i.data!=="supported"&&i.data!=="unsupported"){return}else if(i.data==="unsupported"){l("[KEYCLOAK] Your browser is blocking access to 3rd-party cookies, this means:\n\n"+" - It is not possible to retrieve tokens without redirecting to the Keycloak server (a.k.a. no support for silent authentication).\n"+" - It is not possible to automatically detect changes to the session status (such as the user logging out in another tab).\n\n"+"For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_modern_browsers");a.enable=false;if(t.silentCheckSsoFallback){t.silentCheckSsoRedirectUri=false}}document.body.removeChild(n);window.removeEventListener("message",r);e.setSuccess()};window.addEventListener("message",r,false)}else{e.setSuccess()}return L(e.promise,t.messageReceiveTimeout,"Timeout when waiting for 3rd party check iframe message.")}function K(e){if(!e||e=="default"){return{login:function(e){window.location.assign(t.createLoginUrl(e));return R().promise},logout:function(e){window.location.replace(t.createLogoutUrl(e));return R().promise},register:function(e){window.location.assign(t.createRegisterUrl(e));return R().promise},accountManagement:function(){var e=t.createAccountUrl();if(typeof e!=="undefined"){window.location.href=e}else{throw"Not supported by the OIDC server"}return R().promise},redirectUri:function(e,n){if(e&&e.redirectUri){return e.redirectUri}else if(t.redirectUri){return t.redirectUri}else{return location.href}}}}if(e=="cordova"){a.enable=false;var n=function(e,t,n){if(window.cordova&&window.cordova.InAppBrowser){return window.cordova.InAppBrowser.open(e,t,n)}else{return window.open(e,t,n)}};var r=function(e){if(e&&e.cordovaOptions){return Object.keys(e.cordovaOptions).reduce((function(t,n){t[n]=e.cordovaOptions[n];return t}),{})}else{return{}}};var i=function(e){return Object.keys(e).reduce((function(t,n){t.push(n+"="+e[n]);return t}),[]).join(",")};var o=function(e){var t=r(e);t.location="no";if(e&&e.prompt=="none"){t.hidden="yes"}return i(t)};var s=function(){return t.redirectUri||"http://localhost"};return{login:function(e){var r=R();var i=o(e);var a=t.createLoginUrl(e);var f=n(a,"_blank",i);var c=false;var u=false;var l=function(){u=true;f.close()};f.addEventListener("loadstart",(function(e){if(e.url.indexOf(s())==0){var t=C(e.url);k(t,r);l();c=true}}));f.addEventListener("loaderror",(function(e){if(!c){if(e.url.indexOf(s())==0){var t=C(e.url);k(t,r);l();c=true}else{r.setError();l()}}}));f.addEventListener("exit",(function(e){if(!u){r.setError({reason:"closed_by_user"})}}));return r.promise},logout:function(e){var r=R();var i=t.createLogoutUrl(e);var o=n(i,"_blank","location=no,hidden=yes,clearcache=yes");var a;o.addEventListener("loadstart",(function(e){if(e.url.indexOf(s())==0){o.close()}}));o.addEventListener("loaderror",(function(e){if(e.url.indexOf(s())==0){o.close()}else{a=true;o.close()}}));o.addEventListener("exit",(function(e){if(a){r.setError()}else{t.clearToken();r.setSuccess()}}));return r.promise},register:function(e){var r=R();var i=t.createRegisterUrl();var a=o(e);var f=n(i,"_blank",a);f.addEventListener("loadstart",(function(e){if(e.url.indexOf(s())==0){f.close();var t=C(e.url);k(t,r)}}));return r.promise},accountManagement:function(){var e=t.createAccountUrl();if(typeof e!=="undefined"){var r=n(e,"_blank","location=no");r.addEventListener("loadstart",(function(e){if(e.url.indexOf(s())==0){r.close()}}))}else{throw"Not supported by the OIDC server"}},redirectUri:function(e){return s()}}}if(e=="cordova-native"){a.enable=false;return{login:function(e){var n=R();var r=t.createLoginUrl(e);universalLinks.subscribe("keycloak",(function(e){universalLinks.unsubscribe("keycloak");window.cordova.plugins.browsertab.close();var t=C(e.url);k(t,n)}));window.cordova.plugins.browsertab.openUrl(r);return n.promise},logout:function(e){var n=R();var r=t.createLogoutUrl(e);universalLinks.subscribe("keycloak",(function(e){universalLinks.unsubscribe("keycloak");window.cordova.plugins.browsertab.close();t.clearToken();n.setSuccess()}));window.cordova.plugins.browsertab.openUrl(r);return n.promise},register:function(e){var n=R();var r=t.createRegisterUrl(e);universalLinks.subscribe("keycloak",(function(e){universalLinks.unsubscribe("keycloak");window.cordova.plugins.browsertab.close();var t=C(e.url);k(t,n)}));window.cordova.plugins.browsertab.openUrl(r);return n.promise},accountManagement:function(){var e=t.createAccountUrl();if(typeof e!=="undefined"){window.cordova.plugins.browsertab.openUrl(e)}else{throw"Not supported by the OIDC server"}},redirectUri:function(e){if(e&&e.redirectUri){return e.redirectUri}else if(t.redirectUri){return t.redirectUri}else{return"http://localhost"}}}}throw"invalid adapter type: "+e}var D=function(){if(!(this instanceof D)){return new D}localStorage.setItem("kc-test","test");localStorage.removeItem("kc-test");var e=this;function t(){var e=(new Date).getTime();for(var t=0;t<localStorage.length;t++){var n=localStorage.key(t);if(n&&n.indexOf("kc-callback-")==0){var r=localStorage.getItem(n);if(r){try{var i=JSON.parse(r).expires;if(!i||i<e){localStorage.removeItem(n)}}catch(e){localStorage.removeItem(n)}}}}}e.get=function(e){if(!e){return}var n="kc-callback-"+e;var r=localStorage.getItem(n);if(r){localStorage.removeItem(n);r=JSON.parse(r)}t();return r};e.add=function(e){t();var n="kc-callback-"+e.state;e.expires=(new Date).getTime()+60*60*1e3;localStorage.setItem(n,JSON.stringify(e))}};var T=function(){if(!(this instanceof T)){return new T}var e=this;e.get=function(e){if(!e){return}var i=n("kc-callback-"+e);r("kc-callback-"+e,"",t(-100));if(i){return JSON.parse(i)}};e.add=function(e){r("kc-callback-"+e.state,JSON.stringify(e),t(60))};e.removeItem=function(e){r(e,"",t(-100))};var t=function(e){var t=new Date;t.setTime(t.getTime()+e*60*1e3);return t};var n=function(e){var t=e+"=";var n=document.cookie.split(";");for(var r=0;r<n.length;r++){var i=n[r];while(i.charAt(0)==" "){i=i.substring(1)}if(i.indexOf(t)==0){return i.substring(t.length,i.length)}}return""};var r=function(e,t,n){var r=e+"="+t+"; "+"expires="+n.toUTCString()+"; ";document.cookie=r}};function J(){try{return new D}catch(e){}return new T}function z(e){return function(){if(t.enableLogging){e.apply(console,Array.prototype.slice.call(arguments))}}}}const S='.button{display:flex;height:50px;padding:0;background:#3e7671;border:none;outline:none;border-radius:5px;overflow:hidden;font-size:16px;font-weight:500;cursor:pointer;min-width:220px;max-width:220px}.button:hover{background:#008168}.button:active{background:#3e7671}.button-text{display:block;margin:auto;padding:0 24px;color:#fff;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:80px}.button-icon{margin:auto;padding:10px}.button-profile{display:inline-flex;align-items:center;color:#fff}.button-profile img{height:50px}.button-text-full-width{width:auto!important}.button-link{text-decoration:none!important}.gg-menu-grid-r{color:#fff;box-sizing:border-box;position:relative;display:block;transform:scale(var(--ggs,1));width:16px;height:16px}.gg-menu-grid-r::before{content:"";display:block;box-sizing:border-box;position:absolute;width:4px;height:4px;background:currentColor;box-shadow:0 6px 0,\n 6px 6px 0,\n 12px 6px 0,\n 6px 12px 0,\n 12px 12px 0,\n 6px 0 0,\n 12px 0 0,\n 0 12px 0}.dropdown{position:relative;display:inline-block}.dropdown-content{display:none;position:absolute;right:0;background-color:#f9f9f9;min-width:180px;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);z-index:1;border-radius:5px}.dropdown-content a{color:#71797E;padding:16px 20px;text-decoration:none;display:block;cursor:pointer}.dropdown-content a:hover{background-color:#f1f1f1;color:#000;opacity:0.7}.dropdown:hover .dropdown-content{display:block}.modal{display:none;position:fixed;z-index:1;padding-top:100px;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgb(0,0,0);background-color:rgba(0,0,0,0.4);text-align:center}.modal-content{background-color:#fefefe;margin:auto;padding:20px;border:1px solid #888;width:40%}.close{color:#aaaaaa;float:right;font-size:28px;font-weight:bold}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer}.modal-app{background-color:#c3e9bc;padding:15px;margin:10px;border-radius:5px}';const R=S;const L=class{constructor(t){e(this,t);this.showPostLoginText=false;this.silentCheckSso=false;this.redirectUri=undefined;this.authMethod="check-sso";this.keycloakUri="http://localhost:8080";this.realm="";this.clientId="";this.keycloak=new U({url:this.keycloakUri,realm:this.realm,clientId:this.clientId});this.isAuth=false;this.givenName="";this.silentCheckSsoRedirectUri=window.location.origin+"/assets/verificar-sso.html"}connectedCallback(){this.keycloak.init({onLoad:this.authMethod,checkLoginIframe:false,silentCheckSsoRedirectUri:this.silentCheckSso?this.silentCheckSsoRedirectUri:""}).then((e=>{if(e){this.isAuth=true;localStorage.setItem("keycloak",JSON.stringify(this.keycloak));document.cookie="ZDZW_cookie="+JSON.parse(localStorage.getItem("keycloak")).token;this.givenName=JSON.parse(localStorage.getItem("keycloak")).idTokenParsed.given_name}}))}login(){this.keycloak.login()}logout(){localStorage.removeItem("keycloak");document.cookie="ZDZW_cookie=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";this.keycloak.logout()}showModal(){const e=this.el.shadowRoot.querySelector("#appListModal");e.style.display="block"}closeModal(){const e=this.el.shadowRoot.querySelector("#appListModal");e.style.display="none"}render(){return t("div",{key:"46065686f61e27894acf13494d479f8e14ae440a"},t("div",{key:"fb795b6cab0e9a57ee9ddfc6a6ab69796de02d94"},(()=>{if(this.isAuth&&this.showPostLoginText){return t("a",{href:this.redirectUri,id:"login-btn",class:"button button-link"},t("span",{class:"button-text button-text-full-width"},"Go to Dashboard"))}else if(this.isAuth){return t("div",{id:"profile-btn",class:"dropdown"},t("button",{type:"button",class:"button"},t("span",{class:"button-profile"},t("img",{src:"https://i.pravatar.cc/100?img=32",alt:""})),t("span",{id:"given-name",class:"button-text"},this.givenName),t("div",{class:"button-icon"},t("span",{class:"gg-menu-grid-r"}))),t("div",{class:"dropdown-content"},t("a",{onClick:this.showModal.bind(this),id:"applications-btn"},"Applications"),t("a",{onClick:this.logout.bind(this),id:"logout-btn"},"Logout")))}else{return t("button",{onClick:this.login.bind(this),id:"login-btn",type:"button",class:"button"},t("span",{class:"button-text"},"Login"))}})()),t("div",{key:"f64fc2082e07f576df4cff7d71453c8f18a4347e",id:"appListModal",class:"modal"},t("div",{key:"9753fff951bd9719bb39db00cf99861dc1caeb2e",class:"modal-content"},t("span",{key:"f1a1ba93614473a498cf7f43d1ed1d2814a77df3",onClick:this.closeModal.bind(this),class:"close"},"×"),t("h3",{key:"14a85f33052086fb9597a507789d145bec9cd076"},"Applications"),t("div",{key:"d323ba9ca8504ac36668c78c6c23c53dd695a6ac",class:"modal-app"},"App 1"),t("div",{key:"c1391a3b447aec37d81a723821ea28922a2cbaa4",class:"modal-app"},"App 2"))))}get el(){return n(this)}};L.style=R;export{L as dash_button};
|
|
10
|
-
//# sourceMappingURL=p-
|
|
9
|
+
*/(function(e){(function(){var t="input is invalid type";var n=typeof window==="object";var i=n?window:{};if(i.JS_SHA256_NO_WINDOW){n=false}var o=!n&&typeof self==="object";var a=!i.JS_SHA256_NO_NODE_JS&&typeof process==="object"&&process.versions&&process.versions.node;if(a){i=r}else if(o){i=self}var s=!i.JS_SHA256_NO_COMMON_JS&&"object"==="object"&&e.exports;var c=!i.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!=="undefined";var f="0123456789abcdef".split("");var u=[-2147483648,8388608,32768,128];var l=[24,16,8,0];var d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];var h=["hex","array","digest","arrayBuffer"];var p=[];if(i.JS_SHA256_NO_NODE_JS||!Array.isArray){Array.isArray=function(e){return Object.prototype.toString.call(e)==="[object Array]"}}if(c&&(i.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)){ArrayBuffer.isView=function(e){return typeof e==="object"&&e.buffer&&e.buffer.constructor===ArrayBuffer}}var v=function(e,t){return function(n){return new m(t,true).update(n)[e]()}};var w=function(e){var t=v("hex",e);if(a){t=g(t,e)}t.create=function(){return new m(e)};t.update=function(e){return t.create().update(e)};for(var n=0;n<h.length;++n){var r=h[n];t[r]=v(r,e)}return t};var g=function(e,n){var r=x;var o=x.Buffer;var a=n?"sha224":"sha256";var s;if(o.from&&!i.JS_SHA256_NO_BUFFER_FROM){s=o.from}else{s=function(e){return new o(e)}}var c=function(n){if(typeof n==="string"){return r.createHash(a).update(n,"utf8").digest("hex")}else{if(n===null||n===undefined){throw new Error(t)}else if(n.constructor===ArrayBuffer){n=new Uint8Array(n)}}if(Array.isArray(n)||ArrayBuffer.isView(n)||n.constructor===o){return r.createHash(a).update(s(n)).digest("hex")}else{return e(n)}};return c};var b=function(e,t){return function(n,r){return new y(n,t,true).update(r)[e]()}};var k=function(e){var t=b("hex",e);t.create=function(t){return new y(t,e)};t.update=function(e,n){return t.create(e).update(n)};for(var n=0;n<h.length;++n){var r=h[n];t[r]=b(r,e)}return t};function m(e,t){if(t){p[0]=p[16]=p[1]=p[2]=p[3]=p[4]=p[5]=p[6]=p[7]=p[8]=p[9]=p[10]=p[11]=p[12]=p[13]=p[14]=p[15]=0;this.blocks=p}else{this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}if(e){this.h0=3238371032;this.h1=914150663;this.h2=812702999;this.h3=4144912697;this.h4=4290775857;this.h5=1750603025;this.h6=1694076839;this.h7=3204075428}else{this.h0=1779033703;this.h1=3144134277;this.h2=1013904242;this.h3=2773480762;this.h4=1359893119;this.h5=2600822924;this.h6=528734635;this.h7=1541459225}this.block=this.start=this.bytes=this.hBytes=0;this.finalized=this.hashed=false;this.first=true;this.is224=e}m.prototype.update=function(e){if(this.finalized){return}var n,r=typeof e;if(r!=="string"){if(r==="object"){if(e===null){throw new Error(t)}else if(c&&e.constructor===ArrayBuffer){e=new Uint8Array(e)}else if(!Array.isArray(e)){if(!c||!ArrayBuffer.isView(e)){throw new Error(t)}}}else{throw new Error(t)}n=true}var i,o=0,a,s=e.length,f=this.blocks;while(o<s){if(this.hashed){this.hashed=false;f[0]=this.block;f[16]=f[1]=f[2]=f[3]=f[4]=f[5]=f[6]=f[7]=f[8]=f[9]=f[10]=f[11]=f[12]=f[13]=f[14]=f[15]=0}if(n){for(a=this.start;o<s&&a<64;++o){f[a>>2]|=e[o]<<l[a++&3]}}else{for(a=this.start;o<s&&a<64;++o){i=e.charCodeAt(o);if(i<128){f[a>>2]|=i<<l[a++&3]}else if(i<2048){f[a>>2]|=(192|i>>6)<<l[a++&3];f[a>>2]|=(128|i&63)<<l[a++&3]}else if(i<55296||i>=57344){f[a>>2]|=(224|i>>12)<<l[a++&3];f[a>>2]|=(128|i>>6&63)<<l[a++&3];f[a>>2]|=(128|i&63)<<l[a++&3]}else{i=65536+((i&1023)<<10|e.charCodeAt(++o)&1023);f[a>>2]|=(240|i>>18)<<l[a++&3];f[a>>2]|=(128|i>>12&63)<<l[a++&3];f[a>>2]|=(128|i>>6&63)<<l[a++&3];f[a>>2]|=(128|i&63)<<l[a++&3]}}}this.lastByteIndex=a;this.bytes+=a-this.start;if(a>=64){this.block=f[16];this.start=a-64;this.hash();this.hashed=true}else{this.start=a}}if(this.bytes>4294967295){this.hBytes+=this.bytes/4294967296<<0;this.bytes=this.bytes%4294967296}return this};m.prototype.finalize=function(){if(this.finalized){return}this.finalized=true;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block;e[t>>2]|=u[t&3];this.block=e[16];if(t>=56){if(!this.hashed){this.hash()}e[0]=this.block;e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0}e[14]=this.hBytes<<3|this.bytes>>>29;e[15]=this.bytes<<3;this.hash()};m.prototype.hash=function(){var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,o=this.h5,a=this.h6,s=this.h7,c=this.blocks,f,u,l,h,p,v,w,g,b,k,m;for(f=16;f<64;++f){p=c[f-15];u=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;p=c[f-2];l=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;c[f]=c[f-16]+u+c[f-7]+l<<0}m=t&n;for(f=0;f<64;f+=4){if(this.first){if(this.is224){g=300032;p=c[0]-1413257819;s=p-150054599<<0;r=p+24177077<<0}else{g=704751109;p=c[0]-210244248;s=p-1521486534<<0;r=p+143694565<<0}this.first=false}else{u=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10);l=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7);g=e&t;h=g^e&n^m;w=i&o^~i&a;p=s+l+w+d[f]+c[f];v=u+h;s=r+p<<0;r=p+v<<0}u=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10);l=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7);b=r&e;h=b^r&t^g;w=s&i^~s&o;p=a+l+w+d[f+1]+c[f+1];v=u+h;a=n+p<<0;n=p+v<<0;u=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10);l=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7);k=n&r;h=k^n&e^b;w=a&s^~a&i;p=o+l+w+d[f+2]+c[f+2];v=u+h;o=t+p<<0;t=p+v<<0;u=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10);l=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7);m=t&n;h=m^t&r^k;w=o&a^~o&s;p=i+l+w+d[f+3]+c[f+3];v=u+h;i=e+p<<0;e=p+v<<0;this.chromeBugWorkAround=true}this.h0=this.h0+e<<0;this.h1=this.h1+t<<0;this.h2=this.h2+n<<0;this.h3=this.h3+r<<0;this.h4=this.h4+i<<0;this.h5=this.h5+o<<0;this.h6=this.h6+a<<0;this.h7=this.h7+s<<0};m.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,o=this.h5,a=this.h6,s=this.h7;var c=f[e>>28&15]+f[e>>24&15]+f[e>>20&15]+f[e>>16&15]+f[e>>12&15]+f[e>>8&15]+f[e>>4&15]+f[e&15]+f[t>>28&15]+f[t>>24&15]+f[t>>20&15]+f[t>>16&15]+f[t>>12&15]+f[t>>8&15]+f[t>>4&15]+f[t&15]+f[n>>28&15]+f[n>>24&15]+f[n>>20&15]+f[n>>16&15]+f[n>>12&15]+f[n>>8&15]+f[n>>4&15]+f[n&15]+f[r>>28&15]+f[r>>24&15]+f[r>>20&15]+f[r>>16&15]+f[r>>12&15]+f[r>>8&15]+f[r>>4&15]+f[r&15]+f[i>>28&15]+f[i>>24&15]+f[i>>20&15]+f[i>>16&15]+f[i>>12&15]+f[i>>8&15]+f[i>>4&15]+f[i&15]+f[o>>28&15]+f[o>>24&15]+f[o>>20&15]+f[o>>16&15]+f[o>>12&15]+f[o>>8&15]+f[o>>4&15]+f[o&15]+f[a>>28&15]+f[a>>24&15]+f[a>>20&15]+f[a>>16&15]+f[a>>12&15]+f[a>>8&15]+f[a>>4&15]+f[a&15];if(!this.is224){c+=f[s>>28&15]+f[s>>24&15]+f[s>>20&15]+f[s>>16&15]+f[s>>12&15]+f[s>>8&15]+f[s>>4&15]+f[s&15]}return c};m.prototype.toString=m.prototype.hex;m.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,o=this.h5,a=this.h6,s=this.h7;var c=[e>>24&255,e>>16&255,e>>8&255,e&255,t>>24&255,t>>16&255,t>>8&255,t&255,n>>24&255,n>>16&255,n>>8&255,n&255,r>>24&255,r>>16&255,r>>8&255,r&255,i>>24&255,i>>16&255,i>>8&255,i&255,o>>24&255,o>>16&255,o>>8&255,o&255,a>>24&255,a>>16&255,a>>8&255,a&255];if(!this.is224){c.push(s>>24&255,s>>16&255,s>>8&255,s&255)}return c};m.prototype.array=m.prototype.digest;m.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32);var t=new DataView(e);t.setUint32(0,this.h0);t.setUint32(4,this.h1);t.setUint32(8,this.h2);t.setUint32(12,this.h3);t.setUint32(16,this.h4);t.setUint32(20,this.h5);t.setUint32(24,this.h6);if(!this.is224){t.setUint32(28,this.h7)}return e};function y(e,n,r){var i,o=typeof e;if(o==="string"){var a=[],s=e.length,f=0,u;for(i=0;i<s;++i){u=e.charCodeAt(i);if(u<128){a[f++]=u}else if(u<2048){a[f++]=192|u>>6;a[f++]=128|u&63}else if(u<55296||u>=57344){a[f++]=224|u>>12;a[f++]=128|u>>6&63;a[f++]=128|u&63}else{u=65536+((u&1023)<<10|e.charCodeAt(++i)&1023);a[f++]=240|u>>18;a[f++]=128|u>>12&63;a[f++]=128|u>>6&63;a[f++]=128|u&63}}e=a}else{if(o==="object"){if(e===null){throw new Error(t)}else if(c&&e.constructor===ArrayBuffer){e=new Uint8Array(e)}else if(!Array.isArray(e)){if(!c||!ArrayBuffer.isView(e)){throw new Error(t)}}}else{throw new Error(t)}}if(e.length>64){e=new m(n,true).update(e).array()}var l=[],d=[];for(i=0;i<64;++i){var h=e[i]||0;l[i]=92^h;d[i]=54^h}m.call(this,n,r);this.update(d);this.oKeyPad=l;this.inner=true;this.sharedMemory=r}y.prototype=new m;y.prototype.finalize=function(){m.prototype.finalize.call(this);if(this.inner){this.inner=false;var e=this.array();m.call(this,this.is224,this.sharedMemory);this.update(this.oKeyPad);this.update(e);m.prototype.finalize.call(this)}};var A=w();A.sha256=A;A.sha224=w(true);A.sha256.hmac=k();A.sha224.hmac=k(true);if(s){e.exports=A}else{i.sha256=A.sha256;i.sha224=A.sha224}})()})(k);const A=k.exports;class C extends Error{}C.prototype.name="InvalidTokenError";function I(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();if(n.length<2){n="0"+n}return"%"+n})))}function O(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return I(t)}catch(e){return atob(t)}}function j(e,t){if(typeof e!=="string"){throw new C("Invalid token specified: must be a string")}t||(t={});const n=t.header===true?0:1;const r=e.split(".")[n];if(typeof r!=="string"){throw new C(`Invalid token specified: missing part #${n+1}`)}let i;try{i=O(r)}catch(e){throw new C(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new C(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}if(typeof Promise==="undefined"){throw Error("Keycloak requires an environment that supports Promises. Make sure that you include the appropriate polyfill.")}function R(e){if(!(this instanceof R)){throw new Error("The 'Keycloak' constructor must be invoked with 'new'.")}var t=this;var n;var r=[];var i;var a={enable:true,callbackList:[],interval:5};var s=document.getElementsByTagName("script");for(var c=0;c<s.length;c++){if((s[c].src.indexOf("keycloak.js")!==-1||s[c].src.indexOf("keycloak.min.js")!==-1)&&s[c].src.indexOf("version=")!==-1){t.iframeVersion=s[c].src.substring(s[c].src.indexOf("version=")+8).split("&")[0]}}var f=true;var u=P(console.info);var l=P(console.warn);t.init=function(e){if(t.didInitialize){throw new Error("A 'Keycloak' instance can only be initialized once.")}t.didInitialize=true;t.authenticated=false;i=z();var r=["default","cordova","cordova-native"];if(e&&r.indexOf(e.adapter)>-1){n=T(e.adapter)}else if(e&&typeof e.adapter==="object"){n=e.adapter}else{if(window.Cordova||window.cordova){n=T("cordova")}else{n=T()}}if(e){if(typeof e.useNonce!=="undefined"){f=e.useNonce}if(typeof e.checkLoginIframe!=="undefined"){a.enable=e.checkLoginIframe}if(e.checkLoginIframeInterval){a.interval=e.checkLoginIframeInterval}if(e.onLoad==="login-required"){t.loginRequired=true}if(e.responseMode){if(e.responseMode==="query"||e.responseMode==="fragment"){t.responseMode=e.responseMode}else{throw"Invalid value for responseMode"}}if(e.flow){switch(e.flow){case"standard":t.responseType="code";break;case"implicit":t.responseType="id_token token";break;case"hybrid":t.responseType="code id_token token";break;default:throw"Invalid value for flow"}t.flow=e.flow}if(e.timeSkew!=null){t.timeSkew=e.timeSkew}if(e.redirectUri){t.redirectUri=e.redirectUri}if(e.silentCheckSsoRedirectUri){t.silentCheckSsoRedirectUri=e.silentCheckSsoRedirectUri}if(typeof e.silentCheckSsoFallback==="boolean"){t.silentCheckSsoFallback=e.silentCheckSsoFallback}else{t.silentCheckSsoFallback=true}if(e.pkceMethod){if(e.pkceMethod!=="S256"){throw"Invalid value for pkceMethod"}t.pkceMethod=e.pkceMethod}if(typeof e.enableLogging==="boolean"){t.enableLogging=e.enableLogging}else{t.enableLogging=false}if(typeof e.scope==="string"){t.scope=e.scope}if(typeof e.acrValues==="string"){t.acrValues=e.acrValues}if(typeof e.messageReceiveTimeout==="number"&&e.messageReceiveTimeout>0){t.messageReceiveTimeout=e.messageReceiveTimeout}else{t.messageReceiveTimeout=1e4}}if(!t.responseMode){t.responseMode="fragment"}if(!t.responseType){t.responseType="code";t.flow="standard"}var o=S();var s=S();s.promise.then((function(){t.onReady&&t.onReady(t.authenticated);o.setSuccess(t.authenticated)})).catch((function(e){o.setError(e)}));var c=m();function u(){var n=function(n){if(!n){i.prompt="none"}if(e&&e.locale){i.locale=e.locale}t.login(i).then((function(){s.setSuccess()})).catch((function(e){s.setError(e)}))};var r=function(){var e=document.createElement("iframe");var n=t.createLoginUrl({prompt:"none",redirectUri:t.silentCheckSsoRedirectUri});e.setAttribute("src",n);e.setAttribute("sandbox","allow-storage-access-by-user-activation allow-scripts allow-same-origin");e.setAttribute("title","keycloak-silent-check-sso");e.style.display="none";document.body.appendChild(e);var r=function(t){if(t.origin!==window.location.origin||e.contentWindow!==t.source){return}var n=I(t.data);k(n,s);document.body.removeChild(e);window.removeEventListener("message",r)};window.addEventListener("message",r)};var i={};switch(e.onLoad){case"check-sso":if(a.enable){U().then((function(){E().then((function(e){if(!e){t.silentCheckSsoRedirectUri?r():n(false)}else{s.setSuccess()}})).catch((function(e){s.setError(e)}))}))}else{t.silentCheckSsoRedirectUri?r():n(false)}break;case"login-required":n(true);break;default:throw"Invalid value for onLoad"}}function l(){var n=I(window.location.href);if(n){window.history.replaceState(window.history.state,null,n.newUrl)}if(n&&n.valid){return U().then((function(){k(n,s)})).catch((function(e){s.setError(e)}))}else if(e){if(e.token&&e.refreshToken){x(e.token,e.refreshToken,e.idToken);if(a.enable){U().then((function(){E().then((function(e){if(e){t.onAuthSuccess&&t.onAuthSuccess();s.setSuccess();N()}else{s.setSuccess()}})).catch((function(e){s.setError(e)}))}))}else{t.updateToken(-1).then((function(){t.onAuthSuccess&&t.onAuthSuccess();s.setSuccess()})).catch((function(n){t.onAuthError&&t.onAuthError();if(e.onLoad){u()}else{s.setError(n)}}))}}else if(e.onLoad){u()}else{s.setSuccess()}}else{s.setSuccess()}}function d(){var e=S();var t=function(){if(document.readyState==="interactive"||document.readyState==="complete"){document.removeEventListener("readystatechange",t);e.setSuccess()}};document.addEventListener("readystatechange",t);t();return e.promise}c.then((function(){d().then(M).then(l).catch((function(e){o.setError(e)}))}));c.catch((function(e){o.setError(e)}));return o.promise};t.login=function(e){return n.login(e)};function d(e){var t=null;var n=window.crypto||window.msCrypto;if(n&&n.getRandomValues&&window.Uint8Array){t=new Uint8Array(e);n.getRandomValues(t);return t}t=new Array(e);for(var r=0;r<t.length;r++){t[r]=Math.floor(256*Math.random())}return t}function h(e){return p(e,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")}function p(e,t){var n=d(e);var r=new Array(e);for(var i=0;i<e;i++){r[i]=t.charCodeAt(n[i]%t.length)}return String.fromCharCode.apply(null,r)}function v(e,t){switch(e){case"S256":var n=new Uint8Array(A.arrayBuffer(t));var r=o.fromByteArray(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"");return r;default:throw"Invalid value for pkceMethod"}}function w(e){var t={id_token:{acr:e}};return JSON.stringify(t)}t.createLoginUrl=function(e){var r=C();var o=C();var a=n.redirectUri(e);var s={state:r,nonce:o,redirectUri:encodeURIComponent(a)};if(e&&e.prompt){s.prompt=e.prompt}var c;if(e&&e.action=="register"){c=t.endpoints.register()}else{c=t.endpoints.authorize()}var u=e&&e.scope||t.scope;if(!u){u="openid"}else if(u.indexOf("openid")===-1){u="openid "+u}var l=c+"?client_id="+encodeURIComponent(t.clientId)+"&redirect_uri="+encodeURIComponent(a)+"&state="+encodeURIComponent(r)+"&response_mode="+encodeURIComponent(t.responseMode)+"&response_type="+encodeURIComponent(t.responseType)+"&scope="+encodeURIComponent(u);if(f){l=l+"&nonce="+encodeURIComponent(o)}if(e&&e.prompt){l+="&prompt="+encodeURIComponent(e.prompt)}if(e&&e.maxAge){l+="&max_age="+encodeURIComponent(e.maxAge)}if(e&&e.loginHint){l+="&login_hint="+encodeURIComponent(e.loginHint)}if(e&&e.idpHint){l+="&kc_idp_hint="+encodeURIComponent(e.idpHint)}if(e&&e.action&&e.action!="register"){l+="&kc_action="+encodeURIComponent(e.action)}if(e&&e.locale){l+="&ui_locales="+encodeURIComponent(e.locale)}if(e&&e.acr){var d=w(e.acr);l+="&claims="+encodeURIComponent(d)}if(e&&e.acrValues||t.acrValues){l+="&acr_values="+encodeURIComponent(e.acrValues||t.acrValues)}if(t.pkceMethod){var p=h(96);s.pkceCodeVerifier=p;var g=v(t.pkceMethod,p);l+="&code_challenge="+g;l+="&code_challenge_method="+t.pkceMethod}i.add(s);return l};t.logout=function(e){return n.logout(e)};t.createLogoutUrl=function(e){var r=t.endpoints.logout()+"?client_id="+encodeURIComponent(t.clientId)+"&post_logout_redirect_uri="+encodeURIComponent(n.redirectUri(e,false));if(t.idToken){r+="&id_token_hint="+encodeURIComponent(t.idToken)}return r};t.register=function(e){return n.register(e)};t.createRegisterUrl=function(e){if(!e){e={}}e.action="register";return t.createLoginUrl(e)};t.createAccountUrl=function(e){var r=g();var i=undefined;if(typeof r!=="undefined"){i=r+"/account"+"?referrer="+encodeURIComponent(t.clientId)+"&referrer_uri="+encodeURIComponent(n.redirectUri(e))}return i};t.accountManagement=function(){return n.accountManagement()};t.hasRealmRole=function(e){var n=t.realmAccess;return!!n&&n.roles.indexOf(e)>=0};t.hasResourceRole=function(e,n){if(!t.resourceAccess){return false}var r=t.resourceAccess[n||t.clientId];return!!r&&r.roles.indexOf(e)>=0};t.loadUserProfile=function(){var e=g()+"/account";var n=new XMLHttpRequest;n.open("GET",e,true);n.setRequestHeader("Accept","application/json");n.setRequestHeader("Authorization","bearer "+t.token);var r=S();n.onreadystatechange=function(){if(n.readyState==4){if(n.status==200){t.profile=JSON.parse(n.responseText);r.setSuccess(t.profile)}else{r.setError()}}};n.send();return r.promise};t.loadUserInfo=function(){var e=t.endpoints.userinfo();var n=new XMLHttpRequest;n.open("GET",e,true);n.setRequestHeader("Accept","application/json");n.setRequestHeader("Authorization","bearer "+t.token);var r=S();n.onreadystatechange=function(){if(n.readyState==4){if(n.status==200){t.userInfo=JSON.parse(n.responseText);r.setSuccess(t.userInfo)}else{r.setError()}}};n.send();return r.promise};t.isTokenExpired=function(e){if(!t.tokenParsed||!t.refreshToken&&t.flow!="implicit"){throw"Not authenticated"}if(t.timeSkew==null){u("[KEYCLOAK] Unable to determine if token is expired as timeskew is not set");return true}var n=t.tokenParsed["exp"]-Math.ceil((new Date).getTime()/1e3)+t.timeSkew;if(e){if(isNaN(e)){throw"Invalid minValidity"}n-=e}return n<0};t.updateToken=function(e){var n=S();if(!t.refreshToken){n.setError();return n.promise}e=e||5;var i=function(){var i=false;if(e==-1){i=true;u("[KEYCLOAK] Refreshing token: forced refresh")}else if(!t.tokenParsed||t.isTokenExpired(e)){i=true;u("[KEYCLOAK] Refreshing token: token expired")}if(!i){n.setSuccess(false)}else{var o="grant_type=refresh_token&"+"refresh_token="+t.refreshToken;var a=t.endpoints.token();r.push(n);if(r.length==1){var s=new XMLHttpRequest;s.open("POST",a,true);s.setRequestHeader("Content-type","application/x-www-form-urlencoded");s.withCredentials=true;o+="&client_id="+encodeURIComponent(t.clientId);var c=(new Date).getTime();s.onreadystatechange=function(){if(s.readyState==4){if(s.status==200){u("[KEYCLOAK] Token refreshed");c=(c+(new Date).getTime())/2;var e=JSON.parse(s.responseText);x(e["access_token"],e["refresh_token"],e["id_token"],c);t.onAuthRefreshSuccess&&t.onAuthRefreshSuccess();for(var n=r.pop();n!=null;n=r.pop()){n.setSuccess(true)}}else{l("[KEYCLOAK] Failed to refresh token");if(s.status==400){t.clearToken()}t.onAuthRefreshError&&t.onAuthRefreshError();for(var n=r.pop();n!=null;n=r.pop()){n.setError(true)}}}};s.send(o)}}};if(a.enable){var o=E();o.then((function(){i()})).catch((function(e){n.setError(e)}))}else{i()}return n.promise};t.clearToken=function(){if(t.token){x(null,null,null);t.onAuthLogout&&t.onAuthLogout();if(t.loginRequired){t.login()}}};function g(){if(typeof t.authServerUrl!=="undefined"){if(t.authServerUrl.charAt(t.authServerUrl.length-1)=="/"){return t.authServerUrl+"realms/"+encodeURIComponent(t.realm)}else{return t.authServerUrl+"/realms/"+encodeURIComponent(t.realm)}}else{return undefined}}function b(){if(!window.location.origin){return window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}else{return window.location.origin}}function k(e,n){var r=e.code;var i=e.error;var o=e.prompt;var a=(new Date).getTime();if(e["kc_action_status"]){t.onActionUpdate&&t.onActionUpdate(e["kc_action_status"])}if(i){if(o!="none"){var s={error:i,error_description:e.error_description};t.onAuthError&&t.onAuthError(s);n&&n.setError(s)}else{n&&n.setSuccess()}return}else if(t.flow!="standard"&&(e.access_token||e.id_token)){h(e.access_token,null,e.id_token,true)}if(t.flow!="implicit"&&r){var c="code="+r+"&grant_type=authorization_code";var l=t.endpoints.token();var d=new XMLHttpRequest;d.open("POST",l,true);d.setRequestHeader("Content-type","application/x-www-form-urlencoded");c+="&client_id="+encodeURIComponent(t.clientId);c+="&redirect_uri="+e.redirectUri;if(e.pkceCodeVerifier){c+="&code_verifier="+e.pkceCodeVerifier}d.withCredentials=true;d.onreadystatechange=function(){if(d.readyState==4){if(d.status==200){var e=JSON.parse(d.responseText);h(e["access_token"],e["refresh_token"],e["id_token"],t.flow==="standard");N()}else{t.onAuthError&&t.onAuthError();n&&n.setError()}}};d.send(c)}function h(r,i,o,s){a=(a+(new Date).getTime())/2;x(r,i,o,a);if(f&&(t.tokenParsed&&t.tokenParsed.nonce!=e.storedNonce||t.refreshTokenParsed&&t.refreshTokenParsed.nonce!=e.storedNonce||t.idTokenParsed&&t.idTokenParsed.nonce!=e.storedNonce)){u("[KEYCLOAK] Invalid nonce, clearing token");t.clearToken();n&&n.setError()}else{if(s){t.onAuthSuccess&&t.onAuthSuccess();n&&n.setSuccess()}}}}function m(n){var r=S();var i;if(!e){i="keycloak.json"}else if(typeof e==="string"){i=e}function o(e){if(!e){t.endpoints={authorize:function(){return g()+"/protocol/openid-connect/auth"},token:function(){return g()+"/protocol/openid-connect/token"},logout:function(){return g()+"/protocol/openid-connect/logout"},checkSessionIframe:function(){var e=g()+"/protocol/openid-connect/login-status-iframe.html";if(t.iframeVersion){e=e+"?version="+t.iframeVersion}return e},thirdPartyCookiesIframe:function(){var e=g()+"/protocol/openid-connect/3p-cookies/step1.html";if(t.iframeVersion){e=e+"?version="+t.iframeVersion}return e},register:function(){return g()+"/protocol/openid-connect/registrations"},userinfo:function(){return g()+"/protocol/openid-connect/userinfo"}}}else{t.endpoints={authorize:function(){return e.authorization_endpoint},token:function(){return e.token_endpoint},logout:function(){if(!e.end_session_endpoint){throw"Not supported by the OIDC server"}return e.end_session_endpoint},checkSessionIframe:function(){if(!e.check_session_iframe){throw"Not supported by the OIDC server"}return e.check_session_iframe},register:function(){throw'Redirection to "Register user" page not supported in standard OIDC mode'},userinfo:function(){if(!e.userinfo_endpoint){throw"Not supported by the OIDC server"}return e.userinfo_endpoint}}}}if(i){var a=new XMLHttpRequest;a.open("GET",i,true);a.setRequestHeader("Accept","application/json");a.onreadystatechange=function(){if(a.readyState==4){if(a.status==200||y(a)){var e=JSON.parse(a.responseText);t.authServerUrl=e["auth-server-url"];t.realm=e["realm"];t.clientId=e["resource"];o(null);r.setSuccess()}else{r.setError()}}};a.send()}else{if(!e.clientId){throw"clientId missing"}t.clientId=e.clientId;var s=e["oidcProvider"];if(!s){if(!e["url"]){var c=document.getElementsByTagName("script");for(var f=0;f<c.length;f++){if(c[f].src.match(/.*keycloak\.js/)){e.url=c[f].src.substr(0,c[f].src.indexOf("/js/keycloak.js"));break}}}if(!e.realm){throw"realm missing"}t.authServerUrl=e.url;t.realm=e.realm;o(null);r.setSuccess()}else{if(typeof s==="string"){var u;if(s.charAt(s.length-1)=="/"){u=s+".well-known/openid-configuration"}else{u=s+"/.well-known/openid-configuration"}var a=new XMLHttpRequest;a.open("GET",u,true);a.setRequestHeader("Accept","application/json");a.onreadystatechange=function(){if(a.readyState==4){if(a.status==200||y(a)){var e=JSON.parse(a.responseText);o(e);r.setSuccess()}else{r.setError()}}};a.send()}else{o(s);r.setSuccess()}}}return r.promise}function y(e){return e.status==0&&e.responseText&&e.responseURL.startsWith("file:")}function x(e,n,r,i){if(t.tokenTimeoutHandle){clearTimeout(t.tokenTimeoutHandle);t.tokenTimeoutHandle=null}if(n){t.refreshToken=n;t.refreshTokenParsed=j(n)}else{delete t.refreshToken;delete t.refreshTokenParsed}if(r){t.idToken=r;t.idTokenParsed=j(r)}else{delete t.idToken;delete t.idTokenParsed}if(e){t.token=e;t.tokenParsed=j(e);t.sessionId=t.tokenParsed.session_state;t.authenticated=true;t.subject=t.tokenParsed.sub;t.realmAccess=t.tokenParsed.realm_access;t.resourceAccess=t.tokenParsed.resource_access;if(i){t.timeSkew=Math.floor(i/1e3)-t.tokenParsed.iat}if(t.timeSkew!=null){u("[KEYCLOAK] Estimated time difference between browser and server is "+t.timeSkew+" seconds");if(t.onTokenExpired){var o=(t.tokenParsed["exp"]-(new Date).getTime()/1e3+t.timeSkew)*1e3;u("[KEYCLOAK] Token expires in "+Math.round(o/1e3)+" s");if(o<=0){t.onTokenExpired()}else{t.tokenTimeoutHandle=setTimeout(t.onTokenExpired,o)}}}}else{delete t.token;delete t.tokenParsed;delete t.subject;delete t.realmAccess;delete t.resourceAccess;t.authenticated=false}}function C(){var e="0123456789abcdef";var t=p(36,e).split("");t[14]="4";t[19]=e.substr(t[19]&3|8,1);t[8]=t[13]=t[18]=t[23]="-";var n=t.join("");return n}function I(e){var t=O(e);if(!t){return}var n=i.get(t.state);if(n){t.valid=true;t.redirectUri=n.redirectUri;t.storedNonce=n.nonce;t.prompt=n.prompt;t.pkceCodeVerifier=n.pkceCodeVerifier}return t}function O(e){var n;switch(t.flow){case"standard":n=["code","state","session_state","kc_action_status","iss"];break;case"implicit":n=["access_token","token_type","id_token","state","session_state","expires_in","kc_action_status","iss"];break;case"hybrid":n=["access_token","token_type","id_token","code","state","session_state","expires_in","kc_action_status","iss"];break}n.push("error");n.push("error_description");n.push("error_uri");var r=e.indexOf("?");var i=e.indexOf("#");var o;var a;if(t.responseMode==="query"&&r!==-1){o=e.substring(0,r);a=_(e.substring(r+1,i!==-1?i:e.length),n);if(a.paramsString!==""){o+="?"+a.paramsString}if(i!==-1){o+=e.substring(i)}}else if(t.responseMode==="fragment"&&i!==-1){o=e.substring(0,i);a=_(e.substring(i+1),n);if(a.paramsString!==""){o+="#"+a.paramsString}}if(a&&a.oauthParams){if(t.flow==="standard"||t.flow==="hybrid"){if((a.oauthParams.code||a.oauthParams.error)&&a.oauthParams.state){a.oauthParams.newUrl=o;return a.oauthParams}}else if(t.flow==="implicit"){if((a.oauthParams.access_token||a.oauthParams.error)&&a.oauthParams.state){a.oauthParams.newUrl=o;return a.oauthParams}}}}function _(e,t){var n=e.split("&");var r={paramsString:"",oauthParams:{}};for(var i=0;i<n.length;i++){var o=n[i].indexOf("=");var a=n[i].slice(0,o);if(t.indexOf(a)!==-1){r.oauthParams[a]=n[i].slice(o+1)}else{if(r.paramsString!==""){r.paramsString+="&"}r.paramsString+=n[i]}}return r}function S(){var e={setSuccess:function(t){e.resolve(t)},setError:function(t){e.reject(t)}};e.promise=new Promise((function(t,n){e.resolve=t;e.reject=n}));return e}function L(e,t,n){var r=null;var i=new Promise((function(e,i){r=setTimeout((function(){i({error:n||"Promise is not settled within timeout of "+t+"ms"})}),t)}));return Promise.race([e,i]).finally((function(){clearTimeout(r)}))}function U(){var e=S();if(!a.enable){e.setSuccess();return e.promise}if(a.iframe){e.setSuccess();return e.promise}var n=document.createElement("iframe");a.iframe=n;n.onload=function(){var n=t.endpoints.authorize();if(n.charAt(0)==="/"){a.iframeOrigin=b()}else{a.iframeOrigin=n.substring(0,n.indexOf("/",8))}e.setSuccess()};var r=t.endpoints.checkSessionIframe();n.setAttribute("src",r);n.setAttribute("sandbox","allow-storage-access-by-user-activation allow-scripts allow-same-origin");n.setAttribute("title","keycloak-session-iframe");n.style.display="none";document.body.appendChild(n);var i=function(e){if(e.origin!==a.iframeOrigin||a.iframe.contentWindow!==e.source){return}if(!(e.data=="unchanged"||e.data=="changed"||e.data=="error")){return}if(e.data!="unchanged"){t.clearToken()}var n=a.callbackList.splice(0,a.callbackList.length);for(var r=n.length-1;r>=0;--r){var i=n[r];if(e.data=="error"){i.setError()}else{i.setSuccess(e.data=="unchanged")}}};window.addEventListener("message",i,false);return e.promise}function N(){if(a.enable){if(t.token){setTimeout((function(){E().then((function(e){if(e){N()}}))}),a.interval*1e3)}}}function E(){var e=S();if(a.iframe&&a.iframeOrigin){var n=t.clientId+" "+(t.sessionId?t.sessionId:"");a.callbackList.push(e);var r=a.iframeOrigin;if(a.callbackList.length==1){a.iframe.contentWindow.postMessage(n,r)}}else{e.setSuccess()}return e.promise}function M(){var e=S();if(a.enable||t.silentCheckSsoRedirectUri){var n=document.createElement("iframe");n.setAttribute("src",t.endpoints.thirdPartyCookiesIframe());n.setAttribute("sandbox","allow-storage-access-by-user-activation allow-scripts allow-same-origin");n.setAttribute("title","keycloak-3p-check-iframe");n.style.display="none";document.body.appendChild(n);var r=function(i){if(n.contentWindow!==i.source){return}if(i.data!=="supported"&&i.data!=="unsupported"){return}else if(i.data==="unsupported"){l("[KEYCLOAK] Your browser is blocking access to 3rd-party cookies, this means:\n\n"+" - It is not possible to retrieve tokens without redirecting to the Keycloak server (a.k.a. no support for silent authentication).\n"+" - It is not possible to automatically detect changes to the session status (such as the user logging out in another tab).\n\n"+"For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_modern_browsers");a.enable=false;if(t.silentCheckSsoFallback){t.silentCheckSsoRedirectUri=false}}document.body.removeChild(n);window.removeEventListener("message",r);e.setSuccess()};window.addEventListener("message",r,false)}else{e.setSuccess()}return L(e.promise,t.messageReceiveTimeout,"Timeout when waiting for 3rd party check iframe message.")}function T(e){if(!e||e=="default"){return{login:function(e){window.location.assign(t.createLoginUrl(e));return S().promise},logout:function(e){window.location.replace(t.createLogoutUrl(e));return S().promise},register:function(e){window.location.assign(t.createRegisterUrl(e));return S().promise},accountManagement:function(){var e=t.createAccountUrl();if(typeof e!=="undefined"){window.location.href=e}else{throw"Not supported by the OIDC server"}return S().promise},redirectUri:function(e,n){if(e&&e.redirectUri){return e.redirectUri}else if(t.redirectUri){return t.redirectUri}else{return location.href}}}}if(e=="cordova"){a.enable=false;var n=function(e,t,n){if(window.cordova&&window.cordova.InAppBrowser){return window.cordova.InAppBrowser.open(e,t,n)}else{return window.open(e,t,n)}};var r=function(e){if(e&&e.cordovaOptions){return Object.keys(e.cordovaOptions).reduce((function(t,n){t[n]=e.cordovaOptions[n];return t}),{})}else{return{}}};var i=function(e){return Object.keys(e).reduce((function(t,n){t.push(n+"="+e[n]);return t}),[]).join(",")};var o=function(e){var t=r(e);t.location="no";if(e&&e.prompt=="none"){t.hidden="yes"}return i(t)};var s=function(){return t.redirectUri||"http://localhost"};return{login:function(e){var r=S();var i=o(e);var a=t.createLoginUrl(e);var c=n(a,"_blank",i);var f=false;var u=false;var l=function(){u=true;c.close()};c.addEventListener("loadstart",(function(e){if(e.url.indexOf(s())==0){var t=I(e.url);k(t,r);l();f=true}}));c.addEventListener("loaderror",(function(e){if(!f){if(e.url.indexOf(s())==0){var t=I(e.url);k(t,r);l();f=true}else{r.setError();l()}}}));c.addEventListener("exit",(function(e){if(!u){r.setError({reason:"closed_by_user"})}}));return r.promise},logout:function(e){var r=S();var i=t.createLogoutUrl(e);var o=n(i,"_blank","location=no,hidden=yes,clearcache=yes");var a;o.addEventListener("loadstart",(function(e){if(e.url.indexOf(s())==0){o.close()}}));o.addEventListener("loaderror",(function(e){if(e.url.indexOf(s())==0){o.close()}else{a=true;o.close()}}));o.addEventListener("exit",(function(e){if(a){r.setError()}else{t.clearToken();r.setSuccess()}}));return r.promise},register:function(e){var r=S();var i=t.createRegisterUrl();var a=o(e);var c=n(i,"_blank",a);c.addEventListener("loadstart",(function(e){if(e.url.indexOf(s())==0){c.close();var t=I(e.url);k(t,r)}}));return r.promise},accountManagement:function(){var e=t.createAccountUrl();if(typeof e!=="undefined"){var r=n(e,"_blank","location=no");r.addEventListener("loadstart",(function(e){if(e.url.indexOf(s())==0){r.close()}}))}else{throw"Not supported by the OIDC server"}},redirectUri:function(e){return s()}}}if(e=="cordova-native"){a.enable=false;return{login:function(e){var n=S();var r=t.createLoginUrl(e);universalLinks.subscribe("keycloak",(function(e){universalLinks.unsubscribe("keycloak");window.cordova.plugins.browsertab.close();var t=I(e.url);k(t,n)}));window.cordova.plugins.browsertab.openUrl(r);return n.promise},logout:function(e){var n=S();var r=t.createLogoutUrl(e);universalLinks.subscribe("keycloak",(function(e){universalLinks.unsubscribe("keycloak");window.cordova.plugins.browsertab.close();t.clearToken();n.setSuccess()}));window.cordova.plugins.browsertab.openUrl(r);return n.promise},register:function(e){var n=S();var r=t.createRegisterUrl(e);universalLinks.subscribe("keycloak",(function(e){universalLinks.unsubscribe("keycloak");window.cordova.plugins.browsertab.close();var t=I(e.url);k(t,n)}));window.cordova.plugins.browsertab.openUrl(r);return n.promise},accountManagement:function(){var e=t.createAccountUrl();if(typeof e!=="undefined"){window.cordova.plugins.browsertab.openUrl(e)}else{throw"Not supported by the OIDC server"}},redirectUri:function(e){if(e&&e.redirectUri){return e.redirectUri}else if(t.redirectUri){return t.redirectUri}else{return"http://localhost"}}}}throw"invalid adapter type: "+e}var K=function(){if(!(this instanceof K)){return new K}localStorage.setItem("kc-test","test");localStorage.removeItem("kc-test");var e=this;function t(){var e=(new Date).getTime();for(var t=0;t<localStorage.length;t++){var n=localStorage.key(t);if(n&&n.indexOf("kc-callback-")==0){var r=localStorage.getItem(n);if(r){try{var i=JSON.parse(r).expires;if(!i||i<e){localStorage.removeItem(n)}}catch(e){localStorage.removeItem(n)}}}}}e.get=function(e){if(!e){return}var n="kc-callback-"+e;var r=localStorage.getItem(n);if(r){localStorage.removeItem(n);r=JSON.parse(r)}t();return r};e.add=function(e){t();var n="kc-callback-"+e.state;e.expires=(new Date).getTime()+60*60*1e3;localStorage.setItem(n,JSON.stringify(e))}};var Y=function(){if(!(this instanceof Y)){return new Y}var e=this;e.get=function(e){if(!e){return}var i=n("kc-callback-"+e);r("kc-callback-"+e,"",t(-100));if(i){return JSON.parse(i)}};e.add=function(e){r("kc-callback-"+e.state,JSON.stringify(e),t(60))};e.removeItem=function(e){r(e,"",t(-100))};var t=function(e){var t=new Date;t.setTime(t.getTime()+e*60*1e3);return t};var n=function(e){var t=e+"=";var n=document.cookie.split(";");for(var r=0;r<n.length;r++){var i=n[r];while(i.charAt(0)==" "){i=i.substring(1)}if(i.indexOf(t)==0){return i.substring(t.length,i.length)}}return""};var r=function(e,t,n){var r=e+"="+t+"; "+"expires="+n.toUTCString()+"; ";document.cookie=r}};function z(){try{return new K}catch(e){}return new Y}function P(e){return function(){if(t.enableLogging){e.apply(console,Array.prototype.slice.call(arguments))}}}}const _='.button{display:flex;height:50px;padding:0;background:#3e7671;border:none;outline:none;border-radius:5px;overflow:hidden;font-size:16px;font-weight:500;cursor:pointer;min-width:220px;max-width:220px}.button:hover{background:#008168}.button:active{background:#3e7671}.button-text{display:block;margin:auto;padding:0 24px;color:#fff;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:80px}.button-icon{margin:auto;padding:10px}.button-profile{display:inline-flex;align-items:center;color:#fff}.button-profile img{height:50px}.button-text-full-width{width:auto!important}.button-link{text-decoration:none!important}.gg-menu-grid-r{color:#fff;box-sizing:border-box;position:relative;display:block;transform:scale(var(--ggs,1));width:16px;height:16px}.gg-menu-grid-r::before{content:"";display:block;box-sizing:border-box;position:absolute;width:4px;height:4px;background:currentColor;box-shadow:0 6px 0,\n 6px 6px 0,\n 12px 6px 0,\n 6px 12px 0,\n 12px 12px 0,\n 6px 0 0,\n 12px 0 0,\n 0 12px 0}.dropdown{position:relative;display:inline-block}.dropdown-content{display:none;position:absolute;right:0;background-color:#f9f9f9;min-width:180px;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);z-index:1;border-radius:5px}.dropdown-content a{color:#71797E;padding:16px 20px;text-decoration:none;display:block;cursor:pointer}.dropdown-content a:hover{background-color:#f1f1f1;color:#000;opacity:0.7}.dropdown:hover .dropdown-content{display:block}.modal{display:none;position:fixed;z-index:1;padding-top:100px;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgb(0,0,0);background-color:rgba(0,0,0,0.4);text-align:center}.modal-content{background-color:#fefefe;margin:auto;padding:20px;border:1px solid #888;width:40%}.modal-body{max-height:50vh;overflow-y:auto}.close{color:#aaaaaa;float:right;font-size:28px;font-weight:bold}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer}.modal-app{background-color:#c3e9bc;padding:15px;margin:10px;border-radius:5px}.external-app-link{text-decoration:none;color:#000}.gray-text{color:#606060}.green-text{color:#3e7671}#countdown{position:relative;margin:auto;margin-top:30px;height:40px;width:40px;text-align:center}#countdown-number{color:#2e2e2e;display:inline-block;line-height:40px}svg{position:absolute;top:0;right:0;width:40px;height:40px;transform:rotateY(-180deg) rotateZ(-90deg)}svg circle{stroke-dasharray:113px;stroke-dashoffset:0px;stroke-linecap:round;stroke-width:4px;stroke:#008168;fill:none;animation:countdown 6s linear infinite forwards}@keyframes countdown{from{stroke-dashoffset:0px}to{stroke-dashoffset:113px}}';const S=_;const L=class{constructor(t){e(this,t);this.showPostLoginText=false;this.silentCheckSso=false;this.redirectUri=undefined;this.authMethod="check-sso";this.keycloakUri="http://localhost:8080";this.realm="";this.clientId="";this.appId="";this.portalUrl="";this.marketplaceUrl="";this.showUnauthorizedModal=false;this.keycloak=new R({url:this.keycloakUri,realm:this.realm,clientId:this.clientId});this.isAuth=false;this.givenName="";this.silentCheckSsoRedirectUri=window.location.origin+"/assets/verificar-sso.html";this.appList=[]}componentWillLoad(){this.initKeycloak().then((()=>{if(this.isAuth){this.getAppList().then((e=>{this.appList=e;if(this.appId){const e=this.appId.replace(/'/g,"").split(",");const r=this.appList.map((e=>e["shortname"]));if(e.filter((e=>r.includes(e))).length==0){const e=this.el.shadowRoot.querySelector("#appPermissionErrorModal");e.style.display="block";if(this.portalUrl&&this.showUnauthorizedModal){var t=this.el.shadowRoot.getElementById("countdown-number");var n=6;t.textContent=n.toString();setInterval((()=>{n=--n<=0?6:n;t.textContent=n.toString();if(n==1){window.location.replace(this.portalUrl.toString())}}),1e3)}}}}))}}))}async initKeycloak(){await this.keycloak.init({onLoad:this.authMethod,checkLoginIframe:false,silentCheckSsoRedirectUri:this.silentCheckSso?this.silentCheckSsoRedirectUri:""}).then((e=>{if(e){this.isAuth=true;localStorage.setItem("keycloak",JSON.stringify(this.keycloak));document.cookie="ZDZW_cookie="+JSON.parse(localStorage.getItem("keycloak")).token;this.givenName=JSON.parse(localStorage.getItem("keycloak")).idTokenParsed.given_name}}))}async getAppList(){const e=await fetch(this.marketplaceUrl+"/api/v1/product/nameAndShortName");const t=await e.json();return t}login(){this.keycloak.login()}logout(){localStorage.removeItem("keycloak");document.cookie="ZDZW_cookie=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";this.keycloak.logout()}showModal(){const e=this.el.shadowRoot.querySelector("#appListModal");e.style.display="block"}closeModal(){const e=this.el.shadowRoot.querySelector("#appListModal");e.style.display="none"}render(){return t("div",{key:"518e0da154542073e372b6befd2a8e7e174af702"},t("div",{key:"97353368ee021f8a2343f12950287978ba4af8c9"},(()=>{if(this.isAuth&&this.showPostLoginText){return t("a",{href:this.redirectUri,id:"login-btn",class:"button button-link"},t("span",{class:"button-text button-text-full-width"},"Go to Dashboard"))}else if(this.isAuth){return t("div",{id:"profile-btn",class:"dropdown"},t("button",{type:"button",class:"button"},t("span",{class:"button-profile"},t("img",{src:"https://i.pravatar.cc/100?img=32",alt:""})),t("span",{id:"given-name",class:"button-text"},this.givenName),t("div",{class:"button-icon"},t("span",{class:"gg-menu-grid-r"}))),t("div",{class:"dropdown-content"},t("a",{onClick:this.showModal.bind(this),id:"applications-btn"},"Applications"),t("a",{onClick:this.logout.bind(this),id:"logout-btn"},"Logout")))}else{return t("button",{onClick:this.login.bind(this),id:"login-btn",type:"button",class:"button"},t("span",{class:"button-text"},"Login"))}})()),t("div",{key:"f0171bcfecf92c61280a7e5af8bac5a89b29c997",id:"appListModal",class:"modal"},t("div",{key:"29db22476317b8c76e09769eda047ada47a8ddee",class:"modal-content"},t("span",{key:"1632ec033b67f1fc059027739022b64077e5f651",onClick:this.closeModal.bind(this),class:"close"},"×"),t("h3",{key:"9d5e4048ac0ea51a4fef045c5546aec65822990e"},"Applications"),t("div",{key:"c983f0617428ec20581d6d69ad2df492a213f366",class:"modal-body"},this.appList.length>0?this.appList.map((e=>t("a",{class:"external-app-link",target:"_blank",href:"https://"+e.shortname+"-zdzw."+this.portalUrl.replace(/(^\w+:|^)\/\//,"")},t("div",{class:"modal-app"},t("div",null,e.name))))):t("div",null,t("h3",{class:"gray-text"},"Not installed application found.")," ",t("p",{class:"gray-text"},"Please contact administration."))))),t("div",{key:"fb01669525955798b4aaf2b9e88d35efe78693da",id:"appPermissionErrorModal",class:"modal"},t("div",{key:"6e06bc1824b0a1641795f69d30f6c68dad1930a6",class:"modal-content"},t("img",{key:"5cb3d79f1abcc875188586e720b0ce5135fa80d1",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGD0lEQVR4nO2cbU8TWRTH/W5WEAmF4nNiieFFoeBjYhQUWzUWYkpbDfGFCR9CoolvQF9aWgG3kMCG8LACC1ikuCuUh7bH/M/MmW131S2ZqTDjPcmkdub2tvPj3HP/55yJR44oU6ZMmTJlyg7YOsL9pI7+shkogGFzDqMAhhVAOsiQozwwrACS8sCwfXd+tYTDCiApDwwf/FJUSzisAJKjNhFlPzYF0KQpgCZNATRpCqBJUwBNmgJo0hRAk6YAmjQF0KkAs4uLtPz8OU2HQpRqaaFkQwPFq6v5SHo8fA7XVgYGKLu0dGC/81ABLORylB4cpInLl+nt0aP7OiauXKH00BAV8vlfE2AmkaCxpiYDSKK6mqaammjx+nX6FAzS348e0VYkwgf+jXO4Nun18lj53PuLF2kjmfx1AOa3t2mmt9cAkDxxghauXaPN3l7KxmJlHRgLmKNutzHPTCTCczsa4G4mQ6nWVr7h4WPHaL6trQTc+r17NOf30/iZMzTmdtNwVRWPA2Scm/H56FMgQNlolMfDO/9ob+cxmDPl99PuxoYzAe5mMrzcxOvWAALgolFauXmTxurry45/gPvnjRsG+LW7d3lOWdKVhHggAPPb24bnvW9ooL96evjGP4dC9NvJkwaY0fPnaa6vjzLJJG19+ED5bJY/u5NOUyYep/lnz2jk3Ll/4p/Hw/B4ru5unls8Mb+z4xyAM3rMg5cIvHRXFyVqavg8oKy+elXWjooxqy9f0luXy5gTm4xAFE+cjcWcATCTSGgxr6rKWLaAF9fj1u+BAOW2tsqeL7+7S5OdnRq8mhpaf/CA5xSI8EiJiRsjI/YGWMjlDKmCDUOWrXje3NOnRIWCaXh45biqL+f59nYjHlqtE38qwPTgoLHMeLeNRo2YB8+zEp7ExK1olI+Rujo+t/b6tX0BTugZBnQebha7rcQ8K5Ytw9O9WWKi7M7QiZKx2BJgdnHRyDDE+0SqYMOwEt7k7dvaxqJLHHwXvpMzFpeLtpeX7QdwZWCAbwjpmYhkkSrlxqVy4WEc4q1IHBbbsRhNXrjA71devLAfwOlQiH88lhJuBhkGbxx9fZbDE4NO5LTO5+OxCB14P93dbT+AKZ9P84ZgkG8GqRjeQ9ZUAh4MYhvXxs+e5fHwRBbWra32A5j0ePjHf9H1mST+2YWFisCDba+u8vV3tbWGNuT3jY32AxjXS06QFLgZKUH9aPct7O3RVFfXf+BlHj6kZG2tBq+j47tpGs5LoYKrNpGI9v74cfsDHNazg+/dvFl4sNzmprHz2x5g8l9LWMTuzsePli7bYkMBgqVMfb39l3CqpeXbm0g8XhF439xEgkGjOmN7GTOjA4XU2Be8zs6y4MFmnzzRpJLfXypjenrsK6Qnvd4SSQGxCyFtNbxiIb1+/74mpL1e+wrp7NISp1ElqZwuZZB2WQkPZqRyevz7Eg5zCc22qVxxMUGWMRL94sTfKnjYfd+dPq15261bpcWEq1fJvuWsoSEt/3W7tRZlNMolJylxWQEPJTGRP6lTpwz5YpSz3ryxcUE1nzcaSeieFTeArIKH3Fq8GSX9koJqc7O9C6owNL0lO5CKsZTfzS7bqTt3+LPxornxKu2Cz6Oj5IymUkTLCOB54iWAKOIaMRE7JXbS/zOMwYYhMQ9/gOLOnPxBZh8/dlhb06+Vs9B6FIi4cYmJInGgEyGIkbHgc8idkWHgHHRecVsTMU/mwuuY3tYcv3TJWW1NGJrdJY113WtkdxaJU84BqSK7rRFXdc/Dd+w5rbFeDHG8rc2IiQj2UmwQsY1iKFIxlKSg46AjARfnkGGISOZHO6JRnkNiHjzPsY92iGFZoultLNu6OtZs+3m4CCIZnxGpIjGvUsv2UAEUQ9NblrSUoNDDQP4KT+TH2/QWJT/eFgjwNaRnnGHI4x3NzRXZbQ89QBg0GsQ2Wo+SnZR1uFycYbBI3kdv2XEAiw35KqQMGkDoYaCeaDzi29jIuziuYYyVua1jANrFFECTpgCaNAXQpCmAJk0BNGkKoElTACsNUB39ZTFQAMMW/78xypQpU6ZMmbIjP9e+AkAlsBlIjsPOAAAAAElFTkSuQmCC"}),t("h2",{key:"7698274b668f8681cbc232dcab0c6ae93b8b2be5",class:"green-text margin-b"},"You don't have permission to access this application."),t("h3",{key:"dbafa7836eb959c051af3acb6883955f66ea64d7",class:"green-text"},"Please contact the administration."),this.portalUrl&&this.showUnauthorizedModal?t("div",null,t("h4",{class:"gray-text"},"You will be automatically redirected to the portal."),t("div",{id:"countdown"},t("div",{id:"countdown-number"}),t("svg",null,t("circle",{r:"18",cx:"20",cy:"20"})))):t("div",null))))}get el(){return n(this)}};L.style=S;export{L as dash_button};
|
|
10
|
+
//# sourceMappingURL=p-89ceb862.entry.js.map
|