ad-feature-components 0.0.2 → 0.0.4
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.cjs +1377 -27
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +582 -0
- package/dist/index.d.ts +582 -0
- package/dist/index.js +1313 -0
- package/dist/index.js.map +1 -0
- package/package.json +12 -5
- package/dist/index.mjs +0 -29891
package/dist/index.cjs
CHANGED
|
@@ -1,27 +1,1377 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ge=require("react");function KR(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const K=KR(ge);function En(t,e){return t||e}function ht(t,e){return t[e]}var rn=void 0,bt=null,pm="",ah="function",uu="object",zr="prototype",Kl="__proto__",Eo="undefined",Gl="constructor",gm="Symbol",Va="length",ql="name",Kt="call",lu="toString",mm="getOwnPropertyDescriptor",un=En(Object),vm=ht(un,zr),$E=En(String),ra=ht($E,zr),du=En(Math),YE=En(Array),sh=ht(YE,zr),ei=ht(sh,"slice"),Ny="_polyfill",Oy="__nw21$polytype__";function dt(t,e){try{return{v:t.apply(this,e)}}catch(n){return{e:n}}}function GR(t,e,n){var r=dt(t,n);return r.e?e:r.v}var ef;function ch(t){return function(e){return typeof e===t}}function zE(t){var e="[object "+t+"]";return function(n){return!!(n&&qR(n)===e)}}function qR(t){return vm[lu].call(t)}function st(t){return typeof t===Eo||t===Eo}function $R(t){return t===rn}function W(t){return t===bt||st(t)}function ym(t){return t===bt||t===rn}function YR(t){return!!t||t!==rn}function zR(t){return!ef&&(ef=["string","number","boolean",Eo,"symbol","bigint"]),t!==uu&&ef.indexOf(t)!==-1}var Ce=ch("string"),Se=ch(ah);function Cn(t){return!t&&W(t)?!1:!!t&&typeof t===uu}var ke=ht(YE,"isArray"),jR=zE("Date"),hu=ch("number"),jE=ch("boolean"),Cm=zE("Error");function zi(t){return!!(t&&t.then&&Se(t.then))}function $l(t){return!(!t||GR(function(){return!(t&&0+t)},!t))}function Tm(){}function VR(){return!1}var an=En($E),QR="[object Error]";function ue(t,e){var n=pm,r=vm[lu][Kt](t);r===QR&&(t={stack:an(t.stack),message:an(t.message),name:an(t.name)});try{n=JSON.stringify(t,bt,e?typeof e=="number"?e:4:rn),n=(n?n.replace(/"(\w+)"\s*:\s{0,1}/g,"$1: "):bt)||an(t)}catch(i){n=" - "+ue(i,e)}return r+": "+n}function wn(t){throw new Error(t)}function Mr(t){throw new TypeError(t)}function uh(t){ym(t)&&Mr("Cannot convert undefined or null to object")}function WR(t){Ce(t)||Mr("'"+ue(t)+"' is not a string")}function Kn(t,e){return!!t&&vm.hasOwnProperty[Kt](t,e)}var JR=En(ht(un,mm),Tm),Mi=En(ht(un,"hasOwn"),XR);function XR(t,e){return uh(t),Kn(t,e)||!!JR(t,e)}function Le(t,e,n){if(t&&(Cn(t)||Se(t))){for(var r in t)if(Mi(t,r)&&e[Kt](t,r,t[r])===-1)break}}function ce(t,e,n){if(t)for(var r=t[Va]>>>0,i=0;i<r&&!(i in t&&e[Kt](t,t[i],i,t)===-1);i++);}var ia=lh;function lh(t,e,n){var r=e?e[t]:bt;return function(i){var o=(i?i[t]:bt)||r;if(o||n){var a=arguments;return(o||n).apply(i,o?ei[Kt](a,1):a)}Mr('"'+an(t)+'" not defined for '+ue(i))}}function ZR(t){return function(e){return e[t]}}var eb=En(ht(un,mm),Tm),Ou={e:"enumerable",c:"configurable",v:"value",w:"writable",g:"get",s:"set"};function tb(t){var e={};if(e[Ou.c]=!0,e[Ou.e]=!0,t.l){e.get=function(){return t.l.v};var n=eb(t.l,"v");n&&n.set&&(e.set=function(r){t.l.v=r})}return Le(t,function(r,i){e[Ou[r]]=$R(i)?e[Ou[r]]:i}),e}var ti=ht(un,"defineProperty"),nb=ht(un,"defineProperties");function He(t,e,n){return ti(t,e,tb(n))}function VE(t,e,n,r,i){var o={};return Le(t,function(a,s){Yl(o,a,e?s:a),Yl(o,s,a)}),r?r(o):o}function Yl(t,e,n,r){ti(t,e,{value:n,enumerable:!0,writable:!1})}var rb=En(ht(un,"isFrozen"),VR),QE=ht(un,"freeze");function ib(t){return t}function ob(t){return uh(t),t[Kl]||bt}var Fp=ht(un,"assign"),jr=ht(un,"keys");function WE(t,e){if((ke(t)||Cn(t)||Se(t))&&!rb(t)){for(var n=0;n<e.length;n++)if(e[n]===t)return t;e.push(t),Le(t,function(r,i){WE(i,e)}),rr(t)}return t}function fu(t){return QE?WE(t,[]):t}var rr=En(QE,ib),Hp=En(ht(un,"getPrototypeOf"),ob);function ab(t){return VE(t,1,0,rr)}function sb(t){return VE(t,0,0,rr)}function cb(t){var e={};return Le(t,function(n,r){Yl(e,n,r[1]),Yl(e,r[0],r[1])}),rr(e)}function ub(t){return cb(t)}var JE=sb({asyncIterator:0,hasInstance:1,isConcatSpreadable:2,iterator:3,match:4,matchAll:5,replace:6,search:7,species:8,split:9,toPrimitive:10,toStringTag:11,unscopables:12}),Dy="__tsUtils$gblCfg",tf;function XE(){var t;return typeof globalThis!==Eo&&(t=globalThis),!t&&typeof self!==Eo&&(t=self),!t&&typeof window!==Eo&&(t=window),!t&&typeof global!==Eo&&(t=global),t}function dh(){if(!tf){var t=dt(XE).v||{};tf=t[Dy]=t[Dy]||{}}return tf}var ZE=ht(du,"min"),Ac=ht(du,"max"),My=ia("slice",ra),pn=ia("substring",ra),Ai=lh("substr",ra,lb);function lb(t,e,n){return uh(t),n<0?pm:(e=e||0,e<0&&(e=Ac(e+t[Va],0)),st(n)?My(t,e):My(t,e,e+n))}function zl(t,e){return pn(t,0,e)}function db(t,e){return t&&(dt(function(){t[Ny]=!0,t[Oy]=e}),dt(He,[t,Ny,{v:!0,w:!1,e:!1}]),dt(He,[t,Oy,{v:e,w:!1,e:!1}])),t}var ni=En(ht(un,"create"),hb);function hb(t,e){var n=null;function r(){}if(ym(t))n={};else{var i=typeof t;i!==uu&&i!==ah&&Mr("Prototype must be an Object or function: "+ue(t)),r[zr]=t,dt(function(){r[Kl]=t}),n=new r}return e&&dt(nb,[n,e]),n}function ir(){return(Date.now||fb)()}function fb(){return new Date().getTime()}function _o(t,e,n){return t.apply(e,n)}var St;function Wi(){St=dh()}function e_(t,e){var n={};return!St&&Wi(),n.b=St.lzy,ti(n,"v",{configurable:!0,get:function(){var r=_o(t,null,e);return St.lzy||ti(n,"v",{value:r}),n.b=St.lzy,r}}),n}var pb=ht(du,"random"),gb=e_(function(){for(var t=ir().toString(36).slice(2);t.length<16;)t+=pb().toString(36).slice(2);return t=t.substring(0,16),t}),xy="_urid",mb="$nw21sym",nf,vb=0;function yb(){if(!nf){var t=dh();nf=t.gblSym=t.gblSym||{k:{},s:{}}}return nf}var Du;function Em(t){var e="_"+vb+++"_"+gb.v,n=gm+"("+t+")";function r(o,a){He(i,o,{v:a,e:!1,w:!1})}var i=ni(null);return r("description",an(t)),r(lu,function(){return n+mb+e}),r("valueOf",function(){return i}),r("v",n),r("_uid",e),db(i,"symbol")}function Cb(t){var e=yb();if(!Mi(e.k,t)){var n=Em(t),r=jr(e.s).length;n[xy]=function(){return r+"_"+n[lu]()},e.k[t]=n,e.s[n[xy]()]=an(t)}return e.k[t]}function Tb(t){!Du&&(Du={});var e,n=JE[t];return n&&(e=Du[n]=Du[n]||Em(gm+"."+n)),e}function Yn(t){return ti({toJSON:function(){return t}},"v",{value:t})}var t_="window",Ic;function As(t,e){var n;return function(){return!St&&Wi(),(!n||St.lzy)&&(n=Yn(dt(t,e).v)),n.v}}function Bn(t){return!St&&Wi(),(!Ic||t===!1||St.lzy)&&(Ic=Yn(dt(XE).v||bt)),Ic.v}function ut(t,e){var n;if(!Ic||e===!1?n=Bn(e):n=Ic.v,n&&n[t])return n[t];if(t===t_)try{return window}catch{}return bt}function n_(){return!!Ft()}var Ft=As(ut,["document"]);function hh(){return!!kn()}var kn=As(ut,[t_]);function Eb(){return!!xr()}var xr=As(ut,["navigator"]);function _b(){return!!r_()}var r_=As(ut,["history"]),Sb=As(function(){return!!dt(function(){return process&&(process.versions||{}).node}).v}),i_=As(function(){return!!dt(function(){return self&&self instanceof WorkerGlobalScope}).v}),ps,rf;function fh(){return ps=Yn(dt(ut,[gm]).v),ps}function Ab(t){var e=(St.lzy?0:ps)||fh();return e.v?e.v[t]:rn}function Ib(){return!!wb()}function wb(){return!St&&Wi(),((St.lzy?0:ps)||fh()).v}function _m(t,e){var n=JE[t];!St&&Wi();var r=(St.lzy?0:ps)||fh();return r.v?r.v[n||t]:Tb(t)}function Fs(t,e){!St&&Wi();var n=(St.lzy?0:ps)||fh();return n.v?n.v(t):Em(t)}function Sm(t){return!St&&Wi(),rf=(St.lzy?0:rf)||Yn(dt(Ab,["for"]).v),(rf.v||Cb)(t)}function Bp(t){return!!t&&Se(t.next)}function o_(t){return!ym(t)&&Se(t[_m(3)])}var Mu;function Am(t,e,n){if(t&&(Bp(t)||(!Mu&&(Mu=Yn(_m(3))),t=t[Mu.v]?t[Mu.v]():bt),Bp(t))){var r=rn,i=rn;try{for(var o=0;!(i=t.next()).done&&e[Kt](n||t,i.value,o,t)!==-1;)o++}catch(a){r={e:a},t.throw&&(i=bt,t.throw(r))}finally{try{i&&!i.done&&t.return&&t.return(i)}finally{if(r)throw r.e}}}}function qa(t,e){return!st(e)&&t&&(ke(e)?_o(t.push,t,e):Bp(e)||o_(e)?Am(e,function(n){t.push(n)}):t.push(e)),t}var Wt=ia("indexOf",sh),Lc=ia("map",sh);function ph(t,e,n){return((t?t.slice:bt)||ei).apply(t,ei[Kt](arguments,1))}var Rb=ia("reduce",sh),of,a_=En(ht(un,"setPrototypeOf"),bb);function bb(t,e){var n;return!of&&(of=Yn((n={},n[Kl]=[],n instanceof Array))),of.v?t[Kl]=e:Le(e,function(r,i){return t[r]=i}),t}function kb(t,e,n){dt(He,[e,ql,{v:t,c:!0,e:!1}]),e=a_(e,n);function r(){this[Gl]=e,dt(He,[this,ql,{v:t,c:!0,e:!1}])}return e[zr]=n===bt?ni(n):(r[zr]=n[zr],new r),e}function Uy(t,e){e&&(t[ql]=e)}function s_(t,e,n){var r=Error,i=r[zr][ql],o=Error.captureStackTrace;return kb(t,function(){var a=this,s=arguments;try{dt(Uy,[r,t]);var c=_o(r,a,ei[Kt](s))||a;if(c!==a){var u=Hp(a);u!==Hp(c)&&a_(c,u)}return o&&o(c,a[Gl]),e&&e(c,s),c}finally{dt(Uy,[r,i])}},r)}var af;function Pb(t){throw af||(af=s_("UnsupportedError")),new af(t)}function Nb(t){return function(n){return uh(n),n&&n.replace&&(n=n.replace(t,pm)),n}}var Ob=Nb(/^\s+|(?=\s)\s+$/g),Je=lh("trim",ra,Ob),bn=ht(du,"floor"),sf,cf,uf;function sn(t){if(!t||typeof t!==uu)return!1;uf||(uf=hh()?kn():!0);var e=!1;if(t!==uf){cf||(sf=Function[zr][lu],cf=sf[Kt](un));try{var n=Hp(t);e=!n,e||(Kn(n,Gl)&&(n=n[Gl]),e=!!(n&&typeof n===ah&&sf[Kt](n)===cf))}catch{}}return e}function Db(t){return t.value&&u_(t),!0}var Ly=[Lb,u_,Hb,Fb];function Mb(t,e,n,r){var i;return ce(t,function(o){if(o.k===e)return i=o,-1}),i||(i={k:e,v:e},t.push(i),r(i)),i.v}function Im(t,e,n,r){var i=n.handler,o=n.path?r?n.path.concat(r):n.path:[],a={handler:n.handler,src:n.src,path:o},s=typeof e,c=!1,u=e===bt;u||(e&&s===uu?c=sn(e):u=zR(s));var l={type:s,isPrim:u,isPlain:c,value:e,result:e,path:o,origin:n.src,copy:function(d,p){return Im(t,d,p?a:n,p)},copyTo:function(d,p){return c_(t,d,p,a)}};return l.isPrim?i&&i[Kt](n,l)?l.result:e:Mb(t,e,o,function(d){He(l,"result",{g:function(){return d.v},s:function(f){d.v=f}});for(var p=0,h=i;!(h||(p<Ly.length?Ly[p++]:Db))[Kt](n,l);)h=bt})}function c_(t,e,n,r){if(!W(n))for(var i in n)e[i]=Im(t,n[i],r,i);return e}function xb(t,e,n){var r={handler:n,src:e,path:[]};return c_([],t,e,r)}function Ub(t,e){var n={handler:e,src:t};return Im([],t,n)}function Lb(t){var e=t.value;if(ke(e)){var n=t.result=[];return n.length=e.length,t.copyTo(n,e),!0}return!1}function Fb(t){var e=t.value;return jR(e)?(t.result=new Date(e.getTime()),!0):!1}function Hb(t){return t.type===ah}function u_(t){var e=t.value;if(e&&t.isPlain){var n=t.result={};return t.copyTo(n,e),!0}return!1}function l_(t,e){return ce(e,function(n){xb(t,n)}),t}function Fy(t,e,n,r,i,o,a){return l_(Ub(t)||{},ei[Kt](arguments))}function Bb(t,e,n,r,i,o,a){return l_(t||{},ei[Kt](arguments))}var d_=ia("split",ra);function h_(t,e,n){if(t&&e){var r=d_(e,"."),i=r.pop();ce(r,function(o){W(t[o])&&(t[o]={}),t=t[o]}),t[i]=n}}var Kb=ZR(Va),lf;function ri(){return!St&&Wi(),(!lf||St.lzy)&&(lf=Yn(dt(ut,["performance"]).v)),lf.v}var f_=ht(du,"round"),Gb=En(ht(un,mm),Tm),p_=lh("endsWith",ra,qb);function qb(t,e,n){WR(t);var r=Ce(e)?e:an(e),i=!st(n)&&n<t[Va]?n:t[Va];return pn(t,i-r[Va],i)===r}var gt=ia("indexOf",ra),df="ref",hf="unref",ff="hasRef",$b="enabled";function Yb(t,e,n){var r=!0,i=t?e(bt):bt,o;function a(){return r=!1,i&&i[hf]&&i[hf](),o}function s(){i&&n(i),i=bt}function c(){return i=e(i),r||a(),o}function u(l){!l&&i&&s(),l&&!i&&c()}return o={cancel:s,refresh:c},o[ff]=function(){return i&&i[ff]?i[ff]():r},o[df]=function(){return r=!0,i&&i[df]&&i[df](),o},o[hf]=a,o=ti(o,$b,{get:function(){return!!i},set:u}),{h:o,dn:function(){i=bt}}}var zb,jb;function Vb(t){var e=Se(t)?t:zb;if(!e){var n=dh().tmOut||[];ke(n)&&n.length>0&&Se(n[0])&&(e=n[0])}return e||setTimeout}function Qb(t){var e=Se(t)?t:jb;if(!e){var n=dh().tmOut||[];ke(n)&&n.length>1&&Se(n[1])&&(e=n[1])}return e||clearTimeout}function g_(t,e,n){var r=ke(e),i=r?e.length:0,o=Vb(i>0?e[0]:r?rn:e),a=Qb(i>1?e[1]:rn),s=n[0];n[0]=function(){c.dn(),_o(s,rn,ei[Kt](arguments))};var c=Yb(t,function(u){if(u){if(u.refresh)return u.refresh(),u;_o(a,rn,[u])}return _o(o,rn,n)},function(u){_o(a,rn,[u])});return c.h}function Gn(t,e){return g_(!0,rn,ei[Kt](arguments))}function Wb(t,e){return g_(!1,rn,ei[Kt](arguments))}var xu,jl="constructor",ii="prototype",Vl="function",Ql="_dynInstFuncs",Kp="_isDynProxy",Qa="_dynClass",Jb="_dynCls$",Gp="_dynInstChk",Fc=Gp,m_="_dfOpts",Hy="_unknown_",wm="__proto__",Uu="_dyn"+wm,By="__dynProto$Gbl",pf="_dynInstProto",pl="useBaseInst",qp="setInstFuncs",Rm=Object,Hc=Rm.getPrototypeOf,Ky=Rm.getOwnPropertyNames,Gy=Bn(),$p=Gy[By]||(Gy[By]={o:(xu={},xu[qp]=!0,xu[pl]=!0,xu),n:1e3});function gl(t){return t&&(t===Rm[ii]||t===Array[ii])}function bm(t){return gl(t)||t===Function[ii]}function Go(t){var e;if(t){if(Hc)return Hc(t);var n=t[wm]||t[ii]||(t[jl]?t[jl][ii]:null);e=t[Uu]||n,Kn(t,Uu)||(delete t[pf],e=t[Uu]=t[pf]||t[Uu],t[pf]=n)}return e}function Wl(t,e){var n=[];if(Ky)n=Ky(t);else for(var r in t)typeof r=="string"&&Kn(t,r)&&n.push(r);if(n&&n.length>0)for(var i=0;i<n.length;i++)e(n[i])}function km(t,e,n){return e!==jl&&typeof t[e]===Vl&&(n||Kn(t,e))&&e!==wm&&e!==ii}function Jl(t){Mr("DynamicProto: "+t)}function Xb(t){var e=ni(null);return Wl(t,function(n){!e[n]&&km(t,n,!1)&&(e[n]=t[n])}),e}function Pm(t,e){for(var n=t.length-1;n>=0;n--)if(t[n]===e)return!0;return!1}function Zb(t,e,n,r){function i(c,u,l){var d=u[l];if(d[Kp]&&r){var p=c[Ql]||{};p[Fc]!==!1&&(d=(p[u[Qa]]||{})[l]||d)}return function(){return d.apply(c,arguments)}}var o=ni(null);Wl(n,function(c){o[c]=i(e,n,c)});for(var a=Go(t),s=[];a&&!bm(a)&&!Pm(s,a);)Wl(a,function(c){!o[c]&&km(a,c,!Hc)&&(o[c]=i(e,a,c))}),s.push(a),a=Go(a);return o}function ek(t,e,n,r){var i=null;if(t&&Kn(n,Qa)){var o=t[Ql]||ni(null);if(i=(o[n[Qa]]||ni(null))[e],i||Jl("Missing ["+e+"] "+Vl),!i[Gp]&&o[Fc]!==!1){for(var a=!Kn(t,e),s=Go(t),c=[];a&&s&&!bm(s)&&!Pm(c,s);){var u=s[e];if(u){a=u===r;break}c.push(s),s=Go(s)}try{a&&(t[e]=i),i[Gp]=1}catch{o[Fc]=!1}}}return i}function tk(t,e,n){var r=e[t];return r===n&&(r=Go(e)[t]),typeof r!==Vl&&Jl("["+t+"] is not a "+Vl),r}function nk(t,e,n,r,i){function o(c,u){var l=function(){var d=ek(this,u,c,l)||tk(u,c,l);return d.apply(this,arguments)};return l[Kp]=1,l}if(!gl(t)){var a=n[Ql]=n[Ql]||ni(null);if(!gl(a)){var s=a[e]=a[e]||ni(null);a[Fc]!==!1&&(a[Fc]=!!i),gl(s)||Wl(n,function(c){km(n,c,!1)&&n[c]!==r[c]&&(s[c]=n[c],delete n[c],(!Kn(t,c)||t[c]&&!t[c][Kp])&&(t[c]=o(t,c)))})}}}function rk(t,e){if(Hc){for(var n=[],r=Go(e);r&&!bm(r)&&!Pm(n,r);){if(r===t)return!0;n.push(r),r=Go(r)}return!1}return!0}function gf(t,e){return Kn(t,ii)?t.name||e||Hy:((t||{})[jl]||{}).name||e||Hy}function it(t,e,n,r){Kn(t,ii)||Jl("theClass is an invalid class definition.");var i=t[ii];rk(i,e)||Jl("["+gf(t)+"] not in hierarchy of ["+gf(e)+"]");var o=null;Kn(i,Qa)?o=i[Qa]:(o=Jb+gf(t,"_")+"$"+$p.n,$p.n++,i[Qa]=o);var a=it[m_],s=!!a[pl];s&&r&&r[pl]!==void 0&&(s=!!r[pl]);var c=Xb(e),u=Zb(i,e,c,s);n(e,u);var l=!!Hc&&!!a[qp];l&&r&&(l=!!r[qp]),nk(i,o,e,c,l!==!1)}it[m_]=$p.o;var v_="function",y_="object",Nm="undefined",Ir="prototype",Om=Object,ik=Om[Ir];(Bn()||{}).Symbol;(Bn()||{}).Reflect;var C_="hasOwnProperty",ok=function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)ik[C_].call(e,i)&&(t[i]=e[i])}return t},cn=Fp||ok,Yp=function(t,e){return Yp=Om.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)r[C_](i)&&(n[i]=r[i])},Yp(t,e)};function ui(t,e){typeof e!==v_&&e!==null&&Mr("Class extends value "+String(e)+" is not a constructor or null"),Yp(t,e);function n(){this.constructor=t}t[Ir]=e===null?ni(e):(n[Ir]=e[Ir],new n)}function qy(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t}var T_=ab,ak=ub,_i=T_({NONE:0,PENDING:3,INACTIVE:1,ACTIVE:2}),gs="toLowerCase",Ee="length",Xl="warnToConsole",pu="throwInternal",No="watch",qo="apply",xe="push",oa="splice",Et="logger",vo="cancel",gu="initialize",Ii="identifier",Zl="removeNotificationListener",ed="addNotificationListener",Er="isInitialized",Lu="getNotifyMgr",Bc="getPlugin",$o="name",on="processNext",E_="getProcessTelContext",So="value",$a="enabled",$y="stopPollingInternalLogs",Yo="unload",Fu="onComplete",zp="version",__="loggingLevelConsole",zo="createNew",qr="teardown",td="messageId",Oo="message",Vr="diagLog",nd="_doTeardown",Kc="update",wr="getNext",Gc="setNextPlugin",jp="userAgent",jo="split",Do="replace",Vp="substring",S_="indexOf",xi="type",Yy="evtName",Kr="status",zy="getAllResponseHeaders",Qp="isChildEvt",Vn="data",Wa="getCtx",mr="setCtx",jy="itemsReceived",Hu="headers",Hs="urlString",ya="timeout",Wp="traceFlags",mf="getAttribute",vf;function sk(t,e){vf||(vf=s_("AggregationError",function(r,i){i[Ee]>1&&(r.errors=i[1])}));var n=t;throw ce(e,function(r,i){n+=`
|
|
2
|
-
`.concat(i," > ").concat(ue(r))}),new vf(n,e||[])}var rd="Promise",Dm="rejected";function gn(t,e){return Mm(t,function(n){return e?e({status:"fulfilled",rejected:!1,value:n}):n},function(n){return e?e({status:Dm,rejected:!0,reason:n}):n})}function Mm(t,e,n,r){var i=t;if(zi(t))(e||n)&&(i=t.then(e,n));else try{e&&(i=e(t))}catch(o){if(n)i=n(o);else throw o}return i}var A_=["pending","resolving","resolved",Dm],Vy="dispatchEvent",Bu;function ck(t){var e;return t&&t.createEvent&&(e=t.createEvent("Event")),!!e&&e.initEvent}function uk(t,e,n,r){var i=Ft();!Bu&&(Bu=Yn(!!dt(ck,[i]).v));var o=Bu.v?i.createEvent("Event"):r?new Event(e):{};if(n&&n(o),Bu.v&&o.initEvent(e,!1,!0),o&&t[Vy])t[Vy](o);else{var a=t["on"+e];if(a)a(o);else{var s=ut("console");s&&(s.error||s.log)(e,ue(o))}}}var I_="unhandledRejection",lk=I_.toLowerCase(),Qy=[],dk=0,hk=10,yf;function Wy(t){return Se(t)?t.toString():ue(t)}function w_(t,e,n){var r=ph(arguments,3),i=0,o=!1,a,s=[],c=dk++,u=!1,l=null,d;function p(R,A){try{Qy.push(c),u=!0,l&&l.cancel(),l=null;var M=t(function(b,_){s.push(function(){try{var F=i===2?R:A,B=st(F)?a:Se(F)?F(a):F;zi(B)?B.then(b,_):F?b(B):i===3?_(B):b(B)}catch(Q){_(Q)}}),o&&m()},r);return M}finally{Qy.pop()}}function h(R){return p(void 0,R)}function f(R){var A=R,M=R;return Se(R)&&(A=function(b){return R&&R(),b},M=function(b){throw R&&R(),b}),p(A,M)}function g(){return A_[i]}function m(){if(s.length>0){var R=s.slice();s=[],u=!0,l&&l.cancel(),l=null,e(R)}}function v(R,A){return function(M){if(i===A){if(R===2&&zi(M)){i=1,M.then(v(2,1),v(3,1));return}i=R,o=!0,a=M,m(),!u&&R===3&&!l&&(l=Gn(y,hk))}}}function y(){if(!u)if(u=!0,Sb())process.emit(I_,a,d);else{var R=kn()||Bn();!yf&&(yf=Yn(dt(ut,[rd+"RejectionEvent"]).v)),uk(R,lk,function(A){return He(A,"promise",{g:function(){return d}}),A.reason=a,A},!!yf.v)}}d={then:p,catch:h,finally:f},ti(d,"state",{get:g}),Ib()&&(d[_m(11)]="IPromise");function I(){return"IPromise "+g()+(o?" - "+Wy(a):"")}return d.toString=I,(function(){Se(n)||Mr(rd+": executor is not a function - "+Wy(n));var A=v(3,0);try{n.call(d,v(2,0),A)}catch(M){A(M)}})(),d}function fk(t){return function(e){var n=ph(arguments,1);return t(function(r,i){try{var o=[],a=1;Am(e,function(s,c){s&&(a++,Mm(s,function(u){o[c]=u,--a===0&&r(o)},i))}),a--,a===0&&r(o)}catch(s){i(s)}},n)}}function pk(t){return Yn(function(e){var n=ph(arguments,1);return t(function(r,i){var o=[],a=1;function s(c,u){a++,gn(c,function(l){l.rejected?o[u]={status:Dm,reason:l.reason}:o[u]={status:"fulfilled",value:l.value},--a===0&&r(o)})}try{ke(e)?ce(e,s):o_(e)?Am(e,s):Mr("Input is not an iterable"),a--,a===0&&r(o)}catch(c){i(c)}},n)})}function R_(t){ce(t,function(e){try{e()}catch{}})}function gk(t){var e=hu(t)?t:0;return function(n){Gn(function(){R_(n)},e)}}function b_(t,e){return w_(b_,gk(e),t,e)}var Cf;function mk(t,e){!Cf&&(Cf=Yn(dt(ut,[rd]).v||null));var n=Cf.v;if(!n)return b_(t);Se(t)||Mr(rd+": executor is not a function - "+ue(t));var r=0;function i(){return A_[r]}var o=new n(function(a,s){function c(l){r=2,a(l)}function u(l){r=3,s(l)}t(c,u)});return ti(o,"state",{get:i}),o}var Tf;function qc(t){return w_(qc,R_,t)}function vk(t,e){return!Tf&&(Tf=pk(qc)),Tf.v(t,e)}var Ef;function Pr(t,e){return!Ef&&(Ef=Yn(mk)),Ef.v.call(this,t,e)}var yk=fk(Pr),yr=void 0,Fe="",Oa="channels",Ot="core",Jp="createPerfMgr",Xp="disabled",Ja="extensionConfig",Da="extensions",Nr="processTelemetry",id="priority",ml="eventsSent",wc="eventsDiscarded",vl="eventsSendRequest",Ao="perfEvent",_f="offlineEventsStored",Sf="offlineBatchSent",Af="offlineBatchDrop",od="getPerfMgr",Zp="domain",If="path",Ck="Not dynamic - ",Tk="REDACTED",Jy=["sig","Signature","AWSAccessKeyId","X-Goog-Signature"],Ek="getPrototypeOf",_k=/-([a-z])/g,Sk=/([^\w\d_$])/g,Ak=/^(\d+[\w\d_$])/,Ik=Object[Ek];function Mo(t){return!W(t)}function ad(t){var e=t;return e&&Ce(e)&&(e=e[Do](_k,function(n,r){return r.toUpperCase()}),e=e[Do](Sk,"_"),e=e[Do](Ak,function(n,r){return"_"+r})),e}function zt(t,e){return t&&e?gt(t,e)!==-1:!1}function ms(t){return t&&t.toISOString()||""}function $e(t){return Cm(t)?t[$o]:Fe}function et(t,e,n,r,i){var o=n;return t&&(o=t[e],o!==n&&(!i||i(o))&&(!r||r(n))&&(o=n,t[e]=o)),o}function Xt(t,e,n){var r;return t?(r=t[e],!r&&W(r)&&(r=st(n)?{}:n,t[e]=r)):r=st(n)?{}:n,r}function k_(t,e){var n=null,r=null;return Se(t)?n=t:r=t,function(){var i=arguments;if(n&&(r=n()),r)return r[e][qo](r,i)}}function wk(t,e,n){if(t&&e&&Cn(t)&&Cn(e)){var r=function(o){if(Ce(o)){var a=e[o];Se(a)?(!n||n(o,!0,e,t))&&(t[o]=k_(e,o)):(!n||n(o,!1,e,t))&&(Mi(t,o)&&delete t[o],He(t,o,{g:function(){return e[o]},s:function(s){e[o]=s}}))}};for(var i in e)r(i)}return t}function sd(t,e,n,r,i){t&&e&&n&&(t[e]=k_(n,r))}function hc(t,e,n,r){return t&&e&&Cn(t)&&ke(n)&&ce(n,function(i){Ce(i)&&sd(t,i,e,i)}),t}function Rk(t){return(function(){function e(){var n=this;t&&Le(t,function(r,i){n[r]=i})}return e})()}function P_(t){return t&&Fp&&(t=Om(Fp({},t))),t}function N_(t,e,n,r,i,o){var a=arguments,s=a[0]||{},c=a[Ee],u=!1,l=1;for(c>0&&jE(s)&&(u=s,s=a[l]||{},l++),Cn(s)||(s={});l<c;l++){var d=a[l],p=ke(d),h=Cn(d);for(var f in d){var g=p&&f in d||h&&Mi(d,f);if(g){var m=d[f],v=void 0;if(u&&m&&((v=ke(m))||sn(m))){var y=s[f];v?ke(y)||(y=[]):sn(y)||(y={}),m=N_(u,y,m)}m!==void 0&&(s[f]=m)}}}return s}function yl(t,e,n){var r=e&&e.featureOptIn&&e.featureOptIn[t];if(t&&r){var i=r.mode;if(i===3)return!0;if(i===2)return!1}return n}function cd(t){try{return t.responseText}catch{}return null}function O_(t,e){return t?"XDomainRequest,Response:"+cd(t)||"":e}function ud(t,e){return t?"XMLHttpRequest,Status:"+t[Kr]+",Response:"+cd(t)||t.response||"":e}function Xy(t,e){return e&&(hu(e)?t=[e].concat(t):ke(e)&&(t=e.concat(t))),t}var bk="Microsoft_ApplicationInsights_BypassAjaxInstrumentation",Zy="withCredentials",kk="timeout";function Pk(t,e,n,r,i,o){i===void 0&&(i=!1);function a(c,u,l){try{c[u]=l}catch{}}var s=new XMLHttpRequest;return a(s,bk,r),n&&a(s,Zy,n),s.open(t,e,!i),n&&a(s,Zy,n),!i&&o&&a(s,kk,o),s}function Nk(t){var e={};if(Ce(t)){var n=Je(t)[jo](/[\r\n]+/);ce(n,function(r){if(r){var i=r[S_](": ");if(i!==-1){var o=Je(r.substring(0,i))[gs](),a=Je(r[Vp](i+1));e[o]=a}else e[Je(r)]=1}})}return e}function wf(t,e,n){if(!t[n]&&e&&e.getResponseHeader){var r=e.getResponseHeader(n);r&&(t[n]=Je(r))}return t}var Ok="kill-duration",Dk="kill-duration-seconds",Mk="time-delta-millis";function Rf(t,e){var n={};return t[zy]?n=Nk(t[zy]()):e&&(n=wf(n,t,Mk),n=wf(n,t,Ok),n=wf(n,t,Dk)),n}var xk="documentMode",Uk="location",Lk="console",D_="JSON",Fk="crypto",Hk="msCrypto",Bk="ReactNative",eg="msie",tg="trident/",M_="XMLHttpRequest",bf=null,kf=null,Ca=null,Pf=null;function x_(t,e){var n=!1;if(t){try{if(n=e in t,!n){var r=t[Ir];r&&(n=e in r)}}catch{}if(!n)try{var i=new t;n=!st(i[e])}catch{}}return n}function _r(t){return typeof location===y_&&location?location:ut(Uk)}function Kk(){return typeof console!==Nm?console:ut(Lk)}function mu(){return!!(typeof JSON===y_&&JSON||ut(D_)!==null)}function or(){return mu()?JSON||ut(D_):null}function Gk(){return ut(Fk)}function qk(){return ut(Hk)}function $k(){var t=xr();return t&&t.product?t.product===Bk:!1}function ng(){var t=xr();if(t&&(t[jp]!==kf||bf===null)){kf=t[jp];var e=(kf||Fe)[gs]();bf=zt(e,eg)||zt(e,tg)}return bf}function U_(t){if(t===void 0&&(t=null),!t){var e=xr()||{};t=e?(e.userAgent||Fe)[gs]():Fe}var n=(t||Fe)[gs]();if(zt(n,eg)){var r=Ft()||{};return Ac(parseInt(n[jo](eg)[1]),r[xk]||0)}else if(zt(n,tg)){var i=parseInt(n[jo](tg)[1]);if(i)return i+4}return null}function fc(t){return(Pf===null||t===!1)&&(Pf=Eb()&&!!xr().sendBeacon),Pf}function xm(t){var e=!1;try{e=!!ut("fetch");var n=ut("Request");e&&t&&n&&(e=x_(n,"keepalive"))}catch{}return e}function Yk(){return Ca===null&&(Ca=typeof XDomainRequest!==Nm,Ca&&gh()&&(Ca=Ca&&!x_(ut(M_),"withCredentials"))),Ca}function gh(){var t=!1;try{var e=ut(M_);t=!!e}catch{}return t}function zk(t,e){return t&&t.dispatchEvent&&e?(t.dispatchEvent(e),!0):!1}function jk(t,e){var n=null,r={detail:e||null};if(Se(CustomEvent))n=new CustomEvent(t,r);else{var i=Ft();i&&i.createEvent&&(n=i.createEvent("CustomEvent"),n.initCustomEvent(t,!0,!0,r))}return n}function Vk(t,e,n){var r=Bn();if(r&&r.CustomEvent)try{var i={cfg:e||null,customDetails:n||null};return zk(r,jk(t,i))}catch{}return!1}function Qk(t){return t.replace(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)([^:@]{1,200}):([^@]{1,200})@(.*)$/,"$1REDACTED:REDACTED@$4")}function Wk(t,e){var n,r=gt(t,"?");if(r===-1)return t;e&&e.redactQueryParams?n=Jy.concat(e.redactQueryParams):n=Jy;var i=pn(t,0,r+1),o=pn(t,r+1),a=Fe,s=gt(o,"#");s!==-1&&(a=pn(o,s),o=pn(o,0,s));for(var c=!1,u=0;u<n[Ee];u++){var l=n[u]+"=";if(gt(o,l)!==-1){c=!0;break}}if(!c)return t;var d=[],p=!1;if(o&&o[Ee])for(var h=o[jo]("&"),u=0;u<h[Ee];u++){var f=h[u];if(f){var g=gt(f,"=");if(g===-1)d[xe](f);else{var m=f[Vp](0,g),v=f[Vp](g+1);if(v===Fe)d[xe](f);else{for(var y=!1,I=0;I<n[Ee];I++)if(m===n[I]){y=!0,p=!0;break}y?d[xe](m+"="+Tk):d[xe](f)}}}}return p?i+d.join("&")+a:t}function $r(t,e){if(!t||!Ce(t)||t[S_](" ")!==-1)return t;var n=e&&e.redactUrls===!1;if(n)return t;var r=gt(t,"@")!==-1,i=gt(t,"?")!==-1;if(!r&&!i)return t;try{var o=t;return r&&(o=Qk(t)),i&&(o=Wk(o,e)),o}catch{return t}}var L_=4294967296,Ui=4294967295,F_=123456789,H_=987654321,B_=!1,pc=F_,gc=H_;function Jk(t){t<0&&(t>>>=0),pc=F_+t&Ui,gc=H_-t&Ui,B_=!0}function Xk(){try{var t=ir()&2147483647;Jk((Math.random()*L_^t)+t)}catch{}}function Zk(t){return bn($c()/Ui*(t+1))>>>0}function $c(t){var e=0,n=Gk()||qk();return n&&n.getRandomValues&&(e=n.getRandomValues(new Uint32Array(1))[0]&Ui),e===0&&ng()&&(B_||Xk(),e=eP()&Ui),e===0&&(e=bn(L_*Math.random()|0)),e>>>=0,e}function eP(t){gc=36969*(gc&65535)+(gc>>16)&Ui,pc=18e3*(pc&65535)+(pc>>16)&Ui;var e=(gc<<16)+(pc&65535)>>>0&Ui|0;return e>>>=0,e}function Um(t){t===void 0&&(t=22);for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=$c()>>>0,r=0,i=Fe;i[Ee]<t;)r++,i+=e.charAt(n&63),n>>>=6,r===5&&(n=($c()<<2&4294967295|n&3)>>>0,r=0);return i}var K_="3.3.11",tP="."+Um(6),nP=0;function G_(t){return t.nodeType===1||t.nodeType===9||!+t.nodeType}function rP(t,e){var n=e[t.id];if(!n){n={};try{G_(e)&&He(e,t.id,{e:!1,v:n})}catch{}}return n}function qn(t,e){return e===void 0&&(e=!1),ad(t+nP+++(e?"."+K_:Fe)+tP)}function q_(t){var e={id:qn("_aiData-"+(t||Fe)+"."+K_),accept:function(n){return G_(n)},get:function(n,r,i,o){var a=n[e.id];return a?a[ad(r)]:(o&&(a=rP(e,n),a[ad(r)]=i),i)},kill:function(n,r){if(n&&n[r])try{delete n[r]}catch{}}};return e}function Cl(t){return t&&Cn(t)&&!ke(t)&&(t.isVal||t.fb||Mi(t,"v")||Mi(t,"mrg")||Mi(t,"ref")||t.set)}function $_(t,e,n){var r,i=n.dfVal||YR;if(e&&n.fb){var o=n.fb;ke(o)||(o=[o]);for(var a=0;a<o[Ee];a++){var s=o[a],c=e[s];if(i(c)?r=c:t&&(c=t.cfg[s],i(c)&&(r=c),t.set(t.cfg,an(s),c)),i(r))break}}return!i(r)&&i(n.v)&&(r=n.v),r}function rg(t,e,n){var r=n;if(n&&Cl(n)&&(r=$_(t,e,n)),r){Cl(r)&&(r=rg(t,e,r));var i;ke(r)?(i=[],i[Ee]=r[Ee]):sn(r)&&(i={}),i&&(Le(r,function(o,a){a&&Cl(a)&&(a=rg(t,e,a)),i[o]=a}),r=i)}return r}function Lm(t,e,n,r){var i,o,a,s=r,c,u,l,d;Cl(s)?(i=s.isVal,o=s.set,l=s.rdOnly,d=s.blkVal,c=s.mrg,u=s.ref,!u&&st(u)&&(u=!!c),a=$_(t,e,s)):a=r,d&&t.blkVal(e,n);var p,h=!0,f=e[n];(f||!W(f))&&(p=f,h=!1,i&&p!==a&&!i(p)&&(p=a,h=!0),o&&(p=o(p,a,e),h=p===a)),h?a?p=rg(t,e,a):p=a:(sn(p)||ke(a))&&c&&a&&(sn(a)||ke(a))&&Le(a,function(g,m){Lm(t,p,g,m)}),t.set(e,n,p),u&&t.ref(e,n),l&&t.rdOnly(e,n)}var ji=Sm("[[ai_dynCfg_1]]"),Y_=Sm("[[ai_blkDynCfg_1]]"),iP=Sm("[[ai_frcDynCfg_1]]");function z_(t){if(t){var e;if(ke(t)?(e=[],e[Ee]=t[Ee]):sn(t)&&(e={}),e)return Le(t,function(n,r){e[n]=z_(r)}),e}return t}function oP(t){if(t){var e=t[ji]||t;if(e.cfg&&(e.cfg===t||e.cfg[ji]===e))return e}return null}function aP(t){if(t&&(sn(t)||ke(t)))try{t[Y_]=!0}catch{}return t}function Nf(t,e,n){var r=!1;return n&&!t[e.blkVal]&&(r=n[iP],!r&&!n[Y_]&&(r=sn(n)||ke(n))),r}function j_(t){Mr("InvalidAccess:"+t)}var sP=["push","pop","shift","unshift","splice"],Yc=function(t,e,n,r){t&&t[pu](3,108,"".concat(n," [").concat(e,"] failed - ")+ue(r))};function cP(t,e,n){ke(e)&&ce(sP,function(r){var i=e[r];e[r]=function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=i[qo](this,o);return dd(t,e,n,"Patching"),s}})}function ld(t,e){var n=Gb(t,e);return n&&n.get}function uP(t,e,n,r){var i={n,h:[],trk:function(u){u&&u.fn&&(Wt(i.h,u)===-1&&i.h[xe](u),t.trk(u,i))},clr:function(u){var l=Wt(i.h,u);l!==-1&&i.h[oa](l,1)}},o=!0,a=!1;function s(){o&&(a=a||Nf(s,t,r),r&&!r[ji]&&a&&(r=dd(t,r,n,"Converting")),o=!1);var u=t.act;return u&&i.trk(u),r}s[t.prop]={chng:function(){t.add(i)}};function c(u){if(r!==u){s[t.ro]&&!t.upd&&j_("["+n+"] is read-only:"+ue(e)),o&&(a=a||Nf(s,t,r),o=!1);var l=a&&s[t.rf];if(a)if(l){Le(r,function(p){r[p]=u?u[p]:yr});try{Le(u,function(p,h){mh(t,r,p,h)}),u=r}catch(p){Yc((t.hdlr||{})[Et],n,"Assigning",p),a=!1}}else r&&r[ji]&&Le(r,function(p){var h=ld(r,p);if(h){var f=h[t.prop];f&&f.chng()}});if(u!==r){var d=u&&Nf(s,t,u);!l&&d&&(u=dd(t,u,n,"Converting")),r=u,a=d}t.add(i)}}He(e,i.n,{g:s,s:c})}function mh(t,e,n,r){if(e){var i=ld(e,n),o=i&&!!i[t.prop];o?e[n]=r:uP(t,e,n,r)}return e}function Of(t,e,n,r){if(e){var i=ld(e,n),o=i&&!!i[t.prop],a=r&&r[0],s=r&&r[1],c=r&&r[2];if(!o){if(c)try{aP(e)}catch(u){Yc((t.hdlr||{})[Et],n,"Blocking",u)}try{mh(t,e,n,e[n]),i=ld(e,n)}catch(u){Yc((t.hdlr||{})[Et],n,"State",u)}}a&&(i[t.rf]=a),s&&(i[t.ro]=s),c&&(i[t.blkVal]=!0)}return e}function dd(t,e,n,r){try{Le(e,function(i,o){mh(t,e,i,o)}),e[ji]||(ti(e,ji,{get:function(){return t.hdlr}}),cP(t,e,n))}catch(i){Yc((t.hdlr||{})[Et],n,r,i)}return e}var Bs="[[ai_",Ks="]]";function lP(t){var e=Fs(Bs+"get"+t.uid+Ks),n=Fs(Bs+"ro"+t.uid+Ks),r=Fs(Bs+"rf"+t.uid+Ks),i=Fs(Bs+"blkVal"+t.uid+Ks),o=Fs(Bs+"dtl"+t.uid+Ks),a=null,s=null,c;function u(h,f){var g=c.act;try{c.act=h,h&&h[o]&&(ce(h[o],function(v){v.clr(h)}),h[o]=[]),f({cfg:t.cfg,set:t.set.bind(t),setDf:t.setDf.bind(t),ref:t.ref.bind(t),rdOnly:t.rdOnly.bind(t)})}catch(v){var m=t[Et];throw m&&m[pu](1,107,ue(v)),v}finally{c.act=g||null}}function l(){if(a){var h=a;a=null,s&&s[vo](),s=null;var f=[];if(ce(h,function(g){if(g&&(g[o]&&(ce(g[o],function(m){m.clr(g)}),g[o]=null),g.fn))try{u(g,g.fn)}catch(m){f[xe](m)}}),a)try{l()}catch(g){f[xe](g)}f[Ee]>0&&sk("Watcher error(s): ",f)}}function d(h){if(h&&h.h[Ee]>0){a||(a=[]),s||(s=Gn(function(){s=null,l()},0));for(var f=0;f<h.h[Ee];f++){var g=h.h[f];g&&Wt(a,g)===-1&&a[xe](g)}}}function p(h,f){if(h){var g=h[o]=h[o]||[];Wt(g,f)===-1&&g[xe](f)}}return c={prop:e,ro:n,rf:r,blkVal:i,hdlr:t,add:d,notify:l,use:u,trk:p},c}function dP(t,e){var n={fn:e,rm:function(){n.fn=null,t=null,e=null}};return He(n,"toJSON",{v:function(){return"WatcherHandler"+(n.fn?"":"[X]")}}),t.use(n,e),n}function hP(t,e,n){var r=oP(e);if(r)return r;var i=qn("dyncfg",!0),o=e&&n!==!1?e:z_(e),a;function s(){a.notify()}function c(m,v,y){try{m=mh(a,m,v,y)}catch(I){Yc(t,v,"Setting value",I)}return m[v]}function u(m){return dP(a,m)}function l(m,v){a.use(null,function(y){var I=a.upd;try{st(v)||(a.upd=v),m(y)}finally{a.upd=I}})}function d(m,v){var y;return Of(a,m,v,(y={},y[0]=!0,y))[v]}function p(m,v){var y;return Of(a,m,v,(y={},y[1]=!0,y))[v]}function h(m,v){var y;return Of(a,m,v,(y={},y[2]=!0,y))[v]}function f(m,v){return v&&Le(v,function(y,I){Lm(g,m,y,I)}),m}var g={uid:null,cfg:o,logger:t,notify:s,set:c,setDf:f,watch:u,ref:d,rdOnly:p,blkVal:h,_block:l};return He(g,"uid",{c:!1,e:!1,w:!1,v:i}),a=lP(g),dd(a,o,"config","Creating"),g}function fP(t,e){t?(t[Xl](e),t[pu](2,108,e)):j_(e)}function $n(t,e,n,r){var i=hP(n,t||{},r);return e&&i.setDf(i.cfg,e),i}function vt(t,e,n){var r=t[ji]||t;return r.cfg&&(r.cfg===t||r.cfg[ji]===r)?r[No](e):(fP(n,Ck+ue(t)),$n(t,null,n)[No](e))}function Ya(t,e){if(t&&t[Yo])return t[Yo](e)}function V_(t,e,n){var r;return n||(r=Pr(function(i){n=i})),t&&Kb(t)>0?gn(Ya(t[0],e),function(){V_(ph(t,1),e,n)}):n(),r}var pP=500,eC="Microsoft_ApplicationInsights_BypassAjaxInstrumentation";function gP(t,e,n){return!t&&W(t)?e:jE(t)?t:an(t)[gs]()==="true"}function Jn(t){return{mrg:!0,v:t}}function tC(t,e){return{set:t,v:e}}function hd(t,e,n){return{fb:n,isVal:t,v:e}}function _t(t,e){return{fb:e,set:gP,v:!!t}}function mP(t){return{isVal:Ce,v:an(Fe)}}var Df=[ml,wc,vl,Ao],fd=null,Ku;function vP(t,e){return function(){var n=arguments,r=Q_(e);if(r){var i=r.listener;i&&i[t]&&i[t][qo](i,n)}}}function yP(){var t=ut("Microsoft");return t&&(fd=t.ApplicationInsights),fd}function Q_(t){var e=fd;return!e&&t.disableDbgExt!==!0&&(e=fd||yP()),e?e.ChromeDbgExt:null}function CP(t){if(!Ku){Ku={};for(var e=0;e<Df[Ee];e++)Ku[Df[e]]=vP(Df[e],t)}return Ku}var Ta,W_="warnToConsole",TP="AI (Internal): ",EP="AI: ",_P="AITR_",SP={loggingLevelConsole:0,loggingLevelTelemetry:1,maxMessageLimit:25,enableDebug:!1},AP=(Ta={},Ta[0]=null,Ta[1]="errorToConsole",Ta[2]=W_,Ta[3]="debugToConsole",Ta);function nC(t){return t?'"'+t[Do](/\"/g,Fe)+'"':Fe}function Mf(t,e){var n=Kk();if(n){var r="log";n[t]&&(r=t),Se(n[r])&&n[r](e)}}var zc=(function(){function t(e,n,r,i){r===void 0&&(r=!1);var o=this;o[td]=e,o[Oo]=(r?EP:TP)+e;var a=Fe;mu()&&(a=or().stringify(i));var s=(n?" message:"+nC(n):Fe)+(i?" props:"+nC(a):Fe);o[Oo]+=s}return t.dataType="MessageData",t})();function aa(t,e){return(t||{})[Et]||new pd(e)}var pd=(function(){function t(e){this.identifier="DiagnosticLogger",this.queue=[];var n=0,r={},i,o,a,s,c;it(t,this,function(u){c=d(e||{}),u.consoleLoggingLevel=function(){return i},u[pu]=function(f,g,m,v,y){y===void 0&&(y=!1);var I=new zc(g,m,y,v);if(s)throw ue(I);var R=AP[f]||W_;if(st(I[Oo]))h("throw"+(f===1?"Critical":"Warning"),I);else{if(y){var A=+I[td];!r[A]&&i>=f&&(u[R](I[Oo]),r[A]=!0)}else i>=f&&u[R](I[Oo]);l(f,I)}},u.debugToConsole=function(f){Mf("debug",f),h("warning",f)},u[Xl]=function(f){Mf("warn",f),h("warning",f)},u.errorToConsole=function(f){Mf("error",f),h("error",f)},u.resetInternalMessageCount=function(){n=0,r={}},u.logInternalMessage=l,u[Yo]=function(f){c&&c.rm(),c=null};function l(f,g){if(!p()){var m=!0,v=_P+g[td];if(r[v]?m=!1:r[v]=!0,m&&(f<=o&&(u.queue[xe](g),n++,h(f===1?"error":"warn",g)),n===a)){var y="Internal events throttle limit per PageView reached for this app.",I=new zc(23,y,!1);u.queue[xe](I),f===1?u.errorToConsole(y):u[Xl](y)}}}function d(f){return vt($n(f,SP,u).cfg,function(g){var m=g.cfg;i=m[__],o=m.loggingLevelTelemetry,a=m.maxMessageLimit,s=m.enableDebug})}function p(){return n>=a}function h(f,g){var m=Q_(e||{});m&&m[Vr]&&m[Vr](f,g)}})}return t.__ieDyn=1,t})();function Fm(t){return t||new pd}function ne(t,e,n,r,i,o){o===void 0&&(o=!1),Fm(t)[pu](e,n,r,i,o)}function xo(t,e){Fm(t)[Xl](e)}function IP(t,e,n){Fm(t).logInternalMessage(e,n)}var xf,di,rC="toGMTString",iC="toUTCString",Hm="cookie",Uf="expires",oC="isCookieUseDisabled",jc="disableCookiesUsage",za="_ckMgr",Gu=null,Lf=null,aC=null,Rr,sC={},gd={},wP=(xf={cookieCfg:Jn((di={},di[Zp]={fb:"cookieDomain",dfVal:Mo},di.path={fb:"cookiePath",dfVal:Mo},di.enabled=yr,di.ignoreCookies=yr,di.blockedCookies=yr,di.disableCookieDefer=!1,di)),cookieDomain:yr,cookiePath:yr},xf[jc]=yr,xf);function Bm(){!Rr&&(Rr=e_(function(){return Ft()}))}function RP(t,e){var n=Tl[za]||gd[za];return n||(n=Tl[za]=Tl(t,e),gd[za]=n),n}function qu(t){return t?t.isEnabled():!0}function J_(t,e){return e&&t&&ke(t.ignoreCookies)?Wt(t.ignoreCookies,e)!==-1:!1}function cC(t,e){return e&&t&&ke(t.blockedCookies)&&Wt(t.blockedCookies,e)!==-1?!0:J_(t,e)}function uC(t,e){var n=e[$a];if(W(n)){var r=void 0;st(t[oC])||(r=!t[oC]),st(t[jc])||(r=!t[jc]),n=r}return n}function Km(t,e){var n;return t&&(n=t.getCookieMgr()),n||(n=RP(e,(t||{})[Et])),n}function Tl(t,e){var n,r,i,o,a,s,c,u,l=[];function d(m){var v,y=(v={},v[If]=m||"/",v[Uf]="Thu, 01 Jan 1970 00:00:01 GMT",v);return ng()||(y["max-age"]="0"),dC(Fe,y)}function p(m,v,y,I){var R={},A=Je(m||Fe),M=gt(A,";");if(M!==-1&&(A=Je(zl(m,M)),R=X_(pn(m,M+1))),et(R,Zp,y||i,$l,st),!W(v)){var b=ng();if(st(R[Uf])){var _=ir(),F=_+v*1e3;if(F>0){var B=new Date;B.setTime(F),et(R,Uf,lC(B,b?rC:iC)||lC(B,b?rC:iC)||Fe,$l)}}b||et(R,"max-age",Fe+v,null,st)}var Q=_r();return Q&&Q.protocol==="https:"&&(et(R,"secure",null,null,st),Lf===null&&(Lf=!kP((xr()||{})[jp])),Lf&&et(R,"SameSite","None",null,st)),et(R,If,I||r,null,st),dC(A,R)}function h(m){if(l)for(var v=l[Ee]-1;v>=0;v--)l[v].n===m&&l[oa](v,1)}function f(){Ff(e)&&l&&(ce(l,function(m){cC(n,m.n)||(m.o===0?c(m.n,m.v):m.o===1&&u(m.n,m.v))}),l=[])}t=$n(t||gd,null,e).cfg,o=vt(t,function(m){m.setDf(m.cfg,wP),n=m.ref(m.cfg,"cookieCfg"),r=n[If]||"/",i=n[Zp],n.disableCookieDefer?l=null:l===null&&(l=[]);var v=a;a=uC(t,n)!==!1,s=n.getCookie||bP,c=n.setCookie||hC,u=n.delCookie||hC,!v&&a&&l&&f()},e);var g={isEnabled:function(){var m=uC(t,n)!==!1&&a&&Ff(e),v=gd[za];return m&&v&&g!==v&&(m=qu(v)),m},setEnabled:function(m){n[$a]=m,st(t[jc])||(t[jc]=!m)},set:function(m,v,y,I,R){var A=!1,M=cC(n,m);if(!M){var b=p(v,y,I,R);qu(g)?(c(m,b),A=!0):l&&(h(m),l[xe]({n:m,o:0,v:b}),A=!0)}return A},get:function(m){var v=Fe,y=J_(n,m);if(!y){if(qu(g))v=s(m);else if(l)for(var I=l[Ee]-1;I>=0;I--){var R=l[I];if(R.n===m){if(R.o===0){var A=R.v,M=gt(A,";");v=Je(M!==-1?zl(A,M):A)}break}}}return v},del:function(m,v){var y=!1;return qu(g)?y=g.purge(m,v):l&&(h(m),l[xe]({n:m,o:1,v:d(v)}),y=!0),y},purge:function(m,v){var y=!1;return Ff(e)&&(u(m,d(v)),y=!0),y},unload:function(m){o&&o.rm(),o=null,l=null}};return g[za]=g,g}function Ff(t){if(Gu===null){Gu=!1,!Rr&&Bm();try{var e=Rr.v||{};Gu=e[Hm]!==void 0}catch(n){ne(t,2,68,"Cannot access document.cookie - "+$e(n),{exception:ue(n)})}}return Gu}function X_(t){var e={};if(t&&t[Ee]){var n=Je(t)[jo](";");ce(n,function(r){if(r=Je(r||Fe),r){var i=gt(r,"=");i===-1?e[r]=null:e[Je(zl(r,i))]=Je(pn(r,i+1))}})}return e}function lC(t,e){return Se(t[e])?t[e]():null}function dC(t,e){var n=t||Fe;return Le(e,function(r,i){n+="; "+r+(W(i)?Fe:"="+i)}),n}function bP(t){var e=Fe;if(!Rr&&Bm(),Rr.v){var n=Rr.v[Hm]||Fe;aC!==n&&(sC=X_(n),aC=n),e=Je(sC[t]||Fe)}return e}function hC(t,e){!Rr&&Bm(),Rr.v&&(Rr.v[Hm]=t+"="+e)}function kP(t){return Ce(t)?!!(zt(t,"CPU iPhone OS 12")||zt(t,"iPad; CPU OS 12")||zt(t,"Macintosh; Intel Mac OS X 10_14")&&zt(t,"Version/")&&zt(t,"Safari")||zt(t,"Macintosh; Intel Mac OS X 10_14")&&p_(t,"AppleWebKit/605.1.15 (KHTML, like Gecko)")||zt(t,"Chrome/5")||zt(t,"Chrome/6")||zt(t,"UnrealEngine")&&!zt(t,"Chrome")||zt(t,"UCBrowser/12")||zt(t,"UCBrowser/11")):!1}var PP={perfEvtsSendAll:!1};function NP(t){t.h=null;var e=t.cb;t.cb=[],ce(e,function(n){dt(n.fn,[n.arg])})}function hi(t,e,n,r){ce(t,function(i){i&&i[e]&&(n?(n.cb[xe]({fn:r,arg:i}),n.h=n.h||Gn(NP,0,n)):dt(r,[i]))})}var OP=(function(){function t(e){this.listeners=[];var n,r,i=[],o={h:null,cb:[]},a=$n(e,PP);r=a[No](function(s){n=!!s.cfg.perfEvtsSendAll}),it(t,this,function(s){He(s,"listeners",{g:function(){return i}}),s[ed]=function(c){i[xe](c)},s[Zl]=function(c){for(var u=Wt(i,c);u>-1;)i[oa](u,1),u=Wt(i,c)},s[ml]=function(c){hi(i,ml,o,function(u){u[ml](c)})},s[wc]=function(c,u,l){hi(i,wc,o,function(d){d[wc](c,u,l)})},s[vl]=function(c,u){hi(i,vl,u?o:null,function(l){l[vl](c,u)})},s[Ao]=function(c){c&&(n||!c[Qp]())&&hi(i,Ao,null,function(u){c.isAsync?Gn(function(){return u[Ao](c)},0):u[Ao](c)})},s[_f]=function(c){c&&c[Ee]&&hi(i,_f,o,function(u){u[_f](c)})},s[Sf]=function(c){c&&c[Vn]&&hi(i,Sf,o,function(u){u[Sf](c)})},s[Af]=function(c,u){if(c>0){var l=u||0;hi(i,Af,o,function(d){d[Af](c,l)})}},s[Yo]=function(c){var u=function(){r&&r.rm(),r=null,i=[],o.h&&o.h[vo](),o.h=null,o.cb=[]},l;if(hi(i,"unload",null,function(d){var p=d[Yo](c);p&&(l||(l=[]),l[xe](p))}),l)return Pr(function(d){return gn(yk(l),function(){u(),d()})});u()}})}return t.__ieDyn=1,t})(),Xa="ctx",ig="ParentContextKey",Rc="ChildrenContextKey",DP=null,El=(function(){function t(e,n,r){var i=this;if(i.start=ir(),i[$o]=e,i.isAsync=r,i[Qp]=function(){return!1},Se(n)){var o;He(i,"payload",{g:function(){return!o&&Se(n)&&(o=n(),n=null),o}})}i[Wa]=function(a){return a?a===t[ig]||a===t[Rc]?i[a]:(i[Xa]||{})[a]:null},i[mr]=function(a,s){if(a)if(a===t[ig])i[a]||(i[Qp]=function(){return!0}),i[a]=s;else if(a===t[Rc])i[a]=s;else{var c=i[Xa]=i[Xa]||{};c[a]=s}},i.complete=function(){var a=0,s=i[Wa](t[Rc]);if(ke(s))for(var c=0;c<s[Ee];c++){var u=s[c];u&&(a+=u.time)}i.time=ir()-i.start,i.exTime=i.time-a,i.complete=function(){}}}return t.ParentContextKey="parent",t.ChildrenContextKey="childEvts",t})(),MP=(function(){function t(e){this.ctx={},it(t,this,function(n){n.create=function(r,i,o){return new El(r,i,o)},n.fire=function(r){r&&(r.complete(),e&&Se(e[Ao])&&e[Ao](r))},n[mr]=function(r,i){if(r){var o=n[Xa]=n[Xa]||{};o[r]=i}},n[Wa]=function(r){return(n[Xa]||{})[r]}})}return t.__ieDyn=1,t})(),Hf="CoreUtils.doPerf";function md(t,e,n,r,i){if(t){var o=t;if(o[od]&&(o=o[od]()),o){var a=void 0,s=o[Wa](Hf);try{if(a=o.create(e(),r,i),a){if(s&&a[mr]&&(a[mr](El[ig],s),s[Wa]&&s[mr])){var c=s[Wa](El[Rc]);c||(c=[],s[mr](El[Rc],c)),c[xe](a)}return o[mr](Hf,a),n(a)}}catch(u){a&&a[mr]&&a[mr]("exception",u)}finally{a&&o.fire(a),o[mr](Hf,s)}}}return n()}function xP(){return DP}function Pi(){for(var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],e=Fe,n,r=0;r<4;r++)n=$c(),e+=t[n&15]+t[n>>4&15]+t[n>>8&15]+t[n>>12&15]+t[n>>16&15]+t[n>>20&15]+t[n>>24&15]+t[n>>28&15];var i=t[8+($c()&3)|0];return Ai(e,0,8)+Ai(e,9,4)+"4"+Ai(e,13,3)+i+Ai(e,16,3)+Ai(e,19,12)}var og="00",UP="ff",Z_="00000000000000000000000000000000",eS="0000000000000000";function vu(t,e,n){return t&&t[Ee]===e&&t!==n?!!t.match(/^[\da-f]*$/i):!1}function fC(t,e,n){return vu(t,e)?t:n}function LP(t){(isNaN(t)||t<0||t>255)&&(t=1);for(var e=t.toString(16);e[Ee]<2;)e="0"+e;return e}function pC(t,e,n,r){return{version:vu(r,2,UP)?r:og,traceId:Gm(t)?t:Pi(),spanId:qm(e)?e:zl(Pi(),16),traceFlags:n>=0&&n<=255?n:1}}function Gm(t){return vu(t,32,Z_)}function qm(t){return vu(t,16,eS)}function gC(t){if(t){var e=LP(t[Wp]);vu(e,2)||(e="01");var n=t[zp]||og;return n!=="00"&&n!=="ff"&&(n=og),"".concat(n.toLowerCase(),"-").concat(fC(t.traceId,32,Z_).toLowerCase(),"-").concat(fC(t.spanId,16,eS).toLowerCase(),"-").concat(e.toLowerCase())}return""}function FP(t){var e=t.getElementsByTagName("script"),n=[];return ce(e,function(r){var i=r[mf]("src");if(i){var o=r[mf]("crossorigin"),a=r.hasAttribute("async")===!0,s=r.hasAttribute("defer")===!0,c=r[mf]("referrerpolicy"),u={url:i};o&&(u.crossOrigin=o),a&&(u.async=a),s&&(u.defer=s),c&&(u.referrerPolicy=c),n[xe](u)}}),n}var HP=q_("plugin");function Uo(t){return HP.get(t,"state",{},!0)}function mC(t,e){for(var n=[],r=null,i=t[wr](),o;i;){var a=i[Bc]();if(a){r&&r[Gc]&&a[Nr]&&r[Gc](a),o=Uo(a);var s=!!o[Er];a[Er]&&(s=a[Er]()),s||n[xe](a),r=a,i=i[wr]()}}ce(n,function(c){var u=t[Ot]();c[gu](t.getCfg(),u,e,t[wr]()),o=Uo(c),!c[Ot]&&!o[Ot]&&(o[Ot]=u),o[Er]=!0,delete o[qr]})}function Bf(t){return t.sort(function(e,n){var r=0;if(n){var i=n[Nr];e[Nr]?r=i?e[id]-n[id]:1:i&&(r=-1)}else r=e?1:-1;return r})}function BP(t){var e={};return{getName:function(){return e[$o]},setName:function(n){e[$o]=n},getTraceId:function(){return e.traceId},setTraceId:function(n){Gm(n)&&(e.traceId=n)},getSpanId:function(){return e.spanId},setSpanId:function(n){qm(n)&&(e.spanId=n)},getTraceFlags:function(){return e[Wp]},setTraceFlags:function(n){e[Wp]=n}}}var KP="TelemetryPluginChain",vC="_hasRun",yC="_getTelCtx",CC=0;function GP(t,e,n){for(;t;){if(t[Bc]()===n)return t;t=t[wr]()}return Vo([n],e.config||{},e)}function $m(t,e,n,r){var i=null,o=[];e||(e=$n({},null,n[Et])),r!==null&&(i=r?GP(t,n,r):t);var a={_next:c,ctx:{core:function(){return n},diagLog:function(){return aa(n,e.cfg)},getCfg:function(){return e.cfg},getExtCfg:l,getConfig:d,hasNext:function(){return!!i},getNext:function(){return i},setNext:function(h){i=h},iterate:p,onComplete:s}};function s(h,f){for(var g=[],m=2;m<arguments.length;m++)g[m-2]=arguments[m];h&&o[xe]({func:h,self:st(f)?a.ctx:f,args:g})}function c(){var h=i;if(i=h?h[wr]():null,!h){var f=o;f&&f[Ee]>0&&(ce(f,function(g){try{g.func.call(g.self,g.args)}catch(m){ne(n[Et],2,73,"Unexpected Exception during onComplete - "+ue(m))}}),o=[])}return h}function u(h,f){var g=null,m=e.cfg;if(m&&h){var v=m[Ja];!v&&f&&(v={}),m[Ja]=v,v=e.ref(m,Ja),v&&(g=v[h],!g&&f&&(g={}),v[h]=g,g=e.ref(v,h))}return g}function l(h,f){var g=u(h,!0);return f&&Le(f,function(m,v){if(W(g[m])){var y=e.cfg[m];(y||!W(y))&&(g[m]=y)}Lm(e,g,m,v)}),e.setDf(g,f)}function d(h,f,g){g===void 0&&(g=!1);var m,v=u(h,!1),y=e.cfg;return v&&(v[f]||!W(v[f]))?m=v[f]:(y[f]||!W(y[f]))&&(m=y[f]),m||!W(m)?m:g}function p(h){for(var f;f=a._next();){var g=f[Bc]();g&&h(g)}}return a}function ar(t,e,n,r){var i=$n(e),o=$m(t,i,n,r),a=o.ctx;function s(u){var l=o._next();return l&&l[Nr](u,a),!l}function c(u,l){return u===void 0&&(u=null),ke(u)&&(u=Vo(u,i.cfg,n,l)),ar(u||a[wr](),i.cfg,n,l)}return a[on]=s,a[zo]=c,a}function vd(t,e,n){var r=$n(e.config),i=$m(t,r,e,n),o=i.ctx;function a(c){var u=i._next();return u&&u[Yo](o,c),!u}function s(c,u){return c===void 0&&(c=null),ke(c)&&(c=Vo(c,r.cfg,e,u)),vd(c||o[wr](),e,u)}return o[on]=a,o[zo]=s,o}function Ym(t,e,n){var r=$n(e.config),i=$m(t,r,e,n),o=i.ctx;function a(c){return o.iterate(function(u){Se(u[Kc])&&u[Kc](o,c)})}function s(c,u){return c===void 0&&(c=null),ke(c)&&(c=Vo(c,r.cfg,e,u)),Ym(c||o[wr](),e,u)}return o[on]=a,o[zo]=s,o}function Vo(t,e,n,r){var i=null,o=!r;if(ke(t)&&t[Ee]>0){var a=null;ce(t,function(s){if(!o&&r===s&&(o=!0),o&&s&&Se(s[Nr])){var c=qP(s,e,n);i||(i=c),a&&a._setNext(c),a=c}})}return r&&!i?Vo([r],e,n):i}function qP(t,e,n){var r=null,i=Se(t[Nr]),o=Se(t[Gc]),a;t?a=t[Ii]+"-"+t[id]+"-"+CC++:a="Unknown-0-"+CC++;var s={getPlugin:function(){return t},getNext:function(){return r},processTelemetry:l,unload:d,update:p,_id:a,_setNext:function(h){r=h}};function c(){var h;return t&&Se(t[yC])&&(h=t[yC]()),h||(h=ar(s,e,n)),h}function u(h,f,g,m,v){var y=!1,I=t?t[Ii]:KP,R=h[vC];return R||(R=h[vC]={}),h.setNext(r),t&&md(h[Ot](),function(){return I+":"+g},function(){R[a]=!0;try{var A=r?r._id:Fe;A&&(R[A]=!1),y=f(h)}catch(b){var M=r?R[r._id]:!0;M&&(y=!0),(!r||!M)&&ne(h[Vr](),1,73,"Plugin ["+I+"] failed during "+g+" - "+ue(b)+", run flags: "+ue(R))}},m,v),y}function l(h,f){f=f||c();function g(m){if(!t||!i)return!1;var v=Uo(t);return v[qr]||v[Xp]?!1:(o&&t[Gc](r),t[Nr](h,m),!0)}u(f,g,"processTelemetry",function(){return{item:h}},!h.sync)||f[on](h)}function d(h,f){function g(){var m=!1;if(t){var v=Uo(t),y=t[Ot]||v[Ot];t&&(!y||y===h.core())&&!v[qr]&&(v[Ot]=null,v[qr]=!0,v[Er]=!1,t[qr]&&t[qr](h,f)===!0&&(m=!0))}return m}u(h,g,"unload",function(){},f.isAsync)||h[on](f)}function p(h,f){function g(){var m=!1;if(t){var v=Uo(t),y=t[Ot]||v[Ot];t&&(!y||y===h.core())&&!v[qr]&&t[Kc]&&t[Kc](h,f)===!0&&(m=!0)}return m}u(h,g,"update",function(){},!1)||h[on](f)}return rr(s)}function tS(){var t=[];function e(r){r&&t[xe](r)}function n(r,i){ce(t,function(o){try{o(r,i)}catch(a){ne(r[Vr](),2,73,"Unexpected error calling unload handler - "+ue(a))}}),t=[]}return{add:e,run:n}}function nS(){var t=[];function e(r){var i=t;t=[],ce(i,function(o){try{(o.rm||o.remove).call(o)}catch(a){ne(r,2,73,"Unloading:"+ue(a))}})}function n(r){r&&qa(t,r)}return{run:e,add:n}}var Kf,fi="getPlugin",$P=(Kf={},Kf[Ja]={isVal:Mo,v:{}},Kf),Is=(function(){function t(){var e=this,n,r,i,o,a;u(),it(t,e,function(l){l[gu]=function(d,p,h,f){c(d,p,f),n=!0},l[qr]=function(d,p){var h=l[Ot];if(!h||d&&h!==d[Ot]())return;var f,g=!1,m=d||vd(null,h,i&&i[fi]?i[fi]():i),v=p||{reason:0,isAsync:!1};function y(){g||(g=!0,o.run(m,p),a.run(m[Vr]()),f===!0&&m[on](v),u())}return!l[nd]||l[nd](m,v,y)!==!0?y():f=!0,f},l[Kc]=function(d,p){var h=l[Ot];if(!h||d&&h!==d[Ot]())return;var f,g=!1,m=d||Ym(null,h,i&&i[fi]?i[fi]():i),v=p||{reason:0};function y(){g||(g=!0,c(m.getCfg(),m.core(),m[wr]()))}return!l._doUpdate||l._doUpdate(m,v,y)!==!0?y():f=!0,f},sd(l,"_addUnloadCb",function(){return o},"add"),sd(l,"_addHook",function(){return a},"add"),He(l,"_unloadHooks",{g:function(){return a}})}),e[Vr]=function(l){return s(l)[Vr]()},e[Er]=function(){return n},e.setInitialized=function(l){n=l},e[Gc]=function(l){i=l},e[on]=function(l,d){d?d[on](l):i&&Se(i[Nr])&&i[Nr](l,null)},e._getTelCtx=s;function s(l){l===void 0&&(l=null);var d=l;if(!d){var p=r||ar(null,{},e[Ot]);i&&i[fi]?d=p[zo](null,i[fi]):d=p[zo](null,i)}return d}function c(l,d,p){$n(l,$P,aa(d)),!p&&d&&(p=d[E_]()[wr]());var h=i;i&&i[fi]&&(h=i[fi]()),e[Ot]=d,r=ar(p,l,d,h)}function u(){n=!1,e[Ot]=null,r=null,i=null,a=nS(),o=tS()}}return t.__ieDyn=1,t})();function YP(t,e,n){var r={id:e,fn:n};qa(t,r);var i={remove:function(){ce(t,function(o,a){if(o.id===r.id)return t[oa](a,1),-1})}};return i}function zP(t,e,n){for(var r=!1,i=t[Ee],o=0;o<i;++o){var a=t[o];if(a)try{if(a.fn[qo](null,[e])===!1){r=!0;break}}catch(s){ne(n,2,64,"Telemetry initializer failed: "+$e(s),{exception:ue(s)},!0)}}return!r}var jP=(function(t){ui(e,t);function e(){var n=t.call(this)||this;n.identifier="TelemetryInitializerPlugin",n.priority=199;var r,i;o(),it(e,n,function(a,s){a.addTelemetryInitializer=function(c){return YP(i,r++,c)},a[Nr]=function(c,u){zP(i,c,u?u[Vr]():a[Vr]())&&a[on](c,u)},a[nd]=function(){o()}});function o(){r=0,i=[]}return n}return e.__ieDyn=1,e})(Is),pi,rS="Plugins must provide initialize method",VP="_notificationManager",TC="SDK is still unloading...",QP="SDK is not initialized",WP=100,JP=5e4,Gf=fu((pi={cookieCfg:{}},pi[Da]={rdOnly:!0,ref:!0,v:[]},pi[Oa]={rdOnly:!0,ref:!0,v:[]},pi[Ja]={ref:!0,v:{}},pi[Jp]=yr,pi.loggingLevelConsole=0,pi.diagnosticLogInterval=yr,pi));function XP(t,e){return new MP(e)}function ZP(t,e,n){var r=[],i=[],o={};return ce(n,function(a){(W(a)||W(a[gu]))&&wn(rS);var s=a[id],c=a[Ii];a&&s&&(W(o[s])?o[s]=c:xo(t,"Two extensions have same priority #"+s+" - "+o[s]+", "+c)),!s||s<e?r[xe](a):i[xe](a)}),{core:r,channels:i}}function EC(t,e){var n=!1;return ce(e,function(r){if(r===t)return n=!0,-1}),n}function ag(t,e,n,r){n&&Le(n,function(i,o){r&&sn(o)&&sn(e[i])&&ag(t,e[i],o,r),r&&sn(o)&&sn(e[i])?ag(t,e[i],o,r):t.set(e,i,o)})}function _C(t,e){var n=null,r=-1;return ce(t,function(i,o){if(i.w===e)return n=i,r=o,-1}),{i:r,l:n}}function eN(t,e){var n=_C(t,e).l;return n||(n={w:e,rm:function(){var r=_C(t,e);r.i!==-1&&t[oa](r.i,1)}},t[xe](n)),n}function tN(t,e,n){ce(e,function(r){var i=vt(t,r.w,n);delete r.w,r.rm=function(){i.rm()}})}function nN(t,e,n,r){return e.add(t[No](function(i){var o=i.cfg.disableDbgExt;o===!0&&r&&(n[Zl](r),r=null),n&&!r&&o!==!0&&(r=CP(i.cfg),n[ed](r))})),r}function rN(t){return He({rm:function(){t.rm()}},"toJSON",{v:function(){return"aicore::onCfgChange<"+JSON.stringify(t)+">"}})}var iN=(function(){function t(){var e,n,r,i,o,a,s,c,u,l,d,p,h,f,g,m,v,y,I,R,A,M,b,_,F,B,Q,ie,se,E,P,Y,U;it(t,this,function(O){L(),O._getDbgPlgTargets=function(){return[b,i]},O[Er]=function(){return n},O.activeStatus=function(){return B},O._setPendingStatus=function(){B=3},O[gu]=function(q,re,me,he){h&&wn(TC),O[Er]()&&wn("Core cannot be initialized more than once"),e=$n(q,Gf,me||O[Et],!1),q=e.cfg,On(e[No](function(V){var j=V.cfg;ie=j.initInMemoMaxSize||WP,le(j);var Z=V.ref(V.cfg,Ja);Le(Z,function(fe){V.ref(Z,fe)})})),o=he,I=nN(e,y,o&&O[Lu](),I),Ve(),O[Et]=me;var w=q[Da];if(l=[],l[xe].apply(l,qy(qy([],re,!1),w)),d=q[Oa],ee(null),(!p||p[Ee]===0)&&wn("No "+Oa+" available"),d&&d[Ee]>1){var H=O[Bc]("TeeChannelController");(!H||!H.plugin)&&ne(r,1,28,"TeeChannel required")}tN(q,M,r),M=null,n=!0,B===_i.ACTIVE&&D()},O.getChannels=function(){var q=[];return p&&ce(p,function(re){q[xe](re)}),rr(q)},O.track=function(q){md(O[od](),function(){return"AppInsightsCore:track"},function(){q===null&&(Ur(q),wn("Invalid telemetry item")),!q[$o]&&W(q[$o])&&(Ur(q),wn("telemetry name required")),q.iKey=q.iKey||A,q.time=q.time||ms(new Date),q.ver=q.ver||"4.0",!h&&O[Er]()&&B===_i.ACTIVE?X()[on](q):B!==_i.INACTIVE&&i[Ee]<=ie&&i[xe](q)},function(){return{item:q}},!q.sync)},O[E_]=X,O[Lu]=function(){return o||(o=new OP(e.cfg),O[VP]=o),o},O[ed]=function(q){O.getNotifyMgr()[ed](q)},O[Zl]=function(q){o&&o[Zl](q)},O.getCookieMgr=function(){return c||(c=Tl(e.cfg,O[Et])),c},O.setCookieMgr=function(q){c!==q&&(Ya(c,!1),c=q)},O[od]=function(){return a||s||xP()},O.setPerfMgr=function(q){a=q},O.eventCnt=function(){return i[Ee]},O.releaseQueue=function(){if(n&&i[Ee]>0){var q=i;i=[],B===2?ce(q,function(re){re.iKey=re.iKey||A,X()[on](re)}):ne(r,2,20,"core init status is not active")}},O.pollInternalLogs=function(q){return g=q||null,U=!1,P&&P[vo](),T(!0)};function le(q){var re=q.instrumentationKey,me=q.endpointUrl;if(B!==3){if(W(re)){A=null,B=_i.INACTIVE;var he="Please provide instrumentation key";n?(ne(r,1,100,he),D()):wn(he);return}var w=[];zi(re)?(w[xe](re),A=null):A=re,zi(me)?(w[xe](me),Q=null):Q=me,w[Ee]?ve(q,w):k()}}function ve(q,re){se=!1,B=3;var me=Mo(q.initTimeOut)?q.initTimeOut:JP,he=vk(re);E&&E[vo](),E=Gn(function(){E=null,se||k()},me),gn(he,function(w){try{if(se)return;if(!w.rejected){var H=w[So];if(H&&H[Ee]){var V=H[0];if(A=V&&V[So],H[Ee]>1){var j=H[1];Q=j&&j[So]}}A&&(q.instrumentationKey=A,q.endpointUrl=Q)}k()}catch{se||k()}})}function k(){se=!0,W(A)?(B=_i.INACTIVE,ne(r,1,112,"ikey can't be resolved from promises")):B=_i.ACTIVE,D()}function D(){n&&(O.releaseQueue(),O.pollInternalLogs())}function T(q){if((!P||!P[$a])&&!U){var re=q||r&&r.queue[Ee]>0;re&&(Y||(Y=!0,On(e[No](function(me){var he=me.cfg.diagnosticLogInterval;(!he||!(he>0))&&(he=1e4);var w=!1;P&&(w=P[$a],P[vo]()),P=Wb(qe,he),P.unref(),P[$a]=w}))),P[$a]=!0)}return P}O[$y]=function(){U=!0,P&&P[vo](),qe()},hc(O,function(){return f},["addTelemetryInitializer"]),O[Yo]=function(q,re,me){q===void 0&&(q=!0),n||wn(QP),h&&wn(TC);var he={reason:50,isAsync:q,flushComplete:!1},w;q&&!re&&(w=Pr(function(j){re=j}));var H=vd(Re(),O);H[Fu](function(){y.run(O[Et]),V_([c,o,r],q,function(){L(),re&&re(he)})},O);function V(j){he.flushComplete=j,h=!0,v.run(H,he),O[$y](),H[on](he)}return qe(),Gt(q,V,6,me),w},O[Bc]=Ae,O.addPlugin=function(q,re,me,he){if(!q){he&&he(!1),qt(rS);return}var w=Ae(q[Ii]);if(w&&!re){he&&he(!1),qt("Plugin ["+q[Ii]+"] is already loaded!");return}var H={reason:16};function V(fe){l[xe](q),H.added=[q],ee(H),he&&he(!0)}if(w){var j=[w.plugin],Z={reason:2,isAsync:!!me};Pe(j,Z,function(fe){fe?(H.removed=j,H.reason|=32,V()):he&&he(!1)})}else V()},O.updateCfg=function(q,re){re===void 0&&(re=!0);var me;if(O[Er]()){me={reason:1,cfg:e.cfg,oldCfg:Fy({},e.cfg),newConfig:Fy({},q),merge:re},q=me.newConfig;var he=e.cfg;q[Da]=he[Da],q[Oa]=he[Oa]}e._block(function(w){var H=w.cfg;ag(w,H,q,re),re||Le(H,function(V){Mi(q,V)||w.set(H,V,yr)}),w.setDf(H,Gf)},!0),e.notify(),me&&Ze(me)},O.evtNamespace=function(){return m},O.flush=Gt,O.getTraceCtx=function(q){return R||(R=BP()),R},O.setTraceCtx=function(q){R=q||null},O.addUnloadHook=On,sd(O,"addUnloadCb",function(){return v},"add"),O.onCfgChange=function(q){var re;return n?re=vt(e.cfg,q,O[Et]):re=eN(M,q),rN(re)},O.getWParam=function(){return n_()||e.cfg.enableWParam?0:-1};function C(){var q={};_=[];var re=function(me){me&&ce(me,function(he){if(he[Ii]&&he[zp]&&!q[he.identifier]){var w=he[Ii]+"="+he[zp];_[xe](w),q[he.identifier]=he}})};re(p),d&&ce(d,function(me){re(me)}),re(l)}function L(){n=!1,e=$n({},Gf,O[Et]),e.cfg[__]=1,He(O,"config",{g:function(){return e.cfg},s:function(re){O.updateCfg(re,!1)}}),He(O,"pluginVersionStringArr",{g:function(){return _||C(),_}}),He(O,"pluginVersionString",{g:function(){return F||(_||C(),F=_.join(";")),F||Fe}}),He(O,"logger",{g:function(){return r||(r=new pd(e.cfg),e[Et]=r),r},s:function(re){e[Et]=re,r!==re&&(Ya(r,!1),r=re)}}),O[Et]=new pd(e.cfg),b=[];var q=O.config[Da]||[];q.splice(0,q[Ee]),qa(q,b),f=new jP,i=[],Ya(o,!1),o=null,a=null,s=null,Ya(c,!1),c=null,u=null,l=[],d=null,p=null,h=!1,g=null,m=qn("AIBaseCore",!0),v=tS(),R=null,A=null,y=nS(),M=[],F=null,_=null,U=!1,P=null,Y=!1,B=0,Q=null,ie=null,se=!1,E=null}function X(){var q=ar(Re(),e.cfg,O);return q[Fu](T),q}function ee(q){var re=ZP(O[Et],pP,l);u=null,F=null,_=null,p=(d||[])[0]||[],p=Bf(qa(p,re[Oa]));var me=qa(Bf(re[Ot]),p);b=rr(me);var he=O.config[Da]||[];he.splice(0,he[Ee]),qa(he,b);var w=X();p&&p[Ee]>0&&mC(w[zo](p),me),mC(w,me),q&&Ze(q)}function Ae(q){var re=null,me=null,he=[];return ce(b,function(w){if(w[Ii]===q&&w!==f)return me=w,-1;w.getChannel&&he[xe](w)}),!me&&he[Ee]>0&&ce(he,function(w){if(me=w.getChannel(q),!me)return-1}),me&&(re={plugin:me,setEnabled:function(w){Uo(me)[Xp]=!w},isEnabled:function(){var w=Uo(me);return!w[qr]&&!w[Xp]},remove:function(w,H){w===void 0&&(w=!0);var V=[me],j={reason:1,isAsync:w};Pe(V,j,function(Z){Z&&ee({reason:32,removed:V}),H&&H(Z)})}}),re}function Re(){if(!u){var q=(b||[]).slice();Wt(q,f)===-1&&q[xe](f),u=Vo(Bf(q),e.cfg,O)}return u}function Pe(q,re,me){if(q&&q[Ee]>0){var he=Vo(q,e.cfg,O),w=vd(he,O);w[Fu](function(){var H=!1,V=[];ce(l,function(Z,fe){EC(Z,q)?H=!0:V[xe](Z)}),l=V,F=null,_=null;var j=[];d&&(ce(d,function(Z,fe){var ye=[];ce(Z,function(Oe){EC(Oe,q)?H=!0:ye[xe](Oe)}),j[xe](ye)}),d=j),me&&me(H),T()}),w[on](re)}else me(!1)}function qe(){if(r&&r.queue){var q=r.queue.slice(0);r.queue[Ee]=0,ce(q,function(re){var me={name:g||"InternalMessageId: "+re[td],iKey:A,time:ms(new Date),baseType:zc.dataType,baseData:{message:re[Oo]}};O.track(me)})}}function Gt(q,re,me,he){var w=1,H=!1,V=null;he=he||5e3;function j(){w--,H&&w===0&&(V&&V[vo](),V=null,re&&re(H),re=null)}if(p&&p[Ee]>0){var Z=X()[zo](p);Z.iterate(function(fe){if(fe.flush){w++;var ye=!1;fe.flush(q,function(){ye=!0,j()},me)||ye||(q&&V==null?V=Gn(function(){V=null,j()},he):j())}})}return H=!0,j(),!0}function Ve(){var q;On(e[No](function(re){var me=re.cfg.enablePerfMgr;if(me){var he=re.cfg[Jp];(q!==he||!q)&&(he||(he=XP),Xt(re.cfg,Jp,he),q=he,s=null),!a&&!s&&Se(he)&&(s=he(O,O[Lu]()))}else s=null,q=null}))}function Ze(q){var re=Ym(Re(),O);re[Fu](T),(!O._updateHook||O._updateHook(re,q)!==!0)&&re[on](q)}function qt(q){var re=O[Et];re?(ne(re,2,73,q),T()):wn(q)}function Ur(q){var re=O[Lu]();re&&re[wc]([q],2)}function On(q){y.add(q)}})}return t.__ieDyn=1,t})();function qf(t,e){try{if(t&&t!==""){var n=or().parse(t);if(n&&n[jy]&&n[jy]>=n.itemsAccepted&&n.itemsReceived-n.itemsAccepted===n.errors[Ee])return n}}catch(r){ne(e,1,43,"Cannot parse the response. "+(r[$o]||ue(r)),{response:t})}return null}var jn="",oN="NoResponseBody",SC="&"+oN+"=true",$f="POST",aN=(function(){function t(){var e=0,n,r,i,o,a,s,c,u,l,d,p,h,f,g;it(t,this,function(m,v){var y=!0;se(),m[gu]=function(E,P){i=P,r&&ne(i,1,28,"Sender is already initialized"),m.SetConfig(E),r=!0},m._getDbgPlgTargets=function(){return[r,o,s,n]},m.SetConfig=function(E){try{if(a=E.senderOnCompleteCallBack||{},s=!!E.disableCredentials,c=E.fetchCredentials,o=!!E.isOneDs,n=!!E.enableSendPromise,l=!!E.disableXhr,d=!!E.disableBeacon,p=!!E.disableBeaconSync,g=E.timeWrapper,f=!!E.addNoResponse,h=!!E.disableFetchKeepAlive,u={sendPOST:B},o||(y=!1),s){var P=_r();P&&P.protocol&&P.protocol[gs]()==="file:"&&(y=!1)}return!0}catch{}return!1},m.getSyncFetchPayload=function(){return e},m.getSenderInst=function(E,P){return E&&E[Ee]?M(E,P):null},m.getFallbackInst=function(){return u},m[nd]=function(E,P){se()},m.preparePayload=function(E,P,Y,U){if(!P||U||!Y[Vn]){E(Y);return}try{var O=ut("CompressionStream");if(!Se(O)){E(Y);return}var le=new ReadableStream({start:function(L){L.enqueue(Ce(Y[Vn])?new TextEncoder().encode(Y[Vn]):Y[Vn]),L.close()}}),ve=le.pipeThrough(new O("gzip")),k=ve.getReader(),D=[],T=0,C=!1;return gn(k.read(),function L(X){if(!C&&!X.rejected){var ee=X[So];if(!ee.done)return D[xe](ee[So]),T+=ee.value[Ee],gn(k.read(),L);for(var Ae=new Uint8Array(T),Re=0,Pe=0,qe=D;Pe<qe.length;Pe++){var Gt=qe[Pe];Ae.set(Gt,Re),Re+=Gt[Ee]}Y[Vn]=Ae,Y[Hu]["Content-Encoding"]="gzip",Y._chunkCount=D[Ee]}C||(C=!0,E(Y))}),k}catch{E(Y);return}};function I(E,P){b(P,200,{},E)}function R(E,P){ne(i,2,26,"Failed to send telemetry.",{message:E}),b(P,400,{})}function A(E){R("No endpoint url is provided for the batch",E)}function M(E,P){for(var Y=0,U=null,O=0;U==null&&O<E[Ee];)Y=E[O],!l&&Y===1?Yk()?U=ie:gh()&&(U=B):Y===2&&xm(P)&&(!P||!h)?U=Q:Y===3&&fc()&&(P?!p:!d)&&(U=F),O++;return U?{_transport:Y,_isSync:P,sendPOST:U}:null}function b(E,P,Y,U){try{E&&E(P,Y,U)}catch{}}function _(E,P){var Y=xr(),U=E[Hs];if(!U)return A(P),!0;U=E[Hs]+(f?SC:jn);var O=E[Vn],le=o?O:new Blob([O],{type:"text/plain;charset=UTF-8"}),ve=Y.sendBeacon(U,le);return ve}function F(E,P,Y){var U=E[Vn];try{if(U)if(_(E,P))I(jn,P);else{var O=a&&a.beaconOnRetry;O&&Se(O)?O(E,P,_):(u&&u.sendPOST(E,P,!0),ne(i,2,40,". Failed to send telemetry with Beacon API, retried with normal sender."))}}catch(le){o&&xo(i,"Failed to send telemetry using sendBeacon API. Ex:"+ue(le)),b(P,o?0:400,{},jn)}}function B(E,P,Y){var U,O,le,ve=E[Hu]||{};!Y&&n&&(U=Pr(function(C,L){O=C,le=L})),o&&Y&&E.disableXhrSync&&(Y=!1);var k=E[Hs];if(!k){A(P),O&&O(!1);return}var D=Pk($f,k,y,!0,Y,E[ya]);o||D.setRequestHeader("Content-type","application/json"),ce(jr(ve),function(C){D.setRequestHeader(C,ve[C])}),D.onreadystatechange=function(){o||(T(D),D.readyState===4&&O&&O(!0))},D.onload=function(){o&&T(D)};function T(C){var L=a&&a.xhrOnComplete,X=L&&Se(L);if(X)L(C,P,E);else{var ee=cd(C);b(P,C[Kr],Rf(C,o),ee)}}return D.onerror=function(C){b(P,o?D[Kr]:400,Rf(D,o),o?jn:ud(D)),le&&le(C)},D.ontimeout=function(){b(P,o?D[Kr]:500,Rf(D,o),o?jn:ud(D)),O&&O(!1)},D.send(E[Vn]),U}function Q(E,P,Y){var U,O=E[Hs],le=E[Vn],ve=o?le:new Blob([le],{type:"application/json"}),k,D,T,C=new Headers,L=le[Ee],X=!1,ee=!1,Ae=E[Hu]||{},Re=(U={method:$f,body:ve},U[eC]=!0,U);E.headers&&jr(E.headers)[Ee]>0&&(ce(jr(Ae),function(Ve){C.append(Ve,Ae[Ve])}),Re[Hu]=C),c?Re.credentials=c:y&&o&&(Re.credentials="include"),Y&&(Re.keepalive=!0,e+=L,o?E._sendReason===2&&(X=!0,f&&(O+=SC)):X=!0);var Pe=new Request(O,Re);try{Pe[eC]=!0}catch{}if(!Y&&n&&(k=Pr(function(Ve,Ze){D=Ve,T=Ze})),!O){A(P),D&&D(!1);return}function qe(Ve,Ze){Ze?b(P,o?0:Ze,{},o?jn:Ve):b(P,o?0:400,{},o?jn:Ve)}function Gt(Ve,Ze,qt){var Ur=Ve[Kr],On=a.fetchOnComplete;On&&Se(On)?On(Ve,P,qt||jn,Ze):b(P,Ur,{},qt||jn)}try{gn(fetch(o?O:Pe,o?Re:null),function(Ve){if(Y&&(e-=L,L=0),!ee)if(ee=!0,Ve.rejected)qe(Ve.reason&&Ve.reason[Oo],499),T&&T(Ve.reason);else{var Ze=Ve[So];try{!o&&!Ze.ok?(Ze[Kr]?qe(Ze.statusText,Ze[Kr]):qe(Ze.statusText,499),D&&D(!1)):o&&!Ze.body?(Gt(Ze,null,jn),D&&D(!0)):gn(Ze.text(),function(qt){Gt(Ze,E,qt[So]),D&&D(!0)})}catch(qt){Ze&&Ze[Kr]?qe(ue(qt),Ze[Kr]):qe(ue(qt),499),T&&T(qt)}}})}catch(Ve){ee||(qe(ue(Ve),499),T&&T(Ve))}return X&&!ee&&(ee=!0,b(P,200,{}),D&&D(!0)),o&&!ee&&E[ya]>0&&g&&g.set(function(){ee||(ee=!0,b(P,500,{}),D&&D(!0))},E[ya]),k}function ie(E,P,Y){var U=kn(),O=new XDomainRequest,le=E[Vn];O.onload=function(){var C=cd(O),L=a&&a.xdrOnComplete;L&&Se(L)?L(O,P,E):b(P,200,{},C)},O.onerror=function(){b(P,400,{},o?jn:O_(O))},O.ontimeout=function(){b(P,500,{})},O.onprogress=function(){};var ve=U&&U.location&&U.location.protocol||"",k=E[Hs];if(!k){A(P);return}if(!o&&k.lastIndexOf(ve,0)!==0){var D="Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.";ne(i,2,40,". "+D),R(D,P);return}var T=o?k:k[Do](/^(https?:)/,"");O.open($f,T),E[ya]&&(O[ya]=E[ya]),O.send(le),o&&Y?g&&g.set(function(){O.send(le)},0):O.send(le)}function se(){e=0,r=!1,n=!1,i=null,o=null,a=null,s=null,c=null,u=null,l=!1,d=!1,p=!1,h=!1,f=!1,g=null}})}return t.__ieDyn=1,t})(),iS="on",AC="attachEvent",IC="addEventListener",wC="detachEvent",RC="removeEventListener",sg="events",cg="visibilitychange",vh="pagehide",oS="unload",aS="beforeunload",sS=qn("aiEvtPageHide");qn("aiEvtPageShow");var sN=/\.[\.]+/g,cN=/[\.]+$/,uN=1,yd=q_("events"),lN=/^([^.]*)(?:\.(.+)|)/;function bC(t){return t&&t[Do]?t[Do](/^[\s\.]+|(?=[\s\.])[\.\s]+$/g,Fe):t}function zm(t,e){if(e){var n=Fe;ke(e)?(n=Fe,ce(e,function(i){i=bC(i),i&&(i[0]!=="."&&(i="."+i),n+=i)})):n=bC(e),n&&(n[0]!=="."&&(n="."+n),t=(t||Fe)+n)}var r=lN.exec(t||Fe)||[];return{type:r[1],ns:(r[2]||Fe).replace(sN,".").replace(cN,Fe)[jo](".").sort().join(".")}}function cS(t,e,n){n===void 0&&(n=!0);var r=yd.get(t,sg,{},n),i=r[e];return i||(i=r[e]=[]),i}function uS(t,e,n,r){t&&e&&e[xi]&&(t[RC]?t[RC](e[xi],n,r):t[wC]&&t[wC](iS+e[xi],n))}function dN(t,e,n,r){var i=!1;return t&&e&&e[xi]&&n&&(t[IC]?(t[IC](e[xi],n,r),i=!0):t[AC]&&(t[AC](iS+e[xi],n),i=!0)),i}function kC(t,e,n,r){for(var i=e[Ee];i--;){var o=e[i];o&&(!n.ns||n.ns===o[Yy].ns)&&(!r||r(o))&&(uS(t,o[Yy],o.handler,o.capture),e[oa](i,1))}}function hN(t,e,n){if(e[xi])kC(t,cS(t,e[xi]),e,n);else{var r=yd.get(t,sg,{});Le(r,function(i,o){kC(t,o,e,n)}),jr(r)[Ee]===0&&yd.kill(t,sg)}}function Ji(t,e){var n;return e?(ke(e)?n=[t].concat(e):n=[t,e],n=zm("xx",n).ns[jo](".")):n=t,n}function Qr(t,e,n,r,i){i===void 0&&(i=!1);var o=!1;if(t)try{var a=zm(e,r);if(o=dN(t,a,n,i),o&&yd.accept(t)){var s={guid:uN++,evtName:a,handler:n,capture:i};cS(t,a.type)[xe](s)}}catch{}return o}function Za(t,e,n,r,i){if(i===void 0&&(i=!1),t)try{var o=zm(e,r),a=!1;hN(t,o,function(s){return o.ns&&!n||s.handler===n?(a=!0,!0):!1}),a||uS(t,o,n,i)}catch{}}function fN(t,e,n){var r=!1,i=kn();i&&(r=Qr(i,t,e,n),r=Qr(i.body,t,e,n)||r);var o=Ft();return o&&(r=Qr(o,t,e,n)||r),r}function pN(t,e,n){var r=kn();r&&(Za(r,t,e,n),Za(r.body,t,e,n));var i=Ft();i&&Za(i,t,e,n)}function Cd(t,e,n,r){var i=!1;return e&&t&&t[Ee]>0&&ce(t,function(o){o&&(!n||Wt(n,o)===-1)&&(i=fN(o,e,r)||i)}),i}function gN(t,e,n,r){var i=!1;return e&&t&&ke(t)&&(i=Cd(t,e,n,r),!i&&n&&n[Ee]>0&&(i=Cd(t,e,null,r))),i}function ug(t,e,n){t&&ke(t)&&ce(t,function(r){r&&pN(r,e,n)})}function mN(t,e,n){return gN([aS,oS,vh],t,e,n)}function vN(t,e){ug([aS,oS,vh],t,e)}function lg(t,e,n){function r(a){var s=Ft();t&&s&&s.visibilityState==="hidden"&&t(a)}var i=Ji(sS,n),o=Cd([vh],t,e,i);return(!e||Wt(e,cg)===-1)&&(o=Cd([cg],r,e,i)||o),!o&&e&&(o=lg(t,null,n)),o}function yN(t,e){var n=Ji(sS,e);ug([vh],t,n),ug([cg],null,n)}var PC="_aiHooks",NC=["req","rsp","hkErr","fnErr"];function jm(t,e){if(t)for(var n=0;n<t[Ee]&&!e(t[n],n);n++);}function Yf(t,e,n,r,i){i>=0&&i<=2&&jm(t,function(o,a){var s=o.cbks,c=s[NC[i]];if(c){e.ctx=function(){var d=r[a]=r[a]||{};return d};try{c[qo](e.inst,n)}catch(d){var u=e.err;try{var l=s[NC[2]];l&&(e.err=d,l[qo](e.inst,n))}catch{}finally{e.err=u}}}})}function CN(t){return function(){var e=this,n=arguments,r=t.h,i={name:t.n,inst:e,ctx:null,set:c},o=[],a=s([i],n);i.evt=ut("event");function s(l,d){return jm(d,function(p){l[xe](p)}),l}function c(l,d){n=s([],n),n[l]=d,a=s([i],n)}Yf(r,i,a,o,0);var u=t.f;if(u)try{i.rslt=u[qo](e,n)}catch(l){throw i.err=l,Yf(r,i,a,o,3),l}return Yf(r,i,a,o,1),i.rslt}}function Vm(t,e,n,r){var i=null;return t&&(Kn(t,e)?i=t:n&&(i=Vm(Ik(t),e,r,!1))),i}function TN(t,e,n){return t?dg(t[Ir],e,n,!1):null}function lS(t,e,n,r){var i=n&&n[PC];if(!i){i={i:0,n:e,f:n,h:[]};var o=CN(i);o[PC]=i,t[e]=o}var a={id:i.i,cbks:r,rm:function(){var s=this.id;jm(i.h,function(c,u){if(c.id===s)return i.h[oa](u,1),1})}};return i.i++,i.h[xe](a),a}function dg(t,e,n,r,i){if(r===void 0&&(r=!0),t&&e&&n){var o=Vm(t,e,r,i);if(o){var a=o[e];if(typeof a===v_)return lS(o,e,a,n)}}return null}function $u(t,e,n,r,i){if(t&&e&&n){var o=Vm(t,e,r,i)||t;if(o)return lS(o,e,o[e],n)}return null}var Io="Microsoft_ApplicationInsights_BypassAjaxInstrumentation",dS="sampleRate",zf="ProcessLegacy",OC="http.method",Qm="https://dc.services.visualstudio.com",es="/v2/track",Or="not_specified",jf="iKey",Qe=ak({requestContextHeader:[0,"Request-Context"],requestContextTargetKey:[1,"appId"],requestContextAppIdFormat:[2,"appId=cid-v1:"],requestIdHeader:[3,"Request-Id"],traceParentHeader:[4,"traceparent"],traceStateHeader:[5,"tracestate"],sdkContextHeader:[6,"Sdk-Context"],sdkContextHeaderAppIdRequest:[7,"appId"],requestContextHeaderLowerCase:[8,"request-context"]}),vs="split",be="length",Vc="toLowerCase",ro="ingestionendpoint",Qc="toString",Wm="removeItem",yu="message",Ma="count",Vf="preTriggerDate",Qf="getUTCDate",Td="stringify",Wf="pathname",Wc="match",DC="correlationHeaderExcludePatterns",Dr="name",Sr="properties",Wr="measurements",_l="sizeInBytes",Sl="typeName",Gs="exceptions",mc="severityLevel",Jf="problemGroup",ts="parsedStack",Ed="hasFullStack",_d="assembly",Jr="fileName",ys="line",yh="aiDataContract",Sd="duration";function hS(t,e,n){var r=e[be],i=EN(t,e);if(i[be]!==r){for(var o=0,a=i;n[a]!==void 0;)o++,a=pn(i,0,147)+AN(o);i=a}return i}function EN(t,e){var n;return e&&(e=Je(an(e)),e[be]>150&&(n=pn(e,0,150),ne(t,2,57,"name is too long. It has been truncated to 150 characters.",{name:e},!0))),n||e}function At(t,e,n){n===void 0&&(n=1024);var r;return e&&(n=n||1024,e=Je(an(e)),e[be]>n&&(r=pn(e,0,n),ne(t,2,61,"string value is too long. It has been truncated to "+n+" characters.",{value:e},!0))),r||e}function Ch(t,e,n){return Ce(e)&&(e=$r(e,n)),pS(t,e,2048,66)}function fS(t,e){var n;return e&&e[be]>32768&&(n=pn(e,0,32768),ne(t,2,56,"message is too long, it has been truncated to 32768 characters.",{message:e},!0)),n||e}function _N(t,e){var n;if(e){var r=""+e;r[be]>32768&&(n=pn(r,0,32768),ne(t,2,52,"exception is too long, it has been truncated to 32768 characters.",{exception:e},!0))}return n||e}function sa(t,e){if(e){var n={};Le(e,function(r,i){if(Cn(i)&&mu())try{i=or()[Td](i)}catch(o){ne(t,2,49,"custom property is not valid",{exception:o},!0)}i=At(t,i,8192),r=hS(t,r,n),n[r]=i}),e=n}return e}function ca(t,e){if(e){var n={};Le(e,function(r,i){r=hS(t,r,n),n[r]=i}),e=n}return e}function SN(t,e){return e&&pS(t,e,128,69)[Qc]()}function pS(t,e,n,r){var i;return e&&(e=Je(an(e)),e[be]>n&&(i=pn(e,0,n),ne(t,2,r,"input is too long, it has been truncated to "+n+" characters.",{data:e},!0))),i||e}function AN(t){var e="00"+t;return Ai(e,e[be]-3)}var MC=Ft()||{},xC=0,IN=[null,null,null,null,null];function Jm(t){var e=xC,n=IN,r=n[e];return MC.createElement?n[e]||(r=n[e]=MC.createElement("a")):r={host:bN(t)},r.href=t,e++,e>=n[be]&&(e=0),xC=e,r}function wN(t){var e,n=Jm(t);return n&&(e=n.href),e}function RN(t,e){return t?t.toUpperCase()+" "+e:e}function bN(t,e){var n=gS(t)||"";if(n){var r=n[Wc](/(www\d{0,5}\.)?([^\/:]{1,256})(:\d{1,20})?/i);if(r!=null&&r[be]>3&&Ce(r[2])&&r[2][be]>0)return r[2]+(r[3]||"")}return n}function gS(t,e){var n=null;if(t){var r=t[Wc](/(\w{1,150}):\/\/([^\/:]{1,256})(:\d{1,20})?/i);if(r!=null&&r[be]>2&&Ce(r[2])&&r[2][be]>0&&(n=r[2]||"",r[be]>2)){var i=(r[1]||"")[Vc](),o=r[3]||"";(i==="http"&&o===":80"||i==="https"&&o===":443")&&(o=""),n+=o}}return n}var kN=[Qm+es,"https://breeze.aimon.applicationinsights.io"+es,"https://dc-int.services.visualstudio.com"+es],PN="cid-v1:";function hg(t){return Wt(kN,t[Vc]())!==-1}function UC(t,e,n){if(!e||t&&t.disableCorrelationHeaders)return!1;if(t&&t[DC]){for(var r=0;r<t.correlationHeaderExcludePatterns[be];r++)if(t[DC][r].test(e))return!1}var i=Jm(e).host[Vc]();if(i&&(gt(i,":443")!==-1||gt(i,":80")!==-1)&&(i=(gS(e)||"")[Vc]()),(!t||!t.enableCorsCorrelation)&&i&&i!==n)return!1;var o=t&&t.correlationHeaderDomains;if(o){var a;if(ce(o,function(u){var l=new RegExp(u.toLowerCase().replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*"));a=a||l.test(i)}),!a)return!1}var s=t&&t.correlationHeaderExcludedDomains;if(!s||s[be]===0)return!0;for(var r=0;r<s[be];r++){var c=new RegExp(s[r].toLowerCase().replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*"));if(c.test(i))return!1}return i&&i[be]>0}function LC(t){if(t){var e=NN(t,Qe[1]);if(e&&e!==PN)return e}}function NN(t,e){if(t)for(var n=t[vs](","),r=0;r<n[be];++r){var i=n[r][vs]("=");if(i[be]===2&&i[0]===e)return i[1]}}function ON(t,e,n,r){var i,o=r,a=r;if(e&&e[be]>0){var s=Jm(e);if(i=s.host,!o)if(s[Wf]!=null){var c=s.pathname[be]===0?"/":s[Wf];c.charAt(0)!=="/"&&(c="/"+c),a=s[Wf],o=At(t,n?n+" "+c:c)}else o=At(t,e)}else i=r,o=r;return{target:i,name:o,data:a}}function Yu(){var t=ri();if(t&&t.now&&t.timing){var e=t.now()+t.timing.navigationStart;if(e>0)return e}return ir()}function hn(t,e){var n=null;return t!==0&&e!==0&&!W(t)&&!W(e)&&(n=e-t),n}function Xm(t,e){var n=t||{};return{getName:function(){return n[Dr]},setName:function(r){e&&e.setName(r),n[Dr]=r},getTraceId:function(){return n.traceID},setTraceId:function(r){e&&e.setTraceId(r),Gm(r)&&(n.traceID=r)},getSpanId:function(){return n.parentID},setSpanId:function(r){e&&e.setSpanId(r),qm(r)&&(n.parentID=r)},getTraceFlags:function(){return n.traceFlags},setTraceFlags:function(r){e&&e.setTraceFlags(r),n.traceFlags=r}}}var Cu=T_({LocalStorage:0,SessionStorage:1}),Li=void 0,Fi=void 0,mS="";function Zm(){return Eh()?Th(Cu.LocalStorage):null}function Th(t){try{if(W(Bn()))return null;var e=new Date()[Qc](),n=ut(t===Cu.LocalStorage?"localStorage":"sessionStorage"),r=mS+e;n.setItem(r,e);var i=n.getItem(r)!==e;if(n[Wm](r),!i)return n}catch{}return null}function ev(){return Jc()?Th(Cu.SessionStorage):null}function DN(){Li=!1,Fi=!1}function tv(t){mS=t||""}function MN(){Li=Eh(!0),Fi=Jc(!0)}function Eh(t){return(t||Li===void 0)&&(Li=!!Th(Cu.LocalStorage)),Li}function vS(t,e){var n=Zm();if(n!==null)try{return n.getItem(e)}catch(r){Li=!1,ne(t,2,1,"Browser failed read of local storage. "+$e(r),{exception:ue(r)})}return null}function yS(t,e,n){var r=Zm();if(r!==null)try{return r.setItem(e,n),!0}catch(i){Li=!1,ne(t,2,3,"Browser failed write to local storage. "+$e(i),{exception:ue(i)})}return!1}function xN(t,e){var n=Zm();if(n!==null)try{return n[Wm](e),!0}catch(r){Li=!1,ne(t,2,5,"Browser failed removal of local storage item. "+$e(r),{exception:ue(r)})}return!1}function Jc(t){return(t||Fi===void 0)&&(Fi=!!Th(Cu.SessionStorage)),Fi}function fg(t,e){var n=ev();if(n!==null)try{return n.getItem(e)}catch(r){Fi=!1,ne(t,2,2,"Browser failed read of session storage. "+$e(r),{exception:ue(r)})}return null}function CS(t,e,n){var r=ev();if(r!==null)try{return r.setItem(e,n),!0}catch(i){Fi=!1,ne(t,2,4,"Browser failed write to session storage. "+$e(i),{exception:ue(i)})}return!1}function TS(t,e){var n=ev();if(n!==null)try{return n[Wm](e),!0}catch(r){Fi=!1,ne(t,2,6,"Browser failed removal of session storage item. "+$e(r),{exception:ue(r)})}return!1}var UN="appInsightsThrottle",LN=(function(){function t(e,n){var r=this,i,o,a,s,c,u,l,d=!1,p=!1;f(),r._getDbgPlgTargets=function(){return[l]},r.getConfig=function(){return a},r.canThrottle=function(E){var P=Q(E),Y=g(E);return y(Y,i,P)},r.isTriggered=function(E){return ie(E)},r.isReady=function(){return d},r.flush=function(E){try{var P=se(E);if(P&&P[be]>0){var Y=P.slice(0);return l[E]=[],ce(Y,function(U){h(U.msgID,U[yu],U.severity,!1)}),!0}}catch{}return!1},r.flushAll=function(){try{if(l){var E=!0;return Le(l,function(P){var Y=r.flush(parseInt(P));E=E&&Y}),E}}catch{}return!1},r.onReadyState=function(E,P){return P===void 0&&(P=!0),d=W(E)?!0:E,d&&P?r.flushAll():null},r.sendMessage=function(E,P,Y){return h(E,P,Y,!0)};function h(E,P,Y,U){if(d){var O=B(E);if(!O)return;var le=g(E),ve=Q(E),k=y(le,i,ve),D=!1,T=0,C=ie(E);try{k&&!C?(T=ZE(le.limit.maxSendNumber,ve[Ma]+1),ve[Ma]=0,D=!0,c[E]=!0,ve[Vf]=new Date):(c[E]=k,ve[Ma]+=1);var L=I(E);b(o,L,ve);for(var X=0;X<T;X++)F(E,o,P,Y)}catch{}return{isThrottled:D,throttleNum:T}}else if(U){var ee=se(E);ee.push({msgID:E,message:P,severity:Y})}return null}function f(){o=aa(e),c={},s={},l={},a={},m(109),u=Mo(n)?n:"",e.addUnloadHook(vt(e.config,function(E){var P=E.cfg;i=Eh();var Y=P.throttleMgrCfg||{};Le(Y,function(U,O){m(parseInt(U),O)})}))}function g(E){return a[E]||a[109]}function m(E,P){var Y,U;try{var O=P||{},le={};le.disabled=!!O.disabled;var ve=O.interval||{};p=ve?.daysOfMonth&&ve?.daysOfMonth[be]>0,le.interval=v(ve);var k={samplingRate:((Y=O.limit)===null||Y===void 0?void 0:Y.samplingRate)||100,maxSendNumber:((U=O.limit)===null||U===void 0?void 0:U.maxSendNumber)||1};le.limit=k,a[E]=le}catch{}}function v(E){E=E||{};var P=E?.monthInterval,Y=E?.dayInterval;return W(P)&&W(Y)&&(E.monthInterval=3,p||(E.daysOfMonth=[28],p=!0)),E={monthInterval:E?.monthInterval,dayInterval:E?.dayInterval,daysOfMonth:E?.daysOfMonth},E}function y(E,P,Y){if(E&&!E.disabled&&P&&Mo(Y)){var U=M(),O=Y.date,le=E.interval,ve=1;if(le?.monthInterval){var k=(U.getUTCFullYear()-O.getUTCFullYear())*12+U.getUTCMonth()-O.getUTCMonth();ve=_(le.monthInterval,0,k)}var D=1;if(p)D=Wt(le.daysOfMonth,U[Qf]());else if(le?.dayInterval){var T=bn((U.getTime()-O.getTime())/864e5);D=_(le.dayInterval,0,T)}return ve>=0&&D>=0}return!1}function I(E,P){var Y=Mo(P)?P:"";return E?UN+Y+"-"+E:null}function R(E){try{if(E){var P=new Date;return E.getUTCFullYear()===P.getUTCFullYear()&&E.getUTCMonth()===P.getUTCMonth()&&E[Qf]()===P[Qf]()}}catch{}return!1}function A(E,P,Y){try{var U={date:M(),count:0};if(E){var O=JSON.parse(E),le={date:M(O.date)||U.date,count:O[Ma]||U[Ma],preTriggerDate:O.preTriggerDate?M(O[Vf]):void 0};return le}else return b(P,Y,U),U}catch{}return null}function M(E){try{if(E){var P=new Date(E);if(!isNaN(P.getDate()))return P}else return new Date}catch{}return null}function b(E,P,Y){try{return yS(E,P,Je(JSON[Td](Y)))}catch{}return!1}function _(E,P,Y){return E<=0?1:Y>=P&&(Y-P)%E==0?bn((Y-P)/E)+1:-1}function F(E,P,Y,U){ne(P,U||1,E,Y)}function B(E){try{var P=g(E);return Zk(1e6)<=P.limit.samplingRate}catch{}return!1}function Q(E){try{var P=s[E];if(!P){var Y=I(E,u);P=A(vS(o,Y),o,Y),s[E]=P}return s[E]}catch{}return null}function ie(E){var P=c[E];if(W(P)){P=!1;var Y=Q(E);Y&&(P=R(Y[Vf])),c[E]=P}return c[E]}function se(E){return l=l||{},W(l[E])&&(l[E]=[]),l[E]}}return t})(),FN=";",HN="=";function ES(t){if(!t)return{};var e=t[vs](FN),n=Rb(e,function(i,o){var a=o[vs](HN);if(a[be]===2){var s=a[0][Vc](),c=a[1];i[s]=c}return i},{});if(jr(n)[be]>0){if(n.endpointsuffix){var r=n.location?n.location+".":"";n[ro]=n[ro]||"https://"+r+"dc."+n.endpointsuffix}n[ro]=n[ro]||Qm,p_(n[ro],"/")&&(n[ro]=n[ro].slice(0,-1))}return n}var BN=(function(){function t(e,n,r){var i=this,o=this;o.ver=1,o.sampleRate=100,o.tags={},o[Dr]=At(e,r)||Or,o.data=n,o.time=ms(new Date),o[yh]={time:1,iKey:1,name:1,sampleRate:function(){return i.sampleRate===100?4:1},tags:1,data:1}}return t})(),wi=(function(){function t(e,n,r,i){this.aiDataContract={ver:1,name:1,properties:0,measurements:0};var o=this;o.ver=2,o[Dr]=At(e,n)||Or,o[Sr]=sa(e,r),o[Wr]=ca(e,i)}return t.envelopeType="Microsoft.ApplicationInsights.{0}.Event",t.dataType="EventData",t})(),KN=58,GN=/^\s{0,50}(from\s|at\s|Line\s{1,5}\d{1,10}\s{1,5}of|\w{1,50}@\w{1,80}|[^\(\s\n]+:[0-9\?]+(?::[0-9\?]+)?)/,qN=/^(?:\s{0,50}at)?\s{0,50}([^\@\()\s]+)?\s{0,50}(?:\s|\@|\()\s{0,5}([^\(\s\n\]]+):([0-9\?]+):([0-9\?]+)\)?$/,$N=/^(?:\s{0,50}at)?\s{0,50}([^\@\()\s]+)?\s{0,50}(?:\s|\@|\()\s{0,5}([^\(\s\n\]]+):([0-9\?]+)\)?$/,YN=/^(?:\s{0,50}at)?\s{0,50}([^\@\()\s]+)?\s{0,50}(?:\s|\@|\()\s{0,5}([^\(\s\n\)\]]+)\)?$/,zN=/(?:^|\(|\s{0,10}[\w\)]+\@)?([^\(\n\s\]\)]+)(?:\:([0-9]+)(?:\:([0-9]+))?)?\)?(?:,|$)/,jN=/([^\(\s\n]+):([0-9]+):([0-9]+)$/,VN=/([^\(\s\n]+):([0-9]+)$/,FC="<no_method>",ns="error",Un="stack",pg="stackDetails",HC="errorSrc",gg="message",_S="description",BC=[{re:qN,len:5,m:1,fn:2,ln:3,col:4},{chk:WN,pre:QN,re:$N,len:4,m:1,fn:2,ln:3},{re:YN,len:3,m:1,fn:2,hdl:GC},{re:zN,len:2,fn:1,hdl:GC}];function QN(t){return t.replace(/(\(anonymous\))/,"<anonymous>")}function WN(t){return gt(t,"[native")<0}function mg(t,e){var n=t;return n&&!Ce(n)&&(JSON&&JSON[Td]?(n=JSON[Td](t),e&&(!n||n==="{}")&&(Se(t[Qc])?n=t[Qc]():n=""+t)):n=""+t+" - (Missing JSON.stringify)"),n||""}function SS(t,e){var n=t;return t&&(n&&!Ce(n)&&(n=t[gg]||t[_S]||n),n&&!Ce(n)&&(n=mg(n,!0)),t.filename&&(n=n+" @"+(t.filename||"")+":"+(t.lineno||"?")+":"+(t.colno||"?"))),e&&e!=="String"&&e!=="Object"&&e!=="Error"&>(n||"",e)===-1&&(n=e+": "+n),n||""}function JN(t){try{if(Cn(t))return"hasFullStack"in t&&"typeName"in t}catch{}return!1}function XN(t){try{if(Cn(t))return"ver"in t&&"exceptions"in t&&"properties"in t}catch{}return!1}function KC(t){return t&&t.src&&Ce(t.src)&&t.obj&&ke(t.obj)}function io(t){var e=t||"";Ce(e)||(Ce(e[Un])?e=e[Un]:e=""+e);var n=e[vs](`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
`):e=t.src||""),e}function tO(t){var e,n=t.obj;if(n&&n[be]>0){e=[];var r=0,i=!1,o=0;ce(n,function(g){if(i||oO(g)){var m=an(g);i=!0;var v=aO(m,r);v&&(o+=v[_l],e.push(v),r++)}});var a=32*1024;if(o>a)for(var s=0,c=e[be]-1,u=0,l=s,d=c;s<c;){var p=e[s][_l],h=e[c][_l];if(u+=p+h,u>a){var f=d-l+1;e.splice(l,f);break}l=s,d=c,s++,c--}}return e}function Ad(t){var e="";if(t&&(e=t.typeName||t[Dr]||"",!e))try{var n=/function (.{1,200})\(/,r=n.exec(t.constructor[Qc]());e=r&&r[be]>1?r[1]:""}catch{}return e}function Xf(t){if(t)try{if(!Ce(t)){var e=Ad(t),n=mg(t,!1);return(!n||n==="{}")&&(t[ns]&&(t=t[ns],e=Ad(t)),n=mg(t,!0)),gt(n,e)!==0&&e!=="String"?e+":"+n:n}}catch{}return""+(t||"")}var Ln=(function(){function t(e,n,r,i,o,a){this.aiDataContract={ver:1,exceptions:1,severityLevel:0,properties:0,measurements:0};var s=this;s.ver=2,XN(n)?(s[Gs]=n[Gs]||[],s[Sr]=n[Sr],s[Wr]=n[Wr],n[mc]&&(s[mc]=n[mc]),n.id&&(s.id=n.id,n[Sr].id=n.id),n[Jf]&&(s[Jf]=n[Jf]),W(n.isManual)||(s.isManual=n.isManual)):(r||(r={}),a&&(r.id=a),s[Gs]=[IS(e,n,r)],s[Sr]=sa(e,r),s[Wr]=ca(e,i),o&&(s[mc]=o),a&&(s.id=a))}return t.CreateAutoException=function(e,n,r,i,o,a,s,c){var u=Ad(o||a||e);return{message:SS(e,u),url:n,lineNumber:r,columnNumber:i,error:Xf(o||a||e),evt:Xf(a||e),typeName:u,stackDetails:AS(s||o||a),errorSrc:c}},t.CreateFromInterface=function(e,n,r,i){var o=n[Gs]&&Lc(n[Gs],function(s){return iO(e,s)}),a=new t(e,cn(cn({},n),{exceptions:o}),r,i);return a},t.prototype.toInterface=function(){var e=this,n=e.exceptions,r=e.properties,i=e.measurements,o=e.severityLevel,a=e.problemGroup,s=e.id,c=e.isManual,u=n instanceof Array&&Lc(n,function(l){return l.toInterface()})||void 0;return{ver:"4.0",exceptions:u,severityLevel:o,properties:r,measurements:i,problemGroup:a,id:s,isManual:c}},t.CreateSimpleException=function(e,n,r,i,o,a){var s;return{exceptions:[(s={},s[Ed]=!0,s.message=e,s.stack=o,s.typeName=n,s)]}},t.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",t.dataType="ExceptionData",t.formatError=Xf,t})(),nO=rr({id:0,outerId:0,typeName:1,message:1,hasFullStack:0,stack:0,parsedStack:2});function rO(){var t=this,e=ke(t[ts])&&Lc(t[ts],function(r){return cO(r)}),n={id:t.id,outerId:t.outerId,typeName:t[Sl],message:t[yu],hasFullStack:t[Ed],stack:t[Un],parsedStack:e||void 0};return n}function IS(t,e,n){var r,i,o,a,s,c,u,l;if(JN(e))a=e[Sl],s=e[yu],u=e[Un],l=e[ts]||[],c=e[Ed];else{var d=e,p=d&&d.evt;Cm(d)||(d=d[ns]||p||d),a=At(t,Ad(d))||Or,s=fS(t,SS(e||d,a))||Or;var h=e[pg]||AS(e);l=tO(h),ke(l)&&Lc(l,function(f){f[_d]=At(t,f[_d]),f[Jr]=At(t,f[Jr])}),u=_N(t,eO(h)),c=ke(l)&&l[be]>0,n&&(n[Sl]=n[Sl]||a)}return r={},r[yh]=nO,r.id=i,r.outerId=o,r.typeName=a,r.message=s,r[Ed]=c,r.stack=u,r.parsedStack=l,r.toInterface=rO,r}function iO(t,e){var n=ke(e[ts])&&Lc(e[ts],function(i){return sO(i)})||e[ts],r=IS(t,cn(cn({},e),{parsedStack:n}));return r}function wS(t,e){var n=e[Wc](jN);if(n&&n[be]>=4)t[Jr]=n[1],t[ys]=parseInt(n[2]);else{var r=e[Wc](VN);r&&r[be]>=3?(t[Jr]=r[1],t[ys]=parseInt(r[2])):t[Jr]=e}}function GC(t,e,n){var r=t[Jr];e.fn&&n&&n[be]>e.fn&&(e.ln&&n[be]>e.ln?(r=Je(n[e.fn]||""),t[ys]=parseInt(Je(n[e.ln]||""))||0):r=Je(n[e.fn]||"")),r&&wS(t,r)}function oO(t){var e=!1;if(t&&Ce(t)){var n=Je(t);n&&(e=GN.test(n))}return e}var RS=rr({level:1,method:1,assembly:0,fileName:0,line:0});function aO(t,e){var n,r;if(t&&Ce(t)&&Je(t)){r=(n={},n[yh]=RS,n.level=e,n.assembly=Je(t),n.method=FC,n.fileName="",n.line=0,n.sizeInBytes=0,n);for(var i=0;i<BC[be];){var o=BC[i];if(o.chk&&!o.chk(t))break;o.pre&&(t=o.pre(t));var a=t[Wc](o.re);if(a&&a[be]>=o.len){o.m&&(r.method=Je(a[o.m]||FC)),o.hdl?o.hdl(r,o,a):o.fn&&(o.ln?(r[Jr]=Je(a[o.fn]||""),r[ys]=parseInt(Je(a[o.ln]||""))||0):wS(r,a[o.fn]||""));break}i++}}return bS(r)}function sO(t){var e,n=(e={},e[yh]=RS,e.level=t.level,e.method=t.method,e.assembly=t[_d],e.fileName=t[Jr],e.line=t[ys],e.sizeInBytes=0,e);return bS(n)}function bS(t){var e=KN;return t&&(e+=t.method[be],e+=t.assembly[be],e+=t.fileName[be],e+=t.level.toString()[be],e+=t.line.toString()[be],t[_l]=e),t}function cO(t){return{level:t.level,method:t.method,assembly:t[_d],fileName:t[Jr],line:t[ys]}}var uO=(function(){function t(){this.aiDataContract={name:1,kind:0,value:1,count:0,min:0,max:0,stdDev:0},this.kind=0}return t})(),Lo=(function(){function t(e,n,r,i,o,a,s,c,u){this.aiDataContract={ver:1,metrics:1,properties:0};var l=this;l.ver=2;var d=new uO;d[Ma]=i>0?i:void 0,d.max=isNaN(a)||a===null?void 0:a,d.min=isNaN(o)||o===null?void 0:o,d[Dr]=At(e,n)||Or,d.value=r,d.stdDev=isNaN(s)||s===null?void 0:s,l.metrics=[d],l[Sr]=sa(e,c),l[Wr]=ca(e,u)}return t.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",t.dataType="MetricData",t})(),qs="";function Ri(t){(isNaN(t)||t<0)&&(t=0),t=f_(t);var e=qs+t%1e3,n=qs+bn(t/1e3)%60,r=qs+bn(t/(1e3*60))%60,i=qs+bn(t/(1e3*60*60))%24,o=bn(t/(1e3*60*60*24));return e=e[be]===1?"00"+e:e[be]===2?"0"+e:e,n=n[be]<2?"0"+n:n,r=r[be]<2?"0"+r:r,i=i[be]<2?"0"+i:i,(o>0?o+".":qs)+i+":"+r+":"+n+"."+e}function lO(t,e,n,r,i){return!i&&Ce(t)&&(t==="Script error."||t==="Script error")}var Hi=(function(){function t(e,n,r,i,o,a,s){this.aiDataContract={ver:1,name:0,url:0,duration:0,properties:0,measurements:0,id:0};var c=this;c.ver=2,c.id=SN(e,s),c.url=Ch(e,r),c[Dr]=At(e,n)||Or,isNaN(i)||(c[Sd]=Ri(i)),c[Sr]=sa(e,o),c[Wr]=ca(e,a)}return t.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",t.dataType="PageviewData",t})(),Fo=(function(){function t(e,n,r,i,o,a,s,c,u,l,d,p){u===void 0&&(u="Ajax"),this.aiDataContract={id:1,ver:1,name:0,resultCode:0,duration:0,success:0,data:0,target:0,type:0,properties:0,measurements:0,kind:0,value:0,count:0,min:0,max:0,stdDev:0,dependencyKind:0,dependencySource:0,commandName:0,dependencyTypeName:0};var h=this;h.ver=2,h.id=n,h[Sd]=Ri(o),h.success=a,h.resultCode=s+"",h.type=At(e,u);var f=ON(e,r,c,i);h.data=Ch(e,i)||f.data,h.target=At(e,f.target),l&&(h.target="".concat(h.target," | ").concat(l)),h[Dr]=At(e,f[Dr]),h[Sr]=sa(e,d),h[Wr]=ca(e,p)}return t.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",t.dataType="RemoteDependencyData",t})(),rs=(function(){function t(e,n,r,i,o){this.aiDataContract={ver:1,message:1,severityLevel:0,properties:0};var a=this;a.ver=2,n=n||Or,a[yu]=fS(e,n),a[Sr]=sa(e,i),a[Wr]=ca(e,o),r&&(a[mc]=r)}return t.envelopeType="Microsoft.ApplicationInsights.{0}.Message",t.dataType="MessageData",t})(),is=(function(){function t(e,n,r,i,o,a,s){this.aiDataContract={ver:1,name:0,url:0,duration:0,perfTotal:0,networkConnect:0,sentRequest:0,receivedResponse:0,domProcessing:0,properties:0,measurements:0};var c=this;c.ver=2,c.url=Ch(e,r),c[Dr]=At(e,n)||Or,c[Sr]=sa(e,o),c[Wr]=ca(e,a),s&&(c.domProcessing=s.domProcessing,c[Sd]=s[Sd],c.networkConnect=s.networkConnect,c.perfTotal=s.perfTotal,c.receivedResponse=s.receivedResponse,c.sentRequest=s.sentRequest)}return t.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",t.dataType="PageviewPerformanceData",t})(),ua=(function(){function t(e,n){this.aiDataContract={baseType:1,baseData:1},this.baseType=e,this.baseData=n}return t})();function Xi(t){var e="ai."+t+".";return function(n){return e+n}}var $s=Xi("application"),It=Xi("device"),zu=Xi("location"),Ea=Xi("operation"),Zf=Xi("session"),gi=Xi("user"),oo=Xi("cloud"),Ys=Xi("internal"),kS=(function(t){ui(e,t);function e(){return t.call(this)||this}return e})(Rk({applicationVersion:$s("ver"),applicationBuild:$s("build"),applicationTypeId:$s("typeId"),applicationId:$s("applicationId"),applicationLayer:$s("layer"),deviceId:It("id"),deviceIp:It("ip"),deviceLanguage:It("language"),deviceLocale:It("locale"),deviceModel:It("model"),deviceFriendlyName:It("friendlyName"),deviceNetwork:It("network"),deviceNetworkName:It("networkName"),deviceOEMName:It("oemName"),deviceOS:It("os"),deviceOSVersion:It("osVersion"),deviceRoleInstance:It("roleInstance"),deviceRoleName:It("roleName"),deviceScreenResolution:It("screenResolution"),deviceType:It("type"),deviceMachineName:It("machineName"),deviceVMName:It("vmName"),deviceBrowser:It("browser"),deviceBrowserVersion:It("browserVersion"),locationIp:zu("ip"),locationCountry:zu("country"),locationProvince:zu("province"),locationCity:zu("city"),operationId:Ea("id"),operationName:Ea("name"),operationParentId:Ea("parentId"),operationRootId:Ea("rootId"),operationSyntheticSource:Ea("syntheticSource"),operationCorrelationVector:Ea("correlationVector"),sessionId:Zf("id"),sessionIsFirst:Zf("isFirst"),sessionIsNew:Zf("isNew"),userAccountAcquisitionDate:gi("accountAcquisitionDate"),userAccountId:gi("accountId"),userAgent:gi("userAgent"),userId:gi("id"),userStoreRegion:gi("storeRegion"),userAuthUserId:gi("authUserId"),userAnonymousUserAcquisitionDate:gi("anonUserAcquisitionDate"),userAuthenticatedUserAcquisitionDate:gi("authUserAcquisitionDate"),cloudName:oo("name"),cloudRole:oo("role"),cloudRoleVer:oo("roleVer"),cloudRoleInstance:oo("roleInstance"),cloudEnvironment:oo("environment"),cloudLocation:oo("location"),cloudDeploymentUnit:oo("deploymentUnit"),internalNodeName:Ys("nodeName"),internalSdkVersion:Ys("sdkVersion"),internalAgentVersion:Ys("agentVersion"),internalSnippet:Ys("snippet"),internalSdkSrc:Ys("sdkSrc")}));function Ti(t,e,n,r,i,o){n=At(r,n)||Or,(W(t)||W(e)||W(n))&&wn("Input doesn't contain all required fields");var a="";t[jf]&&(a=t[jf],delete t[jf]);var s={name:n,time:ms(new Date),iKey:a,ext:o||{},tags:[],data:{},baseType:e,baseData:t};return W(i)||Le(i,function(c,u){s.data[c]=u}),s}var An={UserExt:"user",DeviceExt:"device",TraceExt:"trace",WebExt:"web",AppExt:"app",OSExt:"os"},rt=new kS;function zs(t){var e=null;if(Se(Event))e=new Event(t);else{var n=Ft();n&&n.createEvent&&(e=n.createEvent("Event"),e.initEvent(t,!0,!0))}return e}function qC(t,e){Za(t,null,null,e)}function dO(t){var e=Ft(),n=xr(),r=!1,i=[],o=1;n&&!W(n.onLine)&&!n.onLine&&(o=2);var a=0,s=p(),c=Ji(qn("OfflineListener"),t);try{if(l(kn())&&(r=!0),e){var u=e.body||e;u.ononline&&l(u)&&(r=!0)}}catch{r=!1}function l(I){var R=!1;return I&&(R=Qr(I,"online",g,c),R&&Qr(I,"offline",m,c)),R}function d(){return s}function p(){return!(a===2||o===2)}function h(){var I=p();s!==I&&(s=I,ce(i,function(R){var A={isOnline:s,rState:o,uState:a};try{R(A)}catch{}}))}function f(I){a=I,h()}function g(){o=1,h()}function m(){o=2,h()}function v(){var I=kn();if(I&&r){if(qC(I,c),e){var R=e.body||e;st(R.ononline)||qC(R,c)}r=!1}}function y(I){return i.push(I),{rm:function(){var R=i.indexOf(I);if(R>-1)return i.splice(R,1)}}}return{isOnline:d,isListening:function(){return r},unload:v,addListener:y,setOnlineState:f}}var _h="AppInsightsPropertiesPlugin",PS="AppInsightsChannelPlugin",NS="ApplicationInsightsAnalytics",Id="toString",vg="isStorageUseDisabled",_a="_addHook",Ge="core",mi="dataType",ao="envelopeType",_n="diagLog",so="track",Al="trackPageView",Mn="config",yg="trackPreviousPageVisit",yo="sendPageViewInternal",ep="refUri",Cs="startTime",vc="properties",vr="duration",Cg="sendPageViewPerformanceInternal",nv="populatePageViewPerformanceEvent",xa="href",$C="sendExceptionInternal",js="error",tp="lineNumber",np="columnNumber",rp="CreateAutoException",ju="addTelemetryInitializer",hO="overridePageViewDuration",ip="autoExceptionInstrumented",OS="autoTrackPageVisitTime",DS="isBrowserLinkTrackingEnabled",Xc="length",MS="enableAutoRouteTracking",xS="enableUnhandledPromiseRejectionTracking",Tg="autoUnhandledPromiseInstrumented",Eg="getEntriesByType",US="isPerformanceTimingSupported",LS="getPerformanceTiming",wd="navigationStart",_g="shouldCollectDuration",FS="isPerformanceTimingDataReady",yc="responseStart",fO="requestStart",Il="loadEventEnd",Sg="responseEnd",wl="connectEnd",pO=(function(){function t(e,n,r,i){it(t,this,function(o){var a=null,s=[],c=!1,u=!1,l;r&&(l=r.logger);function d(f){r&&r.flush(f,function(){})}function p(){a||(a=Gn((function(){a=null;var f=s.slice(0),g=!1;s=[],ce(f,function(m){m()?g=!0:s.push(m)}),s[Xc]>0&&p(),g&&d(!0)}),100))}function h(f){s.push(f),p()}o[Al]=function(f,g){var m=f.name;if(W(m)||typeof m!="string"){var v=Ft();m=f.name=v&&v.title||""}var y=f.uri;if(W(y)||typeof y!="string"){var I=_r();y=f.uri=I&&I[xa]||""}if(r&&r[Mn]&&(y=f.uri=$r(f.uri,r[Mn])),!u){var R=ri(),A=R&&R[Eg]&&R[Eg]("navigation");if(A&&A[0]&&!st(R.timeOrigin)){var M=A[0].loadEventStart;f[Cs]=new Date(R.timeOrigin+M)}else{var b=(g||f[vc]||{})[vr]||0;f[Cs]=new Date(new Date().getTime()-b)}u=!0}if(!i[US]()){e[yo](f,g),d(!0),i_()||ne(l,2,25,"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");return}var _=!1,F,B=i[LS]()[wd];B>0&&(F=hn(B,+new Date),i[_g](F)||(F=void 0));var Q;!W(g)&&!W(g[vr])&&(Q=g[vr]),(n||!isNaN(Q))&&(isNaN(Q)&&(g||(g={}),g[vr]=F),e[yo](f,g),d(!0),_=!0);var ie=6e4;g||(g={}),h(function(){var se=!1;try{if(i[FS]()){se=!0;var E={name:m,uri:y};i[nv](E),!E.isValid&&!_?(g[vr]=F,e[yo](f,g)):(_||(g[vr]=E.durationMs,e[yo](f,g)),c||(e[Cg](E,g),c=!0))}else B>0&&hn(B,+new Date)>ie&&(se=!0,_||(g[vr]=ie,e[yo](f,g)))}catch(P){ne(l,1,38,"trackPageView failed on page load calculation: "+$e(P),{exception:ue(P)})}return se})},o.teardown=function(f,g){if(a){a.cancel(),a=null;var m=s.slice(0);s=[],ce(m,function(v){v()})}}})}return t.__ieDyn=1,t})(),gO=36e5,YC=["googlebot","adsbot-google","apis-google","mediapartners-google"];function HS(){var t=ri();return t&&!!t.timing}function mO(){var t=ri();return t&&t.getEntriesByType&&t.getEntriesByType("navigation")[Xc]>0}function vO(){var t=ri(),e=t?t.timing:0;return e&&e.domainLookupStart>0&&e[wd]>0&&e[yc]>0&&e[fO]>0&&e[Il]>0&&e[Sg]>0&&e[wl]>0&&e.domLoading>0}function zC(){return HS()?ri().timing:null}function yO(){return mO()?ri()[Eg]("navigation")[0]:null}function CO(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=xr()||{},r=n.userAgent,i=!1;if(r)for(var o=0;o<YC[Xc];o++)i=i||gt(r.toLowerCase(),YC[o])!==-1;if(i)return!1;for(var o=0;o<t[Xc];o++)if(t[o]<0||t[o]>=gO)return!1;return!0}var TO=(function(){function t(e){var n=aa(e);it(t,this,function(r){r[nv]=function(i){i.isValid=!1;var o=yO(),a=zC(),s=0,c=0,u=0,l=0,d=0;(o||a)&&(o?(s=o[vr],c=o[Cs]===0?o[wl]:hn(o[Cs],o[wl]),u=hn(o.requestStart,o[yc]),l=hn(o[yc],o[Sg]),d=hn(o.responseEnd,o[Il])):(s=hn(a[wd],a[Il]),c=hn(a[wd],a[wl]),u=hn(a.requestStart,a[yc]),l=hn(a[yc],a[Sg]),d=hn(a.responseEnd,a[Il])),s===0?ne(n,2,10,"error calculating page view performance.",{total:s,network:c,request:u,response:l,dom:d}):r[_g](s,c,u,l,d)?s<bn(c)+bn(u)+bn(l)+bn(d)?ne(n,2,8,"client performance math error.",{total:s,network:c,request:u,response:l,dom:d}):(i.durationMs=s,i.perfTotal=i[vr]=Ri(s),i.networkConnect=Ri(c),i.sentRequest=Ri(u),i.receivedResponse=Ri(l),i.domProcessing=Ri(d),i.isValid=!0):ne(n,2,45,"Invalid page load duration value. Browser perf data won't be sent.",{total:s,network:c,request:u,response:l,dom:d}))},r[LS]=zC,r[US]=HS,r[FS]=vO,r[_g]=CO})}return t.__ieDyn=1,t})(),EO=(function(){function t(e,n){var r="prevPageVisitData";it(t,this,function(i){i[yg]=function(s,c){try{var u=o(s,c);u&&n(u.pageName,u.pageUrl,u.pageVisitTime)}catch(l){xo(e,"Auto track page visit time failed, metric will not be collected: "+ue(l))}};function o(s,c){var u=null;try{if(u=a(),Jc()){fg(e,r)!=null&&wn("Cannot call startPageVisit consecutively without first calling stopPageVisit");var l=or().stringify(new _O(s,c));CS(e,r,l)}}catch(d){xo(e,"Call to restart failed: "+ue(d)),u=null}return u}function a(){var s=null;try{if(Jc()){var c=ir(),u=fg(e,r);u&&mu()&&(s=or().parse(u),s.pageVisitTime=c-s.pageVisitStartTime,TS(e,r))}}catch(l){xo(e,"Stop page visit timer failed: "+ue(l)),s=null}return s}He(i,"_logger",{g:function(){return e}}),He(i,"pageVisitTimeTrackingHandler",{g:function(){return n}})})}return t.__ieDyn=1,t})(),_O=(function(){function t(e,n){this.pageVisitStartTime=ir(),this.pageName=e,this.pageUrl=n}return t})(),jC=(function(){function t(e,n){var r=this,i={};r.start=function(o){typeof i[o]<"u"&&ne(e,2,62,"start was called more than once for this event without calling stop.",{name:o,key:o},!0),i[o]=+new Date},r.stop=function(o,a,s,c){var u=i[o];if(isNaN(u))ne(e,2,63,"stop was called without a corresponding start.",{name:o,key:o},!0);else{var l=+new Date,d=hn(u,l);r.action(o,a,d,s,c)}delete i[o],i[o]=void 0}}return t})(),Jt,SO="event";function Vs(t,e){t&&t.dispatchEvent&&e&&t.dispatchEvent(e)}function AO(t){if(t&&t.reason){var e=t.reason;return!Ce(e)&&Se(e[Id])?e[Id]():ue(e)}return t||""}var VC=6e4,IO=fu((Jt={sessionRenewalMs:tC(QC,1800*1e3),sessionExpirationMs:tC(QC,1440*60*1e3),disableExceptionTracking:_t()},Jt[OS]=_t(),Jt[hO]=_t(),Jt[xS]=_t(),Jt[Tg]=!1,Jt.samplingPercentage=hd(wO,100),Jt[vg]=_t(),Jt[DS]=_t(),Jt[MS]=_t(),Jt.namePrefix=mP(),Jt.enableDebug=_t(),Jt.disableFlushOnBeforeUnload=_t(),Jt.disableFlushOnUnload=_t(!1,"disableFlushOnBeforeUnload"),Jt.expCfg=Jn({inclScripts:!1,expLog:void 0,maxLogs:50}),Jt));function QC(t,e){return t=t||e,t<VC&&(t=VC),+t}function wO(t){return!isNaN(t)&&t>0&&t<=100}function RO(t){st(t[vg])||(t[vg]?DN():MN())}var bO=(function(t){ui(e,t);function e(){var n=t.call(this)||this;n.identifier=NS,n.priority=180,n.autoRoutePVDelay=500;var r,i,o,a,s,c,u,l,d,p,h,f,g,m,v,y,I,R,A,M,b;return it(e,n,function(_,F){var B=F[_a];D(),_.getCookieMgr=function(){return Km(_[Ge])},_.processTelemetry=function(T,C){_.processNext(T,C)},_.trackEvent=function(T,C){try{var L=Ti(T,wi[mi],wi[ao],_[_n](),C);_[Ge][so](L)}catch(X){k(2,39,"trackTrace failed, trace will not be collected: "+$e(X),{exception:ue(X)})}},_.startTrackEvent=function(T){try{r.start(T)}catch(C){k(1,29,"startTrackEvent failed, event will not be collected: "+$e(C),{exception:ue(C)})}},_.stopTrackEvent=function(T,C,L){try{r.stop(T,void 0,C,L)}catch(X){k(1,30,"stopTrackEvent failed, event will not be collected: "+$e(X),{exception:ue(X)})}},_.trackTrace=function(T,C){try{var L=Ti(T,rs[mi],rs[ao],_[_n](),C);_[Ge][so](L)}catch(X){k(2,39,"trackTrace failed, trace will not be collected: "+$e(X),{exception:ue(X)})}},_.trackMetric=function(T,C){try{var L=Ti(T,Lo[mi],Lo[ao],_[_n](),C);_[Ge][so](L)}catch(X){k(1,36,"trackMetric failed, metric will not be collected: "+$e(X),{exception:ue(X)})}},_[Al]=function(T,C){try{var L=T||{};_[Ge]&&_[Ge][Mn]&&(L.uri=$r(L.uri,_[Ge][Mn])),o[Al](L,cn(cn(cn({},L.properties),L.measurements),C)),y&&s[yg](L.name,L.uri)}catch(X){k(1,37,"trackPageView failed, page view will not be collected: "+$e(X),{exception:ue(X)})}},_[yo]=function(T,C,L){var X=Ft();if(X&&(T[ep]=T[ep]===void 0?X.referrer:T[ep]),_[Ge]&&_[Ge][Mn]&&(T.refUri=$r(T.refUri,_[Ge][Mn])),W(T[Cs])){var ee=(C||T[vc]||{})[vr]||0;T[Cs]=new Date(new Date().getTime()-ee)}var Ae=Ti(T,Hi[mi],Hi[ao],_[_n](),C,L);_[Ge][so](Ae),Q()},_[Cg]=function(T,C,L){var X=Ti(T,is[mi],is[ao],_[_n](),C,L);_[Ge][so](X)},_.trackPageViewPerformance=function(T,C){var L=T||{};try{a[nv](L),_[Cg](L,C)}catch(X){k(1,37,"trackPageViewPerformance failed, page view will not be collected: "+$e(X),{exception:ue(X)})}},_.startTrackPage=function(T){try{if(typeof T!="string"){var C=Ft();T=C&&C.title||""}i.start(T)}catch(L){k(1,31,"startTrackPage failed, page view may not be collected: "+$e(L),{exception:ue(L)})}},_.stopTrackPage=function(T,C,L,X){try{if(typeof T!="string"){var ee=Ft();T=ee&&ee.title||""}if(typeof C!="string"){var Ae=_r();C=Ae&&Ae[xa]||""}_[Ge]&&_[Ge][Mn]&&(C=$r(C,_[Ge][Mn])),i.stop(T,C,L,X),y&&s[yg](T,C)}catch(Re){k(1,32,"stopTrackPage failed, page view will not be collected: "+$e(Re),{exception:ue(Re)})}},_[$C]=function(T,C,L){var X=T&&(T.exception||T[js])||Cm(T)&&T||{name:T&&typeof T,message:T||Or};T=T||{};var ee=new Ln(_[_n](),X,T[vc]||C,T.measurements,T.severityLevel,T.id).toInterface(),Ae=Ft();if(Ae&&I?.inclScripts){var Re=FP(Ae);ee[vc].exceptionScripts=JSON.stringify(Re)}if(I?.expLog){var Pe=I.expLog();Pe&&Pe.logs&&ke(Pe.logs)&&(ee[vc].exceptionLog=Pe.logs.slice(0,I.maxLogs).join(`
|
|
7
|
-
`))}var qe=Ti(ee,Ln[mi],Ln[ao],_[_n](),C,L);_[Ge][so](qe)},_.trackException=function(T,C){T&&!T.exception&&T[js]&&(T.exception=T[js]);try{_[$C](T,C)}catch(L){k(1,35,"trackException failed, exception will not be collected: "+$e(L),{exception:ue(L)})}},_._onerror=function(T){var C=T&&T[js],L=T&&T.evt;try{if(!L){var X=kn();X&&(L=X[SO])}var ee=T&&T.url||(Ft()||{}).URL,Ae=T.errorSrc||"window.onerror@"+ee+":"+(T[tp]||0)+":"+(T[np]||0),Re={errorSrc:Ae,url:ee,lineNumber:T[tp]||0,columnNumber:T[np]||0,message:T.message};lO(T.message,T.url,T.lineNumber,T.columnNumber,T[js])?P(Ln[rp]("Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",ee,T[tp]||0,T[np]||0,C,L,null,Ae),Re):(T.errorSrc||(T.errorSrc=Ae),_.trackException({exception:T,severityLevel:3},Re))}catch(qe){var Pe=C?C.name+", "+C.message:"null";k(1,11,"_onError threw exception while logging error, error will not be collected: "+$e(qe),{exception:ue(qe),errorString:Pe})}},_[ju]=function(T){if(_[Ge])return _[Ge][ju](T);c||(c=[]),c.push(T)},_.initialize=function(T,C,L,X){if(!_.isInitialized()){W(C)&&wn("Error initializing"),F.initialize(T,C,L,X);try{M=Ji(qn(_.identifier),C.evtNamespace&&C.evtNamespace()),c&&(ce(c,function(ee){C[ju](ee)}),c=null),ie(T),a=new TO(_[Ge]),o=new pO(_,v.overridePageViewDuration,_[Ge],a),s=new EO(_[_n](),function(ee,Ae,Re){return se(ee,Ae,Re)}),r=new jC(_[_n](),"trackEvent"),r.action=function(ee,Ae,Re,Pe,qe){Pe||(Pe={}),qe||(qe={}),Pe.duration=Re[Id](),_.trackEvent({name:ee,properties:Pe,measurements:qe})},i=new jC(_[_n](),"trackPageView"),i.action=function(ee,Ae,Re,Pe,qe){W(Pe)&&(Pe={}),Pe.duration=Re[Id]();var Gt={name:ee,uri:Ae,properties:Pe,measurements:qe};_[yo](Gt,Pe)},hh()&&(Y(),U())}catch(ee){throw _.setInitialized(!1),ee}}},_._doTeardown=function(T,C){o&&o.teardown(T,C),Za(window,null,null,M),D()},_._getDbgPlgTargets=function(){return[b,f]};function Q(){if(_[Ge]){var T=_[Ge].getPlugin("AjaxDependencyPlugin");T&&T.plugin&&T.plugin.resetAjaxAttempts&&T.plugin.resetAjaxAttempts()}}function ie(T){var C=_.identifier,L=_[Ge];_[_a](vt(T,function(){var X=ar(null,T,L);v=X.getExtCfg(C,IO),f=f||T[ip]||v[ip],I=v.expCfg,y=v[OS],T.storagePrefix&&tv(T.storagePrefix),RO(v),u=v[DS],E()}))}function se(T,C,L){var X={PageName:T,PageUrl:C};_.trackMetric({name:"PageVisitTime",average:L,max:L,min:L,sampleCount:1},X)}function E(){if(!l&&u){var T=["/browserLinkSignalR/","/__browserLink/"],C=function(L){if(u&&L.baseType===Fo[mi]){var X=L.baseData;if(X){for(var ee=0;ee<T[Xc];ee++)if(X.target&>(X.target,T[ee])>=0)return!1}}return!0};_[_a](_[ju](C)),l=!0}}function P(T,C){var L=Ti(T,Ln[mi],Ln[ao],_[_n](),C);_[Ge][so](L)}function Y(){var T=kn(),C=_r();_[_a](vt(v,function(){h=v.disableExceptionTracking,!h&&!f&&!v[ip]&&(B($u(T,"onerror",{ns:M,rsp:function(L,X,ee,Ae,Re,Pe){!h&&L.rslt!==!0&&_._onerror(Ln[rp](X,ee,Ae,Re,Pe,L.evt))}},!1)),b++,f=!0)})),ve(T,C)}function U(){var T=kn(),C=_r();_[_a](vt(v,function(){if(d=v[MS]===!0,T&&d&&!p&&_b()){var L=r_();Se(L.pushState)&&Se(L.replaceState)&&typeof Event!==Nm&&le(T,L,C)}}))}function O(){var T=null;if(_[Ge]&&_[Ge].getTraceCtx&&(T=_[Ge].getTraceCtx(!1)),!T){var C=_[Ge].getPlugin(_h);if(C){var L=C.plugin.context;L&&(T=Xm(L.telemetryTrace))}}return T}function le(T,C,L){if(p)return;var X=v.namePrefix||"";function ee(){d&&Vs(T,zs(X+"locationchange"))}function Ae(){if(A&&(R=A),A=L&&L[xa]||"",_[Ge]&&_[Ge][Mn]&&(A=$r(A,_[Ge][Mn])),d){var Re=O();if(Re){Re.setTraceId(Pi());var Pe="_unknown_";L&&L.pathname&&(Pe=L.pathname+(L.hash||"")),Re.setName(At(_[_n](),Pe))}Gn((function(qe){_[Al]({refUri:qe,properties:{duration:0}})}).bind(_,R),_.autoRoutePVDelay)}}B($u(C,"pushState",{ns:M,rsp:function(){d&&(Vs(T,zs(X+"pushState")),Vs(T,zs(X+"locationchange")))}},!0)),B($u(C,"replaceState",{ns:M,rsp:function(){d&&(Vs(T,zs(X+"replaceState")),Vs(T,zs(X+"locationchange")))}},!0)),Qr(T,X+"popstate",ee,M),Qr(T,X+"locationchange",Ae,M),p=!0}function ve(T,C){_[_a](vt(v,function(){g=v[xS]===!0,f=f||v[Tg],g&&!m&&(B($u(T,"onunhandledrejection",{ns:M,rsp:function(L,X){g&&L.rslt!==!0&&_._onerror(Ln[rp](AO(X),C?C[xa]:"",0,0,X,L.evt))}},!1)),b++,v[Tg]=m=!0)}))}function k(T,C,L,X,ee){_[_n]().throwInternal(T,C,L,X,ee)}function D(){r=null,i=null,o=null,a=null,s=null,c=null,u=!1,l=!1,d=!1,p=!1,h=!1,f=!1,g=!1,m=!1,y=!1,Q();var T=_r();R=T&&T[xa]||"",_[Ge]&&_[Ge][Mn]&&(R=$r(R,_[Ge][Mn])),A=null,M=null,v=null,b=0,He(_,"config",{g:function(){return v}})}He(_,"_pageViewManager",{g:function(){return o}}),He(_,"_pageViewPerformanceManager",{g:function(){return a}}),He(_,"_pageVisitTimeManager",{g:function(){return s}}),He(_,"_evtNamespace",{g:function(){return"."+M}})}),n}return e.Version="3.3.11",e})(Is),Rl="featureOptIn",BS="scheduleFetchTimeout";function KS(t,e,n,r){try{var i=n>r;i&&(t=null);var o=n==0?Bb({},t):t;return o&&e&&!i&&Le(o,function(a){var s=e[a];s&&(Cn(o[a])&&Cn(s)?o[a]=KS(o[a],s,++n,r):delete o[a])}),o}catch{}return t}var os="featureOptIn.",GS=".mode",qS=".onCfg",$S=".offCfg";function kO(t,e,n){var r;if(!e||!e.enabled)return null;var i=(e[Rl]||{})[t]||{mode:1},o=i.mode,a=i.onCfg,s=i.offCfg,c=(n||{})[t]||{mode:2},u=c.mode,l=c.onCfg,d=c.offCfg,p=!!c.blockCdnCfg,h=os+t+GS,f=os+t+qS,g=os+t+$S,m=u,v=l,y=d;return p||(o===4||o===5?(m=o==4?3:2,v=a||l,y=s||d):o===2||u===2?(m=2,v=l||a,y=d||s):o===3?(m=3,v=l||a,y=d||s):o===1&&u===1&&(m=1)),r={},r[h]=m,r[f]=v,r[g]=y,r}function PO(t,e){try{if(!t||!t.enabled)return null;if(!t[Rl])return t.config;var n=t[Rl],r=t.config||{};return Le(n,function(i){var o=kO(i,t,e.config[Rl]);W(o)||(Le(o,function(a,s){h_(r,a,s)}),NO(i,o,r))}),r}catch{}return null}function NO(t,e,n){var r=e[os+t+GS],i=e[os+t+qS],o=e[os+t+$S],a=null;r===3&&(a=i),r===2&&(a=o),a&&Le(a,function(s,c){h_(n,s,c)})}var Qs,OO="ai_cfgsync",WC="GET",DO=18e5,Sa=void 0,MO={instrumentationKey:!0,connectionString:!0,endpointUrl:!0},xO=fu((Qs={syncMode:1,blkCdnCfg:Sa,customEvtName:Sa,cfgUrl:Sa,overrideSyncFn:Sa,overrideFetchFn:Sa,onCfgChangeReceive:Sa},Qs[BS]=DO,Qs.nonOverrideConfigs=MO,Qs.enableAjax=!1,Qs)),UO=(function(t){ui(e,t);function e(){var n=t.call(this)||this;n.priority=198,n.identifier="AppInsightsCfgSyncPlugin";var r,i,o,a,s,c,u,l,d,p,h,f,g,m,v,y,I=!1,R;return it(e,n,function(A,M){b(),A.initialize=function(D,T,C,L){M.initialize(D,T,C,L),a=Ji(qn(A.identifier),T.evtNamespace&&T.evtNamespace()),_(D)},A.getCfg=function(){return i},A.pause=function(){I=!0,k()},A.resume=function(){I=!1,ve()},A.setCfg=function(D){return F(D)},A.sync=function(D){return Q(D)},A.updateEventListenerName=function(D){return ie(D)},A._doTeardown=function(D,T){B(),k(),b()},A._getDbgPlgTargets=function(){return[l,u,o,d,g]};function b(){i=null,o=null,a=null,s=null,u=null,l=null,g=null,c=null,p=null,h=null,d=null,R=!1,v=null,y=null,f=null}function _(D){var T=A.identifier,C=A.core;A._addHook(vt(D,function(){var L=ar(null,D,C);r=L.getExtCfg(T,xO);var X=d;d=!!r.blkCdnCfg,R=!!r.enableAjax,!W(X)&&X!==d&&(!d&&s?m&&m(s,Y,l):k()),W(u)&&(u=r.syncMode===2),W(l)&&(l=r.syncMode===1);var ee=r.customEvtName||OO;o!==ee&&(u?ie(ee):(B(),o=ee)),W(s)&&(s=r.cfgUrl),s||(i=D,l&&Q())})),y=r.overrideSyncFn,v=r.overrideFetchFn,f=r.onCfgChangeReceive,g=r.nonOverrideConfigs,p=r[BS],m=se(),h=0,s&&!d&&m&&m(s,Y,l)}function F(D,T){if(D){if(i=D,T&&!I)return Q();if(u&&!I)return A.core.updateCfg(D),!0}return!1}function B(){try{var D=Bn();D&&Za(D,null,null,a)}catch{}}function Q(D){try{return y&&Se(y)?y(i,D):Vk(o,i,D)}catch{}return!1}function ie(D){try{return B(),D&&(o=D,O()),!0}catch{}return!1}function se(){var D=v;return W(D)&&(xm()?D=E:gh()&&(D=P)),D}function E(D,T,C){var L=Bn(),X=L&&L.fetch||null;if(D&&X&&Se(X))try{var ee={method:WC};R||(ee[Io]=!0);var Ae=new Request(D,ee);if(!R)try{Ae[Io]=!0}catch{}gn(fetch(Ae),function(Re){var Pe=Re.value;Re.rejected?U(T,400):Pe.ok?gn(Pe.text(),function(qe){U(T,Pe.status,qe.value,C)}):U(T,Pe.status,null,C)})}catch{}}function P(D,T,C){try{var L=new XMLHttpRequest;R||(L[Io]=!0),L.open(WC,D),L.onreadystatechange=function(){L.readyState===XMLHttpRequest.DONE&&U(T,L.status,L.responseText,C)},L.onerror=function(){U(T,400)},L.ontimeout=function(){U(T,400)},L.send()}catch{}}function Y(D,T,C){try{if(D>=200&&D<400&&T){h=0;var L=or();if(L){var X=L.parse(T),ee=PO(X,A.core),Ae=ee&&sn(ee)&&le(ee);Ae&&F(Ae,C)}}else h++;h<3&&ve()}catch{}}function U(D,T,C,L){try{D(T,C,L)}catch{}}function O(){if(u){var D=Bn();if(D)try{Qr(D,o,function(T){var C=T&&T.detail;if(f&&C)f(C);else{var L=C&&C.cfg,X=L&&sn(L)&&le(L);X&&F(X)}},a,!0)}catch{}}}function le(D,T){var C=null;try{D&&(C=KS(D,g,0,5))}catch{}return C}function ve(){!c&&p&&(c=Gn(function(){c=null,m(s,Y,l)},p),c.unref())}function k(){c&&c.cancel(),c=null,h=0}A.processTelemetry=function(D,T){A.processNext(D,T)}}),n}return e.__ieDyn=1,e})(Is),fo="duration",Lt="tags",op="deviceType",Rn="data",oi="name",Zc="traceID",Ue="length",eu="stringify",la="measurements",br="dataType",da="envelopeType",po="toString",Ho="enqueue",Bo="count",Xr="push",Ag="emitLineDelimitedJson",as="clear",Rd="markAsSent",bc="clearSent",rv="bufferOverride",Ws="BUFFER_KEY",vi="SENT_BUFFER_KEY",Ua="concat",Js="MAX_BUFFER_SIZE",Xs="triggerSend",$t="diagLog",ap="initialize",Zs="_sender",ec="endpointUrl",Cc="instrumentationKey",Ig="customHeaders",YS="maxBatchSizeInBytes",wg="onunloadDisableBeacon",Rg="isBeaconApiDisabled",zS="alwaysUseXhrOverride",jS="enableSessionStorageBuffer",fr="_buffer",VS="onunloadDisableFetch",QS="disableSendBeaconSplit",Vu="getSenderInst",co="_onError",sp="_onPartialSuccess",Qu="_onSuccess",cp="itemsReceived",up="itemsAccepted",lp="baseType",bd="sampleRate",LO="getHashCodeScore",dp="baseType",ct="baseData",Dt="properties",JC="true";function mt(t,e,n){return et(t,e,n,$l)}function FO(t,e,n){var r=n[Lt]=n[Lt]||{},i=e.ext=e.ext||{},o=e[Lt]=e[Lt]||[],a=i.user;a&&(mt(r,rt.userAuthUserId,a.authId),mt(r,rt.userId,a.id||a.localId));var s=i.app;s&&mt(r,rt.sessionId,s.sesId);var c=i.device;c&&(mt(r,rt.deviceId,c.id||c.localId),mt(r,rt[op],c.deviceClass),mt(r,rt.deviceIp,c.ip),mt(r,rt.deviceModel,c.model),mt(r,rt[op],c[op]));var u=e.ext.web;if(u){mt(r,rt.deviceLanguage,u.browserLang),mt(r,rt.deviceBrowserVersion,u.browserVer),mt(r,rt.deviceBrowser,u.browser);var l=n[Rn]=n[Rn]||{},d=l[ct]=l[ct]||{},p=d[Dt]=d[Dt]||{};mt(p,"domain",u.domain),mt(p,"isManual",u.isManual?JC:null),mt(p,"screenRes",u.screenRes),mt(p,"userConsent",u.userConsent?JC:null)}var h=i.os;h&&(mt(r,rt.deviceOS,h[oi]),mt(r,rt.deviceOSVersion,h.osVer));var f=i.trace;f&&(mt(r,rt.operationParentId,f.parentID),mt(r,rt.operationName,At(t,f[oi])),mt(r,rt.operationId,f[Zc]));for(var g={},m=o[Ue]-1;m>=0;m--){var v=o[m];Le(v,function(I,R){g[I]=R}),o.splice(m,1)}Le(o,function(I,R){g[I]=R});var y=cn(cn({},r),g);y[rt.internalSdkVersion]||(y[rt.internalSdkVersion]=At(t,"javascript:".concat(HO.Version),64)),n[Lt]=P_(y)}function Vi(t,e,n){W(t)||Le(t,function(r,i){hu(i)?n[r]=i:Ce(i)?e[r]=i:mu()&&(e[r]=or()[eu](i))})}function ha(t,e){W(t)||Le(t,function(n,r){t[n]=r||e})}function fa(t,e,n,r){var i=new BN(t,r,e);mt(i,"sampleRate",n[dS]),(n[ct]||{}).startTime&&(i.time=ms(n[ct].startTime)),i.iKey=n.iKey;var o=n.iKey.replace(/-/g,"");return i[oi]=i[oi].replace("{0}",o),FO(t,n,i),n[Lt]=n[Lt]||[],P_(i)}function pa(t,e){W(e[ct])&&ne(t,1,46,"telemetryItem.baseData cannot be null.")}var HO={Version:"3.3.11"};function BO(t,e,n){pa(t,e);var r=e[ct][la]||{},i=e[ct][Dt]||{};Vi(e[Rn],i,r),W(n)||ha(i,n);var o=e[ct];if(W(o))return xo(t,"Invalid input for dependency data"),null;var a=o[Dt]&&o[Dt][OC]?o[Dt][OC]:"GET",s=new Fo(t,o.id,o.target,o[oi],o[fo],o.success,o.responseCode,a,o.type,o.correlationContext,i,r),c=new ua(Fo[br],s);return fa(t,Fo[da],e,c)}function WS(t,e,n){pa(t,e);var r={},i={};e[dp]!==wi[br]&&(r.baseTypeSource=e[dp]),e[dp]===wi[br]?(r=e[ct][Dt]||{},i=e[ct][la]||{}):e[ct]&&Vi(e[ct],r,i),Vi(e[Rn],r,i),W(n)||ha(r,n);var o=e[ct][oi],a=new wi(t,o,r,i),s=new ua(wi[br],a);return fa(t,wi[da],e,s)}function KO(t,e,n){pa(t,e);var r=e[ct][la]||{},i=e[ct][Dt]||{};Vi(e[Rn],i,r),W(n)||ha(i,n);var o=e[ct],a=Ln.CreateFromInterface(t,o,i,r),s=new ua(Ln[br],a);return fa(t,Ln[da],e,s)}function GO(t,e,n){pa(t,e);var r=e[ct],i=r[Dt]||{},o=r[la]||{};Vi(e[Rn],i,o),W(n)||ha(i,n);var a=new Lo(t,r[oi],r.average,r.sampleCount,r.min,r.max,r.stdDev,i,o),s=new ua(Lo[br],a);return fa(t,Lo[da],e,s)}function qO(t,e,n){pa(t,e);var r,i=e[ct];!W(i)&&!W(i[Dt])&&!W(i[Dt][fo])?(r=i[Dt][fo],delete i[Dt][fo]):!W(e[Rn])&&!W(e[Rn][fo])&&(r=e[Rn][fo],delete e[Rn][fo]);var o=e[ct],a;((e.ext||{}).trace||{})[Zc]&&(a=e.ext.trace[Zc]);var s=o.id||a,c=o[oi],u=o.uri,l=o[Dt]||{},d=o[la]||{};if(W(o.refUri)||(l.refUri=o.refUri),W(o.pageType)||(l.pageType=o.pageType),W(o.isLoggedIn)||(l.isLoggedIn=o.isLoggedIn[po]()),!W(o[Dt])){var p=o[Dt];Le(p,function(g,m){l[g]=m})}Vi(e[Rn],l,d),W(n)||ha(l,n);var h=new Hi(t,c,u,r,l,d,s),f=new ua(Hi[br],h);return fa(t,Hi[da],e,f)}function $O(t,e,n){pa(t,e);var r=e[ct],i=r[oi],o=r.uri||r.url,a=r[Dt]||{},s=r[la]||{};Vi(e[Rn],a,s),W(n)||ha(a,n);var c=new is(t,i,o,void 0,a,s,r),u=new ua(is[br],c);return fa(t,is[da],e,u)}function YO(t,e,n){pa(t,e);var r=e[ct].message,i=e[ct].severityLevel,o=e[ct][Dt]||{},a=e[ct][la]||{};Vi(e[Rn],o,a),W(n)||ha(o,n);var s=new rs(t,r,i,o,a),c=new ua(rs[br],s);return fa(t,rs[da],e,c)}var JS=(function(){function t(e,n){var r=[],i=!1,o=n.maxRetryCnt;this._get=function(){return r},this._set=function(a){return r=a,r},it(t,this,function(a){a[Ho]=function(s){if(a[Bo]()>=n.eventsLimitInMem){i||(ne(e,2,105,"Maximum in-memory buffer size reached: "+a[Bo](),!0),i=!0);return}s.cnt=s.cnt||0,!(!W(o)&&s.cnt>o)&&r[Xr](s)},a[Bo]=function(){return r[Ue]},a.size=function(){for(var s=r[Ue],c=0;c<r[Ue];c++)s+=r[c].item[Ue];return n[Ag]||(s+=2),s},a[as]=function(){r=[],i=!1},a.getItems=function(){return r.slice(0)},a.batchPayloads=function(s){if(s&&s[Ue]>0){var c=[];ce(s,function(l){c[Xr](l.item)});var u=n[Ag]?c.join(`
|
|
8
|
-
|
|
9
|
-
`,{name:s},!0);else{c=[];for(var u=0;u<a[Ue];u++){var l=a[u],d=r(l,s+"["+u+"]");c[Xr](d)}}return c}function o(a,s,c){var u;return a&&(u={},Le(a,function(l,d){if(s==="string")d===void 0?u[l]="undefined":d===null?u[l]="null":d[po]?u[l]=d[po]():u[l]="invalid field: toString() is not defined.";else if(s==="number")if(d===void 0)u[l]="undefined";else if(d===null)u[l]="null";else{var p=parseFloat(d);u[l]=p}else u[l]="invalid field: "+c+" is of unknown type.",ne(e,1,u[l],null,!0)})),u}})}return t.__ieDyn=1,t})(),VO=8,QO=(function(){function t(){}return t.prototype.getHashCodeScore=function(e){var n=this.getHashCode(e)/t.INT_MAX_VALUE;return n*100},t.prototype.getHashCode=function(e){if(e==="")return 0;for(;e[Ue]<VO;)e=e[Ua](e);for(var n=5381,r=0;r<e[Ue];++r)n=(n<<5)+n+e.charCodeAt(r),n=n&n;return Math.abs(n)},t.INT_MAX_VALUE=2147483647,t})(),WO=(function(){function t(){var e=this,n=new QO,r=new kS;e.getSamplingScore=function(i){var o=0;return i[Lt]&&i[Lt][r.userId]?o=n.getHashCodeScore(i[Lt][r.userId]):i.ext&&i.ext.user&&i.ext.user.id?o=n[LO](i.ext.user.id):i[Lt]&&i[Lt][r.operationId]?o=n.getHashCodeScore(i[Lt][r.operationId]):i.ext&&i.ext.telemetryTrace&&i.ext.telemetryTrace[Zc]?o=n.getHashCodeScore(i.ext.telemetryTrace[Zc]):o=Math.random()*100,o}}return t})(),JO=(function(){function t(e,n){this.INT_MAX_VALUE=2147483647;var r=n||aa(null);(e>100||e<0)&&(r.throwInternal(2,58,"Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.",{samplingRate:e},!0),e=100),this[bd]=e,this.samplingScoreGenerator=new WO}return t.prototype.isSampledIn=function(e){var n=this[bd],r=!1;return n==null||n>=100||e.baseType===Lo[br]?!0:(r=this.samplingScoreGenerator.getSamplingScore(e)<n,r)},t})(),nt,Fr,Wn=void 0,XC="",XO=65e3;function ZC(t){try{return t.responseText}catch{}return null}function ZO(t){return t&&t.sendPOST}var eT=fu((nt={endpointUrl:hd($l,Qm+es)},nt[Ag]=_t(),nt.maxBatchInterval=15e3,nt[YS]=102400,nt.disableTelemetry=_t(),nt[jS]=_t(!0),nt.isRetryDisabled=_t(),nt[Rg]=_t(!0),nt[QS]=_t(!0),nt.disableXhr=_t(),nt[VS]=_t(),nt[wg]=_t(),nt[Cc]=Wn,nt.namePrefix=Wn,nt.samplingPercentage=hd(eD,100),nt[Ig]=Wn,nt.convertUndefined=Wn,nt.eventsLimitInMem=1e4,nt[rv]=!1,nt.httpXHROverride={isVal:ZO,v:Wn},nt[zS]=_t(),nt.transports=Wn,nt.retryCodes=Wn,nt.corsPolicy=Wn,nt.maxRetryCnt={isVal:hu,v:10},nt)),tT="X-Set-Cross-Origin-Resource-Policy";function eD(t){return!isNaN(t)&&t>0&&t<=100}var tD=(Fr={},Fr[wi.dataType]=WS,Fr[rs.dataType]=YO,Fr[Hi.dataType]=qO,Fr[is.dataType]=$O,Fr[Ln.dataType]=KO,Fr[Lo.dataType]=GO,Fr[Fo.dataType]=BO,Fr),nD=(function(t){ui(e,t);function e(){var n=t.call(this)||this;n.priority=1001,n.identifier=PS;var r,i,o,a,s,c,u,l,d=0,p,h,f,g,m,v,y,I,R,A,M,b,_,F,B,Q,ie,se,E,P,Y,U,O,le,ve,k,D,T;return it(e,n,function(C,L){ku(),C.pause=function(){Nt(),a=!0},C.resume=function(){a&&(a=!1,i=null,H(),tt())},C.flush=function(N,$,te){if(N===void 0&&(N=!0),!a){Nt();try{var pe=C[Xs](N,null,te||1);return gn(pe,function(_e){return $?($(!_e.rejected),!0):N?Pr(function(Ie){Ie(!_e.rejected)}):pe})}catch(_e){ne(C[$t](),1,22,"flush failed, telemetry will not be collected: "+$e(_e),{exception:ue(_e)})}}},C.onunloadFlush=function(){if(!a)if(y||P)try{return C[Xs](!0,Z,2)}catch(N){ne(C[$t](),1,20,"failed to flush with beacon sender on page unload, telemetry will not be collected: "+$e(N),{exception:ue(N)})}else C.flush(!1)},C.addHeader=function(N,$){l[N]=$},C[ap]=function(N,$,te,pe){C.isInitialized()&&ne(C[$t](),1,28,"Sender is already initialized"),L[ap](N,$,te,pe);var _e=C.identifier;c=new jO($.logger),r=0,i=null,o=0,C[Zs]=null,u=0;var Ie=C[$t]();f=Ji(qn("Sender"),$.evtNamespace&&$.evtNamespace()),h=dO(f),C._addHook(vt(N,function(Ke){var at=Ke.cfg;at.storagePrefix&&tv(at.storagePrefix);var dn=ar(null,at,$),Ne=dn.getExtCfg(_e,eT),xs=Ne[ec];if(g&&xs===g){var Lr=at[ec];Lr&&Lr!==xs&&(Ne[ec]=Lr)}var Us=ut("CompressionStream");T=yl("zipPayload",at,!1),Se(Us)||(T=!1);var to=Ne.corsPolicy;to?(to==="same-origin"||to==="same-site"||to==="cross-origin")&&n.addHeader(tT,to):delete l[tT],zi(Ne[Cc])&&(Ne[Cc]=at[Cc]),He(C,"_senderConfig",{g:function(){return Ne}}),m!==Ne[ec]&&(g=m=Ne[ec]),$.activeStatus()===_i.PENDING?C.pause():$.activeStatus()===_i.ACTIVE&&C.resume(),A&&A!==Ne[Ig]&&ce(A,function(Mt){delete l[Mt.header]}),v=Ne[YS],y=(Ne[wg]===!1||Ne[Rg]===!1)&&fc(),I=Ne[wg]===!1&&fc(),R=Ne[Rg]===!1&&fc(),P=Ne[zS],Y=!!Ne.disableXhr,D=Ne.retryCodes;var Jh=Ne[rv],va=!!Ne[jS]&&(!!Jh||Jc()),ky=Ne.namePrefix,HR=va!==Q||va&&se!==ky||va&&ie!==Jh;if(C[fr]){if(HR)try{C[fr]=C[fr].createNew(Ie,Ne,va)}catch(Mt){ne(C[$t](),1,12,"failed to transfer telemetry to different buffer storage, telemetry will be lost: "+$e(Mt),{exception:ue(Mt)})}H()}else C[fr]=va?new XS(Ie,Ne):new iv(Ie,Ne);se=ky,Q=va,ie=Jh,U=!Ne[VS]&&xm(!0),ve=!!Ne[QS],C._sample=new JO(Ne.samplingPercentage,Ie),b=Ne[Cc],!zi(b)&&!ma(b,at)&&ne(Ie,1,100,"Invalid Instrumentation key "+b),A=Ne[Ig],Ce(g)&&!hg(g)&&A&&A[Ue]>0?ce(A,function(Mt){n.addHeader(Mt.header,Mt.value)}):A=null,E=Ne.enableSendPromise;var Py=ee();k?k.SetConfig(Py):(k=new aN,k[ap](Py,Ie));var Pu=Ne.httpXHROverride,Nu=null,Ls=null,BR=Xy([3,1,2],Ne.transports);Nu=k&&k[Vu](BR,!1);var Xh=k&&k.getFallbackInst();O=function(Mt,no){return me(Xh,Mt,no)},le=function(Mt,no){return me(Xh,Mt,no,!1)},Nu=P?Pu:Nu||Pu||Xh,C[Zs]=function(Mt,no){return me(Nu,Mt,no)},U&&(p=Oe);var Zh=Xy([3,1],Ne.unloadTransports);U||(Zh=Zh.filter(function(Mt){return Mt!==2})),Ls=k&&k[Vu](Zh,!0),Ls=P?Pu:Ls||Pu,(P||Ne.unloadTransports||!p)&&Ls&&(p=function(Mt,no){return me(Ls,Mt,no)}),p||(p=O),M=Ne.disableTelemetry,_=Ne.convertUndefined||Wn,F=Ne.isRetryDisabled,B=Ne.maxBatchInterval}))},C.processTelemetry=function(N,$){$=C._getTelCtx($);var te=$[$t]();try{var pe=Ve(N,te);if(!pe)return;var _e=Ze(N,te);if(!_e)return;var Ie=c.serialize(_e),Ke=C[fr];H(Ie);var at={item:Ie,cnt:0};Ke[Ho](at),tt()}catch(dn){ne(te,2,12,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+$e(dn),{exception:ue(dn)})}C.processNext(N,$)},C.isCompletelyIdle=function(){return!a&&d===0&&C._buffer[Bo]()===0},C.getOfflineListener=function(){return h},C._xhrReadyStateChange=function(N,$,te){if(!ye($))return Ae(N,$,te)},C[Xs]=function(N,$,te){N===void 0&&(N=!0);var pe;if(!a)try{var _e=C[fr];if(M)_e[as]();else{if(_e[Bo]()>0){var Ie=_e.getItems();ln(te||0,N),$?pe=$.call(C,Ie,N):pe=C[Zs](Ie,N)}o=+new Date}Nt()}catch(at){var Ke=U_();(!Ke||Ke>9)&&ne(C[$t](),1,40,"Telemetry transmission failed, some telemetry will be lost: "+$e(at),{exception:ue(at)})}return pe},C.getOfflineSupport=function(){return{getUrl:function(){return g},createPayload:On,serialize:qt,batch:Ur,shouldProcess:function(N){return!!Ve(N)}}},C._doTeardown=function(N,$){C.onunloadFlush(),Ya(h,!1),ku()},C[co]=function(N,$,te){if(!ye(N))return Re(N,$)},C[sp]=function(N,$){if(!ye(N))return Pe(N,$)},C[Qu]=function(N,$){if(!ye(N))return qe(N)},C._xdrOnLoad=function(N,$){if(!ye($))return X(N,$)};function X(N,$){var te=ZC(N);if(N&&(te+""=="200"||te===""))r=0,C[Qu]($,0);else{var pe=qf(te);pe&&pe[cp]&&pe[cp]>pe[up]&&!F?C[sp]($,pe):C[co]($,O_(N))}}function ee(){try{var N={xdrOnComplete:function(te,pe,_e){var Ie=Gt(_e);if(Ie)return X(te,Ie)},fetchOnComplete:function(te,pe,_e,Ie){var Ke=Gt(Ie);if(Ke)return V(te.status,Ke,te.url,Ke[Ue],te.statusText,_e||"")},xhrOnComplete:function(te,pe,_e){var Ie=Gt(_e);if(Ie)return Ae(te,Ie,Ie[Ue])},beaconOnRetry:function(te,pe,_e){return fe(te,pe,_e)}},$={enableSendPromise:E,isOneDs:!1,disableCredentials:!1,disableXhr:Y,disableBeacon:!R,disableBeaconSync:!I,senderOnCompleteCallBack:N};return $}catch{}return null}function Ae(N,$,te){N.readyState===4&&V(N.status,$,N.responseURL,te,ud(N),ZC(N)||N.response)}function Re(N,$,te){ne(C[$t](),2,26,"Failed to send telemetry.",{message:$}),C._buffer&&C._buffer[bc](N)}function Pe(N,$){for(var te=[],pe=[],_e=$.errors.reverse(),Ie=0,Ke=_e;Ie<Ke.length;Ie++){var at=Ke[Ie],dn=N.splice(at.index,1)[0];dr(at.statusCode)?pe[Xr](dn):te[Xr](dn)}N[Ue]>0&&C[Qu](N,$[up]),te[Ue]>0&&C[co](te,ud(null,["partial success",$[up],"of",$.itemsReceived].join(" "))),pe[Ue]>0&&(we(pe),ne(C[$t](),2,40,"Partial success. Delivered: "+N[Ue]+", Failed: "+te[Ue]+". Will retry to send "+pe[Ue]+" our of "+$[cp]+" items"))}function qe(N,$){C._buffer&&C._buffer[bc](N)}function Gt(N){try{if(N){var $=N,te=$.oriPayload;return te&&te[Ue]?te:null}}catch{}return null}function Ve(N,$){if(M)return!1;if(!N)return $&&ne($,1,7,"Cannot send empty telemetry"),!1;if(N.baseData&&!N[lp])return $&&ne($,1,70,"Cannot send telemetry without baseData and baseType"),!1;if(N[lp]||(N[lp]="EventData"),!C[Zs])return $&&ne($,1,28,"Sender was not initialized"),!1;if(q(N))N[dS]=C._sample[bd];else return $&&ne($,2,33,"Telemetry item was sampled out and not sent",{SampleRate:C._sample[bd]}),!1;return!0}function Ze(N,$){var te=N.iKey||b,pe=e.constructEnvelope(N,te,$,_);if(!pe){ne($,1,47,"Unable to create an AppInsights envelope");return}var _e=!1;if(N[Lt]&&N[Lt][zf]&&(ce(N[Lt][zf],function(Ie){try{Ie&&Ie(pe)===!1&&(_e=!0,xo($,"Telemetry processor check returns false"))}catch(Ke){ne($,1,64,"One of telemetry initializers failed, telemetry item will not be sent: "+$e(Ke),{exception:ue(Ke)},!0)}}),delete N[Lt][zf]),!_e)return pe}function qt(N){var $=XC,te=C[$t]();try{var pe=Ve(N,te),_e=null;pe&&(_e=Ze(N,te)),_e&&($=c.serialize(_e))}catch{}return $}function Ur(N){var $=XC;return N&&N[Ue]&&($="["+N.join(",")+"]"),$}function On(N){var $=w();return{urlString:g,data:N,headers:$}}function q(N){return C._sample.isSampledIn(N)}function re(N,$,te,pe){$===200&&N?C._onSuccess(N,N[Ue]):pe&&C[co](N,pe)}function me(N,$,te,pe){pe===void 0&&(pe=!0);var _e=function(Lr,Us,to){return re($,Lr,Us,to)},Ie=he($),Ke=N&&N.sendPOST;if(Ke&&Ie){pe&&C._buffer[Rd]($);var at,dn=!1,Ne,xs;return k.preparePayload(function(Lr){at=Ke(Lr,_e,!te),dn=!0,Ne&&Mm(at,Ne,xs)},T,Ie,!te),dn?at:Pr(function(Lr,Us){Ne=Lr,xs=Us})}return null}function he(N){if(ke(N)&&N[Ue]>0){var $=C[fr].batchPayloads(N),te=w(),pe={data:$,urlString:g,headers:te,disableXhrSync:Y,disableFetchKeepAlive:!U,oriPayload:N};return pe}return null}function w(){try{var N=l||{};return hg(g)&&(N[Qe[6]]=Qe[7]),N}catch{}return null}function H(N){var $=N?N[Ue]:0;return C[fr].size()+$>v?((!h||h.isOnline())&&C[Xs](!0,null,10),!0):!1}function V(N,$,te,pe,_e,Ie){var Ke=null;if(C._appId||(Ke=qf(Ie),Ke&&Ke.appId&&(C._appId=Ke.appId)),(N<200||N>=300)&&N!==0){if((N===301||N===307||N===308)&&!j(te)){C[co]($,_e);return}if(h&&!h.isOnline()){if(!F){var at=10;we($,at),ne(C[$t](),2,40,". Offline - Response Code: ".concat(N,". Offline status: ").concat(!h.isOnline(),". Will retry to send ").concat($.length," items."))}return}!F&&dr(N)?(we($),ne(C[$t](),2,40,". Response code "+N+". Will retry to send "+$[Ue]+" items.")):C[co]($,_e)}else j(te),N===206?(Ke||(Ke=qf(Ie)),Ke&&!F?C[sp]($,Ke):C[co]($,_e)):(r=0,C[Qu]($,pe))}function j(N){return u>=10?!1:!W(N)&&N!==""&&N!==g?(g=N,++u,!0):!1}function Z(N,$){if(p)p(N,!1);else{var te=k&&k[Vu]([3],!0);return me(te,N,$)}}function fe(N,$,te){var pe=N,_e=pe&&pe.oriPayload;if(ve)le&&le(_e,!0),ne(C[$t](),2,40,". Failed to send telemetry with Beacon API, retried with normal sender.");else{for(var Ie=[],Ke=0;Ke<_e[Ue];Ke++){var at=_e[Ke],dn=[at],Ne=he(dn);te(Ne,$)?C._onSuccess(dn,dn[Ue]):Ie[Xr](at)}Ie[Ue]>0&&(le&&le(Ie,!0),ne(C[$t](),2,40,". Failed to send telemetry with Beacon API, retried with normal sender."))}}function ye(N){try{if(N&&N[Ue])return Ce(N[0])}catch{}return null}function Oe(N,$){var te=null;if(ke(N)){for(var pe=N[Ue],_e=0;_e<N[Ue];_e++)pe+=N[_e].item[Ue];var Ie=k.getSyncFetchPayload();Ie+pe<=XO?te=2:fc()?te=3:(te=1,ne(C[$t](),2,40,". Failed to send telemetry with Beacon API, retried with xhrSender."));var Ke=k&&k[Vu]([te],!0);return me(Ke,N,$)}return null}function we(N,$){if($===void 0&&($=1),!(!N||N[Ue]===0)){var te=C[fr];te[bc](N),r++;for(var pe=0,_e=N;pe<_e.length;pe++){var Ie=_e[pe];Ie.cnt=Ie.cnt||0,Ie.cnt++,te[Ho](Ie)}ze($),tt()}}function ze(N){var $=10,te;if(r<=1)te=$;else{var pe=(Math.pow(2,r)-1)/2,_e=bn(Math.random()*pe*$)+1;_e=N*_e,te=Ac(ZE(_e,3600),$)}var Ie=ir()+te*1e3;i=Ie}function tt(){if(!s&&!a){var N=i?Ac(0,i-ir()):0,$=Ac(B,N);s=Gn(function(){s=null,C[Xs](!0,null,1)},$)}}function Nt(){s&&s.cancel(),s=null,i=null}function dr(N){return W(D)?N===401||N===408||N===429||N===500||N===502||N===503||N===504:D[Ue]&&D.indexOf(N)>-1}function hr(){var N="getNotifyMgr",$,te=C.core;return te&&(te[N]?$=te[N]():$=te._notificationManager),$}function ln(N,$){var te=hr();if(te&&te.eventsSendRequest)try{te.eventsSendRequest(N,$)}catch(pe){ne(C[$t](),1,74,"send request notification failed: "+$e(pe),{exception:ue(pe)})}}function ma(N,$){var te=$.disableInstrumentationKeyValidation,pe=W(te)?!1:te;if(pe)return!0;var _e="^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",Ie=new RegExp(_e);return Ie.test(N)}function ku(){C[Zs]=null,C[fr]=null,C._appId=null,C._sample=null,l={},h=null,r=0,i=null,o=null,a=!1,s=null,c=null,u=0,d=0,p=null,f=null,g=null,m=null,v=0,y=!1,A=null,M=!1,b=null,_=Wn,F=!1,Q=null,se=Wn,Y=!1,U=!1,ve=!1,O=null,le=null,k=null,He(C,"_senderConfig",{g:function(){return N_({},eT)}})}}),n}return e.constructEnvelope=function(n,r,i,o){var a;r!==n.iKey&&!W(r)?a=cn(cn({},n),{iKey:r}):a=n;var s=tD[a.baseType]||WS;return s(i,a,o)},e})(Is),nT="duration",Ts="properties",er="requestUrl",wo="length",Ni="traceID",Oi="spanID",tr="traceFlags",kc="context",ss="aborted",Wu="_addHook",Sn="core",hp="includeCorrelationHeaders",bg="getAbsoluteUrl",uo="headers",xn="requestHeaders",fp="setRequestHeader",rT="trackDependencyDataInternal",ja="startTime",Aa="toLowerCase",kg="enableRequestHeaderTracking",ZS="enableAjaxErrorStatusText",eA="enableAjaxPerfTracking",tA="maxAjaxCallsPerView",nA="excludeRequestFromAutoTrackingPatterns",Pg="disableAjaxTracking",rA="ajaxPerfLookupDelay",iA="disableFetchTracking",oA="enableResponseHeaderTracking",Zn="status",Co="statusText",kd="headerMap",Ro="requestSentTime",Ng="getTraceId",Og="getTraceFlags",bi="method",Dg="errorStatusText",aA="stateChangeAttached",iT="responseText",Tc="responseFinishedTime",Mg="CreateTrackItem",oT="getAllResponseHeaders",xg="getPartAProps",Pd="perfMark",Ug="perfTiming",Lg="ajaxDiagnosticsMessage",Fg="correlationContext",pp="ajaxTotalDuration",gp="eventTraceCtx";function sA(t,e,n){var r=0,i=t[e],o=t[n];return i&&o&&(r=hn(i,o)),r}function lo(t,e,n,r,i){var o=0,a=sA(n,r,i);return a&&(o=Ei(t,e,Ri(a))),o}function Ei(t,e,n){var r="ajaxPerf",i=0;if(t&&e&&n){var o=t[r]=t[r]||{};o[e]=n,i=1}return i}function rD(t,e){var n=t[Ug],r=e[Ts]||{},i=0,o="name",a="Start",s="End",c="domainLookup",u="connect",l="redirect",d="request",p="response",h="startTime",f=c+a,g=c+s,m=u+a,v=u+s,y=d+a,I=d+s,R=p+a,A=p+s,M=l+a,b=l=s,_="transferSize",F="encodedBodySize",B="decodedBodySize",Q="serverTiming";if(n){i|=lo(r,l,n,M,b),i|=lo(r,c,n,f,g),i|=lo(r,u,n,m,v),i|=lo(r,d,n,y,I),i|=lo(r,p,n,R,A),i|=lo(r,"networkConnect",n,h,v),i|=lo(r,"sentRequest",n,y,A);var ie=n[nT];ie||(ie=sA(n,h,A)||0),i|=Ei(r,nT,ie),i|=Ei(r,"perfTotal",ie);var se=n[Q];if(se){var E={};ce(se,function(P,Y){var U=ad(P[o]||""+Y),O=E[U]||{};Le(P,function(le,ve){(le!==o&&Ce(ve)||hu(ve))&&(O[le]&&(ve=O[le]+";"+ve),(ve||!Ce(ve))&&(O[le]=ve))}),E[U]=O}),i|=Ei(r,Q,E)}i|=Ei(r,_,n[_]),i|=Ei(r,F,n[F]),i|=Ei(r,B,n[B])}else t[Pd]&&(i|=Ei(r,"missing",t.perfAttempts));i&&(e[Ts]=r)}var iD=(function(){function t(){var e=this;e.openDone=!1,e.setRequestHeaderDone=!1,e.sendDone=!1,e.abortDone=!1,e[aA]=!1}return t})(),aT=(function(){function t(e,n,r,i){var o=this,a=r,s="responseText";o[Pd]=null,o.completed=!1,o.requestHeadersSize=null,o[xn]=null,o.responseReceivingDuration=null,o.callbackDuration=null,o[pp]=null,o[ss]=0,o.pageUrl=null,o[er]=null,o.requestSize=0,o[bi]=null,o[Zn]=null,o[Ro]=null,o.responseStartedTime=null,o[Tc]=null,o.callbackFinishedTime=null,o.endTime=null,o.xhrMonitoringState=new iD,o.clientFailure=0,o[Ni]=e,o[Oi]=n,o[tr]=i?.getTraceFlags(),i?o[gp]={traceId:i[Ng](),spanId:i.getSpanId(),traceFlags:i[Og]()}:o[gp]=null,it(t,o,function(c){c.getAbsoluteUrl=function(){return c[er]?wN(c[er]):null},c.getPathName=function(){return c[er]?Ch(a,RN(c[bi],c[er])):null},c[Mg]=function(u,l,d){var p;if(c.ajaxTotalDuration=f_(hn(c.requestSentTime,c.responseFinishedTime)*1e3)/1e3,c[pp]<0)return null;var h=(p={id:"|"+c[Ni]+"."+c[Oi],target:c[bg](),name:c.getPathName(),type:u,startTime:null,duration:c[pp],success:+c[Zn]>=200&&+c[Zn]<400,responseCode:+c[Zn]},p[Ts]={HttpMethod:c[bi]},p),f=h[Ts];if(c[ss]&&(f[ss]=!0),c[Ro]&&(h[ja]=new Date,h[ja].setTime(c[Ro])),rD(c,h),l&&jr(c.requestHeaders)[wo]>0&&(f[xn]=c[xn]),d){var g=d();if(g){var m=g[Fg];if(m&&(h.correlationContext=m),g[kd]&&jr(g.headerMap)[wo]>0&&(f.responseHeaders=g[kd]),c[Dg])if(c[Zn]>=400){var v=g.type;(v===""||v==="text")&&(f.responseText=g.responseText?g[Co]+" - "+g[s]:g[Co]),v==="json"&&(f.responseText=g.response?g[Co]+" - "+JSON.stringify(g.response):g[Co])}else c[Zn]===0&&(f.responseText=g[Co]||"")}}return h},c[xg]=function(){var u=null,l=c[gp];if(l&&(l.traceId||l.spanId)){u={};var d=u[An.TraceExt]={traceID:l.traceId,parentID:l.spanId};W(l[tr])||(d[tr]=l[tr])}return u}})}return t.__ieDyn=1,t})(),ft,Pc="diagLog",Bi="_ajaxData",To="fetch",tc="Failed to monitor XMLHttpRequest",cA=", monitoring data for this ajax call ",Ia=cA+"may be incorrect.",sT=cA+"won't be sent.",cT="Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",uT="Failed to add custom defined request context as configured call back may missing a null check.",lT="Failed to calculate the duration of the ",dT=0;function oD(){var t=Bn();return!t||W(t.Request)||W(t.Request[Ir])||W(t[To])?null:t[To]}function aD(t,e){var n,r=!1;if(gh()){var i=XMLHttpRequest[Ir];r=!W(i)&&!W(i.open)&&!W(i.send)&&!W(i.abort)}var o=U_();if(o&&o<9&&(r=!1),r)try{var a=new XMLHttpRequest,s={xh:[],i:(n={},n[e]={},n)};a[Bi]=s;var c=XMLHttpRequest[Ir].open;XMLHttpRequest[Ir].open=c}catch(u){r=!1,Nc(t,15,"Failed to enable XMLHttpRequest monitoring, extension is not supported",{exception:ue(u)})}return r}var La=function(t,e){return t&&e&&t[Bi]?(t[Bi].i||{})[e]:null},sD=function(t,e,n){if(t){var r=(t[Bi]||{}).xh;r&&r.push({n:e,v:n})}},mp=function(t,e){var n=!1;if(t){var r=(t[Bi]||{}).xh;r&&ce(r,function(i){if(i.n===e)return n=!0,-1})}return n};function bl(t,e){var n="";try{var r=La(t,e);r&&r[er]&&(n+="(url: '"+r[er]+"')")}catch{}return n}function Nc(t,e,n,r,i){ne(t[Pc](),1,e,n,r,i)}function Hr(t,e,n,r,i){ne(t[Pc](),2,e,n,r,i)}function nc(t,e,n){return function(r){var i;Nc(t,e,n,(i={},i[Lg]=bl(r.inst,t._ajaxDataId),i.exception=ue(r.err),i))}}function wa(t,e){return t&&e?gt(t,e):-1}function hT(t,e,n){var r={id:e,fn:n};return t.push(r),{remove:function(){ce(t,function(i,o){if(i.id===r.id)return t.splice(o,1),-1})}}}function uA(t,e,n,r){var i=!0;return ce(e,function(o,a){try{o.fn.call(null,n)===!1&&(i=!1)}catch(s){ne(t&&t.logger,1,64,"Dependency "+r+" [#"+a+"] failed: "+$e(s),{exception:ue(s)},!0)}}),i}function cD(t,e,n,r,i,o){var a=t[wo],s=!0;if(a>0){var c={core:e,xhr:r,input:i,init:o,traceId:n[Ni],spanId:n[Oi],traceFlags:n[tr],context:n[kc]||{},aborted:!!n[ss]};s=uA(e,t,c,"listener"),n[Ni]=c.traceId,n[Oi]=c.spanId,n[tr]=c[tr],n[kc]=c[kc]}return s}var Ju="*.blob.core.",uD=rr([Ju+"windows.net",Ju+"chinacloudapi.cn",Ju+"cloudapi.de",Ju+"usgovcloudapi.net"]),lD=[/https:\/\/[^\/]*(\.pipe\.aria|aria\.pipe|events\.data|collector\.azure)\.[^\/]+\/(OneCollector\/1|Collector\/3)\.0/i],dD=rr((ft={},ft[tA]=500,ft[Pg]=!1,ft[iA]=!1,ft[nA]=void 0,ft.disableCorrelationHeaders=!1,ft.distributedTracingMode=1,ft.correlationHeaderExcludedDomains=uD,ft.correlationHeaderDomains=void 0,ft.correlationHeaderExcludePatterns=void 0,ft.appId=void 0,ft.enableCorsCorrelation=!1,ft[kg]=!1,ft[oA]=!1,ft[ZS]=!1,ft[eA]=!1,ft.maxAjaxPerfLookupAttempts=3,ft[rA]=25,ft.ignoreHeaders=["Authorization","X-API-Key","WWW-Authenticate"],ft.addRequestContext=void 0,ft.addIntEndpoints=!0,ft)),hD=(function(t){ui(e,t);function e(){var n=t.call(this)||this;n.identifier=e.identifier,n.priority=120;var r,i,o,a,s,c,u,l,d,p,h,f,g,m,v,y,I,R,A,M,b,_,F,B,Q,ie,se,E,P,Y;return it(e,n,function(U,O){var le=O[Wu];ve(),U.initialize=function(w,H,V,j){U.isInitialized()||(O.initialize(w,H,V,j),M=Ji(qn("ajax"),H&&H.evtNamespace&&H.evtNamespace()),k(w),X(),C(),D())},U._doTeardown=function(){ve()},U.trackDependencyData=function(w,H){he(B,U[Sn],null,w,H)},U.resetAjaxAttempts=function(){u=0},U[hp]=function(w,H,V,j){var Z=U._currentWindowHost||o;if(cD(F,U[Sn],w,j,H,V)){if(H||H===""){if(UC(a,w[bg](),Z)){V||(V={});var fe=new Headers(V[uo]||(H instanceof Request?H[uo]||{}:{}));if(p){var ye="|"+w[Ni]+"."+w[Oi];fe.set(Qe[3],ye),s&&(w[xn][Qe[3]]=ye)}var Oe=P||l&&l.appId();if(Oe&&(fe.set(Qe[0],Qe[2]+Oe),s&&(w[xn][Qe[0]]=Qe[2]+Oe)),d){var we=w[tr];W(we)&&(we=1);var ze=gC(pC(w[Ni],w[Oi],we));fe.set(Qe[4],ze),s&&(w[xn][Qe[4]]=ze)}V[uo]=fe}}else if(j&&UC(a,w[bg](),Z)){if(p)if(mp(j,Qe[3]))Hr(U,71,"Unable to set ["+Qe[3]+"] as it has already been set by another instance");else{var ye="|"+w[Ni]+"."+w[Oi];j[fp](Qe[3],ye),s&&(w[xn][Qe[3]]=ye)}var Oe=P||l&&l.appId();if(Oe&&(mp(j,Qe[0])?Hr(U,71,"Unable to set ["+Qe[0]+"] as it has already been set by another instance"):(j[fp](Qe[0],Qe[2]+Oe),s&&(w[xn][Qe[0]]=Qe[2]+Oe))),d){var we=w[tr];if(W(we)&&(we=1),mp(j,Qe[4]))Hr(U,71,"Unable to set ["+Qe[4]+"] as it has already been set by another instance");else{var ze=gC(pC(w[Ni],w[Oi],we));j[fp](Qe[4],ze),s&&(w[xn][Qe[4]]=ze)}}}}return j||V},U[rT]=function(w,H,V){if(g===-1||u<g){(E===2||E===1)&&typeof w.id=="string"&&w.id[w.id[wo]-1]!=="."&&(w.id+="."),W(w[ja])&&(w[ja]=new Date);var j=Ti(w,Fo.dataType,Fo.envelopeType,U[Pc](),H,V);U[Sn].track(j)}else u===g&&Nc(U,55,"Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.",!0);++u},U.addDependencyListener=function(w){return hT(F,_++,w)},U.addDependencyInitializer=function(w){return hT(B,_++,w)};function ve(){var w=_r();r=!1,i=!1,Y=!1,o=w&&w.host&&w.host[Aa](),a=null,s=!1,c=!1,u=0,l=null,d=!1,p=!1,h=null,f=!1,g=0,m=!1,v={},y=!1,I=!1,R=null,A=null,M=null,_=0,F=[],B=[],b=qn("ajaxData"),U._ajaxDataId=b,Q=null,ie=1,se=1,E=1,P=null}function k(w){U[Wu](vt(w,function(H){var V=H.cfg,j=ar(null,V,U[Sn]);a=j.getExtCfg(e.identifier,dD),E=a.distributedTracingMode,s=a[kg],c=a[ZS],f=a[eA],g=a[tA],R=[].concat(a[nA]||[],a.addIntEndpoints!==!1?lD:[]),A=a.addRequestContext,p=E===0||E===1,d=E===1||E===2,f&&(h=b),y=!!a[Pg],ie=a.maxAjaxPerfLookupAttempts,se=a[rA],Q=a.ignoreHeaders,P=a.appId}))}function D(){var w=U[Sn].getPlugin(_h);w&&(l=w.plugin[kc])}function T(w){var H=!0;return(w||Q)&&ce(Q,(function(V){if(V[Aa]()===w[Aa]())return H=!1,-1})),H}function C(){var w=oD();if(w){var H=Bn(),V=w.polyfill;U[Wu](vt(a,function(){I=!!a[iA],m=a[oA],!I&&!r?(le(dg(H,To,{ns:M,req:function(j,Z,fe){var ye;if(!I&&r&&!ee(null,Z,fe)&&!(V&&i)){var Oe=j.ctx();ye=On(Z,fe);var we=U[hp](ye,Z,fe);we!==fe&&j.set(1,we),Oe.data=ye}},rsp:function(j,Z){if(!I){var fe=j.ctx().data;fe&&(j.rslt=j.rslt.then(function(ye){return re(j,(ye||{})[Zn],Z,ye,fe,function(){var Oe,we=(Oe={statusText:(ye||{})[Co],headerMap:null},Oe[Fg]=me(ye),Oe);if(m&&ye){var ze={};ye.headers.forEach(function(tt,Nt){T(Nt)&&(ze[Nt]=tt)}),we[kd]=ze}return we}),ye}).catch(function(ye){throw re(j,0,Z,null,fe,null,{error:ye.message||ue(ye)}),ye}))}},hkErr:nc(U,15,"Failed to monitor Window.fetch"+Ia)},!0,i_())),r=!0):V&&!Y&&(le(dg(H,To,{ns:M,req:function(j,Z,fe){ee(null,Z,fe)}})),Y=!0)})),V&&(H[To].polyfill=V)}}function L(w,H,V){le(TN(w,H,V))}function X(){aD(U,b)&&U[Wu](vt(a,function(){y=!!a[Pg],s=a[kg],!y&&!i&&(L(XMLHttpRequest,"open",{ns:M,req:function(w,H,V,j){if(!y){var Z=w.inst,fe=La(Z,b);!ee(Z,V)&&Ae(Z,fe,!0)&&((!fe||!fe.xhrMonitoringState.openDone)&&(fe=Pe(Z,H,V,j)),qe(Z,fe))}},hkErr:nc(U,15,tc+".open"+Ia)}),L(XMLHttpRequest,"send",{ns:M,req:function(w,H){if(!y){var V=w.inst,j=La(V,b);Ae(V,j)&&!j.xhrMonitoringState.sendDone&&(qt("xhr",j),j[Ro]=Yu(),U[hp](j,void 0,void 0,V),j.xhrMonitoringState.sendDone=!0)}},hkErr:nc(U,17,tc+Ia)}),L(XMLHttpRequest,"abort",{ns:M,req:function(w){if(!y){var H=w.inst,V=La(H,b);Ae(H,V)&&!V.xhrMonitoringState.abortDone&&(V[ss]=1,V.xhrMonitoringState.abortDone=!0)}},hkErr:nc(U,13,tc+".abort"+Ia)}),L(XMLHttpRequest,"setRequestHeader",{ns:M,req:function(w,H,V){if(!y){var j=w.inst,Z=La(j,b);Z&&Ae(j,Z)&&(sD(j,H,V),s&&T(H)&&(Z[xn][H]=V))}},hkErr:nc(U,71,tc+".setRequestHeader"+Ia)}),i=!0)}))}function ee(w,H,V){var j=!1,Z=((Ce(H)?H:(H||{}).url||"")||"")[Aa]();if(ce(R,function(Oe){var we=Oe;Ce(Oe)&&(we=new RegExp(Oe)),j||(j=we.test(Z))}),j)return j;var fe=wa(Z,"?"),ye=wa(Z,"#");return(fe===-1||ye!==-1&&ye<fe)&&(fe=ye),fe!==-1&&(Z=Z.substring(0,fe)),W(w)?W(H)||(j=(typeof H=="object"?H[Io]===!0:!1)||(V?V[Io]===!0:!1)):j=w[Io]===!0||Z[Io]===!0,!j&&Z&&hg(Z)&&(j=!0),j?v[Z]||(v[Z]=1):v[Z]&&(j=!0),j}function Ae(w,H,V){var j=!0,Z=i;return W(w)||(j=V===!0||!W(H)),Z&&j}function Re(){var w=null;return U[Sn]&&U[Sn].getTraceCtx&&(w=U[Sn].getTraceCtx(!1)),!w&&l&&l.telemetryTrace&&(w=Xm(l.telemetryTrace)),w}function Pe(w,H,V,j){var Z,fe=Re(),ye=fe&&fe[Ng]()||Pi(),Oe=Ai(Pi(),0,16),we=w[Bi]=w[Bi]||{xh:[],i:{}},ze=we.i=we.i||{},tt=ze[b]=ze[b]||new aT(ye,Oe,U[Pc](),(Z=U.core)===null||Z===void 0?void 0:Z.getTraceCtx());return tt[tr]=fe&&fe[Og](),tt[bi]=H,tt[er]=V,tt.xhrMonitoringState.openDone=!0,tt[xn]={},tt.async=j,tt[Dg]=c,tt}function qe(w,H){H.xhrMonitoringState[aA]=Qr(w,"readystatechange",function(){var V;try{w&&w.readyState===4&&Ae(w,H)&&Ve(w)}catch(Z){var j=ue(Z);(!j||wa(j[Aa](),"c00c023f")===-1)&&Nc(U,16,tc+" 'readystatechange' event handler"+Ia,(V={},V[Lg]=bl(w,b),V.exception=j,V))}},M)}function Gt(w){try{var H=w.responseType;if(H===""||H==="text")return w[iT]}catch{}return null}function Ve(w){var H=La(w,b);H[Tc]=Yu(),H[Zn]=w[Zn];function V(j,Z){var fe=Z||{};fe.ajaxDiagnosticsMessage=bl(w,b),j&&(fe.exception=ue(j)),Hr(U,14,lT+"ajax call"+sT,fe)}Ur("xmlhttprequest",H,function(){try{var j=H[Mg]("Ajax",s,function(){var we,ze=(we={statusText:w[Co],headerMap:null},we[Fg]=Ze(w),we.type=w.responseType,we[iT]=Gt(w),we.response=w.response,we);if(m){var tt=w[oT]();if(tt){var Nt=Je(tt).split(/[\r\n]+/),dr={};ce(Nt,function(hr){var ln=hr.split(": "),ma=ln.shift(),ku=ln.join(": ");T(ma)&&(dr[ma]=ku)}),ze[kd]=dr}}return ze}),Z=void 0;try{A&&(Z=A({status:w[Zn],xhr:w}))}catch{Hr(U,104,uT)}if(j){Z!==void 0&&(j[Ts]=cn(cn({},j.properties),Z));var fe=H[xg]();he(B,U[Sn],H,j,null,fe)}else V(null,{requestSentTime:H[Ro],responseFinishedTime:H[Tc]})}finally{try{var ye=w[Bi]||{i:{}},Oe=ye.i||{};Oe[b]&&(Oe[b]=null)}catch{}}},function(j){V(j,null)})}function Ze(w){var H;try{var V=w[oT]();if(V!==null){var j=wa(V[Aa](),Qe[8]);if(j!==-1){var Z=w.getResponseHeader(Qe[0]);return LC(Z)}}}catch(fe){Hr(U,18,cT,(H={},H[Lg]=bl(w,b),H.exception=ue(fe),H))}}function qt(w,H){if(H[er]&&h&&f){var V=ri();if(V&&Se(V.mark)){dT++;var j=h+w+"#"+dT;V.mark(j);var Z=V.getEntriesByName(j);Z&&Z[wo]===1&&(H[Pd]=Z[0])}}}function Ur(w,H,V,j){var Z=H[Pd],fe=ri(),ye=ie,Oe=se,we=H[er],ze=0;(function tt(){try{if(fe&&Z){ze++;for(var Nt=null,dr=fe.getEntries(),hr=dr[wo]-1;hr>=0;hr--){var ln=dr[hr];if(ln){if(ln.entryType==="resource")ln.initiatorType===w&&(wa(ln.name,we)!==-1||wa(we,ln.name)!==-1)&&(Nt=ln);else if(ln.entryType==="mark"&&ln.name===Z.name){H[Ug]=Nt;break}if(ln[ja]<Z[ja]-1e3)break}}}!Z||H[Ug]||ze>=ye||H.async===!1?(Z&&Se(fe.clearMarks)&&fe.clearMarks(Z.name),H.perfAttempts=ze,V()):Gn(tt,Oe)}catch(ma){j(ma)}})()}function On(w,H){var V,j=Re(),Z=j&&j[Ng]()||Pi(),fe=Ai(Pi(),0,16),ye=new aT(Z,fe,U[Pc](),(V=U.core)===null||V===void 0?void 0:V.getTraceCtx());ye[tr]=j&&j[Og](),ye[Ro]=Yu(),ye[Dg]=c;var Oe;if(w instanceof Request?Oe=(w||{}).url||"":Oe=w,Oe===""){var we=_r();we&&we.href&&(Oe=d_(we.href,"#")[0])}U[Sn]&&U[Sn].config&&(Oe=$r(Oe,U[Sn].config)),ye[er]=Oe;var ze="GET";H&&H[bi]?ze=H[bi]:w&&w instanceof Request&&(ze=w[bi]),ye[bi]=ze;var tt={};if(s){var Nt=new Headers((H?H[uo]:0)||(w instanceof Request?w[uo]||{}:{}));Nt.forEach(function(dr,hr){T(hr)&&(tt[hr]=dr)})}return ye[xn]=tt,qt(To,ye),ye}function q(w){var H="";try{W(w)||(typeof w=="string"?H+="(url: '".concat(w,"')"):H+="(url: '".concat(w.url,"')"))}catch(V){Nc(U,15,"Failed to grab failed fetch diagnostics message",{exception:ue(V)})}return H}function re(w,H,V,j,Z,fe,ye){if(!Z)return;function Oe(we,ze,tt){var Nt=tt||{};Nt.fetchDiagnosticsMessage=q(V),ze&&(Nt.exception=ue(ze)),Hr(U,we,lT+"fetch call"+sT,Nt)}Z[Tc]=Yu(),Z[Zn]=H,Ur(To,Z,function(){var we=Z[Mg]("Fetch",s,fe),ze;try{A&&(ze=A({status:H,request:V,response:j}))}catch{Hr(U,104,uT)}if(we){ze!==void 0&&(we[Ts]=cn(cn({},we.properties),ze));var tt=Z[xg]();he(B,U[Sn],Z,we,null,tt)}else Oe(14,null,{requestSentTime:Z[Ro],responseFinishedTime:Z[Tc]})},function(we){Oe(18,we,null)})}function me(w){if(w&&w[uo])try{var H=w[uo].get(Qe[0]);return LC(H)}catch(V){Hr(U,18,cT,{fetchDiagnosticsMessage:q(w),exception:ue(V)})}}function he(w,H,V,j,Z,fe){var ye=!0,Oe=w[wo];if(Oe>0){var we={item:j,properties:Z,sysProperties:fe,context:V?V[kc]:null,aborted:V?!!V[ss]:!1};ye=uA(H,w,we,"initializer")}ye&&U[rT](j,Z,fe)}}),n}return e.prototype.processTelemetry=function(n,r){this.processNext(n,r)},e.prototype.addDependencyInitializer=function(n){return null},e.identifier="AjaxDependencyPlugin",e})(Is),fD=(function(){function t(){}return t})(),pD=(function(){function t(){this.id="browser",this.deviceClass="Browser"}return t})(),gD="3.3.11",mD=(function(){function t(e,n){var r=this,i=vt(e,function(){var o=e.sdkExtension;r.sdkVersion=(o?o+"_":"")+"javascript:"+gD});n&&n.add(i)}return t})(),vD=(function(){function t(){}return t})(),Nd="session",Od="sessionManager",kl="isUserCookieSet",Dd="isNewUser",vp="getTraceCtx",Hg="telemetryTrace",lA="applySessionContext",dA="applyApplicationContext",hA="applyOperationContext",fA="applyOperatingSystemContxt",pA="applyLocationContext",gA="applyInternalContext",Pl="getSessionId",mA="sessionCookiePostfix",go="automaticSession",Fa="accountId",Ha="authenticatedId",rc="acquisitionDate",Xu="renewalDate",ic="cookieSeparator",yp="authUserCookieName",yD="ai_session",CD=864e5,TD=18e5,ED=6e4,vA=(function(){function t(){}return t})(),_D=(function(){function t(e,n,r){var i=this,o,a,s=aa(n),c=Km(n),u,l;it(t,i,function(d){e||(e={});var p=vt(e,function(y){u=e.sessionExpirationMs||CD,l=e.sessionRenewalMs||TD;var I=e[mA]||e.namePrefix||"";o=yD+I});r&&r.add(p),d[go]=new vA,d.update=function(){var y=ir(),I=!1,R=d[go];if(R.id||(I=!h(R)),!I&&u>0){var A=y-R[rc],M=y-R[Xu];I=A<0||M<0,I=I||A>u,I=I||M>l}I?g(y):(!a||y-a>ED)&&m(R,y)},d.backup=function(){var y=d[go];v(y.id,y[rc],y[Xu])};function h(y,I){var R=!1,A=c.get(o);if(A&&Se(A.split))R=f(y,A);else{var M=vS(s,o);M&&(R=f(y,M))}return R||!!y.id}function f(y,I){var R=!1,A=", session will be reset",M=I.split("|");if(M.length>=2)try{var b=+M[1]||0,_=+M[2]||0;isNaN(b)||b<=0?ne(s,2,27,"AI session acquisition date is 0"+A):isNaN(_)||_<=0?ne(s,2,27,"AI session renewal date is 0"+A):M[0]&&(y.id=M[0],y[rc]=b,y[Xu]=_,R=!0)}catch(F){ne(s,1,9,"Error parsing ai_session value ["+(I||"")+"]"+A+" - "+$e(F),{exception:ue(F)})}return R}function g(y){var I=e.getNewId||Um;d[go].id=I(e.idLength||22),d[go][rc]=y,m(d[go],y),Eh()||ne(s,2,0,"Browser does not support local storage. Session durations will be inaccurate.")}function m(y,I){var R=y[rc];y[Xu]=I;var A=l,M=R+u-I,b=[y.id,R,I],_=0;M<A?_=M/1e3:_=A/1e3;var F=e.cookieDomain||null;c.set(o,b.join("|"),u>0?_:null,F),a=I}function v(y,I,R){yS(s,o,[y,I,R].join("|"))}})}return t.__ieDyn=1,t})(),SD=(function(){function t(e,n,r,i,o){var a=this;a.traceID=e||Pi(),a.parentID=n;var s=_r();!r&&s&&s.pathname&&(r=s.pathname,o&&(r=$r(r,o))),a.name=At(i,r)}return t})();function fT(t){return!(typeof t!="string"||!t||t.match(/,|;|=| |\|/))}var AD=(function(){function t(e,n,r){this.isNewUser=!1,this.isUserCookieSet=!1;var i=aa(n),o=Km(n),a;it(t,this,function(s){He(s,"config",{g:function(){return e}});var c=vt(e,function(){var p=e.userCookiePostfix||"";a=t.userCookieName+p;var h=o.get(a);if(h){s[Dd]=!1;var f=h.split(t[ic]);f.length>0&&(s.id=f[0],s[kl]=!!s.id)}if(!s.id){s.id=u();var g=l(s.id);d(g.join(t[ic]));var m=(e.namePrefix||"")+"ai_session";xN(i,m)}s[Fa]=e[Fa]||void 0;var v=o.get(t[yp]);if(v){v=decodeURI(v);var y=v.split(t[ic]);y[0]&&(s[Ha]=y[0]),y.length>1&&y[1]&&(s[Fa]=y[1])}});r&&r.add(c);function u(){var p=e||{},h=p.getNewId||Um,f=h(p.idLength?e.idLength:22);return f}function l(p){var h=ms(new Date);s.accountAcquisitionDate=h,s[Dd]=!0;var f=[p,h];return f}function d(p){var h=31536e3;s[kl]=o.set(a,p,h)}s.setAuthenticatedUserContext=function(p,h,f){f===void 0&&(f=!1);var g=!fT(p)||h&&!fT(h);if(g){ne(i,2,60,"Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",!0);return}s[Ha]=p;var m=s[Ha];h&&(s[Fa]=h,m=[s[Ha],s.accountId].join(t[ic])),f&&o.set(t[yp],encodeURI(m))},s.clearAuthenticatedUserContext=function(){s[Ha]=null,s[Fa]=null,o.del(t[yp])},s.update=function(p){if(s.id!==p||!s[kl]){var h=p||u(),f=l(h);d(f.join(t[ic]))}}})}return t.cookieSeparator="|",t.userCookieName="ai_user",t.authUserCookieName="ai_authUser",t})(),Zu="ext",el="tags";function Ra(t,e){t&&t[e]&&jr(t[e]).length===0&&delete t[e]}function pT(){return null}var ID=(function(){function t(e,n,r,i){var o=this,a=e.logger;it(t,this,function(s){if(s.appId=pT,s[Pl]=pT,s.application=new fD,s.internal=new mD(n,i),hh()){s[Od]=new _D(n,e,i),s.device=new pD,s.location=new vD,s.user=new AD(n,e,i);var c=void 0,u=void 0,l;r&&(c=r.getTraceId(),u=r.getSpanId(),l=r.getName()),s[Hg]=new SD(c,u,l,a),s[Nd]=new vA}s[Pl]=function(){var d=s[Nd],p=null;if(d&&Ce(d.id))p=d.id;else{var h=(s[Od]||{})[go];p=h&&Ce(h.id)?h.id:null}return p},s[lA]=function(d,p){et(Xt(d.ext,An.AppExt),"sesId",s[Pl](),Ce)},s[fA]=function(d,p){et(d.ext,An.OSExt,s.os)},s[dA]=function(d,p){var h=s.application;if(h){var f=Xt(d,el);et(f,rt.applicationVersion,h.ver,Ce),et(f,rt.applicationBuild,h.build,Ce)}},s.applyDeviceContext=function(d,p){var h=s.device;if(h){var f=Xt(Xt(d,Zu),An.DeviceExt);et(f,"localId",h.id,Ce),et(f,"ip",h.ip,Ce),et(f,"model",h.model,Ce),et(f,"deviceClass",h.deviceClass,Ce)}},s[gA]=function(d,p){var h=s.internal;if(h){var f=Xt(d,el);et(f,rt.internalAgentVersion,h.agentVersion,Ce),et(f,rt.internalSdkVersion,At(a,h.sdkVersion,64),Ce),(d.baseType===zc.dataType||d.baseType===Hi.dataType)&&(et(f,rt.internalSnippet,h.snippetVer,Ce),et(f,rt.internalSdkSrc,h.sdkSrc,Ce))}},s[pA]=function(d,p){var h=o.location;h&&et(Xt(d,el,[]),rt.locationIp,h.ip,Ce)},s[hA]=function(d,p){var h=s[Hg];if(h){var f=Xt(Xt(d,Zu),An.TraceExt,{traceID:void 0,parentID:void 0});et(f,"traceID",h.traceID,Ce,W),et(f,"name",h.name,Ce,W),et(f,"parentID",h.parentID,Ce,W)}},s.applyWebContext=function(d,p){var h=o.web;h&&et(Xt(d,Zu),An.WebExt,h)},s.applyUserContext=function(d,p){var h=s.user;if(h){var f=Xt(d,el,[]);et(f,rt.userAccountId,h[Fa],Ce);var g=Xt(Xt(d,Zu),An.UserExt);et(g,"id",h.id,Ce),et(g,"authId",h[Ha],Ce)}},s.cleanUp=function(d,p){var h=d.ext;h&&(Ra(h,An.DeviceExt),Ra(h,An.UserExt),Ra(h,An.WebExt),Ra(h,An.OSExt),Ra(h,An.AppExt),Ra(h,An.TraceExt))}})}return t.__ieDyn=1,t})(),yi,Cp,ba=null,wD=fu((yi={accountId:ba,sessionRenewalMs:1800*1e3,samplingPercentage:100,sessionExpirationMs:1440*60*1e3,cookieDomain:ba,sdkExtension:ba,isBrowserLinkTrackingEnabled:!1,appId:ba},yi[Pl]=ba,yi.namePrefix=Cp,yi[mA]=Cp,yi.userCookiePostfix=Cp,yi.idLength=22,yi.getNewId=ba,yi)),RD=(function(t){ui(e,t);function e(){var n=t.call(this)||this;n.priority=110,n.identifier=_h;var r,i,o,a,s;return it(e,n,function(c,u){l(),He(c,"context",{g:function(){return a}}),c.initialize=function(h,f,g,m){u.initialize(h,f,g,m),d(h)},c.processTelemetry=function(h,f){if(!W(h)){f=c._getTelCtx(f),h.name===Hi.envelopeType&&f.diagLog().resetInternalMessageCount();var g=a||{};g[Nd]&&typeof a[Nd].id!="string"&&g[Od]&&g[Od].update();var m=g.user;if(m&&!m[kl]&&m.update(g.user.id),p(h,f),m&&m[Dd]&&(m[Dd]=!1,!s)){var v=new zc(72,(xr()||{}).userAgent||"");IP(f.diagLog(),1,v)}c.processNext(h,f)}},c._doTeardown=function(h,f){var g=(h||{}).core();if(g&&g[vp]){var m=g[vp](!1);m===i&&g.setTraceCtx(o)}l()};function l(){r=null,i=null,o=null,a=null,s=!0}function d(h){var f=c.identifier,g=c.core;c._addHook(vt(h,function(){var m=ar(null,h,g);h.storagePrefix&&tv(h.storagePrefix),s=h.disableUserInitMessage!==!1,r=m.getExtCfg(f,wD),c._extConfig=r})),o=g[vp](!1),a=new ID(g,r,o,c._unloadHooks),i=Xm(c.context[Hg],o),g.setTraceCtx(i),c.context.appId=function(){var m=g.getPlugin(PS);return m?m.plugin._appId:null}}function p(h,f){Xt(h,"tags",[]),Xt(h,"ext",{});var g=c.context;g[lA](h,f),g[dA](h,f),g.applyDeviceContext(h,f),g[hA](h,f),g.applyUserContext(h,f),g[fA](h,f),g.applyWebContext(h,f),g[pA](h,f),g[gA](h,f),g.cleanUp(h,f)}}),n}return e.__ieDyn=1,e})(Is),yA="AuthenticatedUserContext",ws="track",Bg="snippet",bD="getCookieMgr",kD="startTrackPage",PD="stopTrackPage",Tp="flush",ND="startTrackEvent",OD="stopTrackEvent",DD="addTelemetryInitializer",gT="pollInternalLogs",Ep="getPlugin",_p="evtNamespace",MD=ws+"Event",xD=ws+"Trace",UD=ws+"Metric",LD=ws+"PageView",FD=ws+"Exception",HD=ws+"DependencyData",BD="set"+yA,KD="clear"+yA,GD="https://js.monitor.azure.com/scripts/b/ai.config.1.cfg.json",Md="connectionString",Sp="version",ho="queue",Ec="instrumentationKey",Ba="userOverrideEndpointUrl",Ap="endpointUrl",oc="onunloadFlush",Dn="context",mT="addHousekeepingBeforeUnload",Ip="sendMessage",qD="updateSnippetDefinitions",pr,ka,Pa,wp,ac,vT=[Bg,"dependencies","properties","_snippetVersion","appInsightsNew","getSKUDefaults"],CA="iKeyUsage",TA="CdnUsage",EA="SdkLoaderVer",$D="zipPayload",tl=void 0,YD={samplingRate:100,maxSendNumber:1},zD={monthInterval:3,daysOfMonth:[28]},nl={disabled:!0,limit:Jn(YD),interval:Jn(zD)},jD=(pr={},pr[Md]=tl,pr.endpointUrl=tl,pr[Ec]=tl,pr[Ba]=tl,pr.diagnosticLogInterval=hd(VD,1e4),pr.featureOptIn=(ka={},ka[CA]={mode:3},ka[TA]={mode:2},ka[EA]={mode:2},ka[$D]={mode:1},ka),pr.throttleMgrCfg=Jn((Pa={},Pa[109]=Jn(nl),Pa[106]=Jn(nl),Pa[111]=Jn(nl),Pa[110]=Jn(nl),Pa)),pr.extensionConfig=Jn((wp={},wp.AppInsightsCfgSyncPlugin=Jn({cfgUrl:GD,syncMode:2}),wp)),pr);function VD(t){return t&&t>0}function yT(t,e){return qc(function(n,r){gn(e,function(i){var o=i&&i.value,a=null;!i.rejected&&o&&(t[Md]=o,a=ES(o)),n(a)})})}var QD=(function(){function t(e){var n=this,r,i,o,a,s,c,u,l,d,p,h,f,g,m;it(t,this,function(v){R(),He(v,"config",{g:function(){return l}}),ce(["pluginVersionStringArr","pluginVersionString"],function(b){He(v,b,{g:function(){return u?u[b]:null}})}),a=""+(e.sv||e[Sp]||""),e[ho]=e[ho]||[],e[Sp]=e[Sp]||2;var y=$n(e.config||{},jD);l=y.cfg,d=new bO,He(v,"appInsights",{g:function(){return d}}),i=new RD,r=new hD,o=new nD,u=new iN,He(v,"core",{g:function(){return u}}),M(vt(y,function(){var b=l[Md];if(zi(b)){var _=qc(function(ie,se){gn(yT(l,b),function(E){if(E.rejected)ie(null);else{var P=l[Ec],Y=E.value;P=Y&&Y.instrumentationkey||P,ie(P)}})}),F=l[Ba];W(F)&&(F=qc(function(ie,se){gn(yT(l,b),function(E){if(E.rejected)ie(null);else{var P=l[Ap],Y=E.value,U=Y&&Y.ingestionendpoint;P=U?U+es:P,ie(P)}})})),l[Ec]=_,l[Ap]=F}if(Ce(b)&&b){var B=ES(b),Q=B.ingestionendpoint;l.endpointUrl=l[Ba]?l[Ba]:Q+es,l[Ec]=B.instrumentationkey||l[Ec]}l.endpointUrl=l[Ba]?l[Ba]:l[Ap]})),v[Bg]=e,v[Tp]=function(b,_){b===void 0&&(b=!0);var F;return md(u,function(){return"AISKU.flush"},function(){b&&!_&&(F=Pr(function(ie){_=ie}));var B=1,Q=function(){B--,B===0&&_()};ce(u.getChannels(),function(ie){ie&&(B++,ie[Tp](b,Q))}),Q()},null,b),F},v[oc]=function(b){b===void 0&&(b=!0),ce(u.getChannels(),function(_){_[oc]?_[oc]():_[Tp](b)})},v.loadAppInsights=function(b,_,F){b===void 0&&(b=!1),b&&Pb("Legacy Mode is no longer supported");function B(Q){if(Q){var ie="";W(a)||(ie+=a),v[Dn]&&v[Dn].internal&&(v[Dn].internal.snippetVer=ie||"-"),Le(v,function(se,E){Ce(se)&&!Se(E)&&se&&se[0]!=="_"&&Wt(vT,se)===-1&&Q[se]!==E&&(Q[se]=E)})}}return md(v.core,function(){return"AISKU.loadAppInsights"},function(){u.initialize(l,[o,i,r,d,p],_,F),He(v,"context",{g:function(){return i[Dn]}}),h||(h=new LN(u));var Q=WD();Q&&v[Dn]&&(v[Dn].internal.sdkSrc=Q),B(v[Bg]),v.emptyQueue(),v[gT](),v[mT](v),M(vt(y,function(){var ie=!1;l.throttleMgrCfg[109]&&(ie=!l.throttleMgrCfg[109].disabled),!h.isReady()&&l.extensionConfig&&l.extensionConfig[p.identifier]&&ie&&h.onReadyState(!0),!f&&!l[Md]&&yl(CA,l,!0)&&(h[Ip](106,"See Instrumentation key support at aka.ms/IkeyMigrate"),f=!0),!g&&v[Dn].internal.sdkSrc&&v[Dn].internal.sdkSrc.indexOf("az416426")!=-1&&yl(TA,l,!0)&&(h[Ip](110,"See Cdn support notice at aka.ms/JsActiveCdn"),g=!0),!m&&parseInt(a)<6&&yl(EA,l,!0)&&(h[Ip](111,"An updated Sdk Loader is available, see aka.ms/SnippetVer"),m=!0)}))}),v},v[qD]=function(b){wk(b,v,function(_){return _&&Wt(vT,_)===-1})},v.emptyQueue=function(){try{if(ke(v.snippet[ho])){for(var b=v.snippet[ho].length,_=0;_<b;_++){var F=v.snippet[ho][_];F()}v.snippet[ho]=void 0,delete v.snippet[ho]}}catch(Q){var B={};Q&&Se(Q.toString)&&(B.exception=Q.toString())}},v[mT]=function(b){if(hh()||n_()){var _=function(){if(b[oc](!1),Se(v.core[Ep])){var B=n.core[Ep](_h);if(B){var Q=B.plugin;Q&&Q[Dn]&&Q[Dn]._sessionManager&&Q[Dn]._sessionManager.backup()}}},F=!1;c||(c=Ji(s,u[_p]&&u[_p]())),M(vt(l,function(B){var Q=B.cfg,ie=b.appInsights,se=ar(null,Q,ie.core),E=se.getExtCfg(ie.identifier||NS);A();var P=Q.disablePageUnloadEvents;E.disableFlushOnBeforeUnload||(mN(_,P,c)&&(F=!0),lg(_,P,c)&&(F=!0),!F&&!$k()&&ne(u.logger,1,19,"Could not add handler for beforeunload and pagehide")),!F&&!E.disableFlushOnUnload&&lg(_,P,c)}))}},v.getSender=function(){return o},v.unload=function(b,_,F){var B=!1,Q;b!==!1&&!_&&(Q=Pr(function(se){_=se}));function ie(se){B||(B=!0,R(),_&&_(se))}return v[oc](b),A(),u.unload&&u.unload(b,ie,F),Q},hc(v,d,[bD,MD,LD,"trackPageViewPerformance",FD,"_onerror",xD,UD,kD,PD,ND,OD]),hc(v,I,[HD,"addDependencyListener","addDependencyInitializer"]),hc(v,u,[DD,gT,"stopPollingInternalLogs",Ep,"addPlugin",_p,"addUnloadCb","getTraceCtx","updateCfg","onCfgChange"]),hc(v,function(){var b=i[Dn];return b?b.user:null},[BD,KD]);function I(){return r}function R(){s=qn("AISKU"),c=null,r=null,i=null,o=null,a=null,h=null,f=!1,g=!1,m=!1,p=new UO}function A(){c&&(vN(null,c),yN(null,c))}function M(b){u.addUnloadHook(b)}})}return t.prototype.addDependencyInitializer=function(e){return null},t})();function WD(){if(ac)return ac;var t=null,e=!1,n=["://js.monitor.azure.com/","://az416426.vo.msecnd.net/"];try{var r=(document||{}).currentScript;r&&(t=r.src)}catch{}if(t){try{var i=t.toLowerCase();if(i){var o="";ce(n,function(a,s){if(gt(i,a)!==-1)return o="cdn"+(s+1),gt(i,"/scripts/")===-1&&(gt(i,"/next/")!==-1?o+="-next":gt(i,"/beta/")!==-1&&(o+="-beta")),ac=o+(e?".mod":""),-1})}}catch{}ac=t}return ac}const JD=({instrumentationKey:t})=>(ge.useEffect(()=>{const e=new QD({config:{instrumentationKey:t,enableAutoRouteTracking:!0}});e.loadAppInsights(),e.trackPageView()},[t]),null);var rl={exports:{}},sc={};var CT;function XD(){if(CT)return sc;CT=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,o){var a=null;if(o!==void 0&&(a=""+o),i.key!==void 0&&(a=""+i.key),"key"in i){o={};for(var s in i)s!=="key"&&(o[s]=i[s])}else o=i;return i=o.ref,{$$typeof:t,type:r,key:a,ref:i!==void 0?i:null,props:o}}return sc.Fragment=e,sc.jsx=n,sc.jsxs=n,sc}var cc={};var TT;function ZD(){return TT||(TT=1,process.env.NODE_ENV!=="production"&&(function(){function t(k){if(k==null)return null;if(typeof k=="function")return k.$$typeof===Q?null:k.displayName||k.name||null;if(typeof k=="string")return k;switch(k){case m:return"Fragment";case y:return"Profiler";case v:return"StrictMode";case M:return"Suspense";case b:return"SuspenseList";case B:return"Activity"}if(typeof k=="object")switch(typeof k.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),k.$$typeof){case g:return"Portal";case R:return k.displayName||"Context";case I:return(k._context.displayName||"Context")+".Consumer";case A:var D=k.render;return k=k.displayName,k||(k=D.displayName||D.name||"",k=k!==""?"ForwardRef("+k+")":"ForwardRef"),k;case _:return D=k.displayName||null,D!==null?D:t(k.type)||"Memo";case F:D=k._payload,k=k._init;try{return t(k(D))}catch{}}return null}function e(k){return""+k}function n(k){try{e(k);var D=!1}catch{D=!0}if(D){D=console;var T=D.error,C=typeof Symbol=="function"&&Symbol.toStringTag&&k[Symbol.toStringTag]||k.constructor.name||"Object";return T.call(D,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",C),e(k)}}function r(k){if(k===m)return"<>";if(typeof k=="object"&&k!==null&&k.$$typeof===F)return"<...>";try{var D=t(k);return D?"<"+D+">":"<...>"}catch{return"<...>"}}function i(){var k=ie.A;return k===null?null:k.getOwner()}function o(){return Error("react-stack-top-frame")}function a(k){if(se.call(k,"key")){var D=Object.getOwnPropertyDescriptor(k,"key").get;if(D&&D.isReactWarning)return!1}return k.key!==void 0}function s(k,D){function T(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",D))}T.isReactWarning=!0,Object.defineProperty(k,"key",{get:T,configurable:!0})}function c(){var k=t(this.type);return U[k]||(U[k]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),k=this.props.ref,k!==void 0?k:null}function u(k,D,T,C,L,X){var ee=T.ref;return k={$$typeof:f,type:k,key:D,props:T,_owner:C},(ee!==void 0?ee:null)!==null?Object.defineProperty(k,"ref",{enumerable:!1,get:c}):Object.defineProperty(k,"ref",{enumerable:!1,value:null}),k._store={},Object.defineProperty(k._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(k,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(k,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:L}),Object.defineProperty(k,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(k.props),Object.freeze(k)),k}function l(k,D,T,C,L,X){var ee=D.children;if(ee!==void 0)if(C)if(E(ee)){for(C=0;C<ee.length;C++)d(ee[C]);Object.freeze&&Object.freeze(ee)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(ee);if(se.call(D,"key")){ee=t(k);var Ae=Object.keys(D).filter(function(Pe){return Pe!=="key"});C=0<Ae.length?"{key: someKey, "+Ae.join(": ..., ")+": ...}":"{key: someKey}",ve[ee+C]||(Ae=0<Ae.length?"{"+Ae.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<%s key={someKey} {...props} />`,C,ee,Ae,ee),ve[ee+C]=!0)}if(ee=null,T!==void 0&&(n(T),ee=""+T),a(D)&&(n(D.key),ee=""+D.key),"key"in D){T={};for(var Re in D)Re!=="key"&&(T[Re]=D[Re])}else T=D;return ee&&s(T,typeof k=="function"?k.displayName||k.name||"Unknown":k),u(k,ee,T,i(),L,X)}function d(k){p(k)?k._store&&(k._store.validated=1):typeof k=="object"&&k!==null&&k.$$typeof===F&&(k._payload.status==="fulfilled"?p(k._payload.value)&&k._payload.value._store&&(k._payload.value._store.validated=1):k._store&&(k._store.validated=1))}function p(k){return typeof k=="object"&&k!==null&&k.$$typeof===f}var h=ge,f=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),R=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),Q=Symbol.for("react.client.reference"),ie=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=Object.prototype.hasOwnProperty,E=Array.isArray,P=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(k){return k()}};var Y,U={},O=h.react_stack_bottom_frame.bind(h,o)(),le=P(r(o)),ve={};cc.Fragment=m,cc.jsx=function(k,D,T){var C=1e4>ie.recentlyCreatedOwnerStacks++;return l(k,D,T,!1,C?Error("react-stack-top-frame"):O,C?P(r(k)):le)},cc.jsxs=function(k,D,T){var C=1e4>ie.recentlyCreatedOwnerStacks++;return l(k,D,T,!0,C?Error("react-stack-top-frame"):O,C?P(r(k)):le)}})()),cc}var ET;function e0(){return ET||(ET=1,process.env.NODE_ENV==="production"?rl.exports=XD():rl.exports=ZD()),rl.exports}var oe=e0();const z={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",NOT_APPLICABLE:"N/A",NOT_AVAILABLE:"Not Available",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},Di={SUCCESS:200,SUCCESS_RANGE_START:200,SUCCESS_RANGE_END:299,REDIRECT:302,CLIENT_ERROR:400,CLIENT_ERROR_RANGE_START:400,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,REQUEST_TIMEOUT:408,GONE:410,TOO_MANY_REQUESTS:429,CLIENT_ERROR_RANGE_END:499,SERVER_ERROR:500,SERVER_ERROR_RANGE_START:500,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,SERVER_ERROR_RANGE_END:599,MULTI_SIDED_ERROR:600},bo={GET:"GET",POST:"POST"},Rs=[z.OPENID_SCOPE,z.PROFILE_SCOPE,z.OFFLINE_ACCESS_SCOPE],_T=[...Rs,z.EMAIL_SCOPE],en={CONTENT_TYPE:"Content-Type",CONTENT_LENGTH:"Content-Length",RETRY_AFTER:"Retry-After",CCS_HEADER:"X-AnchorMailbox",WWWAuthenticate:"WWW-Authenticate",AuthenticationInfo:"Authentication-Info",X_MS_REQUEST_ID:"x-ms-request-id",X_MS_HTTP_VERSION:"x-ms-httpver"},ST={ACTIVE_ACCOUNT_FILTERS:"active-account-filters"},Ki={COMMON:"common",ORGANIZATIONS:"organizations",CONSUMERS:"consumers"},il={ACCESS_TOKEN:"access_token",XMS_CC:"xms_cc"},Ht={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",NO_SESSION:"no_session"},ov={CODE:"code",IDTOKEN_TOKEN_REFRESHTOKEN:"id_token token refresh_token"},Sh={QUERY:"query",FRAGMENT:"fragment"},t0={QUERY:"query"},_A={AUTHORIZATION_CODE_GRANT:"authorization_code",REFRESH_TOKEN_GRANT:"refresh_token"},ol={MSSTS_ACCOUNT_TYPE:"MSSTS",ADFS_ACCOUNT_TYPE:"ADFS",GENERIC_ACCOUNT_TYPE:"Generic"},tu={CACHE_KEY_SEPARATOR:"-",CLIENT_INFO_SEPARATOR:"."},Ut={ID_TOKEN:"IdToken",ACCESS_TOKEN:"AccessToken",ACCESS_TOKEN_WITH_AUTH_SCHEME:"AccessToken_With_AuthScheme",REFRESH_TOKEN:"RefreshToken"},av="appmetadata",n0="client_info",xd="1",Ud={CACHE_KEY:"authority-metadata",REFRESH_TIME_SECONDS:3600*24},In={CONFIG:"config",CACHE:"cache",NETWORK:"network",HARDCODED_VALUES:"hardcoded_values"},xt={SCHEMA_VERSION:5,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"},je={BEARER:"Bearer",POP:"pop",SSH:"ssh-cert"},Oc={DEFAULT_THROTTLE_TIME_SECONDS:60,DEFAULT_MAX_THROTTLE_TIME_SECONDS:3600,THROTTLING_PREFIX:"throttling",X_MS_LIB_CAPABILITY_VALUE:"retry-after, h429"},AT={INVALID_GRANT_ERROR:"invalid_grant",CLIENT_MISMATCH_ERROR:"client_mismatch"},Na={FAILED_AUTO_DETECTION:"1",INTERNAL_CACHE:"2",ENVIRONMENT_VARIABLE:"3",IMDS:"4"},Rp={CONFIGURED_NO_AUTO_DETECTION:"2",AUTO_DETECTION_REQUESTED_SUCCESSFUL:"4",AUTO_DETECTION_REQUESTED_FAILED:"5"},mo={NOT_APPLICABLE:"0",FORCE_REFRESH_OR_CLAIMS:"1",NO_CACHED_ACCESS_TOKEN:"2",CACHED_ACCESS_TOKEN_EXPIRED:"3",PROACTIVELY_REFRESHED:"4"},r0={Pop:"pop"},SA=300;const Ld="unexpected_error",i0="post_request_failed";const IT={[Ld]:"Unexpected error in authentication.",[i0]:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."};class Xe extends Error{constructor(e,n,r){const i=n?`${e}: ${n}`:e;super(i),Object.setPrototypeOf(this,Xe.prototype),this.errorCode=e||z.EMPTY_STRING,this.errorMessage=n||z.EMPTY_STRING,this.subError=r||z.EMPTY_STRING,this.name="AuthError"}setCorrelationId(e){this.correlationId=e}}function Kg(t,e){return new Xe(t,e?`${IT[t]} ${e}`:IT[t])}const sv="client_info_decoding_error",AA="client_info_empty_error",cv="token_parsing_error",IA="null_or_empty_token",Gr="endpoints_resolution_error",wA="network_error",RA="openid_config_error",bA="hash_not_deserialized",Es="invalid_state",kA="state_mismatch",Gg="state_not_found",PA="nonce_mismatch",uv="auth_time_not_found",NA="max_age_transpired",o0="multiple_matching_tokens",a0="multiple_matching_accounts",OA="multiple_matching_appMetadata",DA="request_cannot_be_made",MA="cannot_remove_empty_scope",xA="cannot_append_scopeset",qg="empty_input_scopeset",s0="device_code_polling_cancelled",c0="device_code_expired",u0="device_code_unknown_error",lv="no_account_in_silent_request",UA="invalid_cache_record",dv="invalid_cache_environment",$g="no_account_found",Yg="no_crypto_object",l0="unexpected_credential_type",d0="invalid_assertion",h0="invalid_client_credential",Gi="token_refresh_required",f0="user_timeout_reached",LA="token_claims_cnf_required_for_signedjwt",FA="authorization_code_missing_from_server_response",HA="binding_key_not_removed",BA="end_session_endpoint_not_supported",hv="key_id_missing",p0="no_network_connectivity",g0="user_canceled",m0="missing_tenant_id_error",Me="method_not_implemented",v0="nested_app_auth_bridge_disabled",y0="platform_broker_error";const wT={[sv]:"The client info could not be parsed/decoded correctly",[AA]:"The client info was empty",[cv]:"Token cannot be parsed",[IA]:"The token is null or empty",[Gr]:"Endpoints cannot be resolved",[wA]:"Network request failed",[RA]:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.",[bA]:"The hash parameters could not be deserialized",[Es]:"State was not the expected format",[kA]:"State mismatch error",[Gg]:"State not found",[PA]:"Nonce mismatch error",[uv]:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.",[NA]:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",[o0]:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account.",[a0]:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account",[OA]:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata",[DA]:"Token request cannot be made without authorization code or refresh token.",[MA]:"Cannot remove null or empty scope from ScopeSet",[xA]:"Cannot append ScopeSet",[qg]:"Empty input ScopeSet cannot be processed",[s0]:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.",[c0]:"Device code is expired.",[u0]:"Device code stopped polling for unknown reasons.",[lv]:"Please pass an account object, silent flow is not supported without account information",[UA]:"Cache record object was null or undefined.",[dv]:"Invalid environment when attempting to create cache entry",[$g]:"No account found in cache for given key.",[Yg]:"No crypto object detected.",[l0]:"Unexpected credential type.",[d0]:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515",[h0]:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential",[Gi]:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.",[f0]:"User defined timeout for device code polling reached",[LA]:"Cannot generate a POP jwt if the token_claims are not populated",[FA]:"Server response does not contain an authorization code to proceed",[HA]:"Could not remove the credential's binding key from storage.",[BA]:"The provided authority does not support logout",[hv]:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.",[p0]:"No network connectivity. Check your internet connection.",[g0]:"User cancelled the flow.",[m0]:"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",[Me]:"This method has not been implemented",[v0]:"The nested app auth bridge is disabled",[y0]:"An error occurred in the native broker. See the platformBrokerError property for details."};class fv extends Xe{constructor(e,n){super(e,n?`${wT[e]}: ${n}`:wT[e]),this.name="ClientAuthError",Object.setPrototypeOf(this,fv.prototype)}}function J(t,e){return new fv(t,e)}const Fd={createNewGuid:()=>{throw J(Me)},base64Decode:()=>{throw J(Me)},base64Encode:()=>{throw J(Me)},base64UrlEncode:()=>{throw J(Me)},encodeKid:()=>{throw J(Me)},async getPublicKeyThumbprint(){throw J(Me)},async removeTokenBindingKey(){throw J(Me)},async clearKeystore(){throw J(Me)},async signJwt(){throw J(Me)},async hashString(){throw J(Me)}};var ot;(function(t){t[t.Error=0]="Error",t[t.Warning=1]="Warning",t[t.Info=2]="Info",t[t.Verbose=3]="Verbose",t[t.Trace=4]="Trace"})(ot||(ot={}));class ai{constructor(e,n,r){this.level=ot.Info;const i=()=>{},o=e||ai.createDefaultLoggerOptions();this.localCallback=o.loggerCallback||i,this.piiLoggingEnabled=o.piiLoggingEnabled||!1,this.level=typeof o.logLevel=="number"?o.logLevel:ot.Info,this.correlationId=o.correlationId||z.EMPTY_STRING,this.packageName=n||z.EMPTY_STRING,this.packageVersion=r||z.EMPTY_STRING}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:ot.Info}}clone(e,n,r){return new ai({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:r||this.correlationId},e,n)}logMessage(e,n){if(n.logLevel>this.level||!this.piiLoggingEnabled&&n.containsPii)return;const o=`${`[${new Date().toUTCString()}] : [${n.correlationId||this.correlationId||""}]`} : ${this.packageName}@${this.packageVersion} : ${ot[n.logLevel]} - ${e}`;this.executeCallback(n.logLevel,o,n.containsPii||!1)}executeCallback(e,n,r){this.localCallback&&this.localCallback(e,n,r)}error(e,n){this.logMessage(e,{logLevel:ot.Error,containsPii:!1,correlationId:n||z.EMPTY_STRING})}errorPii(e,n){this.logMessage(e,{logLevel:ot.Error,containsPii:!0,correlationId:n||z.EMPTY_STRING})}warning(e,n){this.logMessage(e,{logLevel:ot.Warning,containsPii:!1,correlationId:n||z.EMPTY_STRING})}warningPii(e,n){this.logMessage(e,{logLevel:ot.Warning,containsPii:!0,correlationId:n||z.EMPTY_STRING})}info(e,n){this.logMessage(e,{logLevel:ot.Info,containsPii:!1,correlationId:n||z.EMPTY_STRING})}infoPii(e,n){this.logMessage(e,{logLevel:ot.Info,containsPii:!0,correlationId:n||z.EMPTY_STRING})}verbose(e,n){this.logMessage(e,{logLevel:ot.Verbose,containsPii:!1,correlationId:n||z.EMPTY_STRING})}verbosePii(e,n){this.logMessage(e,{logLevel:ot.Verbose,containsPii:!0,correlationId:n||z.EMPTY_STRING})}trace(e,n){this.logMessage(e,{logLevel:ot.Trace,containsPii:!1,correlationId:n||z.EMPTY_STRING})}tracePii(e,n){this.logMessage(e,{logLevel:ot.Trace,containsPii:!0,correlationId:n||z.EMPTY_STRING})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}const KA="@azure/msal-common",pv="15.14.0";const gv={None:"none"};const GA="redirect_uri_empty",C0="claims_request_parsing_error",qA="authority_uri_insecure",_c="url_parse_error",$A="empty_url_error",YA="empty_input_scopes_error",mv="invalid_claims",zA="token_request_empty",jA="logout_request_empty",T0="invalid_code_challenge_method",vv="pkce_params_missing",yv="invalid_cloud_discovery_metadata",VA="invalid_authority_metadata",QA="untrusted_authority",Ah="missing_ssh_jwk",WA="missing_ssh_kid",E0="missing_nonce_authentication_header",_0="invalid_authentication_header",JA="cannot_set_OIDCOptions",XA="cannot_allow_platform_broker",ZA="authority_mismatch",eI="invalid_request_method_for_EAR",tI="invalid_authorize_post_body_parameters",nI="invalid_platform_broker_configuration";const S0={[GA]:"A redirect URI is required for all calls, and none has been set.",[C0]:"Could not parse the given claims request object.",[qA]:"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options",[_c]:"URL could not be parsed into appropriate segments.",[$A]:"URL was empty or null.",[YA]:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",[mv]:"Given claims parameter must be a stringified JSON object.",[zA]:"Token request was empty and not found in cache.",[jA]:"The logout request was null or undefined.",[T0]:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".',[vv]:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request",[yv]:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields",[VA]:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.",[QA]:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.",[Ah]:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.",[WA]:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.",[E0]:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",[_0]:"Invalid authentication header provided",[JA]:"Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",[XA]:"Cannot set allowPlatformBroker parameter to true when not in AAD protocol mode.",[ZA]:"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority.",[tI]:"Invalid authorize post body parameters provided. If you are using authorizePostBodyParameters, the request method must be POST. Please check the request method and parameters.",[eI]:"Invalid request method for EAR protocol mode. The request method cannot be GET when using EAR protocol mode. Please change the request method to POST.",[nI]:"Invalid platform broker configuration. `allowPlatformBrokerWithDOM` can only be enabled when `allowPlatformBroker` is enabled."};class Cv extends Xe{constructor(e){super(e,S0[e]),this.name="ClientConfigurationError",Object.setPrototypeOf(this,Cv.prototype)}}function We(t){return new Cv(t)}class Pn{static isEmptyObj(e){if(e)try{const n=JSON.parse(e);return Object.keys(n).length===0}catch{}return!0}static startsWith(e,n){return e.indexOf(n)===0}static endsWith(e,n){return e.length>=n.length&&e.lastIndexOf(n)===e.length-n.length}static queryStringToObject(e){const n={},r=e.split("&"),i=o=>decodeURIComponent(o.replace(/\+/g," "));return r.forEach(o=>{if(o.trim()){const[a,s]=o.split(/=(.+)/g,2);a&&s&&(n[i(a)]=i(s))}}),n}static trimArrayEntries(e){return e.map(n=>n.trim())}static removeEmptyStringsFromArray(e){return e.filter(n=>!!n)}static jsonParseHelper(e){try{return JSON.parse(e)}catch{return null}}static matchPattern(e,n){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(n)}}class kt{constructor(e){const n=e?Pn.trimArrayEntries([...e]):[],r=n?Pn.removeEmptyStringsFromArray(n):[];if(!r||!r.length)throw We(YA);this.scopes=new Set,r.forEach(i=>this.scopes.add(i))}static fromString(e){const r=(e||z.EMPTY_STRING).split(" ");return new kt(r)}static createSearchScopes(e){const n=e&&e.length>0?e:[...Rs],r=new kt(n);return r.containsOnlyOIDCScopes()?r.removeScope(z.OFFLINE_ACCESS_SCOPE):r.removeOIDCScopes(),r}containsScope(e){const n=this.printScopesLowerCase().split(" "),r=new kt(n);return e?r.scopes.has(e.toLowerCase()):!1}containsScopeSet(e){return!e||e.scopes.size<=0?!1:this.scopes.size>=e.scopes.size&&e.asArray().every(n=>this.containsScope(n))}containsOnlyOIDCScopes(){let e=0;return _T.forEach(n=>{this.containsScope(n)&&(e+=1)}),this.scopes.size===e}appendScope(e){e&&this.scopes.add(e.trim())}appendScopes(e){try{e.forEach(n=>this.appendScope(n))}catch{throw J(xA)}}removeScope(e){if(!e)throw J(MA);this.scopes.delete(e.trim())}removeOIDCScopes(){_T.forEach(e=>{this.scopes.delete(e)})}unionScopeSets(e){if(!e)throw J(qg);const n=new Set;return e.scopes.forEach(r=>n.add(r.toLowerCase())),this.scopes.forEach(r=>n.add(r.toLowerCase())),n}intersectingScopeSets(e){if(!e)throw J(qg);e.containsOnlyOIDCScopes()||e.removeOIDCScopes();const n=this.unionScopeSets(e),r=e.getScopeCount(),i=this.getScopeCount();return n.size<i+r}getScopeCount(){return this.scopes.size}asArray(){const e=[];return this.scopes.forEach(n=>e.push(n)),e}printScopes(){return this.scopes?this.asArray().join(" "):z.EMPTY_STRING}printScopesLowerCase(){return this.printScopes().toLowerCase()}}function Hd(t,e){if(!t)throw J(AA);try{const n=e(t);return JSON.parse(n)}catch{throw J(sv)}}function cs(t){if(!t)throw J(sv);const e=t.split(tu.CLIENT_INFO_SEPARATOR,2);return{uid:e[0],utid:e.length<2?z.EMPTY_STRING:e[1]}}function RT(t,e){return!!t&&!!e&&t===e.split(".")[1]}function Ih(t,e,n,r){if(r){const{oid:i,sub:o,tid:a,name:s,tfp:c,acr:u,preferred_username:l,upn:d,login_hint:p}=r,h=a||c||u||"";return{tenantId:h,localAccountId:i||o||"",name:s,username:l||d||"",loginHint:p,isHomeTenant:RT(h,t)}}else return{tenantId:n,localAccountId:e,username:"",isHomeTenant:RT(n,t)}}function Tv(t,e,n,r){let i=t;if(e){const{isHomeTenant:o,...a}=e;i={...t,...a}}if(n){const{isHomeTenant:o,...a}=Ih(t.homeAccountId,t.localAccountId,t.tenantId,n);return i={...i,...a,idTokenClaims:n,idToken:r},i}return i}const Xn={Default:0,Adfs:1,Dsts:2,Ciam:3};function Ev(t){return t&&(t.tid||t.tfp||t.acr)||null}const mn={AAD:"AAD",OIDC:"OIDC",EAR:"EAR"};class lt{static getAccountInfo(e){return{homeAccountId:e.homeAccountId,environment:e.environment,tenantId:e.realm,username:e.username,localAccountId:e.localAccountId,loginHint:e.loginHint,name:e.name,nativeAccountId:e.nativeAccountId,authorityType:e.authorityType,tenantProfiles:new Map((e.tenantProfiles||[]).map(n=>[n.tenantId,n])),dataBoundary:e.dataBoundary}}isSingleTenant(){return!this.tenantProfiles}static createAccount(e,n,r){const i=new lt;n.authorityType===Xn.Adfs?i.authorityType=ol.ADFS_ACCOUNT_TYPE:n.protocolMode===mn.OIDC?i.authorityType=ol.GENERIC_ACCOUNT_TYPE:i.authorityType=ol.MSSTS_ACCOUNT_TYPE;let o;e.clientInfo&&r&&(o=Hd(e.clientInfo,r),o.xms_tdbr&&(i.dataBoundary=o.xms_tdbr==="EU"?"EU":"None")),i.clientInfo=e.clientInfo,i.homeAccountId=e.homeAccountId,i.nativeAccountId=e.nativeAccountId;const a=e.environment||n&&n.getPreferredCache();if(!a)throw J(dv);i.environment=a,i.realm=o?.utid||Ev(e.idTokenClaims)||"",i.localAccountId=o?.uid||e.idTokenClaims?.oid||e.idTokenClaims?.sub||"";const s=e.idTokenClaims?.preferred_username||e.idTokenClaims?.upn,c=e.idTokenClaims?.emails?e.idTokenClaims.emails[0]:null;if(i.username=s||c||"",i.loginHint=e.idTokenClaims?.login_hint,i.name=e.idTokenClaims?.name||"",i.cloudGraphHostName=e.cloudGraphHostName,i.msGraphHost=e.msGraphHost,e.tenantProfiles)i.tenantProfiles=e.tenantProfiles;else{const u=Ih(e.homeAccountId,i.localAccountId,i.realm,e.idTokenClaims);i.tenantProfiles=[u]}return i}static createFromAccountInfo(e,n,r){const i=new lt;return i.authorityType=e.authorityType||ol.GENERIC_ACCOUNT_TYPE,i.homeAccountId=e.homeAccountId,i.localAccountId=e.localAccountId,i.nativeAccountId=e.nativeAccountId,i.realm=e.tenantId,i.environment=e.environment,i.username=e.username,i.name=e.name,i.loginHint=e.loginHint,i.cloudGraphHostName=n,i.msGraphHost=r,i.tenantProfiles=Array.from(e.tenantProfiles?.values()||[]),i.dataBoundary=e.dataBoundary,i}static generateHomeAccountId(e,n,r,i,o){if(!(n===Xn.Adfs||n===Xn.Dsts)){if(e)try{const a=Hd(e,i.base64Decode);if(a.uid&&a.utid)return`${a.uid}.${a.utid}`}catch{}r.warning("No client info in response")}return o?.sub||""}static isAccountEntity(e){return e?e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType"):!1}static accountInfoIsEqual(e,n,r){if(!e||!n)return!1;let i=!0;if(r){const o=e.idTokenClaims||{},a=n.idTokenClaims||{};i=o.iat===a.iat&&o.nonce===a.nonce}return e.homeAccountId===n.homeAccountId&&e.localAccountId===n.localAccountId&&e.username===n.username&&e.tenantId===n.tenantId&&e.loginHint===n.loginHint&&e.environment===n.environment&&e.nativeAccountId===n.nativeAccountId&&i}}function Ar(t,e){const n=A0(t);try{const r=e(n);return JSON.parse(r)}catch{throw J(cv)}}function kr(t){if(!t.signin_state)return!1;const e=["kmsi","dvc_dmjd"];return t.signin_state.some(r=>e.includes(r.trim().toLowerCase()))}function A0(t){if(!t)throw J(IA);const n=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(t);if(!n||n.length<4)throw J(cv);return n[2]}function rI(t,e){if(e===0||Date.now()-3e5>t+e)throw J(NA)}function bT(t){if(!t)return t;let e=t.toLowerCase();return Pn.endsWith(e,"?")?e=e.slice(0,-1):Pn.endsWith(e,"?/")&&(e=e.slice(0,-2)),Pn.endsWith(e,"/")||(e+="/"),e}function iI(t){return t.startsWith("#/")?t.substring(2):t.startsWith("#")||t.startsWith("?")?t.substring(1):t}function Bd(t){if(!t||t.indexOf("=")<0)return null;try{const e=iI(t),n=Object.fromEntries(new URLSearchParams(e));if(n.code||n.ear_jwe||n.error||n.error_description||n.state)return n}catch{throw J(bA)}return null}function nu(t,e=!0,n){const r=new Array;return t.forEach((i,o)=>{!e&&n&&o in n?r.push(`${o}=${i}`):r.push(`${o}=${encodeURIComponent(i)}`)}),r.join("&")}function kT(t){if(!t)return t;const e=t.split("#")[0];try{const n=new URL(e),r=n.origin+n.pathname+n.search;return bT(r)}catch{return bT(e)}}class Ye{get urlString(){return this._urlString}constructor(e){if(this._urlString=e,!this._urlString)throw We($A);e.includes("#")||(this._urlString=Ye.canonicalizeUri(e))}static canonicalizeUri(e){if(e){let n=e.toLowerCase();return Pn.endsWith(n,"?")?n=n.slice(0,-1):Pn.endsWith(n,"?/")&&(n=n.slice(0,-2)),Pn.endsWith(n,"/")||(n+="/"),n}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch{throw We(_c)}if(!e.HostNameAndPort||!e.PathSegments)throw We(_c);if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw We(qA)}static appendQueryString(e,n){return n?e.indexOf("?")<0?`${e}?${n}`:`${e}&${n}`:e}static removeHashFromUrl(e){return Ye.canonicalizeUri(e.split("#")[0])}replaceTenantPath(e){const n=this.getUrlComponents(),r=n.PathSegments;return e&&r.length!==0&&(r[0]===Ki.COMMON||r[0]===Ki.ORGANIZATIONS)&&(r[0]=e),Ye.constructAuthorityUriFromObject(n)}getUrlComponents(){const e=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),n=this.urlString.match(e);if(!n)throw We(_c);const r={Protocol:n[1],HostNameAndPort:n[4],AbsolutePath:n[5],QueryString:n[7]};let i=r.AbsolutePath.split("/");return i=i.filter(o=>o&&o.length>0),r.PathSegments=i,r.QueryString&&r.QueryString.endsWith("/")&&(r.QueryString=r.QueryString.substring(0,r.QueryString.length-1)),r}static getDomainFromUrl(e){const n=RegExp("^([^:/?#]+://)?([^/?#]*)"),r=e.match(n);if(!r)throw We(_c);return r[2]}static getAbsoluteUrl(e,n){if(e[0]===z.FORWARD_SLASH){const i=new Ye(n).getUrlComponents();return i.Protocol+"//"+i.HostNameAndPort+e}return e}static constructAuthorityUriFromObject(e){return new Ye(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))}static hashContainsKnownProperties(e){return!!Bd(e)}}const oI={endpointMetadata:{"login.microsoftonline.com":{token_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/logout"},"login.chinacloudapi.cn":{token_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.chinacloudapi.cn/{tenantid}/discovery/v2.0/keys",issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",authorization_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/logout"},"login.microsoftonline.us":{token_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.us/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/logout"}},instanceDiscoveryMetadata:{metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]}},PT=oI.endpointMetadata,_v=oI.instanceDiscoveryMetadata,aI=new Set;_v.metadata.forEach(t=>{t.aliases.forEach(e=>{aI.add(e)})});function I0(t,e){let n;const r=t.canonicalAuthority;if(r){const i=new Ye(r).getUrlComponents().HostNameAndPort;n=NT(i,t.cloudDiscoveryMetadata?.metadata,In.CONFIG,e)||NT(i,_v.metadata,In.HARDCODED_VALUES,e)||t.knownAuthorities}return n||[]}function NT(t,e,n,r){if(r?.trace(`getAliasesFromMetadata called with source: ${n}`),t&&e){const i=Kd(e,t);if(i)return r?.trace(`getAliasesFromMetadata: found cloud discovery metadata in ${n}, returning aliases`),i.aliases;r?.trace(`getAliasesFromMetadata: did not find cloud discovery metadata in ${n}`)}return null}function w0(t){return Kd(_v.metadata,t)}function Kd(t,e){for(let n=0;n<t.length;n++){const r=t[n];if(r.aliases.includes(e))return r}return null}const Gd="cache_quota_exceeded",Sv="cache_error_unknown";const bp={[Gd]:"Exceeded cache storage capacity.",[Sv]:"Unexpected error occurred when using cache storage."};class us extends Xe{constructor(e,n){const r=n||(bp[e]?bp[e]:bp[Sv]);super(`${e}: ${r}`),Object.setPrototypeOf(this,us.prototype),this.name="CacheError",this.errorCode=e,this.errorMessage=r}}function zg(t){return t instanceof Error?t.name==="QuotaExceededError"||t.name==="NS_ERROR_DOM_QUOTA_REACHED"||t.message.includes("exceeded the quota")?new us(Gd):new us(t.name,t.message):new us(Sv)}class jg{constructor(e,n,r,i,o){this.clientId=e,this.cryptoImpl=n,this.commonLogger=r.clone(KA,pv),this.staticAuthorityOptions=o,this.performanceClient=i}getAllAccounts(e,n){return this.buildTenantProfiles(this.getAccountsFilteredBy(e,n),n,e)}getAccountInfoFilteredBy(e,n){if(Object.keys(e).length===0||Object.values(e).every(i=>!i))return this.commonLogger.warning("getAccountInfoFilteredBy: Account filter is empty or invalid, returning null"),null;const r=this.getAllAccounts(e,n);return r.length>1?r.sort(o=>o.idTokenClaims?-1:1)[0]:r.length===1?r[0]:null}getBaseAccountInfo(e,n){const r=this.getAccountsFilteredBy(e,n);return r.length>0?lt.getAccountInfo(r[0]):null}buildTenantProfiles(e,n,r){return e.flatMap(i=>this.getTenantProfilesFromAccountEntity(i,n,r?.tenantId,r))}getTenantedAccountInfoByFilter(e,n,r,i,o){let a=null,s;if(o&&!this.tenantProfileMatchesFilter(r,o))return null;const c=this.getIdToken(e,i,n,r.tenantId);return c&&(s=Ar(c.secret,this.cryptoImpl.base64Decode),!this.idTokenClaimsMatchTenantProfileFilter(s,o))?null:(a=Tv(e,r,s,c?.secret),a)}getTenantProfilesFromAccountEntity(e,n,r,i){const o=lt.getAccountInfo(e);let a=o.tenantProfiles||new Map;const s=this.getTokenKeys();if(r){const u=a.get(r);if(u)a=new Map([[r,u]]);else return[]}const c=[];return a.forEach(u=>{const l=this.getTenantedAccountInfoByFilter(o,s,u,n,i);l&&c.push(l)}),c}tenantProfileMatchesFilter(e,n){return!(n.localAccountId&&!this.matchLocalAccountIdFromTenantProfile(e,n.localAccountId)||n.name&&e.name!==n.name||n.isHomeTenant!==void 0&&e.isHomeTenant!==n.isHomeTenant)}idTokenClaimsMatchTenantProfileFilter(e,n){return!(n&&(n.localAccountId&&!this.matchLocalAccountIdFromTokenClaims(e,n.localAccountId)||n.loginHint&&!this.matchLoginHintFromTokenClaims(e,n.loginHint)||n.username&&!this.matchUsername(e.preferred_username,n.username)||n.name&&!this.matchName(e,n.name)||n.sid&&!this.matchSid(e,n.sid)))}async saveCacheRecord(e,n,r,i,o){if(!e)throw J(UA);try{e.account&&await this.setAccount(e.account,n,r,i),e.idToken&&o?.idToken!==!1&&await this.setIdTokenCredential(e.idToken,n,r),e.accessToken&&o?.accessToken!==!1&&await this.saveAccessToken(e.accessToken,n,r),e.refreshToken&&o?.refreshToken!==!1&&await this.setRefreshTokenCredential(e.refreshToken,n,r),e.appMetadata&&this.setAppMetadata(e.appMetadata,n)}catch(a){throw this.commonLogger?.error("CacheManager.saveCacheRecord: failed"),a instanceof Xe?a:zg(a)}}async saveAccessToken(e,n,r){const i={clientId:e.clientId,credentialType:e.credentialType,environment:e.environment,homeAccountId:e.homeAccountId,realm:e.realm,tokenType:e.tokenType,requestedClaimsHash:e.requestedClaimsHash},o=this.getTokenKeys(),a=kt.fromString(e.target);o.accessToken.forEach(s=>{if(!this.accessTokenKeyMatchesFilter(s,i,!1))return;const c=this.getAccessTokenCredential(s,n);c&&this.credentialMatchesFilter(c,i)&&kt.fromString(c.target).intersectingScopeSets(a)&&this.removeAccessToken(s,n)}),await this.setAccessTokenCredential(e,n,r)}getAccountsFilteredBy(e,n){const r=this.getAccountKeys(),i=[];return r.forEach(o=>{const a=this.getAccount(o,n);if(!a||e.homeAccountId&&!this.matchHomeAccountId(a,e.homeAccountId)||e.username&&!this.matchUsername(a.username,e.username)||e.environment&&!this.matchEnvironment(a,e.environment)||e.realm&&!this.matchRealm(a,e.realm)||e.nativeAccountId&&!this.matchNativeAccountId(a,e.nativeAccountId)||e.authorityType&&!this.matchAuthorityType(a,e.authorityType))return;const s={localAccountId:e?.localAccountId,name:e?.name},c=a.tenantProfiles?.filter(u=>this.tenantProfileMatchesFilter(u,s));c&&c.length===0||i.push(a)}),i}credentialMatchesFilter(e,n){return!(n.clientId&&!this.matchClientId(e,n.clientId)||n.userAssertionHash&&!this.matchUserAssertionHash(e,n.userAssertionHash)||typeof n.homeAccountId=="string"&&!this.matchHomeAccountId(e,n.homeAccountId)||n.environment&&!this.matchEnvironment(e,n.environment)||n.realm&&!this.matchRealm(e,n.realm)||n.credentialType&&!this.matchCredentialType(e,n.credentialType)||n.familyId&&!this.matchFamilyId(e,n.familyId)||n.target&&!this.matchTarget(e,n.target)||(n.requestedClaimsHash||e.requestedClaimsHash)&&e.requestedClaimsHash!==n.requestedClaimsHash||e.credentialType===Ut.ACCESS_TOKEN_WITH_AUTH_SCHEME&&(n.tokenType&&!this.matchTokenType(e,n.tokenType)||n.tokenType===je.SSH&&n.keyId&&!this.matchKeyId(e,n.keyId)))}getAppMetadataFilteredBy(e){const n=this.getKeys(),r={};return n.forEach(i=>{if(!this.isAppMetadata(i))return;const o=this.getAppMetadata(i);o&&(e.environment&&!this.matchEnvironment(o,e.environment)||e.clientId&&!this.matchClientId(o,e.clientId)||(r[i]=o))}),r}getAuthorityMetadataByAlias(e){const n=this.getAuthorityMetadataKeys();let r=null;return n.forEach(i=>{if(!this.isAuthorityMetadata(i)||i.indexOf(this.clientId)===-1)return;const o=this.getAuthorityMetadata(i);o&&o.aliases.indexOf(e)!==-1&&(r=o)}),r}removeAllAccounts(e){this.getAllAccounts({},e).forEach(r=>{this.removeAccount(r,e)})}removeAccount(e,n){this.removeAccountContext(e,n);const r=this.getAccountKeys(),i=o=>o.includes(e.homeAccountId)&&o.includes(e.environment);r.filter(i).forEach(o=>{this.removeItem(o,n),this.performanceClient.incrementFields({accountsRemoved:1},n)})}removeAccountContext(e,n){const r=this.getTokenKeys(),i=o=>o.includes(e.homeAccountId)&&o.includes(e.environment);r.idToken.filter(i).forEach(o=>{this.removeIdToken(o,n)}),r.accessToken.filter(i).forEach(o=>{this.removeAccessToken(o,n)}),r.refreshToken.filter(i).forEach(o=>{this.removeRefreshToken(o,n)})}removeAccessToken(e,n){const r=this.getAccessTokenCredential(e,n);if(this.removeItem(e,n),this.performanceClient.incrementFields({accessTokensRemoved:1},n),!r||r.credentialType.toLowerCase()!==Ut.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()||r.tokenType!==je.POP)return;const i=r.keyId;i&&this.cryptoImpl.removeTokenBindingKey(i).catch(()=>{this.commonLogger.error(`Failed to remove token binding key ${i}`,n),this.performanceClient?.incrementFields({removeTokenBindingKeyFailure:1},n)})}removeAppMetadata(e){return this.getKeys().forEach(r=>{this.isAppMetadata(r)&&this.removeItem(r,e)}),!0}getIdToken(e,n,r,i,o){this.commonLogger.trace("CacheManager - getIdToken called");const a={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Ut.ID_TOKEN,clientId:this.clientId,realm:i},s=this.getIdTokensByFilter(a,n,r),c=s.size;if(c<1)return this.commonLogger.info("CacheManager:getIdToken - No token found"),null;if(c>1){let u=s;if(!i){const l=new Map;s.forEach((p,h)=>{p.realm===e.tenantId&&l.set(h,p)});const d=l.size;if(d<1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result"),s.values().next().value;if(d===1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile"),l.values().next().value;u=l}return this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them"),u.forEach((l,d)=>{this.removeIdToken(d,n)}),o&&n&&o.addFields({multiMatchedID:s.size},n),null}return this.commonLogger.info("CacheManager:getIdToken - Returning ID token"),s.values().next().value}getIdTokensByFilter(e,n,r){const i=r&&r.idToken||this.getTokenKeys().idToken,o=new Map;return i.forEach(a=>{if(!this.idTokenKeyMatchesFilter(a,{clientId:this.clientId,...e}))return;const s=this.getIdTokenCredential(a,n);s&&this.credentialMatchesFilter(s,e)&&o.set(a,s)}),o}idTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}removeIdToken(e,n){this.removeItem(e,n)}removeRefreshToken(e,n){this.removeItem(e,n)}getAccessToken(e,n,r,i){const o=n.correlationId;this.commonLogger.trace("CacheManager - getAccessToken called",o);const a=kt.createSearchScopes(n.scopes),s=n.authenticationScheme||je.BEARER,c=s.toLowerCase()!==je.BEARER.toLowerCase()?Ut.ACCESS_TOKEN_WITH_AUTH_SCHEME:Ut.ACCESS_TOKEN,u={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:c,clientId:this.clientId,realm:i||e.tenantId,target:a,tokenType:s,keyId:n.sshKid,requestedClaimsHash:n.requestedClaimsHash},l=r&&r.accessToken||this.getTokenKeys().accessToken,d=[];l.forEach(h=>{if(this.accessTokenKeyMatchesFilter(h,u,!0)){const f=this.getAccessTokenCredential(h,o);f&&this.credentialMatchesFilter(f,u)&&d.push(f)}});const p=d.length;return p<1?(this.commonLogger.info("CacheManager:getAccessToken - No token found",o),null):p>1?(this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them",o),d.forEach(h=>{this.removeAccessToken(this.generateCredentialKey(h),o)}),this.performanceClient.addFields({multiMatchedAT:d.length},o),null):(this.commonLogger.info("CacheManager:getAccessToken - Returning access token",o),d[0])}accessTokenKeyMatchesFilter(e,n,r){const i=e.toLowerCase();if(n.clientId&&i.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&i.indexOf(n.homeAccountId.toLowerCase())===-1||n.realm&&i.indexOf(n.realm.toLowerCase())===-1||n.requestedClaimsHash&&i.indexOf(n.requestedClaimsHash.toLowerCase())===-1)return!1;if(n.target){const o=n.target.asArray();for(let a=0;a<o.length;a++){if(r&&!i.includes(o[a].toLowerCase()))return!1;if(!r&&i.includes(o[a].toLowerCase()))return!0}}return!0}getAccessTokensByFilter(e,n){const r=this.getTokenKeys(),i=[];return r.accessToken.forEach(o=>{if(!this.accessTokenKeyMatchesFilter(o,e,!0))return;const a=this.getAccessTokenCredential(o,n);a&&this.credentialMatchesFilter(a,e)&&i.push(a)}),i}getRefreshToken(e,n,r,i,o){this.commonLogger.trace("CacheManager - getRefreshToken called");const a=n?xd:void 0,s={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Ut.REFRESH_TOKEN,clientId:this.clientId,familyId:a},c=i&&i.refreshToken||this.getTokenKeys().refreshToken,u=[];c.forEach(d=>{if(this.refreshTokenKeyMatchesFilter(d,s)){const p=this.getRefreshTokenCredential(d,r);p&&this.credentialMatchesFilter(p,s)&&u.push(p)}});const l=u.length;return l<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(l>1&&o&&r&&o.addFields({multiMatchedRT:l},r),this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),u[0])}refreshTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.familyId&&r.indexOf(n.familyId.toLowerCase())===-1||!n.familyId&&n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}readAppMetadataFromCache(e){const n={environment:e,clientId:this.clientId},r=this.getAppMetadataFilteredBy(n),i=Object.keys(r).map(a=>r[a]),o=i.length;if(o<1)return null;if(o>1)throw J(OA);return i[0]}isAppMetadataFOCI(e){const n=this.readAppMetadataFromCache(e);return!!(n&&n.familyId===xd)}matchHomeAccountId(e,n){return typeof e.homeAccountId=="string"&&n===e.homeAccountId}matchLocalAccountIdFromTokenClaims(e,n){const r=e.oid||e.sub;return n===r}matchLocalAccountIdFromTenantProfile(e,n){return e.localAccountId===n}matchName(e,n){return n.toLowerCase()===e.name?.toLowerCase()}matchUsername(e,n){return!!(e&&typeof e=="string"&&n?.toLowerCase()===e.toLowerCase())}matchUserAssertionHash(e,n){return!!(e.userAssertionHash&&n===e.userAssertionHash)}matchEnvironment(e,n){if(this.staticAuthorityOptions){const i=I0(this.staticAuthorityOptions,this.commonLogger);if(i.includes(n)&&i.includes(e.environment))return!0}const r=this.getAuthorityMetadataByAlias(n);return!!(r&&r.aliases.indexOf(e.environment)>-1)}matchCredentialType(e,n){return e.credentialType&&n.toLowerCase()===e.credentialType.toLowerCase()}matchClientId(e,n){return!!(e.clientId&&n===e.clientId)}matchFamilyId(e,n){return!!(e.familyId&&n===e.familyId)}matchRealm(e,n){return e.realm?.toLowerCase()===n.toLowerCase()}matchNativeAccountId(e,n){return!!(e.nativeAccountId&&n===e.nativeAccountId)}matchLoginHintFromTokenClaims(e,n){return e.login_hint===n||e.preferred_username===n||e.upn===n}matchSid(e,n){return e.sid===n}matchAuthorityType(e,n){return!!(e.authorityType&&n.toLowerCase()===e.authorityType.toLowerCase())}matchTarget(e,n){return e.credentialType!==Ut.ACCESS_TOKEN&&e.credentialType!==Ut.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target?!1:kt.fromString(e.target).containsScopeSet(n)}matchTokenType(e,n){return!!(e.tokenType&&e.tokenType===n)}matchKeyId(e,n){return!!(e.keyId&&e.keyId===n)}isAppMetadata(e){return e.indexOf(av)!==-1}isAuthorityMetadata(e){return e.indexOf(Ud.CACHE_KEY)!==-1}generateAuthorityMetadataCacheKey(e){return`${Ud.CACHE_KEY}-${this.clientId}-${e}`}static toObject(e,n){for(const r in n)e[r]=n[r];return e}}class R0 extends jg{async setAccount(){throw J(Me)}getAccount(){throw J(Me)}async setIdTokenCredential(){throw J(Me)}getIdTokenCredential(){throw J(Me)}async setAccessTokenCredential(){throw J(Me)}getAccessTokenCredential(){throw J(Me)}async setRefreshTokenCredential(){throw J(Me)}getRefreshTokenCredential(){throw J(Me)}setAppMetadata(){throw J(Me)}getAppMetadata(){throw J(Me)}setServerTelemetry(){throw J(Me)}getServerTelemetry(){throw J(Me)}setAuthorityMetadata(){throw J(Me)}getAuthorityMetadata(){throw J(Me)}getAuthorityMetadataKeys(){throw J(Me)}setThrottlingCache(){throw J(Me)}getThrottlingCache(){throw J(Me)}removeItem(){throw J(Me)}getKeys(){throw J(Me)}getAccountKeys(){throw J(Me)}getTokenKeys(){throw J(Me)}generateCredentialKey(){throw J(Me)}generateAccountKey(){throw J(Me)}}const S={AcquireTokenByCode:"acquireTokenByCode",AcquireTokenByRefreshToken:"acquireTokenByRefreshToken",AcquireTokenSilent:"acquireTokenSilent",AcquireTokenSilentAsync:"acquireTokenSilentAsync",AcquireTokenPopup:"acquireTokenPopup",AcquireTokenPreRedirect:"acquireTokenPreRedirect",AcquireTokenRedirect:"acquireTokenRedirect",CryptoOptsGetPublicKeyThumbprint:"cryptoOptsGetPublicKeyThumbprint",CryptoOptsSignJwt:"cryptoOptsSignJwt",SilentCacheClientAcquireToken:"silentCacheClientAcquireToken",SilentIframeClientAcquireToken:"silentIframeClientAcquireToken",AwaitConcurrentIframe:"awaitConcurrentIframe",SilentRefreshClientAcquireToken:"silentRefreshClientAcquireToken",SsoSilent:"ssoSilent",StandardInteractionClientGetDiscoveredAuthority:"standardInteractionClientGetDiscoveredAuthority",FetchAccountIdWithNativeBroker:"fetchAccountIdWithNativeBroker",NativeInteractionClientAcquireToken:"nativeInteractionClientAcquireToken",BaseClientCreateTokenRequestHeaders:"baseClientCreateTokenRequestHeaders",NetworkClientSendPostRequestAsync:"networkClientSendPostRequestAsync",RefreshTokenClientExecutePostToTokenEndpoint:"refreshTokenClientExecutePostToTokenEndpoint",AuthorizationCodeClientExecutePostToTokenEndpoint:"authorizationCodeClientExecutePostToTokenEndpoint",BrokerHandhshake:"brokerHandshake",AcquireTokenByRefreshTokenInBroker:"acquireTokenByRefreshTokenInBroker",AcquireTokenByBroker:"acquireTokenByBroker",RefreshTokenClientExecuteTokenRequest:"refreshTokenClientExecuteTokenRequest",RefreshTokenClientAcquireToken:"refreshTokenClientAcquireToken",RefreshTokenClientAcquireTokenWithCachedRefreshToken:"refreshTokenClientAcquireTokenWithCachedRefreshToken",RefreshTokenClientAcquireTokenByRefreshToken:"refreshTokenClientAcquireTokenByRefreshToken",RefreshTokenClientCreateTokenRequestBody:"refreshTokenClientCreateTokenRequestBody",AcquireTokenFromCache:"acquireTokenFromCache",SilentFlowClientAcquireCachedToken:"silentFlowClientAcquireCachedToken",SilentFlowClientGenerateResultFromCacheRecord:"silentFlowClientGenerateResultFromCacheRecord",AcquireTokenBySilentIframe:"acquireTokenBySilentIframe",InitializeBaseRequest:"initializeBaseRequest",InitializeSilentRequest:"initializeSilentRequest",InitializeClientApplication:"initializeClientApplication",InitializeCache:"initializeCache",SilentIframeClientTokenHelper:"silentIframeClientTokenHelper",SilentHandlerInitiateAuthRequest:"silentHandlerInitiateAuthRequest",SilentHandlerMonitorIframeForHash:"silentHandlerMonitorIframeForHash",SilentHandlerLoadFrame:"silentHandlerLoadFrame",SilentHandlerLoadFrameSync:"silentHandlerLoadFrameSync",StandardInteractionClientCreateAuthCodeClient:"standardInteractionClientCreateAuthCodeClient",StandardInteractionClientGetClientConfiguration:"standardInteractionClientGetClientConfiguration",StandardInteractionClientInitializeAuthorizationRequest:"standardInteractionClientInitializeAuthorizationRequest",GetAuthCodeUrl:"getAuthCodeUrl",GetStandardParams:"getStandardParams",HandleCodeResponseFromServer:"handleCodeResponseFromServer",HandleCodeResponse:"handleCodeResponse",HandleResponseEar:"handleResponseEar",HandleResponsePlatformBroker:"handleResponsePlatformBroker",HandleResponseCode:"handleResponseCode",UpdateTokenEndpointAuthority:"updateTokenEndpointAuthority",AuthClientAcquireToken:"authClientAcquireToken",AuthClientExecuteTokenRequest:"authClientExecuteTokenRequest",AuthClientCreateTokenRequestBody:"authClientCreateTokenRequestBody",PopTokenGenerateCnf:"popTokenGenerateCnf",PopTokenGenerateKid:"popTokenGenerateKid",HandleServerTokenResponse:"handleServerTokenResponse",DeserializeResponse:"deserializeResponse",AuthorityFactoryCreateDiscoveredInstance:"authorityFactoryCreateDiscoveredInstance",AuthorityResolveEndpointsAsync:"authorityResolveEndpointsAsync",AuthorityResolveEndpointsFromLocalSources:"authorityResolveEndpointsFromLocalSources",AuthorityGetCloudDiscoveryMetadataFromNetwork:"authorityGetCloudDiscoveryMetadataFromNetwork",AuthorityUpdateCloudDiscoveryMetadata:"authorityUpdateCloudDiscoveryMetadata",AuthorityGetEndpointMetadataFromNetwork:"authorityGetEndpointMetadataFromNetwork",AuthorityUpdateEndpointMetadata:"authorityUpdateEndpointMetadata",AuthorityUpdateMetadataWithRegionalInformation:"authorityUpdateMetadataWithRegionalInformation",RegionDiscoveryDetectRegion:"regionDiscoveryDetectRegion",RegionDiscoveryGetRegionFromIMDS:"regionDiscoveryGetRegionFromIMDS",RegionDiscoveryGetCurrentVersion:"regionDiscoveryGetCurrentVersion",AcquireTokenByCodeAsync:"acquireTokenByCodeAsync",GetEndpointMetadataFromNetwork:"getEndpointMetadataFromNetwork",GetCloudDiscoveryMetadataFromNetworkMeasurement:"getCloudDiscoveryMetadataFromNetworkMeasurement",HandleRedirectPromiseMeasurement:"handleRedirectPromise",HandleNativeRedirectPromiseMeasurement:"handleNativeRedirectPromise",UpdateCloudDiscoveryMetadataMeasurement:"updateCloudDiscoveryMetadataMeasurement",UsernamePasswordClientAcquireToken:"usernamePasswordClientAcquireToken",NativeMessageHandlerHandshake:"nativeMessageHandlerHandshake",NativeGenerateAuthResult:"nativeGenerateAuthResult",RemoveHiddenIframe:"removeHiddenIframe",ClearTokensAndKeysWithClaims:"clearTokensAndKeysWithClaims",CacheManagerGetRefreshToken:"cacheManagerGetRefreshToken",ImportExistingCache:"importExistingCache",SetUserData:"setUserData",LocalStorageUpdated:"localStorageUpdated",GeneratePkceCodes:"generatePkceCodes",GenerateCodeVerifier:"generateCodeVerifier",GenerateCodeChallengeFromVerifier:"generateCodeChallengeFromVerifier",Sha256Digest:"sha256Digest",GetRandomValues:"getRandomValues",GenerateHKDF:"generateHKDF",GenerateBaseKey:"generateBaseKey",Base64Decode:"base64Decode",UrlEncodeArr:"urlEncodeArr",Encrypt:"encrypt",Decrypt:"decrypt",GenerateEarKey:"generateEarKey",DecryptEarResponse:"decryptEarResponse",LoadExternalTokens:"LoadExternalTokens",LoadAccount:"loadAccount",LoadIdToken:"loadIdToken",LoadAccessToken:"loadAccessToken",LoadRefreshToken:"loadRefreshToken"},b0={InProgress:1};class OT{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class sI{generateId(){return"callback-id"}startMeasurement(e,n){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:b0.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:n||""},measurement:new OT}}startPerformanceMeasurement(){return new OT}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}const cI={tokenRenewalOffsetSeconds:SA,preventCorsPreflight:!1},k0={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:ot.Info,correlationId:z.EMPTY_STRING},P0={claimsBasedCachingEnabled:!1},N0={async sendGetRequestAsync(){throw J(Me)},async sendPostRequestAsync(){throw J(Me)}},O0={sku:z.SKU,version:pv,cpu:z.EMPTY_STRING,os:z.EMPTY_STRING},D0={clientSecret:z.EMPTY_STRING,clientAssertion:void 0},M0={azureCloudInstance:gv.None,tenant:`${z.DEFAULT_COMMON_TENANT}`},x0={application:{appName:"",appVersion:""}};function U0({authOptions:t,systemOptions:e,loggerOptions:n,cacheOptions:r,storageInterface:i,networkInterface:o,cryptoInterface:a,clientCredentials:s,libraryInfo:c,telemetry:u,serverTelemetryManager:l,persistencePlugin:d,serializableCache:p}){const h={...k0,...n};return{authOptions:L0(t),systemOptions:{...cI,...e},loggerOptions:h,cacheOptions:{...P0,...r},storageInterface:i||new R0(t.clientId,Fd,new ai(h),new sI),networkInterface:o||N0,cryptoInterface:a||Fd,clientCredentials:s||D0,libraryInfo:{...O0,...c},telemetry:{...x0,...u},serverTelemetryManager:l||null,persistencePlugin:d||null,serializableCache:p||null}}function L0(t){return{clientCapabilities:[],azureCloudOptions:M0,skipAuthorityMetadataCache:!1,instanceAware:!1,encodeExtraQueryParams:!1,...t}}function uI(t){return t.authOptions.authority.options.protocolMode===mn.OIDC}const nr={HOME_ACCOUNT_ID:"home_account_id",UPN:"UPN"};const Qo="client_id",lI="redirect_uri",F0="response_type",H0="response_mode",B0="grant_type",K0="claims",G0="scope",q0="refresh_token",$0="state",Y0="nonce",z0="prompt",j0="code",V0="code_challenge",Q0="code_challenge_method",W0="code_verifier",J0="client-request-id",X0="x-client-SKU",Z0="x-client-VER",eM="x-client-OS",tM="x-client-CPU",nM="x-client-current-telemetry",rM="x-client-last-telemetry",iM="x-ms-lib-capability",oM="x-app-name",aM="x-app-ver",sM="post_logout_redirect_uri",cM="id_token_hint",uM="client_secret",lM="client_assertion",dM="client_assertion_type",dI="token_type",hI="req_cnf",DT="return_spa_code",hM="nativebroker",fM="logout_hint",pM="sid",gM="login_hint",mM="domain_hint",vM="x-client-xtra-sku",qd="brk_client_id",$d="brk_redirect_uri",Vg="instance_aware",yM="ear_jwk",CM="ear_jwe_crypto";function wh(t,e,n){if(!e)return;const r=t.get(Qo);r&&t.has(qd)&&n?.addFields({embeddedClientId:r,embeddedRedirectUri:t.get(lI)},e)}function Av(t,e){t.set(F0,e)}function TM(t,e){t.set(H0,e||t0.QUERY)}function EM(t){t.set(hM,"1")}function Iv(t,e,n=!0,r=Rs){n&&!r.includes("openid")&&!e.includes("openid")&&r.push("openid");const i=n?[...e||[],...r]:e||[],o=new kt(i);t.set(G0,o.printScopes())}function wv(t,e){t.set(Qo,e)}function Rv(t,e){t.set(lI,e)}function _M(t,e){t.set(sM,e)}function SM(t,e){t.set(cM,e)}function AM(t,e){t.set(mM,e)}function al(t,e){t.set(gM,e)}function Yd(t,e){t.set(en.CCS_HEADER,`UPN:${e}`)}function Dc(t,e){t.set(en.CCS_HEADER,`Oid:${e.uid}@${e.utid}`)}function MT(t,e){t.set(pM,e)}function bv(t,e,n){const r=PM(e,n);try{JSON.parse(r)}catch{throw We(mv)}t.set(K0,r)}function kv(t,e){t.set(J0,e)}function Pv(t,e){t.set(X0,e.sku),t.set(Z0,e.version),e.os&&t.set(eM,e.os),e.cpu&&t.set(tM,e.cpu)}function Nv(t,e){e?.appName&&t.set(oM,e.appName),e?.appVersion&&t.set(aM,e.appVersion)}function IM(t,e){t.set(z0,e)}function fI(t,e){e&&t.set($0,e)}function wM(t,e){t.set(Y0,e)}function Ov(t,e,n){if(e&&n)t.set(V0,e),t.set(Q0,n);else throw We(vv)}function RM(t,e){t.set(j0,e)}function bM(t,e){t.set(q0,e)}function kM(t,e){t.set(W0,e)}function pI(t,e){t.set(uM,e)}function gI(t,e){e&&t.set(lM,e)}function mI(t,e){e&&t.set(dM,e)}function vI(t,e){t.set(B0,e)}function Dv(t){t.set(n0,"1")}function yI(t){t.has(Vg)||t.set(Vg,"true")}function qi(t,e){Object.entries(e).forEach(([n,r])=>{!t.has(n)&&r&&t.set(n,r)})}function PM(t,e){let n;if(!t)n={};else try{n=JSON.parse(t)}catch{throw We(mv)}return e&&e.length>0&&(n.hasOwnProperty(il.ACCESS_TOKEN)||(n[il.ACCESS_TOKEN]={}),n[il.ACCESS_TOKEN][il.XMS_CC]={values:e}),JSON.stringify(n)}function Mv(t,e){e&&(t.set(dI,je.POP),t.set(hI,e))}function CI(t,e){e&&(t.set(dI,je.SSH),t.set(hI,e))}function TI(t,e){t.set(nM,e.generateCurrentRequestHeaderValue()),t.set(rM,e.generateLastRequestHeaderValue())}function EI(t){t.set(iM,Oc.X_MS_LIB_CAPABILITY_VALUE)}function NM(t,e){t.set(fM,e)}function Rh(t,e,n){t.has(qd)||t.set(qd,e),t.has($d)||t.set($d,n)}function OM(t,e){t.set(yM,encodeURIComponent(e)),t.set(CM,"eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0")}function DM(t,e){Object.entries(e).forEach(([n,r])=>{r&&t.set(n,r)})}function MM(t){return t.hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("jwks_uri")}function xM(t){return t.hasOwnProperty("tenant_discovery_endpoint")&&t.hasOwnProperty("metadata")}function UM(t){return t.hasOwnProperty("error")&&t.hasOwnProperty("error_description")}const Nn=(t,e,n,r,i)=>(...o)=>{n.trace(`Executing function ${e}`);const a=r?.startMeasurement(e,i);if(i){const s=e+"CallCount";r?.incrementFields({[s]:1},i)}try{const s=t(...o);return a?.end({success:!0}),n.trace(`Returning result from ${e}`),s}catch(s){n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(s))}catch{n.trace("Unable to print error message.")}throw a?.end({success:!1},s),s}},G=(t,e,n,r,i)=>(...o)=>{n.trace(`Executing function ${e}`);const a=r?.startMeasurement(e,i);if(i){const s=e+"CallCount";r?.incrementFields({[s]:1},i)}return r?.setPreQueueTime(e,i),t(...o).then(s=>(n.trace(`Returning result from ${e}`),a?.end({success:!0}),s)).catch(s=>{n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(s))}catch{n.trace("Unable to print error message.")}throw a?.end({success:!1},s),s})};class bh{constructor(e,n,r,i){this.networkInterface=e,this.logger=n,this.performanceClient=r,this.correlationId=i}async detectRegion(e,n){this.performanceClient?.addQueueMeasurement(S.RegionDiscoveryDetectRegion,this.correlationId);let r=e;if(r)n.region_source=Na.ENVIRONMENT_VARIABLE;else{const i=bh.IMDS_OPTIONS;try{const o=await G(this.getRegionFromIMDS.bind(this),S.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(z.IMDS_VERSION,i);if(o.status===Di.SUCCESS&&(r=o.body,n.region_source=Na.IMDS),o.status===Di.BAD_REQUEST){const a=await G(this.getCurrentVersion.bind(this),S.RegionDiscoveryGetCurrentVersion,this.logger,this.performanceClient,this.correlationId)(i);if(!a)return n.region_source=Na.FAILED_AUTO_DETECTION,null;const s=await G(this.getRegionFromIMDS.bind(this),S.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(a,i);s.status===Di.SUCCESS&&(r=s.body,n.region_source=Na.IMDS)}}catch{return n.region_source=Na.FAILED_AUTO_DETECTION,null}}return r||(n.region_source=Na.FAILED_AUTO_DETECTION),r||null}async getRegionFromIMDS(e,n){return this.performanceClient?.addQueueMeasurement(S.RegionDiscoveryGetRegionFromIMDS,this.correlationId),this.networkInterface.sendGetRequestAsync(`${z.IMDS_ENDPOINT}?api-version=${e}&format=text`,n,z.IMDS_TIMEOUT)}async getCurrentVersion(e){this.performanceClient?.addQueueMeasurement(S.RegionDiscoveryGetCurrentVersion,this.correlationId);try{const n=await this.networkInterface.sendGetRequestAsync(`${z.IMDS_ENDPOINT}?format=json`,e);return n.status===Di.BAD_REQUEST&&n.body&&n.body["newest-versions"]&&n.body["newest-versions"].length>0?n.body["newest-versions"][0]:null}catch{return null}}}bh.IMDS_OPTIONS={headers:{Metadata:"true"}};function Tn(){return Math.round(new Date().getTime()/1e3)}function xT(t){return t.getTime()/1e3}function ls(t){return t?new Date(Number(t)*1e3):new Date}function zd(t,e){const n=Number(t)||0;return Tn()+e>n}function UT(t,e){const n=Number(t)+e*24*60*60*1e3;return Date.now()>n}function LM(t){return Number(t)>Tn()}function kh(t,e,n,r,i){return{credentialType:Ut.ID_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,realm:i,lastUpdatedAt:Date.now().toString()}}function Ph(t,e,n,r,i,o,a,s,c,u,l,d,p,h,f){const g={homeAccountId:t,credentialType:Ut.ACCESS_TOKEN,secret:n,cachedAt:Tn().toString(),expiresOn:a.toString(),extendedExpiresOn:s.toString(),environment:e,clientId:r,realm:i,target:o,tokenType:l||je.BEARER,lastUpdatedAt:Date.now().toString()};if(d&&(g.userAssertionHash=d),u&&(g.refreshOn=u.toString()),h&&(g.requestedClaims=h,g.requestedClaimsHash=f),g.tokenType?.toLowerCase()!==je.BEARER.toLowerCase())switch(g.credentialType=Ut.ACCESS_TOKEN_WITH_AUTH_SCHEME,g.tokenType){case je.POP:const m=Ar(n,c);if(!m?.cnf?.kid)throw J(LA);g.keyId=m.cnf.kid;break;case je.SSH:g.keyId=p}return g}function _I(t,e,n,r,i,o,a){const s={credentialType:Ut.REFRESH_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,lastUpdatedAt:Date.now().toString()};return o&&(s.userAssertionHash=o),i&&(s.familyId=i),a&&(s.expiresOn=a.toString()),s}function Nh(t){return t.hasOwnProperty("homeAccountId")&&t.hasOwnProperty("environment")&&t.hasOwnProperty("credentialType")&&t.hasOwnProperty("clientId")&&t.hasOwnProperty("secret")}function LT(t){return t?Nh(t)&&t.hasOwnProperty("realm")&&t.hasOwnProperty("target")&&(t.credentialType===Ut.ACCESS_TOKEN||t.credentialType===Ut.ACCESS_TOKEN_WITH_AUTH_SCHEME):!1}function FM(t){return t?Nh(t)&&t.hasOwnProperty("realm")&&t.credentialType===Ut.ID_TOKEN:!1}function FT(t){return t?Nh(t)&&t.credentialType===Ut.REFRESH_TOKEN:!1}function HM(t,e){const n=t.indexOf(xt.CACHE_KEY)===0;let r=!0;return e&&(r=e.hasOwnProperty("failedRequests")&&e.hasOwnProperty("errors")&&e.hasOwnProperty("cacheHits")),n&&r}function BM(t,e){let n=!1;t&&(n=t.indexOf(Oc.THROTTLING_PREFIX)===0);let r=!0;return e&&(r=e.hasOwnProperty("throttleTime")),n&&r}function KM({environment:t,clientId:e}){return[av,t,e].join(tu.CACHE_KEY_SEPARATOR).toLowerCase()}function GM(t,e){return e?t.indexOf(av)===0&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("environment"):!1}function qM(t,e){return e?t.indexOf(Ud.CACHE_KEY)===0&&e.hasOwnProperty("aliases")&&e.hasOwnProperty("preferred_cache")&&e.hasOwnProperty("preferred_network")&&e.hasOwnProperty("canonical_authority")&&e.hasOwnProperty("authorization_endpoint")&&e.hasOwnProperty("token_endpoint")&&e.hasOwnProperty("issuer")&&e.hasOwnProperty("aliasesFromNetwork")&&e.hasOwnProperty("endpointsFromNetwork")&&e.hasOwnProperty("expiresAt")&&e.hasOwnProperty("jwks_uri"):!1}function HT(){return Tn()+Ud.REFRESH_TIME_SECONDS}function sl(t,e,n){t.authorization_endpoint=e.authorization_endpoint,t.token_endpoint=e.token_endpoint,t.end_session_endpoint=e.end_session_endpoint,t.issuer=e.issuer,t.endpointsFromNetwork=n,t.jwks_uri=e.jwks_uri}function kp(t,e,n){t.aliases=e.aliases,t.preferred_cache=e.preferred_cache,t.preferred_network=e.preferred_network,t.aliasesFromNetwork=n}function BT(t){return t.expiresAt<=Tn()}class jt{constructor(e,n,r,i,o,a,s,c){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=n,this.cacheManager=r,this.authorityOptions=i,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=o,this.performanceClient=s,this.correlationId=a,this.managedIdentity=c||!1,this.regionDiscovery=new bh(n,this.logger,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(z.CIAM_AUTH_URL))return Xn.Ciam;const n=e.PathSegments;if(n.length)switch(n[0].toLowerCase()){case z.ADFS:return Xn.Adfs;case z.DSTS:return Xn.Dsts}return Xn.Default}get authorityType(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)}get protocolMode(){return this.authorityOptions.protocolMode}get options(){return this.authorityOptions}get canonicalAuthority(){return this._canonicalAuthority.urlString}set canonicalAuthority(e){this._canonicalAuthority=new Ye(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null}get canonicalAuthorityUrlComponents(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents}get hostnameAndPort(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()}get tenant(){return this.canonicalAuthorityUrlComponents.PathSegments[0]}get authorizationEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw J(Gr)}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw J(Gr)}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw J(Gr)}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw J(BA);return this.replacePath(this.metadata.end_session_endpoint)}else throw J(Gr)}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw J(Gr)}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw J(Gr)}canReplaceTenant(e){return e.PathSegments.length===1&&!jt.reservedTenantDomains.has(e.PathSegments[0])&&this.getAuthorityType(e)===Xn.Default&&this.protocolMode!==mn.OIDC}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let n=e;const i=new Ye(this.metadata.canonical_authority).getUrlComponents(),o=i.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach((s,c)=>{let u=o[c];if(c===0&&this.canReplaceTenant(i)){const l=new Ye(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];u!==l&&(this.logger.verbose(`Replacing tenant domain name ${u} with id ${l}`),u=l)}s!==u&&(n=n.replace(`/${u}/`,`/${s}/`))}),this.replaceTenant(n)}get defaultOpenIdConfigurationEndpoint(){const e=this.hostnameAndPort;return this.canonicalAuthority.endsWith("v2.0/")||this.authorityType===Xn.Adfs||this.protocolMode===mn.OIDC&&!this.isAliasOfKnownMicrosoftAuthority(e)?`${this.canonicalAuthority}.well-known/openid-configuration`:`${this.canonicalAuthority}v2.0/.well-known/openid-configuration`}discoveryComplete(){return!!this.metadata}async resolveEndpointsAsync(){this.performanceClient?.addQueueMeasurement(S.AuthorityResolveEndpointsAsync,this.correlationId);const e=this.getCurrentMetadataEntity(),n=await G(this.updateCloudDiscoveryMetadata.bind(this),S.AuthorityUpdateCloudDiscoveryMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,e.preferred_network);const r=await G(this.updateEndpointMetadata.bind(this),S.AuthorityUpdateEndpointMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.updateCachedMetadata(e,n,{source:r}),this.performanceClient?.addFields({cloudDiscoverySource:n,authorityEndpointSource:r},this.correlationId)}getCurrentMetadataEntity(){let e=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);return e||(e={aliases:[],preferred_cache:this.hostnameAndPort,preferred_network:this.hostnameAndPort,canonical_authority:this.canonicalAuthority,authorization_endpoint:"",token_endpoint:"",end_session_endpoint:"",issuer:"",aliasesFromNetwork:!1,endpointsFromNetwork:!1,expiresAt:HT(),jwks_uri:""}),e}updateCachedMetadata(e,n,r){n!==In.CACHE&&r?.source!==In.CACHE&&(e.expiresAt=HT(),e.canonical_authority=this.canonicalAuthority);const i=this.cacheManager.generateAuthorityMetadataCacheKey(e.preferred_cache);this.cacheManager.setAuthorityMetadata(i,e),this.metadata=e}async updateEndpointMetadata(e){this.performanceClient?.addQueueMeasurement(S.AuthorityUpdateEndpointMetadata,this.correlationId);const n=this.updateEndpointMetadataFromLocalSources(e);if(n){if(n.source===In.HARDCODED_VALUES&&this.authorityOptions.azureRegionConfiguration?.azureRegion&&n.metadata){const i=await G(this.updateMetadataWithRegionalInformation.bind(this),S.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(n.metadata);sl(e,i,!1),e.canonical_authority=this.canonicalAuthority}return n.source}let r=await G(this.getEndpointMetadataFromNetwork.bind(this),S.AuthorityGetEndpointMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return this.authorityOptions.azureRegionConfiguration?.azureRegion&&(r=await G(this.updateMetadataWithRegionalInformation.bind(this),S.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(r)),sl(e,r,!0),In.NETWORK;throw J(RA,this.defaultOpenIdConfigurationEndpoint)}updateEndpointMetadataFromLocalSources(e){this.logger.verbose("Attempting to get endpoint metadata from authority configuration");const n=this.getEndpointMetadataFromConfig();if(n)return this.logger.verbose("Found endpoint metadata in authority configuration"),sl(e,n,!1),{source:In.CONFIG};if(this.logger.verbose("Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values."),this.authorityOptions.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get endpoint metadata from the network metadata cache.");else{const i=this.getEndpointMetadataFromHardcodedValues();if(i)return sl(e,i,!1),{source:In.HARDCODED_VALUES,metadata:i};this.logger.verbose("Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.")}const r=BT(e);return this.isAuthoritySameType(e)&&e.endpointsFromNetwork&&!r?(this.logger.verbose("Found endpoint metadata in the cache."),{source:In.CACHE}):(r&&this.logger.verbose("The metadata entity is expired."),null)}isAuthoritySameType(e){return new Ye(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch{throw We(VA)}return null}async getEndpointMetadataFromNetwork(){this.performanceClient?.addQueueMeasurement(S.AuthorityGetEndpointMetadataFromNetwork,this.correlationId);const e={},n=this.defaultOpenIdConfigurationEndpoint;this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from ${n}`);try{const r=await this.networkInterface.sendGetRequestAsync(n,e);return MM(r.body)?r.body:(this.logger.verbose("Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration"),null)}catch(r){return this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: ${r}`),null}}getEndpointMetadataFromHardcodedValues(){return this.hostnameAndPort in PT?PT[this.hostnameAndPort]:null}async updateMetadataWithRegionalInformation(e){this.performanceClient?.addQueueMeasurement(S.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId);const n=this.authorityOptions.azureRegionConfiguration?.azureRegion;if(n){if(n!==z.AZURE_REGION_AUTO_DISCOVER_FLAG)return this.regionDiscoveryMetadata.region_outcome=Rp.CONFIGURED_NO_AUTO_DETECTION,this.regionDiscoveryMetadata.region_used=n,jt.replaceWithRegionalInformation(e,n);const r=await G(this.regionDiscovery.detectRegion.bind(this.regionDiscovery),S.RegionDiscoveryDetectRegion,this.logger,this.performanceClient,this.correlationId)(this.authorityOptions.azureRegionConfiguration?.environmentRegion,this.regionDiscoveryMetadata);if(r)return this.regionDiscoveryMetadata.region_outcome=Rp.AUTO_DETECTION_REQUESTED_SUCCESSFUL,this.regionDiscoveryMetadata.region_used=r,jt.replaceWithRegionalInformation(e,r);this.regionDiscoveryMetadata.region_outcome=Rp.AUTO_DETECTION_REQUESTED_FAILED}return e}async updateCloudDiscoveryMetadata(e){this.performanceClient?.addQueueMeasurement(S.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId);const n=this.updateCloudDiscoveryMetadataFromLocalSources(e);if(n)return n;const r=await G(this.getCloudDiscoveryMetadataFromNetwork.bind(this),S.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return kp(e,r,!0),In.NETWORK;throw We(QA)}updateCloudDiscoveryMetadataFromLocalSources(e){this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration"),this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities||z.NOT_APPLICABLE}`),this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata||z.NOT_APPLICABLE}`),this.logger.verbosePii(`Canonical Authority: ${e.canonical_authority||z.NOT_APPLICABLE}`);const n=this.getCloudDiscoveryMetadataFromConfig();if(n)return this.logger.verbose("Found cloud discovery metadata in authority configuration"),kp(e,n,!1),In.CONFIG;if(this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values."),this.options.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded cloud discovery metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get cloud discovery metadata from the network metadata cache.");else{const i=w0(this.hostnameAndPort);if(i)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),kp(e,i,!1),In.HARDCODED_VALUES;this.logger.verbose("Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache.")}const r=BT(e);return this.isAuthoritySameType(e)&&e.aliasesFromNetwork&&!r?(this.logger.verbose("Found cloud discovery metadata in the cache."),In.CACHE):(r&&this.logger.verbose("The metadata entity is expired."),null)}getCloudDiscoveryMetadataFromConfig(){if(this.authorityType===Xn.Ciam)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),jt.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");const e=JSON.parse(this.authorityOptions.cloudDiscoveryMetadata),n=Kd(e.metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),n)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),n;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch{throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),We(yv)}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),jt.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){this.performanceClient?.addQueueMeasurement(S.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId);const e=`${z.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`,n={};let r=null;try{const i=await this.networkInterface.sendGetRequestAsync(e,n);let o,a;if(xM(i.body))o=i.body,a=o.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: ${o.tenant_discovery_endpoint}`);else if(UM(i.body)){if(this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${i.status}`),o=i.body,o.error===z.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),null;this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${o.error}`),this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${o.error_description}`),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),a=[]}else return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),null;this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),r=Kd(a,this.hostnameAndPort)}catch(i){if(i instanceof Xe)this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Error Description: ${o.message}`)}return null}return r||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),r=jt.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),r}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(n=>n&&Ye.getDomainFromUrl(n).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,n){let r;if(n&&n.azureCloudInstance!==gv.None){const i=n.tenant?n.tenant:z.DEFAULT_COMMON_TENANT;r=`${n.azureCloudInstance}/${i}/`}return r||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return z.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw J(Gr)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return aI.has(e)}static isPublicCloudAuthority(e){return z.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,n,r){const i=new Ye(e);i.validateAsUri();const o=i.getUrlComponents();let a=`${n}.${o.HostNameAndPort}`;this.isPublicCloudAuthority(o.HostNameAndPort)&&(a=`${n}.${z.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const s=Ye.constructAuthorityUriFromObject({...i.getUrlComponents(),HostNameAndPort:a}).urlString;return r?`${s}?${r}`:s}static replaceWithRegionalInformation(e,n){const r={...e};return r.authorization_endpoint=jt.buildRegionalAuthorityString(r.authorization_endpoint,n),r.token_endpoint=jt.buildRegionalAuthorityString(r.token_endpoint,n),r.end_session_endpoint&&(r.end_session_endpoint=jt.buildRegionalAuthorityString(r.end_session_endpoint,n)),r}static transformCIAMAuthority(e){let n=e;const i=new Ye(e).getUrlComponents();if(i.PathSegments.length===0&&i.HostNameAndPort.endsWith(z.CIAM_AUTH_URL)){const o=i.HostNameAndPort.split(".")[0];n=`${n}${o}${z.AAD_TENANT_DOMAIN_SUFFIX}`}return n}}jt.reservedTenantDomains=new Set(["{tenant}","{tenantid}",Ki.COMMON,Ki.CONSUMERS,Ki.ORGANIZATIONS]);function $M(t){const r=new Ye(t).getUrlComponents().PathSegments.slice(-1)[0]?.toLowerCase();switch(r){case Ki.COMMON:case Ki.ORGANIZATIONS:case Ki.CONSUMERS:return;default:return r}}function SI(t){return t.endsWith(z.FORWARD_SLASH)?t:`${t}${z.FORWARD_SLASH}`}function YM(t){const e=t.cloudDiscoveryMetadata;let n;if(e)try{n=JSON.parse(e)}catch{throw We(yv)}return{canonicalAuthority:t.authority?SI(t.authority):void 0,knownAuthorities:t.knownAuthorities,cloudDiscoveryMetadata:n}}async function AI(t,e,n,r,i,o,a){a?.addQueueMeasurement(S.AuthorityFactoryCreateDiscoveredInstance,o);const s=jt.transformCIAMAuthority(SI(t)),c=new jt(s,e,n,r,i,o,a);try{return await G(c.resolveEndpointsAsync.bind(c),S.AuthorityResolveEndpointsAsync,i,a,o)(),c}catch{throw J(Gr)}}class ga extends Xe{constructor(e,n,r,i,o){super(e,n,r),this.name="ServerError",this.errorNo=i,this.status=o,Object.setPrototypeOf(this,ga.prototype)}}function Oh(t,e,n){return{clientId:t,authority:e.authority,scopes:e.scopes,homeAccountIdentifier:n,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,embeddedClientId:e.embeddedClientId||e.tokenBodyParameters?.clientId}}class Cr{static generateThrottlingStorageKey(e){return`${Oc.THROTTLING_PREFIX}.${JSON.stringify(e)}`}static preProcess(e,n,r){const i=Cr.generateThrottlingStorageKey(n),o=e.getThrottlingCache(i);if(o){if(o.throttleTime<Date.now()){e.removeItem(i,r);return}throw new ga(o.errorCodes?.join(" ")||z.EMPTY_STRING,o.errorMessage,o.subError)}}static postProcess(e,n,r,i){if(Cr.checkResponseStatus(r)||Cr.checkResponseForRetryAfter(r)){const o={throttleTime:Cr.calculateThrottleTime(parseInt(r.headers[en.RETRY_AFTER])),error:r.body.error,errorCodes:r.body.error_codes,errorMessage:r.body.error_description,subError:r.body.suberror};e.setThrottlingCache(Cr.generateThrottlingStorageKey(n),o,i)}}static checkResponseStatus(e){return e.status===429||e.status>=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(en.RETRY_AFTER)&&(e.status<200||e.status>=300):!1}static calculateThrottleTime(e){const n=e<=0?0:e,r=Date.now()/1e3;return Math.floor(Math.min(r+(n||Oc.DEFAULT_THROTTLE_TIME_SECONDS),r+Oc.DEFAULT_MAX_THROTTLE_TIME_SECONDS)*1e3)}static removeThrottle(e,n,r,i){const o=Oh(n,r,i),a=this.generateThrottlingStorageKey(o);e.removeItem(a,r.correlationId)}}class Dh extends Xe{constructor(e,n,r){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,Dh.prototype),this.name="NetworkError",this.error=e,this.httpStatus=n,this.responseHeaders=r}}function Sc(t,e,n,r){return t.errorMessage=`${t.errorMessage}, additionalErrorInfo: error.name:${r?.name}, error.message:${r?.message}`,new Dh(t,e,n)}class xv{constructor(e,n){this.config=U0(e),this.logger=new ai(this.config.loggerOptions,KA,pv),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=n}createTokenRequestHeaders(e){const n={};if(n[en.CONTENT_TYPE]=z.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case nr.HOME_ACCOUNT_ID:try{const r=cs(e.credential);n[en.CCS_HEADER]=`Oid:${r.uid}@${r.utid}`}catch(r){this.logger.verbose("Could not parse home account ID for CCS Header: "+r)}break;case nr.UPN:n[en.CCS_HEADER]=`UPN: ${e.credential}`;break}return n}async executePostToTokenEndpoint(e,n,r,i,o,a){a&&this.performanceClient?.addQueueMeasurement(a,o);const s=await this.sendPostRequest(i,e,{body:n,headers:r},o);return this.config.serverTelemetryManager&&s.status<500&&s.status!==429&&this.config.serverTelemetryManager.clearTelemetryCache(),s}async sendPostRequest(e,n,r,i){Cr.preProcess(this.cacheManager,e,i);let o;try{o=await G(this.networkClient.sendPostRequestAsync.bind(this.networkClient),S.NetworkClientSendPostRequestAsync,this.logger,this.performanceClient,i)(n,r);const a=o.headers||{};this.performanceClient?.addFields({refreshTokenSize:o.body.refresh_token?.length||0,httpVerToken:a[en.X_MS_HTTP_VERSION]||"",requestId:a[en.X_MS_REQUEST_ID]||""},i)}catch(a){if(a instanceof Dh){const s=a.responseHeaders;throw s&&this.performanceClient?.addFields({httpVerToken:s[en.X_MS_HTTP_VERSION]||"",requestId:s[en.X_MS_REQUEST_ID]||"",contentTypeHeader:s[en.CONTENT_TYPE]||void 0,contentLengthHeader:s[en.CONTENT_LENGTH]||void 0,httpStatus:a.httpStatus},i),a.error}throw a instanceof Xe?a:J(wA)}return Cr.postProcess(this.cacheManager,e,o,i),o}async updateAuthority(e,n){this.performanceClient?.addQueueMeasurement(S.UpdateTokenEndpointAuthority,n);const r=`https://${e}/${this.authority.tenant}/`,i=await AI(r,this.networkClient,this.cacheManager,this.authority.options,this.logger,n,this.performanceClient);this.authority=i}createTokenQueryParameters(e){const n=new Map;return e.embeddedClientId&&Rh(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenQueryParameters&&qi(n,e.tokenQueryParameters),kv(n,e.correlationId),wh(n,e.correlationId,this.performanceClient),nu(n)}}const jd="no_tokens_found",II="native_account_unavailable",Uv="refresh_token_expired",Lv="ux_not_allowed",zM="interaction_required",jM="consent_required",VM="login_required",Mh="bad_token";const KT=[zM,jM,VM,Mh,Lv],QM=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],WM={[jd]:"No refresh token found in the cache. Please sign-in.",[II]:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",[Uv]:"Refresh token has expired.",[Mh]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve.",[Lv]:"`canShowUI` flag in Edge was set to false. User interaction required on web page. Please invoke an interactive API to resolve."};class sr extends Xe{constructor(e,n,r,i,o,a,s,c){super(e,n,r),Object.setPrototypeOf(this,sr.prototype),this.timestamp=i||z.EMPTY_STRING,this.traceId=o||z.EMPTY_STRING,this.correlationId=a||z.EMPTY_STRING,this.claims=s||z.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=c}}function wI(t,e,n){const r=!!t&&KT.indexOf(t)>-1,i=!!n&&QM.indexOf(n)>-1,o=!!e&&KT.some(a=>e.indexOf(a)>-1);return r||o||i}function Vd(t){return new sr(t,WM[t])}class bs{static setRequestState(e,n,r){const i=bs.generateLibraryState(e,r);return n?`${i}${z.RESOURCE_DELIM}${n}`:i}static generateLibraryState(e,n){if(!e)throw J(Yg);const r={id:e.createNewGuid()};n&&(r.meta=n);const i=JSON.stringify(r);return e.base64Encode(i)}static parseRequestState(e,n){if(!e)throw J(Yg);if(!n)throw J(Es);try{const r=n.split(z.RESOURCE_DELIM),i=r[0],o=r.length>1?r.slice(1).join(z.RESOURCE_DELIM):z.EMPTY_STRING,a=e.base64Decode(i),s=JSON.parse(a);return{userRequestState:o||z.EMPTY_STRING,libraryState:s}}catch{throw J(Es)}}}const JM={SW:"sw"};class _s{constructor(e,n){this.cryptoUtils=e,this.performanceClient=n}async generateCnf(e,n){this.performanceClient?.addQueueMeasurement(S.PopTokenGenerateCnf,e.correlationId);const r=await G(this.generateKid.bind(this),S.PopTokenGenerateCnf,n,this.performanceClient,e.correlationId)(e),i=this.cryptoUtils.base64UrlEncode(JSON.stringify(r));return{kid:r.kid,reqCnfString:i}}async generateKid(e){return this.performanceClient?.addQueueMeasurement(S.PopTokenGenerateKid,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:JM.SW}}async signPopToken(e,n,r){return this.signPayload(e,n,r)}async signPayload(e,n,r,i){const{resourceRequestMethod:o,resourceRequestUri:a,shrClaims:s,shrNonce:c,shrOptions:u}=r,d=(a?new Ye(a):void 0)?.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:Tn(),m:o?.toUpperCase(),u:d?.HostNameAndPort,nonce:c||this.cryptoUtils.createNewGuid(),p:d?.AbsolutePath,q:d?.QueryString?[[],d.QueryString]:void 0,client_claims:s||void 0,...i},n,u,r.correlationId)}}class XM{constructor(e,n){this.cache=e,this.hasChanged=n}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}class Wo{constructor(e,n,r,i,o,a,s){this.clientId=e,this.cacheStorage=n,this.cryptoObj=r,this.logger=i,this.serializableCache=o,this.persistencePlugin=a,this.performanceClient=s}validateTokenResponse(e,n){if(e.error||e.error_description||e.suberror){const r=`Error(s): ${e.error_codes||z.NOT_AVAILABLE} - Timestamp: ${e.timestamp||z.NOT_AVAILABLE} - Description: ${e.error_description||z.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||z.NOT_AVAILABLE} - Trace ID: ${e.trace_id||z.NOT_AVAILABLE}`,i=e.error_codes?.length?e.error_codes[0]:void 0,o=new ga(e.error,r,e.suberror,i,e.status);if(n&&e.status&&e.status>=Di.SERVER_ERROR_RANGE_START&&e.status<=Di.SERVER_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed.
|
|
19
|
-
|
|
20
|
-
${o}`);return}throw wI(e.error,e.error_description,e.suberror)?new sr(e.error,e.error_description,e.suberror,e.timestamp||z.EMPTY_STRING,e.trace_id||z.EMPTY_STRING,e.correlation_id||z.EMPTY_STRING,e.claims||z.EMPTY_STRING,i):o}}async handleServerTokenResponse(e,n,r,i,o,a,s,c,u,l){this.performanceClient?.addQueueMeasurement(S.HandleServerTokenResponse,e.correlation_id);let d;if(e.id_token){if(d=Ar(e.id_token||z.EMPTY_STRING,this.cryptoObj.base64Decode),a&&a.nonce&&d.nonce!==a.nonce)throw J(PA);if(i.maxAge||i.maxAge===0){const g=d.auth_time;if(!g)throw J(uv);rI(g,i.maxAge)}}this.homeAccountIdentifier=lt.generateHomeAccountId(e.client_info||z.EMPTY_STRING,n.authorityType,this.logger,this.cryptoObj,d);let p;a&&a.state&&(p=bs.parseRequestState(this.cryptoObj,a.state)),e.key_id=e.key_id||i.sshKid||void 0;const h=this.generateCacheRecord(e,n,r,i,d,s,a);let f;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),f=new XM(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(f)),c&&!u&&h.account){const g=this.cacheStorage.generateAccountKey(lt.getAccountInfo(h.account));if(!this.cacheStorage.getAccount(g,i.correlationId))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await Wo.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,p,void 0,l)}await this.cacheStorage.saveCacheRecord(h,i.correlationId,kr(d||{}),o,i.storeInCache)}finally{this.persistencePlugin&&this.serializableCache&&f&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(f))}return Wo.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,p,e,l)}generateCacheRecord(e,n,r,i,o,a,s){const c=n.getPreferredCache();if(!c)throw J(dv);const u=Ev(o);let l,d;e.id_token&&o&&(l=kh(this.homeAccountIdentifier,c,e.id_token,this.clientId,u||""),d=Fv(this.cacheStorage,n,this.homeAccountIdentifier,this.cryptoObj.base64Decode,i.correlationId,o,e.client_info,c,u,s,void 0,this.logger));let p=null;if(e.access_token){const g=e.scope?kt.fromString(e.scope):new kt(i.scopes||[]),m=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,v=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,y=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,I=r+m,R=I+v,A=y&&y>0?r+y:void 0;p=Ph(this.homeAccountIdentifier,c,e.access_token,this.clientId,u||n.tenant||"",g.printScopes(),I,R,this.cryptoObj.base64Decode,A,e.token_type,a,e.key_id,i.claims,i.requestedClaimsHash)}let h=null;if(e.refresh_token){let g;if(e.refresh_token_expires_in){const m=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;g=r+m,this.performanceClient?.addFields({ntwkRtExpiresOnSeconds:g},i.correlationId)}h=_I(this.homeAccountIdentifier,c,e.refresh_token,this.clientId,e.foci,a,g)}let f=null;return e.foci&&(f={clientId:this.clientId,environment:c,familyId:e.foci}),{account:d,idToken:l,accessToken:p,refreshToken:h,appMetadata:f}}static async generateAuthenticationResult(e,n,r,i,o,a,s,c,u){let l=z.EMPTY_STRING,d=[],p=null,h,f,g=z.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===je.POP&&!o.popKid){const I=new _s(e),{secret:R,keyId:A}=r.accessToken;if(!A)throw J(hv);l=await I.signPopToken(R,A,o)}else l=r.accessToken.secret;d=kt.fromString(r.accessToken.target).asArray(),p=ls(r.accessToken.expiresOn),h=ls(r.accessToken.extendedExpiresOn),r.accessToken.refreshOn&&(f=ls(r.accessToken.refreshOn))}r.appMetadata&&(g=r.appMetadata.familyId===xd?xd:"");const m=a?.oid||a?.sub||"",v=a?.tid||"";c?.spa_accountid&&r.account&&(r.account.nativeAccountId=c?.spa_accountid);const y=r.account?Tv(lt.getAccountInfo(r.account),void 0,a,r.idToken?.secret):null;return{authority:n.canonicalAuthority,uniqueId:m,tenantId:v,scopes:d,account:y,idToken:r?.idToken?.secret||"",idTokenClaims:a||{},accessToken:l,fromCache:i,expiresOn:p,extExpiresOn:h,refreshOn:f,correlationId:o.correlationId,requestId:u||z.EMPTY_STRING,familyId:g,tokenType:r.accessToken?.tokenType||z.EMPTY_STRING,state:s?s.userRequestState:z.EMPTY_STRING,cloudGraphHostName:r.account?.cloudGraphHostName||z.EMPTY_STRING,msGraphHost:r.account?.msGraphHost||z.EMPTY_STRING,code:c?.spa_code,fromNativeBroker:!1}}}function Fv(t,e,n,r,i,o,a,s,c,u,l,d){d?.verbose("setCachedAccount called");const h=t.getAccountKeys().find(y=>y.startsWith(n));let f=null;h&&(f=t.getAccount(h,i));const g=f||lt.createAccount({homeAccountId:n,idTokenClaims:o,clientInfo:a,environment:s,cloudGraphHostName:u?.cloud_graph_host_name,msGraphHost:u?.msgraph_host,nativeAccountId:l},e,r),m=g.tenantProfiles||[],v=c||g.realm;if(v&&!m.find(y=>y.tenantId===v)){const y=Ih(n,g.localAccountId,v,o);m.push(y)}return g.tenantProfiles=m,g}async function RI(t,e,n){return typeof t=="string"?t:t({clientId:e,tokenEndpoint:n})}class bI extends xv{constructor(e,n){super(e,n),this.includeRedirectUri=!0,this.oidcDefaultScopes=this.config.authOptions.authority.options.OIDCOptions?.defaultScopes}async acquireToken(e,n,r){if(this.performanceClient?.addQueueMeasurement(S.AuthClientAcquireToken,e.correlationId),!e.code)throw J(DA);const i=Tn(),o=await G(this.executeTokenRequest.bind(this),S.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),a=o.headers?.[en.X_MS_REQUEST_ID],s=new Wo(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return s.validateTokenResponse(o.body),G(s.handleServerTokenResponse.bind(s),S.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(o.body,this.authority,i,e,n,r,void 0,void 0,void 0,a)}getLogoutUri(e){if(!e)throw We(jA);const n=this.createLogoutUrlQueryString(e);return Ye.appendQueryString(this.authority.endSessionEndpoint,n)}async executeTokenRequest(e,n){this.performanceClient?.addQueueMeasurement(S.AuthClientExecuteTokenRequest,n.correlationId);const r=this.createTokenQueryParameters(n),i=Ye.appendQueryString(e.tokenEndpoint,r),o=await G(this.createTokenRequestBody.bind(this),S.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,n.correlationId)(n);let a;if(n.clientInfo)try{const u=Hd(n.clientInfo,this.cryptoUtils.base64Decode);a={credential:`${u.uid}${tu.CLIENT_INFO_SEPARATOR}${u.utid}`,type:nr.HOME_ACCOUNT_ID}}catch(u){this.logger.verbose("Could not parse client info for CCS Header: "+u)}const s=this.createTokenRequestHeaders(a||n.ccsCredential),c=Oh(this.config.authOptions.clientId,n);return G(this.executePostToTokenEndpoint.bind(this),S.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,n.correlationId)(i,o,s,c,n.correlationId,S.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){this.performanceClient?.addQueueMeasurement(S.AuthClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(wv(n,e.embeddedClientId||e.tokenBodyParameters?.[Qo]||this.config.authOptions.clientId),this.includeRedirectUri)Rv(n,e.redirectUri);else if(!e.redirectUri)throw We(GA);if(Iv(n,e.scopes,!0,this.oidcDefaultScopes),RM(n,e.code),Pv(n,this.config.libraryInfo),Nv(n,this.config.telemetry.application),EI(n),this.serverTelemetryManager&&!uI(this.config)&&TI(n,this.serverTelemetryManager),e.codeVerifier&&kM(n,e.codeVerifier),this.config.clientCredentials.clientSecret&&pI(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const i=this.config.clientCredentials.clientAssertion;gI(n,await RI(i.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),mI(n,i.assertionType)}if(vI(n,_A.AUTHORIZATION_CODE_GRANT),Dv(n),e.authenticationScheme===je.POP){const i=new _s(this.cryptoUtils,this.performanceClient);let o;e.popKid?o=this.cryptoUtils.encodeKid(e.popKid):o=(await G(i.generateCnf.bind(i),S.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,Mv(n,o)}else if(e.authenticationScheme===je.SSH)if(e.sshJwk)CI(n,e.sshJwk);else throw We(Ah);(!Pn.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&bv(n,e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const i=Hd(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${i.uid}${tu.CLIENT_INFO_SEPARATOR}${i.utid}`,type:nr.HOME_ACCOUNT_ID}}catch(i){this.logger.verbose("Could not parse client info for CCS Header: "+i)}else r=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&r)switch(r.type){case nr.HOME_ACCOUNT_ID:try{const i=cs(r.credential);Dc(n,i)}catch(i){this.logger.verbose("Could not parse home account ID for CCS Header: "+i)}break;case nr.UPN:Yd(n,r.credential);break}return e.embeddedClientId&&Rh(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&qi(n,e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[DT])&&qi(n,{[DT]:"1"}),wh(n,e.correlationId,this.performanceClient),nu(n)}createLogoutUrlQueryString(e){const n=new Map;return e.postLogoutRedirectUri&&_M(n,e.postLogoutRedirectUri),e.correlationId&&kv(n,e.correlationId),e.idTokenHint&&SM(n,e.idTokenHint),e.state&&fI(n,e.state),e.logoutHint&&NM(n,e.logoutHint),e.extraQueryParameters&&qi(n,e.extraQueryParameters),this.config.authOptions.instanceAware&&yI(n),nu(n,this.config.authOptions.encodeExtraQueryParams,e.extraQueryParameters)}}const ZM=300;class ex extends xv{constructor(e,n){super(e,n)}async acquireToken(e,n){this.performanceClient?.addQueueMeasurement(S.RefreshTokenClientAcquireToken,e.correlationId);const r=Tn(),i=await G(this.executeTokenRequest.bind(this),S.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),o=i.headers?.[en.X_MS_REQUEST_ID],a=new Wo(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return a.validateTokenResponse(i.body),G(a.handleServerTokenResponse.bind(a),S.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(i.body,this.authority,r,e,n,void 0,void 0,!0,e.forceCache,o)}async acquireTokenByRefreshToken(e,n){if(!e)throw We(zA);if(this.performanceClient?.addQueueMeasurement(S.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw J(lv);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await G(this.acquireTokenWithCachedRefreshToken.bind(this),S.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0,n)}catch(i){const o=i instanceof sr&&i.errorCode===jd,a=i instanceof ga&&i.errorCode===AT.INVALID_GRANT_ERROR&&i.subError===AT.CLIENT_MISMATCH_ERROR;if(o||a)return G(this.acquireTokenWithCachedRefreshToken.bind(this),S.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1,n);throw i}return G(this.acquireTokenWithCachedRefreshToken.bind(this),S.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1,n)}async acquireTokenWithCachedRefreshToken(e,n,r){this.performanceClient?.addQueueMeasurement(S.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const i=Nn(this.cacheManager.getRefreshToken.bind(this.cacheManager),S.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,n,e.correlationId,void 0,this.performanceClient);if(!i)throw Vd(jd);if(i.expiresOn){const a=e.refreshTokenExpirationOffsetSeconds||ZM;if(this.performanceClient?.addFields({cacheRtExpiresOnSeconds:Number(i.expiresOn),rtOffsetSeconds:a},e.correlationId),zd(i.expiresOn,a))throw Vd(Uv)}const o={...e,refreshToken:i.secret,authenticationScheme:e.authenticationScheme||je.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:nr.HOME_ACCOUNT_ID}};try{return await G(this.acquireToken.bind(this),S.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(o,r)}catch(a){if(a instanceof sr&&a.subError===Mh){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const s=this.cacheManager.generateCredentialKey(i);this.cacheManager.removeRefreshToken(s,e.correlationId)}throw a}}async executeTokenRequest(e,n){this.performanceClient?.addQueueMeasurement(S.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),i=Ye.appendQueryString(n.tokenEndpoint,r),o=await G(this.createTokenRequestBody.bind(this),S.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),a=this.createTokenRequestHeaders(e.ccsCredential),s=Oh(this.config.authOptions.clientId,e);return G(this.executePostToTokenEndpoint.bind(this),S.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(i,o,a,s,e.correlationId,S.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){this.performanceClient?.addQueueMeasurement(S.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(wv(n,e.embeddedClientId||e.tokenBodyParameters?.[Qo]||this.config.authOptions.clientId),e.redirectUri&&Rv(n,e.redirectUri),Iv(n,e.scopes,!0,this.config.authOptions.authority.options.OIDCOptions?.defaultScopes),vI(n,_A.REFRESH_TOKEN_GRANT),Dv(n),Pv(n,this.config.libraryInfo),Nv(n,this.config.telemetry.application),EI(n),this.serverTelemetryManager&&!uI(this.config)&&TI(n,this.serverTelemetryManager),bM(n,e.refreshToken),this.config.clientCredentials.clientSecret&&pI(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const r=this.config.clientCredentials.clientAssertion;gI(n,await RI(r.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),mI(n,r.assertionType)}if(e.authenticationScheme===je.POP){const r=new _s(this.cryptoUtils,this.performanceClient);let i;e.popKid?i=this.cryptoUtils.encodeKid(e.popKid):i=(await G(r.generateCnf.bind(r),S.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,Mv(n,i)}else if(e.authenticationScheme===je.SSH)if(e.sshJwk)CI(n,e.sshJwk);else throw We(Ah);if((!Pn.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&bv(n,e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case nr.HOME_ACCOUNT_ID:try{const r=cs(e.ccsCredential.credential);Dc(n,r)}catch(r){this.logger.verbose("Could not parse home account ID for CCS Header: "+r)}break;case nr.UPN:Yd(n,e.ccsCredential.credential);break}return e.embeddedClientId&&Rh(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&qi(n,e.tokenBodyParameters),wh(n,e.correlationId,this.performanceClient),nu(n)}}class tx extends xv{constructor(e,n){super(e,n)}async acquireCachedToken(e){this.performanceClient?.addQueueMeasurement(S.SilentFlowClientAcquireCachedToken,e.correlationId);let n=mo.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!Pn.isEmptyObj(e.claims))throw this.setCacheOutcome(mo.FORCE_REFRESH_OR_CLAIMS,e.correlationId),J(Gi);if(!e.account)throw J(lv);const r=e.account.tenantId||$M(e.authority),i=this.cacheManager.getTokenKeys(),o=this.cacheManager.getAccessToken(e.account,e,i,r);if(o){if(LM(o.cachedAt)||zd(o.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(mo.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),J(Gi);o.refreshOn&&zd(o.refreshOn,0)&&(n=mo.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(mo.NO_CACHED_ACCESS_TOKEN,e.correlationId),J(Gi);const a=e.authority||this.authority.getPreferredCache(),s={account:this.cacheManager.getAccount(this.cacheManager.generateAccountKey(e.account),e.correlationId),accessToken:o,idToken:this.cacheManager.getIdToken(e.account,e.correlationId,i,r,this.performanceClient),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(a)};return this.setCacheOutcome(n,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await G(this.generateResultFromCacheRecord.bind(this),S.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(s,e),n]}setCacheOutcome(e,n){this.serverTelemetryManager?.setCacheOutcome(e),this.performanceClient?.addFields({cacheOutcome:e},n),e!==mo.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,n){this.performanceClient?.addQueueMeasurement(S.SilentFlowClientGenerateResultFromCacheRecord,n.correlationId);let r;if(e.idToken&&(r=Ar(e.idToken.secret,this.config.cryptoInterface.base64Decode)),n.maxAge||n.maxAge===0){const i=r?.auth_time;if(!i)throw J(uv);rI(i,n.maxAge)}return Wo.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,n,r)}}const nx={sendGetRequestAsync:()=>Promise.reject(J(Me)),sendPostRequestAsync:()=>Promise.reject(J(Me))};function rx(t,e,n,r){const i=e.correlationId,o=new Map;wv(o,e.embeddedClientId||e.extraQueryParameters?.[Qo]||t.clientId);const a=[...e.scopes||[],...e.extraScopesToConsent||[]];if(Iv(o,a,!0,t.authority.options.OIDCOptions?.defaultScopes),Rv(o,e.redirectUri),kv(o,i),TM(o,e.responseMode),Dv(o),e.prompt&&(IM(o,e.prompt),r?.addFields({prompt:e.prompt},i)),e.domainHint&&(AM(o,e.domainHint),r?.addFields({domainHintFromRequest:!0},i)),e.prompt!==Ht.SELECT_ACCOUNT)if(e.sid&&e.prompt===Ht.NONE)n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),MT(o,e.sid),r?.addFields({sidFromRequest:!0},i);else if(e.account){const s=ax(e.account);let c=sx(e.account);if(c&&e.domainHint&&(n.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),c=null),c){n.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),al(o,c),r?.addFields({loginHintFromClaim:!0},i);try{const u=cs(e.account.homeAccountId);Dc(o,u)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(s&&e.prompt===Ht.NONE){n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),MT(o,s),r?.addFields({sidFromClaim:!0},i);try{const u=cs(e.account.homeAccountId);Dc(o,u)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)n.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),al(o,e.loginHint),Yd(o,e.loginHint),r?.addFields({loginHintFromRequest:!0},i);else if(e.account.username){n.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),al(o,e.account.username),r?.addFields({loginHintFromUpn:!0},i);try{const u=cs(e.account.homeAccountId);Dc(o,u)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(n.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),al(o,e.loginHint),Yd(o,e.loginHint),r?.addFields({loginHintFromRequest:!0},i));else n.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");return e.nonce&&wM(o,e.nonce),e.state&&fI(o,e.state),(e.claims||t.clientCapabilities&&t.clientCapabilities.length>0)&&bv(o,e.claims,t.clientCapabilities),e.embeddedClientId&&Rh(o,t.clientId,t.redirectUri),t.instanceAware&&(!e.extraQueryParameters||!Object.keys(e.extraQueryParameters).includes(Vg))&&yI(o),o}function Hv(t,e,n,r){const i=nu(e,n,r);return Ye.appendQueryString(t.authorizationEndpoint,i)}function ix(t,e){if(kI(t,e),!t.code)throw J(FA);return t}function kI(t,e){if(!t.state||!e)throw t.state?J(Gg,"Cached State"):J(Gg,"Server State");let n,r;try{n=decodeURIComponent(t.state)}catch{throw J(Es,t.state)}try{r=decodeURIComponent(e)}catch{throw J(Es,t.state)}if(n!==r)throw J(kA);if(t.error||t.error_description||t.suberror){const i=ox(t);throw wI(t.error,t.error_description,t.suberror)?new sr(t.error||"",t.error_description,t.suberror,t.timestamp||"",t.trace_id||"",t.correlation_id||"",t.claims||"",i):new ga(t.error||"",t.error_description,t.suberror,i)}}function ox(t){const e="code=",n=t.error_uri?.lastIndexOf(e);return n&&n>=0?t.error_uri?.substring(n+e.length):void 0}function ax(t){return t.idTokenClaims?.sid||null}function sx(t){return t.loginHint||t.idTokenClaims?.login_hint||null}const GT=",",PI="|";function cx(t){const{skus:e,libraryName:n,libraryVersion:r,extensionName:i,extensionVersion:o}=t,a=new Map([[0,[n,r]],[2,[i,o]]]);let s=[];if(e?.length){if(s=e.split(GT),s.length<4)return e}else s=Array.from({length:4},()=>PI);return a.forEach((c,u)=>{c.length===2&&c[0]?.length&&c[1]?.length&&ux({skuArr:s,index:u,skuName:c[0],skuVersion:c[1]})}),s.join(GT)}function ux(t){const{skuArr:e,index:n,skuName:r,skuVersion:i}=t;n>=e.length||(e[n]=[r,i].join(PI))}class ru{constructor(e,n){this.cacheOutcome=mo.NOT_APPLICABLE,this.cacheManager=n,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||z.EMPTY_STRING,this.wrapperVer=e.wrapperVer||z.EMPTY_STRING,this.telemetryCacheKey=xt.CACHE_KEY+tu.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${xt.VALUE_SEPARATOR}${this.cacheOutcome}`,n=[this.wrapperSKU,this.wrapperVer],r=this.getNativeBrokerErrorCode();r?.length&&n.push(`broker_error=${r}`);const i=n.join(xt.VALUE_SEPARATOR),o=this.getRegionDiscoveryFields(),a=[e,o].join(xt.VALUE_SEPARATOR);return[xt.SCHEMA_VERSION,a,i].join(xt.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),n=ru.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*n).join(xt.VALUE_SEPARATOR),i=e.errors.slice(0,n).join(xt.VALUE_SEPARATOR),o=e.errors.length,a=n<o?xt.OVERFLOW_TRUE:xt.OVERFLOW_FALSE,s=[o,a].join(xt.VALUE_SEPARATOR);return[xt.SCHEMA_VERSION,e.cacheHits,r,i,s].join(xt.CATEGORY_SEPARATOR)}cacheFailedRequest(e){const n=this.getLastRequests();n.errors.length>=xt.MAX_CACHED_ERRORS&&(n.failedRequests.shift(),n.failedRequests.shift(),n.errors.shift()),n.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof Xe?e.subError?n.errors.push(e.subError):e.errorCode?n.errors.push(e.errorCode):n.errors.push(e.toString()):n.errors.push(e.toString()):n.errors.push(xt.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,n,this.correlationId)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),n=ru.maxErrorsToSend(e),r=e.errors.length;if(n===r)this.cacheManager.removeItem(this.telemetryCacheKey,this.correlationId);else{const i={failedRequests:e.failedRequests.slice(n*2),errors:e.errors.slice(n),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,i,this.correlationId)}}static maxErrorsToSend(e){let n,r=0,i=0;const o=e.errors.length;for(n=0;n<o;n++){const a=e.failedRequests[2*n]||z.EMPTY_STRING,s=e.failedRequests[2*n+1]||z.EMPTY_STRING,c=e.errors[n]||z.EMPTY_STRING;if(i+=a.toString().length+s.toString().length+c.length+3,i<xt.MAX_LAST_HEADER_BYTES)r+=1;else break}return r}getRegionDiscoveryFields(){const e=[];return e.push(this.regionUsed||z.EMPTY_STRING),e.push(this.regionSource||z.EMPTY_STRING),e.push(this.regionOutcome||z.EMPTY_STRING),e.join(",")}updateRegionDiscoveryMetadata(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome}setCacheOutcome(e){this.cacheOutcome=e}setNativeBrokerErrorCode(e){const n=this.getLastRequests();n.nativeBrokerErrorCode=e,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,n,this.correlationId)}getNativeBrokerErrorCode(){return this.getLastRequests().nativeBrokerErrorCode}clearNativeBrokerErrorCode(){const e=this.getLastRequests();delete e.nativeBrokerErrorCode,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId)}static makeExtraSkuString(e){return cx(e)}}const NI="missing_kid_error",OI="missing_alg_error";const lx={[NI]:"The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided.",[OI]:"The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."};class Bv extends Xe{constructor(e,n){super(e,n),this.name="JoseHeaderError",Object.setPrototypeOf(this,Bv.prototype)}}function qT(t){return new Bv(t,lx[t])}class Kv{constructor(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}static getShrHeaderString(e){if(!e.kid)throw qT(NI);if(!e.alg)throw qT(OI);const n=new Kv({typ:e.typ||r0.Pop,kid:e.kid,alg:e.alg});return JSON.stringify(n)}}const Gv="pkce_not_created",qv="ear_jwk_empty",DI="ear_jwe_empty",Qg="crypto_nonexistent",xh="empty_navigate_uri",MI="hash_empty_error",$v="no_state_in_hash",xI="hash_does_not_contain_known_properties",UI="unable_to_parse_state",LI="state_interaction_type_mismatch",FI="interaction_in_progress",HI="popup_window_error",BI="empty_window_error",iu="user_cancelled",dx="monitor_popup_timeout",KI="monitor_window_timeout",GI="redirect_in_iframe",qI="block_iframe_reload",$I="block_nested_popups",hx="iframe_closed_prematurely",Uh="silent_logout_unsupported",YI="no_account_error",fx="silent_prompt_value_error",zI="no_token_request_cache_error",jI="unable_to_parse_token_request_cache_error",px="auth_request_not_set_error",gx="invalid_cache_type",Lh="non_browser_environment",Ka="database_not_open",Qd="no_network_connectivity",VI="post_request_failed",QI="get_request_failed",Wg="failed_to_parse_response",WI="unable_to_load_token",Yv="crypto_key_not_found",JI="auth_code_required",XI="auth_code_or_nativeAccountId_required",ZI="spa_code_and_nativeAccountId_present",zv="database_unavailable",ew="unable_to_acquire_token_from_native_platform",tw="native_handshake_timeout",nw="native_extension_not_installed",jv="native_connection_not_established",Mc="uninitialized_public_client_application",rw="native_prompt_not_supported",iw="invalid_base64_string",ow="invalid_pop_token_request",aw="failed_to_build_headers",sw="failed_to_parse_headers",Nl="failed_to_decrypt_ear_response",Wd="timed_out";const Br="For more visit: aka.ms/msaljs/browser-errors",mx={[Gv]:"The PKCE code challenge and verifier could not be generated.",[qv]:"No EAR encryption key provided. This is unexpected.",[DI]:"Server response does not contain ear_jwe property. This is unexpected.",[Qg]:"The crypto object or function is not available.",[xh]:"Navigation URI is empty. Please check stack trace for more info.",[MI]:`Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. ${Br}`,[$v]:"Hash does not contain state. Please verify that the request originated from msal.",[xI]:`Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. ${Br}`,[UI]:"Unable to parse state. Please verify that the request originated from msal.",[LI]:"Hash contains state but the interaction type does not match the caller.",[FI]:`Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. ${Br}`,[HI]:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.",[BI]:"window.open returned null or undefined window object.",[iu]:"User cancelled the flow.",[dx]:`Token acquisition in popup failed due to timeout. ${Br}`,[KI]:`Token acquisition in iframe failed due to timeout. ${Br}`,[GI]:"Redirects are not supported for iframed or brokered applications. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs.",[qI]:`Request was blocked inside an iframe because MSAL detected an authentication response. ${Br}`,[$I]:"Request was blocked inside a popup because MSAL detected it was running in a popup.",[hx]:"The iframe being monitored was closed prematurely.",[Uh]:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead.",[YI]:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.",[fx]:"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'.",[zI]:"No token request found in cache.",[jI]:"The cached token request could not be parsed.",[px]:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler",[gx]:"Invalid cache type",[Lh]:"Login and token requests are not supported in non-browser environments.",[Ka]:"Database is not open!",[Qd]:"No network connectivity. Check your internet connection.",[VI]:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'",[QI]:"Network request failed. Please check the network trace to determine root cause.",[Wg]:"Failed to parse network response. Check network trace.",[WI]:"Error loading token to cache.",[Yv]:"Cryptographic Key or Keypair not found in browser storage.",[JI]:"An authorization code must be provided (as the `code` property on the request) to this flow.",[XI]:"An authorization code or nativeAccountId must be provided to this flow.",[ZI]:"Request cannot contain both spa code and native account id.",[zv]:"IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts.",[ew]:`Unable to acquire token from native platform. ${Br}`,[tw]:"Timed out while attempting to establish connection to browser extension",[nw]:"Native extension is not installed. If you think this is a mistake call the initialize function.",[jv]:`Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). ${Br}`,[Mc]:`You must call and await the initialize function before attempting to call any other MSAL API. ${Br}`,[rw]:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",[iw]:"Invalid base64 encoded string.",[ow]:"Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",[aw]:"Failed to build request headers object.",[sw]:"Failed to parse response headers",[Nl]:"Failed to decrypt ear response",[Wd]:"The request timed out."};class Tu extends Xe{constructor(e,n){super(e,mx[e],n),Object.setPrototypeOf(this,Tu.prototype),this.name="BrowserAuthError"}}function ae(t,e){return new Tu(t,e)}const fn={INVALID_GRANT_ERROR:"invalid_grant",POPUP_WIDTH:483,POPUP_HEIGHT:600,POPUP_NAME_PREFIX:"msal",DEFAULT_POLL_INTERVAL_MS:30,MSAL_SKU:"msal.js.browser"},Hn={CHANNEL_ID:"53ee284d-920a-4b59-9d30-a60315b26836",PREFERRED_EXTENSION_ID:"ppnbnpeolgkicgegkbkbjmhlideopiji",MATS_TELEMETRY:"MATS",MICROSOFT_ENTRA_BROKERID:"MicrosoftEntra",DOM_API_NAME:"DOM API",PLATFORM_DOM_APIS:"get-token-and-sign-out",PLATFORM_DOM_PROVIDER:"PlatformAuthDOMHandler",PLATFORM_EXTENSION_PROVIDER:"PlatformAuthExtensionHandler"},uc={HandshakeRequest:"Handshake",HandshakeResponse:"HandshakeResponse",GetToken:"GetToken",Response:"Response"},Bt={LocalStorage:"localStorage",SessionStorage:"sessionStorage",MemoryStorage:"memoryStorage"},$T={GET:"GET",POST:"POST"},ki={SIGNIN:"signin",SIGNOUT:"signout"},Tt={ORIGIN_URI:"request.origin",URL_HASH:"urlHash",REQUEST_PARAMS:"request.params",VERIFIER:"code.verifier",INTERACTION_STATUS_KEY:"interaction.status",NATIVE_REQUEST:"request.native"},cl={WRAPPER_SKU:"wrapper.sku",WRAPPER_VER:"wrapper.version"},Be={acquireTokenRedirect:861,acquireTokenPopup:862,ssoSilent:863,acquireTokenSilent_authCode:864,handleRedirectPromise:865,acquireTokenByCode:866,acquireTokenSilent_silentFlow:61,logout:961,logoutPopup:962,hydrateCache:963,loadExternalTokens:964},YT={861:"acquireTokenRedirect",862:"acquireTokenPopup",863:"ssoSilent",864:"acquireTokenSilent_authCode",865:"handleRedirectPromise",866:"acquireTokenByCode",61:"acquireTokenSilent_silentFlow",961:"logout",962:"logoutPopup",963:"hydrateCache",964:"loadExternalTokens"},vx=t=>typeof t=="number"&&t in YT?YT[t]:"unknown";var Te;(function(t){t.Redirect="redirect",t.Popup="popup",t.Silent="silent",t.None="none"})(Te||(Te={}));const pt={Startup:"startup",Login:"login",Logout:"logout",AcquireToken:"acquireToken",SsoSilent:"ssoSilent",HandleRedirect:"handleRedirect",None:"none"},zT={scopes:Rs},cw="jwk",yx={React:"@azure/msal-react"},Jg="msal.db",Cx=1,Tx=`${Jg}.keys`,Zt={Default:0,AccessToken:1,AccessTokenAndRefreshToken:2,RefreshToken:3,RefreshTokenAndNetwork:4,Skip:5},Ex=[Zt.Default,Zt.Skip,Zt.RefreshTokenAndNetwork];function ul(t){return encodeURIComponent(ou(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"))}function Qi(t){return uw(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ou(t){return uw(new TextEncoder().encode(t))}function uw(t){const e=Array.from(t,n=>String.fromCodePoint(n)).join("");return btoa(e)}function nn(t){return new TextDecoder().decode($i(t))}function $i(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw ae(iw)}const n=atob(e);return Uint8Array.from(n,r=>r.codePointAt(0)||0)}const _x="RSASSA-PKCS1-v1_5",ks="AES-GCM",lw="HKDF",Vv="SHA-256",Sx=2048,Ax=new Uint8Array([1,0,1]),jT="0123456789abcdef",VT=new Uint32Array(1),Qv="raw",dw="encrypt",Wv="decrypt",Ix="deriveKey",wx="crypto_subtle_undefined",Jv={name:_x,hash:Vv,modulusLength:Sx,publicExponent:Ax};function Rx(t){if(!window)throw ae(Lh);if(!window.crypto)throw ae(Qg);if(!t&&!window.crypto.subtle)throw ae(Qg,wx)}async function hw(t,e,n){e?.addQueueMeasurement(S.Sha256Digest,n);const i=new TextEncoder().encode(t);return window.crypto.subtle.digest(Vv,i)}function bx(t){return window.crypto.getRandomValues(t)}function Pp(){return window.crypto.getRandomValues(VT),VT[0]}function cr(){const t=Date.now(),e=Pp()*1024+(Pp()&1023),n=new Uint8Array(16),r=Math.trunc(e/2**30),i=e&2**30-1,o=Pp();n[0]=t/2**40,n[1]=t/2**32,n[2]=t/2**24,n[3]=t/2**16,n[4]=t/2**8,n[5]=t,n[6]=112|r>>>8,n[7]=r,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=o>>>24,n[13]=o>>>16,n[14]=o>>>8,n[15]=o;let a="";for(let s=0;s<n.length;s++)a+=jT.charAt(n[s]>>>4),a+=jT.charAt(n[s]&15),(s===3||s===5||s===7||s===9)&&(a+="-");return a}async function kx(t,e){return window.crypto.subtle.generateKey(Jv,t,e)}async function Np(t){return window.crypto.subtle.exportKey(cw,t)}async function Px(t,e,n){return window.crypto.subtle.importKey(cw,t,Jv,e,n)}async function Nx(t,e){return window.crypto.subtle.sign(Jv,t,e)}async function Xv(){const t=await fw(),n={alg:"dir",kty:"oct",k:Qi(new Uint8Array(t))};return ou(JSON.stringify(n))}async function Ox(t){const e=nn(t),r=JSON.parse(e).k,i=$i(r);return window.crypto.subtle.importKey(Qv,i,ks,!1,[Wv])}async function Dx(t,e){const n=e.split(".");if(n.length!==5)throw ae(Nl,"jwe_length");const r=await Ox(t).catch(()=>{throw ae(Nl,"import_key")});try{const i=new TextEncoder().encode(n[0]),o=$i(n[2]),a=$i(n[3]),s=$i(n[4]),c=s.byteLength*8,u=new Uint8Array(a.length+s.length);u.set(a),u.set(s,a.length);const l=await window.crypto.subtle.decrypt({name:ks,iv:o,tagLength:c,additionalData:i},r,u);return new TextDecoder().decode(l)}catch{throw ae(Nl,"decrypt")}}async function fw(){const t=await window.crypto.subtle.generateKey({name:ks,length:256},!0,[dw,Wv]);return window.crypto.subtle.exportKey(Qv,t)}async function QT(t){return window.crypto.subtle.importKey(Qv,t,lw,!1,[Ix])}async function pw(t,e,n){return window.crypto.subtle.deriveKey({name:lw,salt:e,hash:Vv,info:new TextEncoder().encode(n)},t,{name:ks,length:256},!1,[dw,Wv])}async function Mx(t,e,n){const r=new TextEncoder().encode(e),i=window.crypto.getRandomValues(new Uint8Array(16)),o=await pw(t,i,n),a=await window.crypto.subtle.encrypt({name:ks,iv:new Uint8Array(12)},o,r);return{data:Qi(new Uint8Array(a)),nonce:Qi(i)}}async function WT(t,e,n,r){const i=$i(r),o=await pw(t,$i(e),n),a=await window.crypto.subtle.decrypt({name:ks,iv:new Uint8Array(12)},o,i);return new TextDecoder().decode(a)}async function gw(t){const e=await hw(t),n=new Uint8Array(e);return Qi(n)}const Fh="storage_not_supported",wt="stubbed_public_client_application_called",Zv="in_mem_redirect_unavailable";const Ol={[Fh]:"Given storage configuration option was not supported.",[wt]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[Zv]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};Ol[Fh],Ol[wt],Ol[Zv];class ey extends Xe{constructor(e,n){super(e,n),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,ey.prototype)}}function Ct(t){return new ey(t,Ol[t])}function mw(t){t.location.hash="",typeof t.history.replaceState=="function"&&t.history.replaceState(null,"",`${t.location.origin}${t.location.pathname}${t.location.search}`)}function xx(t){const e=t.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function ty(){return window.parent!==window}function Ux(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${fn.POPUP_NAME_PREFIX}.`)===0}function Yr(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function Lx(){const e=new Ye(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function Fx(){if(Ye.hashContainsKnownProperties(window.location.hash)&&ty())throw ae(qI)}function Hx(t){if(ty()&&!t)throw ae(GI)}function Bx(){if(Ux())throw ae($I)}function vw(){if(typeof window>"u")throw ae(Lh)}function yw(t){if(!t)throw ae(Mc)}function ny(t){vw(),Fx(),Bx(),yw(t)}function JT(t,e){if(ny(t),Hx(e.system.allowRedirectInIframe),e.cache.cacheLocation===Bt.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw Ct(Zv)}function Cw(t){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(t).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function Kx(){return cr()}class Jd{navigateInternal(e,n){return Jd.defaultNavigateWindow(e,n)}navigateExternal(e,n){return Jd.defaultNavigateWindow(e,n)}static defaultNavigateWindow(e,n){return n.noHistory?window.location.replace(e):window.location.assign(e),new Promise((r,i)=>{setTimeout(()=>{i(ae(Wd,"failed_to_redirect"))},n.timeout)})}}class Gx{async sendGetRequestAsync(e,n){let r,i={},o=0;const a=XT(n);try{r=await fetch(e,{method:$T.GET,headers:a})}catch(s){throw Sc(ae(window.navigator.onLine?QI:Qd),void 0,void 0,s)}i=ZT(r.headers);try{return o=r.status,{headers:i,body:await r.json(),status:o}}catch(s){throw Sc(ae(Wg),o,i,s)}}async sendPostRequestAsync(e,n){const r=n&&n.body||"",i=XT(n);let o,a=0,s={};try{o=await fetch(e,{method:$T.POST,headers:i,body:r})}catch(c){throw Sc(ae(window.navigator.onLine?VI:Qd),void 0,void 0,c)}s=ZT(o.headers);try{return a=o.status,{headers:s,body:await o.json(),status:a}}catch(c){throw Sc(ae(Wg),a,s,c)}}}function XT(t){try{const e=new Headers;if(!(t&&t.headers))return e;const n=t.headers;return Object.entries(n).forEach(([r,i])=>{e.append(r,i)}),e}catch(e){throw Sc(ae(aw),void 0,void 0,e)}}function ZT(t){try{const e={};return t.forEach((n,r)=>{e[r]=n}),e}catch{throw ae(sw)}}const qx=6e4,Xg=1e4,$x=3e4,Tw=2e3;function Yx({auth:t,cache:e,system:n,telemetry:r},i){const o={clientId:z.EMPTY_STRING,authority:`${z.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:z.EMPTY_STRING,authorityMetadata:z.EMPTY_STRING,redirectUri:typeof window<"u"?Yr():"",postLogoutRedirectUri:z.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:mn.AAD,OIDCOptions:{serverResponseType:Sh.FRAGMENT,defaultScopes:[z.OPENID_SCOPE,z.PROFILE_SCOPE,z.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:gv.None,tenant:z.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1,encodeExtraQueryParams:!1},a={cacheLocation:Bt.SessionStorage,cacheRetentionDays:5,temporaryCacheLocation:Bt.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===Bt.LocalStorage),claimsBasedCachingEnabled:!1},s={loggerCallback:()=>{},logLevel:ot.Info,piiLoggingEnabled:!1},u={...{...cI,loggerOptions:s,networkClient:i?new Gx:nx,navigationClient:new Jd,loadFrameTimeout:0,windowHashTimeout:n?.loadFrameTimeout||qx,iframeHashTimeout:n?.loadFrameTimeout||Xg,navigateFrameWait:0,redirectNavigationTimeout:$x,asyncPopups:!1,allowRedirectInIframe:!1,allowPlatformBroker:!1,allowPlatformBrokerWithDOM:!1,nativeBrokerHandshakeTimeout:n?.nativeBrokerHandshakeTimeout||Tw,pollIntervalMilliseconds:fn.DEFAULT_POLL_INTERVAL_MS},...n,loggerOptions:n?.loggerOptions||s},l={application:{appName:z.EMPTY_STRING,appVersion:z.EMPTY_STRING},client:new sI};if(t?.protocolMode!==mn.OIDC&&t?.OIDCOptions&&new ai(u.loggerOptions).warning(JSON.stringify(We(JA))),t?.protocolMode&&t.protocolMode===mn.OIDC&&u?.allowPlatformBroker)throw We(XA);return{auth:{...o,...t,OIDCOptions:{...o.OIDCOptions,...t?.OIDCOptions}},cache:{...a,...e},system:u,telemetry:{...l,...r}}}const zx="@azure/msal-browser",Jo="4.28.0";const Vt="msal",Ew="browser",eE="|",Yt=2,Dl=2,jx=`${Vt}.${Ew}.log.level`,Vx=`${Vt}.${Ew}.log.pii`,tE=`${Vt}.version`,nE="account.keys",rE="token.keys";function ds(t=Dl){return t<1?`${Vt}.${nE}`:`${Vt}.${t}.${nE}`}function hs(t,e=Yt){return e<1?`${Vt}.${rE}.${t}`:`${Vt}.${e}.${rE}.${t}`}class ry{static loggerCallback(e,n){switch(e){case ot.Error:console.error(n);return;case ot.Info:console.info(n);return;case ot.Verbose:console.debug(n);return;case ot.Warning:console.warn(n);return;default:console.log(n);return}}constructor(e){this.browserEnvironment=typeof window<"u",this.config=Yx(e,this.browserEnvironment);let n;try{n=window[Bt.SessionStorage]}catch{}const r=n?.getItem(jx),i=n?.getItem(Vx)?.toLowerCase(),o=i==="true"?!0:i==="false"?!1:void 0,a={...this.config.system.loggerOptions},s=r&&Object.keys(ot).includes(r)?ot[r]:void 0;s&&(a.loggerCallback=ry.loggerCallback,a.logLevel=s),o!==void 0&&(a.piiLoggingEnabled=o),this.logger=new ai(a,zx,Jo),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}class Xo extends ry{getModuleName(){return Xo.MODULE_NAME}getId(){return Xo.ID}async initialize(){return this.available=typeof window<"u",this.available}}Xo.MODULE_NAME="";Xo.ID="StandardOperatingContext";class Qx{constructor(){this.dbName=Jg,this.version=Cx,this.tableName=Tx,this.dbOpen=!1}async open(){return new Promise((e,n)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",i=>{i.target.result.createObjectStore(this.tableName)}),r.addEventListener("success",i=>{const o=i;this.db=o.target.result,this.dbOpen=!0,e()}),r.addEventListener("error",()=>n(ae(zv)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(ae(Ka));const a=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);a.addEventListener("success",s=>{const c=s;this.closeConnection(),n(c.target.result)}),a.addEventListener("error",s=>{this.closeConnection(),r(s)})})}async setItem(e,n){return await this.validateDbIsOpen(),new Promise((r,i)=>{if(!this.db)return i(ae(Ka));const s=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(n,e);s.addEventListener("success",()=>{this.closeConnection(),r()}),s.addEventListener("error",c=>{this.closeConnection(),i(c)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(ae(Ka));const a=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);a.addEventListener("success",()=>{this.closeConnection(),n()}),a.addEventListener("error",s=>{this.closeConnection(),r(s)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,n)=>{if(!this.db)return n(ae(Ka));const o=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();o.addEventListener("success",a=>{const s=a;this.closeConnection(),e(s.target.result)}),o.addEventListener("error",a=>{this.closeConnection(),n(a)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(ae(Ka));const a=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);a.addEventListener("success",s=>{const c=s;this.closeConnection(),n(c.target.result===1)}),a.addEventListener("error",s=>{this.closeConnection(),r(s)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,n)=>{const r=window.indexedDB.deleteDatabase(Jg),i=setTimeout(()=>n(!1),200);r.addEventListener("success",()=>(clearTimeout(i),e(!0))),r.addEventListener("blocked",()=>(clearTimeout(i),e(!0))),r.addEventListener("error",()=>(clearTimeout(i),n(!1)))})}}class Hh{constructor(){this.cache=new Map}async initialize(){}getItem(e){return this.cache.get(e)||null}getUserData(e){return this.getItem(e)}setItem(e,n){this.cache.set(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((n,r)=>{e.push(r)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}decryptData(){return Promise.resolve(null)}}class Wx{constructor(e){this.inMemoryCache=new Hh,this.indexedDBCache=new Qx,this.logger=e}handleDatabaseAccessError(e){if(e instanceof Tu&&e.errorCode===zv)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e}async getItem(e){const n=this.inMemoryCache.getItem(e);if(!n)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(r){this.handleDatabaseAccessError(r)}return n}async setItem(e,n){this.inMemoryCache.setItem(e,n);try{await this.indexedDBCache.setItem(e,n)}catch(r){this.handleDatabaseAccessError(r)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(n){this.handleDatabaseAccessError(n)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(e.length===0)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(n){this.handleDatabaseAccessError(n)}return e}async containsKey(e){const n=this.inMemoryCache.containsKey(e);if(!n)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(r){this.handleDatabaseAccessError(r)}return n}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}class si{constructor(e,n,r){this.logger=e,Rx(r??!1),this.cache=new Wx(this.logger),this.performanceClient=n}createNewGuid(){return cr()}base64Encode(e){return ou(e)}base64Decode(e){return nn(e)}base64UrlEncode(e){return ul(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){const n=this.performanceClient?.startMeasurement(S.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await kx(si.EXTRACTABLE,si.POP_KEY_USAGES),i=await Np(r.publicKey),o={e:i.e,kty:i.kty,n:i.n},a=iE(o),s=await this.hashString(a),c=await Np(r.privateKey),u=await Px(c,!1,["sign"]);return await this.cache.setItem(s,{privateKey:u,publicKey:r.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),n&&n.end({success:!0}),s}async removeTokenBindingKey(e){if(await this.cache.removeItem(e),await this.cache.containsKey(e))throw J(HA)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,n,r,i){const o=this.performanceClient?.startMeasurement(S.CryptoOptsSignJwt,i),a=await this.cache.getItem(n);if(!a)throw ae(Yv);const s=await Np(a.publicKey),c=iE(s),u=ul(JSON.stringify({kid:n})),l=Kv.getShrHeaderString({...r?.header,alg:s.alg,kid:u}),d=ul(l);e.cnf={jwk:JSON.parse(c)};const p=ul(JSON.stringify(e)),h=`${d}.${p}`,g=new TextEncoder().encode(h),m=await Nx(a.privateKey,g),v=Qi(new Uint8Array(m)),y=`${h}.${v}`;return o&&o.end({success:!0}),y}async hashString(e){return gw(e)}}si.POP_KEY_USAGES=["sign","verify"];si.EXTRACTABLE=!0;function iE(t){return JSON.stringify(t,Object.keys(t).sort())}const Jx=1440*60*1e3,Zg={Lax:"Lax",None:"None"};class _w{initialize(){return Promise.resolve()}getItem(e){const n=`${encodeURIComponent(e)}`,r=document.cookie.split(";");for(let i=0;i<r.length;i++){const o=r[i],[a,...s]=decodeURIComponent(o).trim().split("="),c=s.join("=");if(a===n)return c}return""}getUserData(){throw J(Me)}setItem(e,n,r,i=!0,o=Zg.Lax){let a=`${encodeURIComponent(e)}=${encodeURIComponent(n)};path=/;SameSite=${o};`;if(r){const s=Xx(r);a+=`expires=${s};`}(i||o===Zg.None)&&(a+="Secure;"),document.cookie=a}async setUserData(){return Promise.reject(J(Me))}removeItem(e){this.setItem(e,"",-1)}getKeys(){const e=document.cookie.split(";"),n=[];return e.forEach(r=>{const i=decodeURIComponent(r).trim().split("=");n.push(i[0])}),n}containsKey(e){return this.getKeys().includes(e)}decryptData(){return Promise.resolve(null)}}function Xx(t){const e=new Date;return new Date(e.getTime()+t*Jx).toUTCString()}function Si(t,e){const n=t.getItem(ds(e));return n?JSON.parse(n):[]}function Qn(t,e,n){const r=e.getItem(hs(t,n));if(r){const i=JSON.parse(r);if(i&&i.hasOwnProperty("idToken")&&i.hasOwnProperty("accessToken")&&i.hasOwnProperty("refreshToken"))return i}return{idToken:[],accessToken:[],refreshToken:[]}}function Ml(t){return t.hasOwnProperty("id")&&t.hasOwnProperty("nonce")&&t.hasOwnProperty("data")}const oE="msal.cache.encryption",Zx="msal.broadcast.cache";class eU{constructor(e,n,r){if(!window.localStorage)throw Ct(Fh);this.memoryStorage=new Hh,this.initialized=!1,this.clientId=e,this.logger=n,this.performanceClient=r,this.broadcast=new BroadcastChannel(Zx)}async initialize(e){const n=new _w,r=n.getItem(oE);let i={key:"",id:""};if(r)try{i=JSON.parse(r)}catch{}if(i.key&&i.id){const o=Nn($i,S.Base64Decode,this.logger,this.performanceClient,e)(i.key);this.encryptionCookie={id:i.id,key:await G(QT,S.GenerateHKDF,this.logger,this.performanceClient,e)(o)}}else{const o=cr(),a=await G(fw,S.GenerateBaseKey,this.logger,this.performanceClient,e)(),s=Nn(Qi,S.UrlEncodeArr,this.logger,this.performanceClient,e)(new Uint8Array(a));this.encryptionCookie={id:o,key:await G(QT,S.GenerateHKDF,this.logger,this.performanceClient,e)(a)};const c={id:o,key:s};n.setItem(oE,JSON.stringify(c),0,!0,Zg.None)}await G(this.importExistingCache.bind(this),S.ImportExistingCache,this.logger,this.performanceClient,e)(e),this.broadcast.addEventListener("message",this.updateCache.bind(this)),this.initialized=!0}getItem(e){return window.localStorage.getItem(e)}getUserData(e){if(!this.initialized)throw ae(Mc);return this.memoryStorage.getItem(e)}async decryptData(e,n,r){if(!this.initialized||!this.encryptionCookie)throw ae(Mc);if(n.id!==this.encryptionCookie.id)return this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},r),null;const i=await G(WT,S.Decrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n.nonce,this.getContext(e),n.data);if(!i)return null;try{return{...JSON.parse(i),lastUpdatedAt:n.lastUpdatedAt}}catch{return this.performanceClient.incrementFields({encryptedCacheCorruptionCount:1},r),null}}setItem(e,n){window.localStorage.setItem(e,n)}async setUserData(e,n,r,i,o){if(!this.initialized||!this.encryptionCookie)throw ae(Mc);if(o)this.setItem(e,n);else{const{data:a,nonce:s}=await G(Mx,S.Encrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n,this.getContext(e)),c={id:this.encryptionCookie.id,nonce:s,data:a,lastUpdatedAt:i};this.setItem(e,JSON.stringify(c))}this.memoryStorage.setItem(e,n),this.broadcast.postMessage({key:e,value:n,context:this.getContext(e)})}removeItem(e){this.memoryStorage.containsKey(e)&&(this.memoryStorage.removeItem(e),this.broadcast.postMessage({key:e,value:null,context:this.getContext(e)})),window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}clear(){this.memoryStorage.clear(),Si(this).forEach(r=>this.removeItem(r));const n=Qn(this.clientId,this);n.idToken.forEach(r=>this.removeItem(r)),n.accessToken.forEach(r=>this.removeItem(r)),n.refreshToken.forEach(r=>this.removeItem(r)),this.getKeys().forEach(r=>{(r.startsWith(Vt)||r.indexOf(this.clientId)!==-1)&&this.removeItem(r)})}async importExistingCache(e){if(!this.encryptionCookie)return;let n=Si(this);n=await this.importArray(n,e),n.length?this.setItem(ds(),JSON.stringify(n)):this.removeItem(ds());const r=Qn(this.clientId,this);r.idToken=await this.importArray(r.idToken,e),r.accessToken=await this.importArray(r.accessToken,e),r.refreshToken=await this.importArray(r.refreshToken,e),r.idToken.length||r.accessToken.length||r.refreshToken.length?this.setItem(hs(this.clientId),JSON.stringify(r)):this.removeItem(hs(this.clientId))}async getItemFromEncryptedCache(e,n){if(!this.encryptionCookie)return null;const r=this.getItem(e);if(!r)return null;let i;try{i=JSON.parse(r)}catch{return null}return Ml(i)?i.id!==this.encryptionCookie.id?(this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},n),null):(this.performanceClient.incrementFields({encryptedCacheCount:1},n),G(WT,S.Decrypt,this.logger,this.performanceClient,n)(this.encryptionCookie.key,i.nonce,this.getContext(e),i.data)):(this.performanceClient.incrementFields({unencryptedCacheCount:1},n),r)}async importArray(e,n){const r=[],i=[];return e.forEach(o=>{const a=this.getItemFromEncryptedCache(o,n).then(s=>{s?(this.memoryStorage.setItem(o,s),r.push(o)):this.removeItem(o)});i.push(a)}),await Promise.all(i),r}getContext(e){let n="";return e.includes(this.clientId)&&(n=this.clientId),n}updateCache(e){this.logger.trace("Updating internal cache from broadcast event");const n=this.performanceClient.startMeasurement(S.LocalStorageUpdated);n.add({isBackground:!0});const{key:r,value:i,context:o}=e.data;if(!r){this.logger.error("Broadcast event missing key"),n.end({success:!1,errorCode:"noKey"});return}if(o&&o!==this.clientId){this.logger.trace(`Ignoring broadcast event from clientId: ${o}`),n.end({success:!1,errorCode:"contextMismatch"});return}i?(this.memoryStorage.setItem(r,i),this.logger.verbose("Updated item in internal cache")):(this.memoryStorage.removeItem(r),this.logger.verbose("Removed item from internal cache")),n.end({success:!0})}}class tU{constructor(){if(!window.sessionStorage)throw Ct(Fh)}async initialize(){}getItem(e){return window.sessionStorage.getItem(e)}getUserData(e){return this.getItem(e)}setItem(e,n){window.sessionStorage.setItem(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}decryptData(){return Promise.resolve(null)}}const de={INITIALIZE_START:"msal:initializeStart",INITIALIZE_END:"msal:initializeEnd",ACCOUNT_ADDED:"msal:accountAdded",ACCOUNT_REMOVED:"msal:accountRemoved",ACTIVE_ACCOUNT_CHANGED:"msal:activeAccountChanged",LOGIN_START:"msal:loginStart",LOGIN_SUCCESS:"msal:loginSuccess",LOGIN_FAILURE:"msal:loginFailure",ACQUIRE_TOKEN_START:"msal:acquireTokenStart",ACQUIRE_TOKEN_SUCCESS:"msal:acquireTokenSuccess",ACQUIRE_TOKEN_FAILURE:"msal:acquireTokenFailure",ACQUIRE_TOKEN_NETWORK_START:"msal:acquireTokenFromNetworkStart",SSO_SILENT_START:"msal:ssoSilentStart",SSO_SILENT_SUCCESS:"msal:ssoSilentSuccess",SSO_SILENT_FAILURE:"msal:ssoSilentFailure",ACQUIRE_TOKEN_BY_CODE_START:"msal:acquireTokenByCodeStart",ACQUIRE_TOKEN_BY_CODE_SUCCESS:"msal:acquireTokenByCodeSuccess",ACQUIRE_TOKEN_BY_CODE_FAILURE:"msal:acquireTokenByCodeFailure",HANDLE_REDIRECT_START:"msal:handleRedirectStart",HANDLE_REDIRECT_END:"msal:handleRedirectEnd",POPUP_OPENED:"msal:popupOpened",LOGOUT_START:"msal:logoutStart",LOGOUT_SUCCESS:"msal:logoutSuccess",LOGOUT_FAILURE:"msal:logoutFailure",LOGOUT_END:"msal:logoutEnd",RESTORE_FROM_BFCACHE:"msal:restoreFromBFCache",BROKER_CONNECTION_ESTABLISHED:"msal:brokerConnectionEstablished"};function Ci(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class em extends jg{constructor(e,n,r,i,o,a,s){super(e,r,i,o,s),this.cacheConfig=n,this.logger=i,this.internalStorage=new Hh,this.browserStorage=aE(e,n.cacheLocation,i,o),this.temporaryCacheStorage=aE(e,n.temporaryCacheLocation,i,o),this.cookieStorage=new _w,this.eventHandler=a}async initialize(e){this.performanceClient.addFields({cacheLocation:this.cacheConfig.cacheLocation,cacheRetentionDays:this.cacheConfig.cacheRetentionDays},e),await this.browserStorage.initialize(e),await this.migrateExistingCache(e),this.trackVersionChanges(e)}async migrateExistingCache(e){let n=Si(this.browserStorage),r=Qn(this.clientId,this.browserStorage);this.performanceClient.addFields({preMigrateAcntCount:n.length,preMigrateATCount:r.accessToken.length,preMigrateITCount:r.idToken.length,preMigrateRTCount:r.refreshToken.length},e);for(let o=0;o<Dl;o++){const a=o;await this.removeStaleAccounts(o,a,e)}for(let o=0;o<Yt;o++){const a=o;await this.migrateIdTokens(o,a,e)}const i=this.getKMSIValues();for(let o=0;o<Yt;o++)await this.migrateAccessTokens(o,i,e),await this.migrateRefreshTokens(o,i,e);n=Si(this.browserStorage),r=Qn(this.clientId,this.browserStorage),this.performanceClient.addFields({postMigrateAcntCount:n.length,postMigrateATCount:r.accessToken.length,postMigrateITCount:r.idToken.length,postMigrateRTCount:r.refreshToken.length},e)}async updateOldEntry(e,n){const r=this.browserStorage.getItem(e),i=this.validateAndParseJson(r||"");if(!i)return this.browserStorage.removeItem(e),null;if(!i.lastUpdatedAt)i.lastUpdatedAt=Date.now().toString(),this.setItem(e,JSON.stringify(i),n);else if(UT(i.lastUpdatedAt,this.cacheConfig.cacheRetentionDays))return this.browserStorage.removeItem(e),this.performanceClient.incrementFields({expiredCacheRemovedCount:1},n),null;const o=Ml(i)?await this.browserStorage.decryptData(e,i,n):i;return!o||!Nh(o)?(this.performanceClient.incrementFields({invalidCacheCount:1},n),null):(LT(o)||FT(o))&&o.expiresOn&&zd(o.expiresOn,SA)?(this.browserStorage.removeItem(e),this.performanceClient.incrementFields({expiredCacheRemovedCount:1},n),null):o}async removeStaleAccounts(e,n,r){const i=Si(this.browserStorage,e);if(i.length!==0){for(const o of[...i]){this.performanceClient.incrementFields({oldAcntCount:1},r);const a=this.browserStorage.getItem(o),s=this.validateAndParseJson(a||"");if(!s){Ci(i,o);continue}if(s.lastUpdatedAt)UT(s.lastUpdatedAt,this.cacheConfig.cacheRetentionDays)&&(await this.removeAccountOldSchema(o,s,n,r),Ci(i,o));else{s.lastUpdatedAt=Date.now().toString(),this.setItem(o,JSON.stringify(s),r);continue}}this.setAccountKeys(i,r,e)}}async removeAccountOldSchema(e,n,r,i){const a=(Ml(n)?await this.browserStorage.decryptData(e,n,i):n)?.homeAccountId;if(a){const s=this.getTokenKeys(r);[...s.idToken].filter(c=>c.includes(a)).forEach(c=>{this.browserStorage.removeItem(c),Ci(s.idToken,c)}),[...s.accessToken].filter(c=>c.includes(a)).forEach(c=>{this.browserStorage.removeItem(c),Ci(s.accessToken,c)}),[...s.refreshToken].filter(c=>c.includes(a)).forEach(c=>{this.browserStorage.removeItem(c),Ci(s.refreshToken,c)}),this.setTokenKeys(s,i,r)}this.performanceClient.incrementFields({expiredAcntRemovedCount:1},i),this.browserStorage.removeItem(e)}getKMSIValues(){const e={},n=this.getTokenKeys().idToken;for(const r of n){const i=this.browserStorage.getUserData(r);if(i){const o=JSON.parse(i),a=Ar(o.secret,nn);a&&(e[o.homeAccountId]=kr(a))}}return e}async migrateIdTokens(e,n,r){const i=Qn(this.clientId,this.browserStorage,e);if(i.idToken.length===0)return;const o=Qn(this.clientId,this.browserStorage,Yt),a=Si(this.browserStorage),s=Si(this.browserStorage,n);for(const c of[...i.idToken]){this.performanceClient.incrementFields({oldITCount:1},r);const u=await this.updateOldEntry(c,r);if(!u){Ci(i.idToken,c);continue}const l=a.find(y=>y.includes(u.homeAccountId)),d=s.find(y=>y.includes(u.homeAccountId));let p=null;if(l)p=this.getAccount(l,r);else if(d){const y=this.browserStorage.getItem(d),I=this.validateAndParseJson(y||"");p=I&&Ml(I)?await this.browserStorage.decryptData(d,I,r):I}if(!p){this.performanceClient.incrementFields({skipITMigrateCount:1},r);continue}const h=Ar(u.secret,nn),f=this.generateCredentialKey(u),g=this.getIdTokenCredential(f,r),m=Object.keys(h).includes("signin_state"),v=g&&Object.keys(Ar(g.secret,nn)||{}).includes("signin_state");if(!g||u.lastUpdatedAt>g.lastUpdatedAt&&(m||!v)){const y=p.tenantProfiles||[],I=Ev(h)||p.realm;if(I&&!y.find(M=>M.tenantId===I)){const M=Ih(p.homeAccountId,p.localAccountId,I,h);y.push(M)}p.tenantProfiles=y;const R=this.generateAccountKey(lt.getAccountInfo(p)),A=kr(h);await this.setUserData(R,JSON.stringify(p),r,p.lastUpdatedAt,A),a.includes(R)||a.push(R),await this.setUserData(f,JSON.stringify(u),r,u.lastUpdatedAt,A),this.performanceClient.incrementFields({migratedITCount:1},r),o.idToken.push(f)}}this.setTokenKeys(i,r,e),this.setTokenKeys(o,r),this.setAccountKeys(a,r)}async migrateAccessTokens(e,n,r){const i=Qn(this.clientId,this.browserStorage,e);if(i.accessToken.length===0)return;const o=Qn(this.clientId,this.browserStorage,Yt);for(const a of[...i.accessToken]){this.performanceClient.incrementFields({oldATCount:1},r);const s=await this.updateOldEntry(a,r);if(!s){Ci(i.accessToken,a);continue}if(!Object.keys(n).includes(s.homeAccountId)){this.performanceClient.incrementFields({skipATMigrateCount:1},r);continue}const c=this.generateCredentialKey(s),u=n[s.homeAccountId];if(!o.accessToken.includes(c))await this.setUserData(c,JSON.stringify(s),r,s.lastUpdatedAt,u),this.performanceClient.incrementFields({migratedATCount:1},r),o.accessToken.push(c);else{const l=this.getAccessTokenCredential(c,r);(!l||s.lastUpdatedAt>l.lastUpdatedAt)&&(await this.setUserData(c,JSON.stringify(s),r,s.lastUpdatedAt,u),this.performanceClient.incrementFields({migratedATCount:1},r))}}this.setTokenKeys(i,r,e),this.setTokenKeys(o,r)}async migrateRefreshTokens(e,n,r){const i=Qn(this.clientId,this.browserStorage,e);if(i.refreshToken.length===0)return;const o=Qn(this.clientId,this.browserStorage,Yt);for(const a of[...i.refreshToken]){this.performanceClient.incrementFields({oldRTCount:1},r);const s=await this.updateOldEntry(a,r);if(!s){Ci(i.refreshToken,a);continue}if(!Object.keys(n).includes(s.homeAccountId)){this.performanceClient.incrementFields({skipRTMigrateCount:1},r);continue}const c=this.generateCredentialKey(s),u=n[s.homeAccountId];if(!o.refreshToken.includes(c))await this.setUserData(c,JSON.stringify(s),r,s.lastUpdatedAt,u),this.performanceClient.incrementFields({migratedRTCount:1},r),o.refreshToken.push(c);else{const l=this.getRefreshTokenCredential(c,r);(!l||s.lastUpdatedAt>l.lastUpdatedAt)&&(await this.setUserData(c,JSON.stringify(s),r,s.lastUpdatedAt,u),this.performanceClient.incrementFields({migratedRTCount:1},r))}}this.setTokenKeys(i,r,e),this.setTokenKeys(o,r)}trackVersionChanges(e){const n=this.browserStorage.getItem(tE);n&&(this.logger.info(`MSAL.js was last initialized by version: ${n}`),this.performanceClient.addFields({previousLibraryVersion:n},e)),n!==Jo&&this.setItem(tE,Jo,e)}validateAndParseJson(e){if(!e)return null;try{const n=JSON.parse(e);return n&&typeof n=="object"?n:null}catch{return null}}setItem(e,n,r){const i=new Array(Yt+1).fill(0),o=[],a=20;for(let s=0;s<=a;s++)try{if(this.browserStorage.setItem(e,n),s>0)for(let c=0;c<=Yt;c++){const u=i.slice(0,c).reduce((d,p)=>d+p,0);if(u>=s)break;const l=s>u+i[c]?u+i[c]:s;s>u&&i[c]>0&&this.removeAccessTokenKeys(o.slice(u,l),r,c)}break}catch(c){const u=zg(c);if(u.errorCode===Gd&&s<a){if(!o.length)for(let l=0;l<=Yt;l++)if(e===hs(this.clientId,l)){const d=JSON.parse(n).accessToken;o.push(...d),i[l]=d.length}else{const d=this.getTokenKeys(l).accessToken;o.push(...d),i[l]=d.length}if(o.length<=s)throw u;this.removeAccessToken(o[s],r,!1)}else throw u}}async setUserData(e,n,r,i,o){const a=new Array(Yt+1).fill(0),s=[],c=20;for(let u=0;u<=c;u++)try{if(await G(this.browserStorage.setUserData.bind(this.browserStorage),S.SetUserData,this.logger,this.performanceClient)(e,n,r,i,o),u>0)for(let l=0;l<=Yt;l++){const d=a.slice(0,l).reduce((h,f)=>h+f,0);if(d>=u)break;const p=u>d+a[l]?d+a[l]:u;u>d&&a[l]>0&&this.removeAccessTokenKeys(s.slice(d,p),r,l)}break}catch(l){const d=zg(l);if(d.errorCode===Gd&&u<c){if(!s.length)for(let p=0;p<=Yt;p++){const h=this.getTokenKeys(p).accessToken;s.push(...h),a[p]=h.length}if(s.length<=u)throw d;this.removeAccessToken(s[u],r,!1)}else throw d}}getAccount(e,n){this.logger.trace("BrowserCacheManager.getAccount called");const r=this.browserStorage.getUserData(e);if(!r)return this.removeAccountKeyFromMap(e,n),null;const i=this.validateAndParseJson(r);return!i||!lt.isAccountEntity(i)?null:(this.performanceClient.addFields({accountCachedBy:vx(i.cachedByApiId)},n),jg.toObject(new lt,i))}async setAccount(e,n,r,i){this.logger.trace("BrowserCacheManager.setAccount called");const o=this.generateAccountKey(lt.getAccountInfo(e)),a=Date.now().toString();e.lastUpdatedAt=a,e.cachedByApiId=i,await this.setUserData(o,JSON.stringify(e),n,a,r);const s=this.addAccountKeyToMap(o,n);this.performanceClient.addFields({kmsi:r},n),this.cacheConfig.cacheLocation===Bt.LocalStorage&&s&&this.eventHandler.emitEvent(de.ACCOUNT_ADDED,void 0,lt.getAccountInfo(e))}getAccountKeys(){return Si(this.browserStorage)}setAccountKeys(e,n,r=Dl){e.length===0?this.removeItem(ds(r)):this.setItem(ds(r),JSON.stringify(e),n)}addAccountKeyToMap(e,n){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${e}`);const r=this.getAccountKeys();return r.indexOf(e)===-1?(r.push(e),this.setItem(ds(),JSON.stringify(r),n),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added"),!0):(this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map"),!1)}removeAccountKeyFromMap(e,n){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${e}`);const r=this.getAccountKeys(),i=r.indexOf(e);i>-1?(r.splice(i,1),this.setAccountKeys(r,n),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")):this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}removeAccount(e,n){const r=this.getActiveAccount(n);r?.homeAccountId===e.homeAccountId&&r?.environment===e.environment&&this.setActiveAccount(null,n),super.removeAccount(e,n),this.removeAccountKeyFromMap(this.generateAccountKey(e),n),this.browserStorage.getKeys().forEach(i=>{i.includes(e.homeAccountId)&&i.includes(e.environment)&&this.browserStorage.removeItem(i)}),this.cacheConfig.cacheLocation===Bt.LocalStorage&&this.eventHandler.emitEvent(de.ACCOUNT_REMOVED,void 0,e)}removeIdToken(e,n){super.removeIdToken(e,n);const r=this.getTokenKeys(),i=r.idToken.indexOf(e);i>-1&&(this.logger.info("idToken removed from tokenKeys map"),r.idToken.splice(i,1),this.setTokenKeys(r,n))}removeAccessToken(e,n,r=!0){super.removeAccessToken(e,n),r&&this.removeAccessTokenKeys([e],n)}removeAccessTokenKeys(e,n,r=Yt){this.logger.trace("removeAccessTokenKey called");const i=this.getTokenKeys(r);let o=0;if(e.forEach(a=>{const s=i.accessToken.indexOf(a);s>-1&&(i.accessToken.splice(s,1),o++)}),o>0){this.logger.info(`removed ${o} accessToken keys from tokenKeys map`),this.setTokenKeys(i,n,r);return}}removeRefreshToken(e,n){super.removeRefreshToken(e,n);const r=this.getTokenKeys(),i=r.refreshToken.indexOf(e);i>-1&&(this.logger.info("refreshToken removed from tokenKeys map"),r.refreshToken.splice(i,1),this.setTokenKeys(r,n))}getTokenKeys(e=Yt){return Qn(this.clientId,this.browserStorage,e)}setTokenKeys(e,n,r=Yt){if(e.idToken.length===0&&e.accessToken.length===0&&e.refreshToken.length===0){this.removeItem(hs(this.clientId,r));return}else this.setItem(hs(this.clientId,r),JSON.stringify(e),n)}getIdTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeIdToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!FM(i)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),i)}async setIdTokenCredential(e,n,r){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const i=this.generateCredentialKey(e),o=Date.now().toString();e.lastUpdatedAt=o,await this.setUserData(i,JSON.stringify(e),n,o,r);const a=this.getTokenKeys();a.idToken.indexOf(i)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),a.idToken.push(i),this.setTokenKeys(a,n))}getAccessTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeAccessTokenKeys([e],n),null;const i=this.validateAndParseJson(r);return!i||!LT(i)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),i)}async setAccessTokenCredential(e,n,r){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const i=this.generateCredentialKey(e),o=Date.now().toString();e.lastUpdatedAt=o,await this.setUserData(i,JSON.stringify(e),n,o,r);const a=this.getTokenKeys(),s=a.accessToken.indexOf(i);s!==-1&&a.accessToken.splice(s,1),this.logger.trace(`access token ${s===-1?"added to":"updated in"} map`),a.accessToken.push(i),this.setTokenKeys(a,n)}getRefreshTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeRefreshToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!FT(i)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),i)}async setRefreshTokenCredential(e,n,r){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const i=this.generateCredentialKey(e),o=Date.now().toString();e.lastUpdatedAt=o,await this.setUserData(i,JSON.stringify(e),n,o,r);const a=this.getTokenKeys();a.refreshToken.indexOf(i)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),a.refreshToken.push(i),this.setTokenKeys(a,n))}getAppMetadata(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!GM(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),r)}setAppMetadata(e,n){this.logger.trace("BrowserCacheManager.setAppMetadata called");const r=KM(e);this.setItem(r,JSON.stringify(e),n)}getServerTelemetry(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!HM(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),r)}setServerTelemetry(e,n,r){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(n),r)}getAuthorityMetadata(e){const n=this.internalStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return r&&qM(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),r):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(n=>this.isAuthorityMetadata(n))}setWrapperMetadata(e,n){this.internalStorage.setItem(cl.WRAPPER_SKU,e),this.internalStorage.setItem(cl.WRAPPER_VER,n)}getWrapperMetadata(){const e=this.internalStorage.getItem(cl.WRAPPER_SKU)||z.EMPTY_STRING,n=this.internalStorage.getItem(cl.WRAPPER_VER)||z.EMPTY_STRING;return[e,n]}setAuthorityMetadata(e,n){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(n))}getActiveAccount(e){const n=this.generateCacheKey(ST.ACTIVE_ACCOUNT_FILTERS),r=this.browserStorage.getItem(n);if(!r)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters found"),null;const i=this.validateAndParseJson(r);return i?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:i.homeAccountId,localAccountId:i.localAccountId,tenantId:i.tenantId},e)):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e,n){const r=this.generateCacheKey(ST.ACTIVE_ACCOUNT_FILTERS);if(e){this.logger.verbose("setActiveAccount: Active account set");const i={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId,lastUpdatedAt:Tn().toString()};this.setItem(r,JSON.stringify(i),n)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(r);this.eventHandler.emitEvent(de.ACTIVE_ACCOUNT_CHANGED)}getThrottlingCache(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!BM(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),r)}setThrottlingCache(e,n,r){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(n),r)}getTemporaryCache(e,n){const r=n?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const o=this.cookieStorage.getItem(r);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),o}const i=this.temporaryCacheStorage.getItem(r);if(!i){if(this.cacheConfig.cacheLocation===Bt.LocalStorage){const o=this.browserStorage.getItem(r);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),o}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),i}setTemporaryCache(e,n,r){const i=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(i,n),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(i,n,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}clear(e){this.removeAllAccounts(e),this.removeAppMetadata(e),this.temporaryCacheStorage.getKeys().forEach(n=>{(n.indexOf(Vt)!==-1||n.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(n)}),this.browserStorage.getKeys().forEach(n=>{(n.indexOf(Vt)!==-1||n.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(n)}),this.internalStorage.clear()}clearTokensAndKeysWithClaims(e){this.performanceClient.addQueueMeasurement(S.ClearTokensAndKeysWithClaims,e);const n=this.getTokenKeys();let r=0;n.accessToken.forEach(i=>{const o=this.getAccessTokenCredential(i,e);o?.requestedClaimsHash&&i.includes(o.requestedClaimsHash.toLowerCase())&&(this.removeAccessToken(i,e),r++)}),r>0&&this.logger.warning(`${r} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return Pn.startsWith(e,Vt)?e:`${Vt}.${this.clientId}.${e}`}generateCredentialKey(e){const n=e.credentialType===Ut.REFRESH_TOKEN&&e.familyId||e.clientId,r=e.tokenType&&e.tokenType.toLowerCase()!==je.BEARER.toLowerCase()?e.tokenType.toLowerCase():"";return[`${Vt}.${Yt}`,e.homeAccountId,e.environment,e.credentialType,n,e.realm||"",e.target||"",e.requestedClaimsHash||"",r].join(eE).toLowerCase()}generateAccountKey(e){const n=e.homeAccountId.split(".")[1];return[`${Vt}.${Dl}`,e.homeAccountId,e.environment,n||e.tenantId||""].join(eE).toLowerCase()}resetRequestCache(){this.logger.trace("BrowserCacheManager.resetRequestCache called"),this.removeTemporaryItem(this.generateCacheKey(Tt.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(Tt.VERIFIER)),this.removeTemporaryItem(this.generateCacheKey(Tt.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(Tt.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(Tt.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cacheAuthorizeRequest(e,n){this.logger.trace("BrowserCacheManager.cacheAuthorizeRequest called");const r=ou(JSON.stringify(e));if(this.setTemporaryCache(Tt.REQUEST_PARAMS,r,!0),n){const i=ou(n);this.setTemporaryCache(Tt.VERIFIER,i,!0)}}getCachedRequest(){this.logger.trace("BrowserCacheManager.getCachedRequest called");const e=this.getTemporaryCache(Tt.REQUEST_PARAMS,!0);if(!e)throw ae(zI);const n=this.getTemporaryCache(Tt.VERIFIER,!0);let r,i="";try{r=JSON.parse(nn(e)),n&&(i=nn(n))}catch(o){throw this.logger.errorPii(`Attempted to parse: ${e}`),this.logger.error(`Parsing cached token request threw with error: ${o}`),ae(jI)}return[r,i]}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(Tt.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const n=this.validateAndParseJson(e);return n||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){const n=this.getInteractionInProgress()?.clientId;return e?n===this.clientId:!!n}getInteractionInProgress(){const e=`${Vt}.${Tt.INTERACTION_STATUS_KEY}`,n=this.getTemporaryCache(e,!1);try{return n?JSON.parse(n):null}catch{return this.logger.error("Cannot parse interaction status. Removing temporary cache items and clearing url hash. Retrying interaction should fix the error"),this.removeTemporaryItem(e),this.resetRequestCache(),mw(window),null}}setInteractionInProgress(e,n=ki.SIGNIN){const r=`${Vt}.${Tt.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw ae(FI);this.setTemporaryCache(r,JSON.stringify({clientId:this.clientId,type:n}),!1)}else!e&&this.getInteractionInProgress()?.clientId===this.clientId&&this.removeTemporaryItem(r)}async hydrateCache(e,n){const r=kh(e.account?.homeAccountId,e.account?.environment,e.idToken,this.clientId,e.tenantId);let i;n.claims&&(i=await this.cryptoImpl.hashString(n.claims));const o=Ph(e.account?.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?xT(e.expiresOn):0,e.extExpiresOn?xT(e.extExpiresOn):0,nn,void 0,e.tokenType,void 0,n.sshKid,n.claims,i),a={idToken:r,accessToken:o};return this.saveCacheRecord(a,e.correlationId,kr(Ar(e.idToken,nn)),Be.hydrateCache)}async saveCacheRecord(e,n,r,i,o){try{await super.saveCacheRecord(e,n,r,i,o)}catch(a){if(a instanceof us&&this.performanceClient&&n)try{const s=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:s.refreshToken.length,cacheIdCount:s.idToken.length,cacheAtCount:s.accessToken.length},n)}catch{}throw a}}}function aE(t,e,n,r){try{switch(e){case Bt.LocalStorage:return new eU(t,n,r);case Bt.SessionStorage:return new tU;case Bt.MemoryStorage:default:break}}catch(i){n.error(i)}return new Hh}const nU=(t,e,n,r)=>{const i={cacheLocation:Bt.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:Bt.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new em(t,i,Fd,e,n,r)};function rU(t,e,n,r,i){return t.verbose("getAllAccounts called"),n?e.getAllAccounts(i||{},r):[]}function iU(t,e,n,r){const i=n.getAccountInfoFilteredBy(t,r);return i?(e.verbose("getAccount: Account matching provided filter found, returning"),i):(e.verbose("getAccount: No matching account found, returning null"),null)}function oU(t,e,n,r){if(e.trace("getAccountByUsername called"),!t)return e.warning("getAccountByUsername: No username provided"),null;const i=n.getAccountInfoFilteredBy({username:t},r);return i?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${t}`),i):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function aU(t,e,n,r){if(e.trace("getAccountByHomeId called"),!t)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const i=n.getAccountInfoFilteredBy({homeAccountId:t},r);return i?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${t}`),i):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function sU(t,e,n,r){if(e.trace("getAccountByLocalId called"),!t)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const i=n.getAccountInfoFilteredBy({localAccountId:t},r);return i?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${t}`),i):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function cU(t,e,n){e.setActiveAccount(t,n)}function uU(t,e){return t.getActiveAccount(e)}const lU="msal.broadcast.event";class dU{constructor(e){this.eventCallbacks=new Map,this.logger=e||new ai({}),typeof BroadcastChannel<"u"&&(this.broadcastChannel=new BroadcastChannel(lU)),this.invokeCrossTabCallbacks=this.invokeCrossTabCallbacks.bind(this)}addEventCallback(e,n,r){if(typeof window<"u"){const i=r||Kx();return this.eventCallbacks.has(i)?(this.logger.error(`Event callback with id: ${i} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(i,[e,n||[]]),this.logger.verbose(`Event callback registered with id: ${i}`),i)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,n,r,i){const o={eventType:e,interactionType:n||null,payload:r||null,error:i||null,timestamp:Date.now()};switch(e){case de.ACCOUNT_ADDED:case de.ACCOUNT_REMOVED:case de.ACTIVE_ACCOUNT_CHANGED:this.broadcastChannel?.postMessage(o);break;default:this.invokeCallbacks(o);break}}invokeCallbacks(e){this.eventCallbacks.forEach(([n,r],i)=>{(r.length===0||r.includes(e.eventType))&&(this.logger.verbose(`Emitting event to callback ${i}: ${e.eventType}`),n.apply(null,[e]))})}invokeCrossTabCallbacks(e){const n=e.data;this.invokeCallbacks(n)}subscribeCrossTab(){this.broadcastChannel?.addEventListener("message",this.invokeCrossTabCallbacks)}unsubscribeCrossTab(){this.broadcastChannel?.removeEventListener("message",this.invokeCrossTabCallbacks)}}class Sw{constructor(e,n,r,i,o,a,s,c,u){this.config=e,this.browserStorage=n,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=o,this.navigationClient=a,this.platformAuthProvider=c,this.correlationId=u||cr(),this.logger=i.clone(fn.MSAL_SKU,Jo,this.correlationId),this.performanceClient=s}async clearCacheOnLogout(e,n){if(n)try{this.browserStorage.removeAccount(n,e),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch{this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),this.browserStorage.clear(e),await this.browserCrypto.clearKeystore()}catch{this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const n=e||this.config.auth.redirectUri;return Ye.getAbsoluteUrl(n,Yr())}initializeServerTelemetryManager(e,n){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:n||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new ru(r,this.browserStorage)}async getDiscoveredAuthority(e){const{account:n}=e,r=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(S.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const i={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},o=e.requestAuthority||this.config.auth.authority,a=r?.length?r==="true":this.config.auth.instanceAware,s=n&&a?this.config.auth.authority.replace(Ye.getDomainFromUrl(o),n.environment):o,c=jt.generateAuthority(s,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),u=await G(AI,S.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(c,this.config.system.networkClient,this.browserStorage,i,this.logger,this.correlationId,this.performanceClient);if(n&&!u.isAlias(n.environment))throw We(ZA);return u}}async function iy(t,e,n,r){n.addQueueMeasurement(S.InitializeBaseRequest,t.correlationId);const i=t.authority||e.auth.authority,o=[...t&&t.scopes||[]],a={...t,correlationId:t.correlationId,authority:i,scopes:o};if(!a.authenticationScheme)a.authenticationScheme=je.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(a.authenticationScheme===je.SSH){if(!t.sshJwk)throw We(Ah);if(!t.sshKid)throw We(WA)}r.verbose(`Authentication Scheme set to "${a.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&t.claims&&!Pn.isEmptyObj(t.claims)&&(a.requestedClaimsHash=await gw(t.claims)),a}async function hU(t,e,n,r,i){r.addQueueMeasurement(S.InitializeSilentRequest,t.correlationId);const o=await G(iy,S.InitializeBaseRequest,i,r,t.correlationId)(t,n,r,i);return{...t,...o,account:e,forceRefresh:t.forceRefresh||!1}}function Aw(t,e){let n;const r=t.httpMethod;if(e===mn.EAR){if(n=r||bo.POST,n!==bo.POST)throw We(eI)}else n=r||bo.GET;if(t.authorizePostBodyParameters&&n!==bo.POST)throw We(tI);return n}class Ps extends Sw{initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e?.correlationId);const n={correlationId:this.correlationId||cr(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const r=this.getLogoutHintFromIdTokenClaims(e.account);r&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),n.logoutHint=r)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return!e||e.postLogoutRedirectUri!==null?e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",n.correlationId),n.postLogoutRedirectUri=Ye.getAbsoluteUrl(e.postLogoutRedirectUri,Yr())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",n.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",n.correlationId),n.postLogoutRedirectUri=Ye.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,Yr())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",n.correlationId),n.postLogoutRedirectUri=Ye.getAbsoluteUrl(Yr(),Yr())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",n.correlationId),n}getLogoutHintFromIdTokenClaims(e){const n=e.idTokenClaims;if(n){if(n.login_hint)return n.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(S.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const n=await G(this.getClientConfiguration.bind(this),S.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new bI(n,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:n,requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:o,account:a}=e;this.performanceClient.addQueueMeasurement(S.StandardInteractionClientGetClientConfiguration,this.correlationId);const s=e.authority||await G(this.getDiscoveredAuthority.bind(this),S.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:o,account:a}),c=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:s,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:c.loggerCallback,piiLoggingEnabled:c.piiLoggingEnabled,logLevel:c.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:n,libraryInfo:{sku:fn.MSAL_SKU,version:Jo,cpu:z.EMPTY_STRING,os:z.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,n){this.performanceClient.addQueueMeasurement(S.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),i={interactionType:n},o=bs.setRequestState(this.browserCrypto,e&&e.state||z.EMPTY_STRING,i),s={...await G(iy,S.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:o,nonce:e.nonce||cr(),responseMode:this.config.auth.OIDCOptions.serverResponseType},c={...s,httpMethod:Aw(s,this.config.auth.protocolMode)};if(e.loginHint||e.sid)return c;const u=e.account||this.browserStorage.getActiveAccount(this.correlationId);return u&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${u.homeAccountId}`,this.correlationId),c.account=u),c}}function fU(t,e){if(!e)return null;try{return bs.parseRequestState(t,e).libraryState.meta}catch{throw J(Es)}}function xc(t,e,n){const r=Bd(t);if(!r)throw iI(t)?(n.error(`A ${e} is present in the iframe but it does not contain known properties. It's likely that the ${e} has been replaced by code running on the redirectUri page.`),n.errorPii(`The ${e} detected is: ${t}`),ae(xI)):(n.error(`The request has returned to the redirectUri but a ${e} is not present. It's likely that the ${e} has been removed or the page has been redirected by code running on the redirectUri page.`),ae(MI));return r}function pU(t,e,n){if(!t.state)throw ae($v);const r=fU(e,t.state);if(!r)throw ae(UI);if(r.interactionType!==n)throw ae(LI)}class Iw{constructor(e,n,r,i,o){this.authModule=e,this.browserStorage=n,this.authCodeRequest=r,this.logger=i,this.performanceClient=o}async handleCodeResponse(e,n,r){this.performanceClient.addQueueMeasurement(S.HandleCodeResponse,n.correlationId);let i;try{i=ix(e,n.state)}catch(o){throw o instanceof ga&&o.subError===iu?ae(iu):o}return G(this.handleCodeResponseFromServer.bind(this),S.HandleCodeResponseFromServer,this.logger,this.performanceClient,n.correlationId)(i,n,r)}async handleCodeResponseFromServer(e,n,r,i=!0){if(this.performanceClient.addQueueMeasurement(S.HandleCodeResponseFromServer,n.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await G(this.authModule.updateAuthority.bind(this.authModule),S.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,n.correlationId)(e.cloud_instance_host_name,n.correlationId),i&&(e.nonce=n.nonce||void 0),e.state=n.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const a=this.createCcsCredentials(n);a&&(this.authCodeRequest.ccsCredential=a)}return await G(this.authModule.acquireToken.bind(this.authModule),S.AuthClientAcquireToken,this.logger,this.performanceClient,n.correlationId)(this.authCodeRequest,r,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:nr.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:nr.UPN}:null}}const gU="ContentError",mU="PageException",ww="user_switch";const vU="USER_INTERACTION_REQUIRED",yU="USER_CANCEL",CU="NO_NETWORK",TU="DISABLED",EU="ACCOUNT_UNAVAILABLE",_U="UX_NOT_ALLOWED";const SU=-2147186943,AU={[ww]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class Tr extends Xe{constructor(e,n,r){super(e,n),Object.setPrototypeOf(this,Tr.prototype),this.name="NativeAuthError",this.ext=r}}function Ga(t){if(t.ext&&t.ext.status&&t.ext.status===TU||t.ext&&t.ext.error&&t.ext.error===SU)return!0;switch(t.errorCode){case gU:case mU:return!0;default:return!1}}function Xd(t,e,n){if(n&&n.status)switch(n.status){case EU:return Vd(II);case vU:return new sr(t,e);case yU:return ae(iu);case CU:return ae(Qd);case _U:return Vd(Lv)}return new Tr(t,AU[t]||e,n)}class Rw extends Ps{async acquireToken(e){this.performanceClient.addQueueMeasurement(S.SilentCacheClientAcquireToken,e.correlationId);const n=this.initializeServerTelemetryManager(Be.acquireTokenSilent_silentFlow),r=await G(this.getClientConfiguration.bind(this),S.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),i=new tx(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const a=(await G(i.acquireCachedToken.bind(i),S.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),a}catch(o){throw o instanceof Tu&&o.errorCode===Yv&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),o}}logout(e){this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(n.correlationId,n?.account)}}class xl extends Sw{constructor(e,n,r,i,o,a,s,c,u,l,d,p){super(e,n,r,i,o,a,c,u,p),this.apiId=s,this.accountId=l,this.platformAuthProvider=u,this.nativeStorageManager=d,this.silentCacheClient=new Rw(e,this.nativeStorageManager,r,i,o,a,c,u,p);const h=this.platformAuthProvider.getExtensionName();this.skus=ru.makeExtraSkuString({libraryName:fn.MSAL_SKU,libraryVersion:Jo,extensionName:h,extensionVersion:this.platformAuthProvider.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[vM]:this.skus}}async acquireToken(e,n){this.performanceClient.addQueueMeasurement(S.NativeInteractionClientAcquireToken,this.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const r=this.performanceClient.startMeasurement(S.NativeInteractionClientAcquireToken,this.correlationId),i=Tn(),o=this.initializeServerTelemetryManager(this.apiId);try{const a=await this.initializeNativeRequest(e);try{const c=await this.acquireTokensFromCache(this.accountId,a);return r.end({success:!0,isNativeBroker:!1,fromCache:!0}),c}catch(c){if(n===Zt.AccessToken)throw this.logger.info("MSAL internal Cache does not contain tokens, return error as per cache policy"),r.end({success:!1,brokerErrorCode:"cache_request_failed"}),c;this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const s=await this.platformAuthProvider.sendMessage(a);return await this.handleNativeResponse(s,a,i).then(c=>(r.end({success:!0,isNativeBroker:!0,requestId:c.requestId}),o.clearNativeBrokerErrorCode(),c)).catch(c=>{throw r.end({success:!1,errorCode:c.errorCode,subErrorCode:c.subError}),c})}catch(a){throw a instanceof Tr&&o.setNativeBrokerErrorCode(a.errorCode),r.end({success:!1}),a}}createSilentCacheRequest(e,n){return{authority:e.authority,correlationId:this.correlationId,scopes:kt.fromString(e.scope).asArray(),account:n,forceRefresh:!1}}async acquireTokensFromCache(e,n){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),J($g);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e},this.correlationId);if(!r)throw J($g);try{const i=this.createSilentCacheRequest(n,r),o=await this.silentCacheClient.acquireToken(i),a={...r,idTokenClaims:o?.idTokenClaims,idToken:o?.idToken};return{...o,account:a}}catch(i){throw i}}async acquireTokenRedirect(e,n){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...r}=e;delete r.onRedirectNavigate;const i=await this.initializeNativeRequest(r);try{await this.platformAuthProvider.sendMessage(i)}catch(s){if(s instanceof Tr&&(this.initializeServerTelemetryManager(this.apiId).setNativeBrokerErrorCode(s.errorCode),Ga(s)))throw s}this.browserStorage.setTemporaryCache(Tt.NATIVE_REQUEST,JSON.stringify(i),!0);const o={apiId:Be.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},a=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);n.end({success:!0}),await this.navigationClient.navigateExternal(a,o)}async handleRedirectPromise(e,n){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const r=this.browserStorage.getCachedNativeRequest();if(!r)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&n&&e?.addFields({errorCode:"no_cached_request"},n),null;const{prompt:i,...o}=r;i&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(Tt.NATIVE_REQUEST));const a=Tn();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const s=await this.platformAuthProvider.sendMessage(o),c=await this.handleNativeResponse(s,o,a);return this.initializeServerTelemetryManager(this.apiId).clearNativeBrokerErrorCode(),e&&this.correlationId&&this.performanceClient.addFields({isNativeBroker:!0},this.correlationId),c}catch(s){throw s}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,n,r){this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const i=Ar(e.id_token,nn),o=this.createHomeAccountIdentifier(e,i),a=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:n.accountId},this.correlationId)?.homeAccountId;if(n.extraParameters?.child_client_id&&e.account.id!==n.accountId)this.logger.info("handleNativeServerResponse: Double broker flow detected, ignoring accountId mismatch");else if(o!==a&&e.account.id!==n.accountId)throw Xd(ww);const s=await this.getDiscoveredAuthority({requestAuthority:n.authority}),c=Fv(this.browserStorage,s,o,nn,this.correlationId,i,e.client_info,void 0,i.tid,void 0,e.account.id,this.logger);e.expires_in=Number(e.expires_in);const u=await this.generateAuthenticationResult(e,n,i,c,s.canonicalAuthority,r);return await this.cacheAccount(c,this.correlationId,kr(i)),await this.cacheNativeTokens(e,n,o,i,e.access_token,u.tenantId,r),u}createHomeAccountIdentifier(e,n){return lt.generateHomeAccountId(e.client_info||z.EMPTY_STRING,Xn.Default,this.logger,this.browserCrypto,n)}generateScopes(e,n){return n?kt.fromString(n):kt.fromString(e)}async generatePopAccessToken(e,n){if(n.tokenType===je.POP&&n.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new _s(this.browserCrypto),i={resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,shrNonce:n.shrNonce};if(!n.keyId)throw J(hv);return r.signPopToken(e.access_token,n.keyId,i)}else return e.access_token}async generateAuthenticationResult(e,n,r,i,o,a){const s=this.addTelemetryFromNativeResponse(e.properties.MATS),c=this.generateScopes(n.scope,e.scope),u=e.account.properties||{},l=u.UID||r.oid||r.sub||z.EMPTY_STRING,d=u.TenantId||r.tid||z.EMPTY_STRING,p=Tv(lt.getAccountInfo(i),void 0,r,e.id_token);p.nativeAccountId!==e.account.id&&(p.nativeAccountId=e.account.id);const h=await this.generatePopAccessToken(e,n),f=n.tokenType===je.POP?je.POP:je.BEARER;return{authority:o,uniqueId:l,tenantId:d,scopes:c.asArray(),account:p,idToken:e.id_token,idTokenClaims:r,accessToken:h,fromCache:s?this.isResponseFromCache(s):!1,expiresOn:ls(a+e.expires_in),tokenType:f,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}async cacheAccount(e,n,r){await this.browserStorage.setAccount(e,this.correlationId,r,this.apiId),this.browserStorage.removeAccountContext(lt.getAccountInfo(e),n)}cacheNativeTokens(e,n,r,i,o,a,s){const c=kh(r,n.authority,e.id_token||"",n.clientId,i.tid||""),u=n.tokenType===je.POP?z.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,l=s+u,d=this.generateScopes(e.scope,n.scope),p=Ph(r,n.authority,o,n.clientId,i.tid||a,d.printScopes(),l,0,nn,void 0,n.tokenType,void 0,n.keyId),h={idToken:c,accessToken:p};return this.nativeStorageManager.saveCacheRecord(h,this.correlationId,kr(i),this.apiId,n.storeInCache)}getExpiresInValue(e,n){return e===je.POP?z.SHR_NONCE_VALIDITY:(typeof n=="string"?parseInt(n,10):n)||0}addTelemetryFromNativeResponse(e){const n=this.getMATSFromResponse(e);return n?(this.performanceClient.addFields({extensionId:this.platformAuthProvider.getExtensionId(),extensionVersion:this.platformAuthProvider.getExtensionVersion(),matsBrokerVersion:n.broker_version,matsAccountJoinOnStart:n.account_join_on_start,matsAccountJoinOnEnd:n.account_join_on_end,matsDeviceJoin:n.device_join,matsPromptBehavior:n.prompt_behavior,matsApiErrorCode:n.api_error_code,matsUiVisible:n.ui_visible,matsSilentCode:n.silent_code,matsSilentBiSubCode:n.silent_bi_sub_code,matsSilentMessage:n.silent_message,matsSilentStatus:n.silent_status,matsHttpStatus:n.http_status,matsHttpEventCount:n.http_event_count},this.correlationId),n):null}getMATSFromResponse(e){if(e)try{return JSON.parse(e)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return typeof e.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const n=await this.getCanonicalAuthority(e),{scopes:r,...i}=e,o=new kt(r||[]);o.appendScopes(Rs);const a={...i,accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:o.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:this.getPrompt(e.prompt),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(a.signPopToken&&e.popKid)throw ae(ow);if(this.handleExtraBrokerParams(a),a.extraParameters=a.extraParameters||{},a.extraParameters.telemetry=Hn.MATS_TELEMETRY,e.authenticationScheme===je.POP){const s={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},c=new _s(this.browserCrypto);let u;if(a.keyId)u=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:a.keyId})),a.signPopToken=!1;else{const l=await G(c.generateCnf.bind(c),S.PopTokenGenerateCnf,this.logger,this.performanceClient,this.correlationId)(s,this.logger);u=l.reqCnfString,a.keyId=l.kid,a.signPopToken=!0}a.reqCnf=u}return this.addRequestSKUs(a),a}async getCanonicalAuthority(e){const n=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:n,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const r=new Ye(n);return r.validateAsUri(),r}getPrompt(e){switch(this.apiId){case Be.ssoSilent:case Be.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),Ht.NONE}if(!e){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e){case Ht.NONE:case Ht.CONSENT:case Ht.LOGIN:case Ht.SELECT_ACCOUNT:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e} is not compatible with native flow`),ae(rw)}}handleExtraBrokerParams(e){const n=e.extraParameters&&e.extraParameters.hasOwnProperty(qd)&&e.extraParameters.hasOwnProperty($d)&&e.extraParameters.hasOwnProperty(Qo);if(!e.embeddedClientId&&!n)return;let r="";const i=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,r=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[$d],r=e.extraParameters[Qo]),e.extraParameters={child_client_id:r,child_redirect_uri:i},this.performanceClient?.addFields({embeddedClientId:r,embeddedRedirectUri:i},this.correlationId)}}async function oy(t,e,n,r,i){const o=rx({...t.auth,authority:e},n,r,i);if(Pv(o,{sku:fn.MSAL_SKU,version:Jo,os:"",cpu:""}),t.auth.protocolMode!==mn.OIDC&&Nv(o,t.telemetry.application),n.platformBroker&&(EM(o),i.addFields({isPlatformAuthorizeRequest:!0},n.correlationId),n.authenticationScheme===je.POP)){const a=new si(r,i),s=new _s(a);let c;n.popKid?c=a.encodeKid(n.popKid):c=(await G(s.generateCnf.bind(s),S.PopTokenGenerateCnf,r,i,n.correlationId)(n,r)).reqCnfString,Mv(o,c)}return wh(o,n.correlationId,i),o}async function ay(t,e,n,r,i){if(!n.codeChallenge)throw We(vv);const o=await G(oy,S.GetStandardParams,r,i,n.correlationId)(t,e,n,r,i);return Av(o,ov.CODE),Ov(o,n.codeChallenge,z.S256_CODE_CHALLENGE_METHOD),qi(o,n.extraQueryParameters||{}),Hv(e,o,t.auth.encodeExtraQueryParams,n.extraQueryParameters)}async function sy(t,e,n,r,i,o){if(!r.earJwk)throw ae(qv);const a=await oy(e,n,r,i,o);Av(a,ov.IDTOKEN_TOKEN_REFRESHTOKEN),OM(a,r.earJwk),Ov(a,r.codeChallenge,z.S256_CODE_CHALLENGE_METHOD);const s=new Map;qi(s,r.extraQueryParameters||{});const c=Hv(n,s,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return bw(t,c,a)}async function cy(t,e,n,r,i,o){const a=await oy(e,n,r,i,o);Av(a,ov.CODE),Ov(a,r.codeChallenge,r.codeChallengeMethod||z.S256_CODE_CHALLENGE_METHOD),DM(a,r.authorizePostBodyParameters||{});const s=new Map;qi(s,r.extraQueryParameters||{});const c=Hv(n,s,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return bw(t,c,a)}function bw(t,e,n){const r=t.createElement("form");return r.method="post",r.action=e,n.forEach((i,o)=>{const a=t.createElement("input");a.hidden=!0,a.name=o,a.value=i,r.appendChild(a)}),t.body.appendChild(r),r}async function kw(t,e,n,r,i,o,a,s,c,u){if(s.verbose("Account id found, calling WAM for token"),!u)throw ae(jv);const l=new si(s,c),d=new xl(r,i,l,s,a,r.system.navigationClient,n,c,u,e,o,t.correlationId),{userRequestState:p}=bs.parseRequestState(l,t.state);return G(d.acquireToken.bind(d),S.NativeInteractionClientAcquireToken,s,c,t.correlationId)({...t,state:p,prompt:void 0})}async function fs(t,e,n,r,i,o,a,s,c,u,l,d){if(Cr.removeThrottle(a,i.auth.clientId,t),e.accountId)return G(kw,S.HandleResponsePlatformBroker,u,l,t.correlationId)(t,e.accountId,r,i,a,s,c,u,l,d);const p={...t,code:e.code||"",codeVerifier:n},h=new Iw(o,a,p,u,l);return await G(h.handleCodeResponse.bind(h),S.HandleCodeResponse,u,l,t.correlationId)(e,t,r)}async function uy(t,e,n,r,i,o,a,s,c,u,l){if(Cr.removeThrottle(o,r.auth.clientId,t),kI(e,t.state),!e.ear_jwe)throw ae(DI);if(!t.earJwk)throw ae(qv);const d=JSON.parse(await G(Dx,S.DecryptEarResponse,c,u,t.correlationId)(t.earJwk,e.ear_jwe));if(d.accountId)return G(kw,S.HandleResponsePlatformBroker,c,u,t.correlationId)(t,d.accountId,n,r,o,a,s,c,u,l);const p=new Wo(r.auth.clientId,o,new si(c,u),c,null,null,u);p.validateTokenResponse(d);const h={code:"",state:t.state,nonce:t.nonce,client_info:d.client_info,cloud_graph_host_name:d.cloud_graph_host_name,cloud_instance_host_name:d.cloud_instance_host_name,cloud_instance_name:d.cloud_instance_name,msgraph_host:d.msgraph_host};return await G(p.handleServerTokenResponse.bind(p),S.HandleServerTokenResponse,c,u,t.correlationId)(d,i,Tn(),t,n,h,void 0,void 0,void 0,void 0)}const IU=32;async function Zo(t,e,n){t.addQueueMeasurement(S.GeneratePkceCodes,n);const r=Nn(wU,S.GenerateCodeVerifier,e,t,n)(t,e,n),i=await G(RU,S.GenerateCodeChallengeFromVerifier,e,t,n)(r,t,e,n);return{verifier:r,challenge:i}}function wU(t,e,n){try{const r=new Uint8Array(IU);return Nn(bx,S.GetRandomValues,e,t,n)(r),Qi(r)}catch{throw ae(Gv)}}async function RU(t,e,n,r){e.addQueueMeasurement(S.GenerateCodeChallengeFromVerifier,r);try{const i=await G(hw,S.Sha256Digest,n,e,r)(t,e,r);return Qi(new Uint8Array(i))}catch{throw ae(Gv)}}class Zd{constructor(e,n,r,i){this.logger=e,this.handshakeTimeoutMs=n,this.extensionId=i,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=r,this.handshakeEvent=r.startMeasurement(S.NativeMessageHandlerHandshake),this.platformAuthType=Hn.PLATFORM_EXTENSION_PROVIDER}async sendMessage(e){this.logger.trace(this.platformAuthType+" - sendMessage called.");const n={method:uc.GetToken,request:e},r={channel:Hn.CHANNEL_ID,extensionId:this.extensionId,responseId:cr(),body:n};this.logger.trace(this.platformAuthType+" - Sending request to browser extension"),this.logger.tracePii(this.platformAuthType+` - Sending request to browser extension: ${JSON.stringify(r)}`),this.messageChannel.port1.postMessage(r);const i=await new Promise((a,s)=>{this.resolvers.set(r.responseId,{resolve:a,reject:s})});return this.validatePlatformBrokerResponse(i)}static async createProvider(e,n,r){e.trace("PlatformAuthExtensionHandler - createProvider called.");try{const i=new Zd(e,n,r,Hn.PREFERRED_EXTENSION_ID);return await i.sendHandshakeRequest(),i}catch{const o=new Zd(e,n,r);return await o.sendHandshakeRequest(),o}}async sendHandshakeRequest(){this.logger.trace(this.platformAuthType+" - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:Hn.CHANNEL_ID,extensionId:this.extensionId,responseId:cr(),body:{method:uc.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=n=>{this.onChannelMessage(n)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((n,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:n,reject:r}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),r(ae(tw)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace(this.platformAuthType+" - onWindowMessage called"),e.source!==window)return;const n=e.data;if(!(!n.channel||n.channel!==Hn.CHANNEL_ID)&&!(n.extensionId&&n.extensionId!==this.extensionId)&&n.body.method===uc.HandshakeRequest){const r=this.handshakeResolvers.get(n.responseId);if(!r){this.logger.trace(this.platformAuthType+`.onWindowMessage - resolver can't be found for request ${n.responseId}`);return}this.logger.verbose(n.extensionId?`Extension with id: ${n.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),r.reject(ae(nw))}}onChannelMessage(e){this.logger.trace(this.platformAuthType+" - onChannelMessage called.");const n=e.data,r=this.resolvers.get(n.responseId),i=this.handshakeResolvers.get(n.responseId);try{const o=n.body.method;if(o===uc.Response){if(!r)return;const a=n.body.response;if(this.logger.trace(this.platformAuthType+" - Received response from browser extension"),this.logger.tracePii(this.platformAuthType+` - Received response from browser extension: ${JSON.stringify(a)}`),a.status!=="Success")r.reject(Xd(a.code,a.description,a.ext));else if(a.result)a.result.code&&a.result.description?r.reject(Xd(a.result.code,a.result.description,a.result.ext)):r.resolve(a.result);else throw Kg(Ld,"Event does not contain result.");this.resolvers.delete(n.responseId)}else if(o===uc.HandshakeResponse){if(!i){this.logger.trace(this.platformAuthType+`.onChannelMessage - resolver can't be found for request ${n.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=n.extensionId,this.extensionVersion=n.body.version,this.logger.verbose(this.platformAuthType+` - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),i.resolve(),this.handshakeResolvers.delete(n.responseId)}}catch(o){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${o}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(o):i&&i.reject(o)}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw Kg(Ld,"Response missing expected properties.")}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}getExtensionName(){return this.getExtensionId()===Hn.PREFERRED_EXTENSION_ID?"chrome":this.getExtensionId()?.length?"unknown":void 0}}class ly{constructor(e,n,r){this.logger=e,this.performanceClient=n,this.correlationId=r,this.platformAuthType=Hn.PLATFORM_DOM_PROVIDER}static async createProvider(e,n,r){if(e.trace("PlatformAuthDOMHandler: createProvider called"),window.navigator?.platformAuthentication&&(await window.navigator.platformAuthentication.getSupportedContracts(Hn.MICROSOFT_ENTRA_BROKERID))?.includes(Hn.PLATFORM_DOM_APIS))return e.trace("Platform auth api available in DOM"),new ly(e,n,r)}getExtensionId(){return Hn.MICROSOFT_ENTRA_BROKERID}getExtensionVersion(){return""}getExtensionName(){return Hn.DOM_API_NAME}async sendMessage(e){this.logger.trace(this.platformAuthType+" - Sending request to browser DOM API");try{const n=this.initializePlatformDOMRequest(e),r=await window.navigator.platformAuthentication.executeGetToken(n);return this.validatePlatformBrokerResponse(r)}catch(n){throw this.logger.error(this.platformAuthType+" - executeGetToken DOM API error"),n}}initializePlatformDOMRequest(e){this.logger.trace(this.platformAuthType+" - initializeNativeDOMRequest called");const{accountId:n,clientId:r,authority:i,scope:o,redirectUri:a,correlationId:s,state:c,storeInCache:u,embeddedClientId:l,extraParameters:d,...p}=e,h=this.getDOMExtraParams(p);return{accountId:n,brokerId:this.getExtensionId(),authority:i,clientId:r,correlationId:s||this.correlationId,extraParameters:{...d,...h},isSecurityTokenService:!1,redirectUri:a,scope:o,state:c,storeInCache:u,embeddedClientId:l}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("isSuccess")){if(e.hasOwnProperty("accessToken")&&e.hasOwnProperty("idToken")&&e.hasOwnProperty("clientInfo")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scopes")&&e.hasOwnProperty("expiresIn"))return this.logger.trace(this.platformAuthType+" - platform broker returned successful and valid response"),this.convertToPlatformBrokerResponse(e);if(e.hasOwnProperty("error")){const n=e;if(n.isSuccess===!1&&n.error&&n.error.code)throw this.logger.trace(this.platformAuthType+" - platform broker returned error response"),Xd(n.error.code,n.error.description,{error:parseInt(n.error.errorCode),protocol_error:n.error.protocolError,status:n.error.status,properties:n.error.properties})}}throw Kg(Ld,"Response missing expected properties.")}convertToPlatformBrokerResponse(e){return this.logger.trace(this.platformAuthType+" - convertToNativeResponse called"),{access_token:e.accessToken,id_token:e.idToken,client_info:e.clientInfo,account:e.account,expires_in:e.expiresIn,scope:e.scopes,state:e.state||"",properties:e.properties||{},extendedLifetimeToken:e.extendedLifetimeToken??!1,shr:e.proofOfPossessionPayload}}getDOMExtraParams(e){return{...Object.entries(e).reduce((i,[o,a])=>(i[o]=String(a),i),{})}}}async function bU(t,e,n,r,i){t.trace("getPlatformAuthProvider called",n),t.trace("Has client allowed platform auth via DOM API: "+i);let o;try{i&&(o=await ly.createProvider(t,e,n)),o||(t.trace("Platform auth via DOM API not available, checking for extension"),o=await Zd.createProvider(t,r||Tw,e))}catch(a){t.trace("Platform auth not available",a)}return o}function au(t,e,n,r){if(e.trace("isPlatformAuthAllowed called"),!t.system.allowPlatformBroker&&t.system.allowPlatformBrokerWithDOM)throw We(nI);if(!t.system.allowPlatformBroker)return e.trace("isPlatformAuthAllowed: allowPlatformBroker is not enabled, returning false"),!1;if(!n)return e.trace("isPlatformAuthAllowed: Platform auth provider is not initialized, returning false"),!1;if(r)switch(r){case je.BEARER:case je.POP:return e.trace("isPlatformAuthAllowed: authenticationScheme is supported, returning true"),!0;default:return e.trace("isPlatformAuthAllowed: authenticationScheme is not supported, returning false"),!1}return!0}class kU extends Ps{constructor(e,n,r,i,o,a,s,c,u,l){super(e,n,r,i,o,a,s,u,l),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=c,this.eventHandler=o}acquireToken(e,n){let r;try{if(r={popupName:this.generatePopupName(e.scopes||Rs,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window},this.performanceClient.addFields({isAsyncPopup:this.config.system.asyncPopups},this.correlationId),this.config.system.asyncPopups)return this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,r,n);{const o={...e,httpMethod:Aw(e,this.config.auth.protocolMode)};return this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),r.popup=this.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(o,r,n)}}catch(i){return Promise.reject(i)}}logout(e){try{this.logger.verbose("logoutPopup called");const n=this.initializeLogoutRequest(e),r={popupName:this.generateLogoutPopupName(n),popupWindowAttributes:e?.popupWindowAttributes||{},popupWindowParent:e?.popupWindowParent??window},i=e&&e.authority,o=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(n,r,i,o)):(this.logger.verbose("asyncPopup set to false, opening popup"),r.popup=this.openSizedPopup("about:blank",r),this.logoutPopupAsync(n,r,i,o))}catch(n){return Promise.reject(n)}}async acquireTokenPopupAsync(e,n,r){this.logger.verbose("acquireTokenPopupAsync called");const i=await G(this.initializeAuthorizationRequest.bind(this),S.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,Te.Popup);n.popup&&Cw(i.authority);const o=au(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);return i.platformBroker=o,this.config.auth.protocolMode===mn.EAR?this.executeEarFlow(i,n,r):this.executeCodeFlow(i,n,r)}async executeCodeFlow(e,n,r){const i=e.correlationId,o=this.initializeServerTelemetryManager(Be.acquireTokenPopup),a=r||await G(Zo,S.GeneratePkceCodes,this.logger,this.performanceClient,i)(this.performanceClient,this.logger,i),s={...e,codeChallenge:a.challenge};try{const c=await G(this.createAuthCodeClient.bind(this),S.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,i)({serverTelemetryManager:o,requestAuthority:s.authority,requestAzureCloudOptions:s.azureCloudOptions,requestExtraQueryParameters:s.extraQueryParameters,account:s.account});if(s.httpMethod===bo.POST)return await this.executeCodeFlowWithPost(s,n,c,a.verifier);{const u=await G(ay,S.GetAuthCodeUrl,this.logger,this.performanceClient,i)(this.config,c.authority,s,this.logger,this.performanceClient),l=this.initiateAuthRequest(u,n);this.eventHandler.emitEvent(de.POPUP_OPENED,Te.Popup,{popupWindow:l},null);const d=await this.monitorPopupForHash(l,n.popupWindowParent),p=Nn(xc,S.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(d,this.config.auth.OIDCOptions.serverResponseType,this.logger);return await G(fs,S.HandleResponseCode,this.logger,this.performanceClient,i)(e,p,a.verifier,Be.acquireTokenPopup,this.config,c,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}catch(c){throw n.popup?.close(),c instanceof Xe&&(c.setCorrelationId(this.correlationId),o.cacheFailedRequest(c)),c}}async executeEarFlow(e,n,r){const i=e.correlationId,o=await G(this.getDiscoveredAuthority.bind(this),S.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,i)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),a=await G(Xv,S.GenerateEarKey,this.logger,this.performanceClient,i)(),s=r||await G(Zo,S.GeneratePkceCodes,this.logger,this.performanceClient,i)(this.performanceClient,this.logger,i),c={...e,earJwk:a,codeChallenge:s.challenge},u=n.popup||this.openPopup("about:blank",n);(await sy(u.document,this.config,o,c,this.logger,this.performanceClient)).submit();const d=await G(this.monitorPopupForHash.bind(this),S.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,i)(u,n.popupWindowParent),p=Nn(xc,S.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(d,this.config.auth.OIDCOptions.serverResponseType,this.logger);if(!p.ear_jwe&&p.code){const h=await G(this.createAuthCodeClient.bind(this),S.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,i)({serverTelemetryManager:this.initializeServerTelemetryManager(Be.acquireTokenPopup),requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account,authority:o});return G(fs,S.HandleResponseCode,this.logger,this.performanceClient,i)(c,p,s.verifier,Be.acquireTokenPopup,this.config,h,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}else return G(uy,S.HandleResponseEar,this.logger,this.performanceClient,i)(c,p,Be.acquireTokenPopup,this.config,o,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async executeCodeFlowWithPost(e,n,r,i){const o=e.correlationId,a=await G(this.getDiscoveredAuthority.bind(this),S.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,o)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),s=n.popup||this.openPopup("about:blank",n);(await cy(s.document,this.config,a,e,this.logger,this.performanceClient)).submit();const u=await G(this.monitorPopupForHash.bind(this),S.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,o)(s,n.popupWindowParent),l=Nn(xc,S.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return G(fs,S.HandleResponseCode,this.logger,this.performanceClient,o)(e,l,i,Be.acquireTokenPopup,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async logoutPopupAsync(e,n,r,i){this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(de.LOGOUT_START,Te.Popup,e);const o=this.initializeServerTelemetryManager(Be.logoutPopup);try{await this.clearCacheOnLogout(this.correlationId,e.account);const a=await G(this.createAuthCodeClient.bind(this),S.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:o,requestAuthority:r,account:e.account||void 0});try{a.authority.endSessionEndpoint}catch{if(e.account?.homeAccountId&&e.postLogoutRedirectUri&&a.authority.protocolMode===mn.OIDC){if(this.eventHandler.emitEvent(de.LOGOUT_SUCCESS,Te.Popup,e),i){const u={apiId:Be.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},l=Ye.getAbsoluteUrl(i,Yr());await this.navigationClient.navigateInternal(l,u)}n.popup?.close();return}}const s=a.getLogoutUri(e);this.eventHandler.emitEvent(de.LOGOUT_SUCCESS,Te.Popup,e);const c=this.openPopup(s,n);if(this.eventHandler.emitEvent(de.POPUP_OPENED,Te.Popup,{popupWindow:c},null),await this.monitorPopupForHash(c,n.popupWindowParent).catch(()=>{}),i){const u={apiId:Be.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},l=Ye.getAbsoluteUrl(i,Yr());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${l}`),await this.navigationClient.navigateInternal(l,u)}else this.logger.verbose("No main window navigation requested")}catch(a){throw n.popup?.close(),a instanceof Xe&&(a.setCorrelationId(this.correlationId),o.cacheFailedRequest(a)),this.eventHandler.emitEvent(de.LOGOUT_FAILURE,Te.Popup,null,a),this.eventHandler.emitEvent(de.LOGOUT_END,Te.Popup),a}this.eventHandler.emitEvent(de.LOGOUT_END,Te.Popup)}initiateAuthRequest(e,n){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,n);throw this.logger.error("Navigate url is empty"),ae(xh)}monitorPopupForHash(e,n){return new Promise((r,i)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const o=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(o),i(ae(iu));return}let a="";try{a=e.location.href}catch{}if(!a||a==="about:blank")return;clearInterval(o);let s="";const c=this.config.auth.OIDCOptions.serverResponseType;e&&(c===Sh.QUERY?s=e.location.search:s=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),r(s)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,n)})}openPopup(e,n){try{let r;if(n.popup?(r=n.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):typeof n.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,n)),!r)throw ae(BI);return r.focus&&r.focus(),this.currentWindow=r,n.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),r}catch(r){throw this.logger.error("error opening popup "+r.message),ae(HI)}}openSizedPopup(e,{popupName:n,popupWindowAttributes:r,popupWindowParent:i}){const o=i.screenLeft?i.screenLeft:i.screenX,a=i.screenTop?i.screenTop:i.screenY,s=i.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,c=i.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let u=r.popupSize?.width,l=r.popupSize?.height,d=r.popupPosition?.top,p=r.popupPosition?.left;return(!u||u<0||u>s)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),u=fn.POPUP_WIDTH),(!l||l<0||l>c)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),l=fn.POPUP_HEIGHT),(!d||d<0||d>c)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),d=Math.max(0,c/2-fn.POPUP_HEIGHT/2+a)),(!p||p<0||p>s)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),p=Math.max(0,s/2-fn.POPUP_WIDTH/2+o)),i.open(e,n,`width=${u}, height=${l}, top=${d}, left=${p}, scrollbars=yes`)}unloadWindow(e){this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,n){e.close(),n.removeEventListener("beforeunload",this.unloadWindow)}generatePopupName(e,n){return`${fn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${n}.${this.correlationId}`}generateLogoutPopupName(e){const n=e.account&&e.account.homeAccountId;return`${fn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${n}.${this.correlationId}`}}function PU(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const t=window.performance.getEntriesByType("navigation");return(t.length?t[0]:void 0)?.type}class NU extends Ps{constructor(e,n,r,i,o,a,s,c,u,l){super(e,n,r,i,o,a,s,u,l),this.nativeStorage=c}async acquireToken(e){const n=await G(this.initializeAuthorizationRequest.bind(this),S.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,Te.Redirect);n.platformBroker=au(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);const r=o=>{o.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.resetRequestCache(),this.eventHandler.emitEvent(de.RESTORE_FROM_BFCACHE,Te.Redirect))},i=this.getRedirectStartPage(e.redirectStartPage);this.logger.verbosePii(`Redirect start page: ${i}`),this.browserStorage.setTemporaryCache(Tt.ORIGIN_URI,i,!0),window.addEventListener("pageshow",r);try{this.config.auth.protocolMode===mn.EAR?await this.executeEarFlow(n):await this.executeCodeFlow(n,e.onRedirectNavigate)}catch(o){throw o instanceof Xe&&o.setCorrelationId(this.correlationId),window.removeEventListener("pageshow",r),o}}async executeCodeFlow(e,n){const r=e.correlationId,i=this.initializeServerTelemetryManager(Be.acquireTokenRedirect),o=await G(Zo,S.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),a={...e,codeChallenge:o.challenge};this.browserStorage.cacheAuthorizeRequest(a,o.verifier);try{if(a.httpMethod===bo.POST)return await this.executeCodeFlowWithPost(a);{const s=await G(this.createAuthCodeClient.bind(this),S.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:a.authority,requestAzureCloudOptions:a.azureCloudOptions,requestExtraQueryParameters:a.extraQueryParameters,account:a.account}),c=await G(ay,S.GetAuthCodeUrl,this.logger,this.performanceClient,e.correlationId)(this.config,s.authority,a,this.logger,this.performanceClient);return await this.initiateAuthRequest(c,n)}}catch(s){throw s instanceof Xe&&(s.setCorrelationId(this.correlationId),i.cacheFailedRequest(s)),s}}async executeEarFlow(e){const n=e.correlationId,r=await G(this.getDiscoveredAuthority.bind(this),S.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await G(Xv,S.GenerateEarKey,this.logger,this.performanceClient,n)(),o=await G(Zo,S.GeneratePkceCodes,this.logger,this.performanceClient,n)(this.performanceClient,this.logger,n),a={...e,earJwk:i,codeChallenge:o.challenge};return this.browserStorage.cacheAuthorizeRequest(a,o.verifier),(await sy(document,this.config,r,a,this.logger,this.performanceClient)).submit(),new Promise((c,u)=>{setTimeout(()=>{u(ae(Wd,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async executeCodeFlowWithPost(e){const n=e.correlationId,r=await G(this.getDiscoveredAuthority.bind(this),S.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return this.browserStorage.cacheAuthorizeRequest(e),(await cy(document,this.config,r,e,this.logger,this.performanceClient)).submit(),new Promise((o,a)=>{setTimeout(()=>{a(ae(Wd,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async handleRedirectPromise(e="",n,r,i){const o=this.initializeServerTelemetryManager(Be.handleRedirectPromise);try{const[a,s]=this.getRedirectResponse(e||"");if(!a)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.resetRequestCache(),PU()!=="back_forward"?i.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const c=this.browserStorage.getTemporaryCache(Tt.ORIGIN_URI,!0)||z.EMPTY_STRING,u=kT(c),l=kT(window.location.href);if(u===l&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),c.indexOf("#")>-1&&xx(c),await this.handleResponse(a,n,r,o);if(this.config.auth.navigateToLoginRequestUrl){if(!ty()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(Tt.URL_HASH,s,!0);const d={apiId:Be.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let p=!0;if(!c||c==="null"){const h=Lx();this.browserStorage.setTemporaryCache(Tt.ORIGIN_URI,h,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),p=await this.navigationClient.navigateInternal(h,d)}else this.logger.verbose(`Navigating to loginRequestUrl: ${c}`),p=await this.navigationClient.navigateInternal(c,d);if(!p)return await this.handleResponse(a,n,r,o)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(a,n,r,o);return null}catch(a){throw a instanceof Xe&&(a.setCorrelationId(this.correlationId),o.cacheFailedRequest(a)),a}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let n=e;n||(this.config.auth.OIDCOptions.serverResponseType===Sh.QUERY?n=window.location.search:n=window.location.hash);let r=Bd(n);if(r){try{pU(r,this.browserCrypto,Te.Redirect)}catch(o){return o instanceof Xe&&this.logger.error(`Interaction type validation failed due to ${o.errorCode}: ${o.errorMessage}`),[null,""]}return mw(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,n]}const i=this.browserStorage.getTemporaryCache(Tt.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(Tt.URL_HASH)),i&&(r=Bd(i),r)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[r,i]):[null,""]}async handleResponse(e,n,r,i){if(!e.state)throw ae($v);if(e.ear_jwe){const s=await G(this.getDiscoveredAuthority.bind(this),S.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n.correlationId)({requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account});return G(uy,S.HandleResponseEar,this.logger,this.performanceClient,n.correlationId)(n,e,Be.acquireTokenRedirect,this.config,s,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}const a=await G(this.createAuthCodeClient.bind(this),S.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:n.authority});return G(fs,S.HandleResponseCode,this.logger,this.performanceClient,n.correlationId)(n,e,r,Be.acquireTokenRedirect,this.config,a,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async initiateAuthRequest(e,n){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const r={apiId:Be.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},i=n||this.config.auth.onRedirectNavigate;if(typeof i=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),i(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await this.navigationClient.navigateExternal(e,r);return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),await this.navigationClient.navigateExternal(e,r);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),ae(xh)}async logout(e){this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(Be.logout);try{this.eventHandler.emitEvent(de.LOGOUT_START,Te.Redirect,e),await this.clearCacheOnLogout(this.correlationId,n.account);const i={apiId:Be.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},o=await G(this.createAuthCodeClient.bind(this),S.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:e&&e.authority,requestExtraQueryParameters:e?.extraQueryParameters,account:e&&e.account||void 0});if(o.authority.protocolMode===mn.OIDC)try{o.authority.endSessionEndpoint}catch{if(n.account?.homeAccountId){this.eventHandler.emitEvent(de.LOGOUT_SUCCESS,Te.Redirect,n);return}}const a=o.getLogoutUri(n);if(this.eventHandler.emitEvent(de.LOGOUT_SUCCESS,Te.Redirect,n),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(a)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,ki.SIGNOUT),await this.navigationClient.navigateExternal(a,i);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,ki.SIGNOUT),await this.navigationClient.navigateExternal(a,i);return}}catch(i){throw i instanceof Xe&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),this.eventHandler.emitEvent(de.LOGOUT_FAILURE,Te.Redirect,null,i),this.eventHandler.emitEvent(de.LOGOUT_END,Te.Redirect),i}this.eventHandler.emitEvent(de.LOGOUT_END,Te.Redirect)}getRedirectStartPage(e){const n=e||window.location.href;return Ye.getAbsoluteUrl(n,Yr())}}async function OU(t,e,n,r,i){if(e.addQueueMeasurement(S.SilentHandlerInitiateAuthRequest,r),!t)throw n.info("Navigate url is empty"),ae(xh);return i?G(xU,S.SilentHandlerLoadFrame,n,e,r)(t,i,e,r):Nn(UU,S.SilentHandlerLoadFrameSync,n,e,r)(t)}async function DU(t,e,n,r,i){const o=Bh();if(!o.contentDocument)throw"No document associated with iframe!";return(await cy(o.contentDocument,t,e,n,r,i)).submit(),o}async function MU(t,e,n,r,i){const o=Bh();if(!o.contentDocument)throw"No document associated with iframe!";return(await sy(o.contentDocument,t,e,n,r,i)).submit(),o}async function sE(t,e,n,r,i,o,a){return r.addQueueMeasurement(S.SilentHandlerMonitorIframeForHash,o),new Promise((s,c)=>{e<Xg&&i.warning(`system.loadFrameTimeout or system.iframeHashTimeout set to lower (${e}ms) than the default (${Xg}ms). This may result in timeouts.`);const u=window.setTimeout(()=>{window.clearInterval(l),c(ae(KI))},e),l=window.setInterval(()=>{let d="";const p=t.contentWindow;try{d=p?p.location.href:""}catch{}if(!d||d==="about:blank")return;let h="";p&&(a===Sh.QUERY?h=p.location.search:h=p.location.hash),window.clearTimeout(u),window.clearInterval(l),s(h)},n)}).finally(()=>{Nn(LU,S.RemoveHiddenIframe,i,r,o)(t)})}function xU(t,e,n,r){return n.addQueueMeasurement(S.SilentHandlerLoadFrame,r),new Promise((i,o)=>{const a=Bh();window.setTimeout(()=>{if(!a){o("Unable to load iframe");return}a.src=t,i(a)},e)})}function UU(t){const e=Bh();return e.src=t,e}function Bh(){const t=document.createElement("iframe");return t.className="msalSilentIframe",t.style.visibility="hidden",t.style.position="absolute",t.style.width=t.style.height="0",t.style.border="0",t.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),t.setAttribute("allow","local-network-access *"),document.body.appendChild(t),t}function LU(t){document.body===t.parentNode&&document.body.removeChild(t)}class FU extends Ps{constructor(e,n,r,i,o,a,s,c,u,l,d){super(e,n,r,i,o,a,c,l,d),this.apiId=s,this.nativeStorage=u}async acquireToken(e){this.performanceClient.addQueueMeasurement(S.SilentIframeClientAcquireToken,e.correlationId),!e.loginHint&&!e.sid&&(!e.account||!e.account.username)&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const n={...e};n.prompt?n.prompt!==Ht.NONE&&n.prompt!==Ht.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${n.prompt} with ${Ht.NONE}`),n.prompt=Ht.NONE):n.prompt=Ht.NONE;const r=await G(this.initializeAuthorizationRequest.bind(this),S.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(n,Te.Silent);return r.platformBroker=au(this.config,this.logger,this.platformAuthProvider,r.authenticationScheme),Cw(r.authority),this.config.auth.protocolMode===mn.EAR?this.executeEarFlow(r):this.executeCodeFlow(r)}async executeCodeFlow(e){let n;const r=this.initializeServerTelemetryManager(this.apiId);try{return n=await G(this.createAuthCodeClient.bind(this),S.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),await G(this.silentTokenHelper.bind(this),S.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(n,e)}catch(i){if(i instanceof Xe&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),!n||!(i instanceof Xe)||i.errorCode!==fn.INVALID_GRANT_ERROR)throw i;return this.performanceClient.addFields({retryError:i.errorCode},this.correlationId),await G(this.silentTokenHelper.bind(this),S.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(n,e)}}async executeEarFlow(e){const n=e.correlationId,r=await G(this.getDiscoveredAuthority.bind(this),S.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await G(Xv,S.GenerateEarKey,this.logger,this.performanceClient,n)(),o=await G(Zo,S.GeneratePkceCodes,this.logger,this.performanceClient,n)(this.performanceClient,this.logger,n),a={...e,earJwk:i,codeChallenge:o.challenge},s=await G(MU,S.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,n)(this.config,r,a,this.logger,this.performanceClient),c=this.config.auth.OIDCOptions.serverResponseType,u=await G(sE,S.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,n)(s,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,n,c),l=Nn(xc,S.DeserializeResponse,this.logger,this.performanceClient,n)(u,c,this.logger);if(!l.ear_jwe&&l.code){const d=await G(this.createAuthCodeClient.bind(this),S.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,n)({serverTelemetryManager:this.initializeServerTelemetryManager(this.apiId),requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account,authority:r});return G(fs,S.HandleResponseCode,this.logger,this.performanceClient,n)(a,l,o.verifier,this.apiId,this.config,d,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}else return G(uy,S.HandleResponseEar,this.logger,this.performanceClient,n)(a,l,this.apiId,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}logout(){return Promise.reject(ae(Uh))}async silentTokenHelper(e,n){const r=n.correlationId;this.performanceClient.addQueueMeasurement(S.SilentIframeClientTokenHelper,r);const i=await G(Zo,S.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),o={...n,codeChallenge:i.challenge};let a;if(n.httpMethod===bo.POST)a=await G(DU,S.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);else{const l=await G(ay,S.GetAuthCodeUrl,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);a=await G(OU,S.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(l,this.performanceClient,this.logger,r,this.config.system.navigateFrameWait)}const s=this.config.auth.OIDCOptions.serverResponseType,c=await G(sE,S.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(a,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,s),u=Nn(xc,S.DeserializeResponse,this.logger,this.performanceClient,r)(c,s,this.logger);return G(fs,S.HandleResponseCode,this.logger,this.performanceClient,r)(n,u,i.verifier,this.apiId,this.config,e,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}class HU extends Ps{async acquireToken(e){this.performanceClient.addQueueMeasurement(S.SilentRefreshClientAcquireToken,e.correlationId);const n=await G(iy,S.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),r={...e,...n};e.redirectUri&&(r.redirectUri=this.getRedirectUri(e.redirectUri));const i=this.initializeServerTelemetryManager(Be.acquireTokenSilent_silentFlow),o=await this.createRefreshTokenClient({serverTelemetryManager:i,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return G(o.acquireTokenByRefreshToken.bind(o),S.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r,Be.acquireTokenSilent_silentFlow).catch(a=>{throw a.setCorrelationId(this.correlationId),i.cacheFailedRequest(a),a})}logout(){return Promise.reject(ae(Uh))}async createRefreshTokenClient(e){const n=await G(this.getClientConfiguration.bind(this),S.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new ex(n,this.performanceClient)}}class BU{constructor(e,n,r,i,o){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=n,this.logger=r,this.cryptoObj=i,this.performanceClient=o}async loadExternalTokens(e,n,r){if(!this.isBrowserEnvironment)throw ae(Lh);const i=e.correlationId||cr(),o=this.performanceClient.startMeasurement(S.LoadExternalTokens,i);try{const a=n.id_token?Ar(n.id_token,nn):void 0,s=kr(a||{}),c={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},u=e.authority?new jt(jt.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,c,this.logger,e.correlationId||cr()):void 0,l=await G(this.loadAccount.bind(this),S.LoadAccount,this.logger,this.performanceClient,i)(e,r.clientInfo||n.client_info||"",i,a,u),d=await G(this.loadIdToken.bind(this),S.LoadIdToken,this.logger,this.performanceClient,i)(n,l.homeAccountId,l.environment,l.realm,i,s),p=await G(this.loadAccessToken.bind(this),S.LoadAccessToken,this.logger,this.performanceClient,i)(e,n,l.homeAccountId,l.environment,l.realm,r,i,s),h=await G(this.loadRefreshToken.bind(this),S.LoadRefreshToken,this.logger,this.performanceClient,i)(n,l.homeAccountId,l.environment,i,s);return o.end({success:!0},void 0,lt.getAccountInfo(l)),this.generateAuthenticationResult(e,{account:l,idToken:d,accessToken:p,refreshToken:h},a,u)}catch(a){throw o.end({success:!1},a),a}}async loadAccount(e,n,r,i,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const u=lt.createFromAccountInfo(e.account);return await this.storage.setAccount(u,r,kr(i||{}),Be.loadExternalTokens),u}else if(!o||!n&&!i)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),ae(WI);const a=lt.generateHomeAccountId(n,o.authorityType,this.logger,this.cryptoObj,i),s=i?.tid,c=Fv(this.storage,o,a,nn,r,i,n,o.hostnameAndPort,s,void 0,void 0,this.logger);return await this.storage.setAccount(c,r,kr(i||{}),Be.loadExternalTokens),c}async loadIdToken(e,n,r,i,o,a){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const s=kh(n,r,e.id_token,this.config.auth.clientId,i);return await this.storage.setIdTokenCredential(s,o,a),s}async loadAccessToken(e,n,r,i,o,a,s,c){if(n.access_token)if(n.expires_in){if(!n.scope&&(!e.scopes||!e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null}else return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;else return this.logger.verbose("TokenCache - no access token found in response"),null;this.logger.verbose("TokenCache - loading access token");const u=n.scope?kt.fromString(n.scope):new kt(e.scopes),l=a.expiresOn||n.expires_in+Tn(),d=a.extendedExpiresOn||(n.ext_expires_in||n.expires_in)+Tn(),p=Ph(r,i,n.access_token,this.config.auth.clientId,o,u.printScopes(),l,d,nn);return await this.storage.setAccessTokenCredential(p,s,c),p}async loadRefreshToken(e,n,r,i,o){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const a=_I(n,r,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return await this.storage.setRefreshTokenCredential(a,i,o),a}generateAuthenticationResult(e,n,r,i){let o="",a=[],s=null,c;n?.accessToken&&(o=n.accessToken.secret,a=kt.fromString(n.accessToken.target).asArray(),s=ls(n.accessToken.expiresOn),c=ls(n.accessToken.extendedExpiresOn));const u=n.account;return{authority:i?i.canonicalAuthority:"",uniqueId:n.account.localAccountId,tenantId:n.account.realm,scopes:a,account:lt.getAccountInfo(u),idToken:n.idToken?.secret||"",idTokenClaims:r||{},accessToken:o,fromCache:!0,expiresOn:s,correlationId:e.correlationId||"",requestId:"",extExpiresOn:c,familyId:n.refreshToken?.familyId||"",tokenType:n?.accessToken?.tokenType||"",state:e.state||"",cloudGraphHostName:u.cloudGraphHostName||"",msGraphHost:u.msGraphHost||"",fromNativeBroker:!1}}}class KU extends bI{constructor(e){super(e),this.includeRedirectUri=!1}}class GU extends Ps{constructor(e,n,r,i,o,a,s,c,u,l){super(e,n,r,i,o,a,c,u,l),this.apiId=s}async acquireToken(e){if(!e.code)throw ae(JI);const n=await G(this.initializeAuthorizationRequest.bind(this),S.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,Te.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const i={...n,code:e.code},o=await G(this.getClientConfiguration.bind(this),S.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account}),a=new KU(o);this.logger.verbose("Auth code client created");const s=new Iw(a,this.browserStorage,i,this.logger,this.performanceClient);return await G(s.handleCodeResponseFromServer.bind(s),S.HandleCodeResponseFromServer,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},n,this.apiId,!1)}catch(i){throw i instanceof Xe&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),i}}logout(){return Promise.reject(ae(Uh))}}function qU(t,e,n){const r=window.msal?.clientIds||[],i=r.length,o=r.filter(a=>a===t).length;o>1&&n.warning("There is already an instance of MSAL.js in the window with the same client id."),e.add({msalInstanceCount:i,sameClientIdInstanceCount:o})}function ll(t,e,n){try{ny(t)}catch(r){throw e.end({success:!1},r,n),r}}class Kh{constructor(e){this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new si(this.logger,this.performanceClient):Fd,this.eventHandler=new dU(this.logger),this.browserStorage=this.isBrowserEnvironment?new em(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler,YM(this.config.auth)):nU(this.config.auth.clientId,this.logger,this.performanceClient,this.eventHandler);const n={cacheLocation:Bt.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:Bt.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new em(this.config.auth.clientId,n,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler),this.tokenCache=new BU(this.config,this.browserStorage,this.logger,this.browserCrypto,this.performanceClient),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this)}static async createController(e,n){const r=new Kh(e);return await r.initialize(n),r}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e,n){if(this.logger.trace("initialize called"),this.initialized){this.logger.info("initialize has already been called, exiting early.");return}if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,this.eventHandler.emitEvent(de.INITIALIZE_END);return}const r=e?.correlationId||this.getRequestCorrelationId(),i=this.config.system.allowPlatformBroker,o=this.performanceClient.startMeasurement(S.InitializeClientApplication,r);if(this.eventHandler.emitEvent(de.INITIALIZE_START),!n)try{this.logMultipleInstances(o)}catch{}if(await G(this.browserStorage.initialize.bind(this.browserStorage),S.InitializeCache,this.logger,this.performanceClient,r)(r),i)try{this.platformAuthProvider=await bU(this.logger,this.performanceClient,r,this.config.system.nativeBrokerHandshakeTimeout,this.config.system.allowPlatformBrokerWithDOM)}catch(a){this.logger.verbose(a)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),Nn(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),S.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,r)(r)),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(r),this.initialized=!0,this.eventHandler.emitEvent(de.INITIALIZE_END),o.end({allowPlatformBroker:i,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),yw(this.initialized),this.isBrowserEnvironment){const n=e||"";let r=this.redirectResponse.get(n);return typeof r>"u"?(r=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(n,r),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),r}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;if(this.browserStorage.getInteractionInProgress()?.type===ki.SIGNOUT)return this.logger.verbose("handleRedirectPromise removing interaction_in_progress flag and returning null after sign-out"),this.browserStorage.setInteractionInProgress(!1),Promise.resolve(null);const r=this.getAllAccounts(),i=this.browserStorage.getCachedNativeRequest(),o=i&&this.platformAuthProvider&&!e;let a;this.eventHandler.emitEvent(de.HANDLE_REDIRECT_START,Te.Redirect);let s;try{if(o&&this.platformAuthProvider){a=this.performanceClient.startMeasurement(S.AcquireTokenRedirect,i?.correlationId||""),this.logger.trace("handleRedirectPromise - acquiring token from native platform"),a.add({isPlatformBrokerRequest:!0});const c=new xl(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Be.handleRedirectPromise,this.performanceClient,this.platformAuthProvider,i.accountId,this.nativeInternalStorage,i.correlationId);s=G(c.handleRedirectPromise.bind(c),S.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,a.event.correlationId)(this.performanceClient,a.event.correlationId)}else{const[c,u]=this.browserStorage.getCachedRequest(),l=c.correlationId;a=this.performanceClient.startMeasurement(S.AcquireTokenRedirect,l),this.logger.trace("handleRedirectPromise - acquiring token from web flow");const d=this.createRedirectClient(l);s=G(d.handleRedirectPromise.bind(d),S.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,a.event.correlationId)(e,c,u,a)}}catch(c){throw this.browserStorage.resetRequestCache(),c}return s.then(c=>(c?(this.browserStorage.resetRequestCache(),r.length<this.getAllAccounts().length?(this.eventHandler.emitEvent(de.LOGIN_SUCCESS,Te.Redirect,c),this.logger.verbose("handleRedirectResponse returned result, login success")):(this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_SUCCESS,Te.Redirect,c),this.logger.verbose("handleRedirectResponse returned result, acquire token success")),a.end({success:!0},void 0,c.account)):a.event.errorCode?a.end({success:!1},void 0):a.discard(),this.eventHandler.emitEvent(de.HANDLE_REDIRECT_END,Te.Redirect),c)).catch(c=>{this.browserStorage.resetRequestCache();const u=c;throw r.length>0?this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_FAILURE,Te.Redirect,null,u):this.eventHandler.emitEvent(de.LOGIN_FAILURE,Te.Redirect,null,u),this.eventHandler.emitEvent(de.HANDLE_REDIRECT_END,Te.Redirect),a.end({success:!1},u),c})}async acquireTokenRedirect(e){const n=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",n);const r=this.performanceClient.startMeasurement(S.AcquireTokenPreRedirect,n);r.add({scenarioId:e.scenarioId});const i=e.onRedirectNavigate;if(i)e.onRedirectNavigate=a=>{const s=typeof i=="function"?i(a):void 0;return r.add({navigateCallbackResult:s!==!1}),r.event=r.end({success:!0},void 0,e.account)||r.event,s};else{const a=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=s=>{const c=typeof a=="function"?a(s):void 0;return r.add({navigateCallbackResult:c!==!1}),r.event=r.end({success:!0},void 0,e.account)||r.event,c}}const o=this.getAllAccounts().length>0;try{JT(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,ki.SIGNIN),o?this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_START,Te.Redirect,e):this.eventHandler.emitEvent(de.LOGIN_START,Te.Redirect,e);let a;return this.platformAuthProvider&&this.canUsePlatformBroker(e)?a=new xl(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Be.acquireTokenRedirect,this.performanceClient,this.platformAuthProvider,this.getNativeAccountId(e),this.nativeInternalStorage,n).acquireTokenRedirect(e,r).catch(c=>{if(r.add({brokerErrorName:c.name,brokerErrorCode:c.errorCode}),c instanceof Tr&&Ga(c))return this.platformAuthProvider=void 0,this.createRedirectClient(n).acquireToken(e);if(c instanceof sr)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(n).acquireToken(e);throw c}):a=this.createRedirectClient(n).acquireToken(e),await a}catch(a){throw this.browserStorage.resetRequestCache(),r.event.status===2?this.performanceClient.startMeasurement(S.AcquireTokenRedirect,n).end({success:!1},a,e.account):r.end({success:!1},a,e.account),o?this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_FAILURE,Te.Redirect,null,a):this.eventHandler.emitEvent(de.LOGIN_FAILURE,Te.Redirect,null,a),a}}acquireTokenPopup(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(S.AcquireTokenPopup,n);r.add({scenarioId:e.scenarioId});try{this.logger.verbose("acquireTokenPopup called",n),ll(this.initialized,r,e.account),this.browserStorage.setInteractionInProgress(!0,ki.SIGNIN)}catch(s){return Promise.reject(s)}const i=this.getAllAccounts();i.length>0?this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_START,Te.Popup,e):this.eventHandler.emitEvent(de.LOGIN_START,Te.Popup,e);let o;const a=this.getPreGeneratedPkceCodes(n);return this.canUsePlatformBroker(e)?(r.add({isPlatformBrokerRequest:!0}),o=this.acquireTokenNative({...e,correlationId:n},Be.acquireTokenPopup).then(s=>(r.end({success:!0},void 0,s.account),s)).catch(s=>{if(r.add({brokerErrorName:s.name,brokerErrorCode:s.errorCode}),s instanceof Tr&&Ga(s))return this.platformAuthProvider=void 0,this.createPopupClient(n).acquireToken(e,a);if(s instanceof sr)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(n).acquireToken(e,a);throw s})):o=this.createPopupClient(n).acquireToken(e,a),o.then(s=>(i.length<this.getAllAccounts().length?this.eventHandler.emitEvent(de.LOGIN_SUCCESS,Te.Popup,s):this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_SUCCESS,Te.Popup,s),r.end({success:!0,accessTokenSize:s.accessToken.length,idTokenSize:s.idToken.length},void 0,s.account),s)).catch(s=>(i.length>0?this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_FAILURE,Te.Popup,null,s):this.eventHandler.emitEvent(de.LOGIN_FAILURE,Te.Popup,null,s),r.end({success:!1},s,e.account),Promise.reject(s))).finally(async()=>{this.browserStorage.setInteractionInProgress(!1),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(n)})}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){const n=this.getRequestCorrelationId(e),r={...e,prompt:e.prompt,correlationId:n};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(S.SsoSilent,n),this.ssoSilentMeasurement?.add({scenarioId:e.scenarioId}),ll(this.initialized,this.ssoSilentMeasurement,e.account),this.ssoSilentMeasurement?.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",n),this.eventHandler.emitEvent(de.SSO_SILENT_START,Te.Silent,r);let i;return this.canUsePlatformBroker(r)?(this.ssoSilentMeasurement?.add({isPlatformBrokerRequest:!0}),i=this.acquireTokenNative(r,Be.ssoSilent).catch(o=>{if(this.ssoSilentMeasurement?.add({brokerErrorName:o.name,brokerErrorCode:o.errorCode}),o instanceof Tr&&Ga(o))return this.platformAuthProvider=void 0,this.createSilentIframeClient(r.correlationId).acquireToken(r);throw o})):i=this.createSilentIframeClient(r.correlationId).acquireToken(r),i.then(o=>(this.eventHandler.emitEvent(de.SSO_SILENT_SUCCESS,Te.Silent,o),this.ssoSilentMeasurement?.end({success:!0,accessTokenSize:o.accessToken.length,idTokenSize:o.idToken.length},void 0,o.account),o)).catch(o=>{throw this.eventHandler.emitEvent(de.SSO_SILENT_FAILURE,Te.Silent,null,o),this.ssoSilentMeasurement?.end({success:!1},o,e.account),o}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const n=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",n);const r=this.performanceClient.startMeasurement(S.AcquireTokenByCode,n);ll(this.initialized,r),this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_BY_CODE_START,Te.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw ae(ZI);if(e.code){const i=e.code;let o=this.hybridAuthCodeResponses.get(i);return o?(this.logger.verbose("Existing acquireTokenByCode request found",n),r.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",n),o=this.acquireTokenByCodeAsync({...e,correlationId:n}).then(a=>(this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_BY_CODE_SUCCESS,Te.Silent,a),this.hybridAuthCodeResponses.delete(i),r.end({success:!0,accessTokenSize:a.accessToken.length,idTokenSize:a.idToken.length},void 0,a.account),a)).catch(a=>{throw this.hybridAuthCodeResponses.delete(i),this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_BY_CODE_FAILURE,Te.Silent,null,a),r.end({success:!1},a),a}),this.hybridAuthCodeResponses.set(i,o)),await o}else if(e.nativeAccountId)if(this.canUsePlatformBroker(e,e.nativeAccountId)){r.add({isPlatformBrokerRequest:!0});const i=await this.acquireTokenNative({...e,correlationId:n},Be.acquireTokenByCode,e.nativeAccountId).catch(o=>{throw o instanceof Tr&&Ga(o)&&(this.platformAuthProvider=void 0),r.add({brokerErrorName:o.name,brokerErrorCode:o.errorCode}),o});return r.end({success:!0},void 0,i.account),i}else throw ae(ew);else throw ae(XI)}catch(i){throw this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_BY_CODE_FAILURE,Te.Silent,null,i),r.end({success:!1},i),i}}async acquireTokenByCodeAsync(e){return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(S.AcquireTokenByCodeAsync,e.correlationId),this.acquireTokenByCodeAsyncMeasurement?.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(i=>(this.acquireTokenByCodeAsyncMeasurement?.end({success:!0,fromCache:i.fromCache}),i)).catch(i=>{throw this.acquireTokenByCodeAsyncMeasurement?.end({success:!1},i),i}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,n){switch(this.performanceClient.addQueueMeasurement(S.AcquireTokenFromCache,e.correlationId),n){case Zt.Default:case Zt.AccessToken:case Zt.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return G(r.acquireToken.bind(r),S.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw J(Gi)}}async acquireTokenByRefreshToken(e,n){switch(this.performanceClient.addQueueMeasurement(S.AcquireTokenByRefreshToken,e.correlationId),n){case Zt.Default:case Zt.AccessTokenAndRefreshToken:case Zt.RefreshToken:case Zt.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return G(r.acquireToken.bind(r),S.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw J(Gi)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(S.AcquireTokenBySilentIframe,e.correlationId);const n=this.createSilentIframeClient(e.correlationId);return G(n.acquireToken.bind(n),S.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const n=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",n),this.logoutRedirect({correlationId:n,...e})}async logoutRedirect(e){const n=this.getRequestCorrelationId(e);return JT(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,ki.SIGNOUT),this.createRedirectClient(n).logout(e)}logoutPopup(e){try{const n=this.getRequestCorrelationId(e);return ny(this.initialized),this.browserStorage.setInteractionInProgress(!0,ki.SIGNOUT),this.createPopupClient(n).logout(e).finally(()=>{this.browserStorage.setInteractionInProgress(!1)})}catch(n){return Promise.reject(n)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const n=this.getRequestCorrelationId(e);return this.createSilentCacheClient(n).logout(e)}getAllAccounts(e){const n=this.getRequestCorrelationId();return rU(this.logger,this.browserStorage,this.isBrowserEnvironment,n,e)}getAccount(e){const n=this.getRequestCorrelationId();return iU(e,this.logger,this.browserStorage,n)}getAccountByUsername(e){const n=this.getRequestCorrelationId();return oU(e,this.logger,this.browserStorage,n)}getAccountByHomeId(e){const n=this.getRequestCorrelationId();return aU(e,this.logger,this.browserStorage,n)}getAccountByLocalId(e){const n=this.getRequestCorrelationId();return sU(e,this.logger,this.browserStorage,n)}setActiveAccount(e){const n=this.getRequestCorrelationId();cU(e,this.browserStorage,n)}getActiveAccount(){const e=this.getRequestCorrelationId();return uU(this.browserStorage,e)}async hydrateCache(e,n){this.logger.verbose("hydrateCache called");const r=lt.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return await this.browserStorage.setAccount(r,e.correlationId,kr(e.idTokenClaims),Be.hydrateCache),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,n)):this.browserStorage.hydrateCache(e,n)}async acquireTokenNative(e,n,r,i){if(this.logger.trace("acquireTokenNative called"),!this.platformAuthProvider)throw ae(jv);return new xl(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,n,this.performanceClient,this.platformAuthProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e,i)}canUsePlatformBroker(e,n){if(this.logger.trace("canUsePlatformBroker called"),!this.platformAuthProvider)return this.logger.trace("canUsePlatformBroker: platform broker unavilable, returning false"),!1;if(!au(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme))return this.logger.trace("canUsePlatformBroker: isBrokerAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case Ht.NONE:case Ht.CONSENT:case Ht.LOGIN:case Ht.SELECT_ACCOUNT:this.logger.trace("canUsePlatformBroker: prompt is compatible with platform broker flow");break;default:return this.logger.trace(`canUsePlatformBroker: prompt = ${e.prompt} is not compatible with platform broker flow, returning false`),!1}return!n&&!this.getNativeAccountId(e)?(this.logger.trace("canUsePlatformBroker: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const n=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return n&&n.nativeAccountId||""}createPopupClient(e){return new kU(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createRedirectClient(e){return new NU(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentIframeClient(e){return new FU(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Be.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentCacheClient(e){return new Rw(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentRefreshClient(e){return new HU(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentAuthCodeClient(e){return new GU(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Be.acquireTokenByCode,this.performanceClient,this.platformAuthProvider,e)}addEventCallback(e,n){return this.eventHandler.addEventCallback(e,n)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return vw(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){if(this.config.cache.cacheLocation!==Bt.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.subscribeCrossTab()}disableAccountStorageEvents(){if(this.config.cache.cacheLocation!==Bt.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.unsubscribeCrossTab()}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,n){this.browserStorage.setWrapperMetadata(e,n)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e?.correlationId?e.correlationId:this.isBrowserEnvironment?cr():z.EMPTY_STRING}async loginRedirect(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",n),this.acquireTokenRedirect({correlationId:n,...e||zT})}loginPopup(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",n),this.acquireTokenPopup({correlationId:n,...e||zT})}async acquireTokenSilent(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(S.AcquireTokenSilent,n);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),ll(this.initialized,r,e.account),this.logger.verbose("acquireTokenSilent called",n);const i=e.account||this.getActiveAccount();if(!i)throw ae(YI);return this.acquireTokenSilentDeduped(e,i,n).then(o=>(r.end({success:!0,fromCache:o.fromCache,accessTokenSize:o.accessToken.length,idTokenSize:o.idToken.length},void 0,o.account),{...o,state:e.state,correlationId:n})).catch(o=>{throw o instanceof Xe&&o.setCorrelationId(n),r.end({success:!1},o,i),o})}async acquireTokenSilentDeduped(e,n,r){const i=Oh(this.config.auth.clientId,{...e,authority:e.authority||this.config.auth.authority},n.homeAccountId),o=JSON.stringify(i),a=this.activeSilentTokenRequests.get(o);if(typeof a>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",r),this.performanceClient.addFields({deduped:!1},r);const s=G(this.acquireTokenSilentAsync.bind(this),S.AcquireTokenSilentAsync,this.logger,this.performanceClient,r)({...e,correlationId:r},n);return this.activeSilentTokenRequests.set(o,s),s.finally(()=>{this.activeSilentTokenRequests.delete(o)})}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",r),this.performanceClient.addFields({deduped:!0},r),a}async acquireTokenSilentAsync(e,n){const r=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(S.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_START,Te.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const i=await G(hU,S.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,n,this.config,this.performanceClient,this.logger),o=e.cacheLookupPolicy||Zt.Default;return this.acquireTokenSilentNoIframe(i,o).catch(async s=>{if($U(s,o))if(this.activeIframeRequest)if(o!==Zt.Skip){const[u,l]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${l}`,i.correlationId);const d=this.performanceClient.startMeasurement(S.AwaitConcurrentIframe,i.correlationId);d.add({awaitIframeCorrelationId:l});const p=await u;if(d.end({success:p}),p)return this.logger.verbose(`Parallel iframe request with correlationId: ${l} succeeded. Retrying cache and/or RT redemption`,i.correlationId),this.acquireTokenSilentNoIframe(i,o);throw this.logger.info(`Iframe request with correlationId: ${l} failed. Interaction is required.`),s}else return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",i.correlationId),G(this.acquireTokenBySilentIframe.bind(this),S.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i);else{let u;return this.activeIframeRequest=[new Promise(l=>{u=l}),i.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",i.correlationId),G(this.acquireTokenBySilentIframe.bind(this),S.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i).then(l=>(u(!0),l)).catch(l=>{throw u(!1),l}).finally(()=>{this.activeIframeRequest=void 0})}else throw s}).then(s=>(this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_SUCCESS,Te.Silent,s),this.performanceClient.addFields({fromCache:s.fromCache},e.correlationId),s)).catch(s=>{throw this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_FAILURE,Te.Silent,null,s),s}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,n){return au(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.performanceClient.addFields({isPlatformBrokerRequest:!0},e.correlationId),this.acquireTokenNative(e,Be.acquireTokenSilent_silentFlow,e.account.nativeAccountId,n).catch(async r=>{throw this.performanceClient.addFields({brokerErrorName:r.name,brokerErrorCode:r.errorCode},e.correlationId),r instanceof Tr&&Ga(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.platformAuthProvider=void 0,J(Gi)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),n===Zt.AccessToken&&this.logger.verbose("acquireTokenSilent - cache lookup policy set to AccessToken, attempting to acquire token from local cache"),G(this.acquireTokenFromCache.bind(this),S.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,n).catch(r=>{if(n===Zt.AccessToken)throw r;return this.eventHandler.emitEvent(de.ACQUIRE_TOKEN_NETWORK_START,Te.Silent,e),G(this.acquireTokenByRefreshToken.bind(this),S.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,n)}))}async preGeneratePkceCodes(e){return this.logger.verbose("Generating new PKCE codes"),this.pkceCode=await G(Zo,S.GeneratePkceCodes,this.logger,this.performanceClient,e)(this.performanceClient,this.logger,e),Promise.resolve()}getPreGeneratedPkceCodes(e){this.logger.verbose("Attempting to pick up pre-generated PKCE codes");const n=this.pkceCode?{...this.pkceCode}:void 0;return this.pkceCode=void 0,this.logger.verbose(`${n?"Found":"Did not find"} pre-generated PKCE codes`),this.performanceClient.addFields({usePreGeneratedPkce:!!n},e),n}logMultipleInstances(e){const n=this.config.auth.clientId;if(!window)return;window.msal=window.msal||{},window.msal.clientIds=window.msal.clientIds||[],window.msal.clientIds.length>0&&this.logger.verbose("There is already an instance of MSAL.js in the window."),window.msal.clientIds.push(n),qU(n,e,this.logger)}}function $U(t,e){const n=!(t instanceof sr&&t.subError!==Mh),r=t.errorCode===fn.INVALID_GRANT_ERROR||t.errorCode===Gi,i=n&&r||t.errorCode===jd||t.errorCode===Uv,o=Ex.includes(e);return i&&o}async function YU(t,e){const n=new Xo(t);return await n.initialize(),Kh.createController(n,e)}class dy{static async createPublicClientApplication(e){const n=await YU(e);return new dy(e,n)}constructor(e,n){this.isBroker=!1,this.controller=n||new Kh(new Xo(e))}async initialize(e){return this.controller.initialize(e,this.isBroker)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,n){return this.controller.addEventCallback(e,n)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,n){return this.controller.initializeWrapperLibrary(e,n)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,n){return this.controller.hydrateCache(e,n)}clearCache(e){return this.controller.clearCache(e)}}const zU={initialize:()=>Promise.reject(Ct(wt)),acquireTokenPopup:()=>Promise.reject(Ct(wt)),acquireTokenRedirect:()=>Promise.reject(Ct(wt)),acquireTokenSilent:()=>Promise.reject(Ct(wt)),acquireTokenByCode:()=>Promise.reject(Ct(wt)),getAllAccounts:()=>[],getAccount:()=>null,getAccountByHomeId:()=>null,getAccountByUsername:()=>null,getAccountByLocalId:()=>null,handleRedirectPromise:()=>Promise.reject(Ct(wt)),loginPopup:()=>Promise.reject(Ct(wt)),loginRedirect:()=>Promise.reject(Ct(wt)),logout:()=>Promise.reject(Ct(wt)),logoutRedirect:()=>Promise.reject(Ct(wt)),logoutPopup:()=>Promise.reject(Ct(wt)),ssoSilent:()=>Promise.reject(Ct(wt)),addEventCallback:()=>null,removeEventCallback:()=>{},addPerformanceCallback:()=>"",removePerformanceCallback:()=>!1,enableAccountStorageEvents:()=>{},disableAccountStorageEvents:()=>{},getTokenCache:()=>{throw Ct(wt)},getLogger:()=>{throw Ct(wt)},setLogger:()=>{},setActiveAccount:()=>{},getActiveAccount:()=>null,initializeWrapperLibrary:()=>{},setNavigationClient:()=>{},getConfiguration:()=>{throw Ct(wt)},hydrateCache:()=>Promise.reject(Ct(wt)),clearCache:()=>Promise.reject(Ct(wt))};class jU{static getInteractionStatusFromEvent(e,n){switch(e.eventType){case de.LOGIN_START:return pt.Login;case de.SSO_SILENT_START:return pt.SsoSilent;case de.ACQUIRE_TOKEN_START:if(e.interactionType===Te.Redirect||e.interactionType===Te.Popup)return pt.AcquireToken;break;case de.HANDLE_REDIRECT_START:return pt.HandleRedirect;case de.LOGOUT_START:return pt.Logout;case de.SSO_SILENT_SUCCESS:case de.SSO_SILENT_FAILURE:if(n&&n!==pt.SsoSilent)break;return pt.None;case de.LOGOUT_END:if(n&&n!==pt.Logout)break;return pt.None;case de.HANDLE_REDIRECT_END:if(n&&n!==pt.HandleRedirect)break;return pt.None;case de.LOGIN_SUCCESS:case de.LOGIN_FAILURE:case de.ACQUIRE_TOKEN_SUCCESS:case de.ACQUIRE_TOKEN_FAILURE:case de.RESTORE_FROM_BFCACHE:if(e.interactionType===Te.Redirect||e.interactionType===Te.Popup){if(n&&n!==pt.Login&&n!==pt.AcquireToken)break;return pt.None}break}return null}}const VU={instance:zU,inProgress:pt.None,accounts:[],logger:new ai({})},hy=K.createContext(VU);hy.Consumer;function cE(t,e){if(t.length!==e.length)return!1;const n=[...e];return t.every(r=>{const i=n.shift();return!r||!i?!1:r.homeAccountId===i.homeAccountId&&r.localAccountId===i.localAccountId&&r.username===i.username})}function QU(t,e){return t.length>0&&(e.homeAccountId||e.localAccountId||e.username)&&t.filter(r=>!(e.username&&e.username.toLowerCase()!==r.username.toLowerCase()||e.homeAccountId&&e.homeAccountId.toLowerCase()!==r.homeAccountId.toLowerCase()||e.localAccountId&&e.localAccountId.toLowerCase()!==r.localAccountId.toLowerCase()))[0]||null}const WU="@azure/msal-react",uE="3.0.24";const eh={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},JU=(t,e)=>{const{type:n,payload:r}=e;let i=t.inProgress;switch(n){case eh.UNBLOCK_INPROGRESS:t.inProgress===pt.Startup&&(i=pt.None,r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case eh.EVENT:const a=r.message,s=jU.getInteractionStatusFromEvent(a,t.inProgress);s&&(r.logger.info(`MsalProvider - ${a.eventType} results in setting inProgress from ${t.inProgress} to ${s}`),i=s);break;default:throw new Error(`Unknown action type: ${n}`)}if(i===pt.Startup)return t;const o=r.instance.getAllAccounts();return i!==t.inProgress&&!cE(o,t.accounts)?{...t,inProgress:i,accounts:o}:i!==t.inProgress?{...t,inProgress:i}:cE(o,t.accounts)?t:{...t,accounts:o}};function XU({instance:t,children:e}){ge.useEffect(()=>{t.initializeWrapperLibrary(yx.React,uE)},[t]);const n=ge.useMemo(()=>t.getLogger().clone(WU,uE),[t]),[r,i]=ge.useReducer(JU,void 0,()=>({inProgress:pt.Startup,accounts:[]}));ge.useEffect(()=>{const a=t.addEventCallback(s=>{i({payload:{instance:t,logger:n,message:s},type:eh.EVENT})});return n.verbose(`MsalProvider - Registered event callback with id: ${a}`),t.initialize().then(()=>{t.handleRedirectPromise().catch(()=>{}).finally(()=>{i({payload:{instance:t,logger:n},type:eh.UNBLOCK_INPROGRESS})})}).catch(()=>{}),()=>{a&&(n.verbose(`MsalProvider - Removing event callback ${a}`),t.removeEventCallback(a))}},[t,n]);const o={instance:t,inProgress:r.inProgress,accounts:r.accounts,logger:n};return ge.createElement(hy.Provider,{value:o},e)}const fy=()=>ge.useContext(hy);function ZU(t,e){return t.length>0}function eL(t){const{accounts:e,inProgress:n}=fy();return ge.useMemo(()=>n===pt.Startup?!1:ZU(e),[e,n,t])}function lE(t,e){return!e||!e.homeAccountId&&!e.localAccountId&&!e.username?t.getActiveAccount():QU(t.getAllAccounts(),e)}function tL(t){const{instance:e,inProgress:n,logger:r}=fy(),[i,o]=ge.useState(()=>n===pt.Startup?null:lE(e,t));return ge.useEffect(()=>{n!==pt.Startup&&o(a=>{const s=lE(e,t);return lt.accountInfoIsEqual(a,s,!0)?a:(r.info("useAccount - Updating account"),s)})},[n,t,e,r]),i}const nL=({config:t,children:e})=>{const n=ge.useRef(null);return n.current||(n.current=new dy({...t,system:{...t.system,loggerOptions:{logLevel:ot.Info}}})),oe.jsx(XU,{instance:n.current,children:e})};function rL(t){const{instance:e,accounts:n}=fy(),r=eL(),i=tL(n[0]||{});return{isAuthenticated:r,account:i,login:async c=>{const u=c??{scopes:t?.defaultScopes??["openid","profile","offline_access"]};t?.loginType==="redirect"?await e.loginRedirect(u):await e.loginPopup(u)},logout:async()=>{try{t?.loginType==="redirect"?await e.logoutRedirect():await e.logoutPopup()}catch{console.error("Failed while trying to logout user!")}},acquireToken:async c=>{const u={account:n[0],scopes:c};try{return(await e.acquireTokenSilent(u)).accessToken}catch{return t?.loginType==="redirect"?(await e.acquireTokenRedirect({scopes:c}),""):(await e.acquireTokenPopup({scopes:c})).accessToken}},InteractionType:Te}}const iL=({children:t})=>oe.jsx(oe.Fragment,{children:t});var dE="popstate";function oL(t={}){function e(r,i){let{pathname:o,search:a,hash:s}=r.location;return tm("",{pathname:o,search:a,hash:s},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:su(i)}return sL(e,n,null,t)}function Pt(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function ur(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function aL(){return Math.random().toString(36).substring(2,10)}function hE(t,e){return{usr:t.state,key:t.key,idx:e}}function tm(t,e,n=null,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Eu(e):e,state:n,key:e&&e.key||r||aL()}}function su({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Eu(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substring(r),t=t.substring(0,r)),t&&(e.pathname=t)}return e}function sL(t,e,n,r={}){let{window:i=document.defaultView,v5Compat:o=!1}=r,a=i.history,s="POP",c=null,u=l();u==null&&(u=0,a.replaceState({...a.state,idx:u},""));function l(){return(a.state||{idx:null}).idx}function d(){s="POP";let m=l(),v=m==null?null:m-u;u=m,c&&c({action:s,location:g.location,delta:v})}function p(m,v){s="PUSH";let y=tm(g.location,m,v);u=l()+1;let I=hE(y,u),R=g.createHref(y);try{a.pushState(I,"",R)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;i.location.assign(R)}o&&c&&c({action:s,location:g.location,delta:1})}function h(m,v){s="REPLACE";let y=tm(g.location,m,v);u=l();let I=hE(y,u),R=g.createHref(y);a.replaceState(I,"",R),o&&c&&c({action:s,location:g.location,delta:0})}function f(m){return cL(m)}let g={get action(){return s},get location(){return t(i,a)},listen(m){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(dE,d),c=m,()=>{i.removeEventListener(dE,d),c=null}},createHref(m){return e(i,m)},createURL:f,encodeLocation(m){let v=f(m);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:h,go(m){return a.go(m)}};return g}function cL(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Pt(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:su(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Pw(t,e,n="/"){return uL(t,e,n,!1)}function uL(t,e,n,r){let i=typeof e=="string"?Eu(e):e,o=ci(i.pathname||"/",n);if(o==null)return null;let a=Nw(t);lL(a);let s=null;for(let c=0;s==null&&c<a.length;++c){let u=EL(o);s=CL(a[c],u,r)}return s}function Nw(t,e=[],n=[],r="",i=!1){let o=(a,s,c=i,u)=>{let l={relativePath:u===void 0?a.path||"":u,caseSensitive:a.caseSensitive===!0,childrenIndex:s,route:a};if(l.relativePath.startsWith("/")){if(!l.relativePath.startsWith(r)&&c)return;Pt(l.relativePath.startsWith(r),`Absolute route path "${l.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),l.relativePath=l.relativePath.slice(r.length)}let d=Zr([r,l.relativePath]),p=n.concat(l);a.children&&a.children.length>0&&(Pt(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),Nw(a.children,e,p,d,c)),!(a.path==null&&!a.index)&&e.push({path:d,score:vL(d,a.index),routesMeta:p})};return t.forEach((a,s)=>{if(a.path===""||!a.path?.includes("?"))o(a,s);else for(let c of Ow(a.path))o(a,s,!0,c)}),e}function Ow(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let a=Ow(r.join("/")),s=[];return s.push(...a.map(c=>c===""?o:[o,c].join("/"))),i&&s.push(...a),s.map(c=>t.startsWith("/")&&c===""?"/":c)}function lL(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:yL(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var dL=/^:[\w-]+$/,hL=3,fL=2,pL=1,gL=10,mL=-2,fE=t=>t==="*";function vL(t,e){let n=t.split("/"),r=n.length;return n.some(fE)&&(r+=mL),e&&(r+=fL),n.filter(i=>!fE(i)).reduce((i,o)=>i+(dL.test(o)?hL:o===""?pL:gL),r)}function yL(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function CL(t,e,n=!1){let{routesMeta:r}=t,i={},o="/",a=[];for(let s=0;s<r.length;++s){let c=r[s],u=s===r.length-1,l=o==="/"?e:e.slice(o.length)||"/",d=th({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},l),p=c.route;if(!d&&u&&n&&!r[r.length-1].route.index&&(d=th({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),a.push({params:i,pathname:Zr([o,d.pathname]),pathnameBase:IL(Zr([o,d.pathnameBase])),route:p}),d.pathnameBase!=="/"&&(o=Zr([o,d.pathnameBase]))}return a}function th(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=TL(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let o=i[0],a=o.replace(/(.)\/+$/,"$1"),s=i.slice(1);return{params:r.reduce((u,{paramName:l,isOptional:d},p)=>{if(l==="*"){let f=s[p]||"";a=o.slice(0,o.length-f.length).replace(/(.)\/+$/,"$1")}const h=s[p];return d&&!h?u[l]=void 0:u[l]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:a,pattern:t}}function TL(t,e=!1,n=!0){ur(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,s,c)=>(r.push({paramName:s,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function EL(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return ur(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function ci(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}var Dw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_L=t=>Dw.test(t);function SL(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Eu(t):t,o;if(n)if(_L(n))o=n;else{if(n.includes("//")){let a=n;n=n.replace(/\/\/+/g,"/"),ur(!1,`Pathnames cannot have embedded double slashes - normalizing ${a} -> ${n}`)}n.startsWith("/")?o=pE(n.substring(1),"/"):o=pE(n,e)}else o=e;return{pathname:o,search:wL(r),hash:RL(i)}}function pE(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Op(t,e,n,r){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function AL(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Mw(t){let e=AL(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function xw(t,e,n,r=!1){let i;typeof t=="string"?i=Eu(t):(i={...t},Pt(!i.pathname||!i.pathname.includes("?"),Op("?","pathname","search",i)),Pt(!i.pathname||!i.pathname.includes("#"),Op("#","pathname","hash",i)),Pt(!i.search||!i.search.includes("#"),Op("#","search","hash",i)));let o=t===""||i.pathname==="",a=o?"/":i.pathname,s;if(a==null)s=n;else{let d=e.length-1;if(!r&&a.startsWith("..")){let p=a.split("/");for(;p[0]==="..";)p.shift(),d-=1;i.pathname=p.join("/")}s=d>=0?e[d]:"/"}let c=SL(i,s),u=a&&a!=="/"&&a.endsWith("/"),l=(o||a===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||l)&&(c.pathname+="/"),c}var Zr=t=>t.join("/").replace(/\/\/+/g,"/"),IL=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),wL=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,RL=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,bL=class{constructor(t,e,n,r=!1){this.status=t,this.statusText=e||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function kL(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function PL(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Uw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Lw(t,e){let n=t;if(typeof n!="string"||!Dw.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Uw)try{let o=new URL(window.location.href),a=n.startsWith("//")?new URL(o.protocol+n):new URL(n),s=ci(a.pathname,e);a.origin===o.origin&&s!=null?n=s+a.search+a.hash:i=!0}catch{ur(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Fw=["POST","PUT","PATCH","DELETE"];new Set(Fw);var NL=["GET",...Fw];new Set(NL);var Ns=K.createContext(null);Ns.displayName="DataRouter";var Gh=K.createContext(null);Gh.displayName="DataRouterState";var OL=K.createContext(!1),Hw=K.createContext({isTransitioning:!1});Hw.displayName="ViewTransition";var DL=K.createContext(new Map);DL.displayName="Fetchers";var ML=K.createContext(null);ML.displayName="Await";var zn=K.createContext(null);zn.displayName="Navigation";var qh=K.createContext(null);qh.displayName="Location";var li=K.createContext({outlet:null,matches:[],isDataRoute:!1});li.displayName="Route";var py=K.createContext(null);py.displayName="RouteError";var Bw="REACT_ROUTER_ERROR",xL="REDIRECT",UL="ROUTE_ERROR_RESPONSE";function LL(t){if(t.startsWith(`${Bw}:${xL}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function FL(t){if(t.startsWith(`${Bw}:${UL}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new bL(e.status,e.statusText,e.data)}catch{}}function HL(t,{relative:e}={}){Pt(_u(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=K.useContext(zn),{hash:i,pathname:o,search:a}=Su(t,{relative:e}),s=o;return n!=="/"&&(s=o==="/"?n:Zr([n,o])),r.createHref({pathname:s,search:a,hash:i})}function _u(){return K.useContext(qh)!=null}function Zi(){return Pt(_u(),"useLocation() may be used only in the context of a <Router> component."),K.useContext(qh).location}var Kw="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Gw(t){K.useContext(zn).static||K.useLayoutEffect(t)}function qw(){let{isDataRoute:t}=K.useContext(li);return t?XL():BL()}function BL(){Pt(_u(),"useNavigate() may be used only in the context of a <Router> component.");let t=K.useContext(Ns),{basename:e,navigator:n}=K.useContext(zn),{matches:r}=K.useContext(li),{pathname:i}=Zi(),o=JSON.stringify(Mw(r)),a=K.useRef(!1);return Gw(()=>{a.current=!0}),K.useCallback((c,u={})=>{if(ur(a.current,Kw),!a.current)return;if(typeof c=="number"){n.go(c);return}let l=xw(c,JSON.parse(o),i,u.relative==="path");t==null&&e!=="/"&&(l.pathname=l.pathname==="/"?e:Zr([e,l.pathname])),(u.replace?n.replace:n.push)(l,u.state,u)},[e,n,o,i,t])}K.createContext(null);function Su(t,{relative:e}={}){let{matches:n}=K.useContext(li),{pathname:r}=Zi(),i=JSON.stringify(Mw(n));return K.useMemo(()=>xw(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function KL(t,e,n,r,i){Pt(_u(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=K.useContext(zn),{matches:a}=K.useContext(li),s=a[a.length-1],c=s?s.params:{},u=s?s.pathname:"/",l=s?s.pathnameBase:"/",d=s&&s.route;{let y=d&&d.path||"";Yw(u,!d||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${y}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
21
|
-
|
|
22
|
-
Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}/*`}">.`)}let p=Zi(),h;h=p;let f=h.pathname||"/",g=f;if(l!=="/"){let y=l.replace(/^\//,"").split("/");g="/"+f.replace(/^\//,"").split("/").slice(y.length).join("/")}let m=Pw(t,{pathname:g});return ur(d||m!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),ur(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),zL(m&&m.map(y=>Object.assign({},y,{params:Object.assign({},c,y.params),pathname:Zr([l,o.encodeLocation?o.encodeLocation(y.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:Zr([l,o.encodeLocation?o.encodeLocation(y.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),a,n,r,i)}function GL(){let t=JL(),e=kL(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},a=null;return console.error("Error handled by React Router default ErrorBoundary:",t),a=K.createElement(K.Fragment,null,K.createElement("p",null,"💿 Hey developer 👋"),K.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",K.createElement("code",{style:o},"ErrorBoundary")," or"," ",K.createElement("code",{style:o},"errorElement")," prop on your route.")),K.createElement(K.Fragment,null,K.createElement("h2",null,"Unexpected Application Error!"),K.createElement("h3",{style:{fontStyle:"italic"}},e),n?K.createElement("pre",{style:i},n):null,a)}var qL=K.createElement(GL,null),$w=class extends K.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=FL(t.digest);n&&(t=n)}let e=t!==void 0?K.createElement(li.Provider,{value:this.props.routeContext},K.createElement(py.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?K.createElement($L,{error:t},e):e}};$w.contextType=OL;var Dp=new WeakMap;function $L({children:t,error:e}){let{basename:n}=K.useContext(zn);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=LL(e.digest);if(r){let i=Dp.get(e);if(i)throw i;let o=Lw(r.location,n);if(Uw&&!Dp.get(e))if(o.isExternal||r.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const a=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:r.replace}));throw Dp.set(e,a),a}return K.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return t}function YL({routeContext:t,match:e,children:n}){let r=K.useContext(Ns);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),K.createElement(li.Provider,{value:t},n)}function zL(t,e=[],n=null,r=null,i=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,a=n?.errors;if(a!=null){let l=o.findIndex(d=>d.route.id&&a?.[d.route.id]!==void 0);Pt(l>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),o=o.slice(0,Math.min(o.length,l+1))}let s=!1,c=-1;if(n)for(let l=0;l<o.length;l++){let d=o[l];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=l),d.route.id){let{loaderData:p,errors:h}=n,f=d.route.loader&&!p.hasOwnProperty(d.route.id)&&(!h||h[d.route.id]===void 0);if(d.route.lazy||f){s=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}let u=n&&r?(l,d)=>{r(l,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:PL(n.matches),errorInfo:d})}:void 0;return o.reduceRight((l,d,p)=>{let h,f=!1,g=null,m=null;n&&(h=a&&d.route.id?a[d.route.id]:void 0,g=d.route.errorElement||qL,s&&(c<0&&p===0?(Yw("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):c===p&&(f=!0,m=d.route.hydrateFallbackElement||null)));let v=e.concat(o.slice(0,p+1)),y=()=>{let I;return h?I=g:f?I=m:d.route.Component?I=K.createElement(d.route.Component,null):d.route.element?I=d.route.element:I=l,K.createElement(YL,{match:d,routeContext:{outlet:l,matches:v,isDataRoute:n!=null},children:I})};return n&&(d.route.ErrorBoundary||d.route.errorElement||p===0)?K.createElement($w,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:y(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:u}):y()},null)}function gy(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function jL(t){let e=K.useContext(Ns);return Pt(e,gy(t)),e}function VL(t){let e=K.useContext(Gh);return Pt(e,gy(t)),e}function QL(t){let e=K.useContext(li);return Pt(e,gy(t)),e}function my(t){let e=QL(t),n=e.matches[e.matches.length-1];return Pt(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function WL(){return my("useRouteId")}function JL(){let t=K.useContext(py),e=VL("useRouteError"),n=my("useRouteError");return t!==void 0?t:e.errors?.[n]}function XL(){let{router:t}=jL("useNavigate"),e=my("useNavigate"),n=K.useRef(!1);return Gw(()=>{n.current=!0}),K.useCallback(async(i,o={})=>{ur(n.current,Kw),n.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...o}))},[t,e])}var gE={};function Yw(t,e,n){!e&&!gE[t]&&(gE[t]=!0,ur(!1,n))}K.memo(ZL);function ZL({routes:t,future:e,state:n,onError:r}){return KL(t,void 0,n,r,e)}function eF({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:o=!1,unstable_useTransitions:a}){Pt(!_u(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=t.replace(/^\/*/,"/"),c=K.useMemo(()=>({basename:s,navigator:i,static:o,unstable_useTransitions:a,future:{}}),[s,i,o,a]);typeof n=="string"&&(n=Eu(n));let{pathname:u="/",search:l="",hash:d="",state:p=null,key:h="default"}=n,f=K.useMemo(()=>{let g=ci(u,s);return g==null?null:{location:{pathname:g,search:l,hash:d,state:p,key:h},navigationType:r}},[s,u,l,d,p,h,r]);return ur(f!=null,`<Router basename="${s}"> is not able to match the URL "${u}${l}${d}" because it does not start with the basename, so the <Router> won't render anything.`),f==null?null:K.createElement(zn.Provider,{value:c},K.createElement(qh.Provider,{children:e,value:f}))}var Ul="get",Ll="application/x-www-form-urlencoded";function $h(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function tF(t){return $h(t)&&t.tagName.toLowerCase()==="button"}function nF(t){return $h(t)&&t.tagName.toLowerCase()==="form"}function rF(t){return $h(t)&&t.tagName.toLowerCase()==="input"}function iF(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function oF(t,e){return t.button===0&&(!e||e==="_self")&&!iF(t)}var dl=null;function aF(){if(dl===null)try{new FormData(document.createElement("form"),0),dl=!1}catch{dl=!0}return dl}var sF=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Mp(t){return t!=null&&!sF.has(t)?(ur(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ll}"`),null):t}function cF(t,e){let n,r,i,o,a;if(nF(t)){let s=t.getAttribute("action");r=s?ci(s,e):null,n=t.getAttribute("method")||Ul,i=Mp(t.getAttribute("enctype"))||Ll,o=new FormData(t)}else if(tF(t)||rF(t)&&(t.type==="submit"||t.type==="image")){let s=t.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=t.getAttribute("formaction")||s.getAttribute("action");if(r=c?ci(c,e):null,n=t.getAttribute("formmethod")||s.getAttribute("method")||Ul,i=Mp(t.getAttribute("formenctype"))||Mp(s.getAttribute("enctype"))||Ll,o=new FormData(s,t),!aF()){let{name:u,type:l,value:d}=t;if(l==="image"){let p=u?`${u}.`:"";o.append(`${p}x`,"0"),o.append(`${p}y`,"0")}else u&&o.append(u,d)}}else{if($h(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Ul,r=null,i=Ll,a=t}return o&&i==="text/plain"&&(a=o,o=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:o,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vy(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function uF(t,e,n,r){let i=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:e&&ci(i.pathname,e)==="/"?i.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${r}`,i}async function lF(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function dF(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function hF(t,e,n){let r=await Promise.all(t.map(async i=>{let o=e.routes[i.route.id];if(o){let a=await lF(o,n);return a.links?a.links():[]}return[]}));return mF(r.flat(1).filter(dF).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function mE(t,e,n,r,i,o){let a=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,s=(c,u)=>n[u].pathname!==c.pathname||n[u].route.path?.endsWith("*")&&n[u].params["*"]!==c.params["*"];return o==="assets"?e.filter((c,u)=>a(c,u)||s(c,u)):o==="data"?e.filter((c,u)=>{let l=r.routes[c.route.id];if(!l||!l.hasLoader)return!1;if(a(c,u)||s(c,u))return!0;if(c.route.shouldRevalidate){let d=c.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof d=="boolean")return d}return!0}):[]}function fF(t,e,{includeHydrateFallback:n}={}){return pF(t.map(r=>{let i=e.routes[r.route.id];if(!i)return[];let o=[i.module];return i.clientActionModule&&(o=o.concat(i.clientActionModule)),i.clientLoaderModule&&(o=o.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(o=o.concat(i.hydrateFallbackModule)),i.imports&&(o=o.concat(i.imports)),o}).flat(1))}function pF(t){return[...new Set(t)]}function gF(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function mF(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let o=JSON.stringify(gF(i));return n.has(o)||(n.add(o),r.push({key:o,link:i})),r},[])}function zw(){let t=K.useContext(Ns);return vy(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function vF(){let t=K.useContext(Gh);return vy(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var yy=K.createContext(void 0);yy.displayName="FrameworkContext";function jw(){let t=K.useContext(yy);return vy(t,"You must render this element inside a <HydratedRouter> element"),t}function yF(t,e){let n=K.useContext(yy),[r,i]=K.useState(!1),[o,a]=K.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:u,onMouseLeave:l,onTouchStart:d}=e,p=K.useRef(null);K.useEffect(()=>{if(t==="render"&&a(!0),t==="viewport"){let g=v=>{v.forEach(y=>{a(y.isIntersecting)})},m=new IntersectionObserver(g,{threshold:.5});return p.current&&m.observe(p.current),()=>{m.disconnect()}}},[t]),K.useEffect(()=>{if(r){let g=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(g)}}},[r]);let h=()=>{i(!0)},f=()=>{i(!1),a(!1)};return n?t!=="intent"?[o,p,{}]:[o,p,{onFocus:lc(s,h),onBlur:lc(c,f),onMouseEnter:lc(u,h),onMouseLeave:lc(l,f),onTouchStart:lc(d,h)}]:[!1,p,{}]}function lc(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function CF({page:t,...e}){let{router:n}=zw(),r=K.useMemo(()=>Pw(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?K.createElement(EF,{page:t,matches:r,...e}):null}function TF(t){let{manifest:e,routeModules:n}=jw(),[r,i]=K.useState([]);return K.useEffect(()=>{let o=!1;return hF(t,e,n).then(a=>{o||i(a)}),()=>{o=!0}},[t,e,n]),r}function EF({page:t,matches:e,...n}){let r=Zi(),{future:i,manifest:o,routeModules:a}=jw(),{basename:s}=zw(),{loaderData:c,matches:u}=vF(),l=K.useMemo(()=>mE(t,e,u,o,r,"data"),[t,e,u,o,r]),d=K.useMemo(()=>mE(t,e,u,o,r,"assets"),[t,e,u,o,r]),p=K.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let g=new Set,m=!1;if(e.forEach(y=>{let I=o.routes[y.route.id];!I||!I.hasLoader||(!l.some(R=>R.route.id===y.route.id)&&y.route.id in c&&a[y.route.id]?.shouldRevalidate||I.hasClientLoader?m=!0:g.add(y.route.id))}),g.size===0)return[];let v=uF(t,s,i.unstable_trailingSlashAwareDataRequests,"data");return m&&g.size>0&&v.searchParams.set("_routes",e.filter(y=>g.has(y.route.id)).map(y=>y.route.id).join(",")),[v.pathname+v.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,o,l,e,t,a]),h=K.useMemo(()=>fF(d,o),[d,o]),f=TF(d);return K.createElement(K.Fragment,null,p.map(g=>K.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...n})),h.map(g=>K.createElement("link",{key:g,rel:"modulepreload",href:g,...n})),f.map(({key:g,link:m})=>K.createElement("link",{key:g,nonce:n.nonce,...m})))}function _F(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var SF=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{SF&&(window.__reactRouterVersion="7.12.0")}catch{}function AF({basename:t,children:e,unstable_useTransitions:n,window:r}){let i=K.useRef();i.current==null&&(i.current=oL({window:r,v5Compat:!0}));let o=i.current,[a,s]=K.useState({action:o.action,location:o.location}),c=K.useCallback(u=>{n===!1?s(u):K.startTransition(()=>s(u))},[n]);return K.useLayoutEffect(()=>o.listen(c),[o,c]),K.createElement(eF,{basename:t,children:e,location:a.location,navigationType:a.action,navigator:o,unstable_useTransitions:n})}var Vw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Qw=K.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:i,reloadDocument:o,replace:a,state:s,target:c,to:u,preventScrollReset:l,viewTransition:d,unstable_defaultShouldRevalidate:p,...h},f){let{basename:g,unstable_useTransitions:m}=K.useContext(zn),v=typeof u=="string"&&Vw.test(u),y=Lw(u,g);u=y.to;let I=HL(u,{relative:i}),[R,A,M]=yF(r,h),b=bF(u,{replace:a,state:s,target:c,preventScrollReset:l,relative:i,viewTransition:d,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m});function _(B){e&&e(B),B.defaultPrevented||b(B)}let F=K.createElement("a",{...h,...M,href:y.absoluteURL||I,onClick:y.isExternal||o?e:_,ref:_F(f,A),target:c,"data-discover":!v&&n==="render"?"true":void 0});return R&&!v?K.createElement(K.Fragment,null,F,K.createElement(CF,{page:I})):F});Qw.displayName="Link";var IF=K.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:o,to:a,viewTransition:s,children:c,...u},l){let d=Su(a,{relative:u.relative}),p=Zi(),h=K.useContext(Gh),{navigator:f,basename:g}=K.useContext(zn),m=h!=null&&DF(d)&&s===!0,v=f.encodeLocation?f.encodeLocation(d).pathname:d.pathname,y=p.pathname,I=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;n||(y=y.toLowerCase(),I=I?I.toLowerCase():null,v=v.toLowerCase()),I&&g&&(I=ci(I,g)||I);const R=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let A=y===v||!i&&y.startsWith(v)&&y.charAt(R)==="/",M=I!=null&&(I===v||!i&&I.startsWith(v)&&I.charAt(v.length)==="/"),b={isActive:A,isPending:M,isTransitioning:m},_=A?e:void 0,F;typeof r=="function"?F=r(b):F=[r,A?"active":null,M?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let B=typeof o=="function"?o(b):o;return K.createElement(Qw,{...u,"aria-current":_,className:F,ref:l,style:B,to:a,viewTransition:s},typeof c=="function"?c(b):c)});IF.displayName="NavLink";var wF=K.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:o,method:a=Ul,action:s,onSubmit:c,relative:u,preventScrollReset:l,viewTransition:d,unstable_defaultShouldRevalidate:p,...h},f)=>{let{unstable_useTransitions:g}=K.useContext(zn),m=NF(),v=OF(s,{relative:u}),y=a.toLowerCase()==="get"?"get":"post",I=typeof s=="string"&&Vw.test(s),R=A=>{if(c&&c(A),A.defaultPrevented)return;A.preventDefault();let M=A.nativeEvent.submitter,b=M?.getAttribute("formmethod")||a,_=()=>m(M||A.currentTarget,{fetcherKey:e,method:b,navigate:n,replace:i,state:o,relative:u,preventScrollReset:l,viewTransition:d,unstable_defaultShouldRevalidate:p});g&&n!==!1?K.startTransition(()=>_()):_()};return K.createElement("form",{ref:f,method:y,action:v,onSubmit:r?c:R,...h,"data-discover":!I&&t==="render"?"true":void 0})});wF.displayName="Form";function RF(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ww(t){let e=K.useContext(Ns);return Pt(e,RF(t)),e}function bF(t,{target:e,replace:n,state:r,preventScrollReset:i,relative:o,viewTransition:a,unstable_defaultShouldRevalidate:s,unstable_useTransitions:c}={}){let u=qw(),l=Zi(),d=Su(t,{relative:o});return K.useCallback(p=>{if(oF(p,e)){p.preventDefault();let h=n!==void 0?n:su(l)===su(d),f=()=>u(t,{replace:h,state:r,preventScrollReset:i,relative:o,viewTransition:a,unstable_defaultShouldRevalidate:s});c?K.startTransition(()=>f()):f()}},[l,u,d,n,r,e,t,i,o,a,s,c])}var kF=0,PF=()=>`__${String(++kF)}__`;function NF(){let{router:t}=Ww("useSubmit"),{basename:e}=K.useContext(zn),n=WL(),r=t.fetch,i=t.navigate;return K.useCallback(async(o,a={})=>{let{action:s,method:c,encType:u,formData:l,body:d}=cF(o,e);if(a.navigate===!1){let p=a.fetcherKey||PF();await r(p,n,a.action||s,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:d,formMethod:a.method||c,formEncType:a.encType||u,flushSync:a.flushSync})}else await i(a.action||s,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:d,formMethod:a.method||c,formEncType:a.encType||u,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,e,n])}function OF(t,{relative:e}={}){let{basename:n}=K.useContext(zn),r=K.useContext(li);Pt(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),o={...Su(t||".",{relative:e})},a=Zi();if(t==null){o.search=a.search;let s=new URLSearchParams(o.search),c=s.getAll("index");if(c.some(l=>l==="")){s.delete("index"),c.filter(d=>d).forEach(d=>s.append("index",d));let l=s.toString();o.search=l?`?${l}`:""}}return(!t||t===".")&&i.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Zr([n,o.pathname])),su(o)}function DF(t,{relative:e}={}){let n=K.useContext(Hw);Pt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ww("useViewTransitionState"),i=Su(t,{relative:e});if(!n.isTransitioning)return!1;let o=ci(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=ci(n.nextLocation.pathname,r)||n.nextLocation.pathname;return th(i.pathname,a)!=null||th(i.pathname,o)!=null}class Jw extends ge.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,n){console.error("Error caught in boundary:",e,n)}render(){return this.state.hasError?this.props.fallback??oe.jsx("div",{children:"Something went wrong."}):this.props.children}}const MF=({routes:t,fallbackUI:e})=>{const n=Zi(),r=t.find(o=>o.path===n.pathname);if(!r)return e??oe.jsx("div",{children:"404 - Page Not Found"});const i=r.component;return oe.jsx(Jw,{fallback:r.errorFallback,children:oe.jsx(i,{})})};let nm=null;const xF=t=>{nm=t},UF=()=>{if(!nm)throw new Error("Navigate function not initialized.");return nm},LF=()=>{const t=qw();return ge.useEffect(()=>{xF(t)},[t]),null},FF=({routes:t,fallbackUI:e})=>oe.jsxs(AF,{children:[oe.jsx(LF,{}),oe.jsx(MF,{routes:t,fallbackUI:e})]});function Xw(t,e){return function(){return t.apply(e,arguments)}}const{toString:HF}=Object.prototype,{getPrototypeOf:Cy}=Object,{iterator:Yh,toStringTag:Zw}=Symbol,zh=(t=>e=>{const n=HF.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),lr=t=>(t=t.toLowerCase(),e=>zh(e)===t),jh=t=>e=>typeof e===t,{isArray:Os}=Array,Ss=jh("undefined");function Au(t){return t!==null&&!Ss(t)&&t.constructor!==null&&!Ss(t.constructor)&&vn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const eR=lr("ArrayBuffer");function BF(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&eR(t.buffer),e}const KF=jh("string"),vn=jh("function"),tR=jh("number"),Iu=t=>t!==null&&typeof t=="object",GF=t=>t===!0||t===!1,Fl=t=>{if(zh(t)!=="object")return!1;const e=Cy(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Zw in t)&&!(Yh in t)},qF=t=>{if(!Iu(t)||Au(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},$F=lr("Date"),YF=lr("File"),zF=lr("Blob"),jF=lr("FileList"),VF=t=>Iu(t)&&vn(t.pipe),QF=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||vn(t.append)&&((e=zh(t))==="formdata"||e==="object"&&vn(t.toString)&&t.toString()==="[object FormData]"))},WF=lr("URLSearchParams"),[JF,XF,ZF,eH]=["ReadableStream","Request","Response","Headers"].map(lr),tH=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function wu(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),Os(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{if(Au(t))return;const o=n?Object.getOwnPropertyNames(t):Object.keys(t),a=o.length;let s;for(r=0;r<a;r++)s=o[r],e.call(null,t[s],s,t)}}function nR(t,e){if(Au(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r=n.length,i;for(;r-- >0;)if(i=n[r],e===i.toLowerCase())return i;return null}const ko=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,rR=t=>!Ss(t)&&t!==ko;function rm(){const{caseless:t,skipUndefined:e}=rR(this)&&this||{},n={},r=(i,o)=>{const a=t&&nR(n,o)||o;Fl(n[a])&&Fl(i)?n[a]=rm(n[a],i):Fl(i)?n[a]=rm({},i):Os(i)?n[a]=i.slice():(!e||!Ss(i))&&(n[a]=i)};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&wu(arguments[i],r);return n}const nH=(t,e,n,{allOwnKeys:r}={})=>(wu(e,(i,o)=>{n&&vn(i)?t[o]=Xw(i,n):t[o]=i},{allOwnKeys:r}),t),rH=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),iH=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},oH=(t,e,n,r)=>{let i,o,a;const s={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)a=i[o],(!r||r(a,t,e))&&!s[a]&&(e[a]=t[a],s[a]=!0);t=n!==!1&&Cy(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},aH=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},sH=t=>{if(!t)return null;if(Os(t))return t;let e=t.length;if(!tR(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},cH=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Cy(Uint8Array)),uH=(t,e)=>{const r=(t&&t[Yh]).call(t);let i;for(;(i=r.next())&&!i.done;){const o=i.value;e.call(t,o[0],o[1])}},lH=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},dH=lr("HTMLFormElement"),hH=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),vE=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),fH=lr("RegExp"),iR=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};wu(n,(i,o)=>{let a;(a=e(i,o,t))!==!1&&(r[o]=a||i)}),Object.defineProperties(t,r)},pH=t=>{iR(t,(e,n)=>{if(vn(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(vn(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},gH=(t,e)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return Os(t)?r(t):r(String(t).split(e)),n},mH=()=>{},vH=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function yH(t){return!!(t&&vn(t.append)&&t[Zw]==="FormData"&&t[Yh])}const CH=t=>{const e=new Array(10),n=(r,i)=>{if(Iu(r)){if(e.indexOf(r)>=0)return;if(Au(r))return r;if(!("toJSON"in r)){e[i]=r;const o=Os(r)?[]:{};return wu(r,(a,s)=>{const c=n(a,i+1);!Ss(c)&&(o[s]=c)}),e[i]=void 0,o}}return r};return n(t,0)},TH=lr("AsyncFunction"),EH=t=>t&&(Iu(t)||vn(t))&&vn(t.then)&&vn(t.catch),oR=((t,e)=>t?setImmediate:e?((n,r)=>(ko.addEventListener("message",({source:i,data:o})=>{i===ko&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),ko.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",vn(ko.postMessage)),_H=typeof queueMicrotask<"u"?queueMicrotask.bind(ko):typeof process<"u"&&process.nextTick||oR,SH=t=>t!=null&&vn(t[Yh]),x={isArray:Os,isArrayBuffer:eR,isBuffer:Au,isFormData:QF,isArrayBufferView:BF,isString:KF,isNumber:tR,isBoolean:GF,isObject:Iu,isPlainObject:Fl,isEmptyObject:qF,isReadableStream:JF,isRequest:XF,isResponse:ZF,isHeaders:eH,isUndefined:Ss,isDate:$F,isFile:YF,isBlob:zF,isRegExp:fH,isFunction:vn,isStream:VF,isURLSearchParams:WF,isTypedArray:cH,isFileList:jF,forEach:wu,merge:rm,extend:nH,trim:tH,stripBOM:rH,inherits:iH,toFlatObject:oH,kindOf:zh,kindOfTest:lr,endsWith:aH,toArray:sH,forEachEntry:uH,matchAll:lH,isHTMLForm:dH,hasOwnProperty:vE,hasOwnProp:vE,reduceDescriptors:iR,freezeMethods:pH,toObjectSet:gH,toCamelCase:hH,noop:mH,toFiniteNumber:vH,findKey:nR,global:ko,isContextDefined:rR,isSpecCompliantForm:yH,toJSONObject:CH,isAsyncFn:TH,isThenable:EH,setImmediate:oR,asap:_H,isIterable:SH};function De(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}x.inherits(De,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:x.toJSONObject(this.config),code:this.code,status:this.status}}});const aR=De.prototype,sR={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{sR[t]={value:t}});Object.defineProperties(De,sR);Object.defineProperty(aR,"isAxiosError",{value:!0});De.from=(t,e,n,r,i,o)=>{const a=Object.create(aR);x.toFlatObject(t,a,function(l){return l!==Error.prototype},u=>u!=="isAxiosError");const s=t&&t.message?t.message:"Error",c=e==null&&t?t.code:e;return De.call(a,s,c,n,r,i),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",o&&Object.assign(a,o),a};const AH=null;function im(t){return x.isPlainObject(t)||x.isArray(t)}function cR(t){return x.endsWith(t,"[]")?t.slice(0,-2):t}function yE(t,e,n){return t?t.concat(e).map(function(i,o){return i=cR(i),!n&&o?"["+i+"]":i}).join(n?".":""):e}function IH(t){return x.isArray(t)&&!t.some(im)}const wH=x.toFlatObject(x,{},null,function(e){return/^is[A-Z]/.test(e)});function Vh(t,e,n){if(!x.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=x.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,m){return!x.isUndefined(m[g])});const r=n.metaTokens,i=n.visitor||l,o=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&x.isSpecCompliantForm(e);if(!x.isFunction(i))throw new TypeError("visitor must be a function");function u(f){if(f===null)return"";if(x.isDate(f))return f.toISOString();if(x.isBoolean(f))return f.toString();if(!c&&x.isBlob(f))throw new De("Blob is not supported. Use a Buffer instead.");return x.isArrayBuffer(f)||x.isTypedArray(f)?c&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function l(f,g,m){let v=f;if(f&&!m&&typeof f=="object"){if(x.endsWith(g,"{}"))g=r?g:g.slice(0,-2),f=JSON.stringify(f);else if(x.isArray(f)&&IH(f)||(x.isFileList(f)||x.endsWith(g,"[]"))&&(v=x.toArray(f)))return g=cR(g),v.forEach(function(I,R){!(x.isUndefined(I)||I===null)&&e.append(a===!0?yE([g],R,o):a===null?g:g+"[]",u(I))}),!1}return im(f)?!0:(e.append(yE(m,g,o),u(f)),!1)}const d=[],p=Object.assign(wH,{defaultVisitor:l,convertValue:u,isVisitable:im});function h(f,g){if(!x.isUndefined(f)){if(d.indexOf(f)!==-1)throw Error("Circular reference detected in "+g.join("."));d.push(f),x.forEach(f,function(v,y){(!(x.isUndefined(v)||v===null)&&i.call(e,v,x.isString(y)?y.trim():y,g,p))===!0&&h(v,g?g.concat(y):[y])}),d.pop()}}if(!x.isObject(t))throw new TypeError("data must be an object");return h(t),e}function CE(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Ty(t,e){this._pairs=[],t&&Vh(t,this,e)}const uR=Ty.prototype;uR.append=function(e,n){this._pairs.push([e,n])};uR.toString=function(e){const n=e?function(r){return e.call(this,r,CE)}:CE;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function RH(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function lR(t,e,n){if(!e)return t;const r=n&&n.encode||RH;x.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(e,n):o=x.isURLSearchParams(e)?e.toString():new Ty(e,n).toString(r),o){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class TE{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){x.forEach(this.handlers,function(r){r!==null&&e(r)})}}const dR={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},bH=typeof URLSearchParams<"u"?URLSearchParams:Ty,kH=typeof FormData<"u"?FormData:null,PH=typeof Blob<"u"?Blob:null,NH={isBrowser:!0,classes:{URLSearchParams:bH,FormData:kH,Blob:PH},protocols:["http","https","file","blob","url","data"]},Ey=typeof window<"u"&&typeof document<"u",om=typeof navigator=="object"&&navigator||void 0,OH=Ey&&(!om||["ReactNative","NativeScript","NS"].indexOf(om.product)<0),DH=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",MH=Ey&&window.location.href||"http://localhost",xH=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ey,hasStandardBrowserEnv:OH,hasStandardBrowserWebWorkerEnv:DH,navigator:om,origin:MH},Symbol.toStringTag,{value:"Module"})),Qt={...xH,...NH};function UH(t,e){return Vh(t,new Qt.classes.URLSearchParams,{visitor:function(n,r,i,o){return Qt.isNode&&x.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function LH(t){return x.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function FH(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],e[o]=t[o];return e}function hR(t){function e(n,r,i,o){let a=n[o++];if(a==="__proto__")return!0;const s=Number.isFinite(+a),c=o>=n.length;return a=!a&&x.isArray(i)?i.length:a,c?(x.hasOwnProp(i,a)?i[a]=[i[a],r]:i[a]=r,!s):((!i[a]||!x.isObject(i[a]))&&(i[a]=[]),e(n,r,i[a],o)&&x.isArray(i[a])&&(i[a]=FH(i[a])),!s)}if(x.isFormData(t)&&x.isFunction(t.entries)){const n={};return x.forEachEntry(t,(r,i)=>{e(LH(r),i,n,0)}),n}return null}function HH(t,e,n){if(x.isString(t))try{return(e||JSON.parse)(t),x.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const Ru={transitional:dR,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=x.isObject(e);if(o&&x.isHTMLForm(e)&&(e=new FormData(e)),x.isFormData(e))return i?JSON.stringify(hR(e)):e;if(x.isArrayBuffer(e)||x.isBuffer(e)||x.isStream(e)||x.isFile(e)||x.isBlob(e)||x.isReadableStream(e))return e;if(x.isArrayBufferView(e))return e.buffer;if(x.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return UH(e,this.formSerializer).toString();if((s=x.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Vh(s?{"files[]":e}:e,c&&new c,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),HH(e)):e}],transformResponse:[function(e){const n=this.transitional||Ru.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(x.isResponse(e)||x.isReadableStream(e))return e;if(e&&x.isString(e)&&(r&&!this.responseType||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(s){if(a)throw s.name==="SyntaxError"?De.from(s,De.ERR_BAD_RESPONSE,this,null,this.response):s}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Qt.classes.FormData,Blob:Qt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};x.forEach(["delete","get","head","post","put","patch"],t=>{Ru.headers[t]={}});const BH=x.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),KH=t=>{const e={};let n,r,i;return t&&t.split(`
|
|
23
|
-
|
|
24
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[EE]=this[EE]={accessors:{}}).accessors,i=this.prototype;function o(a){const s=dc(a);r[s]||(YH(i,a),r[s]=!0)}return x.isArray(e)?e.forEach(o):o(e),this}};yn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);x.reduceDescriptors(yn.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});x.freezeMethods(yn);function Up(t,e){const n=this||Ru,r=e||n,i=yn.from(r.headers);let o=r.data;return x.forEach(t,function(s){o=s.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function fR(t){return!!(t&&t.__CANCEL__)}function Ds(t,e,n){De.call(this,t??"canceled",De.ERR_CANCELED,e,n),this.name="CanceledError"}x.inherits(Ds,De,{__CANCEL__:!0});function pR(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new De("Request failed with status code "+n.status,[De.ERR_BAD_REQUEST,De.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function zH(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function jH(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,o=0,a;return e=e!==void 0?e:1e3,function(c){const u=Date.now(),l=r[o];a||(a=u),n[i]=c,r[i]=u;let d=o,p=0;for(;d!==i;)p+=n[d++],d=d%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),u-a<e)return;const h=l&&u-l;return h?Math.round(p*1e3/h):void 0}}function VH(t,e){let n=0,r=1e3/e,i,o;const a=(u,l=Date.now())=>{n=l,i=null,o&&(clearTimeout(o),o=null),t(...u)};return[(...u)=>{const l=Date.now(),d=l-n;d>=r?a(u,l):(i=u,o||(o=setTimeout(()=>{o=null,a(i)},r-d)))},()=>i&&a(i)]}const nh=(t,e,n=3)=>{let r=0;const i=jH(50,250);return VH(o=>{const a=o.loaded,s=o.lengthComputable?o.total:void 0,c=a-r,u=i(c),l=a<=s;r=a;const d={loaded:a,total:s,progress:s?a/s:void 0,bytes:c,rate:u||void 0,estimated:u&&s&&l?(s-a)/u:void 0,event:o,lengthComputable:s!=null,[e?"download":"upload"]:!0};t(d)},n)},_E=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},SE=t=>(...e)=>x.asap(()=>t(...e)),QH=Qt.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Qt.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Qt.origin),Qt.navigator&&/(msie|trident)/i.test(Qt.navigator.userAgent)):()=>!0,WH=Qt.hasStandardBrowserEnv?{write(t,e,n,r,i,o,a){if(typeof document>"u")return;const s=[`${t}=${encodeURIComponent(e)}`];x.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),x.isString(r)&&s.push(`path=${r}`),x.isString(i)&&s.push(`domain=${i}`),o===!0&&s.push("secure"),x.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function JH(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function XH(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function gR(t,e,n){let r=!JH(e);return t&&(r||n==!1)?XH(t,e):e}const AE=t=>t instanceof yn?{...t}:t;function ea(t,e){e=e||{};const n={};function r(u,l,d,p){return x.isPlainObject(u)&&x.isPlainObject(l)?x.merge.call({caseless:p},u,l):x.isPlainObject(l)?x.merge({},l):x.isArray(l)?l.slice():l}function i(u,l,d,p){if(x.isUndefined(l)){if(!x.isUndefined(u))return r(void 0,u,d,p)}else return r(u,l,d,p)}function o(u,l){if(!x.isUndefined(l))return r(void 0,l)}function a(u,l){if(x.isUndefined(l)){if(!x.isUndefined(u))return r(void 0,u)}else return r(void 0,l)}function s(u,l,d){if(d in e)return r(u,l);if(d in t)return r(void 0,u)}const c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(u,l,d)=>i(AE(u),AE(l),d,!0)};return x.forEach(Object.keys({...t,...e}),function(l){const d=c[l]||i,p=d(t[l],e[l],l);x.isUndefined(p)&&d!==s||(n[l]=p)}),n}const mR=t=>{const e=ea({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:a,auth:s}=e;if(e.headers=a=yn.from(a),e.url=lR(gR(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),s&&a.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),x.isFormData(n)){if(Qt.hasStandardBrowserEnv||Qt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(x.isFunction(n.getHeaders)){const c=n.getHeaders(),u=["content-type","content-length"];Object.entries(c).forEach(([l,d])=>{u.includes(l.toLowerCase())&&a.set(l,d)})}}if(Qt.hasStandardBrowserEnv&&(r&&x.isFunction(r)&&(r=r(e)),r||r!==!1&&QH(e.url))){const c=i&&o&&WH.read(o);c&&a.set(i,c)}return e},ZH=typeof XMLHttpRequest<"u",e1=ZH&&function(t){return new Promise(function(n,r){const i=mR(t);let o=i.data;const a=yn.from(i.headers).normalize();let{responseType:s,onUploadProgress:c,onDownloadProgress:u}=i,l,d,p,h,f;function g(){h&&h(),f&&f(),i.cancelToken&&i.cancelToken.unsubscribe(l),i.signal&&i.signal.removeEventListener("abort",l)}let m=new XMLHttpRequest;m.open(i.method.toUpperCase(),i.url,!0),m.timeout=i.timeout;function v(){if(!m)return;const I=yn.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),A={data:!s||s==="text"||s==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:I,config:t,request:m};pR(function(b){n(b),g()},function(b){r(b),g()},A),m=null}"onloadend"in m?m.onloadend=v:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(v)},m.onabort=function(){m&&(r(new De("Request aborted",De.ECONNABORTED,t,m)),m=null)},m.onerror=function(R){const A=R&&R.message?R.message:"Network Error",M=new De(A,De.ERR_NETWORK,t,m);M.event=R||null,r(M),m=null},m.ontimeout=function(){let R=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const A=i.transitional||dR;i.timeoutErrorMessage&&(R=i.timeoutErrorMessage),r(new De(R,A.clarifyTimeoutError?De.ETIMEDOUT:De.ECONNABORTED,t,m)),m=null},o===void 0&&a.setContentType(null),"setRequestHeader"in m&&x.forEach(a.toJSON(),function(R,A){m.setRequestHeader(A,R)}),x.isUndefined(i.withCredentials)||(m.withCredentials=!!i.withCredentials),s&&s!=="json"&&(m.responseType=i.responseType),u&&([p,f]=nh(u,!0),m.addEventListener("progress",p)),c&&m.upload&&([d,h]=nh(c),m.upload.addEventListener("progress",d),m.upload.addEventListener("loadend",h)),(i.cancelToken||i.signal)&&(l=I=>{m&&(r(!I||I.type?new Ds(null,t,m):I),m.abort(),m=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const y=zH(i.url);if(y&&Qt.protocols.indexOf(y)===-1){r(new De("Unsupported protocol "+y+":",De.ERR_BAD_REQUEST,t));return}m.send(o||null)})},t1=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const o=function(u){if(!i){i=!0,s();const l=u instanceof Error?u:this.reason;r.abort(l instanceof De?l:new Ds(l instanceof Error?l.message:l))}};let a=e&&setTimeout(()=>{a=null,o(new De(`timeout ${e} of ms exceeded`,De.ETIMEDOUT))},e);const s=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),t=null)};t.forEach(u=>u.addEventListener("abort",o));const{signal:c}=r;return c.unsubscribe=()=>x.asap(s),c}},n1=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,i;for(;r<n;)i=r+e,yield t.slice(r,i),r=i},r1=async function*(t,e){for await(const n of i1(t))yield*n1(n,e)},i1=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},IE=(t,e,n,r)=>{const i=r1(t,e);let o=0,a,s=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:l}=await i.next();if(u){s(),c.close();return}let d=l.byteLength;if(n){let p=o+=d;n(p)}c.enqueue(new Uint8Array(l))}catch(u){throw s(u),u}},cancel(c){return s(c),i.return()}},{highWaterMark:2})},wE=64*1024,{isFunction:hl}=x,o1=(({Request:t,Response:e})=>({Request:t,Response:e}))(x.global),{ReadableStream:RE,TextEncoder:bE}=x.global,kE=(t,...e)=>{try{return!!t(...e)}catch{return!1}},a1=t=>{t=x.merge.call({skipUndefined:!0},o1,t);const{fetch:e,Request:n,Response:r}=t,i=e?hl(e):typeof fetch=="function",o=hl(n),a=hl(r);if(!i)return!1;const s=i&&hl(RE),c=i&&(typeof bE=="function"?(f=>g=>f.encode(g))(new bE):async f=>new Uint8Array(await new n(f).arrayBuffer())),u=o&&s&&kE(()=>{let f=!1;const g=new n(Qt.origin,{body:new RE,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!g}),l=a&&s&&kE(()=>x.isReadableStream(new r("").body)),d={stream:l&&(f=>f.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!d[f]&&(d[f]=(g,m)=>{let v=g&&g[f];if(v)return v.call(g);throw new De(`Response type '${f}' is not supported`,De.ERR_NOT_SUPPORT,m)})});const p=async f=>{if(f==null)return 0;if(x.isBlob(f))return f.size;if(x.isSpecCompliantForm(f))return(await new n(Qt.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(x.isArrayBufferView(f)||x.isArrayBuffer(f))return f.byteLength;if(x.isURLSearchParams(f)&&(f=f+""),x.isString(f))return(await c(f)).byteLength},h=async(f,g)=>{const m=x.toFiniteNumber(f.getContentLength());return m??p(g)};return async f=>{let{url:g,method:m,data:v,signal:y,cancelToken:I,timeout:R,onDownloadProgress:A,onUploadProgress:M,responseType:b,headers:_,withCredentials:F="same-origin",fetchOptions:B}=mR(f),Q=e||fetch;b=b?(b+"").toLowerCase():"text";let ie=t1([y,I&&I.toAbortSignal()],R),se=null;const E=ie&&ie.unsubscribe&&(()=>{ie.unsubscribe()});let P;try{if(M&&u&&m!=="get"&&m!=="head"&&(P=await h(_,v))!==0){let k=new n(g,{method:"POST",body:v,duplex:"half"}),D;if(x.isFormData(v)&&(D=k.headers.get("content-type"))&&_.setContentType(D),k.body){const[T,C]=_E(P,nh(SE(M)));v=IE(k.body,wE,T,C)}}x.isString(F)||(F=F?"include":"omit");const Y=o&&"credentials"in n.prototype,U={...B,signal:ie,method:m.toUpperCase(),headers:_.normalize().toJSON(),body:v,duplex:"half",credentials:Y?F:void 0};se=o&&new n(g,U);let O=await(o?Q(se,B):Q(g,U));const le=l&&(b==="stream"||b==="response");if(l&&(A||le&&E)){const k={};["status","statusText","headers"].forEach(L=>{k[L]=O[L]});const D=x.toFiniteNumber(O.headers.get("content-length")),[T,C]=A&&_E(D,nh(SE(A),!0))||[];O=new r(IE(O.body,wE,T,()=>{C&&C(),E&&E()}),k)}b=b||"text";let ve=await d[x.findKey(d,b)||"text"](O,f);return!le&&E&&E(),await new Promise((k,D)=>{pR(k,D,{data:ve,headers:yn.from(O.headers),status:O.status,statusText:O.statusText,config:f,request:se})})}catch(Y){throw E&&E(),Y&&Y.name==="TypeError"&&/Load failed|fetch/i.test(Y.message)?Object.assign(new De("Network Error",De.ERR_NETWORK,f,se),{cause:Y.cause||Y}):De.from(Y,Y&&Y.code,f,se)}}},s1=new Map,vR=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:i}=e,o=[r,i,n];let a=o.length,s=a,c,u,l=s1;for(;s--;)c=o[s],u=l.get(c),u===void 0&&l.set(c,u=s?new Map:a1(e)),l=u;return u};vR();const _y={http:AH,xhr:e1,fetch:{get:vR}};x.forEach(_y,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const PE=t=>`- ${t}`,c1=t=>x.isFunction(t)||t===null||t===!1;function u1(t,e){t=x.isArray(t)?t:[t];const{length:n}=t;let r,i;const o={};for(let a=0;a<n;a++){r=t[a];let s;if(i=r,!c1(r)&&(i=_y[(s=String(r)).toLowerCase()],i===void 0))throw new De(`Unknown adapter '${s}'`);if(i&&(x.isFunction(i)||(i=i.get(e))))break;o[s||"#"+a]=i}if(!i){const a=Object.entries(o).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let s=n?a.length>1?`since :
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`+o):r.stack=o}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=ea(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&Bl.assertOptions(r,{silentJSONParsing:gr.transitional(gr.boolean),forcedJSONParsing:gr.transitional(gr.boolean),clarifyTimeoutError:gr.transitional(gr.boolean)},!1),i!=null&&(x.isFunction(i)?n.paramsSerializer={serialize:i}:Bl.assertOptions(i,{encode:gr.function,serialize:gr.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Bl.assertOptions(n,{baseUrl:gr.spelling("baseURL"),withXsrfToken:gr.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=o&&x.merge(o.common,o[n.method]);o&&x.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),n.headers=yn.concat(a,o);const s=[];let c=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(c=c&&g.synchronous,s.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let l,d=0,p;if(!c){const f=[NE.bind(this),void 0];for(f.unshift(...s),f.push(...u),p=f.length,l=Promise.resolve(n);d<p;)l=l.then(f[d++],f[d++]);return l}p=s.length;let h=n;for(;d<p;){const f=s[d++],g=s[d++];try{h=f(h)}catch(m){g.call(this,m);break}}try{l=NE.call(this,h)}catch(f){return Promise.reject(f)}for(d=0,p=u.length;d<p;)l=l.then(u[d++],u[d++]);return l}getUri(e){e=ea(this.defaults,e);const n=gR(e.baseURL,e.url,e.allowAbsoluteUrls);return lR(n,e.params,e.paramsSerializer)}};x.forEach(["delete","get","head","options"],function(e){Ko.prototype[e]=function(n,r){return this.request(ea(r||{},{method:e,url:n,data:(r||{}).data}))}});x.forEach(["post","put","patch"],function(e){function n(r){return function(o,a,s){return this.request(ea(s||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:a}))}}Ko.prototype[e]=n(),Ko.prototype[e+"Form"]=n(!0)});let d1=class TR{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(i=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const a=new Promise(s=>{r.subscribe(s),o=s}).then(i);return a.cancel=function(){r.unsubscribe(o)},a},e(function(o,a,s){r.reason||(r.reason=new Ds(o,a,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new TR(function(i){e=i}),cancel:e}}};function h1(t){return function(n){return t.apply(null,n)}}function f1(t){return x.isObject(t)&&t.isAxiosError===!0}const am={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(am).forEach(([t,e])=>{am[e]=t});function ER(t){const e=new Ko(t),n=Xw(Ko.prototype.request,e);return x.extend(n,Ko.prototype,e,{allOwnKeys:!0}),x.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return ER(ea(t,i))},n}const yt=ER(Ru);yt.Axios=Ko;yt.CanceledError=Ds;yt.CancelToken=d1;yt.isCancel=fR;yt.VERSION=CR;yt.toFormData=Vh;yt.AxiosError=De;yt.Cancel=yt.CanceledError;yt.all=function(e){return Promise.all(e)};yt.spread=h1;yt.isAxiosError=f1;yt.mergeConfig=ea;yt.AxiosHeaders=yn;yt.formToJSON=t=>hR(x.isHTMLForm(t)?new FormData(t):t);yt.getAdapter=yR.getAdapter;yt.HttpStatusCode=am;yt.default=yt;const{Axios:SB,AxiosError:AB,CanceledError:IB,isCancel:wB,CancelToken:RB,VERSION:bB,all:kB,Cancel:PB,isAxiosError:NB,spread:OB,toFormData:DB,AxiosHeaders:MB,HttpStatusCode:xB,formToJSON:UB,getAdapter:LB,mergeConfig:FB}=yt;let _R="",SR={};const p1=({endpoint:t,headers:e})=>{_R=t,SR=e||{}},Wh=async(t,e,n)=>{try{const r={method:t,url:`${_R}${e}`,data:n,headers:SR};return(await yt(r)).data}catch(r){const i=r.response?.data?.message||r.message||"Unknown error";throw new Error(i)}},AR=t=>Wh("GET",t),IR=(t,e)=>Wh("POST",t,e),wR=(t,e)=>Wh("PUT",t,e),RR=t=>Wh("DELETE",t);var Ms=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},g1={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},m1=class{#e=g1;#t=!1;setTimeoutProvider(t){process.env.NODE_ENV!=="production"&&this.#t&&t!==this.#e&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#e,provider:t}),this.#e=t,process.env.NODE_ENV!=="production"&&(this.#t=!1)}setTimeout(t,e){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},Po=new m1;function v1(t){setTimeout(t,0)}var ta=typeof window>"u"||"Deno"in globalThis;function tn(){}function y1(t,e){return typeof t=="function"?t(e):t}function sm(t){return typeof t=="number"&&t>=0&&t!==1/0}function bR(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Yi(t,e){return typeof t=="function"?t(e):t}function Fn(t,e){return typeof t=="function"?t(e):t}function DE(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:a,stale:s}=t;if(a){if(r){if(e.queryHash!==Sy(a,e.options))return!1}else if(!cu(e.queryKey,a))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof s=="boolean"&&e.isStale()!==s||i&&i!==e.state.fetchStatus||o&&!o(e))}function ME(t,e){const{exact:n,status:r,predicate:i,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(na(e.options.mutationKey)!==na(o))return!1}else if(!cu(e.options.mutationKey,o))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Sy(t,e){return(e?.queryKeyHashFn||na)(t)}function na(t){return JSON.stringify(t,(e,n)=>um(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function cu(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>cu(t[n],e[n])):!1}var C1=Object.prototype.hasOwnProperty;function cm(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=xE(t)&&xE(e);if(!r&&!(um(t)&&um(e)))return e;const o=(r?t:Object.keys(t)).length,a=r?e:Object.keys(e),s=a.length,c=r?new Array(s):{};let u=0;for(let l=0;l<s;l++){const d=r?l:a[l],p=t[d],h=e[d];if(p===h){c[d]=p,(r?l<o:C1.call(t,d))&&u++;continue}if(p===null||h===null||typeof p!="object"||typeof h!="object"){c[d]=h;continue}const f=cm(p,h,n+1);c[d]=f,f===p&&u++}return o===s&&u===o?t:c}function rh(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function xE(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function um(t){if(!UE(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!UE(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function UE(t){return Object.prototype.toString.call(t)==="[object Object]"}function T1(t){return new Promise(e=>{Po.setTimeout(e,t)})}function lm(t,e,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(t,e);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return cm(t,e)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return cm(t,e)}return e}function E1(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function _1(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var ih=Symbol();function kR(t,e){return process.env.NODE_ENV!=="production"&&t.queryFn===ih&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`),!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===ih?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Ay(t,e){return typeof t=="function"?t(...e):!!t}function S1(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??=e(),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var A1=class extends Ms{#e;#t;#n;constructor(){super(),this.#n=t=>{if(!ta&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#n=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Iy=new A1;function dm(){let t,e;const n=new Promise((i,o)=>{t=i,e=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var I1=v1;function w1(){let t=[],e=0,n=s=>{s()},r=s=>{s()},i=I1;const o=s=>{e?t.push(s):i(()=>{n(s)})},a=()=>{const s=t;t=[],s.length&&i(()=>{r(()=>{s.forEach(c=>{n(c)})})})};return{batch:s=>{let c;e++;try{c=s()}finally{e--,e||a()}return c},batchCalls:s=>(...c)=>{o(()=>{s(...c)})},schedule:o,setNotifyFunction:s=>{n=s},setBatchNotifyFunction:s=>{r=s},setScheduler:s=>{i=s}}}var Rt=w1(),R1=class extends Ms{#e=!0;#t;#n;constructor(){super(),this.#n=t=>{if(!ta&&window.addEventListener){const e=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#n=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(n=>{n(t)}))}isOnline(){return this.#e}},oh=new R1;function b1(t){return Math.min(1e3*2**t,3e4)}function PR(t){return(t??"online")==="online"?oh.isOnline():!0}var hm=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function NR(t){let e=!1,n=0,r;const i=dm(),o=()=>i.status!=="pending",a=g=>{if(!o()){const m=new hm(g);p(m),t.onCancel?.(m)}},s=()=>{e=!0},c=()=>{e=!1},u=()=>Iy.isFocused()&&(t.networkMode==="always"||oh.isOnline())&&t.canRun(),l=()=>PR(t.networkMode)&&t.canRun(),d=g=>{o()||(r?.(),i.resolve(g))},p=g=>{o()||(r?.(),i.reject(g))},h=()=>new Promise(g=>{r=m=>{(o()||u())&&g(m)},t.onPause?.()}).then(()=>{r=void 0,o()||t.onContinue?.()}),f=()=>{if(o())return;let g;const m=n===0?t.initialPromise:void 0;try{g=m??t.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(d).catch(v=>{if(o())return;const y=t.retry??(ta?0:3),I=t.retryDelay??b1,R=typeof I=="function"?I(n,v):I,A=y===!0||typeof y=="number"&&n<y||typeof y=="function"&&y(n,v);if(e||!A){p(v);return}n++,t.onFail?.(n,v),T1(R).then(()=>u()?void 0:h()).then(()=>{e?p(v):f()})})};return{promise:i,status:()=>i.status,cancel:a,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:l,start:()=>(l()?f():h().then(f),i)}}var OR=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),sm(this.gcTime)&&(this.#e=Po.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(ta?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Po.clearTimeout(this.#e),this.#e=void 0)}},k1=class extends OR{#e;#t;#n;#i;#r;#a;#s;constructor(t){super(),this.#s=!1,this.#a=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#i=t.client,this.#n=this.#i.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#e=FE(this.options),this.state=t.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(t){if(this.options={...this.#a,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=FE(this.options);e.data!==void 0&&(this.setState(LE(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(t,e){const n=lm(this.state.data,t,this.options);return this.#o({data:n,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),n}setState(t,e){this.#o({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#r?.promise;return this.#r?.cancel(t),e?e.then(tn).catch(tn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(t=>Fn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ih||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Yi(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!bR(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#r&&(this.#s?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(t&&this.setOptions(t),!this.options.queryFn){const s=this.observers.find(c=>c.options.queryFn);s&&this.setOptions(s.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,r=s=>{Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{const s=kR(this.options,e),u=(()=>{const l={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(l),l})();return this.#s=!1,this.options.persister?this.options.persister(s,u,this):s(u)},a=(()=>{const s={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(s),s})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#o({type:"fetch",meta:a.fetchOptions?.meta}),this.#r=NR({initialPromise:e?.initialPromise,fn:a.fetchFn,onCancel:s=>{s instanceof hm&&s.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(s,c)=>{this.#o({type:"failed",failureCount:s,error:c})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const s=await this.#r.start();if(s===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(s),this.#n.config.onSuccess?.(s,this),this.#n.config.onSettled?.(s,this.state.error,this),s}catch(s){if(s instanceof hm){if(s.silent)return this.#r.promise;if(s.revert){if(this.state.data===void 0)throw s;return this.state.data}}throw this.#o({type:"error",error:s}),this.#n.config.onError?.(s,this),this.#n.config.onSettled?.(this.state.data,s,this),s}finally{this.scheduleGc()}}#o(t){const e=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...DR(n.data,this.options),fetchMeta:t.meta??null};case"success":const r={...n,...LE(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=t.manual?r:void 0,r;case"error":const i=t.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=e(this.state),Rt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:t})})}};function DR(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:PR(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function LE(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function FE(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var P1=class extends Ms{constructor(t,e){super(),this.options=e,this.#e=t,this.#o=null,this.#s=dm(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#n=void 0;#i=void 0;#r;#a;#s;#o;#g;#h;#f;#u;#l;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),HE(this.#t,this.options)?this.#d():this.updateResult(),this.#C())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return fm(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return fm(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#T(),this.#E(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Fn(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#_(),this.#t.setOptions(this.options),e._defaulted&&!rh(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&BE(this.#t,n,this.options,e)&&this.#d(),this.updateResult(),r&&(this.#t!==n||Fn(this.options.enabled,this.#t)!==Fn(e.enabled,this.#t)||Yi(this.options.staleTime,this.#t)!==Yi(e.staleTime,this.#t))&&this.#m();const i=this.#v();r&&(this.#t!==n||Fn(this.options.enabled,this.#t)!==Fn(e.enabled,this.#t)||i!==this.#c)&&this.#y(i)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),n=this.createResult(e,t);return O1(this,n)&&(this.#i=n,this.#a=this.options,this.#r=this.#t.state),n}getCurrentResult(){return this.#i}trackResult(t,e){return new Proxy(t,{get:(n,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#s.status==="pending"&&this.#s.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(t){this.#p.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),n=this.#e.getQueryCache().build(this.#e,e);return n.fetch().then(()=>this.createResult(n,e))}fetch(t){return this.#d({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#d(t){this.#_();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(tn)),e}#m(){this.#T();const t=Yi(this.options.staleTime,this.#t);if(ta||this.#i.isStale||!sm(t))return;const n=bR(this.#i.dataUpdatedAt,t)+1;this.#u=Po.setTimeout(()=>{this.#i.isStale||this.updateResult()},n)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(t){this.#E(),this.#c=t,!(ta||Fn(this.options.enabled,this.#t)===!1||!sm(this.#c)||this.#c===0)&&(this.#l=Po.setInterval(()=>{(this.options.refetchIntervalInBackground||Iy.isFocused())&&this.#d()},this.#c))}#C(){this.#m(),this.#y(this.#v())}#T(){this.#u&&(Po.clearTimeout(this.#u),this.#u=void 0)}#E(){this.#l&&(Po.clearInterval(this.#l),this.#l=void 0)}createResult(t,e){const n=this.#t,r=this.options,i=this.#i,o=this.#r,a=this.#a,c=t!==n?t.state:this.#n,{state:u}=t;let l={...u},d=!1,p;if(e._optimisticResults){const _=this.hasListeners(),F=!_&&HE(t,e),B=_&&BE(t,n,e,r);(F||B)&&(l={...l,...DR(u.data,t.options)}),e._optimisticResults==="isRestoring"&&(l.fetchStatus="idle")}let{error:h,errorUpdatedAt:f,status:g}=l;p=l.data;let m=!1;if(e.placeholderData!==void 0&&p===void 0&&g==="pending"){let _;i?.isPlaceholderData&&e.placeholderData===a?.placeholderData?(_=i.data,m=!0):_=typeof e.placeholderData=="function"?e.placeholderData(this.#f?.state.data,this.#f):e.placeholderData,_!==void 0&&(g="success",p=lm(i?.data,_,e),d=!0)}if(e.select&&p!==void 0&&!m)if(i&&p===o?.data&&e.select===this.#g)p=this.#h;else try{this.#g=e.select,p=e.select(p),p=lm(i?.data,p,e),this.#h=p,this.#o=null}catch(_){this.#o=_}this.#o&&(h=this.#o,p=this.#h,f=Date.now(),g="error");const v=l.fetchStatus==="fetching",y=g==="pending",I=g==="error",R=y&&v,A=p!==void 0,b={status:g,fetchStatus:l.fetchStatus,isPending:y,isSuccess:g==="success",isError:I,isInitialLoading:R,isLoading:R,data:p,dataUpdatedAt:l.dataUpdatedAt,error:h,errorUpdatedAt:f,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>c.dataUpdateCount||l.errorUpdateCount>c.errorUpdateCount,isFetching:v,isRefetching:v&&!y,isLoadingError:I&&!A,isPaused:l.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:I&&A,isStale:wy(t,e),refetch:this.refetch,promise:this.#s,isEnabled:Fn(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const _=Q=>{b.status==="error"?Q.reject(b.error):b.data!==void 0&&Q.resolve(b.data)},F=()=>{const Q=this.#s=b.promise=dm();_(Q)},B=this.#s;switch(B.status){case"pending":t.queryHash===n.queryHash&&_(B);break;case"fulfilled":(b.status==="error"||b.data!==B.value)&&F();break;case"rejected":(b.status!=="error"||b.error!==B.reason)&&F();break}}return b}updateResult(){const t=this.#i,e=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#a=this.options,this.#r.data!==void 0&&(this.#f=this.#t),rh(e,t))return;this.#i=e;const n=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#p.size)return!0;const o=new Set(i??this.#p);return this.options.throwOnError&&o.add("error"),Object.keys(this.#i).some(a=>{const s=a;return this.#i[s]!==t[s]&&o.has(s)})};this.#S({listeners:n()})}#_(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#n=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#C()}#S(t){Rt.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function N1(t,e){return Fn(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function HE(t,e){return N1(t,e)||t.state.data!==void 0&&fm(t,e,e.refetchOnMount)}function fm(t,e,n){if(Fn(e.enabled,t)!==!1&&Yi(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&wy(t,e)}return!1}function BE(t,e,n,r){return(t!==e||Fn(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&wy(t,n)}function wy(t,e){return Fn(e.enabled,t)!==!1&&t.isStaleByTime(Yi(e.staleTime,t))}function O1(t,e){return!rh(t.getCurrentResult(),e)}function KE(t){return{onFetch:(e,n)=>{const r=e.options,i=e.fetchOptions?.meta?.fetchMore?.direction,o=e.state.data?.pages||[],a=e.state.data?.pageParams||[];let s={pages:[],pageParams:[]},c=0;const u=async()=>{let l=!1;const d=f=>{S1(f,()=>e.signal,()=>l=!0)},p=kR(e.options,e.fetchOptions),h=async(f,g,m)=>{if(l)return Promise.reject();if(g==null&&f.pages.length)return Promise.resolve(f);const y=(()=>{const M={client:e.client,queryKey:e.queryKey,pageParam:g,direction:m?"backward":"forward",meta:e.options.meta};return d(M),M})(),I=await p(y),{maxPages:R}=e.options,A=m?_1:E1;return{pages:A(f.pages,I,R),pageParams:A(f.pageParams,g,R)}};if(i&&o.length){const f=i==="backward",g=f?D1:GE,m={pages:o,pageParams:a},v=g(r,m);s=await h(m,v,f)}else{const f=t??o.length;do{const g=c===0?a[0]??r.initialPageParam:GE(r,s);if(c>0&&g==null)break;s=await h(s,g),c++}while(c<f)}return s};e.options.persister?e.fetchFn=()=>e.options.persister?.(u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n):e.fetchFn=u}}}function GE(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function D1(t,{pages:e,pageParams:n}){return e.length>0?t.getPreviousPageParam?.(e[0],e,n[0],n):void 0}var M1=class extends OR{#e;#t;#n;#i;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#n=t.mutationCache,this.#t=[],this.state=t.state||MR(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=NR({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(o,a)=>{this.#r({type:"failed",failureCount:o,error:a})},onPause:()=>{this.#r({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",i=!this.#i.canStart();try{if(r)e();else{this.#r({type:"pending",variables:t,isPaused:i}),await this.#n.config.onMutate?.(t,this,n);const a=await this.options.onMutate?.(t,n);a!==this.state.context&&this.#r({type:"pending",context:a,variables:t,isPaused:i})}const o=await this.#i.start();return await this.#n.config.onSuccess?.(o,t,this.state.context,this,n),await this.options.onSuccess?.(o,t,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,t,this.state.context,n),this.#r({type:"success",data:o}),o}catch(o){try{await this.#n.config.onError?.(o,t,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onError?.(o,t,this.state.context,n)}catch(a){Promise.reject(a)}try{await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onSettled?.(void 0,o,t,this.state.context,n)}catch(a){Promise.reject(a)}throw this.#r({type:"error",error:o}),o}finally{this.#n.runNext(this)}}#r(t){const e=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),Rt.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(t)}),this.#n.notify({mutation:this,type:"updated",action:t})})}};function MR(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var x1=class extends Ms{constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(t,e,n){const r=new M1({client:t,mutationCache:this,mutationId:++this.#n,options:t.defaultMutationOptions(e),state:n});return this.add(r),r}add(t){this.#e.add(t);const e=fl(t);if(typeof e=="string"){const n=this.#t.get(e);n?n.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){const e=fl(t);if(typeof e=="string"){const n=this.#t.get(e);if(n)if(n.length>1){const r=n.indexOf(t);r!==-1&&n.splice(r,1)}else n[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=fl(t);if(typeof e=="string"){const r=this.#t.get(e)?.find(i=>i.state.status==="pending");return!r||r===t}else return!0}runNext(t){const e=fl(t);return typeof e=="string"?this.#t.get(e)?.find(r=>r!==t&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Rt.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){const e={exact:!0,...t};return this.getAll().find(n=>ME(e,n))}findAll(t={}){return this.getAll().filter(e=>ME(t,e))}notify(t){Rt.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return Rt.batch(()=>Promise.all(t.map(e=>e.continue().catch(tn))))}};function fl(t){return t.options.scope?.id}var U1=class extends Ms{#e;#t=void 0;#n;#i;constructor(t,e){super(),this.#e=t,this.setOptions(e),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const e=this.options;this.options=this.#e.defaultMutationOptions(t),rh(this.options,e)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),e?.mutationKey&&this.options.mutationKey&&na(e.mutationKey)!==na(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#a(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#a()}mutate(t,e){return this.#i=e,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#r(){const t=this.#n?.state??MR();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#a(t){Rt.batch(()=>{if(this.#i&&this.hasListeners()){const e=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#i.onSuccess?.(t.data,e,n,r)}catch(i){Promise.reject(i)}try{this.#i.onSettled?.(t.data,null,e,n,r)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#i.onError?.(t.error,e,n,r)}catch(i){Promise.reject(i)}try{this.#i.onSettled?.(void 0,t.error,e,n,r)}catch(i){Promise.reject(i)}}}this.listeners.forEach(e=>{e(this.#t)})})}},L1=class extends Ms{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,n){const r=e.queryKey,i=e.queryHash??Sy(r,e);let o=this.get(i);return o||(o=new k1({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:n,defaultOptions:t.getQueryDefaults(r)}),this.add(o)),o}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Rt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(n=>DE(e,n))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(n=>DE(t,n)):e}notify(t){Rt.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){Rt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Rt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},F1=class{#e;#t;#n;#i;#r;#a;#s;#o;constructor(t={}){this.#e=t.queryCache||new L1,this.#t=t.mutationCache||new x1,this.#n=t.defaultOptions||{},this.#i=new Map,this.#r=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#s=Iy.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=oh.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#s?.(),this.#s=void 0,this.#o?.(),this.#o=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=this.#e.build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(Yi(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),o=this.#e.get(r.queryHash)?.state.data,a=y1(e,o);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(t,e,n){return Rt.batch(()=>this.#e.findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){const e=this.#e;Rt.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=this.#e;return Rt.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Rt.batch(()=>this.#e.findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(tn).catch(tn)}invalidateQueries(t,e={}){return Rt.batch(()=>(this.#e.findAll(t).forEach(n=>{n.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Rt.batch(()=>this.#e.findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(tn)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(tn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=this.#e.build(this,e);return n.isStaleByTime(Yi(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(tn).catch(tn)}fetchInfiniteQuery(t){return t.behavior=KE(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(tn).catch(tn)}ensureInfiniteQueryData(t){return t.behavior=KE(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return oh.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(t){this.#n=t}setQueryDefaults(t,e){this.#i.set(na(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#i.values()],n={};return e.forEach(r=>{cu(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){this.#r.set(na(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#r.values()],n={};return e.forEach(r=>{cu(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#n.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Sy(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===ih&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#n.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},xR=K.createContext(void 0),bu=t=>{const e=K.useContext(xR);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},H1=({client:t,children:e})=>(K.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),oe.jsx(xR.Provider,{value:t,children:e})),UR=K.createContext(!1),B1=()=>K.useContext(UR);UR.Provider;function K1(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var G1=K.createContext(K1()),q1=()=>K.useContext(G1),$1=(t,e,n)=>{const r=n?.state.error&&typeof t.throwOnError=="function"?Ay(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},Y1=t=>{K.useEffect(()=>{t.clearReset()},[t])},z1=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||Ay(n,[t.error,r])),j1=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},V1=(t,e)=>t.isLoading&&t.isFetching&&!e,Q1=(t,e)=>t?.suspense&&e.isPending,qE=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function W1(t,e,n){if(process.env.NODE_ENV!=="production"&&(typeof t!="object"||Array.isArray(t)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=B1(),i=q1(),o=bu(),a=o.defaultQueryOptions(t);o.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const s=o.getQueryCache().get(a.queryHash);process.env.NODE_ENV!=="production"&&(a.queryFn||console.error(`[${a.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),a._optimisticResults=r?"isRestoring":"optimistic",j1(a),$1(a,i,s),Y1(i);const c=!o.getQueryCache().get(a.queryHash),[u]=K.useState(()=>new e(o,a)),l=u.getOptimisticResult(a),d=!r&&t.subscribed!==!1;if(K.useSyncExternalStore(K.useCallback(p=>{const h=d?u.subscribe(Rt.batchCalls(p)):tn;return u.updateResult(),h},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),K.useEffect(()=>{u.setOptions(a)},[a,u]),Q1(a,l))throw qE(a,u,i);if(z1({result:l,errorResetBoundary:i,throwOnError:a.throwOnError,query:s,suspense:a.suspense}))throw l.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(a,l),a.experimental_prefetchInRender&&!ta&&V1(l,r)&&(c?qE(a,u,i):s?.promise)?.catch(tn).finally(()=>{u.updateResult()}),a.notifyOnChangeProps?l:u.trackResult(l)}function J1(t,e){return W1(t,P1)}function Ry(t,e){const n=bu(),[r]=K.useState(()=>new U1(n,t));K.useEffect(()=>{r.setOptions(t)},[r,t]);const i=K.useSyncExternalStore(K.useCallback(a=>r.subscribe(Rt.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=K.useCallback((a,s)=>{r.mutate(a,s).catch(tn)},[r]);if(i.error&&Ay(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}const X1=(t,e)=>J1({queryKey:[t],queryFn:()=>AR(e)}),Z1=()=>{const t=bu();return Ry({mutationFn:e=>IR(e.url,e.data),onSuccess:(e,n)=>{n.invalidateKeys&&n.invalidateKeys.forEach(r=>t.invalidateQueries({queryKey:[r]}))}})},eB=()=>{const t=bu();return Ry({mutationFn:e=>wR(e.url,e.data),onSuccess:(e,n)=>{n.invalidateKeys&&n.invalidateKeys.forEach(r=>t.invalidateQueries({queryKey:[r]}))}})},tB=()=>{const t=bu();return Ry({mutationFn:e=>RR(e.url),onSuccess:(e,n)=>{n.invalidateKeys&&n.invalidateKeys.forEach(r=>t.invalidateQueries({queryKey:[r]}))}})};let Uc;const nB=t=>(Uc=new F1({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}},...t}),Uc),rB=({children:t})=>(Uc||(Uc=nB()),oe.jsx(H1,{client:Uc,children:t})),eo=ge.createContext(null),iB=({initialValues:t={},onSubmit:e,onSubmitError:n,onReset:r,children:i})=>{const[o,a]=ge.useState(t),[s,c]=ge.useState({}),[u,l]=ge.useState(!1),d=ge.useRef(new Map),p=ge.useCallback((A,M)=>{a(b=>({...b,[A]:M})),c(b=>({...b,[A]:void 0}))},[]),h=ge.useCallback(A=>{a(M=>({...M,[A]:""})),c(M=>({...M,[A]:void 0}))},[]),f=ge.useCallback((A,M,b)=>{d.current.set(A,{validator:M,fallbackErrorMsg:b}),a(_=>A in _?_:{..._,[A]:""})},[]),g=ge.useCallback(A=>{d.current.delete(A),c(M=>{const b={...M};return delete b[A],b})},[]),m=ge.useCallback(async A=>{const M=d.current.get(A),b=o[A]??"";if(!M?.validator)return c(F=>({...F,[A]:void 0})),!0;const _=await M.validator(b,o);if(typeof _=="string")return c(F=>({...F,[A]:_})),!1;if(_===!0)return c(F=>({...F,[A]:void 0})),!0;{const F=M.fallbackErrorMsg||"Invalid value.";return c(B=>({...B,[A]:F})),!1}},[o]),v=ge.useCallback(async()=>{l(!0);try{const A=Array.from(d.current.keys());return(await Promise.all(A.map(b=>m(b)))).every(Boolean)}finally{l(!1)}},[m]),y=ge.useCallback(()=>{a(t),c({}),r?.()},[t,r]),I=ge.useMemo(()=>({values:o,errors:s,isValidating:u,setValue:p,clearValue:h,registerField:f,unregisterField:g,validateField:m,validateAll:v,reset:y}),[o,s,u,p,h,f,g,m,v,y]),R=async A=>{if(A.preventDefault(),!!await v())try{await e(o)}catch(b){console.error("Submit handler threw:",b),n?.(b)}};return oe.jsx("form",{onSubmit:R,noValidate:!0,children:oe.jsx(eo.Provider,{value:I,children:i})})},oB=({name:t,label:e,clearable:n=!0,validator:r,errorMessage:i,type:o="text",placeholder:a,disabled:s,className:c,...u})=>{const l=ge.useContext(eo);if(!l)throw new Error("InputField must be used inside <Form>.");const d=l.values[t]??"";ge.useEffect(()=>(l.registerField(t,r,i),()=>l.unregisterField(t)),[t,r,i]);const p=async()=>{await l.validateField(t)},h=n&&!!d&&!s,f=!!l.errors[t],g=["input-field-container",c].filter(Boolean).join(" "),m=["input-field-input",h&&"with-clear",f&&"has-error"].filter(Boolean).join(" ");return oe.jsxs("div",{className:g,children:[e&&oe.jsx("label",{htmlFor:t,className:"input-field-label",children:e}),oe.jsxs("div",{className:"input-field-wrapper",children:[oe.jsx("input",{id:t,name:t,type:o,placeholder:a,disabled:s,value:d,onChange:v=>l.setValue(t,v.target.value),onBlur:p,className:m,...u}),h&&oe.jsx("span",{role:"button",tabIndex:0,"aria-label":`Clear ${e||t}`,title:"Clear",onClick:()=>l.clearValue(t),onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),l.clearValue(t))},className:"input-field-clear-button",children:"×"})]}),f&&oe.jsx("div",{role:"alert",className:"input-field-error",children:l.errors[t]})]})},aB=({name:t,label:e,options:n,placeholder:r="Select an option",clearable:i=!0,validator:o,errorMessage:a,disabled:s,className:c,style:u,...l})=>{const d=ge.useContext(eo);if(!d)throw new Error("InputDropdown must be used inside <Form>.");const p=d.values[t]??"";ge.useEffect(()=>(d.registerField(t,o,a),()=>d.unregisterField(t)),[t,o,a]);const h=async()=>{await d.validateField(t)},f=i&&!!p&&!s,g=!!d.errors[t],m=["input-dropdown-select",f&&"with-clear",g&&"has-error",c].filter(Boolean).join(" ");return oe.jsxs("div",{className:"input-dropdown-container",children:[e&&oe.jsx("label",{htmlFor:t,className:"input-dropdown-label",children:e}),oe.jsxs("div",{className:"input-dropdown-wrapper",children:[oe.jsxs("select",{id:t,name:t,disabled:s,value:p,onChange:v=>d.setValue(t,v.target.value),onBlur:h,className:m,style:u,...l,children:[oe.jsx("option",{value:"",disabled:!0,children:r}),n.map(v=>oe.jsx("option",{value:v.value,children:v.label},v.value))]}),f&&oe.jsx("button",{type:"button","aria-label":`Clear ${e||t}`,title:"Clear",onClick:()=>d.clearValue(t),className:"input-dropdown-clear-button",children:"×"})]}),g&&oe.jsx("div",{role:"alert",className:"input-dropdown-error",children:d.errors[t]})]})},sB=({name:t,label:e,options:n,validator:r,errorMessage:i,disabled:o,className:a,...s})=>{const c=ge.useContext(eo);if(!c)throw new Error("InputRadio must be used inside <Form>.");const u=c.values[t]??"";ge.useEffect(()=>(c.registerField(t,r,i),()=>c.unregisterField(t)),[t,r,i]);const l=async()=>{await c.validateField(t)},d=!!c.errors[t],p=["input-radio-container",a].filter(Boolean).join(" ");return oe.jsxs("div",{className:p,children:[e&&oe.jsx("div",{className:"input-radio-label",children:e}),oe.jsx("div",{className:"input-radio-options",role:"radiogroup",...s,children:n.map(h=>oe.jsxs("label",{className:`input-radio-option ${o?"disabled":""}`,children:[oe.jsx("input",{type:"radio",name:t,value:h.value,checked:u===h.value,onChange:f=>c.setValue(t,f.target.value),onBlur:l,disabled:o,className:"input-radio-input"}),oe.jsx("span",{className:"input-radio-option-label",children:h.label})]},h.value))}),d&&oe.jsx("div",{role:"alert",className:"input-radio-error",children:c.errors[t]})]})},cB=({name:t,label:e,options:n,validator:r,errorMessage:i,disabled:o,className:a,...s})=>{const c=ge.useContext(eo);if(!c)throw new Error("InputCheckbox must be used inside <Form>.");const u=c.values[t]??"",l=u?u.split(","):[];ge.useEffect(()=>(c.registerField(t,r,i),()=>c.unregisterField(t)),[t,r,i]);const d=async()=>{await c.validateField(t)},p=(g,m)=>{let v;m?v=[...l,g]:v=l.filter(y=>y!==g),c.setValue(t,v.join(","))},h=!!c.errors[t],f=["input-checkbox-container",a].filter(Boolean).join(" ");return oe.jsxs("div",{className:f,children:[e&&oe.jsx("div",{className:"input-checkbox-label",children:e}),oe.jsx("div",{className:"input-checkbox-options",role:"group",...s,children:n.map(g=>oe.jsxs("label",{className:`input-checkbox-option ${o?"disabled":""}`,children:[oe.jsx("input",{type:"checkbox",name:`${t}-${g.value}`,value:g.value,checked:l.includes(g.value),onChange:m=>p(g.value,m.target.checked),onBlur:d,disabled:o,className:"input-checkbox-input"}),oe.jsx("span",{className:"input-checkbox-option-label",children:g.label})]},g.value))}),h&&oe.jsx("div",{role:"alert",className:"input-checkbox-error",children:c.errors[t]})]})},uB=({name:t,label:e,placeholder:n,clearable:r=!0,validator:i,errorMessage:o,disabled:a,rows:s,maxLength:c,className:u,style:l,...d})=>{const p=ge.useContext(eo);if(!p)throw new Error("InputTextarea must be used inside <Form>.");const h=p.values[t]??"";ge.useEffect(()=>(p.registerField(t,i,o),()=>p.unregisterField(t)),[t,i,o]);const f=async()=>{await p.validateField(t)},g=r&&!!h&&!a,m=!!p.errors[t],v=["input-textarea-field",g&&"with-clear",m&&"has-error",u].filter(Boolean).join(" ");return oe.jsxs("div",{className:"input-textarea-container",children:[e&&oe.jsx("label",{htmlFor:t,className:"input-textarea-label",children:e}),oe.jsxs("div",{className:"input-textarea-wrapper",children:[oe.jsx("textarea",{id:t,name:t,placeholder:n,disabled:a,rows:s,maxLength:c,value:h,onChange:y=>p.setValue(t,y.target.value),onBlur:f,className:v,style:l,...d}),g&&oe.jsx("button",{type:"button","aria-label":`Clear ${e||t}`,title:"Clear",onClick:()=>p.clearValue(t),className:"input-textarea-clear-button",children:"×"})]}),m&&oe.jsx("div",{role:"alert",className:"input-textarea-error",children:p.errors[t]})]})},lB=({children:t,...e})=>{const n=ge.useContext(eo);if(!n)throw new Error("ResetButton must be used inside <Form>.");return oe.jsx("button",{type:"button",onClick:n.reset,...e,children:t??"Reset"})},dB=({name:t,label:e="Upload File",accept:n,maxLength:r=20,maxFileSize:i=2*1024*1024,onFileChange:o,disabled:a=!1,validator:s,errorMessage:c="Please select a file.",className:u})=>{const l=ge.useContext(eo),[d,p]=ge.useState(null),h=ge.useRef(null);ge.useEffect(()=>{if(t&&l)return l.registerField(t,s,c),()=>l.unregisterField(t)},[t]);const f=(R,A)=>{if(R.length<=A)return R;const M=R.lastIndexOf("."),b=M!==-1?R.substring(M):"",_=M!==-1?R.substring(0,M):R,F=A-b.length-10;return`${_.substring(0,Math.max(F,5))}..........${b}`},g=()=>{h.current?.click()},m=async R=>{const A=R.target.files?.[0];if(!A){p(null),o&&o(null),t&&l&&l.setValue(t,"");return}if(A.size>i){const M=(i/1048576).toFixed(2);h.current&&(h.current.value=""),p(null),o&&o(null),t&&l&&l.setValue(t,""),alert(`File size exceeds ${M}MB limit.`);return}p(A),t&&l&&l.setValue(t,A.name),o&&o(A)},y=t&&l?.errors[t]?l?.errors[t]:null,I=["input-file-container",u].filter(Boolean).join(" ");return oe.jsxs("div",{className:I,children:[e&&oe.jsx("label",{className:"input-file-label",children:e}),oe.jsxs("div",{className:"input-file-wrapper",children:[oe.jsx("input",{ref:h,type:"file",accept:n,onChange:m,disabled:a,className:"input-file-hidden"}),oe.jsx("button",{type:"button",onClick:g,disabled:a,className:"input-file-browse-btn",children:"Browse"}),d&&oe.jsx("span",{className:"input-file-name",title:d.name,children:f(d.name,r)})]}),y&&oe.jsx("div",{className:"input-file-error",children:y})]})},LR=ge.createContext(void 0),FR=()=>{const t=ge.useContext(LR);if(!t)throw new Error("useToast must be used within a ToastProvider");return t},hB=({children:t,defaultDuration:e=3e3,maxToasts:n=5})=>{const[r,i]=ge.useState([]),o=ge.useCallback(p=>{i(h=>h.filter(f=>f.id!==p))},[]),a=ge.useCallback((p,h,f=e)=>{const g=`toast-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,m={id:g,message:p,type:h,duration:f};i(v=>[...v,m].slice(-n)),f>0&&setTimeout(()=>{o(g)},f)},[e,n,o]),s=ge.useCallback((p,h)=>{a(p,"success",h)},[a]),c=ge.useCallback((p,h)=>{a(p,"error",h)},[a]),u=ge.useCallback((p,h)=>{a(p,"info",h)},[a]),l=ge.useCallback((p,h)=>{a(p,"warning",h)},[a]),d={toasts:r,showToast:a,showSuccess:s,showError:c,showInfo:u,showWarning:l,removeToast:o};return oe.jsx(LR.Provider,{value:d,children:t})},fB=({position:t="top-right",className:e})=>{const{toasts:n,removeToast:r}=FR(),i=["toast-container",`toast-container-${t}`,e].filter(Boolean).join(" "),o=a=>["toast",`toast-${a}`].filter(Boolean).join(" ");return oe.jsx("div",{className:i,children:n.map(a=>oe.jsxs("div",{className:o(a.type),role:"alert","aria-live":"polite",children:[oe.jsxs("div",{className:"toast-content",children:[oe.jsx("span",{className:"toast-icon",children:pB(a.type)}),oe.jsx("span",{className:"toast-message",children:a.message})]}),oe.jsx("button",{type:"button",className:"toast-close",onClick:()=>r(a.id),"aria-label":"Close",children:"×"})]},a.id))})};function pB(t){switch(t){case"success":return"✓";case"error":return"✕";case"warning":return"⚠";case"info":return"ℹ";default:return""}}const gB=({type:t,message:e,title:n,dismissible:r=!1,onDismiss:i,className:o})=>{const a=["inline-alert",`inline-alert-${t}`,o].filter(Boolean).join(" "),s=()=>{switch(t){case"success":return"✓";case"error":return"✕";case"warning":return"⚠";case"info":return"ℹ";default:return""}};return oe.jsxs("div",{className:a,role:"alert",children:[oe.jsx("div",{className:"inline-alert-icon",children:s()}),oe.jsxs("div",{className:"inline-alert-content",children:[n&&oe.jsx("div",{className:"inline-alert-title",children:n}),oe.jsx("div",{className:"inline-alert-message",children:e})]}),r&&oe.jsx("button",{type:"button",className:"inline-alert-close",onClick:i,"aria-label":"Close",children:"×"})]})},by=ge.createContext(void 0);function mB(){const t=ge.useContext(by);if(!t)throw new Error("useStorage must be used within a StorageProvider");return t}class vB{storage;namespace;serialize;encrypt;storageType;constructor(e={}){this.namespace=e.namespace||"",this.serialize=e.serialize??!0,this.encrypt=e.encrypt??!1,this.storageType=e.storageType||"local",this.storageType==="local"?this.storage=typeof window<"u"?window.localStorage:new Map:this.storageType==="session"?this.storage=typeof window<"u"?window.sessionStorage:new Map:this.storage=new Map}getKey(e){return this.namespace?`${this.namespace}:${e}`:e}encodeValue(e){return this.encrypt?btoa(encodeURIComponent(e)):e}decodeValue(e){if(!this.encrypt)return e;try{return decodeURIComponent(atob(e))}catch{return e}}getItem(e,n){try{const r=this.getKey(e),i=this.storage instanceof Map?this.storage.get(r):this.storage.getItem(r);if(i==null)return n??null;const o=this.decodeValue(i);return this.serialize?JSON.parse(o):o}catch(r){return console.error(`Error getting item "${e}" from storage:`,r),n??null}}setItem(e,n){try{const r=this.getKey(e),i=this.serialize?JSON.stringify(n):String(n),o=this.encodeValue(i);this.storage instanceof Map?this.storage.set(r,o):this.storage.setItem(r,o)}catch(r){console.error(`Error setting item "${e}" in storage:`,r)}}removeItem(e){try{const n=this.getKey(e);this.storage instanceof Map?this.storage.delete(n):this.storage.removeItem(n)}catch(n){console.error(`Error removing item "${e}" from storage:`,n)}}clear(){try{this.storage instanceof Map?this.storage.clear():this.namespace?this.getAllKeys().forEach(n=>this.removeItem(n)):this.storage.clear()}catch(e){console.error("Error clearing storage:",e)}}hasItem(e){const n=this.getKey(e);return this.storage instanceof Map?this.storage.has(n):this.storage.getItem(n)!==null}getAllKeys(){try{return this.storage instanceof Map?Array.from(this.storage.keys()).filter(e=>!this.namespace||e.startsWith(`${this.namespace}:`)).map(e=>this.namespace?e.slice(this.namespace.length+1):e):Object.keys(this.storage).filter(n=>!this.namespace||n.startsWith(`${this.namespace}:`)).map(n=>this.namespace?n.slice(this.namespace.length+1):n)}catch(e){return console.error("Error getting all keys from storage:",e),[]}}getStorageType(){return this.storageType}}const yB=({children:t,storageType:e="local",namespace:n="",serialize:r=!0,encrypt:i=!1})=>{const o=ge.useRef(null);o.current||(o.current=new vB({storageType:e,namespace:n,serialize:r,encrypt:i}));const a=ge.useMemo(()=>({getItem:(s,c)=>o.current.getItem(s,c),setItem:(s,c)=>o.current.setItem(s,c),removeItem:s=>o.current.removeItem(s),clear:()=>o.current.clear(),hasItem:s=>o.current.hasItem(s),getAllKeys:()=>o.current.getAllKeys(),storageType:o.current.getStorageType()}),[]);return oe.jsx(by.Provider,{value:a,children:t})};function CB(t){const{name:e,errorMessage:n,defaultValue:r}=t,i=ge.createContext(r);i.displayName=e;const o=({children:s,value:c})=>oe.jsx(i.Provider,{value:c,children:s});return o.displayName=`${e}Provider`,{Context:i,Provider:o,useContext:()=>{const s=ge.useContext(i);if(s===void 0){const c=n||`use${e} must be used within a ${e}Provider. Make sure you wrap your component tree with <${e}Provider>.`;throw new Error(c)}return s}}}function TB(t){const{name:e,useValue:n,errorMessage:r}=t,i=ge.createContext(void 0);i.displayName=e;const o=({children:s,...c})=>{const u=n(c);return oe.jsx(i.Provider,{value:u,children:s})};return o.displayName=`${e}Provider`,{Context:i,Provider:o,useContext:()=>{const s=ge.useContext(i);if(s===void 0){const c=r||`use${e} must be used within a ${e}Provider. Make sure you wrap your component tree with <${e}Provider>.`;throw new Error(c)}return s}}}exports.AppInsight=JD;exports.AuthProvider=nL;exports.ErrorBoundary=Jw;exports.Form=iB;exports.InlineAlert=gB;exports.InputCheckbox=cB;exports.InputDropdown=aB;exports.InputField=oB;exports.InputFile=dB;exports.InputRadio=sB;exports.InputTextarea=uB;exports.Protected=iL;exports.QueryProvider=rB;exports.ResetButton=lB;exports.RouterProvider=FF;exports.StorageContext=by;exports.StorageProvider=yB;exports.ToastContainer=fB;exports.ToastProvider=hB;exports.configureClient=p1;exports.createContext=CB;exports.createContextWithHook=TB;exports.del=RR;exports.get=AR;exports.getNavigate=UF;exports.post=IR;exports.put=wR;exports.useAuth=rL;exports.useDeleteMutation=tB;exports.useGetQuery=X1;exports.usePostMutation=Z1;exports.usePutMutation=eB;exports.useStorage=mB;exports.useToast=FR;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// lib/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
AppInsight: () => AppInsightsProvider_default,
|
|
34
|
+
AuthProvider: () => AuthProvider,
|
|
35
|
+
ErrorBoundary: () => ErrorBoundary,
|
|
36
|
+
Form: () => Form,
|
|
37
|
+
InlineAlert: () => InlineAlert,
|
|
38
|
+
InputCheckbox: () => InputCheckbox,
|
|
39
|
+
InputDropdown: () => InputDropdown,
|
|
40
|
+
InputField: () => InputField,
|
|
41
|
+
InputFile: () => InputFile_default,
|
|
42
|
+
InputRadio: () => InputRadio,
|
|
43
|
+
InputTextarea: () => InputTextarea,
|
|
44
|
+
Protected: () => Protected,
|
|
45
|
+
QueryProvider: () => QueryProvider,
|
|
46
|
+
ResetButton: () => ResetButton,
|
|
47
|
+
RouterProvider: () => RouterProvider_default,
|
|
48
|
+
StorageContext: () => StorageContext,
|
|
49
|
+
StorageProvider: () => StorageProvider,
|
|
50
|
+
ToastContainer: () => ToastContainer,
|
|
51
|
+
ToastProvider: () => ToastProvider,
|
|
52
|
+
configureClient: () => configureClient,
|
|
53
|
+
createContext: () => createContext4,
|
|
54
|
+
createContextWithHook: () => createContextWithHook,
|
|
55
|
+
del: () => del,
|
|
56
|
+
get: () => get,
|
|
57
|
+
getNavigate: () => getNavigate,
|
|
58
|
+
post: () => post,
|
|
59
|
+
put: () => put,
|
|
60
|
+
useAuth: () => useAuth,
|
|
61
|
+
useDeleteMutation: () => useDeleteMutation,
|
|
62
|
+
useGetQuery: () => useGetQuery,
|
|
63
|
+
usePostMutation: () => usePostMutation,
|
|
64
|
+
usePutMutation: () => usePutMutation,
|
|
65
|
+
useStorage: () => useStorage,
|
|
66
|
+
useToast: () => useToast
|
|
67
|
+
});
|
|
68
|
+
module.exports = __toCommonJS(index_exports);
|
|
69
|
+
|
|
70
|
+
// lib/components/appInsights/AppInsightsProvider.tsx
|
|
71
|
+
var import_react = require("react");
|
|
72
|
+
var import_applicationinsights_web = require("@microsoft/applicationinsights-web");
|
|
73
|
+
var AppInsight = ({ instrumentationKey }) => {
|
|
74
|
+
(0, import_react.useEffect)(() => {
|
|
75
|
+
const appInsights = new import_applicationinsights_web.ApplicationInsights({
|
|
76
|
+
config: {
|
|
77
|
+
instrumentationKey,
|
|
78
|
+
enableAutoRouteTracking: true
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
appInsights.loadAppInsights();
|
|
82
|
+
appInsights.trackPageView();
|
|
83
|
+
}, [instrumentationKey]);
|
|
84
|
+
return null;
|
|
85
|
+
};
|
|
86
|
+
var AppInsightsProvider_default = AppInsight;
|
|
87
|
+
|
|
88
|
+
// lib/components/msAuth/AuthProvider.tsx
|
|
89
|
+
var import_react2 = require("react");
|
|
90
|
+
var import_msal_react = require("@azure/msal-react");
|
|
91
|
+
var import_msal_browser = require("@azure/msal-browser");
|
|
92
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
93
|
+
var AuthProvider = ({
|
|
94
|
+
config,
|
|
95
|
+
children
|
|
96
|
+
}) => {
|
|
97
|
+
const pcaRef = (0, import_react2.useRef)(null);
|
|
98
|
+
if (!pcaRef.current) {
|
|
99
|
+
pcaRef.current = new import_msal_browser.PublicClientApplication({
|
|
100
|
+
...config,
|
|
101
|
+
system: {
|
|
102
|
+
...config.system,
|
|
103
|
+
loggerOptions: { logLevel: import_msal_browser.LogLevel.Info }
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_msal_react.MsalProvider, { instance: pcaRef.current, children });
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// lib/components/msAuth/useAuth.ts
|
|
111
|
+
var import_msal_react2 = require("@azure/msal-react");
|
|
112
|
+
var import_msal_browser2 = require("@azure/msal-browser");
|
|
113
|
+
function useAuth(options) {
|
|
114
|
+
const { instance, accounts } = (0, import_msal_react2.useMsal)();
|
|
115
|
+
const isAuthenticated = (0, import_msal_react2.useIsAuthenticated)();
|
|
116
|
+
const account = (0, import_msal_react2.useAccount)(accounts[0] || {});
|
|
117
|
+
const login = async (request2) => {
|
|
118
|
+
const req = request2 ?? {
|
|
119
|
+
scopes: options?.defaultScopes ?? ["openid", "profile", "offline_access"]
|
|
120
|
+
};
|
|
121
|
+
if (options?.loginType === "redirect") {
|
|
122
|
+
await instance.loginRedirect(req);
|
|
123
|
+
} else {
|
|
124
|
+
await instance.loginPopup(req);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const logout = async () => {
|
|
128
|
+
try {
|
|
129
|
+
if (options?.loginType === "redirect") {
|
|
130
|
+
await instance.logoutRedirect();
|
|
131
|
+
} else {
|
|
132
|
+
await instance.logoutPopup();
|
|
133
|
+
}
|
|
134
|
+
} catch {
|
|
135
|
+
console.error("Failed while trying to logout user!");
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const acquireToken = async (scopes) => {
|
|
139
|
+
const silentReq = { account: accounts[0], scopes };
|
|
140
|
+
try {
|
|
141
|
+
const res = await instance.acquireTokenSilent(silentReq);
|
|
142
|
+
return res.accessToken;
|
|
143
|
+
} catch {
|
|
144
|
+
if (options?.loginType === "redirect") {
|
|
145
|
+
await instance.acquireTokenRedirect({ scopes });
|
|
146
|
+
return "";
|
|
147
|
+
} else {
|
|
148
|
+
const res = await instance.acquireTokenPopup({ scopes });
|
|
149
|
+
return res.accessToken;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
return {
|
|
154
|
+
isAuthenticated,
|
|
155
|
+
account,
|
|
156
|
+
login,
|
|
157
|
+
logout,
|
|
158
|
+
acquireToken,
|
|
159
|
+
InteractionType: import_msal_browser2.InteractionType
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// lib/components/msAuth/Protected.tsx
|
|
164
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
165
|
+
var Protected = ({ children }) => {
|
|
166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
// lib/components/pageRouter/RouterProvider.tsx
|
|
170
|
+
var import_react4 = require("react");
|
|
171
|
+
var import_react_router_dom2 = require("react-router-dom");
|
|
172
|
+
|
|
173
|
+
// lib/components/pageRouter/RouteRenderer.tsx
|
|
174
|
+
var import_react_router_dom = require("react-router-dom");
|
|
175
|
+
|
|
176
|
+
// lib/components/pageRouter/ErrorBoundary.tsx
|
|
177
|
+
var import_react3 = require("react");
|
|
178
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
179
|
+
var ErrorBoundary = class extends import_react3.Component {
|
|
180
|
+
constructor(props) {
|
|
181
|
+
super(props);
|
|
182
|
+
this.state = { hasError: false };
|
|
183
|
+
}
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
185
|
+
static getDerivedStateFromError(_) {
|
|
186
|
+
return { hasError: true };
|
|
187
|
+
}
|
|
188
|
+
componentDidCatch(error, info) {
|
|
189
|
+
console.error("Error caught in boundary:", error, info);
|
|
190
|
+
}
|
|
191
|
+
render() {
|
|
192
|
+
if (this.state.hasError) {
|
|
193
|
+
return this.props.fallback ?? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: "Something went wrong." });
|
|
194
|
+
}
|
|
195
|
+
return this.props.children;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
// lib/components/pageRouter/RouteRenderer.tsx
|
|
200
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
201
|
+
var RouteRenderer = ({ routes, fallbackUI }) => {
|
|
202
|
+
const location = (0, import_react_router_dom.useLocation)();
|
|
203
|
+
const currentRoute = routes.find((route) => route.path === location.pathname);
|
|
204
|
+
if (!currentRoute) {
|
|
205
|
+
return fallbackUI ?? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: "404 - Page Not Found" });
|
|
206
|
+
}
|
|
207
|
+
const Component2 = currentRoute.component;
|
|
208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorBoundary, { fallback: currentRoute.errorFallback, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Component2, {}) });
|
|
209
|
+
};
|
|
210
|
+
var RouteRenderer_default = RouteRenderer;
|
|
211
|
+
|
|
212
|
+
// lib/components/pageRouter/navigation.ts
|
|
213
|
+
var navigate = null;
|
|
214
|
+
var setNavigate = (navFn) => {
|
|
215
|
+
navigate = navFn;
|
|
216
|
+
};
|
|
217
|
+
var getNavigate = () => {
|
|
218
|
+
if (!navigate) {
|
|
219
|
+
throw new Error("Navigate function not initialized.");
|
|
220
|
+
}
|
|
221
|
+
return navigate;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// lib/components/pageRouter/RouterProvider.tsx
|
|
225
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
226
|
+
var NavigatorInitializer = () => {
|
|
227
|
+
const navigate2 = (0, import_react_router_dom2.useNavigate)();
|
|
228
|
+
(0, import_react4.useEffect)(() => {
|
|
229
|
+
setNavigate(navigate2);
|
|
230
|
+
}, [navigate2]);
|
|
231
|
+
return null;
|
|
232
|
+
};
|
|
233
|
+
var RouterProvider = ({ routes, fallbackUI }) => {
|
|
234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_router_dom2.BrowserRouter, { children: [
|
|
235
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(NavigatorInitializer, {}),
|
|
236
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RouteRenderer_default, { routes, fallbackUI })
|
|
237
|
+
] });
|
|
238
|
+
};
|
|
239
|
+
var RouterProvider_default = RouterProvider;
|
|
240
|
+
|
|
241
|
+
// lib/components/reactQuery/apiClient.ts
|
|
242
|
+
var import_axios = __toESM(require("axios"), 1);
|
|
243
|
+
var baseURL = "";
|
|
244
|
+
var globalHeaders = {};
|
|
245
|
+
var configureClient = ({ endpoint, headers }) => {
|
|
246
|
+
baseURL = endpoint;
|
|
247
|
+
globalHeaders = headers || {};
|
|
248
|
+
};
|
|
249
|
+
var request = async (method, url, data) => {
|
|
250
|
+
try {
|
|
251
|
+
const config = {
|
|
252
|
+
method,
|
|
253
|
+
url: `${baseURL}${url}`,
|
|
254
|
+
data,
|
|
255
|
+
headers: globalHeaders
|
|
256
|
+
};
|
|
257
|
+
const response = await (0, import_axios.default)(config);
|
|
258
|
+
return response.data;
|
|
259
|
+
} catch (error) {
|
|
260
|
+
const message = error.response?.data?.message || error.message || "Unknown error";
|
|
261
|
+
throw new Error(message);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
var get = (url) => request("GET", url);
|
|
265
|
+
var post = (url, data) => request("POST", url, data);
|
|
266
|
+
var put = (url, data) => request("PUT", url, data);
|
|
267
|
+
var del = (url) => request("DELETE", url);
|
|
268
|
+
|
|
269
|
+
// lib/components/reactQuery/hooks.ts
|
|
270
|
+
var import_react_query = require("@tanstack/react-query");
|
|
271
|
+
var useGetQuery = (key, url) => {
|
|
272
|
+
return (0, import_react_query.useQuery)({
|
|
273
|
+
queryKey: [key],
|
|
274
|
+
queryFn: () => get(url)
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
var usePostMutation = () => {
|
|
278
|
+
const queryClient2 = (0, import_react_query.useQueryClient)();
|
|
279
|
+
return (0, import_react_query.useMutation)({
|
|
280
|
+
mutationFn: (variables) => post(variables.url, variables.data),
|
|
281
|
+
onSuccess: (_data, variables) => {
|
|
282
|
+
if (variables.invalidateKeys) {
|
|
283
|
+
variables.invalidateKeys.forEach(
|
|
284
|
+
(key) => queryClient2.invalidateQueries({ queryKey: [key] })
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
var usePutMutation = () => {
|
|
291
|
+
const queryClient2 = (0, import_react_query.useQueryClient)();
|
|
292
|
+
return (0, import_react_query.useMutation)({
|
|
293
|
+
mutationFn: (variables) => put(variables.url, variables.data),
|
|
294
|
+
onSuccess: (_data, variables) => {
|
|
295
|
+
if (variables.invalidateKeys) {
|
|
296
|
+
variables.invalidateKeys.forEach(
|
|
297
|
+
(key) => queryClient2.invalidateQueries({ queryKey: [key] })
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
};
|
|
303
|
+
var useDeleteMutation = () => {
|
|
304
|
+
const queryClient2 = (0, import_react_query.useQueryClient)();
|
|
305
|
+
return (0, import_react_query.useMutation)({
|
|
306
|
+
mutationFn: (variables) => del(variables.url),
|
|
307
|
+
onSuccess: (_data, variables) => {
|
|
308
|
+
if (variables.invalidateKeys) {
|
|
309
|
+
variables.invalidateKeys.forEach(
|
|
310
|
+
(key) => queryClient2.invalidateQueries({ queryKey: [key] })
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
// lib/components/reactQuery/queryProvider.tsx
|
|
318
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
319
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
320
|
+
var queryClient;
|
|
321
|
+
var createQueryClient = (options) => {
|
|
322
|
+
queryClient = new import_react_query2.QueryClient({
|
|
323
|
+
defaultOptions: {
|
|
324
|
+
queries: {
|
|
325
|
+
retry: 1,
|
|
326
|
+
refetchOnWindowFocus: false
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
...options
|
|
330
|
+
});
|
|
331
|
+
return queryClient;
|
|
332
|
+
};
|
|
333
|
+
var QueryProvider = ({ children }) => {
|
|
334
|
+
if (!queryClient) {
|
|
335
|
+
queryClient = createQueryClient();
|
|
336
|
+
}
|
|
337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_query2.QueryClientProvider, { client: queryClient, children });
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
// lib/components/formManager/Form.tsx
|
|
341
|
+
var import_react5 = require("react");
|
|
342
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
343
|
+
var FormContext = (0, import_react5.createContext)(null);
|
|
344
|
+
var Form = ({
|
|
345
|
+
initialValues = {},
|
|
346
|
+
onSubmit,
|
|
347
|
+
onSubmitError,
|
|
348
|
+
onReset,
|
|
349
|
+
children
|
|
350
|
+
}) => {
|
|
351
|
+
const [values, setValues] = (0, import_react5.useState)(initialValues);
|
|
352
|
+
const [errors, setErrors] = (0, import_react5.useState)({});
|
|
353
|
+
const [isValidating, setIsValidating] = (0, import_react5.useState)(false);
|
|
354
|
+
const registry = (0, import_react5.useRef)(/* @__PURE__ */ new Map());
|
|
355
|
+
const setValue = (0, import_react5.useCallback)((name, value) => {
|
|
356
|
+
setValues((prev) => ({ ...prev, [name]: value }));
|
|
357
|
+
setErrors((prev) => ({ ...prev, [name]: void 0 }));
|
|
358
|
+
}, []);
|
|
359
|
+
const clearValue = (0, import_react5.useCallback)((name) => {
|
|
360
|
+
setValues((prev) => ({ ...prev, [name]: "" }));
|
|
361
|
+
setErrors((prev) => ({ ...prev, [name]: void 0 }));
|
|
362
|
+
}, []);
|
|
363
|
+
const registerField = (0, import_react5.useCallback)(
|
|
364
|
+
(name, validator, fallbackErrorMsg) => {
|
|
365
|
+
registry.current.set(name, { validator, fallbackErrorMsg });
|
|
366
|
+
setValues((prev) => name in prev ? prev : { ...prev, [name]: "" });
|
|
367
|
+
},
|
|
368
|
+
[]
|
|
369
|
+
);
|
|
370
|
+
const unregisterField = (0, import_react5.useCallback)((name) => {
|
|
371
|
+
registry.current.delete(name);
|
|
372
|
+
setErrors((prev) => {
|
|
373
|
+
const next = { ...prev };
|
|
374
|
+
delete next[name];
|
|
375
|
+
return next;
|
|
376
|
+
});
|
|
377
|
+
}, []);
|
|
378
|
+
const validateField = (0, import_react5.useCallback)(
|
|
379
|
+
async (name) => {
|
|
380
|
+
const entry = registry.current.get(name);
|
|
381
|
+
const value = values[name] ?? "";
|
|
382
|
+
if (!entry?.validator) {
|
|
383
|
+
setErrors((prev) => ({ ...prev, [name]: void 0 }));
|
|
384
|
+
return true;
|
|
385
|
+
}
|
|
386
|
+
const result = await entry.validator(value, values);
|
|
387
|
+
if (typeof result === "string") {
|
|
388
|
+
setErrors((prev) => ({ ...prev, [name]: result }));
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
if (result === true) {
|
|
392
|
+
setErrors((prev) => ({ ...prev, [name]: void 0 }));
|
|
393
|
+
return true;
|
|
394
|
+
} else {
|
|
395
|
+
const fallback = entry.fallbackErrorMsg || "Invalid value.";
|
|
396
|
+
setErrors((prev) => ({ ...prev, [name]: fallback }));
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
[values]
|
|
401
|
+
);
|
|
402
|
+
const validateAll = (0, import_react5.useCallback)(async () => {
|
|
403
|
+
setIsValidating(true);
|
|
404
|
+
try {
|
|
405
|
+
const names = Array.from(registry.current.keys());
|
|
406
|
+
const results = await Promise.all(names.map((n) => validateField(n)));
|
|
407
|
+
return results.every(Boolean);
|
|
408
|
+
} finally {
|
|
409
|
+
setIsValidating(false);
|
|
410
|
+
}
|
|
411
|
+
}, [validateField]);
|
|
412
|
+
const reset = (0, import_react5.useCallback)(() => {
|
|
413
|
+
setValues(initialValues);
|
|
414
|
+
setErrors({});
|
|
415
|
+
onReset?.();
|
|
416
|
+
}, [initialValues, onReset]);
|
|
417
|
+
const ctx = (0, import_react5.useMemo)(
|
|
418
|
+
() => ({
|
|
419
|
+
values,
|
|
420
|
+
errors,
|
|
421
|
+
isValidating,
|
|
422
|
+
setValue,
|
|
423
|
+
clearValue,
|
|
424
|
+
registerField,
|
|
425
|
+
unregisterField,
|
|
426
|
+
validateField,
|
|
427
|
+
validateAll,
|
|
428
|
+
reset
|
|
429
|
+
}),
|
|
430
|
+
[
|
|
431
|
+
values,
|
|
432
|
+
errors,
|
|
433
|
+
isValidating,
|
|
434
|
+
setValue,
|
|
435
|
+
clearValue,
|
|
436
|
+
registerField,
|
|
437
|
+
unregisterField,
|
|
438
|
+
validateField,
|
|
439
|
+
validateAll,
|
|
440
|
+
reset
|
|
441
|
+
]
|
|
442
|
+
);
|
|
443
|
+
const handleSubmit = async (e) => {
|
|
444
|
+
e.preventDefault();
|
|
445
|
+
const ok = await validateAll();
|
|
446
|
+
if (!ok) return;
|
|
447
|
+
try {
|
|
448
|
+
await onSubmit(values);
|
|
449
|
+
} catch (err) {
|
|
450
|
+
console.error("Submit handler threw:", err);
|
|
451
|
+
onSubmitError?.(err);
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("form", { onSubmit: handleSubmit, noValidate: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FormContext.Provider, { value: ctx, children }) });
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
// lib/components/formManager/InputField.tsx
|
|
458
|
+
var import_react6 = require("react");
|
|
459
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
460
|
+
var InputField = ({
|
|
461
|
+
name,
|
|
462
|
+
label,
|
|
463
|
+
clearable = true,
|
|
464
|
+
validator,
|
|
465
|
+
errorMessage,
|
|
466
|
+
type = "text",
|
|
467
|
+
placeholder,
|
|
468
|
+
disabled,
|
|
469
|
+
className,
|
|
470
|
+
...rest
|
|
471
|
+
}) => {
|
|
472
|
+
const form = (0, import_react6.useContext)(FormContext);
|
|
473
|
+
if (!form) {
|
|
474
|
+
throw new Error("InputField must be used inside <Form>.");
|
|
475
|
+
}
|
|
476
|
+
const value = form.values[name] ?? "";
|
|
477
|
+
(0, import_react6.useEffect)(() => {
|
|
478
|
+
form.registerField(name, validator, errorMessage);
|
|
479
|
+
return () => form.unregisterField(name);
|
|
480
|
+
}, [name, validator, errorMessage]);
|
|
481
|
+
const onBlur = async () => {
|
|
482
|
+
await form.validateField(name);
|
|
483
|
+
};
|
|
484
|
+
const showClear = clearable && !!value && !disabled;
|
|
485
|
+
const hasError = !!form.errors[name];
|
|
486
|
+
const containerClassName = [
|
|
487
|
+
"input-field-container",
|
|
488
|
+
className
|
|
489
|
+
].filter(Boolean).join(" ");
|
|
490
|
+
const inputClassName = [
|
|
491
|
+
"input-field-input",
|
|
492
|
+
showClear && "with-clear",
|
|
493
|
+
hasError && "has-error"
|
|
494
|
+
].filter(Boolean).join(" ");
|
|
495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: containerClassName, children: [
|
|
496
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { htmlFor: name, className: "input-field-label", children: label }),
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "input-field-wrapper", children: [
|
|
498
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
499
|
+
"input",
|
|
500
|
+
{
|
|
501
|
+
id: name,
|
|
502
|
+
name,
|
|
503
|
+
type,
|
|
504
|
+
placeholder,
|
|
505
|
+
disabled,
|
|
506
|
+
value,
|
|
507
|
+
onChange: (e) => form.setValue(name, e.target.value),
|
|
508
|
+
onBlur,
|
|
509
|
+
className: inputClassName,
|
|
510
|
+
...rest
|
|
511
|
+
}
|
|
512
|
+
),
|
|
513
|
+
showClear && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
514
|
+
"span",
|
|
515
|
+
{
|
|
516
|
+
role: "button",
|
|
517
|
+
tabIndex: 0,
|
|
518
|
+
"aria-label": `Clear ${label || name}`,
|
|
519
|
+
title: "Clear",
|
|
520
|
+
onClick: () => form.clearValue(name),
|
|
521
|
+
onKeyDown: (e) => {
|
|
522
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
523
|
+
e.preventDefault();
|
|
524
|
+
form.clearValue(name);
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
className: "input-field-clear-button",
|
|
528
|
+
children: "\xD7"
|
|
529
|
+
}
|
|
530
|
+
)
|
|
531
|
+
] }),
|
|
532
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { role: "alert", className: "input-field-error", children: form.errors[name] })
|
|
533
|
+
] });
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
// lib/components/formManager/InputDropdown.tsx
|
|
537
|
+
var import_react7 = require("react");
|
|
538
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
539
|
+
var InputDropdown = ({
|
|
540
|
+
name,
|
|
541
|
+
label,
|
|
542
|
+
options,
|
|
543
|
+
placeholder = "Select an option",
|
|
544
|
+
clearable = true,
|
|
545
|
+
validator,
|
|
546
|
+
errorMessage,
|
|
547
|
+
disabled,
|
|
548
|
+
className,
|
|
549
|
+
style,
|
|
550
|
+
...rest
|
|
551
|
+
}) => {
|
|
552
|
+
const form = (0, import_react7.useContext)(FormContext);
|
|
553
|
+
if (!form) {
|
|
554
|
+
throw new Error("InputDropdown must be used inside <Form>.");
|
|
555
|
+
}
|
|
556
|
+
const value = form.values[name] ?? "";
|
|
557
|
+
(0, import_react7.useEffect)(() => {
|
|
558
|
+
form.registerField(name, validator, errorMessage);
|
|
559
|
+
return () => form.unregisterField(name);
|
|
560
|
+
}, [name, validator, errorMessage]);
|
|
561
|
+
const onBlur = async () => {
|
|
562
|
+
await form.validateField(name);
|
|
563
|
+
};
|
|
564
|
+
const showClear = clearable && !!value && !disabled;
|
|
565
|
+
const hasError = !!form.errors[name];
|
|
566
|
+
const selectClassName = [
|
|
567
|
+
"input-dropdown-select",
|
|
568
|
+
showClear && "with-clear",
|
|
569
|
+
hasError && "has-error",
|
|
570
|
+
className
|
|
571
|
+
].filter(Boolean).join(" ");
|
|
572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "input-dropdown-container", children: [
|
|
573
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { htmlFor: name, className: "input-dropdown-label", children: label }),
|
|
574
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "input-dropdown-wrapper", children: [
|
|
575
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
576
|
+
"select",
|
|
577
|
+
{
|
|
578
|
+
id: name,
|
|
579
|
+
name,
|
|
580
|
+
disabled,
|
|
581
|
+
value,
|
|
582
|
+
onChange: (e) => form.setValue(name, e.target.value),
|
|
583
|
+
onBlur,
|
|
584
|
+
className: selectClassName,
|
|
585
|
+
style,
|
|
586
|
+
...rest,
|
|
587
|
+
children: [
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "", disabled: true, children: placeholder }),
|
|
589
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: option.value, children: option.label }, option.value))
|
|
590
|
+
]
|
|
591
|
+
}
|
|
592
|
+
),
|
|
593
|
+
showClear && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
594
|
+
"button",
|
|
595
|
+
{
|
|
596
|
+
type: "button",
|
|
597
|
+
"aria-label": `Clear ${label || name}`,
|
|
598
|
+
title: "Clear",
|
|
599
|
+
onClick: () => form.clearValue(name),
|
|
600
|
+
className: "input-dropdown-clear-button",
|
|
601
|
+
children: "\xD7"
|
|
602
|
+
}
|
|
603
|
+
)
|
|
604
|
+
] }),
|
|
605
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { role: "alert", className: "input-dropdown-error", children: form.errors[name] })
|
|
606
|
+
] });
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
// lib/components/formManager/InputRadio.tsx
|
|
610
|
+
var import_react8 = require("react");
|
|
611
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
612
|
+
var InputRadio = ({
|
|
613
|
+
name,
|
|
614
|
+
label,
|
|
615
|
+
options,
|
|
616
|
+
validator,
|
|
617
|
+
errorMessage,
|
|
618
|
+
disabled,
|
|
619
|
+
className,
|
|
620
|
+
...rest
|
|
621
|
+
}) => {
|
|
622
|
+
const form = (0, import_react8.useContext)(FormContext);
|
|
623
|
+
if (!form) {
|
|
624
|
+
throw new Error("InputRadio must be used inside <Form>.");
|
|
625
|
+
}
|
|
626
|
+
const value = form.values[name] ?? "";
|
|
627
|
+
(0, import_react8.useEffect)(() => {
|
|
628
|
+
form.registerField(name, validator, errorMessage);
|
|
629
|
+
return () => form.unregisterField(name);
|
|
630
|
+
}, [name, validator, errorMessage]);
|
|
631
|
+
const onBlur = async () => {
|
|
632
|
+
await form.validateField(name);
|
|
633
|
+
};
|
|
634
|
+
const hasError = !!form.errors[name];
|
|
635
|
+
const containerClassName = [
|
|
636
|
+
"input-radio-container",
|
|
637
|
+
className
|
|
638
|
+
].filter(Boolean).join(" ");
|
|
639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: containerClassName, children: [
|
|
640
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "input-radio-label", children: label }),
|
|
641
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "input-radio-options", role: "radiogroup", ...rest, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
642
|
+
"label",
|
|
643
|
+
{
|
|
644
|
+
className: `input-radio-option ${disabled ? "disabled" : ""}`,
|
|
645
|
+
children: [
|
|
646
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
647
|
+
"input",
|
|
648
|
+
{
|
|
649
|
+
type: "radio",
|
|
650
|
+
name,
|
|
651
|
+
value: option.value,
|
|
652
|
+
checked: value === option.value,
|
|
653
|
+
onChange: (e) => form.setValue(name, e.target.value),
|
|
654
|
+
onBlur,
|
|
655
|
+
disabled,
|
|
656
|
+
className: "input-radio-input"
|
|
657
|
+
}
|
|
658
|
+
),
|
|
659
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "input-radio-option-label", children: option.label })
|
|
660
|
+
]
|
|
661
|
+
},
|
|
662
|
+
option.value
|
|
663
|
+
)) }),
|
|
664
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { role: "alert", className: "input-radio-error", children: form.errors[name] })
|
|
665
|
+
] });
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
// lib/components/formManager/InputCheckbox.tsx
|
|
669
|
+
var import_react9 = require("react");
|
|
670
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
671
|
+
var InputCheckbox = ({
|
|
672
|
+
name,
|
|
673
|
+
label,
|
|
674
|
+
options,
|
|
675
|
+
validator,
|
|
676
|
+
errorMessage,
|
|
677
|
+
disabled,
|
|
678
|
+
className,
|
|
679
|
+
...rest
|
|
680
|
+
}) => {
|
|
681
|
+
const form = (0, import_react9.useContext)(FormContext);
|
|
682
|
+
if (!form) {
|
|
683
|
+
throw new Error("InputCheckbox must be used inside <Form>.");
|
|
684
|
+
}
|
|
685
|
+
const value = form.values[name] ?? "";
|
|
686
|
+
const selectedValues = value ? value.split(",") : [];
|
|
687
|
+
(0, import_react9.useEffect)(() => {
|
|
688
|
+
form.registerField(name, validator, errorMessage);
|
|
689
|
+
return () => form.unregisterField(name);
|
|
690
|
+
}, [name, validator, errorMessage]);
|
|
691
|
+
const onBlur = async () => {
|
|
692
|
+
await form.validateField(name);
|
|
693
|
+
};
|
|
694
|
+
const handleChange = (optionValue, checked) => {
|
|
695
|
+
let newSelectedValues;
|
|
696
|
+
if (checked) {
|
|
697
|
+
newSelectedValues = [...selectedValues, optionValue];
|
|
698
|
+
} else {
|
|
699
|
+
newSelectedValues = selectedValues.filter((v) => v !== optionValue);
|
|
700
|
+
}
|
|
701
|
+
form.setValue(name, newSelectedValues.join(","));
|
|
702
|
+
};
|
|
703
|
+
const hasError = !!form.errors[name];
|
|
704
|
+
const containerClassName = [
|
|
705
|
+
"input-checkbox-container",
|
|
706
|
+
className
|
|
707
|
+
].filter(Boolean).join(" ");
|
|
708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: containerClassName, children: [
|
|
709
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "input-checkbox-label", children: label }),
|
|
710
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "input-checkbox-options", role: "group", ...rest, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
711
|
+
"label",
|
|
712
|
+
{
|
|
713
|
+
className: `input-checkbox-option ${disabled ? "disabled" : ""}`,
|
|
714
|
+
children: [
|
|
715
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
716
|
+
"input",
|
|
717
|
+
{
|
|
718
|
+
type: "checkbox",
|
|
719
|
+
name: `${name}-${option.value}`,
|
|
720
|
+
value: option.value,
|
|
721
|
+
checked: selectedValues.includes(option.value),
|
|
722
|
+
onChange: (e) => handleChange(option.value, e.target.checked),
|
|
723
|
+
onBlur,
|
|
724
|
+
disabled,
|
|
725
|
+
className: "input-checkbox-input"
|
|
726
|
+
}
|
|
727
|
+
),
|
|
728
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "input-checkbox-option-label", children: option.label })
|
|
729
|
+
]
|
|
730
|
+
},
|
|
731
|
+
option.value
|
|
732
|
+
)) }),
|
|
733
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { role: "alert", className: "input-checkbox-error", children: form.errors[name] })
|
|
734
|
+
] });
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
// lib/components/formManager/InputTextarea.tsx
|
|
738
|
+
var import_react10 = require("react");
|
|
739
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
740
|
+
var InputTextarea = ({
|
|
741
|
+
name,
|
|
742
|
+
label,
|
|
743
|
+
placeholder,
|
|
744
|
+
clearable = true,
|
|
745
|
+
validator,
|
|
746
|
+
errorMessage,
|
|
747
|
+
disabled,
|
|
748
|
+
rows,
|
|
749
|
+
maxLength,
|
|
750
|
+
className,
|
|
751
|
+
style,
|
|
752
|
+
...rest
|
|
753
|
+
}) => {
|
|
754
|
+
const form = (0, import_react10.useContext)(FormContext);
|
|
755
|
+
if (!form) {
|
|
756
|
+
throw new Error("InputTextarea must be used inside <Form>.");
|
|
757
|
+
}
|
|
758
|
+
const value = form.values[name] ?? "";
|
|
759
|
+
(0, import_react10.useEffect)(() => {
|
|
760
|
+
form.registerField(name, validator, errorMessage);
|
|
761
|
+
return () => form.unregisterField(name);
|
|
762
|
+
}, [name, validator, errorMessage]);
|
|
763
|
+
const onBlur = async () => {
|
|
764
|
+
await form.validateField(name);
|
|
765
|
+
};
|
|
766
|
+
const showClear = clearable && !!value && !disabled;
|
|
767
|
+
const hasError = !!form.errors[name];
|
|
768
|
+
const textareaClassName = [
|
|
769
|
+
"input-textarea-field",
|
|
770
|
+
showClear && "with-clear",
|
|
771
|
+
hasError && "has-error",
|
|
772
|
+
className
|
|
773
|
+
].filter(Boolean).join(" ");
|
|
774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "input-textarea-container", children: [
|
|
775
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: name, className: "input-textarea-label", children: label }),
|
|
776
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "input-textarea-wrapper", children: [
|
|
777
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
778
|
+
"textarea",
|
|
779
|
+
{
|
|
780
|
+
id: name,
|
|
781
|
+
name,
|
|
782
|
+
placeholder,
|
|
783
|
+
disabled,
|
|
784
|
+
rows,
|
|
785
|
+
maxLength,
|
|
786
|
+
value,
|
|
787
|
+
onChange: (e) => form.setValue(name, e.target.value),
|
|
788
|
+
onBlur,
|
|
789
|
+
className: textareaClassName,
|
|
790
|
+
style,
|
|
791
|
+
...rest
|
|
792
|
+
}
|
|
793
|
+
),
|
|
794
|
+
showClear && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
795
|
+
"button",
|
|
796
|
+
{
|
|
797
|
+
type: "button",
|
|
798
|
+
"aria-label": `Clear ${label || name}`,
|
|
799
|
+
title: "Clear",
|
|
800
|
+
onClick: () => form.clearValue(name),
|
|
801
|
+
className: "input-textarea-clear-button",
|
|
802
|
+
children: "\xD7"
|
|
803
|
+
}
|
|
804
|
+
)
|
|
805
|
+
] }),
|
|
806
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { role: "alert", className: "input-textarea-error", children: form.errors[name] })
|
|
807
|
+
] });
|
|
808
|
+
};
|
|
809
|
+
|
|
810
|
+
// lib/components/formManager/ResetButton.tsx
|
|
811
|
+
var import_react11 = require("react");
|
|
812
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
813
|
+
var ResetButton = ({
|
|
814
|
+
children,
|
|
815
|
+
...rest
|
|
816
|
+
}) => {
|
|
817
|
+
const form = (0, import_react11.useContext)(FormContext);
|
|
818
|
+
if (!form) {
|
|
819
|
+
throw new Error("ResetButton must be used inside <Form>.");
|
|
820
|
+
}
|
|
821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: form.reset, ...rest, children: children ?? "Reset" });
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
// lib/components/formManager/InputFile.tsx
|
|
825
|
+
var import_react12 = require("react");
|
|
826
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
827
|
+
var InputFile = ({
|
|
828
|
+
name,
|
|
829
|
+
label = "Upload File",
|
|
830
|
+
accept,
|
|
831
|
+
maxLength = 20,
|
|
832
|
+
maxFileSize = 2 * 1024 * 1024,
|
|
833
|
+
// 2MB default
|
|
834
|
+
onFileChange,
|
|
835
|
+
disabled = false,
|
|
836
|
+
validator,
|
|
837
|
+
errorMessage = "Please select a file.",
|
|
838
|
+
className
|
|
839
|
+
}) => {
|
|
840
|
+
const formContext = (0, import_react12.useContext)(FormContext);
|
|
841
|
+
const [selectedFile, setSelectedFile] = (0, import_react12.useState)(null);
|
|
842
|
+
const fileInputRef = (0, import_react12.useRef)(null);
|
|
843
|
+
(0, import_react12.useEffect)(() => {
|
|
844
|
+
if (name && formContext) {
|
|
845
|
+
formContext.registerField(name, validator, errorMessage);
|
|
846
|
+
return () => formContext.unregisterField(name);
|
|
847
|
+
}
|
|
848
|
+
}, [name]);
|
|
849
|
+
const truncateFileName = (fileName, maxLen) => {
|
|
850
|
+
if (fileName.length <= maxLen) {
|
|
851
|
+
return fileName;
|
|
852
|
+
}
|
|
853
|
+
const extensionIndex = fileName.lastIndexOf(".");
|
|
854
|
+
const extension = extensionIndex !== -1 ? fileName.substring(extensionIndex) : "";
|
|
855
|
+
const nameWithoutExt = extensionIndex !== -1 ? fileName.substring(0, extensionIndex) : fileName;
|
|
856
|
+
const availableLength = maxLen - extension.length - 10;
|
|
857
|
+
const initialChars = nameWithoutExt.substring(0, Math.max(availableLength, 5));
|
|
858
|
+
return `${initialChars}..........${extension}`;
|
|
859
|
+
};
|
|
860
|
+
const handleBrowseClick = () => {
|
|
861
|
+
fileInputRef.current?.click();
|
|
862
|
+
};
|
|
863
|
+
const handleFileChange = async (event) => {
|
|
864
|
+
const file = event.target.files?.[0];
|
|
865
|
+
if (!file) {
|
|
866
|
+
setSelectedFile(null);
|
|
867
|
+
if (onFileChange) onFileChange(null);
|
|
868
|
+
if (name && formContext) {
|
|
869
|
+
formContext.setValue(name, "");
|
|
870
|
+
}
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
if (file.size > maxFileSize) {
|
|
874
|
+
const maxSizeMB = (maxFileSize / (1024 * 1024)).toFixed(2);
|
|
875
|
+
if (fileInputRef.current) {
|
|
876
|
+
fileInputRef.current.value = "";
|
|
877
|
+
}
|
|
878
|
+
setSelectedFile(null);
|
|
879
|
+
if (onFileChange) onFileChange(null);
|
|
880
|
+
if (name && formContext) {
|
|
881
|
+
formContext.setValue(name, "");
|
|
882
|
+
}
|
|
883
|
+
alert(`File size exceeds ${maxSizeMB}MB limit.`);
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
setSelectedFile(file);
|
|
887
|
+
if (name && formContext) {
|
|
888
|
+
formContext.setValue(name, file.name);
|
|
889
|
+
}
|
|
890
|
+
if (onFileChange) {
|
|
891
|
+
onFileChange(file);
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
const hasError = name && formContext?.errors[name];
|
|
895
|
+
const errorMsg = hasError ? formContext?.errors[name] : null;
|
|
896
|
+
const containerClassName = [
|
|
897
|
+
"input-file-container",
|
|
898
|
+
className
|
|
899
|
+
].filter(Boolean).join(" ");
|
|
900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: containerClassName, children: [
|
|
901
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "input-file-label", children: label }),
|
|
902
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "input-file-wrapper", children: [
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
904
|
+
"input",
|
|
905
|
+
{
|
|
906
|
+
ref: fileInputRef,
|
|
907
|
+
type: "file",
|
|
908
|
+
accept,
|
|
909
|
+
onChange: handleFileChange,
|
|
910
|
+
disabled,
|
|
911
|
+
className: "input-file-hidden"
|
|
912
|
+
}
|
|
913
|
+
),
|
|
914
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
915
|
+
"button",
|
|
916
|
+
{
|
|
917
|
+
type: "button",
|
|
918
|
+
onClick: handleBrowseClick,
|
|
919
|
+
disabled,
|
|
920
|
+
className: "input-file-browse-btn",
|
|
921
|
+
children: "Browse"
|
|
922
|
+
}
|
|
923
|
+
),
|
|
924
|
+
selectedFile && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
925
|
+
"span",
|
|
926
|
+
{
|
|
927
|
+
className: "input-file-name",
|
|
928
|
+
title: selectedFile.name,
|
|
929
|
+
children: truncateFileName(selectedFile.name, maxLength)
|
|
930
|
+
}
|
|
931
|
+
)
|
|
932
|
+
] }),
|
|
933
|
+
errorMsg && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "input-file-error", children: errorMsg })
|
|
934
|
+
] });
|
|
935
|
+
};
|
|
936
|
+
var InputFile_default = InputFile;
|
|
937
|
+
|
|
938
|
+
// lib/components/globalErrorSuccessManager/ToastContext.tsx
|
|
939
|
+
var import_react14 = require("react");
|
|
940
|
+
|
|
941
|
+
// lib/components/globalErrorSuccessManager/useToast.ts
|
|
942
|
+
var import_react13 = require("react");
|
|
943
|
+
var ToastContext = (0, import_react13.createContext)(void 0);
|
|
944
|
+
var useToast = () => {
|
|
945
|
+
const context = (0, import_react13.useContext)(ToastContext);
|
|
946
|
+
if (!context) {
|
|
947
|
+
throw new Error("useToast must be used within a ToastProvider");
|
|
948
|
+
}
|
|
949
|
+
return context;
|
|
950
|
+
};
|
|
951
|
+
|
|
952
|
+
// lib/components/globalErrorSuccessManager/ToastContext.tsx
|
|
953
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
954
|
+
var ToastProvider = ({
|
|
955
|
+
children,
|
|
956
|
+
defaultDuration = 3e3,
|
|
957
|
+
maxToasts = 5
|
|
958
|
+
}) => {
|
|
959
|
+
const [toasts, setToasts] = (0, import_react14.useState)([]);
|
|
960
|
+
const removeToast = (0, import_react14.useCallback)((id) => {
|
|
961
|
+
setToasts((prev) => prev.filter((toast) => toast.id !== id));
|
|
962
|
+
}, []);
|
|
963
|
+
const showToast = (0, import_react14.useCallback)(
|
|
964
|
+
(message, type, duration = defaultDuration) => {
|
|
965
|
+
const id = `toast-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
966
|
+
const newToast = { id, message, type, duration };
|
|
967
|
+
setToasts((prev) => {
|
|
968
|
+
const updated = [...prev, newToast];
|
|
969
|
+
return updated.slice(-maxToasts);
|
|
970
|
+
});
|
|
971
|
+
if (duration > 0) {
|
|
972
|
+
setTimeout(() => {
|
|
973
|
+
removeToast(id);
|
|
974
|
+
}, duration);
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
[defaultDuration, maxToasts, removeToast]
|
|
978
|
+
);
|
|
979
|
+
const showSuccess = (0, import_react14.useCallback)(
|
|
980
|
+
(message, duration) => {
|
|
981
|
+
showToast(message, "success", duration);
|
|
982
|
+
},
|
|
983
|
+
[showToast]
|
|
984
|
+
);
|
|
985
|
+
const showError = (0, import_react14.useCallback)(
|
|
986
|
+
(message, duration) => {
|
|
987
|
+
showToast(message, "error", duration);
|
|
988
|
+
},
|
|
989
|
+
[showToast]
|
|
990
|
+
);
|
|
991
|
+
const showInfo = (0, import_react14.useCallback)(
|
|
992
|
+
(message, duration) => {
|
|
993
|
+
showToast(message, "info", duration);
|
|
994
|
+
},
|
|
995
|
+
[showToast]
|
|
996
|
+
);
|
|
997
|
+
const showWarning = (0, import_react14.useCallback)(
|
|
998
|
+
(message, duration) => {
|
|
999
|
+
showToast(message, "warning", duration);
|
|
1000
|
+
},
|
|
1001
|
+
[showToast]
|
|
1002
|
+
);
|
|
1003
|
+
const value = {
|
|
1004
|
+
toasts,
|
|
1005
|
+
showToast,
|
|
1006
|
+
showSuccess,
|
|
1007
|
+
showError,
|
|
1008
|
+
showInfo,
|
|
1009
|
+
showWarning,
|
|
1010
|
+
removeToast
|
|
1011
|
+
};
|
|
1012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ToastContext.Provider, { value, children });
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
// lib/components/globalErrorSuccessManager/ToastContainer.tsx
|
|
1016
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1017
|
+
var ToastContainer = ({
|
|
1018
|
+
position = "top-right",
|
|
1019
|
+
className
|
|
1020
|
+
}) => {
|
|
1021
|
+
const { toasts, removeToast } = useToast();
|
|
1022
|
+
const containerClassName = [
|
|
1023
|
+
"toast-container",
|
|
1024
|
+
`toast-container-${position}`,
|
|
1025
|
+
className
|
|
1026
|
+
].filter(Boolean).join(" ");
|
|
1027
|
+
const getToastClassName = (type) => {
|
|
1028
|
+
return [
|
|
1029
|
+
"toast",
|
|
1030
|
+
`toast-${type}`
|
|
1031
|
+
].filter(Boolean).join(" ");
|
|
1032
|
+
};
|
|
1033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: containerClassName, children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1034
|
+
"div",
|
|
1035
|
+
{
|
|
1036
|
+
className: getToastClassName(toast.type),
|
|
1037
|
+
role: "alert",
|
|
1038
|
+
"aria-live": "polite",
|
|
1039
|
+
children: [
|
|
1040
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "toast-content", children: [
|
|
1041
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "toast-icon", children: getIcon(toast.type) }),
|
|
1042
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "toast-message", children: toast.message })
|
|
1043
|
+
] }),
|
|
1044
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1045
|
+
"button",
|
|
1046
|
+
{
|
|
1047
|
+
type: "button",
|
|
1048
|
+
className: "toast-close",
|
|
1049
|
+
onClick: () => removeToast(toast.id),
|
|
1050
|
+
"aria-label": "Close",
|
|
1051
|
+
children: "\xD7"
|
|
1052
|
+
}
|
|
1053
|
+
)
|
|
1054
|
+
]
|
|
1055
|
+
},
|
|
1056
|
+
toast.id
|
|
1057
|
+
)) });
|
|
1058
|
+
};
|
|
1059
|
+
function getIcon(type) {
|
|
1060
|
+
switch (type) {
|
|
1061
|
+
case "success":
|
|
1062
|
+
return "\u2713";
|
|
1063
|
+
case "error":
|
|
1064
|
+
return "\u2715";
|
|
1065
|
+
case "warning":
|
|
1066
|
+
return "\u26A0";
|
|
1067
|
+
case "info":
|
|
1068
|
+
return "\u2139";
|
|
1069
|
+
default:
|
|
1070
|
+
return "";
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
// lib/components/globalErrorSuccessManager/InlineAlert.tsx
|
|
1075
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1076
|
+
var InlineAlert = ({
|
|
1077
|
+
type,
|
|
1078
|
+
message,
|
|
1079
|
+
title,
|
|
1080
|
+
dismissible = false,
|
|
1081
|
+
onDismiss,
|
|
1082
|
+
className
|
|
1083
|
+
}) => {
|
|
1084
|
+
const alertClassName = [
|
|
1085
|
+
"inline-alert",
|
|
1086
|
+
`inline-alert-${type}`,
|
|
1087
|
+
className
|
|
1088
|
+
].filter(Boolean).join(" ");
|
|
1089
|
+
const getIcon2 = () => {
|
|
1090
|
+
switch (type) {
|
|
1091
|
+
case "success":
|
|
1092
|
+
return "\u2713";
|
|
1093
|
+
case "error":
|
|
1094
|
+
return "\u2715";
|
|
1095
|
+
case "warning":
|
|
1096
|
+
return "\u26A0";
|
|
1097
|
+
case "info":
|
|
1098
|
+
return "\u2139";
|
|
1099
|
+
default:
|
|
1100
|
+
return "";
|
|
1101
|
+
}
|
|
1102
|
+
};
|
|
1103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: alertClassName, role: "alert", children: [
|
|
1104
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "inline-alert-icon", children: getIcon2() }),
|
|
1105
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "inline-alert-content", children: [
|
|
1106
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "inline-alert-title", children: title }),
|
|
1107
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "inline-alert-message", children: message })
|
|
1108
|
+
] }),
|
|
1109
|
+
dismissible && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1110
|
+
"button",
|
|
1111
|
+
{
|
|
1112
|
+
type: "button",
|
|
1113
|
+
className: "inline-alert-close",
|
|
1114
|
+
onClick: onDismiss,
|
|
1115
|
+
"aria-label": "Close",
|
|
1116
|
+
children: "\xD7"
|
|
1117
|
+
}
|
|
1118
|
+
)
|
|
1119
|
+
] });
|
|
1120
|
+
};
|
|
1121
|
+
|
|
1122
|
+
// lib/components/storageManager/StorageProvider.tsx
|
|
1123
|
+
var import_react16 = require("react");
|
|
1124
|
+
|
|
1125
|
+
// lib/components/storageManager/useStorage.ts
|
|
1126
|
+
var import_react15 = require("react");
|
|
1127
|
+
var StorageContext = (0, import_react15.createContext)(
|
|
1128
|
+
void 0
|
|
1129
|
+
);
|
|
1130
|
+
function useStorage() {
|
|
1131
|
+
const context = (0, import_react15.useContext)(StorageContext);
|
|
1132
|
+
if (!context) {
|
|
1133
|
+
throw new Error("useStorage must be used within a StorageProvider");
|
|
1134
|
+
}
|
|
1135
|
+
return context;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
// lib/components/storageManager/StorageProvider.tsx
|
|
1139
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1140
|
+
var StorageAdapter = class {
|
|
1141
|
+
storage;
|
|
1142
|
+
namespace;
|
|
1143
|
+
serialize;
|
|
1144
|
+
encrypt;
|
|
1145
|
+
storageType;
|
|
1146
|
+
constructor(options = {}) {
|
|
1147
|
+
this.namespace = options.namespace || "";
|
|
1148
|
+
this.serialize = options.serialize ?? true;
|
|
1149
|
+
this.encrypt = options.encrypt ?? false;
|
|
1150
|
+
this.storageType = options.storageType || "local";
|
|
1151
|
+
if (this.storageType === "local") {
|
|
1152
|
+
this.storage = typeof window !== "undefined" ? window.localStorage : /* @__PURE__ */ new Map();
|
|
1153
|
+
} else if (this.storageType === "session") {
|
|
1154
|
+
this.storage = typeof window !== "undefined" ? window.sessionStorage : /* @__PURE__ */ new Map();
|
|
1155
|
+
} else {
|
|
1156
|
+
this.storage = /* @__PURE__ */ new Map();
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
getKey(key) {
|
|
1160
|
+
return this.namespace ? `${this.namespace}:${key}` : key;
|
|
1161
|
+
}
|
|
1162
|
+
encodeValue(value) {
|
|
1163
|
+
if (!this.encrypt) return value;
|
|
1164
|
+
return btoa(encodeURIComponent(value));
|
|
1165
|
+
}
|
|
1166
|
+
decodeValue(value) {
|
|
1167
|
+
if (!this.encrypt) return value;
|
|
1168
|
+
try {
|
|
1169
|
+
return decodeURIComponent(atob(value));
|
|
1170
|
+
} catch {
|
|
1171
|
+
return value;
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
getItem(key, defaultValue) {
|
|
1175
|
+
try {
|
|
1176
|
+
const fullKey = this.getKey(key);
|
|
1177
|
+
const rawValue = this.storage instanceof Map ? this.storage.get(fullKey) : this.storage.getItem(fullKey);
|
|
1178
|
+
if (rawValue === null || rawValue === void 0) {
|
|
1179
|
+
return defaultValue ?? null;
|
|
1180
|
+
}
|
|
1181
|
+
const decodedValue = this.decodeValue(rawValue);
|
|
1182
|
+
if (this.serialize) {
|
|
1183
|
+
return JSON.parse(decodedValue);
|
|
1184
|
+
}
|
|
1185
|
+
return decodedValue;
|
|
1186
|
+
} catch (error) {
|
|
1187
|
+
console.error(`Error getting item "${key}" from storage:`, error);
|
|
1188
|
+
return defaultValue ?? null;
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
setItem(key, value) {
|
|
1192
|
+
try {
|
|
1193
|
+
const fullKey = this.getKey(key);
|
|
1194
|
+
const serializedValue = this.serialize ? JSON.stringify(value) : String(value);
|
|
1195
|
+
const encodedValue = this.encodeValue(serializedValue);
|
|
1196
|
+
if (this.storage instanceof Map) {
|
|
1197
|
+
this.storage.set(fullKey, encodedValue);
|
|
1198
|
+
} else {
|
|
1199
|
+
this.storage.setItem(fullKey, encodedValue);
|
|
1200
|
+
}
|
|
1201
|
+
} catch (error) {
|
|
1202
|
+
console.error(`Error setting item "${key}" in storage:`, error);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
removeItem(key) {
|
|
1206
|
+
try {
|
|
1207
|
+
const fullKey = this.getKey(key);
|
|
1208
|
+
if (this.storage instanceof Map) {
|
|
1209
|
+
this.storage.delete(fullKey);
|
|
1210
|
+
} else {
|
|
1211
|
+
this.storage.removeItem(fullKey);
|
|
1212
|
+
}
|
|
1213
|
+
} catch (error) {
|
|
1214
|
+
console.error(`Error removing item "${key}" from storage:`, error);
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
clear() {
|
|
1218
|
+
try {
|
|
1219
|
+
if (this.storage instanceof Map) {
|
|
1220
|
+
this.storage.clear();
|
|
1221
|
+
} else {
|
|
1222
|
+
if (this.namespace) {
|
|
1223
|
+
const keys = this.getAllKeys();
|
|
1224
|
+
keys.forEach((key) => this.removeItem(key));
|
|
1225
|
+
} else {
|
|
1226
|
+
this.storage.clear();
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
} catch (error) {
|
|
1230
|
+
console.error("Error clearing storage:", error);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
hasItem(key) {
|
|
1234
|
+
const fullKey = this.getKey(key);
|
|
1235
|
+
if (this.storage instanceof Map) {
|
|
1236
|
+
return this.storage.has(fullKey);
|
|
1237
|
+
}
|
|
1238
|
+
return this.storage.getItem(fullKey) !== null;
|
|
1239
|
+
}
|
|
1240
|
+
getAllKeys() {
|
|
1241
|
+
try {
|
|
1242
|
+
if (this.storage instanceof Map) {
|
|
1243
|
+
return Array.from(this.storage.keys()).filter((key) => !this.namespace || key.startsWith(`${this.namespace}:`)).map((key) => this.namespace ? key.slice(this.namespace.length + 1) : key);
|
|
1244
|
+
} else {
|
|
1245
|
+
const allKeys = Object.keys(this.storage);
|
|
1246
|
+
return allKeys.filter((key) => !this.namespace || key.startsWith(`${this.namespace}:`)).map((key) => this.namespace ? key.slice(this.namespace.length + 1) : key);
|
|
1247
|
+
}
|
|
1248
|
+
} catch (error) {
|
|
1249
|
+
console.error("Error getting all keys from storage:", error);
|
|
1250
|
+
return [];
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
getStorageType() {
|
|
1254
|
+
return this.storageType;
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
var StorageProvider = ({
|
|
1258
|
+
children,
|
|
1259
|
+
storageType = "local",
|
|
1260
|
+
namespace = "",
|
|
1261
|
+
serialize = true,
|
|
1262
|
+
encrypt = false
|
|
1263
|
+
}) => {
|
|
1264
|
+
const adapterRef = (0, import_react16.useRef)(null);
|
|
1265
|
+
if (!adapterRef.current) {
|
|
1266
|
+
adapterRef.current = new StorageAdapter({
|
|
1267
|
+
storageType,
|
|
1268
|
+
namespace,
|
|
1269
|
+
serialize,
|
|
1270
|
+
encrypt
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
const value = (0, import_react16.useMemo)(
|
|
1274
|
+
() => ({
|
|
1275
|
+
getItem: (key, defaultValue) => adapterRef.current.getItem(key, defaultValue),
|
|
1276
|
+
setItem: (key, value2) => adapterRef.current.setItem(key, value2),
|
|
1277
|
+
removeItem: (key) => adapterRef.current.removeItem(key),
|
|
1278
|
+
clear: () => adapterRef.current.clear(),
|
|
1279
|
+
hasItem: (key) => adapterRef.current.hasItem(key),
|
|
1280
|
+
getAllKeys: () => adapterRef.current.getAllKeys(),
|
|
1281
|
+
storageType: adapterRef.current.getStorageType()
|
|
1282
|
+
}),
|
|
1283
|
+
[]
|
|
1284
|
+
);
|
|
1285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StorageContext.Provider, { value, children });
|
|
1286
|
+
};
|
|
1287
|
+
|
|
1288
|
+
// lib/components/contextManager/createContext.tsx
|
|
1289
|
+
var import_react17 = require("react");
|
|
1290
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1291
|
+
function createContext4(config) {
|
|
1292
|
+
const { name, errorMessage, defaultValue } = config;
|
|
1293
|
+
const Context = (0, import_react17.createContext)(defaultValue);
|
|
1294
|
+
Context.displayName = name;
|
|
1295
|
+
const Provider = ({ children, value }) => {
|
|
1296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Context.Provider, { value, children });
|
|
1297
|
+
};
|
|
1298
|
+
Provider.displayName = `${name}Provider`;
|
|
1299
|
+
const useContext10 = () => {
|
|
1300
|
+
const context = (0, import_react17.useContext)(Context);
|
|
1301
|
+
if (context === void 0) {
|
|
1302
|
+
const error = errorMessage || `use${name} must be used within a ${name}Provider. Make sure you wrap your component tree with <${name}Provider>.`;
|
|
1303
|
+
throw new Error(error);
|
|
1304
|
+
}
|
|
1305
|
+
return context;
|
|
1306
|
+
};
|
|
1307
|
+
return {
|
|
1308
|
+
Context,
|
|
1309
|
+
Provider,
|
|
1310
|
+
useContext: useContext10
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
// lib/components/contextManager/createContextWithHook.tsx
|
|
1315
|
+
var import_react18 = require("react");
|
|
1316
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1317
|
+
function createContextWithHook(config) {
|
|
1318
|
+
const { name, useValue, errorMessage } = config;
|
|
1319
|
+
const Context = (0, import_react18.createContext)(void 0);
|
|
1320
|
+
Context.displayName = name;
|
|
1321
|
+
const Provider = ({ children, ...props }) => {
|
|
1322
|
+
const value = useValue(props);
|
|
1323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Context.Provider, { value, children });
|
|
1324
|
+
};
|
|
1325
|
+
Provider.displayName = `${name}Provider`;
|
|
1326
|
+
const useContext10 = () => {
|
|
1327
|
+
const context = (0, import_react18.useContext)(Context);
|
|
1328
|
+
if (context === void 0) {
|
|
1329
|
+
const error = errorMessage || `use${name} must be used within a ${name}Provider. Make sure you wrap your component tree with <${name}Provider>.`;
|
|
1330
|
+
throw new Error(error);
|
|
1331
|
+
}
|
|
1332
|
+
return context;
|
|
1333
|
+
};
|
|
1334
|
+
return {
|
|
1335
|
+
Context,
|
|
1336
|
+
Provider,
|
|
1337
|
+
useContext: useContext10
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1341
|
+
0 && (module.exports = {
|
|
1342
|
+
AppInsight,
|
|
1343
|
+
AuthProvider,
|
|
1344
|
+
ErrorBoundary,
|
|
1345
|
+
Form,
|
|
1346
|
+
InlineAlert,
|
|
1347
|
+
InputCheckbox,
|
|
1348
|
+
InputDropdown,
|
|
1349
|
+
InputField,
|
|
1350
|
+
InputFile,
|
|
1351
|
+
InputRadio,
|
|
1352
|
+
InputTextarea,
|
|
1353
|
+
Protected,
|
|
1354
|
+
QueryProvider,
|
|
1355
|
+
ResetButton,
|
|
1356
|
+
RouterProvider,
|
|
1357
|
+
StorageContext,
|
|
1358
|
+
StorageProvider,
|
|
1359
|
+
ToastContainer,
|
|
1360
|
+
ToastProvider,
|
|
1361
|
+
configureClient,
|
|
1362
|
+
createContext,
|
|
1363
|
+
createContextWithHook,
|
|
1364
|
+
del,
|
|
1365
|
+
get,
|
|
1366
|
+
getNavigate,
|
|
1367
|
+
post,
|
|
1368
|
+
put,
|
|
1369
|
+
useAuth,
|
|
1370
|
+
useDeleteMutation,
|
|
1371
|
+
useGetQuery,
|
|
1372
|
+
usePostMutation,
|
|
1373
|
+
usePutMutation,
|
|
1374
|
+
useStorage,
|
|
1375
|
+
useToast
|
|
1376
|
+
});
|
|
1377
|
+
//# sourceMappingURL=index.cjs.map
|