@luizleon/sf.prefeiturasp.vuecomponents 0.0.16 → 0.0.18
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/lib.es.js +2417 -2243
- package/dist/lib.es.js.map +1 -1
- package/dist/lib.umd.js +36 -37
- package/dist/lib.umd.js.map +1 -1
- package/dist/services/dialogService.d.ts +6 -0
- package/package.json +1 -1
- package/src/components/button/Button.vue +1 -1
- package/src/services/dialogService.ts +31 -2
package/dist/lib.umd.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(N,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(N=typeof globalThis<"u"?globalThis:N||self,i(N.Lib={},N.Vue))})(this,function(N,i){"use strict";var Si=Object.defineProperty;var _i=(N,i,we)=>i in N?Si(N,i,{enumerable:!0,configurable:!0,writable:!0,value:we}):N[i]=we;var Je=(N,i,we)=>(_i(N,typeof i!="symbol"?i+"":i,we),we);class we{constructor(){Je(this,"_visible",i.ref(!1))}get IsVisible(){return this._visible.value===!0}Toggle(){this._visible.value=!this._visible.value}Close(){this._visible.value=!1}Open(){this._visible.value=!0}}const Bn=new we,ct=()=>Bn;var lt=(t=>(t.Primary="primary",t.Secondary="secondary",t.Info="info",t.Success="success",t.Help="help",t.Warn="warn",t.Error="error",t))(lt||{}),Se=(t=>(t.Pequeno="sm",t.Medio="md",t.Grande="lg",t))(Se||{});const Ft=(t,e)=>{const n=t.__vccOpts||t;for(const[o,a]of e)n[o]=a;return n},Pn={},Tn={class:"sf-loading-circle"},In=[i.createElementVNode("div",null,[i.createElementVNode("svg",{viewBox:"25 25 50 50"},[i.createElementVNode("circle",{cx:"50",cy:"50",r:"20",fill:"none","stroke-width":"4","stroke-miterlimit":"10"})])],-1)];function Fn(t,e){return i.openBlock(),i.createElementBlock("div",Tn,In)}const Ln=Ft(Pn,[["render",Fn]]);class _e{constructor(e){Je(this,"retorno");this.retorno=e??""}Concat(e){return e&&e.trim().length&&(this.retorno+=` ${e}`),this}AddClass(e,n=!0){return n?this.Concat(e):this}Build(){return this.retorno.trim()}}const Un=["disabled","tabindex"],$n=["data-color"],$e=i.defineComponent({__name:"Icon",props:{icone:{},visible:{type:Boolean,default:!0},class:{default:""},style:{default:""},disabled:{type:Boolean},loading:{type:Boolean},button:{type:Boolean},tamanho:{default:Se.Medio},dot:{type:Boolean},dotColor:{default:lt.Error},buttonProps:{}},setup(t){const e=t;function n(){return new _e(`${e.class} sf-icon`).AddClass("sf-component-loading",e.loading).AddClass("sf-component-disabled",e.disabled).AddClass("sf-icon-button",e.button).AddClass("sf-icon-small",e.tamanho===Se.Pequeno).AddClass("sf-icon-medium",e.tamanho===Se.Medio).AddClass("sf-icon-large",e.tamanho===Se.Grande).AddClass("sf-ripple",e.button===!0).Build()}return(o,a)=>(i.openBlock(),i.createElementBlock("div",{style:i.normalizeStyle(e.style),class:i.normalizeClass(n())},[i.createElementVNode("button",i.mergeProps({class:"material-symbols-outlined",disabled:e.disabled||e.loading},e.buttonProps,{tabindex:e.button?void 0:-1}),[e.loading?(i.openBlock(),i.createBlock(Ln,{key:0})):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(e.icone),1)],64))],16,Un),e.dot?(i.openBlock(),i.createElementBlock("span",{key:0,"data-color":e.dotColor},null,8,$n)):i.createCommentVNode("",!0)],6))}});var Mn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function On(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Rn(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function o(){return this instanceof o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var a=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,a.get?a:{enumerable:!0,get:function(){return t[o]}})}),n}var Ye={};Ye.byteLength=Hn,Ye.toByteArray=Dn,Ye.fromByteArray=Kn;for(var ue=[],ne=[],Vn=typeof Uint8Array<"u"?Uint8Array:Array,ut="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ee=0,Nn=ut.length;Ee<Nn;++Ee)ue[Ee]=ut[Ee],ne[ut.charCodeAt(Ee)]=Ee;ne["-".charCodeAt(0)]=62,ne["_".charCodeAt(0)]=63;function Lt(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var o=n===e?0:4-n%4;return[n,o]}function Hn(t){var e=Lt(t),n=e[0],o=e[1];return(n+o)*3/4-o}function jn(t,e,n){return(e+n)*3/4-n}function Dn(t){var e,n=Lt(t),o=n[0],a=n[1],l=new Vn(jn(t,o,a)),C=0,_=a>0?o-4:o,u;for(u=0;u<_;u+=4)e=ne[t.charCodeAt(u)]<<18|ne[t.charCodeAt(u+1)]<<12|ne[t.charCodeAt(u+2)]<<6|ne[t.charCodeAt(u+3)],l[C++]=e>>16&255,l[C++]=e>>8&255,l[C++]=e&255;return a===2&&(e=ne[t.charCodeAt(u)]<<2|ne[t.charCodeAt(u+1)]>>4,l[C++]=e&255),a===1&&(e=ne[t.charCodeAt(u)]<<10|ne[t.charCodeAt(u+1)]<<4|ne[t.charCodeAt(u+2)]>>2,l[C++]=e>>8&255,l[C++]=e&255),l}function zn(t){return ue[t>>18&63]+ue[t>>12&63]+ue[t>>6&63]+ue[t&63]}function qn(t,e,n){for(var o,a=[],l=e;l<n;l+=3)o=(t[l]<<16&16711680)+(t[l+1]<<8&65280)+(t[l+2]&255),a.push(zn(o));return a.join("")}function Kn(t){for(var e,n=t.length,o=n%3,a=[],l=16383,C=0,_=n-o;C<_;C+=l)a.push(qn(t,C,C+l>_?_:C+l));return o===1?(e=t[n-1],a.push(ue[e>>2]+ue[e<<4&63]+"==")):o===2&&(e=(t[n-2]<<8)+t[n-1],a.push(ue[e>>10]+ue[e>>4&63]+ue[e<<2&63]+"=")),a.join("")}var Ut={exports:{}};const $t=Rn(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));/**
|
|
2
2
|
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
3
3
|
*
|
|
4
4
|
* @version 0.10.1
|
|
5
5
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
6
6
|
* @copyright Chen, Yi-Cyuan 2014-2023
|
|
7
7
|
* @license MIT
|
|
8
|
-
*/(function(l){(function(){var o="input is invalid type",h=typeof window=="object",v=h?window:{};v.JS_SHA256_NO_WINDOW&&(h=!1);var U=!h&&typeof self=="object",x=!v.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;x?v=ke:U&&(v=self);var I=!v.JS_SHA256_NO_COMMON_JS&&!0&&l.exports,O=!v.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),K=[-2147483648,8388608,32768,128],W=[24,16,8,0],X=[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],ae=["hex","array","digest","arrayBuffer"],j=[];(v.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(d){return Object.prototype.toString.call(d)==="[object Array]"}),O&&(v.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(d){return typeof d=="object"&&d.buffer&&d.buffer.constructor===ArrayBuffer});var Ce=function(d,C){return function(L){return new J(C,!0).update(L)[d]()}},ge=function(d){var C=Ce("hex",d);x&&(C=ce(C,d)),C.create=function(){return new J(d)},C.update=function(E){return C.create().update(E)};for(var L=0;L<ae.length;++L){var A=ae[L];C[A]=Ce(A,d)}return C},ce=function(d,C){var L=yt,A=yt.Buffer,E=C?"sha224":"sha256",k;A.from&&!v.JS_SHA256_NO_BUFFER_FROM?k=A.from:k=function(g){return new A(g)};var i=function(g){if(typeof g=="string")return L.createHash(E).update(g,"utf8").digest("hex");if(g==null)throw new Error(o);return g.constructor===ArrayBuffer&&(g=new Uint8Array(g)),Array.isArray(g)||ArrayBuffer.isView(g)||g.constructor===A?L.createHash(E).update(k(g)).digest("hex"):d(g)};return i},Ie=function(d,C){return function(L,A){return new we(L,C,!0).update(A)[d]()}},fe=function(d){var C=Ie("hex",d);C.create=function(E){return new we(E,d)},C.update=function(E,k){return C.create(E).update(k)};for(var L=0;L<ae.length;++L){var A=ae[L];C[A]=Ie(A,d)}return C};function J(d,C){C?(j[0]=j[16]=j[1]=j[2]=j[3]=j[4]=j[5]=j[6]=j[7]=j[8]=j[9]=j[10]=j[11]=j[12]=j[13]=j[14]=j[15]=0,this.blocks=j):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],d?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(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=!1,this.first=!0,this.is224=d}J.prototype.update=function(d){if(!this.finalized){var C,L=typeof d;if(L!=="string"){if(L==="object"){if(d===null)throw new Error(o);if(O&&d.constructor===ArrayBuffer)d=new Uint8Array(d);else if(!Array.isArray(d)&&(!O||!ArrayBuffer.isView(d)))throw new Error(o)}else throw new Error(o);C=!0}for(var A,E=0,k,i=d.length,g=this.blocks;E<i;){if(this.hashed&&(this.hashed=!1,g[0]=this.block,g[16]=g[1]=g[2]=g[3]=g[4]=g[5]=g[6]=g[7]=g[8]=g[9]=g[10]=g[11]=g[12]=g[13]=g[14]=g[15]=0),C)for(k=this.start;E<i&&k<64;++E)g[k>>2]|=d[E]<<W[k++&3];else for(k=this.start;E<i&&k<64;++E)A=d.charCodeAt(E),A<128?g[k>>2]|=A<<W[k++&3]:A<2048?(g[k>>2]|=(192|A>>6)<<W[k++&3],g[k>>2]|=(128|A&63)<<W[k++&3]):A<55296||A>=57344?(g[k>>2]|=(224|A>>12)<<W[k++&3],g[k>>2]|=(128|A>>6&63)<<W[k++&3],g[k>>2]|=(128|A&63)<<W[k++&3]):(A=65536+((A&1023)<<10|d.charCodeAt(++E)&1023),g[k>>2]|=(240|A>>18)<<W[k++&3],g[k>>2]|=(128|A>>12&63)<<W[k++&3],g[k>>2]|=(128|A>>6&63)<<W[k++&3],g[k>>2]|=(128|A&63)<<W[k++&3]);this.lastByteIndex=k,this.bytes+=k-this.start,k>=64?(this.block=g[16],this.start=k-64,this.hash(),this.hashed=!0):this.start=k}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},J.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var d=this.blocks,C=this.lastByteIndex;d[16]=this.block,d[C>>2]|=K[C&3],this.block=d[16],C>=56&&(this.hashed||this.hash(),d[0]=this.block,d[16]=d[1]=d[2]=d[3]=d[4]=d[5]=d[6]=d[7]=d[8]=d[9]=d[10]=d[11]=d[12]=d[13]=d[14]=d[15]=0),d[14]=this.hBytes<<3|this.bytes>>>29,d[15]=this.bytes<<3,this.hash()}},J.prototype.hash=function(){var d=this.h0,C=this.h1,L=this.h2,A=this.h3,E=this.h4,k=this.h5,i=this.h6,g=this.h7,T=this.blocks,z,$,F,G,N,te,s,a,m,b,u;for(z=16;z<64;++z)N=T[z-15],$=(N>>>7|N<<25)^(N>>>18|N<<14)^N>>>3,N=T[z-2],F=(N>>>17|N<<15)^(N>>>19|N<<13)^N>>>10,T[z]=T[z-16]+$+T[z-7]+F<<0;for(u=C&L,z=0;z<64;z+=4)this.first?(this.is224?(a=300032,N=T[0]-1413257819,g=N-150054599<<0,A=N+24177077<<0):(a=704751109,N=T[0]-210244248,g=N-1521486534<<0,A=N+143694565<<0),this.first=!1):($=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),F=(E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7),a=d&C,G=a^d&L^u,s=E&k^~E&i,N=g+F+s+X[z]+T[z],te=$+G,g=A+N<<0,A=N+te<<0),$=(A>>>2|A<<30)^(A>>>13|A<<19)^(A>>>22|A<<10),F=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),m=A&d,G=m^A&C^a,s=g&E^~g&k,N=i+F+s+X[z+1]+T[z+1],te=$+G,i=L+N<<0,L=N+te<<0,$=(L>>>2|L<<30)^(L>>>13|L<<19)^(L>>>22|L<<10),F=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),b=L&A,G=b^L&d^m,s=i&g^~i&E,N=k+F+s+X[z+2]+T[z+2],te=$+G,k=C+N<<0,C=N+te<<0,$=(C>>>2|C<<30)^(C>>>13|C<<19)^(C>>>22|C<<10),F=(k>>>6|k<<26)^(k>>>11|k<<21)^(k>>>25|k<<7),u=C&L,G=u^C&A^b,s=k&i^~k&g,N=E+F+s+X[z+3]+T[z+3],te=$+G,E=d+N<<0,d=N+te<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+d<<0,this.h1=this.h1+C<<0,this.h2=this.h2+L<<0,this.h3=this.h3+A<<0,this.h4=this.h4+E<<0,this.h5=this.h5+k<<0,this.h6=this.h6+i<<0,this.h7=this.h7+g<<0},J.prototype.hex=function(){this.finalize();var d=this.h0,C=this.h1,L=this.h2,A=this.h3,E=this.h4,k=this.h5,i=this.h6,g=this.h7,T=p[d>>28&15]+p[d>>24&15]+p[d>>20&15]+p[d>>16&15]+p[d>>12&15]+p[d>>8&15]+p[d>>4&15]+p[d&15]+p[C>>28&15]+p[C>>24&15]+p[C>>20&15]+p[C>>16&15]+p[C>>12&15]+p[C>>8&15]+p[C>>4&15]+p[C&15]+p[L>>28&15]+p[L>>24&15]+p[L>>20&15]+p[L>>16&15]+p[L>>12&15]+p[L>>8&15]+p[L>>4&15]+p[L&15]+p[A>>28&15]+p[A>>24&15]+p[A>>20&15]+p[A>>16&15]+p[A>>12&15]+p[A>>8&15]+p[A>>4&15]+p[A&15]+p[E>>28&15]+p[E>>24&15]+p[E>>20&15]+p[E>>16&15]+p[E>>12&15]+p[E>>8&15]+p[E>>4&15]+p[E&15]+p[k>>28&15]+p[k>>24&15]+p[k>>20&15]+p[k>>16&15]+p[k>>12&15]+p[k>>8&15]+p[k>>4&15]+p[k&15]+p[i>>28&15]+p[i>>24&15]+p[i>>20&15]+p[i>>16&15]+p[i>>12&15]+p[i>>8&15]+p[i>>4&15]+p[i&15];return this.is224||(T+=p[g>>28&15]+p[g>>24&15]+p[g>>20&15]+p[g>>16&15]+p[g>>12&15]+p[g>>8&15]+p[g>>4&15]+p[g&15]),T},J.prototype.toString=J.prototype.hex,J.prototype.digest=function(){this.finalize();var d=this.h0,C=this.h1,L=this.h2,A=this.h3,E=this.h4,k=this.h5,i=this.h6,g=this.h7,T=[d>>24&255,d>>16&255,d>>8&255,d&255,C>>24&255,C>>16&255,C>>8&255,C&255,L>>24&255,L>>16&255,L>>8&255,L&255,A>>24&255,A>>16&255,A>>8&255,A&255,E>>24&255,E>>16&255,E>>8&255,E&255,k>>24&255,k>>16&255,k>>8&255,k&255,i>>24&255,i>>16&255,i>>8&255,i&255];return this.is224||T.push(g>>24&255,g>>16&255,g>>8&255,g&255),T},J.prototype.array=J.prototype.digest,J.prototype.arrayBuffer=function(){this.finalize();var d=new ArrayBuffer(this.is224?28:32),C=new DataView(d);return C.setUint32(0,this.h0),C.setUint32(4,this.h1),C.setUint32(8,this.h2),C.setUint32(12,this.h3),C.setUint32(16,this.h4),C.setUint32(20,this.h5),C.setUint32(24,this.h6),this.is224||C.setUint32(28,this.h7),d};function we(d,C,L){var A,E=typeof d;if(E==="string"){var k=[],i=d.length,g=0,T;for(A=0;A<i;++A)T=d.charCodeAt(A),T<128?k[g++]=T:T<2048?(k[g++]=192|T>>6,k[g++]=128|T&63):T<55296||T>=57344?(k[g++]=224|T>>12,k[g++]=128|T>>6&63,k[g++]=128|T&63):(T=65536+((T&1023)<<10|d.charCodeAt(++A)&1023),k[g++]=240|T>>18,k[g++]=128|T>>12&63,k[g++]=128|T>>6&63,k[g++]=128|T&63);d=k}else if(E==="object"){if(d===null)throw new Error(o);if(O&&d.constructor===ArrayBuffer)d=new Uint8Array(d);else if(!Array.isArray(d)&&(!O||!ArrayBuffer.isView(d)))throw new Error(o)}else throw new Error(o);d.length>64&&(d=new J(C,!0).update(d).array());var z=[],$=[];for(A=0;A<64;++A){var F=d[A]||0;z[A]=92^F,$[A]=54^F}J.call(this,C,L),this.update($),this.oKeyPad=z,this.inner=!0,this.sharedMemory=L}we.prototype=new J,we.prototype.finalize=function(){if(J.prototype.finalize.call(this),this.inner){this.inner=!1;var d=this.array();J.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(d),J.prototype.finalize.call(this)}};var Z=ge();Z.sha256=Z,Z.sha224=ge(!0),Z.sha256.hmac=fe(),Z.sha224.hmac=fe(!0),I?l.exports=Z:(v.sha256=Z.sha256,v.sha224=Z.sha224)})()})(wt);var xn=wt.exports;const Cn=gt(xn);class Re extends Error{}Re.prototype.name="InvalidTokenError";function An(l){return decodeURIComponent(atob(l).replace(/(.)/g,(o,h)=>{let v=h.charCodeAt(0).toString(16).toUpperCase();return v.length<2&&(v="0"+v),"%"+v}))}function Sn(l){let o=l.replace(/-/g,"+").replace(/_/g,"/");switch(o.length%4){case 0:break;case 2:o+="==";break;case 3:o+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return An(o)}catch{return atob(o)}}function et(l,o){if(typeof l!="string")throw new Re("Invalid token specified: must be a string");o||(o={});const h=o.header===!0?0:1,v=l.split(".")[h];if(typeof v!="string")throw new Re(`Invalid token specified: missing part #${h+1}`);let U;try{U=Sn(v)}catch(x){throw new Re(`Invalid token specified: invalid base64 for part #${h+1} (${x.message})`)}try{return JSON.parse(U)}catch(x){throw new Re(`Invalid token specified: invalid json for part #${h+1} (${x.message})`)}}if(typeof Promise>"u")throw Error("Keycloak requires an environment that supports Promises. Make sure that you include the appropriate polyfill.");function vt(l){if(!(this instanceof vt))throw new Error("The 'Keycloak' constructor must be invoked with 'new'.");for(var o=this,h,v=[],U,x={enable:!0,callbackList:[],interval:5},I=document.getElementsByTagName("script"),O=0;O<I.length;O++)(I[O].src.indexOf("keycloak.js")!==-1||I[O].src.indexOf("keycloak.min.js")!==-1)&&I[O].src.indexOf("version=")!==-1&&(o.iframeVersion=I[O].src.substring(I[O].src.indexOf("version=")+8).split("&")[0]);var p=!0,K=te(console.info),W=te(console.warn);o.init=function(s){if(o.didInitialize)throw new Error("A 'Keycloak' instance can only be initialized once.");o.didInitialize=!0,o.authenticated=!1,U=N();var a=["default","cordova","cordova-native"];if(s&&a.indexOf(s.adapter)>-1?h=$(s.adapter):s&&typeof s.adapter=="object"?h=s.adapter:window.Cordova||window.cordova?h=$("cordova"):h=$(),s){if(typeof s.useNonce<"u"&&(p=s.useNonce),typeof s.checkLoginIframe<"u"&&(x.enable=s.checkLoginIframe),s.checkLoginIframeInterval&&(x.interval=s.checkLoginIframeInterval),s.onLoad==="login-required"&&(o.loginRequired=!0),s.responseMode)if(s.responseMode==="query"||s.responseMode==="fragment")o.responseMode=s.responseMode;else throw"Invalid value for responseMode";if(s.flow){switch(s.flow){case"standard":o.responseType="code";break;case"implicit":o.responseType="id_token token";break;case"hybrid":o.responseType="code id_token token";break;default:throw"Invalid value for flow"}o.flow=s.flow}if(s.timeSkew!=null&&(o.timeSkew=s.timeSkew),s.redirectUri&&(o.redirectUri=s.redirectUri),s.silentCheckSsoRedirectUri&&(o.silentCheckSsoRedirectUri=s.silentCheckSsoRedirectUri),typeof s.silentCheckSsoFallback=="boolean"?o.silentCheckSsoFallback=s.silentCheckSsoFallback:o.silentCheckSsoFallback=!0,s.pkceMethod){if(s.pkceMethod!=="S256")throw"Invalid value for pkceMethod";o.pkceMethod=s.pkceMethod}typeof s.enableLogging=="boolean"?o.enableLogging=s.enableLogging:o.enableLogging=!1,typeof s.scope=="string"&&(o.scope=s.scope),typeof s.acrValues=="string"&&(o.acrValues=s.acrValues),typeof s.messageReceiveTimeout=="number"&&s.messageReceiveTimeout>0?o.messageReceiveTimeout=s.messageReceiveTimeout:o.messageReceiveTimeout=1e4}o.responseMode||(o.responseMode="fragment"),o.responseType||(o.responseType="code",o.flow="standard");var m=E(),b=E();b.promise.then(function(){o.onReady&&o.onReady(o.authenticated),m.setSuccess(o.authenticated)}).catch(function(_){m.setError(_)});var u=J();function S(){var _=function(H){H||(M.prompt="none"),s&&s.locale&&(M.locale=s.locale),o.login(M).then(function(){b.setSuccess()}).catch(function(he){b.setError(he)})},B=function(){var H=document.createElement("iframe"),he=o.createLoginUrl({prompt:"none",redirectUri:o.silentCheckSsoRedirectUri});H.setAttribute("src",he),H.setAttribute("sandbox","allow-scripts allow-same-origin"),H.setAttribute("title","keycloak-silent-check-sso"),H.style.display="none",document.body.appendChild(H);var pe=function(ne){if(!(ne.origin!==window.location.origin||H.contentWindow!==ne.source)){var ye=C(ne.data);fe(ye,b),document.body.removeChild(H),window.removeEventListener("message",pe)}};window.addEventListener("message",pe)},M={};switch(s.onLoad){case"check-sso":x.enable?i().then(function(){T().then(function(H){H?b.setSuccess():o.silentCheckSsoRedirectUri?B():_(!1)}).catch(function(H){b.setError(H)})}):o.silentCheckSsoRedirectUri?B():_(!1);break;case"login-required":_(!0);break;default:throw"Invalid value for onLoad"}}function w(){var _=C(window.location.href);if(_&&window.history.replaceState(window.history.state,null,_.newUrl),_&&_.valid)return i().then(function(){fe(_,b)}).catch(function(B){b.setError(B)});s?s.token&&s.refreshToken?(Z(s.token,s.refreshToken,s.idToken),x.enable?i().then(function(){T().then(function(B){B?(o.onAuthSuccess&&o.onAuthSuccess(),b.setSuccess(),g()):b.setSuccess()}).catch(function(B){b.setError(B)})}):o.updateToken(-1).then(function(){o.onAuthSuccess&&o.onAuthSuccess(),b.setSuccess()}).catch(function(B){o.onAuthError&&o.onAuthError(),s.onLoad?S():b.setError(B)})):s.onLoad?S():b.setSuccess():b.setSuccess()}function y(){var _=E(),B=function(){(document.readyState==="interactive"||document.readyState==="complete")&&(document.removeEventListener("readystatechange",B),_.setSuccess())};return document.addEventListener("readystatechange",B),B(),_.promise}return u.then(function(){y().then(z).then(w).catch(function(_){m.setError(_)})}),u.catch(function(_){m.setError(_)}),m.promise},o.login=function(s){return h.login(s)};function X(s){var a=null,m=window.crypto||window.msCrypto;if(m&&m.getRandomValues&&window.Uint8Array)return a=new Uint8Array(s),m.getRandomValues(a),a;a=new Array(s);for(var b=0;b<a.length;b++)a[b]=Math.floor(256*Math.random());return a}function ae(s){return j(s,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")}function j(s,a){for(var m=X(s),b=new Array(s),u=0;u<s;u++)b[u]=a.charCodeAt(m[u]%a.length);return String.fromCharCode.apply(null,b)}function Ce(s,a){switch(s){case"S256":var m=new Uint8Array(Cn.arrayBuffer(a)),b=qe.fromByteArray(m).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"");return b;default:throw"Invalid value for pkceMethod"}}function ge(s){var a={id_token:{acr:s}};return JSON.stringify(a)}o.createLoginUrl=function(s){var a=d(),m=d(),b=h.redirectUri(s),u={state:a,nonce:m,redirectUri:encodeURIComponent(b)};s&&s.prompt&&(u.prompt=s.prompt);var S;s&&s.action=="register"?S=o.endpoints.register():S=o.endpoints.authorize();var w=s&&s.scope||o.scope;w?w.indexOf("openid")===-1&&(w="openid "+w):w="openid";var y=S+"?client_id="+encodeURIComponent(o.clientId)+"&redirect_uri="+encodeURIComponent(b)+"&state="+encodeURIComponent(a)+"&response_mode="+encodeURIComponent(o.responseMode)+"&response_type="+encodeURIComponent(o.responseType)+"&scope="+encodeURIComponent(w);if(p&&(y=y+"&nonce="+encodeURIComponent(m)),s&&s.prompt&&(y+="&prompt="+encodeURIComponent(s.prompt)),s&&s.maxAge&&(y+="&max_age="+encodeURIComponent(s.maxAge)),s&&s.loginHint&&(y+="&login_hint="+encodeURIComponent(s.loginHint)),s&&s.idpHint&&(y+="&kc_idp_hint="+encodeURIComponent(s.idpHint)),s&&s.action&&s.action!="register"&&(y+="&kc_action="+encodeURIComponent(s.action)),s&&s.locale&&(y+="&ui_locales="+encodeURIComponent(s.locale)),s&&s.acr){var _=ge(s.acr);y+="&claims="+encodeURIComponent(_)}if((s&&s.acrValues||o.acrValues)&&(y+="&acr_values="+encodeURIComponent(s.acrValues||o.acrValues)),o.pkceMethod){var B=ae(96);u.pkceCodeVerifier=B;var M=Ce(o.pkceMethod,B);y+="&code_challenge="+M,y+="&code_challenge_method="+o.pkceMethod}return U.add(u),y},o.logout=function(s){return h.logout(s)},o.createLogoutUrl=function(s){var a=o.endpoints.logout()+"?client_id="+encodeURIComponent(o.clientId)+"&post_logout_redirect_uri="+encodeURIComponent(h.redirectUri(s,!1));return o.idToken&&(a+="&id_token_hint="+encodeURIComponent(o.idToken)),a},o.register=function(s){return h.register(s)},o.createRegisterUrl=function(s){return s||(s={}),s.action="register",o.createLoginUrl(s)},o.createAccountUrl=function(s){var a=ce(),m=void 0;return typeof a<"u"&&(m=a+"/account?referrer="+encodeURIComponent(o.clientId)+"&referrer_uri="+encodeURIComponent(h.redirectUri(s))),m},o.accountManagement=function(){return h.accountManagement()},o.hasRealmRole=function(s){var a=o.realmAccess;return!!a&&a.roles.indexOf(s)>=0},o.hasResourceRole=function(s,a){if(!o.resourceAccess)return!1;var m=o.resourceAccess[a||o.clientId];return!!m&&m.roles.indexOf(s)>=0},o.loadUserProfile=function(){var s=ce()+"/account",a=new XMLHttpRequest;a.open("GET",s,!0),a.setRequestHeader("Accept","application/json"),a.setRequestHeader("Authorization","bearer "+o.token);var m=E();return a.onreadystatechange=function(){a.readyState==4&&(a.status==200?(o.profile=JSON.parse(a.responseText),m.setSuccess(o.profile)):m.setError())},a.send(),m.promise},o.loadUserInfo=function(){var s=o.endpoints.userinfo(),a=new XMLHttpRequest;a.open("GET",s,!0),a.setRequestHeader("Accept","application/json"),a.setRequestHeader("Authorization","bearer "+o.token);var m=E();return a.onreadystatechange=function(){a.readyState==4&&(a.status==200?(o.userInfo=JSON.parse(a.responseText),m.setSuccess(o.userInfo)):m.setError())},a.send(),m.promise},o.isTokenExpired=function(s){if(!o.tokenParsed||!o.refreshToken&&o.flow!="implicit")throw"Not authenticated";if(o.timeSkew==null)return K("[KEYCLOAK] Unable to determine if token is expired as timeskew is not set"),!0;var a=o.tokenParsed.exp-Math.ceil(new Date().getTime()/1e3)+o.timeSkew;if(s){if(isNaN(s))throw"Invalid minValidity";a-=s}return a<0},o.updateToken=function(s){var a=E();if(!o.refreshToken)return a.setError(),a.promise;s=s||5;var m=function(){var u=!1;if(s==-1?(u=!0,K("[KEYCLOAK] Refreshing token: forced refresh")):(!o.tokenParsed||o.isTokenExpired(s))&&(u=!0,K("[KEYCLOAK] Refreshing token: token expired")),!u)a.setSuccess(!1);else{var S="grant_type=refresh_token&refresh_token="+o.refreshToken,w=o.endpoints.token();if(v.push(a),v.length==1){var y=new XMLHttpRequest;y.open("POST",w,!0),y.setRequestHeader("Content-type","application/x-www-form-urlencoded"),y.withCredentials=!0,S+="&client_id="+encodeURIComponent(o.clientId);var _=new Date().getTime();y.onreadystatechange=function(){if(y.readyState==4)if(y.status==200){K("[KEYCLOAK] Token refreshed"),_=(_+new Date().getTime())/2;var B=JSON.parse(y.responseText);Z(B.access_token,B.refresh_token,B.id_token,_),o.onAuthRefreshSuccess&&o.onAuthRefreshSuccess();for(var M=v.pop();M!=null;M=v.pop())M.setSuccess(!0)}else{W("[KEYCLOAK] Failed to refresh token"),y.status==400&&o.clearToken(),o.onAuthRefreshError&&o.onAuthRefreshError();for(var M=v.pop();M!=null;M=v.pop())M.setError(!0)}},y.send(S)}}};if(x.enable){var b=T();b.then(function(){m()}).catch(function(u){a.setError(u)})}else m();return a.promise},o.clearToken=function(){o.token&&(Z(null,null,null),o.onAuthLogout&&o.onAuthLogout(),o.loginRequired&&o.login())},o.setToken=Z;function ce(){if(typeof o.authServerUrl<"u")return o.authServerUrl.charAt(o.authServerUrl.length-1)=="/"?o.authServerUrl+"realms/"+encodeURIComponent(o.realm):o.authServerUrl+"/realms/"+encodeURIComponent(o.realm)}function Ie(){return window.location.origin?window.location.origin:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}function fe(s,a){var m=s.code,b=s.error,u=s.prompt,S=new Date().getTime();if(s.kc_action_status&&o.onActionUpdate&&o.onActionUpdate(s.kc_action_status),b){if(u!="none"){var w={error:b,error_description:s.error_description};o.onAuthError&&o.onAuthError(w),a&&a.setError(w)}else a&&a.setSuccess();return}else o.flow!="standard"&&(s.access_token||s.id_token)&&M(s.access_token,null,s.id_token,!0);if(o.flow!="implicit"&&m){var y="code="+m+"&grant_type=authorization_code",_=o.endpoints.token(),B=new XMLHttpRequest;B.open("POST",_,!0),B.setRequestHeader("Content-type","application/x-www-form-urlencoded"),y+="&client_id="+encodeURIComponent(o.clientId),y+="&redirect_uri="+s.redirectUri,s.pkceCodeVerifier&&(y+="&code_verifier="+s.pkceCodeVerifier),B.withCredentials=!0,B.onreadystatechange=function(){if(B.readyState==4)if(B.status==200){var H=JSON.parse(B.responseText);M(H.access_token,H.refresh_token,H.id_token,o.flow==="standard"),g()}else o.onAuthError&&o.onAuthError(),a&&a.setError()},B.send(y)}function M(H,he,pe,ne){S=(S+new Date().getTime())/2,Z(H,he,pe,S),p&&(o.tokenParsed&&o.tokenParsed.nonce!=s.storedNonce||o.refreshTokenParsed&&o.refreshTokenParsed.nonce!=s.storedNonce||o.idTokenParsed&&o.idTokenParsed.nonce!=s.storedNonce)?(K("[KEYCLOAK] Invalid nonce, clearing token"),o.clearToken(),a&&a.setError()):ne&&(o.onAuthSuccess&&o.onAuthSuccess(),a&&a.setSuccess())}}function J(s){var a=E(),m;l?typeof l=="string"&&(m=l):m=location.origin+"/keycloak.json";function b(B){B?o.endpoints={authorize:function(){return B.authorization_endpoint},token:function(){return B.token_endpoint},logout:function(){if(!B.end_session_endpoint)throw"Not supported by the OIDC server";return B.end_session_endpoint},checkSessionIframe:function(){if(!B.check_session_iframe)throw"Not supported by the OIDC server";return B.check_session_iframe},register:function(){throw'Redirection to "Register user" page not supported in standard OIDC mode'},userinfo:function(){if(!B.userinfo_endpoint)throw"Not supported by the OIDC server";return B.userinfo_endpoint}}:o.endpoints={authorize:function(){return ce()+"/protocol/openid-connect/auth"},token:function(){return ce()+"/protocol/openid-connect/token"},logout:function(){return ce()+"/protocol/openid-connect/logout"},checkSessionIframe:function(){var M=ce()+"/protocol/openid-connect/login-status-iframe.html";return o.iframeVersion&&(M=M+"?version="+o.iframeVersion),M},thirdPartyCookiesIframe:function(){var M=ce()+"/protocol/openid-connect/3p-cookies/step1.html";return o.iframeVersion&&(M=M+"?version="+o.iframeVersion),M},register:function(){return ce()+"/protocol/openid-connect/registrations"},userinfo:function(){return ce()+"/protocol/openid-connect/userinfo"}}}if(m){var u=new XMLHttpRequest;u.open("GET",m,!0),u.setRequestHeader("Accept","application/json"),u.onreadystatechange=function(){if(u.readyState==4)if(u.status==200||we(u)){var B=JSON.parse(u.responseText);o.authServerUrl=B["auth-server-url"],o.realm=B.realm,o.clientId=B.resource,b(null),a.setSuccess()}else a.setError()},u.send()}else{if(!l.clientId)throw"clientId missing";o.clientId=l.clientId;var S=l.oidcProvider;if(S)if(typeof S=="string"){var _;S.charAt(S.length-1)=="/"?_=S+".well-known/openid-configuration":_=S+"/.well-known/openid-configuration";var u=new XMLHttpRequest;u.open("GET",_,!0),u.setRequestHeader("Accept","application/json"),u.onreadystatechange=function(){if(u.readyState==4)if(u.status==200||we(u)){var M=JSON.parse(u.responseText);b(M),a.setSuccess()}else a.setError()},u.send()}else b(S),a.setSuccess();else{if(!l.url){for(var w=document.getElementsByTagName("script"),y=0;y<w.length;y++)if(w[y].src.match(/.*keycloak\.js/)){l.url=w[y].src.substr(0,w[y].src.indexOf("/js/keycloak.js"));break}}if(!l.realm)throw"realm missing";o.authServerUrl=l.url,o.realm=l.realm,b(null),a.setSuccess()}}return a.promise}function we(s){return s.status==0&&s.responseText&&s.responseURL.startsWith("file:")}function Z(s,a,m,b){if(o.tokenTimeoutHandle&&(clearTimeout(o.tokenTimeoutHandle),o.tokenTimeoutHandle=null),a?(o.refreshToken=a,o.refreshTokenParsed=et(a)):(delete o.refreshToken,delete o.refreshTokenParsed),m?(o.idToken=m,o.idTokenParsed=et(m)):(delete o.idToken,delete o.idTokenParsed),s){if(o.token=s,o.tokenParsed=et(s),o.sessionId=o.tokenParsed.session_state,o.authenticated=!0,o.subject=o.tokenParsed.sub,o.realmAccess=o.tokenParsed.realm_access,o.resourceAccess=o.tokenParsed.resource_access,b&&(o.timeSkew=Math.floor(b/1e3)-o.tokenParsed.iat),o.timeSkew!=null&&(K("[KEYCLOAK] Estimated time difference between browser and server is "+o.timeSkew+" seconds"),o.onTokenExpired)){var u=(o.tokenParsed.exp-new Date().getTime()/1e3+o.timeSkew)*1e3;K("[KEYCLOAK] Token expires in "+Math.round(u/1e3)+" s"),u<=0?o.onTokenExpired():o.tokenTimeoutHandle=setTimeout(o.onTokenExpired,u)}}else delete o.token,delete o.tokenParsed,delete o.subject,delete o.realmAccess,delete o.resourceAccess,o.authenticated=!1}function d(){var s="0123456789abcdef",a=j(36,s).split("");a[14]="4",a[19]=s.substr(a[19]&3|8,1),a[8]=a[13]=a[18]=a[23]="-";var m=a.join("");return m}function C(s){var a=L(s);if(a){var m=U.get(a.state);return m&&(a.valid=!0,a.redirectUri=m.redirectUri,a.storedNonce=m.nonce,a.prompt=m.prompt,a.pkceCodeVerifier=m.pkceCodeVerifier),a}}function L(s){var a;switch(o.flow){case"standard":a=["code","state","session_state","kc_action_status","iss"];break;case"implicit":a=["access_token","token_type","id_token","state","session_state","expires_in","kc_action_status","iss"];break;case"hybrid":a=["access_token","token_type","id_token","code","state","session_state","expires_in","kc_action_status","iss"];break}a.push("error"),a.push("error_description"),a.push("error_uri");var m=s.indexOf("?"),b=s.indexOf("#"),u,S;if(o.responseMode==="query"&&m!==-1?(u=s.substring(0,m),S=A(s.substring(m+1,b!==-1?b:s.length),a),S.paramsString!==""&&(u+="?"+S.paramsString),b!==-1&&(u+=s.substring(b))):o.responseMode==="fragment"&&b!==-1&&(u=s.substring(0,b),S=A(s.substring(b+1),a),S.paramsString!==""&&(u+="#"+S.paramsString)),S&&S.oauthParams){if(o.flow==="standard"||o.flow==="hybrid"){if((S.oauthParams.code||S.oauthParams.error)&&S.oauthParams.state)return S.oauthParams.newUrl=u,S.oauthParams}else if(o.flow==="implicit"&&(S.oauthParams.access_token||S.oauthParams.error)&&S.oauthParams.state)return S.oauthParams.newUrl=u,S.oauthParams}}function A(s,a){for(var m=s.split("&"),b={paramsString:"",oauthParams:{}},u=0;u<m.length;u++){var S=m[u].indexOf("="),w=m[u].slice(0,S);a.indexOf(w)!==-1?b.oauthParams[w]=m[u].slice(S+1):(b.paramsString!==""&&(b.paramsString+="&"),b.paramsString+=m[u])}return b}function E(){var s={setSuccess:function(a){s.resolve(a)},setError:function(a){s.reject(a)}};return s.promise=new Promise(function(a,m){s.resolve=a,s.reject=m}),s}function k(s,a,m){var b=null,u=new Promise(function(S,w){b=setTimeout(function(){w({error:m||"Promise is not settled within timeout of "+a+"ms"})},a)});return Promise.race([s,u]).finally(function(){clearTimeout(b)})}function i(){var s=E();if(!x.enable||x.iframe)return s.setSuccess(),s.promise;var a=document.createElement("iframe");x.iframe=a,a.onload=function(){var u=o.endpoints.authorize();u.charAt(0)==="/"?x.iframeOrigin=Ie():x.iframeOrigin=u.substring(0,u.indexOf("/",8)),s.setSuccess()};var m=o.endpoints.checkSessionIframe();a.setAttribute("src",m),a.setAttribute("sandbox","allow-scripts allow-same-origin"),a.setAttribute("title","keycloak-session-iframe"),a.style.display="none",document.body.appendChild(a);var b=function(u){if(!(u.origin!==x.iframeOrigin||x.iframe.contentWindow!==u.source)&&(u.data=="unchanged"||u.data=="changed"||u.data=="error")){u.data!="unchanged"&&o.clearToken();for(var S=x.callbackList.splice(0,x.callbackList.length),w=S.length-1;w>=0;--w){var y=S[w];u.data=="error"?y.setError():y.setSuccess(u.data=="unchanged")}}};return window.addEventListener("message",b,!1),s.promise}function g(){x.enable&&o.token&&setTimeout(function(){T().then(function(s){s&&g()})},x.interval*1e3)}function T(){var s=E();if(x.iframe&&x.iframeOrigin){var a=o.clientId+" "+(o.sessionId?o.sessionId:"");x.callbackList.push(s);var m=x.iframeOrigin;x.callbackList.length==1&&x.iframe.contentWindow.postMessage(a,m)}else s.setSuccess();return s.promise}function z(){var s=E();if(x.enable||o.silentCheckSsoRedirectUri){var a=document.createElement("iframe");a.setAttribute("src",o.endpoints.thirdPartyCookiesIframe()),a.setAttribute("sandbox","allow-scripts allow-same-origin"),a.setAttribute("title","keycloak-3p-check-iframe"),a.style.display="none",document.body.appendChild(a);var m=function(b){a.contentWindow===b.source&&(b.data!=="supported"&&b.data!=="unsupported"||(b.data==="unsupported"&&(W(`[KEYCLOAK] Your browser is blocking access to 3rd-party cookies, this means:
|
|
8
|
+
*/(function(t){(function(){var e="input is invalid type",n=typeof window=="object",o=n?window:{};o.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",l=!o.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;l?o=Mn:a&&(o=self);var C=!o.JS_SHA256_NO_COMMON_JS&&!0&&t.exports,_=!o.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),O=[-2147483648,8388608,32768,128],R=[24,16,8,0],X=[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],me=["hex","array","digest","arrayBuffer"],V=[];(o.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(d){return Object.prototype.toString.call(d)==="[object Array]"}),_&&(o.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(d){return typeof d=="object"&&d.buffer&&d.buffer.constructor===ArrayBuffer});var st=function(d,w){return function(E){return new j(w,!0).update(E)[d]()}},it=function(d){var w=st("hex",d);l&&(w=ce(w,d)),w.create=function(){return new j(d)},w.update=function(x){return w.create().update(x)};for(var E=0;E<me.length;++E){var v=me[E];w[v]=st(v,d)}return w},ce=function(d,w){var E=$t,v=$t.Buffer,x=w?"sha224":"sha256",y;v.from&&!o.JS_SHA256_NO_BUFFER_FROM?y=v.from:y=function(p){return new v(p)};var F=function(p){if(typeof p=="string")return E.createHash(x).update(p,"utf8").digest("hex");if(p==null)throw new Error(e);return p.constructor===ArrayBuffer&&(p=new Uint8Array(p)),Array.isArray(p)||ArrayBuffer.isView(p)||p.constructor===v?E.createHash(x).update(y(p)).digest("hex"):d(p)};return F},at=function(d,w){return function(E,v){return new Ae(E,w,!0).update(v)[d]()}},fe=function(d){var w=at("hex",d);w.create=function(x){return new Ae(x,d)},w.update=function(x,y){return w.create(x).update(y)};for(var E=0;E<me.length;++E){var v=me[E];w[v]=at(v,d)}return w};function j(d,w){w?(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):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],d?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(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=!1,this.first=!0,this.is224=d}j.prototype.update=function(d){if(!this.finalized){var w,E=typeof d;if(E!=="string"){if(E==="object"){if(d===null)throw new Error(e);if(_&&d.constructor===ArrayBuffer)d=new Uint8Array(d);else if(!Array.isArray(d)&&(!_||!ArrayBuffer.isView(d)))throw new Error(e)}else throw new Error(e);w=!0}for(var v,x=0,y,F=d.length,p=this.blocks;x<F;){if(this.hashed&&(this.hashed=!1,p[0]=this.block,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),w)for(y=this.start;x<F&&y<64;++x)p[y>>2]|=d[x]<<R[y++&3];else for(y=this.start;x<F&&y<64;++x)v=d.charCodeAt(x),v<128?p[y>>2]|=v<<R[y++&3]:v<2048?(p[y>>2]|=(192|v>>6)<<R[y++&3],p[y>>2]|=(128|v&63)<<R[y++&3]):v<55296||v>=57344?(p[y>>2]|=(224|v>>12)<<R[y++&3],p[y>>2]|=(128|v>>6&63)<<R[y++&3],p[y>>2]|=(128|v&63)<<R[y++&3]):(v=65536+((v&1023)<<10|d.charCodeAt(++x)&1023),p[y>>2]|=(240|v>>18)<<R[y++&3],p[y>>2]|=(128|v>>12&63)<<R[y++&3],p[y>>2]|=(128|v>>6&63)<<R[y++&3],p[y>>2]|=(128|v&63)<<R[y++&3]);this.lastByteIndex=y,this.bytes+=y-this.start,y>=64?(this.block=p[16],this.start=y-64,this.hash(),this.hashed=!0):this.start=y}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},j.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var d=this.blocks,w=this.lastByteIndex;d[16]=this.block,d[w>>2]|=O[w&3],this.block=d[16],w>=56&&(this.hashed||this.hash(),d[0]=this.block,d[16]=d[1]=d[2]=d[3]=d[4]=d[5]=d[6]=d[7]=d[8]=d[9]=d[10]=d[11]=d[12]=d[13]=d[14]=d[15]=0),d[14]=this.hBytes<<3|this.bytes>>>29,d[15]=this.bytes<<3,this.hash()}},j.prototype.hash=function(){var d=this.h0,w=this.h1,E=this.h2,v=this.h3,x=this.h4,y=this.h5,F=this.h6,p=this.h7,T=this.blocks,H,z,q,se,U,le,r,s,h,b,f;for(H=16;H<64;++H)U=T[H-15],z=(U>>>7|U<<25)^(U>>>18|U<<14)^U>>>3,U=T[H-2],q=(U>>>17|U<<15)^(U>>>19|U<<13)^U>>>10,T[H]=T[H-16]+z+T[H-7]+q<<0;for(f=w&E,H=0;H<64;H+=4)this.first?(this.is224?(s=300032,U=T[0]-1413257819,p=U-150054599<<0,v=U+24177077<<0):(s=704751109,U=T[0]-210244248,p=U-1521486534<<0,v=U+143694565<<0),this.first=!1):(z=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),q=(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7),s=d&w,se=s^d&E^f,r=x&y^~x&F,U=p+q+r+X[H]+T[H],le=z+se,p=v+U<<0,v=U+le<<0),z=(v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),q=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7),h=v&d,se=h^v&w^s,r=p&x^~p&y,U=F+q+r+X[H+1]+T[H+1],le=z+se,F=E+U<<0,E=U+le<<0,z=(E>>>2|E<<30)^(E>>>13|E<<19)^(E>>>22|E<<10),q=(F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7),b=E&v,se=b^E&d^h,r=F&p^~F&x,U=y+q+r+X[H+2]+T[H+2],le=z+se,y=w+U<<0,w=U+le<<0,z=(w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10),q=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),f=w&E,se=f^w&v^b,r=y&F^~y&p,U=x+q+r+X[H+3]+T[H+3],le=z+se,x=d+U<<0,d=U+le<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+d<<0,this.h1=this.h1+w<<0,this.h2=this.h2+E<<0,this.h3=this.h3+v<<0,this.h4=this.h4+x<<0,this.h5=this.h5+y<<0,this.h6=this.h6+F<<0,this.h7=this.h7+p<<0},j.prototype.hex=function(){this.finalize();var d=this.h0,w=this.h1,E=this.h2,v=this.h3,x=this.h4,y=this.h5,F=this.h6,p=this.h7,T=u[d>>28&15]+u[d>>24&15]+u[d>>20&15]+u[d>>16&15]+u[d>>12&15]+u[d>>8&15]+u[d>>4&15]+u[d&15]+u[w>>28&15]+u[w>>24&15]+u[w>>20&15]+u[w>>16&15]+u[w>>12&15]+u[w>>8&15]+u[w>>4&15]+u[w&15]+u[E>>28&15]+u[E>>24&15]+u[E>>20&15]+u[E>>16&15]+u[E>>12&15]+u[E>>8&15]+u[E>>4&15]+u[E&15]+u[v>>28&15]+u[v>>24&15]+u[v>>20&15]+u[v>>16&15]+u[v>>12&15]+u[v>>8&15]+u[v>>4&15]+u[v&15]+u[x>>28&15]+u[x>>24&15]+u[x>>20&15]+u[x>>16&15]+u[x>>12&15]+u[x>>8&15]+u[x>>4&15]+u[x&15]+u[y>>28&15]+u[y>>24&15]+u[y>>20&15]+u[y>>16&15]+u[y>>12&15]+u[y>>8&15]+u[y>>4&15]+u[y&15]+u[F>>28&15]+u[F>>24&15]+u[F>>20&15]+u[F>>16&15]+u[F>>12&15]+u[F>>8&15]+u[F>>4&15]+u[F&15];return this.is224||(T+=u[p>>28&15]+u[p>>24&15]+u[p>>20&15]+u[p>>16&15]+u[p>>12&15]+u[p>>8&15]+u[p>>4&15]+u[p&15]),T},j.prototype.toString=j.prototype.hex,j.prototype.digest=function(){this.finalize();var d=this.h0,w=this.h1,E=this.h2,v=this.h3,x=this.h4,y=this.h5,F=this.h6,p=this.h7,T=[d>>24&255,d>>16&255,d>>8&255,d&255,w>>24&255,w>>16&255,w>>8&255,w&255,E>>24&255,E>>16&255,E>>8&255,E&255,v>>24&255,v>>16&255,v>>8&255,v&255,x>>24&255,x>>16&255,x>>8&255,x&255,y>>24&255,y>>16&255,y>>8&255,y&255,F>>24&255,F>>16&255,F>>8&255,F&255];return this.is224||T.push(p>>24&255,p>>16&255,p>>8&255,p&255),T},j.prototype.array=j.prototype.digest,j.prototype.arrayBuffer=function(){this.finalize();var d=new ArrayBuffer(this.is224?28:32),w=new DataView(d);return w.setUint32(0,this.h0),w.setUint32(4,this.h1),w.setUint32(8,this.h2),w.setUint32(12,this.h3),w.setUint32(16,this.h4),w.setUint32(20,this.h5),w.setUint32(24,this.h6),this.is224||w.setUint32(28,this.h7),d};function Ae(d,w,E){var v,x=typeof d;if(x==="string"){var y=[],F=d.length,p=0,T;for(v=0;v<F;++v)T=d.charCodeAt(v),T<128?y[p++]=T:T<2048?(y[p++]=192|T>>6,y[p++]=128|T&63):T<55296||T>=57344?(y[p++]=224|T>>12,y[p++]=128|T>>6&63,y[p++]=128|T&63):(T=65536+((T&1023)<<10|d.charCodeAt(++v)&1023),y[p++]=240|T>>18,y[p++]=128|T>>12&63,y[p++]=128|T>>6&63,y[p++]=128|T&63);d=y}else if(x==="object"){if(d===null)throw new Error(e);if(_&&d.constructor===ArrayBuffer)d=new Uint8Array(d);else if(!Array.isArray(d)&&(!_||!ArrayBuffer.isView(d)))throw new Error(e)}else throw new Error(e);d.length>64&&(d=new j(w,!0).update(d).array());var H=[],z=[];for(v=0;v<64;++v){var q=d[v]||0;H[v]=92^q,z[v]=54^q}j.call(this,w,E),this.update(z),this.oKeyPad=H,this.inner=!0,this.sharedMemory=E}Ae.prototype=new j,Ae.prototype.finalize=function(){if(j.prototype.finalize.call(this),this.inner){this.inner=!1;var d=this.array();j.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(d),j.prototype.finalize.call(this)}};var Q=it();Q.sha256=Q,Q.sha224=it(!0),Q.sha256.hmac=fe(),Q.sha224.hmac=fe(!0),C?t.exports=Q:(o.sha256=Q.sha256,o.sha224=Q.sha224)})()})(Ut);var Wn=Ut.exports;const Jn=On(Wn);class Me extends Error{}Me.prototype.name="InvalidTokenError";function Yn(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,n)=>{let o=n.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function Xn(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Yn(e)}catch{return atob(e)}}function dt(t,e){if(typeof t!="string")throw new Me("Invalid token specified: must be a string");e||(e={});const n=e.header===!0?0:1,o=t.split(".")[n];if(typeof o!="string")throw new Me(`Invalid token specified: missing part #${n+1}`);let a;try{a=Xn(o)}catch(l){throw new Me(`Invalid token specified: invalid base64 for part #${n+1} (${l.message})`)}try{return JSON.parse(a)}catch(l){throw new Me(`Invalid token specified: invalid json for part #${n+1} (${l.message})`)}}if(typeof Promise>"u")throw Error("Keycloak requires an environment that supports Promises. Make sure that you include the appropriate polyfill.");function Mt(t){if(!(this instanceof Mt))throw new Error("The 'Keycloak' constructor must be invoked with 'new'.");for(var e=this,n,o=[],a,l={enable:!0,callbackList:[],interval:5},C=document.getElementsByTagName("script"),_=0;_<C.length;_++)(C[_].src.indexOf("keycloak.js")!==-1||C[_].src.indexOf("keycloak.min.js")!==-1)&&C[_].src.indexOf("version=")!==-1&&(e.iframeVersion=C[_].src.substring(C[_].src.indexOf("version=")+8).split("&")[0]);var u=!0,O=le(console.info),R=le(console.warn);e.init=function(r){if(e.didInitialize)throw new Error("A 'Keycloak' instance can only be initialized once.");e.didInitialize=!0,e.authenticated=!1,a=U();var s=["default","cordova","cordova-native"];if(r&&s.indexOf(r.adapter)>-1?n=z(r.adapter):r&&typeof r.adapter=="object"?n=r.adapter:window.Cordova||window.cordova?n=z("cordova"):n=z(),r){if(typeof r.useNonce<"u"&&(u=r.useNonce),typeof r.checkLoginIframe<"u"&&(l.enable=r.checkLoginIframe),r.checkLoginIframeInterval&&(l.interval=r.checkLoginIframeInterval),r.onLoad==="login-required"&&(e.loginRequired=!0),r.responseMode)if(r.responseMode==="query"||r.responseMode==="fragment")e.responseMode=r.responseMode;else throw"Invalid value for responseMode";if(r.flow){switch(r.flow){case"standard":e.responseType="code";break;case"implicit":e.responseType="id_token token";break;case"hybrid":e.responseType="code id_token token";break;default:throw"Invalid value for flow"}e.flow=r.flow}if(r.timeSkew!=null&&(e.timeSkew=r.timeSkew),r.redirectUri&&(e.redirectUri=r.redirectUri),r.silentCheckSsoRedirectUri&&(e.silentCheckSsoRedirectUri=r.silentCheckSsoRedirectUri),typeof r.silentCheckSsoFallback=="boolean"?e.silentCheckSsoFallback=r.silentCheckSsoFallback:e.silentCheckSsoFallback=!0,r.pkceMethod){if(r.pkceMethod!=="S256")throw"Invalid value for pkceMethod";e.pkceMethod=r.pkceMethod}typeof r.enableLogging=="boolean"?e.enableLogging=r.enableLogging:e.enableLogging=!1,typeof r.scope=="string"&&(e.scope=r.scope),typeof r.acrValues=="string"&&(e.acrValues=r.acrValues),typeof r.messageReceiveTimeout=="number"&&r.messageReceiveTimeout>0?e.messageReceiveTimeout=r.messageReceiveTimeout:e.messageReceiveTimeout=1e4}e.responseMode||(e.responseMode="fragment"),e.responseType||(e.responseType="code",e.flow="standard");var h=x(),b=x();b.promise.then(function(){e.onReady&&e.onReady(e.authenticated),h.setSuccess(e.authenticated)}).catch(function(A){h.setError(A)});var f=j();function k(){var A=function($){$||(P.prompt="none"),r&&r.locale&&(P.locale=r.locale),e.login(P).then(function(){b.setSuccess()}).catch(function(he){b.setError(he)})},S=function(){var $=document.createElement("iframe"),he=e.createLoginUrl({prompt:"none",redirectUri:e.silentCheckSsoRedirectUri});$.setAttribute("src",he),$.setAttribute("sandbox","allow-scripts allow-same-origin"),$.setAttribute("title","keycloak-silent-check-sso"),$.style.display="none",document.body.appendChild($);var ye=function(ie){if(!(ie.origin!==window.location.origin||$.contentWindow!==ie.source)){var We=w(ie.data);fe(We,b),document.body.removeChild($),window.removeEventListener("message",ye)}};window.addEventListener("message",ye)},P={};switch(r.onLoad){case"check-sso":l.enable?F().then(function(){T().then(function($){$?b.setSuccess():e.silentCheckSsoRedirectUri?S():A(!1)}).catch(function($){b.setError($)})}):e.silentCheckSsoRedirectUri?S():A(!1);break;case"login-required":A(!0);break;default:throw"Invalid value for onLoad"}}function m(){var A=w(window.location.href);if(A&&window.history.replaceState(window.history.state,null,A.newUrl),A&&A.valid)return F().then(function(){fe(A,b)}).catch(function(S){b.setError(S)});r?r.token&&r.refreshToken?(Q(r.token,r.refreshToken,r.idToken),l.enable?F().then(function(){T().then(function(S){S?(e.onAuthSuccess&&e.onAuthSuccess(),b.setSuccess(),p()):b.setSuccess()}).catch(function(S){b.setError(S)})}):e.updateToken(-1).then(function(){e.onAuthSuccess&&e.onAuthSuccess(),b.setSuccess()}).catch(function(S){e.onAuthError&&e.onAuthError(),r.onLoad?k():b.setError(S)})):r.onLoad?k():b.setSuccess():b.setSuccess()}function g(){var A=x(),S=function(){(document.readyState==="interactive"||document.readyState==="complete")&&(document.removeEventListener("readystatechange",S),A.setSuccess())};return document.addEventListener("readystatechange",S),S(),A.promise}return f.then(function(){g().then(H).then(m).catch(function(A){h.setError(A)})}),f.catch(function(A){h.setError(A)}),h.promise},e.login=function(r){return n.login(r)};function X(r){var s=null,h=window.crypto||window.msCrypto;if(h&&h.getRandomValues&&window.Uint8Array)return s=new Uint8Array(r),h.getRandomValues(s),s;s=new Array(r);for(var b=0;b<s.length;b++)s[b]=Math.floor(256*Math.random());return s}function me(r){return V(r,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")}function V(r,s){for(var h=X(r),b=new Array(r),f=0;f<r;f++)b[f]=s.charCodeAt(h[f]%s.length);return String.fromCharCode.apply(null,b)}function st(r,s){switch(r){case"S256":var h=new Uint8Array(Jn.arrayBuffer(s)),b=Ye.fromByteArray(h).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"");return b;default:throw"Invalid value for pkceMethod"}}function it(r){var s={id_token:{acr:r}};return JSON.stringify(s)}e.createLoginUrl=function(r){var s=d(),h=d(),b=n.redirectUri(r),f={state:s,nonce:h,redirectUri:encodeURIComponent(b)};r&&r.prompt&&(f.prompt=r.prompt);var k;r&&r.action=="register"?k=e.endpoints.register():k=e.endpoints.authorize();var m=r&&r.scope||e.scope;m?m.indexOf("openid")===-1&&(m="openid "+m):m="openid";var g=k+"?client_id="+encodeURIComponent(e.clientId)+"&redirect_uri="+encodeURIComponent(b)+"&state="+encodeURIComponent(s)+"&response_mode="+encodeURIComponent(e.responseMode)+"&response_type="+encodeURIComponent(e.responseType)+"&scope="+encodeURIComponent(m);if(u&&(g=g+"&nonce="+encodeURIComponent(h)),r&&r.prompt&&(g+="&prompt="+encodeURIComponent(r.prompt)),r&&r.maxAge&&(g+="&max_age="+encodeURIComponent(r.maxAge)),r&&r.loginHint&&(g+="&login_hint="+encodeURIComponent(r.loginHint)),r&&r.idpHint&&(g+="&kc_idp_hint="+encodeURIComponent(r.idpHint)),r&&r.action&&r.action!="register"&&(g+="&kc_action="+encodeURIComponent(r.action)),r&&r.locale&&(g+="&ui_locales="+encodeURIComponent(r.locale)),r&&r.acr){var A=it(r.acr);g+="&claims="+encodeURIComponent(A)}if((r&&r.acrValues||e.acrValues)&&(g+="&acr_values="+encodeURIComponent(r.acrValues||e.acrValues)),e.pkceMethod){var S=me(96);f.pkceCodeVerifier=S;var P=st(e.pkceMethod,S);g+="&code_challenge="+P,g+="&code_challenge_method="+e.pkceMethod}return a.add(f),g},e.logout=function(r){return n.logout(r)},e.createLogoutUrl=function(r){var s=e.endpoints.logout()+"?client_id="+encodeURIComponent(e.clientId)+"&post_logout_redirect_uri="+encodeURIComponent(n.redirectUri(r,!1));return e.idToken&&(s+="&id_token_hint="+encodeURIComponent(e.idToken)),s},e.register=function(r){return n.register(r)},e.createRegisterUrl=function(r){return r||(r={}),r.action="register",e.createLoginUrl(r)},e.createAccountUrl=function(r){var s=ce(),h=void 0;return typeof s<"u"&&(h=s+"/account?referrer="+encodeURIComponent(e.clientId)+"&referrer_uri="+encodeURIComponent(n.redirectUri(r))),h},e.accountManagement=function(){return n.accountManagement()},e.hasRealmRole=function(r){var s=e.realmAccess;return!!s&&s.roles.indexOf(r)>=0},e.hasResourceRole=function(r,s){if(!e.resourceAccess)return!1;var h=e.resourceAccess[s||e.clientId];return!!h&&h.roles.indexOf(r)>=0},e.loadUserProfile=function(){var r=ce()+"/account",s=new XMLHttpRequest;s.open("GET",r,!0),s.setRequestHeader("Accept","application/json"),s.setRequestHeader("Authorization","bearer "+e.token);var h=x();return s.onreadystatechange=function(){s.readyState==4&&(s.status==200?(e.profile=JSON.parse(s.responseText),h.setSuccess(e.profile)):h.setError())},s.send(),h.promise},e.loadUserInfo=function(){var r=e.endpoints.userinfo(),s=new XMLHttpRequest;s.open("GET",r,!0),s.setRequestHeader("Accept","application/json"),s.setRequestHeader("Authorization","bearer "+e.token);var h=x();return s.onreadystatechange=function(){s.readyState==4&&(s.status==200?(e.userInfo=JSON.parse(s.responseText),h.setSuccess(e.userInfo)):h.setError())},s.send(),h.promise},e.isTokenExpired=function(r){if(!e.tokenParsed||!e.refreshToken&&e.flow!="implicit")throw"Not authenticated";if(e.timeSkew==null)return O("[KEYCLOAK] Unable to determine if token is expired as timeskew is not set"),!0;var s=e.tokenParsed.exp-Math.ceil(new Date().getTime()/1e3)+e.timeSkew;if(r){if(isNaN(r))throw"Invalid minValidity";s-=r}return s<0},e.updateToken=function(r){var s=x();if(!e.refreshToken)return s.setError(),s.promise;r=r||5;var h=function(){var f=!1;if(r==-1?(f=!0,O("[KEYCLOAK] Refreshing token: forced refresh")):(!e.tokenParsed||e.isTokenExpired(r))&&(f=!0,O("[KEYCLOAK] Refreshing token: token expired")),!f)s.setSuccess(!1);else{var k="grant_type=refresh_token&refresh_token="+e.refreshToken,m=e.endpoints.token();if(o.push(s),o.length==1){var g=new XMLHttpRequest;g.open("POST",m,!0),g.setRequestHeader("Content-type","application/x-www-form-urlencoded"),g.withCredentials=!0,k+="&client_id="+encodeURIComponent(e.clientId);var A=new Date().getTime();g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200){O("[KEYCLOAK] Token refreshed"),A=(A+new Date().getTime())/2;var S=JSON.parse(g.responseText);Q(S.access_token,S.refresh_token,S.id_token,A),e.onAuthRefreshSuccess&&e.onAuthRefreshSuccess();for(var P=o.pop();P!=null;P=o.pop())P.setSuccess(!0)}else{R("[KEYCLOAK] Failed to refresh token"),g.status==400&&e.clearToken(),e.onAuthRefreshError&&e.onAuthRefreshError();for(var P=o.pop();P!=null;P=o.pop())P.setError(!0)}},g.send(k)}}};if(l.enable){var b=T();b.then(function(){h()}).catch(function(f){s.setError(f)})}else h();return s.promise},e.clearToken=function(){e.token&&(Q(null,null,null),e.onAuthLogout&&e.onAuthLogout(),e.loginRequired&&e.login())},e.setToken=Q;function ce(){if(typeof e.authServerUrl<"u")return e.authServerUrl.charAt(e.authServerUrl.length-1)=="/"?e.authServerUrl+"realms/"+encodeURIComponent(e.realm):e.authServerUrl+"/realms/"+encodeURIComponent(e.realm)}function at(){return window.location.origin?window.location.origin:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}function fe(r,s){var h=r.code,b=r.error,f=r.prompt,k=new Date().getTime();if(r.kc_action_status&&e.onActionUpdate&&e.onActionUpdate(r.kc_action_status),b){if(f!="none"){var m={error:b,error_description:r.error_description};e.onAuthError&&e.onAuthError(m),s&&s.setError(m)}else s&&s.setSuccess();return}else e.flow!="standard"&&(r.access_token||r.id_token)&&P(r.access_token,null,r.id_token,!0);if(e.flow!="implicit"&&h){var g="code="+h+"&grant_type=authorization_code",A=e.endpoints.token(),S=new XMLHttpRequest;S.open("POST",A,!0),S.setRequestHeader("Content-type","application/x-www-form-urlencoded"),g+="&client_id="+encodeURIComponent(e.clientId),g+="&redirect_uri="+r.redirectUri,r.pkceCodeVerifier&&(g+="&code_verifier="+r.pkceCodeVerifier),S.withCredentials=!0,S.onreadystatechange=function(){if(S.readyState==4)if(S.status==200){var $=JSON.parse(S.responseText);P($.access_token,$.refresh_token,$.id_token,e.flow==="standard"),p()}else e.onAuthError&&e.onAuthError(),s&&s.setError()},S.send(g)}function P($,he,ye,ie){k=(k+new Date().getTime())/2,Q($,he,ye,k),u&&(e.tokenParsed&&e.tokenParsed.nonce!=r.storedNonce||e.refreshTokenParsed&&e.refreshTokenParsed.nonce!=r.storedNonce||e.idTokenParsed&&e.idTokenParsed.nonce!=r.storedNonce)?(O("[KEYCLOAK] Invalid nonce, clearing token"),e.clearToken(),s&&s.setError()):ie&&(e.onAuthSuccess&&e.onAuthSuccess(),s&&s.setSuccess())}}function j(r){var s=x(),h;t?typeof t=="string"&&(h=t):h=location.origin+"/keycloak.json";function b(S){S?e.endpoints={authorize:function(){return S.authorization_endpoint},token:function(){return S.token_endpoint},logout:function(){if(!S.end_session_endpoint)throw"Not supported by the OIDC server";return S.end_session_endpoint},checkSessionIframe:function(){if(!S.check_session_iframe)throw"Not supported by the OIDC server";return S.check_session_iframe},register:function(){throw'Redirection to "Register user" page not supported in standard OIDC mode'},userinfo:function(){if(!S.userinfo_endpoint)throw"Not supported by the OIDC server";return S.userinfo_endpoint}}:e.endpoints={authorize:function(){return ce()+"/protocol/openid-connect/auth"},token:function(){return ce()+"/protocol/openid-connect/token"},logout:function(){return ce()+"/protocol/openid-connect/logout"},checkSessionIframe:function(){var P=ce()+"/protocol/openid-connect/login-status-iframe.html";return e.iframeVersion&&(P=P+"?version="+e.iframeVersion),P},thirdPartyCookiesIframe:function(){var P=ce()+"/protocol/openid-connect/3p-cookies/step1.html";return e.iframeVersion&&(P=P+"?version="+e.iframeVersion),P},register:function(){return ce()+"/protocol/openid-connect/registrations"},userinfo:function(){return ce()+"/protocol/openid-connect/userinfo"}}}if(h){var f=new XMLHttpRequest;f.open("GET",h,!0),f.setRequestHeader("Accept","application/json"),f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||Ae(f)){var S=JSON.parse(f.responseText);e.authServerUrl=S["auth-server-url"],e.realm=S.realm,e.clientId=S.resource,b(null),s.setSuccess()}else s.setError()},f.send()}else{if(!t.clientId)throw"clientId missing";e.clientId=t.clientId;var k=t.oidcProvider;if(k)if(typeof k=="string"){var A;k.charAt(k.length-1)=="/"?A=k+".well-known/openid-configuration":A=k+"/.well-known/openid-configuration";var f=new XMLHttpRequest;f.open("GET",A,!0),f.setRequestHeader("Accept","application/json"),f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||Ae(f)){var P=JSON.parse(f.responseText);b(P),s.setSuccess()}else s.setError()},f.send()}else b(k),s.setSuccess();else{if(!t.url){for(var m=document.getElementsByTagName("script"),g=0;g<m.length;g++)if(m[g].src.match(/.*keycloak\.js/)){t.url=m[g].src.substr(0,m[g].src.indexOf("/js/keycloak.js"));break}}if(!t.realm)throw"realm missing";e.authServerUrl=t.url,e.realm=t.realm,b(null),s.setSuccess()}}return s.promise}function Ae(r){return r.status==0&&r.responseText&&r.responseURL.startsWith("file:")}function Q(r,s,h,b){if(e.tokenTimeoutHandle&&(clearTimeout(e.tokenTimeoutHandle),e.tokenTimeoutHandle=null),s?(e.refreshToken=s,e.refreshTokenParsed=dt(s)):(delete e.refreshToken,delete e.refreshTokenParsed),h?(e.idToken=h,e.idTokenParsed=dt(h)):(delete e.idToken,delete e.idTokenParsed),r){if(e.token=r,e.tokenParsed=dt(r),e.sessionId=e.tokenParsed.session_state,e.authenticated=!0,e.subject=e.tokenParsed.sub,e.realmAccess=e.tokenParsed.realm_access,e.resourceAccess=e.tokenParsed.resource_access,b&&(e.timeSkew=Math.floor(b/1e3)-e.tokenParsed.iat),e.timeSkew!=null&&(O("[KEYCLOAK] Estimated time difference between browser and server is "+e.timeSkew+" seconds"),e.onTokenExpired)){var f=(e.tokenParsed.exp-new Date().getTime()/1e3+e.timeSkew)*1e3;O("[KEYCLOAK] Token expires in "+Math.round(f/1e3)+" s"),f<=0?e.onTokenExpired():e.tokenTimeoutHandle=setTimeout(e.onTokenExpired,f)}}else delete e.token,delete e.tokenParsed,delete e.subject,delete e.realmAccess,delete e.resourceAccess,e.authenticated=!1}function d(){var r="0123456789abcdef",s=V(36,r).split("");s[14]="4",s[19]=r.substr(s[19]&3|8,1),s[8]=s[13]=s[18]=s[23]="-";var h=s.join("");return h}function w(r){var s=E(r);if(s){var h=a.get(s.state);return h&&(s.valid=!0,s.redirectUri=h.redirectUri,s.storedNonce=h.nonce,s.prompt=h.prompt,s.pkceCodeVerifier=h.pkceCodeVerifier),s}}function E(r){var s;switch(e.flow){case"standard":s=["code","state","session_state","kc_action_status","iss"];break;case"implicit":s=["access_token","token_type","id_token","state","session_state","expires_in","kc_action_status","iss"];break;case"hybrid":s=["access_token","token_type","id_token","code","state","session_state","expires_in","kc_action_status","iss"];break}s.push("error"),s.push("error_description"),s.push("error_uri");var h=r.indexOf("?"),b=r.indexOf("#"),f,k;if(e.responseMode==="query"&&h!==-1?(f=r.substring(0,h),k=v(r.substring(h+1,b!==-1?b:r.length),s),k.paramsString!==""&&(f+="?"+k.paramsString),b!==-1&&(f+=r.substring(b))):e.responseMode==="fragment"&&b!==-1&&(f=r.substring(0,b),k=v(r.substring(b+1),s),k.paramsString!==""&&(f+="#"+k.paramsString)),k&&k.oauthParams){if(e.flow==="standard"||e.flow==="hybrid"){if((k.oauthParams.code||k.oauthParams.error)&&k.oauthParams.state)return k.oauthParams.newUrl=f,k.oauthParams}else if(e.flow==="implicit"&&(k.oauthParams.access_token||k.oauthParams.error)&&k.oauthParams.state)return k.oauthParams.newUrl=f,k.oauthParams}}function v(r,s){for(var h=r.split("&"),b={paramsString:"",oauthParams:{}},f=0;f<h.length;f++){var k=h[f].indexOf("="),m=h[f].slice(0,k);s.indexOf(m)!==-1?b.oauthParams[m]=h[f].slice(k+1):(b.paramsString!==""&&(b.paramsString+="&"),b.paramsString+=h[f])}return b}function x(){var r={setSuccess:function(s){r.resolve(s)},setError:function(s){r.reject(s)}};return r.promise=new Promise(function(s,h){r.resolve=s,r.reject=h}),r}function y(r,s,h){var b=null,f=new Promise(function(k,m){b=setTimeout(function(){m({error:h||"Promise is not settled within timeout of "+s+"ms"})},s)});return Promise.race([r,f]).finally(function(){clearTimeout(b)})}function F(){var r=x();if(!l.enable||l.iframe)return r.setSuccess(),r.promise;var s=document.createElement("iframe");l.iframe=s,s.onload=function(){var f=e.endpoints.authorize();f.charAt(0)==="/"?l.iframeOrigin=at():l.iframeOrigin=f.substring(0,f.indexOf("/",8)),r.setSuccess()};var h=e.endpoints.checkSessionIframe();s.setAttribute("src",h),s.setAttribute("sandbox","allow-scripts allow-same-origin"),s.setAttribute("title","keycloak-session-iframe"),s.style.display="none",document.body.appendChild(s);var b=function(f){if(!(f.origin!==l.iframeOrigin||l.iframe.contentWindow!==f.source)&&(f.data=="unchanged"||f.data=="changed"||f.data=="error")){f.data!="unchanged"&&e.clearToken();for(var k=l.callbackList.splice(0,l.callbackList.length),m=k.length-1;m>=0;--m){var g=k[m];f.data=="error"?g.setError():g.setSuccess(f.data=="unchanged")}}};return window.addEventListener("message",b,!1),r.promise}function p(){l.enable&&e.token&&setTimeout(function(){T().then(function(r){r&&p()})},l.interval*1e3)}function T(){var r=x();if(l.iframe&&l.iframeOrigin){var s=e.clientId+" "+(e.sessionId?e.sessionId:"");l.callbackList.push(r);var h=l.iframeOrigin;l.callbackList.length==1&&l.iframe.contentWindow.postMessage(s,h)}else r.setSuccess();return r.promise}function H(){var r=x();if(l.enable||e.silentCheckSsoRedirectUri){var s=document.createElement("iframe");s.setAttribute("src",e.endpoints.thirdPartyCookiesIframe()),s.setAttribute("sandbox","allow-scripts allow-same-origin"),s.setAttribute("title","keycloak-3p-check-iframe"),s.style.display="none",document.body.appendChild(s);var h=function(b){s.contentWindow===b.source&&(b.data!=="supported"&&b.data!=="unsupported"||(b.data==="unsupported"&&(R(`[KEYCLOAK] Your browser is blocking access to 3rd-party cookies, this means:
|
|
9
9
|
|
|
10
10
|
- It is not possible to retrieve tokens without redirecting to the Keycloak server (a.k.a. no support for silent authentication).
|
|
11
11
|
- It is not possible to automatically detect changes to the session status (such as the user logging out in another tab).
|
|
12
12
|
|
|
13
|
-
For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_modern_browsers`),x.enable=!1,o.silentCheckSsoFallback&&(o.silentCheckSsoRedirectUri=!1)),document.body.removeChild(a),window.removeEventListener("message",m),s.setSuccess()))};window.addEventListener("message",m,!1)}else s.setSuccess();return k(s.promise,o.messageReceiveTimeout,"Timeout when waiting for 3rd party check iframe message.")}function $(s){if(!s||s=="default")return{login:function(w){return window.location.assign(o.createLoginUrl(w)),E().promise},logout:function(w){return window.location.replace(o.createLogoutUrl(w)),E().promise},register:function(w){return window.location.assign(o.createRegisterUrl(w)),E().promise},accountManagement:function(){var w=o.createAccountUrl();if(typeof w<"u")window.location.href=w;else throw"Not supported by the OIDC server";return E().promise},redirectUri:function(w,y){return w&&w.redirectUri?w.redirectUri:o.redirectUri?o.redirectUri:location.href}};if(s=="cordova"){x.enable=!1;var a=function(w,y,_){return window.cordova&&window.cordova.InAppBrowser?window.cordova.InAppBrowser.open(w,y,_):window.open(w,y,_)},m=function(w){return w&&w.cordovaOptions?Object.keys(w.cordovaOptions).reduce(function(y,_){return y[_]=w.cordovaOptions[_],y},{}):{}},b=function(w){return Object.keys(w).reduce(function(y,_){return y.push(_+"="+w[_]),y},[]).join(",")},u=function(w){var y=m(w);return y.location="no",w&&w.prompt=="none"&&(y.hidden="yes"),b(y)},S=function(){return o.redirectUri||"http://localhost"};return{login:function(w){var y=E(),_=u(w),B=o.createLoginUrl(w),M=a(B,"_blank",_),H=!1,he=!1,pe=function(){he=!0,M.close()};return M.addEventListener("loadstart",function(ne){if(ne.url.indexOf(S())==0){var ye=C(ne.url);fe(ye,y),pe(),H=!0}}),M.addEventListener("loaderror",function(ne){if(!H)if(ne.url.indexOf(S())==0){var ye=C(ne.url);fe(ye,y),pe(),H=!0}else y.setError(),pe()}),M.addEventListener("exit",function(ne){he||y.setError({reason:"closed_by_user"})}),y.promise},logout:function(w){var y=E(),_=o.createLogoutUrl(w),B=a(_,"_blank","location=no,hidden=yes,clearcache=yes"),M;return B.addEventListener("loadstart",function(H){H.url.indexOf(S())==0&&B.close()}),B.addEventListener("loaderror",function(H){H.url.indexOf(S())==0||(M=!0),B.close()}),B.addEventListener("exit",function(H){M?y.setError():(o.clearToken(),y.setSuccess())}),y.promise},register:function(w){var y=E(),_=o.createRegisterUrl(),B=u(w),M=a(_,"_blank",B);return M.addEventListener("loadstart",function(H){if(H.url.indexOf(S())==0){M.close();var he=C(H.url);fe(he,y)}}),y.promise},accountManagement:function(){var w=o.createAccountUrl();if(typeof w<"u"){var y=a(w,"_blank","location=no");y.addEventListener("loadstart",function(_){_.url.indexOf(S())==0&&y.close()})}else throw"Not supported by the OIDC server"},redirectUri:function(w){return S()}}}if(s=="cordova-native")return x.enable=!1,{login:function(w){var y=E(),_=o.createLoginUrl(w);return universalLinks.subscribe("keycloak",function(B){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var M=C(B.url);fe(M,y)}),window.cordova.plugins.browsertab.openUrl(_),y.promise},logout:function(w){var y=E(),_=o.createLogoutUrl(w);return universalLinks.subscribe("keycloak",function(B){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close(),o.clearToken(),y.setSuccess()}),window.cordova.plugins.browsertab.openUrl(_),y.promise},register:function(w){var y=E(),_=o.createRegisterUrl(w);return universalLinks.subscribe("keycloak",function(B){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var M=C(B.url);fe(M,y)}),window.cordova.plugins.browsertab.openUrl(_),y.promise},accountManagement:function(){var w=o.createAccountUrl();if(typeof w<"u")window.cordova.plugins.browsertab.openUrl(w);else throw"Not supported by the OIDC server"},redirectUri:function(w){return w&&w.redirectUri?w.redirectUri:o.redirectUri?o.redirectUri:"http://localhost"}};throw"invalid adapter type: "+s}var F=function(){if(!(this instanceof F))return new F;localStorage.setItem("kc-test","test"),localStorage.removeItem("kc-test");var s=this;function a(){for(var m=new Date().getTime(),b=0;b<localStorage.length;b++){var u=localStorage.key(b);if(u&&u.indexOf("kc-callback-")==0){var S=localStorage.getItem(u);if(S)try{var w=JSON.parse(S).expires;(!w||w<m)&&localStorage.removeItem(u)}catch{localStorage.removeItem(u)}}}}s.get=function(m){if(m){var b="kc-callback-"+m,u=localStorage.getItem(b);return u&&(localStorage.removeItem(b),u=JSON.parse(u)),a(),u}},s.add=function(m){a();var b="kc-callback-"+m.state;m.expires=new Date().getTime()+60*60*1e3,localStorage.setItem(b,JSON.stringify(m))}},G=function(){if(!(this instanceof G))return new G;var s=this;s.get=function(u){if(u){var S=m("kc-callback-"+u);if(b("kc-callback-"+u,"",a(-100)),S)return JSON.parse(S)}},s.add=function(u){b("kc-callback-"+u.state,JSON.stringify(u),a(60))},s.removeItem=function(u){b(u,"",a(-100))};var a=function(u){var S=new Date;return S.setTime(S.getTime()+u*60*1e3),S},m=function(u){for(var S=u+"=",w=document.cookie.split(";"),y=0;y<w.length;y++){for(var _=w[y];_.charAt(0)==" ";)_=_.substring(1);if(_.indexOf(S)==0)return _.substring(S.length,_.length)}return""},b=function(u,S,w){var y=u+"="+S+"; expires="+w.toUTCString()+"; ";document.cookie=y}};function N(){try{return new F}catch{}return new G}function te(s){return function(){o.enableLogging&&s.apply(console,Array.prototype.slice.call(arguments))}}}const We=new vt,En=(l,o)=>{We.init({onLoad:"login-required"}).then(async h=>{h&&await _n(),l()}).catch(h=>{o(h)})},_n=async()=>{const l=await We.loadUserInfo();ee.User.email=l.email??"",ee.User.emailVerified=l.email_verified===!0,ee.User.firstName=l.given_name??"",ee.User.lastName=l.family_name??"",ee.User.name=l.name??"",ee.User.sub=l.sub??"",ee.User.username=l.preferred_username??"",ee.User.roles=[...l.role??[]],ee.User.groups=[...l.group??[]],ee.User.IsInRole=o=>ee.User.roles.includes(o)},ee={Instance:We,User:{},CallLogin:En,CallLogout:()=>{We.logout({redirectUri:location.origin}).then(()=>{sessionStorage.removeItem("user-info")})}};var kt={exports:{}};/*!
|
|
14
|
-
* sweetalert2 v11.4.8
|
|
15
|
-
* Released under the MIT License.
|
|
16
|
-
*/(function(l,o){(function(h,v){l.exports=v()})(ke,function(){const h="SweetAlert2:",v=e=>{const t=[];for(let n=0;n<e.length;n++)t.indexOf(e[n])===-1&&t.push(e[n]);return t},U=e=>e.charAt(0).toUpperCase()+e.slice(1),x=e=>Array.prototype.slice.call(e),I=e=>{console.warn("".concat(h," ").concat(typeof e=="object"?e.join(" "):e))},O=e=>{console.error("".concat(h," ").concat(e))},p=[],K=e=>{p.includes(e)||(p.push(e),I(e))},W=(e,t)=>{K('"'.concat(e,'" is deprecated and will be removed in the next major release. Please use "').concat(t,'" instead.'))},X=e=>typeof e=="function"?e():e,ae=e=>e&&typeof e.toPromise=="function",j=e=>ae(e)?e.toPromise():Promise.resolve(e),Ce=e=>e&&Promise.resolve(e)===e,ge={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconColor:void 0,iconHtml:void 0,template:void 0,toast:!1,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:{},target:"body",color:void 0,backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showDenyButton:!1,showCancelButton:!1,preConfirm:void 0,preDeny:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,denyButtonText:"No",denyButtonAriaLabel:"",denyButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusDeny:!1,focusCancel:!1,returnFocus:!0,showCloseButton:!1,closeButtonHtml:"×",closeButtonAriaLabel:"Close this dialog",loaderHtml:"",showLoaderOnConfirm:!1,showLoaderOnDeny:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputLabel:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,returnInputValueOnDeny:!1,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,willOpen:void 0,didOpen:void 0,didRender:void 0,willClose:void 0,didClose:void 0,didDestroy:void 0,scrollbarPadding:!0},ce=["allowEscapeKey","allowOutsideClick","background","buttonsStyling","cancelButtonAriaLabel","cancelButtonColor","cancelButtonText","closeButtonAriaLabel","closeButtonHtml","color","confirmButtonAriaLabel","confirmButtonColor","confirmButtonText","currentProgressStep","customClass","denyButtonAriaLabel","denyButtonColor","denyButtonText","didClose","didDestroy","footer","hideClass","html","icon","iconColor","iconHtml","imageAlt","imageHeight","imageUrl","imageWidth","preConfirm","preDeny","progressSteps","returnFocus","reverseButtons","showCancelButton","showCloseButton","showConfirmButton","showDenyButton","text","title","titleText","willClose"],Ie={},fe=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],J=e=>Object.prototype.hasOwnProperty.call(ge,e),we=e=>ce.indexOf(e)!==-1,Z=e=>Ie[e],d=e=>{J(e)||I('Unknown parameter "'.concat(e,'"'))},C=e=>{fe.includes(e)&&I('The parameter "'.concat(e,'" is incompatible with toasts'))},L=e=>{Z(e)&&W(e,Z(e))},A=e=>{!e.backdrop&&e.allowOutsideClick&&I('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');for(const t in e)d(t),e.toast&&C(t),L(t)},E="swal2-",k=e=>{const t={};for(const n in e)t[e[n]]=E+e[n];return t},i=k(["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","default-outline","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error"]),g=k(["success","warning","info","question","error"]),T=()=>document.body.querySelector(".".concat(i.container)),z=e=>{const t=T();return t?t.querySelector(e):null},$=e=>z(".".concat(e)),F=()=>$(i.popup),G=()=>$(i.icon),N=()=>$(i.title),te=()=>$(i["html-container"]),s=()=>$(i.image),a=()=>$(i["progress-steps"]),m=()=>$(i["validation-message"]),b=()=>z(".".concat(i.actions," .").concat(i.confirm)),u=()=>z(".".concat(i.actions," .").concat(i.deny)),S=()=>$(i["input-label"]),w=()=>z(".".concat(i.loader)),y=()=>z(".".concat(i.actions," .").concat(i.cancel)),_=()=>$(i.actions),B=()=>$(i.footer),M=()=>$(i["timer-progress-bar"]),H=()=>$(i.close),he=`
|
|
13
|
+
For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_modern_browsers`),l.enable=!1,e.silentCheckSsoFallback&&(e.silentCheckSsoRedirectUri=!1)),document.body.removeChild(s),window.removeEventListener("message",h),r.setSuccess()))};window.addEventListener("message",h,!1)}else r.setSuccess();return y(r.promise,e.messageReceiveTimeout,"Timeout when waiting for 3rd party check iframe message.")}function z(r){if(!r||r=="default")return{login:function(m){return window.location.assign(e.createLoginUrl(m)),x().promise},logout:function(m){return window.location.replace(e.createLogoutUrl(m)),x().promise},register:function(m){return window.location.assign(e.createRegisterUrl(m)),x().promise},accountManagement:function(){var m=e.createAccountUrl();if(typeof m<"u")window.location.href=m;else throw"Not supported by the OIDC server";return x().promise},redirectUri:function(m,g){return m&&m.redirectUri?m.redirectUri:e.redirectUri?e.redirectUri:location.href}};if(r=="cordova"){l.enable=!1;var s=function(m,g,A){return window.cordova&&window.cordova.InAppBrowser?window.cordova.InAppBrowser.open(m,g,A):window.open(m,g,A)},h=function(m){return m&&m.cordovaOptions?Object.keys(m.cordovaOptions).reduce(function(g,A){return g[A]=m.cordovaOptions[A],g},{}):{}},b=function(m){return Object.keys(m).reduce(function(g,A){return g.push(A+"="+m[A]),g},[]).join(",")},f=function(m){var g=h(m);return g.location="no",m&&m.prompt=="none"&&(g.hidden="yes"),b(g)},k=function(){return e.redirectUri||"http://localhost"};return{login:function(m){var g=x(),A=f(m),S=e.createLoginUrl(m),P=s(S,"_blank",A),$=!1,he=!1,ye=function(){he=!0,P.close()};return P.addEventListener("loadstart",function(ie){if(ie.url.indexOf(k())==0){var We=w(ie.url);fe(We,g),ye(),$=!0}}),P.addEventListener("loaderror",function(ie){if(!$)if(ie.url.indexOf(k())==0){var We=w(ie.url);fe(We,g),ye(),$=!0}else g.setError(),ye()}),P.addEventListener("exit",function(ie){he||g.setError({reason:"closed_by_user"})}),g.promise},logout:function(m){var g=x(),A=e.createLogoutUrl(m),S=s(A,"_blank","location=no,hidden=yes,clearcache=yes"),P;return S.addEventListener("loadstart",function($){$.url.indexOf(k())==0&&S.close()}),S.addEventListener("loaderror",function($){$.url.indexOf(k())==0||(P=!0),S.close()}),S.addEventListener("exit",function($){P?g.setError():(e.clearToken(),g.setSuccess())}),g.promise},register:function(m){var g=x(),A=e.createRegisterUrl(),S=f(m),P=s(A,"_blank",S);return P.addEventListener("loadstart",function($){if($.url.indexOf(k())==0){P.close();var he=w($.url);fe(he,g)}}),g.promise},accountManagement:function(){var m=e.createAccountUrl();if(typeof m<"u"){var g=s(m,"_blank","location=no");g.addEventListener("loadstart",function(A){A.url.indexOf(k())==0&&g.close()})}else throw"Not supported by the OIDC server"},redirectUri:function(m){return k()}}}if(r=="cordova-native")return l.enable=!1,{login:function(m){var g=x(),A=e.createLoginUrl(m);return universalLinks.subscribe("keycloak",function(S){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var P=w(S.url);fe(P,g)}),window.cordova.plugins.browsertab.openUrl(A),g.promise},logout:function(m){var g=x(),A=e.createLogoutUrl(m);return universalLinks.subscribe("keycloak",function(S){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close(),e.clearToken(),g.setSuccess()}),window.cordova.plugins.browsertab.openUrl(A),g.promise},register:function(m){var g=x(),A=e.createRegisterUrl(m);return universalLinks.subscribe("keycloak",function(S){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var P=w(S.url);fe(P,g)}),window.cordova.plugins.browsertab.openUrl(A),g.promise},accountManagement:function(){var m=e.createAccountUrl();if(typeof m<"u")window.cordova.plugins.browsertab.openUrl(m);else throw"Not supported by the OIDC server"},redirectUri:function(m){return m&&m.redirectUri?m.redirectUri:e.redirectUri?e.redirectUri:"http://localhost"}};throw"invalid adapter type: "+r}var q=function(){if(!(this instanceof q))return new q;localStorage.setItem("kc-test","test"),localStorage.removeItem("kc-test");var r=this;function s(){for(var h=new Date().getTime(),b=0;b<localStorage.length;b++){var f=localStorage.key(b);if(f&&f.indexOf("kc-callback-")==0){var k=localStorage.getItem(f);if(k)try{var m=JSON.parse(k).expires;(!m||m<h)&&localStorage.removeItem(f)}catch{localStorage.removeItem(f)}}}}r.get=function(h){if(h){var b="kc-callback-"+h,f=localStorage.getItem(b);return f&&(localStorage.removeItem(b),f=JSON.parse(f)),s(),f}},r.add=function(h){s();var b="kc-callback-"+h.state;h.expires=new Date().getTime()+60*60*1e3,localStorage.setItem(b,JSON.stringify(h))}},se=function(){if(!(this instanceof se))return new se;var r=this;r.get=function(f){if(f){var k=h("kc-callback-"+f);if(b("kc-callback-"+f,"",s(-100)),k)return JSON.parse(k)}},r.add=function(f){b("kc-callback-"+f.state,JSON.stringify(f),s(60))},r.removeItem=function(f){b(f,"",s(-100))};var s=function(f){var k=new Date;return k.setTime(k.getTime()+f*60*1e3),k},h=function(f){for(var k=f+"=",m=document.cookie.split(";"),g=0;g<m.length;g++){for(var A=m[g];A.charAt(0)==" ";)A=A.substring(1);if(A.indexOf(k)==0)return A.substring(k.length,A.length)}return""},b=function(f,k,m){var g=f+"="+k+"; expires="+m.toUTCString()+"; ";document.cookie=g}};function U(){try{return new q}catch{}return new se}function le(r){return function(){e.enableLogging&&r.apply(console,Array.prototype.slice.call(arguments))}}}const Xe=new Mt,Zn=(t,e)=>{Xe.init({onLoad:"login-required"}).then(async n=>{n&&await Gn(),t()}).catch(n=>{e(n)})},Gn=async()=>{const t=await Xe.loadUserInfo();K.User.email=t.email??"",K.User.emailVerified=t.email_verified===!0,K.User.firstName=t.given_name??"",K.User.lastName=t.family_name??"",K.User.name=t.name??"",K.User.sub=t.sub??"",K.User.username=t.preferred_username??"",K.User.roles=[...t.role??[]],K.User.groups=[...t.group??[]],K.User.IsInRole=e=>K.User.roles.includes(e)},K={Instance:Xe,User:{},CallLogin:Zn,CallLogout:()=>{Xe.logout({redirectUri:location.origin}).then(()=>{sessionStorage.removeItem("user-info")})}},Ot="SweetAlert2:",Qn=t=>{const e=[];for(let n=0;n<t.length;n++)e.indexOf(t[n])===-1&&e.push(t[n]);return e},ft=t=>t.charAt(0).toUpperCase()+t.slice(1),ee=t=>Array.prototype.slice.call(t),Z=t=>{console.warn(`${Ot} ${typeof t=="object"?t.join(" "):t}`)},ve=t=>{console.error(`${Ot} ${t}`)},Rt=[],eo=t=>{Rt.includes(t)||(Rt.push(t),Z(t))},to=(t,e)=>{eo(`"${t}" is deprecated and will be removed in the next major release. Please use "${e}" instead.`)},Ze=t=>typeof t=="function"?t():t,ht=t=>t&&typeof t.toPromise=="function",Oe=t=>ht(t)?t.toPromise():Promise.resolve(t),pt=t=>t&&Promise.resolve(t)===t,Be={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconColor:void 0,iconHtml:void 0,template:void 0,toast:!1,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:{},target:"body",color:void 0,backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showDenyButton:!1,showCancelButton:!1,preConfirm:void 0,preDeny:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,denyButtonText:"No",denyButtonAriaLabel:"",denyButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusDeny:!1,focusCancel:!1,returnFocus:!0,showCloseButton:!1,closeButtonHtml:"×",closeButtonAriaLabel:"Close this dialog",loaderHtml:"",showLoaderOnConfirm:!1,showLoaderOnDeny:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputLabel:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,returnInputValueOnDeny:!1,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,willOpen:void 0,didOpen:void 0,didRender:void 0,willClose:void 0,didClose:void 0,didDestroy:void 0,scrollbarPadding:!0},no=["allowEscapeKey","allowOutsideClick","background","buttonsStyling","cancelButtonAriaLabel","cancelButtonColor","cancelButtonText","closeButtonAriaLabel","closeButtonHtml","color","confirmButtonAriaLabel","confirmButtonColor","confirmButtonText","currentProgressStep","customClass","denyButtonAriaLabel","denyButtonColor","denyButtonText","didClose","didDestroy","footer","hideClass","html","icon","iconColor","iconHtml","imageAlt","imageHeight","imageUrl","imageWidth","preConfirm","preDeny","progressSteps","returnFocus","reverseButtons","showCancelButton","showCloseButton","showConfirmButton","showDenyButton","text","title","titleText","willClose"],oo={},ro=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],Vt=t=>Object.prototype.hasOwnProperty.call(Be,t),Nt=t=>no.indexOf(t)!==-1,mt=t=>oo[t],so=t=>{Vt(t)||Z(`Unknown parameter "${t}"`)},io=t=>{ro.includes(t)&&Z(`The parameter "${t}" is incompatible with toasts`)},ao=t=>{mt(t)&&to(t,mt(t))},co=t=>{!t.backdrop&&t.allowOutsideClick&&Z('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');for(const e in t)so(e),t.toast&&io(e),ao(e)},lo="swal2-",Ht=t=>{const e={};for(const n in t)e[t[n]]=lo+t[n];return e},c=Ht(["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","default-outline","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error"]),Re=Ht(["success","warning","info","question","error"]),W=()=>document.body.querySelector(`.${c.container}`),Ve=t=>{const e=W();return e?e.querySelector(t):null},oe=t=>Ve(`.${t}`),M=()=>oe(c.popup),Ne=()=>oe(c.icon),jt=()=>oe(c.title),Ge=()=>oe(c["html-container"]),Dt=()=>oe(c.image),zt=()=>oe(c["progress-steps"]),Qe=()=>oe(c["validation-message"]),ae=()=>Ve(`.${c.actions} .${c.confirm}`),ge=()=>Ve(`.${c.actions} .${c.deny}`),uo=()=>oe(c["input-label"]),Pe=()=>Ve(`.${c.loader}`),ke=()=>Ve(`.${c.actions} .${c.cancel}`),He=()=>oe(c.actions),qt=()=>oe(c.footer),et=()=>oe(c["timer-progress-bar"]),gt=()=>oe(c.close),fo=`
|
|
17
14
|
a[href],
|
|
18
15
|
area[href],
|
|
19
16
|
input:not([disabled]),
|
|
@@ -28,53 +25,55 @@ For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_m
|
|
|
28
25
|
audio[controls],
|
|
29
26
|
video[controls],
|
|
30
27
|
summary
|
|
31
|
-
`,
|
|
32
|
-
<div aria-labelledby="
|
|
33
|
-
<button type="button" class="
|
|
34
|
-
<ul class="
|
|
35
|
-
<div class="
|
|
36
|
-
<img class="
|
|
37
|
-
<h2 class="
|
|
38
|
-
<div class="
|
|
39
|
-
<input class="
|
|
40
|
-
<input type="file" class="
|
|
41
|
-
<div class="
|
|
28
|
+
`,bt=()=>{const t=ee(M().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort((n,o)=>{const a=parseInt(n.getAttribute("tabindex")),l=parseInt(o.getAttribute("tabindex"));return a>l?1:a<l?-1:0}),e=ee(M().querySelectorAll(fo)).filter(n=>n.getAttribute("tabindex")!=="-1");return Qn(t.concat(e)).filter(n=>te(n))},yt=()=>pe(document.body,c.shown)&&!pe(document.body,c["toast-shown"])&&!pe(document.body,c["no-backdrop"]),tt=()=>M()&&pe(M(),c.toast),ho=()=>M().hasAttribute("data-loading"),Te={previousBodyPadding:null},J=(t,e)=>{if(t.textContent="",e){const o=new DOMParser().parseFromString(e,"text/html");ee(o.querySelector("head").childNodes).forEach(a=>{t.appendChild(a)}),ee(o.querySelector("body").childNodes).forEach(a=>{t.appendChild(a)})}},pe=(t,e)=>{if(!e)return!1;const n=e.split(/\s+/);for(let o=0;o<n.length;o++)if(!t.classList.contains(n[o]))return!1;return!0},po=(t,e)=>{ee(t.classList).forEach(n=>{!Object.values(c).includes(n)&&!Object.values(Re).includes(n)&&!Object.values(e.showClass).includes(n)&&t.classList.remove(n)})},re=(t,e,n)=>{if(po(t,e),e.customClass&&e.customClass[n]){if(typeof e.customClass[n]!="string"&&!e.customClass[n].forEach)return Z(`Invalid type of customClass.${n}! Expected string or iterable object, got "${typeof e.customClass[n]}"`);L(t,e.customClass[n])}},wt=(t,e)=>{if(!e)return null;switch(e){case"select":case"textarea":case"file":return t.querySelector(`.${c.popup} > .${c[e]}`);case"checkbox":return t.querySelector(`.${c.popup} > .${c.checkbox} input`);case"radio":return t.querySelector(`.${c.popup} > .${c.radio} input:checked`)||t.querySelector(`.${c.popup} > .${c.radio} input:first-child`);case"range":return t.querySelector(`.${c.popup} > .${c.range} input`);default:return t.querySelector(`.${c.popup} > .${c.input}`)}},Kt=t=>{if(t.focus(),t.type!=="file"){const e=t.value;t.value="",t.value=e}},Wt=(t,e,n)=>{!t||!e||(typeof e=="string"&&(e=e.split(/\s+/).filter(Boolean)),e.forEach(o=>{Array.isArray(t)?t.forEach(a=>{n?a.classList.add(o):a.classList.remove(o)}):n?t.classList.add(o):t.classList.remove(o)}))},L=(t,e)=>{Wt(t,e,!0)},de=(t,e)=>{Wt(t,e,!1)},be=(t,e)=>{const n=ee(t.childNodes);for(let o=0;o<n.length;o++)if(pe(n[o],e))return n[o]},je=(t,e,n)=>{n===`${parseInt(n)}`&&(n=parseInt(n)),n||parseInt(n)===0?t.style[e]=typeof n=="number"?`${n}px`:n:t.style.removeProperty(e)},D=(t,e="flex")=>{t.style.display=e},Y=t=>{t.style.display="none"},Jt=(t,e,n,o)=>{const a=t.querySelector(e);a&&(a.style[n]=o)},nt=(t,e,n)=>{e?D(t,n):Y(t)},te=t=>!!(t&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)),mo=()=>!te(ae())&&!te(ge())&&!te(ke()),Yt=t=>t.scrollHeight>t.clientHeight,Xt=t=>{const e=window.getComputedStyle(t),n=parseFloat(e.getPropertyValue("animation-duration")||"0"),o=parseFloat(e.getPropertyValue("transition-duration")||"0");return n>0||o>0},vt=(t,e=!1)=>{const n=et();te(n)&&(e&&(n.style.transition="none",n.style.width="100%"),setTimeout(()=>{n.style.transition=`width ${t/1e3}s linear`,n.style.width="0%"},10))},go=()=>{const t=et(),e=parseInt(window.getComputedStyle(t).width);t.style.removeProperty("transition"),t.style.width="100%";const n=parseInt(window.getComputedStyle(t).width),o=e/n*100;t.style.removeProperty("transition"),t.style.width=`${o}%`},Zt=()=>typeof window>"u"||typeof document>"u",bo=100,B={},yo=()=>{B.previousActiveElement&&B.previousActiveElement.focus?(B.previousActiveElement.focus(),B.previousActiveElement=null):document.body&&document.body.focus()},wo=t=>new Promise(e=>{if(!t)return e();const n=window.scrollX,o=window.scrollY;B.restoreFocusTimeout=setTimeout(()=>{yo(),e()},bo),window.scrollTo(n,o)}),vo=`
|
|
29
|
+
<div aria-labelledby="${c.title}" aria-describedby="${c["html-container"]}" class="${c.popup}" tabindex="-1">
|
|
30
|
+
<button type="button" class="${c.close}"></button>
|
|
31
|
+
<ul class="${c["progress-steps"]}"></ul>
|
|
32
|
+
<div class="${c.icon}"></div>
|
|
33
|
+
<img class="${c.image}" />
|
|
34
|
+
<h2 class="${c.title}" id="${c.title}"></h2>
|
|
35
|
+
<div class="${c["html-container"]}" id="${c["html-container"]}"></div>
|
|
36
|
+
<input class="${c.input}" />
|
|
37
|
+
<input type="file" class="${c.file}" />
|
|
38
|
+
<div class="${c.range}">
|
|
42
39
|
<input type="range" />
|
|
43
40
|
<output></output>
|
|
44
41
|
</div>
|
|
45
|
-
<select class="
|
|
46
|
-
<div class="
|
|
47
|
-
<label for="
|
|
42
|
+
<select class="${c.select}"></select>
|
|
43
|
+
<div class="${c.radio}"></div>
|
|
44
|
+
<label for="${c.checkbox}" class="${c.checkbox}">
|
|
48
45
|
<input type="checkbox" />
|
|
49
|
-
<span class="
|
|
46
|
+
<span class="${c.label}"></span>
|
|
50
47
|
</label>
|
|
51
|
-
<textarea class="
|
|
52
|
-
<div class="
|
|
53
|
-
<div class="
|
|
54
|
-
<div class="
|
|
55
|
-
<button type="button" class="
|
|
56
|
-
<button type="button" class="
|
|
57
|
-
<button type="button" class="
|
|
48
|
+
<textarea class="${c.textarea}"></textarea>
|
|
49
|
+
<div class="${c["validation-message"]}" id="${c["validation-message"]}"></div>
|
|
50
|
+
<div class="${c.actions}">
|
|
51
|
+
<div class="${c.loader}"></div>
|
|
52
|
+
<button type="button" class="${c.confirm}"></button>
|
|
53
|
+
<button type="button" class="${c.deny}"></button>
|
|
54
|
+
<button type="button" class="${c.cancel}"></button>
|
|
58
55
|
</div>
|
|
59
|
-
<div class="
|
|
60
|
-
<div class="
|
|
61
|
-
<div class="
|
|
56
|
+
<div class="${c.footer}"></div>
|
|
57
|
+
<div class="${c["timer-progress-bar-container"]}">
|
|
58
|
+
<div class="${c["timer-progress-bar"]}"></div>
|
|
62
59
|
</div>
|
|
63
60
|
</div>
|
|
64
|
-
|
|
61
|
+
`.replace(/(^|\n)\s*/g,""),ko=()=>{const t=W();return t?(t.remove(),de([document.documentElement,document.body],[c["no-backdrop"],c["toast-shown"],c["has-column"]]),!0):!1},xe=()=>{B.currentInstance.resetValidationMessage()},xo=()=>{const t=M(),e=be(t,c.input),n=be(t,c.file),o=t.querySelector(`.${c.range} input`),a=t.querySelector(`.${c.range} output`),l=be(t,c.select),C=t.querySelector(`.${c.checkbox} input`),_=be(t,c.textarea);e.oninput=xe,n.onchange=xe,l.onchange=xe,C.onchange=xe,_.oninput=xe,o.oninput=()=>{xe(),a.value=o.value},o.onchange=()=>{xe(),o.nextSibling.value=o.value}},Co=t=>typeof t=="string"?document.querySelector(t):t,Ao=t=>{const e=M();e.setAttribute("role",t.toast?"alert":"dialog"),e.setAttribute("aria-live",t.toast?"polite":"assertive"),t.toast||e.setAttribute("aria-modal","true")},So=t=>{window.getComputedStyle(t).direction==="rtl"&&L(W(),c.rtl)},_o=t=>{const e=ko();if(Zt()){ve("SweetAlert2 requires document to initialize");return}const n=document.createElement("div");n.className=c.container,e&&L(n,c["no-transition"]),J(n,vo);const o=Co(t.target);o.appendChild(n),Ao(t),So(o),xo()},kt=(t,e)=>{t instanceof HTMLElement?e.appendChild(t):typeof t=="object"?Eo(t,e):t&&J(e,t)},Eo=(t,e)=>{t.jquery?Bo(e,t):J(e,t.toString())},Bo=(t,e)=>{if(t.textContent="",0 in e)for(let n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0))},De=(()=>{if(Zt())return!1;const t=document.createElement("div"),e={WebkitAnimation:"webkitAnimationEnd",animation:"animationend"};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&typeof t.style[n]<"u")return e[n];return!1})(),Po=()=>{const t=document.createElement("div");t.className=c["scrollbar-measure"],document.body.appendChild(t);const e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e},To=(t,e)=>{const n=He(),o=Pe();!e.showConfirmButton&&!e.showDenyButton&&!e.showCancelButton?Y(n):D(n),re(n,e,"actions"),Io(n,o,e),J(o,e.loaderHtml),re(o,e,"loader")};function Io(t,e,n){const o=ae(),a=ge(),l=ke();xt(o,"confirm",n),xt(a,"deny",n),xt(l,"cancel",n),Fo(o,a,l,n),n.reverseButtons&&(n.toast?(t.insertBefore(l,o),t.insertBefore(a,o)):(t.insertBefore(l,e),t.insertBefore(a,e),t.insertBefore(o,e)))}function Fo(t,e,n,o){if(!o.buttonsStyling)return de([t,e,n],c.styled);L([t,e,n],c.styled),o.confirmButtonColor&&(t.style.backgroundColor=o.confirmButtonColor,L(t,c["default-outline"])),o.denyButtonColor&&(e.style.backgroundColor=o.denyButtonColor,L(e,c["default-outline"])),o.cancelButtonColor&&(n.style.backgroundColor=o.cancelButtonColor,L(n,c["default-outline"]))}function xt(t,e,n){nt(t,n[`show${ft(e)}Button`],"inline-block"),J(t,n[`${e}ButtonText`]),t.setAttribute("aria-label",n[`${e}ButtonAriaLabel`]),t.className=c[e],re(t,n,`${e}Button`),L(t,n[`${e}ButtonClass`])}function Lo(t,e){typeof e=="string"?t.style.background=e:e||L([document.documentElement,document.body],c["no-backdrop"])}function Uo(t,e){e in c?L(t,c[e]):(Z('The "position" parameter is not valid, defaulting to "center"'),L(t,c.center))}function $o(t,e){if(e&&typeof e=="string"){const n=`grow-${e}`;n in c&&L(t,c[n])}}const Mo=(t,e)=>{const n=W();n&&(Lo(n,e.backdrop),Uo(n,e.position),$o(n,e.grow),re(n,e,"container"))},I={awaitingPromise:new WeakMap,promise:new WeakMap,innerParams:new WeakMap,domCache:new WeakMap},Oo=["input","file","range","select","radio","checkbox","textarea"],Ro=(t,e)=>{const n=M(),o=I.innerParams.get(t),a=!o||e.input!==o.input;Oo.forEach(l=>{const C=c[l],_=be(n,C);Ho(l,e.inputAttributes),_.className=C,a&&Y(_)}),e.input&&(a&&Vo(e),jo(e))},Vo=t=>{if(!G[t.input])return ve(`Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "${t.input}"`);const e=Gt(t.input),n=G[t.input](e,t);D(n),setTimeout(()=>{Kt(n)})},No=t=>{for(let e=0;e<t.attributes.length;e++){const n=t.attributes[e].name;["type","value","style"].includes(n)||t.removeAttribute(n)}},Ho=(t,e)=>{const n=wt(M(),t);if(n){No(n);for(const o in e)n.setAttribute(o,e[o])}},jo=t=>{const e=Gt(t.input);t.customClass&&L(e,t.customClass.input)},Ct=(t,e)=>{(!t.placeholder||e.inputPlaceholder)&&(t.placeholder=e.inputPlaceholder)},ze=(t,e,n)=>{if(n.inputLabel){t.id=c.input;const o=document.createElement("label"),a=c["input-label"];o.setAttribute("for",t.id),o.className=a,L(o,n.customClass.inputLabel),o.innerText=n.inputLabel,e.insertAdjacentElement("beforebegin",o)}},Gt=t=>{const e=c[t]?c[t]:c.input;return be(M(),e)},G={};G.text=G.email=G.password=G.number=G.tel=G.url=(t,e)=>(typeof e.inputValue=="string"||typeof e.inputValue=="number"?t.value=e.inputValue:pt(e.inputValue)||Z(`Unexpected type of inputValue! Expected "string", "number" or "Promise", got "${typeof e.inputValue}"`),ze(t,t,e),Ct(t,e),t.type=e.input,t),G.file=(t,e)=>(ze(t,t,e),Ct(t,e),t),G.range=(t,e)=>{const n=t.querySelector("input"),o=t.querySelector("output");return n.value=e.inputValue,n.type=e.input,o.value=e.inputValue,ze(n,t,e),t},G.select=(t,e)=>{if(t.textContent="",e.inputPlaceholder){const n=document.createElement("option");J(n,e.inputPlaceholder),n.value="",n.disabled=!0,n.selected=!0,t.appendChild(n)}return ze(t,t,e),t},G.radio=t=>(t.textContent="",t),G.checkbox=(t,e)=>{const n=wt(M(),"checkbox");n.value="1",n.id=c.checkbox,n.checked=!!e.inputValue;const o=t.querySelector("span");return J(o,e.inputPlaceholder),t},G.textarea=(t,e)=>{t.value=e.inputValue,Ct(t,e),ze(t,t,e);const n=o=>parseInt(window.getComputedStyle(o).marginLeft)+parseInt(window.getComputedStyle(o).marginRight);return setTimeout(()=>{if("MutationObserver"in window){const o=parseInt(window.getComputedStyle(M()).width),a=()=>{const l=t.offsetWidth+n(t);l>o?M().style.width=`${l}px`:M().style.width=null};new MutationObserver(a).observe(t,{attributes:!0,attributeFilter:["style"]})}}),t};const Do=(t,e)=>{const n=Ge();re(n,e,"htmlContainer"),e.html?(kt(e.html,n),D(n,"block")):e.text?(n.textContent=e.text,D(n,"block")):Y(n),Ro(t,e)},zo=(t,e)=>{const n=qt();nt(n,e.footer),e.footer&&kt(e.footer,n),re(n,e,"footer")},qo=(t,e)=>{const n=gt();J(n,e.closeButtonHtml),re(n,e,"closeButton"),nt(n,e.showCloseButton),n.setAttribute("aria-label",e.closeButtonAriaLabel)},Ko=(t,e)=>{const n=I.innerParams.get(t),o=Ne();if(n&&e.icon===n.icon){en(o,e),Qt(o,e);return}if(!e.icon&&!e.iconHtml)return Y(o);if(e.icon&&Object.keys(Re).indexOf(e.icon)===-1)return ve(`Unknown icon! Expected "success", "error", "warning", "info" or "question", got "${e.icon}"`),Y(o);D(o),en(o,e),Qt(o,e),L(o,e.showClass.icon)},Qt=(t,e)=>{for(const n in Re)e.icon!==n&&de(t,Re[n]);L(t,Re[e.icon]),Xo(t,e),Wo(),re(t,e,"icon")},Wo=()=>{const t=M(),e=window.getComputedStyle(t).getPropertyValue("background-color"),n=t.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix");for(let o=0;o<n.length;o++)n[o].style.backgroundColor=e},Jo=`
|
|
65
62
|
<div class="swal2-success-circular-line-left"></div>
|
|
66
63
|
<span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>
|
|
67
64
|
<div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>
|
|
68
65
|
<div class="swal2-success-circular-line-right"></div>
|
|
69
|
-
`,
|
|
66
|
+
`,Yo=`
|
|
70
67
|
<span class="swal2-x-mark">
|
|
71
68
|
<span class="swal2-x-mark-line-left"></span>
|
|
72
69
|
<span class="swal2-x-mark-line-right"></span>
|
|
73
70
|
</span>
|
|
74
|
-
`,
|
|
71
|
+
`,en=(t,e)=>{t.textContent="",e.iconHtml?J(t,tn(e.iconHtml)):e.icon==="success"?J(t,Jo):e.icon==="error"?J(t,Yo):J(t,tn({question:"?",warning:"!",info:"i"}[e.icon]))},Xo=(t,e)=>{if(e.iconColor){t.style.color=e.iconColor,t.style.borderColor=e.iconColor;for(const n of[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"])Jt(t,n,"backgroundColor",e.iconColor);Jt(t,".swal2-success-ring","borderColor",e.iconColor)}},tn=t=>`<div class="${c["icon-content"]}">${t}</div>`,Zo=(t,e)=>{const n=Dt();if(!e.imageUrl)return Y(n);D(n,""),n.setAttribute("src",e.imageUrl),n.setAttribute("alt",e.imageAlt),je(n,"width",e.imageWidth),je(n,"height",e.imageHeight),n.className=c.image,re(n,e,"image")},Go=t=>{const e=document.createElement("li");return L(e,c["progress-step"]),J(e,t),e},Qo=t=>{const e=document.createElement("li");return L(e,c["progress-step-line"]),t.progressStepsDistance&&(e.style.width=t.progressStepsDistance),e},er=(t,e)=>{const n=zt();if(!e.progressSteps||e.progressSteps.length===0)return Y(n);D(n),n.textContent="",e.currentProgressStep>=e.progressSteps.length&&Z("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),e.progressSteps.forEach((o,a)=>{const l=Go(o);if(n.appendChild(l),a===e.currentProgressStep&&L(l,c["active-progress-step"]),a!==e.progressSteps.length-1){const C=Qo(e);n.appendChild(C)}})},tr=(t,e)=>{const n=jt();nt(n,e.title||e.titleText,"block"),e.title&&kt(e.title,n),e.titleText&&(n.innerText=e.titleText),re(n,e,"title")},nr=(t,e)=>{const n=W(),o=M();e.toast?(je(n,"width",e.width),o.style.width="100%",o.insertBefore(Pe(),Ne())):je(o,"width",e.width),je(o,"padding",e.padding),e.color&&(o.style.color=e.color),e.background&&(o.style.background=e.background),Y(Qe()),or(o,e)},or=(t,e)=>{t.className=`${c.popup} ${te(t)?e.showClass.popup:""}`,e.toast?(L([document.documentElement,document.body],c["toast-shown"]),L(t,c.toast)):L(t,c.modal),re(t,e,"popup"),typeof e.customClass=="string"&&L(t,e.customClass),e.icon&&L(t,c[`icon-${e.icon}`])},nn=(t,e)=>{nr(t,e),Mo(t,e),er(t,e),Ko(t,e),Zo(t,e),tr(t,e),qo(t,e),Do(t,e),To(t,e),zo(t,e),typeof e.didRender=="function"&&e.didRender(M())},Ie=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),rr=()=>{ee(document.body.children).forEach(e=>{e===W()||e.contains(W())||(e.hasAttribute("aria-hidden")&&e.setAttribute("data-previous-aria-hidden",e.getAttribute("aria-hidden")),e.setAttribute("aria-hidden","true"))})},on=()=>{ee(document.body.children).forEach(e=>{e.hasAttribute("data-previous-aria-hidden")?(e.setAttribute("aria-hidden",e.getAttribute("data-previous-aria-hidden")),e.removeAttribute("data-previous-aria-hidden")):e.removeAttribute("aria-hidden")})},rn=["swal-title","swal-html","swal-footer"],sr=t=>{const e=typeof t.template=="string"?document.querySelector(t.template):t.template;if(!e)return{};const n=e.content;return fr(n),Object.assign(ir(n),ar(n),cr(n),lr(n),ur(n),dr(n,rn))},ir=t=>{const e={};return ee(t.querySelectorAll("swal-param")).forEach(n=>{Ce(n,["name","value"]);const o=n.getAttribute("name"),a=n.getAttribute("value");typeof Be[o]=="boolean"&&a==="false"&&(e[o]=!1),typeof Be[o]=="object"&&(e[o]=JSON.parse(a))}),e},ar=t=>{const e={};return ee(t.querySelectorAll("swal-button")).forEach(n=>{Ce(n,["type","color","aria-label"]);const o=n.getAttribute("type");e[`${o}ButtonText`]=n.innerHTML,e[`show${ft(o)}Button`]=!0,n.hasAttribute("color")&&(e[`${o}ButtonColor`]=n.getAttribute("color")),n.hasAttribute("aria-label")&&(e[`${o}ButtonAriaLabel`]=n.getAttribute("aria-label"))}),e},cr=t=>{const e={},n=t.querySelector("swal-image");return n&&(Ce(n,["src","width","height","alt"]),n.hasAttribute("src")&&(e.imageUrl=n.getAttribute("src")),n.hasAttribute("width")&&(e.imageWidth=n.getAttribute("width")),n.hasAttribute("height")&&(e.imageHeight=n.getAttribute("height")),n.hasAttribute("alt")&&(e.imageAlt=n.getAttribute("alt"))),e},lr=t=>{const e={},n=t.querySelector("swal-icon");return n&&(Ce(n,["type","color"]),n.hasAttribute("type")&&(e.icon=n.getAttribute("type")),n.hasAttribute("color")&&(e.iconColor=n.getAttribute("color")),e.iconHtml=n.innerHTML),e},ur=t=>{const e={},n=t.querySelector("swal-input");n&&(Ce(n,["type","label","placeholder","value"]),e.input=n.getAttribute("type")||"text",n.hasAttribute("label")&&(e.inputLabel=n.getAttribute("label")),n.hasAttribute("placeholder")&&(e.inputPlaceholder=n.getAttribute("placeholder")),n.hasAttribute("value")&&(e.inputValue=n.getAttribute("value")));const o=t.querySelectorAll("swal-input-option");return o.length&&(e.inputOptions={},ee(o).forEach(a=>{Ce(a,["value"]);const l=a.getAttribute("value"),C=a.innerHTML;e.inputOptions[l]=C})),e},dr=(t,e)=>{const n={};for(const o in e){const a=e[o],l=t.querySelector(a);l&&(Ce(l,[]),n[a.replace(/^swal-/,"")]=l.innerHTML.trim())}return n},fr=t=>{const e=rn.concat(["swal-param","swal-button","swal-image","swal-icon","swal-input","swal-input-option"]);ee(t.children).forEach(n=>{const o=n.tagName.toLowerCase();e.indexOf(o)===-1&&Z(`Unrecognized element <${o}>`)})},Ce=(t,e)=>{ee(t.attributes).forEach(n=>{e.indexOf(n.name)===-1&&Z([`Unrecognized attribute "${n.name}" on <${t.tagName.toLowerCase()}>.`,`${e.length?`Allowed attributes are: ${e.join(", ")}`:"To set the value, use HTML within the element."}`])})},sn={email:(t,e)=>/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid email address"),url:(t,e)=>/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid URL")};function hr(t){t.inputValidator||Object.keys(sn).forEach(e=>{t.input===e&&(t.inputValidator=sn[e])})}function pr(t){(!t.target||typeof t.target=="string"&&!document.querySelector(t.target)||typeof t.target!="string"&&!t.target.appendChild)&&(Z('Target parameter is not valid, defaulting to "body"'),t.target="body")}function mr(t){hr(t),t.showLoaderOnConfirm&&!t.preConfirm&&Z(`showLoaderOnConfirm is set to true, but preConfirm is not defined.
|
|
75
72
|
showLoaderOnConfirm should be used together with preConfirm, see usage example:
|
|
76
|
-
https://sweetalert2.github.io/#ajax-request`),
|
|
77
|
-
`).join("<br />")),So(e)}class mr{constructor(t,n){this.callback=t,this.remaining=n,this.running=!1,this.start()}start(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}stop(){return this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=new Date().getTime()-this.started.getTime()),this.remaining}increase(t){const n=this.running;return n&&this.stop(),this.remaining+=t,n&&this.start(),this.remaining}getTimerLeft(){return this.running&&(this.stop(),this.start()),this.remaining}isRunning(){return this.running}}const gr=()=>{Le.previousBodyPadding===null&&document.body.scrollHeight>window.innerHeight&&(Le.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight="".concat(Le.previousBodyPadding+Bo(),"px"))},br=()=>{Le.previousBodyPadding!==null&&(document.body.style.paddingRight="".concat(Le.previousBodyPadding,"px"),Le.previousBodyPadding=null)},wr=()=>{if((/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!xe(document.body,i.iosfix)){const t=document.body.scrollTop;document.body.style.top="".concat(t*-1,"px"),D(document.body,i.iosfix),vr(),yr()}},yr=()=>{const e=navigator.userAgent,t=!!e.match(/iPad/i)||!!e.match(/iPhone/i),n=!!e.match(/WebKit/i);t&&n&&!e.match(/CriOS/i)&&F().scrollHeight>window.innerHeight-44&&(T().style.paddingBottom="".concat(44,"px"))},vr=()=>{const e=T();let t;e.ontouchstart=n=>{t=kr(n)},e.ontouchmove=n=>{t&&(n.preventDefault(),n.stopPropagation())}},kr=e=>{const t=e.target,n=T();return xr(e)||Cr(e)?!1:t===n||!_t(n)&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"&&!(_t(te())&&te().contains(t))},xr=e=>e.touches&&e.touches.length&&e.touches[0].touchType==="stylus",Cr=e=>e.touches&&e.touches.length>1,Ar=()=>{if(xe(document.body,i.iosfix)){const e=parseInt(document.body.style.top,10);ve(document.body,i.iosfix),document.body.style.top="",document.body.scrollTop=e*-1}},Rt=10,Sr=e=>{const t=T(),n=F();typeof e.willOpen=="function"&&e.willOpen(n);const f=window.getComputedStyle(document.body).overflowY;Br(t,n,e),setTimeout(()=>{Er(t,n)},Rt),ne()&&(_r(t,e.scrollbarPadding,f),or()),!ye()&&!V.previousActiveElement&&(V.previousActiveElement=document.activeElement),typeof e.didOpen=="function"&&setTimeout(()=>e.didOpen(n)),ve(t,i["no-transition"])},Nt=e=>{const t=F();if(e.target!==t)return;const n=T();t.removeEventListener(He,Nt),n.style.overflowY="auto"},Er=(e,t)=>{He&&Bt(t)?(e.style.overflowY="hidden",t.addEventListener(He,Nt)):e.style.overflowY="auto"},_r=(e,t,n)=>{wr(),t&&n!=="hidden"&&gr(),setTimeout(()=>{e.scrollTop=0})},Br=(e,t,n)=>{D(e,n.showClass.backdrop),t.style.setProperty("opacity","0","important"),Q(t,"grid"),setTimeout(()=>{D(t,n.showClass.popup),t.style.removeProperty("opacity")},Rt),D([document.documentElement,document.body],i.shown),n.heightAuto&&n.backdrop&&!n.toast&&D([document.documentElement,document.body],i["height-auto"])},Ue=e=>{let t=F();t||new Xe,t=F();const n=w();ye()?re(G()):Pr(t,e),Q(n),t.setAttribute("data-loading",!0),t.setAttribute("aria-busy",!0),t.focus()},Pr=(e,t)=>{const n=_(),r=w();!t&&le(b())&&(t=b()),Q(n),t&&(re(t),r.setAttribute("data-button-to-replace",t.className)),r.parentNode.insertBefore(r,t),D([e,n],i.loading)},Tr=(e,t)=>{t.input==="select"||t.input==="radio"?Mr(e,t):["text","email","number","tel","textarea"].includes(t.input)&&(ae(t.inputValue)||Ce(t.inputValue))&&(Ue(b()),Or(e,t))},Ir=(e,t)=>{const n=e.getInput();if(!n)return null;switch(t.input){case"checkbox":return Lr(n);case"radio":return Fr(n);case"file":return Ur(n);default:return t.inputAutoTrim?n.value.trim():n.value}},Lr=e=>e.checked?1:0,Fr=e=>e.checked?e.value:null,Ur=e=>e.files.length?e.getAttribute("multiple")!==null?e.files:e.files[0]:null,Mr=(e,t)=>{const n=F(),r=f=>Vr[t.input](n,at(f),t);ae(t.inputOptions)||Ce(t.inputOptions)?(Ue(b()),j(t.inputOptions).then(f=>{e.hideLoading(),r(f)})):typeof t.inputOptions=="object"?r(t.inputOptions):O("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(typeof t.inputOptions))},Or=(e,t)=>{const n=e.getInput();re(n),j(t.inputValue).then(r=>{n.value=t.input==="number"?parseFloat(r)||0:"".concat(r),Q(n),n.focus(),e.hideLoading()}).catch(r=>{O("Error in inputValue promise: ".concat(r)),n.value="",Q(n),n.focus(),e.hideLoading()})},Vr={select:(e,t,n)=>{const r=Ae(e,i.select),f=(P,Y,ue)=>{const se=document.createElement("option");se.value=ue,oe(se,Y),se.selected=Ht(ue,n.inputValue),P.appendChild(se)};t.forEach(P=>{const Y=P[0],ue=P[1];if(Array.isArray(ue)){const se=document.createElement("optgroup");se.label=Y,se.disabled=!1,r.appendChild(se),ue.forEach(Oe=>f(se,Oe[1],Oe[0]))}else f(r,ue,Y)}),r.focus()},radio:(e,t,n)=>{const r=Ae(e,i.radio);t.forEach(P=>{const Y=P[0],ue=P[1],se=document.createElement("input"),Oe=document.createElement("label");se.type="radio",se.name=i.radio,se.value=Y,Ht(Y,n.inputValue)&&(se.checked=!0);const pt=document.createElement("span");oe(pt,ue),pt.className=i.label,Oe.appendChild(se),Oe.appendChild(pt),r.appendChild(Oe)});const f=r.querySelectorAll("input");f.length&&f[0].focus()}},at=e=>{const t=[];return typeof Map<"u"&&e instanceof Map?e.forEach((n,r)=>{let f=n;typeof f=="object"&&(f=at(f)),t.push([r,f])}):Object.keys(e).forEach(n=>{let r=e[n];typeof r=="object"&&(r=at(r)),t.push([n,r])}),t},Ht=(e,t)=>t&&t.toString()===e.toString();function Dt(){const e=R.innerParams.get(this);if(!e)return;const t=R.domCache.get(this);re(t.loader),ye()?e.icon&&Q(G()):Rr(t),ve([t.popup,t.actions],i.loading),t.popup.removeAttribute("aria-busy"),t.popup.removeAttribute("data-loading"),t.confirmButton.disabled=!1,t.denyButton.disabled=!1,t.cancelButton.disabled=!1}const Rr=e=>{const t=e.popup.getElementsByClassName(e.loader.getAttribute("data-button-to-replace"));t.length?Q(t[0],"inline-block"):po()&&re(e.actions)};function Nr(e){const t=R.innerParams.get(e||this),n=R.domCache.get(e||this);return n?nt(n.popup,t.input):null}var je={swalPromiseResolve:new WeakMap,swalPromiseReject:new WeakMap};const Hr=()=>le(F()),jt=()=>b()&&b().click(),Dr=()=>u()&&u().click(),jr=()=>y()&&y().click(),zt=e=>{e.keydownTarget&&e.keydownHandlerAdded&&(e.keydownTarget.removeEventListener("keydown",e.keydownHandler,{capture:e.keydownListenerCapture}),e.keydownHandlerAdded=!1)},zr=(e,t,n,r)=>{zt(t),n.toast||(t.keydownHandler=f=>qr(e,f,r),t.keydownTarget=n.keydownListenerCapture?window:F(),t.keydownListenerCapture=n.keydownListenerCapture,t.keydownTarget.addEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0)},ct=(e,t,n)=>{const r=pe();if(r.length)return t=t+n,t===r.length?t=0:t===-1&&(t=r.length-1),r[t].focus();F().focus()},$t=["ArrowRight","ArrowDown"],$r=["ArrowLeft","ArrowUp"],qr=(e,t,n)=>{const r=R.innerParams.get(e);r&&(t.isComposing||t.keyCode===229||(r.stopKeydownPropagation&&t.stopPropagation(),t.key==="Enter"?Wr(e,t,r):t.key==="Tab"?Kr(t,r):[...$t,...$r].includes(t.key)?Jr(t.key):t.key==="Escape"&&Yr(t,r,n)))},Wr=(e,t,n)=>{if(X(n.allowEnterKey)&&t.target&&e.getInput()&&t.target.outerHTML===e.getInput().outerHTML){if(["textarea","file"].includes(n.input))return;jt(),t.preventDefault()}},Kr=(e,t)=>{const n=e.target,r=pe();let f=-1;for(let P=0;P<r.length;P++)if(n===r[P]){f=P;break}e.shiftKey?ct(t,f,-1):ct(t,f,1),e.stopPropagation(),e.preventDefault()},Jr=e=>{const t=b(),n=u(),r=y();if(![t,n,r].includes(document.activeElement))return;const f=$t.includes(e)?"nextElementSibling":"previousElementSibling";let P=document.activeElement;for(let Y=0;Y<_().children.length;Y++){if(P=P[f],!P)return;if(le(P)&&P instanceof HTMLButtonElement)break}P instanceof HTMLButtonElement&&P.focus()},Yr=(e,t,n)=>{X(t.allowEscapeKey)&&(e.preventDefault(),n(Fe.esc))};function qt(e,t,n,r){ye()?Wt(e,r):(wo(n).then(()=>Wt(e,r)),zt(V)),/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?(t.setAttribute("style","display:none !important"),t.removeAttribute("class"),t.innerHTML=""):t.remove(),ne()&&(br(),Ar(),Mt()),Xr()}function Xr(){ve([document.documentElement,document.body],[i.shown,i["height-auto"],i["no-backdrop"],i["toast-shown"]])}function Je(e){e=es(e);const t=je.swalPromiseResolve.get(this),n=Gr(this);this.isAwaitingPromise()?e.isDismissed||(ze(this),t(e)):n&&t(e)}function Zr(){return!!R.awaitingPromise.get(this)}const Gr=e=>{const t=F();if(!t)return!1;const n=R.innerParams.get(e);if(!n||xe(t,n.hideClass.popup))return!1;ve(t,n.showClass.popup),D(t,n.hideClass.popup);const r=T();return ve(r,n.showClass.backdrop),D(r,n.hideClass.backdrop),ts(e,t,n),!0};function Qr(e){const t=je.swalPromiseReject.get(this);ze(this),t&&t(e)}const ze=e=>{e.isAwaitingPromise()&&(R.awaitingPromise.delete(e),R.innerParams.get(e)||e._destroy())},es=e=>typeof e>"u"?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},e),ts=(e,t,n)=>{const r=T(),f=He&&Bt(t);typeof n.willClose=="function"&&n.willClose(t),f?ns(e,t,r,n.returnFocus,n.didClose):qt(e,r,n.returnFocus,n.didClose)},ns=(e,t,n,r,f)=>{V.swalCloseEventFinishedCallback=qt.bind(null,e,n,r,f),t.addEventListener(He,function(P){P.target===t&&(V.swalCloseEventFinishedCallback(),delete V.swalCloseEventFinishedCallback)})},Wt=(e,t)=>{setTimeout(()=>{typeof t=="function"&&t.bind(e.params)(),e._destroy()})};function Kt(e,t,n){const r=R.domCache.get(e);t.forEach(f=>{r[f].disabled=n})}function Jt(e,t){if(!e)return!1;if(e.type==="radio"){const r=e.parentNode.parentNode.querySelectorAll("input");for(let f=0;f<r.length;f++)r[f].disabled=t}else e.disabled=t}function os(){Kt(this,["confirmButton","denyButton","cancelButton"],!1)}function rs(){Kt(this,["confirmButton","denyButton","cancelButton"],!0)}function ss(){return Jt(this.getInput(),!1)}function is(){return Jt(this.getInput(),!0)}function as(e){const t=R.domCache.get(this),n=R.innerParams.get(this);oe(t.validationMessage,e),t.validationMessage.className=i["validation-message"],n.customClass&&n.customClass.validationMessage&&D(t.validationMessage,n.customClass.validationMessage),Q(t.validationMessage);const r=this.getInput();r&&(r.setAttribute("aria-invalid",!0),r.setAttribute("aria-describedby",i["validation-message"]),At(r),D(r,i.inputerror))}function cs(){const e=R.domCache.get(this);e.validationMessage&&re(e.validationMessage);const t=this.getInput();t&&(t.removeAttribute("aria-invalid"),t.removeAttribute("aria-describedby"),ve(t,i.inputerror))}function ls(){return R.domCache.get(this).progressSteps}function us(e){const t=F(),n=R.innerParams.get(this);if(!t||xe(t,n.hideClass.popup))return I("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");const r=ds(e),f=Object.assign({},n,r);Ut(this,f),R.innerParams.set(this,f),Object.defineProperties(this,{params:{value:Object.assign({},this.params,e),writable:!1,enumerable:!0}})}const ds=e=>{const t={};return Object.keys(e).forEach(n=>{we(n)?t[n]=e[n]:I('Invalid parameter to update: "'.concat(n,`". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js
|
|
73
|
+
https://sweetalert2.github.io/#ajax-request`),pr(t),typeof t.title=="string"&&(t.title=t.title.split(`
|
|
74
|
+
`).join("<br />")),_o(t)}class gr{constructor(e,n){this.callback=e,this.remaining=n,this.running=!1,this.start()}start(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}stop(){return this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=new Date().getTime()-this.started.getTime()),this.remaining}increase(e){const n=this.running;return n&&this.stop(),this.remaining+=e,n&&this.start(),this.remaining}getTimerLeft(){return this.running&&(this.stop(),this.start()),this.remaining}isRunning(){return this.running}}const br=()=>{Te.previousBodyPadding===null&&document.body.scrollHeight>window.innerHeight&&(Te.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight=`${Te.previousBodyPadding+Po()}px`)},yr=()=>{Te.previousBodyPadding!==null&&(document.body.style.paddingRight=`${Te.previousBodyPadding}px`,Te.previousBodyPadding=null)},wr=()=>{if((/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!pe(document.body,c.iosfix)){const e=document.body.scrollTop;document.body.style.top=`${e*-1}px`,L(document.body,c.iosfix),kr(),vr()}},vr=()=>{const t=navigator.userAgent,e=!!t.match(/iPad/i)||!!t.match(/iPhone/i),n=!!t.match(/WebKit/i);e&&n&&!t.match(/CriOS/i)&&M().scrollHeight>window.innerHeight-44&&(W().style.paddingBottom="44px")},kr=()=>{const t=W();let e;t.ontouchstart=n=>{e=xr(n)},t.ontouchmove=n=>{e&&(n.preventDefault(),n.stopPropagation())}},xr=t=>{const e=t.target,n=W();return Cr(t)||Ar(t)?!1:e===n||!Yt(n)&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"&&!(Yt(Ge())&&Ge().contains(e))},Cr=t=>t.touches&&t.touches.length&&t.touches[0].touchType==="stylus",Ar=t=>t.touches&&t.touches.length>1,Sr=()=>{if(pe(document.body,c.iosfix)){const t=parseInt(document.body.style.top,10);de(document.body,c.iosfix),document.body.style.top="",document.body.scrollTop=t*-1}},an=10,_r=t=>{const e=W(),n=M();typeof t.willOpen=="function"&&t.willOpen(n);const a=window.getComputedStyle(document.body).overflowY;Pr(e,n,t),setTimeout(()=>{Er(e,n)},an),yt()&&(Br(e,t.scrollbarPadding,a),rr()),!tt()&&!B.previousActiveElement&&(B.previousActiveElement=document.activeElement),typeof t.didOpen=="function"&&setTimeout(()=>t.didOpen(n)),de(e,c["no-transition"])},cn=t=>{const e=M();if(t.target!==e)return;const n=W();e.removeEventListener(De,cn),n.style.overflowY="auto"},Er=(t,e)=>{De&&Xt(e)?(t.style.overflowY="hidden",e.addEventListener(De,cn)):t.style.overflowY="auto"},Br=(t,e,n)=>{wr(),e&&n!=="hidden"&&br(),setTimeout(()=>{t.scrollTop=0})},Pr=(t,e,n)=>{L(t,n.showClass.backdrop),e.style.setProperty("opacity","0","important"),D(e,"grid"),setTimeout(()=>{L(e,n.showClass.popup),e.style.removeProperty("opacity")},an),L([document.documentElement,document.body],c.shown),n.heightAuto&&n.backdrop&&!n.toast&&L([document.documentElement,document.body],c["height-auto"])},Fe=t=>{let e=M();e||new Ue,e=M();const n=Pe();tt()?Y(Ne()):Tr(e,t),D(n),e.setAttribute("data-loading",!0),e.setAttribute("aria-busy",!0),e.focus()},Tr=(t,e)=>{const n=He(),o=Pe();!e&&te(ae())&&(e=ae()),D(n),e&&(Y(e),o.setAttribute("data-button-to-replace",e.className)),o.parentNode.insertBefore(o,e),L([t,n],c.loading)},Ir=(t,e)=>{e.input==="select"||e.input==="radio"?Mr(t,e):["text","email","number","tel","textarea"].includes(e.input)&&(ht(e.inputValue)||pt(e.inputValue))&&(Fe(ae()),Or(t,e))},Fr=(t,e)=>{const n=t.getInput();if(!n)return null;switch(e.input){case"checkbox":return Lr(n);case"radio":return Ur(n);case"file":return $r(n);default:return e.inputAutoTrim?n.value.trim():n.value}},Lr=t=>t.checked?1:0,Ur=t=>t.checked?t.value:null,$r=t=>t.files.length?t.getAttribute("multiple")!==null?t.files:t.files[0]:null,Mr=(t,e)=>{const n=M(),o=a=>Rr[e.input](n,At(a),e);ht(e.inputOptions)||pt(e.inputOptions)?(Fe(ae()),Oe(e.inputOptions).then(a=>{t.hideLoading(),o(a)})):typeof e.inputOptions=="object"?o(e.inputOptions):ve(`Unexpected type of inputOptions! Expected object, Map or Promise, got ${typeof e.inputOptions}`)},Or=(t,e)=>{const n=t.getInput();Y(n),Oe(e.inputValue).then(o=>{n.value=e.input==="number"?parseFloat(o)||0:`${o}`,D(n),n.focus(),t.hideLoading()}).catch(o=>{ve(`Error in inputValue promise: ${o}`),n.value="",D(n),n.focus(),t.hideLoading()})},Rr={select:(t,e,n)=>{const o=be(t,c.select),a=(l,C,_)=>{const u=document.createElement("option");u.value=_,J(u,C),u.selected=ln(_,n.inputValue),l.appendChild(u)};e.forEach(l=>{const C=l[0],_=l[1];if(Array.isArray(_)){const u=document.createElement("optgroup");u.label=C,u.disabled=!1,o.appendChild(u),_.forEach(O=>a(u,O[1],O[0]))}else a(o,_,C)}),o.focus()},radio:(t,e,n)=>{const o=be(t,c.radio);e.forEach(l=>{const C=l[0],_=l[1],u=document.createElement("input"),O=document.createElement("label");u.type="radio",u.name=c.radio,u.value=C,ln(C,n.inputValue)&&(u.checked=!0);const R=document.createElement("span");J(R,_),R.className=c.label,O.appendChild(u),O.appendChild(R),o.appendChild(O)});const a=o.querySelectorAll("input");a.length&&a[0].focus()}},At=t=>{const e=[];return typeof Map<"u"&&t instanceof Map?t.forEach((n,o)=>{let a=n;typeof a=="object"&&(a=At(a)),e.push([o,a])}):Object.keys(t).forEach(n=>{let o=t[n];typeof o=="object"&&(o=At(o)),e.push([n,o])}),e},ln=(t,e)=>e&&e.toString()===t.toString();function un(){const t=I.innerParams.get(this);if(!t)return;const e=I.domCache.get(this);Y(e.loader),tt()?t.icon&&D(Ne()):Vr(e),de([e.popup,e.actions],c.loading),e.popup.removeAttribute("aria-busy"),e.popup.removeAttribute("data-loading"),e.confirmButton.disabled=!1,e.denyButton.disabled=!1,e.cancelButton.disabled=!1}const Vr=t=>{const e=t.popup.getElementsByClassName(t.loader.getAttribute("data-button-to-replace"));e.length?D(e[0],"inline-block"):mo()&&Y(t.actions)};function Nr(t){const e=I.innerParams.get(t||this),n=I.domCache.get(t||this);return n?wt(n.popup,e.input):null}const qe={swalPromiseResolve:new WeakMap,swalPromiseReject:new WeakMap},Hr=()=>te(M()),dn=()=>ae()&&ae().click(),jr=()=>ge()&&ge().click(),Dr=()=>ke()&&ke().click(),fn=t=>{t.keydownTarget&&t.keydownHandlerAdded&&(t.keydownTarget.removeEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!1)},zr=(t,e,n,o)=>{fn(e),n.toast||(e.keydownHandler=a=>Kr(t,a,o),e.keydownTarget=n.keydownListenerCapture?window:M(),e.keydownListenerCapture=n.keydownListenerCapture,e.keydownTarget.addEventListener("keydown",e.keydownHandler,{capture:e.keydownListenerCapture}),e.keydownHandlerAdded=!0)},St=(t,e,n)=>{const o=bt();if(o.length)return e=e+n,e===o.length?e=0:e===-1&&(e=o.length-1),o[e].focus();M().focus()},hn=["ArrowRight","ArrowDown"],qr=["ArrowLeft","ArrowUp"],Kr=(t,e,n)=>{const o=I.innerParams.get(t);o&&(e.isComposing||e.keyCode===229||(o.stopKeydownPropagation&&e.stopPropagation(),e.key==="Enter"?Wr(t,e,o):e.key==="Tab"?Jr(e,o):[...hn,...qr].includes(e.key)?Yr(e.key):e.key==="Escape"&&Xr(e,o,n)))},Wr=(t,e,n)=>{if(Ze(n.allowEnterKey)&&e.target&&t.getInput()&&e.target.outerHTML===t.getInput().outerHTML){if(["textarea","file"].includes(n.input))return;dn(),e.preventDefault()}},Jr=(t,e)=>{const n=t.target,o=bt();let a=-1;for(let l=0;l<o.length;l++)if(n===o[l]){a=l;break}t.shiftKey?St(e,a,-1):St(e,a,1),t.stopPropagation(),t.preventDefault()},Yr=t=>{const e=ae(),n=ge(),o=ke();if(![e,n,o].includes(document.activeElement))return;const a=hn.includes(t)?"nextElementSibling":"previousElementSibling";let l=document.activeElement;for(let C=0;C<He().children.length;C++){if(l=l[a],!l)return;if(te(l)&&l instanceof HTMLButtonElement)break}l instanceof HTMLButtonElement&&l.focus()},Xr=(t,e,n)=>{Ze(e.allowEscapeKey)&&(t.preventDefault(),n(Ie.esc))};function pn(t,e,n,o){tt()?mn(t,o):(wo(n).then(()=>mn(t,o)),fn(B)),/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?(e.setAttribute("style","display:none !important"),e.removeAttribute("class"),e.innerHTML=""):e.remove(),yt()&&(yr(),Sr(),on()),Zr()}function Zr(){de([document.documentElement,document.body],[c.shown,c["height-auto"],c["no-backdrop"],c["toast-shown"]])}function ot(t){t=ts(t);const e=qe.swalPromiseResolve.get(this),n=Qr(this);this.isAwaitingPromise()?t.isDismissed||(Ke(this),e(t)):n&&e(t)}function Gr(){return!!I.awaitingPromise.get(this)}const Qr=t=>{const e=M();if(!e)return!1;const n=I.innerParams.get(t);if(!n||pe(e,n.hideClass.popup))return!1;de(e,n.showClass.popup),L(e,n.hideClass.popup);const o=W();return de(o,n.showClass.backdrop),L(o,n.hideClass.backdrop),ns(t,e,n),!0};function es(t){const e=qe.swalPromiseReject.get(this);Ke(this),e&&e(t)}const Ke=t=>{t.isAwaitingPromise()&&(I.awaitingPromise.delete(t),I.innerParams.get(t)||t._destroy())},ts=t=>typeof t>"u"?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},t),ns=(t,e,n)=>{const o=W(),a=De&&Xt(e);typeof n.willClose=="function"&&n.willClose(e),a?os(t,e,o,n.returnFocus,n.didClose):pn(t,o,n.returnFocus,n.didClose)},os=(t,e,n,o,a)=>{B.swalCloseEventFinishedCallback=pn.bind(null,t,n,o,a),e.addEventListener(De,function(l){l.target===e&&(B.swalCloseEventFinishedCallback(),delete B.swalCloseEventFinishedCallback)})},mn=(t,e)=>{setTimeout(()=>{typeof e=="function"&&e.bind(t.params)(),t._destroy()})};function gn(t,e,n){const o=I.domCache.get(t);e.forEach(a=>{o[a].disabled=n})}function bn(t,e){if(!t)return!1;if(t.type==="radio"){const o=t.parentNode.parentNode.querySelectorAll("input");for(let a=0;a<o.length;a++)o[a].disabled=e}else t.disabled=e}function rs(){gn(this,["confirmButton","denyButton","cancelButton"],!1)}function ss(){gn(this,["confirmButton","denyButton","cancelButton"],!0)}function is(){return bn(this.getInput(),!1)}function as(){return bn(this.getInput(),!0)}function cs(t){const e=I.domCache.get(this),n=I.innerParams.get(this);J(e.validationMessage,t),e.validationMessage.className=c["validation-message"],n.customClass&&n.customClass.validationMessage&&L(e.validationMessage,n.customClass.validationMessage),D(e.validationMessage);const o=this.getInput();o&&(o.setAttribute("aria-invalid",!0),o.setAttribute("aria-describedby",c["validation-message"]),Kt(o),L(o,c.inputerror))}function ls(){const t=I.domCache.get(this);t.validationMessage&&Y(t.validationMessage);const e=this.getInput();e&&(e.removeAttribute("aria-invalid"),e.removeAttribute("aria-describedby"),de(e,c.inputerror))}function us(){return I.domCache.get(this).progressSteps}function ds(t){const e=M(),n=I.innerParams.get(this);if(!e||pe(e,n.hideClass.popup))return Z("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");const o=fs(t),a=Object.assign({},n,o);nn(this,a),I.innerParams.set(this,a),Object.defineProperties(this,{params:{value:Object.assign({},this.params,t),writable:!1,enumerable:!0}})}const fs=t=>{const e={};return Object.keys(t).forEach(n=>{Nt(n)?e[n]=t[n]:Z(`Invalid parameter to update: "${n}". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js
|
|
78
75
|
|
|
79
|
-
If you think this parameter should be updatable, request it here: https://github.com/sweetalert2/sweetalert2/issues/new?template=02_feature_request.md`))}),t};function fs(){const e=R.domCache.get(this),t=R.innerParams.get(this);if(!t){Yt(this);return}e.popup&&V.swalCloseEventFinishedCallback&&(V.swalCloseEventFinishedCallback(),delete V.swalCloseEventFinishedCallback),V.deferDisposalTimer&&(clearTimeout(V.deferDisposalTimer),delete V.deferDisposalTimer),typeof t.didDestroy=="function"&&t.didDestroy(),hs(this)}const hs=e=>{Yt(e),delete e.params,delete V.keydownHandler,delete V.keydownTarget,delete V.currentInstance},Yt=e=>{e.isAwaitingPromise()?(lt(R,e),R.awaitingPromise.set(e,!0)):(lt(je,e),lt(R,e))},lt=(e,t)=>{for(const n in e)e[n].delete(t)};var Xt=Object.freeze({hideLoading:Dt,disableLoading:Dt,getInput:Nr,close:Je,isAwaitingPromise:Zr,rejectPromise:Qr,handleAwaitingPromise:ze,closePopup:Je,closeModal:Je,closeToast:Je,enableButtons:os,disableButtons:rs,enableInput:ss,disableInput:is,showValidationMessage:as,resetValidationMessage:cs,getProgressSteps:ls,update:us,_destroy:fs});const ps=e=>{const t=R.innerParams.get(e);e.disableButtons(),t.input?Zt(e,"confirm"):dt(e,!0)},ms=e=>{const t=R.innerParams.get(e);e.disableButtons(),t.returnInputValueOnDeny?Zt(e,"deny"):ut(e,!1)},gs=(e,t)=>{e.disableButtons(),t(Fe.cancel)},Zt=(e,t)=>{const n=R.innerParams.get(e);if(!n.input)return O('The "input" parameter is needed to be set when using returnInputValueOn'.concat(U(t)));const r=Ir(e,n);n.inputValidator?bs(e,r,t):e.getInput().checkValidity()?t==="deny"?ut(e,r):dt(e,r):(e.enableButtons(),e.showValidationMessage(n.validationMessage))},bs=(e,t,n)=>{const r=R.innerParams.get(e);e.disableInput(),Promise.resolve().then(()=>j(r.inputValidator(t,r.validationMessage))).then(P=>{e.enableButtons(),e.enableInput(),P?e.showValidationMessage(P):n==="deny"?ut(e,t):dt(e,t)})},ut=(e,t)=>{const n=R.innerParams.get(e||void 0);n.showLoaderOnDeny&&Ue(u()),n.preDeny?(R.awaitingPromise.set(e||void 0,!0),Promise.resolve().then(()=>j(n.preDeny(t,n.validationMessage))).then(f=>{f===!1?(e.hideLoading(),ze(e)):e.closePopup({isDenied:!0,value:typeof f>"u"?t:f})}).catch(f=>Qt(e||void 0,f))):e.closePopup({isDenied:!0,value:t})},Gt=(e,t)=>{e.closePopup({isConfirmed:!0,value:t})},Qt=(e,t)=>{e.rejectPromise(t)},dt=(e,t)=>{const n=R.innerParams.get(e||void 0);n.showLoaderOnConfirm&&Ue(),n.preConfirm?(e.resetValidationMessage(),R.awaitingPromise.set(e||void 0,!0),Promise.resolve().then(()=>j(n.preConfirm(t,n.validationMessage))).then(f=>{le(m())||f===!1?(e.hideLoading(),ze(e)):Gt(e,typeof f>"u"?t:f)}).catch(f=>Qt(e||void 0,f))):Gt(e,t)},ws=(e,t,n)=>{R.innerParams.get(e).toast?ys(e,t,n):(ks(t),xs(t),Cs(e,t,n))},ys=(e,t,n)=>{t.popup.onclick=()=>{const r=R.innerParams.get(e);r&&(vs(r)||r.timer||r.input)||n(Fe.close)}},vs=e=>e.showConfirmButton||e.showDenyButton||e.showCancelButton||e.showCloseButton;let Ye=!1;const ks=e=>{e.popup.onmousedown=()=>{e.container.onmouseup=function(t){e.container.onmouseup=void 0,t.target===e.container&&(Ye=!0)}}},xs=e=>{e.container.onmousedown=()=>{e.popup.onmouseup=function(t){e.popup.onmouseup=void 0,(t.target===e.popup||e.popup.contains(t.target))&&(Ye=!0)}}},Cs=(e,t,n)=>{t.container.onclick=r=>{const f=R.innerParams.get(e);if(Ye){Ye=!1;return}r.target===t.container&&X(f.allowOutsideClick)&&n(Fe.backdrop)}},As=e=>typeof e=="object"&&e.jquery,en=e=>e instanceof Element||As(e),Ss=e=>{const t={};return typeof e[0]=="object"&&!en(e[0])?Object.assign(t,e[0]):["title","html","icon"].forEach((n,r)=>{const f=e[r];typeof f=="string"||en(f)?t[n]=f:f!==void 0&&O("Unexpected type of ".concat(n,'! Expected "string" or "Element", got ').concat(typeof f))}),t};function Es(){const e=this;for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return new e(...n)}function _s(e){class t extends this{_main(r,f){return super._main(r,Object.assign({},e,f))}}return t}const Bs=()=>V.timeout&&V.timeout.getTimerLeft(),tn=()=>{if(V.timeout)return mo(),V.timeout.stop()},nn=()=>{if(V.timeout){const e=V.timeout.start();return ot(e),e}},Ps=()=>{const e=V.timeout;return e&&(e.running?tn():nn())},Ts=e=>{if(V.timeout){const t=V.timeout.increase(e);return ot(t,!0),t}},Is=()=>V.timeout&&V.timeout.isRunning();let on=!1;const ft={};function Ls(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"data-swal-template";ft[e]=this,on||(document.body.addEventListener("click",Fs),on=!0)}const Fs=e=>{for(let t=e.target;t&&t!==document;t=t.parentNode)for(const n in ft){const r=t.getAttribute(n);if(r){ft[n].fire({template:r});return}}};var Us=Object.freeze({isValidParameter:J,isUpdatableParameter:we,isDeprecatedParameter:Z,argsToParams:Ss,isVisible:Hr,clickConfirm:jt,clickDeny:Dr,clickCancel:jr,getContainer:T,getPopup:F,getTitle:N,getHtmlContainer:te,getImage:s,getIcon:G,getInputLabel:S,getCloseButton:H,getActions:_,getConfirmButton:b,getDenyButton:u,getCancelButton:y,getLoader:w,getFooter:B,getTimerProgressBar:M,getFocusableElements:pe,getValidationMessage:m,isLoading:fo,fire:Es,mixin:_s,showLoading:Ue,enableLoading:Ue,getTimerLeft:Bs,stopTimer:tn,resumeTimer:nn,toggleTimer:Ps,increaseTimer:Ts,isTimerRunning:Is,bindClickHandler:Ls});let ht;class Me{constructor(){if(typeof window>"u")return;ht=this;for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const f=Object.freeze(this.constructor.argsToParams(n));Object.defineProperties(this,{params:{value:f,writable:!1,enumerable:!0,configurable:!0}});const P=this._main(this.params);R.promise.set(this,P)}_main(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};A(Object.assign({},n,t)),V.currentInstance&&(V.currentInstance._destroy(),ne()&&Mt()),V.currentInstance=this;const r=Os(t,n);pr(r),Object.freeze(r),V.timeout&&(V.timeout.stop(),delete V.timeout),clearTimeout(V.restoreFocusTimeout);const f=Vs(this);return Ut(this,r),R.innerParams.set(this,r),Ms(this,f,r)}then(t){return R.promise.get(this).then(t)}finally(t){return R.promise.get(this).finally(t)}}const Ms=(e,t,n)=>new Promise((r,f)=>{const P=Y=>{e.closePopup({isDismissed:!0,dismiss:Y})};je.swalPromiseResolve.set(e,r),je.swalPromiseReject.set(e,f),t.confirmButton.onclick=()=>ps(e),t.denyButton.onclick=()=>ms(e),t.cancelButton.onclick=()=>gs(e,P),t.closeButton.onclick=()=>P(Fe.close),ws(e,t,P),zr(e,V,n,P),Tr(e,n),Sr(n),Rs(V,n,P),Ns(t,n),setTimeout(()=>{t.container.scrollTop=0})}),Os=(e,t)=>{const n=rr(e),r=Object.assign({},ge,t,n,e);return r.showClass=Object.assign({},ge.showClass,r.showClass),r.hideClass=Object.assign({},ge.hideClass,r.hideClass),r},Vs=e=>{const t={popup:F(),container:T(),actions:_(),confirmButton:b(),denyButton:u(),cancelButton:y(),loader:w(),closeButton:H(),validationMessage:m(),progressSteps:a()};return R.domCache.set(e,t),t},Rs=(e,t,n)=>{const r=M();re(r),t.timer&&(e.timeout=new mr(()=>{n("timer"),delete e.timeout},t.timer),t.timerProgressBar&&(Q(r),me(r,t,"timerProgressBar"),setTimeout(()=>{e.timeout&&e.timeout.running&&ot(t.timer)})))},Ns=(e,t)=>{if(!t.toast){if(!X(t.allowEnterKey))return Ds();Hs(e,t)||ct(t,-1,1)}},Hs=(e,t)=>t.focusDeny&&le(e.denyButton)?(e.denyButton.focus(),!0):t.focusCancel&&le(e.cancelButton)?(e.cancelButton.focus(),!0):t.focusConfirm&&le(e.confirmButton)?(e.confirmButton.focus(),!0):!1,Ds=()=>{document.activeElement instanceof HTMLElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur()};Object.assign(Me.prototype,Xt),Object.assign(Me,Us),Object.keys(Xt).forEach(e=>{Me[e]=function(){if(ht)return ht[e](...arguments)}}),Me.DismissReason=Fe,Me.version="11.4.8";const Xe=Me;return Xe.default=Xe,Xe}),typeof ke<"u"&&ke.Sweetalert2&&(ke.swal=ke.sweetAlert=ke.Swal=ke.SweetAlert=ke.Sweetalert2)})(kt);var Bn=kt.exports;const xt=gt(Bn);class Pn{get IsVisible(){return xt.isVisible()}async ConfirmAsync(o){return new Promise(h=>{xt.fire({showCancelButton:!0,allowEscapeKey:!1,allowOutsideClick:!1,icon:"question",title:o.header,html:o.message,confirmButtonText:o.confirmLabel??"confirmar",cancelButtonText:o.rejectLabel??"cancelar"}).then(v=>{h(v.isConfirmed===!0)})})}}const Tn=new Pn,Ct=()=>Tn,In=["data-cor"],Ln=c.defineComponent({__name:"HeaderAvatar",setup(l){const o=Ct(),h=U();async function v(){await o.ConfirmAsync({message:`${ee.User.username} - ${ee.User.name}.<br /><br />Você deseja sair da conta?`,confirmLabel:"sair"})&&ee.CallLogout()}function U(){const I=ee.User.name;let O="?";if(!I)return O;const p=I.split(" ").filter(W=>W.length>0).map(W=>W[0].toUpperCase()),K=Math.min(2,p.length);return O=p.slice(0,K).join(""),O.length>0?O:"?"}function x(){const I=h[0],O=I==="?"?0:(I.charCodeAt(0)-64)%19;return Math.max(O,0)}return(I,O)=>(c.openBlock(),c.createElementBlock("div",{id:"sf-header-avatar","data-cor":x(),onClick:v},c.toDisplayString(c.unref(h)),9,In))}}),Fn={},Un={xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",class:"sf-svg-icon"},Mn=[c.createElementVNode("path",{d:"m307.231-83.463-54.999-55.23 343.923-343.922-343.923-343.539 54.999-54.614 398.153 398.153L307.231-83.462Z"},null,-1)];function On(l,o){return c.openBlock(),c.createElementBlock("svg",Un,Mn)}const Vn=mt(Fn,[["render",On]]);class Rn{get storedTheme(){return localStorage.getItem("color-scheme")}get IsDark(){return document.documentElement.classList.contains("dark")}Toggle(){this.IsDark?this.EnableLightMode():this.EnableDarkMode()}EnableDarkMode(){document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),localStorage.setItem("color-scheme","dark")}EnableLightMode(){document.documentElement.classList.remove("dark"),document.documentElement.classList.add("light"),localStorage.setItem("color-scheme","light")}SetInitialTheme(){if(this.storedTheme==="light")return this.EnableLightMode();if(this.storedTheme==="dark")return this.EnableDarkMode();if(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches)return this.EnableDarkMode();this.EnableLightMode()}}const tt=(()=>new Rn)(),Nn=[c.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="472.39" height="472.39" viewBox="0 0 472.39 472.39"><g class="toggle-sun"><path d="M403.21,167V69.18H305.38L236.2,0,167,69.18H69.18V167L0,236.2l69.18,69.18v97.83H167l69.18,69.18,69.18-69.18h97.83V305.38l69.18-69.18Zm-167,198.17a129,129,0,1,1,129-129A129,129,0,0,1,236.2,365.19Z"></path></g><g class="toggle-circle"><circle class="cls-1" cx="236.2" cy="236.2" r="103.78"></circle></g></svg>',1)],Hn=c.defineComponent({__name:"ThemeToggle",setup(l){return(o,h)=>(c.openBlock(),c.createElementBlock("button",{id:"sf-theme-toggle",onClick:h[0]||(h[0]=(...v)=>c.unref(tt).Toggle&&c.unref(tt).Toggle(...v))},Nn))}}),Dn={id:"sf-layout"},jn=c.createElementVNode("div",{class:"sf-layout-menu-toggler-logo"},null,-1),zn={class:"title"},$n={class:"sf-layout-nav-header"},qn=c.createElementVNode("span",null,"Menu",-1),Wn={class:"sf-layout-nav-content"},Kn=c.createElementVNode("section",{id:"sf-layout-page-title"},null,-1),Jn={id:"sf-layout-content"},Yn=c.defineComponent({__name:"Layout",setup(l){const o=Ze();return(h,v)=>(c.openBlock(),c.createElementBlock("div",Dn,[c.createElementVNode("header",null,[c.createElementVNode("div",{class:c.normalizeClass(["sf-layout-menu-toggler",{invert:c.unref(o).IsVisible}]),onClick:v[0]||(v[0]=U=>c.unref(o).Toggle())},[jn,c.createVNode(Vn)],2),c.createElementVNode("div",zn,[c.renderSlot(h.$slots,"title")]),c.renderSlot(h.$slots,"action"),c.createVNode(Hn),c.createVNode(Ln)]),c.createElementVNode("nav",{class:c.normalizeClass({visible:c.unref(o).IsVisible})},[c.createElementVNode("div",$n,[qn,c.createVNode(Ve,{icone:"close",button:"",onClick:v[1]||(v[1]=U=>c.unref(o).Close())})]),c.createElementVNode("div",Wn,[c.renderSlot(h.$slots,"menu")])],2),c.createElementVNode("main",{class:c.normalizeClass({"menu-visible":c.unref(o).IsVisible})},[Kn,c.createElementVNode("section",Jn,[c.renderSlot(h.$slots,"content")])],2)]))}}),Xn=["href","data-active","onClick"],Zn={class:"sf-navmenulink-text"},Gn=c.defineComponent({__name:"NavMenuLink",props:{href:{},text:{},icon:{},exact:{type:Boolean}},setup(l){const o=l,h=Ze();function v(U,x){U.preventDefault();const O=U.target.closest(".sf-layout-nav-content");x(),O&&O.clientWidth+10>document.body.clientWidth&&h.Close()}return(U,x)=>{const I=c.resolveComponent("router-link");return c.openBlock(),c.createBlock(I,{to:o.href,custom:""},{default:c.withCtx(({href:O,navigate:p,isExactActive:K,isActive:W})=>[c.createElementVNode("a",{class:"sf-navmenulink",href:O,"data-active":o.exact?K:W,onClick:X=>v(X,p)},[o.icon?(c.openBlock(),c.createBlock(Ve,{key:0,icone:o.icon,"button-props":{tabindex:-1}},null,8,["icone"])):c.createCommentVNode("",!0),c.createElementVNode("span",Zn,c.toDisplayString(o.text),1)],8,Xn)]),_:1},8,["to"])}}}),Qn=c.defineComponent({__name:"ScrollToTop",setup(l){const o=c.ref(!1),h=`--${+new Date}`;let v=null;function U(){v==null||v.scrollTo(0,0)}return c.onMounted(()=>{var x;v=((x=document.getElementById(h))==null?void 0:x.parentElement)??null,v&&v.addEventListener("scroll",function(){o.value=this.scrollTop-this.clientHeight>0})}),(x,I)=>(c.openBlock(),c.createElementBlock("button",{id:h,class:c.normalizeClass(["sf-scrollToTop",{"sf-scrollToTop-visible":o.value}]),onClick:U},null,2))}}),eo=c.defineComponent({__name:"Content",props:{class:{},style:{},disableBodyPadding:{type:Boolean},disableHeaderPadding:{type:Boolean},disableFooterPadding:{type:Boolean}},setup(l){const o=l;function h(){return new Pe("sf-content").AddClass(o.class,!!o.class).Build()}function v(){return new Pe("sf-content-body").AddClass("sf-content-no-padding",o.disableBodyPadding).Build()}function U(){return new Pe("sf-content-header").AddClass("sf-content-no-padding",o.disableHeaderPadding).Build()}function x(){return new Pe("sf-content-footer").AddClass("sf-content-no-padding",o.disableFooterPadding).Build()}return(I,O)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(h()),style:c.normalizeStyle(o.style)},[c.createElementVNode("div",{class:c.normalizeClass(U())},[c.renderSlot(I.$slots,"header")],2),c.createElementVNode("div",{class:c.normalizeClass(v())},[c.renderSlot(I.$slots,"default"),c.createVNode(Qn)],2),c.createElementVNode("div",{class:c.normalizeClass(x())},[c.renderSlot(I.$slots,"footer")],2)],6))}}),to={class:"sf-tab-navigation"},no=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},[c.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})],-1)],oo=["data-active"],ro=["href","onClick"],so=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},[c.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})],-1)],io=c.defineComponent({__name:"TabNavigation",props:{tabs:{}},setup(l){const o=l,h=c.ref(null),v=new ResizeObserver(p=>{O()}),U=c.ref(!1),x=c.ref(!1);function I(p=!1){const K=h.value.clientWidth;h.value.scrollLeft+=p?-K:K}function O(){const p=h.value.scrollWidth-h.value.clientWidth;U.value=h.value.scrollLeft>10,x.value=h.value.scrollLeft<p-10}return c.onMounted(()=>{h.value.addEventListener("scroll",O),v.observe(h.value)}),c.onBeforeUnmount(()=>{var p;try{(p=h.value)==null||p.removeEventListener("scroll",O),v.unobserve(h.value),v.disconnect()}catch{}}),(p,K)=>{const W=c.resolveComponent("RouterLink");return c.openBlock(),c.createElementBlock("div",to,[c.createElementVNode("div",{class:c.normalizeClass(["left-arrow",{active:U.value}]),onClick:K[0]||(K[0]=X=>I(!0))},no,2),c.createElementVNode("ul",{ref_key:"trackerContainer",ref:h},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(o.tabs,X=>(c.openBlock(),c.createBlock(W,{to:X.route,custom:!0},{default:c.withCtx(({navigate:ae,isActive:j})=>[c.createElementVNode("li",{"data-active":j},[c.renderSlot(p.$slots,"item",{item:X,navigate:ae,isActive:j},()=>[c.createElementVNode("a",{href:X.route,class:c.normalizeClass({active:j}),onClick:ae},c.toDisplayString(X.text),11,ro)])],8,oo)]),_:2},1032,["to"]))),256))],512),c.createElementVNode("div",{class:c.normalizeClass(["right-arrow",{active:x.value}]),onClick:K[1]||(K[1]=X=>I())},so,2)])}}}),ao=["id","name","disabled","data-color","form","type"],co={class:"sf-button-label"},lo=c.defineComponent({__name:"Button",props:{icon:{},visible:{type:Boolean,default:!0},class:{},style:{},disabled:{type:Boolean},loading:{type:Boolean},color:{default:"primary"},size:{default:"md"},variant:{default:"filled"},autofocus:{type:Boolean},form:{},name:{},id:{},type:{default:"button"},value:{}},setup(l){const o=l;function h(){return new Pe(`${o.class??""} sf-button`).AddClass("sf-component-loading",o.loading).AddClass("sf-component-disabled",o.disabled).AddClass("sf-button-small",o.size==="sm").AddClass("sf-button-medium",o.size==="md").AddClass("sf-button-large",o.size==="lg").AddClass("sf-button-filled",o.variant==="filled").AddClass("sf-button-text",o.variant==="text").AddClass("sf-button-outlined",o.variant==="outlined").AddClass("sf-button-with-icon",!!o.icon).AddClass("sf-ripple").Build()}return(v,U)=>(c.openBlock(),c.createElementBlock("button",{id:o.id,name:o.name,class:c.normalizeClass(h()),style:c.normalizeStyle(o.style),disabled:o.disabled||o.loading,"data-color":o.color,form:o.form,type:o.type},[o.icon?(c.openBlock(),c.createBlock(Ve,{key:0,icon:o.icon,loading:o.loading,size:o.size,"button-props":{tabindex:-1}},null,8,["icon","loading","size"])):o.loading?(c.openBlock(),c.createBlock(Ve,{key:1,loading:!0,size:o.size,"button-props":{tabindex:-1}},null,8,["size"])):c.createCommentVNode("",!0),c.createElementVNode("span",co,[c.renderSlot(v.$slots,"default")])],14,ao))}});class uo{constructor(o=null){$e(this,"errors",[]);$e(this,"_value",null);this._value=o}get value(){return this._value}set value(o){this._value=o}get hasSuccess(){return!this.hasError}get hasError(){return this.errors.length>0}WithError(o){this.errors.push(o)}}const Gs="",Qs="";(()=>{function l(){c.nextTick(()=>{setTimeout(()=>{var h;const o=document.querySelector(":root");o&&o.style.setProperty("--window-height",`${((h=window.visualViewport)==null?void 0:h.height)??window.innerHeight}px`)},1)})}l(),window.addEventListener("resize",l)})(),tt.SetInitialTheme(),q.AppResult=uo,q.AuthService=ee,q.Cor=Ge,q.SfButton=lo,q.SfContent=eo,q.SfIcon=Ve,q.SfLayout=Yn,q.SfNavMenuLink=Gn,q.SfTabNavigation=io,q.Tamanho=Be,q.UseDialogService=Ct,q.UseNavMenuService=Ze,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})});
|
|
76
|
+
If you think this parameter should be updatable, request it here: https://github.com/sweetalert2/sweetalert2/issues/new?template=02_feature_request.md`)}),e};function hs(){const t=I.domCache.get(this),e=I.innerParams.get(this);if(!e){yn(this);return}t.popup&&B.swalCloseEventFinishedCallback&&(B.swalCloseEventFinishedCallback(),delete B.swalCloseEventFinishedCallback),B.deferDisposalTimer&&(clearTimeout(B.deferDisposalTimer),delete B.deferDisposalTimer),typeof e.didDestroy=="function"&&e.didDestroy(),ps(this)}const ps=t=>{yn(t),delete t.params,delete B.keydownHandler,delete B.keydownTarget,delete B.currentInstance},yn=t=>{t.isAwaitingPromise()?(_t(I,t),I.awaitingPromise.set(t,!0)):(_t(qe,t),_t(I,t))},_t=(t,e)=>{for(const n in t)t[n].delete(e)},wn=Object.freeze(Object.defineProperty({__proto__:null,_destroy:hs,close:ot,closeModal:ot,closePopup:ot,closeToast:ot,disableButtons:ss,disableInput:as,disableLoading:un,enableButtons:rs,enableInput:is,getInput:Nr,getProgressSteps:us,handleAwaitingPromise:Ke,hideLoading:un,isAwaitingPromise:Gr,rejectPromise:es,resetValidationMessage:ls,showValidationMessage:cs,update:ds},Symbol.toStringTag,{value:"Module"})),ms=t=>{const e=I.innerParams.get(t);t.disableButtons(),e.input?vn(t,"confirm"):Bt(t,!0)},gs=t=>{const e=I.innerParams.get(t);t.disableButtons(),e.returnInputValueOnDeny?vn(t,"deny"):Et(t,!1)},bs=(t,e)=>{t.disableButtons(),e(Ie.cancel)},vn=(t,e)=>{const n=I.innerParams.get(t);if(!n.input)return ve(`The "input" parameter is needed to be set when using returnInputValueOn${ft(e)}`);const o=Fr(t,n);n.inputValidator?ys(t,o,e):t.getInput().checkValidity()?e==="deny"?Et(t,o):Bt(t,o):(t.enableButtons(),t.showValidationMessage(n.validationMessage))},ys=(t,e,n)=>{const o=I.innerParams.get(t);t.disableInput(),Promise.resolve().then(()=>Oe(o.inputValidator(e,o.validationMessage))).then(l=>{t.enableButtons(),t.enableInput(),l?t.showValidationMessage(l):n==="deny"?Et(t,e):Bt(t,e)})},Et=(t,e)=>{const n=I.innerParams.get(t||globalThis);n.showLoaderOnDeny&&Fe(ge()),n.preDeny?(I.awaitingPromise.set(t||globalThis,!0),Promise.resolve().then(()=>Oe(n.preDeny(e,n.validationMessage))).then(a=>{a===!1?(t.hideLoading(),Ke(t)):t.closePopup({isDenied:!0,value:typeof a>"u"?e:a})}).catch(a=>xn(t||globalThis,a))):t.closePopup({isDenied:!0,value:e})},kn=(t,e)=>{t.closePopup({isConfirmed:!0,value:e})},xn=(t,e)=>{t.rejectPromise(e)},Bt=(t,e)=>{const n=I.innerParams.get(t||globalThis);n.showLoaderOnConfirm&&Fe(),n.preConfirm?(t.resetValidationMessage(),I.awaitingPromise.set(t||globalThis,!0),Promise.resolve().then(()=>Oe(n.preConfirm(e,n.validationMessage))).then(a=>{te(Qe())||a===!1?(t.hideLoading(),Ke(t)):kn(t,typeof a>"u"?e:a)}).catch(a=>xn(t||globalThis,a))):kn(t,e)},ws=(t,e,n)=>{I.innerParams.get(t).toast?vs(t,e,n):(xs(e),Cs(e),As(t,e,n))},vs=(t,e,n)=>{e.popup.onclick=()=>{const o=I.innerParams.get(t);o&&(ks(o)||o.timer||o.input)||n(Ie.close)}},ks=t=>t.showConfirmButton||t.showDenyButton||t.showCancelButton||t.showCloseButton;let rt=!1;const xs=t=>{t.popup.onmousedown=()=>{t.container.onmouseup=function(e){t.container.onmouseup=void 0,e.target===t.container&&(rt=!0)}}},Cs=t=>{t.container.onmousedown=()=>{t.popup.onmouseup=function(e){t.popup.onmouseup=void 0,(e.target===t.popup||t.popup.contains(e.target))&&(rt=!0)}}},As=(t,e,n)=>{e.container.onclick=o=>{const a=I.innerParams.get(t);if(rt){rt=!1;return}o.target===e.container&&Ze(a.allowOutsideClick)&&n(Ie.backdrop)}},Ss=t=>typeof t=="object"&&t.jquery,Cn=t=>t instanceof Element||Ss(t),_s=t=>{const e={};return typeof t[0]=="object"&&!Cn(t[0])?Object.assign(e,t[0]):["title","html","icon"].forEach((n,o)=>{const a=t[o];typeof a=="string"||Cn(a)?e[n]=a:a!==void 0&&ve(`Unexpected type of ${n}! Expected "string" or "Element", got ${typeof a}`)}),e};function Es(...t){const e=this;return new e(...t)}function Bs(t){class e extends this{_main(o,a){return super._main(o,Object.assign({},t,a))}}return e}const Ps=()=>B.timeout&&B.timeout.getTimerLeft(),An=()=>{if(B.timeout)return go(),B.timeout.stop()},Sn=()=>{if(B.timeout){const t=B.timeout.start();return vt(t),t}},Ts=()=>{const t=B.timeout;return t&&(t.running?An():Sn())},Is=t=>{if(B.timeout){const e=B.timeout.increase(t);return vt(e,!0),e}},Fs=()=>B.timeout&&B.timeout.isRunning();let _n=!1;const Pt={};function Ls(t="data-swal-template"){Pt[t]=this,_n||(document.body.addEventListener("click",Us),_n=!0)}const Us=t=>{for(let e=t.target;e&&e!==document;e=e.parentNode)for(const n in Pt){const o=e.getAttribute(n);if(o){Pt[n].fire({template:o});return}}},$s=Object.freeze(Object.defineProperty({__proto__:null,argsToParams:_s,bindClickHandler:Ls,clickCancel:Dr,clickConfirm:dn,clickDeny:jr,enableLoading:Fe,fire:Es,getActions:He,getCancelButton:ke,getCloseButton:gt,getConfirmButton:ae,getContainer:W,getDenyButton:ge,getFocusableElements:bt,getFooter:qt,getHtmlContainer:Ge,getIcon:Ne,getImage:Dt,getInputLabel:uo,getLoader:Pe,getPopup:M,getTimerLeft:Ps,getTimerProgressBar:et,getTitle:jt,getValidationMessage:Qe,increaseTimer:Is,isDeprecatedParameter:mt,isLoading:ho,isTimerRunning:Fs,isUpdatableParameter:Nt,isValidParameter:Vt,isVisible:Hr,mixin:Bs,resumeTimer:Sn,showLoading:Fe,stopTimer:An,toggleTimer:Ts},Symbol.toStringTag,{value:"Module"}));let Tt;class Le{constructor(...e){if(typeof window>"u")return;Tt=this;const n=Object.freeze(this.constructor.argsToParams(e));Object.defineProperties(this,{params:{value:n,writable:!1,enumerable:!0,configurable:!0}});const o=this._main(this.params);I.promise.set(this,o)}_main(e,n={}){co(Object.assign({},n,e)),B.currentInstance&&(B.currentInstance._destroy(),yt()&&on()),B.currentInstance=this;const o=Os(e,n);mr(o),Object.freeze(o),B.timeout&&(B.timeout.stop(),delete B.timeout),clearTimeout(B.restoreFocusTimeout);const a=Rs(this);return nn(this,o),I.innerParams.set(this,o),Ms(this,a,o)}then(e){return I.promise.get(this).then(e)}finally(e){return I.promise.get(this).finally(e)}}const Ms=(t,e,n)=>new Promise((o,a)=>{const l=C=>{t.closePopup({isDismissed:!0,dismiss:C})};qe.swalPromiseResolve.set(t,o),qe.swalPromiseReject.set(t,a),e.confirmButton.onclick=()=>ms(t),e.denyButton.onclick=()=>gs(t),e.cancelButton.onclick=()=>bs(t,l),e.closeButton.onclick=()=>l(Ie.close),ws(t,e,l),zr(t,B,n,l),Ir(t,n),_r(n),Vs(B,n,l),Ns(e,n),setTimeout(()=>{e.container.scrollTop=0})}),Os=(t,e)=>{const n=sr(t),o=Object.assign({},Be,e,n,t);return o.showClass=Object.assign({},Be.showClass,o.showClass),o.hideClass=Object.assign({},Be.hideClass,o.hideClass),o},Rs=t=>{const e={popup:M(),container:W(),actions:He(),confirmButton:ae(),denyButton:ge(),cancelButton:ke(),loader:Pe(),closeButton:gt(),validationMessage:Qe(),progressSteps:zt()};return I.domCache.set(t,e),e},Vs=(t,e,n)=>{const o=et();Y(o),e.timer&&(t.timeout=new gr(()=>{n("timer"),delete t.timeout},e.timer),e.timerProgressBar&&(D(o),re(o,e,"timerProgressBar"),setTimeout(()=>{t.timeout&&t.timeout.running&&vt(e.timer)})))},Ns=(t,e)=>{if(!e.toast){if(!Ze(e.allowEnterKey))return js();Hs(t,e)||St(e,-1,1)}},Hs=(t,e)=>e.focusDeny&&te(t.denyButton)?(t.denyButton.focus(),!0):e.focusCancel&&te(t.cancelButton)?(t.cancelButton.focus(),!0):e.focusConfirm&&te(t.confirmButton)?(t.confirmButton.focus(),!0):!1,js=()=>{document.activeElement instanceof HTMLElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur()};Object.assign(Le.prototype,wn),Object.assign(Le,$s),Object.keys(wn).forEach(t=>{Le[t]=function(...e){if(Tt)return Tt[t](...e)}}),Le.DismissReason=Ie,Le.version="11.4.8";const Ue=Le;Ue.default=Ue;class Ds{get IsVisible(){return Ue.isVisible()}async ConfirmAsync(e){return new Promise(n=>{Ue.fire({showCancelButton:!0,allowEscapeKey:!1,allowOutsideClick:!1,icon:"question",title:e.header,html:e.message,confirmButtonText:e.confirmLabel??"confirmar",cancelButtonText:e.rejectLabel??"cancelar"}).then(o=>{n(o.isConfirmed===!0)})})}async AlertAsync(e){const n=e.icon??"info";let o,a;return Array.isArray(e.text)?a=`<div style="max-height: 50vh; overflow: auto">
|
|
77
|
+
${e.text.join("<br />")}
|
|
78
|
+
</div>`:o=e.text,new Promise(l=>{Ue.fire({allowEscapeKey:!1,allowOutsideClick:!1,icon:n,title:e.title,text:o,html:a}).then(()=>l(!0))})}}const zs=new Ds,En=()=>zs,qs=["data-cor"],Ks=i.defineComponent({__name:"HeaderAvatar",setup(t){const e=En(),n=a();async function o(){await e.ConfirmAsync({message:`${K.User.username} - ${K.User.name}.<br /><br />Você deseja sair da conta?`,confirmLabel:"sair"})&&K.CallLogout()}function a(){const C=K.User.name;let _="?";if(!C)return _;const u=C.split(" ").filter(R=>R.length>0).map(R=>R[0].toUpperCase()),O=Math.min(2,u.length);return _=u.slice(0,O).join(""),_.length>0?_:"?"}function l(){const C=n[0],_=C==="?"?0:(C.charCodeAt(0)-64)%19;return Math.max(_,0)}return(C,_)=>(i.openBlock(),i.createElementBlock("div",{id:"sf-header-avatar","data-cor":l(),onClick:o},i.toDisplayString(i.unref(n)),9,qs))}}),Ws={},Js={xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",class:"sf-svg-icon"},Ys=[i.createElementVNode("path",{d:"m307.231-83.463-54.999-55.23 343.923-343.922-343.923-343.539 54.999-54.614 398.153 398.153L307.231-83.462Z"},null,-1)];function Xs(t,e){return i.openBlock(),i.createElementBlock("svg",Js,Ys)}const Zs=Ft(Ws,[["render",Xs]]);class Gs{get storedTheme(){return localStorage.getItem("color-scheme")}get IsDark(){return document.documentElement.classList.contains("dark")}Toggle(){this.IsDark?this.EnableLightMode():this.EnableDarkMode()}EnableDarkMode(){document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),localStorage.setItem("color-scheme","dark")}EnableLightMode(){document.documentElement.classList.remove("dark"),document.documentElement.classList.add("light"),localStorage.setItem("color-scheme","light")}SetInitialTheme(){if(this.storedTheme==="light")return this.EnableLightMode();if(this.storedTheme==="dark")return this.EnableDarkMode();if(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches)return this.EnableDarkMode();this.EnableLightMode()}}const It=(()=>new Gs)(),Qs=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="472.39" height="472.39" viewBox="0 0 472.39 472.39"><g class="toggle-sun"><path d="M403.21,167V69.18H305.38L236.2,0,167,69.18H69.18V167L0,236.2l69.18,69.18v97.83H167l69.18,69.18,69.18-69.18h97.83V305.38l69.18-69.18Zm-167,198.17a129,129,0,1,1,129-129A129,129,0,0,1,236.2,365.19Z"></path></g><g class="toggle-circle"><circle class="cls-1" cx="236.2" cy="236.2" r="103.78"></circle></g></svg>',1)],ei=i.defineComponent({__name:"ThemeToggle",setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("button",{id:"sf-theme-toggle",onClick:n[0]||(n[0]=(...o)=>i.unref(It).Toggle&&i.unref(It).Toggle(...o))},Qs))}}),ti={id:"sf-layout"},ni=i.createElementVNode("div",{class:"sf-layout-menu-toggler-logo"},null,-1),oi={class:"title"},ri={class:"sf-layout-nav-header"},si=i.createElementVNode("span",null,"Menu",-1),ii={class:"sf-layout-nav-content"},ai=i.createElementVNode("section",{id:"sf-layout-page-title"},null,-1),ci={id:"sf-layout-content"},li=i.defineComponent({__name:"Layout",setup(t){const e=ct();return(n,o)=>(i.openBlock(),i.createElementBlock("div",ti,[i.createElementVNode("header",null,[i.createElementVNode("div",{class:i.normalizeClass(["sf-layout-menu-toggler",{invert:i.unref(e).IsVisible}]),onClick:o[0]||(o[0]=a=>i.unref(e).Toggle())},[ni,i.createVNode(Zs)],2),i.createElementVNode("div",oi,[i.renderSlot(n.$slots,"title")]),i.renderSlot(n.$slots,"action"),i.createVNode(ei),i.createVNode(Ks)]),i.createElementVNode("nav",{class:i.normalizeClass({visible:i.unref(e).IsVisible})},[i.createElementVNode("div",ri,[si,i.createVNode($e,{icone:"close",button:"",onClick:o[1]||(o[1]=a=>i.unref(e).Close())})]),i.createElementVNode("div",ii,[i.renderSlot(n.$slots,"menu")])],2),i.createElementVNode("main",{class:i.normalizeClass({"menu-visible":i.unref(e).IsVisible})},[ai,i.createElementVNode("section",ci,[i.renderSlot(n.$slots,"content")])],2)]))}}),ui=["href","data-active","onClick"],di={class:"sf-navmenulink-text"},fi=i.defineComponent({__name:"NavMenuLink",props:{href:{},text:{},icon:{},exact:{type:Boolean}},setup(t){const e=t,n=ct();function o(a,l){a.preventDefault();const _=a.target.closest(".sf-layout-nav-content");l(),_&&_.clientWidth+10>document.body.clientWidth&&n.Close()}return(a,l)=>{const C=i.resolveComponent("router-link");return i.openBlock(),i.createBlock(C,{to:e.href,custom:""},{default:i.withCtx(({href:_,navigate:u,isExactActive:O,isActive:R})=>[i.createElementVNode("a",{class:"sf-navmenulink",href:_,"data-active":e.exact?O:R,onClick:X=>o(X,u)},[e.icon?(i.openBlock(),i.createBlock($e,{key:0,icone:e.icon,"button-props":{tabindex:-1}},null,8,["icone"])):i.createCommentVNode("",!0),i.createElementVNode("span",di,i.toDisplayString(e.text),1)],8,ui)]),_:1},8,["to"])}}}),hi=i.defineComponent({__name:"ScrollToTop",setup(t){const e=i.ref(!1),n=`--${+new Date}`;let o=null;function a(){o==null||o.scrollTo(0,0)}return i.onMounted(()=>{var l;o=((l=document.getElementById(n))==null?void 0:l.parentElement)??null,o&&o.addEventListener("scroll",function(){e.value=this.scrollTop-this.clientHeight>0})}),(l,C)=>(i.openBlock(),i.createElementBlock("button",{id:n,class:i.normalizeClass(["sf-scrollToTop",{"sf-scrollToTop-visible":e.value}]),onClick:a},null,2))}}),pi=i.defineComponent({__name:"Content",props:{class:{},style:{},disableBodyPadding:{type:Boolean},disableHeaderPadding:{type:Boolean},disableFooterPadding:{type:Boolean}},setup(t){const e=t;function n(){return new _e("sf-content").AddClass(e.class,!!e.class).Build()}function o(){return new _e("sf-content-body").AddClass("sf-content-no-padding",e.disableBodyPadding).Build()}function a(){return new _e("sf-content-header").AddClass("sf-content-no-padding",e.disableHeaderPadding).Build()}function l(){return new _e("sf-content-footer").AddClass("sf-content-no-padding",e.disableFooterPadding).Build()}return(C,_)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(n()),style:i.normalizeStyle(e.style)},[i.createElementVNode("div",{class:i.normalizeClass(a())},[i.renderSlot(C.$slots,"header")],2),i.createElementVNode("div",{class:i.normalizeClass(o())},[i.renderSlot(C.$slots,"default"),i.createVNode(hi)],2),i.createElementVNode("div",{class:i.normalizeClass(l())},[i.renderSlot(C.$slots,"footer")],2)],6))}}),mi={class:"sf-tab-navigation"},gi=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})],-1)],bi=["data-active"],yi=["href","onClick"],wi=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})],-1)],vi=i.defineComponent({__name:"TabNavigation",props:{tabs:{}},setup(t){const e=t,n=i.ref(null),o=new ResizeObserver(u=>{_()}),a=i.ref(!1),l=i.ref(!1);function C(u=!1){const O=n.value.clientWidth;n.value.scrollLeft+=u?-O:O}function _(){const u=n.value.scrollWidth-n.value.clientWidth;a.value=n.value.scrollLeft>10,l.value=n.value.scrollLeft<u-10}return i.onMounted(()=>{n.value.addEventListener("scroll",_),o.observe(n.value)}),i.onBeforeUnmount(()=>{var u;try{(u=n.value)==null||u.removeEventListener("scroll",_),o.unobserve(n.value),o.disconnect()}catch{}}),(u,O)=>{const R=i.resolveComponent("RouterLink");return i.openBlock(),i.createElementBlock("div",mi,[i.createElementVNode("div",{class:i.normalizeClass(["left-arrow",{active:a.value}]),onClick:O[0]||(O[0]=X=>C(!0))},gi,2),i.createElementVNode("ul",{ref_key:"trackerContainer",ref:n},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.tabs,X=>(i.openBlock(),i.createBlock(R,{to:X.route,custom:!0},{default:i.withCtx(({navigate:me,isActive:V})=>[i.createElementVNode("li",{"data-active":V},[i.renderSlot(u.$slots,"item",{item:X,navigate:me,isActive:V},()=>[i.createElementVNode("a",{href:X.route,class:i.normalizeClass({active:V}),onClick:me},i.toDisplayString(X.text),11,yi)])],8,bi)]),_:2},1032,["to"]))),256))],512),i.createElementVNode("div",{class:i.normalizeClass(["right-arrow",{active:l.value}]),onClick:O[1]||(O[1]=X=>C())},wi,2)])}}}),ki=["id","name","disabled","data-color","form","type"],xi={class:"sf-button-label"},Ci=i.defineComponent({__name:"Button",props:{icon:{},visible:{type:Boolean,default:!0},class:{},style:{},disabled:{type:Boolean},loading:{type:Boolean},color:{default:"primary"},size:{default:"md"},variant:{default:"filled"},autofocus:{type:Boolean},form:{},name:{},id:{},type:{default:"button"},value:{}},setup(t){const e=t;function n(){return new _e(`${e.class??""} sf-button`).AddClass("sf-component-loading",e.loading).AddClass("sf-component-disabled",e.disabled).AddClass("sf-button-small",e.size==="sm").AddClass("sf-button-medium",e.size==="md").AddClass("sf-button-large",e.size==="lg").AddClass("sf-button-filled",e.variant==="filled").AddClass("sf-button-text",e.variant==="text").AddClass("sf-button-outlined",e.variant==="outlined").AddClass("sf-button-with-icon",!!e.icon).AddClass("sf-ripple").Build()}return(o,a)=>(i.openBlock(),i.createElementBlock("button",{id:e.id,name:e.name,class:i.normalizeClass(n()),style:i.normalizeStyle(e.style),disabled:e.disabled||e.loading,"data-color":e.color,form:e.form,type:e.type},[e.icon?(i.openBlock(),i.createBlock($e,{key:0,icone:e.icon,loading:e.loading,size:e.size,"button-props":{tabindex:-1}},null,8,["icone","loading","size"])):e.loading?(i.openBlock(),i.createBlock($e,{key:1,loading:!0,size:e.size,"button-props":{tabindex:-1}},null,8,["size"])):i.createCommentVNode("",!0),i.createElementVNode("span",xi,[i.renderSlot(o.$slots,"default")])],14,ki))}});class Ai{constructor(e=null){Je(this,"errors",[]);Je(this,"_value",null);this._value=e}get value(){return this._value}set value(e){this._value=e}get hasSuccess(){return!this.hasError}get hasError(){return this.errors.length>0}WithError(e){this.errors.push(e)}}const $i="",Mi="";(()=>{function t(){i.nextTick(()=>{setTimeout(()=>{var n;const e=document.querySelector(":root");e&&e.style.setProperty("--window-height",`${((n=window.visualViewport)==null?void 0:n.height)??window.innerHeight}px`)},1)})}t(),window.addEventListener("resize",t)})(),It.SetInitialTheme(),N.AppResult=Ai,N.AuthService=K,N.Cor=lt,N.SfButton=Ci,N.SfContent=pi,N.SfIcon=$e,N.SfLayout=li,N.SfNavMenuLink=fi,N.SfTabNavigation=vi,N.Tamanho=Se,N.UseDialogService=En,N.UseNavMenuService=ct,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})});
|
|
80
79
|
//# sourceMappingURL=lib.umd.js.map
|