@luizleon/sf.prefeiturasp.vuecomponents 5.1.0 → 5.1.1

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.
@@ -343,7 +343,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
343
343
  - It is not possible to retrieve tokens without redirecting to the Keycloak server (a.k.a. no support for silent authentication).
344
344
  - It is not possible to automatically detect changes to the session status (such as the user logging out in another tab).
345
345
 
346
- For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_modern_browsers`),s.enable=!1,e.silentCheckSsoFallback&&(e.silentCheckSsoRedirectUri=!1)),document.body.removeChild(h),window.removeEventListener("message",w),u.setSuccess()))};window.addEventListener("message",w,!1)}else u.setSuccess();return M(u.promise,e.messageReceiveTimeout,"Timeout when waiting for 3rd party check iframe message.")}function Ze(u){if(!u||u=="default")return{login:function(C){return window.location.assign(e.createLoginUrl(C)),Y().promise},logout:async function(C){if(((C==null?void 0:C.logoutMethod)??e.logoutMethod)==="GET"){window.location.replace(e.createLogoutUrl(C));return}const O=e.createLogoutUrl(C),x=await fetch(O,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({id_token_hint:e.idToken,client_id:e.clientId,post_logout_redirect_uri:n.redirectUri(C,!1)})});if(x.redirected){window.location.href=x.url;return}if(x.ok){window.location.reload();return}throw new Error("Logout failed, request returned an error code.")},register:function(C){return window.location.assign(e.createRegisterUrl(C)),Y().promise},accountManagement:function(){var C=e.createAccountUrl();if(typeof C<"u")window.location.href=C;else throw"Not supported by the OIDC server";return Y().promise},redirectUri:function(C,E){return C&&C.redirectUri?C.redirectUri:e.redirectUri?e.redirectUri:location.href}};if(u=="cordova"){s.enable=!1;var h=function(C,E,O){return window.cordova&&window.cordova.InAppBrowser?window.cordova.InAppBrowser.open(C,E,O):window.open(C,E,O)},w=function(C){return C&&C.cordovaOptions?Object.keys(C.cordovaOptions).reduce(function(E,O){return E[O]=C.cordovaOptions[O],E},{}):{}},I=function(C){return Object.keys(C).reduce(function(E,O){return E.push(O+"="+C[O]),E},[]).join(",")},b=function(C){var E=w(C);return E.location="no",C&&C.prompt=="none"&&(E.hidden="yes"),I(E)},P=function(){return e.redirectUri||"http://localhost"};return{login:function(C){var E=Y(),O=b(C),x=e.createLoginUrl(C),R=h(x,"_blank",O),F=!1,ke=!1,me=function(){ke=!0,R.close()};return R.addEventListener("loadstart",function(pe){if(pe.url.indexOf(P())==0){var Je=ne(pe.url);k(Je,E),me(),F=!0}}),R.addEventListener("loaderror",function(pe){if(!F)if(pe.url.indexOf(P())==0){var Je=ne(pe.url);k(Je,E),me(),F=!0}else E.setError(),me()}),R.addEventListener("exit",function(pe){ke||E.setError({reason:"closed_by_user"})}),E.promise},logout:function(C){var E=Y(),O=e.createLogoutUrl(C),x=h(O,"_blank","location=no,hidden=yes,clearcache=yes"),R;return x.addEventListener("loadstart",function(F){F.url.indexOf(P())==0&&x.close()}),x.addEventListener("loaderror",function(F){F.url.indexOf(P())==0||(R=!0),x.close()}),x.addEventListener("exit",function(F){R?E.setError():(e.clearToken(),E.setSuccess())}),E.promise},register:function(C){var E=Y(),O=e.createRegisterUrl(),x=b(C),R=h(O,"_blank",x);return R.addEventListener("loadstart",function(F){if(F.url.indexOf(P())==0){R.close();var ke=ne(F.url);k(ke,E)}}),E.promise},accountManagement:function(){var C=e.createAccountUrl();if(typeof C<"u"){var E=h(C,"_blank","location=no");E.addEventListener("loadstart",function(O){O.url.indexOf(P())==0&&E.close()})}else throw"Not supported by the OIDC server"},redirectUri:function(C){return P()}}}if(u=="cordova-native")return s.enable=!1,{login:function(C){var E=Y(),O=e.createLoginUrl(C);return universalLinks.subscribe("keycloak",function(x){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var R=ne(x.url);k(R,E)}),window.cordova.plugins.browsertab.openUrl(O),E.promise},logout:function(C){var E=Y(),O=e.createLogoutUrl(C);return universalLinks.subscribe("keycloak",function(x){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close(),e.clearToken(),E.setSuccess()}),window.cordova.plugins.browsertab.openUrl(O),E.promise},register:function(C){var E=Y(),O=e.createRegisterUrl(C);return universalLinks.subscribe("keycloak",function(x){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var R=ne(x.url);k(R,E)}),window.cordova.plugins.browsertab.openUrl(O),E.promise},accountManagement:function(){var C=e.createAccountUrl();if(typeof C<"u")window.cordova.plugins.browsertab.openUrl(C);else throw"Not supported by the OIDC server"},redirectUri:function(C){return C&&C.redirectUri?C.redirectUri:e.redirectUri?e.redirectUri:"http://localhost"}};throw"invalid adapter type: "+u}var Fe=function(){if(!(this instanceof Fe))return new Fe;localStorage.setItem("kc-test","test"),localStorage.removeItem("kc-test");var u=this;function h(){for(var w=new Date().getTime(),I=0;I<localStorage.length;I++){var b=localStorage.key(I);if(b&&b.indexOf("kc-callback-")==0){var P=localStorage.getItem(b);if(P)try{var C=JSON.parse(P).expires;(!C||C<w)&&localStorage.removeItem(b)}catch{localStorage.removeItem(b)}}}}u.get=function(w){if(w){var I="kc-callback-"+w,b=localStorage.getItem(I);return b&&(localStorage.removeItem(I),b=JSON.parse(b)),h(),b}},u.add=function(w){h();var I="kc-callback-"+w.state;w.expires=new Date().getTime()+60*60*1e3,localStorage.setItem(I,JSON.stringify(w))}},ze=function(){if(!(this instanceof ze))return new ze;var u=this;u.get=function(b){if(b){var P=w("kc-callback-"+b);if(I("kc-callback-"+b,"",h(-100)),P)return JSON.parse(P)}},u.add=function(b){I("kc-callback-"+b.state,JSON.stringify(b),h(60))},u.removeItem=function(b){I(b,"",h(-100))};var h=function(b){var P=new Date;return P.setTime(P.getTime()+b*60*1e3),P},w=function(b){for(var P=b+"=",C=document.cookie.split(";"),E=0;E<C.length;E++){for(var O=C[E];O.charAt(0)==" ";)O=O.substring(1);if(O.indexOf(P)==0)return O.substring(P.length,O.length)}return""},I=function(b,P,C){var E=b+"="+P+"; expires="+C.toUTCString()+"; ";document.cookie=E}};function ht(){try{return new Fe}catch{}return new ze}function $e(u){return function(){e.enableLogging&&u.apply(console,Array.prototype.slice.call(arguments))}}}function tc(t){const e=String.fromCodePoint(...t);return btoa(e)}class nc{constructor(e){ee(this,"oidc");ee(this,"isAuthenticated",!1);ee(this,"authenticatedWith",null);this.oidc=new Mr(e)}async InitAsync(e={}){return await this.oidc.init(e).then(async n=>(this.isAuthenticated=n,this.authenticatedWith=this.AuthenticatedWith(),n)).catch(n=>(console.info("Ocorreu um erro na inicialização. Verifique o console para mais detalhes."),console.error(n),!1))}LoginGovBr(){this.oidc.login({idpHint:"GOV.BR"})}LoginSenhaweb(){var n;const e=(n=this.oidc.authServerUrl)!=null&&n.startsWith("https://keycloak.dev.apps.sf.prefeitura.sp.gov.br")?"senhawebdev":"senhaweb";this.oidc.login({idpHint:e})}AuthenticatedWith(){var n,o;const e=this.oidc.tokenParsed;return e?(n=e.identity_provider)!=null&&n.startsWith("GOV.BR")?"govbr":(o=e.identity_provider)!=null&&o.startsWith("senhaweb")?"senhaweb":"ad":null}}let Dr;function oc(t){Dr=new nc(t)}const Sn=()=>Dr,Rr=Symbol();function rc(){return r.inject(Rr)}const Gt=()=>rc(),ic={class:"body"},sc={class:"my-3 name"},ac={class:"login-buttons py-3 mx-auto"},lc={class:"my-3 footer"},cc=We(r.defineComponent({__name:"Login",props:{enableAdlogin:{type:Boolean}},setup(t){const e=t,n=r.ref(null),{width:o}=Vl(n),i=r.computed(()=>o.value>300?"md":"sm"),s=Sn(),{ClearStoredTheme:l,EnableLightMode:a}=Gt(),c=r.computed(()=>e.enableAdlogin===!0),d=r.ref(!1),f=r.ref(null);async function p(g){d.value||(d.value=!0,f.value=g,await new Promise(v=>setTimeout(v,400)),l(),g==="govbr"?s.LoginGovBr():c&&g==="sf"&&s.oidc.login())}return r.onBeforeMount(()=>{a()}),(g,v)=>(r.openBlock(),r.createElementBlock("div",ic,[v[6]||(v[6]=r.createElementVNode("div",{class:"bg"},null,-1)),r.createElementVNode("div",{class:"card",ref_key:"cardRef",ref:n},[v[5]||(v[5]=r.createElementVNode("div",{class:"my-3 logo"},null,-1)),r.createElementVNode("div",sc,[r.renderSlot(g.$slots,"name",{},()=>[v[2]||(v[2]=r.createTextVNode("Nome do sistema"))],!0)]),r.createElementVNode("div",ac,[r.renderSlot(g.$slots,"buttons",r.normalizeProps(r.guardReactiveProps({Login:p})),()=>[r.createVNode(r.unref(Fn),{size:i.value,icon:"person","icon-filled":!0,class:r.normalizeClass("w-full text-nowrap justify-content-center"),loading:d.value&&f.value==="govbr",onClick:v[0]||(v[0]=_=>p("govbr"))},{default:r.withCtx(()=>v[3]||(v[3]=[r.createTextVNode(" Entrar com "),r.createElementVNode("b",null,"Gov.br",-1)])),_:1},8,["size","loading"]),c.value?(r.openBlock(),r.createBlock(r.unref(Fn),{key:0,size:i.value,icon:"person","icon-filled":!0,class:r.normalizeClass("w-full text-nowrap justify-content-center"),loading:d.value&&f.value==="sf",onClick:v[1]||(v[1]=_=>p("sf"))},{default:r.withCtx(()=>v[4]||(v[4]=[r.createTextVNode(" Entrar com "),r.createElementVNode("b",null,"SF",-1)])),_:1},8,["size","loading"])):r.createCommentVNode("",!0),r.renderSlot(g.$slots,"extra-button",{},void 0,!0)],!0)]),r.createElementVNode("div",lc,[r.renderSlot(g.$slots,"footer",{},void 0,!0)])],512)]))}}),[["__scopeId","data-v-c097519d"]]);class uc{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()}ClearStoredTheme(){localStorage.removeItem("color-scheme")}}const qt=new uc,Ur="SweetAlert2:",dc=t=>{const e=[];for(let n=0;n<t.length;n++)e.indexOf(t[n])===-1&&e.push(t[n]);return e},ao=t=>t.charAt(0).toUpperCase()+t.slice(1),Ie=t=>Array.prototype.slice.call(t),_e=t=>{console.warn(`${Ur} ${typeof t=="object"?t.join(" "):t}`)},ut=t=>{console.error(`${Ur} ${t}`)},Vr=[],fc=t=>{Vr.includes(t)||(Vr.push(t),_e(t))},mc=(t,e)=>{fc(`"${t}" is deprecated and will be removed in the next major release. Please use "${e}" instead.`)},_n=t=>typeof t=="function"?t():t,lo=t=>t&&typeof t.toPromise=="function",Yt=t=>lo(t)?t.toPromise():Promise.resolve(t),co=t=>t&&Promise.resolve(t)===t,vt={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:"&times;",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},pc=["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"],hc={},gc=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],Hr=t=>Object.prototype.hasOwnProperty.call(vt,t),jr=t=>pc.indexOf(t)!==-1,uo=t=>hc[t],yc=t=>{Hr(t)||_e(`Unknown parameter "${t}"`)},bc=t=>{gc.includes(t)&&_e(`The parameter "${t}" is incompatible with toasts`)},vc=t=>{uo(t)&&mc(t,uo(t))},wc=t=>{!t.backdrop&&t.allowOutsideClick&&_e('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');for(const e in t)yc(e),t.toast&&bc(e),vc(e)},kc="swal2-",Fr=t=>{const e={};for(const n in t)e[t[n]]=kc+t[n];return e},y=Fr(["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"]),Xt=Fr(["success","warning","info","question","error"]),ae=()=>document.body.querySelector(`.${y.container}`),Zt=t=>{const e=ae();return e?e.querySelector(t):null},Le=t=>Zt(`.${t}`),J=()=>Le(y.popup),Jt=()=>Le(y.icon),zr=()=>Le(y.title),Cn=()=>Le(y["html-container"]),Kr=()=>Le(y.image),Wr=()=>Le(y["progress-steps"]),En=()=>Le(y["validation-message"]),De=()=>Zt(`.${y.actions} .${y.confirm}`),st=()=>Zt(`.${y.actions} .${y.deny}`),Sc=()=>Le(y["input-label"]),wt=()=>Zt(`.${y.loader}`),dt=()=>Zt(`.${y.actions} .${y.cancel}`),Qt=()=>Le(y.actions),Gr=()=>Le(y.footer),Tn=()=>Le(y["timer-progress-bar"]),fo=()=>Le(y.close),_c=`
346
+ For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_modern_browsers`),s.enable=!1,e.silentCheckSsoFallback&&(e.silentCheckSsoRedirectUri=!1)),document.body.removeChild(h),window.removeEventListener("message",w),u.setSuccess()))};window.addEventListener("message",w,!1)}else u.setSuccess();return M(u.promise,e.messageReceiveTimeout,"Timeout when waiting for 3rd party check iframe message.")}function Ze(u){if(!u||u=="default")return{login:function(C){return window.location.assign(e.createLoginUrl(C)),Y().promise},logout:async function(C){if(((C==null?void 0:C.logoutMethod)??e.logoutMethod)==="GET"){window.location.replace(e.createLogoutUrl(C));return}const O=e.createLogoutUrl(C),x=await fetch(O,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({id_token_hint:e.idToken,client_id:e.clientId,post_logout_redirect_uri:n.redirectUri(C,!1)})});if(x.redirected){window.location.href=x.url;return}if(x.ok){window.location.reload();return}throw new Error("Logout failed, request returned an error code.")},register:function(C){return window.location.assign(e.createRegisterUrl(C)),Y().promise},accountManagement:function(){var C=e.createAccountUrl();if(typeof C<"u")window.location.href=C;else throw"Not supported by the OIDC server";return Y().promise},redirectUri:function(C,E){return C&&C.redirectUri?C.redirectUri:e.redirectUri?e.redirectUri:location.href}};if(u=="cordova"){s.enable=!1;var h=function(C,E,O){return window.cordova&&window.cordova.InAppBrowser?window.cordova.InAppBrowser.open(C,E,O):window.open(C,E,O)},w=function(C){return C&&C.cordovaOptions?Object.keys(C.cordovaOptions).reduce(function(E,O){return E[O]=C.cordovaOptions[O],E},{}):{}},I=function(C){return Object.keys(C).reduce(function(E,O){return E.push(O+"="+C[O]),E},[]).join(",")},b=function(C){var E=w(C);return E.location="no",C&&C.prompt=="none"&&(E.hidden="yes"),I(E)},P=function(){return e.redirectUri||"http://localhost"};return{login:function(C){var E=Y(),O=b(C),x=e.createLoginUrl(C),R=h(x,"_blank",O),F=!1,ke=!1,me=function(){ke=!0,R.close()};return R.addEventListener("loadstart",function(pe){if(pe.url.indexOf(P())==0){var Je=ne(pe.url);k(Je,E),me(),F=!0}}),R.addEventListener("loaderror",function(pe){if(!F)if(pe.url.indexOf(P())==0){var Je=ne(pe.url);k(Je,E),me(),F=!0}else E.setError(),me()}),R.addEventListener("exit",function(pe){ke||E.setError({reason:"closed_by_user"})}),E.promise},logout:function(C){var E=Y(),O=e.createLogoutUrl(C),x=h(O,"_blank","location=no,hidden=yes,clearcache=yes"),R;return x.addEventListener("loadstart",function(F){F.url.indexOf(P())==0&&x.close()}),x.addEventListener("loaderror",function(F){F.url.indexOf(P())==0||(R=!0),x.close()}),x.addEventListener("exit",function(F){R?E.setError():(e.clearToken(),E.setSuccess())}),E.promise},register:function(C){var E=Y(),O=e.createRegisterUrl(),x=b(C),R=h(O,"_blank",x);return R.addEventListener("loadstart",function(F){if(F.url.indexOf(P())==0){R.close();var ke=ne(F.url);k(ke,E)}}),E.promise},accountManagement:function(){var C=e.createAccountUrl();if(typeof C<"u"){var E=h(C,"_blank","location=no");E.addEventListener("loadstart",function(O){O.url.indexOf(P())==0&&E.close()})}else throw"Not supported by the OIDC server"},redirectUri:function(C){return P()}}}if(u=="cordova-native")return s.enable=!1,{login:function(C){var E=Y(),O=e.createLoginUrl(C);return universalLinks.subscribe("keycloak",function(x){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var R=ne(x.url);k(R,E)}),window.cordova.plugins.browsertab.openUrl(O),E.promise},logout:function(C){var E=Y(),O=e.createLogoutUrl(C);return universalLinks.subscribe("keycloak",function(x){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close(),e.clearToken(),E.setSuccess()}),window.cordova.plugins.browsertab.openUrl(O),E.promise},register:function(C){var E=Y(),O=e.createRegisterUrl(C);return universalLinks.subscribe("keycloak",function(x){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var R=ne(x.url);k(R,E)}),window.cordova.plugins.browsertab.openUrl(O),E.promise},accountManagement:function(){var C=e.createAccountUrl();if(typeof C<"u")window.cordova.plugins.browsertab.openUrl(C);else throw"Not supported by the OIDC server"},redirectUri:function(C){return C&&C.redirectUri?C.redirectUri:e.redirectUri?e.redirectUri:"http://localhost"}};throw"invalid adapter type: "+u}var Fe=function(){if(!(this instanceof Fe))return new Fe;localStorage.setItem("kc-test","test"),localStorage.removeItem("kc-test");var u=this;function h(){for(var w=new Date().getTime(),I=0;I<localStorage.length;I++){var b=localStorage.key(I);if(b&&b.indexOf("kc-callback-")==0){var P=localStorage.getItem(b);if(P)try{var C=JSON.parse(P).expires;(!C||C<w)&&localStorage.removeItem(b)}catch{localStorage.removeItem(b)}}}}u.get=function(w){if(w){var I="kc-callback-"+w,b=localStorage.getItem(I);return b&&(localStorage.removeItem(I),b=JSON.parse(b)),h(),b}},u.add=function(w){h();var I="kc-callback-"+w.state;w.expires=new Date().getTime()+60*60*1e3,localStorage.setItem(I,JSON.stringify(w))}},ze=function(){if(!(this instanceof ze))return new ze;var u=this;u.get=function(b){if(b){var P=w("kc-callback-"+b);if(I("kc-callback-"+b,"",h(-100)),P)return JSON.parse(P)}},u.add=function(b){I("kc-callback-"+b.state,JSON.stringify(b),h(60))},u.removeItem=function(b){I(b,"",h(-100))};var h=function(b){var P=new Date;return P.setTime(P.getTime()+b*60*1e3),P},w=function(b){for(var P=b+"=",C=document.cookie.split(";"),E=0;E<C.length;E++){for(var O=C[E];O.charAt(0)==" ";)O=O.substring(1);if(O.indexOf(P)==0)return O.substring(P.length,O.length)}return""},I=function(b,P,C){var E=b+"="+P+"; expires="+C.toUTCString()+"; ";document.cookie=E}};function ht(){try{return new Fe}catch{}return new ze}function $e(u){return function(){e.enableLogging&&u.apply(console,Array.prototype.slice.call(arguments))}}}function tc(t){const e=String.fromCodePoint(...t);return btoa(e)}class nc{constructor(e){ee(this,"oidc");ee(this,"isAuthenticated",!1);ee(this,"authenticatedWith",null);this.oidc=new Mr(e)}async InitAsync(e={}){return await this.oidc.init(e).then(async n=>(this.isAuthenticated=n,this.authenticatedWith=this.AuthenticatedWith(),n)).catch(n=>(console.info("Ocorreu um erro na inicialização. Verifique o console para mais detalhes."),console.error(n),!1))}LoginGovBr(){this.oidc.login({idpHint:"GOV.BR"})}LoginSenhaweb(){var n;const e=(n=this.oidc.authServerUrl)!=null&&n.startsWith("https://keycloak.dev.apps.sf.prefeitura.sp.gov.br")?"senhawebdev":"senhaweb";this.oidc.login({idpHint:e})}AuthenticatedWith(){var n,o;const e=this.oidc.tokenParsed;return e?(n=e.identity_provider)!=null&&n.startsWith("GOV.BR")?"govbr":(o=e.identity_provider)!=null&&o.startsWith("senhaweb")?"senhaweb":"ad":null}}let Dr;function oc(t){Dr=new nc(t)}const Sn=()=>Dr,Rr=Symbol();function rc(){return r.inject(Rr)}const Gt=()=>rc(),ic={class:"body"},sc={class:"my-3 name"},ac={class:"login-buttons py-3 mx-auto"},lc={class:"my-3 footer"},cc=We(r.defineComponent({__name:"Login",props:{enableAdlogin:{type:Boolean}},setup(t){const e=t,n=r.ref(null),{width:o}=Vl(n),i=r.computed(()=>o.value>300?"md":"sm"),s=Sn(),{ClearStoredTheme:l,EnableLightMode:a}=Gt(),c=r.computed(()=>e.enableAdlogin===!0),d=r.ref(!1),f=r.ref(null);async function p(g){d.value||(d.value=!0,f.value=g,await new Promise(v=>setTimeout(v,400)),l(),g==="govbr"?s.LoginGovBr():c&&g==="sf"&&s.oidc.login())}return r.onBeforeMount(()=>{a()}),(g,v)=>(r.openBlock(),r.createElementBlock("div",ic,[v[6]||(v[6]=r.createElementVNode("div",{class:"bg"},null,-1)),r.createElementVNode("div",{class:"card",ref_key:"cardRef",ref:n},[v[5]||(v[5]=r.createElementVNode("div",{class:"my-3 logo"},null,-1)),r.createElementVNode("div",sc,[r.renderSlot(g.$slots,"name",{},()=>[v[2]||(v[2]=r.createTextVNode("Nome do sistema"))],!0)]),r.createElementVNode("div",ac,[r.renderSlot(g.$slots,"buttons",r.normalizeProps(r.guardReactiveProps({Login:p})),()=>[r.createVNode(r.unref(Fn),{size:i.value,icon:"person","icon-filled":!0,class:r.normalizeClass("w-full text-nowrap justify-content-center"),loading:d.value&&f.value==="govbr",onClick:v[0]||(v[0]=_=>p("govbr"))},{default:r.withCtx(()=>v[3]||(v[3]=[r.createTextVNode(" Entrar com "),r.createElementVNode("b",null,"Gov.br",-1)])),_:1},8,["size","loading"]),c.value?(r.openBlock(),r.createBlock(r.unref(Fn),{key:0,size:i.value,icon:"person","icon-filled":!0,class:r.normalizeClass("w-full text-nowrap justify-content-center"),loading:d.value&&f.value==="sf",onClick:v[1]||(v[1]=_=>p("sf"))},{default:r.withCtx(()=>v[4]||(v[4]=[r.createTextVNode(" Entrar com "),r.createElementVNode("b",null,"SF",-1)])),_:1},8,["size","loading"])):r.createCommentVNode("",!0),r.renderSlot(g.$slots,"extra-button",{},void 0,!0)],!0)]),r.createElementVNode("div",lc,[r.renderSlot(g.$slots,"footer",{},void 0,!0)])],512)]))}}),[["__scopeId","data-v-34abf460"]]);class uc{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()}ClearStoredTheme(){localStorage.removeItem("color-scheme")}}const qt=new uc,Ur="SweetAlert2:",dc=t=>{const e=[];for(let n=0;n<t.length;n++)e.indexOf(t[n])===-1&&e.push(t[n]);return e},ao=t=>t.charAt(0).toUpperCase()+t.slice(1),Ie=t=>Array.prototype.slice.call(t),_e=t=>{console.warn(`${Ur} ${typeof t=="object"?t.join(" "):t}`)},ut=t=>{console.error(`${Ur} ${t}`)},Vr=[],fc=t=>{Vr.includes(t)||(Vr.push(t),_e(t))},mc=(t,e)=>{fc(`"${t}" is deprecated and will be removed in the next major release. Please use "${e}" instead.`)},_n=t=>typeof t=="function"?t():t,lo=t=>t&&typeof t.toPromise=="function",Yt=t=>lo(t)?t.toPromise():Promise.resolve(t),co=t=>t&&Promise.resolve(t)===t,vt={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:"&times;",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},pc=["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"],hc={},gc=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],Hr=t=>Object.prototype.hasOwnProperty.call(vt,t),jr=t=>pc.indexOf(t)!==-1,uo=t=>hc[t],yc=t=>{Hr(t)||_e(`Unknown parameter "${t}"`)},bc=t=>{gc.includes(t)&&_e(`The parameter "${t}" is incompatible with toasts`)},vc=t=>{uo(t)&&mc(t,uo(t))},wc=t=>{!t.backdrop&&t.allowOutsideClick&&_e('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');for(const e in t)yc(e),t.toast&&bc(e),vc(e)},kc="swal2-",Fr=t=>{const e={};for(const n in t)e[t[n]]=kc+t[n];return e},y=Fr(["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"]),Xt=Fr(["success","warning","info","question","error"]),ae=()=>document.body.querySelector(`.${y.container}`),Zt=t=>{const e=ae();return e?e.querySelector(t):null},Le=t=>Zt(`.${t}`),J=()=>Le(y.popup),Jt=()=>Le(y.icon),zr=()=>Le(y.title),Cn=()=>Le(y["html-container"]),Kr=()=>Le(y.image),Wr=()=>Le(y["progress-steps"]),En=()=>Le(y["validation-message"]),De=()=>Zt(`.${y.actions} .${y.confirm}`),st=()=>Zt(`.${y.actions} .${y.deny}`),Sc=()=>Le(y["input-label"]),wt=()=>Zt(`.${y.loader}`),dt=()=>Zt(`.${y.actions} .${y.cancel}`),Qt=()=>Le(y.actions),Gr=()=>Le(y.footer),Tn=()=>Le(y["timer-progress-bar"]),fo=()=>Le(y.close),_c=`
347
347
  a[href],
348
348
  area[href],
349
349
  input:not([disabled]),