componentes-exagono 0.2.26 → 0.2.27
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.es.js +2 -3
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -14982,9 +14982,8 @@ const nk = /* @__PURE__ */ rt(rk), zf = 46, ok = 22, sk = ({ dayNumber: e, date:
|
|
|
14982
14982
|
{
|
|
14983
14983
|
sx: {
|
|
14984
14984
|
fontSize: "10px",
|
|
14985
|
-
lineHeight: "1
|
|
14985
|
+
lineHeight: "1",
|
|
14986
14986
|
color: "#3C4043",
|
|
14987
|
-
fontWeight: 500,
|
|
14988
14987
|
pr: b ? 2 : 0,
|
|
14989
14988
|
display: "-webkit-box",
|
|
14990
14989
|
WebkitLineClamp: 2,
|
|
@@ -15018,7 +15017,7 @@ const nk = /* @__PURE__ */ rt(rk), zf = 46, ok = 22, sk = ({ dayNumber: e, date:
|
|
|
15018
15017
|
be,
|
|
15019
15018
|
{
|
|
15020
15019
|
sx: {
|
|
15021
|
-
fontSize: "
|
|
15020
|
+
fontSize: "10px",
|
|
15022
15021
|
fontWeight: "bold",
|
|
15023
15022
|
color: "#1976D2",
|
|
15024
15023
|
textAlign: "left",
|
package/dist/index.umd.js
CHANGED
|
@@ -157,7 +157,7 @@ const theme2 = createTheme({ palette: {
|
|
|
157
157
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(o=>n.set(o)),n}static accessor(t){const n=(this[Sf]=this[Sf]={accessors:{}}).accessors,o=this.prototype;function s(i){const a=jo(i);n[a]||(m_(o,i),n[a]=!0)}return z.isArray(t)?t.forEach(s):s(t),this}};sr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),z.reduceDescriptors(sr.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),z.freezeMethods(sr);function yc(e,t){const r=this||Oo,n=t||r,o=sr.from(n.headers);let s=n.data;return z.forEach(e,function(a){s=a.call(r,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Cf(e){return!!(e&&e.__CANCEL__)}function qn(e,t,r){Le.call(this,e??"canceled",Le.ERR_CANCELED,t,r),this.name="CanceledError"}z.inherits(qn,Le,{__CANCEL__:!0});function Ef(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Le("Request failed with status code "+r.status,[Le.ERR_BAD_REQUEST,Le.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function g_(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function v_(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o=0,s=0,i;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=n[s];i||(i=u),r[o]=c,n[o]=u;let f=s,h=0;for(;f!==o;)h+=r[f++],f=f%e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),u-i<t)return;const v=d&&u-d;return v?Math.round(h*1e3/v):void 0}}function y_(e,t){let r=0,n=1e3/t,o,s;const i=(u,d=Date.now())=>{r=d,o=null,s&&(clearTimeout(s),s=null),e(...u)};return[(...u)=>{const d=Date.now(),f=d-r;f>=n?i(u,d):(o=u,s||(s=setTimeout(()=>{s=null,i(o)},n-f)))},()=>o&&i(o)]}const ki=(e,t,r=3)=>{let n=0;const o=v_(50,250);return y_(s=>{const i=s.loaded,a=s.lengthComputable?s.total:void 0,c=i-n,u=o(c),d=i<=a;n=i;const f={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,[t?"download":"upload"]:!0};e(f)},r)},Df=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},kf=e=>(...t)=>z.asap(()=>e(...t)),b_=Xt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Xt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Xt.origin),Xt.navigator&&/(msie|trident)/i.test(Xt.navigator.userAgent)):()=>!0,__=Xt.hasStandardBrowserEnv?{write(e,t,r,n,o,s){const i=[e+"="+encodeURIComponent(t)];z.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),z.isString(n)&&i.push("path="+n),z.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function x_(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function w_(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Af(e,t,r){let n=!x_(t);return e&&(n||r==!1)?w_(e,t):t}const Tf=e=>e instanceof sr?{...e}:e;function bn(e,t){t=t||{};const r={};function n(u,d,f,h){return z.isPlainObject(u)&&z.isPlainObject(d)?z.merge.call({caseless:h},u,d):z.isPlainObject(d)?z.merge({},d):z.isArray(d)?d.slice():d}function o(u,d,f,h){if(z.isUndefined(d)){if(!z.isUndefined(u))return n(void 0,u,f,h)}else return n(u,d,f,h)}function s(u,d){if(!z.isUndefined(d))return n(void 0,d)}function i(u,d){if(z.isUndefined(d)){if(!z.isUndefined(u))return n(void 0,u)}else return n(void 0,d)}function a(u,d,f){if(f in t)return n(u,d);if(f in e)return n(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,f)=>o(Tf(u),Tf(d),f,!0)};return z.forEach(Object.keys({...e,...t}),function(d){const f=c[d]||o,h=f(e[d],t[d],d);z.isUndefined(h)&&f!==a||(r[d]=h)}),r}const If=e=>{const t=bn({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:a}=t;t.headers=i=sr.from(i),t.url=bf(Af(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(z.isFormData(r)){if(Xt.hasStandardBrowserEnv||Xt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((c=i.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];i.setContentType([u||"multipart/form-data",...d].join("; "))}}if(Xt.hasStandardBrowserEnv&&(n&&z.isFunction(n)&&(n=n(t)),n||n!==!1&&b_(t.url))){const u=o&&s&&__.read(s);u&&i.set(o,u)}return t},S_=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const o=If(e);let s=o.data;const i=sr.from(o.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=o,d,f,h,v,m;function p(){v&&v(),m&&m(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let b=new XMLHttpRequest;b.open(o.method.toUpperCase(),o.url,!0),b.timeout=o.timeout;function w(){if(!b)return;const E=sr.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:E,config:e,request:b};Ef(function(D){r(D),p()},function(D){n(D),p()},x),b=null}"onloadend"in b?b.onloadend=w:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(w)},b.onabort=function(){b&&(n(new Le("Request aborted",Le.ECONNABORTED,e,b)),b=null)},b.onerror=function(){n(new Le("Network Error",Le.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let S=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const x=o.transitional||xf;o.timeoutErrorMessage&&(S=o.timeoutErrorMessage),n(new Le(S,x.clarifyTimeoutError?Le.ETIMEDOUT:Le.ECONNABORTED,e,b)),b=null},s===void 0&&i.setContentType(null),"setRequestHeader"in b&&z.forEach(i.toJSON(),function(S,x){b.setRequestHeader(x,S)}),z.isUndefined(o.withCredentials)||(b.withCredentials=!!o.withCredentials),a&&a!=="json"&&(b.responseType=o.responseType),u&&([h,m]=ki(u,!0),b.addEventListener("progress",h)),c&&b.upload&&([f,v]=ki(c),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",v)),(o.cancelToken||o.signal)&&(d=E=>{b&&(n(!E||E.type?new qn(null,e,b):E),b.abort(),b=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const C=g_(o.url);if(C&&Xt.protocols.indexOf(C)===-1){n(new Le("Unsupported protocol "+C+":",Le.ERR_BAD_REQUEST,e));return}b.send(s||null)})},C_=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,o;const s=function(u){if(!o){o=!0,a();const d=u instanceof Error?u:this.reason;n.abort(d instanceof Le?d:new qn(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new Le(`timeout ${t} of ms exceeded`,Le.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:c}=n;return c.unsubscribe=()=>z.asap(a),c}},E_=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,o;for(;n<r;)o=n+t,yield e.slice(n,o),n=o},D_=async function*(e,t){for await(const r of k_(e))yield*E_(r,t)},k_=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},Mf=(e,t,r,n)=>{const o=D_(e,t);let s=0,i,a=c=>{i||(i=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await o.next();if(u){a(),c.close();return}let f=d.byteLength;if(r){let h=s+=f;r(h)}c.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(c){return a(c),o.return()}},{highWaterMark:2})},Ai=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Pf=Ai&&typeof ReadableStream=="function",A_=Ai&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Of=(e,...t)=>{try{return!!e(...t)}catch{return!1}},T_=Pf&&Of(()=>{let e=!1;const t=new Request(Xt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),jf=64*1024,bc=Pf&&Of(()=>z.isReadableStream(new Response("").body)),Ti={stream:bc&&(e=>e.body)};Ai&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ti[t]&&(Ti[t]=z.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new Le(`Response type '${t}' is not supported`,Le.ERR_NOT_SUPPORT,n)})})})(new Response);const I_=async e=>{if(e==null)return 0;if(z.isBlob(e))return e.size;if(z.isSpecCompliantForm(e))return(await new Request(Xt.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(z.isArrayBufferView(e)||z.isArrayBuffer(e))return e.byteLength;if(z.isURLSearchParams(e)&&(e=e+""),z.isString(e))return(await A_(e)).byteLength},M_=async(e,t)=>{const r=z.toFiniteNumber(e.getContentLength());return r??I_(t)},_c={http:X1,xhr:S_,fetch:Ai&&(async e=>{let{url:t,method:r,data:n,signal:o,cancelToken:s,timeout:i,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:h}=If(e);u=u?(u+"").toLowerCase():"text";let v=C_([o,s&&s.toAbortSignal()],i),m;const p=v&&v.unsubscribe&&(()=>{v.unsubscribe()});let b;try{if(c&&T_&&r!=="get"&&r!=="head"&&(b=await M_(d,n))!==0){let x=new Request(t,{method:"POST",body:n,duplex:"half"}),W;if(z.isFormData(n)&&(W=x.headers.get("content-type"))&&d.setContentType(W),x.body){const[D,A]=Df(b,ki(kf(c)));n=Mf(x.body,jf,D,A)}}z.isString(f)||(f=f?"include":"omit");const w="credentials"in Request.prototype;m=new Request(t,{...h,signal:v,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:w?f:void 0});let C=await fetch(m,h);const E=bc&&(u==="stream"||u==="response");if(bc&&(a||E&&p)){const x={};["status","statusText","headers"].forEach(M=>{x[M]=C[M]});const W=z.toFiniteNumber(C.headers.get("content-length")),[D,A]=a&&Df(W,ki(kf(a),!0))||[];C=new Response(Mf(C.body,jf,D,()=>{A&&A(),p&&p()}),x)}u=u||"text";let S=await Ti[z.findKey(Ti,u)||"text"](C,e);return!E&&p&&p(),await new Promise((x,W)=>{Ef(x,W,{data:S,headers:sr.from(C.headers),status:C.status,statusText:C.statusText,config:e,request:m})})}catch(w){throw p&&p(),w&&w.name==="TypeError"&&/Load failed|fetch/i.test(w.message)?Object.assign(new Le("Network Error",Le.ERR_NETWORK,e,m),{cause:w.cause||w}):Le.from(w,w&&w.code,e,m)}})};z.forEach(_c,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Rf=e=>`- ${e}`,P_=e=>z.isFunction(e)||e===null||e===!1,Nf={getAdapter:e=>{e=z.isArray(e)?e:[e];const{length:t}=e;let r,n;const o={};for(let s=0;s<t;s++){r=e[s];let i;if(n=r,!P_(r)&&(n=_c[(i=String(r)).toLowerCase()],n===void 0))throw new Le(`Unknown adapter '${i}'`);if(n)break;o[i||"#"+s]=n}if(!n){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=t?s.length>1?`since :
|
|
158
158
|
`+s.map(Rf).join(`
|
|
159
159
|
`):" "+Rf(s[0]):"as no adapter specified";throw new Le("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return n},adapters:_c};function xc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new qn(null,e)}function $f(e){return xc(e),e.headers=sr.from(e.headers),e.data=yc.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Nf.getAdapter(e.adapter||Oo.adapter)(e).then(function(n){return xc(e),n.data=yc.call(e,e.transformResponse,n),n.headers=sr.from(n.headers),n},function(n){return Cf(n)||(xc(e),n&&n.response&&(n.response.data=yc.call(e,e.transformResponse,n.response),n.response.headers=sr.from(n.response.headers))),Promise.reject(n)})}const Lf="1.11.0",Ii={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ii[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const zf={};Ii.transitional=function(t,r,n){function o(s,i){return"[Axios v"+Lf+"] Transitional option '"+s+"'"+i+(n?". "+n:"")}return(s,i,a)=>{if(t===!1)throw new Le(o(i," has been removed"+(r?" in "+r:"")),Le.ERR_DEPRECATED);return r&&!zf[i]&&(zf[i]=!0,console.warn(o(i," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(s,i,a):!0}},Ii.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function O_(e,t,r){if(typeof e!="object")throw new Le("options must be an object",Le.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const s=n[o],i=t[s];if(i){const a=e[s],c=a===void 0||i(a,s,e);if(c!==!0)throw new Le("option "+s+" must be "+c,Le.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Le("Unknown option "+s,Le.ERR_BAD_OPTION)}}const Mi={assertOptions:O_,validators:Ii},Wr=Mi.validators;let _n=class{constructor(t){this.defaults=t||{},this.interceptors={request:new _f,response:new _f}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const s=o.stack?o.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
160
|
-
`+s):n.stack=s}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=bn(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:s}=r;n!==void 0&&Mi.assertOptions(n,{silentJSONParsing:Wr.transitional(Wr.boolean),forcedJSONParsing:Wr.transitional(Wr.boolean),clarifyTimeoutError:Wr.transitional(Wr.boolean)},!1),o!=null&&(z.isFunction(o)?r.paramsSerializer={serialize:o}:Mi.assertOptions(o,{encode:Wr.function,serialize:Wr.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Mi.assertOptions(r,{baseUrl:Wr.spelling("baseURL"),withXsrfToken:Wr.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=s&&z.merge(s.common,s[r.method]);s&&z.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),r.headers=sr.concat(i,s);const a=[];let c=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(r)===!1||(c=c&&p.synchronous,a.unshift(p.fulfilled,p.rejected))});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let d,f=0,h;if(!c){const m=[$f.bind(this),void 0];for(m.unshift(...a),m.push(...u),h=m.length,d=Promise.resolve(r);f<h;)d=d.then(m[f++],m[f++]);return d}h=a.length;let v=r;for(f=0;f<h;){const m=a[f++],p=a[f++];try{v=m(v)}catch(b){p.call(this,b);break}}try{d=$f.call(this,v)}catch(m){return Promise.reject(m)}for(f=0,h=u.length;f<h;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=bn(this.defaults,t);const r=Af(t.baseURL,t.url,t.allowAbsoluteUrls);return bf(r,t.params,t.paramsSerializer)}};z.forEach(["delete","get","head","options"],function(t){_n.prototype[t]=function(r,n){return this.request(bn(n||{},{method:t,url:r,data:(n||{}).data}))}}),z.forEach(["post","put","patch"],function(t){function r(n){return function(s,i,a){return this.request(bn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}_n.prototype[t]=r(),_n.prototype[t+"Form"]=r(!0)});let j_=class m0{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});const n=this;this.promise.then(o=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](o);n._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{n.subscribe(a),s=a}).then(o);return i.cancel=function(){n.unsubscribe(s)},i},t(function(s,i,a){n.reason||(n.reason=new qn(s,i,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new m0(function(o){t=o}),cancel:t}}};function R_(e){return function(r){return e.apply(null,r)}}function N_(e){return z.isObject(e)&&e.isAxiosError===!0}const wc={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(wc).forEach(([e,t])=>{wc[t]=e});function Bf(e){const t=new _n(e),r=nf(_n.prototype.request,t);return z.extend(r,_n.prototype,t,{allOwnKeys:!0}),z.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return Bf(bn(e,o))},r}const Rt=Bf(Oo);Rt.Axios=_n,Rt.CanceledError=qn,Rt.CancelToken=j_,Rt.isCancel=Cf,Rt.VERSION=Lf,Rt.toFormData=Ei,Rt.AxiosError=Le,Rt.Cancel=Rt.CanceledError,Rt.all=function(t){return Promise.all(t)},Rt.spread=R_,Rt.isAxiosError=N_,Rt.mergeConfig=bn,Rt.AxiosHeaders=sr,Rt.formToJSON=e=>wf(z.isHTMLForm(e)?new FormData(e):e),Rt.getAdapter=Nf.getAdapter,Rt.HttpStatusCode=wc,Rt.default=Rt;const{Axios:n5,AxiosError:o5,CanceledError:s5,isCancel:i5,CancelToken:a5,VERSION:c5,all:l5,Cancel:u5,isAxiosError:d5,spread:f5,toFormData:p5,AxiosHeaders:h5,HttpStatusCode:m5,formToJSON:g5,getAdapter:v5,mergeConfig:y5}=Rt,Ff={token:null},$_=e=>{Ff.token=e},Et=Rt.create({headers:{"Content-Type":"application/json"}});Et.interceptors.request.use(e=>{const t=Ff.token;return t&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e));const Wf=y.createContext(void 0),L_=({config:e,children:t})=>(y.useEffect(()=>{e.getToken&&$_(e.getToken)},[e.getToken]),l.jsx(Wf.Provider,{value:e,children:t})),Sc=()=>{const e=y.useContext(Wf);if(!e)throw new Error("useApiConfig debe ser usado dentro de un ApiProvider");return e},Pi=()=>{const{calendarApiUrl:e}=Sc();return{getGoogleAuthUrl:async()=>{try{const i=`${e}/api/Calendario/v1/auth-url-Google`;return(await Et.get(i)).data}catch(i){throw console.error("Error al obtener la URL de Google Auth:",i),i}},saveGoogleCredentials:async i=>{try{const a=new URLSearchParams({code:i.code,disID:String(i.disID),usrID:String(i.usrID)}).toString(),c=`${e}/api/Calendario/v1/google-auth/SaveCredential?${a}`;return(await Et.post(c,{})).data}catch(a){throw console.error("Error al guardar credenciales de Google:",a),a}},getGoogleCalendars:async(i,a)=>{try{return(await Et.get(`${e}/api/Calendario/v1/google/ObtenerTiposCalendariosGoogleAsync?usrMail=${encodeURIComponent(i)}&disID=${a}`)).data}catch(c){throw console.error("Error al obtener los calendarios de Google:",c),c}},syncGoogleEvents:async(i,a,c)=>{try{return(await Et.post(`${e}/api/Calendario/v1/google/SincronizarEnviarEventosAsync?usrMail=${encodeURIComponent(i)}&disID=${a}&UsuarioID=${c}`)).data}catch(u){throw console.error("Error al sincronizar eventos con Google Calendar:",u),u}},getGoogleEventsByMonth:async i=>{try{return(await Et.post(`${e}/api/Calendario/v1/google/ObtenerEventosGoogleAsyncXMes`,i)).data}catch(a){throw console.error("Error al obtener eventos de Google Calendar por mes:",a),a}}}},Vf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAASFBMVEVChfRHcExDhOAWaNUZfjjkTDf////6/P7b6fu61fj7wCj7vASZv/VuoPBQjvVCr19GifE0qFM4gerrRjMubcQQaucZZ9MYgTpc4mWWAAAABnRSTlP/AFtbW/eMEQaPAAAAfUlEQVR42q3Pyw4CIQyFYVDbigKOl6Pv/6a2ZBYN08TEzL9gcb6waDqkubd1TEsEWkp7Q3e9RuvOrsvV+g0Fi+jaZIKC0sECzMDCDK51C9zR9A2gPhCC6HgOoIFL/KMD1cMfl39GNxc9NVrh7jKgHAPlCGwPgSgbnDYw9vwFKv0VRfpGYZ8AAAAASUVORK5CYII=",z_=({disID:e,usrID:t})=>{const[r,n]=y.useState(null),o=Pi(),s=async()=>{localStorage.setItem("temp_auth_disID",String(e)),localStorage.setItem("temp_auth_usrID",String(t)),n(null);try{const{url:i}=await o.getGoogleAuthUrl();window.location.href=i}catch(i){n(i.message||"Fallo al iniciar sesión con Google."),localStorage.removeItem("temp_auth_disID"),localStorage.removeItem("temp_auth_usrID")}finally{}};return l.jsxs("div",{className:"flex",children:[l.jsxs("div",{className:_e.syncButton,onClick:s,children:[l.jsx("div",{className:_e.customCheckIcon,children:l.jsx("div",{className:_e.uncheckedCircle})}),l.jsx("img",{src:Vf,width:18}),l.jsx("span",{children:"Google Calendar"})]}),r&&l.jsx("p",{className:"text-red-500 mt-2",children:r})]})},Cc=()=>{const{calendarApiUrl:e}=Sc();return{getOutlookAuthUrl:async()=>{try{const i=`${e}/api/Calendario/v1/auth-url-Outlook`,a=await Et.get(i);return console.log("api",a),a.data}catch(i){throw console.error("Error al obtener la URL de Outlook Auth:",i),i}},saveOutlookCredentials:async i=>{try{const a=new URLSearchParams({code:i.code,disID:String(i.disID),usrID:String(i.usrID)}).toString(),c=`${e}/api/Calendario/v1/outlook-auth/SaveCredential?${a}`;return(await Et.post(c,{})).data}catch(a){throw console.error("Error al guardar credenciales Outlook:",a),a}},syncOutlookEvents:async(i,a,c)=>{try{return(await Et.post(`${e}/api/Calendario/v1/outlook/SincronizarEnviarEventosAsync?usrMail=${encodeURIComponent(i)}&disID=${a}&UsuarioID=${c}`)).data}catch(u){throw console.error("Error al sincronizar eventos con outlook Calendar:",u),u}},getOutlookCalendars:async(i,a)=>{try{return(await Et.get(`${e}/api/Calendario/v1/outlook/ObtenerTiposCalendariosOutlookAsync?usrMail=${encodeURIComponent(i)}&disID=${a}`)).data}catch(c){throw console.error("Error al obtener los calendarios de Google:",c),c}},getOutlookEventsByMonth:async i=>{try{return(await Et.post(`${e}/api/Calendario/v1/outlook/ObtenerEventosoutlookAsyncXMes`,i)).data}catch(a){throw console.error("Error al obtener eventos de Outlook Calendar por mes:",a),a}}}},Uf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAYCAMAAAA8nnbJAAAAflBMVEUAAAAAV34AMFoAID0ATmsAL1oATXcAZZAAIUgANmQArPAAfd0BedoAacQAZbsAkuMActcAa9QAsfMAjfMAUJL///8Ame8Aht4A6v8A2v8Atvguid0AfMIAo+wAWrYA3/+q0/MAQ38ASIjB4PeHwe4AU7JlsekAdcMAXqgApf4WoQK+AAAACnRSTlMATjUWISlCbAuE1QOT9gAAAP1JREFUKM9t0GF7QzAQwPG2xiw5JGlICWVsrX3/L7i7Gyae/l944efinpzW4ktQfPrvorIgiHaW5UHZ29Hu3Dd235uTUkJnMHGj2NKISvh/TmBdX9c1W/pz5SQOOtsFFl0lBfx8YeCH6aHJhEG89X2/2aOchnLSIC1IACWwZjFdfmnwpSeDg/kSJH0AsLPLZgBoam9jsp2p8EylLK2rjDAmb89kALzLoLUaMyx3bs6rajHlh8FnZHzN+VwVxWKI+F5jFgdnW2BsaSUxUBRYYUdXrYaDMfbxydmuEU+32tJ7+5fB7QvUwBrDCcq4Z2AirJX7udCaziUMVHI+hPQLqRAg85aAu30AAAAASUVORK5CYII=",B_=({disID:e,usrID:t})=>{const[r,n]=y.useState(null),o=Cc(),s=async()=>{localStorage.setItem("temp_auth_disID",String(e)),localStorage.setItem("temp_auth_usrID",String(t)),n(null);try{const i=await o.getOutlookAuthUrl();window.location.href=i?.authUrl}catch(i){n(i.message||"Fallo al iniciar sesión con Google."),localStorage.removeItem("temp_auth_disID"),localStorage.removeItem("temp_auth_usrID")}finally{}};return l.jsxs("div",{className:"flex",children:[l.jsxs("div",{className:_e.syncButton,onClick:s,children:[l.jsx("div",{className:_e.customCheckIcon,children:l.jsx("div",{className:_e.uncheckedCircle})}),l.jsx("img",{src:Uf,width:20}),l.jsx("span",{children:"Outlook"})]}),r&&l.jsx("p",{className:"text-red-500 mt-2",children:r})]})},Hf="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='88'%20height='67'%20fill='none'%3e%3cg%20filter='url(%23a)'%20opacity='.7'%3e%3cellipse%20cx='69.302'%20cy='60.952'%20fill='%23D9D9D9'%20rx='12.698'%20ry='2.032'/%3e%3c/g%3e%3cpath%20fill='%23D6D6D6'%20fill-rule='evenodd'%20d='M60.034%2011.99c.71.001%201.37.374%201.737.982l-1.74%201.05a270%20270%200%200%201%201.74-1.048l.002.002.002.004.007.011.02.034.063.11q.08.139.21.385c.171.327.403.795.657%201.38a24.6%2024.6%200%200%201%201.527%204.811c.817%203.964.847%209.339-2.499%2014.552a2.033%202.033%200%200%201-3.242.236l1.533-1.333-1.535%201.332v-.003l-.005-.004-.01-.012-.028-.033-.082-.1a10%2010%200%200%201-.26-.34%2014%2014%200%200%201-.798-1.221%2017.3%2017.3%200%200%201-1.828-4.469c-.986-3.873-.934-9.225%202.79-15.35l.072-.11c.38-.542%201-.867%201.667-.866m1.867%2017.26q-.02.064-.042.126.091-.276.172-.552zm-1.626-14.786.004.008z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23C2C3CC'%20d='M59.728%2035.515s-1.736-7.32%206.371-12.183c0%200%20.497%208.29-6.371%2012.183'/%3e%3cpath%20fill='%23D6D6D6'%20fill-rule='evenodd'%20d='M79.915%2011.99c.71.001%201.37.374%201.737.982l-1.74%201.05a281%20281%200%200%201%201.74-1.048l.002.002.002.004.007.011.02.034.063.11q.08.139.21.385c.171.327.402.795.657%201.38a24.6%2024.6%200%200%201%201.527%204.811c.817%203.964.847%209.339-2.5%2014.552a2.033%202.033%200%200%201-3.241.236l1.532-1.333-1.534%201.332-.001-.003-.004-.004-.011-.012-.027-.033-.082-.1a10%2010%200%200%201-.26-.34c-.211-.287-.492-.698-.799-1.221a17.3%2017.3%200%200%201-1.827-4.469c-.986-3.873-.934-9.225%202.79-15.35l.072-.11c.38-.542%201-.867%201.667-.866m2.476%209.544q.013.113.027.228-.058-.477-.135-.934z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23C2C3CC'%20fill-rule='evenodd'%20d='M72.733%2022.085c.313-.165.691-.154.996.028l-.522.871c.522-.87.521-.871.522-.87l.004.001.007.004.021.013q.027.016.072.046.091.057.25.165c.212.145.507.357.856.635.697.556%201.62%201.383%202.52%202.474%201.803%202.183%203.562%205.475%203.201%209.764a1.016%201.016%200%200%201-1.376.863h-.002l-.004-.002-.008-.002-.023-.01-.079-.033a9.79%209.79%200%200%201-1.139-.603%2012%2012%200%200%201-2.566-2.14c-1.853-2.044-3.57-5.345-3.271-10.365l.017-.131c.057-.3.249-.563.524-.708M78.04%2034.22l.11.075a11%2011%200%200%201-.394-.282zm-4.516-11.027.334.237q0%200%20.003.002a13%2013%200%200%200-.337-.24'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23C2C3CC'%20fill-rule='evenodd'%20d='M85.456%2022.461a1.017%201.017%200%200%201%201.536.81l-1.014.061%201.014-.06v.002l.001.003v.008l.001.024.004.085q.004.108.004.301c0%20.257-.007.62-.04%201.067-.064.89-.227%202.12-.618%203.482-.781%202.723-2.5%206.038-6.237%208.156a1.018%201.018%200%200%201-1.489-.65l-.002-.006-.002-.009-.005-.025a5%205%200%200%201-.065-.367%2010%2010%200%200%201-.096-.999c-.04-.837%200-2.002.316-3.331.639-2.686%202.388-5.97%206.692-8.552'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23D6D6D6'%20fill-rule='evenodd'%20d='M70.232%205.343c.71.002%201.37.374%201.737.982l-1.74%201.05c1.739-1.05%201.74-1.048%201.74-1.048l.002.002q0%20.003.003.004l.008.014.023.04.082.142q.102.18.274.505c.227.432.535%201.053.875%201.834a33%2033%200%200%201%202.036%206.417c1.09%205.284%201.122%2012.4-3.305%2019.3a2.034%202.034%200%200%201-3.242.236l1.532-1.334a223%20223%200%200%201-1.534%201.332l-.002-.002-.004-.005-.012-.013-.033-.04-.102-.124a13%2013%200%200%201-.335-.438%2019%2019%200%200%201-1.048-1.603%2023%2023%200%200%201-2.413-5.902c-1.3-5.104-1.25-12.198%203.719-20.373l.072-.11c.38-.541%201-.867%201.667-.866m1.563%2026.818v-.002l-.003-.002v-.002z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23AAABAD'%20fill-rule='evenodd'%20d='M60.61%2018.704c.315-.166.693-.155.998.027l-.523.871c.489-.815.52-.868.523-.87l.004.001.009.005.027.017a8%208%200%200%201%20.425.279c.282.192.676.476%201.145.85a23%2023%200%200%201%203.383%203.32c2.419%202.929%204.765%207.325%204.284%2013.05a1.017%201.017%200%200%201-1.376.864l.363-.948-.364.947h-.002l-.003-.002q-.005%200-.01-.003l-.03-.012-.1-.041a9%209%200%200%201-.341-.157c-.288-.139-.69-.35-1.164-.642a16%2016%200%200%201-3.42-2.852c-2.465-2.719-4.768-7.125-4.367-13.866l.017-.131c.058-.3.248-.562.523-.708m.436%201.974q.003-.237.011-.477v-.003a24%2024%200%200%200-.01.48'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23AAABAD'%20fill-rule='evenodd'%20d='M78.103%2019.143a1.016%201.016%200%200%201%201.419.871l-1.014.06%201.014-.06.001.002v.013l.002.032.004.11q.005.142.006.399c0%20.341-.01.83-.054%201.428a23.2%2023.2%200%200%201-.829%204.675c-1.05%203.655-3.348%208.076-8.335%2010.904a1.016%201.016%200%200%201-1.49-.65l.989-.233-.988.232-.001-.001-.001-.004-.002-.01-.007-.032q-.01-.038-.022-.104a9%209%200%200%201-.064-.372c-.047-.317-.1-.768-.127-1.326a16%2016%200%200%201%20.423-4.441c.85-3.574%203.18-7.967%208.96-11.433zm-8.499%2015.032c-.007.617.024%201.143.066%201.552q.032.308.065.524c.043.286.08.443.08.443-.003-.017-.23-.99-.21-2.52m.05-1.027q-.023.282-.036.546l.032-.511q.001-.018.004-.035'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23D6D6D6'%20d='M55.804%2031.519h28.238c.815%200%201.476.663%201.476%201.481v15.847c0%206.204-5.019%2011.241-11.2%2011.241h-8.79c-6.182%200-11.2-5.037-11.2-11.24V33c0-.818.66-1.481%201.476-1.481'/%3e%3cpath%20fill='%23E6E8ED'%20d='M68.15%2032.344v17.159c0%205.103%203.6%209.364%208.39%2010.361%205.122-1.034%208.978-5.574%208.978-11.018V33c0-.818-.66-1.481-1.476-1.481h-15.07a.823.823%200%200%200-.822.824z'/%3e%3cg%20filter='url(%23b)'%20opacity='.7'%3e%3cellipse%20cx='33.238'%20cy='60.952'%20fill='%23D9D9D9'%20rx='28.444'%20ry='3.048'/%3e%3c/g%3e%3cpath%20fill='%233856EC'%20d='M6.095%2017.27h54.857V53.84a6.095%206.095%200%200%201-6.095%206.095H12.19a6.095%206.095%200%200%201-6.095-6.095z'/%3e%3cpath%20fill='%23E2EDFB'%20d='M6.195%2050.145a8.127%208.127%200%200%200%208.127%208.127H37.9a6.1%206.1%200%200%200%204.309-1.785l16.98-16.973a6.1%206.1%200%200%200%201.785-4.31V9.586a6.095%206.095%200%200%200-6.095-6.095H12.29a6.095%206.095%200%200%200-6.095%206.095z'/%3e%3cpath%20fill='%233856EC'%20fill-rule='evenodd'%20d='M60.952%209.009a6.014%206.014%200%200%200-6.014-6.014H12.11a6.014%206.014%200%200%200-6.014%206.014v8.284h54.857zM17.77%2012.772a2.794%202.794%200%201%201%20.002-5.589%202.794%202.794%200%200%201-.002%205.59m15.965%200a2.794%202.794%200%201%201%20.001-5.588%202.794%202.794%200%200%201%200%205.588m16.763%200a2.794%202.794%200%201%201%20.001-5.588%202.794%202.794%200%200%201-.001%205.588'%20clip-rule='evenodd'/%3e%3crect%20width='7.982'%20height='7.982'%20x='11.783'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='23.756'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='34.931'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='46.904'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='11.783'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='23.756'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='34.931'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='46.904'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='11.783'%20y='44.702'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='23.756'%20y='44.702'%20fill='%23fff'%20rx='2.032'/%3e%3cpath%20fill='%23597EF7'%20d='M40.52%2057.687a6%206%200%200%200%201.665-1.174l17.027-17.021a6%206%200%200%200%201.313-1.973H48.646a8.127%208.127%200%200%200-8.127%208.127z'/%3e%3crect%20width='3.991'%20height='11.974'%20x='15.773'%20fill='%23D9D9D9'%20rx='1.996'/%3e%3crect%20width='3.991'%20height='11.974'%20x='31.738'%20fill='%23D9D9D9'%20rx='1.996'/%3e%3crect%20width='3.991'%20height='11.974'%20x='48.501'%20fill='%23D9D9D9'%20rx='1.996'/%3e%3cdefs%3e%3cfilter%20id='a'%20width='29.46'%20height='8.127'%20x='54.572'%20y='56.889'%20color-interpolation-filters='sRGB'%20filterUnits='userSpaceOnUse'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeGaussianBlur%20result='effect1_foregroundBlur_529_4322'%20stdDeviation='1.016'/%3e%3c/filter%3e%3cfilter%20id='b'%20width='60.952'%20height='10.159'%20x='2.762'%20y='55.873'%20color-interpolation-filters='sRGB'%20filterUnits='userSpaceOnUse'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeGaussianBlur%20result='effect1_foregroundBlur_529_4322'%20stdDeviation='1.016'/%3e%3c/filter%3e%3c/defs%3e%3c/svg%3e";class xn extends Error{constructor(t,r){const n=new.target.prototype;super(`${t}: Status code '${r}'`),this.statusCode=r,this.__proto__=n}}class Ec extends Error{constructor(t="A timeout occurred."){const r=new.target.prototype;super(t),this.__proto__=r}}class Ar extends Error{constructor(t="An abort occurred."){const r=new.target.prototype;super(t),this.__proto__=r}}class F_ extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.transport=r,this.errorType="UnsupportedTransportError",this.__proto__=n}}class W_ extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.transport=r,this.errorType="DisabledTransportError",this.__proto__=n}}class V_ extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.transport=r,this.errorType="FailedToStartTransportError",this.__proto__=n}}class Yf extends Error{constructor(t){const r=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=r}}class U_ extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.innerErrors=r,this.__proto__=n}}class qf{constructor(t,r,n){this.statusCode=t,this.statusText=r,this.content=n}}class Oi{get(t,r){return this.send({...r,method:"GET",url:t})}post(t,r){return this.send({...r,method:"POST",url:t})}delete(t,r){return this.send({...r,method:"DELETE",url:t})}getCookieString(t){return""}}var U;(function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"})(U||(U={}));class Ro{constructor(){}log(t,r){}}Ro.instance=new Ro;const H_="10.0.0";class Bt{static isRequired(t,r){if(t==null)throw new Error(`The '${r}' argument is required.`)}static isNotEmpty(t,r){if(!t||t.match(/^\s*$/))throw new Error(`The '${r}' argument should not be empty.`)}static isIn(t,r,n){if(!(t in r))throw new Error(`Unknown ${n} value: ${t}.`)}}class Dt{static get isBrowser(){return!Dt.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!Dt.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!Dt.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function No(e,t){let r="";return wn(e)?(r=`Binary data of length ${e.byteLength}`,t&&(r+=`. Content: '${Y_(e)}'`)):typeof e=="string"&&(r=`String data of length ${e.length}`,t&&(r+=`. Content: '${e}'`)),r}function Y_(e){const t=new Uint8Array(e);let r="";return t.forEach(n=>{const o=n<16?"0":"";r+=`0x${o}${n.toString(16)} `}),r.substring(0,r.length-1)}function wn(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}async function Zf(e,t,r,n,o,s){const i={},[a,c]=Zn();i[a]=c,e.log(U.Trace,`(${t} transport) sending data. ${No(o,s.logMessageContent)}.`);const u=wn(o)?"arraybuffer":"text",d=await r.post(n,{content:o,headers:{...i,...s.headers},responseType:u,timeout:s.timeout,withCredentials:s.withCredentials});e.log(U.Trace,`(${t} transport) request complete. Response status: ${d.statusCode}.`)}function q_(e){return e===void 0?new ji(U.Information):e===null?Ro.instance:e.log!==void 0?e:new ji(e)}class Z_{constructor(t,r){this._subject=t,this._observer=r}dispose(){const t=this._subject.observers.indexOf(this._observer);t>-1&&this._subject.observers.splice(t,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(r=>{})}}class ji{constructor(t){this._minLevel=t,this.out=console}log(t,r){if(t>=this._minLevel){const n=`[${new Date().toISOString()}] ${U[t]}: ${r}`;switch(t){case U.Critical:case U.Error:this.out.error(n);break;case U.Warning:this.out.warn(n);break;case U.Information:this.out.info(n);break;default:this.out.log(n);break}}}}function Zn(){let e="X-SignalR-User-Agent";return Dt.isNode&&(e="User-Agent"),[e,G_(H_,K_(),X_(),Q_())]}function G_(e,t,r,n){let o="Microsoft SignalR/";const s=e.split(".");return o+=`${s[0]}.${s[1]}`,o+=` (${e}; `,t&&t!==""?o+=`${t}; `:o+="Unknown OS; ",o+=`${r}`,n?o+=`; ${n}`:o+="; Unknown Runtime Version",o+=")",o}function K_(){if(Dt.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Q_(){if(Dt.isNode)return process.versions.node}function X_(){return Dt.isNode?"NodeJS":"Browser"}function Dc(e){return e.stack?e.stack:e.message?e.message:`${e}`}function J_(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class ex extends Oi{constructor(t){if(super(),this._logger=t,typeof fetch>"u"||Dt.isNode){const r=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(r("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=r("node-fetch"):this._fetchType=fetch,this._fetchType=r("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(J_());if(typeof AbortController>"u"){const r=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=r("abort-controller")}else this._abortControllerType=AbortController}async send(t){if(t.abortSignal&&t.abortSignal.aborted)throw new Ar;if(!t.method)throw new Error("No method defined.");if(!t.url)throw new Error("No url defined.");const r=new this._abortControllerType;let n;t.abortSignal&&(t.abortSignal.onabort=()=>{r.abort(),n=new Ar});let o=null;if(t.timeout){const c=t.timeout;o=setTimeout(()=>{r.abort(),this._logger.log(U.Warning,"Timeout from HTTP request."),n=new Ec},c)}t.content===""&&(t.content=void 0),t.content&&(t.headers=t.headers||{},wn(t.content)?t.headers["Content-Type"]="application/octet-stream":t.headers["Content-Type"]="text/plain;charset=UTF-8");let s;try{s=await this._fetchType(t.url,{body:t.content,cache:"no-cache",credentials:t.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:r.signal})}catch(c){throw n||(this._logger.log(U.Warning,`Error from HTTP request. ${c}.`),c)}finally{o&&clearTimeout(o),t.abortSignal&&(t.abortSignal.onabort=null)}if(!s.ok){const c=await Gf(s,"text");throw new xn(c||s.statusText,s.status)}const a=await Gf(s,t.responseType);return new qf(s.status,s.statusText,a)}getCookieString(t){let r="";return Dt.isNode&&this._jar&&this._jar.getCookies(t,(n,o)=>r=o.join("; ")),r}}function Gf(e,t){let r;switch(t){case"arraybuffer":r=e.arrayBuffer();break;case"text":r=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`);default:r=e.text();break}return r}class tx extends Oi{constructor(t){super(),this._logger=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new Ar):t.method?t.url?new Promise((r,n)=>{const o=new XMLHttpRequest;o.open(t.method,t.url,!0),o.withCredentials=t.withCredentials===void 0?!0:t.withCredentials,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),t.content===""&&(t.content=void 0),t.content&&(wn(t.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const s=t.headers;s&&Object.keys(s).forEach(i=>{o.setRequestHeader(i,s[i])}),t.responseType&&(o.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{o.abort(),n(new Ar)}),t.timeout&&(o.timeout=t.timeout),o.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),o.status>=200&&o.status<300?r(new qf(o.status,o.statusText,o.response||o.responseText)):n(new xn(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(U.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new xn(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(U.Warning,"Timeout from HTTP request."),n(new Ec)},o.send(t.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class rx extends Oi{constructor(t){if(super(),typeof fetch<"u"||Dt.isNode)this._httpClient=new ex(t);else if(typeof XMLHttpRequest<"u")this._httpClient=new tx(t);else throw new Error("No usable HttpClient found.")}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new Ar):t.method?t.url?this._httpClient.send(t):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(t){return this._httpClient.getCookieString(t)}}class fr{static write(t){return`${t}${fr.RecordSeparator}`}static parse(t){if(t[t.length-1]!==fr.RecordSeparator)throw new Error("Message is incomplete.");const r=t.split(fr.RecordSeparator);return r.pop(),r}}fr.RecordSeparatorCode=30,fr.RecordSeparator=String.fromCharCode(fr.RecordSeparatorCode);class nx{writeHandshakeRequest(t){return fr.write(JSON.stringify(t))}parseHandshakeResponse(t){let r,n;if(wn(t)){const a=new Uint8Array(t),c=a.indexOf(fr.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");const u=c+1;r=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,u))),n=a.byteLength>u?a.slice(u).buffer:null}else{const a=t,c=a.indexOf(fr.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");const u=c+1;r=a.substring(0,u),n=a.length>u?a.substring(u):null}const o=fr.parse(r),s=JSON.parse(o[0]);if(s.type)throw new Error("Expected a handshake response from the server.");return[n,s]}}var $e;(function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"})($e||($e={}));class ox{constructor(){this.observers=[]}next(t){for(const r of this.observers)r.next(t)}error(t){for(const r of this.observers)r.error&&r.error(t)}complete(){for(const t of this.observers)t.complete&&t.complete()}subscribe(t){return this.observers.push(t),new Z_(this,t)}}class sx{constructor(t,r,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=t,this._connection=r,this._bufferSize=n}async _send(t){const r=this._protocol.writeMessage(t);let n=Promise.resolve();if(this._isInvocationMessage(t)){this._totalMessageCount++;let o=()=>{},s=()=>{};wn(r)?this._bufferedByteCount+=r.byteLength:this._bufferedByteCount+=r.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((i,a)=>{o=i,s=a})),this._messages.push(new ix(r,this._totalMessageCount,o,s))}try{this._reconnectInProgress||await this._connection.send(r)}catch{this._disconnected()}await n}_ack(t){let r=-1;for(let n=0;n<this._messages.length;n++){const o=this._messages[n];if(o._id<=t.sequenceId)r=n,wn(o._message)?this._bufferedByteCount-=o._message.byteLength:this._bufferedByteCount-=o._message.length,o._resolver();else if(this._bufferedByteCount<this._bufferSize)o._resolver();else break}r!==-1&&(this._messages=this._messages.slice(r+1))}_shouldProcessMessage(t){if(this._waitForSequenceMessage)return t.type!==$e.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(t))return!0;const r=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,r<=this._latestReceivedSequenceId?(r===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=r,this._ackTimer(),!0)}_resetSequence(t){if(t.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=t.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const t=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:$e.Sequence,sequenceId:t}));const r=this._messages;for(const n of r)await this._connection.send(n._message);this._reconnectInProgress=!1}_dispose(t){t??(t=new Error("Unable to reconnect to server."));for(const r of this._messages)r._rejector(t)}_isInvocationMessage(t){switch(t.type){case $e.Invocation:case $e.StreamItem:case $e.Completion:case $e.StreamInvocation:case $e.CancelInvocation:return!0;case $e.Close:case $e.Sequence:case $e.Ping:case $e.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:$e.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class ix{constructor(t,r,n,o){this._message=t,this._id=r,this._resolver=n,this._rejector=o}}const ax=30*1e3,cx=15*1e3,lx=1e5;var bt;(function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"})(bt||(bt={}));class kc{static create(t,r,n,o,s,i,a){return new kc(t,r,n,o,s,i,a)}constructor(t,r,n,o,s,i,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(U.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},Bt.isRequired(t,"connection"),Bt.isRequired(r,"logger"),Bt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=s??ax,this.keepAliveIntervalInMilliseconds=i??cx,this._statefulReconnectBufferSize=a??lx,this._logger=r,this._protocol=n,this.connection=t,this._reconnectPolicy=o,this._handshakeProtocol=new nx,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=bt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:$e.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this._connectionState!==bt.Disconnected&&this._connectionState!==bt.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==bt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=bt.Connecting,this._logger.log(U.Debug,"Starting HubConnection.");try{await this._startInternal(),Dt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=bt.Connected,this._connectionStarted=!0,this._logger.log(U.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=bt.Disconnected,this._logger.log(U.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const t=new Promise((r,n)=>{this._handshakeResolver=r,this._handshakeRejecter=n});await this.connection.start(this._protocol.transferFormat);try{let r=this._protocol.version;this.connection.features.reconnect||(r=1);const n={protocol:this._protocol.name,version:r};if(this._logger.log(U.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(U.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await t,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new sx(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(r){throw this._logger.log(U.Debug,`Hub handshake failed with error '${r}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(r),r}}async stop(){const t=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await t}catch{}}_stopInternal(t){if(this._connectionState===bt.Disconnected)return this._logger.log(U.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===bt.Disconnecting)return this._logger.log(U.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const r=this._connectionState;return this._connectionState=bt.Disconnecting,this._logger.log(U.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(U.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(r===bt.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||new Ar("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(t,...r){const[n,o]=this._replaceStreamingParams(r),s=this._createStreamInvocation(t,r,o);let i;const a=new ox;return a.cancelCallback=()=>{const c=this._createCancelInvocation(s.invocationId);return delete this._callbacks[s.invocationId],i.then(()=>this._sendWithProtocol(c))},this._callbacks[s.invocationId]=(c,u)=>{if(u){a.error(u);return}else c&&(c.type===$e.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},i=this._sendWithProtocol(s).catch(c=>{a.error(c),delete this._callbacks[s.invocationId]}),this._launchStreams(n,i),a}_sendMessage(t){return this._resetKeepAliveInterval(),this.connection.send(t)}_sendWithProtocol(t){return this._messageBuffer?this._messageBuffer._send(t):this._sendMessage(this._protocol.writeMessage(t))}send(t,...r){const[n,o]=this._replaceStreamingParams(r),s=this._sendWithProtocol(this._createInvocation(t,r,!0,o));return this._launchStreams(n,s),s}invoke(t,...r){const[n,o]=this._replaceStreamingParams(r),s=this._createInvocation(t,r,!1,o);return new Promise((a,c)=>{this._callbacks[s.invocationId]=(d,f)=>{if(f){c(f);return}else d&&(d.type===$e.Completion?d.error?c(new Error(d.error)):a(d.result):c(new Error(`Unexpected message type: ${d.type}`)))};const u=this._sendWithProtocol(s).catch(d=>{c(d),delete this._callbacks[s.invocationId]});this._launchStreams(n,u)})}on(t,r){!t||!r||(t=t.toLowerCase(),this._methods[t]||(this._methods[t]=[]),this._methods[t].indexOf(r)===-1&&this._methods[t].push(r))}off(t,r){if(!t)return;t=t.toLowerCase();const n=this._methods[t];if(n)if(r){const o=n.indexOf(r);o!==-1&&(n.splice(o,1),n.length===0&&delete this._methods[t])}else delete this._methods[t]}onclose(t){t&&this._closedCallbacks.push(t)}onreconnecting(t){t&&this._reconnectingCallbacks.push(t)}onreconnected(t){t&&this._reconnectedCallbacks.push(t)}_processIncomingData(t){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(t=this._processHandshakeResponse(t),this._receivedHandshakeResponse=!0),t){const r=this._protocol.parseMessages(t,this._logger);for(const n of r)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case $e.Invocation:this._invokeClientMethod(n).catch(o=>{this._logger.log(U.Error,`Invoke client method threw error: ${Dc(o)}`)});break;case $e.StreamItem:case $e.Completion:{const o=this._callbacks[n.invocationId];if(o){n.type===$e.Completion&&delete this._callbacks[n.invocationId];try{o(n)}catch(s){this._logger.log(U.Error,`Stream callback threw error: ${Dc(s)}`)}}break}case $e.Ping:break;case $e.Close:{this._logger.log(U.Information,"Close message received from server.");const o=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(o):this._stopPromise=this._stopInternal(o);break}case $e.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case $e.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(U.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(t){let r,n;try{[n,r]=this._handshakeProtocol.parseHandshakeResponse(t)}catch(o){const s="Error parsing handshake response: "+o;this._logger.log(U.Error,s);const i=new Error(s);throw this._handshakeRejecter(i),i}if(r.error){const o="Server returned handshake error: "+r.error;this._logger.log(U.Error,o);const s=new Error(o);throw this._handshakeRejecter(s),s}else this._logger.log(U.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!this.connection.features||!this.connection.features.inherentKeepAlive){this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds);let t=this._nextKeepAlive-new Date().getTime();if(t<0){this._connectionState===bt.Connected&&this._trySendPingMessage();return}this._pingServerHandle===void 0&&(t<0&&(t=0),this._pingServerHandle=setTimeout(async()=>{this._connectionState===bt.Connected&&await this._trySendPingMessage()},t))}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(t){const r=t.target.toLowerCase(),n=this._methods[r];if(!n){this._logger.log(U.Warning,`No client method with the name '${r}' found.`),t.invocationId&&(this._logger.log(U.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)));return}const o=n.slice(),s=!!t.invocationId;let i,a,c;for(const u of o)try{const d=i;i=await u.apply(this,t.arguments),s&&i&&d&&(this._logger.log(U.Error,`Multiple results provided for '${r}'. Sending error to server.`),c=this._createCompletionMessage(t.invocationId,"Client provided multiple results.",null)),a=void 0}catch(d){a=d,this._logger.log(U.Error,`A callback for the method '${r}' threw error '${d}'.`)}c?await this._sendWithProtocol(c):s?(a?c=this._createCompletionMessage(t.invocationId,`${a}`,null):i!==void 0?c=this._createCompletionMessage(t.invocationId,null,i):(this._logger.log(U.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),c=this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):i&&this._logger.log(U.Error,`Result given for '${r}' method but server is not expecting a result.`)}_connectionClosed(t){this._logger.log(U.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||t||new Ar("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(t||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===bt.Disconnecting?this._completeClose(t):this._connectionState===bt.Connected&&this._reconnectPolicy?this._reconnect(t):this._connectionState===bt.Connected&&this._completeClose(t)}_completeClose(t){if(this._connectionStarted){this._connectionState=bt.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(t??new Error("Connection closed.")),this._messageBuffer=void 0),Dt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(r=>r.apply(this,[t]))}catch(r){this._logger.log(U.Error,`An onclose callback called with error '${t}' threw error '${r}'.`)}}}async _reconnect(t){const r=Date.now();let n=0,o=t!==void 0?t:new Error("Attempting to reconnect due to a unknown error."),s=this._getNextRetryDelay(n,0,o);if(s===null){this._logger.log(U.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(t);return}if(this._connectionState=bt.Reconnecting,t?this._logger.log(U.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(U.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(i=>i.apply(this,[t]))}catch(i){this._logger.log(U.Error,`An onreconnecting callback called with error '${t}' threw error '${i}'.`)}if(this._connectionState!==bt.Reconnecting){this._logger.log(U.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;s!==null;){if(this._logger.log(U.Information,`Reconnect attempt number ${n+1} will start in ${s} ms.`),await new Promise(i=>{this._reconnectDelayHandle=setTimeout(i,s)}),this._reconnectDelayHandle=void 0,this._connectionState!==bt.Reconnecting){this._logger.log(U.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=bt.Connected,this._logger.log(U.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(i=>i.apply(this,[this.connection.connectionId]))}catch(i){this._logger.log(U.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${i}'.`)}return}catch(i){if(this._logger.log(U.Information,`Reconnect attempt failed because of error '${i}'.`),this._connectionState!==bt.Reconnecting){this._logger.log(U.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===bt.Disconnecting&&this._completeClose();return}n++,o=i instanceof Error?i:new Error(i.toString()),s=this._getNextRetryDelay(n,Date.now()-r,o)}}this._logger.log(U.Information,`Reconnect retries have been exhausted after ${Date.now()-r} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(t,r,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:r,previousRetryCount:t,retryReason:n})}catch(o){return this._logger.log(U.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${r}) threw error '${o}'.`),null}}_cancelCallbacksWithError(t){const r=this._callbacks;this._callbacks={},Object.keys(r).forEach(n=>{const o=r[n];try{o(null,t)}catch(s){this._logger.log(U.Error,`Stream 'error' callback called with '${t}' threw error: ${Dc(s)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(t,r,n,o){if(n)return o.length!==0?{target:t,arguments:r,streamIds:o,type:$e.Invocation}:{target:t,arguments:r,type:$e.Invocation};{const s=this._invocationId;return this._invocationId++,o.length!==0?{target:t,arguments:r,invocationId:s.toString(),streamIds:o,type:$e.Invocation}:{target:t,arguments:r,invocationId:s.toString(),type:$e.Invocation}}}_launchStreams(t,r){if(t.length!==0){r||(r=Promise.resolve());for(const n in t)t[n].subscribe({complete:()=>{r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:o=>{let s;o instanceof Error?s=o.message:o&&o.toString?s=o.toString():s="Unknown error",r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,s)))},next:o=>{r=r.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,o)))}})}}_replaceStreamingParams(t){const r=[],n=[];for(let o=0;o<t.length;o++){const s=t[o];if(this._isObservable(s)){const i=this._invocationId;this._invocationId++,r[i]=s,n.push(i.toString()),t.splice(o,1)}}return[r,n]}_isObservable(t){return t&&t.subscribe&&typeof t.subscribe=="function"}_createStreamInvocation(t,r,n){const o=this._invocationId;return this._invocationId++,n.length!==0?{target:t,arguments:r,invocationId:o.toString(),streamIds:n,type:$e.StreamInvocation}:{target:t,arguments:r,invocationId:o.toString(),type:$e.StreamInvocation}}_createCancelInvocation(t){return{invocationId:t,type:$e.CancelInvocation}}_createStreamItemMessage(t,r){return{invocationId:t,item:r,type:$e.StreamItem}}_createCompletionMessage(t,r,n){return r?{error:r,invocationId:t,type:$e.Completion}:{invocationId:t,result:n,type:$e.Completion}}_createCloseMessage(){return{type:$e.Close}}async _trySendPingMessage(){try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}}const ux=[0,2e3,1e4,3e4,null];class Kf{constructor(t){this._retryDelays=t!==void 0?[...t,null]:ux}nextRetryDelayInMilliseconds(t){return this._retryDelays[t.previousRetryCount]}}class Sn{}Sn.Authorization="Authorization",Sn.Cookie="Cookie";class dx extends Oi{constructor(t,r){super(),this._innerClient=t,this._accessTokenFactory=r}async send(t){let r=!0;this._accessTokenFactory&&(!this._accessToken||t.url&&t.url.indexOf("/negotiate?")>0)&&(r=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(t);const n=await this._innerClient.send(t);return r&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(t),await this._innerClient.send(t)):n}_setAuthorizationHeader(t){t.headers||(t.headers={}),this._accessToken?t.headers[Sn.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&t.headers[Sn.Authorization]&&delete t.headers[Sn.Authorization]}getCookieString(t){return this._innerClient.getCookieString(t)}}var Wt;(function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"})(Wt||(Wt={}));var Jt;(function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"})(Jt||(Jt={}));let fx=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class Qf{get pollAborted(){return this._pollAbort.aborted}constructor(t,r,n){this._httpClient=t,this._logger=r,this._pollAbort=new fx,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(t,r){if(Bt.isRequired(t,"url"),Bt.isRequired(r,"transferFormat"),Bt.isIn(r,Jt,"transferFormat"),this._url=t,this._logger.log(U.Trace,"(LongPolling transport) Connecting."),r===Jt.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,o]=Zn(),s={[n]:o,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:s,timeout:1e5,withCredentials:this._options.withCredentials};r===Jt.Binary&&(i.responseType="arraybuffer");const a=`${t}&_=${Date.now()}`;this._logger.log(U.Trace,`(LongPolling transport) polling: ${a}.`);const c=await this._httpClient.get(a,i);c.statusCode!==200?(this._logger.log(U.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new xn(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(t,r){try{for(;this._running;)try{const n=`${t}&_=${Date.now()}`;this._logger.log(U.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,r);o.statusCode===204?(this._logger.log(U.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):o.statusCode!==200?(this._logger.log(U.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new xn(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(U.Trace,`(LongPolling transport) data received. ${No(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(U.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof Ec?this._logger.log(U.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(U.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(U.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?Zf(this._logger,"LongPolling",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(U.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(U.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const t={},[r,n]=Zn();t[r]=n;const o={headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let s;try{await this._httpClient.delete(this._url,o)}catch(i){s=i}s?s instanceof xn&&(s.statusCode===404?this._logger.log(U.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(U.Trace,`(LongPolling transport) Error sending a DELETE request: ${s}`)):this._logger.log(U.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(U.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this._closeError&&(t+=" Error: "+this._closeError),this._logger.log(U.Trace,t),this.onclose(this._closeError)}}}class px{constructor(t,r,n,o){this._httpClient=t,this._accessToken=r,this._logger=n,this._options=o,this.onreceive=null,this.onclose=null}async connect(t,r){return Bt.isRequired(t,"url"),Bt.isRequired(r,"transferFormat"),Bt.isIn(r,Jt,"transferFormat"),this._logger.log(U.Trace,"(SSE transport) Connecting."),this._url=t,this._accessToken&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,o)=>{let s=!1;if(r!==Jt.Text){o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let i;if(Dt.isBrowser||Dt.isWebWorker)i=new this._options.EventSource(t,{withCredentials:this._options.withCredentials});else{const a=this._httpClient.getCookieString(t),c={};c.Cookie=a;const[u,d]=Zn();c[u]=d,i=new this._options.EventSource(t,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{i.onmessage=a=>{if(this.onreceive)try{this._logger.log(U.Trace,`(SSE transport) data received. ${No(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},i.onerror=a=>{s?this._close():o(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},i.onopen=()=>{this._logger.log(U.Information,`SSE connected to ${this._url}`),this._eventSource=i,s=!0,n()}}catch(a){o(a);return}})}async send(t){return this._eventSource?Zf(this._logger,"SSE",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(t){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(t))}}class hx{constructor(t,r,n,o,s,i){this._logger=n,this._accessTokenFactory=r,this._logMessageContent=o,this._webSocketConstructor=s,this._httpClient=t,this.onreceive=null,this.onclose=null,this._headers=i}async connect(t,r){Bt.isRequired(t,"url"),Bt.isRequired(r,"transferFormat"),Bt.isIn(r,Jt,"transferFormat"),this._logger.log(U.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise((o,s)=>{t=t.replace(/^http/,"ws");let i;const a=this._httpClient.getCookieString(t);let c=!1;if(Dt.isNode||Dt.isReactNative){const u={},[d,f]=Zn();u[d]=f,n&&(u[Sn.Authorization]=`Bearer ${n}`),a&&(u[Sn.Cookie]=a),i=new this._webSocketConstructor(t,void 0,{headers:{...u,...this._headers}})}else n&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(t)),r===Jt.Binary&&(i.binaryType="arraybuffer"),i.onopen=u=>{this._logger.log(U.Information,`WebSocket connected to ${t}.`),this._webSocket=i,c=!0,o()},i.onerror=u=>{let d=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?d=u.error:d="There was an error with the transport",this._logger.log(U.Information,`(WebSockets transport) ${d}.`)},i.onmessage=u=>{if(this._logger.log(U.Trace,`(WebSockets transport) data received. ${No(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(d){this._close(d);return}},i.onclose=u=>{if(c)this._close(u);else{let d=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?d=u.error:d="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",s(new Error(d))}}})}send(t){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(U.Trace,`(WebSockets transport) sending data. ${No(t,this._logMessageContent)}.`),this._webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(t){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(U.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(t)&&(t.wasClean===!1||t.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)):t instanceof Error?this.onclose(t):this.onclose())}_isCloseEvent(t){return t&&typeof t.wasClean=="boolean"&&typeof t.code=="number"}}const Xf=100;class mx{constructor(t,r={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Bt.isRequired(t,"url"),this._logger=q_(r.logger),this.baseUrl=this._resolveUrl(t),r=r||{},r.logMessageContent=r.logMessageContent===void 0?!1:r.logMessageContent,typeof r.withCredentials=="boolean"||r.withCredentials===void 0)r.withCredentials=r.withCredentials===void 0?!0:r.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");r.timeout=r.timeout===void 0?100*1e3:r.timeout;let n=null,o=null;if(Dt.isNode&&typeof require<"u"){const s=typeof __webpack_require__=="function"?__non_webpack_require__:require;n=s("ws"),o=s("eventsource")}!Dt.isNode&&typeof WebSocket<"u"&&!r.WebSocket?r.WebSocket=WebSocket:Dt.isNode&&!r.WebSocket&&n&&(r.WebSocket=n),!Dt.isNode&&typeof EventSource<"u"&&!r.EventSource?r.EventSource=EventSource:Dt.isNode&&!r.EventSource&&typeof o<"u"&&(r.EventSource=o),this._httpClient=new dx(r.httpClient||new rx(this._logger),r.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=r,this.onreceive=null,this.onclose=null}async start(t){if(t=t||Jt.Binary,Bt.isIn(t,Jt,"transferFormat"),this._logger.log(U.Debug,`Starting connection with transfer format '${Jt[t]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(t),await this._startInternalPromise,this._connectionState==="Disconnecting"){const r="Failed to start the HttpConnection before stop() was called.";return this._logger.log(U.Error,r),await this._stopPromise,Promise.reject(new Ar(r))}else if(this._connectionState!=="Connected"){const r="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(U.Error,r),Promise.reject(new Ar(r))}this._connectionStarted=!0}send(t){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Ac(this.transport)),this._sendQueue.send(t))}async stop(t){if(this._connectionState==="Disconnected")return this._logger.log(U.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(U.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(r=>{this._stopPromiseResolver=r}),await this._stopInternal(t),await this._stopPromise}async _stopInternal(t){this._stopError=t;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(r){this._logger.log(U.Error,`HttpConnection.transport.stop() threw error '${r}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(U.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(t){let r=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===Wt.WebSockets)this.transport=this._constructTransport(Wt.WebSockets),await this._startTransport(r,t);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,o=0;do{if(n=await this._getNegotiationResponse(r),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new Ar("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(r=n.url),n.accessToken){const s=n.accessToken;this._accessTokenFactory=()=>s,this._httpClient._accessToken=s,this._httpClient._accessTokenFactory=void 0}o++}while(n.url&&o<Xf);if(o===Xf&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(r,this._options.transport,n,t)}this.transport instanceof Qf&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(U.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(U.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}}async _getNegotiationResponse(t){const r={},[n,o]=Zn();r[n]=o;const s=this._resolveNegotiateUrl(t);this._logger.log(U.Debug,`Sending negotiation request: ${s}.`);try{const i=await this._httpClient.post(s,{content:"",headers:{...r,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(i.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${i.statusCode}'`));const a=JSON.parse(i.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new Yf("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(i){let a="Failed to complete negotiation with the server: "+i;return i instanceof xn&&i.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(U.Error,a),Promise.reject(new Yf(a))}}_createConnectUrl(t,r){return r?t+(t.indexOf("?")===-1?"?":"&")+`id=${r}`:t}async _createTransport(t,r,n,o){let s=this._createConnectUrl(t,n.connectionToken);if(this._isITransport(r)){this._logger.log(U.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=r,await this._startTransport(s,o),this.connectionId=n.connectionId;return}const i=[],a=n.availableTransports||[];let c=n;for(const u of a){const d=this._resolveTransportOrError(u,r,o,c?.useStatefulReconnect===!0);if(d instanceof Error)i.push(`${u.transport} failed:`),i.push(d);else if(this._isITransport(d)){if(this.transport=d,!c){try{c=await this._getNegotiationResponse(t)}catch(f){return Promise.reject(f)}s=this._createConnectUrl(t,c.connectionToken)}try{await this._startTransport(s,o),this.connectionId=c.connectionId;return}catch(f){if(this._logger.log(U.Error,`Failed to start the transport '${u.transport}': ${f}`),c=void 0,i.push(new V_(`${u.transport} failed: ${f}`,Wt[u.transport])),this._connectionState!=="Connecting"){const h="Failed to select transport before stop() was called.";return this._logger.log(U.Debug,h),Promise.reject(new Ar(h))}}}}return i.length>0?Promise.reject(new U_(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(t){switch(t){case Wt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new hx(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Wt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new px(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Wt.LongPolling:return new Qf(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${t}.`)}}_startTransport(t,r){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let o=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(t,r),await this.features.resend()}catch{o=!0}else{this._stopConnection(n);return}o&&this._stopConnection(n)}:this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(t,r)}_resolveTransportOrError(t,r,n,o){const s=Wt[t.transport];if(s==null)return this._logger.log(U.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(gx(r,s))if(t.transferFormats.map(a=>Jt[a]).indexOf(n)>=0){if(s===Wt.WebSockets&&!this._options.WebSocket||s===Wt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(U.Debug,`Skipping transport '${Wt[s]}' because it is not supported in your environment.'`),new F_(`'${Wt[s]}' is not supported in your environment.`,s);this._logger.log(U.Debug,`Selecting transport '${Wt[s]}'.`);try{return this.features.reconnect=s===Wt.WebSockets?o:void 0,this._constructTransport(s)}catch(a){return a}}else return this._logger.log(U.Debug,`Skipping transport '${Wt[s]}' because it does not support the requested transfer format '${Jt[n]}'.`),new Error(`'${Wt[s]}' does not support ${Jt[n]}.`);else return this._logger.log(U.Debug,`Skipping transport '${Wt[s]}' because it was disabled by the client.`),new W_(`'${Wt[s]}' is disabled by the client.`,s)}_isITransport(t){return t&&typeof t=="object"&&"connect"in t}_stopConnection(t){if(this._logger.log(U.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this._connectionState}.`),this.transport=void 0,t=this._stopError||t,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(U.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(U.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),t?this._logger.log(U.Error,`Connection disconnected with error '${t}'.`):this._logger.log(U.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(r=>{this._logger.log(U.Error,`TransportSendQueue.stop() threw error '${r}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(t)}catch(r){this._logger.log(U.Error,`HttpConnection.onclose(${t}) threw error '${r}'.`)}}}_resolveUrl(t){if(t.lastIndexOf("https://",0)===0||t.lastIndexOf("http://",0)===0)return t;if(!Dt.isBrowser)throw new Error(`Cannot resolve '${t}'.`);const r=window.document.createElement("a");return r.href=t,this._logger.log(U.Information,`Normalizing '${t}' to '${r.href}'.`),r.href}_resolveNegotiateUrl(t){const r=new URL(t);r.pathname.endsWith("/")?r.pathname+="negotiate":r.pathname+="/negotiate";const n=new URLSearchParams(r.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),r.search=n.toString(),r.toString()}}function gx(e,t){return!e||(t&e)!==0}class Ac{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new Ri,this._transportResult=new Ri,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new Ri),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(t){if(this._buffer.length&&typeof this._buffer[0]!=typeof t)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof t}`);this._buffer.push(t),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new Ri;const t=this._transportResult;this._transportResult=void 0;const r=typeof this._buffer[0]=="string"?this._buffer.join(""):Ac._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(r),t.resolve()}catch(n){t.reject(n)}}}static _concatBuffers(t){const r=t.map(s=>s.byteLength).reduce((s,i)=>s+i),n=new Uint8Array(r);let o=0;for(const s of t)n.set(new Uint8Array(s),o),o+=s.byteLength;return n.buffer}}class Ri{constructor(){this.promise=new Promise((t,r)=>[this._resolver,this._rejecter]=[t,r])}resolve(){this._resolver()}reject(t){this._rejecter(t)}}const vx="json";class yx{constructor(){this.name=vx,this.version=2,this.transferFormat=Jt.Text}parseMessages(t,r){if(typeof t!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!t)return[];r===null&&(r=Ro.instance);const n=fr.parse(t),o=[];for(const s of n){const i=JSON.parse(s);if(typeof i.type!="number")throw new Error("Invalid payload.");switch(i.type){case $e.Invocation:this._isInvocationMessage(i);break;case $e.StreamItem:this._isStreamItemMessage(i);break;case $e.Completion:this._isCompletionMessage(i);break;case $e.Ping:break;case $e.Close:break;case $e.Ack:this._isAckMessage(i);break;case $e.Sequence:this._isSequenceMessage(i);break;default:r.log(U.Information,"Unknown message type '"+i.type+"' ignored.");continue}o.push(i)}return o}writeMessage(t){return fr.write(JSON.stringify(t))}_isInvocationMessage(t){this._assertNotEmptyString(t.target,"Invalid payload for Invocation message."),t.invocationId!==void 0&&this._assertNotEmptyString(t.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(t){if(this._assertNotEmptyString(t.invocationId,"Invalid payload for StreamItem message."),t.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(t){if(t.result&&t.error)throw new Error("Invalid payload for Completion message.");!t.result&&t.error&&this._assertNotEmptyString(t.error,"Invalid payload for Completion message."),this._assertNotEmptyString(t.invocationId,"Invalid payload for Completion message.")}_isAckMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(t,r){if(typeof t!="string"||t==="")throw new Error(r)}}const bx={trace:U.Trace,debug:U.Debug,info:U.Information,information:U.Information,warn:U.Warning,warning:U.Warning,error:U.Error,critical:U.Critical,none:U.None};function _x(e){const t=bx[e.toLowerCase()];if(typeof t<"u")return t;throw new Error(`Unknown log level: ${e}`)}class xx{configureLogging(t){if(Bt.isRequired(t,"logging"),wx(t))this.logger=t;else if(typeof t=="string"){const r=_x(t);this.logger=new ji(r)}else this.logger=new ji(t);return this}withUrl(t,r){return Bt.isRequired(t,"url"),Bt.isNotEmpty(t,"url"),this.url=t,typeof r=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...r}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:r},this}withHubProtocol(t){return Bt.isRequired(t,"protocol"),this.protocol=t,this}withAutomaticReconnect(t){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return t?Array.isArray(t)?this.reconnectPolicy=new Kf(t):this.reconnectPolicy=t:this.reconnectPolicy=new Kf,this}withServerTimeout(t){return Bt.isRequired(t,"milliseconds"),this._serverTimeoutInMilliseconds=t,this}withKeepAliveInterval(t){return Bt.isRequired(t,"milliseconds"),this._keepAliveIntervalInMilliseconds=t,this}withStatefulReconnect(t){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=t?.bufferSize,this}build(){const t=this.httpConnectionOptions||{};if(t.logger===void 0&&(t.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const r=new mx(this.url,t);return kc.create(r,this.logger||Ro.instance,this.protocol||new yx,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function wx(e){return e.log!==void 0}var $o={},Jf;function Sx(){if(Jf)return $o;Jf=1;var e=Je();Object.defineProperty($o,"__esModule",{value:!0}),$o.default=void 0;var t=e(lt()),r=rt();return $o.default=(0,t.default)((0,r.jsx)("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V10h16zm0-13H4V5h16z"}),"CalendarTodayOutlined"),$o}var Cx=Sx();const Ex=Xe(Cx);var Lo={},ep;function Dx(){if(ep)return Lo;ep=1;var e=Je();Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.default=void 0;var t=e(lt()),r=rt();return Lo.default=(0,t.default)((0,r.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"}),"AccessTimeOutlined"),Lo}var kx=Dx();const Ax=Xe(kx);var zo={},tp;function Tx(){if(tp)return zo;tp=1;var e=Je();Object.defineProperty(zo,"__esModule",{value:!0}),zo.default=void 0;var t=e(lt()),r=rt();return zo.default=(0,t.default)((0,r.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check"),zo}var Ix=Tx();const rp=Xe(Ix);var Bo={},np;function Mx(){if(np)return Bo;np=1;var e=Je();Object.defineProperty(Bo,"__esModule",{value:!0}),Bo.default=void 0;var t=e(lt()),r=rt();return Bo.default=(0,t.default)((0,r.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),Bo}var Px=Mx();const Vr=Xe(Px);function Tc(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}function Fo(e){return(t,r)=>{const n=r?.context?String(r.context):"standalone";let o;if(n==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,a=r?.width?String(r.width):i;o=e.formattingValues[a]||e.formattingValues[i]}else{const i=e.defaultWidth,a=r?.width?String(r.width):e.defaultWidth;o=e.values[a]||e.values[i]}const s=e.argumentCallback?e.argumentCallback(t):t;return o[s]}}function Wo(e){return(t,r={})=>{const n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],s=t.match(o);if(!s)return null;const i=s[0],a=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(a)?jx(a,f=>f.test(i)):Ox(a,f=>f.test(i));let u;u=e.valueCallback?e.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;const d=t.slice(i.length);return{value:u,rest:d}}}function Ox(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function jx(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function Rx(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const o=n[0],s=t.match(e.parsePattern);if(!s)return null;let i=e.valueCallback?e.valueCallback(s[0]):s[0];i=r.valueCallback?r.valueCallback(i):i;const a=t.slice(o.length);return{value:i,rest:a}}}function Nx(e,...t){const r=cc.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}const $x={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},Lx=(e,t,r)=>{let n;const o=$x[e];return typeof o=="string"?n=o:t===1?n=o.one:n=o.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"en "+n:"hace "+n:n},zx={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},Bx={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Fx={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Wx={date:Tc({formats:zx,defaultWidth:"full"}),time:Tc({formats:Bx,defaultWidth:"full"}),dateTime:Tc({formats:Fx,defaultWidth:"full"})},Vx={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},Ux={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},Hx=(e,t,r,n)=>t.getHours()!==1?Ux[e]:Vx[e],Yx={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},qx={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Zx={narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},Gx={narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},Kx={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},Qx={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},Xx={ordinalNumber:(e,t)=>Number(e)+"º",era:Fo({values:Yx,defaultWidth:"wide"}),quarter:Fo({values:qx,defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:Fo({values:Zx,defaultWidth:"wide"}),day:Fo({values:Gx,defaultWidth:"wide"}),dayPeriod:Fo({values:Kx,defaultWidth:"wide",formattingValues:Qx,defaultFormattingWidth:"wide"})},Jx=/^(\d+)(º)?/i,ew=/\d+/i,tw={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},rw={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},nw={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},ow={any:[/1/i,/2/i,/3/i,/4/i]},sw={narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},iw={narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},aw={narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},cw={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},lw={narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},uw={any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},dw={ordinalNumber:Rx({matchPattern:Jx,parsePattern:ew,valueCallback:function(e){return parseInt(e,10)}}),era:Wo({matchPatterns:tw,defaultMatchWidth:"wide",parsePatterns:rw,defaultParseWidth:"any"}),quarter:Wo({matchPatterns:nw,defaultMatchWidth:"wide",parsePatterns:ow,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Wo({matchPatterns:sw,defaultMatchWidth:"wide",parsePatterns:iw,defaultParseWidth:"any"}),day:Wo({matchPatterns:aw,defaultMatchWidth:"wide",parsePatterns:cw,defaultParseWidth:"any"}),dayPeriod:Wo({matchPatterns:lw,defaultMatchWidth:"any",parsePatterns:uw,defaultParseWidth:"any"})},fw={code:"es",formatDistance:Lx,formatLong:Wx,formatRelative:Hx,localize:Xx,match:dw,options:{weekStartsOn:1,firstWeekContainsDate:1}},pw=({notificacion:e,onAccept:t})=>{const{mensaje:r,evento:n,tipo:o}=e,s=o==="EventoCreado"||o==="EventoModificado",i=n?.fechaInicio?new Date(n.fechaInicio):new Date,a=n?.fechaFin?new Date(n.fechaFin):null,c=u=>{const d=u.match(/^([\wáéíóúÁÉÍÓÚñÑ]+)\s+([\wáéíóúÁÉÍÓÚñÑ]+)/);return d?`${d[1][0]}${d[2][0]}`.toUpperCase():"??"};return l.jsxs(g.Box,{sx:{p:2,mb:1,bgcolor:"white",borderRadius:"4px",border:"1px solid #e0e0e0"},children:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"flex-start",mb:2},children:[l.jsx(g.Avatar,{sx:{bgcolor:"#F5A623",width:32,height:32,fontSize:"14px",mr:1.5,fontWeight:"bold"},children:c(r)}),l.jsxs(g.Box,{children:[l.jsxs(g.Typography,{sx:{fontSize:"14px",color:"#5f6368",lineHeight:1.2},children:[r.split(" te ha invitado ")[0]," te ha invitado a"]}),l.jsx(g.Typography,{sx:{fontSize:"14px",fontWeight:700,color:"#3c4043"},children:n?.titulo||"Revisión diseño proyecto"})]})]}),l.jsx(g.Divider,{sx:{mb:2,opacity:.6}}),l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mb:1.5},children:[l.jsx(Ex,{sx:{fontSize:20,color:"#5f6368",mr:2}}),l.jsx(g.Typography,{sx:{fontSize:"14px",color:"#3c4043"},children:_.format(i,"EEEE, dd 'de' MMMM",{locale:fw})})]}),l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mb:3},children:[l.jsx(Ax,{sx:{fontSize:20,color:"#5f6368",mr:2}}),l.jsxs(g.Typography,{sx:{fontSize:"14px",color:"#3c4043"},children:[_.format(i,"h:mm a")," - ",a?_.format(a,"h:mm a"):""]})]}),s&&!e?.leida&&l.jsxs(g.Box,{sx:{display:"flex",gap:1},children:[l.jsx(g.Button,{variant:"outlined",startIcon:l.jsx(rp,{}),onClick:()=>t?.(e,"CONFIRMADA"),sx:{flex:1,borderRadius:"8px",textTransform:"none",fontWeight:700,color:"#1976D2",borderColor:"#1976D2","&:hover":{bgcolor:"rgba(25, 118, 210, 0.04)",borderColor:"#115293"}},children:"Asistiré"}),l.jsx(g.Button,{variant:"outlined",startIcon:l.jsx(Vr,{}),onClick:()=>t?.(e,"RECHAZADA"),sx:{flex:1,borderRadius:"8px",textTransform:"none",fontWeight:700,color:"#D32F2F",borderColor:"#D32F2F","&:hover":{bgcolor:"rgba(211, 47, 47, 0.04)",borderColor:"#9a2121"}},children:"Rechazar"})]})]})},hw="https://qa2.crm.netcar.com.mx/hubs/invitaciones",mw=({userId:e,notifications:t,onAceppInvitacion:r})=>{const[n,o]=y.useState(t),[s,i]=y.useState(null);y.useEffect(()=>{o(t)},[t]);const a=y.useCallback(c=>{const u={notificacionID:Math.random(),titulo:"Nueva invitación a evento",mensaje:c.Descripcion,tipo:"EventoCreado",leida:!1,fechaCreacion:new Date().toISOString(),tiempoTranscurrido:"Ahora",url:`/eventos/${c.EventoID}`,iconoColor:"#E1D6FB",evento:{eventoID:c.EventoID,titulo:c.Titulo,fechaInicio:c.FechaInicio,ubicacion:"",nombreAnfitrion:""}};o(d=>[u,...d])},[]);return y.useEffect(()=>{if(!e)return;const c=new xx().withUrl(hw+`?userId=${e}`).withAutomaticReconnect().build();return c.start().then(()=>{c.on("NotificarInvitacionAEvento",a)}).catch(u=>console.error("Error SignalR:",u)),()=>{c.off("NotificarInvitacionAEvento"),c.stop()}},[e,a]),l.jsx(g.Box,{sx:{width:"100%",maxHeight:"600px",overflowY:"auto"},children:l.jsx(g.List,{disablePadding:!0,children:n.length===0?l.jsxs("div",{className:_e.emptyStateContainer,children:[l.jsx("img",{src:Hf,alt:"Todo en orden",className:_e.emptyStateImage}),l.jsx("h4",{className:_e.emptyStateTitle,children:"Todo en orden aquí"}),l.jsx("p",{className:_e.emptyStateText,children:"Por el momento no tienes invitaciones pendientes."})]}):n.map(c=>l.jsx(pw,{notificacion:c,onAccept:r}))})})},gw=({onEventClick:e,upcomingEvents:t,leads30Days:r,leads90Days:n,disID:o,usrID:s,onAddEvent:i,googleCalendars:a,outlookCalendars:c,isLoadingCalendars:u,onToggleGoogle:d,onToggleOutlook:f,notifications:h,unreadCount:v,onAceppInvitacion:m})=>{const{session:p,sessionoutlook:b}=uc(),{enqueueSnackbar:w}=ws.useSnackbar(),C=N=>{const ae=new Date,fe={start:_.startOfDay(ae),end:_.endOfDay(ae)},$={start:N.fechaInicio,end:N.fechaFin};return Hd(fe,$)?"Hoy":_.isTomorrow(N.fechaInicio)?"Mañana":new Intl.DateTimeFormat("es-ES",{day:"numeric",month:"long"}).format(N.fechaInicio)},E={};t.forEach(N=>{const ae=C(N);E[ae]||(E[ae]=[]),E[ae].push(N)});const[S,x]=y.useState(!1),W=()=>{x(!S)},D=Pi(),A=Cc(),M=async()=>{if(!p?.userEmail||!o||!s){console.error("Faltan datos (email, disID o usrID) para sincronizar eventos.");return}try{await D.syncGoogleEvents(p?.userEmail,o,s),w("Eventos sincronizados con Google Calendar con éxito.",{variant:"success"})}catch{w("Error al sincronizar eventos con Google Calendar.",{variant:"error"})}finally{}},I=async()=>{if(!b?.userEmail||!o||!s){console.error("Faltan datos (email, disID o usrID) para sincronizar eventos.");return}try{await A.syncOutlookEvents(b?.userEmail,o,s),w("Eventos sincronizados con Outlook Calendar con éxito.",{variant:"success"})}catch{w("Error al sincronizar eventos con Outlook Calendar.",{variant:"error"})}finally{}},[H,G]=y.useState("events"),F=N=>{G(N)},[Y,oe]=y.useState(!0),V=()=>{oe(N=>!N)};return l.jsxs("div",{className:_e.sidebarContainer,children:[l.jsxs("div",{className:_e.leadsSection,children:[l.jsxs("div",{className:_e.leadCard,children:[l.jsx("div",{className:_e.leadIcon,children:l.jsx("img",{src:ef})}),l.jsxs("div",{className:_e.leadText,children:[l.jsx("div",{className:_e.leadDays,children:"+30 días sin atender"}),l.jsxs("div",{className:_e.leadCount,children:[r," ",l.jsx("span",{style:{fontSize:10,fontWeight:"normal"},children:"leads"})]})]})]}),l.jsxs("div",{className:_e.leadCard,children:[l.jsx("div",{className:_e.leadIcon,children:l.jsx("img",{src:ef})}),l.jsxs("div",{className:_e.leadText,children:[l.jsx("div",{className:_e.leadDays,children:"+90 días sin atender"}),l.jsxs("div",{className:_e.leadCount,children:[n," ",l.jsx("span",{style:{fontSize:10,fontWeight:"normal"},children:"leads"})]})]})]})]}),l.jsxs("div",{className:_e.eventsSection,children:[l.jsxs("div",{className:_e.tabsContainer,children:[l.jsx("button",{className:`${_e.tabButton} ${H==="events"?_e.activeTab:""}`,onClick:()=>F("events"),children:"Eventos"}),l.jsxs("button",{className:`${_e.tabButton} ${H==="alerts"?_e.activeTab:""}`,onClick:()=>F("alerts"),children:["Alertas",v>0&&l.jsx("span",{className:_e.alertBadge,children:v>99?"99+":v})]})]}),l.jsxs("div",{className:_e.eventsContainer,children:[H==="events"&&l.jsx(l.Fragment,{children:Object.keys(E).length>0?Object.entries(E).map(([N,ae])=>l.jsxs("div",{className:`${_e.eventGroup}`,children:[l.jsxs("div",{className:_e.eventGroupDate,children:[l.jsx("img",{src:d1,width:15})," ",N]}),ae.map(fe=>{const $=De(fe.color||"#ffcc00"),Q=$.toString(),Ce=$.clone().darken(15).toString(),me=new Intl.DateTimeFormat("es-ES",{hour:"numeric",minute:"2-digit",hour12:!0});return l.jsxs("div",{className:_e.eventItem,style:{backgroundColor:Q,borderLeft:`4px solid ${Ce}`,display:"flex",alignItems:"center",padding:"10px",marginBottom:"8px",borderRadius:"4px",cursor:"pointer"},onClick:()=>e(fe),children:[l.jsxs("div",{className:_e.eventDetails,style:{flex:1},children:[l.jsx("div",{className:_e.eventTitle,style:{fontWeight:"500",fontSize:"12px",color:"#333"},children:fe.titulo.length>32?`${fe.titulo.substring(0,32)}...`:fe.titulo}),fe.nombreAnfitrion&&l.jsxs("div",{style:{display:"flex",alignItems:"center",marginTop:"4px",color:"#555"},children:[l.jsx("img",{src:tf,width:16,style:{marginRight:"6px",opacity:.7}}),l.jsx("span",{style:{fontSize:"13px"},children:fe.nombreAnfitrion})]}),l.jsx("div",{className:_e.eventTime,style:{fontSize:"12px",marginTop:"4px",opacity:.7},children:`${me.format(fe.fechaInicio).toLowerCase()} - ${me.format(fe.fechaFin).toLowerCase()}`})]}),fe.link&&l.jsx("a",{onClick:we=>we.stopPropagation(),href:fe.link,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",padding:"4px"},children:l.jsx("img",{src:f1,alt:"Video",width:20,style:{opacity:.8}})})]},fe.eventoID)})]},N)):l.jsxs("div",{className:_e.emptyStateContainer,children:[l.jsx("img",{src:Hf,alt:"Todo en orden",className:_e.emptyStateImage}),l.jsx("h4",{className:_e.emptyStateTitle,children:"Tu agenda está despejada"}),l.jsx("p",{className:_e.emptyStateText,children:"Parece que no tienes ningún evento en tu calendario. ¿Te gustaría añadir uno? "}),l.jsxs("button",{className:_e.addEventButton,onClick:i,children:[l.jsx("img",{src:Fd}),"Agregar evento"]})]})}),H==="alerts"&&l.jsx(g.Box,{children:l.jsx(mw,{userId:s,notifications:h,onAceppInvitacion:m})})]})]}),l.jsxs("div",{className:_e.calendarsSection,children:[l.jsxs("button",{onClick:W,className:_e.collapsibleHeader,children:[l.jsxs("div",{className:_e.headerTitle,children:[l.jsx("span",{style:{fontSize:"14px"},children:"Calendarios"}),l.jsx("span",{className:_e.calendarCount,children:"1"})]}),l.jsx(zb,{className:`${_e.chevronIcon} ${S?_e.collapsed:""}`})]}),l.jsxs("div",{className:`${_e.collapsibleContent} ${S?_e.hidden:""}`,children:[l.jsxs("button",{className:`${_e.calendarSelectButton} ${Y?_e.calendarSelected:""}`,onClick:V,style:{"--calendar-color":"#1976D2"},children:[l.jsx("div",{className:_e.customCheckIcon,children:l.jsx("div",{className:_e.circularCheckbox,children:l.jsx(ac,{size:16,className:_e.checkedIcon})})}),l.jsx(Lb,{size:16,className:_e.calendarIcon}),l.jsx("span",{className:_e.calendarItemText,children:"Mi calendario"})]}),b.userEmail?l.jsxs("div",{className:_e.syncButton,onClick:I,children:[l.jsx("div",{className:_e.circularCheckbox,children:l.jsx(ac,{size:16,className:_e.checkedIcon})}),l.jsx("img",{src:Uf,width:20}),l.jsx("span",{style:{fontSize:"14px"},children:"Sincronizar Outlook"})]}):l.jsx(B_,{disID:o,usrID:s}),p?.userEmail?l.jsxs("div",{className:_e.syncButton,onClick:M,children:[l.jsx("div",{className:_e.circularCheckbox,children:l.jsx(ac,{size:16,className:_e.checkedIcon})}),l.jsx("img",{src:Vf,width:18}),l.jsx("span",{style:{fontSize:"14px"},children:"Sincronizar Google"})]}):l.jsx(z_,{disID:o,usrID:s}),b?.userEmail&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:_e.currentUserCalendarTitle,style:{marginTop:"10px"},children:b?.userEmail}),u?l.jsx(g.CircularProgress,{size:24}):c.length>0?l.jsx(g.List,{dense:!0,className:_e.calendarsList,children:c.map(N=>l.jsx(g.ListItem,{secondaryAction:l.jsx(g.Checkbox,{edge:"end",onChange:()=>f(N.id),checked:N.selected||!1,sx:{color:N.backgroundColor,"&.Mui-checked":{color:N.backgroundColor}}}),disablePadding:!0,children:l.jsx(g.ListItemText,{primary:N.summary.length>25?`${N.summary.substring(0,25)}...`:N.summary,className:_e.calendarItemText})},N.id))}):l.jsx("p",{style:{fontSize:"12px"},children:"No se encontraron calendarios."})]}),p?.userEmail&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:_e.currentUserCalendarTitle,style:{marginTop:"10px"},children:p?.userEmail}),u?l.jsx(g.CircularProgress,{size:24}):a.length>0?l.jsx(g.List,{dense:!0,className:_e.calendarsList,children:a.map(N=>l.jsx(g.ListItem,{secondaryAction:l.jsx(g.Checkbox,{edge:"end",onChange:()=>d(N.id),checked:N.selected||!1,sx:{color:N.backgroundColor,"&.Mui-checked":{color:N.backgroundColor}}}),disablePadding:!0,children:l.jsx(g.ListItemText,{primary:N.summary.length>25?`${N.summary.substring(0,25)}...`:N.summary,className:_e.calendarItemText})},N.id))}):l.jsx("p",{style:{fontSize:"12px"},children:"No se encontraron calendarios."})]})]})]})]})},Cn={dayCell:"_dayCell_xweup_1",dayCellContainer:"_dayCellContainer_xweup_23",dayNumber:"_dayNumber_xweup_55",dayNumberToday:"_dayNumberToday_xweup_69",notCurrentMonth:"_notCurrentMonth_xweup_91",CurrentDay:"_CurrentDay_xweup_129",eventsList:"_eventsList_xweup_137"};var Vo={},op;function vw(){if(op)return Vo;op=1;var e=Je();Object.defineProperty(Vo,"__esModule",{value:!0}),Vo.default=void 0,o(y);var t=e(lt()),r=rt();function n(s){if(typeof WeakMap!="function")return null;var i=new WeakMap,a=new WeakMap;return(n=function(c){return c?a:i})(s)}function o(s,i){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var a=n(i);if(a&&a.has(s))return a.get(s);var c={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var f=u?Object.getOwnPropertyDescriptor(s,d):null;f&&(f.get||f.set)?Object.defineProperty(c,d,f):c[d]=s[d]}return c.default=s,a&&a.set(s,c),c}return Vo.default=(0,t.default)((0,r.jsx)("path",{d:"M12.545,10.239v3.821h5.445c-0.712,2.315-2.647,3.972-5.445,3.972c-3.332,0-6.033-2.701-6.033-6.032s2.701-6.032,6.033-6.032c1.498,0,2.866,0.549,3.921,1.453l2.814-2.814C17.503,2.988,15.139,2,12.545,2C7.021,2,2.543,6.477,2.543,12s4.478,10,10.002,10c8.396,0,10.249-7.85,9.426-11.748L12.545,10.239z"}),"Google"),Vo}var yw=vw();const bw=Xe(yw);var Uo={},sp;function _w(){if(sp)return Uo;sp=1;var e=Je();Object.defineProperty(Uo,"__esModule",{value:!0}),Uo.default=void 0;var t=e(lt()),r=rt();return Uo.default=(0,t.default)((0,r.jsx)("path",{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 14H4V8l8 5 8-5zm-8-7L4 6h16z"}),"MailOutline"),Uo}var xw=_w();const ww=Xe(xw),ip=46,Sw=22,Cw=({dayNumber:e,date:t,events:r,isToday:n,isCurrentMonth:o,onDayClick:s,onEventClick:i,onSeeMoreClick:a})=>{const c=[Cn.dayCell,o?"":Cn.notCurrentMonth,Cn.CurrentDay].join(" ").trim(),u=y.useRef(null),[d,f]=y.useState(r.length),h=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});y.useLayoutEffect(()=>{const p=()=>{if(u.current){const b=u.current.clientHeight;let w=Math.floor(b/(ip+4));if(w<r.length){const C=Math.floor((b-Sw)/(ip+4));w=Math.max(0,C)}f(w)}};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[r.length]);const v=r.slice(0,d===0?1:d),m=r.length-(d===0?1:d);return l.jsxs("div",{className:`${c} ${Cn.dayCellContainer}`,onClick:()=>s?.(t),style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},children:[l.jsx("div",{className:n?Cn.dayNumber:Cn.dayNumberToday,children:e}),l.jsxs("div",{className:Cn.eventsList,ref:u,style:{flex:1,display:"flex",flexDirection:"column",gap:"4px",padding:"0 4px 4px 4px",marginTop:"4px",overflow:"hidden"},children:[v.map(p=>{const b=p.color||"#D7EBFB",w=p.isGoogleEvent||p.isOutlookEvent;return l.jsxs(g.Box,{onClick:C=>{C.stopPropagation(),i?.(p)},sx:{backgroundColor:w?"#ffffff":p?.color,padding:"4px 8px",borderRadius:"6px",cursor:"pointer",display:"flex",flexDirection:"column",minHeight:"40px",maxHeight:"48px",position:"relative",overflow:"hidden",border:w?`1px solid ${De(b).setAlpha(.4).toRgbString()}`:"none","&:hover":{filter:"brightness(0.95)",boxShadow:"0px 2px 4px rgba(0,0,0,0.08)"}},children:[p.isGoogleEvent&&l.jsx(bw,{sx:{position:"absolute",top:4,right:4,fontSize:12,color:"#4285F4"}}),p.isOutlookEvent&&l.jsx(ww,{sx:{position:"absolute",top:4,right:4,fontSize:12,color:"#0078D4"}}),l.jsx(g.Typography,{sx:{fontSize:"10px",lineHeight:"1.1",color:"#3C4043",fontWeight:500,pr:w?2:0,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word"},children:p.titulo}),l.jsx(g.Typography,{sx:{fontSize:"9px",color:"#70757a",mt:"auto",fontWeight:400},children:`${h.format(p.fechaInicio).toLowerCase()} - ${h.format(p.fechaFin).toLowerCase()}`})]},p.eventoID)}),m>0&&l.jsxs(g.Typography,{sx:{fontSize:"11px",fontWeight:"bold",color:"#1976D2",textAlign:"left",ml:1,mt:.5,cursor:"pointer","&:hover":{textDecoration:"underline"}},onClick:p=>{p.stopPropagation(),a(r,t)},children:["+",m," más"]})]})]})},ap={weekDaysContainer:"_weekDaysContainer_5h5ol_1",weekDay:"_weekDay_5h5ol_1"},Ew=()=>{const e=["Lunes","Martes","Miércoles","Jueves","Viernes","Sábado","Domingo"];return l.jsx("div",{className:ap.weekDaysContainer,children:e.map(t=>l.jsx("div",{className:ap.weekDay,children:t},t))})},Ni={calendarGridContainer:"_calendarGridContainer_1expw_1",daysContainer:"_daysContainer_1expw_23",rows5:"_rows5_1expw_37",rows6:"_rows6_1expw_45"};function Dw(e,t){const[r,n]=Nx(e,t.start,t.end);return{start:r,end:n}}function kw(e,t){const{start:r,end:n}=Dw(t?.in,e);let o=+r>+n;const s=o?+r:+n,i=o?n:r;i.setHours(0,0,0,0);let a=1;const c=[];for(;+i<=s;)c.push(cc(r,i)),i.setDate(i.getDate()+a),i.setHours(0,0,0,0);return o?c.reverse():c}function Aw(e,t){const r=t?.weekStartsOn,n=sn(e,t?.in),o=n.getDay(),s=(o<r?-7:0)+6-(o-r);return n.setDate(n.getDate()+s),n.setHours(23,59,59,999),n}function Tw(e,t,r){const n=+sn(e,r?.in),[o,s]=[+sn(t.start,r?.in),+sn(t.end,r?.in)].sort((i,a)=>i-a);return n>=o&&n<=s}const Iw=({currentDate:e,events:t,onDayClick:r,onEventClick:n,onSeeMoreClick:o})=>{const s=_.startOfMonth(e),i=_.endOfMonth(e),a=_.startOfWeek(s,{weekStartsOn:1}),c=Aw(i,{weekStartsOn:1}),u=kw({start:a,end:c}),d={},f=u.length/7,h=`${Ni.daysContainer} ${f===5?Ni.rows5:Ni.rows6}`;return t.forEach(v=>{const m=_.format(v.fechaInicio,"yyyy-MM-dd");d[m]||(d[m]=[]),d[m].push(v)}),l.jsxs("div",{className:Ni.calendarGridContainer,children:[l.jsx(Ew,{}),l.jsx("div",{className:h,children:u.map(v=>{const m=t.filter(p=>Tw(v,{start:_.startOfDay(p.fechaInicio),end:_.endOfDay(p.fechaFin)}));return l.jsx(Cw,{dayNumber:v.getDate(),date:v,events:m,isToday:_.isToday(v),isCurrentMonth:_.isSameMonth(v,e),onDayClick:r,onEventClick:n,onSeeMoreClick:o},v.toISOString())})})]})},Ic=()=>{const{calendarApiUrl:e}=Sc(),t=async v=>{try{return(await Et.get(`${e}/api/Calendario/v1/local/ListarEventosXUsuario/${v}`)).data.map(p=>{const b=new Date(p.fechaInicio),w=new Date(p.fechaFin),C=p.solicitudRelacionada?.[0]?.nombreCliente??null;return{...p,fechaInicio:b,fechaFin:w,client:C}})}catch(m){return console.error("Error events:",m),[]}},r=async(v,m)=>{try{const p=await Et.post(`${e}/api/Calendario/v1/local/InsertarEvento/${m}`,v);return{...p.data,fechaInicio:new Date(p.data.fechaInicio),fechaFin:new Date(p.data.fechaFin)}}catch(p){throw console.log("Error creating event:",p),p}},n=async v=>{try{const m=await Et.post(`${e}/api/Calendario/v1/local/ActualizarEvento/${v.eventoID}`,v);return{eventoID:m.data.eventoID,titulo:m.data.titulo,descripcion:m.data.descripcion,fechaInicio:new Date(m.data.fechaInicio),fechaFin:new Date(m.data.fechaFin),todoElDia:m.data.todoElDia,color:m.data.color,repetir:m.data.repetir,link:m.data.link,solID:m.data.solID,disID:m.data.disID,client:m.data.client}}catch(m){throw console.log("Error updating event:",m),m}},o=async v=>{try{const m=await Et.get(`${e}/api/Calendario/v1/local/ObtenerEvento/${v}`),p=m.data[0].solicitudRelacionada?.[0]?.nombreCliente||null;return{...m.data[0],fechaInicio:m.data[0].fechaInicio,fechaFin:m.data[0].fechaFin,client:p}}catch(m){throw console.error(`Error fetching event with ID ${v}:`,m),m}},s=async v=>{try{await Et.post(`${e}/api/Calendario/v1/local/EliminarEvento/${v}`)}catch(m){throw console.log(`Error ID ${v}:`,m),m}},i=y.useCallback(async(v,m,p,b)=>{try{const w={masNombreBD:p,usrID:b,disID:m,nombreCliente:v},E=(await Et.post(`${e}/api/Calendario/v1/local/ConsultaClientesXUsuariologgeado/`,w)).data?.data;return Array.isArray(E)?E.map(S=>({clienteID:S.clienteID,solID:S.solID,marca:S?.marca,modelo:S?.modelo,nombreCliente:S?.nombreCliente})):[]}catch(w){return console.error("Error clientes:",w),[]}},[e]),a=y.useCallback(async(v,m)=>{try{const p={disID:v,usrMail:m},w=(await Et.post(`${e}/api/Calendario/v1/Consulta_UsuariosInvitados/`,p)).data?.data;return Array.isArray(w)?w.map(C=>({usrID:C.usrID,usrNombre:C.usrNombre,usrMail:C?.usrMail,disID:C?.disID})):[]}catch(p){return console.error("Error usuarios:",p),[]}},[e]),c=async(v,m,p,b,w)=>{const C={tieneConflicto:!1,usrMail:""};try{const E={disID:v,usrMail:m,startDate:p,horaInicio:b,horaFin:w};return(await Et.post(`${e}/api/Calendario/v1/local/ConsultaConflictoInvitados`,E)).data?.data}catch(E){return console.error("Error al verificar conflicto:",E),C}},u=y.useCallback(async(v,m,p,b)=>{try{const w={disID:v,usrMail:m,startDate:p,DuracionEvento:b},E=(await Et.post(`${e}/api/Calendario/v1/local/ConsultaDisponibilidadUsuario`,w)).data?.data;return Array.isArray(E)?E.map(S=>({Fecha:S.fecha,HoraInicio:S.horaInicio,HoraFin:S.horaFin})):[]}catch(w){return console.error("Error usuarios:",w),[]}},[e]),d=y.useCallback(async(v,m=!1)=>{try{const p=await Et.post(`${e}/api/Notificaciones/v1/local/ObtenerNotificacionesPorUsuarioAsync/${v}?soloNoLeidas=${m}`);return console.log("response.data",p.data),p.data}catch(p){return console.error("Error usuarios:",p),[]}},[e]);return{getEventsByUser:t,createEvent:r,updateEvent:n,getEventById:o,deleteEvent:s,getClients:i,getUsuariosInvitados:a,VerificarConflicto:c,getDisponibilidadUsuario:u,getNotificacionesXUsuario:d,UpdateStatusEvento:async(v,m,p)=>{try{const b={EventoID:v,UsuarioID:m,status:p};return(await Et.post(`${e}/api/Calendario/v1/local/ActualizarEstadoInvitacionAsync/`,b)).data}catch(b){return console.error("Error Actualizar estatus:",b),{}}},MarcarLeido:async(v,m)=>{try{return(await Et.post(`${e}/api/Notificaciones/v1/local/MarcarComoLeidaAsync/${v}?usuarioId=${m}&marcarComoLeida=true`)).data?.data}catch(p){return console.error("Error Actualizar estatus:",p),{}}}}};var Ho={},cp;function Mw(){if(cp)return Ho;cp=1;var e=Je();Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.default=void 0;var t=e(lt()),r=rt();return Ho.default=(0,t.default)([(0,r.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),(0,r.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"AccessTime"),Ho}var Pw=Mw();const Mc=Xe(Pw);var Yo=e=>e.type==="checkbox",En=e=>e instanceof Date,rr=e=>e==null;const lp=e=>typeof e=="object";var Nt=e=>!rr(e)&&!Array.isArray(e)&&lp(e)&&!En(e),up=e=>Nt(e)&&e.target?Yo(e.target)?e.target.checked:e.target.value:e,Ow=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,dp=(e,t)=>e.has(Ow(t)),jw=e=>{const t=e.constructor&&e.constructor.prototype;return Nt(t)&&t.hasOwnProperty("isPrototypeOf")},Pc=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Vt(e){let t;const r=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(Pc&&(e instanceof Blob||n))&&(r||Nt(e)))if(t=r?[]:Object.create(Object.getPrototypeOf(e)),!r&&!jw(e))t=e;else for(const o in e)e.hasOwnProperty(o)&&(t[o]=Vt(e[o]));else return e;return t}var $i=e=>/^\w*$/.test(e),$t=e=>e===void 0,Oc=e=>Array.isArray(e)?e.filter(Boolean):[],jc=e=>Oc(e.replace(/["|']|\]/g,"").split(/\.|\[/)),he=(e,t,r)=>{if(!t||!Nt(e))return r;const n=($i(t)?[t]:jc(t)).reduce((o,s)=>rr(o)?o:o[s],e);return $t(n)||n===e?$t(e[t])?r:e[t]:n},pr=e=>typeof e=="boolean",ut=(e,t,r)=>{let n=-1;const o=$i(t)?[t]:jc(t),s=o.length,i=s-1;for(;++n<s;){const a=o[n];let c=r;if(n!==i){const u=e[a];c=Nt(u)||Array.isArray(u)?u:isNaN(+o[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}};const Li={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Tr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Qr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Rc=y.createContext(null);Rc.displayName="HookFormContext";const Nc=()=>y.useContext(Rc),Rw=e=>{const{children:t,...r}=e;return y.createElement(Rc.Provider,{value:r},t)};var fp=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==Tr.all&&(t._proxyFormState[i]=!n||Tr.all),r&&(r[i]=!0),e[i]}});return o};const $c=typeof window<"u"?y.useLayoutEffect:y.useEffect;function Nw(e){const t=Nc(),{control:r=t.control,disabled:n,name:o,exact:s}=e||{},[i,a]=y.useState(r._formState),c=y.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return $c(()=>r._subscribe({name:o,formState:c.current,exact:s,callback:u=>{!n&&a({...r._formState,...u})}}),[o,n,s]),y.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),y.useMemo(()=>fp(i,r,c.current,!1),[i,r])}var Ur=e=>typeof e=="string",pp=(e,t,r,n,o)=>Ur(e)?(n&&t.watch.add(e),he(r,e,o)):Array.isArray(e)?e.map(s=>(n&&t.watch.add(s),he(r,s))):(n&&(t.watchAll=!0),r),Lc=e=>rr(e)||!lp(e);function Xr(e,t,r=new WeakSet){if(Lc(e)||Lc(t))return e===t;if(En(e)&&En(t))return e.getTime()===t.getTime();const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const i=e[s];if(!o.includes(s))return!1;if(s!=="ref"){const a=t[s];if(En(i)&&En(a)||Nt(i)&&Nt(a)||Array.isArray(i)&&Array.isArray(a)?!Xr(i,a,r):i!==a)return!1}}return!0}function hp(e){const t=Nc(),{control:r=t.control,name:n,defaultValue:o,disabled:s,exact:i,compute:a}=e||{},c=y.useRef(o),u=y.useRef(a),d=y.useRef(void 0);u.current=a;const f=y.useMemo(()=>r._getWatch(n,c.current),[r,n]),[h,v]=y.useState(u.current?u.current(f):f);return $c(()=>r._subscribe({name:n,formState:{values:!0},exact:i,callback:m=>{if(!s){const p=pp(n,r._names,m.values||r._formValues,!1,c.current);if(u.current){const b=u.current(p);Xr(b,d.current)||(v(b),d.current=b)}else v(p)}}}),[r,s,n,i]),y.useEffect(()=>r._removeUnmounted()),h}function $w(e){const t=Nc(),{name:r,disabled:n,control:o=t.control,shouldUnregister:s,defaultValue:i}=e,a=dp(o._names.array,r),c=y.useMemo(()=>he(o._formValues,r,he(o._defaultValues,r,i)),[o,r,i]),u=hp({control:o,name:r,defaultValue:c,exact:!0}),d=Nw({control:o,name:r,exact:!0}),f=y.useRef(e),h=y.useRef(o.register(r,{...e.rules,value:u,...pr(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const v=y.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!he(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!he(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!he(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!he(d.validatingFields,r)},error:{enumerable:!0,get:()=>he(d.errors,r)}}),[d,r]),m=y.useCallback(C=>h.current.onChange({target:{value:up(C),name:r},type:Li.CHANGE}),[r]),p=y.useCallback(()=>h.current.onBlur({target:{value:he(o._formValues,r),name:r},type:Li.BLUR}),[r,o._formValues]),b=y.useCallback(C=>{const E=he(o._fields,r);E&&C&&(E._f.ref={focus:()=>C.focus&&C.focus(),select:()=>C.select&&C.select(),setCustomValidity:S=>C.setCustomValidity(S),reportValidity:()=>C.reportValidity()})},[o._fields,r]),w=y.useMemo(()=>({name:r,value:u,...pr(n)||d.disabled?{disabled:d.disabled||n}:{},onChange:m,onBlur:p,ref:b}),[r,n,d.disabled,m,p,b,u]);return y.useEffect(()=>{const C=o._options.shouldUnregister||s;o.register(r,{...f.current.rules,...pr(f.current.disabled)?{disabled:f.current.disabled}:{}});const E=(S,x)=>{const W=he(o._fields,S);W&&W._f&&(W._f.mount=x)};if(E(r,!0),C){const S=Vt(he(o._options.defaultValues,r));ut(o._defaultValues,r,S),$t(he(o._formValues,r))&&ut(o._formValues,r,S)}return!a&&o.register(r),()=>{(a?C&&!o._state.action:C)?o.unregister(r):E(r,!1)}},[r,o,a,s]),y.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),y.useMemo(()=>({field:w,formState:d,fieldState:v}),[w,d,v])}const hr=e=>e.render($w(e));var zc=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},qo=e=>Array.isArray(e)?e:[e],mp=()=>{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},ir=e=>Nt(e)&&!Object.keys(e).length,Bc=e=>e.type==="file",Ir=e=>typeof e=="function",zi=e=>{if(!Pc)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},gp=e=>e.type==="select-multiple",Fc=e=>e.type==="radio",Lw=e=>Fc(e)||Yo(e),Wc=e=>zi(e)&&e.isConnected;function zw(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=$t(e)?n++:e[t[n++]];return e}function Bw(e){for(const t in e)if(e.hasOwnProperty(t)&&!$t(e[t]))return!1;return!0}function Ft(e,t){const r=Array.isArray(t)?t:$i(t)?[t]:jc(t),n=r.length===1?e:zw(e,r),o=r.length-1,s=r[o];return n&&delete n[s],o!==0&&(Nt(n)&&ir(n)||Array.isArray(n)&&Bw(n))&&Ft(e,r.slice(0,-1)),e}var vp=e=>{for(const t in e)if(Ir(e[t]))return!0;return!1};function Bi(e,t={}){const r=Array.isArray(e);if(Nt(e)||r)for(const n in e)Array.isArray(e[n])||Nt(e[n])&&!vp(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Bi(e[n],t[n])):rr(e[n])||(t[n]=!0);return t}function yp(e,t,r){const n=Array.isArray(e);if(Nt(e)||n)for(const o in e)Array.isArray(e[o])||Nt(e[o])&&!vp(e[o])?$t(t)||Lc(r[o])?r[o]=Array.isArray(e[o])?Bi(e[o],[]):{...Bi(e[o])}:yp(e[o],rr(t)?{}:t[o],r[o]):r[o]=!Xr(e[o],t[o]);return r}var Zo=(e,t)=>yp(e,t,Bi(t));const bp={value:!1,isValid:!1},_p={value:!0,isValid:!0};var xp=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!$t(e[0].attributes.value)?$t(e[0].value)||e[0].value===""?_p:{value:e[0].value,isValid:!0}:_p:bp}return bp},wp=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>$t(e)?e:t?e===""?NaN:e&&+e:r&&Ur(e)?new Date(e):n?n(e):e;const Sp={isValid:!1,value:null};var Cp=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Sp):Sp;function Ep(e){const t=e.ref;return Bc(t)?t.files:Fc(t)?Cp(e.refs).value:gp(t)?[...t.selectedOptions].map(({value:r})=>r):Yo(t)?xp(e.refs).value:wp($t(t.value)?e.ref.value:t.value,e)}var Fw=(e,t,r,n)=>{const o={};for(const s of e){const i=he(t,s);i&&ut(o,s,i._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},Fi=e=>e instanceof RegExp,Go=e=>$t(e)?e:Fi(e)?e.source:Nt(e)?Fi(e.value)?e.value.source:e.value:e,Dp=e=>({isOnSubmit:!e||e===Tr.onSubmit,isOnBlur:e===Tr.onBlur,isOnChange:e===Tr.onChange,isOnAll:e===Tr.all,isOnTouch:e===Tr.onTouched});const kp="AsyncFunction";var Ww=e=>!!e&&!!e.validate&&!!(Ir(e.validate)&&e.validate.constructor.name===kp||Nt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===kp)),Vw=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ap=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Ko=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const s=he(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!n)return!0;if(i.ref&&t(i.ref,i.name)&&!n)return!0;if(Ko(a,t))break}else if(Nt(a)&&Ko(a,t))break}}};function Tp(e,t,r){const n=he(e,r);if(n||$i(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const s=o.join("."),i=he(t,s),a=he(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(a&&a.type)return{name:s,error:a};if(a&&a.root&&a.root.type)return{name:`${s}.root`,error:a.root};o.pop()}return{name:r}}var Uw=(e,t,r,n)=>{r(e);const{name:o,...s}=e;return ir(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!n||Tr.all))},Hw=(e,t,r)=>!e||!t||e===t||qo(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),Yw=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,qw=(e,t)=>!Oc(he(e,t)).length&&Ft(e,t),Zw=(e,t,r)=>{const n=qo(he(e,r));return ut(n,"root",t[r]),ut(e,r,n),e},Wi=e=>Ur(e);function Ip(e,t,r="validate"){if(Wi(e)||Array.isArray(e)&&e.every(Wi)||pr(e)&&!e)return{type:r,message:Wi(e)?e:"",ref:t}}var Gn=e=>Nt(e)&&!Fi(e)?e:{value:e,message:""},Mp=async(e,t,r,n,o,s)=>{const{ref:i,refs:a,required:c,maxLength:u,minLength:d,min:f,max:h,pattern:v,validate:m,name:p,valueAsNumber:b,mount:w}=e._f,C=he(r,p);if(!w||t.has(p))return{};const E=a?a[0]:i,S=G=>{o&&E.reportValidity&&(E.setCustomValidity(pr(G)?"":G||""),E.reportValidity())},x={},W=Fc(i),D=Yo(i),A=W||D,M=(b||Bc(i))&&$t(i.value)&&$t(C)||zi(i)&&i.value===""||C===""||Array.isArray(C)&&!C.length,I=zc.bind(null,p,n,x),H=(G,F,Y,oe=Qr.maxLength,V=Qr.minLength)=>{const N=G?F:Y;x[p]={type:G?oe:V,message:N,ref:i,...I(G?oe:V,N)}};if(s?!Array.isArray(C)||!C.length:c&&(!A&&(M||rr(C))||pr(C)&&!C||D&&!xp(a).isValid||W&&!Cp(a).isValid)){const{value:G,message:F}=Wi(c)?{value:!!c,message:c}:Gn(c);if(G&&(x[p]={type:Qr.required,message:F,ref:E,...I(Qr.required,F)},!n))return S(F),x}if(!M&&(!rr(f)||!rr(h))){let G,F;const Y=Gn(h),oe=Gn(f);if(!rr(C)&&!isNaN(C)){const V=i.valueAsNumber||C&&+C;rr(Y.value)||(G=V>Y.value),rr(oe.value)||(F=V<oe.value)}else{const V=i.valueAsDate||new Date(C),N=$=>new Date(new Date().toDateString()+" "+$),ae=i.type=="time",fe=i.type=="week";Ur(Y.value)&&C&&(G=ae?N(C)>N(Y.value):fe?C>Y.value:V>new Date(Y.value)),Ur(oe.value)&&C&&(F=ae?N(C)<N(oe.value):fe?C<oe.value:V<new Date(oe.value))}if((G||F)&&(H(!!G,Y.message,oe.message,Qr.max,Qr.min),!n))return S(x[p].message),x}if((u||d)&&!M&&(Ur(C)||s&&Array.isArray(C))){const G=Gn(u),F=Gn(d),Y=!rr(G.value)&&C.length>+G.value,oe=!rr(F.value)&&C.length<+F.value;if((Y||oe)&&(H(Y,G.message,F.message),!n))return S(x[p].message),x}if(v&&!M&&Ur(C)){const{value:G,message:F}=Gn(v);if(Fi(G)&&!C.match(G)&&(x[p]={type:Qr.pattern,message:F,ref:i,...I(Qr.pattern,F)},!n))return S(F),x}if(m){if(Ir(m)){const G=await m(C,r),F=Ip(G,E);if(F&&(x[p]={...F,...I(Qr.validate,F.message)},!n))return S(F.message),x}else if(Nt(m)){let G={};for(const F in m){if(!ir(G)&&!n)break;const Y=Ip(await m[F](C,r),E,F);Y&&(G={...Y,...I(F,Y.message)},S(Y.message),n&&(x[p]=G))}if(!ir(G)&&(x[p]={ref:E,...G},!n))return x}}return S(!0),x};const Gw={mode:Tr.onSubmit,reValidateMode:Tr.onChange,shouldFocusError:!0};function Kw(e={}){let t={...Gw,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ir(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},o=Nt(t.defaultValues)||Nt(t.values)?Vt(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Vt(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...d};const h={array:mp(),state:mp()},v=t.criteriaMode===Tr.all,m=k=>P=>{clearTimeout(u),u=setTimeout(k,P)},p=async k=>{if(!t.disabled&&(d.isValid||f.isValid||k)){const P=t.resolver?ir((await D()).errors):await M(n,!0);P!==r.isValid&&h.state.next({isValid:P})}},b=(k,P)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((k||Array.from(a.mount)).forEach(B=>{B&&(P?ut(r.validatingFields,B,P):Ft(r.validatingFields,B))}),h.state.next({validatingFields:r.validatingFields,isValidating:!ir(r.validatingFields)}))},w=(k,P=[],B,le,se=!0,O=!0)=>{if(le&&B&&!t.disabled){if(i.action=!0,O&&Array.isArray(he(n,k))){const ne=B(he(n,k),le.argA,le.argB);se&&ut(n,k,ne)}if(O&&Array.isArray(he(r.errors,k))){const ne=B(he(r.errors,k),le.argA,le.argB);se&&ut(r.errors,k,ne),qw(r.errors,k)}if((d.touchedFields||f.touchedFields)&&O&&Array.isArray(he(r.touchedFields,k))){const ne=B(he(r.touchedFields,k),le.argA,le.argB);se&&ut(r.touchedFields,k,ne)}(d.dirtyFields||f.dirtyFields)&&(r.dirtyFields=Zo(o,s)),h.state.next({name:k,isDirty:H(k,P),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ut(s,k,P)},C=(k,P)=>{ut(r.errors,k,P),h.state.next({errors:r.errors})},E=k=>{r.errors=k,h.state.next({errors:r.errors,isValid:!1})},S=(k,P,B,le)=>{const se=he(n,k);if(se){const O=he(s,k,$t(B)?he(o,k):B);$t(O)||le&&le.defaultChecked||P?ut(s,k,P?O:Ep(se._f)):Y(k,O),i.mount&&p()}},x=(k,P,B,le,se)=>{let O=!1,ne=!1;const Se={name:k};if(!t.disabled){if(!B||le){(d.isDirty||f.isDirty)&&(ne=r.isDirty,r.isDirty=Se.isDirty=H(),O=ne!==Se.isDirty);const Oe=Xr(he(o,k),P);ne=!!he(r.dirtyFields,k),Oe?Ft(r.dirtyFields,k):ut(r.dirtyFields,k,!0),Se.dirtyFields=r.dirtyFields,O=O||(d.dirtyFields||f.dirtyFields)&&ne!==!Oe}if(B){const Oe=he(r.touchedFields,k);Oe||(ut(r.touchedFields,k,B),Se.touchedFields=r.touchedFields,O=O||(d.touchedFields||f.touchedFields)&&Oe!==B)}O&&se&&h.state.next(Se)}return O?Se:{}},W=(k,P,B,le)=>{const se=he(r.errors,k),O=(d.isValid||f.isValid)&&pr(P)&&r.isValid!==P;if(t.delayError&&B?(c=m(()=>C(k,B)),c(t.delayError)):(clearTimeout(u),c=null,B?ut(r.errors,k,B):Ft(r.errors,k)),(B?!Xr(se,B):se)||!ir(le)||O){const ne={...le,...O&&pr(P)?{isValid:P}:{},errors:r.errors,name:k};r={...r,...ne},h.state.next(ne)}},D=async k=>{b(k,!0);const P=await t.resolver(s,t.context,Fw(k||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return b(k),P},A=async k=>{const{errors:P}=await D(k);if(k)for(const B of k){const le=he(P,B);le?ut(r.errors,B,le):Ft(r.errors,B)}else r.errors=P;return P},M=async(k,P,B={valid:!0})=>{for(const le in k){const se=k[le];if(se){const{_f:O,...ne}=se;if(O){const Se=a.array.has(O.name),Oe=se._f&&Ww(se._f);Oe&&d.validatingFields&&b([le],!0);const R=await Mp(se,a.disabled,s,v,t.shouldUseNativeValidation&&!P,Se);if(Oe&&d.validatingFields&&b([le]),R[O.name]&&(B.valid=!1,P))break;!P&&(he(R,O.name)?Se?Zw(r.errors,R,O.name):ut(r.errors,O.name,R[O.name]):Ft(r.errors,O.name))}!ir(ne)&&await M(ne,P,B)}}return B.valid},I=()=>{for(const k of a.unMount){const P=he(n,k);P&&(P._f.refs?P._f.refs.every(B=>!Wc(B)):!Wc(P._f.ref))&&ce(k)}a.unMount=new Set},H=(k,P)=>!t.disabled&&(k&&P&&ut(s,k,P),!Xr($(),o)),G=(k,P,B)=>pp(k,a,{...i.mount?s:$t(P)?o:Ur(k)?{[k]:P}:P},B,P),F=k=>Oc(he(i.mount?s:o,k,t.shouldUnregister?he(o,k,[]):[])),Y=(k,P,B={})=>{const le=he(n,k);let se=P;if(le){const O=le._f;O&&(!O.disabled&&ut(s,k,wp(P,O)),se=zi(O.ref)&&rr(P)?"":P,gp(O.ref)?[...O.ref.options].forEach(ne=>ne.selected=se.includes(ne.value)):O.refs?Yo(O.ref)?O.refs.forEach(ne=>{(!ne.defaultChecked||!ne.disabled)&&(Array.isArray(se)?ne.checked=!!se.find(Se=>Se===ne.value):ne.checked=se===ne.value||!!se)}):O.refs.forEach(ne=>ne.checked=ne.value===se):Bc(O.ref)?O.ref.value="":(O.ref.value=se,O.ref.type||h.state.next({name:k,values:Vt(s)})))}(B.shouldDirty||B.shouldTouch)&&x(k,se,B.shouldTouch,B.shouldDirty,!0),B.shouldValidate&&fe(k)},oe=(k,P,B)=>{for(const le in P){if(!P.hasOwnProperty(le))return;const se=P[le],O=k+"."+le,ne=he(n,O);(a.array.has(k)||Nt(se)||ne&&!ne._f)&&!En(se)?oe(O,se,B):Y(O,se,B)}},V=(k,P,B={})=>{const le=he(n,k),se=a.array.has(k),O=Vt(P);ut(s,k,O),se?(h.array.next({name:k,values:Vt(s)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&B.shouldDirty&&h.state.next({name:k,dirtyFields:Zo(o,s),isDirty:H(k,O)})):le&&!le._f&&!rr(O)?oe(k,O,B):Y(k,O,B),Ap(k,a)&&h.state.next({...r,name:k}),h.state.next({name:i.mount?k:void 0,values:Vt(s)})},N=async k=>{i.mount=!0;const P=k.target;let B=P.name,le=!0;const se=he(n,B),O=Oe=>{le=Number.isNaN(Oe)||En(Oe)&&isNaN(Oe.getTime())||Xr(Oe,he(s,B,Oe))},ne=Dp(t.mode),Se=Dp(t.reValidateMode);if(se){let Oe,R;const te=P.type?Ep(se._f):up(k),xe=k.type===Li.BLUR||k.type===Li.FOCUS_OUT,Ge=!Vw(se._f)&&!t.resolver&&!he(r.errors,B)&&!se._f.deps||Yw(xe,he(r.touchedFields,B),r.isSubmitted,Se,ne),q=Ap(B,a,xe);ut(s,B,te),xe?(!P||!P.readOnly)&&(se._f.onBlur&&se._f.onBlur(k),c&&c(0)):se._f.onChange&&se._f.onChange(k);const ue=x(B,te,xe),Ee=!ir(ue)||q;if(!xe&&h.state.next({name:B,type:k.type,values:Vt(s)}),Ge)return(d.isValid||f.isValid)&&(t.mode==="onBlur"?xe&&p():xe||p()),Ee&&h.state.next({name:B,...q?{}:ue});if(!xe&&q&&h.state.next({...r}),t.resolver){const{errors:Te}=await D([B]);if(O(te),le){const Ve=Tp(r.errors,n,B),J=Tp(Te,n,Ve.name||B);Oe=J.error,B=J.name,R=ir(Te)}}else b([B],!0),Oe=(await Mp(se,a.disabled,s,v,t.shouldUseNativeValidation))[B],b([B]),O(te),le&&(Oe?R=!1:(d.isValid||f.isValid)&&(R=await M(n,!0)));le&&(se._f.deps&&fe(se._f.deps),W(B,R,Oe,ue))}},ae=(k,P)=>{if(he(r.errors,P)&&k.focus)return k.focus(),1},fe=async(k,P={})=>{let B,le;const se=qo(k);if(t.resolver){const O=await A($t(k)?k:se);B=ir(O),le=k?!se.some(ne=>he(O,ne)):B}else k?(le=(await Promise.all(se.map(async O=>{const ne=he(n,O);return await M(ne&&ne._f?{[O]:ne}:ne)}))).every(Boolean),!(!le&&!r.isValid)&&p()):le=B=await M(n);return h.state.next({...!Ur(k)||(d.isValid||f.isValid)&&B!==r.isValid?{}:{name:k},...t.resolver||!k?{isValid:B}:{},errors:r.errors}),P.shouldFocus&&!le&&Ko(n,ae,k?se:a.mount),le},$=k=>{const P={...i.mount?s:o};return $t(k)?P:Ur(k)?he(P,k):k.map(B=>he(P,B))},Q=(k,P)=>({invalid:!!he((P||r).errors,k),isDirty:!!he((P||r).dirtyFields,k),error:he((P||r).errors,k),isValidating:!!he(r.validatingFields,k),isTouched:!!he((P||r).touchedFields,k)}),Ce=k=>{k&&qo(k).forEach(P=>Ft(r.errors,P)),h.state.next({errors:k?r.errors:{}})},me=(k,P,B)=>{const le=(he(n,k,{_f:{}})._f||{}).ref,se=he(r.errors,k)||{},{ref:O,message:ne,type:Se,...Oe}=se;ut(r.errors,k,{...Oe,...P,ref:le}),h.state.next({name:k,errors:r.errors,isValid:!1}),B&&B.shouldFocus&&le&&le.focus&&le.focus()},we=(k,P)=>Ir(k)?h.state.subscribe({next:B=>"values"in B&&k(G(void 0,P),B)}):G(k,P,!0),ie=k=>h.state.subscribe({next:P=>{Hw(k.name,P.name,k.exact)&&Uw(P,k.formState||d,Be,k.reRenderRoot)&&k.callback({values:{...s},...r,...P,defaultValues:o})}}).unsubscribe,ee=k=>(i.mount=!0,f={...f,...k.formState},ie({...k,formState:f})),ce=(k,P={})=>{for(const B of k?qo(k):a.mount)a.mount.delete(B),a.array.delete(B),P.keepValue||(Ft(n,B),Ft(s,B)),!P.keepError&&Ft(r.errors,B),!P.keepDirty&&Ft(r.dirtyFields,B),!P.keepTouched&&Ft(r.touchedFields,B),!P.keepIsValidating&&Ft(r.validatingFields,B),!t.shouldUnregister&&!P.keepDefaultValue&&Ft(o,B);h.state.next({values:Vt(s)}),h.state.next({...r,...P.keepDirty?{isDirty:H()}:{}}),!P.keepIsValid&&p()},ge=({disabled:k,name:P})=>{(pr(k)&&i.mount||k||a.disabled.has(P))&&(k?a.disabled.add(P):a.disabled.delete(P))},de=(k,P={})=>{let B=he(n,k);const le=pr(P.disabled)||pr(t.disabled);return ut(n,k,{...B||{},_f:{...B&&B._f?B._f:{ref:{name:k}},name:k,mount:!0,...P}}),a.mount.add(k),B?ge({disabled:pr(P.disabled)?P.disabled:t.disabled,name:k}):S(k,!0,P.value),{...le?{disabled:P.disabled||t.disabled}:{},...t.progressive?{required:!!P.required,min:Go(P.min),max:Go(P.max),minLength:Go(P.minLength),maxLength:Go(P.maxLength),pattern:Go(P.pattern)}:{},name:k,onChange:N,onBlur:N,ref:se=>{if(se){de(k,P),B=he(n,k);const O=$t(se.value)&&se.querySelectorAll&&se.querySelectorAll("input,select,textarea")[0]||se,ne=Lw(O),Se=B._f.refs||[];if(ne?Se.find(Oe=>Oe===O):O===B._f.ref)return;ut(n,k,{_f:{...B._f,...ne?{refs:[...Se.filter(Wc),O,...Array.isArray(he(o,k))?[{}]:[]],ref:{type:O.type,name:k}}:{ref:O}}}),S(k,!1,void 0,O)}else B=he(n,k,{}),B._f&&(B._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(dp(a.array,k)&&i.action)&&a.unMount.add(k)}}},pe=()=>t.shouldFocusError&&Ko(n,ae,a.mount),Re=k=>{pr(k)&&(h.state.next({disabled:k}),Ko(n,(P,B)=>{const le=he(n,B);le&&(P.disabled=le._f.disabled||k,Array.isArray(le._f.refs)&&le._f.refs.forEach(se=>{se.disabled=le._f.disabled||k}))},0,!1))},j=(k,P)=>async B=>{let le;B&&(B.preventDefault&&B.preventDefault(),B.persist&&B.persist());let se=Vt(s);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:O,values:ne}=await D();r.errors=O,se=Vt(ne)}else await M(n);if(a.disabled.size)for(const O of a.disabled)Ft(se,O);if(Ft(r.errors,"root"),ir(r.errors)){h.state.next({errors:{}});try{await k(se,B)}catch(O){le=O}}else P&&await P({...r.errors},B),pe(),setTimeout(pe);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ir(r.errors)&&!le,submitCount:r.submitCount+1,errors:r.errors}),le)throw le},Fe=(k,P={})=>{he(n,k)&&($t(P.defaultValue)?V(k,Vt(he(o,k))):(V(k,P.defaultValue),ut(o,k,Vt(P.defaultValue))),P.keepTouched||Ft(r.touchedFields,k),P.keepDirty||(Ft(r.dirtyFields,k),r.isDirty=P.defaultValue?H(k,Vt(he(o,k))):H()),P.keepError||(Ft(r.errors,k),d.isValid&&p()),h.state.next({...r}))},qe=(k,P={})=>{const B=k?Vt(k):o,le=Vt(B),se=ir(k),O=se?o:le;if(P.keepDefaultValues||(o=B),!P.keepValues){if(P.keepDirtyValues){const ne=new Set([...a.mount,...Object.keys(Zo(o,s))]);for(const Se of Array.from(ne))he(r.dirtyFields,Se)?ut(O,Se,he(s,Se)):V(Se,he(O,Se))}else{if(Pc&&$t(k))for(const ne of a.mount){const Se=he(n,ne);if(Se&&Se._f){const Oe=Array.isArray(Se._f.refs)?Se._f.refs[0]:Se._f.ref;if(zi(Oe)){const R=Oe.closest("form");if(R){R.reset();break}}}}if(P.keepFieldsRef)for(const ne of a.mount)V(ne,he(O,ne));else n={}}s=t.shouldUnregister?P.keepDefaultValues?Vt(o):{}:Vt(O),h.array.next({values:{...O}}),h.state.next({values:{...O}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues,i.watch=!!t.shouldUnregister,h.state.next({submitCount:P.keepSubmitCount?r.submitCount:0,isDirty:se?!1:P.keepDirty?r.isDirty:!!(P.keepDefaultValues&&!Xr(k,o)),isSubmitted:P.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:se?{}:P.keepDirtyValues?P.keepDefaultValues&&s?Zo(o,s):r.dirtyFields:P.keepDefaultValues&&k?Zo(o,k):P.keepDirty?r.dirtyFields:{},touchedFields:P.keepTouched?r.touchedFields:{},errors:P.keepErrors?r.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Ze=(k,P)=>qe(Ir(k)?k(s):k,P),Ne=(k,P={})=>{const B=he(n,k),le=B&&B._f;if(le){const se=le.refs?le.refs[0]:le.ref;se.focus&&(se.focus(),P.shouldSelect&&Ir(se.select)&&se.select())}},Be=k=>{r={...r,...k}},ht={control:{register:de,unregister:ce,getFieldState:Q,handleSubmit:j,setError:me,_subscribe:ie,_runSchema:D,_focusError:pe,_getWatch:G,_getDirty:H,_setValid:p,_setFieldArray:w,_setDisabledField:ge,_setErrors:E,_getFieldArray:F,_reset:qe,_resetDefaultValues:()=>Ir(t.defaultValues)&&t.defaultValues().then(k=>{Ze(k,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:I,_disableForm:Re,_subjects:h,_proxyFormState:d,get _fields(){return n},get _formValues(){return s},get _state(){return i},set _state(k){i=k},get _defaultValues(){return o},get _names(){return a},set _names(k){a=k},get _formState(){return r},get _options(){return t},set _options(k){t={...t,...k}}},subscribe:ee,trigger:fe,register:de,handleSubmit:j,watch:we,setValue:V,getValues:$,reset:Ze,resetField:Fe,clearErrors:Ce,unregister:ce,setError:me,setFocus:Ne,getFieldState:Q};return{...ht,formControl:ht}}function Pp(e={}){const t=y.useRef(void 0),r=y.useRef(void 0),[n,o]=y.useState({isDirty:!1,isValidating:!1,isLoading:Ir(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Ir(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Ir(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...a}=Kw(e);t.current={...a,formState:n}}const s=t.current.control;return s._options=e,$c(()=>{const i=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),s._formState.isReady=!0,i},[s]),y.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),y.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),y.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),y.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),y.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==n.isDirty&&s._subjects.state.next({isDirty:i})}},[s,n.isDirty]),y.useEffect(()=>{e.values&&!Xr(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),r.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[s,e.values]),y.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=fp(n,s),t.current}const Op=(e,t,r)=>{if(e&&"reportValidity"in e){const n=he(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Vc=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Op(n.ref,r,e):n&&n.refs&&n.refs.forEach(o=>Op(o,r,e))}},jp=(e,t)=>{t.shouldUseNativeValidation&&Vc(e,t);const r={};for(const n in e){const o=he(t.fields,n),s=Object.assign(e[n]||{},{ref:o&&o.ref});if(Qw(t.names||Object.keys(e),n)){const i=Object.assign({},he(r,n));ut(i,"root",s),ut(r,n,i)}else ut(r,n,s)}return r},Qw=(e,t)=>{const r=Rp(t);return e.some(n=>Rp(n).match(`^${r}\\.\\d+`))};function Rp(e){return e.replace(/\]|\[/g,"")}function Z(e,t,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(e),t(a,c);for(const d in i.prototype)d in a||Object.defineProperty(a,d,{value:i.prototype[d].bind(a)});a._zod.constr=i,a._zod.def=c}const o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Kn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Np extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const $p={};function Dn(e){return $p}function Xw(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Uc(e,t){return typeof t=="bigint"?t.toString():t}function Hc(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Yc(e){return e==null}function qc(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Jw(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=r>o?r:o,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const Lp=Symbol("evaluating");function gt(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Lp)return n===void 0&&(n=Lp,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function eS(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function an(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Qn(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function zp(e){return JSON.stringify(e)}const Bp="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Vi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const tS=Hc(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Qo(e){if(Vi(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(Vi(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Fp(e){return Qo(e)?{...e}:e}const rS=new Set(["string","number","symbol"]);function Xn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cn(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Ae(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function nS(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const oS={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function sS(e,t){const r=e._zod.def,n=Qn(e._zod.def,{get shape(){const o={};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=r.shape[s])}return an(this,"shape",o),o},checks:[]});return cn(e,n)}function iS(e,t){const r=e._zod.def,n=Qn(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return an(this,"shape",o),o},checks:[]});return cn(e,n)}function aS(e,t){if(!Qo(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const o=Qn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return an(this,"shape",s),s},checks:[]});return cn(e,o)}function cS(e,t){if(!Qo(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return an(this,"shape",n),n},checks:e._zod.def.checks};return cn(e,r)}function lS(e,t){const r=Qn(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return an(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return cn(e,r)}function uS(e,t,r){const n=Qn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=e?new e({type:"optional",innerType:o[i]}):o[i])}else for(const i in o)s[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return an(this,"shape",s),s},checks:[]});return cn(t,n)}function dS(e,t,r){const n=Qn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return an(this,"shape",s),s},checks:[]});return cn(t,n)}function Jn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Wp(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ui(e){return typeof e=="string"?e:e?.message}function kn(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Ui(e.inst?._zod.def?.error?.(e))??Ui(t?.error?.(e))??Ui(r.customError?.(e))??Ui(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Zc(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Xo(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Vp=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Uc,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Gc=Z("$ZodError",Vp),Hi=Z("$ZodError",Vp,{Parent:Error});function fS(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function pS(e,t){const r=t||function(s){return s.message},n={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(e),n}const Yi=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Kn;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>kn(c,s,Dn())));throw Bp(a,o?.callee),a}return i.value},hS=Yi(Hi),qi=e=>async(t,r,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>kn(c,s,Dn())));throw Bp(a,o?.callee),a}return i.value},mS=qi(Hi),Zi=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Kn;return s.issues.length?{success:!1,error:new(e??Gc)(s.issues.map(i=>kn(i,o,Dn())))}:{success:!0,data:s.value}},gS=Zi(Hi),Gi=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>kn(i,o,Dn())))}:{success:!0,data:s.value}},vS=Gi(Hi),yS=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Yi(e)(t,r,o)},bS=e=>(t,r,n)=>Yi(e)(t,r,n),_S=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return qi(e)(t,r,o)},xS=e=>async(t,r,n)=>qi(e)(t,r,n),wS=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Zi(e)(t,r,o)},SS=e=>(t,r,n)=>Zi(e)(t,r,n),CS=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Gi(e)(t,r,o)},ES=e=>async(t,r,n)=>Gi(e)(t,r,n),DS=/^[cC][^\s-]{8,}$/,kS=/^[0-9a-z]+$/,AS=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,TS=/^[0-9a-vA-V]{20}$/,IS=/^[A-Za-z0-9]{27}$/,MS=/^[a-zA-Z0-9_-]{21}$/,PS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,OS=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Up=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,jS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,RS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function NS(){return new RegExp(RS,"u")}const $S=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,LS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,zS=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,BS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,FS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Hp=/^[A-Za-z0-9_-]*$/,WS=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,VS=/^\+(?:[0-9]){6,14}[0-9]$/,Yp="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",US=new RegExp(`^${Yp}$`);function qp(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function HS(e){return new RegExp(`^${qp(e)}$`)}function YS(e){const t=qp({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Yp}T(?:${n})$`)}const qS=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ZS=/^\d+$/,GS=/^-?\d+(?:\.\d+)?/i,KS=/true|false/i,QS=/^[^A-Z]*$/,XS=/^[^a-z]*$/,ar=Z("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Zp={number:"number",bigint:"bigint",object:"date"},Gp=Z("$ZodCheckLessThan",(e,t)=>{ar.init(e,t);const r=Zp[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Kp=Z("$ZodCheckGreaterThan",(e,t)=>{ar.init(e,t);const r=Zp[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),JS=Z("$ZodCheckMultipleOf",(e,t)=>{ar.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Jw(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),eC=Z("$ZodCheckNumberFormat",(e,t)=>{ar.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,s]=oS[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,r&&(a.pattern=ZS)}),e._zod.check=i=>{const a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}}),tC=Z("$ZodCheckMaxLength",(e,t)=>{var r;ar.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Yc(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const i=Zc(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),rC=Z("$ZodCheckMinLength",(e,t)=>{var r;ar.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Yc(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const i=Zc(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),nC=Z("$ZodCheckLengthEquals",(e,t)=>{var r;ar.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Yc(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,s=o.length;if(s===t.length)return;const i=Zc(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ki=Z("$ZodCheckStringFormat",(e,t)=>{var r,n;ar.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),oC=Z("$ZodCheckRegex",(e,t)=>{Ki.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),sC=Z("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=QS),Ki.init(e,t)}),iC=Z("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=XS),Ki.init(e,t)}),aC=Z("$ZodCheckIncludes",(e,t)=>{ar.init(e,t);const r=Xn(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),cC=Z("$ZodCheckStartsWith",(e,t)=>{ar.init(e,t);const r=new RegExp(`^${Xn(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),lC=Z("$ZodCheckEndsWith",(e,t)=>{ar.init(e,t);const r=new RegExp(`.*${Xn(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),uC=Z("$ZodCheckOverwrite",(e,t)=>{ar.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class dC{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
160
|
+
`+s):n.stack=s}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=bn(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:s}=r;n!==void 0&&Mi.assertOptions(n,{silentJSONParsing:Wr.transitional(Wr.boolean),forcedJSONParsing:Wr.transitional(Wr.boolean),clarifyTimeoutError:Wr.transitional(Wr.boolean)},!1),o!=null&&(z.isFunction(o)?r.paramsSerializer={serialize:o}:Mi.assertOptions(o,{encode:Wr.function,serialize:Wr.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Mi.assertOptions(r,{baseUrl:Wr.spelling("baseURL"),withXsrfToken:Wr.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=s&&z.merge(s.common,s[r.method]);s&&z.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),r.headers=sr.concat(i,s);const a=[];let c=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(r)===!1||(c=c&&p.synchronous,a.unshift(p.fulfilled,p.rejected))});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let d,f=0,h;if(!c){const m=[$f.bind(this),void 0];for(m.unshift(...a),m.push(...u),h=m.length,d=Promise.resolve(r);f<h;)d=d.then(m[f++],m[f++]);return d}h=a.length;let v=r;for(f=0;f<h;){const m=a[f++],p=a[f++];try{v=m(v)}catch(b){p.call(this,b);break}}try{d=$f.call(this,v)}catch(m){return Promise.reject(m)}for(f=0,h=u.length;f<h;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=bn(this.defaults,t);const r=Af(t.baseURL,t.url,t.allowAbsoluteUrls);return bf(r,t.params,t.paramsSerializer)}};z.forEach(["delete","get","head","options"],function(t){_n.prototype[t]=function(r,n){return this.request(bn(n||{},{method:t,url:r,data:(n||{}).data}))}}),z.forEach(["post","put","patch"],function(t){function r(n){return function(s,i,a){return this.request(bn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}_n.prototype[t]=r(),_n.prototype[t+"Form"]=r(!0)});let j_=class m0{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});const n=this;this.promise.then(o=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](o);n._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{n.subscribe(a),s=a}).then(o);return i.cancel=function(){n.unsubscribe(s)},i},t(function(s,i,a){n.reason||(n.reason=new qn(s,i,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new m0(function(o){t=o}),cancel:t}}};function R_(e){return function(r){return e.apply(null,r)}}function N_(e){return z.isObject(e)&&e.isAxiosError===!0}const wc={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(wc).forEach(([e,t])=>{wc[t]=e});function Bf(e){const t=new _n(e),r=nf(_n.prototype.request,t);return z.extend(r,_n.prototype,t,{allOwnKeys:!0}),z.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return Bf(bn(e,o))},r}const Rt=Bf(Oo);Rt.Axios=_n,Rt.CanceledError=qn,Rt.CancelToken=j_,Rt.isCancel=Cf,Rt.VERSION=Lf,Rt.toFormData=Ei,Rt.AxiosError=Le,Rt.Cancel=Rt.CanceledError,Rt.all=function(t){return Promise.all(t)},Rt.spread=R_,Rt.isAxiosError=N_,Rt.mergeConfig=bn,Rt.AxiosHeaders=sr,Rt.formToJSON=e=>wf(z.isHTMLForm(e)?new FormData(e):e),Rt.getAdapter=Nf.getAdapter,Rt.HttpStatusCode=wc,Rt.default=Rt;const{Axios:n5,AxiosError:o5,CanceledError:s5,isCancel:i5,CancelToken:a5,VERSION:c5,all:l5,Cancel:u5,isAxiosError:d5,spread:f5,toFormData:p5,AxiosHeaders:h5,HttpStatusCode:m5,formToJSON:g5,getAdapter:v5,mergeConfig:y5}=Rt,Ff={token:null},$_=e=>{Ff.token=e},Et=Rt.create({headers:{"Content-Type":"application/json"}});Et.interceptors.request.use(e=>{const t=Ff.token;return t&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e));const Wf=y.createContext(void 0),L_=({config:e,children:t})=>(y.useEffect(()=>{e.getToken&&$_(e.getToken)},[e.getToken]),l.jsx(Wf.Provider,{value:e,children:t})),Sc=()=>{const e=y.useContext(Wf);if(!e)throw new Error("useApiConfig debe ser usado dentro de un ApiProvider");return e},Pi=()=>{const{calendarApiUrl:e}=Sc();return{getGoogleAuthUrl:async()=>{try{const i=`${e}/api/Calendario/v1/auth-url-Google`;return(await Et.get(i)).data}catch(i){throw console.error("Error al obtener la URL de Google Auth:",i),i}},saveGoogleCredentials:async i=>{try{const a=new URLSearchParams({code:i.code,disID:String(i.disID),usrID:String(i.usrID)}).toString(),c=`${e}/api/Calendario/v1/google-auth/SaveCredential?${a}`;return(await Et.post(c,{})).data}catch(a){throw console.error("Error al guardar credenciales de Google:",a),a}},getGoogleCalendars:async(i,a)=>{try{return(await Et.get(`${e}/api/Calendario/v1/google/ObtenerTiposCalendariosGoogleAsync?usrMail=${encodeURIComponent(i)}&disID=${a}`)).data}catch(c){throw console.error("Error al obtener los calendarios de Google:",c),c}},syncGoogleEvents:async(i,a,c)=>{try{return(await Et.post(`${e}/api/Calendario/v1/google/SincronizarEnviarEventosAsync?usrMail=${encodeURIComponent(i)}&disID=${a}&UsuarioID=${c}`)).data}catch(u){throw console.error("Error al sincronizar eventos con Google Calendar:",u),u}},getGoogleEventsByMonth:async i=>{try{return(await Et.post(`${e}/api/Calendario/v1/google/ObtenerEventosGoogleAsyncXMes`,i)).data}catch(a){throw console.error("Error al obtener eventos de Google Calendar por mes:",a),a}}}},Vf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAASFBMVEVChfRHcExDhOAWaNUZfjjkTDf////6/P7b6fu61fj7wCj7vASZv/VuoPBQjvVCr19GifE0qFM4gerrRjMubcQQaucZZ9MYgTpc4mWWAAAABnRSTlP/AFtbW/eMEQaPAAAAfUlEQVR42q3Pyw4CIQyFYVDbigKOl6Pv/6a2ZBYN08TEzL9gcb6waDqkubd1TEsEWkp7Q3e9RuvOrsvV+g0Fi+jaZIKC0sECzMDCDK51C9zR9A2gPhCC6HgOoIFL/KMD1cMfl39GNxc9NVrh7jKgHAPlCGwPgSgbnDYw9vwFKv0VRfpGYZ8AAAAASUVORK5CYII=",z_=({disID:e,usrID:t})=>{const[r,n]=y.useState(null),o=Pi(),s=async()=>{localStorage.setItem("temp_auth_disID",String(e)),localStorage.setItem("temp_auth_usrID",String(t)),n(null);try{const{url:i}=await o.getGoogleAuthUrl();window.location.href=i}catch(i){n(i.message||"Fallo al iniciar sesión con Google."),localStorage.removeItem("temp_auth_disID"),localStorage.removeItem("temp_auth_usrID")}finally{}};return l.jsxs("div",{className:"flex",children:[l.jsxs("div",{className:_e.syncButton,onClick:s,children:[l.jsx("div",{className:_e.customCheckIcon,children:l.jsx("div",{className:_e.uncheckedCircle})}),l.jsx("img",{src:Vf,width:18}),l.jsx("span",{children:"Google Calendar"})]}),r&&l.jsx("p",{className:"text-red-500 mt-2",children:r})]})},Cc=()=>{const{calendarApiUrl:e}=Sc();return{getOutlookAuthUrl:async()=>{try{const i=`${e}/api/Calendario/v1/auth-url-Outlook`,a=await Et.get(i);return console.log("api",a),a.data}catch(i){throw console.error("Error al obtener la URL de Outlook Auth:",i),i}},saveOutlookCredentials:async i=>{try{const a=new URLSearchParams({code:i.code,disID:String(i.disID),usrID:String(i.usrID)}).toString(),c=`${e}/api/Calendario/v1/outlook-auth/SaveCredential?${a}`;return(await Et.post(c,{})).data}catch(a){throw console.error("Error al guardar credenciales Outlook:",a),a}},syncOutlookEvents:async(i,a,c)=>{try{return(await Et.post(`${e}/api/Calendario/v1/outlook/SincronizarEnviarEventosAsync?usrMail=${encodeURIComponent(i)}&disID=${a}&UsuarioID=${c}`)).data}catch(u){throw console.error("Error al sincronizar eventos con outlook Calendar:",u),u}},getOutlookCalendars:async(i,a)=>{try{return(await Et.get(`${e}/api/Calendario/v1/outlook/ObtenerTiposCalendariosOutlookAsync?usrMail=${encodeURIComponent(i)}&disID=${a}`)).data}catch(c){throw console.error("Error al obtener los calendarios de Google:",c),c}},getOutlookEventsByMonth:async i=>{try{return(await Et.post(`${e}/api/Calendario/v1/outlook/ObtenerEventosoutlookAsyncXMes`,i)).data}catch(a){throw console.error("Error al obtener eventos de Outlook Calendar por mes:",a),a}}}},Uf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAYCAMAAAA8nnbJAAAAflBMVEUAAAAAV34AMFoAID0ATmsAL1oATXcAZZAAIUgANmQArPAAfd0BedoAacQAZbsAkuMActcAa9QAsfMAjfMAUJL///8Ame8Aht4A6v8A2v8Atvguid0AfMIAo+wAWrYA3/+q0/MAQ38ASIjB4PeHwe4AU7JlsekAdcMAXqgApf4WoQK+AAAACnRSTlMATjUWISlCbAuE1QOT9gAAAP1JREFUKM9t0GF7QzAQwPG2xiw5JGlICWVsrX3/L7i7Gyae/l944efinpzW4ktQfPrvorIgiHaW5UHZ29Hu3Dd235uTUkJnMHGj2NKISvh/TmBdX9c1W/pz5SQOOtsFFl0lBfx8YeCH6aHJhEG89X2/2aOchnLSIC1IACWwZjFdfmnwpSeDg/kSJH0AsLPLZgBoam9jsp2p8EylLK2rjDAmb89kALzLoLUaMyx3bs6rajHlh8FnZHzN+VwVxWKI+F5jFgdnW2BsaSUxUBRYYUdXrYaDMfbxydmuEU+32tJ7+5fB7QvUwBrDCcq4Z2AirJX7udCaziUMVHI+hPQLqRAg85aAu30AAAAASUVORK5CYII=",B_=({disID:e,usrID:t})=>{const[r,n]=y.useState(null),o=Cc(),s=async()=>{localStorage.setItem("temp_auth_disID",String(e)),localStorage.setItem("temp_auth_usrID",String(t)),n(null);try{const i=await o.getOutlookAuthUrl();window.location.href=i?.authUrl}catch(i){n(i.message||"Fallo al iniciar sesión con Google."),localStorage.removeItem("temp_auth_disID"),localStorage.removeItem("temp_auth_usrID")}finally{}};return l.jsxs("div",{className:"flex",children:[l.jsxs("div",{className:_e.syncButton,onClick:s,children:[l.jsx("div",{className:_e.customCheckIcon,children:l.jsx("div",{className:_e.uncheckedCircle})}),l.jsx("img",{src:Uf,width:20}),l.jsx("span",{children:"Outlook"})]}),r&&l.jsx("p",{className:"text-red-500 mt-2",children:r})]})},Hf="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='88'%20height='67'%20fill='none'%3e%3cg%20filter='url(%23a)'%20opacity='.7'%3e%3cellipse%20cx='69.302'%20cy='60.952'%20fill='%23D9D9D9'%20rx='12.698'%20ry='2.032'/%3e%3c/g%3e%3cpath%20fill='%23D6D6D6'%20fill-rule='evenodd'%20d='M60.034%2011.99c.71.001%201.37.374%201.737.982l-1.74%201.05a270%20270%200%200%201%201.74-1.048l.002.002.002.004.007.011.02.034.063.11q.08.139.21.385c.171.327.403.795.657%201.38a24.6%2024.6%200%200%201%201.527%204.811c.817%203.964.847%209.339-2.499%2014.552a2.033%202.033%200%200%201-3.242.236l1.533-1.333-1.535%201.332v-.003l-.005-.004-.01-.012-.028-.033-.082-.1a10%2010%200%200%201-.26-.34%2014%2014%200%200%201-.798-1.221%2017.3%2017.3%200%200%201-1.828-4.469c-.986-3.873-.934-9.225%202.79-15.35l.072-.11c.38-.542%201-.867%201.667-.866m1.867%2017.26q-.02.064-.042.126.091-.276.172-.552zm-1.626-14.786.004.008z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23C2C3CC'%20d='M59.728%2035.515s-1.736-7.32%206.371-12.183c0%200%20.497%208.29-6.371%2012.183'/%3e%3cpath%20fill='%23D6D6D6'%20fill-rule='evenodd'%20d='M79.915%2011.99c.71.001%201.37.374%201.737.982l-1.74%201.05a281%20281%200%200%201%201.74-1.048l.002.002.002.004.007.011.02.034.063.11q.08.139.21.385c.171.327.402.795.657%201.38a24.6%2024.6%200%200%201%201.527%204.811c.817%203.964.847%209.339-2.5%2014.552a2.033%202.033%200%200%201-3.241.236l1.532-1.333-1.534%201.332-.001-.003-.004-.004-.011-.012-.027-.033-.082-.1a10%2010%200%200%201-.26-.34c-.211-.287-.492-.698-.799-1.221a17.3%2017.3%200%200%201-1.827-4.469c-.986-3.873-.934-9.225%202.79-15.35l.072-.11c.38-.542%201-.867%201.667-.866m2.476%209.544q.013.113.027.228-.058-.477-.135-.934z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23C2C3CC'%20fill-rule='evenodd'%20d='M72.733%2022.085c.313-.165.691-.154.996.028l-.522.871c.522-.87.521-.871.522-.87l.004.001.007.004.021.013q.027.016.072.046.091.057.25.165c.212.145.507.357.856.635.697.556%201.62%201.383%202.52%202.474%201.803%202.183%203.562%205.475%203.201%209.764a1.016%201.016%200%200%201-1.376.863h-.002l-.004-.002-.008-.002-.023-.01-.079-.033a9.79%209.79%200%200%201-1.139-.603%2012%2012%200%200%201-2.566-2.14c-1.853-2.044-3.57-5.345-3.271-10.365l.017-.131c.057-.3.249-.563.524-.708M78.04%2034.22l.11.075a11%2011%200%200%201-.394-.282zm-4.516-11.027.334.237q0%200%20.003.002a13%2013%200%200%200-.337-.24'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23C2C3CC'%20fill-rule='evenodd'%20d='M85.456%2022.461a1.017%201.017%200%200%201%201.536.81l-1.014.061%201.014-.06v.002l.001.003v.008l.001.024.004.085q.004.108.004.301c0%20.257-.007.62-.04%201.067-.064.89-.227%202.12-.618%203.482-.781%202.723-2.5%206.038-6.237%208.156a1.018%201.018%200%200%201-1.489-.65l-.002-.006-.002-.009-.005-.025a5%205%200%200%201-.065-.367%2010%2010%200%200%201-.096-.999c-.04-.837%200-2.002.316-3.331.639-2.686%202.388-5.97%206.692-8.552'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23D6D6D6'%20fill-rule='evenodd'%20d='M70.232%205.343c.71.002%201.37.374%201.737.982l-1.74%201.05c1.739-1.05%201.74-1.048%201.74-1.048l.002.002q0%20.003.003.004l.008.014.023.04.082.142q.102.18.274.505c.227.432.535%201.053.875%201.834a33%2033%200%200%201%202.036%206.417c1.09%205.284%201.122%2012.4-3.305%2019.3a2.034%202.034%200%200%201-3.242.236l1.532-1.334a223%20223%200%200%201-1.534%201.332l-.002-.002-.004-.005-.012-.013-.033-.04-.102-.124a13%2013%200%200%201-.335-.438%2019%2019%200%200%201-1.048-1.603%2023%2023%200%200%201-2.413-5.902c-1.3-5.104-1.25-12.198%203.719-20.373l.072-.11c.38-.541%201-.867%201.667-.866m1.563%2026.818v-.002l-.003-.002v-.002z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23AAABAD'%20fill-rule='evenodd'%20d='M60.61%2018.704c.315-.166.693-.155.998.027l-.523.871c.489-.815.52-.868.523-.87l.004.001.009.005.027.017a8%208%200%200%201%20.425.279c.282.192.676.476%201.145.85a23%2023%200%200%201%203.383%203.32c2.419%202.929%204.765%207.325%204.284%2013.05a1.017%201.017%200%200%201-1.376.864l.363-.948-.364.947h-.002l-.003-.002q-.005%200-.01-.003l-.03-.012-.1-.041a9%209%200%200%201-.341-.157c-.288-.139-.69-.35-1.164-.642a16%2016%200%200%201-3.42-2.852c-2.465-2.719-4.768-7.125-4.367-13.866l.017-.131c.058-.3.248-.562.523-.708m.436%201.974q.003-.237.011-.477v-.003a24%2024%200%200%200-.01.48'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23AAABAD'%20fill-rule='evenodd'%20d='M78.103%2019.143a1.016%201.016%200%200%201%201.419.871l-1.014.06%201.014-.06.001.002v.013l.002.032.004.11q.005.142.006.399c0%20.341-.01.83-.054%201.428a23.2%2023.2%200%200%201-.829%204.675c-1.05%203.655-3.348%208.076-8.335%2010.904a1.016%201.016%200%200%201-1.49-.65l.989-.233-.988.232-.001-.001-.001-.004-.002-.01-.007-.032q-.01-.038-.022-.104a9%209%200%200%201-.064-.372c-.047-.317-.1-.768-.127-1.326a16%2016%200%200%201%20.423-4.441c.85-3.574%203.18-7.967%208.96-11.433zm-8.499%2015.032c-.007.617.024%201.143.066%201.552q.032.308.065.524c.043.286.08.443.08.443-.003-.017-.23-.99-.21-2.52m.05-1.027q-.023.282-.036.546l.032-.511q.001-.018.004-.035'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23D6D6D6'%20d='M55.804%2031.519h28.238c.815%200%201.476.663%201.476%201.481v15.847c0%206.204-5.019%2011.241-11.2%2011.241h-8.79c-6.182%200-11.2-5.037-11.2-11.24V33c0-.818.66-1.481%201.476-1.481'/%3e%3cpath%20fill='%23E6E8ED'%20d='M68.15%2032.344v17.159c0%205.103%203.6%209.364%208.39%2010.361%205.122-1.034%208.978-5.574%208.978-11.018V33c0-.818-.66-1.481-1.476-1.481h-15.07a.823.823%200%200%200-.822.824z'/%3e%3cg%20filter='url(%23b)'%20opacity='.7'%3e%3cellipse%20cx='33.238'%20cy='60.952'%20fill='%23D9D9D9'%20rx='28.444'%20ry='3.048'/%3e%3c/g%3e%3cpath%20fill='%233856EC'%20d='M6.095%2017.27h54.857V53.84a6.095%206.095%200%200%201-6.095%206.095H12.19a6.095%206.095%200%200%201-6.095-6.095z'/%3e%3cpath%20fill='%23E2EDFB'%20d='M6.195%2050.145a8.127%208.127%200%200%200%208.127%208.127H37.9a6.1%206.1%200%200%200%204.309-1.785l16.98-16.973a6.1%206.1%200%200%200%201.785-4.31V9.586a6.095%206.095%200%200%200-6.095-6.095H12.29a6.095%206.095%200%200%200-6.095%206.095z'/%3e%3cpath%20fill='%233856EC'%20fill-rule='evenodd'%20d='M60.952%209.009a6.014%206.014%200%200%200-6.014-6.014H12.11a6.014%206.014%200%200%200-6.014%206.014v8.284h54.857zM17.77%2012.772a2.794%202.794%200%201%201%20.002-5.589%202.794%202.794%200%200%201-.002%205.59m15.965%200a2.794%202.794%200%201%201%20.001-5.588%202.794%202.794%200%200%201%200%205.588m16.763%200a2.794%202.794%200%201%201%20.001-5.588%202.794%202.794%200%200%201-.001%205.588'%20clip-rule='evenodd'/%3e%3crect%20width='7.982'%20height='7.982'%20x='11.783'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='23.756'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='34.931'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='46.904'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='11.783'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='23.756'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='34.931'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='46.904'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='11.783'%20y='44.702'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='23.756'%20y='44.702'%20fill='%23fff'%20rx='2.032'/%3e%3cpath%20fill='%23597EF7'%20d='M40.52%2057.687a6%206%200%200%200%201.665-1.174l17.027-17.021a6%206%200%200%200%201.313-1.973H48.646a8.127%208.127%200%200%200-8.127%208.127z'/%3e%3crect%20width='3.991'%20height='11.974'%20x='15.773'%20fill='%23D9D9D9'%20rx='1.996'/%3e%3crect%20width='3.991'%20height='11.974'%20x='31.738'%20fill='%23D9D9D9'%20rx='1.996'/%3e%3crect%20width='3.991'%20height='11.974'%20x='48.501'%20fill='%23D9D9D9'%20rx='1.996'/%3e%3cdefs%3e%3cfilter%20id='a'%20width='29.46'%20height='8.127'%20x='54.572'%20y='56.889'%20color-interpolation-filters='sRGB'%20filterUnits='userSpaceOnUse'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeGaussianBlur%20result='effect1_foregroundBlur_529_4322'%20stdDeviation='1.016'/%3e%3c/filter%3e%3cfilter%20id='b'%20width='60.952'%20height='10.159'%20x='2.762'%20y='55.873'%20color-interpolation-filters='sRGB'%20filterUnits='userSpaceOnUse'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeGaussianBlur%20result='effect1_foregroundBlur_529_4322'%20stdDeviation='1.016'/%3e%3c/filter%3e%3c/defs%3e%3c/svg%3e";class xn extends Error{constructor(t,r){const n=new.target.prototype;super(`${t}: Status code '${r}'`),this.statusCode=r,this.__proto__=n}}class Ec extends Error{constructor(t="A timeout occurred."){const r=new.target.prototype;super(t),this.__proto__=r}}class Ar extends Error{constructor(t="An abort occurred."){const r=new.target.prototype;super(t),this.__proto__=r}}class F_ extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.transport=r,this.errorType="UnsupportedTransportError",this.__proto__=n}}class W_ extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.transport=r,this.errorType="DisabledTransportError",this.__proto__=n}}class V_ extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.transport=r,this.errorType="FailedToStartTransportError",this.__proto__=n}}class Yf extends Error{constructor(t){const r=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=r}}class U_ extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.innerErrors=r,this.__proto__=n}}class qf{constructor(t,r,n){this.statusCode=t,this.statusText=r,this.content=n}}class Oi{get(t,r){return this.send({...r,method:"GET",url:t})}post(t,r){return this.send({...r,method:"POST",url:t})}delete(t,r){return this.send({...r,method:"DELETE",url:t})}getCookieString(t){return""}}var U;(function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"})(U||(U={}));class Ro{constructor(){}log(t,r){}}Ro.instance=new Ro;const H_="10.0.0";class Bt{static isRequired(t,r){if(t==null)throw new Error(`The '${r}' argument is required.`)}static isNotEmpty(t,r){if(!t||t.match(/^\s*$/))throw new Error(`The '${r}' argument should not be empty.`)}static isIn(t,r,n){if(!(t in r))throw new Error(`Unknown ${n} value: ${t}.`)}}class Dt{static get isBrowser(){return!Dt.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!Dt.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!Dt.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function No(e,t){let r="";return wn(e)?(r=`Binary data of length ${e.byteLength}`,t&&(r+=`. Content: '${Y_(e)}'`)):typeof e=="string"&&(r=`String data of length ${e.length}`,t&&(r+=`. Content: '${e}'`)),r}function Y_(e){const t=new Uint8Array(e);let r="";return t.forEach(n=>{const o=n<16?"0":"";r+=`0x${o}${n.toString(16)} `}),r.substring(0,r.length-1)}function wn(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}async function Zf(e,t,r,n,o,s){const i={},[a,c]=Zn();i[a]=c,e.log(U.Trace,`(${t} transport) sending data. ${No(o,s.logMessageContent)}.`);const u=wn(o)?"arraybuffer":"text",d=await r.post(n,{content:o,headers:{...i,...s.headers},responseType:u,timeout:s.timeout,withCredentials:s.withCredentials});e.log(U.Trace,`(${t} transport) request complete. Response status: ${d.statusCode}.`)}function q_(e){return e===void 0?new ji(U.Information):e===null?Ro.instance:e.log!==void 0?e:new ji(e)}class Z_{constructor(t,r){this._subject=t,this._observer=r}dispose(){const t=this._subject.observers.indexOf(this._observer);t>-1&&this._subject.observers.splice(t,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(r=>{})}}class ji{constructor(t){this._minLevel=t,this.out=console}log(t,r){if(t>=this._minLevel){const n=`[${new Date().toISOString()}] ${U[t]}: ${r}`;switch(t){case U.Critical:case U.Error:this.out.error(n);break;case U.Warning:this.out.warn(n);break;case U.Information:this.out.info(n);break;default:this.out.log(n);break}}}}function Zn(){let e="X-SignalR-User-Agent";return Dt.isNode&&(e="User-Agent"),[e,G_(H_,K_(),X_(),Q_())]}function G_(e,t,r,n){let o="Microsoft SignalR/";const s=e.split(".");return o+=`${s[0]}.${s[1]}`,o+=` (${e}; `,t&&t!==""?o+=`${t}; `:o+="Unknown OS; ",o+=`${r}`,n?o+=`; ${n}`:o+="; Unknown Runtime Version",o+=")",o}function K_(){if(Dt.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Q_(){if(Dt.isNode)return process.versions.node}function X_(){return Dt.isNode?"NodeJS":"Browser"}function Dc(e){return e.stack?e.stack:e.message?e.message:`${e}`}function J_(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class ex extends Oi{constructor(t){if(super(),this._logger=t,typeof fetch>"u"||Dt.isNode){const r=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(r("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=r("node-fetch"):this._fetchType=fetch,this._fetchType=r("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(J_());if(typeof AbortController>"u"){const r=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=r("abort-controller")}else this._abortControllerType=AbortController}async send(t){if(t.abortSignal&&t.abortSignal.aborted)throw new Ar;if(!t.method)throw new Error("No method defined.");if(!t.url)throw new Error("No url defined.");const r=new this._abortControllerType;let n;t.abortSignal&&(t.abortSignal.onabort=()=>{r.abort(),n=new Ar});let o=null;if(t.timeout){const c=t.timeout;o=setTimeout(()=>{r.abort(),this._logger.log(U.Warning,"Timeout from HTTP request."),n=new Ec},c)}t.content===""&&(t.content=void 0),t.content&&(t.headers=t.headers||{},wn(t.content)?t.headers["Content-Type"]="application/octet-stream":t.headers["Content-Type"]="text/plain;charset=UTF-8");let s;try{s=await this._fetchType(t.url,{body:t.content,cache:"no-cache",credentials:t.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:r.signal})}catch(c){throw n||(this._logger.log(U.Warning,`Error from HTTP request. ${c}.`),c)}finally{o&&clearTimeout(o),t.abortSignal&&(t.abortSignal.onabort=null)}if(!s.ok){const c=await Gf(s,"text");throw new xn(c||s.statusText,s.status)}const a=await Gf(s,t.responseType);return new qf(s.status,s.statusText,a)}getCookieString(t){let r="";return Dt.isNode&&this._jar&&this._jar.getCookies(t,(n,o)=>r=o.join("; ")),r}}function Gf(e,t){let r;switch(t){case"arraybuffer":r=e.arrayBuffer();break;case"text":r=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`);default:r=e.text();break}return r}class tx extends Oi{constructor(t){super(),this._logger=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new Ar):t.method?t.url?new Promise((r,n)=>{const o=new XMLHttpRequest;o.open(t.method,t.url,!0),o.withCredentials=t.withCredentials===void 0?!0:t.withCredentials,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),t.content===""&&(t.content=void 0),t.content&&(wn(t.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const s=t.headers;s&&Object.keys(s).forEach(i=>{o.setRequestHeader(i,s[i])}),t.responseType&&(o.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{o.abort(),n(new Ar)}),t.timeout&&(o.timeout=t.timeout),o.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),o.status>=200&&o.status<300?r(new qf(o.status,o.statusText,o.response||o.responseText)):n(new xn(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(U.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new xn(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(U.Warning,"Timeout from HTTP request."),n(new Ec)},o.send(t.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class rx extends Oi{constructor(t){if(super(),typeof fetch<"u"||Dt.isNode)this._httpClient=new ex(t);else if(typeof XMLHttpRequest<"u")this._httpClient=new tx(t);else throw new Error("No usable HttpClient found.")}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new Ar):t.method?t.url?this._httpClient.send(t):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(t){return this._httpClient.getCookieString(t)}}class fr{static write(t){return`${t}${fr.RecordSeparator}`}static parse(t){if(t[t.length-1]!==fr.RecordSeparator)throw new Error("Message is incomplete.");const r=t.split(fr.RecordSeparator);return r.pop(),r}}fr.RecordSeparatorCode=30,fr.RecordSeparator=String.fromCharCode(fr.RecordSeparatorCode);class nx{writeHandshakeRequest(t){return fr.write(JSON.stringify(t))}parseHandshakeResponse(t){let r,n;if(wn(t)){const a=new Uint8Array(t),c=a.indexOf(fr.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");const u=c+1;r=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,u))),n=a.byteLength>u?a.slice(u).buffer:null}else{const a=t,c=a.indexOf(fr.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");const u=c+1;r=a.substring(0,u),n=a.length>u?a.substring(u):null}const o=fr.parse(r),s=JSON.parse(o[0]);if(s.type)throw new Error("Expected a handshake response from the server.");return[n,s]}}var $e;(function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"})($e||($e={}));class ox{constructor(){this.observers=[]}next(t){for(const r of this.observers)r.next(t)}error(t){for(const r of this.observers)r.error&&r.error(t)}complete(){for(const t of this.observers)t.complete&&t.complete()}subscribe(t){return this.observers.push(t),new Z_(this,t)}}class sx{constructor(t,r,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=t,this._connection=r,this._bufferSize=n}async _send(t){const r=this._protocol.writeMessage(t);let n=Promise.resolve();if(this._isInvocationMessage(t)){this._totalMessageCount++;let o=()=>{},s=()=>{};wn(r)?this._bufferedByteCount+=r.byteLength:this._bufferedByteCount+=r.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((i,a)=>{o=i,s=a})),this._messages.push(new ix(r,this._totalMessageCount,o,s))}try{this._reconnectInProgress||await this._connection.send(r)}catch{this._disconnected()}await n}_ack(t){let r=-1;for(let n=0;n<this._messages.length;n++){const o=this._messages[n];if(o._id<=t.sequenceId)r=n,wn(o._message)?this._bufferedByteCount-=o._message.byteLength:this._bufferedByteCount-=o._message.length,o._resolver();else if(this._bufferedByteCount<this._bufferSize)o._resolver();else break}r!==-1&&(this._messages=this._messages.slice(r+1))}_shouldProcessMessage(t){if(this._waitForSequenceMessage)return t.type!==$e.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(t))return!0;const r=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,r<=this._latestReceivedSequenceId?(r===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=r,this._ackTimer(),!0)}_resetSequence(t){if(t.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=t.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const t=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:$e.Sequence,sequenceId:t}));const r=this._messages;for(const n of r)await this._connection.send(n._message);this._reconnectInProgress=!1}_dispose(t){t??(t=new Error("Unable to reconnect to server."));for(const r of this._messages)r._rejector(t)}_isInvocationMessage(t){switch(t.type){case $e.Invocation:case $e.StreamItem:case $e.Completion:case $e.StreamInvocation:case $e.CancelInvocation:return!0;case $e.Close:case $e.Sequence:case $e.Ping:case $e.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:$e.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class ix{constructor(t,r,n,o){this._message=t,this._id=r,this._resolver=n,this._rejector=o}}const ax=30*1e3,cx=15*1e3,lx=1e5;var bt;(function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"})(bt||(bt={}));class kc{static create(t,r,n,o,s,i,a){return new kc(t,r,n,o,s,i,a)}constructor(t,r,n,o,s,i,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(U.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},Bt.isRequired(t,"connection"),Bt.isRequired(r,"logger"),Bt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=s??ax,this.keepAliveIntervalInMilliseconds=i??cx,this._statefulReconnectBufferSize=a??lx,this._logger=r,this._protocol=n,this.connection=t,this._reconnectPolicy=o,this._handshakeProtocol=new nx,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=bt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:$e.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this._connectionState!==bt.Disconnected&&this._connectionState!==bt.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==bt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=bt.Connecting,this._logger.log(U.Debug,"Starting HubConnection.");try{await this._startInternal(),Dt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=bt.Connected,this._connectionStarted=!0,this._logger.log(U.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=bt.Disconnected,this._logger.log(U.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const t=new Promise((r,n)=>{this._handshakeResolver=r,this._handshakeRejecter=n});await this.connection.start(this._protocol.transferFormat);try{let r=this._protocol.version;this.connection.features.reconnect||(r=1);const n={protocol:this._protocol.name,version:r};if(this._logger.log(U.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(U.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await t,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new sx(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(r){throw this._logger.log(U.Debug,`Hub handshake failed with error '${r}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(r),r}}async stop(){const t=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await t}catch{}}_stopInternal(t){if(this._connectionState===bt.Disconnected)return this._logger.log(U.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===bt.Disconnecting)return this._logger.log(U.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const r=this._connectionState;return this._connectionState=bt.Disconnecting,this._logger.log(U.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(U.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(r===bt.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||new Ar("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(t,...r){const[n,o]=this._replaceStreamingParams(r),s=this._createStreamInvocation(t,r,o);let i;const a=new ox;return a.cancelCallback=()=>{const c=this._createCancelInvocation(s.invocationId);return delete this._callbacks[s.invocationId],i.then(()=>this._sendWithProtocol(c))},this._callbacks[s.invocationId]=(c,u)=>{if(u){a.error(u);return}else c&&(c.type===$e.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},i=this._sendWithProtocol(s).catch(c=>{a.error(c),delete this._callbacks[s.invocationId]}),this._launchStreams(n,i),a}_sendMessage(t){return this._resetKeepAliveInterval(),this.connection.send(t)}_sendWithProtocol(t){return this._messageBuffer?this._messageBuffer._send(t):this._sendMessage(this._protocol.writeMessage(t))}send(t,...r){const[n,o]=this._replaceStreamingParams(r),s=this._sendWithProtocol(this._createInvocation(t,r,!0,o));return this._launchStreams(n,s),s}invoke(t,...r){const[n,o]=this._replaceStreamingParams(r),s=this._createInvocation(t,r,!1,o);return new Promise((a,c)=>{this._callbacks[s.invocationId]=(d,f)=>{if(f){c(f);return}else d&&(d.type===$e.Completion?d.error?c(new Error(d.error)):a(d.result):c(new Error(`Unexpected message type: ${d.type}`)))};const u=this._sendWithProtocol(s).catch(d=>{c(d),delete this._callbacks[s.invocationId]});this._launchStreams(n,u)})}on(t,r){!t||!r||(t=t.toLowerCase(),this._methods[t]||(this._methods[t]=[]),this._methods[t].indexOf(r)===-1&&this._methods[t].push(r))}off(t,r){if(!t)return;t=t.toLowerCase();const n=this._methods[t];if(n)if(r){const o=n.indexOf(r);o!==-1&&(n.splice(o,1),n.length===0&&delete this._methods[t])}else delete this._methods[t]}onclose(t){t&&this._closedCallbacks.push(t)}onreconnecting(t){t&&this._reconnectingCallbacks.push(t)}onreconnected(t){t&&this._reconnectedCallbacks.push(t)}_processIncomingData(t){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(t=this._processHandshakeResponse(t),this._receivedHandshakeResponse=!0),t){const r=this._protocol.parseMessages(t,this._logger);for(const n of r)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case $e.Invocation:this._invokeClientMethod(n).catch(o=>{this._logger.log(U.Error,`Invoke client method threw error: ${Dc(o)}`)});break;case $e.StreamItem:case $e.Completion:{const o=this._callbacks[n.invocationId];if(o){n.type===$e.Completion&&delete this._callbacks[n.invocationId];try{o(n)}catch(s){this._logger.log(U.Error,`Stream callback threw error: ${Dc(s)}`)}}break}case $e.Ping:break;case $e.Close:{this._logger.log(U.Information,"Close message received from server.");const o=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(o):this._stopPromise=this._stopInternal(o);break}case $e.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case $e.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(U.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(t){let r,n;try{[n,r]=this._handshakeProtocol.parseHandshakeResponse(t)}catch(o){const s="Error parsing handshake response: "+o;this._logger.log(U.Error,s);const i=new Error(s);throw this._handshakeRejecter(i),i}if(r.error){const o="Server returned handshake error: "+r.error;this._logger.log(U.Error,o);const s=new Error(o);throw this._handshakeRejecter(s),s}else this._logger.log(U.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!this.connection.features||!this.connection.features.inherentKeepAlive){this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds);let t=this._nextKeepAlive-new Date().getTime();if(t<0){this._connectionState===bt.Connected&&this._trySendPingMessage();return}this._pingServerHandle===void 0&&(t<0&&(t=0),this._pingServerHandle=setTimeout(async()=>{this._connectionState===bt.Connected&&await this._trySendPingMessage()},t))}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(t){const r=t.target.toLowerCase(),n=this._methods[r];if(!n){this._logger.log(U.Warning,`No client method with the name '${r}' found.`),t.invocationId&&(this._logger.log(U.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)));return}const o=n.slice(),s=!!t.invocationId;let i,a,c;for(const u of o)try{const d=i;i=await u.apply(this,t.arguments),s&&i&&d&&(this._logger.log(U.Error,`Multiple results provided for '${r}'. Sending error to server.`),c=this._createCompletionMessage(t.invocationId,"Client provided multiple results.",null)),a=void 0}catch(d){a=d,this._logger.log(U.Error,`A callback for the method '${r}' threw error '${d}'.`)}c?await this._sendWithProtocol(c):s?(a?c=this._createCompletionMessage(t.invocationId,`${a}`,null):i!==void 0?c=this._createCompletionMessage(t.invocationId,null,i):(this._logger.log(U.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),c=this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):i&&this._logger.log(U.Error,`Result given for '${r}' method but server is not expecting a result.`)}_connectionClosed(t){this._logger.log(U.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||t||new Ar("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(t||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===bt.Disconnecting?this._completeClose(t):this._connectionState===bt.Connected&&this._reconnectPolicy?this._reconnect(t):this._connectionState===bt.Connected&&this._completeClose(t)}_completeClose(t){if(this._connectionStarted){this._connectionState=bt.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(t??new Error("Connection closed.")),this._messageBuffer=void 0),Dt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(r=>r.apply(this,[t]))}catch(r){this._logger.log(U.Error,`An onclose callback called with error '${t}' threw error '${r}'.`)}}}async _reconnect(t){const r=Date.now();let n=0,o=t!==void 0?t:new Error("Attempting to reconnect due to a unknown error."),s=this._getNextRetryDelay(n,0,o);if(s===null){this._logger.log(U.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(t);return}if(this._connectionState=bt.Reconnecting,t?this._logger.log(U.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(U.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(i=>i.apply(this,[t]))}catch(i){this._logger.log(U.Error,`An onreconnecting callback called with error '${t}' threw error '${i}'.`)}if(this._connectionState!==bt.Reconnecting){this._logger.log(U.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;s!==null;){if(this._logger.log(U.Information,`Reconnect attempt number ${n+1} will start in ${s} ms.`),await new Promise(i=>{this._reconnectDelayHandle=setTimeout(i,s)}),this._reconnectDelayHandle=void 0,this._connectionState!==bt.Reconnecting){this._logger.log(U.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=bt.Connected,this._logger.log(U.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(i=>i.apply(this,[this.connection.connectionId]))}catch(i){this._logger.log(U.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${i}'.`)}return}catch(i){if(this._logger.log(U.Information,`Reconnect attempt failed because of error '${i}'.`),this._connectionState!==bt.Reconnecting){this._logger.log(U.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===bt.Disconnecting&&this._completeClose();return}n++,o=i instanceof Error?i:new Error(i.toString()),s=this._getNextRetryDelay(n,Date.now()-r,o)}}this._logger.log(U.Information,`Reconnect retries have been exhausted after ${Date.now()-r} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(t,r,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:r,previousRetryCount:t,retryReason:n})}catch(o){return this._logger.log(U.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${r}) threw error '${o}'.`),null}}_cancelCallbacksWithError(t){const r=this._callbacks;this._callbacks={},Object.keys(r).forEach(n=>{const o=r[n];try{o(null,t)}catch(s){this._logger.log(U.Error,`Stream 'error' callback called with '${t}' threw error: ${Dc(s)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(t,r,n,o){if(n)return o.length!==0?{target:t,arguments:r,streamIds:o,type:$e.Invocation}:{target:t,arguments:r,type:$e.Invocation};{const s=this._invocationId;return this._invocationId++,o.length!==0?{target:t,arguments:r,invocationId:s.toString(),streamIds:o,type:$e.Invocation}:{target:t,arguments:r,invocationId:s.toString(),type:$e.Invocation}}}_launchStreams(t,r){if(t.length!==0){r||(r=Promise.resolve());for(const n in t)t[n].subscribe({complete:()=>{r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:o=>{let s;o instanceof Error?s=o.message:o&&o.toString?s=o.toString():s="Unknown error",r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,s)))},next:o=>{r=r.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,o)))}})}}_replaceStreamingParams(t){const r=[],n=[];for(let o=0;o<t.length;o++){const s=t[o];if(this._isObservable(s)){const i=this._invocationId;this._invocationId++,r[i]=s,n.push(i.toString()),t.splice(o,1)}}return[r,n]}_isObservable(t){return t&&t.subscribe&&typeof t.subscribe=="function"}_createStreamInvocation(t,r,n){const o=this._invocationId;return this._invocationId++,n.length!==0?{target:t,arguments:r,invocationId:o.toString(),streamIds:n,type:$e.StreamInvocation}:{target:t,arguments:r,invocationId:o.toString(),type:$e.StreamInvocation}}_createCancelInvocation(t){return{invocationId:t,type:$e.CancelInvocation}}_createStreamItemMessage(t,r){return{invocationId:t,item:r,type:$e.StreamItem}}_createCompletionMessage(t,r,n){return r?{error:r,invocationId:t,type:$e.Completion}:{invocationId:t,result:n,type:$e.Completion}}_createCloseMessage(){return{type:$e.Close}}async _trySendPingMessage(){try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}}const ux=[0,2e3,1e4,3e4,null];class Kf{constructor(t){this._retryDelays=t!==void 0?[...t,null]:ux}nextRetryDelayInMilliseconds(t){return this._retryDelays[t.previousRetryCount]}}class Sn{}Sn.Authorization="Authorization",Sn.Cookie="Cookie";class dx extends Oi{constructor(t,r){super(),this._innerClient=t,this._accessTokenFactory=r}async send(t){let r=!0;this._accessTokenFactory&&(!this._accessToken||t.url&&t.url.indexOf("/negotiate?")>0)&&(r=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(t);const n=await this._innerClient.send(t);return r&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(t),await this._innerClient.send(t)):n}_setAuthorizationHeader(t){t.headers||(t.headers={}),this._accessToken?t.headers[Sn.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&t.headers[Sn.Authorization]&&delete t.headers[Sn.Authorization]}getCookieString(t){return this._innerClient.getCookieString(t)}}var Wt;(function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"})(Wt||(Wt={}));var Jt;(function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"})(Jt||(Jt={}));let fx=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class Qf{get pollAborted(){return this._pollAbort.aborted}constructor(t,r,n){this._httpClient=t,this._logger=r,this._pollAbort=new fx,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(t,r){if(Bt.isRequired(t,"url"),Bt.isRequired(r,"transferFormat"),Bt.isIn(r,Jt,"transferFormat"),this._url=t,this._logger.log(U.Trace,"(LongPolling transport) Connecting."),r===Jt.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,o]=Zn(),s={[n]:o,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:s,timeout:1e5,withCredentials:this._options.withCredentials};r===Jt.Binary&&(i.responseType="arraybuffer");const a=`${t}&_=${Date.now()}`;this._logger.log(U.Trace,`(LongPolling transport) polling: ${a}.`);const c=await this._httpClient.get(a,i);c.statusCode!==200?(this._logger.log(U.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new xn(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(t,r){try{for(;this._running;)try{const n=`${t}&_=${Date.now()}`;this._logger.log(U.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,r);o.statusCode===204?(this._logger.log(U.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):o.statusCode!==200?(this._logger.log(U.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new xn(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(U.Trace,`(LongPolling transport) data received. ${No(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(U.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof Ec?this._logger.log(U.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(U.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(U.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?Zf(this._logger,"LongPolling",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(U.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(U.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const t={},[r,n]=Zn();t[r]=n;const o={headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let s;try{await this._httpClient.delete(this._url,o)}catch(i){s=i}s?s instanceof xn&&(s.statusCode===404?this._logger.log(U.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(U.Trace,`(LongPolling transport) Error sending a DELETE request: ${s}`)):this._logger.log(U.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(U.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this._closeError&&(t+=" Error: "+this._closeError),this._logger.log(U.Trace,t),this.onclose(this._closeError)}}}class px{constructor(t,r,n,o){this._httpClient=t,this._accessToken=r,this._logger=n,this._options=o,this.onreceive=null,this.onclose=null}async connect(t,r){return Bt.isRequired(t,"url"),Bt.isRequired(r,"transferFormat"),Bt.isIn(r,Jt,"transferFormat"),this._logger.log(U.Trace,"(SSE transport) Connecting."),this._url=t,this._accessToken&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,o)=>{let s=!1;if(r!==Jt.Text){o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let i;if(Dt.isBrowser||Dt.isWebWorker)i=new this._options.EventSource(t,{withCredentials:this._options.withCredentials});else{const a=this._httpClient.getCookieString(t),c={};c.Cookie=a;const[u,d]=Zn();c[u]=d,i=new this._options.EventSource(t,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{i.onmessage=a=>{if(this.onreceive)try{this._logger.log(U.Trace,`(SSE transport) data received. ${No(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},i.onerror=a=>{s?this._close():o(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},i.onopen=()=>{this._logger.log(U.Information,`SSE connected to ${this._url}`),this._eventSource=i,s=!0,n()}}catch(a){o(a);return}})}async send(t){return this._eventSource?Zf(this._logger,"SSE",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(t){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(t))}}class hx{constructor(t,r,n,o,s,i){this._logger=n,this._accessTokenFactory=r,this._logMessageContent=o,this._webSocketConstructor=s,this._httpClient=t,this.onreceive=null,this.onclose=null,this._headers=i}async connect(t,r){Bt.isRequired(t,"url"),Bt.isRequired(r,"transferFormat"),Bt.isIn(r,Jt,"transferFormat"),this._logger.log(U.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise((o,s)=>{t=t.replace(/^http/,"ws");let i;const a=this._httpClient.getCookieString(t);let c=!1;if(Dt.isNode||Dt.isReactNative){const u={},[d,f]=Zn();u[d]=f,n&&(u[Sn.Authorization]=`Bearer ${n}`),a&&(u[Sn.Cookie]=a),i=new this._webSocketConstructor(t,void 0,{headers:{...u,...this._headers}})}else n&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(t)),r===Jt.Binary&&(i.binaryType="arraybuffer"),i.onopen=u=>{this._logger.log(U.Information,`WebSocket connected to ${t}.`),this._webSocket=i,c=!0,o()},i.onerror=u=>{let d=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?d=u.error:d="There was an error with the transport",this._logger.log(U.Information,`(WebSockets transport) ${d}.`)},i.onmessage=u=>{if(this._logger.log(U.Trace,`(WebSockets transport) data received. ${No(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(d){this._close(d);return}},i.onclose=u=>{if(c)this._close(u);else{let d=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?d=u.error:d="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",s(new Error(d))}}})}send(t){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(U.Trace,`(WebSockets transport) sending data. ${No(t,this._logMessageContent)}.`),this._webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(t){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(U.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(t)&&(t.wasClean===!1||t.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)):t instanceof Error?this.onclose(t):this.onclose())}_isCloseEvent(t){return t&&typeof t.wasClean=="boolean"&&typeof t.code=="number"}}const Xf=100;class mx{constructor(t,r={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Bt.isRequired(t,"url"),this._logger=q_(r.logger),this.baseUrl=this._resolveUrl(t),r=r||{},r.logMessageContent=r.logMessageContent===void 0?!1:r.logMessageContent,typeof r.withCredentials=="boolean"||r.withCredentials===void 0)r.withCredentials=r.withCredentials===void 0?!0:r.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");r.timeout=r.timeout===void 0?100*1e3:r.timeout;let n=null,o=null;if(Dt.isNode&&typeof require<"u"){const s=typeof __webpack_require__=="function"?__non_webpack_require__:require;n=s("ws"),o=s("eventsource")}!Dt.isNode&&typeof WebSocket<"u"&&!r.WebSocket?r.WebSocket=WebSocket:Dt.isNode&&!r.WebSocket&&n&&(r.WebSocket=n),!Dt.isNode&&typeof EventSource<"u"&&!r.EventSource?r.EventSource=EventSource:Dt.isNode&&!r.EventSource&&typeof o<"u"&&(r.EventSource=o),this._httpClient=new dx(r.httpClient||new rx(this._logger),r.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=r,this.onreceive=null,this.onclose=null}async start(t){if(t=t||Jt.Binary,Bt.isIn(t,Jt,"transferFormat"),this._logger.log(U.Debug,`Starting connection with transfer format '${Jt[t]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(t),await this._startInternalPromise,this._connectionState==="Disconnecting"){const r="Failed to start the HttpConnection before stop() was called.";return this._logger.log(U.Error,r),await this._stopPromise,Promise.reject(new Ar(r))}else if(this._connectionState!=="Connected"){const r="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(U.Error,r),Promise.reject(new Ar(r))}this._connectionStarted=!0}send(t){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Ac(this.transport)),this._sendQueue.send(t))}async stop(t){if(this._connectionState==="Disconnected")return this._logger.log(U.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(U.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(r=>{this._stopPromiseResolver=r}),await this._stopInternal(t),await this._stopPromise}async _stopInternal(t){this._stopError=t;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(r){this._logger.log(U.Error,`HttpConnection.transport.stop() threw error '${r}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(U.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(t){let r=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===Wt.WebSockets)this.transport=this._constructTransport(Wt.WebSockets),await this._startTransport(r,t);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,o=0;do{if(n=await this._getNegotiationResponse(r),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new Ar("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(r=n.url),n.accessToken){const s=n.accessToken;this._accessTokenFactory=()=>s,this._httpClient._accessToken=s,this._httpClient._accessTokenFactory=void 0}o++}while(n.url&&o<Xf);if(o===Xf&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(r,this._options.transport,n,t)}this.transport instanceof Qf&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(U.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(U.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}}async _getNegotiationResponse(t){const r={},[n,o]=Zn();r[n]=o;const s=this._resolveNegotiateUrl(t);this._logger.log(U.Debug,`Sending negotiation request: ${s}.`);try{const i=await this._httpClient.post(s,{content:"",headers:{...r,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(i.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${i.statusCode}'`));const a=JSON.parse(i.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new Yf("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(i){let a="Failed to complete negotiation with the server: "+i;return i instanceof xn&&i.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(U.Error,a),Promise.reject(new Yf(a))}}_createConnectUrl(t,r){return r?t+(t.indexOf("?")===-1?"?":"&")+`id=${r}`:t}async _createTransport(t,r,n,o){let s=this._createConnectUrl(t,n.connectionToken);if(this._isITransport(r)){this._logger.log(U.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=r,await this._startTransport(s,o),this.connectionId=n.connectionId;return}const i=[],a=n.availableTransports||[];let c=n;for(const u of a){const d=this._resolveTransportOrError(u,r,o,c?.useStatefulReconnect===!0);if(d instanceof Error)i.push(`${u.transport} failed:`),i.push(d);else if(this._isITransport(d)){if(this.transport=d,!c){try{c=await this._getNegotiationResponse(t)}catch(f){return Promise.reject(f)}s=this._createConnectUrl(t,c.connectionToken)}try{await this._startTransport(s,o),this.connectionId=c.connectionId;return}catch(f){if(this._logger.log(U.Error,`Failed to start the transport '${u.transport}': ${f}`),c=void 0,i.push(new V_(`${u.transport} failed: ${f}`,Wt[u.transport])),this._connectionState!=="Connecting"){const h="Failed to select transport before stop() was called.";return this._logger.log(U.Debug,h),Promise.reject(new Ar(h))}}}}return i.length>0?Promise.reject(new U_(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(t){switch(t){case Wt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new hx(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Wt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new px(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Wt.LongPolling:return new Qf(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${t}.`)}}_startTransport(t,r){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let o=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(t,r),await this.features.resend()}catch{o=!0}else{this._stopConnection(n);return}o&&this._stopConnection(n)}:this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(t,r)}_resolveTransportOrError(t,r,n,o){const s=Wt[t.transport];if(s==null)return this._logger.log(U.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(gx(r,s))if(t.transferFormats.map(a=>Jt[a]).indexOf(n)>=0){if(s===Wt.WebSockets&&!this._options.WebSocket||s===Wt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(U.Debug,`Skipping transport '${Wt[s]}' because it is not supported in your environment.'`),new F_(`'${Wt[s]}' is not supported in your environment.`,s);this._logger.log(U.Debug,`Selecting transport '${Wt[s]}'.`);try{return this.features.reconnect=s===Wt.WebSockets?o:void 0,this._constructTransport(s)}catch(a){return a}}else return this._logger.log(U.Debug,`Skipping transport '${Wt[s]}' because it does not support the requested transfer format '${Jt[n]}'.`),new Error(`'${Wt[s]}' does not support ${Jt[n]}.`);else return this._logger.log(U.Debug,`Skipping transport '${Wt[s]}' because it was disabled by the client.`),new W_(`'${Wt[s]}' is disabled by the client.`,s)}_isITransport(t){return t&&typeof t=="object"&&"connect"in t}_stopConnection(t){if(this._logger.log(U.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this._connectionState}.`),this.transport=void 0,t=this._stopError||t,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(U.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(U.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),t?this._logger.log(U.Error,`Connection disconnected with error '${t}'.`):this._logger.log(U.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(r=>{this._logger.log(U.Error,`TransportSendQueue.stop() threw error '${r}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(t)}catch(r){this._logger.log(U.Error,`HttpConnection.onclose(${t}) threw error '${r}'.`)}}}_resolveUrl(t){if(t.lastIndexOf("https://",0)===0||t.lastIndexOf("http://",0)===0)return t;if(!Dt.isBrowser)throw new Error(`Cannot resolve '${t}'.`);const r=window.document.createElement("a");return r.href=t,this._logger.log(U.Information,`Normalizing '${t}' to '${r.href}'.`),r.href}_resolveNegotiateUrl(t){const r=new URL(t);r.pathname.endsWith("/")?r.pathname+="negotiate":r.pathname+="/negotiate";const n=new URLSearchParams(r.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),r.search=n.toString(),r.toString()}}function gx(e,t){return!e||(t&e)!==0}class Ac{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new Ri,this._transportResult=new Ri,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new Ri),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(t){if(this._buffer.length&&typeof this._buffer[0]!=typeof t)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof t}`);this._buffer.push(t),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new Ri;const t=this._transportResult;this._transportResult=void 0;const r=typeof this._buffer[0]=="string"?this._buffer.join(""):Ac._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(r),t.resolve()}catch(n){t.reject(n)}}}static _concatBuffers(t){const r=t.map(s=>s.byteLength).reduce((s,i)=>s+i),n=new Uint8Array(r);let o=0;for(const s of t)n.set(new Uint8Array(s),o),o+=s.byteLength;return n.buffer}}class Ri{constructor(){this.promise=new Promise((t,r)=>[this._resolver,this._rejecter]=[t,r])}resolve(){this._resolver()}reject(t){this._rejecter(t)}}const vx="json";class yx{constructor(){this.name=vx,this.version=2,this.transferFormat=Jt.Text}parseMessages(t,r){if(typeof t!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!t)return[];r===null&&(r=Ro.instance);const n=fr.parse(t),o=[];for(const s of n){const i=JSON.parse(s);if(typeof i.type!="number")throw new Error("Invalid payload.");switch(i.type){case $e.Invocation:this._isInvocationMessage(i);break;case $e.StreamItem:this._isStreamItemMessage(i);break;case $e.Completion:this._isCompletionMessage(i);break;case $e.Ping:break;case $e.Close:break;case $e.Ack:this._isAckMessage(i);break;case $e.Sequence:this._isSequenceMessage(i);break;default:r.log(U.Information,"Unknown message type '"+i.type+"' ignored.");continue}o.push(i)}return o}writeMessage(t){return fr.write(JSON.stringify(t))}_isInvocationMessage(t){this._assertNotEmptyString(t.target,"Invalid payload for Invocation message."),t.invocationId!==void 0&&this._assertNotEmptyString(t.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(t){if(this._assertNotEmptyString(t.invocationId,"Invalid payload for StreamItem message."),t.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(t){if(t.result&&t.error)throw new Error("Invalid payload for Completion message.");!t.result&&t.error&&this._assertNotEmptyString(t.error,"Invalid payload for Completion message."),this._assertNotEmptyString(t.invocationId,"Invalid payload for Completion message.")}_isAckMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(t,r){if(typeof t!="string"||t==="")throw new Error(r)}}const bx={trace:U.Trace,debug:U.Debug,info:U.Information,information:U.Information,warn:U.Warning,warning:U.Warning,error:U.Error,critical:U.Critical,none:U.None};function _x(e){const t=bx[e.toLowerCase()];if(typeof t<"u")return t;throw new Error(`Unknown log level: ${e}`)}class xx{configureLogging(t){if(Bt.isRequired(t,"logging"),wx(t))this.logger=t;else if(typeof t=="string"){const r=_x(t);this.logger=new ji(r)}else this.logger=new ji(t);return this}withUrl(t,r){return Bt.isRequired(t,"url"),Bt.isNotEmpty(t,"url"),this.url=t,typeof r=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...r}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:r},this}withHubProtocol(t){return Bt.isRequired(t,"protocol"),this.protocol=t,this}withAutomaticReconnect(t){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return t?Array.isArray(t)?this.reconnectPolicy=new Kf(t):this.reconnectPolicy=t:this.reconnectPolicy=new Kf,this}withServerTimeout(t){return Bt.isRequired(t,"milliseconds"),this._serverTimeoutInMilliseconds=t,this}withKeepAliveInterval(t){return Bt.isRequired(t,"milliseconds"),this._keepAliveIntervalInMilliseconds=t,this}withStatefulReconnect(t){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=t?.bufferSize,this}build(){const t=this.httpConnectionOptions||{};if(t.logger===void 0&&(t.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const r=new mx(this.url,t);return kc.create(r,this.logger||Ro.instance,this.protocol||new yx,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function wx(e){return e.log!==void 0}var $o={},Jf;function Sx(){if(Jf)return $o;Jf=1;var e=Je();Object.defineProperty($o,"__esModule",{value:!0}),$o.default=void 0;var t=e(lt()),r=rt();return $o.default=(0,t.default)((0,r.jsx)("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V10h16zm0-13H4V5h16z"}),"CalendarTodayOutlined"),$o}var Cx=Sx();const Ex=Xe(Cx);var Lo={},ep;function Dx(){if(ep)return Lo;ep=1;var e=Je();Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.default=void 0;var t=e(lt()),r=rt();return Lo.default=(0,t.default)((0,r.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"}),"AccessTimeOutlined"),Lo}var kx=Dx();const Ax=Xe(kx);var zo={},tp;function Tx(){if(tp)return zo;tp=1;var e=Je();Object.defineProperty(zo,"__esModule",{value:!0}),zo.default=void 0;var t=e(lt()),r=rt();return zo.default=(0,t.default)((0,r.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check"),zo}var Ix=Tx();const rp=Xe(Ix);var Bo={},np;function Mx(){if(np)return Bo;np=1;var e=Je();Object.defineProperty(Bo,"__esModule",{value:!0}),Bo.default=void 0;var t=e(lt()),r=rt();return Bo.default=(0,t.default)((0,r.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),Bo}var Px=Mx();const Vr=Xe(Px);function Tc(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}function Fo(e){return(t,r)=>{const n=r?.context?String(r.context):"standalone";let o;if(n==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,a=r?.width?String(r.width):i;o=e.formattingValues[a]||e.formattingValues[i]}else{const i=e.defaultWidth,a=r?.width?String(r.width):e.defaultWidth;o=e.values[a]||e.values[i]}const s=e.argumentCallback?e.argumentCallback(t):t;return o[s]}}function Wo(e){return(t,r={})=>{const n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],s=t.match(o);if(!s)return null;const i=s[0],a=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(a)?jx(a,f=>f.test(i)):Ox(a,f=>f.test(i));let u;u=e.valueCallback?e.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;const d=t.slice(i.length);return{value:u,rest:d}}}function Ox(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function jx(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function Rx(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const o=n[0],s=t.match(e.parsePattern);if(!s)return null;let i=e.valueCallback?e.valueCallback(s[0]):s[0];i=r.valueCallback?r.valueCallback(i):i;const a=t.slice(o.length);return{value:i,rest:a}}}function Nx(e,...t){const r=cc.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}const $x={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},Lx=(e,t,r)=>{let n;const o=$x[e];return typeof o=="string"?n=o:t===1?n=o.one:n=o.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"en "+n:"hace "+n:n},zx={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},Bx={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Fx={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Wx={date:Tc({formats:zx,defaultWidth:"full"}),time:Tc({formats:Bx,defaultWidth:"full"}),dateTime:Tc({formats:Fx,defaultWidth:"full"})},Vx={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},Ux={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},Hx=(e,t,r,n)=>t.getHours()!==1?Ux[e]:Vx[e],Yx={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},qx={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Zx={narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},Gx={narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},Kx={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},Qx={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},Xx={ordinalNumber:(e,t)=>Number(e)+"º",era:Fo({values:Yx,defaultWidth:"wide"}),quarter:Fo({values:qx,defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:Fo({values:Zx,defaultWidth:"wide"}),day:Fo({values:Gx,defaultWidth:"wide"}),dayPeriod:Fo({values:Kx,defaultWidth:"wide",formattingValues:Qx,defaultFormattingWidth:"wide"})},Jx=/^(\d+)(º)?/i,ew=/\d+/i,tw={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},rw={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},nw={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},ow={any:[/1/i,/2/i,/3/i,/4/i]},sw={narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},iw={narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},aw={narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},cw={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},lw={narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},uw={any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},dw={ordinalNumber:Rx({matchPattern:Jx,parsePattern:ew,valueCallback:function(e){return parseInt(e,10)}}),era:Wo({matchPatterns:tw,defaultMatchWidth:"wide",parsePatterns:rw,defaultParseWidth:"any"}),quarter:Wo({matchPatterns:nw,defaultMatchWidth:"wide",parsePatterns:ow,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Wo({matchPatterns:sw,defaultMatchWidth:"wide",parsePatterns:iw,defaultParseWidth:"any"}),day:Wo({matchPatterns:aw,defaultMatchWidth:"wide",parsePatterns:cw,defaultParseWidth:"any"}),dayPeriod:Wo({matchPatterns:lw,defaultMatchWidth:"any",parsePatterns:uw,defaultParseWidth:"any"})},fw={code:"es",formatDistance:Lx,formatLong:Wx,formatRelative:Hx,localize:Xx,match:dw,options:{weekStartsOn:1,firstWeekContainsDate:1}},pw=({notificacion:e,onAccept:t})=>{const{mensaje:r,evento:n,tipo:o}=e,s=o==="EventoCreado"||o==="EventoModificado",i=n?.fechaInicio?new Date(n.fechaInicio):new Date,a=n?.fechaFin?new Date(n.fechaFin):null,c=u=>{const d=u.match(/^([\wáéíóúÁÉÍÓÚñÑ]+)\s+([\wáéíóúÁÉÍÓÚñÑ]+)/);return d?`${d[1][0]}${d[2][0]}`.toUpperCase():"??"};return l.jsxs(g.Box,{sx:{p:2,mb:1,bgcolor:"white",borderRadius:"4px",border:"1px solid #e0e0e0"},children:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"flex-start",mb:2},children:[l.jsx(g.Avatar,{sx:{bgcolor:"#F5A623",width:32,height:32,fontSize:"14px",mr:1.5,fontWeight:"bold"},children:c(r)}),l.jsxs(g.Box,{children:[l.jsxs(g.Typography,{sx:{fontSize:"14px",color:"#5f6368",lineHeight:1.2},children:[r.split(" te ha invitado ")[0]," te ha invitado a"]}),l.jsx(g.Typography,{sx:{fontSize:"14px",fontWeight:700,color:"#3c4043"},children:n?.titulo||"Revisión diseño proyecto"})]})]}),l.jsx(g.Divider,{sx:{mb:2,opacity:.6}}),l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mb:1.5},children:[l.jsx(Ex,{sx:{fontSize:20,color:"#5f6368",mr:2}}),l.jsx(g.Typography,{sx:{fontSize:"14px",color:"#3c4043"},children:_.format(i,"EEEE, dd 'de' MMMM",{locale:fw})})]}),l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mb:3},children:[l.jsx(Ax,{sx:{fontSize:20,color:"#5f6368",mr:2}}),l.jsxs(g.Typography,{sx:{fontSize:"14px",color:"#3c4043"},children:[_.format(i,"h:mm a")," - ",a?_.format(a,"h:mm a"):""]})]}),s&&!e?.leida&&l.jsxs(g.Box,{sx:{display:"flex",gap:1},children:[l.jsx(g.Button,{variant:"outlined",startIcon:l.jsx(rp,{}),onClick:()=>t?.(e,"CONFIRMADA"),sx:{flex:1,borderRadius:"8px",textTransform:"none",fontWeight:700,color:"#1976D2",borderColor:"#1976D2","&:hover":{bgcolor:"rgba(25, 118, 210, 0.04)",borderColor:"#115293"}},children:"Asistiré"}),l.jsx(g.Button,{variant:"outlined",startIcon:l.jsx(Vr,{}),onClick:()=>t?.(e,"RECHAZADA"),sx:{flex:1,borderRadius:"8px",textTransform:"none",fontWeight:700,color:"#D32F2F",borderColor:"#D32F2F","&:hover":{bgcolor:"rgba(211, 47, 47, 0.04)",borderColor:"#9a2121"}},children:"Rechazar"})]})]})},hw="https://qa2.crm.netcar.com.mx/hubs/invitaciones",mw=({userId:e,notifications:t,onAceppInvitacion:r})=>{const[n,o]=y.useState(t),[s,i]=y.useState(null);y.useEffect(()=>{o(t)},[t]);const a=y.useCallback(c=>{const u={notificacionID:Math.random(),titulo:"Nueva invitación a evento",mensaje:c.Descripcion,tipo:"EventoCreado",leida:!1,fechaCreacion:new Date().toISOString(),tiempoTranscurrido:"Ahora",url:`/eventos/${c.EventoID}`,iconoColor:"#E1D6FB",evento:{eventoID:c.EventoID,titulo:c.Titulo,fechaInicio:c.FechaInicio,ubicacion:"",nombreAnfitrion:""}};o(d=>[u,...d])},[]);return y.useEffect(()=>{if(!e)return;const c=new xx().withUrl(hw+`?userId=${e}`).withAutomaticReconnect().build();return c.start().then(()=>{c.on("NotificarInvitacionAEvento",a)}).catch(u=>console.error("Error SignalR:",u)),()=>{c.off("NotificarInvitacionAEvento"),c.stop()}},[e,a]),l.jsx(g.Box,{sx:{width:"100%",maxHeight:"600px",overflowY:"auto"},children:l.jsx(g.List,{disablePadding:!0,children:n.length===0?l.jsxs("div",{className:_e.emptyStateContainer,children:[l.jsx("img",{src:Hf,alt:"Todo en orden",className:_e.emptyStateImage}),l.jsx("h4",{className:_e.emptyStateTitle,children:"Todo en orden aquí"}),l.jsx("p",{className:_e.emptyStateText,children:"Por el momento no tienes invitaciones pendientes."})]}):n.map(c=>l.jsx(pw,{notificacion:c,onAccept:r}))})})},gw=({onEventClick:e,upcomingEvents:t,leads30Days:r,leads90Days:n,disID:o,usrID:s,onAddEvent:i,googleCalendars:a,outlookCalendars:c,isLoadingCalendars:u,onToggleGoogle:d,onToggleOutlook:f,notifications:h,unreadCount:v,onAceppInvitacion:m})=>{const{session:p,sessionoutlook:b}=uc(),{enqueueSnackbar:w}=ws.useSnackbar(),C=N=>{const ae=new Date,fe={start:_.startOfDay(ae),end:_.endOfDay(ae)},$={start:N.fechaInicio,end:N.fechaFin};return Hd(fe,$)?"Hoy":_.isTomorrow(N.fechaInicio)?"Mañana":new Intl.DateTimeFormat("es-ES",{day:"numeric",month:"long"}).format(N.fechaInicio)},E={};t.forEach(N=>{const ae=C(N);E[ae]||(E[ae]=[]),E[ae].push(N)});const[S,x]=y.useState(!1),W=()=>{x(!S)},D=Pi(),A=Cc(),M=async()=>{if(!p?.userEmail||!o||!s){console.error("Faltan datos (email, disID o usrID) para sincronizar eventos.");return}try{await D.syncGoogleEvents(p?.userEmail,o,s),w("Eventos sincronizados con Google Calendar con éxito.",{variant:"success"})}catch{w("Error al sincronizar eventos con Google Calendar.",{variant:"error"})}finally{}},I=async()=>{if(!b?.userEmail||!o||!s){console.error("Faltan datos (email, disID o usrID) para sincronizar eventos.");return}try{await A.syncOutlookEvents(b?.userEmail,o,s),w("Eventos sincronizados con Outlook Calendar con éxito.",{variant:"success"})}catch{w("Error al sincronizar eventos con Outlook Calendar.",{variant:"error"})}finally{}},[H,G]=y.useState("events"),F=N=>{G(N)},[Y,oe]=y.useState(!0),V=()=>{oe(N=>!N)};return l.jsxs("div",{className:_e.sidebarContainer,children:[l.jsxs("div",{className:_e.leadsSection,children:[l.jsxs("div",{className:_e.leadCard,children:[l.jsx("div",{className:_e.leadIcon,children:l.jsx("img",{src:ef})}),l.jsxs("div",{className:_e.leadText,children:[l.jsx("div",{className:_e.leadDays,children:"+30 días sin atender"}),l.jsxs("div",{className:_e.leadCount,children:[r," ",l.jsx("span",{style:{fontSize:10,fontWeight:"normal"},children:"leads"})]})]})]}),l.jsxs("div",{className:_e.leadCard,children:[l.jsx("div",{className:_e.leadIcon,children:l.jsx("img",{src:ef})}),l.jsxs("div",{className:_e.leadText,children:[l.jsx("div",{className:_e.leadDays,children:"+90 días sin atender"}),l.jsxs("div",{className:_e.leadCount,children:[n," ",l.jsx("span",{style:{fontSize:10,fontWeight:"normal"},children:"leads"})]})]})]})]}),l.jsxs("div",{className:_e.eventsSection,children:[l.jsxs("div",{className:_e.tabsContainer,children:[l.jsx("button",{className:`${_e.tabButton} ${H==="events"?_e.activeTab:""}`,onClick:()=>F("events"),children:"Eventos"}),l.jsxs("button",{className:`${_e.tabButton} ${H==="alerts"?_e.activeTab:""}`,onClick:()=>F("alerts"),children:["Alertas",v>0&&l.jsx("span",{className:_e.alertBadge,children:v>99?"99+":v})]})]}),l.jsxs("div",{className:_e.eventsContainer,children:[H==="events"&&l.jsx(l.Fragment,{children:Object.keys(E).length>0?Object.entries(E).map(([N,ae])=>l.jsxs("div",{className:`${_e.eventGroup}`,children:[l.jsxs("div",{className:_e.eventGroupDate,children:[l.jsx("img",{src:d1,width:15})," ",N]}),ae.map(fe=>{const $=De(fe.color||"#ffcc00"),Q=$.toString(),Ce=$.clone().darken(15).toString(),me=new Intl.DateTimeFormat("es-ES",{hour:"numeric",minute:"2-digit",hour12:!0});return l.jsxs("div",{className:_e.eventItem,style:{backgroundColor:Q,borderLeft:`4px solid ${Ce}`,display:"flex",alignItems:"center",padding:"10px",marginBottom:"8px",borderRadius:"4px",cursor:"pointer"},onClick:()=>e(fe),children:[l.jsxs("div",{className:_e.eventDetails,style:{flex:1},children:[l.jsx("div",{className:_e.eventTitle,style:{fontWeight:"500",fontSize:"12px",color:"#333"},children:fe.titulo.length>32?`${fe.titulo.substring(0,32)}...`:fe.titulo}),fe.nombreAnfitrion&&l.jsxs("div",{style:{display:"flex",alignItems:"center",marginTop:"4px",color:"#555"},children:[l.jsx("img",{src:tf,width:16,style:{marginRight:"6px",opacity:.7}}),l.jsx("span",{style:{fontSize:"13px"},children:fe.nombreAnfitrion})]}),l.jsx("div",{className:_e.eventTime,style:{fontSize:"12px",marginTop:"4px",opacity:.7},children:`${me.format(fe.fechaInicio).toLowerCase()} - ${me.format(fe.fechaFin).toLowerCase()}`})]}),fe.link&&l.jsx("a",{onClick:we=>we.stopPropagation(),href:fe.link,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",padding:"4px"},children:l.jsx("img",{src:f1,alt:"Video",width:20,style:{opacity:.8}})})]},fe.eventoID)})]},N)):l.jsxs("div",{className:_e.emptyStateContainer,children:[l.jsx("img",{src:Hf,alt:"Todo en orden",className:_e.emptyStateImage}),l.jsx("h4",{className:_e.emptyStateTitle,children:"Tu agenda está despejada"}),l.jsx("p",{className:_e.emptyStateText,children:"Parece que no tienes ningún evento en tu calendario. ¿Te gustaría añadir uno? "}),l.jsxs("button",{className:_e.addEventButton,onClick:i,children:[l.jsx("img",{src:Fd}),"Agregar evento"]})]})}),H==="alerts"&&l.jsx(g.Box,{children:l.jsx(mw,{userId:s,notifications:h,onAceppInvitacion:m})})]})]}),l.jsxs("div",{className:_e.calendarsSection,children:[l.jsxs("button",{onClick:W,className:_e.collapsibleHeader,children:[l.jsxs("div",{className:_e.headerTitle,children:[l.jsx("span",{style:{fontSize:"14px"},children:"Calendarios"}),l.jsx("span",{className:_e.calendarCount,children:"1"})]}),l.jsx(zb,{className:`${_e.chevronIcon} ${S?_e.collapsed:""}`})]}),l.jsxs("div",{className:`${_e.collapsibleContent} ${S?_e.hidden:""}`,children:[l.jsxs("button",{className:`${_e.calendarSelectButton} ${Y?_e.calendarSelected:""}`,onClick:V,style:{"--calendar-color":"#1976D2"},children:[l.jsx("div",{className:_e.customCheckIcon,children:l.jsx("div",{className:_e.circularCheckbox,children:l.jsx(ac,{size:16,className:_e.checkedIcon})})}),l.jsx(Lb,{size:16,className:_e.calendarIcon}),l.jsx("span",{className:_e.calendarItemText,children:"Mi calendario"})]}),b.userEmail?l.jsxs("div",{className:_e.syncButton,onClick:I,children:[l.jsx("div",{className:_e.circularCheckbox,children:l.jsx(ac,{size:16,className:_e.checkedIcon})}),l.jsx("img",{src:Uf,width:20}),l.jsx("span",{style:{fontSize:"14px"},children:"Sincronizar Outlook"})]}):l.jsx(B_,{disID:o,usrID:s}),p?.userEmail?l.jsxs("div",{className:_e.syncButton,onClick:M,children:[l.jsx("div",{className:_e.circularCheckbox,children:l.jsx(ac,{size:16,className:_e.checkedIcon})}),l.jsx("img",{src:Vf,width:18}),l.jsx("span",{style:{fontSize:"14px"},children:"Sincronizar Google"})]}):l.jsx(z_,{disID:o,usrID:s}),b?.userEmail&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:_e.currentUserCalendarTitle,style:{marginTop:"10px"},children:b?.userEmail}),u?l.jsx(g.CircularProgress,{size:24}):c.length>0?l.jsx(g.List,{dense:!0,className:_e.calendarsList,children:c.map(N=>l.jsx(g.ListItem,{secondaryAction:l.jsx(g.Checkbox,{edge:"end",onChange:()=>f(N.id),checked:N.selected||!1,sx:{color:N.backgroundColor,"&.Mui-checked":{color:N.backgroundColor}}}),disablePadding:!0,children:l.jsx(g.ListItemText,{primary:N.summary.length>25?`${N.summary.substring(0,25)}...`:N.summary,className:_e.calendarItemText})},N.id))}):l.jsx("p",{style:{fontSize:"12px"},children:"No se encontraron calendarios."})]}),p?.userEmail&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:_e.currentUserCalendarTitle,style:{marginTop:"10px"},children:p?.userEmail}),u?l.jsx(g.CircularProgress,{size:24}):a.length>0?l.jsx(g.List,{dense:!0,className:_e.calendarsList,children:a.map(N=>l.jsx(g.ListItem,{secondaryAction:l.jsx(g.Checkbox,{edge:"end",onChange:()=>d(N.id),checked:N.selected||!1,sx:{color:N.backgroundColor,"&.Mui-checked":{color:N.backgroundColor}}}),disablePadding:!0,children:l.jsx(g.ListItemText,{primary:N.summary.length>25?`${N.summary.substring(0,25)}...`:N.summary,className:_e.calendarItemText})},N.id))}):l.jsx("p",{style:{fontSize:"12px"},children:"No se encontraron calendarios."})]})]})]})]})},Cn={dayCell:"_dayCell_xweup_1",dayCellContainer:"_dayCellContainer_xweup_23",dayNumber:"_dayNumber_xweup_55",dayNumberToday:"_dayNumberToday_xweup_69",notCurrentMonth:"_notCurrentMonth_xweup_91",CurrentDay:"_CurrentDay_xweup_129",eventsList:"_eventsList_xweup_137"};var Vo={},op;function vw(){if(op)return Vo;op=1;var e=Je();Object.defineProperty(Vo,"__esModule",{value:!0}),Vo.default=void 0,o(y);var t=e(lt()),r=rt();function n(s){if(typeof WeakMap!="function")return null;var i=new WeakMap,a=new WeakMap;return(n=function(c){return c?a:i})(s)}function o(s,i){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var a=n(i);if(a&&a.has(s))return a.get(s);var c={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var f=u?Object.getOwnPropertyDescriptor(s,d):null;f&&(f.get||f.set)?Object.defineProperty(c,d,f):c[d]=s[d]}return c.default=s,a&&a.set(s,c),c}return Vo.default=(0,t.default)((0,r.jsx)("path",{d:"M12.545,10.239v3.821h5.445c-0.712,2.315-2.647,3.972-5.445,3.972c-3.332,0-6.033-2.701-6.033-6.032s2.701-6.032,6.033-6.032c1.498,0,2.866,0.549,3.921,1.453l2.814-2.814C17.503,2.988,15.139,2,12.545,2C7.021,2,2.543,6.477,2.543,12s4.478,10,10.002,10c8.396,0,10.249-7.85,9.426-11.748L12.545,10.239z"}),"Google"),Vo}var yw=vw();const bw=Xe(yw);var Uo={},sp;function _w(){if(sp)return Uo;sp=1;var e=Je();Object.defineProperty(Uo,"__esModule",{value:!0}),Uo.default=void 0;var t=e(lt()),r=rt();return Uo.default=(0,t.default)((0,r.jsx)("path",{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 14H4V8l8 5 8-5zm-8-7L4 6h16z"}),"MailOutline"),Uo}var xw=_w();const ww=Xe(xw),ip=46,Sw=22,Cw=({dayNumber:e,date:t,events:r,isToday:n,isCurrentMonth:o,onDayClick:s,onEventClick:i,onSeeMoreClick:a})=>{const c=[Cn.dayCell,o?"":Cn.notCurrentMonth,Cn.CurrentDay].join(" ").trim(),u=y.useRef(null),[d,f]=y.useState(r.length),h=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});y.useLayoutEffect(()=>{const p=()=>{if(u.current){const b=u.current.clientHeight;let w=Math.floor(b/(ip+4));if(w<r.length){const C=Math.floor((b-Sw)/(ip+4));w=Math.max(0,C)}f(w)}};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[r.length]);const v=r.slice(0,d===0?1:d),m=r.length-(d===0?1:d);return l.jsxs("div",{className:`${c} ${Cn.dayCellContainer}`,onClick:()=>s?.(t),style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},children:[l.jsx("div",{className:n?Cn.dayNumber:Cn.dayNumberToday,children:e}),l.jsxs("div",{className:Cn.eventsList,ref:u,style:{flex:1,display:"flex",flexDirection:"column",gap:"4px",padding:"0 4px 4px 4px",marginTop:"4px",overflow:"hidden"},children:[v.map(p=>{const b=p.color||"#D7EBFB",w=p.isGoogleEvent||p.isOutlookEvent;return l.jsxs(g.Box,{onClick:C=>{C.stopPropagation(),i?.(p)},sx:{backgroundColor:w?"#ffffff":p?.color,padding:"4px 8px",borderRadius:"6px",cursor:"pointer",display:"flex",flexDirection:"column",minHeight:"40px",maxHeight:"48px",position:"relative",overflow:"hidden",border:w?`1px solid ${De(b).setAlpha(.4).toRgbString()}`:"none","&:hover":{filter:"brightness(0.95)",boxShadow:"0px 2px 4px rgba(0,0,0,0.08)"}},children:[p.isGoogleEvent&&l.jsx(bw,{sx:{position:"absolute",top:4,right:4,fontSize:12,color:"#4285F4"}}),p.isOutlookEvent&&l.jsx(ww,{sx:{position:"absolute",top:4,right:4,fontSize:12,color:"#0078D4"}}),l.jsx(g.Typography,{sx:{fontSize:"10px",lineHeight:"1",color:"#3C4043",pr:w?2:0,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word"},children:p.titulo}),l.jsx(g.Typography,{sx:{fontSize:"9px",color:"#70757a",mt:"auto",fontWeight:400},children:`${h.format(p.fechaInicio).toLowerCase()} - ${h.format(p.fechaFin).toLowerCase()}`})]},p.eventoID)}),m>0&&l.jsxs(g.Typography,{sx:{fontSize:"10px",fontWeight:"bold",color:"#1976D2",textAlign:"left",ml:1,mt:.5,cursor:"pointer","&:hover":{textDecoration:"underline"}},onClick:p=>{p.stopPropagation(),a(r,t)},children:["+",m," más"]})]})]})},ap={weekDaysContainer:"_weekDaysContainer_5h5ol_1",weekDay:"_weekDay_5h5ol_1"},Ew=()=>{const e=["Lunes","Martes","Miércoles","Jueves","Viernes","Sábado","Domingo"];return l.jsx("div",{className:ap.weekDaysContainer,children:e.map(t=>l.jsx("div",{className:ap.weekDay,children:t},t))})},Ni={calendarGridContainer:"_calendarGridContainer_1expw_1",daysContainer:"_daysContainer_1expw_23",rows5:"_rows5_1expw_37",rows6:"_rows6_1expw_45"};function Dw(e,t){const[r,n]=Nx(e,t.start,t.end);return{start:r,end:n}}function kw(e,t){const{start:r,end:n}=Dw(t?.in,e);let o=+r>+n;const s=o?+r:+n,i=o?n:r;i.setHours(0,0,0,0);let a=1;const c=[];for(;+i<=s;)c.push(cc(r,i)),i.setDate(i.getDate()+a),i.setHours(0,0,0,0);return o?c.reverse():c}function Aw(e,t){const r=t?.weekStartsOn,n=sn(e,t?.in),o=n.getDay(),s=(o<r?-7:0)+6-(o-r);return n.setDate(n.getDate()+s),n.setHours(23,59,59,999),n}function Tw(e,t,r){const n=+sn(e,r?.in),[o,s]=[+sn(t.start,r?.in),+sn(t.end,r?.in)].sort((i,a)=>i-a);return n>=o&&n<=s}const Iw=({currentDate:e,events:t,onDayClick:r,onEventClick:n,onSeeMoreClick:o})=>{const s=_.startOfMonth(e),i=_.endOfMonth(e),a=_.startOfWeek(s,{weekStartsOn:1}),c=Aw(i,{weekStartsOn:1}),u=kw({start:a,end:c}),d={},f=u.length/7,h=`${Ni.daysContainer} ${f===5?Ni.rows5:Ni.rows6}`;return t.forEach(v=>{const m=_.format(v.fechaInicio,"yyyy-MM-dd");d[m]||(d[m]=[]),d[m].push(v)}),l.jsxs("div",{className:Ni.calendarGridContainer,children:[l.jsx(Ew,{}),l.jsx("div",{className:h,children:u.map(v=>{const m=t.filter(p=>Tw(v,{start:_.startOfDay(p.fechaInicio),end:_.endOfDay(p.fechaFin)}));return l.jsx(Cw,{dayNumber:v.getDate(),date:v,events:m,isToday:_.isToday(v),isCurrentMonth:_.isSameMonth(v,e),onDayClick:r,onEventClick:n,onSeeMoreClick:o},v.toISOString())})})]})},Ic=()=>{const{calendarApiUrl:e}=Sc(),t=async v=>{try{return(await Et.get(`${e}/api/Calendario/v1/local/ListarEventosXUsuario/${v}`)).data.map(p=>{const b=new Date(p.fechaInicio),w=new Date(p.fechaFin),C=p.solicitudRelacionada?.[0]?.nombreCliente??null;return{...p,fechaInicio:b,fechaFin:w,client:C}})}catch(m){return console.error("Error events:",m),[]}},r=async(v,m)=>{try{const p=await Et.post(`${e}/api/Calendario/v1/local/InsertarEvento/${m}`,v);return{...p.data,fechaInicio:new Date(p.data.fechaInicio),fechaFin:new Date(p.data.fechaFin)}}catch(p){throw console.log("Error creating event:",p),p}},n=async v=>{try{const m=await Et.post(`${e}/api/Calendario/v1/local/ActualizarEvento/${v.eventoID}`,v);return{eventoID:m.data.eventoID,titulo:m.data.titulo,descripcion:m.data.descripcion,fechaInicio:new Date(m.data.fechaInicio),fechaFin:new Date(m.data.fechaFin),todoElDia:m.data.todoElDia,color:m.data.color,repetir:m.data.repetir,link:m.data.link,solID:m.data.solID,disID:m.data.disID,client:m.data.client}}catch(m){throw console.log("Error updating event:",m),m}},o=async v=>{try{const m=await Et.get(`${e}/api/Calendario/v1/local/ObtenerEvento/${v}`),p=m.data[0].solicitudRelacionada?.[0]?.nombreCliente||null;return{...m.data[0],fechaInicio:m.data[0].fechaInicio,fechaFin:m.data[0].fechaFin,client:p}}catch(m){throw console.error(`Error fetching event with ID ${v}:`,m),m}},s=async v=>{try{await Et.post(`${e}/api/Calendario/v1/local/EliminarEvento/${v}`)}catch(m){throw console.log(`Error ID ${v}:`,m),m}},i=y.useCallback(async(v,m,p,b)=>{try{const w={masNombreBD:p,usrID:b,disID:m,nombreCliente:v},E=(await Et.post(`${e}/api/Calendario/v1/local/ConsultaClientesXUsuariologgeado/`,w)).data?.data;return Array.isArray(E)?E.map(S=>({clienteID:S.clienteID,solID:S.solID,marca:S?.marca,modelo:S?.modelo,nombreCliente:S?.nombreCliente})):[]}catch(w){return console.error("Error clientes:",w),[]}},[e]),a=y.useCallback(async(v,m)=>{try{const p={disID:v,usrMail:m},w=(await Et.post(`${e}/api/Calendario/v1/Consulta_UsuariosInvitados/`,p)).data?.data;return Array.isArray(w)?w.map(C=>({usrID:C.usrID,usrNombre:C.usrNombre,usrMail:C?.usrMail,disID:C?.disID})):[]}catch(p){return console.error("Error usuarios:",p),[]}},[e]),c=async(v,m,p,b,w)=>{const C={tieneConflicto:!1,usrMail:""};try{const E={disID:v,usrMail:m,startDate:p,horaInicio:b,horaFin:w};return(await Et.post(`${e}/api/Calendario/v1/local/ConsultaConflictoInvitados`,E)).data?.data}catch(E){return console.error("Error al verificar conflicto:",E),C}},u=y.useCallback(async(v,m,p,b)=>{try{const w={disID:v,usrMail:m,startDate:p,DuracionEvento:b},E=(await Et.post(`${e}/api/Calendario/v1/local/ConsultaDisponibilidadUsuario`,w)).data?.data;return Array.isArray(E)?E.map(S=>({Fecha:S.fecha,HoraInicio:S.horaInicio,HoraFin:S.horaFin})):[]}catch(w){return console.error("Error usuarios:",w),[]}},[e]),d=y.useCallback(async(v,m=!1)=>{try{const p=await Et.post(`${e}/api/Notificaciones/v1/local/ObtenerNotificacionesPorUsuarioAsync/${v}?soloNoLeidas=${m}`);return console.log("response.data",p.data),p.data}catch(p){return console.error("Error usuarios:",p),[]}},[e]);return{getEventsByUser:t,createEvent:r,updateEvent:n,getEventById:o,deleteEvent:s,getClients:i,getUsuariosInvitados:a,VerificarConflicto:c,getDisponibilidadUsuario:u,getNotificacionesXUsuario:d,UpdateStatusEvento:async(v,m,p)=>{try{const b={EventoID:v,UsuarioID:m,status:p};return(await Et.post(`${e}/api/Calendario/v1/local/ActualizarEstadoInvitacionAsync/`,b)).data}catch(b){return console.error("Error Actualizar estatus:",b),{}}},MarcarLeido:async(v,m)=>{try{return(await Et.post(`${e}/api/Notificaciones/v1/local/MarcarComoLeidaAsync/${v}?usuarioId=${m}&marcarComoLeida=true`)).data?.data}catch(p){return console.error("Error Actualizar estatus:",p),{}}}}};var Ho={},cp;function Mw(){if(cp)return Ho;cp=1;var e=Je();Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.default=void 0;var t=e(lt()),r=rt();return Ho.default=(0,t.default)([(0,r.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),(0,r.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"AccessTime"),Ho}var Pw=Mw();const Mc=Xe(Pw);var Yo=e=>e.type==="checkbox",En=e=>e instanceof Date,rr=e=>e==null;const lp=e=>typeof e=="object";var Nt=e=>!rr(e)&&!Array.isArray(e)&&lp(e)&&!En(e),up=e=>Nt(e)&&e.target?Yo(e.target)?e.target.checked:e.target.value:e,Ow=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,dp=(e,t)=>e.has(Ow(t)),jw=e=>{const t=e.constructor&&e.constructor.prototype;return Nt(t)&&t.hasOwnProperty("isPrototypeOf")},Pc=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Vt(e){let t;const r=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(Pc&&(e instanceof Blob||n))&&(r||Nt(e)))if(t=r?[]:Object.create(Object.getPrototypeOf(e)),!r&&!jw(e))t=e;else for(const o in e)e.hasOwnProperty(o)&&(t[o]=Vt(e[o]));else return e;return t}var $i=e=>/^\w*$/.test(e),$t=e=>e===void 0,Oc=e=>Array.isArray(e)?e.filter(Boolean):[],jc=e=>Oc(e.replace(/["|']|\]/g,"").split(/\.|\[/)),he=(e,t,r)=>{if(!t||!Nt(e))return r;const n=($i(t)?[t]:jc(t)).reduce((o,s)=>rr(o)?o:o[s],e);return $t(n)||n===e?$t(e[t])?r:e[t]:n},pr=e=>typeof e=="boolean",ut=(e,t,r)=>{let n=-1;const o=$i(t)?[t]:jc(t),s=o.length,i=s-1;for(;++n<s;){const a=o[n];let c=r;if(n!==i){const u=e[a];c=Nt(u)||Array.isArray(u)?u:isNaN(+o[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}};const Li={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Tr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Qr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Rc=y.createContext(null);Rc.displayName="HookFormContext";const Nc=()=>y.useContext(Rc),Rw=e=>{const{children:t,...r}=e;return y.createElement(Rc.Provider,{value:r},t)};var fp=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==Tr.all&&(t._proxyFormState[i]=!n||Tr.all),r&&(r[i]=!0),e[i]}});return o};const $c=typeof window<"u"?y.useLayoutEffect:y.useEffect;function Nw(e){const t=Nc(),{control:r=t.control,disabled:n,name:o,exact:s}=e||{},[i,a]=y.useState(r._formState),c=y.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return $c(()=>r._subscribe({name:o,formState:c.current,exact:s,callback:u=>{!n&&a({...r._formState,...u})}}),[o,n,s]),y.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),y.useMemo(()=>fp(i,r,c.current,!1),[i,r])}var Ur=e=>typeof e=="string",pp=(e,t,r,n,o)=>Ur(e)?(n&&t.watch.add(e),he(r,e,o)):Array.isArray(e)?e.map(s=>(n&&t.watch.add(s),he(r,s))):(n&&(t.watchAll=!0),r),Lc=e=>rr(e)||!lp(e);function Xr(e,t,r=new WeakSet){if(Lc(e)||Lc(t))return e===t;if(En(e)&&En(t))return e.getTime()===t.getTime();const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const i=e[s];if(!o.includes(s))return!1;if(s!=="ref"){const a=t[s];if(En(i)&&En(a)||Nt(i)&&Nt(a)||Array.isArray(i)&&Array.isArray(a)?!Xr(i,a,r):i!==a)return!1}}return!0}function hp(e){const t=Nc(),{control:r=t.control,name:n,defaultValue:o,disabled:s,exact:i,compute:a}=e||{},c=y.useRef(o),u=y.useRef(a),d=y.useRef(void 0);u.current=a;const f=y.useMemo(()=>r._getWatch(n,c.current),[r,n]),[h,v]=y.useState(u.current?u.current(f):f);return $c(()=>r._subscribe({name:n,formState:{values:!0},exact:i,callback:m=>{if(!s){const p=pp(n,r._names,m.values||r._formValues,!1,c.current);if(u.current){const b=u.current(p);Xr(b,d.current)||(v(b),d.current=b)}else v(p)}}}),[r,s,n,i]),y.useEffect(()=>r._removeUnmounted()),h}function $w(e){const t=Nc(),{name:r,disabled:n,control:o=t.control,shouldUnregister:s,defaultValue:i}=e,a=dp(o._names.array,r),c=y.useMemo(()=>he(o._formValues,r,he(o._defaultValues,r,i)),[o,r,i]),u=hp({control:o,name:r,defaultValue:c,exact:!0}),d=Nw({control:o,name:r,exact:!0}),f=y.useRef(e),h=y.useRef(o.register(r,{...e.rules,value:u,...pr(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const v=y.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!he(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!he(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!he(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!he(d.validatingFields,r)},error:{enumerable:!0,get:()=>he(d.errors,r)}}),[d,r]),m=y.useCallback(C=>h.current.onChange({target:{value:up(C),name:r},type:Li.CHANGE}),[r]),p=y.useCallback(()=>h.current.onBlur({target:{value:he(o._formValues,r),name:r},type:Li.BLUR}),[r,o._formValues]),b=y.useCallback(C=>{const E=he(o._fields,r);E&&C&&(E._f.ref={focus:()=>C.focus&&C.focus(),select:()=>C.select&&C.select(),setCustomValidity:S=>C.setCustomValidity(S),reportValidity:()=>C.reportValidity()})},[o._fields,r]),w=y.useMemo(()=>({name:r,value:u,...pr(n)||d.disabled?{disabled:d.disabled||n}:{},onChange:m,onBlur:p,ref:b}),[r,n,d.disabled,m,p,b,u]);return y.useEffect(()=>{const C=o._options.shouldUnregister||s;o.register(r,{...f.current.rules,...pr(f.current.disabled)?{disabled:f.current.disabled}:{}});const E=(S,x)=>{const W=he(o._fields,S);W&&W._f&&(W._f.mount=x)};if(E(r,!0),C){const S=Vt(he(o._options.defaultValues,r));ut(o._defaultValues,r,S),$t(he(o._formValues,r))&&ut(o._formValues,r,S)}return!a&&o.register(r),()=>{(a?C&&!o._state.action:C)?o.unregister(r):E(r,!1)}},[r,o,a,s]),y.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),y.useMemo(()=>({field:w,formState:d,fieldState:v}),[w,d,v])}const hr=e=>e.render($w(e));var zc=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},qo=e=>Array.isArray(e)?e:[e],mp=()=>{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},ir=e=>Nt(e)&&!Object.keys(e).length,Bc=e=>e.type==="file",Ir=e=>typeof e=="function",zi=e=>{if(!Pc)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},gp=e=>e.type==="select-multiple",Fc=e=>e.type==="radio",Lw=e=>Fc(e)||Yo(e),Wc=e=>zi(e)&&e.isConnected;function zw(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=$t(e)?n++:e[t[n++]];return e}function Bw(e){for(const t in e)if(e.hasOwnProperty(t)&&!$t(e[t]))return!1;return!0}function Ft(e,t){const r=Array.isArray(t)?t:$i(t)?[t]:jc(t),n=r.length===1?e:zw(e,r),o=r.length-1,s=r[o];return n&&delete n[s],o!==0&&(Nt(n)&&ir(n)||Array.isArray(n)&&Bw(n))&&Ft(e,r.slice(0,-1)),e}var vp=e=>{for(const t in e)if(Ir(e[t]))return!0;return!1};function Bi(e,t={}){const r=Array.isArray(e);if(Nt(e)||r)for(const n in e)Array.isArray(e[n])||Nt(e[n])&&!vp(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Bi(e[n],t[n])):rr(e[n])||(t[n]=!0);return t}function yp(e,t,r){const n=Array.isArray(e);if(Nt(e)||n)for(const o in e)Array.isArray(e[o])||Nt(e[o])&&!vp(e[o])?$t(t)||Lc(r[o])?r[o]=Array.isArray(e[o])?Bi(e[o],[]):{...Bi(e[o])}:yp(e[o],rr(t)?{}:t[o],r[o]):r[o]=!Xr(e[o],t[o]);return r}var Zo=(e,t)=>yp(e,t,Bi(t));const bp={value:!1,isValid:!1},_p={value:!0,isValid:!0};var xp=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!$t(e[0].attributes.value)?$t(e[0].value)||e[0].value===""?_p:{value:e[0].value,isValid:!0}:_p:bp}return bp},wp=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>$t(e)?e:t?e===""?NaN:e&&+e:r&&Ur(e)?new Date(e):n?n(e):e;const Sp={isValid:!1,value:null};var Cp=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Sp):Sp;function Ep(e){const t=e.ref;return Bc(t)?t.files:Fc(t)?Cp(e.refs).value:gp(t)?[...t.selectedOptions].map(({value:r})=>r):Yo(t)?xp(e.refs).value:wp($t(t.value)?e.ref.value:t.value,e)}var Fw=(e,t,r,n)=>{const o={};for(const s of e){const i=he(t,s);i&&ut(o,s,i._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},Fi=e=>e instanceof RegExp,Go=e=>$t(e)?e:Fi(e)?e.source:Nt(e)?Fi(e.value)?e.value.source:e.value:e,Dp=e=>({isOnSubmit:!e||e===Tr.onSubmit,isOnBlur:e===Tr.onBlur,isOnChange:e===Tr.onChange,isOnAll:e===Tr.all,isOnTouch:e===Tr.onTouched});const kp="AsyncFunction";var Ww=e=>!!e&&!!e.validate&&!!(Ir(e.validate)&&e.validate.constructor.name===kp||Nt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===kp)),Vw=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ap=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Ko=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const s=he(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!n)return!0;if(i.ref&&t(i.ref,i.name)&&!n)return!0;if(Ko(a,t))break}else if(Nt(a)&&Ko(a,t))break}}};function Tp(e,t,r){const n=he(e,r);if(n||$i(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const s=o.join("."),i=he(t,s),a=he(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(a&&a.type)return{name:s,error:a};if(a&&a.root&&a.root.type)return{name:`${s}.root`,error:a.root};o.pop()}return{name:r}}var Uw=(e,t,r,n)=>{r(e);const{name:o,...s}=e;return ir(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!n||Tr.all))},Hw=(e,t,r)=>!e||!t||e===t||qo(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),Yw=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,qw=(e,t)=>!Oc(he(e,t)).length&&Ft(e,t),Zw=(e,t,r)=>{const n=qo(he(e,r));return ut(n,"root",t[r]),ut(e,r,n),e},Wi=e=>Ur(e);function Ip(e,t,r="validate"){if(Wi(e)||Array.isArray(e)&&e.every(Wi)||pr(e)&&!e)return{type:r,message:Wi(e)?e:"",ref:t}}var Gn=e=>Nt(e)&&!Fi(e)?e:{value:e,message:""},Mp=async(e,t,r,n,o,s)=>{const{ref:i,refs:a,required:c,maxLength:u,minLength:d,min:f,max:h,pattern:v,validate:m,name:p,valueAsNumber:b,mount:w}=e._f,C=he(r,p);if(!w||t.has(p))return{};const E=a?a[0]:i,S=G=>{o&&E.reportValidity&&(E.setCustomValidity(pr(G)?"":G||""),E.reportValidity())},x={},W=Fc(i),D=Yo(i),A=W||D,M=(b||Bc(i))&&$t(i.value)&&$t(C)||zi(i)&&i.value===""||C===""||Array.isArray(C)&&!C.length,I=zc.bind(null,p,n,x),H=(G,F,Y,oe=Qr.maxLength,V=Qr.minLength)=>{const N=G?F:Y;x[p]={type:G?oe:V,message:N,ref:i,...I(G?oe:V,N)}};if(s?!Array.isArray(C)||!C.length:c&&(!A&&(M||rr(C))||pr(C)&&!C||D&&!xp(a).isValid||W&&!Cp(a).isValid)){const{value:G,message:F}=Wi(c)?{value:!!c,message:c}:Gn(c);if(G&&(x[p]={type:Qr.required,message:F,ref:E,...I(Qr.required,F)},!n))return S(F),x}if(!M&&(!rr(f)||!rr(h))){let G,F;const Y=Gn(h),oe=Gn(f);if(!rr(C)&&!isNaN(C)){const V=i.valueAsNumber||C&&+C;rr(Y.value)||(G=V>Y.value),rr(oe.value)||(F=V<oe.value)}else{const V=i.valueAsDate||new Date(C),N=$=>new Date(new Date().toDateString()+" "+$),ae=i.type=="time",fe=i.type=="week";Ur(Y.value)&&C&&(G=ae?N(C)>N(Y.value):fe?C>Y.value:V>new Date(Y.value)),Ur(oe.value)&&C&&(F=ae?N(C)<N(oe.value):fe?C<oe.value:V<new Date(oe.value))}if((G||F)&&(H(!!G,Y.message,oe.message,Qr.max,Qr.min),!n))return S(x[p].message),x}if((u||d)&&!M&&(Ur(C)||s&&Array.isArray(C))){const G=Gn(u),F=Gn(d),Y=!rr(G.value)&&C.length>+G.value,oe=!rr(F.value)&&C.length<+F.value;if((Y||oe)&&(H(Y,G.message,F.message),!n))return S(x[p].message),x}if(v&&!M&&Ur(C)){const{value:G,message:F}=Gn(v);if(Fi(G)&&!C.match(G)&&(x[p]={type:Qr.pattern,message:F,ref:i,...I(Qr.pattern,F)},!n))return S(F),x}if(m){if(Ir(m)){const G=await m(C,r),F=Ip(G,E);if(F&&(x[p]={...F,...I(Qr.validate,F.message)},!n))return S(F.message),x}else if(Nt(m)){let G={};for(const F in m){if(!ir(G)&&!n)break;const Y=Ip(await m[F](C,r),E,F);Y&&(G={...Y,...I(F,Y.message)},S(Y.message),n&&(x[p]=G))}if(!ir(G)&&(x[p]={ref:E,...G},!n))return x}}return S(!0),x};const Gw={mode:Tr.onSubmit,reValidateMode:Tr.onChange,shouldFocusError:!0};function Kw(e={}){let t={...Gw,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ir(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},o=Nt(t.defaultValues)||Nt(t.values)?Vt(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Vt(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...d};const h={array:mp(),state:mp()},v=t.criteriaMode===Tr.all,m=k=>P=>{clearTimeout(u),u=setTimeout(k,P)},p=async k=>{if(!t.disabled&&(d.isValid||f.isValid||k)){const P=t.resolver?ir((await D()).errors):await M(n,!0);P!==r.isValid&&h.state.next({isValid:P})}},b=(k,P)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((k||Array.from(a.mount)).forEach(B=>{B&&(P?ut(r.validatingFields,B,P):Ft(r.validatingFields,B))}),h.state.next({validatingFields:r.validatingFields,isValidating:!ir(r.validatingFields)}))},w=(k,P=[],B,le,se=!0,O=!0)=>{if(le&&B&&!t.disabled){if(i.action=!0,O&&Array.isArray(he(n,k))){const ne=B(he(n,k),le.argA,le.argB);se&&ut(n,k,ne)}if(O&&Array.isArray(he(r.errors,k))){const ne=B(he(r.errors,k),le.argA,le.argB);se&&ut(r.errors,k,ne),qw(r.errors,k)}if((d.touchedFields||f.touchedFields)&&O&&Array.isArray(he(r.touchedFields,k))){const ne=B(he(r.touchedFields,k),le.argA,le.argB);se&&ut(r.touchedFields,k,ne)}(d.dirtyFields||f.dirtyFields)&&(r.dirtyFields=Zo(o,s)),h.state.next({name:k,isDirty:H(k,P),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ut(s,k,P)},C=(k,P)=>{ut(r.errors,k,P),h.state.next({errors:r.errors})},E=k=>{r.errors=k,h.state.next({errors:r.errors,isValid:!1})},S=(k,P,B,le)=>{const se=he(n,k);if(se){const O=he(s,k,$t(B)?he(o,k):B);$t(O)||le&&le.defaultChecked||P?ut(s,k,P?O:Ep(se._f)):Y(k,O),i.mount&&p()}},x=(k,P,B,le,se)=>{let O=!1,ne=!1;const Se={name:k};if(!t.disabled){if(!B||le){(d.isDirty||f.isDirty)&&(ne=r.isDirty,r.isDirty=Se.isDirty=H(),O=ne!==Se.isDirty);const Oe=Xr(he(o,k),P);ne=!!he(r.dirtyFields,k),Oe?Ft(r.dirtyFields,k):ut(r.dirtyFields,k,!0),Se.dirtyFields=r.dirtyFields,O=O||(d.dirtyFields||f.dirtyFields)&&ne!==!Oe}if(B){const Oe=he(r.touchedFields,k);Oe||(ut(r.touchedFields,k,B),Se.touchedFields=r.touchedFields,O=O||(d.touchedFields||f.touchedFields)&&Oe!==B)}O&&se&&h.state.next(Se)}return O?Se:{}},W=(k,P,B,le)=>{const se=he(r.errors,k),O=(d.isValid||f.isValid)&&pr(P)&&r.isValid!==P;if(t.delayError&&B?(c=m(()=>C(k,B)),c(t.delayError)):(clearTimeout(u),c=null,B?ut(r.errors,k,B):Ft(r.errors,k)),(B?!Xr(se,B):se)||!ir(le)||O){const ne={...le,...O&&pr(P)?{isValid:P}:{},errors:r.errors,name:k};r={...r,...ne},h.state.next(ne)}},D=async k=>{b(k,!0);const P=await t.resolver(s,t.context,Fw(k||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return b(k),P},A=async k=>{const{errors:P}=await D(k);if(k)for(const B of k){const le=he(P,B);le?ut(r.errors,B,le):Ft(r.errors,B)}else r.errors=P;return P},M=async(k,P,B={valid:!0})=>{for(const le in k){const se=k[le];if(se){const{_f:O,...ne}=se;if(O){const Se=a.array.has(O.name),Oe=se._f&&Ww(se._f);Oe&&d.validatingFields&&b([le],!0);const R=await Mp(se,a.disabled,s,v,t.shouldUseNativeValidation&&!P,Se);if(Oe&&d.validatingFields&&b([le]),R[O.name]&&(B.valid=!1,P))break;!P&&(he(R,O.name)?Se?Zw(r.errors,R,O.name):ut(r.errors,O.name,R[O.name]):Ft(r.errors,O.name))}!ir(ne)&&await M(ne,P,B)}}return B.valid},I=()=>{for(const k of a.unMount){const P=he(n,k);P&&(P._f.refs?P._f.refs.every(B=>!Wc(B)):!Wc(P._f.ref))&&ce(k)}a.unMount=new Set},H=(k,P)=>!t.disabled&&(k&&P&&ut(s,k,P),!Xr($(),o)),G=(k,P,B)=>pp(k,a,{...i.mount?s:$t(P)?o:Ur(k)?{[k]:P}:P},B,P),F=k=>Oc(he(i.mount?s:o,k,t.shouldUnregister?he(o,k,[]):[])),Y=(k,P,B={})=>{const le=he(n,k);let se=P;if(le){const O=le._f;O&&(!O.disabled&&ut(s,k,wp(P,O)),se=zi(O.ref)&&rr(P)?"":P,gp(O.ref)?[...O.ref.options].forEach(ne=>ne.selected=se.includes(ne.value)):O.refs?Yo(O.ref)?O.refs.forEach(ne=>{(!ne.defaultChecked||!ne.disabled)&&(Array.isArray(se)?ne.checked=!!se.find(Se=>Se===ne.value):ne.checked=se===ne.value||!!se)}):O.refs.forEach(ne=>ne.checked=ne.value===se):Bc(O.ref)?O.ref.value="":(O.ref.value=se,O.ref.type||h.state.next({name:k,values:Vt(s)})))}(B.shouldDirty||B.shouldTouch)&&x(k,se,B.shouldTouch,B.shouldDirty,!0),B.shouldValidate&&fe(k)},oe=(k,P,B)=>{for(const le in P){if(!P.hasOwnProperty(le))return;const se=P[le],O=k+"."+le,ne=he(n,O);(a.array.has(k)||Nt(se)||ne&&!ne._f)&&!En(se)?oe(O,se,B):Y(O,se,B)}},V=(k,P,B={})=>{const le=he(n,k),se=a.array.has(k),O=Vt(P);ut(s,k,O),se?(h.array.next({name:k,values:Vt(s)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&B.shouldDirty&&h.state.next({name:k,dirtyFields:Zo(o,s),isDirty:H(k,O)})):le&&!le._f&&!rr(O)?oe(k,O,B):Y(k,O,B),Ap(k,a)&&h.state.next({...r,name:k}),h.state.next({name:i.mount?k:void 0,values:Vt(s)})},N=async k=>{i.mount=!0;const P=k.target;let B=P.name,le=!0;const se=he(n,B),O=Oe=>{le=Number.isNaN(Oe)||En(Oe)&&isNaN(Oe.getTime())||Xr(Oe,he(s,B,Oe))},ne=Dp(t.mode),Se=Dp(t.reValidateMode);if(se){let Oe,R;const te=P.type?Ep(se._f):up(k),xe=k.type===Li.BLUR||k.type===Li.FOCUS_OUT,Ge=!Vw(se._f)&&!t.resolver&&!he(r.errors,B)&&!se._f.deps||Yw(xe,he(r.touchedFields,B),r.isSubmitted,Se,ne),q=Ap(B,a,xe);ut(s,B,te),xe?(!P||!P.readOnly)&&(se._f.onBlur&&se._f.onBlur(k),c&&c(0)):se._f.onChange&&se._f.onChange(k);const ue=x(B,te,xe),Ee=!ir(ue)||q;if(!xe&&h.state.next({name:B,type:k.type,values:Vt(s)}),Ge)return(d.isValid||f.isValid)&&(t.mode==="onBlur"?xe&&p():xe||p()),Ee&&h.state.next({name:B,...q?{}:ue});if(!xe&&q&&h.state.next({...r}),t.resolver){const{errors:Te}=await D([B]);if(O(te),le){const Ve=Tp(r.errors,n,B),J=Tp(Te,n,Ve.name||B);Oe=J.error,B=J.name,R=ir(Te)}}else b([B],!0),Oe=(await Mp(se,a.disabled,s,v,t.shouldUseNativeValidation))[B],b([B]),O(te),le&&(Oe?R=!1:(d.isValid||f.isValid)&&(R=await M(n,!0)));le&&(se._f.deps&&fe(se._f.deps),W(B,R,Oe,ue))}},ae=(k,P)=>{if(he(r.errors,P)&&k.focus)return k.focus(),1},fe=async(k,P={})=>{let B,le;const se=qo(k);if(t.resolver){const O=await A($t(k)?k:se);B=ir(O),le=k?!se.some(ne=>he(O,ne)):B}else k?(le=(await Promise.all(se.map(async O=>{const ne=he(n,O);return await M(ne&&ne._f?{[O]:ne}:ne)}))).every(Boolean),!(!le&&!r.isValid)&&p()):le=B=await M(n);return h.state.next({...!Ur(k)||(d.isValid||f.isValid)&&B!==r.isValid?{}:{name:k},...t.resolver||!k?{isValid:B}:{},errors:r.errors}),P.shouldFocus&&!le&&Ko(n,ae,k?se:a.mount),le},$=k=>{const P={...i.mount?s:o};return $t(k)?P:Ur(k)?he(P,k):k.map(B=>he(P,B))},Q=(k,P)=>({invalid:!!he((P||r).errors,k),isDirty:!!he((P||r).dirtyFields,k),error:he((P||r).errors,k),isValidating:!!he(r.validatingFields,k),isTouched:!!he((P||r).touchedFields,k)}),Ce=k=>{k&&qo(k).forEach(P=>Ft(r.errors,P)),h.state.next({errors:k?r.errors:{}})},me=(k,P,B)=>{const le=(he(n,k,{_f:{}})._f||{}).ref,se=he(r.errors,k)||{},{ref:O,message:ne,type:Se,...Oe}=se;ut(r.errors,k,{...Oe,...P,ref:le}),h.state.next({name:k,errors:r.errors,isValid:!1}),B&&B.shouldFocus&&le&&le.focus&&le.focus()},we=(k,P)=>Ir(k)?h.state.subscribe({next:B=>"values"in B&&k(G(void 0,P),B)}):G(k,P,!0),ie=k=>h.state.subscribe({next:P=>{Hw(k.name,P.name,k.exact)&&Uw(P,k.formState||d,Be,k.reRenderRoot)&&k.callback({values:{...s},...r,...P,defaultValues:o})}}).unsubscribe,ee=k=>(i.mount=!0,f={...f,...k.formState},ie({...k,formState:f})),ce=(k,P={})=>{for(const B of k?qo(k):a.mount)a.mount.delete(B),a.array.delete(B),P.keepValue||(Ft(n,B),Ft(s,B)),!P.keepError&&Ft(r.errors,B),!P.keepDirty&&Ft(r.dirtyFields,B),!P.keepTouched&&Ft(r.touchedFields,B),!P.keepIsValidating&&Ft(r.validatingFields,B),!t.shouldUnregister&&!P.keepDefaultValue&&Ft(o,B);h.state.next({values:Vt(s)}),h.state.next({...r,...P.keepDirty?{isDirty:H()}:{}}),!P.keepIsValid&&p()},ge=({disabled:k,name:P})=>{(pr(k)&&i.mount||k||a.disabled.has(P))&&(k?a.disabled.add(P):a.disabled.delete(P))},de=(k,P={})=>{let B=he(n,k);const le=pr(P.disabled)||pr(t.disabled);return ut(n,k,{...B||{},_f:{...B&&B._f?B._f:{ref:{name:k}},name:k,mount:!0,...P}}),a.mount.add(k),B?ge({disabled:pr(P.disabled)?P.disabled:t.disabled,name:k}):S(k,!0,P.value),{...le?{disabled:P.disabled||t.disabled}:{},...t.progressive?{required:!!P.required,min:Go(P.min),max:Go(P.max),minLength:Go(P.minLength),maxLength:Go(P.maxLength),pattern:Go(P.pattern)}:{},name:k,onChange:N,onBlur:N,ref:se=>{if(se){de(k,P),B=he(n,k);const O=$t(se.value)&&se.querySelectorAll&&se.querySelectorAll("input,select,textarea")[0]||se,ne=Lw(O),Se=B._f.refs||[];if(ne?Se.find(Oe=>Oe===O):O===B._f.ref)return;ut(n,k,{_f:{...B._f,...ne?{refs:[...Se.filter(Wc),O,...Array.isArray(he(o,k))?[{}]:[]],ref:{type:O.type,name:k}}:{ref:O}}}),S(k,!1,void 0,O)}else B=he(n,k,{}),B._f&&(B._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(dp(a.array,k)&&i.action)&&a.unMount.add(k)}}},pe=()=>t.shouldFocusError&&Ko(n,ae,a.mount),Re=k=>{pr(k)&&(h.state.next({disabled:k}),Ko(n,(P,B)=>{const le=he(n,B);le&&(P.disabled=le._f.disabled||k,Array.isArray(le._f.refs)&&le._f.refs.forEach(se=>{se.disabled=le._f.disabled||k}))},0,!1))},j=(k,P)=>async B=>{let le;B&&(B.preventDefault&&B.preventDefault(),B.persist&&B.persist());let se=Vt(s);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:O,values:ne}=await D();r.errors=O,se=Vt(ne)}else await M(n);if(a.disabled.size)for(const O of a.disabled)Ft(se,O);if(Ft(r.errors,"root"),ir(r.errors)){h.state.next({errors:{}});try{await k(se,B)}catch(O){le=O}}else P&&await P({...r.errors},B),pe(),setTimeout(pe);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ir(r.errors)&&!le,submitCount:r.submitCount+1,errors:r.errors}),le)throw le},Fe=(k,P={})=>{he(n,k)&&($t(P.defaultValue)?V(k,Vt(he(o,k))):(V(k,P.defaultValue),ut(o,k,Vt(P.defaultValue))),P.keepTouched||Ft(r.touchedFields,k),P.keepDirty||(Ft(r.dirtyFields,k),r.isDirty=P.defaultValue?H(k,Vt(he(o,k))):H()),P.keepError||(Ft(r.errors,k),d.isValid&&p()),h.state.next({...r}))},qe=(k,P={})=>{const B=k?Vt(k):o,le=Vt(B),se=ir(k),O=se?o:le;if(P.keepDefaultValues||(o=B),!P.keepValues){if(P.keepDirtyValues){const ne=new Set([...a.mount,...Object.keys(Zo(o,s))]);for(const Se of Array.from(ne))he(r.dirtyFields,Se)?ut(O,Se,he(s,Se)):V(Se,he(O,Se))}else{if(Pc&&$t(k))for(const ne of a.mount){const Se=he(n,ne);if(Se&&Se._f){const Oe=Array.isArray(Se._f.refs)?Se._f.refs[0]:Se._f.ref;if(zi(Oe)){const R=Oe.closest("form");if(R){R.reset();break}}}}if(P.keepFieldsRef)for(const ne of a.mount)V(ne,he(O,ne));else n={}}s=t.shouldUnregister?P.keepDefaultValues?Vt(o):{}:Vt(O),h.array.next({values:{...O}}),h.state.next({values:{...O}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues,i.watch=!!t.shouldUnregister,h.state.next({submitCount:P.keepSubmitCount?r.submitCount:0,isDirty:se?!1:P.keepDirty?r.isDirty:!!(P.keepDefaultValues&&!Xr(k,o)),isSubmitted:P.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:se?{}:P.keepDirtyValues?P.keepDefaultValues&&s?Zo(o,s):r.dirtyFields:P.keepDefaultValues&&k?Zo(o,k):P.keepDirty?r.dirtyFields:{},touchedFields:P.keepTouched?r.touchedFields:{},errors:P.keepErrors?r.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Ze=(k,P)=>qe(Ir(k)?k(s):k,P),Ne=(k,P={})=>{const B=he(n,k),le=B&&B._f;if(le){const se=le.refs?le.refs[0]:le.ref;se.focus&&(se.focus(),P.shouldSelect&&Ir(se.select)&&se.select())}},Be=k=>{r={...r,...k}},ht={control:{register:de,unregister:ce,getFieldState:Q,handleSubmit:j,setError:me,_subscribe:ie,_runSchema:D,_focusError:pe,_getWatch:G,_getDirty:H,_setValid:p,_setFieldArray:w,_setDisabledField:ge,_setErrors:E,_getFieldArray:F,_reset:qe,_resetDefaultValues:()=>Ir(t.defaultValues)&&t.defaultValues().then(k=>{Ze(k,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:I,_disableForm:Re,_subjects:h,_proxyFormState:d,get _fields(){return n},get _formValues(){return s},get _state(){return i},set _state(k){i=k},get _defaultValues(){return o},get _names(){return a},set _names(k){a=k},get _formState(){return r},get _options(){return t},set _options(k){t={...t,...k}}},subscribe:ee,trigger:fe,register:de,handleSubmit:j,watch:we,setValue:V,getValues:$,reset:Ze,resetField:Fe,clearErrors:Ce,unregister:ce,setError:me,setFocus:Ne,getFieldState:Q};return{...ht,formControl:ht}}function Pp(e={}){const t=y.useRef(void 0),r=y.useRef(void 0),[n,o]=y.useState({isDirty:!1,isValidating:!1,isLoading:Ir(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Ir(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Ir(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...a}=Kw(e);t.current={...a,formState:n}}const s=t.current.control;return s._options=e,$c(()=>{const i=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),s._formState.isReady=!0,i},[s]),y.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),y.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),y.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),y.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),y.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==n.isDirty&&s._subjects.state.next({isDirty:i})}},[s,n.isDirty]),y.useEffect(()=>{e.values&&!Xr(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),r.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[s,e.values]),y.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=fp(n,s),t.current}const Op=(e,t,r)=>{if(e&&"reportValidity"in e){const n=he(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Vc=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Op(n.ref,r,e):n&&n.refs&&n.refs.forEach(o=>Op(o,r,e))}},jp=(e,t)=>{t.shouldUseNativeValidation&&Vc(e,t);const r={};for(const n in e){const o=he(t.fields,n),s=Object.assign(e[n]||{},{ref:o&&o.ref});if(Qw(t.names||Object.keys(e),n)){const i=Object.assign({},he(r,n));ut(i,"root",s),ut(r,n,i)}else ut(r,n,s)}return r},Qw=(e,t)=>{const r=Rp(t);return e.some(n=>Rp(n).match(`^${r}\\.\\d+`))};function Rp(e){return e.replace(/\]|\[/g,"")}function Z(e,t,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(e),t(a,c);for(const d in i.prototype)d in a||Object.defineProperty(a,d,{value:i.prototype[d].bind(a)});a._zod.constr=i,a._zod.def=c}const o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Kn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Np extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const $p={};function Dn(e){return $p}function Xw(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Uc(e,t){return typeof t=="bigint"?t.toString():t}function Hc(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Yc(e){return e==null}function qc(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Jw(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=r>o?r:o,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const Lp=Symbol("evaluating");function gt(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Lp)return n===void 0&&(n=Lp,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function eS(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function an(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Qn(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function zp(e){return JSON.stringify(e)}const Bp="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Vi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const tS=Hc(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Qo(e){if(Vi(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(Vi(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Fp(e){return Qo(e)?{...e}:e}const rS=new Set(["string","number","symbol"]);function Xn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cn(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Ae(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function nS(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const oS={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function sS(e,t){const r=e._zod.def,n=Qn(e._zod.def,{get shape(){const o={};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=r.shape[s])}return an(this,"shape",o),o},checks:[]});return cn(e,n)}function iS(e,t){const r=e._zod.def,n=Qn(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return an(this,"shape",o),o},checks:[]});return cn(e,n)}function aS(e,t){if(!Qo(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const o=Qn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return an(this,"shape",s),s},checks:[]});return cn(e,o)}function cS(e,t){if(!Qo(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return an(this,"shape",n),n},checks:e._zod.def.checks};return cn(e,r)}function lS(e,t){const r=Qn(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return an(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return cn(e,r)}function uS(e,t,r){const n=Qn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=e?new e({type:"optional",innerType:o[i]}):o[i])}else for(const i in o)s[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return an(this,"shape",s),s},checks:[]});return cn(t,n)}function dS(e,t,r){const n=Qn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return an(this,"shape",s),s},checks:[]});return cn(t,n)}function Jn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Wp(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ui(e){return typeof e=="string"?e:e?.message}function kn(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Ui(e.inst?._zod.def?.error?.(e))??Ui(t?.error?.(e))??Ui(r.customError?.(e))??Ui(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Zc(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Xo(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Vp=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Uc,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Gc=Z("$ZodError",Vp),Hi=Z("$ZodError",Vp,{Parent:Error});function fS(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function pS(e,t){const r=t||function(s){return s.message},n={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(e),n}const Yi=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Kn;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>kn(c,s,Dn())));throw Bp(a,o?.callee),a}return i.value},hS=Yi(Hi),qi=e=>async(t,r,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>kn(c,s,Dn())));throw Bp(a,o?.callee),a}return i.value},mS=qi(Hi),Zi=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Kn;return s.issues.length?{success:!1,error:new(e??Gc)(s.issues.map(i=>kn(i,o,Dn())))}:{success:!0,data:s.value}},gS=Zi(Hi),Gi=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>kn(i,o,Dn())))}:{success:!0,data:s.value}},vS=Gi(Hi),yS=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Yi(e)(t,r,o)},bS=e=>(t,r,n)=>Yi(e)(t,r,n),_S=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return qi(e)(t,r,o)},xS=e=>async(t,r,n)=>qi(e)(t,r,n),wS=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Zi(e)(t,r,o)},SS=e=>(t,r,n)=>Zi(e)(t,r,n),CS=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Gi(e)(t,r,o)},ES=e=>async(t,r,n)=>Gi(e)(t,r,n),DS=/^[cC][^\s-]{8,}$/,kS=/^[0-9a-z]+$/,AS=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,TS=/^[0-9a-vA-V]{20}$/,IS=/^[A-Za-z0-9]{27}$/,MS=/^[a-zA-Z0-9_-]{21}$/,PS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,OS=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Up=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,jS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,RS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function NS(){return new RegExp(RS,"u")}const $S=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,LS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,zS=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,BS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,FS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Hp=/^[A-Za-z0-9_-]*$/,WS=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,VS=/^\+(?:[0-9]){6,14}[0-9]$/,Yp="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",US=new RegExp(`^${Yp}$`);function qp(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function HS(e){return new RegExp(`^${qp(e)}$`)}function YS(e){const t=qp({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Yp}T(?:${n})$`)}const qS=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ZS=/^\d+$/,GS=/^-?\d+(?:\.\d+)?/i,KS=/true|false/i,QS=/^[^A-Z]*$/,XS=/^[^a-z]*$/,ar=Z("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Zp={number:"number",bigint:"bigint",object:"date"},Gp=Z("$ZodCheckLessThan",(e,t)=>{ar.init(e,t);const r=Zp[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Kp=Z("$ZodCheckGreaterThan",(e,t)=>{ar.init(e,t);const r=Zp[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),JS=Z("$ZodCheckMultipleOf",(e,t)=>{ar.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Jw(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),eC=Z("$ZodCheckNumberFormat",(e,t)=>{ar.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,s]=oS[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,r&&(a.pattern=ZS)}),e._zod.check=i=>{const a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}}),tC=Z("$ZodCheckMaxLength",(e,t)=>{var r;ar.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Yc(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const i=Zc(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),rC=Z("$ZodCheckMinLength",(e,t)=>{var r;ar.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Yc(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const i=Zc(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),nC=Z("$ZodCheckLengthEquals",(e,t)=>{var r;ar.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Yc(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,s=o.length;if(s===t.length)return;const i=Zc(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ki=Z("$ZodCheckStringFormat",(e,t)=>{var r,n;ar.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),oC=Z("$ZodCheckRegex",(e,t)=>{Ki.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),sC=Z("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=QS),Ki.init(e,t)}),iC=Z("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=XS),Ki.init(e,t)}),aC=Z("$ZodCheckIncludes",(e,t)=>{ar.init(e,t);const r=Xn(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),cC=Z("$ZodCheckStartsWith",(e,t)=>{ar.init(e,t);const r=new RegExp(`^${Xn(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),lC=Z("$ZodCheckEndsWith",(e,t)=>{ar.init(e,t);const r=new RegExp(`.*${Xn(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),uC=Z("$ZodCheckOverwrite",(e,t)=>{ar.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class dC{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
161
161
|
`).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,o.join(`
|
|
162
162
|
`))}}const fC={major:4,minor:1,patch:5},Mt=Z("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=fC;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,a,c)=>{let u=Jn(i),d;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(i))continue}else if(u)continue;const h=i.issues.length,v=f._zod.check(i);if(v instanceof Promise&&c?.async===!1)throw new Kn;if(d||v instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await v,i.issues.length!==h&&(u||(u=Jn(i,h)))});else{if(i.issues.length===h)continue;u||(u=Jn(i,h))}}return d?d.then(()=>i):i},s=(i,a,c)=>{if(Jn(i))return i.aborted=!0,i;const u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new Kn;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,i,a)):s(u,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Kn;return c.then(u=>o(u,n,a))}return o(c,n,a)}}e["~standard"]={validate:o=>{try{const s=gS(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return vS(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),Kc=Z("$ZodString",(e,t)=>{Mt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??qS(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),wt=Z("$ZodStringFormat",(e,t)=>{Ki.init(e,t),Kc.init(e,t)}),pC=Z("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=OS),wt.init(e,t)}),hC=Z("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Up(n))}else t.pattern??(t.pattern=Up());wt.init(e,t)}),mC=Z("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=jS),wt.init(e,t)}),gC=Z("$ZodURL",(e,t)=>{wt.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:WS.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),vC=Z("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=NS()),wt.init(e,t)}),yC=Z("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=MS),wt.init(e,t)}),bC=Z("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=DS),wt.init(e,t)}),_C=Z("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=kS),wt.init(e,t)}),xC=Z("$ZodULID",(e,t)=>{t.pattern??(t.pattern=AS),wt.init(e,t)}),wC=Z("$ZodXID",(e,t)=>{t.pattern??(t.pattern=TS),wt.init(e,t)}),SC=Z("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=IS),wt.init(e,t)}),CC=Z("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=YS(t)),wt.init(e,t)}),EC=Z("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=US),wt.init(e,t)}),DC=Z("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=HS(t)),wt.init(e,t)}),kC=Z("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=PS),wt.init(e,t)}),AC=Z("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$S),wt.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv4"})}),TC=Z("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=LS),wt.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),IC=Z("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=zS),wt.init(e,t)}),MC=Z("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=BS),wt.init(e,t),e._zod.check=r=>{const[n,o]=r.value.split("/");try{if(!o)throw new Error;const s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Qp(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const PC=Z("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=FS),wt.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{Qp(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function OC(e){if(!Hp.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Qp(r)}const jC=Z("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Hp),wt.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{OC(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),RC=Z("$ZodE164",(e,t)=>{t.pattern??(t.pattern=VS),wt.init(e,t)});function NC(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const $C=Z("$ZodJWT",(e,t)=>{wt.init(e,t),e._zod.check=r=>{NC(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Xp=Z("$ZodNumber",(e,t)=>{Mt.init(e,t),e._zod.pattern=e._zod.bag.pattern??GS,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),LC=Z("$ZodNumber",(e,t)=>{eC.init(e,t),Xp.init(e,t)}),zC=Z("$ZodBoolean",(e,t)=>{Mt.init(e,t),e._zod.pattern=KS,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),BC=Z("$ZodUnknown",(e,t)=>{Mt.init(e,t),e._zod.parse=r=>r}),FC=Z("$ZodNever",(e,t)=>{Mt.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Jp(e,t,r){e.issues.length&&t.issues.push(...Wp(r,e.issues)),t.value[r]=e.value}const WC=Z("$ZodArray",(e,t)=>{Mt.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>Jp(u,r,i))):Jp(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Qi(e,t,r,n){e.issues.length&&t.issues.push(...Wp(r,e.issues)),e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function eh(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape[n]._zod.traits.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=nS(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function th(e,t,r,n,o,s){const i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type;for(const d of Object.keys(t)){if(a.has(d))continue;if(u==="never"){i.push(d);continue}const f=c.run({value:t[d],issues:[]},n);f instanceof Promise?e.push(f.then(h=>Qi(h,r,d,t))):Qi(f,r,d,t)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const VC=Z("$ZodObject",(e,t)=>{Mt.init(e,t);const r=Hc(()=>eh(t));gt(e._zod,"propValues",()=>{const i=t.shape,a={};for(const c in i){const u=i[c]._zod;if(u.values){a[c]??(a[c]=new Set);for(const d of u.values)a[c].add(d)}}return a});const n=Vi,o=t.catchall;let s;e._zod.parse=(i,a)=>{s??(s=r.value);const c=i.value;if(!n(c))return i.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),i;i.value={};const u=[],d=s.shape;for(const f of s.keys){const v=d[f]._zod.run({value:c[f],issues:[]},a);v instanceof Promise?u.push(v.then(m=>Qi(m,i,f,c))):Qi(v,i,f,c)}return o?th(u,c,i,a,r.value,e):u.length?Promise.all(u).then(()=>i):i}}),UC=Z("$ZodObjectJIT",(e,t)=>{VC.init(e,t);const r=e._zod.parse,n=Hc(()=>eh(t)),o=h=>{const v=new dC(["shape","payload","ctx"]),m=n.value,p=E=>{const S=zp(E);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};v.write("const input = payload.value;");const b=Object.create(null);let w=0;for(const E of m.keys)b[E]=`key_${w++}`;v.write("const newResult = {}");for(const E of m.keys){const S=b[E],x=zp(E);v.write(`const ${S} = ${p(E)};`),v.write(`
|
|
163
163
|
if (${S}.issues.length) {
|