@luizleon/sf.prefeiturasp.vuecomponents 4.1.7 → 4.1.8
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/common/utilities.d.ts +7 -0
- package/dist/sf.prefeiturasp.vuecomponents.cjs +1 -1
- package/dist/sf.prefeiturasp.vuecomponents.cjs.map +1 -1
- package/dist/sf.prefeiturasp.vuecomponents.js +9 -0
- package/dist/sf.prefeiturasp.vuecomponents.js.map +1 -1
- package/dist/sf.prefeiturasp.vuecomponents.umd.cjs +1 -1
- package/dist/sf.prefeiturasp.vuecomponents.umd.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -30,5 +30,12 @@ declare class Utilities {
|
|
|
30
30
|
static Mask(value: string, mask: string): string;
|
|
31
31
|
static MaskCpf(value: string): string;
|
|
32
32
|
static MaskCnpj(value: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Pausa a execução do código por um determinado tempo, em milissegundos.
|
|
35
|
+
* @example await Utilities.DelayAsync(1000)
|
|
36
|
+
* @param ms
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
static DelayAsync(ms: number): Promise<unknown>;
|
|
33
40
|
}
|
|
34
41
|
export { Utilities };
|
|
@@ -412,5 +412,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
412
412
|
`)}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[xs]=this[xs]={accessors:{}}).accessors,o=this.prototype;function s(i){const a=Wt(i);r[a]||(sh(o,i),r[a]=!0)}return y.isArray(e)?e.forEach(s):s(e),this}}Ce.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);y.reduceDescriptors(Ce.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});y.freezeMethods(Ce);function Sr(t,e){const n=this||bn,r=e||n,o=Ce.from(r.headers);let s=r.data;return y.forEach(t,function(a){s=a.call(n,s,o.normalize(),e?e.status:void 0)}),o.normalize(),s}function oa(t){return!!(t&&t.__CANCEL__)}function Dt(t,e,n){M.call(this,t??"canceled",M.ERR_CANCELED,e,n),this.name="CanceledError"}y.inherits(Dt,M,{__CANCEL__:!0});function sa(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new M("Request failed with status code "+n.status,[M.ERR_BAD_REQUEST,M.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function ih(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function ah(t,e){t=t||10;const n=new Array(t),r=new Array(t);let o=0,s=0,i;return e=e!==void 0?e:1e3,function(c){const u=Date.now(),d=r[s];i||(i=u),n[o]=c,r[o]=u;let m=s,g=0;for(;m!==o;)g+=n[m++],m=m%t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),u-i<e)return;const _=d&&u-d;return _?Math.round(g*1e3/_):void 0}}function lh(t,e){let n=0,r=1e3/e,o,s;const i=(u,d=Date.now())=>{n=d,o=null,s&&(clearTimeout(s),s=null),t.apply(null,u)};return[(...u)=>{const d=Date.now(),m=d-n;m>=r?i(u,d):(o=u,s||(s=setTimeout(()=>{s=null,i(o)},r-m)))},()=>o&&i(o)]}const Mn=(t,e,n=3)=>{let r=0;const o=ah(50,250);return lh(s=>{const i=s.loaded,a=s.lengthComputable?s.total:void 0,c=i-r,u=o(c),d=i<=a;r=i;const m={loaded:i,total:a,progress:a?i/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a&&d?(a-i)/u:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(m)},n)},Os=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Ls=t=>(...e)=>y.asap(()=>t(...e)),ch=ze.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function o(s){let i=s;return e&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{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(i){const a=y.isString(i)?o(i):i;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}(),uh=ze.hasStandardBrowserEnv?{write(t,e,n,r,o,s){const i=[t+"="+encodeURIComponent(e)];y.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),y.isString(r)&&i.push("path="+r),y.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.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 dh(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fh(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function ia(t,e){return t&&!dh(e)?fh(t,e):e}const $s=t=>t instanceof Ce?{...t}:t;function _t(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 s(u,d){if(!y.isUndefined(d))return r(void 0,d)}function i(u,d){if(y.isUndefined(d)){if(!y.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function a(u,d,m){if(m in e)return r(u,d);if(m in t)return r(void 0,u)}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,d)=>o($s(u),$s(d),!0)};return y.forEach(Object.keys(Object.assign({},t,e)),function(d){const m=c[d]||o,g=m(t[d],e[d],d);y.isUndefined(g)&&m!==a||(n[d]=g)}),n}const aa=t=>{const e=_t({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:a}=e;e.headers=i=Ce.from(i),e.url=ta(ia(e.baseURL,e.url),t.params,t.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(y.isFormData(n)){if(ze.hasStandardBrowserEnv||ze.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((c=i.getContentType())!==!1){const[u,...d]=c?c.split(";").map(m=>m.trim()).filter(Boolean):[];i.setContentType([u||"multipart/form-data",...d].join("; "))}}if(ze.hasStandardBrowserEnv&&(r&&y.isFunction(r)&&(r=r(e)),r||r!==!1&&ch(e.url))){const u=o&&s&&uh.read(s);u&&i.set(o,u)}return e},mh=typeof XMLHttpRequest<"u",ph=mh&&function(t){return new Promise(function(n,r){const o=aa(t);let s=o.data;const i=Ce.from(o.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=o,d,m,g,_,v;function T(){_&&_(),v&&v(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let w=new XMLHttpRequest;w.open(o.method.toUpperCase(),o.url,!0),w.timeout=o.timeout;function B(){if(!w)return;const A=Ce.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),X={data:!a||a==="text"||a==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:A,config:t,request:w};sa(function(J){n(J),T()},function(J){r(J),T()},X),w=null}"onloadend"in w?w.onloadend=B:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(B)},w.onabort=function(){w&&(r(new M("Request aborted",M.ECONNABORTED,t,w)),w=null)},w.onerror=function(){r(new M("Network Error",M.ERR_NETWORK,t,w)),w=null},w.ontimeout=function(){let j=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const X=o.transitional||na;o.timeoutErrorMessage&&(j=o.timeoutErrorMessage),r(new M(j,X.clarifyTimeoutError?M.ETIMEDOUT:M.ECONNABORTED,t,w)),w=null},s===void 0&&i.setContentType(null),"setRequestHeader"in w&&y.forEach(i.toJSON(),function(j,X){w.setRequestHeader(X,j)}),y.isUndefined(o.withCredentials)||(w.withCredentials=!!o.withCredentials),a&&a!=="json"&&(w.responseType=o.responseType),u&&([g,v]=Mn(u,!0),w.addEventListener("progress",g)),c&&w.upload&&([m,_]=Mn(c),w.upload.addEventListener("progress",m),w.upload.addEventListener("loadend",_)),(o.cancelToken||o.signal)&&(d=A=>{w&&(r(!A||A.type?new Dt(null,t,w):A),w.abort(),w=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const C=ih(o.url);if(C&&ze.protocols.indexOf(C)===-1){r(new M("Unsupported protocol "+C+":",M.ERR_BAD_REQUEST,t));return}w.send(s||null)})},hh=(t,e)=>{let n=new AbortController,r;const o=function(c){if(!r){r=!0,i();const u=c instanceof Error?c:this.reason;n.abort(u instanceof M?u:new Dt(u instanceof Error?u.message:u))}};let s=e&&setTimeout(()=>{o(new M(`timeout ${e} of ms exceeded`,M.ETIMEDOUT))},e);const i=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(c=>{c&&(c.removeEventListener?c.removeEventListener("abort",o):c.unsubscribe(o))}),t=null)};t.forEach(c=>c&&c.addEventListener&&c.addEventListener("abort",o));const{signal:a}=n;return a.unsubscribe=i,[a,()=>{s&&clearTimeout(s),s=null}]},gh=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},yh=async function*(t,e,n){for await(const r of t)yield*gh(ArrayBuffer.isView(r)?r:await n(String(r)),e)},Rs=(t,e,n,r,o)=>{const s=yh(t,e,o);let i=0,a,c=u=>{a||(a=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:d,value:m}=await s.next();if(d){c(),u.close();return}let g=m.byteLength;if(n){let _=i+=g;n(_)}u.enqueue(new Uint8Array(m))}catch(d){throw c(d),d}},cancel(u){return c(u),s.return()}},{highWaterMark:2})},Qn=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",la=Qn&&typeof ReadableStream=="function",Br=Qn&&(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}},vh=la&&ca(()=>{let t=!1;const e=new Request(ze.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Ns=64*1024,Dr=la&&ca(()=>y.isReadableStream(new Response("").body)),Un={stream:Dr&&(t=>t.body)};Qn&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Un[e]&&(Un[e]=y.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new M(`Response type '${e}' is not supported`,M.ERR_NOT_SUPPORT,r)})})})(new Response);const bh=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},wh=async(t,e)=>{const n=y.toFiniteNumber(t.getContentLength());return n??bh(e)},Sh=Qn&&(async t=>{let{url:e,method:n,data:r,signal:o,cancelToken:s,timeout:i,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:d,withCredentials:m="same-origin",fetchOptions:g}=aa(t);u=u?(u+"").toLowerCase():"text";let[_,v]=o||s||i?hh([o,s],i):[],T,w;const B=()=>{!T&&setTimeout(()=>{_&&_.unsubscribe()}),T=!0};let C;try{if(c&&vh&&n!=="get"&&n!=="head"&&(C=await wh(d,r))!==0){let ne=new Request(e,{method:"POST",body:r,duplex:"half"}),J;if(y.isFormData(r)&&(J=ne.headers.get("content-type"))&&d.setContentType(J),ne.body){const[pe,se]=Os(C,Mn(Ls(c)));r=Rs(ne.body,Ns,pe,se,Br)}}y.isString(m)||(m=m?"include":"omit"),w=new Request(e,{...g,signal:_,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:m});let A=await fetch(w);const j=Dr&&(u==="stream"||u==="response");if(Dr&&(a||j)){const ne={};["status","statusText","headers"].forEach(U=>{ne[U]=A[U]});const J=y.toFiniteNumber(A.headers.get("content-length")),[pe,se]=a&&Os(J,Mn(Ls(a),!0))||[];A=new Response(Rs(A.body,Ns,pe,()=>{se&&se(),j&&B()},Br),ne)}u=u||"text";let X=await Un[y.findKey(Un,u)||"text"](A,t);return!j&&B(),v&&v(),await new Promise((ne,J)=>{sa(ne,J,{data:X,headers:Ce.from(A.headers),status:A.status,statusText:A.statusText,config:t,request:w})})}catch(A){throw B(),A&&A.name==="TypeError"&&/fetch/i.test(A.message)?Object.assign(new M("Network Error",M.ERR_NETWORK,t,w),{cause:A.cause||A}):M.from(A,A&&A.code,t,w)}}),Mr={http:Mp,xhr:ph,fetch:Sh};y.forEach(Mr,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Bs=t=>`- ${t}`,_h=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 s=0;s<e;s++){n=t[s];let i;if(r=n,!_h(n)&&(r=Mr[(i=String(n)).toLowerCase()],r===void 0))throw new M(`Unknown adapter '${i}'`);if(r)break;o[i||"#"+s]=r}if(!r){const s=Object.entries(o).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let i=e?s.length>1?`since :
|
|
413
413
|
`+s.map(Bs).join(`
|
|
414
414
|
`):" "+Bs(s[0]):"as no adapter specified";throw new M("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:Mr};function _r(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Dt(null,t)}function Ds(t){return _r(t),t.headers=Ce.from(t.headers),t.data=Sr.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),ua.getAdapter(t.adapter||bn.adapter)(t).then(function(r){return _r(t),r.data=Sr.call(t,t.transformResponse,r),r.headers=Ce.from(r.headers),r},function(r){return oa(r)||(_r(t),r&&r.response&&(r.response.data=Sr.call(t,t.transformResponse,r.response),r.response.headers=Ce.from(r.response.headers))),Promise.reject(r)})}const da="1.7.4",fo={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{fo[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const Ms={};fo.transitional=function(e,n,r){function o(s,i){return"[Axios v"+da+"] Transitional option '"+s+"'"+i+(r?". "+r:"")}return(s,i,a)=>{if(e===!1)throw new M(o(i," has been removed"+(n?" in "+n:"")),M.ERR_DEPRECATED);return n&&!Ms[i]&&(Ms[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,i,a):!0}};function kh(t,e,n){if(typeof t!="object")throw new M("options must be an object",M.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let o=r.length;for(;o-- >0;){const s=r[o],i=e[s];if(i){const a=t[s],c=a===void 0||i(a,s,t);if(c!==!0)throw new M("option "+s+" must be "+c,M.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new M("Unknown option "+s,M.ERR_BAD_OPTION)}}const Ur={assertOptions:kh,validators:fo},it=Ur.validators;class vt{constructor(e){this.defaults=e,this.interceptors={request:new Is,response:new Is}}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 s=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
415
|
-
`+s):r.stack=s}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=_t(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&Ur.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}:Ur.assertOptions(o,{encode:it.function,serialize:it.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&y.merge(s.common,s[n.method]);s&&y.forEach(["delete","get","head","post","put","patch","common"],v=>{delete s[v]}),n.headers=Ce.concat(i,s);const a=[];let c=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(n)===!1||(c=c&&T.synchronous,a.unshift(T.fulfilled,T.rejected))});const u=[];this.interceptors.response.forEach(function(T){u.push(T.fulfilled,T.rejected)});let d,m=0,g;if(!c){const v=[Ds.bind(this),void 0];for(v.unshift.apply(v,a),v.push.apply(v,u),g=v.length,d=Promise.resolve(n);m<g;)d=d.then(v[m++],v[m++]);return d}g=a.length;let _=n;for(m=0;m<g;){const v=a[m++],T=a[m++];try{_=v(_)}catch(w){T.call(this,w);break}}try{d=Ds.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=_t(this.defaults,e);const n=ia(e.baseURL,e.url);return ta(n,e.params,e.paramsSerializer)}}y.forEach(["delete","get","head","options"],function(e){vt.prototype[e]=function(n,r){return this.request(_t(r||{},{method:e,url:n,data:(r||{}).data}))}});y.forEach(["post","put","patch"],function(e){function n(r){return function(s,i,a){return this.request(_t(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}vt.prototype[e]=n(),vt.prototype[e+"Form"]=n(!0)});class mo{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{r.subscribe(a),s=a}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},e(function(s,i,a){r.reason||(r.reason=new Dt(s,i,a),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 mo(function(o){e=o}),cancel:e}}}function Ch(t){return function(n){return t.apply(null,n)}}function Eh(t){return y.isObject(t)&&t.isAxiosError===!0}const Hr={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(Hr).forEach(([t,e])=>{Hr[e]=t});function fa(t){const e=new vt(t),n=Fi(vt.prototype.request,e);return y.extend(n,vt.prototype,e,{allOwnKeys:!0}),y.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return fa(_t(t,o))},n}const re=fa(bn);re.Axios=vt;re.CanceledError=Dt;re.CancelToken=mo;re.isCancel=oa;re.VERSION=da;re.toFormData=Zn;re.AxiosError=M;re.Cancel=re.CanceledError;re.all=function(e){return Promise.all(e)};re.spread=Ch;re.isAxiosError=Eh;re.mergeConfig=_t;re.AxiosHeaders=Ce;re.formToJSON=t=>ra(y.isHTMLForm(t)?new FormData(t):t);re.getAdapter=ua.getAdapter;re.HttpStatusCode=Hr;re.default=re;class ma{constructor(e,n){Se(this,"keycloak");Se(this,"axios");Se(this,"fileName","silent-login.html");this.keycloak=e,this.axios=re.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",s=Array.isArray(e.errors);return n&&r&&o&&s?e:null}catch{return null}}HandleThen(e){const n=new un,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 un,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 s=o.data.action,i=o.data.code,a=o.data.state,c=o.data.error;if(s!=="silent-login-iframe-result"||c==="login_required"||!i){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(i,a))};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);class pa{constructor(){Se(this,"axios");Se(this,"authService",no());this.axios=re.create(),this.axios.defaults.baseURL=window.location.origin+"/api",this.axios.defaults.headers.common["content-type"]="application/json",this.axios.defaults.timeout=1e3*60*5,this.axios.interceptors.request.use(async e=>{const n=await this.GetAccessToken();return e.headers.Authorization=n?`Bearer ${n}`:void 0,e})}GetAxios(e=!0){return e?this.axios:re.create()}async GetAccessToken(){return await this.authService.Instance.getAccessTokenAsync()}async GetAsync(e){return this.GetAxios().get(e).then(n=>this.HandleThen(n)).catch(n=>this.HandleCatch(n))}async PostAsync(e,n){return this.GetAxios().post(e,n).then(r=>this.HandleThen(r)).catch(r=>this.HandleCatch(r))}async PutAsync(e,n){return this.GetAxios().put(e,n).then(r=>this.HandleThen(r)).catch(r=>this.HandleCatch(r))}async DeleteAsync(e){return this.GetAxios().delete(e).then(n=>this.HandleThen(n)).catch(n=>this.HandleCatch(n))}HandleThen(e){const n=new un,r=this.ParsedResponse(e.data);return r===null?(n.httpStatusCode=e.status,n.value=e.data,n):(n.httpStatusCode=r.httpStatusCode,r.hasError?(n.WithErrors(r.errors),n):(n.value=r.value,n))}HandleCatch(e){var o;const n=new un,r=this.ParsedResponse((o=e.response)==null?void 0:o.data);return r===null?(n.WithError(e.message),n):(n.httpStatusCode=r.httpStatusCode,n.WithErrors(r.errors),n)}ParsedResponse(e){try{const n=typeof e.hasSuccess=="boolean",r=typeof e.hasError=="boolean",o=typeof e.httpStatusCode=="number",s=Array.isArray(e.errors);return n&&r&&o&&s?e:null}catch{return null}}}const Ah=()=>new pa;class Hn{static get IsTouch(){return window.matchMedia("(pointer: coarse)").matches}static GetMaxZindex(e=[]){let n="body > *:not(script):not(style)";for(const o of e)n+=`, ${o}`;const r=Math.max(...Array.from(document.querySelectorAll(n)).map(o=>{const s=getComputedStyle(o).zIndex;return+s==+s?+s:0}));return r>=100?r:100}static AjustarFuso(e){const n=e.getTimezoneOffset()/60;e.setHours(e.getHours()-n)}static Mask(e,n){let r=0,o=e.toString();return n.replace(/#/g,()=>o[r++]||"")}static MaskCpf(e){return Hn.Mask(e.padStart(11,"0"),"###.###.###-##")}static MaskCnpj(e){return Hn.Mask(e.padStart(14,"0"),"##.###.###/####-##")}}function Ph(){document.documentElement.classList.add("app-mounted")}function ha(){St.SetInitialTheme()}function Ih(){St.Toggle()}function xh(){St.EnableDarkMode()}function Oh(){St.EnableLightMode()}function Lh(){St.ClearStoredTheme()}ha();exports.ApiClient=pa;exports.AppResult=un;exports.AxiosClient=ma;exports.ClearStoredTheme=Lh;exports.EnableDarkMode=xh;exports.EnableLightMode=Oh;exports.Keycloak=to;exports.RemovePreloader=Ph;exports.SetInitialTheme=ha;exports.SfButton=Vs;exports.SfContent=Fd;exports.SfDrawer=Hs;exports.SfIcon=Ln;exports.SfLayout=Vd;exports.SfMessage=Qd;exports.SfNavMenu=Zm;exports.SfTabNavigation=Xd;exports.SfTooltip=jr;exports.StartAuthService=wd;exports.ToggleTheme=Ih;exports.UseAlertService=nd;exports.UseApiClient=Ah;exports.UseAuthService=no;exports.UseAxiosClient=Th;exports.UseConfirmService=Ei;exports.UseNavMenuService=Vr;exports.Utilities=Hn;
|
|
415
|
+
`+s):r.stack=s}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=_t(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&Ur.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}:Ur.assertOptions(o,{encode:it.function,serialize:it.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&y.merge(s.common,s[n.method]);s&&y.forEach(["delete","get","head","post","put","patch","common"],v=>{delete s[v]}),n.headers=Ce.concat(i,s);const a=[];let c=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(n)===!1||(c=c&&T.synchronous,a.unshift(T.fulfilled,T.rejected))});const u=[];this.interceptors.response.forEach(function(T){u.push(T.fulfilled,T.rejected)});let d,m=0,g;if(!c){const v=[Ds.bind(this),void 0];for(v.unshift.apply(v,a),v.push.apply(v,u),g=v.length,d=Promise.resolve(n);m<g;)d=d.then(v[m++],v[m++]);return d}g=a.length;let _=n;for(m=0;m<g;){const v=a[m++],T=a[m++];try{_=v(_)}catch(w){T.call(this,w);break}}try{d=Ds.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=_t(this.defaults,e);const n=ia(e.baseURL,e.url);return ta(n,e.params,e.paramsSerializer)}}y.forEach(["delete","get","head","options"],function(e){vt.prototype[e]=function(n,r){return this.request(_t(r||{},{method:e,url:n,data:(r||{}).data}))}});y.forEach(["post","put","patch"],function(e){function n(r){return function(s,i,a){return this.request(_t(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}vt.prototype[e]=n(),vt.prototype[e+"Form"]=n(!0)});class mo{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{r.subscribe(a),s=a}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},e(function(s,i,a){r.reason||(r.reason=new Dt(s,i,a),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 mo(function(o){e=o}),cancel:e}}}function Ch(t){return function(n){return t.apply(null,n)}}function Eh(t){return y.isObject(t)&&t.isAxiosError===!0}const Hr={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(Hr).forEach(([t,e])=>{Hr[e]=t});function fa(t){const e=new vt(t),n=Fi(vt.prototype.request,e);return y.extend(n,vt.prototype,e,{allOwnKeys:!0}),y.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return fa(_t(t,o))},n}const re=fa(bn);re.Axios=vt;re.CanceledError=Dt;re.CancelToken=mo;re.isCancel=oa;re.VERSION=da;re.toFormData=Zn;re.AxiosError=M;re.Cancel=re.CanceledError;re.all=function(e){return Promise.all(e)};re.spread=Ch;re.isAxiosError=Eh;re.mergeConfig=_t;re.AxiosHeaders=Ce;re.formToJSON=t=>ra(y.isHTMLForm(t)?new FormData(t):t);re.getAdapter=ua.getAdapter;re.HttpStatusCode=Hr;re.default=re;class ma{constructor(e,n){Se(this,"keycloak");Se(this,"axios");Se(this,"fileName","silent-login.html");this.keycloak=e,this.axios=re.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",s=Array.isArray(e.errors);return n&&r&&o&&s?e:null}catch{return null}}HandleThen(e){const n=new un,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 un,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 s=o.data.action,i=o.data.code,a=o.data.state,c=o.data.error;if(s!=="silent-login-iframe-result"||c==="login_required"||!i){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(i,a))};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);class pa{constructor(){Se(this,"axios");Se(this,"authService",no());this.axios=re.create(),this.axios.defaults.baseURL=window.location.origin+"/api",this.axios.defaults.headers.common["content-type"]="application/json",this.axios.defaults.timeout=1e3*60*5,this.axios.interceptors.request.use(async e=>{const n=await this.GetAccessToken();return e.headers.Authorization=n?`Bearer ${n}`:void 0,e})}GetAxios(e=!0){return e?this.axios:re.create()}async GetAccessToken(){return await this.authService.Instance.getAccessTokenAsync()}async GetAsync(e){return this.GetAxios().get(e).then(n=>this.HandleThen(n)).catch(n=>this.HandleCatch(n))}async PostAsync(e,n){return this.GetAxios().post(e,n).then(r=>this.HandleThen(r)).catch(r=>this.HandleCatch(r))}async PutAsync(e,n){return this.GetAxios().put(e,n).then(r=>this.HandleThen(r)).catch(r=>this.HandleCatch(r))}async DeleteAsync(e){return this.GetAxios().delete(e).then(n=>this.HandleThen(n)).catch(n=>this.HandleCatch(n))}HandleThen(e){const n=new un,r=this.ParsedResponse(e.data);return r===null?(n.httpStatusCode=e.status,n.value=e.data,n):(n.httpStatusCode=r.httpStatusCode,r.hasError?(n.WithErrors(r.errors),n):(n.value=r.value,n))}HandleCatch(e){var o;const n=new un,r=this.ParsedResponse((o=e.response)==null?void 0:o.data);return r===null?(n.WithError(e.message),n):(n.httpStatusCode=r.httpStatusCode,n.WithErrors(r.errors),n)}ParsedResponse(e){try{const n=typeof e.hasSuccess=="boolean",r=typeof e.hasError=="boolean",o=typeof e.httpStatusCode=="number",s=Array.isArray(e.errors);return n&&r&&o&&s?e:null}catch{return null}}}const Ah=()=>new pa;class Hn{static get IsTouch(){return window.matchMedia("(pointer: coarse)").matches}static GetMaxZindex(e=[]){let n="body > *:not(script):not(style)";for(const o of e)n+=`, ${o}`;const r=Math.max(...Array.from(document.querySelectorAll(n)).map(o=>{const s=getComputedStyle(o).zIndex;return+s==+s?+s:0}));return r>=100?r:100}static AjustarFuso(e){const n=e.getTimezoneOffset()/60;e.setHours(e.getHours()-n)}static Mask(e,n){let r=0,o=e.toString();return n.replace(/#/g,()=>o[r++]||"")}static MaskCpf(e){return Hn.Mask(e.padStart(11,"0"),"###.###.###-##")}static MaskCnpj(e){return Hn.Mask(e.padStart(14,"0"),"##.###.###/####-##")}static async DelayAsync(e){return new Promise(n=>setTimeout(n,e))}}function Ph(){document.documentElement.classList.add("app-mounted")}function ha(){St.SetInitialTheme()}function Ih(){St.Toggle()}function xh(){St.EnableDarkMode()}function Oh(){St.EnableLightMode()}function Lh(){St.ClearStoredTheme()}ha();exports.ApiClient=pa;exports.AppResult=un;exports.AxiosClient=ma;exports.ClearStoredTheme=Lh;exports.EnableDarkMode=xh;exports.EnableLightMode=Oh;exports.Keycloak=to;exports.RemovePreloader=Ph;exports.SetInitialTheme=ha;exports.SfButton=Vs;exports.SfContent=Fd;exports.SfDrawer=Hs;exports.SfIcon=Ln;exports.SfLayout=Vd;exports.SfMessage=Qd;exports.SfNavMenu=Zm;exports.SfTabNavigation=Xd;exports.SfTooltip=jr;exports.StartAuthService=wd;exports.ToggleTheme=Ih;exports.UseAlertService=nd;exports.UseApiClient=Ah;exports.UseAuthService=no;exports.UseAxiosClient=Th;exports.UseConfirmService=Ei;exports.UseNavMenuService=Vr;exports.Utilities=Hn;
|
|
416
416
|
//# sourceMappingURL=sf.prefeiturasp.vuecomponents.cjs.map
|