@luizleon/sf.prefeiturasp.vuecomponents 4.0.12 → 4.0.14

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/index.d.ts CHANGED
@@ -7,12 +7,12 @@ import { default as SfDrawer } from './components/drawer/Drawer';
7
7
  import { default as SfMessage } from './components/message/Message';
8
8
  import { default as SfTooltip } from './components/tooltip/Tooltip';
9
9
  import { default as SfNavMenu } from './components/navmenu/NavMenu';
10
- import { ThemeToggleBase } from './components/internal/ThemeToggle';
11
10
  import { UseNavMenuService } from './services/navMenuService';
12
11
  import { UseAlertService, UseConfirmService } from './services/dialogService';
13
12
  import { StartAuthService, UseAuthService } from './services/authService';
14
13
  import { AppResult } from './common/appResult';
15
14
  import { AxiosClient, UseAxiosClient } from './axios/axiosClient';
16
15
  declare function RemovePreloader(): void;
17
- export { SfLayout, SfIcon, SfContent, SfTabNavigation, SfButton, SfDrawer, SfMessage, SfTooltip, SfNavMenu, StartAuthService, UseAuthService, UseNavMenuService, UseConfirmService, UseAlertService, UseAxiosClient, RemovePreloader, AppResult, AxiosClient, ThemeToggleBase, };
16
+ declare function ToggleTheme(): void;
17
+ export { SfLayout, SfIcon, SfContent, SfTabNavigation, SfButton, SfDrawer, SfMessage, SfTooltip, SfNavMenu, StartAuthService, UseAuthService, UseNavMenuService, UseConfirmService, UseAlertService, UseAxiosClient, RemovePreloader, AppResult, AxiosClient, ToggleTheme, };
18
18
  export * from './types';
@@ -419,5 +419,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
419
419
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(o=>r.set(o)),r}static accessor(e){const r=(this[xi]=this[xi]={accessors:{}}).accessors,o=this.prototype;function i(s){const l=Kt(s);r[l]||(sh(o,s),r[l]=!0)}return y.isArray(e)?e.forEach(i):i(e),this}}Oe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);y.reduceDescriptors(Oe.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});y.freezeMethods(Oe);function wr(t,e){const n=this||yn,r=e||n,o=Oe.from(r.headers);let i=r.data;return y.forEach(t,function(l){i=l.call(n,i,o.normalize(),e?e.status:void 0)}),o.normalize(),i}function oa(t){return!!(t&&t.__CANCEL__)}function Bt(t,e,n){J.call(this,t??"canceled",J.ERR_CANCELED,e,n),this.name="CanceledError"}y.inherits(Bt,J,{__CANCEL__:!0});function ia(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new J("Request failed with status code "+n.status,[J.ERR_BAD_REQUEST,J.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function ah(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function lh(t,e){t=t||10;const n=new Array(t),r=new Array(t);let o=0,i=0,s;return e=e!==void 0?e:1e3,function(a){const u=Date.now(),d=r[i];s||(s=u),n[o]=a,r[o]=u;let m=i,g=0;for(;m!==o;)g+=n[m++],m=m%t;if(o=(o+1)%t,o===i&&(i=(i+1)%t),u-s<e)return;const _=d&&u-d;return _?Math.round(g*1e3/_):void 0}}function ch(t,e){let n=0,r=1e3/e,o,i;const s=(u,d=Date.now())=>{n=d,o=null,i&&(clearTimeout(i),i=null),t.apply(null,u)};return[(...u)=>{const d=Date.now(),m=d-n;m>=r?s(u,d):(o=u,i||(i=setTimeout(()=>{i=null,s(o)},r-m)))},()=>o&&s(o)]}const Dn=(t,e,n=3)=>{let r=0;const o=lh(50,250);return ch(i=>{const s=i.loaded,l=i.lengthComputable?i.total:void 0,a=s-r,u=o(a),d=s<=l;r=s;const m={loaded:s,total:l,progress:l?s/l:void 0,bytes:a,rate:u||void 0,estimated:u&&l&&d?(l-s)/u:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(m)},n)},Pi=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Ii=t=>(...e)=>y.asap(()=>t(...e)),uh=qe.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function o(i){let s=i;return e&&(n.setAttribute("href",s),s=n.href),n.setAttribute("href",s),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(s){const l=y.isString(s)?o(s):s;return l.protocol===r.protocol&&l.host===r.host}}():function(){return function(){return!0}}(),dh=qe.hasStandardBrowserEnv?{write(t,e,n,r,o,i){const s=[t+"="+encodeURIComponent(e)];y.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),y.isString(r)&&s.push("path="+r),y.isString(o)&&s.push("domain="+o),i===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function fh(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function mh(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function sa(t,e){return t&&!fh(e)?mh(t,e):e}const Oi=t=>t instanceof Oe?{...t}:t;function wt(t,e){e=e||{};const n={};function r(u,d,m){return y.isPlainObject(u)&&y.isPlainObject(d)?y.merge.call({caseless:m},u,d):y.isPlainObject(d)?y.merge({},d):y.isArray(d)?d.slice():d}function o(u,d,m){if(y.isUndefined(d)){if(!y.isUndefined(u))return r(void 0,u,m)}else return r(u,d,m)}function i(u,d){if(!y.isUndefined(d))return r(void 0,d)}function s(u,d){if(y.isUndefined(d)){if(!y.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,m){if(m in e)return r(u,d);if(m in t)return r(void 0,u)}const a={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:l,headers:(u,d)=>o(Oi(u),Oi(d),!0)};return y.forEach(Object.keys(Object.assign({},t,e)),function(d){const m=a[d]||o,g=m(t[d],e[d],d);y.isUndefined(g)&&m!==l||(n[d]=g)}),n}const aa=t=>{const e=wt({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:l}=e;e.headers=s=Oe.from(s),e.url=ta(sa(e.baseURL,e.url),t.params,t.paramsSerializer),l&&s.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let a;if(y.isFormData(n)){if(qe.hasStandardBrowserEnv||qe.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((a=s.getContentType())!==!1){const[u,...d]=a?a.split(";").map(m=>m.trim()).filter(Boolean):[];s.setContentType([u||"multipart/form-data",...d].join("; "))}}if(qe.hasStandardBrowserEnv&&(r&&y.isFunction(r)&&(r=r(e)),r||r!==!1&&uh(e.url))){const u=o&&i&&dh.read(i);u&&s.set(o,u)}return e},ph=typeof XMLHttpRequest<"u",hh=ph&&function(t){return new Promise(function(n,r){const o=aa(t);let i=o.data;const s=Oe.from(o.headers).normalize();let{responseType:l,onUploadProgress:a,onDownloadProgress:u}=o,d,m,g,_,v;function $(){_&&_(),v&&v(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let S=new XMLHttpRequest;S.open(o.method.toUpperCase(),o.url,!0),S.timeout=o.timeout;function j(){if(!S)return;const E=Oe.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),Q={data:!l||l==="text"||l==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:E,config:t,request:S};ia(function(T){n(T),$()},function(T){r(T),$()},Q),S=null}"onloadend"in S?S.onloadend=j:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(j)},S.onabort=function(){S&&(r(new J("Request aborted",J.ECONNABORTED,t,S)),S=null)},S.onerror=function(){r(new J("Network Error",J.ERR_NETWORK,t,S)),S=null},S.ontimeout=function(){let G=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const Q=o.transitional||na;o.timeoutErrorMessage&&(G=o.timeoutErrorMessage),r(new J(G,Q.clarifyTimeoutError?J.ETIMEDOUT:J.ECONNABORTED,t,S)),S=null},i===void 0&&s.setContentType(null),"setRequestHeader"in S&&y.forEach(s.toJSON(),function(G,Q){S.setRequestHeader(Q,G)}),y.isUndefined(o.withCredentials)||(S.withCredentials=!!o.withCredentials),l&&l!=="json"&&(S.responseType=o.responseType),u&&([g,v]=Dn(u,!0),S.addEventListener("progress",g)),a&&S.upload&&([m,_]=Dn(a),S.upload.addEventListener("progress",m),S.upload.addEventListener("loadend",_)),(o.cancelToken||o.signal)&&(d=E=>{S&&(r(!E||E.type?new Bt(null,t,S):E),S.abort(),S=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const A=ah(o.url);if(A&&qe.protocols.indexOf(A)===-1){r(new J("Unsupported protocol "+A+":",J.ERR_BAD_REQUEST,t));return}S.send(i||null)})},gh=(t,e)=>{let n=new AbortController,r;const o=function(a){if(!r){r=!0,s();const u=a instanceof Error?a:this.reason;n.abort(u instanceof J?u:new Bt(u instanceof Error?u.message:u))}};let i=e&&setTimeout(()=>{o(new J(`timeout ${e} of ms exceeded`,J.ETIMEDOUT))},e);const s=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(a=>{a&&(a.removeEventListener?a.removeEventListener("abort",o):a.unsubscribe(o))}),t=null)};t.forEach(a=>a&&a.addEventListener&&a.addEventListener("abort",o));const{signal:l}=n;return l.unsubscribe=s,[l,()=>{i&&clearTimeout(i),i=null}]},yh=function*(t,e){let n=t.byteLength;if(!e||n<e){yield t;return}let r=0,o;for(;r<n;)o=r+e,yield t.slice(r,o),r=o},vh=async function*(t,e,n){for await(const r of t)yield*yh(ArrayBuffer.isView(r)?r:await n(String(r)),e)},Li=(t,e,n,r,o)=>{const i=vh(t,e,o);let s=0,l,a=u=>{l||(l=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:d,value:m}=await i.next();if(d){a(),u.close();return}let g=m.byteLength;if(n){let _=s+=g;n(_)}u.enqueue(new Uint8Array(m))}catch(d){throw a(d),d}},cancel(u){return a(u),i.return()}},{highWaterMark:2})},Zn=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",la=Zn&&typeof ReadableStream=="function",Br=Zn&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),ca=(t,...e)=>{try{return!!t(...e)}catch{return!1}},bh=la&&ca(()=>{let t=!1;const e=new Request(qe.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Ri=64*1024,Dr=la&&ca(()=>y.isReadableStream(new Response("").body)),Fn={stream:Dr&&(t=>t.body)};Zn&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Fn[e]&&(Fn[e]=y.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new J(`Response type '${e}' is not supported`,J.ERR_NOT_SUPPORT,r)})})})(new Response);const wh=async t=>{if(t==null)return 0;if(y.isBlob(t))return t.size;if(y.isSpecCompliantForm(t))return(await new Request(t).arrayBuffer()).byteLength;if(y.isArrayBufferView(t)||y.isArrayBuffer(t))return t.byteLength;if(y.isURLSearchParams(t)&&(t=t+""),y.isString(t))return(await Br(t)).byteLength},Sh=async(t,e)=>{const n=y.toFiniteNumber(t.getContentLength());return n??wh(e)},_h=Zn&&(async t=>{let{url:e,method:n,data:r,signal:o,cancelToken:i,timeout:s,onDownloadProgress:l,onUploadProgress:a,responseType:u,headers:d,withCredentials:m="same-origin",fetchOptions:g}=aa(t);u=u?(u+"").toLowerCase():"text";let[_,v]=o||i||s?gh([o,i],s):[],$,S;const j=()=>{!$&&setTimeout(()=>{_&&_.unsubscribe()}),$=!0};let A;try{if(a&&bh&&n!=="get"&&n!=="head"&&(A=await Sh(d,r))!==0){let b=new Request(e,{method:"POST",body:r,duplex:"half"}),T;if(y.isFormData(r)&&(T=b.headers.get("content-type"))&&d.setContentType(T),b.body){const[M,I]=Pi(A,Dn(Ii(a)));r=Li(b.body,Ri,M,I,Br)}}y.isString(m)||(m=m?"include":"omit"),S=new Request(e,{...g,signal:_,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:m});let E=await fetch(S);const G=Dr&&(u==="stream"||u==="response");if(Dr&&(l||G)){const b={};["status","statusText","headers"].forEach(O=>{b[O]=E[O]});const T=y.toFiniteNumber(E.headers.get("content-length")),[M,I]=l&&Pi(T,Dn(Ii(l),!0))||[];E=new Response(Li(E.body,Ri,M,()=>{I&&I(),G&&j()},Br),b)}u=u||"text";let Q=await Fn[y.findKey(Fn,u)||"text"](E,t);return!G&&j(),v&&v(),await new Promise((b,T)=>{ia(b,T,{data:Q,headers:Oe.from(E.headers),status:E.status,statusText:E.statusText,config:t,request:S})})}catch(E){throw j(),E&&E.name==="TypeError"&&/fetch/i.test(E.message)?Object.assign(new J("Network Error",J.ERR_NETWORK,t,S),{cause:E.cause||E}):J.from(E,E&&E.code,t,S)}}),Fr={http:Mp,xhr:hh,fetch:_h};y.forEach(Fr,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const $i=t=>`- ${t}`,kh=t=>y.isFunction(t)||t===null||t===!1,ua={getAdapter:t=>{t=y.isArray(t)?t:[t];const{length:e}=t;let n,r;const o={};for(let i=0;i<e;i++){n=t[i];let s;if(r=n,!kh(n)&&(r=Fr[(s=String(n)).toLowerCase()],r===void 0))throw new J(`Unknown adapter '${s}'`);if(r)break;o[s||"#"+i]=r}if(!r){const i=Object.entries(o).map(([l,a])=>`adapter ${l} `+(a===!1?"is not supported by the environment":"is not available in the build"));let s=e?i.length>1?`since :
420
420
  `+i.map($i).join(`
421
421
  `):" "+$i(i[0]):"as no adapter specified";throw new J("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:Fr};function Sr(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Bt(null,t)}function Ni(t){return Sr(t),t.headers=Oe.from(t.headers),t.data=wr.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),ua.getAdapter(t.adapter||yn.adapter)(t).then(function(r){return Sr(t),r.data=wr.call(t,t.transformResponse,r),r.headers=Oe.from(r.headers),r},function(r){return oa(r)||(Sr(t),r&&r.response&&(r.response.data=wr.call(t,t.transformResponse,r.response),r.response.headers=Oe.from(r.response.headers))),Promise.reject(r)})}const da="1.7.4",co={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{co[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const Bi={};co.transitional=function(e,n,r){function o(i,s){return"[Axios v"+da+"] Transitional option '"+i+"'"+s+(r?". "+r:"")}return(i,s,l)=>{if(e===!1)throw new J(o(s," has been removed"+(n?" in "+n:"")),J.ERR_DEPRECATED);return n&&!Bi[s]&&(Bi[s]=!0,console.warn(o(s," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,s,l):!0}};function Ch(t,e,n){if(typeof t!="object")throw new J("options must be an object",J.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let o=r.length;for(;o-- >0;){const i=r[o],s=e[i];if(s){const l=t[i],a=l===void 0||s(l,i,t);if(a!==!0)throw new J("option "+i+" must be "+a,J.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new J("Unknown option "+i,J.ERR_BAD_OPTION)}}const Mr={assertOptions:Ch,validators:co},it=Mr.validators;class yt{constructor(e){this.defaults=e,this.interceptors={request:new Ti,response:new Ti}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
422
- `+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=wt(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Mr.assertOptions(r,{silentJSONParsing:it.transitional(it.boolean),forcedJSONParsing:it.transitional(it.boolean),clarifyTimeoutError:it.transitional(it.boolean)},!1),o!=null&&(y.isFunction(o)?n.paramsSerializer={serialize:o}:Mr.assertOptions(o,{encode:it.function,serialize:it.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=i&&y.merge(i.common,i[n.method]);i&&y.forEach(["delete","get","head","post","put","patch","common"],v=>{delete i[v]}),n.headers=Oe.concat(s,i);const l=[];let a=!0;this.interceptors.request.forEach(function($){typeof $.runWhen=="function"&&$.runWhen(n)===!1||(a=a&&$.synchronous,l.unshift($.fulfilled,$.rejected))});const u=[];this.interceptors.response.forEach(function($){u.push($.fulfilled,$.rejected)});let d,m=0,g;if(!a){const v=[Ni.bind(this),void 0];for(v.unshift.apply(v,l),v.push.apply(v,u),g=v.length,d=Promise.resolve(n);m<g;)d=d.then(v[m++],v[m++]);return d}g=l.length;let _=n;for(m=0;m<g;){const v=l[m++],$=l[m++];try{_=v(_)}catch(S){$.call(this,S);break}}try{d=Ni.call(this,_)}catch(v){return Promise.reject(v)}for(m=0,g=u.length;m<g;)d=d.then(u[m++],u[m++]);return d}getUri(e){e=wt(this.defaults,e);const n=sa(e.baseURL,e.url);return ta(n,e.params,e.paramsSerializer)}}y.forEach(["delete","get","head","options"],function(e){yt.prototype[e]=function(n,r){return this.request(wt(r||{},{method:e,url:n,data:(r||{}).data}))}});y.forEach(["post","put","patch"],function(e){function n(r){return function(i,s,l){return this.request(wt(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}yt.prototype[e]=n(),yt.prototype[e+"Form"]=n(!0)});class uo{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const s=new Promise(l=>{r.subscribe(l),i=l}).then(o);return s.cancel=function(){r.unsubscribe(i)},s},e(function(i,s,l){r.reason||(r.reason=new Bt(i,s,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}static source(){let e;return{token:new uo(function(o){e=o}),cancel:e}}}function Eh(t){return function(n){return t.apply(null,n)}}function Ah(t){return y.isObject(t)&&t.isAxiosError===!0}const Ur={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ur).forEach(([t,e])=>{Ur[e]=t});function fa(t){const e=new yt(t),n=Vs(yt.prototype.request,e);return y.extend(n,yt.prototype,e,{allOwnKeys:!0}),y.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return fa(wt(t,o))},n}const me=fa(yn);me.Axios=yt;me.CanceledError=Bt;me.CancelToken=uo;me.isCancel=oa;me.VERSION=da;me.toFormData=Xn;me.AxiosError=J;me.Cancel=me.CanceledError;me.all=function(e){return Promise.all(e)};me.spread=Eh;me.isAxiosError=Ah;me.mergeConfig=wt;me.AxiosHeaders=Oe;me.formToJSON=t=>ra(y.isHTMLForm(t)?new FormData(t):t);me.getAdapter=ua.getAdapter;me.HttpStatusCode=Ur;me.default=me;class ma{constructor(e,n){Me(this,"keycloak");Me(this,"axios");Me(this,"fileName","silent-login.html");this.keycloak=e,this.axios=me.create(),this.axios.defaults.baseURL=n,this.axios.defaults.headers.common["content-type"]="application/json",this.axios.defaults.timeout=1e3*60*5,this.axios.interceptors.request.use(async r=>{await this.SilentLogin();const o=this.keycloak.token;return r.headers.Authorization=`Bearer ${o}`,r})}ParseAppResult(e){try{const n=typeof e.hasSuccess=="boolean",r=typeof e.hasError=="boolean",o=typeof e.httpStatusCode=="number",i=Array.isArray(e.errors);return n&&r&&o&&i?e:null}catch{return null}}HandleThen(e){const n=new Rr,r=this.ParseAppResult(e.data);return r===null?(n.value=e.data,n):r.hasError?(r.errors.forEach(o=>n.WithError(o)),n.httpStatusCode=r.httpStatusCode,n):(n.value=e.data.value,n)}HandleCatch(e){var o;const n=new Rr,r=this.ParseAppResult((o=e.response)==null?void 0:o.data);return r===null?n.WithError(e.message):(n.WithErrors(r.errors),n.httpStatusCode=r.httpStatusCode),n}async SilentLogin(){return new Promise(async e=>{if(!this.isTokenExpired){e(!0);return}const n=this.GenerateIframe(),r=o=>{if(document.body.removeChild(n),window.removeEventListener("message",r),o.origin!==location.origin){e(!1);return}const i=o.data.action,s=o.data.code,l=o.data.state,a=o.data.error;if(i!=="silent-login-iframe-result"||a==="login_required"||!s){e(!1);return}const u=new XMLHttpRequest;u.open("POST",this.tokenExchangeUrl,!0),u.setRequestHeader("Content-type","application/x-www-form-urlencoded"),u.onreadystatechange=()=>{if(u.readyState===4){if(u.status===200){const d=JSON.parse(u.responseText);this.keycloak.setToken(d.access_token,null,d.id_token,new Date().getTime()),e(!0);return}e(!1)}},u.send(this.TokenExchangeParams(s,l))};window.addEventListener("message",r)}).then(e=>(e||(this.keycloak.clearToken(),this.keycloak.login()),e))}GetCodeVerifierFromState(e){const n=`kc-callback-${e}`,r=localStorage.getItem(n);if(r)return localStorage.removeItem(n),JSON.parse(r).pkceCodeVerifier}TokenExchangeParams(e,n){let r=`code=${e}&grant_type=authorization_code`;return r+=`&client_id=${encodeURIComponent(this.keycloak.clientId)}`,r+=`&redirect_uri=${this.silentLoginRedirectUrl}`,r+=`&code_verifier=${this.GetCodeVerifierFromState(n)}`,r}GenerateIframe(){const e=document.createElement("iframe");return e.src=this.keycloak.createLoginUrl({prompt:"none",redirectUri:this.silentLoginRedirectUrl})??"",document.body.appendChild(e),e}get silentLoginRedirectUrl(){return`${location.origin}/${this.fileName}`}get tokenExchangeUrl(){return`${this.keycloak.authServerUrl}/realms/${this.keycloak.realm}/protocol/openid-connect/token`}get isTokenExpired(){const e=this.keycloak.tokenParsed,n=e?e.exp:null;return!e||!n?!0:n-Math.ceil(new Date().getTime()/1e3)+(this.keycloak.timeSkew??0)<10}}const Th=(t,e)=>new ma(t,e);function xh(){document.documentElement.classList.add("app-mounted")}Rn.SetInitialTheme();exports.AppResult=Rr;exports.AxiosClient=ma;exports.RemovePreloader=xh;exports.SfButton=Mi;exports.SfContent=zd;exports.SfDrawer=Fi;exports.SfIcon=In;exports.SfLayout=jd;exports.SfMessage=ef;exports.SfNavMenu=Qm;exports.SfTabNavigation=Zd;exports.SfTooltip=jr;exports.StartAuthService=Sd;exports.ThemeToggleBase=Rn;exports.UseAlertService=ed;exports.UseAuthService=xs;exports.UseAxiosClient=Th;exports.UseConfirmService=ks;exports.UseNavMenuService=Hr;
422
+ `+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=wt(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Mr.assertOptions(r,{silentJSONParsing:it.transitional(it.boolean),forcedJSONParsing:it.transitional(it.boolean),clarifyTimeoutError:it.transitional(it.boolean)},!1),o!=null&&(y.isFunction(o)?n.paramsSerializer={serialize:o}:Mr.assertOptions(o,{encode:it.function,serialize:it.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=i&&y.merge(i.common,i[n.method]);i&&y.forEach(["delete","get","head","post","put","patch","common"],v=>{delete i[v]}),n.headers=Oe.concat(s,i);const l=[];let a=!0;this.interceptors.request.forEach(function($){typeof $.runWhen=="function"&&$.runWhen(n)===!1||(a=a&&$.synchronous,l.unshift($.fulfilled,$.rejected))});const u=[];this.interceptors.response.forEach(function($){u.push($.fulfilled,$.rejected)});let d,m=0,g;if(!a){const v=[Ni.bind(this),void 0];for(v.unshift.apply(v,l),v.push.apply(v,u),g=v.length,d=Promise.resolve(n);m<g;)d=d.then(v[m++],v[m++]);return d}g=l.length;let _=n;for(m=0;m<g;){const v=l[m++],$=l[m++];try{_=v(_)}catch(S){$.call(this,S);break}}try{d=Ni.call(this,_)}catch(v){return Promise.reject(v)}for(m=0,g=u.length;m<g;)d=d.then(u[m++],u[m++]);return d}getUri(e){e=wt(this.defaults,e);const n=sa(e.baseURL,e.url);return ta(n,e.params,e.paramsSerializer)}}y.forEach(["delete","get","head","options"],function(e){yt.prototype[e]=function(n,r){return this.request(wt(r||{},{method:e,url:n,data:(r||{}).data}))}});y.forEach(["post","put","patch"],function(e){function n(r){return function(i,s,l){return this.request(wt(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}yt.prototype[e]=n(),yt.prototype[e+"Form"]=n(!0)});class uo{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const s=new Promise(l=>{r.subscribe(l),i=l}).then(o);return s.cancel=function(){r.unsubscribe(i)},s},e(function(i,s,l){r.reason||(r.reason=new Bt(i,s,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}static source(){let e;return{token:new uo(function(o){e=o}),cancel:e}}}function Eh(t){return function(n){return t.apply(null,n)}}function Ah(t){return y.isObject(t)&&t.isAxiosError===!0}const Ur={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ur).forEach(([t,e])=>{Ur[e]=t});function fa(t){const e=new yt(t),n=Vs(yt.prototype.request,e);return y.extend(n,yt.prototype,e,{allOwnKeys:!0}),y.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return fa(wt(t,o))},n}const me=fa(yn);me.Axios=yt;me.CanceledError=Bt;me.CancelToken=uo;me.isCancel=oa;me.VERSION=da;me.toFormData=Xn;me.AxiosError=J;me.Cancel=me.CanceledError;me.all=function(e){return Promise.all(e)};me.spread=Eh;me.isAxiosError=Ah;me.mergeConfig=wt;me.AxiosHeaders=Oe;me.formToJSON=t=>ra(y.isHTMLForm(t)?new FormData(t):t);me.getAdapter=ua.getAdapter;me.HttpStatusCode=Ur;me.default=me;class ma{constructor(e,n){Me(this,"keycloak");Me(this,"axios");Me(this,"fileName","silent-login.html");this.keycloak=e,this.axios=me.create(),this.axios.defaults.baseURL=n,this.axios.defaults.headers.common["content-type"]="application/json",this.axios.defaults.timeout=1e3*60*5,this.axios.interceptors.request.use(async r=>{await this.SilentLogin();const o=this.keycloak.token;return r.headers.Authorization=`Bearer ${o}`,r})}ParseAppResult(e){try{const n=typeof e.hasSuccess=="boolean",r=typeof e.hasError=="boolean",o=typeof e.httpStatusCode=="number",i=Array.isArray(e.errors);return n&&r&&o&&i?e:null}catch{return null}}HandleThen(e){const n=new Rr,r=this.ParseAppResult(e.data);return r===null?(n.value=e.data,n):r.hasError?(r.errors.forEach(o=>n.WithError(o)),n.httpStatusCode=r.httpStatusCode,n):(n.value=e.data.value,n)}HandleCatch(e){var o;const n=new Rr,r=this.ParseAppResult((o=e.response)==null?void 0:o.data);return r===null?n.WithError(e.message):(n.WithErrors(r.errors),n.httpStatusCode=r.httpStatusCode),n}async SilentLogin(){return new Promise(async e=>{if(!this.isTokenExpired){e(!0);return}const n=this.GenerateIframe(),r=o=>{if(document.body.removeChild(n),window.removeEventListener("message",r),o.origin!==location.origin){e(!1);return}const i=o.data.action,s=o.data.code,l=o.data.state,a=o.data.error;if(i!=="silent-login-iframe-result"||a==="login_required"||!s){e(!1);return}const u=new XMLHttpRequest;u.open("POST",this.tokenExchangeUrl,!0),u.setRequestHeader("Content-type","application/x-www-form-urlencoded"),u.onreadystatechange=()=>{if(u.readyState===4){if(u.status===200){const d=JSON.parse(u.responseText);this.keycloak.setToken(d.access_token,null,d.id_token,new Date().getTime()),e(!0);return}e(!1)}},u.send(this.TokenExchangeParams(s,l))};window.addEventListener("message",r)}).then(e=>(e||(this.keycloak.clearToken(),this.keycloak.login()),e))}GetCodeVerifierFromState(e){const n=`kc-callback-${e}`,r=localStorage.getItem(n);if(r)return localStorage.removeItem(n),JSON.parse(r).pkceCodeVerifier}TokenExchangeParams(e,n){let r=`code=${e}&grant_type=authorization_code`;return r+=`&client_id=${encodeURIComponent(this.keycloak.clientId)}`,r+=`&redirect_uri=${this.silentLoginRedirectUrl}`,r+=`&code_verifier=${this.GetCodeVerifierFromState(n)}`,r}GenerateIframe(){const e=document.createElement("iframe");return e.src=this.keycloak.createLoginUrl({prompt:"none",redirectUri:this.silentLoginRedirectUrl})??"",document.body.appendChild(e),e}get silentLoginRedirectUrl(){return`${location.origin}/${this.fileName}`}get tokenExchangeUrl(){return`${this.keycloak.authServerUrl}/realms/${this.keycloak.realm}/protocol/openid-connect/token`}get isTokenExpired(){const e=this.keycloak.tokenParsed,n=e?e.exp:null;return!e||!n?!0:n-Math.ceil(new Date().getTime()/1e3)+(this.keycloak.timeSkew??0)<10}}const Th=(t,e)=>new ma(t,e);function xh(){document.documentElement.classList.add("app-mounted")}function Ph(){Rn.Toggle()}Rn.SetInitialTheme();exports.AppResult=Rr;exports.AxiosClient=ma;exports.RemovePreloader=xh;exports.SfButton=Mi;exports.SfContent=zd;exports.SfDrawer=Fi;exports.SfIcon=In;exports.SfLayout=jd;exports.SfMessage=ef;exports.SfNavMenu=Qm;exports.SfTabNavigation=Zd;exports.SfTooltip=jr;exports.StartAuthService=Sd;exports.ToggleTheme=Ph;exports.UseAlertService=ed;exports.UseAuthService=xs;exports.UseAxiosClient=Th;exports.UseConfirmService=ks;exports.UseNavMenuService=Hr;
423
423
  //# sourceMappingURL=sf.prefeiturasp.vuecomponents.cjs.map