jplan-pack 0.6.733 → 0.6.735
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/{AuthRoute-R4mMegPV.mjs → AuthRoute-CI8SYI0x.mjs} +1 -1
- package/dist/{AuthRoute-0iHl45Os.js → AuthRoute-CxnmOY8x.js} +1 -1
- package/dist/{WidgetLabel-DQCAg6V8.js → WidgetLabel-ByRvF284.js} +1 -1
- package/dist/{WidgetLabel-DdmQCYwi.mjs → WidgetLabel-EGh5Uxyy.mjs} +1 -1
- package/dist/{WidgetShortcut-CQ7ysNgy.js → WidgetShortcut-BXIP0Njn.js} +1 -1
- package/dist/{WidgetShortcut-35D1TnPh.mjs → WidgetShortcut-BYCtrby8.mjs} +1 -1
- package/dist/{WidgetSpacer-CqnMZpDm.js → WidgetSpacer-B4EZ3H17.js} +1 -1
- package/dist/{WidgetSpacer-Bjv8n6zF.mjs → WidgetSpacer-D7BVzaNf.mjs} +1 -1
- package/dist/{WidgetTask-CB749RiZ.mjs → WidgetTask-C1ccG6k4.mjs} +1 -1
- package/dist/{WidgetTask-BQdg0SnF.js → WidgetTask-CEJI71mG.js} +1 -1
- package/dist/{index-CciX2B9K.mjs → index-CE7FSPaf.mjs} +8 -6
- package/dist/{index-D2YLQxoc.js → index-DqOQ5Gkx.js} +2 -2
- package/dist/jplan-pack.cjs.js +1 -1
- package/dist/jplan-pack.es.js +1 -1
- package/dist/types/components/form/JSelect.d.ts +1 -0
- package/package.json +1 -1
@@ -69,7 +69,7 @@ __p += '`),Pe&&(j+=`' +
|
|
69
69
|
function print() { __p += __j.call(arguments, '') }
|
70
70
|
`:`;
|
71
71
|
`)+j+`return __p
|
72
|
-
}`;var Ie=o_(function(){return Fe(E,se+"return "+j).apply(t,b)});if(Ie.source=j,Td(Ie))throw Ie;return Ie}function NR(i){return He(i).toLowerCase()}function RR(i){return He(i).toUpperCase()}function OR(i,s,u){if(i=He(i),i&&(u||s===t))return fg(i);if(!i||!(s=In(s)))return i;var f=cr(i),_=cr(s),E=mg(f,_),b=gg(f,_)+1;return ko(f,E,b).join("")}function PR(i,s,u){if(i=He(i),i&&(u||s===t))return i.slice(0,_g(i)+1);if(!i||!(s=In(s)))return i;var f=cr(i),_=gg(f,cr(s))+1;return ko(f,0,_).join("")}function MR(i,s,u){if(i=He(i),i&&(u||s===t))return i.replace(Tu,"");if(!i||!(s=In(s)))return i;var f=cr(i),_=mg(f,cr(s));return ko(f,_).join("")}function DR(i,s){var u=X,f=ee;if(ut(s)){var _="separator"in s?s.separator:_;u="length"in s?be(s.length):u,f="omission"in s?In(s.omission):f}i=He(i);var E=i.length;if(Oi(i)){var b=cr(i);E=b.length}if(u>=E)return i;var S=u-Pi(f);if(S<1)return f;var P=b?ko(b,0,S).join(""):i.slice(0,S);if(_===t)return P+f;if(b&&(S+=P.length-S),bd(_)){if(i.slice(S).search(_)){var W,z=P;for(_.global||(_=Vu(_.source,He(Lm.exec(_))+"g")),_.lastIndex=0;W=_.exec(z);)var j=W.index;P=P.slice(0,j===t?S:j)}}else if(i.indexOf(In(_),S)!=S){var te=P.lastIndexOf(_);te>-1&&(P=P.slice(0,te))}return P+f}function LR(i){return i=He(i),i&>.test(i)?i.replace(Pm,uI):i}var xR=Fi(function(i,s,u){return i+(u?" ":"")+s.toUpperCase()}),Ad=ip("toUpperCase");function r_(i,s,u){return i=He(i),s=u?t:s,s===t?iI(i)?fI(i):Jb(i):i.match(s)||[]}var o_=Se(function(i,s){try{return Tn(i,t,s)}catch(u){return Td(u)?u:new Ce(u)}}),UR=Xr(function(i,s){return Hn(s,function(u){u=Or(u),Jr(i,u,Ed(i[u],i))}),i});function BR(i){var s=i==null?0:i.length,u=de();return i=s?st(i,function(f){if(typeof f[1]!="function")throw new $n(c);return[u(f[0]),f[1]]}):[],Se(function(f){for(var _=-1;++_<s;){var E=i[_];if(Tn(E[0],this,f))return Tn(E[1],this,f)}})}function FR(i){return uS(Wn(i,v))}function kd(i){return function(){return i}}function VR(i,s){return i==null||i!==i?s:i}var HR=sp(),$R=sp(!0);function gn(i){return i}function Nd(i){return Ug(typeof i=="function"?i:Wn(i,v))}function KR(i){return Fg(Wn(i,v))}function WR(i,s){return Vg(i,Wn(s,v))}var zR=Se(function(i,s){return function(u){return Ya(u,i,s)}}),GR=Se(function(i,s){return function(u){return Ya(i,u,s)}});function Rd(i,s,u){var f=Dt(s),_=fc(s,f);u==null&&!(ut(s)&&(_.length||!f.length))&&(u=s,s=i,i=this,_=fc(s,Dt(s)));var E=!(ut(u)&&"chain"in u)||!!u.chain,b=eo(i);return Hn(_,function(S){var P=s[S];i[S]=P,b&&(i.prototype[S]=function(){var W=this.__chain__;if(E||W){var z=i(this.__wrapped__),j=z.__actions__=hn(this.__actions__);return j.push({func:P,args:arguments,thisArg:i}),z.__chain__=W,z}return P.apply(i,wo([this.value()],arguments))})}),i}function qR(){return Vt._===this&&(Vt._=yI),this}function Od(){}function jR(i){return i=be(i),Se(function(s){return Hg(s,i)})}var YR=cd(st),JR=cd(cg),QR=cd(Mu);function i_(i){return gd(i)?Du(Or(i)):AS(i)}function XR(i){return function(s){return i==null?t:ni(i,s)}}var ZR=lp(),eO=lp(!0);function Pd(){return[]}function Md(){return!1}function tO(){return{}}function nO(){return""}function rO(){return!0}function oO(i,s){if(i=be(i),i<1||i>at)return[];var u=St,f=jt(i,St);s=de(s),i-=St;for(var _=Uu(f,s);++u<i;)s(u);return _}function iO(i){return Ee(i)?st(i,Or):Sn(i)?[i]:hn(Ip(He(i)))}function aO(i){var s=++_I;return He(i)+s}var sO=yc(function(i,s){return i+s},0),cO=ld("ceil"),lO=yc(function(i,s){return i/s},1),uO=ld("floor");function dO(i){return i&&i.length?hc(i,gn,ju):t}function hO(i,s){return i&&i.length?hc(i,de(s,2),ju):t}function fO(i){return dg(i,gn)}function mO(i,s){return dg(i,de(s,2))}function gO(i){return i&&i.length?hc(i,gn,Xu):t}function pO(i,s){return i&&i.length?hc(i,de(s,2),Xu):t}var _O=yc(function(i,s){return i*s},1),vO=ld("round"),yO=yc(function(i,s){return i-s},0);function CO(i){return i&&i.length?xu(i,gn):0}function EO(i,s){return i&&i.length?xu(i,de(s,2)):0}return y.after=Kk,y.ary=xp,y.assign=RN,y.assignIn=Jp,y.assignInWith=Pc,y.assignWith=ON,y.at=PN,y.before=Up,y.bind=Ed,y.bindAll=UR,y.bindKey=Bp,y.castArray=tN,y.chain=Mp,y.chunk=uA,y.compact=dA,y.concat=hA,y.cond=BR,y.conforms=FR,y.constant=kd,y.countBy=Ck,y.create=MN,y.curry=Fp,y.curryRight=Vp,y.debounce=Hp,y.defaults=DN,y.defaultsDeep=LN,y.defer=Wk,y.delay=zk,y.difference=fA,y.differenceBy=mA,y.differenceWith=gA,y.drop=pA,y.dropRight=_A,y.dropRightWhile=vA,y.dropWhile=yA,y.fill=CA,y.filter=wk,y.flatMap=Ik,y.flatMapDeep=Sk,y.flatMapDepth=Ak,y.flatten=Np,y.flattenDeep=EA,y.flattenDepth=wA,y.flip=Gk,y.flow=HR,y.flowRight=$R,y.fromPairs=TA,y.functions=$N,y.functionsIn=KN,y.groupBy=kk,y.initial=IA,y.intersection=SA,y.intersectionBy=AA,y.intersectionWith=kA,y.invert=zN,y.invertBy=GN,y.invokeMap=Rk,y.iteratee=Nd,y.keyBy=Ok,y.keys=Dt,y.keysIn=mn,y.map=Sc,y.mapKeys=jN,y.mapValues=YN,y.matches=KR,y.matchesProperty=WR,y.memoize=kc,y.merge=JN,y.mergeWith=Qp,y.method=zR,y.methodOf=GR,y.mixin=Rd,y.negate=Nc,y.nthArg=jR,y.omit=QN,y.omitBy=XN,y.once=qk,y.orderBy=Pk,y.over=YR,y.overArgs=jk,y.overEvery=JR,y.overSome=QR,y.partial=wd,y.partialRight=$p,y.partition=Mk,y.pick=ZN,y.pickBy=Xp,y.property=i_,y.propertyOf=XR,y.pull=PA,y.pullAll=Op,y.pullAllBy=MA,y.pullAllWith=DA,y.pullAt=LA,y.range=ZR,y.rangeRight=eO,y.rearg=Yk,y.reject=xk,y.remove=xA,y.rest=Jk,y.reverse=yd,y.sampleSize=Bk,y.set=tR,y.setWith=nR,y.shuffle=Fk,y.slice=UA,y.sortBy=$k,y.sortedUniq=WA,y.sortedUniqBy=zA,y.split=IR,y.spread=Qk,y.tail=GA,y.take=qA,y.takeRight=jA,y.takeRightWhile=YA,y.takeWhile=JA,y.tap=dk,y.throttle=Xk,y.thru=Ic,y.toArray=qp,y.toPairs=Zp,y.toPairsIn=e_,y.toPath=iO,y.toPlainObject=Yp,y.transform=rR,y.unary=Zk,y.union=QA,y.unionBy=XA,y.unionWith=ZA,y.uniq=ek,y.uniqBy=tk,y.uniqWith=nk,y.unset=oR,y.unzip=Cd,y.unzipWith=Pp,y.update=iR,y.updateWith=aR,y.values=$i,y.valuesIn=sR,y.without=rk,y.words=r_,y.wrap=eN,y.xor=ok,y.xorBy=ik,y.xorWith=ak,y.zip=sk,y.zipObject=ck,y.zipObjectDeep=lk,y.zipWith=uk,y.entries=Zp,y.entriesIn=e_,y.extend=Jp,y.extendWith=Pc,Rd(y,y),y.add=sO,y.attempt=o_,y.camelCase=dR,y.capitalize=t_,y.ceil=cO,y.clamp=cR,y.clone=nN,y.cloneDeep=oN,y.cloneDeepWith=iN,y.cloneWith=rN,y.conformsTo=aN,y.deburr=n_,y.defaultTo=VR,y.divide=lO,y.endsWith=hR,y.eq=ur,y.escape=fR,y.escapeRegExp=mR,y.every=Ek,y.find=Tk,y.findIndex=Ap,y.findKey=xN,y.findLast=bk,y.findLastIndex=kp,y.findLastKey=UN,y.floor=uO,y.forEach=Dp,y.forEachRight=Lp,y.forIn=BN,y.forInRight=FN,y.forOwn=VN,y.forOwnRight=HN,y.get=Id,y.gt=sN,y.gte=cN,y.has=WN,y.hasIn=Sd,y.head=Rp,y.identity=gn,y.includes=Nk,y.indexOf=bA,y.inRange=lR,y.invoke=qN,y.isArguments=ii,y.isArray=Ee,y.isArrayBuffer=lN,y.isArrayLike=fn,y.isArrayLikeObject=pt,y.isBoolean=uN,y.isBuffer=No,y.isDate=dN,y.isElement=hN,y.isEmpty=fN,y.isEqual=mN,y.isEqualWith=gN,y.isError=Td,y.isFinite=pN,y.isFunction=eo,y.isInteger=Kp,y.isLength=Rc,y.isMap=Wp,y.isMatch=_N,y.isMatchWith=vN,y.isNaN=yN,y.isNative=CN,y.isNil=wN,y.isNull=EN,y.isNumber=zp,y.isObject=ut,y.isObjectLike=ht,y.isPlainObject=ts,y.isRegExp=bd,y.isSafeInteger=TN,y.isSet=Gp,y.isString=Oc,y.isSymbol=Sn,y.isTypedArray=Hi,y.isUndefined=bN,y.isWeakMap=IN,y.isWeakSet=SN,y.join=NA,y.kebabCase=gR,y.last=Gn,y.lastIndexOf=RA,y.lowerCase=pR,y.lowerFirst=_R,y.lt=AN,y.lte=kN,y.max=dO,y.maxBy=hO,y.mean=fO,y.meanBy=mO,y.min=gO,y.minBy=pO,y.stubArray=Pd,y.stubFalse=Md,y.stubObject=tO,y.stubString=nO,y.stubTrue=rO,y.multiply=_O,y.nth=OA,y.noConflict=qR,y.noop=Od,y.now=Ac,y.pad=vR,y.padEnd=yR,y.padStart=CR,y.parseInt=ER,y.random=uR,y.reduce=Dk,y.reduceRight=Lk,y.repeat=wR,y.replace=TR,y.result=eR,y.round=vO,y.runInContext=O,y.sample=Uk,y.size=Vk,y.snakeCase=bR,y.some=Hk,y.sortedIndex=BA,y.sortedIndexBy=FA,y.sortedIndexOf=VA,y.sortedLastIndex=HA,y.sortedLastIndexBy=$A,y.sortedLastIndexOf=KA,y.startCase=SR,y.startsWith=AR,y.subtract=yO,y.sum=CO,y.sumBy=EO,y.template=kR,y.times=oO,y.toFinite=to,y.toInteger=be,y.toLength=jp,y.toLower=NR,y.toNumber=qn,y.toSafeInteger=NN,y.toString=He,y.toUpper=RR,y.trim=OR,y.trimEnd=PR,y.trimStart=MR,y.truncate=DR,y.unescape=LR,y.uniqueId=aO,y.upperCase=xR,y.upperFirst=Ad,y.each=Dp,y.eachRight=Lp,y.first=Rp,Rd(y,function(){var i={};return Nr(y,function(s,u){$e.call(y.prototype,u)||(i[u]=s)}),i}(),{chain:!1}),y.VERSION=r,Hn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(i){y[i].placeholder=y}),Hn(["drop","take"],function(i,s){Oe.prototype[i]=function(u){u=u===t?1:kt(be(u),0);var f=this.__filtered__&&!s?new Oe(this):this.clone();return f.__filtered__?f.__takeCount__=jt(u,f.__takeCount__):f.__views__.push({size:jt(u,St),type:i+(f.__dir__<0?"Right":"")}),f},Oe.prototype[i+"Right"]=function(u){return this.reverse()[i](u).reverse()}}),Hn(["filter","map","takeWhile"],function(i,s){var u=s+1,f=u==Ct||u==qt;Oe.prototype[i]=function(_){var E=this.clone();return E.__iteratees__.push({iteratee:de(_,3),type:u}),E.__filtered__=E.__filtered__||f,E}}),Hn(["head","last"],function(i,s){var u="take"+(s?"Right":"");Oe.prototype[i]=function(){return this[u](1).value()[0]}}),Hn(["initial","tail"],function(i,s){var u="drop"+(s?"":"Right");Oe.prototype[i]=function(){return this.__filtered__?new Oe(this):this[u](1)}}),Oe.prototype.compact=function(){return this.filter(gn)},Oe.prototype.find=function(i){return this.filter(i).head()},Oe.prototype.findLast=function(i){return this.reverse().find(i)},Oe.prototype.invokeMap=Se(function(i,s){return typeof i=="function"?new Oe(this):this.map(function(u){return Ya(u,i,s)})}),Oe.prototype.reject=function(i){return this.filter(Nc(de(i)))},Oe.prototype.slice=function(i,s){i=be(i);var u=this;return u.__filtered__&&(i>0||s<0)?new Oe(u):(i<0?u=u.takeRight(-i):i&&(u=u.drop(i)),s!==t&&(s=be(s),u=s<0?u.dropRight(-s):u.take(s-i)),u)},Oe.prototype.takeRightWhile=function(i){return this.reverse().takeWhile(i).reverse()},Oe.prototype.toArray=function(){return this.take(St)},Nr(Oe.prototype,function(i,s){var u=/^(?:filter|find|map|reject)|While$/.test(s),f=/^(?:head|last)$/.test(s),_=y[f?"take"+(s=="last"?"Right":""):s],E=f||/^find/.test(s);_&&(y.prototype[s]=function(){var b=this.__wrapped__,S=f?[1]:arguments,P=b instanceof Oe,W=S[0],z=P||Ee(b),j=function(Re){var Pe=_.apply(y,wo([Re],S));return f&&te?Pe[0]:Pe};z&&u&&typeof W=="function"&&W.length!=1&&(P=z=!1);var te=this.__chain__,se=!!this.__actions__.length,he=E&&!te,Ie=P&&!se;if(!E&&z){b=Ie?b:new Oe(this);var fe=i.apply(b,S);return fe.__actions__.push({func:Ic,args:[j],thisArg:t}),new Kn(fe,te)}return he&&Ie?i.apply(this,S):(fe=this.thru(j),he?f?fe.value()[0]:fe.value():fe)})}),Hn(["pop","push","shift","sort","splice","unshift"],function(i){var s=Qs[i],u=/^(?:push|sort|unshift)$/.test(i)?"tap":"thru",f=/^(?:pop|shift)$/.test(i);y.prototype[i]=function(){var _=arguments;if(f&&!this.__chain__){var E=this.value();return s.apply(Ee(E)?E:[],_)}return this[u](function(b){return s.apply(Ee(b)?b:[],_)})}}),Nr(Oe.prototype,function(i,s){var u=y[s];if(u){var f=u.name+"";$e.call(xi,f)||(xi[f]=[]),xi[f].push({name:s,func:u})}}),xi[vc(t,I).name]=[{name:"wrapper",func:t}],Oe.prototype.clone=LI,Oe.prototype.reverse=xI,Oe.prototype.value=UI,y.prototype.at=hk,y.prototype.chain=fk,y.prototype.commit=mk,y.prototype.next=gk,y.prototype.plant=_k,y.prototype.reverse=vk,y.prototype.toJSON=y.prototype.valueOf=y.prototype.value=yk,y.prototype.first=y.prototype.head,$a&&(y.prototype[$a]=pk),y},Mi=mI();Qo?((Qo.exports=Mi)._=Mi,Nu._=Mi):Vt._=Mi}).call(hF)}(cs,cs.exports)),cs.exports}var Oa=fF();const ml=dF(Oa);function Pa(n,e,t=[]){const r=gF(e);if(!r)return n;const o=r.split(" ");return n.filter(a=>mF(a,o,t))}function mF(n,e,t){return t.some(r=>{const o=ml.get(n,r);if(ml.isNil(o))return!1;const a=ml.toString(o).toLowerCase();return e.every(c=>a.includes(c))})}function gF(n){return ml.trim(n).toLowerCase().replace(/\s+/g," ")}const pF={class:"text-faded mt-7"},_F={key:0,class:"d-flex align-baseline mb-1"},vF={class:"me-1"},yF={class:"max-w-_form-metadataJ"},CF={key:0,class:"mb-1"},EF={key:1,class:"mb-1"},wF={class:"mb-1"},ou=l.defineComponent({__name:"FormMetadata",props:{meta:{},id:{}},setup(n){const{t:e}=br();return(t,r)=>(l.openBlock(),l.createElementBlock("div",pF,[l.createVNode(Qe.VRow,{"no-gutters":"",class:"align-end ga-3",align:"center"},{default:l.withCtx(()=>[l.renderSlot(t.$slots,"default"),l.createVNode(Qe.VCol,{cols:"auto",class:"pa-2"},{default:l.withCtx(()=>[t.id?(l.openBlock(),l.createElementBlock("p",_F,[l.createElementVNode("b",vF,l.toDisplayString(t.id.title)+": ",1),l.createElementVNode("span",yF,l.toDisplayString(t.id.key||"-"),1),l.createElementVNode("span",null,[l.createVNode(Bl,{"content-to-copy":t.id.key,size:15},null,8,["content-to-copy"])])])):l.createCommentVNode("",!0),l.createElementVNode("p",null,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.created"))+": ",1),l.createTextVNode(l.toDisplayString(l.unref(ds)(t.meta.created_at))+" - "+l.toDisplayString(t.meta.created_by),1)])]),_:1}),l.createVNode(Qe.VCol,{cols:"auto",class:"d-flex flex-column align-baseline px-2 mt-1"},{default:l.withCtx(()=>[t.meta.updated_at&&t.meta.updated_by?(l.openBlock(),l.createElementBlock("p",CF,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.updated"))+": ",1),l.createTextVNode(l.toDisplayString(l.unref(ds)(t.meta.updated_at))+" - "+l.toDisplayString(t.meta.updated_by),1)])):(l.openBlock(),l.createElementBlock("p",EF,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.modified"))+": ",1),l.createTextVNode(l.toDisplayString(l.unref(ds)(t.meta.modified_at))+" - "+l.toDisplayString(t.meta.modified_by),1)])),l.createElementVNode("p",wF,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.delegated"))+": ",1),l.createTextVNode(l.toDisplayString(t.meta.delegated_at)+" - "+l.toDisplayString(t.meta.delegated_by),1)])]),_:1})]),_:3})]))}}),TF={key:0,class:"mb-2 ms-1"},VE=l.defineComponent({__name:"JSelect",props:l.mergeModels({name:{},label:{},placeholder:{},readonly:{type:Boolean},items:{},itemTitle:{},itemValue:{},density:{},loading:{type:Boolean},clearable:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=l.useModel(n,"modelValue"),t=n,r=l.computed(()=>t.readonly?"solo":"solo-filled"),o=l.computed(()=>{if(Array.isArray(t.items)&&t.items.length>0)if(typeof t.items[0]=="object"&&t.itemValue&&t.itemTitle){const a=t.items.find(c=>c[t.itemValue]===e.value);return a?a[t.itemTitle]:""}else{const a=t.items.indexOf(e.value);return a!==-1?t.items[a]:""}return""});return(a,c)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[a.name?(l.openBlock(),l.createElementBlock("p",TF,l.toDisplayString(a.name),1)):l.createCommentVNode("",!0),a.label?(l.openBlock(),l.createBlock(va.VLabel,{key:1,class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(a.label),1)]),_:1})):l.createCommentVNode("",!0),a.readonly?(l.openBlock(),l.createBlock(mE,{key:3,value:o.value},null,8,["value"])):(l.openBlock(),l.createBlock(l.unref(Vo.VSelect),{key:2,modelValue:e.value,"onUpdate:modelValue":c[0]||(c[0]=d=>e.value=d),variant:r.value,items:a.items,"item-title":a.itemTitle,"item-value":a.itemValue,loading:a.loading,placeholder:a.placeholder,density:a.density,"bg-color":"containerBg",rounded:"false","hide-details":"",class:"j-field",clearable:a.clearable,readonly:a.readonly,disabled:a.readonly},null,8,["modelValue","variant","items","item-title","item-value","loading","placeholder","density","clearable","readonly","disabled"]))],64))}}),bF={key:0,class:"mb-2 ms-1"},HE=l.defineComponent({__name:"JAutocomplete",props:{modelValue:{},name:{},label:{},placeholder:{},readonly:{type:Boolean},items:{},itemTitle:{},itemValue:{},density:{},loading:{type:Boolean},clearable:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=l.computed(()=>t.readonly?"solo":"solo-filled"),a=c=>{r("update:modelValue",c)};return(c,d)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[c.name?(l.openBlock(),l.createElementBlock("p",bF,l.toDisplayString(c.name),1)):l.createCommentVNode("",!0),c.label?(l.openBlock(),l.createBlock(va.VLabel,{key:1,class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(c.label),1)]),_:1})):l.createCommentVNode("",!0),l.createVNode(IO.VAutocomplete,{modelValue:t.modelValue,"onUpdate:modelValue":[d[0]||(d[0]=h=>t.modelValue=h),a],variant:o.value,items:c.items,"item-title":c.itemTitle,"item-value":c.itemValue,loading:c.loading,placeholder:c.placeholder,density:c.density,"bg-color":"containerBg",rounded:"false","hide-details":"",class:"j-field",clearable:c.clearable,readonly:c.readonly,disabled:c.readonly},null,8,["modelValue","variant","items","item-title","item-value","loading","placeholder","density","clearable","readonly","disabled"])],64))}}),IF={key:0,class:"mb-2 ms-1"},SF={key:3,class:"j-textarea px-4 py-3 rounded-sm bg-containerBg"},$E=l.defineComponent({__name:"JTextArea",props:{modelValue:{},name:{},label:{},readonly:{type:Boolean},rows:{},hideDetails:{type:Boolean}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=l.computed(()=>t.readonly?"solo":"solo-filled");return(a,c)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[a.name?(l.openBlock(),l.createElementBlock("p",IF,l.toDisplayString(a.name),1)):l.createCommentVNode("",!0),a.label?(l.openBlock(),l.createBlock(va.VLabel,{key:1,class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(a.label),1)]),_:1})):l.createCommentVNode("",!0),a.readonly?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(SO.VTextarea,{key:2,variant:o.value,"bg-color":"containerBg",rounded:"false",rows:a.rows,hideDetails:a.hideDetails,value:a.modelValue,"onUpdate:modelValue":c[0]||(c[0]=d=>r("update:modelValue",d)),"no-resize":""},null,8,["variant","rows","hideDetails","value"])),a.readonly?(l.openBlock(),l.createElementBlock("div",SF,l.toDisplayString(a.modelValue),1)):l.createCommentVNode("",!0)],64))}}),KE=l.defineComponent({__name:"CancelButton",props:{title:{}},emits:["cancel"],setup(n,{emit:e}){const t=e,{t:r}=br();return(o,a)=>(l.openBlock(),l.createBlock(it.VBtn,{color:"secondary",variant:"outlined",onClick:a[0]||(a[0]=c=>t("cancel")),class:"me-2 j-btn-form"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(o.title?l.unref(r)("actions.cancel"):l.unref(r)("actions.back")),1)]),_:1}))}}),WE=l.defineComponent({__name:"SaveButton",props:{disabled:{type:Boolean}},emits:["onSave"],setup(n,{emit:e}){const t=e,r=l.ref(!1);async function o(){r.value=!0,await t("onSave"),r.value=!1}const{t:a}=br();return(c,d)=>(l.openBlock(),l.createBlock(it.VBtn,{disabled:c.disabled,loading:r.value,color:"secondary",onClick:o,onKeydown:l.withKeys(o,["enter"]),class:"j-btn-form"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(a)("actions.save")),1)]),_:1},8,["disabled","loading"]))}}),AF={class:"mt-4"},zE=l.defineComponent({__name:"JForm",props:{title:{},metadata:{},id:{},cancelReturn:{type:Boolean}},emits:["onSave","onCancel"],setup(n,{emit:e}){const t=e;return(r,o)=>(l.openBlock(),l.createBlock(Kl,{title:r.title,class:"d-flex flex-column ma-0"},{default:l.withCtx(()=>[r.title?(l.openBlock(),l.createBlock(pi.VDivider,{key:0})):l.createCommentVNode("",!0),l.createElementVNode("div",AF,[l.renderSlot(r.$slots,"default")]),l.createVNode(xt.VCardText,{class:"pa-0 mx-0 align-content-end"},{default:l.withCtx(()=>[l.createVNode(Qe.VRow,{justify:"space-between",class:"mt-4"},{default:l.withCtx(()=>[l.createVNode(Qe.VCol,{cols:"auto",class:"text-sm-subtitle-2 text-medium-emphasis"},{default:l.withCtx(()=>[l.createVNode(ou,{id:r.id,meta:r.metadata},null,8,["id","meta"])]),_:1}),l.createVNode(Qe.VSpacer),l.createVNode(Qe.VCol,{cols:"auto",class:"align-content-end"},{default:l.withCtx(()=>[l.createVNode(KE,{"cancel-return":r.cancelReturn,onCancel:o[0]||(o[0]=a=>t("onCancel"))},null,8,["cancel-return"]),l.createVNode(WE,{onOnSave:o[1]||(o[1]=a=>t("onSave"))})]),_:1})]),_:1})]),_:1})]),_:3},8,["title"]))}}),kF={class:"d-flex align-items-center"},NF={key:0,class:"d-flex align-center"},RF={class:"ms-1"},OF={class:"d-flex"},PF={class:"d-flex mb-1 align-center"},MF={class:"min-w-100 relative"},GE=l.defineComponent({__name:"TabFormHeader",props:{id:{},readonly:{type:Boolean,default:!1}},emits:["update:isEdition","save","cancel","delete","disable"],setup(n,{emit:e}){var v;const t=n,r=e,o=l.getCurrentInstance(),a=((v=o==null?void 0:o.vnode.props)==null?void 0:v.onDisable)!==void 0,c=l.ref(t.readonly);function d(){r("cancel"),c.value=!1,r("update:isEdition",c.value)}function h(){c.value=!c.value,r("update:isEdition",c.value)}async function m(){r("delete"),r("disable")}const{t:g}=br();return(p,w)=>(l.openBlock(),l.createElementBlock("div",kF,[p.id?(l.openBlock(),l.createElementBlock("div",NF,[w[0]||(w[0]=l.createElementVNode("b",null,"ID:",-1)),l.createElementVNode("span",RF,l.toDisplayString(p.id),1),l.createVNode(Bl,{"content-to-copy":p.id,size:20},null,8,["content-to-copy"])])):l.createCommentVNode("",!0),l.createVNode(Qe.VSpacer),l.createElementVNode("div",OF,[l.createVNode(it.VBtn,{onClick:m,variant:"text"},{default:l.withCtx(()=>[a?(l.openBlock(),l.createBlock(l.unref(iP),{key:0,size:"11",class:"me-2"})):(l.openBlock(),l.createBlock(pl.VIcon,{key:1,class:"me-2"},{default:l.withCtx(()=>w[1]||(w[1]=[l.createTextVNode("mdi-delete-outline")])),_:1})),l.createTextVNode(" "+l.toDisplayString(a?l.unref(g)("actions.disable"):l.unref(g)("actions.delete")),1)]),_:1}),l.createElementVNode("div",PF,[l.createVNode(pi.VDivider,{class:"mx-2 my-1",vertical:""}),l.createElementVNode("div",MF,[l.withDirectives(l.createVNode(it.VBtn,{onClick:h,variant:"text",color:"secondary","prepend-icon":"mdi-pencil",width:"95"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(g)("actions.edit")),1)]),_:1},512),[[l.vShow,!c.value]]),l.withDirectives(l.createVNode(it.VBtn,{onClick:d,variant:"text",color:"secondary",width:"95"},{default:l.withCtx(()=>[l.createVNode(pl.VIcon,{class:"pt-1 pe-2"},{default:l.withCtx(()=>w[2]||(w[2]=[l.createTextVNode("mdi-close")])),_:1}),l.createTextVNode(" "+l.toDisplayString(l.unref(g)("actions.cancel")),1)]),_:1},512),[[l.vShow,c.value]])])])])]))}}),DF={class:"d-flex flex-column"},LF={class:"height d-flex flex-column"},xF={class:"d-flex justify-between align-end"},UF=l.defineComponent({__name:"FormHeadless",props:{id:{},metadata:{},readonly:{type:Boolean,default:!1}},emits:["save","cancel"],setup(n,{emit:e}){const t=e,r=l.getCurrentInstance(),o=l.computed(()=>{var c;return!!((c=r==null?void 0:r.vnode.props)!=null&&c.onSave)}),a=l.computed(()=>{var c;return!!((c=r==null?void 0:r.vnode.props)!=null&&c.onCancel)});return(c,d)=>(l.openBlock(),l.createBlock(Kl,null,{default:l.withCtx(()=>[l.createElementVNode("div",DF,[l.createElementVNode("div",LF,[l.renderSlot(c.$slots,"default",{},void 0,!0)])]),l.createElementVNode("div",xF,[l.createVNode(Qe.VRow,{"no-gutters":"",justify:"space-between",class:"w-100"},{default:l.withCtx(()=>[l.createVNode(Qe.VCol,{cols:"auto",class:"text-sm-subtitle-2 text-medium-emphasis"},{default:l.withCtx(()=>[l.createVNode(ou,{id:c.id,meta:c.metadata},null,8,["id","meta"])]),_:1}),c.readonly?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(Qe.VCol,{key:0,class:"d-flex align-end",cols:"auto"},{default:l.withCtx(()=>[a.value?(l.openBlock(),l.createBlock(KE,{key:0,title:"Back",onCancel:d[0]||(d[0]=h=>t("cancel"))})):l.createCommentVNode("",!0),o.value?(l.openBlock(),l.createBlock(WE,{key:1,onOnSave:d[1]||(d[1]=h=>t("save"))})):l.createCommentVNode("",!0)]),_:1}))]),_:1})])]),_:3}))}}),qE=Aa(UF,[["__scopeId","data-v-e7e4d99c"]]);/**
|
72
|
+
}`;var Ie=o_(function(){return Fe(E,se+"return "+j).apply(t,b)});if(Ie.source=j,Td(Ie))throw Ie;return Ie}function NR(i){return He(i).toLowerCase()}function RR(i){return He(i).toUpperCase()}function OR(i,s,u){if(i=He(i),i&&(u||s===t))return fg(i);if(!i||!(s=In(s)))return i;var f=cr(i),_=cr(s),E=mg(f,_),b=gg(f,_)+1;return ko(f,E,b).join("")}function PR(i,s,u){if(i=He(i),i&&(u||s===t))return i.slice(0,_g(i)+1);if(!i||!(s=In(s)))return i;var f=cr(i),_=gg(f,cr(s))+1;return ko(f,0,_).join("")}function MR(i,s,u){if(i=He(i),i&&(u||s===t))return i.replace(Tu,"");if(!i||!(s=In(s)))return i;var f=cr(i),_=mg(f,cr(s));return ko(f,_).join("")}function DR(i,s){var u=X,f=ee;if(ut(s)){var _="separator"in s?s.separator:_;u="length"in s?be(s.length):u,f="omission"in s?In(s.omission):f}i=He(i);var E=i.length;if(Oi(i)){var b=cr(i);E=b.length}if(u>=E)return i;var S=u-Pi(f);if(S<1)return f;var P=b?ko(b,0,S).join(""):i.slice(0,S);if(_===t)return P+f;if(b&&(S+=P.length-S),bd(_)){if(i.slice(S).search(_)){var W,z=P;for(_.global||(_=Vu(_.source,He(Lm.exec(_))+"g")),_.lastIndex=0;W=_.exec(z);)var j=W.index;P=P.slice(0,j===t?S:j)}}else if(i.indexOf(In(_),S)!=S){var te=P.lastIndexOf(_);te>-1&&(P=P.slice(0,te))}return P+f}function LR(i){return i=He(i),i&>.test(i)?i.replace(Pm,uI):i}var xR=Fi(function(i,s,u){return i+(u?" ":"")+s.toUpperCase()}),Ad=ip("toUpperCase");function r_(i,s,u){return i=He(i),s=u?t:s,s===t?iI(i)?fI(i):Jb(i):i.match(s)||[]}var o_=Se(function(i,s){try{return Tn(i,t,s)}catch(u){return Td(u)?u:new Ce(u)}}),UR=Xr(function(i,s){return Hn(s,function(u){u=Or(u),Jr(i,u,Ed(i[u],i))}),i});function BR(i){var s=i==null?0:i.length,u=de();return i=s?st(i,function(f){if(typeof f[1]!="function")throw new $n(c);return[u(f[0]),f[1]]}):[],Se(function(f){for(var _=-1;++_<s;){var E=i[_];if(Tn(E[0],this,f))return Tn(E[1],this,f)}})}function FR(i){return uS(Wn(i,v))}function kd(i){return function(){return i}}function VR(i,s){return i==null||i!==i?s:i}var HR=sp(),$R=sp(!0);function gn(i){return i}function Nd(i){return Ug(typeof i=="function"?i:Wn(i,v))}function KR(i){return Fg(Wn(i,v))}function WR(i,s){return Vg(i,Wn(s,v))}var zR=Se(function(i,s){return function(u){return Ya(u,i,s)}}),GR=Se(function(i,s){return function(u){return Ya(i,u,s)}});function Rd(i,s,u){var f=Dt(s),_=fc(s,f);u==null&&!(ut(s)&&(_.length||!f.length))&&(u=s,s=i,i=this,_=fc(s,Dt(s)));var E=!(ut(u)&&"chain"in u)||!!u.chain,b=eo(i);return Hn(_,function(S){var P=s[S];i[S]=P,b&&(i.prototype[S]=function(){var W=this.__chain__;if(E||W){var z=i(this.__wrapped__),j=z.__actions__=hn(this.__actions__);return j.push({func:P,args:arguments,thisArg:i}),z.__chain__=W,z}return P.apply(i,wo([this.value()],arguments))})}),i}function qR(){return Vt._===this&&(Vt._=yI),this}function Od(){}function jR(i){return i=be(i),Se(function(s){return Hg(s,i)})}var YR=cd(st),JR=cd(cg),QR=cd(Mu);function i_(i){return gd(i)?Du(Or(i)):AS(i)}function XR(i){return function(s){return i==null?t:ni(i,s)}}var ZR=lp(),eO=lp(!0);function Pd(){return[]}function Md(){return!1}function tO(){return{}}function nO(){return""}function rO(){return!0}function oO(i,s){if(i=be(i),i<1||i>at)return[];var u=St,f=jt(i,St);s=de(s),i-=St;for(var _=Uu(f,s);++u<i;)s(u);return _}function iO(i){return Ee(i)?st(i,Or):Sn(i)?[i]:hn(Ip(He(i)))}function aO(i){var s=++_I;return He(i)+s}var sO=yc(function(i,s){return i+s},0),cO=ld("ceil"),lO=yc(function(i,s){return i/s},1),uO=ld("floor");function dO(i){return i&&i.length?hc(i,gn,ju):t}function hO(i,s){return i&&i.length?hc(i,de(s,2),ju):t}function fO(i){return dg(i,gn)}function mO(i,s){return dg(i,de(s,2))}function gO(i){return i&&i.length?hc(i,gn,Xu):t}function pO(i,s){return i&&i.length?hc(i,de(s,2),Xu):t}var _O=yc(function(i,s){return i*s},1),vO=ld("round"),yO=yc(function(i,s){return i-s},0);function CO(i){return i&&i.length?xu(i,gn):0}function EO(i,s){return i&&i.length?xu(i,de(s,2)):0}return y.after=Kk,y.ary=xp,y.assign=RN,y.assignIn=Jp,y.assignInWith=Pc,y.assignWith=ON,y.at=PN,y.before=Up,y.bind=Ed,y.bindAll=UR,y.bindKey=Bp,y.castArray=tN,y.chain=Mp,y.chunk=uA,y.compact=dA,y.concat=hA,y.cond=BR,y.conforms=FR,y.constant=kd,y.countBy=Ck,y.create=MN,y.curry=Fp,y.curryRight=Vp,y.debounce=Hp,y.defaults=DN,y.defaultsDeep=LN,y.defer=Wk,y.delay=zk,y.difference=fA,y.differenceBy=mA,y.differenceWith=gA,y.drop=pA,y.dropRight=_A,y.dropRightWhile=vA,y.dropWhile=yA,y.fill=CA,y.filter=wk,y.flatMap=Ik,y.flatMapDeep=Sk,y.flatMapDepth=Ak,y.flatten=Np,y.flattenDeep=EA,y.flattenDepth=wA,y.flip=Gk,y.flow=HR,y.flowRight=$R,y.fromPairs=TA,y.functions=$N,y.functionsIn=KN,y.groupBy=kk,y.initial=IA,y.intersection=SA,y.intersectionBy=AA,y.intersectionWith=kA,y.invert=zN,y.invertBy=GN,y.invokeMap=Rk,y.iteratee=Nd,y.keyBy=Ok,y.keys=Dt,y.keysIn=mn,y.map=Sc,y.mapKeys=jN,y.mapValues=YN,y.matches=KR,y.matchesProperty=WR,y.memoize=kc,y.merge=JN,y.mergeWith=Qp,y.method=zR,y.methodOf=GR,y.mixin=Rd,y.negate=Nc,y.nthArg=jR,y.omit=QN,y.omitBy=XN,y.once=qk,y.orderBy=Pk,y.over=YR,y.overArgs=jk,y.overEvery=JR,y.overSome=QR,y.partial=wd,y.partialRight=$p,y.partition=Mk,y.pick=ZN,y.pickBy=Xp,y.property=i_,y.propertyOf=XR,y.pull=PA,y.pullAll=Op,y.pullAllBy=MA,y.pullAllWith=DA,y.pullAt=LA,y.range=ZR,y.rangeRight=eO,y.rearg=Yk,y.reject=xk,y.remove=xA,y.rest=Jk,y.reverse=yd,y.sampleSize=Bk,y.set=tR,y.setWith=nR,y.shuffle=Fk,y.slice=UA,y.sortBy=$k,y.sortedUniq=WA,y.sortedUniqBy=zA,y.split=IR,y.spread=Qk,y.tail=GA,y.take=qA,y.takeRight=jA,y.takeRightWhile=YA,y.takeWhile=JA,y.tap=dk,y.throttle=Xk,y.thru=Ic,y.toArray=qp,y.toPairs=Zp,y.toPairsIn=e_,y.toPath=iO,y.toPlainObject=Yp,y.transform=rR,y.unary=Zk,y.union=QA,y.unionBy=XA,y.unionWith=ZA,y.uniq=ek,y.uniqBy=tk,y.uniqWith=nk,y.unset=oR,y.unzip=Cd,y.unzipWith=Pp,y.update=iR,y.updateWith=aR,y.values=$i,y.valuesIn=sR,y.without=rk,y.words=r_,y.wrap=eN,y.xor=ok,y.xorBy=ik,y.xorWith=ak,y.zip=sk,y.zipObject=ck,y.zipObjectDeep=lk,y.zipWith=uk,y.entries=Zp,y.entriesIn=e_,y.extend=Jp,y.extendWith=Pc,Rd(y,y),y.add=sO,y.attempt=o_,y.camelCase=dR,y.capitalize=t_,y.ceil=cO,y.clamp=cR,y.clone=nN,y.cloneDeep=oN,y.cloneDeepWith=iN,y.cloneWith=rN,y.conformsTo=aN,y.deburr=n_,y.defaultTo=VR,y.divide=lO,y.endsWith=hR,y.eq=ur,y.escape=fR,y.escapeRegExp=mR,y.every=Ek,y.find=Tk,y.findIndex=Ap,y.findKey=xN,y.findLast=bk,y.findLastIndex=kp,y.findLastKey=UN,y.floor=uO,y.forEach=Dp,y.forEachRight=Lp,y.forIn=BN,y.forInRight=FN,y.forOwn=VN,y.forOwnRight=HN,y.get=Id,y.gt=sN,y.gte=cN,y.has=WN,y.hasIn=Sd,y.head=Rp,y.identity=gn,y.includes=Nk,y.indexOf=bA,y.inRange=lR,y.invoke=qN,y.isArguments=ii,y.isArray=Ee,y.isArrayBuffer=lN,y.isArrayLike=fn,y.isArrayLikeObject=pt,y.isBoolean=uN,y.isBuffer=No,y.isDate=dN,y.isElement=hN,y.isEmpty=fN,y.isEqual=mN,y.isEqualWith=gN,y.isError=Td,y.isFinite=pN,y.isFunction=eo,y.isInteger=Kp,y.isLength=Rc,y.isMap=Wp,y.isMatch=_N,y.isMatchWith=vN,y.isNaN=yN,y.isNative=CN,y.isNil=wN,y.isNull=EN,y.isNumber=zp,y.isObject=ut,y.isObjectLike=ht,y.isPlainObject=ts,y.isRegExp=bd,y.isSafeInteger=TN,y.isSet=Gp,y.isString=Oc,y.isSymbol=Sn,y.isTypedArray=Hi,y.isUndefined=bN,y.isWeakMap=IN,y.isWeakSet=SN,y.join=NA,y.kebabCase=gR,y.last=Gn,y.lastIndexOf=RA,y.lowerCase=pR,y.lowerFirst=_R,y.lt=AN,y.lte=kN,y.max=dO,y.maxBy=hO,y.mean=fO,y.meanBy=mO,y.min=gO,y.minBy=pO,y.stubArray=Pd,y.stubFalse=Md,y.stubObject=tO,y.stubString=nO,y.stubTrue=rO,y.multiply=_O,y.nth=OA,y.noConflict=qR,y.noop=Od,y.now=Ac,y.pad=vR,y.padEnd=yR,y.padStart=CR,y.parseInt=ER,y.random=uR,y.reduce=Dk,y.reduceRight=Lk,y.repeat=wR,y.replace=TR,y.result=eR,y.round=vO,y.runInContext=O,y.sample=Uk,y.size=Vk,y.snakeCase=bR,y.some=Hk,y.sortedIndex=BA,y.sortedIndexBy=FA,y.sortedIndexOf=VA,y.sortedLastIndex=HA,y.sortedLastIndexBy=$A,y.sortedLastIndexOf=KA,y.startCase=SR,y.startsWith=AR,y.subtract=yO,y.sum=CO,y.sumBy=EO,y.template=kR,y.times=oO,y.toFinite=to,y.toInteger=be,y.toLength=jp,y.toLower=NR,y.toNumber=qn,y.toSafeInteger=NN,y.toString=He,y.toUpper=RR,y.trim=OR,y.trimEnd=PR,y.trimStart=MR,y.truncate=DR,y.unescape=LR,y.uniqueId=aO,y.upperCase=xR,y.upperFirst=Ad,y.each=Dp,y.eachRight=Lp,y.first=Rp,Rd(y,function(){var i={};return Nr(y,function(s,u){$e.call(y.prototype,u)||(i[u]=s)}),i}(),{chain:!1}),y.VERSION=r,Hn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(i){y[i].placeholder=y}),Hn(["drop","take"],function(i,s){Oe.prototype[i]=function(u){u=u===t?1:kt(be(u),0);var f=this.__filtered__&&!s?new Oe(this):this.clone();return f.__filtered__?f.__takeCount__=jt(u,f.__takeCount__):f.__views__.push({size:jt(u,St),type:i+(f.__dir__<0?"Right":"")}),f},Oe.prototype[i+"Right"]=function(u){return this.reverse()[i](u).reverse()}}),Hn(["filter","map","takeWhile"],function(i,s){var u=s+1,f=u==Ct||u==qt;Oe.prototype[i]=function(_){var E=this.clone();return E.__iteratees__.push({iteratee:de(_,3),type:u}),E.__filtered__=E.__filtered__||f,E}}),Hn(["head","last"],function(i,s){var u="take"+(s?"Right":"");Oe.prototype[i]=function(){return this[u](1).value()[0]}}),Hn(["initial","tail"],function(i,s){var u="drop"+(s?"":"Right");Oe.prototype[i]=function(){return this.__filtered__?new Oe(this):this[u](1)}}),Oe.prototype.compact=function(){return this.filter(gn)},Oe.prototype.find=function(i){return this.filter(i).head()},Oe.prototype.findLast=function(i){return this.reverse().find(i)},Oe.prototype.invokeMap=Se(function(i,s){return typeof i=="function"?new Oe(this):this.map(function(u){return Ya(u,i,s)})}),Oe.prototype.reject=function(i){return this.filter(Nc(de(i)))},Oe.prototype.slice=function(i,s){i=be(i);var u=this;return u.__filtered__&&(i>0||s<0)?new Oe(u):(i<0?u=u.takeRight(-i):i&&(u=u.drop(i)),s!==t&&(s=be(s),u=s<0?u.dropRight(-s):u.take(s-i)),u)},Oe.prototype.takeRightWhile=function(i){return this.reverse().takeWhile(i).reverse()},Oe.prototype.toArray=function(){return this.take(St)},Nr(Oe.prototype,function(i,s){var u=/^(?:filter|find|map|reject)|While$/.test(s),f=/^(?:head|last)$/.test(s),_=y[f?"take"+(s=="last"?"Right":""):s],E=f||/^find/.test(s);_&&(y.prototype[s]=function(){var b=this.__wrapped__,S=f?[1]:arguments,P=b instanceof Oe,W=S[0],z=P||Ee(b),j=function(Re){var Pe=_.apply(y,wo([Re],S));return f&&te?Pe[0]:Pe};z&&u&&typeof W=="function"&&W.length!=1&&(P=z=!1);var te=this.__chain__,se=!!this.__actions__.length,he=E&&!te,Ie=P&&!se;if(!E&&z){b=Ie?b:new Oe(this);var fe=i.apply(b,S);return fe.__actions__.push({func:Ic,args:[j],thisArg:t}),new Kn(fe,te)}return he&&Ie?i.apply(this,S):(fe=this.thru(j),he?f?fe.value()[0]:fe.value():fe)})}),Hn(["pop","push","shift","sort","splice","unshift"],function(i){var s=Qs[i],u=/^(?:push|sort|unshift)$/.test(i)?"tap":"thru",f=/^(?:pop|shift)$/.test(i);y.prototype[i]=function(){var _=arguments;if(f&&!this.__chain__){var E=this.value();return s.apply(Ee(E)?E:[],_)}return this[u](function(b){return s.apply(Ee(b)?b:[],_)})}}),Nr(Oe.prototype,function(i,s){var u=y[s];if(u){var f=u.name+"";$e.call(xi,f)||(xi[f]=[]),xi[f].push({name:s,func:u})}}),xi[vc(t,I).name]=[{name:"wrapper",func:t}],Oe.prototype.clone=LI,Oe.prototype.reverse=xI,Oe.prototype.value=UI,y.prototype.at=hk,y.prototype.chain=fk,y.prototype.commit=mk,y.prototype.next=gk,y.prototype.plant=_k,y.prototype.reverse=vk,y.prototype.toJSON=y.prototype.valueOf=y.prototype.value=yk,y.prototype.first=y.prototype.head,$a&&(y.prototype[$a]=pk),y},Mi=mI();Qo?((Qo.exports=Mi)._=Mi,Nu._=Mi):Vt._=Mi}).call(hF)}(cs,cs.exports)),cs.exports}var Oa=fF();const ml=dF(Oa);function Pa(n,e,t=[]){const r=gF(e);if(!r)return n;const o=r.split(" ");return n.filter(a=>mF(a,o,t))}function mF(n,e,t){return t.some(r=>{const o=ml.get(n,r);if(ml.isNil(o))return!1;const a=ml.toString(o).toLowerCase();return e.every(c=>a.includes(c))})}function gF(n){return ml.trim(n).toLowerCase().replace(/\s+/g," ")}const pF={class:"text-faded mt-7"},_F={key:0,class:"d-flex align-baseline mb-1"},vF={class:"me-1"},yF={class:"max-w-_form-metadataJ"},CF={key:0,class:"mb-1"},EF={key:1,class:"mb-1"},wF={class:"mb-1"},ou=l.defineComponent({__name:"FormMetadata",props:{meta:{},id:{}},setup(n){const{t:e}=br();return(t,r)=>(l.openBlock(),l.createElementBlock("div",pF,[l.createVNode(Qe.VRow,{"no-gutters":"",class:"align-end ga-3",align:"center"},{default:l.withCtx(()=>[l.renderSlot(t.$slots,"default"),l.createVNode(Qe.VCol,{cols:"auto",class:"pa-2"},{default:l.withCtx(()=>[t.id?(l.openBlock(),l.createElementBlock("p",_F,[l.createElementVNode("b",vF,l.toDisplayString(t.id.title)+": ",1),l.createElementVNode("span",yF,l.toDisplayString(t.id.key||"-"),1),l.createElementVNode("span",null,[l.createVNode(Bl,{"content-to-copy":t.id.key,size:15},null,8,["content-to-copy"])])])):l.createCommentVNode("",!0),l.createElementVNode("p",null,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.created"))+": ",1),l.createTextVNode(l.toDisplayString(l.unref(ds)(t.meta.created_at))+" - "+l.toDisplayString(t.meta.created_by),1)])]),_:1}),l.createVNode(Qe.VCol,{cols:"auto",class:"d-flex flex-column align-baseline px-2 mt-1"},{default:l.withCtx(()=>[t.meta.updated_at&&t.meta.updated_by?(l.openBlock(),l.createElementBlock("p",CF,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.updated"))+": ",1),l.createTextVNode(l.toDisplayString(l.unref(ds)(t.meta.updated_at))+" - "+l.toDisplayString(t.meta.updated_by),1)])):(l.openBlock(),l.createElementBlock("p",EF,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.modified"))+": ",1),l.createTextVNode(l.toDisplayString(l.unref(ds)(t.meta.modified_at))+" - "+l.toDisplayString(t.meta.modified_by),1)])),l.createElementVNode("p",wF,[l.createElementVNode("b",null,l.toDisplayString(l.unref(e)("forms.metadata.delegated"))+": ",1),l.createTextVNode(l.toDisplayString(t.meta.delegated_at)+" - "+l.toDisplayString(t.meta.delegated_by),1)])]),_:1})]),_:3})]))}}),TF={key:0,class:"mb-2 ms-1"},VE=l.defineComponent({__name:"JSelect",props:l.mergeModels({name:{},label:{},placeholder:{},readonly:{type:Boolean},items:{},itemTitle:{},itemValue:{},density:{},loading:{type:Boolean},clearable:{type:Boolean,default:!0},rules:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=l.useModel(n,"modelValue"),t=n,r=l.computed(()=>t.readonly?"solo":"solo-filled"),o=l.computed(()=>{if(Array.isArray(t.items)&&t.items.length>0)if(typeof t.items[0]=="object"&&t.itemValue&&t.itemTitle){const a=t.items.find(c=>c[t.itemValue]===e.value);return a?a[t.itemTitle]:""}else{const a=t.items.indexOf(e.value);return a!==-1?t.items[a]:""}return""});return(a,c)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[a.name?(l.openBlock(),l.createElementBlock("p",TF,l.toDisplayString(a.name),1)):l.createCommentVNode("",!0),a.label?(l.openBlock(),l.createBlock(va.VLabel,{key:1,class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(a.label),1)]),_:1})):l.createCommentVNode("",!0),a.readonly?(l.openBlock(),l.createBlock(mE,{key:3,value:o.value},null,8,["value"])):(l.openBlock(),l.createBlock(l.unref(Vo.VSelect),{key:2,modelValue:e.value,"onUpdate:modelValue":c[0]||(c[0]=d=>e.value=d),variant:r.value,items:a.items,"item-title":a.itemTitle,"item-value":a.itemValue,loading:a.loading,placeholder:a.placeholder,density:a.density,"bg-color":"containerBg",rounded:"false","hide-details":"auto",class:"j-field",clearable:a.clearable,readonly:a.readonly,disabled:a.readonly,rules:a.rules},null,8,["modelValue","variant","items","item-title","item-value","loading","placeholder","density","clearable","readonly","disabled","rules"]))],64))}}),bF={key:0,class:"mb-2 ms-1"},HE=l.defineComponent({__name:"JAutocomplete",props:{modelValue:{},name:{},label:{},placeholder:{},readonly:{type:Boolean},items:{},itemTitle:{},itemValue:{},density:{},loading:{type:Boolean},clearable:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=l.computed(()=>t.readonly?"solo":"solo-filled"),a=c=>{r("update:modelValue",c)};return(c,d)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[c.name?(l.openBlock(),l.createElementBlock("p",bF,l.toDisplayString(c.name),1)):l.createCommentVNode("",!0),c.label?(l.openBlock(),l.createBlock(va.VLabel,{key:1,class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(c.label),1)]),_:1})):l.createCommentVNode("",!0),l.createVNode(IO.VAutocomplete,{modelValue:t.modelValue,"onUpdate:modelValue":[d[0]||(d[0]=h=>t.modelValue=h),a],variant:o.value,items:c.items,"item-title":c.itemTitle,"item-value":c.itemValue,loading:c.loading,placeholder:c.placeholder,density:c.density,"bg-color":"containerBg",rounded:"false","hide-details":"",class:"j-field",clearable:c.clearable,readonly:c.readonly,disabled:c.readonly},null,8,["modelValue","variant","items","item-title","item-value","loading","placeholder","density","clearable","readonly","disabled"])],64))}}),IF={key:0,class:"mb-2 ms-1"},SF={key:3,class:"j-textarea px-4 py-3 rounded-sm bg-containerBg"},$E=l.defineComponent({__name:"JTextArea",props:{modelValue:{},name:{},label:{},readonly:{type:Boolean},rows:{},hideDetails:{type:Boolean}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=l.computed(()=>t.readonly?"solo":"solo-filled");return(a,c)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[a.name?(l.openBlock(),l.createElementBlock("p",IF,l.toDisplayString(a.name),1)):l.createCommentVNode("",!0),a.label?(l.openBlock(),l.createBlock(va.VLabel,{key:1,class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(a.label),1)]),_:1})):l.createCommentVNode("",!0),a.readonly?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(SO.VTextarea,{key:2,variant:o.value,"bg-color":"containerBg",rounded:"false",rows:a.rows,hideDetails:a.hideDetails,value:a.modelValue,"onUpdate:modelValue":c[0]||(c[0]=d=>r("update:modelValue",d)),"no-resize":""},null,8,["variant","rows","hideDetails","value"])),a.readonly?(l.openBlock(),l.createElementBlock("div",SF,l.toDisplayString(a.modelValue),1)):l.createCommentVNode("",!0)],64))}}),KE=l.defineComponent({__name:"CancelButton",props:{title:{}},emits:["cancel"],setup(n,{emit:e}){const t=e,{t:r}=br();return(o,a)=>(l.openBlock(),l.createBlock(it.VBtn,{color:"secondary",variant:"outlined",onClick:a[0]||(a[0]=c=>t("cancel")),class:"me-2 j-btn-form"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(o.title?l.unref(r)("actions.cancel"):l.unref(r)("actions.back")),1)]),_:1}))}}),WE=l.defineComponent({__name:"SaveButton",props:{disabled:{type:Boolean}},emits:["onSave"],setup(n,{emit:e}){const t=e,r=l.ref(!1);async function o(){r.value=!0,await t("onSave"),r.value=!1}const{t:a}=br();return(c,d)=>(l.openBlock(),l.createBlock(it.VBtn,{disabled:c.disabled,loading:r.value,color:"secondary",onClick:o,onKeydown:l.withKeys(o,["enter"]),class:"j-btn-form"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(a)("actions.save")),1)]),_:1},8,["disabled","loading"]))}}),AF={class:"mt-4"},zE=l.defineComponent({__name:"JForm",props:{title:{},metadata:{},id:{},cancelReturn:{type:Boolean}},emits:["onSave","onCancel"],setup(n,{emit:e}){const t=e;return(r,o)=>(l.openBlock(),l.createBlock(Kl,{title:r.title,class:"d-flex flex-column ma-0"},{default:l.withCtx(()=>[r.title?(l.openBlock(),l.createBlock(pi.VDivider,{key:0})):l.createCommentVNode("",!0),l.createElementVNode("div",AF,[l.renderSlot(r.$slots,"default")]),l.createVNode(xt.VCardText,{class:"pa-0 mx-0 align-content-end"},{default:l.withCtx(()=>[l.createVNode(Qe.VRow,{justify:"space-between",class:"mt-4"},{default:l.withCtx(()=>[l.createVNode(Qe.VCol,{cols:"auto",class:"text-sm-subtitle-2 text-medium-emphasis"},{default:l.withCtx(()=>[l.createVNode(ou,{id:r.id,meta:r.metadata},null,8,["id","meta"])]),_:1}),l.createVNode(Qe.VSpacer),l.createVNode(Qe.VCol,{cols:"auto",class:"align-content-end"},{default:l.withCtx(()=>[l.createVNode(KE,{"cancel-return":r.cancelReturn,onCancel:o[0]||(o[0]=a=>t("onCancel"))},null,8,["cancel-return"]),l.createVNode(WE,{onOnSave:o[1]||(o[1]=a=>t("onSave"))})]),_:1})]),_:1})]),_:1})]),_:3},8,["title"]))}}),kF={class:"d-flex align-items-center"},NF={key:0,class:"d-flex align-center"},RF={class:"ms-1"},OF={class:"d-flex"},PF={class:"d-flex mb-1 align-center"},MF={class:"min-w-100 relative"},GE=l.defineComponent({__name:"TabFormHeader",props:{id:{},readonly:{type:Boolean,default:!1}},emits:["update:isEdition","save","cancel","delete","disable"],setup(n,{emit:e}){var v;const t=n,r=e,o=l.getCurrentInstance(),a=((v=o==null?void 0:o.vnode.props)==null?void 0:v.onDisable)!==void 0,c=l.ref(t.readonly);function d(){r("cancel"),c.value=!1,r("update:isEdition",c.value)}function h(){c.value=!c.value,r("update:isEdition",c.value)}async function m(){r("delete"),r("disable")}const{t:g}=br();return(p,w)=>(l.openBlock(),l.createElementBlock("div",kF,[p.id?(l.openBlock(),l.createElementBlock("div",NF,[w[0]||(w[0]=l.createElementVNode("b",null,"ID:",-1)),l.createElementVNode("span",RF,l.toDisplayString(p.id),1),l.createVNode(Bl,{"content-to-copy":p.id,size:20},null,8,["content-to-copy"])])):l.createCommentVNode("",!0),l.createVNode(Qe.VSpacer),l.createElementVNode("div",OF,[l.createVNode(it.VBtn,{onClick:m,variant:"text"},{default:l.withCtx(()=>[a?(l.openBlock(),l.createBlock(l.unref(iP),{key:0,size:"11",class:"me-2"})):(l.openBlock(),l.createBlock(pl.VIcon,{key:1,class:"me-2"},{default:l.withCtx(()=>w[1]||(w[1]=[l.createTextVNode("mdi-delete-outline")])),_:1})),l.createTextVNode(" "+l.toDisplayString(a?l.unref(g)("actions.disable"):l.unref(g)("actions.delete")),1)]),_:1}),l.createElementVNode("div",PF,[l.createVNode(pi.VDivider,{class:"mx-2 my-1",vertical:""}),l.createElementVNode("div",MF,[l.withDirectives(l.createVNode(it.VBtn,{onClick:h,variant:"text",color:"secondary","prepend-icon":"mdi-pencil",width:"95"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(g)("actions.edit")),1)]),_:1},512),[[l.vShow,!c.value]]),l.withDirectives(l.createVNode(it.VBtn,{onClick:d,variant:"text",color:"secondary",width:"95"},{default:l.withCtx(()=>[l.createVNode(pl.VIcon,{class:"pt-1 pe-2"},{default:l.withCtx(()=>w[2]||(w[2]=[l.createTextVNode("mdi-close")])),_:1}),l.createTextVNode(" "+l.toDisplayString(l.unref(g)("actions.cancel")),1)]),_:1},512),[[l.vShow,c.value]])])])])]))}}),DF={class:"d-flex flex-column"},LF={class:"height d-flex flex-column"},xF={class:"d-flex justify-between align-end"},UF=l.defineComponent({__name:"FormHeadless",props:{id:{},metadata:{},readonly:{type:Boolean,default:!1}},emits:["save","cancel"],setup(n,{emit:e}){const t=e,r=l.getCurrentInstance(),o=l.computed(()=>{var c;return!!((c=r==null?void 0:r.vnode.props)!=null&&c.onSave)}),a=l.computed(()=>{var c;return!!((c=r==null?void 0:r.vnode.props)!=null&&c.onCancel)});return(c,d)=>(l.openBlock(),l.createBlock(Kl,null,{default:l.withCtx(()=>[l.createElementVNode("div",DF,[l.createElementVNode("div",LF,[l.renderSlot(c.$slots,"default",{},void 0,!0)])]),l.createElementVNode("div",xF,[l.createVNode(Qe.VRow,{"no-gutters":"",justify:"space-between",class:"w-100"},{default:l.withCtx(()=>[l.createVNode(Qe.VCol,{cols:"auto",class:"text-sm-subtitle-2 text-medium-emphasis"},{default:l.withCtx(()=>[l.createVNode(ou,{id:c.id,meta:c.metadata},null,8,["id","meta"])]),_:1}),c.readonly?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(Qe.VCol,{key:0,class:"d-flex align-end",cols:"auto"},{default:l.withCtx(()=>[a.value?(l.openBlock(),l.createBlock(KE,{key:0,title:"Back",onCancel:d[0]||(d[0]=h=>t("cancel"))})):l.createCommentVNode("",!0),o.value?(l.openBlock(),l.createBlock(WE,{key:1,onOnSave:d[1]||(d[1]=h=>t("save"))})):l.createCommentVNode("",!0)]),_:1}))]),_:1})])]),_:3}))}}),qE=Aa(UF,[["__scopeId","data-v-e7e4d99c"]]);/**
|
73
73
|
* @license @tabler/icons-vue v3.22.0 - MIT
|
74
74
|
*
|
75
75
|
* This source code is licensed under the MIT license.
|
@@ -110,4 +110,4 @@ Error Description: ${a.errorMessage}`);else{const c=a;this.logger.error(`A non-M
|
|
110
110
|
Error: ${c.name}
|
111
111
|
Error Description: ${c.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=Xt.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),r}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(t=>t&&De.getDomainFromUrl(t).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,t){let r;if(t&&t.azureCloudInstance!==Xf.None){const o=t.tenant?t.tenant:F.DEFAULT_COMMON_TENANT;r=`${t.azureCloudInstance}/${o}/`}return r||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return F.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw Y(ao)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return Mw.has(e)}static isPublicCloudAuthority(e){return F.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,t,r){const o=new De(e);o.validateAsUri();const a=o.getUrlComponents();let c=`${t}.${a.HostNameAndPort}`;this.isPublicCloudAuthority(a.HostNameAndPort)&&(c=`${t}.${F.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const d=De.constructAuthorityUriFromObject({...o.getUrlComponents(),HostNameAndPort:c}).urlString;return r?`${d}?${r}`:d}static replaceWithRegionalInformation(e,t){const r={...e};return r.authorization_endpoint=Xt.buildRegionalAuthorityString(r.authorization_endpoint,t),r.token_endpoint=Xt.buildRegionalAuthorityString(r.token_endpoint,t),r.end_session_endpoint&&(r.end_session_endpoint=Xt.buildRegionalAuthorityString(r.end_session_endpoint,t)),r}static transformCIAMAuthority(e){let t=e;const o=new De(e).getUrlComponents();if(o.PathSegments.length===0&&o.HostNameAndPort.endsWith(F.CIAM_AUTH_URL)){const a=o.HostNameAndPort.split(".")[0];t=`${t}${a}${F.AAD_TENANT_DOMAIN_SUFFIX}`}return t}}Xt.reservedTenantDomains=new Set(["{tenant}","{tenantid}",Ho.COMMON,Ho.CONSUMERS,Ho.ORGANIZATIONS]);function E2(n){var o;const r=(o=new De(n).getUrlComponents().PathSegments.slice(-1)[0])==null?void 0:o.toLowerCase();switch(r){case Ho.COMMON:case Ho.ORGANIZATIONS:case Ho.CONSUMERS:return;default:return r}}function Uw(n){return n.endsWith(F.FORWARD_SLASH)?n:`${n}${F.FORWARD_SLASH}`}function w2(n){const e=n.cloudDiscoveryMetadata;let t;if(e)try{t=JSON.parse(e)}catch{throw Xe(nm)}return{canonicalAuthority:n.authority?Uw(n.authority):void 0,knownAuthorities:n.knownAuthorities,cloudDiscoveryMetadata:t}}/*! @azure/msal-common v14.16.0 2024-11-05 */async function Bw(n,e,t,r,o,a,c){c==null||c.addQueueMeasurement(x.AuthorityFactoryCreateDiscoveredInstance,a);const d=Xt.transformCIAMAuthority(Uw(n)),h=new Xt(d,e,t,r,o,a,c);try{return await Q(h.resolveEndpointsAsync.bind(h),x.AuthorityResolveEndpointsAsync,o,c,a)(),h}catch{throw Y(ao)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Wo extends lt{constructor(e,t,r,o,a){super(e,t,r),this.name="ServerError",this.errorNo=o,this.status=a,Object.setPrototypeOf(this,Wo.prototype)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Ur{static generateThrottlingStorageKey(e){return`${vs.THROTTLING_PREFIX}.${JSON.stringify(e)}`}static preProcess(e,t){var a;const r=Ur.generateThrottlingStorageKey(t),o=e.getThrottlingCache(r);if(o){if(o.throttleTime<Date.now()){e.removeItem(r);return}throw new Wo(((a=o.errorCodes)==null?void 0:a.join(" "))||F.EMPTY_STRING,o.errorMessage,o.subError)}}static postProcess(e,t,r){if(Ur.checkResponseStatus(r)||Ur.checkResponseForRetryAfter(r)){const o={throttleTime:Ur.calculateThrottleTime(parseInt(r.headers[dn.RETRY_AFTER])),error:r.body.error,errorCodes:r.body.error_codes,errorMessage:r.body.error_description,subError:r.body.suberror};e.setThrottlingCache(Ur.generateThrottlingStorageKey(t),o)}}static checkResponseStatus(e){return e.status===429||e.status>=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(dn.RETRY_AFTER)&&(e.status<200||e.status>=300):!1}static calculateThrottleTime(e){const t=e<=0?0:e,r=Date.now()/1e3;return Math.floor(Math.min(r+(t||vs.DEFAULT_THROTTLE_TIME_SECONDS),r+vs.DEFAULT_MAX_THROTTLE_TIME_SECONDS)*1e3)}static removeThrottle(e,t,r,o){const a={clientId:t,authority:r.authority,scopes:r.scopes,homeAccountIdentifier:o,claims:r.claims,authenticationScheme:r.authenticationScheme,resourceRequestMethod:r.resourceRequestMethod,resourceRequestUri:r.resourceRequestUri,shrClaims:r.shrClaims,sshKid:r.sshKid},c=this.generateThrottlingStorageKey(a);e.removeItem(c)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class uu extends lt{constructor(e,t,r){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,uu.prototype),this.name="NetworkError",this.error=e,this.httpStatus=t,this.responseHeaders=r}}function Zv(n,e,t){return new uu(n,e,t)}/*! @azure/msal-common v14.16.0 2024-11-05 */class lm{constructor(e,t){this.config=PV(e),this.logger=new Ko(this.config.loggerOptions,fw,Qf),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=t}createTokenRequestHeaders(e){const t={};if(t[dn.CONTENT_TYPE]=F.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case Bn.HOME_ACCOUNT_ID:try{const r=fa(e.credential);t[dn.CCS_HEADER]=`Oid:${r.uid}@${r.utid}`}catch(r){this.logger.verbose("Could not parse home account ID for CCS Header: "+r)}break;case Bn.UPN:t[dn.CCS_HEADER]=`UPN: ${e.credential}`;break}return t}async executePostToTokenEndpoint(e,t,r,o,a,c){var h;c&&((h=this.performanceClient)==null||h.addQueueMeasurement(c,a));const d=await this.sendPostRequest(o,e,{body:t,headers:r},a);return this.config.serverTelemetryManager&&d.status<500&&d.status!==429&&this.config.serverTelemetryManager.clearTelemetryCache(),d}async sendPostRequest(e,t,r,o){var c,d,h;Ur.preProcess(this.cacheManager,e);let a;try{a=await Q(this.networkClient.sendPostRequestAsync.bind(this.networkClient),x.NetworkClientSendPostRequestAsync,this.logger,this.performanceClient,o)(t,r);const m=a.headers||{};(d=this.performanceClient)==null||d.addFields({refreshTokenSize:((c=a.body.refresh_token)==null?void 0:c.length)||0,httpVerToken:m[dn.X_MS_HTTP_VERSION]||"",requestId:m[dn.X_MS_REQUEST_ID]||""},o)}catch(m){if(m instanceof uu){const g=m.responseHeaders;throw g&&((h=this.performanceClient)==null||h.addFields({httpVerToken:g[dn.X_MS_HTTP_VERSION]||"",requestId:g[dn.X_MS_REQUEST_ID]||"",contentTypeHeader:g[dn.CONTENT_TYPE]||void 0,contentLengthHeader:g[dn.CONTENT_LENGTH]||void 0,httpStatus:m.httpStatus},o)),m.error}throw m instanceof lt?m:Y(XE)}return Ur.postProcess(this.cacheManager,e,a),a}async updateAuthority(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.UpdateTokenEndpointAuthority,t);const r=`https://${e}/${this.authority.tenant}/`,o=await Bw(r,this.networkClient,this.cacheManager,this.authority.options,this.logger,t,this.performanceClient);this.authority=o}createTokenQueryParameters(e){const t=new ys(e.correlationId,this.performanceClient);return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenQueryParameters&&t.addExtraQueryParameters(e.tokenQueryParameters),t.addCorrelationId(e.correlationId),t.createQueryString()}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Dl="no_tokens_found",Fw="native_account_unavailable",um="refresh_token_expired",T2="interaction_required",b2="consent_required",I2="login_required",du="bad_token";/*! @azure/msal-common v14.16.0 2024-11-05 */const ey=[T2,b2,I2,du],S2=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],A2={[Dl]:"No refresh token found in the cache. Please sign-in.",[Fw]:"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.",[um]:"Refresh token has expired.",[du]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve."};class Er extends lt{constructor(e,t,r,o,a,c,d,h){super(e,t,r),Object.setPrototypeOf(this,Er.prototype),this.timestamp=o||F.EMPTY_STRING,this.traceId=a||F.EMPTY_STRING,this.correlationId=c||F.EMPTY_STRING,this.claims=d||F.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=h}}function ty(n,e,t){const r=!!n&&ey.indexOf(n)>-1,o=!!t&&S2.indexOf(t)>-1,a=!!e&&ey.some(c=>e.indexOf(c)>-1);return r||a||o}function tf(n){return new Er(n,A2[n])}/*! @azure/msal-common v14.16.0 2024-11-05 */class yr{static setRequestState(e,t,r){const o=yr.generateLibraryState(e,r);return t?`${o}${F.RESOURCE_DELIM}${t}`:o}static generateLibraryState(e,t){if(!e)throw Y(Jh);const r={id:e.createNewGuid()};t&&(r.meta=t);const o=JSON.stringify(r);return e.base64Encode(o)}static parseRequestState(e,t){if(!e)throw Y(Jh);if(!t)throw Y(Ta);try{const r=t.split(F.RESOURCE_DELIM),o=r[0],a=r.length>1?r.slice(1).join(F.RESOURCE_DELIM):F.EMPTY_STRING,c=e.base64Decode(o),d=JSON.parse(c);return{userRequestState:a||F.EMPTY_STRING,libraryState:d}}catch{throw Y(Ta)}}}/*! @azure/msal-common v14.16.0 2024-11-05 */const k2={SW:"sw",UHW:"uhw"};class Ia{constructor(e,t){this.cryptoUtils=e,this.performanceClient=t}async generateCnf(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.PopTokenGenerateCnf,e.correlationId);const r=await Q(this.generateKid.bind(this),x.PopTokenGenerateCnf,t,this.performanceClient,e.correlationId)(e),o=this.cryptoUtils.base64UrlEncode(JSON.stringify(r));return{kid:r.kid,reqCnfString:o}}async generateKid(e){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(x.PopTokenGenerateKid,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:k2.SW}}async signPopToken(e,t,r){return this.signPayload(e,t,r)}async signPayload(e,t,r,o){const{resourceRequestMethod:a,resourceRequestUri:c,shrClaims:d,shrNonce:h,shrOptions:m}=r,g=c?new De(c):void 0,v=g==null?void 0:g.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:zr(),m:a==null?void 0:a.toUpperCase(),u:v==null?void 0:v.HostNameAndPort,nonce:h||this.cryptoUtils.createNewGuid(),p:v==null?void 0:v.AbsolutePath,q:v!=null&&v.QueryString?[[],v.QueryString]:void 0,client_claims:d||void 0,...o},t,m,r.correlationId)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class N2{constructor(e,t){this.cache=e,this.hasChanged=t}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}/*! @azure/msal-common v14.16.0 2024-11-05 */function R2(n){var r,o;const e="code=",t=(r=n.error_uri)==null?void 0:r.lastIndexOf(e);return t&&t>=0?(o=n.error_uri)==null?void 0:o.substring(t+e.length):void 0}class Ti{constructor(e,t,r,o,a,c,d){this.clientId=e,this.cacheStorage=t,this.cryptoObj=r,this.logger=o,this.serializableCache=a,this.persistencePlugin=c,this.performanceClient=d}validateServerAuthorizationCodeResponse(e,t){if(!e.state||!t)throw e.state?Y(kl,"Cached State"):Y(kl,"Server State");let r,o;try{r=decodeURIComponent(e.state)}catch{throw Y(Ta,e.state)}try{o=decodeURIComponent(t)}catch{throw Y(Ta,e.state)}if(r!==o)throw Y(tw);if(e.error||e.error_description||e.suberror){const a=R2(e);throw ty(e.error,e.error_description,e.suberror)?new Er(e.error||"",e.error_description,e.suberror,e.timestamp||"",e.trace_id||"",e.correlation_id||"",e.claims||"",a):new Wo(e.error||"",e.error_description,e.suberror,a)}}validateTokenResponse(e,t){var r;if(e.error||e.error_description||e.suberror){const o=`Error(s): ${e.error_codes||F.NOT_AVAILABLE} - Timestamp: ${e.timestamp||F.NOT_AVAILABLE} - Description: ${e.error_description||F.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||F.NOT_AVAILABLE} - Trace ID: ${e.trace_id||F.NOT_AVAILABLE}`,a=(r=e.error_codes)!=null&&r.length?e.error_codes[0]:void 0,c=new Wo(e.error,o,e.suberror,a,e.status);if(t&&e.status&&e.status>=$c.SERVER_ERROR_RANGE_START&&e.status<=$c.SERVER_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed.
|
112
112
|
${c}`);return}else if(t&&e.status&&e.status>=$c.CLIENT_ERROR_RANGE_START&&e.status<=$c.CLIENT_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently available but is unable to refresh the access token.
|
113
|
-
${c}`);return}throw ty(e.error,e.error_description,e.suberror)?new Er(e.error,e.error_description,e.suberror,e.timestamp||F.EMPTY_STRING,e.trace_id||F.EMPTY_STRING,e.correlation_id||F.EMPTY_STRING,e.claims||F.EMPTY_STRING,a):c}}async handleServerTokenResponse(e,t,r,o,a,c,d,h,m){var C;(C=this.performanceClient)==null||C.addQueueMeasurement(x.HandleServerTokenResponse,e.correlation_id);let g;if(e.id_token){if(g=Si(e.id_token||F.EMPTY_STRING,this.cryptoObj.base64Decode),a&&a.nonce&&g.nonce!==a.nonce)throw Y(nw);if(o.maxAge||o.maxAge===0){const T=g.auth_time;if(!T)throw Y(qf);mw(T,o.maxAge)}}this.homeAccountIdentifier=Pt.generateHomeAccountId(e.client_info||F.EMPTY_STRING,t.authorityType,this.logger,this.cryptoObj,g);let v;a&&a.state&&(v=yr.parseRequestState(this.cryptoObj,a.state)),e.key_id=e.key_id||o.sshKid||void 0;const p=this.generateCacheRecord(e,t,r,o,g,c,a);let w;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),w=new N2(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(w)),d&&!h&&p.account){const T=p.account.generateAccountKey();if(!this.cacheStorage.getAccount(T,this.logger))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await Ti.generateAuthenticationResult(this.cryptoObj,t,p,!1,o,g,v,void 0,m)}await this.cacheStorage.saveCacheRecord(p,o.storeInCache,o.correlationId)}finally{this.persistencePlugin&&this.serializableCache&&w&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(w))}return Ti.generateAuthenticationResult(this.cryptoObj,t,p,!1,o,g,v,e,m)}generateCacheRecord(e,t,r,o,a,c,d){const h=t.getPreferredCache();if(!h)throw Y(Yf);const m=Rw(a);let g,v;e.id_token&&a&&(g=au(this.homeAccountIdentifier,h,e.id_token,this.clientId,m||""),v=dm(this.cacheStorage,t,this.homeAccountIdentifier,this.cryptoObj.base64Decode,a,e.client_info,h,m,d,void 0,this.logger));let p=null;if(e.access_token){const T=e.scope?vt.fromString(e.scope):new vt(o.scopes||[]),k=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,I=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,N=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,D=r+k,L=D+I,K=N&&N>0?r+N:void 0;p=su(this.homeAccountIdentifier,h,e.access_token,this.clientId,m||t.tenant||"",T.printScopes(),D,L,this.cryptoObj.base64Decode,K,e.token_type,c,e.key_id,o.claims,o.requestedClaimsHash)}let w=null;if(e.refresh_token){let T;if(e.refresh_token_expires_in){const k=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;T=r+k}w=gw(this.homeAccountIdentifier,h,e.refresh_token,this.clientId,e.foci,c,T)}let C=null;return e.foci&&(C={clientId:this.clientId,environment:h,familyId:e.foci}),{account:v,idToken:g,accessToken:p,refreshToken:w,appMetadata:C}}static async generateAuthenticationResult(e,t,r,o,a,c,d,h,m){var D,L,K,q,M;let g=F.EMPTY_STRING,v=[],p=null,w,C,T=F.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===Ge.POP&&!a.popKid){const ce=new Ia(e),{secret:ae,keyId:X}=r.accessToken;if(!X)throw Y(Jf);g=await ce.signPopToken(ae,X,a)}else g=r.accessToken.secret;v=vt.fromString(r.accessToken.target).asArray(),p=new Date(Number(r.accessToken.expiresOn)*1e3),w=new Date(Number(r.accessToken.extendedExpiresOn)*1e3),r.accessToken.refreshOn&&(C=new Date(Number(r.accessToken.refreshOn)*1e3))}r.appMetadata&&(T=r.appMetadata.familyId===_s?_s:"");const k=(c==null?void 0:c.oid)||(c==null?void 0:c.sub)||"",I=(c==null?void 0:c.tid)||"";h!=null&&h.spa_accountid&&r.account&&(r.account.nativeAccountId=h==null?void 0:h.spa_accountid);const N=r.account?im(r.account.getAccountInfo(),void 0,c,(D=r.idToken)==null?void 0:D.secret):null;return{authority:t.canonicalAuthority,uniqueId:k,tenantId:I,scopes:v,account:N,idToken:((L=r==null?void 0:r.idToken)==null?void 0:L.secret)||"",idTokenClaims:c||{},accessToken:g,fromCache:o,expiresOn:p,extExpiresOn:w,refreshOn:C,correlationId:a.correlationId,requestId:m||F.EMPTY_STRING,familyId:T,tokenType:((K=r.accessToken)==null?void 0:K.tokenType)||F.EMPTY_STRING,state:d?d.userRequestState:F.EMPTY_STRING,cloudGraphHostName:((q=r.account)==null?void 0:q.cloudGraphHostName)||F.EMPTY_STRING,msGraphHost:((M=r.account)==null?void 0:M.msGraphHost)||F.EMPTY_STRING,code:h==null?void 0:h.spa_code,fromNativeBroker:!1}}}function dm(n,e,t,r,o,a,c,d,h,m,g){g==null||g.verbose("setCachedAccount called");const p=n.getAccountKeys().find(I=>I.startsWith(t));let w=null;p&&(w=n.getAccount(p,g));const C=w||Pt.createAccount({homeAccountId:t,idTokenClaims:o,clientInfo:a,environment:c,cloudGraphHostName:h==null?void 0:h.cloud_graph_host_name,msGraphHost:h==null?void 0:h.msgraph_host,nativeAccountId:m},e,r),T=C.tenantProfiles||[],k=d||C.realm;if(k&&!T.find(I=>I.tenantId===k)){const I=om(t,C.localAccountId,k,o);T.push(I)}return C.tenantProfiles=T,C}/*! @azure/msal-common v14.16.0 2024-11-05 */async function Vw(n,e,t){return typeof n=="string"?n:n({clientId:e,tokenEndpoint:t})}/*! @azure/msal-common v14.16.0 2024-11-05 */class Hw extends lm{constructor(e,t){var r;super(e,t),this.includeRedirectUri=!0,this.oidcDefaultScopes=(r=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:r.defaultScopes}async getAuthCodeUrl(e){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(x.GetAuthCodeUrl,e.correlationId);const t=await Q(this.createAuthCodeUrlQueryString.bind(this),x.AuthClientCreateQueryString,this.logger,this.performanceClient,e.correlationId)(e);return De.appendQueryString(this.authority.authorizationEndpoint,t)}async acquireToken(e,t){var d,h;if((d=this.performanceClient)==null||d.addQueueMeasurement(x.AuthClientAcquireToken,e.correlationId),!e.code)throw Y(iw);const r=zr(),o=await Q(this.executeTokenRequest.bind(this),x.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),a=(h=o.headers)==null?void 0:h[dn.X_MS_REQUEST_ID],c=new Ti(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return c.validateTokenResponse(o.body),Q(c.handleServerTokenResponse.bind(c),x.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(o.body,this.authority,r,e,t,void 0,void 0,void 0,a)}handleFragmentResponse(e,t){if(new Ti(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null).validateServerAuthorizationCodeResponse(e,t),!e.code)throw Y(uw);return e}getLogoutUri(e){if(!e)throw Xe(ww);const t=this.createLogoutUrlQueryString(e);return De.appendQueryString(this.authority.endSessionEndpoint,t)}async executeTokenRequest(e,t){var m,g;(m=this.performanceClient)==null||m.addQueueMeasurement(x.AuthClientExecuteTokenRequest,t.correlationId);const r=this.createTokenQueryParameters(t),o=De.appendQueryString(e.tokenEndpoint,r),a=await Q(this.createTokenRequestBody.bind(this),x.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,t.correlationId)(t);let c;if(t.clientInfo)try{const v=Rl(t.clientInfo,this.cryptoUtils.base64Decode);c={credential:`${v.uid}${tn.CLIENT_INFO_SEPARATOR}${v.utid}`,type:Bn.HOME_ACCOUNT_ID}}catch(v){this.logger.verbose("Could not parse client info for CCS Header: "+v)}const d=this.createTokenRequestHeaders(c||t.ccsCredential),h={clientId:((g=t.tokenBodyParameters)==null?void 0:g.clientId)||this.config.authOptions.clientId,authority:e.canonicalAuthority,scopes:t.scopes,claims:t.claims,authenticationScheme:t.authenticationScheme,resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,sshKid:t.sshKid};return Q(this.executePostToTokenEndpoint.bind(this),x.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,t.correlationId)(o,a,d,h,t.correlationId,x.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var o,a;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthClientCreateTokenRequestBody,e.correlationId);const t=new ys(e.correlationId,this.performanceClient);if(t.addClientId(e.embeddedClientId||((a=e.tokenBodyParameters)==null?void 0:a[wi])||this.config.authOptions.clientId),this.includeRedirectUri?t.addRedirectUri(e.redirectUri):ia.validateRedirectUri(e.redirectUri),t.addScopes(e.scopes,!0,this.oidcDefaultScopes),t.addAuthorizationCode(e.code),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addThrottling(),this.serverTelemetryManager&&!Zh(this.config)&&t.addServerTelemetry(this.serverTelemetryManager),e.codeVerifier&&t.addCodeVerifier(e.codeVerifier),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const c=this.config.clientCredentials.clientAssertion;t.addClientAssertion(await Vw(c.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),t.addClientAssertionType(c.assertionType)}if(t.addGrantType(jE.AUTHORIZATION_CODE_GRANT),t.addClientInfo(),e.authenticationScheme===Ge.POP){const c=new Ia(this.cryptoUtils,this.performanceClient);let d;e.popKid?d=this.cryptoUtils.encodeKid(e.popKid):d=(await Q(c.generateCnf.bind(c),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,t.addPopToken(d)}else if(e.authenticationScheme===Ge.SSH)if(e.sshJwk)t.addSshJwk(e.sshJwk);else throw Xe(cu);(!vr.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const c=Rl(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${c.uid}${tn.CLIENT_INFO_SEPARATOR}${c.utid}`,type:Bn.HOME_ACCOUNT_ID}}catch(c){this.logger.verbose("Could not parse client info for CCS Header: "+c)}else r=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&r)switch(r.type){case Bn.HOME_ACCOUNT_ID:try{const c=fa(r.credential);t.addCcsOid(c)}catch(c){this.logger.verbose("Could not parse home account ID for CCS Header: "+c)}break;case Bn.UPN:t.addCcsUpn(r.credential);break}return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&t.addExtraQueryParameters(e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[Xv])&&t.addExtraQueryParameters({[Xv]:"1"}),t.createQueryString()}async createAuthCodeUrlQueryString(e){var a,c;const t=e.correlationId||this.config.cryptoInterface.createNewGuid();(a=this.performanceClient)==null||a.addQueueMeasurement(x.AuthClientCreateQueryString,t);const r=new ys(t,this.performanceClient);r.addClientId(e.embeddedClientId||((c=e.extraQueryParameters)==null?void 0:c[wi])||this.config.authOptions.clientId);const o=[...e.scopes||[],...e.extraScopesToConsent||[]];if(r.addScopes(o,!0,this.oidcDefaultScopes),r.addRedirectUri(e.redirectUri),r.addCorrelationId(t),r.addResponseMode(e.responseMode),r.addResponseTypeCode(),r.addLibraryInfo(this.config.libraryInfo),Zh(this.config)||r.addApplicationTelemetry(this.config.telemetry.application),r.addClientInfo(),e.codeChallenge&&e.codeChallengeMethod&&r.addCodeChallengeParams(e.codeChallenge,e.codeChallengeMethod),e.prompt&&r.addPrompt(e.prompt),e.domainHint&&r.addDomainHint(e.domainHint),e.prompt!==Bt.SELECT_ACCOUNT)if(e.sid&&e.prompt===Bt.NONE)this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),r.addSid(e.sid);else if(e.account){const d=this.extractAccountSid(e.account);let h=this.extractLoginHint(e.account);if(h&&e.domainHint&&(this.logger.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),h=null),h){this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),r.addLoginHint(h);try{const m=fa(e.account.homeAccountId);r.addCcsOid(m)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(d&&e.prompt===Bt.NONE){this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),r.addSid(d);try{const m=fa(e.account.homeAccountId);r.addCcsOid(m)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),r.addLoginHint(e.loginHint),r.addCcsUpn(e.loginHint);else if(e.account.username){this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),r.addLoginHint(e.account.username);try{const m=fa(e.account.homeAccountId);r.addCcsOid(m)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),r.addLoginHint(e.loginHint),r.addCcsUpn(e.loginHint));else this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");if(e.nonce&&r.addNonce(e.nonce),e.state&&r.addState(e.state),(e.claims||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(e.claims,this.config.authOptions.clientCapabilities),e.embeddedClientId&&r.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),this.addExtraQueryParams(e,r),e.nativeBroker&&(r.addNativeBroker(),e.authenticationScheme===Ge.POP)){const d=new Ia(this.cryptoUtils);let h;e.popKid?h=this.cryptoUtils.encodeKid(e.popKid):h=(await Q(d.generateCnf.bind(d),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,r.addPopToken(h)}return r.createQueryString()}createLogoutUrlQueryString(e){const t=new ys(e.correlationId,this.performanceClient);return e.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(e.postLogoutRedirectUri),e.correlationId&&t.addCorrelationId(e.correlationId),e.idTokenHint&&t.addIdTokenHint(e.idTokenHint),e.state&&t.addState(e.state),e.logoutHint&&t.addLogoutHint(e.logoutHint),this.addExtraQueryParams(e,t),t.createQueryString()}addExtraQueryParams(e,t){!(e.extraQueryParameters&&e.extraQueryParameters.hasOwnProperty("instance_aware"))&&this.config.authOptions.instanceAware&&(e.extraQueryParameters=e.extraQueryParameters||{},e.extraQueryParameters.instance_aware="true"),e.extraQueryParameters&&t.addExtraQueryParameters(e.extraQueryParameters)}extractAccountSid(e){var t;return((t=e.idTokenClaims)==null?void 0:t.sid)||null}extractLoginHint(e){var t;return((t=e.idTokenClaims)==null?void 0:t.login_hint)||null}}/*! @azure/msal-common v14.16.0 2024-11-05 */const O2=300;class nf extends lm{constructor(e,t){super(e,t)}async acquireToken(e){var c,d;(c=this.performanceClient)==null||c.addQueueMeasurement(x.RefreshTokenClientAcquireToken,e.correlationId);const t=zr(),r=await Q(this.executeTokenRequest.bind(this),x.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),o=(d=r.headers)==null?void 0:d[dn.X_MS_REQUEST_ID],a=new Ti(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return a.validateTokenResponse(r.body),Q(a.handleServerTokenResponse.bind(a),x.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,t,e,void 0,void 0,!0,e.forceCache,o)}async acquireTokenByRefreshToken(e){var r;if(!e)throw Xe(Ew);if((r=this.performanceClient)==null||r.addQueueMeasurement(x.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw Y(jf);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await Q(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(o){const a=o instanceof Er&&o.errorCode===Dl,c=o instanceof Wo&&o.errorCode===Bv.INVALID_GRANT_ERROR&&o.subError===Bv.CLIENT_MISMATCH_ERROR;if(a||c)return Q(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw o}return Q(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const r=Ai(this.cacheManager.getRefreshToken.bind(this.cacheManager),x.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,t,void 0,this.performanceClient,e.correlationId);if(!r)throw tf(Dl);if(r.expiresOn&&Xh(r.expiresOn,e.refreshTokenExpirationOffsetSeconds||O2))throw tf(um);const o={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||Ge.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:Bn.HOME_ACCOUNT_ID}};try{return await Q(this.acquireToken.bind(this),x.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(o)}catch(c){if(c instanceof Er&&c.subError===du){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const d=ha(r);this.cacheManager.removeRefreshToken(d)}throw c}}async executeTokenRequest(e,t){var h,m;(h=this.performanceClient)==null||h.addQueueMeasurement(x.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),o=De.appendQueryString(t.tokenEndpoint,r),a=await Q(this.createTokenRequestBody.bind(this),x.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),c=this.createTokenRequestHeaders(e.ccsCredential),d={clientId:((m=e.tokenBodyParameters)==null?void 0:m.clientId)||this.config.authOptions.clientId,authority:t.canonicalAuthority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid};return Q(this.executePostToTokenEndpoint.bind(this),x.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(o,a,c,d,e.correlationId,x.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var o,a,c;(o=this.performanceClient)==null||o.addQueueMeasurement(x.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const t=e.correlationId,r=new ys(t,this.performanceClient);if(r.addClientId(e.embeddedClientId||((a=e.tokenBodyParameters)==null?void 0:a[wi])||this.config.authOptions.clientId),e.redirectUri&&r.addRedirectUri(e.redirectUri),r.addScopes(e.scopes,!0,(c=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:c.defaultScopes),r.addGrantType(jE.REFRESH_TOKEN_GRANT),r.addClientInfo(),r.addLibraryInfo(this.config.libraryInfo),r.addApplicationTelemetry(this.config.telemetry.application),r.addThrottling(),this.serverTelemetryManager&&!Zh(this.config)&&r.addServerTelemetry(this.serverTelemetryManager),r.addRefreshToken(e.refreshToken),this.config.clientCredentials.clientSecret&&r.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const d=this.config.clientCredentials.clientAssertion;r.addClientAssertion(await Vw(d.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),r.addClientAssertionType(d.assertionType)}if(e.authenticationScheme===Ge.POP){const d=new Ia(this.cryptoUtils,this.performanceClient);let h;e.popKid?h=this.cryptoUtils.encodeKid(e.popKid):h=(await Q(d.generateCnf.bind(d),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,r.addPopToken(h)}else if(e.authenticationScheme===Ge.SSH)if(e.sshJwk)r.addSshJwk(e.sshJwk);else throw Xe(cu);if((!vr.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case Bn.HOME_ACCOUNT_ID:try{const d=fa(e.ccsCredential.credential);r.addCcsOid(d)}catch(d){this.logger.verbose("Could not parse home account ID for CCS Header: "+d)}break;case Bn.UPN:r.addCcsUpn(e.ccsCredential.credential);break}return e.embeddedClientId&&r.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&r.addExtraQueryParameters(e.tokenBodyParameters),r.createQueryString()}}/*! @azure/msal-common v14.16.0 2024-11-05 */class P2 extends lm{constructor(e,t){super(e,t)}async acquireToken(e){var t;try{const[r,o]=await this.acquireCachedToken({...e,scopes:(t=e.scopes)!=null&&t.length?e.scopes:[...Ma]});return o===Mo.PROACTIVELY_REFRESHED&&(this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."),new nf(this.config,this.performanceClient).acquireTokenByRefreshToken(e).catch(()=>{})),r}catch(r){if(r instanceof iu&&r.errorCode===co)return new nf(this.config,this.performanceClient).acquireTokenByRefreshToken(e);throw r}}async acquireCachedToken(e){var h;(h=this.performanceClient)==null||h.addQueueMeasurement(x.SilentFlowClientAcquireCachedToken,e.correlationId);let t=Mo.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!vr.isEmptyObj(e.claims))throw this.setCacheOutcome(Mo.FORCE_REFRESH_OR_CLAIMS,e.correlationId),Y(co);if(!e.account)throw Y(jf);const r=e.account.tenantId||E2(e.authority),o=this.cacheManager.getTokenKeys(),a=this.cacheManager.getAccessToken(e.account,e,o,r,this.performanceClient,e.correlationId);if(a){if(sV(a.cachedAt)||Xh(a.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(Mo.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),Y(co);a.refreshOn&&Xh(a.refreshOn,0)&&(t=Mo.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(Mo.NO_CACHED_ACCESS_TOKEN,e.correlationId),Y(co);const c=e.authority||this.authority.getPreferredCache(),d={account:this.cacheManager.readAccountFromCache(e.account),accessToken:a,idToken:this.cacheManager.getIdToken(e.account,o,r,this.performanceClient,e.correlationId),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(c)};return this.setCacheOutcome(t,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await Q(this.generateResultFromCacheRecord.bind(this),x.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(d,e),t]}setCacheOutcome(e,t){var r,o;(r=this.serverTelemetryManager)==null||r.setCacheOutcome(e),(o=this.performanceClient)==null||o.addFields({cacheOutcome:e},t),e!==Mo.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,t){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(x.SilentFlowClientGenerateResultFromCacheRecord,t.correlationId);let r;if(e.idToken&&(r=Si(e.idToken.secret,this.config.cryptoInterface.base64Decode)),t.maxAge||t.maxAge===0){const a=r==null?void 0:r.auth_time;if(!a)throw Y(qf);mw(a,t.maxAge)}return Ti.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,t,r)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const M2={sendGetRequestAsync:()=>Promise.reject(Y(Ae)),sendPostRequestAsync:()=>Promise.reject(Y(Ae))};/*! @azure/msal-common v14.16.0 2024-11-05 */const ny=",",$w="|";function D2(n){const{skus:e,libraryName:t,libraryVersion:r,extensionName:o,extensionVersion:a}=n,c=new Map([[0,[t,r]],[2,[o,a]]]);let d=[];if(e!=null&&e.length){if(d=e.split(ny),d.length<4)return e}else d=Array.from({length:4},()=>$w);return c.forEach((h,m)=>{var g,v;h.length===2&&((g=h[0])!=null&&g.length)&&((v=h[1])!=null&&v.length)&&L2({skuArr:d,index:m,skuName:h[0],skuVersion:h[1]})}),d.join(ny)}function L2(n){const{skuArr:e,index:t,skuName:r,skuVersion:o}=n;t>=e.length||(e[t]=[r,o].join($w))}class Os{constructor(e,t){this.cacheOutcome=Mo.NOT_APPLICABLE,this.cacheManager=t,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||F.EMPTY_STRING,this.wrapperVer=e.wrapperVer||F.EMPTY_STRING,this.telemetryCacheKey=Wt.CACHE_KEY+tn.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${Wt.VALUE_SEPARATOR}${this.cacheOutcome}`,t=[this.wrapperSKU,this.wrapperVer],r=this.getNativeBrokerErrorCode();r!=null&&r.length&&t.push(`broker_error=${r}`);const o=t.join(Wt.VALUE_SEPARATOR),a=this.getRegionDiscoveryFields(),c=[e,a].join(Wt.VALUE_SEPARATOR);return[Wt.SCHEMA_VERSION,c,o].join(Wt.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),t=Os.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*t).join(Wt.VALUE_SEPARATOR),o=e.errors.slice(0,t).join(Wt.VALUE_SEPARATOR),a=e.errors.length,c=t<a?Wt.OVERFLOW_TRUE:Wt.OVERFLOW_FALSE,d=[a,c].join(Wt.VALUE_SEPARATOR);return[Wt.SCHEMA_VERSION,e.cacheHits,r,o,d].join(Wt.CATEGORY_SEPARATOR)}cacheFailedRequest(e){const t=this.getLastRequests();t.errors.length>=Wt.MAX_CACHED_ERRORS&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof lt?e.subError?t.errors.push(e.subError):e.errorCode?t.errors.push(e.errorCode):t.errors.push(e.toString()):t.errors.push(e.toString()):t.errors.push(Wt.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),t=Os.maxErrorsToSend(e),r=e.errors.length;if(t===r)this.cacheManager.removeItem(this.telemetryCacheKey);else{const o={failedRequests:e.failedRequests.slice(t*2),errors:e.errors.slice(t),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,o)}}static maxErrorsToSend(e){let t,r=0,o=0;const a=e.errors.length;for(t=0;t<a;t++){const c=e.failedRequests[2*t]||F.EMPTY_STRING,d=e.failedRequests[2*t+1]||F.EMPTY_STRING,h=e.errors[t]||F.EMPTY_STRING;if(o+=c.toString().length+d.toString().length+h.length+3,o<Wt.MAX_LAST_HEADER_BYTES)r+=1;else break}return r}getRegionDiscoveryFields(){const e=[];return e.push(this.regionUsed||F.EMPTY_STRING),e.push(this.regionSource||F.EMPTY_STRING),e.push(this.regionOutcome||F.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 t=this.getLastRequests();t.nativeBrokerErrorCode=e,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}getNativeBrokerErrorCode(){return this.getLastRequests().nativeBrokerErrorCode}clearNativeBrokerErrorCode(){const e=this.getLastRequests();delete e.nativeBrokerErrorCode,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e)}static makeExtraSkuString(e){return D2(e)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Kw="missing_kid_error",Ww="missing_alg_error";/*! @azure/msal-common v14.16.0 2024-11-05 */const x2={[Kw]:"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.",[Ww]:"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 hm extends lt{constructor(e,t){super(e,t),this.name="JoseHeaderError",Object.setPrototypeOf(this,hm.prototype)}}function ry(n){return new hm(n,x2[n])}/*! @azure/msal-common v14.16.0 2024-11-05 */class fm{constructor(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}static getShrHeaderString(e){if(!e.kid)throw ry(Kw);if(!e.alg)throw ry(Ww);const t=new fm({typ:e.typ||zF.Pop,kid:e.kid,alg:e.alg});return JSON.stringify(t)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class oy{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class U2{generateId(){return"callback-id"}startMeasurement(e,t){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:C2.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:t||""},measurement:new oy}}startPerformanceMeasurement(){return new oy}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const mm="pkce_not_created",rf="crypto_nonexistent",hu="empty_navigate_uri",zw="hash_empty_error",gm="no_state_in_hash",Gw="hash_does_not_contain_known_properties",qw="unable_to_parse_state",jw="state_interaction_type_mismatch",Yw="interaction_in_progress",Jw="popup_window_error",Qw="empty_window_error",bi="user_cancelled",B2="monitor_popup_timeout",Xw="monitor_window_timeout",Zw="redirect_in_iframe",eT="block_iframe_reload",tT="block_nested_popups",F2="iframe_closed_prematurely",fu="silent_logout_unsupported",nT="no_account_error",V2="silent_prompt_value_error",rT="no_token_request_cache_error",oT="unable_to_parse_token_request_cache_error",pm="no_cached_authority_error",H2="auth_request_not_set_error",$2="invalid_cache_type",mu="non_browser_environment",aa="database_not_open",Ll="no_network_connectivity",iT="post_request_failed",aT="get_request_failed",of="failed_to_parse_response",sT="unable_to_load_token",_m="crypto_key_not_found",cT="auth_code_required",lT="auth_code_or_nativeAccountId_required",uT="spa_code_and_nativeAccountId_present",vm="database_unavailable",dT="unable_to_acquire_token_from_native_platform",hT="native_handshake_timeout",fT="native_extension_not_installed",Ks="native_connection_not_established",mT="uninitialized_public_client_application",gT="native_prompt_not_supported",pT="invalid_base64_string",_T="invalid_pop_token_request",vT="failed_to_build_headers",yT="failed_to_parse_headers";/*! @azure/msal-browser v3.28.1 2025-01-14 */const io="For more visit: aka.ms/msaljs/browser-errors",K2={[mm]:"The PKCE code challenge and verifier could not be generated.",[rf]:"The crypto object or function is not available.",[hu]:"Navigation URI is empty. Please check stack trace for more info.",[zw]:`Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. ${io}`,[gm]:"Hash does not contain state. Please verify that the request originated from msal.",[Gw]:`Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. ${io}`,[qw]:"Unable to parse state. Please verify that the request originated from msal.",[jw]:"Hash contains state but the interaction type does not match the caller.",[Yw]:`Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. ${io}`,[Jw]:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.",[Qw]:"window.open returned null or undefined window object.",[bi]:"User cancelled the flow.",[B2]:`Token acquisition in popup failed due to timeout. ${io}`,[Xw]:`Token acquisition in iframe failed due to timeout. ${io}`,[Zw]:"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.",[eT]:`Request was blocked inside an iframe because MSAL detected an authentication response. ${io}`,[tT]:"Request was blocked inside a popup because MSAL detected it was running in a popup.",[F2]:"The iframe being monitored was closed prematurely.",[fu]:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead.",[nT]:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.",[V2]:"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'.",[rT]:"No token request found in cache.",[oT]:"The cached token request could not be parsed.",[pm]:"No cached authority found.",[H2]:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler",[$2]:"Invalid cache type",[mu]:"Login and token requests are not supported in non-browser environments.",[aa]:"Database is not open!",[Ll]:"No network connectivity. Check your internet connection.",[iT]:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'",[aT]:"Network request failed. Please check the network trace to determine root cause.",[of]:"Failed to parse network response. Check network trace.",[sT]:"Error loading token to cache.",[_m]:"Cryptographic Key or Keypair not found in browser storage.",[cT]:"An authorization code must be provided (as the `code` property on the request) to this flow.",[lT]:"An authorization code or nativeAccountId must be provided to this flow.",[uT]:"Request cannot contain both spa code and native account id.",[vm]:"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.",[dT]:`Unable to acquire token from native platform. ${io}`,[hT]:"Timed out while attempting to establish connection to browser extension",[fT]:"Native extension is not installed. If you think this is a mistake call the initialize function.",[Ks]:`Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). ${io}`,[mT]:`You must call and await the initialize function before attempting to call any other MSAL API. ${io}`,[gT]:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",[pT]:"Invalid base64 encoded string.",[_T]:"Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",[vT]:"Failed to build request headers object.",[yT]:"Failed to parse response headers"};class Ws extends lt{constructor(e,t){super(e,K2[e],t),Object.setPrototypeOf(this,Ws.prototype),this.name="BrowserAuthError"}}function ie(n,e){return new Ws(n,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Dn={INTERACTION_IN_PROGRESS_VALUE:"interaction_in_progress",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"},ma={CHANNEL_ID:"53ee284d-920a-4b59-9d30-a60315b26836",PREFERRED_EXTENSION_ID:"ppnbnpeolgkicgegkbkbjmhlideopiji",MATS_TELEMETRY:"MATS"},gi={HandshakeRequest:"Handshake",HandshakeResponse:"HandshakeResponse",GetToken:"GetToken",Response:"Response"},vn={LocalStorage:"localStorage",SessionStorage:"sessionStorage",MemoryStorage:"memoryStorage"},iy={GET:"GET",POST:"POST"},Ke={AUTHORITY:"authority",ACQUIRE_TOKEN_ACCOUNT:"acquireToken.account",SESSION_STATE:"session.state",REQUEST_STATE:"request.state",NONCE_IDTOKEN:"nonce.id_token",ORIGIN_URI:"request.origin",RENEW_STATUS:"token.renew.status",URL_HASH:"urlHash",REQUEST_PARAMS:"request.params",SCOPES:"scopes",INTERACTION_STATUS_KEY:"interaction.status",CCS_CREDENTIAL:"ccs.credential",CORRELATION_ID:"request.correlationId",NATIVE_REQUEST:"request.native",REDIRECT_CONTEXT:"request.redirect.context"},Po={ACCOUNT_KEYS:"msal.account.keys",TOKEN_KEYS:"msal.token.keys"},qc={WRAPPER_SKU:"wrapper.sku",WRAPPER_VER:"wrapper.version"},ot={acquireTokenRedirect:861,acquireTokenPopup:862,ssoSilent:863,acquireTokenSilent_authCode:864,handleRedirectPromise:865,acquireTokenByCode:866,acquireTokenSilent_silentFlow:61,logout:961,logoutPopup:962};var le;(function(n){n.Redirect="redirect",n.Popup="popup",n.Silent="silent",n.None="none"})(le||(le={}));const ay={scopes:Ma},CT="jwk",af="msal.db",W2=1,z2=`${af}.keys`,Pn={Default:0,AccessToken:1,AccessTokenAndRefreshToken:2,RefreshToken:3,RefreshTokenAndNetwork:4,Skip:5},G2=[Pn.Default,Pn.Skip,Pn.RefreshTokenAndNetwork],q2="msal.browser.log.level",j2="msal.browser.log.pii";/*! @azure/msal-browser v3.28.1 2025-01-14 */function jc(n){return encodeURIComponent(ym(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"))}function gu(n){return ET(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ym(n){return ET(new TextEncoder().encode(n))}function ET(n){const e=Array.from(n,t=>String.fromCodePoint(t)).join("");return btoa(e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Y2="RSASSA-PKCS1-v1_5",wT="SHA-256",J2=2048,Q2=new Uint8Array([1,0,1]),sy="0123456789abcdef",cy=new Uint32Array(1),X2="crypto_subtle_undefined",Cm={name:Y2,hash:wT,modulusLength:J2,publicExponent:Q2};function Z2(n){if(!window)throw ie(mu);if(!window.crypto)throw ie(rf);if(!n&&!window.crypto.subtle)throw ie(rf,X2)}async function TT(n,e,t){e==null||e.addQueueMeasurement(x.Sha256Digest,t);const o=new TextEncoder().encode(n);return window.crypto.subtle.digest(wT,o)}function eH(n){return window.crypto.getRandomValues(n)}function sh(){return window.crypto.getRandomValues(cy),cy[0]}function go(){const n=Date.now(),e=sh()*1024+(sh()&1023),t=new Uint8Array(16),r=Math.trunc(e/2**30),o=e&2**30-1,a=sh();t[0]=n/2**40,t[1]=n/2**32,t[2]=n/2**24,t[3]=n/2**16,t[4]=n/2**8,t[5]=n,t[6]=112|r>>>8,t[7]=r,t[8]=128|o>>>24,t[9]=o>>>16,t[10]=o>>>8,t[11]=o,t[12]=a>>>24,t[13]=a>>>16,t[14]=a>>>8,t[15]=a;let c="";for(let d=0;d<t.length;d++)c+=sy.charAt(t[d]>>>4),c+=sy.charAt(t[d]&15),(d===3||d===5||d===7||d===9)&&(c+="-");return c}async function tH(n,e){return window.crypto.subtle.generateKey(Cm,n,e)}async function ch(n){return window.crypto.subtle.exportKey(CT,n)}async function nH(n,e,t){return window.crypto.subtle.importKey(CT,n,Cm,e,t)}async function rH(n,e){return window.crypto.subtle.sign(Cm,n,e)}async function bT(n){const e=await TT(n),t=new Uint8Array(e);return gu(t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Ps="storage_not_supported",sf="stubbed_public_client_application_called",xl="in_mem_redirect_unavailable";/*! @azure/msal-browser v3.28.1 2025-01-14 */const gl={[Ps]:"Given storage configuration option was not supported.",[sf]:"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",[xl]:"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."};gl[Ps],gl[sf],gl[xl];class Em extends lt{constructor(e,t){super(e,t),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,Em.prototype)}}function wm(n){return new Em(n,gl[n])}/*! @azure/msal-browser v3.28.1 2025-01-14 */function oH(n){n.location.hash="",typeof n.history.replaceState=="function"&&n.history.replaceState(null,"",`${n.location.origin}${n.location.pathname}${n.location.search}`)}function iH(n){const e=n.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function Tm(){return window.parent!==window}function aH(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${Dn.POPUP_NAME_PREFIX}.`)===0}function lo(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function sH(){const e=new De(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function cH(){if(De.hashContainsKnownProperties(window.location.hash)&&Tm())throw ie(eT)}function lH(n){if(Tm()&&!n)throw ie(Zw)}function uH(){if(aH())throw ie(tT)}function IT(){if(typeof window>"u")throw ie(mu)}function ST(n){if(!n)throw ie(mT)}function bm(n){IT(),cH(),uH(),ST(n)}function ly(n,e){if(bm(n),lH(e.system.allowRedirectInIframe),e.cache.cacheLocation===vn.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw wm(xl)}function AT(n){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(n).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function dH(){return go()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ul{navigateInternal(e,t){return Ul.defaultNavigateWindow(e,t)}navigateExternal(e,t){return Ul.defaultNavigateWindow(e,t)}static defaultNavigateWindow(e,t){return t.noHistory?window.location.replace(e):window.location.assign(e),new Promise(r=>{setTimeout(()=>{r(!0)},t.timeout)})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class hH{async sendGetRequestAsync(e,t){let r,o={},a=0;const c=uy(t);try{r=await fetch(e,{method:iy.GET,headers:c})}catch{throw ie(window.navigator.onLine?aT:Ll)}o=dy(r.headers);try{return a=r.status,{headers:o,body:await r.json(),status:a}}catch{throw Zv(ie(of),a,o)}}async sendPostRequestAsync(e,t){const r=t&&t.body||"",o=uy(t);let a,c=0,d={};try{a=await fetch(e,{method:iy.POST,headers:o,body:r})}catch{throw ie(window.navigator.onLine?iT:Ll)}d=dy(a.headers);try{return c=a.status,{headers:d,body:await a.json(),status:c}}catch{throw Zv(ie(of),c,d)}}}function uy(n){try{const e=new Headers;if(!(n&&n.headers))return e;const t=n.headers;return Object.entries(t).forEach(([r,o])=>{e.append(r,o)}),e}catch{throw ie(vT)}}function dy(n){try{const e={};return n.forEach((t,r)=>{e[r]=t}),e}catch{throw ie(yT)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const fH=6e4,cf=1e4,mH=3e4,gH=2e3;function pH({auth:n,cache:e,system:t,telemetry:r},o){const a={clientId:F.EMPTY_STRING,authority:`${F.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:F.EMPTY_STRING,authorityMetadata:F.EMPTY_STRING,redirectUri:typeof window<"u"?lo():"",postLogoutRedirectUri:F.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:fo.AAD,OIDCOptions:{serverResponseType:$s.FRAGMENT,defaultScopes:[F.OPENID_SCOPE,F.PROFILE_SCOPE,F.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:Xf.None,tenant:F.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1},c={cacheLocation:vn.SessionStorage,temporaryCacheLocation:vn.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===vn.LocalStorage),claimsBasedCachingEnabled:!1},d={loggerCallback:()=>{},logLevel:tt.Info,piiLoggingEnabled:!1},m={...{...Lw,loggerOptions:d,networkClient:o?new hH:M2,navigationClient:new Ul,loadFrameTimeout:0,windowHashTimeout:(t==null?void 0:t.loadFrameTimeout)||fH,iframeHashTimeout:(t==null?void 0:t.loadFrameTimeout)||cf,navigateFrameWait:0,redirectNavigationTimeout:mH,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:(t==null?void 0:t.nativeBrokerHandshakeTimeout)||gH,pollIntervalMilliseconds:Dn.DEFAULT_POLL_INTERVAL_MS},...t,loggerOptions:(t==null?void 0:t.loggerOptions)||d},g={application:{appName:F.EMPTY_STRING,appVersion:F.EMPTY_STRING},client:new U2};if((n==null?void 0:n.protocolMode)!==fo.OIDC&&(n!=null&&n.OIDCOptions)&&new Ko(m.loggerOptions).warning(JSON.stringify(Xe(Aw))),n!=null&&n.protocolMode&&n.protocolMode!==fo.AAD&&(m!=null&&m.allowNativeBroker))throw Xe(kw);return{auth:{...a,...n,OIDCOptions:{...a.OIDCOptions,...n==null?void 0:n.OIDCOptions}},cache:{...c,...e},system:m,telemetry:{...g,...r}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const _H="@azure/msal-browser",pu="3.28.1";/*! @azure/msal-browser v3.28.1 2025-01-14 */class Im{static loggerCallback(e,t){switch(e){case tt.Error:console.error(t);return;case tt.Info:console.info(t);return;case tt.Verbose:console.debug(t);return;case tt.Warning:console.warn(t);return;default:console.log(t);return}}constructor(e){var h;this.browserEnvironment=typeof window<"u",this.config=pH(e,this.browserEnvironment);let t;try{t=window[vn.SessionStorage]}catch{}const r=t==null?void 0:t.getItem(q2),o=(h=t==null?void 0:t.getItem(j2))==null?void 0:h.toLowerCase(),a=o==="true"?!0:o==="false"?!1:void 0,c={...this.config.system.loggerOptions},d=r&&Object.keys(tt).includes(r)?tt[r]:void 0;d&&(c.loggerCallback=Im.loggerCallback,c.logLevel=d),a!==void 0&&(c.piiLoggingEnabled=a),this.logger=new Ko(c,_H,pu),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ii extends Im{getModuleName(){return Ii.MODULE_NAME}getId(){return Ii.ID}async initialize(){return this.available=typeof window<"u",this.available}}Ii.MODULE_NAME="";Ii.ID="StandardOperatingContext";/*! @azure/msal-browser v3.28.1 2025-01-14 */function Kr(n){return new TextDecoder().decode(vH(n))}function vH(n){let e=n.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw ie(pT)}const t=atob(e);return Uint8Array.from(t,r=>r.codePointAt(0)||0)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class yH{constructor(){this.dbName=af,this.version=W2,this.tableName=z2,this.dbOpen=!1}async open(){return new Promise((e,t)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",o=>{o.target.result.createObjectStore(this.tableName)}),r.addEventListener("success",o=>{const a=o;this.db=a.target.result,this.dbOpen=!0,e()}),r.addEventListener("error",()=>t(ie(vm)))})}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((t,r)=>{if(!this.db)return r(ie(aa));const c=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);c.addEventListener("success",d=>{const h=d;this.closeConnection(),t(h.target.result)}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async setItem(e,t){return await this.validateDbIsOpen(),new Promise((r,o)=>{if(!this.db)return o(ie(aa));const d=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(t,e);d.addEventListener("success",()=>{this.closeConnection(),r()}),d.addEventListener("error",h=>{this.closeConnection(),o(h)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(ie(aa));const c=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);c.addEventListener("success",()=>{this.closeConnection(),t()}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,t)=>{if(!this.db)return t(ie(aa));const a=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();a.addEventListener("success",c=>{const d=c;this.closeConnection(),e(d.target.result)}),a.addEventListener("error",c=>{this.closeConnection(),t(c)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(ie(aa));const c=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);c.addEventListener("success",d=>{const h=d;this.closeConnection(),t(h.target.result===1)}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,t)=>{const r=window.indexedDB.deleteDatabase(af),o=setTimeout(()=>t(!1),200);r.addEventListener("success",()=>(clearTimeout(o),e(!0))),r.addEventListener("blocked",()=>(clearTimeout(o),e(!0))),r.addEventListener("error",()=>(clearTimeout(o),t(!1)))})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class lf{constructor(){this.cache=new Map}getItem(e){return this.cache.get(e)||null}setItem(e,t){this.cache.set(e,t)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((t,r)=>{e.push(r)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class CH{constructor(e){this.inMemoryCache=new lf,this.indexedDBCache=new yH,this.logger=e}handleDatabaseAccessError(e){if(e instanceof Ws&&e.errorCode===vm)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 t=this.inMemoryCache.getItem(e);if(!t)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 t}async setItem(e,t){this.inMemoryCache.setItem(e,t);try{await this.indexedDBCache.setItem(e,t)}catch(r){this.handleDatabaseAccessError(r)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(t){this.handleDatabaseAccessError(t)}}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(t){this.handleDatabaseAccessError(t)}return e}async containsKey(e){const t=this.inMemoryCache.containsKey(e);if(!t)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 t}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}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Sa{constructor(e,t,r){this.logger=e,Z2(r??!1),this.cache=new CH(this.logger),this.performanceClient=t}createNewGuid(){return go()}base64Encode(e){return ym(e)}base64Decode(e){return Kr(e)}base64UrlEncode(e){return jc(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var g;const t=(g=this.performanceClient)==null?void 0:g.startMeasurement(x.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await tH(Sa.EXTRACTABLE,Sa.POP_KEY_USAGES),o=await ch(r.publicKey),a={e:o.e,kty:o.kty,n:o.n},c=hy(a),d=await this.hashString(c),h=await ch(r.privateKey),m=await nH(h,!1,["sign"]);return await this.cache.setItem(d,{privateKey:m,publicKey:r.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),t&&t.end({success:!0}),d}async removeTokenBindingKey(e){return await this.cache.removeItem(e),!await this.cache.containsKey(e)}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,t,r,o){var D;const a=(D=this.performanceClient)==null?void 0:D.startMeasurement(x.CryptoOptsSignJwt,o),c=await this.cache.getItem(t);if(!c)throw ie(_m);const d=await ch(c.publicKey),h=hy(d),m=jc(JSON.stringify({kid:t})),g=fm.getShrHeaderString({...r==null?void 0:r.header,alg:d.alg,kid:m}),v=jc(g);e.cnf={jwk:JSON.parse(h)};const p=jc(JSON.stringify(e)),w=`${v}.${p}`,T=new TextEncoder().encode(w),k=await rH(c.privateKey,T),I=gu(new Uint8Array(k)),N=`${w}.${I}`;return a&&a.end({success:!0}),N}async hashString(e){return bT(e)}}Sa.POP_KEY_USAGES=["sign","verify"];Sa.EXTRACTABLE=!0;function hy(n){return JSON.stringify(n,Object.keys(n).sort())}/*! @azure/msal-browser v3.28.1 2025-01-14 */class EH{constructor(){if(!window.localStorage)throw wm(Ps)}getItem(e){return window.localStorage.getItem(e)}setItem(e,t){window.localStorage.setItem(e,t)}removeItem(e){window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class wH{constructor(){if(!window.sessionStorage)throw wm(Ps)}getItem(e){return window.sessionStorage.getItem(e)}setItem(e,t){window.sessionStorage.setItem(e,t)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function kT(n,e){if(!e)return null;try{return yr.parseRequestState(n,e).libraryState.meta}catch{throw Y(Ta)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const TH=24*60*60*1e3;class bH{getItem(e){const t=`${encodeURIComponent(e)}`,r=document.cookie.split(";");for(let o=0;o<r.length;o++){const a=r[o],[c,...d]=decodeURIComponent(a).trim().split("="),h=d.join("=");if(c===t)return h}return""}setItem(e,t,r,o=!0){let a=`${encodeURIComponent(e)}=${encodeURIComponent(t)};path=/;SameSite=Lax;`;if(r){const c=IH(r);a+=`expires=${c};`}o&&(a+="Secure;"),document.cookie=a}removeItem(e){this.setItem(e,"",-1)}getKeys(){const e=document.cookie.split(";"),t=[];return e.forEach(r=>{const o=decodeURIComponent(r).trim().split("=");t.push(o[0])}),t}containsKey(e){return this.getKeys().includes(e)}}function IH(n){const e=new Date;return new Date(e.getTime()+n*TH).toUTCString()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class uf extends ba{constructor(e,t,r,o,a,c){super(e,r,o,a),this.cacheConfig=t,this.logger=o,this.internalStorage=new lf,this.browserStorage=this.setupBrowserStorage(this.cacheConfig.cacheLocation),this.temporaryCacheStorage=this.setupBrowserStorage(this.cacheConfig.temporaryCacheLocation),this.cookieStorage=new bH,t.cacheMigrationEnabled&&(this.migrateCacheEntries(),this.createKeyMaps()),this.performanceClient=c}setupBrowserStorage(e){try{switch(e){case vn.LocalStorage:return new EH;case vn.SessionStorage:return new wH;case vn.MemoryStorage:default:break}}catch(t){this.logger.error(t)}return this.cacheConfig.cacheLocation=vn.MemoryStorage,new lf}migrateCacheEntries(){const e=`${F.CACHE_PREFIX}.${Lt.ID_TOKEN}`,t=`${F.CACHE_PREFIX}.${Lt.CLIENT_INFO}`,r=`${F.CACHE_PREFIX}.${Lt.ERROR}`,o=`${F.CACHE_PREFIX}.${Lt.ERROR_DESC}`,a=this.browserStorage.getItem(e),c=this.browserStorage.getItem(t),d=this.browserStorage.getItem(r),h=this.browserStorage.getItem(o),m=[a,c,d,h];[Lt.ID_TOKEN,Lt.CLIENT_INFO,Lt.ERROR,Lt.ERROR_DESC].forEach((v,p)=>{const w=m[p];w&&this.setTemporaryCache(v,w,!0)})}createKeyMaps(){this.logger.trace("BrowserCacheManager - createKeyMaps called.");const e=this.getItem(Po.ACCOUNT_KEYS),t=this.getItem(`${Po.TOKEN_KEYS}.${this.clientId}`);if(e&&t){this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.");return}this.browserStorage.getKeys().forEach(o=>{if(this.isCredentialKey(o)){const a=this.getItem(o);if(a){const c=this.validateAndParseJson(a);if(c&&c.hasOwnProperty("credentialType"))switch(c.credentialType){case ge.ID_TOKEN:if(Kv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,ge.ID_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed idToken validation on key: ${o}`);break;case ge.ACCESS_TOKEN:case ge.ACCESS_TOKEN_WITH_AUTH_SCHEME:if($v(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,ge.ACCESS_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed accessToken validation on key: ${o}`);break;case ge.REFRESH_TOKEN:if(Wv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,ge.REFRESH_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: ${o}`);break}}}if(this.isAccountKey(o)){const a=this.getItem(o);if(a){const c=this.validateAndParseJson(a);c&&Pt.isAccountEntity(c)&&(this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${o} found, saving key to account key map`),this.addAccountKeyToMap(o))}}})}validateAndParseJson(e){try{const t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}getItem(e){return this.browserStorage.getItem(e)}setItem(e,t){this.browserStorage.setItem(e,t)}getAccount(e,t){this.logger.trace("BrowserCacheManager.getAccount called");const r=this.getCachedAccountEntity(e);return this.updateOutdatedCachedAccount(e,r,t)}getCachedAccountEntity(e){const t=this.getItem(e);if(!t)return this.removeAccountKeyFromMap(e),null;const r=this.validateAndParseJson(t);return!r||!Pt.isAccountEntity(r)?(this.removeAccountKeyFromMap(e),null):ba.toObject(new Pt,r)}setAccount(e){this.logger.trace("BrowserCacheManager.setAccount called");const t=e.generateAccountKey();this.setItem(t,JSON.stringify(e)),this.addAccountKeyToMap(t)}getAccountKeys(){this.logger.trace("BrowserCacheManager.getAccountKeys called");const e=this.getItem(Po.ACCOUNT_KEYS);return e?JSON.parse(e):(this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found"),[])}addAccountKeyToMap(e){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${e}`);const t=this.getAccountKeys();t.indexOf(e)===-1?(t.push(e),this.setItem(Po.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added")):this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map")}removeAccountKeyFromMap(e){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${e}`);const t=this.getAccountKeys(),r=t.indexOf(e);r>-1?(t.splice(r,1),this.setItem(Po.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")):this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}async removeAccount(e){super.removeAccount(e),this.removeAccountKeyFromMap(e)}removeOutdatedAccount(e){this.removeItem(e),this.removeAccountKeyFromMap(e)}removeIdToken(e){super.removeIdToken(e),this.removeTokenKey(e,ge.ID_TOKEN)}async removeAccessToken(e){super.removeAccessToken(e),this.removeTokenKey(e,ge.ACCESS_TOKEN)}removeRefreshToken(e){super.removeRefreshToken(e),this.removeTokenKey(e,ge.REFRESH_TOKEN)}getTokenKeys(){this.logger.trace("BrowserCacheManager.getTokenKeys called");const e=this.getItem(`${Po.TOKEN_KEYS}.${this.clientId}`);if(e){const t=this.validateAndParseJson(e);if(t&&t.hasOwnProperty("idToken")&&t.hasOwnProperty("accessToken")&&t.hasOwnProperty("refreshToken"))return t;this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.")}else this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");return{idToken:[],accessToken:[],refreshToken:[]}}addTokenKey(e,t){this.logger.trace("BrowserCacheManager addTokenKey called");const r=this.getTokenKeys();switch(t){case ge.ID_TOKEN:r.idToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),r.idToken.push(e));break;case ge.ACCESS_TOKEN:r.accessToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - accessToken added to map"),r.accessToken.push(e));break;case ge.REFRESH_TOKEN:r.refreshToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),r.refreshToken.push(e));break;default:throw this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${t}`),Y(Qh)}this.setItem(`${Po.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}removeTokenKey(e,t){this.logger.trace("BrowserCacheManager removeTokenKey called");const r=this.getTokenKeys();switch(t){case ge.ID_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: ${e} from map`);const o=r.idToken.indexOf(e);o>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map"),r.idToken.splice(o,1)):this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");break;case ge.ACCESS_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: ${e} from map`);const a=r.accessToken.indexOf(e);a>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map"),r.accessToken.splice(a,1)):this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");break;case ge.REFRESH_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: ${e} from map`);const c=r.refreshToken.indexOf(e);c>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map"),r.refreshToken.splice(c,1)):this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");break;default:throw this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${t}`),Y(Qh)}this.setItem(`${Po.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}getIdTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ID_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Kv(r)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ID_TOKEN),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),r)}setIdTokenCredential(e){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const t=ha(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,ge.ID_TOKEN)}getAccessTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ACCESS_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!$v(r)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ACCESS_TOKEN),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),r)}setAccessTokenCredential(e){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const t=ha(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,ge.ACCESS_TOKEN)}getRefreshTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.REFRESH_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Wv(r)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.REFRESH_TOKEN),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),r)}setRefreshTokenCredential(e){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const t=ha(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,ge.REFRESH_TOKEN)}getAppMetadata(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!pV(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),r)}setAppMetadata(e){this.logger.trace("BrowserCacheManager.setAppMetadata called");const t=gV(e);this.setItem(t,JSON.stringify(e))}getServerTelemetry(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!fV(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),r)}setServerTelemetry(e,t){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(t))}getAuthorityMetadata(e){const t=this.internalStorage.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return r&&_V(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),r):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(t=>this.isAuthorityMetadata(t))}setWrapperMetadata(e,t){this.internalStorage.setItem(qc.WRAPPER_SKU,e),this.internalStorage.setItem(qc.WRAPPER_VER,t)}getWrapperMetadata(){const e=this.internalStorage.getItem(qc.WRAPPER_SKU)||F.EMPTY_STRING,t=this.internalStorage.getItem(qc.WRAPPER_VER)||F.EMPTY_STRING;return[e,t]}setAuthorityMetadata(e,t){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(t))}getActiveAccount(){const e=this.generateCacheKey(Lt.ACTIVE_ACCOUNT_FILTERS),t=this.getItem(e);if(!t){this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");const o=this.generateCacheKey(Lt.ACTIVE_ACCOUNT),a=this.getItem(o);if(!a)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null;const c=this.getAccountInfoFilteredBy({localAccountId:a});return c?(this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"),this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema"),this.setActiveAccount(c),c):null}const r=this.validateAndParseJson(t);return r?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:r.homeAccountId,localAccountId:r.localAccountId,tenantId:r.tenantId})):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e){const t=this.generateCacheKey(Lt.ACTIVE_ACCOUNT_FILTERS),r=this.generateCacheKey(Lt.ACTIVE_ACCOUNT);if(e){this.logger.verbose("setActiveAccount: Active account set");const o={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId};this.browserStorage.setItem(t,JSON.stringify(o)),this.browserStorage.setItem(r,e.localAccountId)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(t),this.browserStorage.removeItem(r)}getThrottlingCache(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!mV(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),r)}setThrottlingCache(e,t){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(t))}getTemporaryCache(e,t){const r=t?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const a=this.cookieStorage.getItem(r);if(a)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),a}const o=this.temporaryCacheStorage.getItem(r);if(!o){if(this.cacheConfig.cacheLocation===vn.LocalStorage){const a=this.browserStorage.getItem(r);if(a)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),a}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),o}setTemporaryCache(e,t,r){const o=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(o,t),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(o,t,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()}async clear(){await this.removeAllAccounts(),this.removeAppMetadata(),this.temporaryCacheStorage.getKeys().forEach(e=>{(e.indexOf(F.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(e)}),this.browserStorage.getKeys().forEach(e=>{(e.indexOf(F.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(e)}),this.internalStorage.clear()}async clearTokensAndKeysWithClaims(e,t){e.addQueueMeasurement(x.ClearTokensAndKeysWithClaims,t);const r=this.getTokenKeys(),o=[];r.accessToken.forEach(a=>{const c=this.getAccessTokenCredential(a);c!=null&&c.requestedClaimsHash&&a.includes(c.requestedClaimsHash.toLowerCase())&&o.push(this.removeAccessToken(a))}),await Promise.all(o),o.length>0&&this.logger.warning(`${o.length} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return this.validateAndParseJson(e)?JSON.stringify(e):vr.startsWith(e,F.CACHE_PREFIX)||vr.startsWith(e,Lt.ADAL_ID_TOKEN)?e:`${F.CACHE_PREFIX}.${this.clientId}.${e}`}generateAuthorityKey(e){const{libraryState:{id:t}}=yr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Ke.AUTHORITY}.${t}`)}generateNonceKey(e){const{libraryState:{id:t}}=yr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Ke.NONCE_IDTOKEN}.${t}`)}generateStateKey(e){const{libraryState:{id:t}}=yr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Ke.REQUEST_STATE}.${t}`)}getCachedAuthority(e){const t=this.generateStateKey(e),r=this.getTemporaryCache(t);if(!r)return null;const o=this.generateAuthorityKey(r);return this.getTemporaryCache(o)}updateCacheEntries(e,t,r,o,a){this.logger.trace("BrowserCacheManager.updateCacheEntries called");const c=this.generateStateKey(e);this.setTemporaryCache(c,e,!1);const d=this.generateNonceKey(e);this.setTemporaryCache(d,t,!1);const h=this.generateAuthorityKey(e);if(this.setTemporaryCache(h,r,!1),a){const m={credential:a.homeAccountId,type:Bn.HOME_ACCOUNT_ID};this.setTemporaryCache(Ke.CCS_CREDENTIAL,JSON.stringify(m),!0)}else if(o){const m={credential:o,type:Bn.UPN};this.setTemporaryCache(Ke.CCS_CREDENTIAL,JSON.stringify(m),!0)}}resetRequestCache(e){this.logger.trace("BrowserCacheManager.resetRequestCache called"),e&&(this.temporaryCacheStorage.getKeys().forEach(t=>{t.indexOf(e)!==-1&&this.removeTemporaryItem(t)}),this.removeTemporaryItem(this.generateStateKey(e)),this.removeTemporaryItem(this.generateNonceKey(e)),this.removeTemporaryItem(this.generateAuthorityKey(e))),this.removeTemporaryItem(this.generateCacheKey(Ke.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(Ke.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(Ke.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(Ke.CORRELATION_ID)),this.removeTemporaryItem(this.generateCacheKey(Ke.CCS_CREDENTIAL)),this.removeTemporaryItem(this.generateCacheKey(Ke.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cleanRequestByState(e){if(this.logger.trace("BrowserCacheManager.cleanRequestByState called"),e){const t=this.generateStateKey(e),r=this.temporaryCacheStorage.getItem(t);this.logger.infoPii(`BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: ${r}`),this.resetRequestCache(r||F.EMPTY_STRING)}}cleanRequestByInteractionType(e){this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.temporaryCacheStorage.getKeys().forEach(t=>{if(t.indexOf(Ke.REQUEST_STATE)===-1)return;const r=this.temporaryCacheStorage.getItem(t);if(!r)return;const o=kT(this.cryptoImpl,r);o&&o.interactionType===e&&(this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${r}`),this.resetRequestCache(r))}),this.setInteractionInProgress(!1)}cacheCodeRequest(e){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");const t=ym(JSON.stringify(e));this.setTemporaryCache(Ke.REQUEST_PARAMS,t,!0)}getCachedRequest(e){this.logger.trace("BrowserCacheManager.getCachedRequest called");const t=this.getTemporaryCache(Ke.REQUEST_PARAMS,!0);if(!t)throw ie(rT);let r;try{r=JSON.parse(Kr(t))}catch(o){throw this.logger.errorPii(`Attempted to parse: ${t}`),this.logger.error(`Parsing cached token request threw with error: ${o}`),ie(oT)}if(this.removeTemporaryItem(this.generateCacheKey(Ke.REQUEST_PARAMS)),!r.authority){const o=this.generateAuthorityKey(e),a=this.getTemporaryCache(o);if(!a)throw ie(pm);r.authority=a}return r}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(Ke.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const t=this.validateAndParseJson(e);return t||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){const t=this.getInteractionInProgress();return e?t===this.clientId:!!t}getInteractionInProgress(){const e=`${F.CACHE_PREFIX}.${Ke.INTERACTION_STATUS_KEY}`;return this.getTemporaryCache(e,!1)}setInteractionInProgress(e){const t=`${F.CACHE_PREFIX}.${Ke.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw ie(Yw);this.setTemporaryCache(t,this.clientId,!1)}else!e&&this.getInteractionInProgress()===this.clientId&&this.removeTemporaryItem(t)}getLegacyLoginHint(){const e=this.getTemporaryCache(Lt.ADAL_ID_TOKEN);e&&(this.browserStorage.removeItem(Lt.ADAL_ID_TOKEN),this.logger.verbose("Cached ADAL id token retrieved."));const t=this.getTemporaryCache(Lt.ID_TOKEN,!0);t&&(this.browserStorage.removeItem(this.generateCacheKey(Lt.ID_TOKEN)),this.logger.verbose("Cached MSAL.js v1 id token retrieved"));const r=t||e;if(r){const o=Si(r,Kr);if(o.preferred_username)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint"),o.preferred_username;if(o.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),o.upn;this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.")}return null}updateCredentialCacheKey(e,t){const r=ha(t);if(e!==r){const o=this.getItem(e);if(o)return this.browserStorage.removeItem(e),this.setItem(r,o),this.logger.verbose(`Updated an outdated ${t.credentialType} cache key`),r;this.logger.error(`Attempted to update an outdated ${t.credentialType} cache key but no item matching the outdated key was found in storage`)}return e}async hydrateCache(e,t){var d,h,m;const r=au((d=e.account)==null?void 0:d.homeAccountId,(h=e.account)==null?void 0:h.environment,e.idToken,this.clientId,e.tenantId);let o;t.claims&&(o=await this.cryptoImpl.hashString(t.claims));const a=su((m=e.account)==null?void 0:m.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?e.expiresOn.getTime()/1e3:0,e.extExpiresOn?e.extExpiresOn.getTime()/1e3:0,Kr,void 0,e.tokenType,void 0,t.sshKid,t.claims,o),c={idToken:r,accessToken:a};return this.saveCacheRecord(c)}async saveCacheRecord(e,t,r){try{await super.saveCacheRecord(e,t,r)}catch(o){if(o instanceof pa&&this.performanceClient&&r)try{const a=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:a.refreshToken.length,cacheIdCount:a.idToken.length,cacheAtCount:a.accessToken.length},r)}catch{}throw o}}}const SH=(n,e)=>{const t={cacheLocation:vn.MemoryStorage,temporaryCacheLocation:vn.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new uf(n,t,Nl,e)};/*! @azure/msal-browser v3.28.1 2025-01-14 */function AH(n,e,t,r){return n.verbose("getAllAccounts called"),t?e.getAllAccounts(r):[]}function kH(n,e,t){if(e.trace("getAccount called"),Object.keys(n).length===0)return e.warning("getAccount: No accountFilter provided"),null;const r=t.getAccountInfoFilteredBy(n);return r?(e.verbose("getAccount: Account matching provided filter found, returning"),r):(e.verbose("getAccount: No matching account found, returning null"),null)}function NH(n,e,t){if(e.trace("getAccountByUsername called"),!n)return e.warning("getAccountByUsername: No username provided"),null;const r=t.getAccountInfoFilteredBy({username:n});return r?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${n}`),r):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function RH(n,e,t){if(e.trace("getAccountByHomeId called"),!n)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const r=t.getAccountInfoFilteredBy({homeAccountId:n});return r?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${n}`),r):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function OH(n,e,t){if(e.trace("getAccountByLocalId called"),!n)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const r=t.getAccountInfoFilteredBy({localAccountId:n});return r?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${n}`),r):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function PH(n,e){e.setActiveAccount(n)}function MH(n){return n.getActiveAccount()}/*! @azure/msal-browser v3.28.1 2025-01-14 */const me={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"};/*! @azure/msal-browser v3.28.1 2025-01-14 */class DH{constructor(e){this.eventCallbacks=new Map,this.logger=e||new Ko({})}addEventCallback(e,t,r){if(typeof window<"u"){const o=r||dH();return this.eventCallbacks.has(o)?(this.logger.error(`Event callback with id: ${o} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(o,[e,t||[]]),this.logger.verbose(`Event callback registered with id: ${o}`),o)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,t,r,o){if(typeof window<"u"){const a={eventType:e,interactionType:t||null,payload:r||null,error:o||null,timestamp:Date.now()};this.eventCallbacks.forEach(([c,d],h)=>{(d.length===0||d.includes(e))&&(this.logger.verbose(`Emitting event to callback ${h}: ${e}`),c.apply(null,[a]))})}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class NT{constructor(e,t,r,o,a,c,d,h,m){this.config=e,this.browserStorage=t,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=a,this.navigationClient=c,this.nativeMessageHandler=h,this.correlationId=m||go(),this.logger=o.clone(Dn.MSAL_SKU,pu,this.correlationId),this.performanceClient=d}async clearCacheOnLogout(e){if(e){Pt.accountInfoIsEqual(e,this.browserStorage.getActiveAccount(),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null));try{await this.browserStorage.removeAccount(Pt.generateAccountCacheKey(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),await this.browserStorage.clear(),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 t=e||this.config.auth.redirectUri;return De.getAbsoluteUrl(t,lo())}initializeServerTelemetryManager(e,t){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:t||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new Os(r,this.browserStorage)}async getDiscoveredAuthority(e){const{account:t}=e,r=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(x.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const o={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},a=e.requestAuthority||this.config.auth.authority,c=r!=null&&r.length?r==="true":this.config.auth.instanceAware,d=t&&c?this.config.auth.authority.replace(De.getDomainFromUrl(a),t.environment):a,h=Xt.generateAuthority(d,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),m=await Q(Bw,x.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(h,this.config.system.networkClient,this.browserStorage,o,this.logger,this.correlationId,this.performanceClient);if(t&&!m.isAlias(t.environment))throw Xe(Nw);return m}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const LH=32;async function xH(n,e,t){n.addQueueMeasurement(x.GeneratePkceCodes,t);const r=Ai(UH,x.GenerateCodeVerifier,e,n,t)(n,e,t),o=await Q(BH,x.GenerateCodeChallengeFromVerifier,e,n,t)(r,n,e,t);return{verifier:r,challenge:o}}function UH(n,e,t){try{const r=new Uint8Array(LH);return Ai(eH,x.GetRandomValues,e,n,t)(r),gu(r)}catch{throw ie(mm)}}async function BH(n,e,t,r){e.addQueueMeasurement(x.GenerateCodeChallengeFromVerifier,r);try{const o=await Q(TT,x.Sha256Digest,t,e,r)(n,e,r);return gu(new Uint8Array(o))}catch{throw ie(mm)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function Sm(n,e,t,r){t.addQueueMeasurement(x.InitializeBaseRequest,n.correlationId);const o=n.authority||e.auth.authority,a=[...n&&n.scopes||[]],c={...n,correlationId:n.correlationId,authority:o,scopes:a};if(!c.authenticationScheme)c.authenticationScheme=Ge.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(c.authenticationScheme===Ge.SSH){if(!n.sshJwk)throw Xe(cu);if(!n.sshKid)throw Xe(Sw)}r.verbose(`Authentication Scheme set to "${c.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&n.claims&&!vr.isEmptyObj(n.claims)&&(c.requestedClaimsHash=await bT(n.claims)),c}async function FH(n,e,t,r,o){r.addQueueMeasurement(x.InitializeSilentRequest,n.correlationId);const a=await Q(Sm,x.InitializeBaseRequest,o,r,n.correlationId)(n,t,r,o);return{...n,...a,account:e,forceRefresh:n.forceRefresh||!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Da extends NT{async initializeAuthorizationCodeRequest(e){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.correlationId);const t=await Q(xH,x.GeneratePkceCodes,this.logger,this.performanceClient,this.correlationId)(this.performanceClient,this.logger,this.correlationId),r={...e,redirectUri:e.redirectUri,code:F.EMPTY_STRING,codeVerifier:t.verifier};return e.codeChallenge=t.challenge,e.codeChallengeMethod=F.S256_CODE_CHALLENGE_METHOD,r}initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const t={correlationId:this.correlationId||go(),...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"),t.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",t.correlationId),t.postLogoutRedirectUri=De.getAbsoluteUrl(e.postLogoutRedirectUri,lo())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",t.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",t.correlationId),t.postLogoutRedirectUri=De.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,lo())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",t.correlationId),t.postLogoutRedirectUri=De.getAbsoluteUrl(lo(),lo())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",t.correlationId),t}getLogoutHintFromIdTokenClaims(e){const t=e.idTokenClaims;if(t){if(t.login_hint)return t.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(x.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const t=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new Hw(t,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:t,requestAuthority:r,requestAzureCloudOptions:o,requestExtraQueryParameters:a,account:c}=e;this.performanceClient.addQueueMeasurement(x.StandardInteractionClientGetClientConfiguration,this.correlationId);const d=await Q(this.getDiscoveredAuthority.bind(this),x.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:r,requestAzureCloudOptions:o,requestExtraQueryParameters:a,account:c}),h=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:d,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:h.loggerCallback,piiLoggingEnabled:h.piiLoggingEnabled,logLevel:h.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:t,libraryInfo:{sku:Dn.MSAL_SKU,version:pu,cpu:F.EMPTY_STRING,os:F.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,t){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),o={interactionType:t},a=yr.setRequestState(this.browserCrypto,e&&e.state||F.EMPTY_STRING,o),d={...await Q(Sm,x.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:a,nonce:e.nonce||go(),responseMode:this.config.auth.OIDCOptions.serverResponseType};if(e.loginHint||e.sid)return d;const h=e.account||this.browserStorage.getActiveAccount();if(h&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${h.homeAccountId}`,this.correlationId),d.account=h),!d.loginHint&&!h){const m=this.browserStorage.getLegacyLoginHint();m&&(d.loginHint=m)}return d}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const VH="ContentError",RT="user_switch";/*! @azure/msal-browser v3.28.1 2025-01-14 */const HH="USER_INTERACTION_REQUIRED",$H="USER_CANCEL",KH="NO_NETWORK",WH="PERSISTENT_ERROR",zH="DISABLED",GH="ACCOUNT_UNAVAILABLE";/*! @azure/msal-browser v3.28.1 2025-01-14 */const qH=-2147186943,jH={[RT]:"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 Br extends lt{constructor(e,t,r){super(e,t),Object.setPrototypeOf(this,Br.prototype),this.name="NativeAuthError",this.ext=r}}function sa(n){if(n.ext&&n.ext.status&&(n.ext.status===WH||n.ext.status===zH)||n.ext&&n.ext.error&&n.ext.error===qH)return!0;switch(n.errorCode){case VH:return!0;default:return!1}}function df(n,e,t){if(t&&t.status)switch(t.status){case GH:return tf(Fw);case HH:return new Er(n,e);case $H:return ie(bi);case KH:return ie(Ll)}return new Br(n,jH[n]||e,t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class OT extends Da{async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentCacheClientAcquireToken,e.correlationId);const t=this.initializeServerTelemetryManager(ot.acquireTokenSilent_silentFlow),r=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),o=new P2(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const c=(await Q(o.acquireCachedToken.bind(o),x.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),c}catch(a){throw a instanceof Ws&&a.errorCode===_m&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),a}}logout(e){this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(t==null?void 0:t.account)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class _a extends NT{constructor(e,t,r,o,a,c,d,h,m,g,v,p){var C;super(e,t,r,o,a,c,h,m,p),this.apiId=d,this.accountId=g,this.nativeMessageHandler=m,this.nativeStorageManager=v,this.silentCacheClient=new OT(e,this.nativeStorageManager,r,o,a,c,h,m,p),this.serverTelemetryManager=this.initializeServerTelemetryManager(this.apiId);const w=this.nativeMessageHandler.getExtensionId()===ma.PREFERRED_EXTENSION_ID?"chrome":(C=this.nativeMessageHandler.getExtensionId())!=null&&C.length?"unknown":void 0;this.skus=Os.makeExtraSkuString({libraryName:Dn.MSAL_SKU,libraryVersion:pu,extensionName:w,extensionVersion:this.nativeMessageHandler.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[g2]:this.skus}}async acquireToken(e){this.performanceClient.addQueueMeasurement(x.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const t=this.performanceClient.startMeasurement(x.NativeInteractionClientAcquireToken,e.correlationId),r=zr();try{const o=await this.initializeNativeRequest(e);try{const m=await this.acquireTokensFromCache(this.accountId,o);return t.end({success:!0,isNativeBroker:!1,fromCache:!0}),m}catch{this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const{...a}=o,c={method:gi.GetToken,request:a},d=await this.nativeMessageHandler.sendMessage(c),h=this.validateNativeResponse(d);return await this.handleNativeResponse(h,o,r).then(m=>(t.end({success:!0,isNativeBroker:!0,requestId:m.requestId}),this.serverTelemetryManager.clearNativeBrokerErrorCode(),m)).catch(m=>{throw t.end({success:!1,errorCode:m.errorCode,subErrorCode:m.subError,isNativeBroker:!0}),m})}catch(o){throw o instanceof Br&&this.serverTelemetryManager.setNativeBrokerErrorCode(o.errorCode),o}}createSilentCacheRequest(e,t){return{authority:e.authority,correlationId:this.correlationId,scopes:vt.fromString(e.scope).asArray(),account:t,forceRefresh:!1}}async acquireTokensFromCache(e,t){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),Y(Yh);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e});if(!r)throw Y(Yh);try{const o=this.createSilentCacheRequest(t,r),a=await this.silentCacheClient.acquireToken(o),c={...r,idTokenClaims:a==null?void 0:a.idTokenClaims,idToken:a==null?void 0:a.idToken};return{...a,account:c}}catch(o){throw o}}async acquireTokenRedirect(e,t){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...r}=e;delete r.onRedirectNavigate;const o=await this.initializeNativeRequest(r),a={method:gi.GetToken,request:o};try{const h=await this.nativeMessageHandler.sendMessage(a);this.validateNativeResponse(h)}catch(h){if(h instanceof Br&&(this.serverTelemetryManager.setNativeBrokerErrorCode(h.errorCode),sa(h)))throw h}this.browserStorage.setTemporaryCache(Ke.NATIVE_REQUEST,JSON.stringify(o),!0);const c={apiId:ot.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);t.end({success:!0}),await this.navigationClient.navigateExternal(d,c)}async handleRedirectPromise(e,t){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&&t&&(e==null||e.addFields({errorCode:"no_cached_request"},t)),null;const{prompt:o,...a}=r;o&&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(Ke.NATIVE_REQUEST));const c={method:gi.GetToken,request:a},d=zr();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const h=await this.nativeMessageHandler.sendMessage(c);this.validateNativeResponse(h);const m=this.handleNativeResponse(h,a,d);this.browserStorage.setInteractionInProgress(!1);const g=await m;return this.serverTelemetryManager.clearNativeBrokerErrorCode(),g}catch(h){throw this.browserStorage.setInteractionInProgress(!1),h}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,t,r){var g;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const o=Si(e.id_token,Kr),a=this.createHomeAccountIdentifier(e,o),c=(g=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:t.accountId}))==null?void 0:g.homeAccountId;if(a!==c&&e.account.id!==t.accountId)throw df(RT);const d=await this.getDiscoveredAuthority({requestAuthority:t.authority}),h=dm(this.browserStorage,d,a,Kr,o,e.client_info,void 0,o.tid,void 0,e.account.id,this.logger),m=await this.generateAuthenticationResult(e,t,o,h,d.canonicalAuthority,r);return this.cacheAccount(h),this.cacheNativeTokens(e,t,a,o,e.access_token,m.tenantId,r),m}createHomeAccountIdentifier(e,t){return Pt.generateHomeAccountId(e.client_info||F.EMPTY_STRING,mr.Default,this.logger,this.browserCrypto,t)}generateScopes(e,t){return e.scope?vt.fromString(e.scope):vt.fromString(t.scope)}async generatePopAccessToken(e,t){if(t.tokenType===Ge.POP&&t.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new Ia(this.browserCrypto),o={resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,shrNonce:t.shrNonce};if(!t.keyId)throw Y(Jf);return r.signPopToken(e.access_token,t.keyId,o)}else return e.access_token}async generateAuthenticationResult(e,t,r,o,a,c){const d=this.addTelemetryFromNativeResponse(e),h=e.scope?vt.fromString(e.scope):vt.fromString(t.scope),m=e.account.properties||{},g=m.UID||r.oid||r.sub||F.EMPTY_STRING,v=m.TenantId||r.tid||F.EMPTY_STRING,p=im(o.getAccountInfo(),void 0,r,e.id_token);p.nativeAccountId!==e.account.id&&(p.nativeAccountId=e.account.id);const w=await this.generatePopAccessToken(e,t),C=t.tokenType===Ge.POP?Ge.POP:Ge.BEARER;return{authority:a,uniqueId:g,tenantId:v,scopes:h.asArray(),account:p,idToken:e.id_token,idTokenClaims:r,accessToken:w,fromCache:d?this.isResponseFromCache(d):!1,expiresOn:new Date(Number(c+e.expires_in)*1e3),tokenType:C,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}cacheAccount(e){this.browserStorage.setAccount(e),this.browserStorage.removeAccountContext(e).catch(t=>{this.logger.error(`Error occurred while removing account context from browser storage. ${t}`)})}cacheNativeTokens(e,t,r,o,a,c,d){const h=au(r,t.authority,e.id_token||"",t.clientId,o.tid||""),m=t.tokenType===Ge.POP?F.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,g=d+m,v=this.generateScopes(e,t),p=su(r,t.authority,a,t.clientId,o.tid||c,v.printScopes(),g,0,Kr,void 0,t.tokenType,void 0,t.keyId),w={idToken:h,accessToken:p};this.nativeStorageManager.saveCacheRecord(w,t.storeInCache)}addTelemetryFromNativeResponse(e){const t=this.getMATSFromResponse(e);return t?(this.performanceClient.addFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:t.broker_version,matsAccountJoinOnStart:t.account_join_on_start,matsAccountJoinOnEnd:t.account_join_on_end,matsDeviceJoin:t.device_join,matsPromptBehavior:t.prompt_behavior,matsApiErrorCode:t.api_error_code,matsUiVisible:t.ui_visible,matsSilentCode:t.silent_code,matsSilentBiSubCode:t.silent_bi_sub_code,matsSilentMessage:t.silent_message,matsSilentStatus:t.silent_status,matsHttpStatus:t.http_status,matsHttpEventCount:t.http_event_count},this.correlationId),t):null}validateNativeResponse(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 YE(Wf,"Response missing expected properties.")}getMATSFromResponse(e){if(e.properties.MATS)try{return JSON.parse(e.properties.MATS)}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 t=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:t,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const r=new De(t);r.validateAsUri();const{scopes:o,...a}=e,c=new vt(o||[]);c.appendScopes(Ma);const d=()=>{switch(this.apiId){case ot.ssoSilent:case ot.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),Bt.NONE}if(!e.prompt){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e.prompt){case Bt.NONE:case Bt.CONSENT:case Bt.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e.prompt;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e.prompt} is not compatible with native flow`),ie(gT)}},h={...a,accountId:this.accountId,clientId:this.config.auth.clientId,authority:r.urlString,scope:c.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:d(),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(h.signPopToken&&e.popKid)throw ie(_T);if(this.handleExtraBrokerParams(h),h.extraParameters=h.extraParameters||{},h.extraParameters.telemetry=ma.MATS_TELEMETRY,e.authenticationScheme===Ge.POP){const m={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},g=new Ia(this.browserCrypto);let v;if(h.keyId)v=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:h.keyId})),h.signPopToken=!1;else{const p=await Q(g.generateCnf.bind(g),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(m,this.logger);v=p.reqCnfString,h.keyId=p.kid,h.signPopToken=!0}h.reqCnf=v}return this.addRequestSKUs(h),h}handleExtraBrokerParams(e){var a;const t=e.extraParameters&&e.extraParameters.hasOwnProperty(cm)&&e.extraParameters.hasOwnProperty(ef)&&e.extraParameters.hasOwnProperty(wi);if(!e.embeddedClientId&&!t)return;let r="";const o=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,r=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[ef],r=e.extraParameters[wi]),e.extraParameters={child_client_id:r,child_redirect_uri:o},(a=this.performanceClient)==null||a.addFields({embeddedClientId:r,embeddedRedirectUri:o},e.correlationId)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Fr{constructor(e,t,r,o){this.logger=e,this.handshakeTimeoutMs=t,this.extensionId=o,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(x.NativeMessageHandlerHandshake)}async sendMessage(e){this.logger.trace("NativeMessageHandler - sendMessage called.");const t={channel:ma.CHANNEL_ID,extensionId:this.extensionId,responseId:go(),body:e};return this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii(`NativeMessageHandler - Sending request to browser extension: ${JSON.stringify(t)}`),this.messageChannel.port1.postMessage(t),new Promise((r,o)=>{this.resolvers.set(t.responseId,{resolve:r,reject:o})})}static async createProvider(e,t,r){e.trace("NativeMessageHandler - createProvider called.");try{const o=new Fr(e,t,r,ma.PREFERRED_EXTENSION_ID);return await o.sendHandshakeRequest(),o}catch{const a=new Fr(e,t,r);return await a.sendHandshakeRequest(),a}}async sendHandshakeRequest(){this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:ma.CHANNEL_ID,extensionId:this.extensionId,responseId:go(),body:{method:gi.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=t=>{this.onChannelMessage(t)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((t,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:t,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(ie(hT)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source!==window)return;const t=e.data;if(!(!t.channel||t.channel!==ma.CHANNEL_ID)&&!(t.extensionId&&t.extensionId!==this.extensionId)&&t.body.method===gi.HandshakeRequest){const r=this.handshakeResolvers.get(t.responseId);if(!r){this.logger.trace(`NativeMessageHandler.onWindowMessage - resolver can't be found for request ${t.responseId}`);return}this.logger.verbose(t.extensionId?`Extension with id: ${t.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(ie(fT))}}onChannelMessage(e){this.logger.trace("NativeMessageHandler - onChannelMessage called.");const t=e.data,r=this.resolvers.get(t.responseId),o=this.handshakeResolvers.get(t.responseId);try{const a=t.body.method;if(a===gi.Response){if(!r)return;const c=t.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii(`NativeMessageHandler - Received response from browser extension: ${JSON.stringify(c)}`),c.status!=="Success")r.reject(df(c.code,c.description,c.ext));else if(c.result)c.result.code&&c.result.description?r.reject(df(c.result.code,c.result.description,c.result.ext)):r.resolve(c.result);else throw YE(Wf,"Event does not contain result.");this.resolvers.delete(t.responseId)}else if(a===gi.HandshakeResponse){if(!o){this.logger.trace(`NativeMessageHandler.onChannelMessage - resolver can't be found for request ${t.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=t.extensionId,this.extensionVersion=t.body.version,this.logger.verbose(`NativeMessageHandler - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),o.resolve(),this.handshakeResolvers.delete(t.responseId)}}catch(a){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${a}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(a):o&&o.reject(a)}}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}static isNativeAvailable(e,t,r,o){if(t.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return t.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!r)return t.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(o)switch(o){case Ge.BEARER:case Ge.POP:return t.trace("isNativeAvailable: authenticationScheme is supported, returning true"),!0;default:return t.trace("isNativeAvailable: authenticationScheme is not supported, returning false"),!1}return!0}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Am{constructor(e,t,r,o,a){this.authModule=e,this.browserStorage=t,this.authCodeRequest=r,this.logger=o,this.performanceClient=a}async handleCodeResponse(e,t){this.performanceClient.addQueueMeasurement(x.HandleCodeResponse,t.correlationId);let r;try{r=this.authModule.handleFragmentResponse(e,t.state)}catch(o){throw o instanceof Wo&&o.subError===bi?ie(bi):o}return Q(this.handleCodeResponseFromServer.bind(this),x.HandleCodeResponseFromServer,this.logger,this.performanceClient,t.correlationId)(r,t)}async handleCodeResponseFromServer(e,t,r=!0){if(this.performanceClient.addQueueMeasurement(x.HandleCodeResponseFromServer,t.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await Q(this.authModule.updateAuthority.bind(this.authModule),x.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,t.correlationId)(e.cloud_instance_host_name,t.correlationId),r&&(e.nonce=t.nonce||void 0),e.state=t.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const a=this.createCcsCredentials(t);a&&(this.authCodeRequest.ccsCredential=a)}return await Q(this.authModule.acquireToken.bind(this.authModule),x.AuthClientAcquireToken,this.logger,this.performanceClient,t.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:Bn.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:Bn.UPN}:null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function PT(n,e,t){const r=Pl(n);if(!r)throw Ow(n)?(t.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.`),t.errorPii(`The ${e} detected is: ${n}`),ie(Gw)):(t.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.`),ie(zw));return r}function YH(n,e,t){if(!n.state)throw ie(gm);const r=kT(e,n.state);if(!r)throw ie(qw);if(r.interactionType!==t)throw ie(jw)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class JH extends Da{constructor(e,t,r,o,a,c,d,h,m,g){super(e,t,r,o,a,c,d,m,g),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=h}acquireToken(e){try{const r={popupName:this.generatePopupName(e.scopes||Ma,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,r)):(this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),r.popup=this.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(e,r))}catch(t){return Promise.reject(t)}}logout(e){try{this.logger.verbose("logoutPopup called");const t=this.initializeLogoutRequest(e),r={popupName:this.generateLogoutPopupName(t),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},o=e&&e.authority,a=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(t,r,o,a)):(this.logger.verbose("asyncPopup set to false, opening popup"),r.popup=this.openSizedPopup("about:blank",r),this.logoutPopupAsync(t,r,o,a))}catch(t){return Promise.reject(t)}}async acquireTokenPopupAsync(e,t){var a;this.logger.verbose("acquireTokenPopupAsync called");const r=this.initializeServerTelemetryManager(ot.acquireTokenPopup),o=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,le.Popup);AT(o.authority);try{const c=await Q(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(o),d=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:o.authority,requestAzureCloudOptions:o.azureCloudOptions,requestExtraQueryParameters:o.extraQueryParameters,account:o.account}),h=Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme);let m;h&&(m=this.performanceClient.startMeasurement(x.FetchAccountIdWithNativeBroker,e.correlationId));const g=await d.getAuthCodeUrl({...o,nativeBroker:h}),v=new Am(d,this.browserStorage,c,this.logger,this.performanceClient),p=this.initiateAuthRequest(g,t);this.eventHandler.emitEvent(me.POPUP_OPENED,le.Popup,{popupWindow:p},null);const w=await this.monitorPopupForHash(p,t.popupWindowParent),C=Ai(PT,x.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(w,this.config.auth.OIDCOptions.serverResponseType,this.logger);if(Ur.removeThrottle(this.browserStorage,this.config.auth.clientId,c),C.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),m&&m.end({success:!0,isNativeBroker:!0}),!this.nativeMessageHandler)throw ie(Ks);const k=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,C.accountId,this.nativeStorage,o.correlationId),{userRequestState:I}=yr.parseRequestState(this.browserCrypto,o.state);return await k.acquireToken({...o,state:I,prompt:void 0})}return await v.handleCodeResponse(C,o)}catch(c){throw(a=t.popup)==null||a.close(),c instanceof lt&&(c.setCorrelationId(this.correlationId),r.cacheFailedRequest(c)),c}}async logoutPopupAsync(e,t,r,o){var c,d,h,m;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(me.LOGOUT_START,le.Popup,e);const a=this.initializeServerTelemetryManager(ot.logoutPopup);try{await this.clearCacheOnLogout(e.account);const g=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:a,requestAuthority:r,account:e.account||void 0});try{g.authority.endSessionEndpoint}catch{if((c=e.account)!=null&&c.homeAccountId&&e.postLogoutRedirectUri&&g.authority.protocolMode===fo.OIDC){if(this.browserStorage.removeAccount((d=e.account)==null?void 0:d.homeAccountId),this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Popup,e),o){const w={apiId:ot.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},C=De.getAbsoluteUrl(o,lo());await this.navigationClient.navigateInternal(C,w)}(h=t.popup)==null||h.close();return}}const v=g.getLogoutUri(e);this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Popup,e);const p=this.openPopup(v,t);if(this.eventHandler.emitEvent(me.POPUP_OPENED,le.Popup,{popupWindow:p},null),await this.monitorPopupForHash(p,t.popupWindowParent).catch(()=>{}),o){const w={apiId:ot.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},C=De.getAbsoluteUrl(o,lo());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${C}`),await this.navigationClient.navigateInternal(C,w)}else this.logger.verbose("No main window navigation requested")}catch(g){throw(m=t.popup)==null||m.close(),g instanceof lt&&(g.setCorrelationId(this.correlationId),a.cacheFailedRequest(g)),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(me.LOGOUT_FAILURE,le.Popup,null,g),this.eventHandler.emitEvent(me.LOGOUT_END,le.Popup),g}this.eventHandler.emitEvent(me.LOGOUT_END,le.Popup)}initiateAuthRequest(e,t){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,t);throw this.logger.error("Navigate url is empty"),ie(hu)}monitorPopupForHash(e,t){return new Promise((r,o)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const a=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(a),o(ie(bi));return}let c="";try{c=e.location.href}catch{}if(!c||c==="about:blank")return;clearInterval(a);let d="";const h=this.config.auth.OIDCOptions.serverResponseType;e&&(h===$s.QUERY?d=e.location.search:d=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),r(d)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,t)})}openPopup(e,t){try{let r;if(t.popup?(r=t.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):typeof t.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,t)),!r)throw ie(Qw);return r.focus&&r.focus(),this.currentWindow=r,t.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),r}catch(r){throw this.logger.error("error opening popup "+r.message),this.browserStorage.setInteractionInProgress(!1),ie(Jw)}}openSizedPopup(e,{popupName:t,popupWindowAttributes:r,popupWindowParent:o}){var w,C,T,k;const a=o.screenLeft?o.screenLeft:o.screenX,c=o.screenTop?o.screenTop:o.screenY,d=o.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,h=o.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let m=(w=r.popupSize)==null?void 0:w.width,g=(C=r.popupSize)==null?void 0:C.height,v=(T=r.popupPosition)==null?void 0:T.top,p=(k=r.popupPosition)==null?void 0:k.left;return(!m||m<0||m>d)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),m=Dn.POPUP_WIDTH),(!g||g<0||g>h)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),g=Dn.POPUP_HEIGHT),(!v||v<0||v>h)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),v=Math.max(0,h/2-Dn.POPUP_HEIGHT/2+c)),(!p||p<0||p>d)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),p=Math.max(0,d/2-Dn.POPUP_WIDTH/2+a)),o.open(e,t,`width=${m}, height=${g}, top=${v}, left=${p}, scrollbars=yes`)}unloadWindow(e){this.browserStorage.cleanRequestByInteractionType(le.Popup),this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,t){e.close(),t.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)}generatePopupName(e,t){return`${Dn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${t}.${this.correlationId}`}generateLogoutPopupName(e){const t=e.account&&e.account.homeAccountId;return`${Dn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${t}.${this.correlationId}`}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class fy{constructor(e,t,r,o,a){this.authModule=e,this.browserStorage=t,this.authCodeRequest=r,this.logger=o,this.performanceClient=a}async initiateAuthRequest(e,t){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){t.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache(Ke.ORIGIN_URI,t.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(Ke.CORRELATION_ID,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest),this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const r={apiId:ot.acquireTokenRedirect,timeout:t.redirectTimeout,noHistory:!1};if(typeof t.onRedirectNavigate=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),t.onRedirectNavigate(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await t.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 t.navigationClient.navigateExternal(e,r);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),ie(hu)}async handleCodeResponse(e,t){this.logger.verbose("RedirectHandler.handleCodeResponse called"),this.browserStorage.setInteractionInProgress(!1);const r=this.browserStorage.generateStateKey(t),o=this.browserStorage.getTemporaryCache(r);if(!o)throw Y(kl,"Cached State");let a;try{a=this.authModule.handleFragmentResponse(e,o)}catch(m){throw m instanceof Wo&&m.subError===bi?ie(bi):m}const c=this.browserStorage.generateNonceKey(o),d=this.browserStorage.getTemporaryCache(c);if(this.authCodeRequest.code=a.code,a.cloud_instance_host_name&&await Q(this.authModule.updateAuthority.bind(this.authModule),x.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,this.authCodeRequest.correlationId)(a.cloud_instance_host_name,this.authCodeRequest.correlationId),a.nonce=d||void 0,a.state=o,a.client_info)this.authCodeRequest.clientInfo=a.client_info;else{const m=this.checkCcsCredentials();m&&(this.authCodeRequest.ccsCredential=m)}const h=await this.authModule.acquireToken(this.authCodeRequest,a);return this.browserStorage.cleanRequestByState(t),h}checkCcsCredentials(){const e=this.browserStorage.getTemporaryCache(Ke.CCS_CREDENTIAL,!0);if(e)try{return JSON.parse(e)}catch{this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii(`Cache credential could not be parsed: ${e}`)}return null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function QH(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const n=window.performance.getEntriesByType("navigation"),e=n.length?n[0]:void 0;return e==null?void 0:e.type}class XH extends Da{constructor(e,t,r,o,a,c,d,h,m,g){super(e,t,r,o,a,c,d,m,g),this.nativeStorage=h}async acquireToken(e){const t=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,le.Redirect);this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||"",t.account||null);const r=this.initializeServerTelemetryManager(ot.acquireTokenRedirect),o=a=>{a.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.cleanRequestByState(t.state),this.eventHandler.emitEvent(me.RESTORE_FROM_BFCACHE,le.Redirect))};try{const a=await Q(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(t),c=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),d=new fy(c,this.browserStorage,a,this.logger,this.performanceClient),h=await c.getAuthCodeUrl({...t,nativeBroker:Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme)}),m=this.getRedirectStartPage(e.redirectStartPage);return this.logger.verbosePii(`Redirect start page: ${m}`),window.addEventListener("pageshow",o),await d.initiateAuthRequest(h,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:m,onRedirectNavigate:e.onRedirectNavigate||this.config.auth.onRedirectNavigate})}catch(a){throw a instanceof lt&&(a.setCorrelationId(this.correlationId),r.cacheFailedRequest(a)),window.removeEventListener("pageshow",o),this.browserStorage.cleanRequestByState(t.state),a}}async handleRedirectPromise(e="",t){const r=this.initializeServerTelemetryManager(ot.handleRedirectPromise);try{if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const[o,a]=this.getRedirectResponse(e||"");if(!o)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(le.Redirect),QH()!=="back_forward"?t.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const c=this.browserStorage.getTemporaryCache(Ke.ORIGIN_URI,!0)||F.EMPTY_STRING,d=De.removeHashFromUrl(c),h=De.removeHashFromUrl(window.location.href);if(d===h&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),c.indexOf("#")>-1&&iH(c),await this.handleResponse(o,r);if(this.config.auth.navigateToLoginRequestUrl){if(!Tm()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(Ke.URL_HASH,a,!0);const m={apiId:ot.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let g=!0;if(!c||c==="null"){const v=sH();this.browserStorage.setTemporaryCache(Ke.ORIGIN_URI,v,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),g=await this.navigationClient.navigateInternal(v,m)}else this.logger.verbose(`Navigating to loginRequestUrl: ${c}`),g=await this.navigationClient.navigateInternal(c,m);if(!g)return await this.handleResponse(o,r)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(o,r);return null}catch(o){throw o instanceof lt&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),this.browserStorage.cleanRequestByInteractionType(le.Redirect),o}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let t=e;t||(this.config.auth.OIDCOptions.serverResponseType===$s.QUERY?t=window.location.search:t=window.location.hash);let r=Pl(t);if(r){try{YH(r,this.browserCrypto,le.Redirect)}catch(a){return a instanceof lt&&this.logger.error(`Interaction type validation failed due to ${a.errorCode}: ${a.errorMessage}`),[null,""]}return oH(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,t]}const o=this.browserStorage.getTemporaryCache(Ke.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(Ke.URL_HASH)),o&&(r=Pl(o),r)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[r,o]):[null,""]}async handleResponse(e,t){const r=e.state;if(!r)throw ie(gm);const o=this.browserStorage.getCachedRequest(r);if(this.logger.verbose("handleResponse called, retrieved cached request"),e.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw ie(Ks);const h=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,e.accountId,this.nativeStorage,o.correlationId),{userRequestState:m}=yr.parseRequestState(this.browserCrypto,r);return h.acquireToken({...o,state:m,prompt:void 0}).finally(()=>{this.browserStorage.cleanRequestByState(r)})}const a=this.browserStorage.getCachedAuthority(r);if(!a)throw ie(pm);const c=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:a});return Ur.removeThrottle(this.browserStorage,this.config.auth.clientId,o),new fy(c,this.browserStorage,o,this.logger,this.performanceClient).handleCodeResponse(e,r)}async logout(e){var o,a;this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(ot.logout);try{this.eventHandler.emitEvent(me.LOGOUT_START,le.Redirect,e),await this.clearCacheOnLogout(t.account);const c={apiId:ot.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(d.authority.protocolMode===fo.OIDC)try{d.authority.endSessionEndpoint}catch{if((o=t.account)!=null&&o.homeAccountId){this.browserStorage.removeAccount((a=t.account)==null?void 0:a.homeAccountId),this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Redirect,t);return}}const h=d.getLogoutUri(t);if(this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Redirect,t),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(h)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(h,c);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(h,c);return}}catch(c){throw c instanceof lt&&(c.setCorrelationId(this.correlationId),r.cacheFailedRequest(c)),this.eventHandler.emitEvent(me.LOGOUT_FAILURE,le.Redirect,null,c),this.eventHandler.emitEvent(me.LOGOUT_END,le.Redirect),c}this.eventHandler.emitEvent(me.LOGOUT_END,le.Redirect)}getRedirectStartPage(e){const t=e||window.location.href;return De.getAbsoluteUrl(t,lo())}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function ZH(n,e,t,r,o){if(e.addQueueMeasurement(x.SilentHandlerInitiateAuthRequest,r),!n)throw t.info("Navigate url is empty"),ie(hu);return o?Q(t$,x.SilentHandlerLoadFrame,t,e,r)(n,o,e,r):Ai(n$,x.SilentHandlerLoadFrameSync,t,e,r)(n)}async function e$(n,e,t,r,o,a,c){return r.addQueueMeasurement(x.SilentHandlerMonitorIframeForHash,a),new Promise((d,h)=>{e<cf&&o.warning(`system.loadFrameTimeout or system.iframeHashTimeout set to lower (${e}ms) than the default (${cf}ms). This may result in timeouts.`);const m=window.setTimeout(()=>{window.clearInterval(g),h(ie(Xw))},e),g=window.setInterval(()=>{let v="";const p=n.contentWindow;try{v=p?p.location.href:""}catch{}if(!v||v==="about:blank")return;let w="";p&&(c===$s.QUERY?w=p.location.search:w=p.location.hash),window.clearTimeout(m),window.clearInterval(g),d(w)},t)}).finally(()=>{Ai(r$,x.RemoveHiddenIframe,o,r,a)(n)})}function t$(n,e,t,r){return t.addQueueMeasurement(x.SilentHandlerLoadFrame,r),new Promise((o,a)=>{const c=MT();window.setTimeout(()=>{if(!c){a("Unable to load iframe");return}c.src=n,o(c)},e)})}function n$(n){const e=MT();return e.src=n,e}function MT(){const n=document.createElement("iframe");return n.className="msalSilentIframe",n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height="0",n.style.border="0",n.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(n),n}function r$(n){document.body===n.parentNode&&document.body.removeChild(n)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class o$ extends Da{constructor(e,t,r,o,a,c,d,h,m,g,v){super(e,t,r,o,a,c,h,g,v),this.apiId=d,this.nativeStorage=m}async acquireToken(e){this.performanceClient.addQueueMeasurement(x.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 t={...e};t.prompt?t.prompt!==Bt.NONE&&t.prompt!==Bt.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${t.prompt} with ${Bt.NONE}`),t.prompt=Bt.NONE):t.prompt=Bt.NONE;const r=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,le.Silent);AT(r.authority);const o=this.initializeServerTelemetryManager(this.apiId);let a;try{return a=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:o,requestAuthority:r.authority,requestAzureCloudOptions:r.azureCloudOptions,requestExtraQueryParameters:r.extraQueryParameters,account:r.account}),await Q(this.silentTokenHelper.bind(this),x.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(a,r)}catch(c){if(c instanceof lt&&(c.setCorrelationId(this.correlationId),o.cacheFailedRequest(c)),!a||!(c instanceof lt)||c.errorCode!==Dn.INVALID_GRANT_ERROR)throw c;this.performanceClient.addFields({retryError:c.errorCode},this.correlationId);const d=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,le.Silent);return await Q(this.silentTokenHelper.bind(this),x.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(a,d)}}logout(){return Promise.reject(ie(fu))}async silentTokenHelper(e,t){const r=t.correlationId;this.performanceClient.addQueueMeasurement(x.SilentIframeClientTokenHelper,r);const o=await Q(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,r)(t),a=await Q(e.getAuthCodeUrl.bind(e),x.GetAuthCodeUrl,this.logger,this.performanceClient,r)({...t,nativeBroker:Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,t.authenticationScheme)}),c=new Am(e,this.browserStorage,o,this.logger,this.performanceClient),d=await Q(ZH,x.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(a,this.performanceClient,this.logger,r,this.config.system.navigateFrameWait),h=this.config.auth.OIDCOptions.serverResponseType,m=await Q(e$,x.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(d,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,h),g=Ai(PT,x.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(m,h,this.logger);if(g.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw ie(Ks);const v=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,g.accountId,this.browserStorage,r),{userRequestState:p}=yr.parseRequestState(this.browserCrypto,t.state);return Q(v.acquireToken.bind(v),x.NativeInteractionClientAcquireToken,this.logger,this.performanceClient,r)({...t,state:p,prompt:t.prompt||Bt.NONE})}return Q(c.handleCodeResponse.bind(c),x.HandleCodeResponse,this.logger,this.performanceClient,r)(g,t)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class i$ extends Da{async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentRefreshClientAcquireToken,e.correlationId);const t=await Q(Sm,x.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),r={...e,...t};e.redirectUri&&(r.redirectUri=this.getRedirectUri(e.redirectUri));const o=this.initializeServerTelemetryManager(ot.acquireTokenSilent_silentFlow),a=await this.createRefreshTokenClient({serverTelemetryManager:o,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return Q(a.acquireTokenByRefreshToken.bind(a),x.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r).catch(c=>{throw c.setCorrelationId(this.correlationId),o.cacheFailedRequest(c),c})}logout(){return Promise.reject(ie(fu))}async createRefreshTokenClient(e){const t=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new nf(t,this.performanceClient)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class a${constructor(e,t,r,o){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=t,this.logger=r,this.cryptoObj=o}loadExternalTokens(e,t,r){if(!this.isBrowserEnvironment)throw ie(mu);const o=t.id_token?Si(t.id_token,Kr):void 0,a={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},c=e.authority?new Xt(Xt.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,a,this.logger,e.correlationId||go()):void 0,d=this.loadAccount(e,r.clientInfo||t.client_info||"",o,c),h=this.loadIdToken(t,d.homeAccountId,d.environment,d.realm),m=this.loadAccessToken(e,t,d.homeAccountId,d.environment,d.realm,r),g=this.loadRefreshToken(t,d.homeAccountId,d.environment);return this.generateAuthenticationResult(e,{account:d,idToken:h,accessToken:m,refreshToken:g},o,c)}loadAccount(e,t,r,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const h=Pt.createFromAccountInfo(e.account);return this.storage.setAccount(h),h}else if(!o||!t&&!r)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),ie(sT);const a=Pt.generateHomeAccountId(t,o.authorityType,this.logger,this.cryptoObj,r),c=r==null?void 0:r.tid,d=dm(this.storage,o,a,Kr,r,t,o.hostnameAndPort,c,void 0,void 0,this.logger);return this.storage.setAccount(d),d}loadIdToken(e,t,r,o){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const a=au(t,r,e.id_token,this.config.auth.clientId,o);return this.storage.setIdTokenCredential(a),a}loadAccessToken(e,t,r,o,a,c){if(t.access_token)if(t.expires_in){if(!t.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 d=t.scope?vt.fromString(t.scope):new vt(e.scopes),h=c.expiresOn||t.expires_in+new Date().getTime()/1e3,m=c.extendedExpiresOn||(t.ext_expires_in||t.expires_in)+new Date().getTime()/1e3,g=su(r,o,t.access_token,this.config.auth.clientId,a,d.printScopes(),h,m,Kr);return this.storage.setAccessTokenCredential(g),g}loadRefreshToken(e,t,r){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const o=gw(t,r,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return this.storage.setRefreshTokenCredential(o),o}generateAuthenticationResult(e,t,r,o){var g,v,p;let a="",c=[],d=null,h;t!=null&&t.accessToken&&(a=t.accessToken.secret,c=vt.fromString(t.accessToken.target).asArray(),d=new Date(Number(t.accessToken.expiresOn)*1e3),h=new Date(Number(t.accessToken.extendedExpiresOn)*1e3));const m=t.account;return{authority:o?o.canonicalAuthority:"",uniqueId:t.account.localAccountId,tenantId:t.account.realm,scopes:c,account:m.getAccountInfo(),idToken:((g=t.idToken)==null?void 0:g.secret)||"",idTokenClaims:r||{},accessToken:a,fromCache:!0,expiresOn:d,correlationId:e.correlationId||"",requestId:"",extExpiresOn:h,familyId:((v=t.refreshToken)==null?void 0:v.familyId)||"",tokenType:((p=t==null?void 0:t.accessToken)==null?void 0:p.tokenType)||"",state:e.state||"",cloudGraphHostName:m.cloudGraphHostName||"",msGraphHost:m.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class s$ extends Hw{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class c$ extends Da{constructor(e,t,r,o,a,c,d,h,m,g){super(e,t,r,o,a,c,h,m,g),this.apiId=d}async acquireToken(e){if(!e.code)throw ie(cT);const t=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,le.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const o={...t,code:e.code},a=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),c=new s$(a);this.logger.verbose("Auth code client created");const d=new Am(c,this.browserStorage,o,this.logger,this.performanceClient);return await Q(d.handleCodeResponseFromServer.bind(d),x.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},t,!1)}catch(o){throw o instanceof lt&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),o}}logout(){return Promise.reject(ie(fu))}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function Dr(n){const e=n==null?void 0:n.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function Yc(n,e){try{bm(n)}catch(t){throw e.end({success:!1},t),t}}class _u{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 Sa(this.logger,this.performanceClient):Nl,this.eventHandler=new DH(this.logger),this.browserStorage=this.isBrowserEnvironment?new uf(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,w2(this.config.auth),this.performanceClient):SH(this.config.auth.clientId,this.logger);const t={cacheLocation:vn.MemoryStorage,temporaryCacheLocation:vn.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new uf(this.config.auth.clientId,t,this.browserCrypto,this.logger,void 0,this.performanceClient),this.tokenCache=new a$(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this),this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}static async createController(e,t){const r=new _u(e);return await r.initialize(t),r}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e){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(me.INITIALIZE_END);return}const t=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),r=this.config.system.allowNativeBroker,o=this.performanceClient.startMeasurement(x.InitializeClientApplication,t);if(this.eventHandler.emitEvent(me.INITIALIZE_START),r)try{this.nativeExtensionProvider=await Fr.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout,this.performanceClient)}catch(a){this.logger.verbose(a)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),await Q(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),x.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,t)(this.performanceClient,t)),this.initialized=!0,this.eventHandler.emitEvent(me.INITIALIZE_END),o.end({allowNativeBroker:r,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),ST(this.initialized),this.isBrowserEnvironment){const t=e||"";let r=this.redirectResponse.get(t);return typeof r>"u"?(r=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(t,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){const t=this.getAllAccounts(),r=this.browserStorage.getCachedNativeRequest(),o=r&&Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!e,a=o?r==null?void 0:r.correlationId:this.browserStorage.getTemporaryCache(Ke.CORRELATION_ID,!0)||"",c=this.performanceClient.startMeasurement(x.AcquireTokenRedirect,a);this.eventHandler.emitEvent(me.HANDLE_REDIRECT_START,le.Redirect);let d;if(o&&this.nativeExtensionProvider){this.logger.trace("handleRedirectPromise - acquiring token from native platform");const h=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.handleRedirectPromise,this.performanceClient,this.nativeExtensionProvider,r.accountId,this.nativeInternalStorage,r.correlationId);d=Q(h.handleRedirectPromise.bind(h),x.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,c.event.correlationId)(this.performanceClient,c.event.correlationId)}else{this.logger.trace("handleRedirectPromise - acquiring token from web flow");const h=this.createRedirectClient(a);d=Q(h.handleRedirectPromise.bind(h),x.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,c.event.correlationId)(e,c)}return d.then(h=>(h?(t.length<this.getAllAccounts().length?(this.eventHandler.emitEvent(me.LOGIN_SUCCESS,le.Redirect,h),this.logger.verbose("handleRedirectResponse returned result, login success")):(this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_SUCCESS,le.Redirect,h),this.logger.verbose("handleRedirectResponse returned result, acquire token success")),c.end({success:!0,accountType:Dr(h.account)})):c.event.errorCode?c.end({success:!1}):c.discard(),this.eventHandler.emitEvent(me.HANDLE_REDIRECT_END,le.Redirect),h)).catch(h=>{const m=h;throw t.length>0?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Redirect,null,m):this.eventHandler.emitEvent(me.LOGIN_FAILURE,le.Redirect,null,m),this.eventHandler.emitEvent(me.HANDLE_REDIRECT_END,le.Redirect),c.end({success:!1},m),h})}async acquireTokenRedirect(e){const t=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",t);const r=this.performanceClient.startMeasurement(x.AcquireTokenPreRedirect,t);r.add({accountType:Dr(e.account),scenarioId:e.scenarioId});const o=e.onRedirectNavigate;if(o)e.onRedirectNavigate=c=>{const d=typeof o=="function"?o(c):void 0;return d!==!1?r.end({success:!0}):r.discard(),d};else{const c=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=d=>{const h=typeof c=="function"?c(d):void 0;return h!==!1?r.end({success:!0}):r.discard(),h}}const a=this.getAllAccounts().length>0;try{ly(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),a?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_START,le.Redirect,e):this.eventHandler.emitEvent(me.LOGIN_START,le.Redirect,e);let c;return this.nativeExtensionProvider&&this.canUseNative(e)?c=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenRedirect,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(e),this.nativeInternalStorage,t).acquireTokenRedirect(e,r).catch(h=>{if(h instanceof Br&&sa(h))return this.nativeExtensionProvider=void 0,this.createRedirectClient(t).acquireToken(e);if(h instanceof Er)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),h}):c=this.createRedirectClient(t).acquireToken(e),await c}catch(c){throw r.end({success:!1},c),a?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Redirect,null,c):this.eventHandler.emitEvent(me.LOGIN_FAILURE,le.Redirect,null,c),c}}acquireTokenPopup(e){const t=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(x.AcquireTokenPopup,t);r.add({scenarioId:e.scenarioId,accountType:Dr(e.account)});try{this.logger.verbose("acquireTokenPopup called",t),Yc(this.initialized,r),this.browserStorage.setInteractionInProgress(!0)}catch(c){return Promise.reject(c)}const o=this.getAllAccounts();o.length>0?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_START,le.Popup,e):this.eventHandler.emitEvent(me.LOGIN_START,le.Popup,e);let a;return this.canUseNative(e)?a=this.acquireTokenNative({...e,correlationId:t},ot.acquireTokenPopup).then(c=>(this.browserStorage.setInteractionInProgress(!1),r.end({success:!0,isNativeBroker:!0,accountType:Dr(c.account)}),c)).catch(c=>{if(c instanceof Br&&sa(c))return this.nativeExtensionProvider=void 0,this.createPopupClient(t).acquireToken(e);if(c instanceof Er)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),c}):a=this.createPopupClient(t).acquireToken(e),a.then(c=>(o.length<this.getAllAccounts().length?this.eventHandler.emitEvent(me.LOGIN_SUCCESS,le.Popup,c):this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_SUCCESS,le.Popup,c),r.end({success:!0,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Dr(c.account)}),c)).catch(c=>(o.length>0?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Popup,null,c):this.eventHandler.emitEvent(me.LOGIN_FAILURE,le.Popup,null,c),r.end({success:!1},c),Promise.reject(c)))}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){var a,c;const t=this.getRequestCorrelationId(e),r={...e,prompt:e.prompt,correlationId:t};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(x.SsoSilent,t),(a=this.ssoSilentMeasurement)==null||a.add({scenarioId:e.scenarioId,accountType:Dr(e.account)}),Yc(this.initialized,this.ssoSilentMeasurement),(c=this.ssoSilentMeasurement)==null||c.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",t),this.eventHandler.emitEvent(me.SSO_SILENT_START,le.Silent,r);let o;return this.canUseNative(r)?o=this.acquireTokenNative(r,ot.ssoSilent).catch(d=>{if(d instanceof Br&&sa(d))return this.nativeExtensionProvider=void 0,this.createSilentIframeClient(r.correlationId).acquireToken(r);throw d}):o=this.createSilentIframeClient(r.correlationId).acquireToken(r),o.then(d=>{var h;return this.eventHandler.emitEvent(me.SSO_SILENT_SUCCESS,le.Silent,d),(h=this.ssoSilentMeasurement)==null||h.end({success:!0,isNativeBroker:d.fromNativeBroker,accessTokenSize:d.accessToken.length,idTokenSize:d.idToken.length,accountType:Dr(d.account)}),d}).catch(d=>{var h;throw this.eventHandler.emitEvent(me.SSO_SILENT_FAILURE,le.Silent,null,d),(h=this.ssoSilentMeasurement)==null||h.end({success:!1},d),d}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const t=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",t);const r=this.performanceClient.startMeasurement(x.AcquireTokenByCode,t);Yc(this.initialized,r),this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_START,le.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw ie(uT);if(e.code){const o=e.code;let a=this.hybridAuthCodeResponses.get(o);return a?(this.logger.verbose("Existing acquireTokenByCode request found",t),r.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",t),a=this.acquireTokenByCodeAsync({...e,correlationId:t}).then(c=>(this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_SUCCESS,le.Silent,c),this.hybridAuthCodeResponses.delete(o),r.end({success:!0,isNativeBroker:c.fromNativeBroker,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Dr(c.account)}),c)).catch(c=>{throw this.hybridAuthCodeResponses.delete(o),this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_FAILURE,le.Silent,null,c),r.end({success:!1},c),c}),this.hybridAuthCodeResponses.set(o,a)),await a}else if(e.nativeAccountId)if(this.canUseNative(e,e.nativeAccountId)){const o=await this.acquireTokenNative({...e,correlationId:t},ot.acquireTokenByCode,e.nativeAccountId).catch(a=>{throw a instanceof Br&&sa(a)&&(this.nativeExtensionProvider=void 0),a});return r.end({accountType:Dr(o.account),success:!0}),o}else throw ie(dT);else throw ie(lT)}catch(o){throw this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_FAILURE,le.Silent,null,o),r.end({success:!1},o),o}}async acquireTokenByCodeAsync(e){var o;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(x.AcquireTokenByCodeAsync,e.correlationId),(o=this.acquireTokenByCodeAsyncMeasurement)==null||o.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(a=>{var c;return(c=this.acquireTokenByCodeAsyncMeasurement)==null||c.end({success:!0,fromCache:a.fromCache,isNativeBroker:a.fromNativeBroker}),a}).catch(a=>{var c;throw(c=this.acquireTokenByCodeAsyncMeasurement)==null||c.end({success:!1},a),a}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,t){switch(this.performanceClient.addQueueMeasurement(x.AcquireTokenFromCache,e.correlationId),t){case Pn.Default:case Pn.AccessToken:case Pn.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return Q(r.acquireToken.bind(r),x.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Y(co)}}async acquireTokenByRefreshToken(e,t){switch(this.performanceClient.addQueueMeasurement(x.AcquireTokenByRefreshToken,e.correlationId),t){case Pn.Default:case Pn.AccessTokenAndRefreshToken:case Pn.RefreshToken:case Pn.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return Q(r.acquireToken.bind(r),x.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Y(co)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(x.AcquireTokenBySilentIframe,e.correlationId);const t=this.createSilentIframeClient(e.correlationId);return Q(t.acquireToken.bind(t),x.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const t=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",t),this.logoutRedirect({correlationId:t,...e})}async logoutRedirect(e){const t=this.getRequestCorrelationId(e);return ly(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),this.createRedirectClient(t).logout(e)}logoutPopup(e){try{const t=this.getRequestCorrelationId(e);return bm(this.initialized),this.browserStorage.setInteractionInProgress(!0),this.createPopupClient(t).logout(e)}catch(t){return Promise.reject(t)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const t=this.getRequestCorrelationId(e);return this.createSilentCacheClient(t).logout(e)}getAllAccounts(e){return AH(this.logger,this.browserStorage,this.isBrowserEnvironment,e)}getAccount(e){return kH(e,this.logger,this.browserStorage)}getAccountByUsername(e){return NH(e,this.logger,this.browserStorage)}getAccountByHomeId(e){return RH(e,this.logger,this.browserStorage)}getAccountByLocalId(e){return OH(e,this.logger,this.browserStorage)}setActiveAccount(e){PH(e,this.browserStorage)}getActiveAccount(){return MH(this.browserStorage)}async hydrateCache(e,t){this.logger.verbose("hydrateCache called");const r=Pt.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return this.browserStorage.setAccount(r),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,t)):this.browserStorage.hydrateCache(e,t)}async acquireTokenNative(e,t,r){if(this.logger.trace("acquireTokenNative called"),!this.nativeExtensionProvider)throw ie(Ks);return new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,t,this.performanceClient,this.nativeExtensionProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e)}canUseNative(e,t){if(this.logger.trace("canUseNative called"),!Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme))return this.logger.trace("canUseNative: isNativeAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case Bt.NONE:case Bt.CONSENT:case Bt.LOGIN:this.logger.trace("canUseNative: prompt is compatible with native flow");break;default:return this.logger.trace(`canUseNative: prompt = ${e.prompt} is not compatible with native flow, returning false`),!1}return!t&&!this.getNativeAccountId(e)?(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const t=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return t&&t.nativeAccountId||""}createPopupClient(e){return new JH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createRedirectClient(e){return new XH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentIframeClient(e){return new o$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentCacheClient(e){return new OT(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentRefreshClient(e){return new i$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentAuthCodeClient(e){return new c$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenByCode,this.performanceClient,this.nativeExtensionProvider,e)}addEventCallback(e,t){return this.eventHandler.addEventCallback(e,t)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return IT(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?this.logger.verbose("Account storage listener already registered."):(this.logger.verbose("Adding account storage listener."),this.listeningToStorageEvents=!0,window.addEventListener("storage",this.handleAccountCacheChange)))}disableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?(this.logger.verbose("Removing account storage listener."),window.removeEventListener("storage",this.handleAccountCacheChange),this.listeningToStorageEvents=!1):this.logger.verbose("No account storage listener registered."))}handleAccountCacheChange(e){var t;try{(t=e.key)!=null&&t.includes(Lt.ACTIVE_ACCOUNT_FILTERS)&&this.eventHandler.emitEvent(me.ACTIVE_ACCOUNT_CHANGED);const r=e.newValue||e.oldValue;if(!r)return;const o=JSON.parse(r);if(typeof o!="object"||!Pt.isAccountEntity(o))return;const c=ba.toObject(new Pt,o).getAccountInfo();!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.eventHandler.emitEvent(me.ACCOUNT_ADDED,void 0,c)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.eventHandler.emitEvent(me.ACCOUNT_REMOVED,void 0,c))}catch{return}}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,t){this.browserStorage.setWrapperMetadata(e,t)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?go():F.EMPTY_STRING}async loginRedirect(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",t),this.acquireTokenRedirect({correlationId:t,...e||ay})}loginPopup(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",t),this.acquireTokenPopup({correlationId:t,...e||ay})}async acquireTokenSilent(e){const t=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(x.AcquireTokenSilent,t);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),Yc(this.initialized,r),this.logger.verbose("acquireTokenSilent called",t);const o=e.account||this.getActiveAccount();if(!o)throw ie(nT);r.add({accountType:Dr(o)});const a={clientId:this.config.auth.clientId,authority:e.authority||F.EMPTY_STRING,scopes:e.scopes,homeAccountIdentifier:o.homeAccountId,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,shrOptions:e.shrOptions},c=JSON.stringify(a),d=this.activeSilentTokenRequests.get(c);if(typeof d>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",t);const h=Q(this.acquireTokenSilentAsync.bind(this),x.AcquireTokenSilentAsync,this.logger,this.performanceClient,t)({...e,correlationId:t},o).then(m=>(this.activeSilentTokenRequests.delete(c),r.end({success:!0,fromCache:m.fromCache,isNativeBroker:m.fromNativeBroker,cacheLookupPolicy:e.cacheLookupPolicy,accessTokenSize:m.accessToken.length,idTokenSize:m.idToken.length}),m)).catch(m=>{throw this.activeSilentTokenRequests.delete(c),r.end({success:!1},m),m});return this.activeSilentTokenRequests.set(c,h),{...await h,state:e.state}}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",t),r.discard(),{...await d,state:e.state}}async acquireTokenSilentAsync(e,t){const r=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(x.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_START,le.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const o=await Q(FH,x.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,t,this.config,this.performanceClient,this.logger),a=e.cacheLookupPolicy||Pn.Default;return this.acquireTokenSilentNoIframe(o,a).catch(async d=>{if(l$(d,a))if(this.activeIframeRequest)if(a!==Pn.Skip){const[m,g]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${g}`,o.correlationId);const v=this.performanceClient.startMeasurement(x.AwaitConcurrentIframe,o.correlationId);v.add({awaitIframeCorrelationId:g});const p=await m;if(v.end({success:p}),p)return this.logger.verbose(`Parallel iframe request with correlationId: ${g} succeeded. Retrying cache and/or RT redemption`,o.correlationId),this.acquireTokenSilentNoIframe(o,a);throw this.logger.info(`Iframe request with correlationId: ${g} failed. Interaction is required.`),d}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.",o.correlationId),Q(this.acquireTokenBySilentIframe.bind(this),x.AcquireTokenBySilentIframe,this.logger,this.performanceClient,o.correlationId)(o);else{let m;return this.activeIframeRequest=[new Promise(g=>{m=g}),o.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",o.correlationId),Q(this.acquireTokenBySilentIframe.bind(this),x.AcquireTokenBySilentIframe,this.logger,this.performanceClient,o.correlationId)(o).then(g=>(m(!0),g)).catch(g=>{throw m(!1),g}).finally(()=>{this.activeIframeRequest=void 0})}else throw d}).then(d=>(this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_SUCCESS,le.Silent,d),e.correlationId&&this.performanceClient.addFields({fromCache:d.fromCache,isNativeBroker:d.fromNativeBroker},e.correlationId),d)).catch(d=>{throw this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Silent,null,d),d}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,t){return Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,ot.acquireTokenSilent_silentFlow).catch(async r=>{throw r instanceof Br&&sa(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,Y(co)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),Q(this.acquireTokenFromCache.bind(this),x.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,t).catch(r=>{if(t===Pn.AccessToken)throw r;return this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_NETWORK_START,le.Silent,e),Q(this.acquireTokenByRefreshToken.bind(this),x.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,t)}))}}function l$(n,e){const t=!(n instanceof Er&&n.subError!==du),r=n.errorCode===Dn.INVALID_GRANT_ERROR||n.errorCode===co,o=t&&r||n.errorCode===Dl||n.errorCode===um,a=G2.includes(e);return o&&a}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function u$(n,e){const t=new Ii(n);return await t.initialize(),_u.createController(t,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class km{static async createPublicClientApplication(e){const t=await u$(e);return new km(e,t)}constructor(e,t){this.controller=t||new _u(new Ii(e))}async initialize(e){return this.controller.initialize(e)}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,t){return this.controller.addEventCallback(e,t)}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,t){return this.controller.initializeWrapperLibrary(e,t)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,t){return this.controller.hydrateCache(e,t)}clearCache(e){return this.controller.clearCache(e)}}const lh=process.env.JPLAN_WEBAPP__APP_PROXY_TENANT_NAME??"",d$=process.env.JPLAN_WEBAPP__APP_PROXY_CLIENT_ID??"",h$=process.env.JPLAN_WEBAPP__APP_PROXY_USER_FLOW??"",hf=process.env.JPLAN_WEBAPP__URL_AUTH??process.env.JPLAN_WEBAPP__URL_BASE??"",f$={auth:{clientId:d$,authority:`https://${lh}.b2clogin.com/${lh}.onmicrosoft.com/${h$}`,knownAuthorities:[`${lh}.b2clogin.com`],redirectUri:process.env.JPLAN_AUTOMATION_ENVIRONMENT?`${hf}/_/dashboard`:hf},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(n,e)=>{n===tt.Error&&console.error(e)},logLevel:tt.Warning}}},DT=(n,e)=>({scopes:["https://graph.microsoft.com/.default","openid","profile"],redirectStartPage:`${hf}${n}`,extraQueryParameters:e}),Gt=new km(f$),my=l.ref(null);function LT(){async function n(e){var t;if(e)try{const r=e.idTokenClaims;if(!(r!=null&&r.aud))throw new Error("User audience (aud) is missing in ID token claims");const o=localStorage.getItem(`msal.token.keys.${r.aud}`);if(!o)throw new Error(`Token keys para ${r.aud} não encontrados no localStorage`);const a=JSON.parse(o),c=(t=a==null?void 0:a.idToken)==null?void 0:t[0];if(!c)throw new Error("idToken não encontrado nos token keys");const d=localStorage.getItem(c);if(!d)throw new Error(`Dados do token para ID ${c} não encontrados no localStorage`);const h=JSON.parse(d),m=h==null?void 0:h.secret;if(!m)throw new Error("Secret não encontrado nos dados do token");sessionStorage.setItem("isAuthenticated","true"),my.value=m}catch(r){console.error("Erro ao obter token de acesso:",r)}}return{jToken:my,setJToken:n}}let Jc=null;const tr=l.ref(null),Ji=l.ref(null),xT=l.ref(Math.floor(Date.now()/1e3));ff.useIntervalFn(()=>m$(),1e3);function m$(){var r,o;if(!((o=(r=tr.value)==null?void 0:r.idTokenClaims)!=null&&o.exp))return;const n=Math.floor(Date.now()/1e3),e=300,t=tr.value.idTokenClaims.exp;xT.value=t-n-e}function Nm(){if(Jc)return Jc;const{setJToken:n,jToken:e}=LT(),t=l.computed(()=>!!tr.value),r=l.computed(()=>tr.value);let o;async function a(p,w){if(!t.value)switch(p){case"redirect":w&&(o=w,await h());break;case"tab":default:await c();break}}const c=async()=>new Promise((p,w)=>{try{localStorage.clear();const C=process.env.JPLAN_WEBAPP__URL_AUTH,T=window.open(C);if(!T){console.error("Failed to open authentication window"),w("Failed to open authentication window");return}const k=Date.now(),I=6e4,N=setInterval(()=>{if(Date.now()-k>I||T.closed){clearInterval(N),console.error("Authentication canceled or timeout reached."),w("Authentication canceled or timeout reached.");return}Object.keys(localStorage).some(L=>L.startsWith("msal.account.keys"))&&(clearInterval(N),d(),T.close(),p())},500)}catch(C){console.error("Error in handleRedirect:",C),w(C)}}),d=async()=>{try{await Gt.initialize();const p=Gt.getActiveAccount();if(p)tr.value=p;else{const w=await Gt.handleRedirectPromise();w?(Gt.setActiveAccount(w.account),tr.value=Gt.getActiveAccount()):console.error("Falha na autenticação")}}catch(p){console.error("Erro no processo de autenticação:",p)}tr.value&&await n(tr.value)},h=async()=>{try{await Gt.initialize();const p=await Gt.handleRedirectPromise();if(!p||Gt.getAllAccounts().length===0){const w=DT(o);await Gt.loginRedirect(w);return}Gt.setActiveAccount(p.account),tr.value=Gt.getActiveAccount(),tr.value&&await n(tr.value),Ji.value="updated"}catch(p){console.error("handleRedirect failed",p)}};async function m(){ve.value=!0,Ji.value="updating";try{const p=await Gt.acquireTokenSilent({scopes:["https://graph.microsoft.com/.default","openid","profile"]});Gt.setActiveAccount(p.account),await n(tr.value),Ji.value="updated"}catch(p){console.error("Failed to refresh token, forcing new login.",p),Ji.value="error",localStorage.clear(),window.location.reload()}ve.value=!1}const g=async()=>{try{await Gt.initialize(),localStorage.clear(),await Gt.logoutRedirect({postLogoutRedirectUri:"/"})}catch(p){console.error("Logout error",p)}};l.watch(xT,async p=>{p<=0&&Ji.value==="updated"&&await m()});const v=l.computed(()=>e.value);return Jc={isAuthenticated:t,authState:Ji,account:r,token:v,refreshToken:m,handleRedirect:a,logout:g},Jc}const{jToken:gy}=LT(),Rm=()=>{const n=dt.create({headers:{"Content-Type":"application/json"}});l.watch(gy,o=>{n.interceptors.request.use(a=>(o&&(a.headers.Authorization=`Bearer ${o}`),a))},{immediate:!0});let e=1;n.interceptors.response.use(async o=>o,async o=>{var a;if(o.config&&o.config.headers){const c=o.config;if(((a=o.response)==null?void 0:a.status)===401&&e>0){e--;try{return c.headers.Authorization=`Bearer ${gy.value}`,await n(c)}catch(d){return Promise.reject(d)}}}return Promise.reject(o)});async function t({url:o,method:a,header:c={},body:d,baseURL:h}){try{return h&&(n.defaults.baseURL=h),(await n({url:o,method:a,headers:c,data:d})).data}catch(m){if(console.error(`Request error [${a} ${o}]:`,m),dt.isAxiosError(m)){const{response:g,message:v}=m;throw new Error(`Axios error: ${v}, Status: ${g==null?void 0:g.status}, URL: ${o}`)}throw m}}async function r({url:o,method:a,header:c,body:d,baseURL:h}){try{h&&(n.defaults.baseURL=h);const m=await n({url:o,method:a,headers:c,data:d});return{status:m.status,header:m.headers,body:m.data}}catch(m){if(dt.isAxiosError(m)){const{response:g,message:v}=m;console.error(`Raw Request Error: ${v}, Status: ${g==null?void 0:g.status}`)}return Promise.reject(m)}}return Object.assign(n,{_request:t,rawRequest:r})},{request:py}=Rm(),_y=l.ref(null),vy=l.ref("default"),uh=l.ref(null),dh=l.ref({scope_type:"org"});function vu(){var v,p;const{handleRedirect:n,account:e,logout:t}=Nm();(p=(v=e.value)==null?void 0:v.idTokenClaims)==null||p.domain;const r=l.computed(()=>{var w,C;return{domain:(C=(w=e.value)==null?void 0:w.idTokenClaims)==null?void 0:C.domain,environment:vy.value,...dh.value}}),o=l.computed(()=>dh.value);async function a(){var w;(!e.value||!((w=e.value.idTokenClaims)!=null&&w.email))&&await n();try{await c(),await d()}catch{}}async function c(){var w,C;try{const T=(C=(w=e.value)==null?void 0:w.idTokenClaims)==null?void 0:C.email;if(!T)throw new Error("Email is undefined");const k=await py({url:`https://api.jplan.com.br/platform/user/profile/?email=${T}`,method:"GET"});uh.value=k.data??null}catch(T){console.error("Failed to fetch user profile:",T)}}async function d(){var w;try{if(!((w=uh.value)!=null&&w.email))throw new Error("User email is undefined");const C=await py({url:"https://api.jplan.com.br/platform/user/domain/",method:"GET"});_y.value=C.data.data??[]}catch(C){console.error("Failed to fetch user domains:",C)}}function h(w){dh.value=w}function m(w){vy.value=w,h(r.value)}async function g(w,C){const T=DT(w,{request_domain:C});await Gt.loginRedirect(T)}return{__init__:a,user:uh,userDomains:_y,setEnv:m,setScope:h,changeDomain:g,session:r,scope:o,logout:t}}const g$={path:"/_/dashboard",component:()=>Promise.resolve().then(()=>require("./AuthRoute-0iHl45Os.js")),meta:{requiresAuth:!1}},p$={path:"/jplan-auth-fail",component:()=>Promise.resolve().then(()=>require("./AuthFailRoute-DHl-IhUQ.js")),meta:{requiresAuth:!1}},{isAuthenticated:yy,handleRedirect:_$}=Nm(),v$=vu();function y$(n,e){n.addRoute(g$),n.addRoute(p$),n.beforeEach(async(t,r,o)=>{function a(d){return d.matched.some(h=>h.meta.requiresAuth)}if(!a(t))return o();if(!yy.value){ve.value=!0;try{await _$(e,t.fullPath),await v$.__init__()}catch(d){console.error("Fail to authenticate",d),await n.push("/jplan-auth-fail")}ve.value=!1}if(yy.value){if(localStorage.getItem("returnRoute")&&localStorage.getItem("returnRoute")!==null){const d=localStorage.getItem("returnRoute")??"/";console.log("trying to go to saved route:",d),o(d),localStorage.removeItem("returnRoute");return}o()}})}const{scope:Cy}=vu();function C$(){const n=Rm(),e=l.ref({scope_type:"org"});async function t(r){e.value=r}return l.watch(Cy,()=>{n.interceptors.request.use(r=>{const o=r.headers,a=o.Authorization;a&&(o.Authorization=a);const c=Cy.value;return c&&(c.scope_type&&(o["j-scope-type"]=c.scope_type,c.organization&&(o["j-scope-organization"]=c.organization),c.team&&(o["j-scope-team"]=c.team)),c.environment&&(o["j-scope-environment"]=c.environment)),r})},{immediate:!0}),Object.assign(n,{setScope:t,scope:e})}function La(n){const e=C$();e.defaults.baseURL=n;const t=l.ref({scope_type:"org"});async function r(o){t.value=o}return l.watch(t,()=>{e.interceptors.request.use(o=>{const a=t.value;return delete o.headers["j-scope-type"],delete o.headers["j-scope-organization"],delete o.headers["j-scope-team"],a!=null&&a.scope_type&&(o.headers["j-scope-type"]=a.scope_type),a!=null&&a.organization&&(o.headers["j-scope-organization"]=a.organization),a!=null&&a.team&&(o.headers["j-scope-team"]=a.team),o})},{immediate:!0}),Object.assign(e,{setScope:r,scope:t})}const Ey={enUS:{widget:"widget",spacer:"spacer"},ptBr:{widget:"widget",spacer:"Espaçador"}},Om={"pt-BR":{placeholders:{selectFilter:"Selecionar filtro",visualize:"Visualizar",actions:"Ações",search:"Pesquisar"},dialogs:{columnSettings:{title:"Configurações de coluna"},scope:{title:"Escopo",unknown:"Desconhecido",domain:"Domínio",environment:"Ambiente",organizational:"Organizacional",organization:"Organização",team:"Time",user:"Usuário",none:"Nenhum",selectOrganization:"Selecione uma Organização",selectTeam:"Selecione um Time"}},actions:{save:"Salvar",cancel:"Cancelar",edit:"Editar",delete:"Apagar",disable:"Desabilitar",confirm:"Confirmar",back:"Voltar"},forms:{metadata:{created:"Criado",updated:"Atualizado",modified:"Modificado",delegated:"Delegado"}},$vuetify:{dataFooter:{itemsPerPageAll:"Todos",itemsPerPageText:"Itens por página:",pageText:"{0}-{1} de {2}"}},toast:{error:{create_failed:"Falha ao criar {entity}",update_failed:"Falha ao atualizar {entity}",delete_failed:"Falha ao apagar {entity}",fetch_failed:"Falha ao buscar {entity}",activate_failed:"Falha ao ativar {entity}",deactivate_failed:"Falha ao desativar {entity}",link_failed:"Falha ao vincular {entity}",unlink_failed:"Falha ao desvincular {entity}"},success:{create_success:"{entity} criado com sucesso",update_success:"{entity} atualizado com sucesso",delete_success:"{entity} apagado com sucesso",activate_success:"{entity} ativado com sucesso",deactivate_success:"{entity} desativado com sucesso",link_success:"{entity} vinculado com sucesso",unlink_success:"{entity} desvinculado com sucesso"},info:{already_linked:"{entity} já está vinculado",select_valid_item:"Selecione um item válido"}},app:{widget:Ey.ptBr}},"en-US":{placeholders:{selectFilter:"Select a filter",visualize:"Visualize",actions:"Actions",search:"Search"},dialogs:{columnSettings:{title:"Column Settings"},scope:{title:"Scope",unknown:"Unknown",domain:"Domain",environment:"Environment",organizational:"Organizational",organization:"Organization",team:"Team",user:"User",none:"None",selectOrganization:"Select a organization",selectTeam:"Select a Team"}},actions:{save:"Save",cancel:"Cancel",edit:"Edit",delete:"Delete",disable:"Disable",back:"Back",confirm:"Confirm"},forms:{metadata:{created:"Created",updated:"Updated",modified:"Modified",delegated:"Delegated"}},$vuetify:{dataFooter:{itemsPerPageAll:"All",itemsPerPageText:"Items per page:",pageText:"{0}-{1} of {2}"}},toast:{error:{create_failed:"Failed to create {entity}",update_failed:"Failed to update {entity}",delete_failed:"Failed to delete {entity}",fetch_failed:"Failed to fetch {entity}",activate_failed:"Failed to activate {entity}",deactivate_failed:"Failed to deactivate {entity}",link_failed:"Failed to link {entity}",unlink_failed:"Failed to unlink {entity}"},success:{create_success:"{entity} created successfully",update_success:"{entity} updated successfully",delete_success:"{entity} deleted successfully",activate_success:"{entity} activated successfully",deactivate_success:"{entity} deactivated successfully",link_success:"{entity} linked successfully",unlink_success:"{entity} unlinked successfully"},info:{already_linked:"{entity} is already linked",select_valid_item:"Please select a valid item"}},app:{widget:Ey.ptBr}}},E$=Object.keys(Om),wy=navigator.language,w$=E$.includes(wy)?wy:"pt-BR",$=Ex({locale:w$,fallbackLocale:"en-US",messages:Om});function T$(){const n=La("https://api.jplan.com.br/management/organization"),{error:e}=wr();return{async getOrgList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Organization"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getOrgList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Organization"}));return}},async createOrg(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Organization"})),a}},async updateOrg(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e($.global.t("toast.error.update_failed",{entity:"Organization"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Organization"})),a}},async getOrg(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Organization"})),new Error(a.data.error);return a.data}catch(a){throw console.error("Error in getOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Organization"})),a}},async activateOrg(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"Organization"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Organization"})),a}},async deactivateOrg(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"Organization"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Organization"})),a}}}}const xo=T$();function b$(){const n=La("https://api.jplan.com.br/management/branch/"),{error:e}=wr();return{async getBranchList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error){e($.global.t("toast.error.fetch_failed",{entity:"Branch"}));return}return o.data.data}catch(r){console.error("Error in getBranchList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Branch"}))}},async createBranch(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){console.error("Error in createBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Branch"}))}},async updateBranch(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error){e(a.data.error||$.global.t("toast.error.update_failed",{entity:"Branch"}));return}return a}catch(a){console.error("Error in updateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Branch"}))}},async getBranch(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error){e(a.data.error||$.global.t("toast.error.fetch_failed",{entity:"Branch"}));return}return a.data}catch(a){console.error("Error in getBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Branch"}))}},async activateBranch(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error){e(a.data.error||$.global.t("toast.error.activate_failed",{entity:"Branch"}));return}}catch(a){console.error("Error in activateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Branch"}))}},async deactivateBranch(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error){e(a.data.error||$.global.t("toast.error.deactivate_failed",{entity:"Branch"}));return}}catch(a){console.error("Error in deactivateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Branch"}))}}}}const Uo=b$();function I$(){const n=La("https://api.jplan.com.br/management/team"),{error:e}=wr();return{async getTeamList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Team"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getTeamList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Team"}));return}},async createTeam(t){var r,o;try{const a=await n.post("/item",t);if(a.data.error)throw e($.global.t("toast.error.create_failed",{entity:"Team"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in createTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Team"})),a}},async updateTeam(t){var r,o;try{const a=await n.patch("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in updateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Team"})),a}},async getTeam(t){var r,o;try{const a=await n.get(`/item/${t}`);return a.data.error&&e($.global.t("toast.error.fetch_failed",{entity:"Team"})),a.data}catch(a){console.error("Error in getTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Team"}));return}},async activateTeam(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"Team"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Team"})),a}},async deactivateTeam(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"Team"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Team"})),a}},async getTeamUserList(t,r){try{const o=r?`?filter_query=${r}`:"",a=await n.get(`/item/${t}/user/list/${o}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(a.data.error);return a.data.data}catch(o){console.error("Error in getTeamUserList:",o),e($.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async linkManageUser(t,r){try{const o=await n.post(`/item/${t}/user/item/`,r);if(o.data.error)throw e($.global.t("toast.error.link_failed",{entity:"User"})),new Error(o.data.error);return o.data}catch(o){console.error("Error in link User:",o),e($.global.t("toast.error.link_failed",{entity:"User"}));return}},async updateManageUser(t,r){try{const o=await n.patch(`/item/${t}/user/item/`,r);if(o.data.error)throw e($.global.t("toast.error.update_failed",{entity:"User"})),new Error(o.data.error);return o.data.data}catch(o){throw console.error("Error in update User:",o),e($.global.t("toast.error.update_failed",{entity:"User"})),o}},async getManageUser(t,r,o){try{const a=o?`?filter_query=${o}`:"",c=await n.get(`/item/${t}/user/item/${r}/${a}`);if(c.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(c.data.error);return c.data.data}catch(a){console.error("Error in getUser:",a),e($.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async unlinkManageUser(t,r,o){try{const a=o?`?filter_query=${o}`:"";await n.delete(`/item/${t}/user/item/${r}/${a}`)}catch(a){throw console.error("Error in unlink User:",a),e($.global.t("toast.error.unlink_failed",{entity:"User"})),a}}}}const Mn=I$();let Qc=!1;const hh=l.ref(!1),jn=l.ref([]),Ty=l.ref([]),ft=l.ref(null),Qi=l.ref([]),Xi=l.ref([]),UT=()=>{const n=wr(),e=async C=>{hh.value=!0;const T=C?`_active eq true and ${C}`:"_active eq true",k=await xo.getOrgList(T);k&&(jn.value=k,Qc=!0),hh.value=!1},t=async C=>{var T;return(T=jn.value)!=null&&T.length||await e(C),jn.value};function r(C){if(!jn.value)throw new Error("Data not stored yet");const T=Pa(jn.value,C,["name","description"]);return C!==""?T:jn.value}const o=C=>{Ty.value=C},a=C=>{ft.value=Oa.cloneDeep(C)},c=async C=>await xo.getOrg(C),d=async()=>{if(ft.value!=null){const C=await xo.createOrg(ft.value);return C!=null&&C.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Organization"})),Qc&&jn.value.push(C.data)),C==null?void 0:C.data}},h=async()=>{if(ve.value=!0,ft.value&&ft.value.__id){const C=await xo.updateOrg(ft.value);if(Qc&&(C!=null&&C.data.__id)){const T=jn.value.findIndex(k=>k.__id===C.data.__id);return T!==-1?(jn.value[T]=C.data,n.success($.global.t("toast.success.update_success",{entity:"Organization"}))):n.error($.global.t("toast.error.update_failed",{entity:"Organization"})),ve.value=!1,C.data}}else ve.value=!1,n.error($.global.t("toast.error.update_failed",{entity:"Organization"}))},m=async()=>{if(ve.value=!0,ft.value&&ft.value.created_at){if(await xo.deactivateOrg(ft.value.__id),Qc){const C=jn.value.findIndex(T=>{var k;return T.__id===((k=ft.value)==null?void 0:k.__id)});if(C!==-1)return jn.value.splice(C,1),ft.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Organization"}))}ve.value=!1}};async function g(C){ve.value=!0;try{if(ft.value&&ft.value.__id){const T={...C,organization:ft.value.__id};if(!await Uo.updateBranch(T)){ve.value=!1;return}if(Qi.value.findIndex(N=>N.__id===C.__id)===-1)return n.success($.global.t("toast.success.link_success",{entity:"Branch"})),Qi.value.push(T),T;n.info($.global.t("toast.info.already_linked",{entity:"Branch"}))}}catch(T){console.error(T)}finally{ve.value=!1}}async function v(C){if(ve.value=!0,ft.value&&ft.value.__id){const T={...C,organization:null};if(!await Uo.updateBranch(T)){ve.value=!1;return}const I=Qi.value.findIndex(N=>N.__id===C.__id);if(I!==-1)return Qi.value.splice(I,1),ve.value=!1,Qi.value;throw new Error("Item not found to remove")}ve.value=!1}async function p(C){ve.value=!0;try{if(ft.value&&ft.value.__id){const T={...C,organization:ft.value.__id};if(!await Mn.updateTeam(T)){ve.value=!1;return}if(Xi.value.findIndex(N=>N.__id===C.__id)===-1)return n.success($.global.t("toast.success.link_success",{entity:"Team"})),Xi.value.push(T),T;n.info($.global.t("toast.info.already_linked",{entity:"Team"}))}}catch(T){console.error(T)}finally{ve.value=!1}}async function w(C){if(ve.value=!0,ft.value&&ft.value.__id){const T={...C,organization:null};if(!await Mn.updateTeam(T)){ve.value=!1;return}const I=Xi.value.findIndex(N=>N.__id===C.__id);if(I!==-1)return Xi.value.splice(I,1),ve.value=!1,Xi.value;throw new Error("Item not found to remove")}ve.value=!1}return{data:jn,loading:hh,columns:Ty,item:ft,filterData:r,__init__:e,getData:t,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,orgBranches:Qi,orgTeams:Xi,linkBranch:g,unlinkBranch:v,linkTeam:p,unlinkTeam:w}};let Xc=!1;const Yn=l.ref([]),by=l.ref([]),Nt=l.ref(null),fh=l.ref(!1),Zi=l.ref([]),BT=()=>{const n=wr(),e=async p=>{fh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await Mn.getTeamList(w);C&&(Yn.value=C,Xc=!0),fh.value=!1},t=async p=>(Yn.value.length||await e(p),Yn.value);function r(p){if(!Yn.value)throw new Error("Data not stored yet");const w=Pa(Yn.value,p,["name","description"]);return p!==""?w:Yn.value}const o=p=>{by.value=p},a=p=>{Nt.value=Oa.cloneDeep(p)},c=async p=>await Mn.getTeam(p),d=async()=>{if(Nt.value!=null){const p=await Mn.createTeam(Nt.value);return p!=null&&p.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Team"})),Xc&&Yn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(ve.value=!0,Nt.value&&Nt.value.__id){const p=await Mn.updateTeam(Nt.value);if(Xc&&(p!=null&&p.data.__id)){const w=Yn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Yn.value[w]=p.data,n.success($.global.t("toast.success.update_success",{entity:"Team"}))):n.error($.global.t("toast.error.update_failed",{entity:"Team"})),p.data}}else n.error($.global.t("toast.error.update_failed",{entity:"Team"}))},m=async()=>{if(Nt.value&&Nt.value.created_at&&(await Mn.deactivateTeam(Nt.value.__id),Xc)){const p=Yn.value.findIndex(w=>{var C;return w.__id===((C=Nt.value)==null?void 0:C.__id)});if(p!==-1)return Yn.value.splice(p,1),Nt.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Team"}))}};async function g(p){var w;if(ve.value=!0,(w=Nt.value)!=null&&w.__id)if(Zi.value.findIndex(T=>T.__id===p.__id)===-1)try{const T=await Mn.linkManageUser(Nt.value.__id,{team:Nt.value.__id,user:p.__id,role:"string",joined_at:"string",comments:"string"}),k=await Mn.getTeamUserList(Nt.value.__id);return k&&(Zi.value=k),n.success($.global.t("toast.success.link_success",{entity:"User"})),T}catch(T){console.error(T),n.error($.global.t("toast.error.link_failed",{entity:"User"}))}finally{ve.value=!1}else n.info($.global.t("toast.info.already_linked",{entity:"User"}));else console.warn("No item selected or item ID is missing."),n.info($.global.t("toast.info.select_valid_item"));ve.value=!1}async function v(p){if(ve.value=!0,Nt.value&&Nt.value.__id){const w=Zi.value.findIndex(C=>C.__id===p);if(w!==-1)return await Mn.unlinkManageUser(Nt.value.__id,p),Zi.value.splice(w,1),ve.value=!1,Zi.value;throw new Error("Item not found to remove")}ve.value=!1}return{data:Yn,loading:fh,columns:by,item:Nt,usersTeam:Zi,__init__:e,getData:t,filterData:r,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,linkUser:g,unlinkUser:v}},FT=l.defineComponent({__name:"GlobalScopeFilter",setup(n){var T,k,I;const{openDialog:e}=Ms("global-scope__J-"),{user:t,scope:r,session:o,setScope:a}=vu(),{getData:c,data:d}=UT(),{getData:h,data:m}=BT(),g=l.ref(!1);l.onBeforeMount(async()=>{g.value=!0,await c(),await h(),g.value=!1});const v=l.ref({scope_type:(T=r.value)==null?void 0:T.scope_type,organization:((k=r.value)==null?void 0:k.organization)??"org",team:(I=r.value)==null?void 0:I.team});function p(){var N,D,L;v.value={...r.value,scope_type:(N=r.value)==null?void 0:N.scope_type,organization:((D=r.value)==null?void 0:D.organization)??"",team:(L=r.value)==null?void 0:L.team},e()}const w=l.computed(()=>{var N;switch((N=r.value)==null?void 0:N.scope_type){case"user":return VF;case"org":return BF;case"team":return HF;default:return FF}});async function C(){var N;((N=r.value)==null?void 0:N.scope_type)!==""&&a(v.value)}return(N,D)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(it.VBtn,{onClick:p,icon:"",class:"text-secondary",color:"surface",rounded:"sm",size:"small",variant:"flat"},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(w.value),{size:"20"}))]),_:1}),l.createVNode(l.unref(Ls),{loading:g.value,title:l.unref($).global.t("dialogs.scope.title"),"dd-id":"global-scope__J-",onOnSave:C},{default:l.withCtx(()=>[l.createElementVNode("div",null,[l.createVNode(Qe.VRow,null,{default:l.withCtx(()=>[l.createVNode(Qe.VCol,{cols:"4",class:"d-flex flex-row align-center"},{default:l.withCtx(()=>[l.createVNode(Qt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.user")),1)]),_:1}),l.createVNode(Qt.VListItemSubtitle,null,{default:l.withCtx(()=>{var L;return[l.createTextVNode(l.toDisplayString(((L=l.unref(t))==null?void 0:L.name)||l.unref($).global.t("dialogs.scope.unknownUser")),1)]}),_:1})]),_:1})]),_:1}),l.createVNode(Qe.VCol,{cols:"4"},{default:l.withCtx(()=>[l.createVNode(Qt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.environment")),1)]),_:1}),l.createVNode(Qt.VListItemSubtitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o).domain),1)]),_:1})]),_:1})]),_:1}),l.createVNode(Qe.VCol,{cols:"4"},{default:l.withCtx(()=>[l.createVNode(Qt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.environment")),1)]),_:1}),l.createVNode(Qt.VListItemSubtitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o).environment),1)]),_:1})]),_:1})]),_:1})]),_:1}),l.createVNode(AO.VBtnToggle,{density:"compact",variant:"outlined",modelValue:v.value.scope_type,"onUpdate:modelValue":D[0]||(D[0]=L=>v.value.scope_type=L),class:"d-flex justify-center my-4"},{default:l.withCtx(()=>[l.createVNode(it.VBtn,{value:"org",label:l.unref($).global.t("dialogs.scope.organizational"),color:"secondary"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.organizational")),1)]),_:1},8,["label"]),l.createVNode(it.VBtn,{value:"team",label:l.unref($).global.t("dialogs.scope.team"),color:"secondary"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.team")),1)]),_:1},8,["label"]),l.createVNode(it.VBtn,{value:"user",label:l.unref($).global.t("dialogs.scope.user"),color:"secondary"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.user")),1)]),_:1},8,["label"]),l.createVNode(it.VBtn,{value:"",label:l.unref($).global.t("dialogs.scope.none"),color:"lightext"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.none")),1)]),_:1},8,["label"])]),_:1},8,["modelValue"]),l.createElementVNode("div",null,[l.createVNode(va.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.organization")),1)]),_:1}),l.createVNode(us.VSelect,{items:l.unref(d),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:l.unref($).global.t("dialogs.scope.selectOrganization"),class:"min-w-50",modelValue:v.value.organization,"onUpdate:modelValue":D[1]||(D[1]=L=>v.value.organization=L),clearable:""},null,8,["items","placeholder","modelValue"]),l.createVNode(va.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.team")),1)]),_:1}),l.createVNode(us.VSelect,{items:l.unref(m),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:l.unref($).global.t("dialogs.scope.selectTeam"),class:"min-w-50",modelValue:v.value.team,"onUpdate:modelValue":D[2]||(D[2]=L=>v.value.team=L),clearable:""},null,8,["items","placeholder","modelValue"])])])]),_:1},8,["loading","title"])],64))}}),S$={},A$={class:"double-ring-spinner-container"};function k$(n,e){return l.openBlock(),l.createElementBlock("div",A$,e[0]||(e[0]=[l.createElementVNode("div",{class:"spinner-loading"},[l.createElementVNode("div"),l.createElementVNode("div"),l.createElementVNode("div",null,[l.createElementVNode("div")]),l.createElementVNode("div",null,[l.createElementVNode("div")])],-1)]))}const VT=Aa(S$,[["render",k$],["__scopeId","data-v-00d7a69f"]]),N$={key:0,class:"_jspinner-overlay_jj"},HT=l.defineComponent({__name:"GlobalSpinner",setup(n){return(e,t)=>l.unref(ve)?(l.openBlock(),l.createElementBlock("div",N$,t[0]||(t[0]=[l.createElementVNode("div",{class:"j-double-ring-spinner-container"},[l.createElementVNode("div",{class:"j-global-spinner-loading"},[l.createElementVNode("div"),l.createElementVNode("div"),l.createElementVNode("div",null,[l.createElementVNode("div")]),l.createElementVNode("div",null,[l.createElementVNode("div")])])],-1)]))):l.createCommentVNode("",!0)}}),$T=l.defineComponent({__name:"SubMenu",props:{title:{}},setup(n,{expose:e}){return e({props:n}),(r,o)=>(l.openBlock(),l.createBlock(Qt.VListItem,{onClick:o[0]||(o[0]=()=>{}),density:"compact"},{append:l.withCtx(()=>[l.createVNode(l.unref($F))]),default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(r.title),1)]),_:1}),l.createVNode(gf.VMenu,{activator:"parent","open-on-hover":"",submenu:"",density:"compact"},{default:l.withCtx(()=>[l.renderSlot(r.$slots,"default")]),_:3})]),_:3}))}}),R$=Object.freeze(Object.defineProperty({__proto__:null,AvatarPicture:fC,ColumnSettingsDialog:Uf,ConfirmDialog:dC,ContextMenu:mC,CopyButton:Bl,DeleteAllBtn:Cf,DotsMenu:uC,EditButton:lC,FormHeadless:qE,FormMetadata:ou,GlobalScopeFilter:FT,GlobalSpinner:HT,JAutocomplete:HE,JAvatar:hC,JBtn:Oy,JDialog:Ls,JForm:zE,JIconBtn:Ry,JSelect:VE,JTextArea:$E,JTextField:gE,ParentCard:Kl,SearchFilter:Jl,SpinnerLoader:VT,SubMenu:$T,TabFormHeader:GE,TableAdvanced:XC,TableCard:Bf,TableCardsView:fE,TableHeader:ZC,UiTable:gC},Symbol.toStringTag,{value:"Module"})),O$=n0(),P$={transition:"Vue-Toastification__fade",maxToasts:20,newestOnTop:!0};let mh=!1;const gh=l.ref(!1),Jn=l.ref([]),Iy=l.ref([]),$t=l.ref(null),ea=l.ref([]),M$=()=>{const n=wr(),e=async p=>{gh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await Uo.getBranchList(w);C&&(Jn.value=C,mh=!0),gh.value=!1},t=async p=>(Jn.value.length||await e(p),Jn.value);function r(p){if(!Jn.value)throw new Error("Data not stored yet");const w=Pa(Jn.value,p,["name","description"]);return p!==""?w:Jn.value}const o=p=>{Iy.value=p},a=p=>{$t.value=Oa.cloneDeep(p)},c=async p=>await Uo.getBranch(p),d=async()=>{if($t.value!=null){const p=await Uo.createBranch($t.value);return p!=null&&p.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Branch"})),mh&&Jn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if($t.value&&$t.value.__id){const p=await Uo.updateBranch($t.value);if(mh&&p){const w=Jn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Jn.value[w]=p.data,n.success($.global.t("toast.success.update_success",{entity:"Branch"}))):n.error($.global.t("toast.error.update_failed",{entity:"Branch"})),p}}else n.error($.global.t("toast.error.update_failed",{entity:"Branch"}))},m=async()=>{if($t.value&&$t.value.created_at){await Uo.deactivateBranch($t.value.__id);const p=Jn.value.findIndex(w=>{var C;return w.__id===((C=$t.value)==null?void 0:C.__id)});if(p!==-1)return Jn.value.splice(p,1),$t.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Branch"}))}};async function g(p){ve.value=!0;try{if($t.value&&$t.value.__id){const w={...p,branch:$t.value.__id};if(!await Mn.updateTeam(w)){n.error($.global.t("toast.error.link_failed",{entity:"Team"}));return}if(ea.value.findIndex(k=>k.__id===p.__id)===-1)return n.success($.global.t("toast.success.link_success",{entity:"Team"})),ea.value.push(w),w;n.info($.global.t("toast.info.already_linked",{entity:"Team"}))}else throw new Error("Item is not defined")}catch(w){console.error(w)}finally{ve.value=!1}}async function v(p){if(ve.value=!0,$t.value&&$t.value.__id){const w={...p,branch:null};if(!await Mn.updateTeam(w))return;const T=ea.value.findIndex(k=>k.__id===p.__id);if(T!==-1)return ea.value.splice(T,1),ve.value=!1,ea.value;throw new Error("Item not found to remove")}ve.value=!1}return{data:Jn,columns:Iy,item:$t,loading:gh,__init__:e,getData:t,filterData:r,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,branchTeams:ea,linkTeam:g,unlinkTeam:v}};function D$(){const n=La("https://api.jplan.com.br/management/division"),{error:e}=wr();return{async getDivisionList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Division"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getDivisionList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Division"}));return}},async createDivision(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Division"})),a}},async updateDivision(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e($.global.t("toast.error.update_failed",{entity:"Division"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Division"})),a}},async getDivision(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Division"})),new Error(a.data.error);return a.data}catch(a){throw console.error("Error in getDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Division"})),a}},async activateDivision(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"Division"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Division"})),a}},async deactivateDivision(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"Division"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Division"})),a}}}}const ca=D$();let ph=!1;const _h=l.ref(!1),Qn=l.ref([]),Sy=l.ref([]),Kt=l.ref(null),ta=l.ref([]),L$=()=>{const n=wr(),e=async p=>{_h.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await ca.getDivisionList(w);C&&(Qn.value=C,ph=!0),_h.value=!1},t=async p=>(Qn.value.length||await e(p),Qn.value);function r(p){if(!Qn.value)throw new Error("Data not stored yet");const w=Pa(Qn.value,p,["name","description"]);return p!==""?w:Qn.value}const o=p=>{Sy.value=p},a=p=>{Kt.value=Oa.cloneDeep(p)},c=async p=>await ca.getDivision(p),d=async()=>{if(Kt.value!=null){const p=await ca.createDivision(Kt.value);return p!=null&&p.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Division"})),ph&&Qn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(ve.value=!0,Kt.value&&Kt.value.__id){const p=await ca.updateDivision(Kt.value);if(ph&&(p!=null&&p.data.__id)){const w=Qn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Qn.value[w]=p.data,n.success($.global.t("toast.success.update_success",{entity:"Division"}))):n.error($.global.t("toast.error.update_failed",{entity:"Division"})),ve.value=!1,p}}else ve.value=!1,n.error($.global.t("toast.error.update_failed",{entity:"Division"}))},m=async()=>{if(ve.value=!0,Kt.value&&Kt.value.created_at){await ca.deactivateDivision(Kt.value.__id);const p=Qn.value.findIndex(w=>{var C;return w.__id===((C=Kt.value)==null?void 0:C.__id)});if(p!==-1)return Qn.value.splice(p,1),Kt.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Division"}))}ve.value=!1};async function g(p){ve.value=!0;try{if(Kt.value&&Kt.value.__id){const w={...p,division:Kt.value.__id};return await xo.updateOrg(w)?(ta.value.findIndex(k=>k.__id===p.__id)===-1?(n.success($.global.t("toast.success.link_success",{entity:"Organization"})),ta.value.push(w)):n.info($.global.t("toast.info.already_linked",{entity:"Organization"})),w):void 0}else throw new Error("Item is not defined")}catch(w){console.error(w)}finally{ve.value=!1}}async function v(p){if(ve.value=!0,Kt.value&&Kt.value.__id){const w={...p,division:null};if(!await xo.updateOrg(w))return;const T=ta.value.findIndex(k=>k.__id===p.__id);if(T!==-1)ta.value.splice(T,1);else throw new Error("Item not found to remove")}else throw new Error("Item is not defined");return ve.value=!1,ta.value}return{data:Qn,columns:Sy,item:Kt,loading:_h,__init__:e,filterData:r,getData:t,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,orgs:ta,linkDivision:g,unlinkDivision:v}};function x$(){const n=La("https://api.jplan.com.br/management/user"),{error:e}=wr();return{async getManageUserList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getManageUserList:",r),e($.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async createManageUser(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"User"})),a}},async updateManageUser(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e($.global.t("toast.error.update_failed",{entity:"User"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"User"})),a}},async getManageUser(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(a.data.error);return a.data}catch(a){console.error("Error in getManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async activateManageUser(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"User"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"User"})),a}},async deactivateManageUser(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"User"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"User"})),a}}}}const la=x$();let vh=!1,yh=l.ref(!1);const Xn=l.ref([]),Ay=l.ref([]),Zn=l.ref(null),U$=l.ref(null),B$=l.ref([]),F$=()=>{const n=wr(),e=async g=>{yh.value=!0;const v=g?`_active eq true and ${g}`:"_active eq true",p=await la.getManageUserList(v);p&&(Xn.value=p,vh=!0),yh.value=!1},t=async g=>(Xn.value.length||await e(g),Xn.value);function r(g){if(!Xn.value)throw new Error("Data not stored yet");const v=Pa(Xn.value,g,["name","description"]);return g!==""?v:Xn.value}return{data:Xn,loading:yh,columns:Ay,item:Zn,filterData:r,__init__:e,getData:t,setColumns:g=>{Ay.value=g},setItem:g=>{Zn.value=Oa.cloneDeep(g)},getItem:async g=>await la.getManageUser(g),createItem:async()=>{if(Zn.value!=null){const g=crypto.randomUUID(),v=await la.createManageUser({...Zn.value,__id:g});return v!=null&&v.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"User"})),vh&&Xn.value.push(v.data)),v==null?void 0:v.data}},updateItem:async()=>{if(ve.value=!0,Zn.value&&Zn.value.created_at){const g=await la.updateManageUser(Zn.value);if(vh&&(g!=null&&g.data)){const v=Xn.value.findIndex(p=>p.__id===(g==null?void 0:g.data.__id));v!==-1?(Xn.value[v]=g==null?void 0:g.data,n.success($.global.t("toast.success.update_success",{entity:"User"}))):n.error($.global.t("toast.error.update_failed",{entity:"User"}))}return ve.value=!1,g==null?void 0:g.data}},removeItem:async()=>{if(Zn.value&&Zn.value.created_at){try{await la.deactivateManageUser(Zn.value.__id)}catch{n.error($.global.t("toast.error.deactivate_failed",{entity:"User"}));return}const g=Xn.value.findIndex(v=>{var p;return v.__id===((p=Zn.value)==null?void 0:p.__id)});if(g!==-1)return Xn.value.splice(g,1),n.success($.global.t("toast.success.deactivate_success",{entity:"User"})),Zn.value}},userOrg:U$,userTeams:B$}},Ch=Object.freeze({colNum:24,rowHeight:50,useCssTransforms:!0,responsive:!0,margin:[12,10]}),na=l.ref(!1),V$=l.ref([]);function H$(){const n=l.ref({...Ch,isResizable:!1,isDraggable:!1,useStyleCursor:!1,cursor:"default"});function e(){if(na.value=!na.value,n.value.isDraggable=na.value,n.value.isResizable=na.value,!na.value){n.value.useStyleCursor=!0,n.value.cursor="pointer";return}n.value.useStyleCursor=!1,n.value.cursor="move"}function t(){n.value={...Ch,isResizable:!1,isDraggable:!1,useStyleCursor:!1,cursor:"default"}}return{DEFAULT_CONFIG:Ch,config:n,layout:V$,edition:na,toggleEdit:e,resetLayout:t}}const $$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetTask-BQdg0SnF.js"))),K$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetImage-DhplL-E6.js"))),W$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetShortcut-CQ7ysNgy.js"))),z$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetSpacer-CqnMZpDm.js"))),G$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetLabel-DQCAg6V8.js"))),q$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetChartBar-ChMg_dbz.js"))),j$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetChartPie-C2AIgVQ2.js"))),Y$={WidgetSpacer:z$,WidgetLabel:G$,WidgetTask:$$,WidgetImage:K$,WidgetShortcut:W$,WidgetChartBar:q$,WidgetChartPie:j$},J$={defaultI18n:!0},Q$=(n,e)=>{const t={...J$,...e};n.use(O$),n.use(oP,P$),t.defaultI18n&&n.use($),Object.entries(R$).forEach(([r,o])=>{n.component(r,o)}),Object.entries(NO).forEach(([r,o])=>{n.provide(r,o)})},X$={install:Q$};exports.ContextMenu=mC;exports.EmptyListImg=Lh;exports.EventBus=Hl;exports.FormHeadless=qE;exports.HttpCore=uF;exports.I18nMessages=Om;exports.SpinnerLoader=VT;exports.TableCardsView=fE;exports.TableHeader=ZC;exports.__spinner=ve;exports._export_sfc=Aa;exports._sfc_main=Ls;exports._sfc_main$1=gC;exports._sfc_main$10=Oy;exports._sfc_main$11=Cf;exports._sfc_main$12=lC;exports._sfc_main$13=Ry;exports._sfc_main$14=VE;exports._sfc_main$15=HE;exports._sfc_main$16=$E;exports._sfc_main$17=gE;exports._sfc_main$18=zE;exports._sfc_main$19=GE;exports._sfc_main$2=XC;exports._sfc_main$20=Kl;exports._sfc_main$21=hC;exports._sfc_main$22=fC;exports._sfc_main$23=$T;exports._sfc_main$24=FT;exports._sfc_main$25=HT;exports._sfc_main$3=Uf;exports._sfc_main$4=Bf;exports._sfc_main$5=Jl;exports._sfc_main$6=dC;exports._sfc_main$7=Bl;exports._sfc_main$8=uC;exports._sfc_main$9=ou;exports.branchInstance=Uo;exports.coreClient=Rm;exports.createToastInterface=ws;exports.dateFormat=ds;exports.divisionInstance=ca;exports.filterQuery=Pa;exports.globalEventBus=yf;exports.i18n=$;exports.index=X$;exports.manageUserInstance=la;exports.msal=Gt;exports.orgInstance=xo;exports.provideToast=rP;exports.scopedClient=La;exports.setupAuthGuard=y$;exports.teamInstance=Mn;exports.toastInjectionKey=$l;exports.useAuth=Nm;exports.useBranchStore=M$;exports.useCustomizer=s0;exports.useDashboardStore=H$;exports.useDialog=Ms;exports.useDivisionStore=L$;exports.useManageUserStore=F$;exports.useOrganizationStore=UT;exports.useSession=vu;exports.useTeamStore=BT;exports.useToast=wr;exports.widgets=Y$;
|
113
|
+
${c}`);return}throw ty(e.error,e.error_description,e.suberror)?new Er(e.error,e.error_description,e.suberror,e.timestamp||F.EMPTY_STRING,e.trace_id||F.EMPTY_STRING,e.correlation_id||F.EMPTY_STRING,e.claims||F.EMPTY_STRING,a):c}}async handleServerTokenResponse(e,t,r,o,a,c,d,h,m){var C;(C=this.performanceClient)==null||C.addQueueMeasurement(x.HandleServerTokenResponse,e.correlation_id);let g;if(e.id_token){if(g=Si(e.id_token||F.EMPTY_STRING,this.cryptoObj.base64Decode),a&&a.nonce&&g.nonce!==a.nonce)throw Y(nw);if(o.maxAge||o.maxAge===0){const T=g.auth_time;if(!T)throw Y(qf);mw(T,o.maxAge)}}this.homeAccountIdentifier=Pt.generateHomeAccountId(e.client_info||F.EMPTY_STRING,t.authorityType,this.logger,this.cryptoObj,g);let v;a&&a.state&&(v=yr.parseRequestState(this.cryptoObj,a.state)),e.key_id=e.key_id||o.sshKid||void 0;const p=this.generateCacheRecord(e,t,r,o,g,c,a);let w;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),w=new N2(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(w)),d&&!h&&p.account){const T=p.account.generateAccountKey();if(!this.cacheStorage.getAccount(T,this.logger))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await Ti.generateAuthenticationResult(this.cryptoObj,t,p,!1,o,g,v,void 0,m)}await this.cacheStorage.saveCacheRecord(p,o.storeInCache,o.correlationId)}finally{this.persistencePlugin&&this.serializableCache&&w&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(w))}return Ti.generateAuthenticationResult(this.cryptoObj,t,p,!1,o,g,v,e,m)}generateCacheRecord(e,t,r,o,a,c,d){const h=t.getPreferredCache();if(!h)throw Y(Yf);const m=Rw(a);let g,v;e.id_token&&a&&(g=au(this.homeAccountIdentifier,h,e.id_token,this.clientId,m||""),v=dm(this.cacheStorage,t,this.homeAccountIdentifier,this.cryptoObj.base64Decode,a,e.client_info,h,m,d,void 0,this.logger));let p=null;if(e.access_token){const T=e.scope?vt.fromString(e.scope):new vt(o.scopes||[]),k=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,I=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,N=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,D=r+k,L=D+I,K=N&&N>0?r+N:void 0;p=su(this.homeAccountIdentifier,h,e.access_token,this.clientId,m||t.tenant||"",T.printScopes(),D,L,this.cryptoObj.base64Decode,K,e.token_type,c,e.key_id,o.claims,o.requestedClaimsHash)}let w=null;if(e.refresh_token){let T;if(e.refresh_token_expires_in){const k=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;T=r+k}w=gw(this.homeAccountIdentifier,h,e.refresh_token,this.clientId,e.foci,c,T)}let C=null;return e.foci&&(C={clientId:this.clientId,environment:h,familyId:e.foci}),{account:v,idToken:g,accessToken:p,refreshToken:w,appMetadata:C}}static async generateAuthenticationResult(e,t,r,o,a,c,d,h,m){var D,L,K,q,M;let g=F.EMPTY_STRING,v=[],p=null,w,C,T=F.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===Ge.POP&&!a.popKid){const ce=new Ia(e),{secret:ae,keyId:X}=r.accessToken;if(!X)throw Y(Jf);g=await ce.signPopToken(ae,X,a)}else g=r.accessToken.secret;v=vt.fromString(r.accessToken.target).asArray(),p=new Date(Number(r.accessToken.expiresOn)*1e3),w=new Date(Number(r.accessToken.extendedExpiresOn)*1e3),r.accessToken.refreshOn&&(C=new Date(Number(r.accessToken.refreshOn)*1e3))}r.appMetadata&&(T=r.appMetadata.familyId===_s?_s:"");const k=(c==null?void 0:c.oid)||(c==null?void 0:c.sub)||"",I=(c==null?void 0:c.tid)||"";h!=null&&h.spa_accountid&&r.account&&(r.account.nativeAccountId=h==null?void 0:h.spa_accountid);const N=r.account?im(r.account.getAccountInfo(),void 0,c,(D=r.idToken)==null?void 0:D.secret):null;return{authority:t.canonicalAuthority,uniqueId:k,tenantId:I,scopes:v,account:N,idToken:((L=r==null?void 0:r.idToken)==null?void 0:L.secret)||"",idTokenClaims:c||{},accessToken:g,fromCache:o,expiresOn:p,extExpiresOn:w,refreshOn:C,correlationId:a.correlationId,requestId:m||F.EMPTY_STRING,familyId:T,tokenType:((K=r.accessToken)==null?void 0:K.tokenType)||F.EMPTY_STRING,state:d?d.userRequestState:F.EMPTY_STRING,cloudGraphHostName:((q=r.account)==null?void 0:q.cloudGraphHostName)||F.EMPTY_STRING,msGraphHost:((M=r.account)==null?void 0:M.msGraphHost)||F.EMPTY_STRING,code:h==null?void 0:h.spa_code,fromNativeBroker:!1}}}function dm(n,e,t,r,o,a,c,d,h,m,g){g==null||g.verbose("setCachedAccount called");const p=n.getAccountKeys().find(I=>I.startsWith(t));let w=null;p&&(w=n.getAccount(p,g));const C=w||Pt.createAccount({homeAccountId:t,idTokenClaims:o,clientInfo:a,environment:c,cloudGraphHostName:h==null?void 0:h.cloud_graph_host_name,msGraphHost:h==null?void 0:h.msgraph_host,nativeAccountId:m},e,r),T=C.tenantProfiles||[],k=d||C.realm;if(k&&!T.find(I=>I.tenantId===k)){const I=om(t,C.localAccountId,k,o);T.push(I)}return C.tenantProfiles=T,C}/*! @azure/msal-common v14.16.0 2024-11-05 */async function Vw(n,e,t){return typeof n=="string"?n:n({clientId:e,tokenEndpoint:t})}/*! @azure/msal-common v14.16.0 2024-11-05 */class Hw extends lm{constructor(e,t){var r;super(e,t),this.includeRedirectUri=!0,this.oidcDefaultScopes=(r=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:r.defaultScopes}async getAuthCodeUrl(e){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(x.GetAuthCodeUrl,e.correlationId);const t=await Q(this.createAuthCodeUrlQueryString.bind(this),x.AuthClientCreateQueryString,this.logger,this.performanceClient,e.correlationId)(e);return De.appendQueryString(this.authority.authorizationEndpoint,t)}async acquireToken(e,t){var d,h;if((d=this.performanceClient)==null||d.addQueueMeasurement(x.AuthClientAcquireToken,e.correlationId),!e.code)throw Y(iw);const r=zr(),o=await Q(this.executeTokenRequest.bind(this),x.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),a=(h=o.headers)==null?void 0:h[dn.X_MS_REQUEST_ID],c=new Ti(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return c.validateTokenResponse(o.body),Q(c.handleServerTokenResponse.bind(c),x.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(o.body,this.authority,r,e,t,void 0,void 0,void 0,a)}handleFragmentResponse(e,t){if(new Ti(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null).validateServerAuthorizationCodeResponse(e,t),!e.code)throw Y(uw);return e}getLogoutUri(e){if(!e)throw Xe(ww);const t=this.createLogoutUrlQueryString(e);return De.appendQueryString(this.authority.endSessionEndpoint,t)}async executeTokenRequest(e,t){var m,g;(m=this.performanceClient)==null||m.addQueueMeasurement(x.AuthClientExecuteTokenRequest,t.correlationId);const r=this.createTokenQueryParameters(t),o=De.appendQueryString(e.tokenEndpoint,r),a=await Q(this.createTokenRequestBody.bind(this),x.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,t.correlationId)(t);let c;if(t.clientInfo)try{const v=Rl(t.clientInfo,this.cryptoUtils.base64Decode);c={credential:`${v.uid}${tn.CLIENT_INFO_SEPARATOR}${v.utid}`,type:Bn.HOME_ACCOUNT_ID}}catch(v){this.logger.verbose("Could not parse client info for CCS Header: "+v)}const d=this.createTokenRequestHeaders(c||t.ccsCredential),h={clientId:((g=t.tokenBodyParameters)==null?void 0:g.clientId)||this.config.authOptions.clientId,authority:e.canonicalAuthority,scopes:t.scopes,claims:t.claims,authenticationScheme:t.authenticationScheme,resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,sshKid:t.sshKid};return Q(this.executePostToTokenEndpoint.bind(this),x.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,t.correlationId)(o,a,d,h,t.correlationId,x.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var o,a;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthClientCreateTokenRequestBody,e.correlationId);const t=new ys(e.correlationId,this.performanceClient);if(t.addClientId(e.embeddedClientId||((a=e.tokenBodyParameters)==null?void 0:a[wi])||this.config.authOptions.clientId),this.includeRedirectUri?t.addRedirectUri(e.redirectUri):ia.validateRedirectUri(e.redirectUri),t.addScopes(e.scopes,!0,this.oidcDefaultScopes),t.addAuthorizationCode(e.code),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addThrottling(),this.serverTelemetryManager&&!Zh(this.config)&&t.addServerTelemetry(this.serverTelemetryManager),e.codeVerifier&&t.addCodeVerifier(e.codeVerifier),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const c=this.config.clientCredentials.clientAssertion;t.addClientAssertion(await Vw(c.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),t.addClientAssertionType(c.assertionType)}if(t.addGrantType(jE.AUTHORIZATION_CODE_GRANT),t.addClientInfo(),e.authenticationScheme===Ge.POP){const c=new Ia(this.cryptoUtils,this.performanceClient);let d;e.popKid?d=this.cryptoUtils.encodeKid(e.popKid):d=(await Q(c.generateCnf.bind(c),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,t.addPopToken(d)}else if(e.authenticationScheme===Ge.SSH)if(e.sshJwk)t.addSshJwk(e.sshJwk);else throw Xe(cu);(!vr.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const c=Rl(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${c.uid}${tn.CLIENT_INFO_SEPARATOR}${c.utid}`,type:Bn.HOME_ACCOUNT_ID}}catch(c){this.logger.verbose("Could not parse client info for CCS Header: "+c)}else r=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&r)switch(r.type){case Bn.HOME_ACCOUNT_ID:try{const c=fa(r.credential);t.addCcsOid(c)}catch(c){this.logger.verbose("Could not parse home account ID for CCS Header: "+c)}break;case Bn.UPN:t.addCcsUpn(r.credential);break}return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&t.addExtraQueryParameters(e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[Xv])&&t.addExtraQueryParameters({[Xv]:"1"}),t.createQueryString()}async createAuthCodeUrlQueryString(e){var a,c;const t=e.correlationId||this.config.cryptoInterface.createNewGuid();(a=this.performanceClient)==null||a.addQueueMeasurement(x.AuthClientCreateQueryString,t);const r=new ys(t,this.performanceClient);r.addClientId(e.embeddedClientId||((c=e.extraQueryParameters)==null?void 0:c[wi])||this.config.authOptions.clientId);const o=[...e.scopes||[],...e.extraScopesToConsent||[]];if(r.addScopes(o,!0,this.oidcDefaultScopes),r.addRedirectUri(e.redirectUri),r.addCorrelationId(t),r.addResponseMode(e.responseMode),r.addResponseTypeCode(),r.addLibraryInfo(this.config.libraryInfo),Zh(this.config)||r.addApplicationTelemetry(this.config.telemetry.application),r.addClientInfo(),e.codeChallenge&&e.codeChallengeMethod&&r.addCodeChallengeParams(e.codeChallenge,e.codeChallengeMethod),e.prompt&&r.addPrompt(e.prompt),e.domainHint&&r.addDomainHint(e.domainHint),e.prompt!==Bt.SELECT_ACCOUNT)if(e.sid&&e.prompt===Bt.NONE)this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),r.addSid(e.sid);else if(e.account){const d=this.extractAccountSid(e.account);let h=this.extractLoginHint(e.account);if(h&&e.domainHint&&(this.logger.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),h=null),h){this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),r.addLoginHint(h);try{const m=fa(e.account.homeAccountId);r.addCcsOid(m)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(d&&e.prompt===Bt.NONE){this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),r.addSid(d);try{const m=fa(e.account.homeAccountId);r.addCcsOid(m)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),r.addLoginHint(e.loginHint),r.addCcsUpn(e.loginHint);else if(e.account.username){this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),r.addLoginHint(e.account.username);try{const m=fa(e.account.homeAccountId);r.addCcsOid(m)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),r.addLoginHint(e.loginHint),r.addCcsUpn(e.loginHint));else this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");if(e.nonce&&r.addNonce(e.nonce),e.state&&r.addState(e.state),(e.claims||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(e.claims,this.config.authOptions.clientCapabilities),e.embeddedClientId&&r.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),this.addExtraQueryParams(e,r),e.nativeBroker&&(r.addNativeBroker(),e.authenticationScheme===Ge.POP)){const d=new Ia(this.cryptoUtils);let h;e.popKid?h=this.cryptoUtils.encodeKid(e.popKid):h=(await Q(d.generateCnf.bind(d),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,r.addPopToken(h)}return r.createQueryString()}createLogoutUrlQueryString(e){const t=new ys(e.correlationId,this.performanceClient);return e.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(e.postLogoutRedirectUri),e.correlationId&&t.addCorrelationId(e.correlationId),e.idTokenHint&&t.addIdTokenHint(e.idTokenHint),e.state&&t.addState(e.state),e.logoutHint&&t.addLogoutHint(e.logoutHint),this.addExtraQueryParams(e,t),t.createQueryString()}addExtraQueryParams(e,t){!(e.extraQueryParameters&&e.extraQueryParameters.hasOwnProperty("instance_aware"))&&this.config.authOptions.instanceAware&&(e.extraQueryParameters=e.extraQueryParameters||{},e.extraQueryParameters.instance_aware="true"),e.extraQueryParameters&&t.addExtraQueryParameters(e.extraQueryParameters)}extractAccountSid(e){var t;return((t=e.idTokenClaims)==null?void 0:t.sid)||null}extractLoginHint(e){var t;return((t=e.idTokenClaims)==null?void 0:t.login_hint)||null}}/*! @azure/msal-common v14.16.0 2024-11-05 */const O2=300;class nf extends lm{constructor(e,t){super(e,t)}async acquireToken(e){var c,d;(c=this.performanceClient)==null||c.addQueueMeasurement(x.RefreshTokenClientAcquireToken,e.correlationId);const t=zr(),r=await Q(this.executeTokenRequest.bind(this),x.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),o=(d=r.headers)==null?void 0:d[dn.X_MS_REQUEST_ID],a=new Ti(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return a.validateTokenResponse(r.body),Q(a.handleServerTokenResponse.bind(a),x.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,t,e,void 0,void 0,!0,e.forceCache,o)}async acquireTokenByRefreshToken(e){var r;if(!e)throw Xe(Ew);if((r=this.performanceClient)==null||r.addQueueMeasurement(x.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw Y(jf);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await Q(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(o){const a=o instanceof Er&&o.errorCode===Dl,c=o instanceof Wo&&o.errorCode===Bv.INVALID_GRANT_ERROR&&o.subError===Bv.CLIENT_MISMATCH_ERROR;if(a||c)return Q(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw o}return Q(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const r=Ai(this.cacheManager.getRefreshToken.bind(this.cacheManager),x.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,t,void 0,this.performanceClient,e.correlationId);if(!r)throw tf(Dl);if(r.expiresOn&&Xh(r.expiresOn,e.refreshTokenExpirationOffsetSeconds||O2))throw tf(um);const o={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||Ge.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:Bn.HOME_ACCOUNT_ID}};try{return await Q(this.acquireToken.bind(this),x.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(o)}catch(c){if(c instanceof Er&&c.subError===du){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const d=ha(r);this.cacheManager.removeRefreshToken(d)}throw c}}async executeTokenRequest(e,t){var h,m;(h=this.performanceClient)==null||h.addQueueMeasurement(x.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),o=De.appendQueryString(t.tokenEndpoint,r),a=await Q(this.createTokenRequestBody.bind(this),x.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),c=this.createTokenRequestHeaders(e.ccsCredential),d={clientId:((m=e.tokenBodyParameters)==null?void 0:m.clientId)||this.config.authOptions.clientId,authority:t.canonicalAuthority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid};return Q(this.executePostToTokenEndpoint.bind(this),x.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(o,a,c,d,e.correlationId,x.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var o,a,c;(o=this.performanceClient)==null||o.addQueueMeasurement(x.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const t=e.correlationId,r=new ys(t,this.performanceClient);if(r.addClientId(e.embeddedClientId||((a=e.tokenBodyParameters)==null?void 0:a[wi])||this.config.authOptions.clientId),e.redirectUri&&r.addRedirectUri(e.redirectUri),r.addScopes(e.scopes,!0,(c=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:c.defaultScopes),r.addGrantType(jE.REFRESH_TOKEN_GRANT),r.addClientInfo(),r.addLibraryInfo(this.config.libraryInfo),r.addApplicationTelemetry(this.config.telemetry.application),r.addThrottling(),this.serverTelemetryManager&&!Zh(this.config)&&r.addServerTelemetry(this.serverTelemetryManager),r.addRefreshToken(e.refreshToken),this.config.clientCredentials.clientSecret&&r.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const d=this.config.clientCredentials.clientAssertion;r.addClientAssertion(await Vw(d.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),r.addClientAssertionType(d.assertionType)}if(e.authenticationScheme===Ge.POP){const d=new Ia(this.cryptoUtils,this.performanceClient);let h;e.popKid?h=this.cryptoUtils.encodeKid(e.popKid):h=(await Q(d.generateCnf.bind(d),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,r.addPopToken(h)}else if(e.authenticationScheme===Ge.SSH)if(e.sshJwk)r.addSshJwk(e.sshJwk);else throw Xe(cu);if((!vr.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case Bn.HOME_ACCOUNT_ID:try{const d=fa(e.ccsCredential.credential);r.addCcsOid(d)}catch(d){this.logger.verbose("Could not parse home account ID for CCS Header: "+d)}break;case Bn.UPN:r.addCcsUpn(e.ccsCredential.credential);break}return e.embeddedClientId&&r.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&r.addExtraQueryParameters(e.tokenBodyParameters),r.createQueryString()}}/*! @azure/msal-common v14.16.0 2024-11-05 */class P2 extends lm{constructor(e,t){super(e,t)}async acquireToken(e){var t;try{const[r,o]=await this.acquireCachedToken({...e,scopes:(t=e.scopes)!=null&&t.length?e.scopes:[...Ma]});return o===Mo.PROACTIVELY_REFRESHED&&(this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."),new nf(this.config,this.performanceClient).acquireTokenByRefreshToken(e).catch(()=>{})),r}catch(r){if(r instanceof iu&&r.errorCode===co)return new nf(this.config,this.performanceClient).acquireTokenByRefreshToken(e);throw r}}async acquireCachedToken(e){var h;(h=this.performanceClient)==null||h.addQueueMeasurement(x.SilentFlowClientAcquireCachedToken,e.correlationId);let t=Mo.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!vr.isEmptyObj(e.claims))throw this.setCacheOutcome(Mo.FORCE_REFRESH_OR_CLAIMS,e.correlationId),Y(co);if(!e.account)throw Y(jf);const r=e.account.tenantId||E2(e.authority),o=this.cacheManager.getTokenKeys(),a=this.cacheManager.getAccessToken(e.account,e,o,r,this.performanceClient,e.correlationId);if(a){if(sV(a.cachedAt)||Xh(a.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(Mo.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),Y(co);a.refreshOn&&Xh(a.refreshOn,0)&&(t=Mo.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(Mo.NO_CACHED_ACCESS_TOKEN,e.correlationId),Y(co);const c=e.authority||this.authority.getPreferredCache(),d={account:this.cacheManager.readAccountFromCache(e.account),accessToken:a,idToken:this.cacheManager.getIdToken(e.account,o,r,this.performanceClient,e.correlationId),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(c)};return this.setCacheOutcome(t,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await Q(this.generateResultFromCacheRecord.bind(this),x.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(d,e),t]}setCacheOutcome(e,t){var r,o;(r=this.serverTelemetryManager)==null||r.setCacheOutcome(e),(o=this.performanceClient)==null||o.addFields({cacheOutcome:e},t),e!==Mo.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,t){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(x.SilentFlowClientGenerateResultFromCacheRecord,t.correlationId);let r;if(e.idToken&&(r=Si(e.idToken.secret,this.config.cryptoInterface.base64Decode)),t.maxAge||t.maxAge===0){const a=r==null?void 0:r.auth_time;if(!a)throw Y(qf);mw(a,t.maxAge)}return Ti.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,t,r)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const M2={sendGetRequestAsync:()=>Promise.reject(Y(Ae)),sendPostRequestAsync:()=>Promise.reject(Y(Ae))};/*! @azure/msal-common v14.16.0 2024-11-05 */const ny=",",$w="|";function D2(n){const{skus:e,libraryName:t,libraryVersion:r,extensionName:o,extensionVersion:a}=n,c=new Map([[0,[t,r]],[2,[o,a]]]);let d=[];if(e!=null&&e.length){if(d=e.split(ny),d.length<4)return e}else d=Array.from({length:4},()=>$w);return c.forEach((h,m)=>{var g,v;h.length===2&&((g=h[0])!=null&&g.length)&&((v=h[1])!=null&&v.length)&&L2({skuArr:d,index:m,skuName:h[0],skuVersion:h[1]})}),d.join(ny)}function L2(n){const{skuArr:e,index:t,skuName:r,skuVersion:o}=n;t>=e.length||(e[t]=[r,o].join($w))}class Os{constructor(e,t){this.cacheOutcome=Mo.NOT_APPLICABLE,this.cacheManager=t,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||F.EMPTY_STRING,this.wrapperVer=e.wrapperVer||F.EMPTY_STRING,this.telemetryCacheKey=Wt.CACHE_KEY+tn.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${Wt.VALUE_SEPARATOR}${this.cacheOutcome}`,t=[this.wrapperSKU,this.wrapperVer],r=this.getNativeBrokerErrorCode();r!=null&&r.length&&t.push(`broker_error=${r}`);const o=t.join(Wt.VALUE_SEPARATOR),a=this.getRegionDiscoveryFields(),c=[e,a].join(Wt.VALUE_SEPARATOR);return[Wt.SCHEMA_VERSION,c,o].join(Wt.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),t=Os.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*t).join(Wt.VALUE_SEPARATOR),o=e.errors.slice(0,t).join(Wt.VALUE_SEPARATOR),a=e.errors.length,c=t<a?Wt.OVERFLOW_TRUE:Wt.OVERFLOW_FALSE,d=[a,c].join(Wt.VALUE_SEPARATOR);return[Wt.SCHEMA_VERSION,e.cacheHits,r,o,d].join(Wt.CATEGORY_SEPARATOR)}cacheFailedRequest(e){const t=this.getLastRequests();t.errors.length>=Wt.MAX_CACHED_ERRORS&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof lt?e.subError?t.errors.push(e.subError):e.errorCode?t.errors.push(e.errorCode):t.errors.push(e.toString()):t.errors.push(e.toString()):t.errors.push(Wt.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),t=Os.maxErrorsToSend(e),r=e.errors.length;if(t===r)this.cacheManager.removeItem(this.telemetryCacheKey);else{const o={failedRequests:e.failedRequests.slice(t*2),errors:e.errors.slice(t),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,o)}}static maxErrorsToSend(e){let t,r=0,o=0;const a=e.errors.length;for(t=0;t<a;t++){const c=e.failedRequests[2*t]||F.EMPTY_STRING,d=e.failedRequests[2*t+1]||F.EMPTY_STRING,h=e.errors[t]||F.EMPTY_STRING;if(o+=c.toString().length+d.toString().length+h.length+3,o<Wt.MAX_LAST_HEADER_BYTES)r+=1;else break}return r}getRegionDiscoveryFields(){const e=[];return e.push(this.regionUsed||F.EMPTY_STRING),e.push(this.regionSource||F.EMPTY_STRING),e.push(this.regionOutcome||F.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 t=this.getLastRequests();t.nativeBrokerErrorCode=e,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}getNativeBrokerErrorCode(){return this.getLastRequests().nativeBrokerErrorCode}clearNativeBrokerErrorCode(){const e=this.getLastRequests();delete e.nativeBrokerErrorCode,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e)}static makeExtraSkuString(e){return D2(e)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Kw="missing_kid_error",Ww="missing_alg_error";/*! @azure/msal-common v14.16.0 2024-11-05 */const x2={[Kw]:"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.",[Ww]:"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 hm extends lt{constructor(e,t){super(e,t),this.name="JoseHeaderError",Object.setPrototypeOf(this,hm.prototype)}}function ry(n){return new hm(n,x2[n])}/*! @azure/msal-common v14.16.0 2024-11-05 */class fm{constructor(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}static getShrHeaderString(e){if(!e.kid)throw ry(Kw);if(!e.alg)throw ry(Ww);const t=new fm({typ:e.typ||zF.Pop,kid:e.kid,alg:e.alg});return JSON.stringify(t)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class oy{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class U2{generateId(){return"callback-id"}startMeasurement(e,t){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:C2.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:t||""},measurement:new oy}}startPerformanceMeasurement(){return new oy}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const mm="pkce_not_created",rf="crypto_nonexistent",hu="empty_navigate_uri",zw="hash_empty_error",gm="no_state_in_hash",Gw="hash_does_not_contain_known_properties",qw="unable_to_parse_state",jw="state_interaction_type_mismatch",Yw="interaction_in_progress",Jw="popup_window_error",Qw="empty_window_error",bi="user_cancelled",B2="monitor_popup_timeout",Xw="monitor_window_timeout",Zw="redirect_in_iframe",eT="block_iframe_reload",tT="block_nested_popups",F2="iframe_closed_prematurely",fu="silent_logout_unsupported",nT="no_account_error",V2="silent_prompt_value_error",rT="no_token_request_cache_error",oT="unable_to_parse_token_request_cache_error",pm="no_cached_authority_error",H2="auth_request_not_set_error",$2="invalid_cache_type",mu="non_browser_environment",aa="database_not_open",Ll="no_network_connectivity",iT="post_request_failed",aT="get_request_failed",of="failed_to_parse_response",sT="unable_to_load_token",_m="crypto_key_not_found",cT="auth_code_required",lT="auth_code_or_nativeAccountId_required",uT="spa_code_and_nativeAccountId_present",vm="database_unavailable",dT="unable_to_acquire_token_from_native_platform",hT="native_handshake_timeout",fT="native_extension_not_installed",Ks="native_connection_not_established",mT="uninitialized_public_client_application",gT="native_prompt_not_supported",pT="invalid_base64_string",_T="invalid_pop_token_request",vT="failed_to_build_headers",yT="failed_to_parse_headers";/*! @azure/msal-browser v3.28.1 2025-01-14 */const io="For more visit: aka.ms/msaljs/browser-errors",K2={[mm]:"The PKCE code challenge and verifier could not be generated.",[rf]:"The crypto object or function is not available.",[hu]:"Navigation URI is empty. Please check stack trace for more info.",[zw]:`Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. ${io}`,[gm]:"Hash does not contain state. Please verify that the request originated from msal.",[Gw]:`Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. ${io}`,[qw]:"Unable to parse state. Please verify that the request originated from msal.",[jw]:"Hash contains state but the interaction type does not match the caller.",[Yw]:`Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. ${io}`,[Jw]:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.",[Qw]:"window.open returned null or undefined window object.",[bi]:"User cancelled the flow.",[B2]:`Token acquisition in popup failed due to timeout. ${io}`,[Xw]:`Token acquisition in iframe failed due to timeout. ${io}`,[Zw]:"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.",[eT]:`Request was blocked inside an iframe because MSAL detected an authentication response. ${io}`,[tT]:"Request was blocked inside a popup because MSAL detected it was running in a popup.",[F2]:"The iframe being monitored was closed prematurely.",[fu]:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead.",[nT]:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.",[V2]:"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'.",[rT]:"No token request found in cache.",[oT]:"The cached token request could not be parsed.",[pm]:"No cached authority found.",[H2]:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler",[$2]:"Invalid cache type",[mu]:"Login and token requests are not supported in non-browser environments.",[aa]:"Database is not open!",[Ll]:"No network connectivity. Check your internet connection.",[iT]:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'",[aT]:"Network request failed. Please check the network trace to determine root cause.",[of]:"Failed to parse network response. Check network trace.",[sT]:"Error loading token to cache.",[_m]:"Cryptographic Key or Keypair not found in browser storage.",[cT]:"An authorization code must be provided (as the `code` property on the request) to this flow.",[lT]:"An authorization code or nativeAccountId must be provided to this flow.",[uT]:"Request cannot contain both spa code and native account id.",[vm]:"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.",[dT]:`Unable to acquire token from native platform. ${io}`,[hT]:"Timed out while attempting to establish connection to browser extension",[fT]:"Native extension is not installed. If you think this is a mistake call the initialize function.",[Ks]:`Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). ${io}`,[mT]:`You must call and await the initialize function before attempting to call any other MSAL API. ${io}`,[gT]:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",[pT]:"Invalid base64 encoded string.",[_T]:"Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",[vT]:"Failed to build request headers object.",[yT]:"Failed to parse response headers"};class Ws extends lt{constructor(e,t){super(e,K2[e],t),Object.setPrototypeOf(this,Ws.prototype),this.name="BrowserAuthError"}}function ie(n,e){return new Ws(n,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Dn={INTERACTION_IN_PROGRESS_VALUE:"interaction_in_progress",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"},ma={CHANNEL_ID:"53ee284d-920a-4b59-9d30-a60315b26836",PREFERRED_EXTENSION_ID:"ppnbnpeolgkicgegkbkbjmhlideopiji",MATS_TELEMETRY:"MATS"},gi={HandshakeRequest:"Handshake",HandshakeResponse:"HandshakeResponse",GetToken:"GetToken",Response:"Response"},vn={LocalStorage:"localStorage",SessionStorage:"sessionStorage",MemoryStorage:"memoryStorage"},iy={GET:"GET",POST:"POST"},Ke={AUTHORITY:"authority",ACQUIRE_TOKEN_ACCOUNT:"acquireToken.account",SESSION_STATE:"session.state",REQUEST_STATE:"request.state",NONCE_IDTOKEN:"nonce.id_token",ORIGIN_URI:"request.origin",RENEW_STATUS:"token.renew.status",URL_HASH:"urlHash",REQUEST_PARAMS:"request.params",SCOPES:"scopes",INTERACTION_STATUS_KEY:"interaction.status",CCS_CREDENTIAL:"ccs.credential",CORRELATION_ID:"request.correlationId",NATIVE_REQUEST:"request.native",REDIRECT_CONTEXT:"request.redirect.context"},Po={ACCOUNT_KEYS:"msal.account.keys",TOKEN_KEYS:"msal.token.keys"},qc={WRAPPER_SKU:"wrapper.sku",WRAPPER_VER:"wrapper.version"},ot={acquireTokenRedirect:861,acquireTokenPopup:862,ssoSilent:863,acquireTokenSilent_authCode:864,handleRedirectPromise:865,acquireTokenByCode:866,acquireTokenSilent_silentFlow:61,logout:961,logoutPopup:962};var le;(function(n){n.Redirect="redirect",n.Popup="popup",n.Silent="silent",n.None="none"})(le||(le={}));const ay={scopes:Ma},CT="jwk",af="msal.db",W2=1,z2=`${af}.keys`,Pn={Default:0,AccessToken:1,AccessTokenAndRefreshToken:2,RefreshToken:3,RefreshTokenAndNetwork:4,Skip:5},G2=[Pn.Default,Pn.Skip,Pn.RefreshTokenAndNetwork],q2="msal.browser.log.level",j2="msal.browser.log.pii";/*! @azure/msal-browser v3.28.1 2025-01-14 */function jc(n){return encodeURIComponent(ym(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"))}function gu(n){return ET(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ym(n){return ET(new TextEncoder().encode(n))}function ET(n){const e=Array.from(n,t=>String.fromCodePoint(t)).join("");return btoa(e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Y2="RSASSA-PKCS1-v1_5",wT="SHA-256",J2=2048,Q2=new Uint8Array([1,0,1]),sy="0123456789abcdef",cy=new Uint32Array(1),X2="crypto_subtle_undefined",Cm={name:Y2,hash:wT,modulusLength:J2,publicExponent:Q2};function Z2(n){if(!window)throw ie(mu);if(!window.crypto)throw ie(rf);if(!n&&!window.crypto.subtle)throw ie(rf,X2)}async function TT(n,e,t){e==null||e.addQueueMeasurement(x.Sha256Digest,t);const o=new TextEncoder().encode(n);return window.crypto.subtle.digest(wT,o)}function eH(n){return window.crypto.getRandomValues(n)}function sh(){return window.crypto.getRandomValues(cy),cy[0]}function go(){const n=Date.now(),e=sh()*1024+(sh()&1023),t=new Uint8Array(16),r=Math.trunc(e/2**30),o=e&2**30-1,a=sh();t[0]=n/2**40,t[1]=n/2**32,t[2]=n/2**24,t[3]=n/2**16,t[4]=n/2**8,t[5]=n,t[6]=112|r>>>8,t[7]=r,t[8]=128|o>>>24,t[9]=o>>>16,t[10]=o>>>8,t[11]=o,t[12]=a>>>24,t[13]=a>>>16,t[14]=a>>>8,t[15]=a;let c="";for(let d=0;d<t.length;d++)c+=sy.charAt(t[d]>>>4),c+=sy.charAt(t[d]&15),(d===3||d===5||d===7||d===9)&&(c+="-");return c}async function tH(n,e){return window.crypto.subtle.generateKey(Cm,n,e)}async function ch(n){return window.crypto.subtle.exportKey(CT,n)}async function nH(n,e,t){return window.crypto.subtle.importKey(CT,n,Cm,e,t)}async function rH(n,e){return window.crypto.subtle.sign(Cm,n,e)}async function bT(n){const e=await TT(n),t=new Uint8Array(e);return gu(t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Ps="storage_not_supported",sf="stubbed_public_client_application_called",xl="in_mem_redirect_unavailable";/*! @azure/msal-browser v3.28.1 2025-01-14 */const gl={[Ps]:"Given storage configuration option was not supported.",[sf]:"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",[xl]:"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."};gl[Ps],gl[sf],gl[xl];class Em extends lt{constructor(e,t){super(e,t),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,Em.prototype)}}function wm(n){return new Em(n,gl[n])}/*! @azure/msal-browser v3.28.1 2025-01-14 */function oH(n){n.location.hash="",typeof n.history.replaceState=="function"&&n.history.replaceState(null,"",`${n.location.origin}${n.location.pathname}${n.location.search}`)}function iH(n){const e=n.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function Tm(){return window.parent!==window}function aH(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${Dn.POPUP_NAME_PREFIX}.`)===0}function lo(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function sH(){const e=new De(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function cH(){if(De.hashContainsKnownProperties(window.location.hash)&&Tm())throw ie(eT)}function lH(n){if(Tm()&&!n)throw ie(Zw)}function uH(){if(aH())throw ie(tT)}function IT(){if(typeof window>"u")throw ie(mu)}function ST(n){if(!n)throw ie(mT)}function bm(n){IT(),cH(),uH(),ST(n)}function ly(n,e){if(bm(n),lH(e.system.allowRedirectInIframe),e.cache.cacheLocation===vn.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw wm(xl)}function AT(n){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(n).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function dH(){return go()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ul{navigateInternal(e,t){return Ul.defaultNavigateWindow(e,t)}navigateExternal(e,t){return Ul.defaultNavigateWindow(e,t)}static defaultNavigateWindow(e,t){return t.noHistory?window.location.replace(e):window.location.assign(e),new Promise(r=>{setTimeout(()=>{r(!0)},t.timeout)})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class hH{async sendGetRequestAsync(e,t){let r,o={},a=0;const c=uy(t);try{r=await fetch(e,{method:iy.GET,headers:c})}catch{throw ie(window.navigator.onLine?aT:Ll)}o=dy(r.headers);try{return a=r.status,{headers:o,body:await r.json(),status:a}}catch{throw Zv(ie(of),a,o)}}async sendPostRequestAsync(e,t){const r=t&&t.body||"",o=uy(t);let a,c=0,d={};try{a=await fetch(e,{method:iy.POST,headers:o,body:r})}catch{throw ie(window.navigator.onLine?iT:Ll)}d=dy(a.headers);try{return c=a.status,{headers:d,body:await a.json(),status:c}}catch{throw Zv(ie(of),c,d)}}}function uy(n){try{const e=new Headers;if(!(n&&n.headers))return e;const t=n.headers;return Object.entries(t).forEach(([r,o])=>{e.append(r,o)}),e}catch{throw ie(vT)}}function dy(n){try{const e={};return n.forEach((t,r)=>{e[r]=t}),e}catch{throw ie(yT)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const fH=6e4,cf=1e4,mH=3e4,gH=2e3;function pH({auth:n,cache:e,system:t,telemetry:r},o){const a={clientId:F.EMPTY_STRING,authority:`${F.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:F.EMPTY_STRING,authorityMetadata:F.EMPTY_STRING,redirectUri:typeof window<"u"?lo():"",postLogoutRedirectUri:F.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:fo.AAD,OIDCOptions:{serverResponseType:$s.FRAGMENT,defaultScopes:[F.OPENID_SCOPE,F.PROFILE_SCOPE,F.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:Xf.None,tenant:F.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1},c={cacheLocation:vn.SessionStorage,temporaryCacheLocation:vn.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===vn.LocalStorage),claimsBasedCachingEnabled:!1},d={loggerCallback:()=>{},logLevel:tt.Info,piiLoggingEnabled:!1},m={...{...Lw,loggerOptions:d,networkClient:o?new hH:M2,navigationClient:new Ul,loadFrameTimeout:0,windowHashTimeout:(t==null?void 0:t.loadFrameTimeout)||fH,iframeHashTimeout:(t==null?void 0:t.loadFrameTimeout)||cf,navigateFrameWait:0,redirectNavigationTimeout:mH,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:(t==null?void 0:t.nativeBrokerHandshakeTimeout)||gH,pollIntervalMilliseconds:Dn.DEFAULT_POLL_INTERVAL_MS},...t,loggerOptions:(t==null?void 0:t.loggerOptions)||d},g={application:{appName:F.EMPTY_STRING,appVersion:F.EMPTY_STRING},client:new U2};if((n==null?void 0:n.protocolMode)!==fo.OIDC&&(n!=null&&n.OIDCOptions)&&new Ko(m.loggerOptions).warning(JSON.stringify(Xe(Aw))),n!=null&&n.protocolMode&&n.protocolMode!==fo.AAD&&(m!=null&&m.allowNativeBroker))throw Xe(kw);return{auth:{...a,...n,OIDCOptions:{...a.OIDCOptions,...n==null?void 0:n.OIDCOptions}},cache:{...c,...e},system:m,telemetry:{...g,...r}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const _H="@azure/msal-browser",pu="3.28.1";/*! @azure/msal-browser v3.28.1 2025-01-14 */class Im{static loggerCallback(e,t){switch(e){case tt.Error:console.error(t);return;case tt.Info:console.info(t);return;case tt.Verbose:console.debug(t);return;case tt.Warning:console.warn(t);return;default:console.log(t);return}}constructor(e){var h;this.browserEnvironment=typeof window<"u",this.config=pH(e,this.browserEnvironment);let t;try{t=window[vn.SessionStorage]}catch{}const r=t==null?void 0:t.getItem(q2),o=(h=t==null?void 0:t.getItem(j2))==null?void 0:h.toLowerCase(),a=o==="true"?!0:o==="false"?!1:void 0,c={...this.config.system.loggerOptions},d=r&&Object.keys(tt).includes(r)?tt[r]:void 0;d&&(c.loggerCallback=Im.loggerCallback,c.logLevel=d),a!==void 0&&(c.piiLoggingEnabled=a),this.logger=new Ko(c,_H,pu),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ii extends Im{getModuleName(){return Ii.MODULE_NAME}getId(){return Ii.ID}async initialize(){return this.available=typeof window<"u",this.available}}Ii.MODULE_NAME="";Ii.ID="StandardOperatingContext";/*! @azure/msal-browser v3.28.1 2025-01-14 */function Kr(n){return new TextDecoder().decode(vH(n))}function vH(n){let e=n.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw ie(pT)}const t=atob(e);return Uint8Array.from(t,r=>r.codePointAt(0)||0)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class yH{constructor(){this.dbName=af,this.version=W2,this.tableName=z2,this.dbOpen=!1}async open(){return new Promise((e,t)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",o=>{o.target.result.createObjectStore(this.tableName)}),r.addEventListener("success",o=>{const a=o;this.db=a.target.result,this.dbOpen=!0,e()}),r.addEventListener("error",()=>t(ie(vm)))})}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((t,r)=>{if(!this.db)return r(ie(aa));const c=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);c.addEventListener("success",d=>{const h=d;this.closeConnection(),t(h.target.result)}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async setItem(e,t){return await this.validateDbIsOpen(),new Promise((r,o)=>{if(!this.db)return o(ie(aa));const d=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(t,e);d.addEventListener("success",()=>{this.closeConnection(),r()}),d.addEventListener("error",h=>{this.closeConnection(),o(h)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(ie(aa));const c=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);c.addEventListener("success",()=>{this.closeConnection(),t()}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,t)=>{if(!this.db)return t(ie(aa));const a=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();a.addEventListener("success",c=>{const d=c;this.closeConnection(),e(d.target.result)}),a.addEventListener("error",c=>{this.closeConnection(),t(c)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(ie(aa));const c=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);c.addEventListener("success",d=>{const h=d;this.closeConnection(),t(h.target.result===1)}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,t)=>{const r=window.indexedDB.deleteDatabase(af),o=setTimeout(()=>t(!1),200);r.addEventListener("success",()=>(clearTimeout(o),e(!0))),r.addEventListener("blocked",()=>(clearTimeout(o),e(!0))),r.addEventListener("error",()=>(clearTimeout(o),t(!1)))})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class lf{constructor(){this.cache=new Map}getItem(e){return this.cache.get(e)||null}setItem(e,t){this.cache.set(e,t)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((t,r)=>{e.push(r)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class CH{constructor(e){this.inMemoryCache=new lf,this.indexedDBCache=new yH,this.logger=e}handleDatabaseAccessError(e){if(e instanceof Ws&&e.errorCode===vm)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 t=this.inMemoryCache.getItem(e);if(!t)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 t}async setItem(e,t){this.inMemoryCache.setItem(e,t);try{await this.indexedDBCache.setItem(e,t)}catch(r){this.handleDatabaseAccessError(r)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(t){this.handleDatabaseAccessError(t)}}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(t){this.handleDatabaseAccessError(t)}return e}async containsKey(e){const t=this.inMemoryCache.containsKey(e);if(!t)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 t}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}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Sa{constructor(e,t,r){this.logger=e,Z2(r??!1),this.cache=new CH(this.logger),this.performanceClient=t}createNewGuid(){return go()}base64Encode(e){return ym(e)}base64Decode(e){return Kr(e)}base64UrlEncode(e){return jc(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var g;const t=(g=this.performanceClient)==null?void 0:g.startMeasurement(x.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await tH(Sa.EXTRACTABLE,Sa.POP_KEY_USAGES),o=await ch(r.publicKey),a={e:o.e,kty:o.kty,n:o.n},c=hy(a),d=await this.hashString(c),h=await ch(r.privateKey),m=await nH(h,!1,["sign"]);return await this.cache.setItem(d,{privateKey:m,publicKey:r.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),t&&t.end({success:!0}),d}async removeTokenBindingKey(e){return await this.cache.removeItem(e),!await this.cache.containsKey(e)}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,t,r,o){var D;const a=(D=this.performanceClient)==null?void 0:D.startMeasurement(x.CryptoOptsSignJwt,o),c=await this.cache.getItem(t);if(!c)throw ie(_m);const d=await ch(c.publicKey),h=hy(d),m=jc(JSON.stringify({kid:t})),g=fm.getShrHeaderString({...r==null?void 0:r.header,alg:d.alg,kid:m}),v=jc(g);e.cnf={jwk:JSON.parse(h)};const p=jc(JSON.stringify(e)),w=`${v}.${p}`,T=new TextEncoder().encode(w),k=await rH(c.privateKey,T),I=gu(new Uint8Array(k)),N=`${w}.${I}`;return a&&a.end({success:!0}),N}async hashString(e){return bT(e)}}Sa.POP_KEY_USAGES=["sign","verify"];Sa.EXTRACTABLE=!0;function hy(n){return JSON.stringify(n,Object.keys(n).sort())}/*! @azure/msal-browser v3.28.1 2025-01-14 */class EH{constructor(){if(!window.localStorage)throw wm(Ps)}getItem(e){return window.localStorage.getItem(e)}setItem(e,t){window.localStorage.setItem(e,t)}removeItem(e){window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class wH{constructor(){if(!window.sessionStorage)throw wm(Ps)}getItem(e){return window.sessionStorage.getItem(e)}setItem(e,t){window.sessionStorage.setItem(e,t)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function kT(n,e){if(!e)return null;try{return yr.parseRequestState(n,e).libraryState.meta}catch{throw Y(Ta)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const TH=24*60*60*1e3;class bH{getItem(e){const t=`${encodeURIComponent(e)}`,r=document.cookie.split(";");for(let o=0;o<r.length;o++){const a=r[o],[c,...d]=decodeURIComponent(a).trim().split("="),h=d.join("=");if(c===t)return h}return""}setItem(e,t,r,o=!0){let a=`${encodeURIComponent(e)}=${encodeURIComponent(t)};path=/;SameSite=Lax;`;if(r){const c=IH(r);a+=`expires=${c};`}o&&(a+="Secure;"),document.cookie=a}removeItem(e){this.setItem(e,"",-1)}getKeys(){const e=document.cookie.split(";"),t=[];return e.forEach(r=>{const o=decodeURIComponent(r).trim().split("=");t.push(o[0])}),t}containsKey(e){return this.getKeys().includes(e)}}function IH(n){const e=new Date;return new Date(e.getTime()+n*TH).toUTCString()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class uf extends ba{constructor(e,t,r,o,a,c){super(e,r,o,a),this.cacheConfig=t,this.logger=o,this.internalStorage=new lf,this.browserStorage=this.setupBrowserStorage(this.cacheConfig.cacheLocation),this.temporaryCacheStorage=this.setupBrowserStorage(this.cacheConfig.temporaryCacheLocation),this.cookieStorage=new bH,t.cacheMigrationEnabled&&(this.migrateCacheEntries(),this.createKeyMaps()),this.performanceClient=c}setupBrowserStorage(e){try{switch(e){case vn.LocalStorage:return new EH;case vn.SessionStorage:return new wH;case vn.MemoryStorage:default:break}}catch(t){this.logger.error(t)}return this.cacheConfig.cacheLocation=vn.MemoryStorage,new lf}migrateCacheEntries(){const e=`${F.CACHE_PREFIX}.${Lt.ID_TOKEN}`,t=`${F.CACHE_PREFIX}.${Lt.CLIENT_INFO}`,r=`${F.CACHE_PREFIX}.${Lt.ERROR}`,o=`${F.CACHE_PREFIX}.${Lt.ERROR_DESC}`,a=this.browserStorage.getItem(e),c=this.browserStorage.getItem(t),d=this.browserStorage.getItem(r),h=this.browserStorage.getItem(o),m=[a,c,d,h];[Lt.ID_TOKEN,Lt.CLIENT_INFO,Lt.ERROR,Lt.ERROR_DESC].forEach((v,p)=>{const w=m[p];w&&this.setTemporaryCache(v,w,!0)})}createKeyMaps(){this.logger.trace("BrowserCacheManager - createKeyMaps called.");const e=this.getItem(Po.ACCOUNT_KEYS),t=this.getItem(`${Po.TOKEN_KEYS}.${this.clientId}`);if(e&&t){this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.");return}this.browserStorage.getKeys().forEach(o=>{if(this.isCredentialKey(o)){const a=this.getItem(o);if(a){const c=this.validateAndParseJson(a);if(c&&c.hasOwnProperty("credentialType"))switch(c.credentialType){case ge.ID_TOKEN:if(Kv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,ge.ID_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed idToken validation on key: ${o}`);break;case ge.ACCESS_TOKEN:case ge.ACCESS_TOKEN_WITH_AUTH_SCHEME:if($v(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,ge.ACCESS_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed accessToken validation on key: ${o}`);break;case ge.REFRESH_TOKEN:if(Wv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,ge.REFRESH_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: ${o}`);break}}}if(this.isAccountKey(o)){const a=this.getItem(o);if(a){const c=this.validateAndParseJson(a);c&&Pt.isAccountEntity(c)&&(this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${o} found, saving key to account key map`),this.addAccountKeyToMap(o))}}})}validateAndParseJson(e){try{const t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}getItem(e){return this.browserStorage.getItem(e)}setItem(e,t){this.browserStorage.setItem(e,t)}getAccount(e,t){this.logger.trace("BrowserCacheManager.getAccount called");const r=this.getCachedAccountEntity(e);return this.updateOutdatedCachedAccount(e,r,t)}getCachedAccountEntity(e){const t=this.getItem(e);if(!t)return this.removeAccountKeyFromMap(e),null;const r=this.validateAndParseJson(t);return!r||!Pt.isAccountEntity(r)?(this.removeAccountKeyFromMap(e),null):ba.toObject(new Pt,r)}setAccount(e){this.logger.trace("BrowserCacheManager.setAccount called");const t=e.generateAccountKey();this.setItem(t,JSON.stringify(e)),this.addAccountKeyToMap(t)}getAccountKeys(){this.logger.trace("BrowserCacheManager.getAccountKeys called");const e=this.getItem(Po.ACCOUNT_KEYS);return e?JSON.parse(e):(this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found"),[])}addAccountKeyToMap(e){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${e}`);const t=this.getAccountKeys();t.indexOf(e)===-1?(t.push(e),this.setItem(Po.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added")):this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map")}removeAccountKeyFromMap(e){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${e}`);const t=this.getAccountKeys(),r=t.indexOf(e);r>-1?(t.splice(r,1),this.setItem(Po.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")):this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}async removeAccount(e){super.removeAccount(e),this.removeAccountKeyFromMap(e)}removeOutdatedAccount(e){this.removeItem(e),this.removeAccountKeyFromMap(e)}removeIdToken(e){super.removeIdToken(e),this.removeTokenKey(e,ge.ID_TOKEN)}async removeAccessToken(e){super.removeAccessToken(e),this.removeTokenKey(e,ge.ACCESS_TOKEN)}removeRefreshToken(e){super.removeRefreshToken(e),this.removeTokenKey(e,ge.REFRESH_TOKEN)}getTokenKeys(){this.logger.trace("BrowserCacheManager.getTokenKeys called");const e=this.getItem(`${Po.TOKEN_KEYS}.${this.clientId}`);if(e){const t=this.validateAndParseJson(e);if(t&&t.hasOwnProperty("idToken")&&t.hasOwnProperty("accessToken")&&t.hasOwnProperty("refreshToken"))return t;this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.")}else this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");return{idToken:[],accessToken:[],refreshToken:[]}}addTokenKey(e,t){this.logger.trace("BrowserCacheManager addTokenKey called");const r=this.getTokenKeys();switch(t){case ge.ID_TOKEN:r.idToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),r.idToken.push(e));break;case ge.ACCESS_TOKEN:r.accessToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - accessToken added to map"),r.accessToken.push(e));break;case ge.REFRESH_TOKEN:r.refreshToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),r.refreshToken.push(e));break;default:throw this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${t}`),Y(Qh)}this.setItem(`${Po.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}removeTokenKey(e,t){this.logger.trace("BrowserCacheManager removeTokenKey called");const r=this.getTokenKeys();switch(t){case ge.ID_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: ${e} from map`);const o=r.idToken.indexOf(e);o>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map"),r.idToken.splice(o,1)):this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");break;case ge.ACCESS_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: ${e} from map`);const a=r.accessToken.indexOf(e);a>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map"),r.accessToken.splice(a,1)):this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");break;case ge.REFRESH_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: ${e} from map`);const c=r.refreshToken.indexOf(e);c>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map"),r.refreshToken.splice(c,1)):this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");break;default:throw this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${t}`),Y(Qh)}this.setItem(`${Po.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}getIdTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ID_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Kv(r)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ID_TOKEN),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),r)}setIdTokenCredential(e){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const t=ha(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,ge.ID_TOKEN)}getAccessTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ACCESS_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!$v(r)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.ACCESS_TOKEN),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),r)}setAccessTokenCredential(e){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const t=ha(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,ge.ACCESS_TOKEN)}getRefreshTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.REFRESH_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Wv(r)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,ge.REFRESH_TOKEN),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),r)}setRefreshTokenCredential(e){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const t=ha(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,ge.REFRESH_TOKEN)}getAppMetadata(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!pV(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),r)}setAppMetadata(e){this.logger.trace("BrowserCacheManager.setAppMetadata called");const t=gV(e);this.setItem(t,JSON.stringify(e))}getServerTelemetry(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!fV(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),r)}setServerTelemetry(e,t){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(t))}getAuthorityMetadata(e){const t=this.internalStorage.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return r&&_V(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),r):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(t=>this.isAuthorityMetadata(t))}setWrapperMetadata(e,t){this.internalStorage.setItem(qc.WRAPPER_SKU,e),this.internalStorage.setItem(qc.WRAPPER_VER,t)}getWrapperMetadata(){const e=this.internalStorage.getItem(qc.WRAPPER_SKU)||F.EMPTY_STRING,t=this.internalStorage.getItem(qc.WRAPPER_VER)||F.EMPTY_STRING;return[e,t]}setAuthorityMetadata(e,t){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(t))}getActiveAccount(){const e=this.generateCacheKey(Lt.ACTIVE_ACCOUNT_FILTERS),t=this.getItem(e);if(!t){this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");const o=this.generateCacheKey(Lt.ACTIVE_ACCOUNT),a=this.getItem(o);if(!a)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null;const c=this.getAccountInfoFilteredBy({localAccountId:a});return c?(this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"),this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema"),this.setActiveAccount(c),c):null}const r=this.validateAndParseJson(t);return r?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:r.homeAccountId,localAccountId:r.localAccountId,tenantId:r.tenantId})):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e){const t=this.generateCacheKey(Lt.ACTIVE_ACCOUNT_FILTERS),r=this.generateCacheKey(Lt.ACTIVE_ACCOUNT);if(e){this.logger.verbose("setActiveAccount: Active account set");const o={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId};this.browserStorage.setItem(t,JSON.stringify(o)),this.browserStorage.setItem(r,e.localAccountId)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(t),this.browserStorage.removeItem(r)}getThrottlingCache(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!mV(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),r)}setThrottlingCache(e,t){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(t))}getTemporaryCache(e,t){const r=t?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const a=this.cookieStorage.getItem(r);if(a)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),a}const o=this.temporaryCacheStorage.getItem(r);if(!o){if(this.cacheConfig.cacheLocation===vn.LocalStorage){const a=this.browserStorage.getItem(r);if(a)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),a}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),o}setTemporaryCache(e,t,r){const o=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(o,t),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(o,t,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()}async clear(){await this.removeAllAccounts(),this.removeAppMetadata(),this.temporaryCacheStorage.getKeys().forEach(e=>{(e.indexOf(F.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(e)}),this.browserStorage.getKeys().forEach(e=>{(e.indexOf(F.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(e)}),this.internalStorage.clear()}async clearTokensAndKeysWithClaims(e,t){e.addQueueMeasurement(x.ClearTokensAndKeysWithClaims,t);const r=this.getTokenKeys(),o=[];r.accessToken.forEach(a=>{const c=this.getAccessTokenCredential(a);c!=null&&c.requestedClaimsHash&&a.includes(c.requestedClaimsHash.toLowerCase())&&o.push(this.removeAccessToken(a))}),await Promise.all(o),o.length>0&&this.logger.warning(`${o.length} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return this.validateAndParseJson(e)?JSON.stringify(e):vr.startsWith(e,F.CACHE_PREFIX)||vr.startsWith(e,Lt.ADAL_ID_TOKEN)?e:`${F.CACHE_PREFIX}.${this.clientId}.${e}`}generateAuthorityKey(e){const{libraryState:{id:t}}=yr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Ke.AUTHORITY}.${t}`)}generateNonceKey(e){const{libraryState:{id:t}}=yr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Ke.NONCE_IDTOKEN}.${t}`)}generateStateKey(e){const{libraryState:{id:t}}=yr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Ke.REQUEST_STATE}.${t}`)}getCachedAuthority(e){const t=this.generateStateKey(e),r=this.getTemporaryCache(t);if(!r)return null;const o=this.generateAuthorityKey(r);return this.getTemporaryCache(o)}updateCacheEntries(e,t,r,o,a){this.logger.trace("BrowserCacheManager.updateCacheEntries called");const c=this.generateStateKey(e);this.setTemporaryCache(c,e,!1);const d=this.generateNonceKey(e);this.setTemporaryCache(d,t,!1);const h=this.generateAuthorityKey(e);if(this.setTemporaryCache(h,r,!1),a){const m={credential:a.homeAccountId,type:Bn.HOME_ACCOUNT_ID};this.setTemporaryCache(Ke.CCS_CREDENTIAL,JSON.stringify(m),!0)}else if(o){const m={credential:o,type:Bn.UPN};this.setTemporaryCache(Ke.CCS_CREDENTIAL,JSON.stringify(m),!0)}}resetRequestCache(e){this.logger.trace("BrowserCacheManager.resetRequestCache called"),e&&(this.temporaryCacheStorage.getKeys().forEach(t=>{t.indexOf(e)!==-1&&this.removeTemporaryItem(t)}),this.removeTemporaryItem(this.generateStateKey(e)),this.removeTemporaryItem(this.generateNonceKey(e)),this.removeTemporaryItem(this.generateAuthorityKey(e))),this.removeTemporaryItem(this.generateCacheKey(Ke.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(Ke.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(Ke.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(Ke.CORRELATION_ID)),this.removeTemporaryItem(this.generateCacheKey(Ke.CCS_CREDENTIAL)),this.removeTemporaryItem(this.generateCacheKey(Ke.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cleanRequestByState(e){if(this.logger.trace("BrowserCacheManager.cleanRequestByState called"),e){const t=this.generateStateKey(e),r=this.temporaryCacheStorage.getItem(t);this.logger.infoPii(`BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: ${r}`),this.resetRequestCache(r||F.EMPTY_STRING)}}cleanRequestByInteractionType(e){this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.temporaryCacheStorage.getKeys().forEach(t=>{if(t.indexOf(Ke.REQUEST_STATE)===-1)return;const r=this.temporaryCacheStorage.getItem(t);if(!r)return;const o=kT(this.cryptoImpl,r);o&&o.interactionType===e&&(this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${r}`),this.resetRequestCache(r))}),this.setInteractionInProgress(!1)}cacheCodeRequest(e){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");const t=ym(JSON.stringify(e));this.setTemporaryCache(Ke.REQUEST_PARAMS,t,!0)}getCachedRequest(e){this.logger.trace("BrowserCacheManager.getCachedRequest called");const t=this.getTemporaryCache(Ke.REQUEST_PARAMS,!0);if(!t)throw ie(rT);let r;try{r=JSON.parse(Kr(t))}catch(o){throw this.logger.errorPii(`Attempted to parse: ${t}`),this.logger.error(`Parsing cached token request threw with error: ${o}`),ie(oT)}if(this.removeTemporaryItem(this.generateCacheKey(Ke.REQUEST_PARAMS)),!r.authority){const o=this.generateAuthorityKey(e),a=this.getTemporaryCache(o);if(!a)throw ie(pm);r.authority=a}return r}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(Ke.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const t=this.validateAndParseJson(e);return t||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){const t=this.getInteractionInProgress();return e?t===this.clientId:!!t}getInteractionInProgress(){const e=`${F.CACHE_PREFIX}.${Ke.INTERACTION_STATUS_KEY}`;return this.getTemporaryCache(e,!1)}setInteractionInProgress(e){const t=`${F.CACHE_PREFIX}.${Ke.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw ie(Yw);this.setTemporaryCache(t,this.clientId,!1)}else!e&&this.getInteractionInProgress()===this.clientId&&this.removeTemporaryItem(t)}getLegacyLoginHint(){const e=this.getTemporaryCache(Lt.ADAL_ID_TOKEN);e&&(this.browserStorage.removeItem(Lt.ADAL_ID_TOKEN),this.logger.verbose("Cached ADAL id token retrieved."));const t=this.getTemporaryCache(Lt.ID_TOKEN,!0);t&&(this.browserStorage.removeItem(this.generateCacheKey(Lt.ID_TOKEN)),this.logger.verbose("Cached MSAL.js v1 id token retrieved"));const r=t||e;if(r){const o=Si(r,Kr);if(o.preferred_username)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint"),o.preferred_username;if(o.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),o.upn;this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.")}return null}updateCredentialCacheKey(e,t){const r=ha(t);if(e!==r){const o=this.getItem(e);if(o)return this.browserStorage.removeItem(e),this.setItem(r,o),this.logger.verbose(`Updated an outdated ${t.credentialType} cache key`),r;this.logger.error(`Attempted to update an outdated ${t.credentialType} cache key but no item matching the outdated key was found in storage`)}return e}async hydrateCache(e,t){var d,h,m;const r=au((d=e.account)==null?void 0:d.homeAccountId,(h=e.account)==null?void 0:h.environment,e.idToken,this.clientId,e.tenantId);let o;t.claims&&(o=await this.cryptoImpl.hashString(t.claims));const a=su((m=e.account)==null?void 0:m.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?e.expiresOn.getTime()/1e3:0,e.extExpiresOn?e.extExpiresOn.getTime()/1e3:0,Kr,void 0,e.tokenType,void 0,t.sshKid,t.claims,o),c={idToken:r,accessToken:a};return this.saveCacheRecord(c)}async saveCacheRecord(e,t,r){try{await super.saveCacheRecord(e,t,r)}catch(o){if(o instanceof pa&&this.performanceClient&&r)try{const a=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:a.refreshToken.length,cacheIdCount:a.idToken.length,cacheAtCount:a.accessToken.length},r)}catch{}throw o}}}const SH=(n,e)=>{const t={cacheLocation:vn.MemoryStorage,temporaryCacheLocation:vn.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new uf(n,t,Nl,e)};/*! @azure/msal-browser v3.28.1 2025-01-14 */function AH(n,e,t,r){return n.verbose("getAllAccounts called"),t?e.getAllAccounts(r):[]}function kH(n,e,t){if(e.trace("getAccount called"),Object.keys(n).length===0)return e.warning("getAccount: No accountFilter provided"),null;const r=t.getAccountInfoFilteredBy(n);return r?(e.verbose("getAccount: Account matching provided filter found, returning"),r):(e.verbose("getAccount: No matching account found, returning null"),null)}function NH(n,e,t){if(e.trace("getAccountByUsername called"),!n)return e.warning("getAccountByUsername: No username provided"),null;const r=t.getAccountInfoFilteredBy({username:n});return r?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${n}`),r):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function RH(n,e,t){if(e.trace("getAccountByHomeId called"),!n)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const r=t.getAccountInfoFilteredBy({homeAccountId:n});return r?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${n}`),r):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function OH(n,e,t){if(e.trace("getAccountByLocalId called"),!n)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const r=t.getAccountInfoFilteredBy({localAccountId:n});return r?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${n}`),r):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function PH(n,e){e.setActiveAccount(n)}function MH(n){return n.getActiveAccount()}/*! @azure/msal-browser v3.28.1 2025-01-14 */const me={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"};/*! @azure/msal-browser v3.28.1 2025-01-14 */class DH{constructor(e){this.eventCallbacks=new Map,this.logger=e||new Ko({})}addEventCallback(e,t,r){if(typeof window<"u"){const o=r||dH();return this.eventCallbacks.has(o)?(this.logger.error(`Event callback with id: ${o} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(o,[e,t||[]]),this.logger.verbose(`Event callback registered with id: ${o}`),o)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,t,r,o){if(typeof window<"u"){const a={eventType:e,interactionType:t||null,payload:r||null,error:o||null,timestamp:Date.now()};this.eventCallbacks.forEach(([c,d],h)=>{(d.length===0||d.includes(e))&&(this.logger.verbose(`Emitting event to callback ${h}: ${e}`),c.apply(null,[a]))})}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class NT{constructor(e,t,r,o,a,c,d,h,m){this.config=e,this.browserStorage=t,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=a,this.navigationClient=c,this.nativeMessageHandler=h,this.correlationId=m||go(),this.logger=o.clone(Dn.MSAL_SKU,pu,this.correlationId),this.performanceClient=d}async clearCacheOnLogout(e){if(e){Pt.accountInfoIsEqual(e,this.browserStorage.getActiveAccount(),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null));try{await this.browserStorage.removeAccount(Pt.generateAccountCacheKey(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),await this.browserStorage.clear(),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 t=e||this.config.auth.redirectUri;return De.getAbsoluteUrl(t,lo())}initializeServerTelemetryManager(e,t){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:t||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new Os(r,this.browserStorage)}async getDiscoveredAuthority(e){const{account:t}=e,r=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(x.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const o={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},a=e.requestAuthority||this.config.auth.authority,c=r!=null&&r.length?r==="true":this.config.auth.instanceAware,d=t&&c?this.config.auth.authority.replace(De.getDomainFromUrl(a),t.environment):a,h=Xt.generateAuthority(d,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),m=await Q(Bw,x.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(h,this.config.system.networkClient,this.browserStorage,o,this.logger,this.correlationId,this.performanceClient);if(t&&!m.isAlias(t.environment))throw Xe(Nw);return m}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const LH=32;async function xH(n,e,t){n.addQueueMeasurement(x.GeneratePkceCodes,t);const r=Ai(UH,x.GenerateCodeVerifier,e,n,t)(n,e,t),o=await Q(BH,x.GenerateCodeChallengeFromVerifier,e,n,t)(r,n,e,t);return{verifier:r,challenge:o}}function UH(n,e,t){try{const r=new Uint8Array(LH);return Ai(eH,x.GetRandomValues,e,n,t)(r),gu(r)}catch{throw ie(mm)}}async function BH(n,e,t,r){e.addQueueMeasurement(x.GenerateCodeChallengeFromVerifier,r);try{const o=await Q(TT,x.Sha256Digest,t,e,r)(n,e,r);return gu(new Uint8Array(o))}catch{throw ie(mm)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function Sm(n,e,t,r){t.addQueueMeasurement(x.InitializeBaseRequest,n.correlationId);const o=n.authority||e.auth.authority,a=[...n&&n.scopes||[]],c={...n,correlationId:n.correlationId,authority:o,scopes:a};if(!c.authenticationScheme)c.authenticationScheme=Ge.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(c.authenticationScheme===Ge.SSH){if(!n.sshJwk)throw Xe(cu);if(!n.sshKid)throw Xe(Sw)}r.verbose(`Authentication Scheme set to "${c.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&n.claims&&!vr.isEmptyObj(n.claims)&&(c.requestedClaimsHash=await bT(n.claims)),c}async function FH(n,e,t,r,o){r.addQueueMeasurement(x.InitializeSilentRequest,n.correlationId);const a=await Q(Sm,x.InitializeBaseRequest,o,r,n.correlationId)(n,t,r,o);return{...n,...a,account:e,forceRefresh:n.forceRefresh||!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Da extends NT{async initializeAuthorizationCodeRequest(e){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.correlationId);const t=await Q(xH,x.GeneratePkceCodes,this.logger,this.performanceClient,this.correlationId)(this.performanceClient,this.logger,this.correlationId),r={...e,redirectUri:e.redirectUri,code:F.EMPTY_STRING,codeVerifier:t.verifier};return e.codeChallenge=t.challenge,e.codeChallengeMethod=F.S256_CODE_CHALLENGE_METHOD,r}initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const t={correlationId:this.correlationId||go(),...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"),t.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",t.correlationId),t.postLogoutRedirectUri=De.getAbsoluteUrl(e.postLogoutRedirectUri,lo())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",t.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",t.correlationId),t.postLogoutRedirectUri=De.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,lo())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",t.correlationId),t.postLogoutRedirectUri=De.getAbsoluteUrl(lo(),lo())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",t.correlationId),t}getLogoutHintFromIdTokenClaims(e){const t=e.idTokenClaims;if(t){if(t.login_hint)return t.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(x.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const t=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new Hw(t,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:t,requestAuthority:r,requestAzureCloudOptions:o,requestExtraQueryParameters:a,account:c}=e;this.performanceClient.addQueueMeasurement(x.StandardInteractionClientGetClientConfiguration,this.correlationId);const d=await Q(this.getDiscoveredAuthority.bind(this),x.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:r,requestAzureCloudOptions:o,requestExtraQueryParameters:a,account:c}),h=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:d,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:h.loggerCallback,piiLoggingEnabled:h.piiLoggingEnabled,logLevel:h.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:t,libraryInfo:{sku:Dn.MSAL_SKU,version:pu,cpu:F.EMPTY_STRING,os:F.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,t){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),o={interactionType:t},a=yr.setRequestState(this.browserCrypto,e&&e.state||F.EMPTY_STRING,o),d={...await Q(Sm,x.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:a,nonce:e.nonce||go(),responseMode:this.config.auth.OIDCOptions.serverResponseType};if(e.loginHint||e.sid)return d;const h=e.account||this.browserStorage.getActiveAccount();if(h&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${h.homeAccountId}`,this.correlationId),d.account=h),!d.loginHint&&!h){const m=this.browserStorage.getLegacyLoginHint();m&&(d.loginHint=m)}return d}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const VH="ContentError",RT="user_switch";/*! @azure/msal-browser v3.28.1 2025-01-14 */const HH="USER_INTERACTION_REQUIRED",$H="USER_CANCEL",KH="NO_NETWORK",WH="PERSISTENT_ERROR",zH="DISABLED",GH="ACCOUNT_UNAVAILABLE";/*! @azure/msal-browser v3.28.1 2025-01-14 */const qH=-2147186943,jH={[RT]:"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 Br extends lt{constructor(e,t,r){super(e,t),Object.setPrototypeOf(this,Br.prototype),this.name="NativeAuthError",this.ext=r}}function sa(n){if(n.ext&&n.ext.status&&(n.ext.status===WH||n.ext.status===zH)||n.ext&&n.ext.error&&n.ext.error===qH)return!0;switch(n.errorCode){case VH:return!0;default:return!1}}function df(n,e,t){if(t&&t.status)switch(t.status){case GH:return tf(Fw);case HH:return new Er(n,e);case $H:return ie(bi);case KH:return ie(Ll)}return new Br(n,jH[n]||e,t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class OT extends Da{async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentCacheClientAcquireToken,e.correlationId);const t=this.initializeServerTelemetryManager(ot.acquireTokenSilent_silentFlow),r=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),o=new P2(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const c=(await Q(o.acquireCachedToken.bind(o),x.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),c}catch(a){throw a instanceof Ws&&a.errorCode===_m&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),a}}logout(e){this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(t==null?void 0:t.account)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class _a extends NT{constructor(e,t,r,o,a,c,d,h,m,g,v,p){var C;super(e,t,r,o,a,c,h,m,p),this.apiId=d,this.accountId=g,this.nativeMessageHandler=m,this.nativeStorageManager=v,this.silentCacheClient=new OT(e,this.nativeStorageManager,r,o,a,c,h,m,p),this.serverTelemetryManager=this.initializeServerTelemetryManager(this.apiId);const w=this.nativeMessageHandler.getExtensionId()===ma.PREFERRED_EXTENSION_ID?"chrome":(C=this.nativeMessageHandler.getExtensionId())!=null&&C.length?"unknown":void 0;this.skus=Os.makeExtraSkuString({libraryName:Dn.MSAL_SKU,libraryVersion:pu,extensionName:w,extensionVersion:this.nativeMessageHandler.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[g2]:this.skus}}async acquireToken(e){this.performanceClient.addQueueMeasurement(x.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const t=this.performanceClient.startMeasurement(x.NativeInteractionClientAcquireToken,e.correlationId),r=zr();try{const o=await this.initializeNativeRequest(e);try{const m=await this.acquireTokensFromCache(this.accountId,o);return t.end({success:!0,isNativeBroker:!1,fromCache:!0}),m}catch{this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const{...a}=o,c={method:gi.GetToken,request:a},d=await this.nativeMessageHandler.sendMessage(c),h=this.validateNativeResponse(d);return await this.handleNativeResponse(h,o,r).then(m=>(t.end({success:!0,isNativeBroker:!0,requestId:m.requestId}),this.serverTelemetryManager.clearNativeBrokerErrorCode(),m)).catch(m=>{throw t.end({success:!1,errorCode:m.errorCode,subErrorCode:m.subError,isNativeBroker:!0}),m})}catch(o){throw o instanceof Br&&this.serverTelemetryManager.setNativeBrokerErrorCode(o.errorCode),o}}createSilentCacheRequest(e,t){return{authority:e.authority,correlationId:this.correlationId,scopes:vt.fromString(e.scope).asArray(),account:t,forceRefresh:!1}}async acquireTokensFromCache(e,t){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),Y(Yh);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e});if(!r)throw Y(Yh);try{const o=this.createSilentCacheRequest(t,r),a=await this.silentCacheClient.acquireToken(o),c={...r,idTokenClaims:a==null?void 0:a.idTokenClaims,idToken:a==null?void 0:a.idToken};return{...a,account:c}}catch(o){throw o}}async acquireTokenRedirect(e,t){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...r}=e;delete r.onRedirectNavigate;const o=await this.initializeNativeRequest(r),a={method:gi.GetToken,request:o};try{const h=await this.nativeMessageHandler.sendMessage(a);this.validateNativeResponse(h)}catch(h){if(h instanceof Br&&(this.serverTelemetryManager.setNativeBrokerErrorCode(h.errorCode),sa(h)))throw h}this.browserStorage.setTemporaryCache(Ke.NATIVE_REQUEST,JSON.stringify(o),!0);const c={apiId:ot.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);t.end({success:!0}),await this.navigationClient.navigateExternal(d,c)}async handleRedirectPromise(e,t){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&&t&&(e==null||e.addFields({errorCode:"no_cached_request"},t)),null;const{prompt:o,...a}=r;o&&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(Ke.NATIVE_REQUEST));const c={method:gi.GetToken,request:a},d=zr();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const h=await this.nativeMessageHandler.sendMessage(c);this.validateNativeResponse(h);const m=this.handleNativeResponse(h,a,d);this.browserStorage.setInteractionInProgress(!1);const g=await m;return this.serverTelemetryManager.clearNativeBrokerErrorCode(),g}catch(h){throw this.browserStorage.setInteractionInProgress(!1),h}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,t,r){var g;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const o=Si(e.id_token,Kr),a=this.createHomeAccountIdentifier(e,o),c=(g=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:t.accountId}))==null?void 0:g.homeAccountId;if(a!==c&&e.account.id!==t.accountId)throw df(RT);const d=await this.getDiscoveredAuthority({requestAuthority:t.authority}),h=dm(this.browserStorage,d,a,Kr,o,e.client_info,void 0,o.tid,void 0,e.account.id,this.logger),m=await this.generateAuthenticationResult(e,t,o,h,d.canonicalAuthority,r);return this.cacheAccount(h),this.cacheNativeTokens(e,t,a,o,e.access_token,m.tenantId,r),m}createHomeAccountIdentifier(e,t){return Pt.generateHomeAccountId(e.client_info||F.EMPTY_STRING,mr.Default,this.logger,this.browserCrypto,t)}generateScopes(e,t){return e.scope?vt.fromString(e.scope):vt.fromString(t.scope)}async generatePopAccessToken(e,t){if(t.tokenType===Ge.POP&&t.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new Ia(this.browserCrypto),o={resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,shrNonce:t.shrNonce};if(!t.keyId)throw Y(Jf);return r.signPopToken(e.access_token,t.keyId,o)}else return e.access_token}async generateAuthenticationResult(e,t,r,o,a,c){const d=this.addTelemetryFromNativeResponse(e),h=e.scope?vt.fromString(e.scope):vt.fromString(t.scope),m=e.account.properties||{},g=m.UID||r.oid||r.sub||F.EMPTY_STRING,v=m.TenantId||r.tid||F.EMPTY_STRING,p=im(o.getAccountInfo(),void 0,r,e.id_token);p.nativeAccountId!==e.account.id&&(p.nativeAccountId=e.account.id);const w=await this.generatePopAccessToken(e,t),C=t.tokenType===Ge.POP?Ge.POP:Ge.BEARER;return{authority:a,uniqueId:g,tenantId:v,scopes:h.asArray(),account:p,idToken:e.id_token,idTokenClaims:r,accessToken:w,fromCache:d?this.isResponseFromCache(d):!1,expiresOn:new Date(Number(c+e.expires_in)*1e3),tokenType:C,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}cacheAccount(e){this.browserStorage.setAccount(e),this.browserStorage.removeAccountContext(e).catch(t=>{this.logger.error(`Error occurred while removing account context from browser storage. ${t}`)})}cacheNativeTokens(e,t,r,o,a,c,d){const h=au(r,t.authority,e.id_token||"",t.clientId,o.tid||""),m=t.tokenType===Ge.POP?F.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,g=d+m,v=this.generateScopes(e,t),p=su(r,t.authority,a,t.clientId,o.tid||c,v.printScopes(),g,0,Kr,void 0,t.tokenType,void 0,t.keyId),w={idToken:h,accessToken:p};this.nativeStorageManager.saveCacheRecord(w,t.storeInCache)}addTelemetryFromNativeResponse(e){const t=this.getMATSFromResponse(e);return t?(this.performanceClient.addFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:t.broker_version,matsAccountJoinOnStart:t.account_join_on_start,matsAccountJoinOnEnd:t.account_join_on_end,matsDeviceJoin:t.device_join,matsPromptBehavior:t.prompt_behavior,matsApiErrorCode:t.api_error_code,matsUiVisible:t.ui_visible,matsSilentCode:t.silent_code,matsSilentBiSubCode:t.silent_bi_sub_code,matsSilentMessage:t.silent_message,matsSilentStatus:t.silent_status,matsHttpStatus:t.http_status,matsHttpEventCount:t.http_event_count},this.correlationId),t):null}validateNativeResponse(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 YE(Wf,"Response missing expected properties.")}getMATSFromResponse(e){if(e.properties.MATS)try{return JSON.parse(e.properties.MATS)}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 t=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:t,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const r=new De(t);r.validateAsUri();const{scopes:o,...a}=e,c=new vt(o||[]);c.appendScopes(Ma);const d=()=>{switch(this.apiId){case ot.ssoSilent:case ot.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),Bt.NONE}if(!e.prompt){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e.prompt){case Bt.NONE:case Bt.CONSENT:case Bt.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e.prompt;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e.prompt} is not compatible with native flow`),ie(gT)}},h={...a,accountId:this.accountId,clientId:this.config.auth.clientId,authority:r.urlString,scope:c.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:d(),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(h.signPopToken&&e.popKid)throw ie(_T);if(this.handleExtraBrokerParams(h),h.extraParameters=h.extraParameters||{},h.extraParameters.telemetry=ma.MATS_TELEMETRY,e.authenticationScheme===Ge.POP){const m={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},g=new Ia(this.browserCrypto);let v;if(h.keyId)v=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:h.keyId})),h.signPopToken=!1;else{const p=await Q(g.generateCnf.bind(g),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(m,this.logger);v=p.reqCnfString,h.keyId=p.kid,h.signPopToken=!0}h.reqCnf=v}return this.addRequestSKUs(h),h}handleExtraBrokerParams(e){var a;const t=e.extraParameters&&e.extraParameters.hasOwnProperty(cm)&&e.extraParameters.hasOwnProperty(ef)&&e.extraParameters.hasOwnProperty(wi);if(!e.embeddedClientId&&!t)return;let r="";const o=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,r=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[ef],r=e.extraParameters[wi]),e.extraParameters={child_client_id:r,child_redirect_uri:o},(a=this.performanceClient)==null||a.addFields({embeddedClientId:r,embeddedRedirectUri:o},e.correlationId)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Fr{constructor(e,t,r,o){this.logger=e,this.handshakeTimeoutMs=t,this.extensionId=o,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(x.NativeMessageHandlerHandshake)}async sendMessage(e){this.logger.trace("NativeMessageHandler - sendMessage called.");const t={channel:ma.CHANNEL_ID,extensionId:this.extensionId,responseId:go(),body:e};return this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii(`NativeMessageHandler - Sending request to browser extension: ${JSON.stringify(t)}`),this.messageChannel.port1.postMessage(t),new Promise((r,o)=>{this.resolvers.set(t.responseId,{resolve:r,reject:o})})}static async createProvider(e,t,r){e.trace("NativeMessageHandler - createProvider called.");try{const o=new Fr(e,t,r,ma.PREFERRED_EXTENSION_ID);return await o.sendHandshakeRequest(),o}catch{const a=new Fr(e,t,r);return await a.sendHandshakeRequest(),a}}async sendHandshakeRequest(){this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:ma.CHANNEL_ID,extensionId:this.extensionId,responseId:go(),body:{method:gi.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=t=>{this.onChannelMessage(t)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((t,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:t,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(ie(hT)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source!==window)return;const t=e.data;if(!(!t.channel||t.channel!==ma.CHANNEL_ID)&&!(t.extensionId&&t.extensionId!==this.extensionId)&&t.body.method===gi.HandshakeRequest){const r=this.handshakeResolvers.get(t.responseId);if(!r){this.logger.trace(`NativeMessageHandler.onWindowMessage - resolver can't be found for request ${t.responseId}`);return}this.logger.verbose(t.extensionId?`Extension with id: ${t.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(ie(fT))}}onChannelMessage(e){this.logger.trace("NativeMessageHandler - onChannelMessage called.");const t=e.data,r=this.resolvers.get(t.responseId),o=this.handshakeResolvers.get(t.responseId);try{const a=t.body.method;if(a===gi.Response){if(!r)return;const c=t.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii(`NativeMessageHandler - Received response from browser extension: ${JSON.stringify(c)}`),c.status!=="Success")r.reject(df(c.code,c.description,c.ext));else if(c.result)c.result.code&&c.result.description?r.reject(df(c.result.code,c.result.description,c.result.ext)):r.resolve(c.result);else throw YE(Wf,"Event does not contain result.");this.resolvers.delete(t.responseId)}else if(a===gi.HandshakeResponse){if(!o){this.logger.trace(`NativeMessageHandler.onChannelMessage - resolver can't be found for request ${t.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=t.extensionId,this.extensionVersion=t.body.version,this.logger.verbose(`NativeMessageHandler - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),o.resolve(),this.handshakeResolvers.delete(t.responseId)}}catch(a){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${a}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(a):o&&o.reject(a)}}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}static isNativeAvailable(e,t,r,o){if(t.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return t.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!r)return t.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(o)switch(o){case Ge.BEARER:case Ge.POP:return t.trace("isNativeAvailable: authenticationScheme is supported, returning true"),!0;default:return t.trace("isNativeAvailable: authenticationScheme is not supported, returning false"),!1}return!0}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Am{constructor(e,t,r,o,a){this.authModule=e,this.browserStorage=t,this.authCodeRequest=r,this.logger=o,this.performanceClient=a}async handleCodeResponse(e,t){this.performanceClient.addQueueMeasurement(x.HandleCodeResponse,t.correlationId);let r;try{r=this.authModule.handleFragmentResponse(e,t.state)}catch(o){throw o instanceof Wo&&o.subError===bi?ie(bi):o}return Q(this.handleCodeResponseFromServer.bind(this),x.HandleCodeResponseFromServer,this.logger,this.performanceClient,t.correlationId)(r,t)}async handleCodeResponseFromServer(e,t,r=!0){if(this.performanceClient.addQueueMeasurement(x.HandleCodeResponseFromServer,t.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await Q(this.authModule.updateAuthority.bind(this.authModule),x.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,t.correlationId)(e.cloud_instance_host_name,t.correlationId),r&&(e.nonce=t.nonce||void 0),e.state=t.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const a=this.createCcsCredentials(t);a&&(this.authCodeRequest.ccsCredential=a)}return await Q(this.authModule.acquireToken.bind(this.authModule),x.AuthClientAcquireToken,this.logger,this.performanceClient,t.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:Bn.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:Bn.UPN}:null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function PT(n,e,t){const r=Pl(n);if(!r)throw Ow(n)?(t.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.`),t.errorPii(`The ${e} detected is: ${n}`),ie(Gw)):(t.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.`),ie(zw));return r}function YH(n,e,t){if(!n.state)throw ie(gm);const r=kT(e,n.state);if(!r)throw ie(qw);if(r.interactionType!==t)throw ie(jw)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class JH extends Da{constructor(e,t,r,o,a,c,d,h,m,g){super(e,t,r,o,a,c,d,m,g),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=h}acquireToken(e){try{const r={popupName:this.generatePopupName(e.scopes||Ma,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,r)):(this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),r.popup=this.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(e,r))}catch(t){return Promise.reject(t)}}logout(e){try{this.logger.verbose("logoutPopup called");const t=this.initializeLogoutRequest(e),r={popupName:this.generateLogoutPopupName(t),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},o=e&&e.authority,a=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(t,r,o,a)):(this.logger.verbose("asyncPopup set to false, opening popup"),r.popup=this.openSizedPopup("about:blank",r),this.logoutPopupAsync(t,r,o,a))}catch(t){return Promise.reject(t)}}async acquireTokenPopupAsync(e,t){var a;this.logger.verbose("acquireTokenPopupAsync called");const r=this.initializeServerTelemetryManager(ot.acquireTokenPopup),o=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,le.Popup);AT(o.authority);try{const c=await Q(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(o),d=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:o.authority,requestAzureCloudOptions:o.azureCloudOptions,requestExtraQueryParameters:o.extraQueryParameters,account:o.account}),h=Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme);let m;h&&(m=this.performanceClient.startMeasurement(x.FetchAccountIdWithNativeBroker,e.correlationId));const g=await d.getAuthCodeUrl({...o,nativeBroker:h}),v=new Am(d,this.browserStorage,c,this.logger,this.performanceClient),p=this.initiateAuthRequest(g,t);this.eventHandler.emitEvent(me.POPUP_OPENED,le.Popup,{popupWindow:p},null);const w=await this.monitorPopupForHash(p,t.popupWindowParent),C=Ai(PT,x.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(w,this.config.auth.OIDCOptions.serverResponseType,this.logger);if(Ur.removeThrottle(this.browserStorage,this.config.auth.clientId,c),C.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),m&&m.end({success:!0,isNativeBroker:!0}),!this.nativeMessageHandler)throw ie(Ks);const k=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,C.accountId,this.nativeStorage,o.correlationId),{userRequestState:I}=yr.parseRequestState(this.browserCrypto,o.state);return await k.acquireToken({...o,state:I,prompt:void 0})}return await v.handleCodeResponse(C,o)}catch(c){throw(a=t.popup)==null||a.close(),c instanceof lt&&(c.setCorrelationId(this.correlationId),r.cacheFailedRequest(c)),c}}async logoutPopupAsync(e,t,r,o){var c,d,h,m;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(me.LOGOUT_START,le.Popup,e);const a=this.initializeServerTelemetryManager(ot.logoutPopup);try{await this.clearCacheOnLogout(e.account);const g=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:a,requestAuthority:r,account:e.account||void 0});try{g.authority.endSessionEndpoint}catch{if((c=e.account)!=null&&c.homeAccountId&&e.postLogoutRedirectUri&&g.authority.protocolMode===fo.OIDC){if(this.browserStorage.removeAccount((d=e.account)==null?void 0:d.homeAccountId),this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Popup,e),o){const w={apiId:ot.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},C=De.getAbsoluteUrl(o,lo());await this.navigationClient.navigateInternal(C,w)}(h=t.popup)==null||h.close();return}}const v=g.getLogoutUri(e);this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Popup,e);const p=this.openPopup(v,t);if(this.eventHandler.emitEvent(me.POPUP_OPENED,le.Popup,{popupWindow:p},null),await this.monitorPopupForHash(p,t.popupWindowParent).catch(()=>{}),o){const w={apiId:ot.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},C=De.getAbsoluteUrl(o,lo());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${C}`),await this.navigationClient.navigateInternal(C,w)}else this.logger.verbose("No main window navigation requested")}catch(g){throw(m=t.popup)==null||m.close(),g instanceof lt&&(g.setCorrelationId(this.correlationId),a.cacheFailedRequest(g)),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(me.LOGOUT_FAILURE,le.Popup,null,g),this.eventHandler.emitEvent(me.LOGOUT_END,le.Popup),g}this.eventHandler.emitEvent(me.LOGOUT_END,le.Popup)}initiateAuthRequest(e,t){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,t);throw this.logger.error("Navigate url is empty"),ie(hu)}monitorPopupForHash(e,t){return new Promise((r,o)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const a=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(a),o(ie(bi));return}let c="";try{c=e.location.href}catch{}if(!c||c==="about:blank")return;clearInterval(a);let d="";const h=this.config.auth.OIDCOptions.serverResponseType;e&&(h===$s.QUERY?d=e.location.search:d=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),r(d)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,t)})}openPopup(e,t){try{let r;if(t.popup?(r=t.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):typeof t.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,t)),!r)throw ie(Qw);return r.focus&&r.focus(),this.currentWindow=r,t.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),r}catch(r){throw this.logger.error("error opening popup "+r.message),this.browserStorage.setInteractionInProgress(!1),ie(Jw)}}openSizedPopup(e,{popupName:t,popupWindowAttributes:r,popupWindowParent:o}){var w,C,T,k;const a=o.screenLeft?o.screenLeft:o.screenX,c=o.screenTop?o.screenTop:o.screenY,d=o.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,h=o.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let m=(w=r.popupSize)==null?void 0:w.width,g=(C=r.popupSize)==null?void 0:C.height,v=(T=r.popupPosition)==null?void 0:T.top,p=(k=r.popupPosition)==null?void 0:k.left;return(!m||m<0||m>d)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),m=Dn.POPUP_WIDTH),(!g||g<0||g>h)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),g=Dn.POPUP_HEIGHT),(!v||v<0||v>h)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),v=Math.max(0,h/2-Dn.POPUP_HEIGHT/2+c)),(!p||p<0||p>d)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),p=Math.max(0,d/2-Dn.POPUP_WIDTH/2+a)),o.open(e,t,`width=${m}, height=${g}, top=${v}, left=${p}, scrollbars=yes`)}unloadWindow(e){this.browserStorage.cleanRequestByInteractionType(le.Popup),this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,t){e.close(),t.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)}generatePopupName(e,t){return`${Dn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${t}.${this.correlationId}`}generateLogoutPopupName(e){const t=e.account&&e.account.homeAccountId;return`${Dn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${t}.${this.correlationId}`}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class fy{constructor(e,t,r,o,a){this.authModule=e,this.browserStorage=t,this.authCodeRequest=r,this.logger=o,this.performanceClient=a}async initiateAuthRequest(e,t){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){t.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache(Ke.ORIGIN_URI,t.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(Ke.CORRELATION_ID,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest),this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const r={apiId:ot.acquireTokenRedirect,timeout:t.redirectTimeout,noHistory:!1};if(typeof t.onRedirectNavigate=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),t.onRedirectNavigate(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await t.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 t.navigationClient.navigateExternal(e,r);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),ie(hu)}async handleCodeResponse(e,t){this.logger.verbose("RedirectHandler.handleCodeResponse called"),this.browserStorage.setInteractionInProgress(!1);const r=this.browserStorage.generateStateKey(t),o=this.browserStorage.getTemporaryCache(r);if(!o)throw Y(kl,"Cached State");let a;try{a=this.authModule.handleFragmentResponse(e,o)}catch(m){throw m instanceof Wo&&m.subError===bi?ie(bi):m}const c=this.browserStorage.generateNonceKey(o),d=this.browserStorage.getTemporaryCache(c);if(this.authCodeRequest.code=a.code,a.cloud_instance_host_name&&await Q(this.authModule.updateAuthority.bind(this.authModule),x.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,this.authCodeRequest.correlationId)(a.cloud_instance_host_name,this.authCodeRequest.correlationId),a.nonce=d||void 0,a.state=o,a.client_info)this.authCodeRequest.clientInfo=a.client_info;else{const m=this.checkCcsCredentials();m&&(this.authCodeRequest.ccsCredential=m)}const h=await this.authModule.acquireToken(this.authCodeRequest,a);return this.browserStorage.cleanRequestByState(t),h}checkCcsCredentials(){const e=this.browserStorage.getTemporaryCache(Ke.CCS_CREDENTIAL,!0);if(e)try{return JSON.parse(e)}catch{this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii(`Cache credential could not be parsed: ${e}`)}return null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function QH(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const n=window.performance.getEntriesByType("navigation"),e=n.length?n[0]:void 0;return e==null?void 0:e.type}class XH extends Da{constructor(e,t,r,o,a,c,d,h,m,g){super(e,t,r,o,a,c,d,m,g),this.nativeStorage=h}async acquireToken(e){const t=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,le.Redirect);this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||"",t.account||null);const r=this.initializeServerTelemetryManager(ot.acquireTokenRedirect),o=a=>{a.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.cleanRequestByState(t.state),this.eventHandler.emitEvent(me.RESTORE_FROM_BFCACHE,le.Redirect))};try{const a=await Q(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(t),c=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),d=new fy(c,this.browserStorage,a,this.logger,this.performanceClient),h=await c.getAuthCodeUrl({...t,nativeBroker:Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme)}),m=this.getRedirectStartPage(e.redirectStartPage);return this.logger.verbosePii(`Redirect start page: ${m}`),window.addEventListener("pageshow",o),await d.initiateAuthRequest(h,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:m,onRedirectNavigate:e.onRedirectNavigate||this.config.auth.onRedirectNavigate})}catch(a){throw a instanceof lt&&(a.setCorrelationId(this.correlationId),r.cacheFailedRequest(a)),window.removeEventListener("pageshow",o),this.browserStorage.cleanRequestByState(t.state),a}}async handleRedirectPromise(e="",t){const r=this.initializeServerTelemetryManager(ot.handleRedirectPromise);try{if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const[o,a]=this.getRedirectResponse(e||"");if(!o)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(le.Redirect),QH()!=="back_forward"?t.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const c=this.browserStorage.getTemporaryCache(Ke.ORIGIN_URI,!0)||F.EMPTY_STRING,d=De.removeHashFromUrl(c),h=De.removeHashFromUrl(window.location.href);if(d===h&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),c.indexOf("#")>-1&&iH(c),await this.handleResponse(o,r);if(this.config.auth.navigateToLoginRequestUrl){if(!Tm()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(Ke.URL_HASH,a,!0);const m={apiId:ot.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let g=!0;if(!c||c==="null"){const v=sH();this.browserStorage.setTemporaryCache(Ke.ORIGIN_URI,v,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),g=await this.navigationClient.navigateInternal(v,m)}else this.logger.verbose(`Navigating to loginRequestUrl: ${c}`),g=await this.navigationClient.navigateInternal(c,m);if(!g)return await this.handleResponse(o,r)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(o,r);return null}catch(o){throw o instanceof lt&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),this.browserStorage.cleanRequestByInteractionType(le.Redirect),o}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let t=e;t||(this.config.auth.OIDCOptions.serverResponseType===$s.QUERY?t=window.location.search:t=window.location.hash);let r=Pl(t);if(r){try{YH(r,this.browserCrypto,le.Redirect)}catch(a){return a instanceof lt&&this.logger.error(`Interaction type validation failed due to ${a.errorCode}: ${a.errorMessage}`),[null,""]}return oH(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,t]}const o=this.browserStorage.getTemporaryCache(Ke.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(Ke.URL_HASH)),o&&(r=Pl(o),r)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[r,o]):[null,""]}async handleResponse(e,t){const r=e.state;if(!r)throw ie(gm);const o=this.browserStorage.getCachedRequest(r);if(this.logger.verbose("handleResponse called, retrieved cached request"),e.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw ie(Ks);const h=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,e.accountId,this.nativeStorage,o.correlationId),{userRequestState:m}=yr.parseRequestState(this.browserCrypto,r);return h.acquireToken({...o,state:m,prompt:void 0}).finally(()=>{this.browserStorage.cleanRequestByState(r)})}const a=this.browserStorage.getCachedAuthority(r);if(!a)throw ie(pm);const c=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:a});return Ur.removeThrottle(this.browserStorage,this.config.auth.clientId,o),new fy(c,this.browserStorage,o,this.logger,this.performanceClient).handleCodeResponse(e,r)}async logout(e){var o,a;this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(ot.logout);try{this.eventHandler.emitEvent(me.LOGOUT_START,le.Redirect,e),await this.clearCacheOnLogout(t.account);const c={apiId:ot.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(d.authority.protocolMode===fo.OIDC)try{d.authority.endSessionEndpoint}catch{if((o=t.account)!=null&&o.homeAccountId){this.browserStorage.removeAccount((a=t.account)==null?void 0:a.homeAccountId),this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Redirect,t);return}}const h=d.getLogoutUri(t);if(this.eventHandler.emitEvent(me.LOGOUT_SUCCESS,le.Redirect,t),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(h)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(h,c);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(h,c);return}}catch(c){throw c instanceof lt&&(c.setCorrelationId(this.correlationId),r.cacheFailedRequest(c)),this.eventHandler.emitEvent(me.LOGOUT_FAILURE,le.Redirect,null,c),this.eventHandler.emitEvent(me.LOGOUT_END,le.Redirect),c}this.eventHandler.emitEvent(me.LOGOUT_END,le.Redirect)}getRedirectStartPage(e){const t=e||window.location.href;return De.getAbsoluteUrl(t,lo())}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function ZH(n,e,t,r,o){if(e.addQueueMeasurement(x.SilentHandlerInitiateAuthRequest,r),!n)throw t.info("Navigate url is empty"),ie(hu);return o?Q(t$,x.SilentHandlerLoadFrame,t,e,r)(n,o,e,r):Ai(n$,x.SilentHandlerLoadFrameSync,t,e,r)(n)}async function e$(n,e,t,r,o,a,c){return r.addQueueMeasurement(x.SilentHandlerMonitorIframeForHash,a),new Promise((d,h)=>{e<cf&&o.warning(`system.loadFrameTimeout or system.iframeHashTimeout set to lower (${e}ms) than the default (${cf}ms). This may result in timeouts.`);const m=window.setTimeout(()=>{window.clearInterval(g),h(ie(Xw))},e),g=window.setInterval(()=>{let v="";const p=n.contentWindow;try{v=p?p.location.href:""}catch{}if(!v||v==="about:blank")return;let w="";p&&(c===$s.QUERY?w=p.location.search:w=p.location.hash),window.clearTimeout(m),window.clearInterval(g),d(w)},t)}).finally(()=>{Ai(r$,x.RemoveHiddenIframe,o,r,a)(n)})}function t$(n,e,t,r){return t.addQueueMeasurement(x.SilentHandlerLoadFrame,r),new Promise((o,a)=>{const c=MT();window.setTimeout(()=>{if(!c){a("Unable to load iframe");return}c.src=n,o(c)},e)})}function n$(n){const e=MT();return e.src=n,e}function MT(){const n=document.createElement("iframe");return n.className="msalSilentIframe",n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height="0",n.style.border="0",n.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(n),n}function r$(n){document.body===n.parentNode&&document.body.removeChild(n)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class o$ extends Da{constructor(e,t,r,o,a,c,d,h,m,g,v){super(e,t,r,o,a,c,h,g,v),this.apiId=d,this.nativeStorage=m}async acquireToken(e){this.performanceClient.addQueueMeasurement(x.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 t={...e};t.prompt?t.prompt!==Bt.NONE&&t.prompt!==Bt.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${t.prompt} with ${Bt.NONE}`),t.prompt=Bt.NONE):t.prompt=Bt.NONE;const r=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,le.Silent);AT(r.authority);const o=this.initializeServerTelemetryManager(this.apiId);let a;try{return a=await Q(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:o,requestAuthority:r.authority,requestAzureCloudOptions:r.azureCloudOptions,requestExtraQueryParameters:r.extraQueryParameters,account:r.account}),await Q(this.silentTokenHelper.bind(this),x.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(a,r)}catch(c){if(c instanceof lt&&(c.setCorrelationId(this.correlationId),o.cacheFailedRequest(c)),!a||!(c instanceof lt)||c.errorCode!==Dn.INVALID_GRANT_ERROR)throw c;this.performanceClient.addFields({retryError:c.errorCode},this.correlationId);const d=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,le.Silent);return await Q(this.silentTokenHelper.bind(this),x.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(a,d)}}logout(){return Promise.reject(ie(fu))}async silentTokenHelper(e,t){const r=t.correlationId;this.performanceClient.addQueueMeasurement(x.SilentIframeClientTokenHelper,r);const o=await Q(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,r)(t),a=await Q(e.getAuthCodeUrl.bind(e),x.GetAuthCodeUrl,this.logger,this.performanceClient,r)({...t,nativeBroker:Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,t.authenticationScheme)}),c=new Am(e,this.browserStorage,o,this.logger,this.performanceClient),d=await Q(ZH,x.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(a,this.performanceClient,this.logger,r,this.config.system.navigateFrameWait),h=this.config.auth.OIDCOptions.serverResponseType,m=await Q(e$,x.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(d,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,h),g=Ai(PT,x.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(m,h,this.logger);if(g.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw ie(Ks);const v=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,g.accountId,this.browserStorage,r),{userRequestState:p}=yr.parseRequestState(this.browserCrypto,t.state);return Q(v.acquireToken.bind(v),x.NativeInteractionClientAcquireToken,this.logger,this.performanceClient,r)({...t,state:p,prompt:t.prompt||Bt.NONE})}return Q(c.handleCodeResponse.bind(c),x.HandleCodeResponse,this.logger,this.performanceClient,r)(g,t)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class i$ extends Da{async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentRefreshClientAcquireToken,e.correlationId);const t=await Q(Sm,x.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),r={...e,...t};e.redirectUri&&(r.redirectUri=this.getRedirectUri(e.redirectUri));const o=this.initializeServerTelemetryManager(ot.acquireTokenSilent_silentFlow),a=await this.createRefreshTokenClient({serverTelemetryManager:o,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return Q(a.acquireTokenByRefreshToken.bind(a),x.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r).catch(c=>{throw c.setCorrelationId(this.correlationId),o.cacheFailedRequest(c),c})}logout(){return Promise.reject(ie(fu))}async createRefreshTokenClient(e){const t=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new nf(t,this.performanceClient)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class a${constructor(e,t,r,o){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=t,this.logger=r,this.cryptoObj=o}loadExternalTokens(e,t,r){if(!this.isBrowserEnvironment)throw ie(mu);const o=t.id_token?Si(t.id_token,Kr):void 0,a={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},c=e.authority?new Xt(Xt.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,a,this.logger,e.correlationId||go()):void 0,d=this.loadAccount(e,r.clientInfo||t.client_info||"",o,c),h=this.loadIdToken(t,d.homeAccountId,d.environment,d.realm),m=this.loadAccessToken(e,t,d.homeAccountId,d.environment,d.realm,r),g=this.loadRefreshToken(t,d.homeAccountId,d.environment);return this.generateAuthenticationResult(e,{account:d,idToken:h,accessToken:m,refreshToken:g},o,c)}loadAccount(e,t,r,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const h=Pt.createFromAccountInfo(e.account);return this.storage.setAccount(h),h}else if(!o||!t&&!r)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),ie(sT);const a=Pt.generateHomeAccountId(t,o.authorityType,this.logger,this.cryptoObj,r),c=r==null?void 0:r.tid,d=dm(this.storage,o,a,Kr,r,t,o.hostnameAndPort,c,void 0,void 0,this.logger);return this.storage.setAccount(d),d}loadIdToken(e,t,r,o){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const a=au(t,r,e.id_token,this.config.auth.clientId,o);return this.storage.setIdTokenCredential(a),a}loadAccessToken(e,t,r,o,a,c){if(t.access_token)if(t.expires_in){if(!t.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 d=t.scope?vt.fromString(t.scope):new vt(e.scopes),h=c.expiresOn||t.expires_in+new Date().getTime()/1e3,m=c.extendedExpiresOn||(t.ext_expires_in||t.expires_in)+new Date().getTime()/1e3,g=su(r,o,t.access_token,this.config.auth.clientId,a,d.printScopes(),h,m,Kr);return this.storage.setAccessTokenCredential(g),g}loadRefreshToken(e,t,r){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const o=gw(t,r,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return this.storage.setRefreshTokenCredential(o),o}generateAuthenticationResult(e,t,r,o){var g,v,p;let a="",c=[],d=null,h;t!=null&&t.accessToken&&(a=t.accessToken.secret,c=vt.fromString(t.accessToken.target).asArray(),d=new Date(Number(t.accessToken.expiresOn)*1e3),h=new Date(Number(t.accessToken.extendedExpiresOn)*1e3));const m=t.account;return{authority:o?o.canonicalAuthority:"",uniqueId:t.account.localAccountId,tenantId:t.account.realm,scopes:c,account:m.getAccountInfo(),idToken:((g=t.idToken)==null?void 0:g.secret)||"",idTokenClaims:r||{},accessToken:a,fromCache:!0,expiresOn:d,correlationId:e.correlationId||"",requestId:"",extExpiresOn:h,familyId:((v=t.refreshToken)==null?void 0:v.familyId)||"",tokenType:((p=t==null?void 0:t.accessToken)==null?void 0:p.tokenType)||"",state:e.state||"",cloudGraphHostName:m.cloudGraphHostName||"",msGraphHost:m.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class s$ extends Hw{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class c$ extends Da{constructor(e,t,r,o,a,c,d,h,m,g){super(e,t,r,o,a,c,h,m,g),this.apiId=d}async acquireToken(e){if(!e.code)throw ie(cT);const t=await Q(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,le.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const o={...t,code:e.code},a=await Q(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),c=new s$(a);this.logger.verbose("Auth code client created");const d=new Am(c,this.browserStorage,o,this.logger,this.performanceClient);return await Q(d.handleCodeResponseFromServer.bind(d),x.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},t,!1)}catch(o){throw o instanceof lt&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),o}}logout(){return Promise.reject(ie(fu))}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function Dr(n){const e=n==null?void 0:n.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function Yc(n,e){try{bm(n)}catch(t){throw e.end({success:!1},t),t}}class _u{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 Sa(this.logger,this.performanceClient):Nl,this.eventHandler=new DH(this.logger),this.browserStorage=this.isBrowserEnvironment?new uf(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,w2(this.config.auth),this.performanceClient):SH(this.config.auth.clientId,this.logger);const t={cacheLocation:vn.MemoryStorage,temporaryCacheLocation:vn.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new uf(this.config.auth.clientId,t,this.browserCrypto,this.logger,void 0,this.performanceClient),this.tokenCache=new a$(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this),this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}static async createController(e,t){const r=new _u(e);return await r.initialize(t),r}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e){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(me.INITIALIZE_END);return}const t=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),r=this.config.system.allowNativeBroker,o=this.performanceClient.startMeasurement(x.InitializeClientApplication,t);if(this.eventHandler.emitEvent(me.INITIALIZE_START),r)try{this.nativeExtensionProvider=await Fr.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout,this.performanceClient)}catch(a){this.logger.verbose(a)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),await Q(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),x.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,t)(this.performanceClient,t)),this.initialized=!0,this.eventHandler.emitEvent(me.INITIALIZE_END),o.end({allowNativeBroker:r,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),ST(this.initialized),this.isBrowserEnvironment){const t=e||"";let r=this.redirectResponse.get(t);return typeof r>"u"?(r=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(t,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){const t=this.getAllAccounts(),r=this.browserStorage.getCachedNativeRequest(),o=r&&Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!e,a=o?r==null?void 0:r.correlationId:this.browserStorage.getTemporaryCache(Ke.CORRELATION_ID,!0)||"",c=this.performanceClient.startMeasurement(x.AcquireTokenRedirect,a);this.eventHandler.emitEvent(me.HANDLE_REDIRECT_START,le.Redirect);let d;if(o&&this.nativeExtensionProvider){this.logger.trace("handleRedirectPromise - acquiring token from native platform");const h=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.handleRedirectPromise,this.performanceClient,this.nativeExtensionProvider,r.accountId,this.nativeInternalStorage,r.correlationId);d=Q(h.handleRedirectPromise.bind(h),x.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,c.event.correlationId)(this.performanceClient,c.event.correlationId)}else{this.logger.trace("handleRedirectPromise - acquiring token from web flow");const h=this.createRedirectClient(a);d=Q(h.handleRedirectPromise.bind(h),x.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,c.event.correlationId)(e,c)}return d.then(h=>(h?(t.length<this.getAllAccounts().length?(this.eventHandler.emitEvent(me.LOGIN_SUCCESS,le.Redirect,h),this.logger.verbose("handleRedirectResponse returned result, login success")):(this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_SUCCESS,le.Redirect,h),this.logger.verbose("handleRedirectResponse returned result, acquire token success")),c.end({success:!0,accountType:Dr(h.account)})):c.event.errorCode?c.end({success:!1}):c.discard(),this.eventHandler.emitEvent(me.HANDLE_REDIRECT_END,le.Redirect),h)).catch(h=>{const m=h;throw t.length>0?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Redirect,null,m):this.eventHandler.emitEvent(me.LOGIN_FAILURE,le.Redirect,null,m),this.eventHandler.emitEvent(me.HANDLE_REDIRECT_END,le.Redirect),c.end({success:!1},m),h})}async acquireTokenRedirect(e){const t=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",t);const r=this.performanceClient.startMeasurement(x.AcquireTokenPreRedirect,t);r.add({accountType:Dr(e.account),scenarioId:e.scenarioId});const o=e.onRedirectNavigate;if(o)e.onRedirectNavigate=c=>{const d=typeof o=="function"?o(c):void 0;return d!==!1?r.end({success:!0}):r.discard(),d};else{const c=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=d=>{const h=typeof c=="function"?c(d):void 0;return h!==!1?r.end({success:!0}):r.discard(),h}}const a=this.getAllAccounts().length>0;try{ly(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),a?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_START,le.Redirect,e):this.eventHandler.emitEvent(me.LOGIN_START,le.Redirect,e);let c;return this.nativeExtensionProvider&&this.canUseNative(e)?c=new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenRedirect,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(e),this.nativeInternalStorage,t).acquireTokenRedirect(e,r).catch(h=>{if(h instanceof Br&&sa(h))return this.nativeExtensionProvider=void 0,this.createRedirectClient(t).acquireToken(e);if(h instanceof Er)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),h}):c=this.createRedirectClient(t).acquireToken(e),await c}catch(c){throw r.end({success:!1},c),a?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Redirect,null,c):this.eventHandler.emitEvent(me.LOGIN_FAILURE,le.Redirect,null,c),c}}acquireTokenPopup(e){const t=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(x.AcquireTokenPopup,t);r.add({scenarioId:e.scenarioId,accountType:Dr(e.account)});try{this.logger.verbose("acquireTokenPopup called",t),Yc(this.initialized,r),this.browserStorage.setInteractionInProgress(!0)}catch(c){return Promise.reject(c)}const o=this.getAllAccounts();o.length>0?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_START,le.Popup,e):this.eventHandler.emitEvent(me.LOGIN_START,le.Popup,e);let a;return this.canUseNative(e)?a=this.acquireTokenNative({...e,correlationId:t},ot.acquireTokenPopup).then(c=>(this.browserStorage.setInteractionInProgress(!1),r.end({success:!0,isNativeBroker:!0,accountType:Dr(c.account)}),c)).catch(c=>{if(c instanceof Br&&sa(c))return this.nativeExtensionProvider=void 0,this.createPopupClient(t).acquireToken(e);if(c instanceof Er)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),c}):a=this.createPopupClient(t).acquireToken(e),a.then(c=>(o.length<this.getAllAccounts().length?this.eventHandler.emitEvent(me.LOGIN_SUCCESS,le.Popup,c):this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_SUCCESS,le.Popup,c),r.end({success:!0,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Dr(c.account)}),c)).catch(c=>(o.length>0?this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Popup,null,c):this.eventHandler.emitEvent(me.LOGIN_FAILURE,le.Popup,null,c),r.end({success:!1},c),Promise.reject(c)))}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){var a,c;const t=this.getRequestCorrelationId(e),r={...e,prompt:e.prompt,correlationId:t};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(x.SsoSilent,t),(a=this.ssoSilentMeasurement)==null||a.add({scenarioId:e.scenarioId,accountType:Dr(e.account)}),Yc(this.initialized,this.ssoSilentMeasurement),(c=this.ssoSilentMeasurement)==null||c.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",t),this.eventHandler.emitEvent(me.SSO_SILENT_START,le.Silent,r);let o;return this.canUseNative(r)?o=this.acquireTokenNative(r,ot.ssoSilent).catch(d=>{if(d instanceof Br&&sa(d))return this.nativeExtensionProvider=void 0,this.createSilentIframeClient(r.correlationId).acquireToken(r);throw d}):o=this.createSilentIframeClient(r.correlationId).acquireToken(r),o.then(d=>{var h;return this.eventHandler.emitEvent(me.SSO_SILENT_SUCCESS,le.Silent,d),(h=this.ssoSilentMeasurement)==null||h.end({success:!0,isNativeBroker:d.fromNativeBroker,accessTokenSize:d.accessToken.length,idTokenSize:d.idToken.length,accountType:Dr(d.account)}),d}).catch(d=>{var h;throw this.eventHandler.emitEvent(me.SSO_SILENT_FAILURE,le.Silent,null,d),(h=this.ssoSilentMeasurement)==null||h.end({success:!1},d),d}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const t=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",t);const r=this.performanceClient.startMeasurement(x.AcquireTokenByCode,t);Yc(this.initialized,r),this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_START,le.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw ie(uT);if(e.code){const o=e.code;let a=this.hybridAuthCodeResponses.get(o);return a?(this.logger.verbose("Existing acquireTokenByCode request found",t),r.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",t),a=this.acquireTokenByCodeAsync({...e,correlationId:t}).then(c=>(this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_SUCCESS,le.Silent,c),this.hybridAuthCodeResponses.delete(o),r.end({success:!0,isNativeBroker:c.fromNativeBroker,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Dr(c.account)}),c)).catch(c=>{throw this.hybridAuthCodeResponses.delete(o),this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_FAILURE,le.Silent,null,c),r.end({success:!1},c),c}),this.hybridAuthCodeResponses.set(o,a)),await a}else if(e.nativeAccountId)if(this.canUseNative(e,e.nativeAccountId)){const o=await this.acquireTokenNative({...e,correlationId:t},ot.acquireTokenByCode,e.nativeAccountId).catch(a=>{throw a instanceof Br&&sa(a)&&(this.nativeExtensionProvider=void 0),a});return r.end({accountType:Dr(o.account),success:!0}),o}else throw ie(dT);else throw ie(lT)}catch(o){throw this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_BY_CODE_FAILURE,le.Silent,null,o),r.end({success:!1},o),o}}async acquireTokenByCodeAsync(e){var o;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(x.AcquireTokenByCodeAsync,e.correlationId),(o=this.acquireTokenByCodeAsyncMeasurement)==null||o.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(a=>{var c;return(c=this.acquireTokenByCodeAsyncMeasurement)==null||c.end({success:!0,fromCache:a.fromCache,isNativeBroker:a.fromNativeBroker}),a}).catch(a=>{var c;throw(c=this.acquireTokenByCodeAsyncMeasurement)==null||c.end({success:!1},a),a}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,t){switch(this.performanceClient.addQueueMeasurement(x.AcquireTokenFromCache,e.correlationId),t){case Pn.Default:case Pn.AccessToken:case Pn.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return Q(r.acquireToken.bind(r),x.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Y(co)}}async acquireTokenByRefreshToken(e,t){switch(this.performanceClient.addQueueMeasurement(x.AcquireTokenByRefreshToken,e.correlationId),t){case Pn.Default:case Pn.AccessTokenAndRefreshToken:case Pn.RefreshToken:case Pn.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return Q(r.acquireToken.bind(r),x.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Y(co)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(x.AcquireTokenBySilentIframe,e.correlationId);const t=this.createSilentIframeClient(e.correlationId);return Q(t.acquireToken.bind(t),x.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const t=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",t),this.logoutRedirect({correlationId:t,...e})}async logoutRedirect(e){const t=this.getRequestCorrelationId(e);return ly(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),this.createRedirectClient(t).logout(e)}logoutPopup(e){try{const t=this.getRequestCorrelationId(e);return bm(this.initialized),this.browserStorage.setInteractionInProgress(!0),this.createPopupClient(t).logout(e)}catch(t){return Promise.reject(t)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const t=this.getRequestCorrelationId(e);return this.createSilentCacheClient(t).logout(e)}getAllAccounts(e){return AH(this.logger,this.browserStorage,this.isBrowserEnvironment,e)}getAccount(e){return kH(e,this.logger,this.browserStorage)}getAccountByUsername(e){return NH(e,this.logger,this.browserStorage)}getAccountByHomeId(e){return RH(e,this.logger,this.browserStorage)}getAccountByLocalId(e){return OH(e,this.logger,this.browserStorage)}setActiveAccount(e){PH(e,this.browserStorage)}getActiveAccount(){return MH(this.browserStorage)}async hydrateCache(e,t){this.logger.verbose("hydrateCache called");const r=Pt.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return this.browserStorage.setAccount(r),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,t)):this.browserStorage.hydrateCache(e,t)}async acquireTokenNative(e,t,r){if(this.logger.trace("acquireTokenNative called"),!this.nativeExtensionProvider)throw ie(Ks);return new _a(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,t,this.performanceClient,this.nativeExtensionProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e)}canUseNative(e,t){if(this.logger.trace("canUseNative called"),!Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme))return this.logger.trace("canUseNative: isNativeAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case Bt.NONE:case Bt.CONSENT:case Bt.LOGIN:this.logger.trace("canUseNative: prompt is compatible with native flow");break;default:return this.logger.trace(`canUseNative: prompt = ${e.prompt} is not compatible with native flow, returning false`),!1}return!t&&!this.getNativeAccountId(e)?(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const t=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return t&&t.nativeAccountId||""}createPopupClient(e){return new JH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createRedirectClient(e){return new XH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentIframeClient(e){return new o$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentCacheClient(e){return new OT(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentRefreshClient(e){return new i$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentAuthCodeClient(e){return new c$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ot.acquireTokenByCode,this.performanceClient,this.nativeExtensionProvider,e)}addEventCallback(e,t){return this.eventHandler.addEventCallback(e,t)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return IT(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?this.logger.verbose("Account storage listener already registered."):(this.logger.verbose("Adding account storage listener."),this.listeningToStorageEvents=!0,window.addEventListener("storage",this.handleAccountCacheChange)))}disableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?(this.logger.verbose("Removing account storage listener."),window.removeEventListener("storage",this.handleAccountCacheChange),this.listeningToStorageEvents=!1):this.logger.verbose("No account storage listener registered."))}handleAccountCacheChange(e){var t;try{(t=e.key)!=null&&t.includes(Lt.ACTIVE_ACCOUNT_FILTERS)&&this.eventHandler.emitEvent(me.ACTIVE_ACCOUNT_CHANGED);const r=e.newValue||e.oldValue;if(!r)return;const o=JSON.parse(r);if(typeof o!="object"||!Pt.isAccountEntity(o))return;const c=ba.toObject(new Pt,o).getAccountInfo();!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.eventHandler.emitEvent(me.ACCOUNT_ADDED,void 0,c)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.eventHandler.emitEvent(me.ACCOUNT_REMOVED,void 0,c))}catch{return}}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,t){this.browserStorage.setWrapperMetadata(e,t)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?go():F.EMPTY_STRING}async loginRedirect(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",t),this.acquireTokenRedirect({correlationId:t,...e||ay})}loginPopup(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",t),this.acquireTokenPopup({correlationId:t,...e||ay})}async acquireTokenSilent(e){const t=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(x.AcquireTokenSilent,t);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),Yc(this.initialized,r),this.logger.verbose("acquireTokenSilent called",t);const o=e.account||this.getActiveAccount();if(!o)throw ie(nT);r.add({accountType:Dr(o)});const a={clientId:this.config.auth.clientId,authority:e.authority||F.EMPTY_STRING,scopes:e.scopes,homeAccountIdentifier:o.homeAccountId,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,shrOptions:e.shrOptions},c=JSON.stringify(a),d=this.activeSilentTokenRequests.get(c);if(typeof d>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",t);const h=Q(this.acquireTokenSilentAsync.bind(this),x.AcquireTokenSilentAsync,this.logger,this.performanceClient,t)({...e,correlationId:t},o).then(m=>(this.activeSilentTokenRequests.delete(c),r.end({success:!0,fromCache:m.fromCache,isNativeBroker:m.fromNativeBroker,cacheLookupPolicy:e.cacheLookupPolicy,accessTokenSize:m.accessToken.length,idTokenSize:m.idToken.length}),m)).catch(m=>{throw this.activeSilentTokenRequests.delete(c),r.end({success:!1},m),m});return this.activeSilentTokenRequests.set(c,h),{...await h,state:e.state}}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",t),r.discard(),{...await d,state:e.state}}async acquireTokenSilentAsync(e,t){const r=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(x.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_START,le.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const o=await Q(FH,x.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,t,this.config,this.performanceClient,this.logger),a=e.cacheLookupPolicy||Pn.Default;return this.acquireTokenSilentNoIframe(o,a).catch(async d=>{if(l$(d,a))if(this.activeIframeRequest)if(a!==Pn.Skip){const[m,g]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${g}`,o.correlationId);const v=this.performanceClient.startMeasurement(x.AwaitConcurrentIframe,o.correlationId);v.add({awaitIframeCorrelationId:g});const p=await m;if(v.end({success:p}),p)return this.logger.verbose(`Parallel iframe request with correlationId: ${g} succeeded. Retrying cache and/or RT redemption`,o.correlationId),this.acquireTokenSilentNoIframe(o,a);throw this.logger.info(`Iframe request with correlationId: ${g} failed. Interaction is required.`),d}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.",o.correlationId),Q(this.acquireTokenBySilentIframe.bind(this),x.AcquireTokenBySilentIframe,this.logger,this.performanceClient,o.correlationId)(o);else{let m;return this.activeIframeRequest=[new Promise(g=>{m=g}),o.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",o.correlationId),Q(this.acquireTokenBySilentIframe.bind(this),x.AcquireTokenBySilentIframe,this.logger,this.performanceClient,o.correlationId)(o).then(g=>(m(!0),g)).catch(g=>{throw m(!1),g}).finally(()=>{this.activeIframeRequest=void 0})}else throw d}).then(d=>(this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_SUCCESS,le.Silent,d),e.correlationId&&this.performanceClient.addFields({fromCache:d.fromCache,isNativeBroker:d.fromNativeBroker},e.correlationId),d)).catch(d=>{throw this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_FAILURE,le.Silent,null,d),d}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,t){return Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,ot.acquireTokenSilent_silentFlow).catch(async r=>{throw r instanceof Br&&sa(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,Y(co)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),Q(this.acquireTokenFromCache.bind(this),x.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,t).catch(r=>{if(t===Pn.AccessToken)throw r;return this.eventHandler.emitEvent(me.ACQUIRE_TOKEN_NETWORK_START,le.Silent,e),Q(this.acquireTokenByRefreshToken.bind(this),x.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,t)}))}}function l$(n,e){const t=!(n instanceof Er&&n.subError!==du),r=n.errorCode===Dn.INVALID_GRANT_ERROR||n.errorCode===co,o=t&&r||n.errorCode===Dl||n.errorCode===um,a=G2.includes(e);return o&&a}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function u$(n,e){const t=new Ii(n);return await t.initialize(),_u.createController(t,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class km{static async createPublicClientApplication(e){const t=await u$(e);return new km(e,t)}constructor(e,t){this.controller=t||new _u(new Ii(e))}async initialize(e){return this.controller.initialize(e)}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,t){return this.controller.addEventCallback(e,t)}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,t){return this.controller.initializeWrapperLibrary(e,t)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,t){return this.controller.hydrateCache(e,t)}clearCache(e){return this.controller.clearCache(e)}}const lh=process.env.JPLAN_WEBAPP__APP_PROXY_TENANT_NAME??"",d$=process.env.JPLAN_WEBAPP__APP_PROXY_CLIENT_ID??"",h$=process.env.JPLAN_WEBAPP__APP_PROXY_USER_FLOW??"",hf=process.env.JPLAN_WEBAPP__URL_AUTH??process.env.JPLAN_WEBAPP__URL_BASE??"",f$={auth:{clientId:d$,authority:`https://${lh}.b2clogin.com/${lh}.onmicrosoft.com/${h$}`,knownAuthorities:[`${lh}.b2clogin.com`],redirectUri:process.env.JPLAN_AUTOMATION_ENVIRONMENT?`${hf}/_/dashboard`:hf},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(n,e)=>{n===tt.Error&&console.error(e)},logLevel:tt.Warning}}},DT=(n,e)=>({scopes:["https://graph.microsoft.com/.default","openid","profile"],redirectStartPage:`${hf}${n}`,extraQueryParameters:e}),Gt=new km(f$),my=l.ref(null);function LT(){async function n(e){var t;if(e)try{const r=e.idTokenClaims;if(!(r!=null&&r.aud))throw new Error("User audience (aud) is missing in ID token claims");const o=localStorage.getItem(`msal.token.keys.${r.aud}`);if(!o)throw new Error(`Token keys para ${r.aud} não encontrados no localStorage`);const a=JSON.parse(o),c=(t=a==null?void 0:a.idToken)==null?void 0:t[0];if(!c)throw new Error("idToken não encontrado nos token keys");const d=localStorage.getItem(c);if(!d)throw new Error(`Dados do token para ID ${c} não encontrados no localStorage`);const h=JSON.parse(d),m=h==null?void 0:h.secret;if(!m)throw new Error("Secret não encontrado nos dados do token");sessionStorage.setItem("isAuthenticated","true"),my.value=m}catch(r){console.error("Erro ao obter token de acesso:",r)}}return{jToken:my,setJToken:n}}let Jc=null;const tr=l.ref(null),Ji=l.ref(null),xT=l.ref(Math.floor(Date.now()/1e3));ff.useIntervalFn(()=>m$(),1e3);function m$(){var r,o;if(!((o=(r=tr.value)==null?void 0:r.idTokenClaims)!=null&&o.exp))return;const n=Math.floor(Date.now()/1e3),e=300,t=tr.value.idTokenClaims.exp;xT.value=t-n-e}function Nm(){if(Jc)return Jc;const{setJToken:n,jToken:e}=LT(),t=l.computed(()=>!!tr.value),r=l.computed(()=>tr.value);let o;async function a(p,w){if(!t.value)switch(p){case"redirect":w&&(o=w,await h());break;case"tab":default:await c();break}}const c=async()=>new Promise((p,w)=>{try{localStorage.clear();const C=process.env.JPLAN_WEBAPP__URL_AUTH,T=window.open(C);if(!T){console.error("Failed to open authentication window"),w("Failed to open authentication window");return}const k=Date.now(),I=6e4,N=setInterval(()=>{if(Date.now()-k>I||T.closed){clearInterval(N),console.error("Authentication canceled or timeout reached."),w("Authentication canceled or timeout reached.");return}Object.keys(localStorage).some(L=>L.startsWith("msal.account.keys"))&&(clearInterval(N),d(),T.close(),p())},500)}catch(C){console.error("Error in handleRedirect:",C),w(C)}}),d=async()=>{try{await Gt.initialize();const p=Gt.getActiveAccount();if(p)tr.value=p;else{const w=await Gt.handleRedirectPromise();w?(Gt.setActiveAccount(w.account),tr.value=Gt.getActiveAccount()):console.error("Falha na autenticação")}}catch(p){console.error("Erro no processo de autenticação:",p)}tr.value&&await n(tr.value)},h=async()=>{try{await Gt.initialize();const p=await Gt.handleRedirectPromise();if(!p||Gt.getAllAccounts().length===0){const w=DT(o);await Gt.loginRedirect(w);return}Gt.setActiveAccount(p.account),tr.value=Gt.getActiveAccount(),tr.value&&await n(tr.value),Ji.value="updated"}catch(p){console.error("handleRedirect failed",p)}};async function m(){ve.value=!0,Ji.value="updating";try{const p=await Gt.acquireTokenSilent({scopes:["https://graph.microsoft.com/.default","openid","profile"]});Gt.setActiveAccount(p.account),await n(tr.value),Ji.value="updated"}catch(p){console.error("Failed to refresh token, forcing new login.",p),Ji.value="error",localStorage.clear(),window.location.reload()}ve.value=!1}const g=async()=>{try{await Gt.initialize(),localStorage.clear(),await Gt.logoutRedirect({postLogoutRedirectUri:"/"})}catch(p){console.error("Logout error",p)}};l.watch(xT,async p=>{p<=0&&Ji.value==="updated"&&await m()});const v=l.computed(()=>e.value);return Jc={isAuthenticated:t,authState:Ji,account:r,token:v,refreshToken:m,handleRedirect:a,logout:g},Jc}const{jToken:gy}=LT(),Rm=()=>{const n=dt.create({headers:{"Content-Type":"application/json"}});l.watch(gy,o=>{n.interceptors.request.use(a=>(o&&(a.headers.Authorization=`Bearer ${o}`),a))},{immediate:!0});let e=1;n.interceptors.response.use(async o=>o,async o=>{var a;if(o.config&&o.config.headers){const c=o.config;if(((a=o.response)==null?void 0:a.status)===401&&e>0){e--;try{return c.headers.Authorization=`Bearer ${gy.value}`,await n(c)}catch(d){return Promise.reject(d)}}}return Promise.reject(o)});async function t({url:o,method:a,header:c={},body:d,baseURL:h}){try{return h&&(n.defaults.baseURL=h),(await n({url:o,method:a,headers:c,data:d})).data}catch(m){if(console.error(`Request error [${a} ${o}]:`,m),dt.isAxiosError(m)){const{response:g,message:v}=m;throw new Error(`Axios error: ${v}, Status: ${g==null?void 0:g.status}, URL: ${o}`)}throw m}}async function r({url:o,method:a,header:c,body:d,baseURL:h}){try{h&&(n.defaults.baseURL=h);const m=await n({url:o,method:a,headers:c,data:d});return{status:m.status,header:m.headers,body:m.data}}catch(m){if(dt.isAxiosError(m)){const{response:g,message:v}=m;console.error(`Raw Request Error: ${v}, Status: ${g==null?void 0:g.status}`)}return Promise.reject(m)}}return Object.assign(n,{_request:t,rawRequest:r})},{request:py}=Rm(),_y=l.ref(null),vy=l.ref("default"),uh=l.ref(null),dh=l.ref({scope_type:"org"});function vu(){var v,p;const{handleRedirect:n,account:e,logout:t}=Nm();(p=(v=e.value)==null?void 0:v.idTokenClaims)==null||p.domain;const r=l.computed(()=>{var w,C;return{domain:(C=(w=e.value)==null?void 0:w.idTokenClaims)==null?void 0:C.domain,environment:vy.value,...dh.value}}),o=l.computed(()=>dh.value);async function a(){var w;(!e.value||!((w=e.value.idTokenClaims)!=null&&w.email))&&await n();try{await c(),await d()}catch{}}async function c(){var w,C;try{const T=(C=(w=e.value)==null?void 0:w.idTokenClaims)==null?void 0:C.email;if(!T)throw new Error("Email is undefined");const k=await py({url:`https://api.jplan.com.br/platform/user/profile/?email=${T}`,method:"GET"});uh.value=k.data??null}catch(T){console.error("Failed to fetch user profile:",T)}}async function d(){var w;try{if(!((w=uh.value)!=null&&w.email))throw new Error("User email is undefined");const C=await py({url:"https://api.jplan.com.br/platform/user/domain/",method:"GET"});_y.value=C.data.data??[]}catch(C){console.error("Failed to fetch user domains:",C)}}function h(w){dh.value=w}function m(w){vy.value=w,h(r.value)}async function g(w,C){const T=DT(w,{request_domain:C});await Gt.loginRedirect(T)}return{__init__:a,user:uh,userDomains:_y,setEnv:m,setScope:h,changeDomain:g,session:r,scope:o,logout:t}}const g$={path:"/_/dashboard",component:()=>Promise.resolve().then(()=>require("./AuthRoute-CxnmOY8x.js")),meta:{requiresAuth:!1}},p$={path:"/jplan-auth-fail",component:()=>Promise.resolve().then(()=>require("./AuthFailRoute-DHl-IhUQ.js")),meta:{requiresAuth:!1}},{isAuthenticated:yy,handleRedirect:_$}=Nm(),v$=vu();function y$(n,e){n.addRoute(g$),n.addRoute(p$),n.beforeEach(async(t,r,o)=>{function a(d){return d.matched.some(h=>h.meta.requiresAuth)}if(!a(t))return o();if(!yy.value){ve.value=!0;try{await _$(e,t.fullPath),await v$.__init__()}catch(d){console.error("Fail to authenticate",d),await n.push("/jplan-auth-fail")}ve.value=!1}if(yy.value){if(localStorage.getItem("returnRoute")&&localStorage.getItem("returnRoute")!==null){const d=localStorage.getItem("returnRoute")??"/";console.log("trying to go to saved route:",d),o(d),localStorage.removeItem("returnRoute");return}o()}})}const{scope:Cy}=vu();function C$(){const n=Rm(),e=l.ref({scope_type:"org"});async function t(r){e.value=r}return l.watch(Cy,()=>{n.interceptors.request.use(r=>{const o=r.headers,a=o.Authorization;a&&(o.Authorization=a);const c=Cy.value;return c&&(c.scope_type&&(o["j-scope-type"]=c.scope_type,c.organization&&(o["j-scope-organization"]=c.organization),c.team&&(o["j-scope-team"]=c.team)),c.environment&&(o["j-scope-environment"]=c.environment)),r})},{immediate:!0}),Object.assign(n,{setScope:t,scope:e})}function La(n){const e=C$();e.defaults.baseURL=n;const t=l.ref({scope_type:"org"});async function r(o){t.value=o}return l.watch(t,()=>{e.interceptors.request.use(o=>{const a=t.value;return delete o.headers["j-scope-type"],delete o.headers["j-scope-organization"],delete o.headers["j-scope-team"],a!=null&&a.scope_type&&(o.headers["j-scope-type"]=a.scope_type),a!=null&&a.organization&&(o.headers["j-scope-organization"]=a.organization),a!=null&&a.team&&(o.headers["j-scope-team"]=a.team),o})},{immediate:!0}),Object.assign(e,{setScope:r,scope:t})}const Ey={enUS:{widget:"widget",spacer:"spacer"},ptBr:{widget:"widget",spacer:"Espaçador"}},Om={"pt-BR":{placeholders:{selectFilter:"Selecionar filtro",visualize:"Visualizar",actions:"Ações",search:"Pesquisar"},dialogs:{columnSettings:{title:"Configurações de coluna"},scope:{title:"Escopo",unknown:"Desconhecido",domain:"Domínio",environment:"Ambiente",organizational:"Organizacional",organization:"Organização",team:"Time",user:"Usuário",none:"Nenhum",selectOrganization:"Selecione uma Organização",selectTeam:"Selecione um Time"}},actions:{save:"Salvar",cancel:"Cancelar",edit:"Editar",delete:"Apagar",disable:"Desabilitar",confirm:"Confirmar",back:"Voltar"},forms:{metadata:{created:"Criado",updated:"Atualizado",modified:"Modificado",delegated:"Delegado"}},$vuetify:{dataFooter:{itemsPerPageAll:"Todos",itemsPerPageText:"Itens por página:",pageText:"{0}-{1} de {2}"}},toast:{error:{create_failed:"Falha ao criar {entity}",update_failed:"Falha ao atualizar {entity}",delete_failed:"Falha ao apagar {entity}",fetch_failed:"Falha ao buscar {entity}",activate_failed:"Falha ao ativar {entity}",deactivate_failed:"Falha ao desativar {entity}",link_failed:"Falha ao vincular {entity}",unlink_failed:"Falha ao desvincular {entity}"},success:{create_success:"{entity} criado com sucesso",update_success:"{entity} atualizado com sucesso",delete_success:"{entity} apagado com sucesso",activate_success:"{entity} ativado com sucesso",deactivate_success:"{entity} desativado com sucesso",link_success:"{entity} vinculado com sucesso",unlink_success:"{entity} desvinculado com sucesso"},info:{already_linked:"{entity} já está vinculado",select_valid_item:"Selecione um item válido"}},app:{widget:Ey.ptBr}},"en-US":{placeholders:{selectFilter:"Select a filter",visualize:"Visualize",actions:"Actions",search:"Search"},dialogs:{columnSettings:{title:"Column Settings"},scope:{title:"Scope",unknown:"Unknown",domain:"Domain",environment:"Environment",organizational:"Organizational",organization:"Organization",team:"Team",user:"User",none:"None",selectOrganization:"Select a organization",selectTeam:"Select a Team"}},actions:{save:"Save",cancel:"Cancel",edit:"Edit",delete:"Delete",disable:"Disable",back:"Back",confirm:"Confirm"},forms:{metadata:{created:"Created",updated:"Updated",modified:"Modified",delegated:"Delegated"}},$vuetify:{dataFooter:{itemsPerPageAll:"All",itemsPerPageText:"Items per page:",pageText:"{0}-{1} of {2}"}},toast:{error:{create_failed:"Failed to create {entity}",update_failed:"Failed to update {entity}",delete_failed:"Failed to delete {entity}",fetch_failed:"Failed to fetch {entity}",activate_failed:"Failed to activate {entity}",deactivate_failed:"Failed to deactivate {entity}",link_failed:"Failed to link {entity}",unlink_failed:"Failed to unlink {entity}"},success:{create_success:"{entity} created successfully",update_success:"{entity} updated successfully",delete_success:"{entity} deleted successfully",activate_success:"{entity} activated successfully",deactivate_success:"{entity} deactivated successfully",link_success:"{entity} linked successfully",unlink_success:"{entity} unlinked successfully"},info:{already_linked:"{entity} is already linked",select_valid_item:"Please select a valid item"}},app:{widget:Ey.ptBr}}},E$=Object.keys(Om),wy=navigator.language,w$=E$.includes(wy)?wy:"pt-BR",$=Ex({locale:w$,fallbackLocale:"en-US",messages:Om});function T$(){const n=La("https://api.jplan.com.br/management/organization"),{error:e}=wr();return{async getOrgList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Organization"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getOrgList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Organization"}));return}},async createOrg(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Organization"})),a}},async updateOrg(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e($.global.t("toast.error.update_failed",{entity:"Organization"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Organization"})),a}},async getOrg(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Organization"})),new Error(a.data.error);return a.data}catch(a){throw console.error("Error in getOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Organization"})),a}},async activateOrg(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"Organization"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Organization"})),a}},async deactivateOrg(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"Organization"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Organization"})),a}}}}const xo=T$();function b$(){const n=La("https://api.jplan.com.br/management/branch/"),{error:e}=wr();return{async getBranchList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error){e($.global.t("toast.error.fetch_failed",{entity:"Branch"}));return}return o.data.data}catch(r){console.error("Error in getBranchList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Branch"}))}},async createBranch(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){console.error("Error in createBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Branch"}))}},async updateBranch(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error){e(a.data.error||$.global.t("toast.error.update_failed",{entity:"Branch"}));return}return a}catch(a){console.error("Error in updateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Branch"}))}},async getBranch(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error){e(a.data.error||$.global.t("toast.error.fetch_failed",{entity:"Branch"}));return}return a.data}catch(a){console.error("Error in getBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Branch"}))}},async activateBranch(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error){e(a.data.error||$.global.t("toast.error.activate_failed",{entity:"Branch"}));return}}catch(a){console.error("Error in activateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Branch"}))}},async deactivateBranch(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error){e(a.data.error||$.global.t("toast.error.deactivate_failed",{entity:"Branch"}));return}}catch(a){console.error("Error in deactivateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Branch"}))}}}}const Uo=b$();function I$(){const n=La("https://api.jplan.com.br/management/team"),{error:e}=wr();return{async getTeamList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Team"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getTeamList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Team"}));return}},async createTeam(t){var r,o;try{const a=await n.post("/item",t);if(a.data.error)throw e($.global.t("toast.error.create_failed",{entity:"Team"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in createTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Team"})),a}},async updateTeam(t){var r,o;try{const a=await n.patch("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in updateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Team"})),a}},async getTeam(t){var r,o;try{const a=await n.get(`/item/${t}`);return a.data.error&&e($.global.t("toast.error.fetch_failed",{entity:"Team"})),a.data}catch(a){console.error("Error in getTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Team"}));return}},async activateTeam(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"Team"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Team"})),a}},async deactivateTeam(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"Team"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Team"})),a}},async getTeamUserList(t,r){try{const o=r?`?filter_query=${r}`:"",a=await n.get(`/item/${t}/user/list/${o}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(a.data.error);return a.data.data}catch(o){console.error("Error in getTeamUserList:",o),e($.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async linkManageUser(t,r){try{const o=await n.post(`/item/${t}/user/item/`,r);if(o.data.error)throw e($.global.t("toast.error.link_failed",{entity:"User"})),new Error(o.data.error);return o.data}catch(o){console.error("Error in link User:",o),e($.global.t("toast.error.link_failed",{entity:"User"}));return}},async updateManageUser(t,r){try{const o=await n.patch(`/item/${t}/user/item/`,r);if(o.data.error)throw e($.global.t("toast.error.update_failed",{entity:"User"})),new Error(o.data.error);return o.data.data}catch(o){throw console.error("Error in update User:",o),e($.global.t("toast.error.update_failed",{entity:"User"})),o}},async getManageUser(t,r,o){try{const a=o?`?filter_query=${o}`:"",c=await n.get(`/item/${t}/user/item/${r}/${a}`);if(c.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(c.data.error);return c.data.data}catch(a){console.error("Error in getUser:",a),e($.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async unlinkManageUser(t,r,o){try{const a=o?`?filter_query=${o}`:"";await n.delete(`/item/${t}/user/item/${r}/${a}`)}catch(a){throw console.error("Error in unlink User:",a),e($.global.t("toast.error.unlink_failed",{entity:"User"})),a}}}}const Mn=I$();let Qc=!1;const hh=l.ref(!1),jn=l.ref([]),Ty=l.ref([]),ft=l.ref(null),Qi=l.ref([]),Xi=l.ref([]),UT=()=>{const n=wr(),e=async C=>{hh.value=!0;const T=C?`_active eq true and ${C}`:"_active eq true",k=await xo.getOrgList(T);k&&(jn.value=k,Qc=!0),hh.value=!1},t=async C=>{var T;return(T=jn.value)!=null&&T.length||await e(C),jn.value};function r(C){if(!jn.value)throw new Error("Data not stored yet");const T=Pa(jn.value,C,["name","description"]);return C!==""?T:jn.value}const o=C=>{Ty.value=C},a=C=>{ft.value=Oa.cloneDeep(C)},c=async C=>await xo.getOrg(C),d=async()=>{if(ft.value!=null){const C=await xo.createOrg(ft.value);return C!=null&&C.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Organization"})),Qc&&jn.value.push(C.data)),C==null?void 0:C.data}},h=async()=>{if(ve.value=!0,ft.value&&ft.value.__id){const C=await xo.updateOrg(ft.value);if(Qc&&(C!=null&&C.data.__id)){const T=jn.value.findIndex(k=>k.__id===C.data.__id);return T!==-1?(jn.value[T]=C.data,n.success($.global.t("toast.success.update_success",{entity:"Organization"}))):n.error($.global.t("toast.error.update_failed",{entity:"Organization"})),ve.value=!1,C.data}}else ve.value=!1,n.error($.global.t("toast.error.update_failed",{entity:"Organization"}))},m=async()=>{if(ve.value=!0,ft.value&&ft.value.created_at){if(await xo.deactivateOrg(ft.value.__id),Qc){const C=jn.value.findIndex(T=>{var k;return T.__id===((k=ft.value)==null?void 0:k.__id)});if(C!==-1)return jn.value.splice(C,1),ft.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Organization"}))}ve.value=!1}};async function g(C){ve.value=!0;try{if(ft.value&&ft.value.__id){const T={...C,organization:ft.value.__id};if(!await Uo.updateBranch(T)){ve.value=!1;return}if(Qi.value.findIndex(N=>N.__id===C.__id)===-1)return n.success($.global.t("toast.success.link_success",{entity:"Branch"})),Qi.value.push(T),T;n.info($.global.t("toast.info.already_linked",{entity:"Branch"}))}}catch(T){console.error(T)}finally{ve.value=!1}}async function v(C){if(ve.value=!0,ft.value&&ft.value.__id){const T={...C,organization:null};if(!await Uo.updateBranch(T)){ve.value=!1;return}const I=Qi.value.findIndex(N=>N.__id===C.__id);if(I!==-1)return Qi.value.splice(I,1),ve.value=!1,Qi.value;throw new Error("Item not found to remove")}ve.value=!1}async function p(C){ve.value=!0;try{if(ft.value&&ft.value.__id){const T={...C,organization:ft.value.__id};if(!await Mn.updateTeam(T)){ve.value=!1;return}if(Xi.value.findIndex(N=>N.__id===C.__id)===-1)return n.success($.global.t("toast.success.link_success",{entity:"Team"})),Xi.value.push(T),T;n.info($.global.t("toast.info.already_linked",{entity:"Team"}))}}catch(T){console.error(T)}finally{ve.value=!1}}async function w(C){if(ve.value=!0,ft.value&&ft.value.__id){const T={...C,organization:null};if(!await Mn.updateTeam(T)){ve.value=!1;return}const I=Xi.value.findIndex(N=>N.__id===C.__id);if(I!==-1)return Xi.value.splice(I,1),ve.value=!1,Xi.value;throw new Error("Item not found to remove")}ve.value=!1}return{data:jn,loading:hh,columns:Ty,item:ft,filterData:r,__init__:e,getData:t,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,orgBranches:Qi,orgTeams:Xi,linkBranch:g,unlinkBranch:v,linkTeam:p,unlinkTeam:w}};let Xc=!1;const Yn=l.ref([]),by=l.ref([]),Nt=l.ref(null),fh=l.ref(!1),Zi=l.ref([]),BT=()=>{const n=wr(),e=async p=>{fh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await Mn.getTeamList(w);C&&(Yn.value=C,Xc=!0),fh.value=!1},t=async p=>(Yn.value.length||await e(p),Yn.value);function r(p){if(!Yn.value)throw new Error("Data not stored yet");const w=Pa(Yn.value,p,["name","description"]);return p!==""?w:Yn.value}const o=p=>{by.value=p},a=p=>{Nt.value=Oa.cloneDeep(p)},c=async p=>await Mn.getTeam(p),d=async()=>{if(Nt.value!=null){const p=await Mn.createTeam(Nt.value);return p!=null&&p.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Team"})),Xc&&Yn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(ve.value=!0,Nt.value&&Nt.value.__id){const p=await Mn.updateTeam(Nt.value);if(Xc&&(p!=null&&p.data.__id)){const w=Yn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Yn.value[w]=p.data,n.success($.global.t("toast.success.update_success",{entity:"Team"}))):n.error($.global.t("toast.error.update_failed",{entity:"Team"})),p.data}}else n.error($.global.t("toast.error.update_failed",{entity:"Team"}))},m=async()=>{if(Nt.value&&Nt.value.created_at&&(await Mn.deactivateTeam(Nt.value.__id),Xc)){const p=Yn.value.findIndex(w=>{var C;return w.__id===((C=Nt.value)==null?void 0:C.__id)});if(p!==-1)return Yn.value.splice(p,1),Nt.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Team"}))}};async function g(p){var w;if(ve.value=!0,(w=Nt.value)!=null&&w.__id)if(Zi.value.findIndex(T=>T.__id===p.__id)===-1)try{const T=await Mn.linkManageUser(Nt.value.__id,{team:Nt.value.__id,user:p.__id,role:"string",joined_at:"string",comments:"string"}),k=await Mn.getTeamUserList(Nt.value.__id);return k&&(Zi.value=k),n.success($.global.t("toast.success.link_success",{entity:"User"})),T}catch(T){console.error(T),n.error($.global.t("toast.error.link_failed",{entity:"User"}))}finally{ve.value=!1}else n.info($.global.t("toast.info.already_linked",{entity:"User"}));else console.warn("No item selected or item ID is missing."),n.info($.global.t("toast.info.select_valid_item"));ve.value=!1}async function v(p){if(ve.value=!0,Nt.value&&Nt.value.__id){const w=Zi.value.findIndex(C=>C.__id===p);if(w!==-1)return await Mn.unlinkManageUser(Nt.value.__id,p),Zi.value.splice(w,1),ve.value=!1,Zi.value;throw new Error("Item not found to remove")}ve.value=!1}return{data:Yn,loading:fh,columns:by,item:Nt,usersTeam:Zi,__init__:e,getData:t,filterData:r,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,linkUser:g,unlinkUser:v}},FT=l.defineComponent({__name:"GlobalScopeFilter",setup(n){var T,k,I;const{openDialog:e}=Ms("global-scope__J-"),{user:t,scope:r,session:o,setScope:a}=vu(),{getData:c,data:d}=UT(),{getData:h,data:m}=BT(),g=l.ref(!1);l.onBeforeMount(async()=>{g.value=!0,await c(),await h(),g.value=!1});const v=l.ref({scope_type:(T=r.value)==null?void 0:T.scope_type,organization:((k=r.value)==null?void 0:k.organization)??"org",team:(I=r.value)==null?void 0:I.team});function p(){var N,D,L;v.value={...r.value,scope_type:(N=r.value)==null?void 0:N.scope_type,organization:((D=r.value)==null?void 0:D.organization)??"",team:(L=r.value)==null?void 0:L.team},e()}const w=l.computed(()=>{var N;switch((N=r.value)==null?void 0:N.scope_type){case"user":return VF;case"org":return BF;case"team":return HF;default:return FF}});async function C(){var N;((N=r.value)==null?void 0:N.scope_type)!==""&&a(v.value)}return(N,D)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(it.VBtn,{onClick:p,icon:"",class:"text-secondary",color:"surface",rounded:"sm",size:"small",variant:"flat"},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(w.value),{size:"20"}))]),_:1}),l.createVNode(l.unref(Ls),{loading:g.value,title:l.unref($).global.t("dialogs.scope.title"),"dd-id":"global-scope__J-",onOnSave:C},{default:l.withCtx(()=>[l.createElementVNode("div",null,[l.createVNode(Qe.VRow,null,{default:l.withCtx(()=>[l.createVNode(Qe.VCol,{cols:"4",class:"d-flex flex-row align-center"},{default:l.withCtx(()=>[l.createVNode(Qt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.user")),1)]),_:1}),l.createVNode(Qt.VListItemSubtitle,null,{default:l.withCtx(()=>{var L;return[l.createTextVNode(l.toDisplayString(((L=l.unref(t))==null?void 0:L.name)||l.unref($).global.t("dialogs.scope.unknownUser")),1)]}),_:1})]),_:1})]),_:1}),l.createVNode(Qe.VCol,{cols:"4"},{default:l.withCtx(()=>[l.createVNode(Qt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.environment")),1)]),_:1}),l.createVNode(Qt.VListItemSubtitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o).domain),1)]),_:1})]),_:1})]),_:1}),l.createVNode(Qe.VCol,{cols:"4"},{default:l.withCtx(()=>[l.createVNode(Qt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.environment")),1)]),_:1}),l.createVNode(Qt.VListItemSubtitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o).environment),1)]),_:1})]),_:1})]),_:1})]),_:1}),l.createVNode(AO.VBtnToggle,{density:"compact",variant:"outlined",modelValue:v.value.scope_type,"onUpdate:modelValue":D[0]||(D[0]=L=>v.value.scope_type=L),class:"d-flex justify-center my-4"},{default:l.withCtx(()=>[l.createVNode(it.VBtn,{value:"org",label:l.unref($).global.t("dialogs.scope.organizational"),color:"secondary"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.organizational")),1)]),_:1},8,["label"]),l.createVNode(it.VBtn,{value:"team",label:l.unref($).global.t("dialogs.scope.team"),color:"secondary"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.team")),1)]),_:1},8,["label"]),l.createVNode(it.VBtn,{value:"user",label:l.unref($).global.t("dialogs.scope.user"),color:"secondary"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.user")),1)]),_:1},8,["label"]),l.createVNode(it.VBtn,{value:"",label:l.unref($).global.t("dialogs.scope.none"),color:"lightext"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.none")),1)]),_:1},8,["label"])]),_:1},8,["modelValue"]),l.createElementVNode("div",null,[l.createVNode(va.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.organization")),1)]),_:1}),l.createVNode(us.VSelect,{items:l.unref(d),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:l.unref($).global.t("dialogs.scope.selectOrganization"),class:"min-w-50",modelValue:v.value.organization,"onUpdate:modelValue":D[1]||(D[1]=L=>v.value.organization=L),clearable:""},null,8,["items","placeholder","modelValue"]),l.createVNode(va.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref($).global.t("dialogs.scope.team")),1)]),_:1}),l.createVNode(us.VSelect,{items:l.unref(m),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:l.unref($).global.t("dialogs.scope.selectTeam"),class:"min-w-50",modelValue:v.value.team,"onUpdate:modelValue":D[2]||(D[2]=L=>v.value.team=L),clearable:""},null,8,["items","placeholder","modelValue"])])])]),_:1},8,["loading","title"])],64))}}),S$={},A$={class:"double-ring-spinner-container"};function k$(n,e){return l.openBlock(),l.createElementBlock("div",A$,e[0]||(e[0]=[l.createElementVNode("div",{class:"spinner-loading"},[l.createElementVNode("div"),l.createElementVNode("div"),l.createElementVNode("div",null,[l.createElementVNode("div")]),l.createElementVNode("div",null,[l.createElementVNode("div")])],-1)]))}const VT=Aa(S$,[["render",k$],["__scopeId","data-v-00d7a69f"]]),N$={key:0,class:"_jspinner-overlay_jj"},HT=l.defineComponent({__name:"GlobalSpinner",setup(n){return(e,t)=>l.unref(ve)?(l.openBlock(),l.createElementBlock("div",N$,t[0]||(t[0]=[l.createElementVNode("div",{class:"j-double-ring-spinner-container"},[l.createElementVNode("div",{class:"j-global-spinner-loading"},[l.createElementVNode("div"),l.createElementVNode("div"),l.createElementVNode("div",null,[l.createElementVNode("div")]),l.createElementVNode("div",null,[l.createElementVNode("div")])])],-1)]))):l.createCommentVNode("",!0)}}),$T=l.defineComponent({__name:"SubMenu",props:{title:{}},setup(n,{expose:e}){return e({props:n}),(r,o)=>(l.openBlock(),l.createBlock(Qt.VListItem,{onClick:o[0]||(o[0]=()=>{}),density:"compact"},{append:l.withCtx(()=>[l.createVNode(l.unref($F))]),default:l.withCtx(()=>[l.createVNode(Qt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(r.title),1)]),_:1}),l.createVNode(gf.VMenu,{activator:"parent","open-on-hover":"",submenu:"",density:"compact"},{default:l.withCtx(()=>[l.renderSlot(r.$slots,"default")]),_:3})]),_:3}))}}),R$=Object.freeze(Object.defineProperty({__proto__:null,AvatarPicture:fC,ColumnSettingsDialog:Uf,ConfirmDialog:dC,ContextMenu:mC,CopyButton:Bl,DeleteAllBtn:Cf,DotsMenu:uC,EditButton:lC,FormHeadless:qE,FormMetadata:ou,GlobalScopeFilter:FT,GlobalSpinner:HT,JAutocomplete:HE,JAvatar:hC,JBtn:Oy,JDialog:Ls,JForm:zE,JIconBtn:Ry,JSelect:VE,JTextArea:$E,JTextField:gE,ParentCard:Kl,SearchFilter:Jl,SpinnerLoader:VT,SubMenu:$T,TabFormHeader:GE,TableAdvanced:XC,TableCard:Bf,TableCardsView:fE,TableHeader:ZC,UiTable:gC},Symbol.toStringTag,{value:"Module"})),O$=n0(),P$={transition:"Vue-Toastification__fade",maxToasts:20,newestOnTop:!0};let mh=!1;const gh=l.ref(!1),Jn=l.ref([]),Iy=l.ref([]),$t=l.ref(null),ea=l.ref([]),M$=()=>{const n=wr(),e=async p=>{gh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await Uo.getBranchList(w);C&&(Jn.value=C,mh=!0),gh.value=!1},t=async p=>(Jn.value.length||await e(p),Jn.value);function r(p){if(!Jn.value)throw new Error("Data not stored yet");const w=Pa(Jn.value,p,["name","description"]);return p!==""?w:Jn.value}const o=p=>{Iy.value=p},a=p=>{$t.value=Oa.cloneDeep(p)},c=async p=>await Uo.getBranch(p),d=async()=>{if($t.value!=null){const p=await Uo.createBranch($t.value);return p!=null&&p.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Branch"})),mh&&Jn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if($t.value&&$t.value.__id){const p=await Uo.updateBranch($t.value);if(mh&&p){const w=Jn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Jn.value[w]=p.data,n.success($.global.t("toast.success.update_success",{entity:"Branch"}))):n.error($.global.t("toast.error.update_failed",{entity:"Branch"})),p}}else n.error($.global.t("toast.error.update_failed",{entity:"Branch"}))},m=async()=>{if($t.value&&$t.value.created_at){await Uo.deactivateBranch($t.value.__id);const p=Jn.value.findIndex(w=>{var C;return w.__id===((C=$t.value)==null?void 0:C.__id)});if(p!==-1)return Jn.value.splice(p,1),$t.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Branch"}))}};async function g(p){ve.value=!0;try{if($t.value&&$t.value.__id){const w={...p,branch:$t.value.__id};if(!await Mn.updateTeam(w)){n.error($.global.t("toast.error.link_failed",{entity:"Team"}));return}if(ea.value.findIndex(k=>k.__id===p.__id)===-1)return n.success($.global.t("toast.success.link_success",{entity:"Team"})),ea.value.push(w),w;n.info($.global.t("toast.info.already_linked",{entity:"Team"}))}else throw new Error("Item is not defined")}catch(w){console.error(w)}finally{ve.value=!1}}async function v(p){if(ve.value=!0,$t.value&&$t.value.__id){const w={...p,branch:null};if(!await Mn.updateTeam(w))return;const T=ea.value.findIndex(k=>k.__id===p.__id);if(T!==-1)return ea.value.splice(T,1),ve.value=!1,ea.value;throw new Error("Item not found to remove")}ve.value=!1}return{data:Jn,columns:Iy,item:$t,loading:gh,__init__:e,getData:t,filterData:r,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,branchTeams:ea,linkTeam:g,unlinkTeam:v}};function D$(){const n=La("https://api.jplan.com.br/management/division"),{error:e}=wr();return{async getDivisionList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Division"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getDivisionList:",r),e($.global.t("toast.error.fetch_failed",{entity:"Division"}));return}},async createDivision(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"Division"})),a}},async updateDivision(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e($.global.t("toast.error.update_failed",{entity:"Division"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"Division"})),a}},async getDivision(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"Division"})),new Error(a.data.error);return a.data}catch(a){throw console.error("Error in getDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"Division"})),a}},async activateDivision(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"Division"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"Division"})),a}},async deactivateDivision(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"Division"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"Division"})),a}}}}const ca=D$();let ph=!1;const _h=l.ref(!1),Qn=l.ref([]),Sy=l.ref([]),Kt=l.ref(null),ta=l.ref([]),L$=()=>{const n=wr(),e=async p=>{_h.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await ca.getDivisionList(w);C&&(Qn.value=C,ph=!0),_h.value=!1},t=async p=>(Qn.value.length||await e(p),Qn.value);function r(p){if(!Qn.value)throw new Error("Data not stored yet");const w=Pa(Qn.value,p,["name","description"]);return p!==""?w:Qn.value}const o=p=>{Sy.value=p},a=p=>{Kt.value=Oa.cloneDeep(p)},c=async p=>await ca.getDivision(p),d=async()=>{if(Kt.value!=null){const p=await ca.createDivision(Kt.value);return p!=null&&p.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"Division"})),ph&&Qn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(ve.value=!0,Kt.value&&Kt.value.__id){const p=await ca.updateDivision(Kt.value);if(ph&&(p!=null&&p.data.__id)){const w=Qn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Qn.value[w]=p.data,n.success($.global.t("toast.success.update_success",{entity:"Division"}))):n.error($.global.t("toast.error.update_failed",{entity:"Division"})),ve.value=!1,p}}else ve.value=!1,n.error($.global.t("toast.error.update_failed",{entity:"Division"}))},m=async()=>{if(ve.value=!0,Kt.value&&Kt.value.created_at){await ca.deactivateDivision(Kt.value.__id);const p=Qn.value.findIndex(w=>{var C;return w.__id===((C=Kt.value)==null?void 0:C.__id)});if(p!==-1)return Qn.value.splice(p,1),Kt.value;n.error($.global.t("toast.error.deactivate_failed",{entity:"Division"}))}ve.value=!1};async function g(p){ve.value=!0;try{if(Kt.value&&Kt.value.__id){const w={...p,division:Kt.value.__id};return await xo.updateOrg(w)?(ta.value.findIndex(k=>k.__id===p.__id)===-1?(n.success($.global.t("toast.success.link_success",{entity:"Organization"})),ta.value.push(w)):n.info($.global.t("toast.info.already_linked",{entity:"Organization"})),w):void 0}else throw new Error("Item is not defined")}catch(w){console.error(w)}finally{ve.value=!1}}async function v(p){if(ve.value=!0,Kt.value&&Kt.value.__id){const w={...p,division:null};if(!await xo.updateOrg(w))return;const T=ta.value.findIndex(k=>k.__id===p.__id);if(T!==-1)ta.value.splice(T,1);else throw new Error("Item not found to remove")}else throw new Error("Item is not defined");return ve.value=!1,ta.value}return{data:Qn,columns:Sy,item:Kt,loading:_h,__init__:e,filterData:r,getData:t,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:m,orgs:ta,linkDivision:g,unlinkDivision:v}};function x$(){const n=La("https://api.jplan.com.br/management/user"),{error:e}=wr();return{async getManageUserList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getManageUserList:",r),e($.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async createManageUser(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.create_failed",{entity:"User"})),a}},async updateManageUser(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e($.global.t("toast.error.update_failed",{entity:"User"})),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.update_failed",{entity:"User"})),a}},async getManageUser(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e($.global.t("toast.error.fetch_failed",{entity:"User"})),new Error(a.data.error);return a.data}catch(a){console.error("Error in getManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.fetch_failed",{entity:"User"}));return}},async activateManageUser(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e($.global.t("toast.error.activate_failed",{entity:"User"})),new Error(a.data.error)}catch(a){throw console.error("Error in activateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.activate_failed",{entity:"User"})),a}},async deactivateManageUser(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e($.global.t("toast.error.deactivate_failed",{entity:"User"})),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||$.global.t("toast.error.deactivate_failed",{entity:"User"})),a}}}}const la=x$();let vh=!1,yh=l.ref(!1);const Xn=l.ref([]),Ay=l.ref([]),Zn=l.ref(null),U$=l.ref(null),B$=l.ref([]),F$=()=>{const n=wr(),e=async g=>{yh.value=!0;const v=g?`_active eq true and ${g}`:"_active eq true",p=await la.getManageUserList(v);p&&(Xn.value=p,vh=!0),yh.value=!1},t=async g=>(Xn.value.length||await e(g),Xn.value);function r(g){if(!Xn.value)throw new Error("Data not stored yet");const v=Pa(Xn.value,g,["name","description"]);return g!==""?v:Xn.value}return{data:Xn,loading:yh,columns:Ay,item:Zn,filterData:r,__init__:e,getData:t,setColumns:g=>{Ay.value=g},setItem:g=>{Zn.value=Oa.cloneDeep(g)},getItem:async g=>await la.getManageUser(g),createItem:async()=>{if(Zn.value!=null){const g=crypto.randomUUID(),v=await la.createManageUser({...Zn.value,__id:g});return v!=null&&v.data.created_at&&(n.success($.global.t("toast.success.create_success",{entity:"User"})),vh&&Xn.value.push(v.data)),v==null?void 0:v.data}},updateItem:async()=>{if(ve.value=!0,Zn.value&&Zn.value.created_at){const g=await la.updateManageUser(Zn.value);if(vh&&(g!=null&&g.data)){const v=Xn.value.findIndex(p=>p.__id===(g==null?void 0:g.data.__id));v!==-1?(Xn.value[v]=g==null?void 0:g.data,n.success($.global.t("toast.success.update_success",{entity:"User"}))):n.error($.global.t("toast.error.update_failed",{entity:"User"}))}return ve.value=!1,g==null?void 0:g.data}},removeItem:async()=>{if(Zn.value&&Zn.value.created_at){try{await la.deactivateManageUser(Zn.value.__id)}catch{n.error($.global.t("toast.error.deactivate_failed",{entity:"User"}));return}const g=Xn.value.findIndex(v=>{var p;return v.__id===((p=Zn.value)==null?void 0:p.__id)});if(g!==-1)return Xn.value.splice(g,1),n.success($.global.t("toast.success.deactivate_success",{entity:"User"})),Zn.value}},userOrg:U$,userTeams:B$}},Ch=Object.freeze({colNum:24,rowHeight:50,useCssTransforms:!0,responsive:!0,margin:[12,10]}),na=l.ref(!1),V$=l.ref([]);function H$(){const n=l.ref({...Ch,isResizable:!1,isDraggable:!1,useStyleCursor:!1,cursor:"default"});function e(){if(na.value=!na.value,n.value.isDraggable=na.value,n.value.isResizable=na.value,!na.value){n.value.useStyleCursor=!0,n.value.cursor="pointer";return}n.value.useStyleCursor=!1,n.value.cursor="move"}function t(){n.value={...Ch,isResizable:!1,isDraggable:!1,useStyleCursor:!1,cursor:"default"}}return{DEFAULT_CONFIG:Ch,config:n,layout:V$,edition:na,toggleEdit:e,resetLayout:t}}const $$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetTask-CEJI71mG.js"))),K$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetImage-DhplL-E6.js"))),W$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetShortcut-BXIP0Njn.js"))),z$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetSpacer-B4EZ3H17.js"))),G$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetLabel-ByRvF284.js"))),q$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetChartBar-ChMg_dbz.js"))),j$=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./WidgetChartPie-C2AIgVQ2.js"))),Y$={WidgetSpacer:z$,WidgetLabel:G$,WidgetTask:$$,WidgetImage:K$,WidgetShortcut:W$,WidgetChartBar:q$,WidgetChartPie:j$},J$={defaultI18n:!0},Q$=(n,e)=>{const t={...J$,...e};n.use(O$),n.use(oP,P$),t.defaultI18n&&n.use($),Object.entries(R$).forEach(([r,o])=>{n.component(r,o)}),Object.entries(NO).forEach(([r,o])=>{n.provide(r,o)})},X$={install:Q$};exports.ContextMenu=mC;exports.EmptyListImg=Lh;exports.EventBus=Hl;exports.FormHeadless=qE;exports.HttpCore=uF;exports.I18nMessages=Om;exports.SpinnerLoader=VT;exports.TableCardsView=fE;exports.TableHeader=ZC;exports.__spinner=ve;exports._export_sfc=Aa;exports._sfc_main=Ls;exports._sfc_main$1=gC;exports._sfc_main$10=Oy;exports._sfc_main$11=Cf;exports._sfc_main$12=lC;exports._sfc_main$13=Ry;exports._sfc_main$14=VE;exports._sfc_main$15=HE;exports._sfc_main$16=$E;exports._sfc_main$17=gE;exports._sfc_main$18=zE;exports._sfc_main$19=GE;exports._sfc_main$2=XC;exports._sfc_main$20=Kl;exports._sfc_main$21=hC;exports._sfc_main$22=fC;exports._sfc_main$23=$T;exports._sfc_main$24=FT;exports._sfc_main$25=HT;exports._sfc_main$3=Uf;exports._sfc_main$4=Bf;exports._sfc_main$5=Jl;exports._sfc_main$6=dC;exports._sfc_main$7=Bl;exports._sfc_main$8=uC;exports._sfc_main$9=ou;exports.branchInstance=Uo;exports.coreClient=Rm;exports.createToastInterface=ws;exports.dateFormat=ds;exports.divisionInstance=ca;exports.filterQuery=Pa;exports.globalEventBus=yf;exports.i18n=$;exports.index=X$;exports.manageUserInstance=la;exports.msal=Gt;exports.orgInstance=xo;exports.provideToast=rP;exports.scopedClient=La;exports.setupAuthGuard=y$;exports.teamInstance=Mn;exports.toastInjectionKey=$l;exports.useAuth=Nm;exports.useBranchStore=M$;exports.useCustomizer=s0;exports.useDashboardStore=H$;exports.useDialog=Ms;exports.useDivisionStore=L$;exports.useManageUserStore=F$;exports.useOrganizationStore=UT;exports.useSession=vu;exports.useTeamStore=BT;exports.useToast=wr;exports.widgets=Y$;
|