@machinemetrics/mm-react-tools 3.2.5-0 → 3.2.5

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.
@@ -22939,7 +22939,7 @@ const sl = Ms.createContext(), _F = () => {
22939
22939
  padding-top: 200px;
22940
22940
  `, K0 = ({ loadError: r }) => {
22941
22941
  const e = AM();
22942
- return r && !e || e.indexOf("mm-embedded-login") === -1 ? /* @__PURE__ */ sr.jsx(SF, { children: r }) : (vx(), /* @__PURE__ */ sr.jsx(cI, { replace: !0, to: e || "/" }));
22942
+ return r && (!e || e.indexOf("mm-embedded-login") === -1) ? /* @__PURE__ */ sr.jsx(SF, { children: r }) : (vx(), /* @__PURE__ */ sr.jsx(cI, { replace: !0, to: e || "/" }));
22943
22943
  };
22944
22944
  Eb.div`
22945
22945
  font-size: 20px;
@@ -31397,23 +31397,21 @@ const xb = (r, e) => {
31397
31397
  h.current,
31398
31398
  () => xb(h, f)
31399
31399
  ];
31400
- }, lq = nI(
31401
- ({ href: r, asFlyout: e, flyoutTitle: t, children: n, ...i }, a) => {
31402
- const { isEmbedded: u, navigateParent: c } = ai(qa);
31403
- return /* @__PURE__ */ sr.jsx(
31404
- "a",
31405
- {
31406
- ...i,
31407
- ref: a,
31408
- href: r,
31409
- onClick: (f) => {
31410
- !u || f.metaKey || f.ctrlKey || f.shiftKey || (f.preventDefault(), f.stopPropagation(), c(r, { asFlyout: e, flyoutTitle: t }));
31411
- },
31412
- children: n
31413
- }
31414
- );
31415
- }
31416
- );
31400
+ }, lq = nI(({ href: r, asFlyout: e, children: t, ...n }, i) => {
31401
+ const { isEmbedded: a, navigateParent: u } = ai(qa);
31402
+ return /* @__PURE__ */ sr.jsx(
31403
+ "a",
31404
+ {
31405
+ ...n,
31406
+ ref: i,
31407
+ href: r,
31408
+ onClick: (c) => {
31409
+ !a || c.metaKey || c.ctrlKey || c.shiftKey || (c.preventDefault(), c.stopPropagation(), u(r, { asFlyout: e }));
31410
+ },
31411
+ children: t
31412
+ }
31413
+ );
31414
+ });
31417
31415
  export {
31418
31416
  lq as Link,
31419
31417
  oq as MMProvider,
@@ -131,7 +131,7 @@ function print() { __p += __j.call(arguments, '') }
131
131
  `+G.prev}function zt(H,G){var it=nt(H),gt=[];if(it){gt.length=H.length;for(var ct=0;ct<H.length;ct++)gt[ct]=V(H,ct)?G(H[ct],H):""}var We=typeof te=="function"?te(H):[],Kt;if(ye){Kt={};for(var Zt=0;Zt<We.length;Zt++)Kt["$"+We[Zt]]=We[Zt]}for(var Gt in H)V(H,Gt)&&(it&&String(Number(Gt))===Gt&&Gt<H.length||ye&&Kt["$"+Gt]instanceof Symbol||(W.call(/[^\w$]/,Gt)?gt.push(G(Gt,H)+": "+G(H[Gt],H)):gt.push(Gt+": "+G(H[Gt],H))));if(typeof te=="function")for(var kr=0;kr<We.length;kr++)Me.call(H,We[kr])&&gt.push("["+G(We[kr])+"]: "+G(H[We[kr]],H));return gt}return gh}var vh,D0;function Mk(){if(D0)return vh;D0=1;var r=ec(),e=da(),t=function(c,f,h){for(var d=c,y;(y=d.next)!=null;d=y)if(y.key===f)return d.next=y.next,h||(y.next=c.next,c.next=y),y},n=function(c,f){if(c){var h=t(c,f);return h&&h.value}},i=function(c,f,h){var d=t(c,f);d?d.value=h:c.next={key:f,next:c.next,value:h}},a=function(c,f){return c?!!t(c,f):!1},u=function(c,f){if(c)return t(c,f,!0)};return vh=function(){var f,h={assert:function(d){if(!h.has(d))throw new e("Side channel does not contain "+r(d))},delete:function(d){var y=f&&f.next,g=u(f,d);return g&&y&&y===g&&(f=void 0),!!g},get:function(d){return n(f,d)},has:function(d){return a(f,d)},set:function(d,y){f||(f={next:void 0}),i(f,d,y)}};return h},vh}var bh,F0;function L0(){return F0||(F0=1,bh=Object),bh}var wh,q0;function Dk(){return q0||(q0=1,wh=Error),wh}var _h,j0;function Fk(){return j0||(j0=1,_h=EvalError),_h}var xh,U0;function Lk(){return U0||(U0=1,xh=RangeError),xh}var Sh,$0;function qk(){return $0||($0=1,Sh=ReferenceError),Sh}var Eh,B0;function jk(){return B0||(B0=1,Eh=SyntaxError),Eh}var Oh,V0;function Uk(){return V0||(V0=1,Oh=URIError),Oh}var Th,W0;function $k(){return W0||(W0=1,Th=Math.abs),Th}var Ah,z0;function Bk(){return z0||(z0=1,Ah=Math.floor),Ah}var kh,H0;function Vk(){return H0||(H0=1,kh=Math.max),kh}var Ih,G0;function Wk(){return G0||(G0=1,Ih=Math.min),Ih}var Ch,Q0;function zk(){return Q0||(Q0=1,Ch=Math.pow),Ch}var Ph,J0;function Hk(){return J0||(J0=1,Ph=Math.round),Ph}var Nh,Y0;function Gk(){return Y0||(Y0=1,Nh=Number.isNaN||function(e){return e!==e}),Nh}var Rh,K0;function Qk(){if(K0)return Rh;K0=1;var r=Gk();return Rh=function(t){return r(t)||t===0?t:t<0?-1:1},Rh}var Mh,Z0;function Jk(){return Z0||(Z0=1,Mh=Object.getOwnPropertyDescriptor),Mh}var Dh,X0;function eb(){if(X0)return Dh;X0=1;var r=Jk();if(r)try{r([],"length")}catch{r=null}return Dh=r,Dh}var Fh,tb;function Yk(){if(tb)return Fh;tb=1;var r=Object.defineProperty||!1;if(r)try{r({},"a",{value:1})}catch{r=!1}return Fh=r,Fh}var Lh,rb;function Kk(){return rb||(rb=1,Lh=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var a in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var u=Object.getOwnPropertySymbols(e);if(u.length!==1||u[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(e,t);if(c.value!==i||c.enumerable!==!0)return!1}return!0}),Lh}var qh,nb;function Zk(){if(nb)return qh;nb=1;var r=typeof Symbol<"u"&&Symbol,e=Kk();return qh=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},qh}var jh,ib;function sb(){return ib||(ib=1,jh=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),jh}var Uh,ab;function ob(){if(ab)return Uh;ab=1;var r=L0();return Uh=r.getPrototypeOf||null,Uh}var $h,ub;function Xk(){if(ub)return $h;ub=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,n="[object Function]",i=function(f,h){for(var d=[],y=0;y<f.length;y+=1)d[y]=f[y];for(var g=0;g<h.length;g+=1)d[g+f.length]=h[g];return d},a=function(f,h){for(var d=[],y=h,g=0;y<f.length;y+=1,g+=1)d[g]=f[y];return d},u=function(c,f){for(var h="",d=0;d<c.length;d+=1)h+=c[d],d+1<c.length&&(h+=f);return h};return $h=function(f){var h=this;if(typeof h!="function"||e.apply(h)!==n)throw new TypeError(r+h);for(var d=a(arguments,1),y,g=function(){if(this instanceof y){var _=h.apply(this,i(d,arguments));return Object(_)===_?_:this}return h.apply(f,i(d,arguments))},m=t(0,h.length-d.length),b=[],I=0;I<m;I++)b[I]="$"+I;if(y=Function("binder","return function ("+u(b,",")+"){ return binder.apply(this,arguments); }")(g),h.prototype){var S=function(){};S.prototype=h.prototype,y.prototype=new S,S.prototype=null}return y},$h}var Bh,cb;function tc(){if(cb)return Bh;cb=1;var r=Xk();return Bh=Function.prototype.bind||r,Bh}var Vh,lb;function Wh(){return lb||(lb=1,Vh=Function.prototype.call),Vh}var zh,fb;function hb(){return fb||(fb=1,zh=Function.prototype.apply),zh}var Hh,db;function eI(){return db||(db=1,Hh=typeof Reflect<"u"&&Reflect&&Reflect.apply),Hh}var Gh,pb;function tI(){if(pb)return Gh;pb=1;var r=tc(),e=hb(),t=Wh(),n=eI();return Gh=n||r.call(t,e),Gh}var Qh,mb;function yb(){if(mb)return Qh;mb=1;var r=tc(),e=da(),t=Wh(),n=tI();return Qh=function(a){if(a.length<1||typeof a[0]!="function")throw new e("a function is required");return n(r,t,a)},Qh}var Jh,gb;function rI(){if(gb)return Jh;gb=1;var r=yb(),e=eb(),t;try{t=[].__proto__===Array.prototype}catch(u){if(!u||typeof u!="object"||!("code"in u)||u.code!=="ERR_PROTO_ACCESS")throw u}var n=!!t&&e&&e(Object.prototype,"__proto__"),i=Object,a=i.getPrototypeOf;return Jh=n&&typeof n.get=="function"?r([n.get]):typeof a=="function"?function(c){return a(c==null?c:i(c))}:!1,Jh}var Yh,vb;function nI(){if(vb)return Yh;vb=1;var r=sb(),e=ob(),t=rI();return Yh=r?function(i){return r(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:t?function(i){return t(i)}:null,Yh}var Kh,bb;function iI(){if(bb)return Kh;bb=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=tc();return Kh=t.call(r,e),Kh}var Zh,wb;function Xh(){if(wb)return Zh;wb=1;var r,e=L0(),t=Dk(),n=Fk(),i=Lk(),a=qk(),u=jk(),c=da(),f=Uk(),h=$k(),d=Bk(),y=Vk(),g=Wk(),m=zk(),b=Hk(),I=Qk(),S=Function,_=function(Ne){try{return S('"use strict"; return ('+Ne+").constructor;")()}catch{}},T=eb(),P=Yk(),M=function(){throw new c},U=T?function(){try{return arguments.callee,M}catch{try{return T(arguments,"callee").get}catch{return M}}}():M,W=Zk()(),K=nI(),X=ob(),fe=sb(),oe=hb(),ke=Wh(),te={},ve=typeof Uint8Array>"u"||!K?r:K(Uint8Array),ye={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":W&&K?K([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":te,"%AsyncGenerator%":te,"%AsyncGeneratorFunction%":te,"%AsyncIteratorPrototype%":te,"%Atomics%":typeof Atomics>"u"?r:Atomics,"%BigInt%":typeof BigInt>"u"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":S,"%GeneratorFunction%":te,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":W&&K?K(K([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!W||!K?r:K(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":T,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":i,"%ReferenceError%":a,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!W||!K?r:K(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":W&&K?K(""[Symbol.iterator]()):r,"%Symbol%":W?Symbol:r,"%SyntaxError%":u,"%ThrowTypeError%":U,"%TypedArray%":ve,"%TypeError%":c,"%Uint8Array%":typeof Uint8Array>"u"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?r:Uint32Array,"%URIError%":f,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet,"%Function.prototype.call%":ke,"%Function.prototype.apply%":oe,"%Object.defineProperty%":P,"%Object.getPrototypeOf%":X,"%Math.abs%":h,"%Math.floor%":d,"%Math.max%":y,"%Math.min%":g,"%Math.pow%":m,"%Math.round%":b,"%Math.sign%":I,"%Reflect.getPrototypeOf%":fe};if(K)try{null.error}catch(Ne){var de=K(K(Ne));ye["%Error.prototype%"]=de}var Me=function Ne(ze){var B;if(ze==="%AsyncFunction%")B=_("async function () {}");else if(ze==="%GeneratorFunction%")B=_("function* () {}");else if(ze==="%AsyncGeneratorFunction%")B=_("async function* () {}");else if(ze==="%AsyncGenerator%"){var Q=Ne("%AsyncGeneratorFunction%");Q&&(B=Q.prototype)}else if(ze==="%AsyncIteratorPrototype%"){var q=Ne("%AsyncGenerator%");q&&K&&(B=K(q.prototype))}return ye[ze]=B,B},Se={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ge=tc(),qe=iI(),tt=ge.call(ke,Array.prototype.concat),je=ge.call(oe,Array.prototype.splice),mt=ge.call(ke,String.prototype.replace),Pt=ge.call(ke,String.prototype.slice),Jt=ge.call(ke,RegExp.prototype.exec),Lt=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,nt=/\\(\\)?/g,rt=function(ze){var B=Pt(ze,0,1),Q=Pt(ze,-1);if(B==="%"&&Q!=="%")throw new u("invalid intrinsic syntax, expected closing `%`");if(Q==="%"&&B!=="%")throw new u("invalid intrinsic syntax, expected opening `%`");var q=[];return mt(ze,Lt,function(J,ee,V,xe){q[q.length]=V?mt(xe,nt,"$1"):ee||J}),q},xt=function(ze,B){var Q=ze,q;if(qe(Se,Q)&&(q=Se[Q],Q="%"+q[0]+"%"),qe(ye,Q)){var J=ye[Q];if(J===te&&(J=Me(Q)),typeof J>"u"&&!B)throw new c("intrinsic "+ze+" exists, but is not available. Please file an issue!");return{alias:q,name:Q,value:J}}throw new u("intrinsic "+ze+" does not exist!")};return Zh=function(ze,B){if(typeof ze!="string"||ze.length===0)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof B!="boolean")throw new c('"allowMissing" argument must be a boolean');if(Jt(/^%?[^%]*%?$/,ze)===null)throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Q=rt(ze),q=Q.length>0?Q[0]:"",J=xt("%"+q+"%",B),ee=J.name,V=J.value,xe=!1,Ve=J.alias;Ve&&(q=Ve[0],je(Q,tt([0,1],Ve)));for(var $e=1,se=!0;$e<Q.length;$e+=1){var _e=Q[$e],He=Pt(_e,0,1),ht=Pt(_e,-1);if((He==='"'||He==="'"||He==="`"||ht==='"'||ht==="'"||ht==="`")&&He!==ht)throw new u("property names with quotes must have matching quotes");if((_e==="constructor"||!se)&&(xe=!0),q+="."+_e,ee="%"+q+"%",qe(ye,ee))V=ye[ee];else if(V!=null){if(!(_e in V)){if(!B)throw new c("base intrinsic for "+ze+" exists, but the property is not available.");return}if(T&&$e+1>=Q.length){var dt=T(V,_e);se=!!dt,se&&"get"in dt&&!("originalValue"in dt.get)?V=dt.get:V=V[_e]}else se=qe(V,_e),V=V[_e];se&&!xe&&(ye[ee]=V)}}return V},Zh}var ed,_b;function xb(){if(_b)return ed;_b=1;var r=Xh(),e=yb(),t=e([r("%String.prototype.indexOf%")]);return ed=function(i,a){var u=r(i,!!a);return typeof u=="function"&&t(i,".prototype.")>-1?e([u]):u},ed}var td,Sb;function Eb(){if(Sb)return td;Sb=1;var r=Xh(),e=xb(),t=ec(),n=da(),i=r("%Map%",!0),a=e("Map.prototype.get",!0),u=e("Map.prototype.set",!0),c=e("Map.prototype.has",!0),f=e("Map.prototype.delete",!0),h=e("Map.prototype.size",!0);return td=!!i&&function(){var y,g={assert:function(m){if(!g.has(m))throw new n("Side channel does not contain "+t(m))},delete:function(m){if(y){var b=f(y,m);return h(y)===0&&(y=void 0),b}return!1},get:function(m){if(y)return a(y,m)},has:function(m){return y?c(y,m):!1},set:function(m,b){y||(y=new i),u(y,m,b)}};return g},td}var rd,Ob;function sI(){if(Ob)return rd;Ob=1;var r=Xh(),e=xb(),t=ec(),n=Eb(),i=da(),a=r("%WeakMap%",!0),u=e("WeakMap.prototype.get",!0),c=e("WeakMap.prototype.set",!0),f=e("WeakMap.prototype.has",!0),h=e("WeakMap.prototype.delete",!0);return rd=a?function(){var y,g,m={assert:function(b){if(!m.has(b))throw new i("Side channel does not contain "+t(b))},delete:function(b){if(a&&b&&(typeof b=="object"||typeof b=="function")){if(y)return h(y,b)}else if(n&&g)return g.delete(b);return!1},get:function(b){return a&&b&&(typeof b=="object"||typeof b=="function")&&y?u(y,b):g&&g.get(b)},has:function(b){return a&&b&&(typeof b=="object"||typeof b=="function")&&y?f(y,b):!!g&&g.has(b)},set:function(b,I){a&&b&&(typeof b=="object"||typeof b=="function")?(y||(y=new a),c(y,b,I)):n&&(g||(g=n()),g.set(b,I))}};return m}:n,rd}var nd,Tb;function aI(){if(Tb)return nd;Tb=1;var r=da(),e=ec(),t=Mk(),n=Eb(),i=sI(),a=i||n||t;return nd=function(){var c,f={assert:function(h){if(!f.has(h))throw new r("Side channel does not contain "+e(h))},delete:function(h){return!!c&&c.delete(h)},get:function(h){return c&&c.get(h)},has:function(h){return!!c&&c.has(h)},set:function(h,d){c||(c=a()),c.set(h,d)}};return f},nd}var id,Ab;function sd(){if(Ab)return id;Ab=1;var r=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return id={default:t.RFC3986,formatters:{RFC1738:function(n){return r.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},id}var ad,kb;function Ib(){if(kb)return ad;kb=1;var r=sd(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n=function(){for(var S=[],_=0;_<256;++_)S.push("%"+((_<16?"0":"")+_.toString(16)).toUpperCase());return S}(),i=function(_){for(;_.length>1;){var T=_.pop(),P=T.obj[T.prop];if(t(P)){for(var M=[],U=0;U<P.length;++U)typeof P[U]<"u"&&M.push(P[U]);T.obj[T.prop]=M}}},a=function(_,T){for(var P=T&&T.plainObjects?Object.create(null):{},M=0;M<_.length;++M)typeof _[M]<"u"&&(P[M]=_[M]);return P},u=function S(_,T,P){if(!T)return _;if(typeof T!="object"){if(t(_))_.push(T);else if(_&&typeof _=="object")(P&&(P.plainObjects||P.allowPrototypes)||!e.call(Object.prototype,T))&&(_[T]=!0);else return[_,T];return _}if(!_||typeof _!="object")return[_].concat(T);var M=_;return t(_)&&!t(T)&&(M=a(_,P)),t(_)&&t(T)?(T.forEach(function(U,W){if(e.call(_,W)){var K=_[W];K&&typeof K=="object"&&U&&typeof U=="object"?_[W]=S(K,U,P):_.push(U)}else _[W]=U}),_):Object.keys(T).reduce(function(U,W){var K=T[W];return e.call(U,W)?U[W]=S(U[W],K,P):U[W]=K,U},M)},c=function(_,T){return Object.keys(T).reduce(function(P,M){return P[M]=T[M],P},_)},f=function(S,_,T){var P=S.replace(/\+/g," ");if(T==="iso-8859-1")return P.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(P)}catch{return P}},h=1024,d=function(_,T,P,M,U){if(_.length===0)return _;var W=_;if(typeof _=="symbol"?W=Symbol.prototype.toString.call(_):typeof _!="string"&&(W=String(_)),P==="iso-8859-1")return escape(W).replace(/%u[0-9a-f]{4}/gi,function(ve){return"%26%23"+parseInt(ve.slice(2),16)+"%3B"});for(var K="",X=0;X<W.length;X+=h){for(var fe=W.length>=h?W.slice(X,X+h):W,oe=[],ke=0;ke<fe.length;++ke){var te=fe.charCodeAt(ke);if(te===45||te===46||te===95||te===126||te>=48&&te<=57||te>=65&&te<=90||te>=97&&te<=122||U===r.RFC1738&&(te===40||te===41)){oe[oe.length]=fe.charAt(ke);continue}if(te<128){oe[oe.length]=n[te];continue}if(te<2048){oe[oe.length]=n[192|te>>6]+n[128|te&63];continue}if(te<55296||te>=57344){oe[oe.length]=n[224|te>>12]+n[128|te>>6&63]+n[128|te&63];continue}ke+=1,te=65536+((te&1023)<<10|fe.charCodeAt(ke)&1023),oe[oe.length]=n[240|te>>18]+n[128|te>>12&63]+n[128|te>>6&63]+n[128|te&63]}K+=oe.join("")}return K},y=function(_){for(var T=[{obj:{o:_},prop:"o"}],P=[],M=0;M<T.length;++M)for(var U=T[M],W=U.obj[U.prop],K=Object.keys(W),X=0;X<K.length;++X){var fe=K[X],oe=W[fe];typeof oe=="object"&&oe!==null&&P.indexOf(oe)===-1&&(T.push({obj:W,prop:fe}),P.push(oe))}return i(T),_},g=function(_){return Object.prototype.toString.call(_)==="[object RegExp]"},m=function(_){return!_||typeof _!="object"?!1:!!(_.constructor&&_.constructor.isBuffer&&_.constructor.isBuffer(_))},b=function(_,T){return[].concat(_,T)},I=function(_,T){if(t(_)){for(var P=[],M=0;M<_.length;M+=1)P.push(T(_[M]));return P}return T(_)};return ad={arrayToObject:a,assign:c,combine:b,compact:y,decode:f,encode:d,isBuffer:m,isRegExp:g,maybeMap:I,merge:u},ad}var od,Cb;function oI(){if(Cb)return od;Cb=1;var r=aI(),e=Ib(),t=sd(),n=Object.prototype.hasOwnProperty,i={brackets:function(S){return S+"[]"},comma:"comma",indices:function(S,_){return S+"["+_+"]"},repeat:function(S){return S}},a=Array.isArray,u=Array.prototype.push,c=function(I,S){u.apply(I,a(S)?S:[S])},f=Date.prototype.toISOString,h=t.default,d={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:e.encode,encodeValuesOnly:!1,format:h,formatter:t.formatters[h],indices:!1,serializeDate:function(S){return f.call(S)},skipNulls:!1,strictNullHandling:!1},y=function(S){return typeof S=="string"||typeof S=="number"||typeof S=="boolean"||typeof S=="symbol"||typeof S=="bigint"},g={},m=function I(S,_,T,P,M,U,W,K,X,fe,oe,ke,te,ve,ye,de,Me,Se){for(var ge=S,qe=Se,tt=0,je=!1;(qe=qe.get(g))!==void 0&&!je;){var mt=qe.get(S);if(tt+=1,typeof mt<"u"){if(mt===tt)throw new RangeError("Cyclic object value");je=!0}typeof qe.get(g)>"u"&&(tt=0)}if(typeof fe=="function"?ge=fe(_,ge):ge instanceof Date?ge=te(ge):T==="comma"&&a(ge)&&(ge=e.maybeMap(ge,function(ee){return ee instanceof Date?te(ee):ee})),ge===null){if(U)return X&&!de?X(_,d.encoder,Me,"key",ve):_;ge=""}if(y(ge)||e.isBuffer(ge)){if(X){var Pt=de?_:X(_,d.encoder,Me,"key",ve);return[ye(Pt)+"="+ye(X(ge,d.encoder,Me,"value",ve))]}return[ye(_)+"="+ye(String(ge))]}var Jt=[];if(typeof ge>"u")return Jt;var Lt;if(T==="comma"&&a(ge))de&&X&&(ge=e.maybeMap(ge,X)),Lt=[{value:ge.length>0?ge.join(",")||null:void 0}];else if(a(fe))Lt=fe;else{var nt=Object.keys(ge);Lt=oe?nt.sort(oe):nt}var rt=K?_.replace(/\./g,"%2E"):_,xt=P&&a(ge)&&ge.length===1?rt+"[]":rt;if(M&&a(ge)&&ge.length===0)return xt+"[]";for(var Ne=0;Ne<Lt.length;++Ne){var ze=Lt[Ne],B=typeof ze=="object"&&typeof ze.value<"u"?ze.value:ge[ze];if(!(W&&B===null)){var Q=ke&&K?ze.replace(/\./g,"%2E"):ze,q=a(ge)?typeof T=="function"?T(xt,Q):xt:xt+(ke?"."+Q:"["+Q+"]");Se.set(S,tt);var J=r();J.set(g,Se),c(Jt,I(B,q,T,P,M,U,W,K,T==="comma"&&de&&a(ge)?null:X,fe,oe,ke,te,ve,ye,de,Me,J))}}return Jt},b=function(S){if(!S)return d;if(typeof S.allowEmptyArrays<"u"&&typeof S.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof S.encodeDotInKeys<"u"&&typeof S.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(S.encoder!==null&&typeof S.encoder<"u"&&typeof S.encoder!="function")throw new TypeError("Encoder has to be a function.");var _=S.charset||d.charset;if(typeof S.charset<"u"&&S.charset!=="utf-8"&&S.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var T=t.default;if(typeof S.format<"u"){if(!n.call(t.formatters,S.format))throw new TypeError("Unknown format option provided.");T=S.format}var P=t.formatters[T],M=d.filter;(typeof S.filter=="function"||a(S.filter))&&(M=S.filter);var U;if(S.arrayFormat in i?U=S.arrayFormat:"indices"in S?U=S.indices?"indices":"repeat":U=d.arrayFormat,"commaRoundTrip"in S&&typeof S.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var W=typeof S.allowDots>"u"?S.encodeDotInKeys===!0?!0:d.allowDots:!!S.allowDots;return{addQueryPrefix:typeof S.addQueryPrefix=="boolean"?S.addQueryPrefix:d.addQueryPrefix,allowDots:W,allowEmptyArrays:typeof S.allowEmptyArrays=="boolean"?!!S.allowEmptyArrays:d.allowEmptyArrays,arrayFormat:U,charset:_,charsetSentinel:typeof S.charsetSentinel=="boolean"?S.charsetSentinel:d.charsetSentinel,commaRoundTrip:S.commaRoundTrip,delimiter:typeof S.delimiter>"u"?d.delimiter:S.delimiter,encode:typeof S.encode=="boolean"?S.encode:d.encode,encodeDotInKeys:typeof S.encodeDotInKeys=="boolean"?S.encodeDotInKeys:d.encodeDotInKeys,encoder:typeof S.encoder=="function"?S.encoder:d.encoder,encodeValuesOnly:typeof S.encodeValuesOnly=="boolean"?S.encodeValuesOnly:d.encodeValuesOnly,filter:M,format:T,formatter:P,serializeDate:typeof S.serializeDate=="function"?S.serializeDate:d.serializeDate,skipNulls:typeof S.skipNulls=="boolean"?S.skipNulls:d.skipNulls,sort:typeof S.sort=="function"?S.sort:null,strictNullHandling:typeof S.strictNullHandling=="boolean"?S.strictNullHandling:d.strictNullHandling}};return od=function(I,S){var _=I,T=b(S),P,M;typeof T.filter=="function"?(M=T.filter,_=M("",_)):a(T.filter)&&(M=T.filter,P=M);var U=[];if(typeof _!="object"||_===null)return"";var W=i[T.arrayFormat],K=W==="comma"&&T.commaRoundTrip;P||(P=Object.keys(_)),T.sort&&P.sort(T.sort);for(var X=r(),fe=0;fe<P.length;++fe){var oe=P[fe];T.skipNulls&&_[oe]===null||c(U,m(_[oe],oe,W,K,T.allowEmptyArrays,T.strictNullHandling,T.skipNulls,T.encodeDotInKeys,T.encode?T.encoder:null,T.filter,T.sort,T.allowDots,T.serializeDate,T.format,T.formatter,T.encodeValuesOnly,T.charset,X))}var ke=U.join(T.delimiter),te=T.addQueryPrefix===!0?"?":"";return T.charsetSentinel&&(T.charset==="iso-8859-1"?te+="utf8=%26%2310003%3B&":te+="utf8=%E2%9C%93&"),ke.length>0?te+ke:""},od}var ud,Pb;function uI(){if(Pb)return ud;Pb=1;var r=Ib(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:r.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},i=function(g){return g.replace(/&#(\d+);/g,function(m,b){return String.fromCharCode(parseInt(b,10))})},a=function(g,m){return g&&typeof g=="string"&&m.comma&&g.indexOf(",")>-1?g.split(","):g},u="utf8=%26%2310003%3B",c="utf8=%E2%9C%93",f=function(m,b){var I={__proto__:null},S=b.ignoreQueryPrefix?m.replace(/^\?/,""):m;S=S.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var _=b.parameterLimit===1/0?void 0:b.parameterLimit,T=S.split(b.delimiter,_),P=-1,M,U=b.charset;if(b.charsetSentinel)for(M=0;M<T.length;++M)T[M].indexOf("utf8=")===0&&(T[M]===c?U="utf-8":T[M]===u&&(U="iso-8859-1"),P=M,M=T.length);for(M=0;M<T.length;++M)if(M!==P){var W=T[M],K=W.indexOf("]="),X=K===-1?W.indexOf("="):K+1,fe,oe;X===-1?(fe=b.decoder(W,n.decoder,U,"key"),oe=b.strictNullHandling?null:""):(fe=b.decoder(W.slice(0,X),n.decoder,U,"key"),oe=r.maybeMap(a(W.slice(X+1),b),function(te){return b.decoder(te,n.decoder,U,"value")})),oe&&b.interpretNumericEntities&&U==="iso-8859-1"&&(oe=i(oe)),W.indexOf("[]=")>-1&&(oe=t(oe)?[oe]:oe);var ke=e.call(I,fe);ke&&b.duplicates==="combine"?I[fe]=r.combine(I[fe],oe):(!ke||b.duplicates==="last")&&(I[fe]=oe)}return I},h=function(g,m,b,I){for(var S=I?m:a(m,b),_=g.length-1;_>=0;--_){var T,P=g[_];if(P==="[]"&&b.parseArrays)T=b.allowEmptyArrays&&(S===""||b.strictNullHandling&&S===null)?[]:[].concat(S);else{T=b.plainObjects?Object.create(null):{};var M=P.charAt(0)==="["&&P.charAt(P.length-1)==="]"?P.slice(1,-1):P,U=b.decodeDotInKeys?M.replace(/%2E/g,"."):M,W=parseInt(U,10);!b.parseArrays&&U===""?T={0:S}:!isNaN(W)&&P!==U&&String(W)===U&&W>=0&&b.parseArrays&&W<=b.arrayLimit?(T=[],T[W]=S):U!=="__proto__"&&(T[U]=S)}S=T}return S},d=function(m,b,I,S){if(m){var _=I.allowDots?m.replace(/\.([^.[]+)/g,"[$1]"):m,T=/(\[[^[\]]*])/,P=/(\[[^[\]]*])/g,M=I.depth>0&&T.exec(_),U=M?_.slice(0,M.index):_,W=[];if(U){if(!I.plainObjects&&e.call(Object.prototype,U)&&!I.allowPrototypes)return;W.push(U)}for(var K=0;I.depth>0&&(M=P.exec(_))!==null&&K<I.depth;){if(K+=1,!I.plainObjects&&e.call(Object.prototype,M[1].slice(1,-1))&&!I.allowPrototypes)return;W.push(M[1])}if(M){if(I.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+I.depth+" and strictDepth is true");W.push("["+_.slice(M.index)+"]")}return h(W,b,I,S)}},y=function(m){if(!m)return n;if(typeof m.allowEmptyArrays<"u"&&typeof m.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof m.decodeDotInKeys<"u"&&typeof m.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(m.decoder!==null&&typeof m.decoder<"u"&&typeof m.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof m.charset<"u"&&m.charset!=="utf-8"&&m.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var b=typeof m.charset>"u"?n.charset:m.charset,I=typeof m.duplicates>"u"?n.duplicates:m.duplicates;if(I!=="combine"&&I!=="first"&&I!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var S=typeof m.allowDots>"u"?m.decodeDotInKeys===!0?!0:n.allowDots:!!m.allowDots;return{allowDots:S,allowEmptyArrays:typeof m.allowEmptyArrays=="boolean"?!!m.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof m.allowPrototypes=="boolean"?m.allowPrototypes:n.allowPrototypes,allowSparse:typeof m.allowSparse=="boolean"?m.allowSparse:n.allowSparse,arrayLimit:typeof m.arrayLimit=="number"?m.arrayLimit:n.arrayLimit,charset:b,charsetSentinel:typeof m.charsetSentinel=="boolean"?m.charsetSentinel:n.charsetSentinel,comma:typeof m.comma=="boolean"?m.comma:n.comma,decodeDotInKeys:typeof m.decodeDotInKeys=="boolean"?m.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof m.decoder=="function"?m.decoder:n.decoder,delimiter:typeof m.delimiter=="string"||r.isRegExp(m.delimiter)?m.delimiter:n.delimiter,depth:typeof m.depth=="number"||m.depth===!1?+m.depth:n.depth,duplicates:I,ignoreQueryPrefix:m.ignoreQueryPrefix===!0,interpretNumericEntities:typeof m.interpretNumericEntities=="boolean"?m.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof m.parameterLimit=="number"?m.parameterLimit:n.parameterLimit,parseArrays:m.parseArrays!==!1,plainObjects:typeof m.plainObjects=="boolean"?m.plainObjects:n.plainObjects,strictDepth:typeof m.strictDepth=="boolean"?!!m.strictDepth:n.strictDepth,strictNullHandling:typeof m.strictNullHandling=="boolean"?m.strictNullHandling:n.strictNullHandling}};return ud=function(g,m){var b=y(m);if(g===""||g===null||typeof g>"u")return b.plainObjects?Object.create(null):{};for(var I=typeof g=="string"?f(g,b):g,S=b.plainObjects?Object.create(null):{},_=Object.keys(I),T=0;T<_.length;++T){var P=_[T],M=d(P,I[P],b,typeof g=="string");S=r.merge(S,M,b)}return b.allowSparse===!0?S:r.compact(S)},ud}var cd,Nb;function cI(){if(Nb)return cd;Nb=1;var r=oI(),e=uI(),t=sd();return cd={formats:t,parse:e,stringify:r},cd}(function(r,e){(function(t,n){n(e,Pk,Nk,cI())})(pi,function(t,n,i,a){var u=function(B,Q,q,J){function ee(V){return V instanceof q?V:new q(function(xe){xe(V)})}return new(q||(q=Promise))(function(V,xe){function Ve(_e){try{se(J.next(_e))}catch(He){xe(He)}}function $e(_e){try{se(J.throw(_e))}catch(He){xe(He)}}function se(_e){_e.done?V(_e.value):ee(_e.value).then(Ve,$e)}se((J=J.apply(B,Q||[])).next())})},c=function(B,Q){var q={label:0,sent:function(){if(V[0]&1)throw V[1];return V[1]},trys:[],ops:[]},J,ee,V,xe;return xe={next:Ve(0),throw:Ve(1),return:Ve(2)},typeof Symbol=="function"&&(xe[Symbol.iterator]=function(){return this}),xe;function Ve(se){return function(_e){return $e([se,_e])}}function $e(se){if(J)throw new TypeError("Generator is already executing.");for(;q;)try{if(J=1,ee&&(V=se[0]&2?ee.return:se[0]?ee.throw||((V=ee.return)&&V.call(ee),0):ee.next)&&!(V=V.call(ee,se[1])).done)return V;switch(ee=0,V&&(se=[se[0]&2,V.value]),se[0]){case 0:case 1:V=se;break;case 4:return q.label++,{value:se[1],done:!1};case 5:q.label++,ee=se[1],se=[0];continue;case 7:se=q.ops.pop(),q.trys.pop();continue;default:if(V=q.trys,!(V=V.length>0&&V[V.length-1])&&(se[0]===6||se[0]===2)){q=0;continue}if(se[0]===3&&(!V||se[1]>V[0]&&se[1]<V[3])){q.label=se[1];break}if(se[0]===6&&q.label<V[1]){q.label=V[1],V=se;break}if(V&&q.label<V[2]){q.label=V[2],q.ops.push(se);break}V[2]&&q.ops.pop(),q.trys.pop();continue}se=Q.call(B,q)}catch(_e){se=[6,_e],ee=0}finally{J=V=0}if(se[0]&5)throw se[1];return{value:se[0]?se[1]:void 0,done:!0}}};function f(B,Q){if(B.directives&&B.directives.length){var q={};return B.directives.forEach(function(J){q[J.name.value]=i.argumentsObjectFromField(J,Q)}),q}return null}var h=Object.prototype.hasOwnProperty;function d(B,Q){Q!==null&&typeof Q=="object"&&Object.keys(Q).forEach(function(q){var J=Q[q];h.call(B,q)?d(B[q],J):B[q]=J})}function y(B,Q,q,J,ee,V){V===void 0&&(V={});var xe=i.getMainDefinition(Q),Ve=i.getFragmentDefinitions(Q),$e=i.createFragmentMap(Ve),se=V.resultMapper,_e=V.fragmentMatcher||function(){return!0},He={fragmentMap:$e,contextValue:J,variableValues:ee,resultMapper:se,resolver:B,fragmentMatcher:_e};return g(xe.selectionSet,q,He)}function g(B,Q,q){return u(this,void 0,void 0,function(){var J,ee,V,xe,Ve,$e=this;return c(this,function(se){switch(se.label){case 0:return J=q.fragmentMap,ee=q.contextValue,V=q.variableValues,xe={},Ve=function(_e){return u($e,void 0,void 0,function(){var He,ht,dt,Yt,St;return c(this,function(Vt){switch(Vt.label){case 0:return i.shouldInclude(_e,V)?i.isField(_e)?[4,m(_e,Q,q)]:[3,2]:[2];case 1:return He=Vt.sent(),ht=i.resultKeyNameFromField(_e),He!==void 0&&(xe[ht]===void 0?xe[ht]=He:d(xe[ht],He)),[2];case 2:if(i.isInlineFragment(_e))dt=_e;else if(dt=J[_e.name.value],!dt)throw new Error("No fragment named "+_e.name.value);return Yt=dt.typeCondition.name.value,q.fragmentMatcher(Q,Yt,ee)?[4,g(dt.selectionSet,Q,q)]:[3,4];case 3:St=Vt.sent(),d(xe,St),Vt.label=4;case 4:return[2]}})})},[4,Promise.all(B.selections.map(Ve))];case 1:return se.sent(),q.resultMapper?[2,q.resultMapper(xe,Q)]:[2,xe]}})})}function m(B,Q,q){return u(this,void 0,void 0,function(){var J,ee,V,xe,Ve,$e,se;return c(this,function(_e){switch(_e.label){case 0:return J=q.variableValues,ee=q.contextValue,V=q.resolver,xe=B.name.value,Ve=i.argumentsObjectFromField(B,J),$e={isLeaf:!B.selectionSet,resultKey:i.resultKeyNameFromField(B),directives:f(B,J),field:B},[4,V(xe,Q,Ve,ee,$e)];case 1:return se=_e.sent(),B.selectionSet?se==null?[2,se]:Array.isArray(se)?[2,b(B,se,q)]:[2,g(B.selectionSet,se,q)]:[2,se]}})})}function b(B,Q,q){return Promise.all(Q.map(function(J){return J===null?null:Array.isArray(J)?b(B,J,q):g(B.selectionSet,J,q)}))}var I=function(){var B=function(Q,q){return B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(J,ee){J.__proto__=ee}||function(J,ee){for(var V in ee)ee.hasOwnProperty(V)&&(J[V]=ee[V])},B(Q,q)};return function(Q,q){B(Q,q);function J(){this.constructor=Q}Q.prototype=q===null?Object.create(q):(J.prototype=q.prototype,new J)}}(),S=function(){return S=Object.assign||function(B){for(var Q,q=1,J=arguments.length;q<J;q++){Q=arguments[q];for(var ee in Q)Object.prototype.hasOwnProperty.call(Q,ee)&&(B[ee]=Q[ee])}return B},S.apply(this,arguments)},_=function(B,Q,q,J){function ee(V){return V instanceof q?V:new q(function(xe){xe(V)})}return new(q||(q=Promise))(function(V,xe){function Ve(_e){try{se(J.next(_e))}catch(He){xe(He)}}function $e(_e){try{se(J.throw(_e))}catch(He){xe(He)}}function se(_e){_e.done?V(_e.value):ee(_e.value).then(Ve,$e)}se((J=J.apply(B,Q||[])).next())})},T=function(B,Q){var q={label:0,sent:function(){if(V[0]&1)throw V[1];return V[1]},trys:[],ops:[]},J,ee,V,xe;return xe={next:Ve(0),throw:Ve(1),return:Ve(2)},typeof Symbol=="function"&&(xe[Symbol.iterator]=function(){return this}),xe;function Ve(se){return function(_e){return $e([se,_e])}}function $e(se){if(J)throw new TypeError("Generator is already executing.");for(;q;)try{if(J=1,ee&&(V=se[0]&2?ee.return:se[0]?ee.throw||((V=ee.return)&&V.call(ee),0):ee.next)&&!(V=V.call(ee,se[1])).done)return V;switch(ee=0,V&&(se=[se[0]&2,V.value]),se[0]){case 0:case 1:V=se;break;case 4:return q.label++,{value:se[1],done:!1};case 5:q.label++,ee=se[1],se=[0];continue;case 7:se=q.ops.pop(),q.trys.pop();continue;default:if(V=q.trys,!(V=V.length>0&&V[V.length-1])&&(se[0]===6||se[0]===2)){q=0;continue}if(se[0]===3&&(!V||se[1]>V[0]&&se[1]<V[3])){q.label=se[1];break}if(se[0]===6&&q.label<V[1]){q.label=V[1],V=se;break}if(V&&q.label<V[2]){q.label=V[2],q.ops.push(se);break}V[2]&&q.ops.pop(),q.trys.pop();continue}se=Q.call(B,q)}catch(_e){se=[6,_e],ee=0}finally{J=V=0}if(se[0]&5)throw se[1];return{value:se[0]?se[1]:void 0,done:!0}}},P=function(){for(var B=0,Q=0,q=arguments.length;Q<q;Q++)B+=arguments[Q].length;for(var J=Array(B),ee=0,Q=0;Q<q;Q++)for(var V=arguments[Q],xe=0,Ve=V.length;xe<Ve;xe++,ee++)J[ee]=V[xe];return J},M=function(B){var Q=B.replace(/\s/g,""),q=Q.replace(/\[(.*)\]/,function(J,ee,V,xe){return((ee!=null&&ee.length)>0?ee:null)||Q});return q},U=function(B,Q,q,J){if(Array.isArray(B)){var ee=M(Q);return B.map(function(V){return U(V,ee,q,J)})}return B==null||typeof B=="number"||typeof B=="boolean"||typeof B=="string"?B:q(B,Q,q,J)},W=function(B){return B.directives&&B.directives.length?B.directives.find(function(Q){return Q.name.value==="rest"}):null};function K(B,Q,q,J,ee){return ee==null||Q==null||typeof Q=="number"||typeof Q=="boolean"||typeof Q=="string"||ee.selections.forEach(function(V){if(i.isInlineFragment(V))K(B,Q,q,J,V.selectionSet);else if(V.kind==="FragmentSpread"){var xe=J[V.name.value];K(B,Q,q,J,xe.selectionSet)}else if(i.isField(V)){var Ve=i.resultKeyNameFromField(V);Ve===B&&W(V)!=null?X(Q,q,J,V.selectionSet):K(B,Q,q,J,V.selectionSet)}else return function($e){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()}),Q}function X(B,Q,q,J){if(!(B==null||typeof B=="number"||typeof B=="boolean"||typeof B=="string")){if(Array.isArray(B)){B.forEach(function(ee){return X(ee,Q,q,J)});return}J.selections.forEach(function(ee){if(i.isInlineFragment(ee))X(B,Q,q,ee.selectionSet);else if(ee.kind==="FragmentSpread"){var V=q[ee.name.value];X(B,Q,q,V.selectionSet)}else if(i.isField(ee)){var xe=B[ee.name.value];ee.name.value==="__typename"||(typeof xe>"u"?B[ee.name.value]=null:xe!=null&&typeof xe=="object"&&ee.selectionSet!=null&&X(xe,Q,q,ee.selectionSet))}else return function(Ve){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()})}}var fe=function(B,Q){var q=B[Q||nt]||B[nt];return typeof q=="string"?{uri:q}:S({responseTransformer:null},q)},oe=function(B,Q,q){return q===void 0||Q===void 0?B:B.replace(":"+Q,q)},ke=function(){function B(){}return B.replacerForPath=function(Q){if(Q in B.cache)return B.cache[Q];var q=Q.indexOf("?"),J=Q.split(B.argReplacement),ee=[],V=!1;J.reduce(function(Ve,$e){if($e===""||$e==="{}")return Ve+$e.length;var se=Ve+$e.length;if($e[0]==="{"&&$e[$e.length-1]==="}"){var _e=$e.slice(1,$e.length-1).split(".");ee.push(function(He,ht){try{var dt=te(He,_e);return!ht||typeof dt!="object"||dt==null?String(dt):a.stringify(dt)}catch{var Yt=[Q,_e.join(".")].join("|");return Yt in B.warnTable||(console.warn("Warning: RestLink caught an error while unpacking",Yt,"This tends to happen if you forgot to pass a parameter needed for creating an @rest(path, or if RestLink was configured to deeply unpack a path parameter that wasn't provided. This message will only log once per detected instance. Trouble-shooting hint: check @rest(path: and the variables provided to this query."),B.warnTable[Yt]=!0),""}})}else ee.push($e),!V&&se>=q&&(V=!0,ee.push(!0));return se},0);var xe=function(Ve){var $e=!1,se=ee.reduce(function(_e,He){return typeof He=="string"?_e+He:typeof He=="boolean"?($e=!0,_e):_e+He(Ve,$e)},"");return se};return B.cache[Q]=xe},B.cache={},B.warnTable={},B.argReplacement=/({[._a-zA-Z0-9]*})/,B}();function te(B,Q){if(Q.length===0)return B;var q=P(Q),J=q.shift();return te(B[J],q)}var ve=["__typename"],ye=typeof globalThis=="object"&&globalThis||pi,de=function(B,Q,q){q===void 0&&(q=[]);var J=null;return Q.length!=2?J=function(ee,V){return Q(ee)}:J=Q,Array.isArray(B)?B.map(function(ee,V){return de(ee,J,P(q,[String(V)]))}):B==null||typeof B!="object"||B.constructor!==Object||ye.FileList&&B instanceof FileList||ye.File&&B instanceof File?B:Object.keys(B).reduce(function(ee,V){var xe=B[V];if(ve.indexOf(V)!==-1)return ee[V]=xe,ee;var Ve=P(q,[V]);return ee[J(V,Ve)]=de(xe,J,Ve),ee},{})},Me=function(B){return B},Se=function(B){return B instanceof Headers?B:new Headers(B||{})},ge=function(){for(var B=[],Q=0;Q<arguments.length;Q++)B[Q]=arguments[Q];return B.reduce(function(q,J){return J&&(J.forEach||(J=Se(J)),J.forEach(function(ee,V){q.append(V,ee)})),q},new Headers)},qe=function(B,Q,q){var J=new Headers;return B.forEach(function(ee,V){Q.indexOf(V)===-1&&J.append(V,ee)}),ge(J,q||new Headers)},tt=function(B){return function(Q,q){return qe(Q,B,q)}},je=["GET","POST","PUT","PATCH","DELETE"],mt=function(B,Q){switch(Q){case"query":if(je.indexOf(B.toUpperCase())!==-1)return;throw new Error('A "query" operation can only support "GET" requests but got "'+B+'".');case"mutation":if(je.indexOf(B.toUpperCase())!==-1)return;throw new Error('"mutation" operations do not support that HTTP-verb');case"subscription":throw new Error('A "subscription" operation is not supported yet.');default:var q=Q;return q}},Pt=function(B,Q,q){var J=new Error(q);throw J.response=B,J.statusCode=B.status,J.result=Q,J},Jt=function(B,Q){return B==null||typeof B!="object"?B:Array.isArray(B)?B.map(function(q){return Jt(q,Q)}):(B.__typename=Q,B)},Lt=function(B,Q,q,J,ee){return _(void 0,void 0,void 0,function(){var V,xe,Ve,$e,se,_e,He,ht,dt,Yt,St,Vt,Ht,Er,Wt,sr,dr,Ar,zt,H,G,it,gt,ct,We,Kt,Zt,Gt,kr,Hr,Fr,jt,Or,$r,Lr,ar,Gr,Tr,gr,Ir,Sn,Un,R,ue,be,Ie,Be,ot,Qe,Ke;return T(this,function(Ze){switch(Ze.label){case 0:if(V=ee.directives,xe=ee.isLeaf,Ve=ee.resultKey,$e=J.exportVariablesByNode,se=$e.get(Q)||{},_e=function(yt){return yt instanceof Array?yt.forEach(_e):$e.set(yt,S({},se)),yt},He=(Q||{})[Ve],ht=(Q||{})[B],Q&&V&&V.export&&(se[V.export.as]=ht),dt=V&&V.type,!xe&&dt){if(V.rest)throw new Error("Invalid use of @type(name: ...) directive on a call that also has @rest(...)");return _e(ht),[2,Jt(ht,V.type.name)]}if(Yt=!V||!V.rest,Yt)return[2,_e(He||ht)];if(St=J.credentials,Vt=J.endpoints,Ht=J.headers,Er=J.customFetch,Wt=J.operationType,sr=J.typePatcher,dr=J.mainDefinition,Ar=J.fragmentDefinitions,zt=J.fieldNameNormalizer,H=J.fieldNameDenormalizer,G=J.serializers,it=J.responseTransformer,gt=i.createFragmentMap(Ar),ct=V.rest,We=ct.path,Kt=ct.endpoint,Zt=ct.pathBuilder,Gt=fe(Vt,Kt),kr=We==null&&Zt==null,kr)throw new Error('One of ("path" | "pathBuilder") must be set in the @rest() directive. This request had neither, please add one');if(Zt||(We.includes(":")?(console.warn("Deprecated: '@rest(path:' contains a ':' colon, this format will be removed in future versions"),Zt=function(yt){var w=yt.args,k=yt.exportVariables,A=S(S({},w),k),C=Object.keys(A).reduce(function(D,$){return oe(D,$,A[$])},We);if(C.includes(":"))throw new Error('Missing parameters to run query, specify it in the query params or use an export directive. (If you need to use ":" inside a variable string make sure to encode the variables properly using `encodeURIComponent`. Alternatively see documentation about using pathBuilder.)');return C}):Zt=ke.replacerForPath(We)),Hr={args:q,exportVariables:se,context:J,"@rest":V.rest,replacer:Zt},Fr=Zt(Hr),jt=V.rest,Or=jt.method,$r=jt.type,Lr=jt.bodyBuilder,ar=jt.bodyKey,Gr=jt.fieldNameDenormalizer,Tr=jt.fieldNameNormalizer,gr=jt.bodySerializer,Or||(Or="GET"),ar||(ar="input"),Ir=void 0,Sn=void 0,["GET","DELETE"].indexOf(Or)===-1){if(!Lr){if(Un=Hr.exportVariables[ar]||Hr.args&&Hr.args[ar],!Un)throw new Error("[GraphQL "+Or+" "+Wt+" using a REST call without a body]. No `"+ar+"` was detected. Pass bodyKey, or bodyBuilder to the @rest() directive to resolve this.");Lr=function(yt){return Un}}if(Ir=de(Lr(Hr),Gr||H||Me),R=void 0,typeof gr=="string"){if(!G.hasOwnProperty(gr))throw new Error('"bodySerializer" must correspond to configured serializer. '+("Please make sure to specify a serializer called "+gr+' in the "bodySerializers" property of the RestLink.'));R=G[gr](Ir,Ht)}else R=gr?gr(Ir,Ht):G[rt](Ir,Ht);Ir=R.body,Sn=new Headers(R.headers)}return mt(Or,Wt||"query"),ue=S({method:Or,headers:Sn||Ht,body:Ir},St?{credentials:St}:{}),be=""+Gt.uri+Fr,[4,(Er||fetch)(be,ue)];case 1:return Ie=Ze.sent(),J.responses.push(Ie),Ie.ok?(Ie.status===204||Ie.headers.get("Content-Length")==="0"?Be={}:Be=Ie,[3,9]):[3,2];case 2:return Ie.status!==404?[3,3]:(Be=null,[3,9]);case 3:ot=void 0,Ze.label=4;case 4:return Ze.trys.push([4,6,,8]),[4,Ie.clone().json()];case 5:return ot=Ze.sent(),[3,8];case 6:return Ze.sent(),[4,Ie.clone().text()];case 7:return ot=Ze.sent(),[3,8];case 8:Pt(Ie,ot,"Response not successful: Received status code "+Ie.status),Ze.label=9;case 9:if(Qe=Gt.responseTransformer||it,!Qe)return[3,14];Ze.label=10;case 10:return Ze.trys.push([10,12,,13]),[4,Qe(Be,$r)];case 11:return Be=Ze.sent(),[3,13];case 12:throw Ke=Ze.sent(),console.warn("An error occurred in a responseTransformer:"),Ke;case 13:return[3,16];case 14:return Be&&Be.json?[4,Be.json()]:[3,16];case 15:Be=Ze.sent(),Ze.label=16;case 16:return Be=de(Be,Tr||zt||Me),Be=K(Ve,Be,dr,gt,dr.selectionSet),Be=U(Be,$r,sr,{resolverParams:{fieldName:B,root:Q,args:q,context:J,info:ee}}),[2,_e(Be)]}})})},nt="",rt="",xt=function(B,Q){return Q.has("content-type")||Q.append("Content-Type","application/json"),{body:JSON.stringify(B),headers:Q}},Ne={test:function(B){return B.name.value==="rest"},remove:!0},ze=function(B){I(Q,B);function Q(q){var J,ee=q.uri,V=q.endpoints,xe=q.headers,Ve=q.fieldNameNormalizer,$e=q.fieldNameDenormalizer,se=q.typePatcher,_e=q.customFetch,He=q.credentials,ht=q.bodySerializers,dt=q.defaultSerializer,Yt=q.responseTransformer,St=B.call(this)||this,Vt={};if(Vt[nt]=ee||"",St.endpoints=Object.assign({},V||Vt),ee==null&&V==null)throw new Error("A RestLink must be initialized with either 1 uri, or a map of keyed-endpoints");if(ee!=null){var Ht=(V||{})[nt];if(Ht!=null&&Ht!=ee)throw new Error("RestLink was configured with a default uri that doesn't match what's passed in to the endpoints map.");St.endpoints[nt]=ee}if(St.endpoints[nt]==null&&console.warn("RestLink configured without a default URI. All @rest(…) directives must provide an endpoint key!"),se==null)St.typePatcher=function(Wt,sr,dr){return S({__typename:sr},Wt)};else if(!Array.isArray(se)&&typeof se=="object"&&Object.keys(se).map(function(Wt){return se[Wt]}).reduce(function(Wt,sr){return Wt&&typeof sr=="function"},!0)){var Er=se;St.typePatcher=function(Wt,sr,dr,Ar){var zt=Wt.__typename||sr;if(Array.isArray(Wt))return Wt.map(function(G){return dr(G,zt,dr,Ar)});var H=Er[zt]||function(G){return G};return S({__typename:zt},H(Wt,zt,dr,Ar))}}else throw new Error("RestLink was configured with a typePatcher of invalid type!");return ht&&ht.hasOwnProperty(rt)&&console.warn("RestLink was configured to override the default serializer! This may result in unexpected behavior"),St.responseTransformer=Yt||null,St.fieldNameNormalizer=Ve||null,St.fieldNameDenormalizer=$e||null,St.headers=Se(xe),St.credentials=He||null,St.customFetch=_e,St.serializers=S((J={},J[rt]=dt||xt,J),ht||{}),St.processedDocuments=new Map,St}return Q.prototype.removeRestSetsFromDocument=function(q){var J=this.processedDocuments.get(q);if(J)return J;i.checkDocument(q);var ee=i.removeDirectivesFromDocument([Ne],q);return this.processedDocuments.set(q,ee),ee},Q.prototype.request=function(q,J){var ee=q.query,V=q.variables,xe=q.getContext,Ve=q.setContext,$e=xe(),se=i.hasDirectives(["rest"],ee);if(!se)return J(q);var _e=this.removeRestSetsFromDocument(ee),He=$e.headersMergePolicy;He==null&&Array.isArray($e.headersToOverride)?He=tt($e.headersToOverride):He==null&&(He=ge);var ht=He(this.headers,$e.headers);ht.has("Accept")||ht.append("Accept","application/json");var dt=$e.credentials||this.credentials,Yt=i.addTypenameToDocument(ee),St=i.getMainDefinition(ee),Vt=i.getFragmentDefinitions(ee),Ht=(St||{}).operation||"query",Er={headers:ht,endpoints:this.endpoints,exportVariablesByNode:new Map,credentials:dt,customFetch:this.customFetch,operationType:Ht,fieldNameNormalizer:this.fieldNameNormalizer,fieldNameDenormalizer:this.fieldNameDenormalizer,mainDefinition:St,fragmentDefinitions:Vt,typePatcher:this.typePatcher,serializers:this.serializers,responses:[],responseTransformer:this.responseTransformer},Wt={},sr;return _e&&J?(q.query=_e,sr=J(q)):sr=n.Observable.of({data:{}}),sr.flatMap(function(dr){var Ar=dr.data,zt=dr.errors;return new n.Observable(function(H){y(Lt,Yt,Ar,Er,V,Wt).then(function(G){Ve({restResponses:($e.restResponses||[]).concat(Er.responses)}),H.next({data:G,errors:zt}),H.complete()}).catch(function(G){G.name!=="AbortError"&&(G.result&&G.result.errors&&H.next(G.result),H.error(G))})})})},Q}(n.ApolloLink);t.RestLink=ze,t.PathBuilder=ke,Object.defineProperty(t,"__esModule",{value:!0})})})(mh,mh.exports);var lI=mh.exports;const rc=me.createContext(),fI=()=>{const{isAuthenticated:r,login:e}=ti(),{children:t,isEmbedded:n,setIsEmbedded:i,authError:a}=me.useContext(rc),u=pn.useNavigate(),c=pn.useLocation(),[f,h]=me.useState(!1),[d,y]=me.useState(),[g,m]=me.useState(),[b,I]=me.useState({}),[S,_]=me.useState({}),[T,P]=me.useState({}),[M,U]=me.useState(!1);me.useEffect(()=>{var te;if(!(!c||c.pathname!=="/mm-embedded-login")){if(r||a)if(((te=new URL(origin))==null?void 0:te.protocol)==="http:"){window.close();return}else{const ye=new URLSearchParams(c.search),de=ye.get("id"),Me=ye.get("origin");a?window.parent.postMessage({type:"authorize-failed",instanceId:de,error:a,authUrl:window.location.href},Me):window.parent.postMessage({type:"authorized",instanceId:de,authUrl:window.location.href},Me);return}r===!1&&e()}},[c]),me.useEffect(()=>{var de,Me;if(r===null||!c||c.pathname!=="/mm-embedded-interop")return;const te=new URLSearchParams(c.search),ve=te.get("id"),ye=te.get("origin");if(ye){const Se=(de=new URL(ye))==null?void 0:de.hostname;if(/^(?:[\w-]+\.)*(?:machinemetrics\.com|machinemetrics-us-gov\.com|m12s\.com)$/.test(Se))y(ye);else{alert("Invalid Embeddable Zone Host");return}}if(r===!1){if(ye){const Se={instanceId:ve,authUrl:`${window.location.protocol}//${window.location.host}/mm-embedded-login?id=${ve}&origin=${ye}`,origin:ye};if(((Me=new URL(ye))==null?void 0:Me.protocol)==="http:"){window.parent.postMessage({type:"login",...Se},ye);return}e({mm_instanceId:Se.instanceId,mm_authUrl:encodeURIComponent(Se.authUrl),mm_origin:Se.origin});return}e();return}ve&&m(ve),ve&&ye&&i(!0)},[c,r]),pn.useBlocker(({nextLocation:te})=>{var ve;return n?(ve=te.state)!=null&&ve.fromParent?(h(!0),!1):(W(`${te.pathname}${te.search}`),!0):!1}),me.useEffect(()=>{if(!n||!d)return;const te=ve=>{ve.metaKey&&ve.key==="k"&&window.parent.postMessage({type:"open-search",instanceId:g},d)};return window.addEventListener("keydown",te),()=>{window.removeEventListener("keydown",te)}},[n,d]),me.useEffect(()=>{if(!n||!d)return;const te=({origin:ve,data:ye})=>{var de,Me;if(ve===d)switch(ye.type){case"navigate":u(ye.path,{replace:!0,state:{fromParent:!0}});break;case"set-context":I(ye.context||{});break;case"set-configuring":U(ye.isConfiguring);break;case"load-options":(de=S[ye.name])==null||de.call(S,{filter:ye.filter});break;case"validate":(Me=T[ye.name])==null||Me.call(T,{value:ye.value});break}};return window.addEventListener("message",te),!f&&r&&window.parent.postMessage({type:"ready",instanceId:g},d),()=>{window.removeEventListener("message",te)}},[u,f,n,r,d,S,T]);const W=(te,ve)=>{!f&&!r||window.parent.postMessage({type:"set-path",instanceId:g,path:te,...ve},d)},K=te=>{f&&window.parent.postMessage({type:"set-summary",instanceId:g,summary:te},d)},X=te=>{f&&window.parent.postMessage({type:"toast",instanceId:g,message:te},d)},fe=te=>{f&&window.parent.postMessage({type:"popup",instanceId:g,message:te},d)},oe=async(te,ve)=>{f&&(ve.validate&&typeof ve.validate=="function"&&P(ye=>{const de=async Me=>{const Se=await ve.validate(Me);window.parent.postMessage({type:"set-validation",instanceId:g,name:te,validation:Se},d)};return ye[te]&&de({value:""}),{...ye,[te]:de}}),ve.options&&_(ye=>{const de=async Me=>{const ge=await(typeof ve.options=="function"?ve.options:()=>ve.options)(Me);window.parent.postMessage({type:"set-options",instanceId:g,name:te,options:ge},d)};return ye[te]&&de({filter:""}),{...ye,[te]:de}}),window.parent.postMessage({type:"add-setting",instanceId:g,setting:{name:te,...ve,options:void 0,validate:void 0}},d))},ke=me.useMemo(()=>({isEmbedded:n,isConfiguring:M,navigateParent:W,setSummary:K,toast:X,popup:fe,context:b,addSetting:oe}),[n,M,W,K,X,fe,b,oe]);return nr.jsx(fa.Provider,{value:ke,children:c.pathname!=="/mm-embedded-interop"&&c.pathname!=="/mm-embedded-login"?t:nr.jsx(nr.Fragment,{})})},hI=()=>{const{urls:r,jwtRef:e,accessToken:t}=ti(),{graphQLRoleOverride:n,children:i}=me.useContext(rc),[a,u]=me.useState(),[c,f]=me.useState(),h=()=>{const g=new URL(r.graphQLUrl);return`//${g.host}${g.pathname}`},d=()=>n?{"X-Hasura-Role":n}:{};me.useEffect(()=>{const g=new Sk(kk({url:`wss:${h()}`,lazy:!0,reconnect:!0,connectionParams:async()=>({headers:{Authorization:`Bearer ${e.current}`,...d()}})})),m=N0(({operation:P,networkError:M,forward:U})=>(Bi(P.query).operation==="subscription"&&M&&g.client.terminate(),U(P))),I=P0(async(P,{headers:M})=>({headers:{...M,Authorization:`Bearer ${e.current}`,...d()}})).concat(uf({uri:`https:${h()}`,fetch:window.fetch})),S=m.split(({query:P})=>{const M=Bi(P);return M.kind==="OperationDefinition"&&M.operation==="subscription"},g,I),T=P0(async(P,{headers:M})=>({headers:{...M,Authorization:`Bearer ${t}`}})).concat(new lI.RestLink({uri:r.apiUrl}));f(Kr.from([T,S]))},[]),me.useEffect(()=>{c&&u(new Cf({link:c,cache:new Of}))},[c]);const y=me.useMemo(()=>({link:c}),[c]);return nr.jsx(u0.Provider,{value:y,children:a?nr.jsx(S1,{client:a,children:nr.jsx(BA,{children:nr.jsx(fI,{children:i})})}):nr.jsx(nr.Fragment,{})})},dI=Qp.div`
132
132
  text-align: center;
133
133
  padding-top: 200px;
134
- `,Rb=({loadError:r})=>{const e=bk();return r&&!e||e.indexOf("mm-embedded-login")===-1?nr.jsx(dI,{children:r}):(O0(),nr.jsx(pn.Navigate,{replace:!0,to:e||"/"}))};Qp.div`
134
+ `,Rb=({loadError:r})=>{const e=bk();return r&&(!e||e.indexOf("mm-embedded-login")===-1)?nr.jsx(dI,{children:r}):(O0(),nr.jsx(pn.Navigate,{replace:!0,to:e||"/"}))};Qp.div`
135
135
  font-size: 20px;
136
136
  text-align: center;
137
137
  margin-top: 300px;
@@ -162,4 +162,4 @@ ${f}`),y(b);return}c(null,I),n.strategy===ri.Count&&(h--,h===0&&y()),n.strategy=
162
162
 
163
163
  ${c.stack}`),f.unsubscribe(),u.reject(h)):(h=Vb(d),h?(c&&(h.stack+=`
164
164
 
165
- ${c.stack}`),u.reject(h)):u.resolve(d))}});return f.requestSubject=e,this.protocol.publish(e,t,{reply:a,headers:n.headers}),u}else{const a=new Xb(this.protocol.muxSubscriptions,e,n,i);this.protocol.request(a);try{this.publish(e,t,{reply:`${this.protocol.muxSubscriptions.baseInbox}${a.token}`,headers:n.headers})}catch(c){a.cancel(c)}const u=Promise.race([a.timer,a.deferred]);return u.catch(()=>{a.cancel()}),u}}flush(){return this.isClosed()?Promise.reject(Ce.errorForCode(we.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Ce.errorForCode(we.ConnectionClosed)):this.isDraining()?Promise.reject(Ce.errorForCode(we.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const e=this.protocol.getServer();return e?e.listen:""}status(){const e=new Mr;return e.iterClosed.then(()=>{const t=this.listeners.indexOf(e);this.listeners.splice(t,1)}),this.listeners.push(e),e}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((t,n)=>t==="time"?new Date(Date.parse(n)):n)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(e={}){const t=new lP(this,e);if(e.checkAPI!==!1)try{await t.getAccountInfo()}catch(n){const i=n;throw i.code===we.NoResponders&&(i.code=we.JetStreamNotEnabled),i}return t}jetstream(e={}){return new Fd(this,e)}getServerVersion(){const e=this.info;return e?Cs(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Ce.errorForCode(we.Disconnect);const e=Date.now();return await this.flush(),Date.now()-e}get features(){return this.protocol.features}get services(){return this._services||(this._services=new pP(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Ce.errorForCode(we.ConnectionClosed)):this.isDraining()?Promise.reject(Ce.errorForCode(we.ConnectionDraining)):this.protocol.reconnect()}}class pP{constructor(e){E(this,"nc");this.nc=e}add(e){try{return new No(this.nc,e).start()}catch(t){return Promise.reject(t)}}client(e,t){return new GC(this.nc,e,t)}}class mP{constructor(e,t,n){E(this,"bucket");E(this,"sm");E(this,"prefixLen");this.bucket=e,this.prefixLen=t,this.sm=n}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(gc)||"PUT"}get length(){const e=this.sm.header.get(en.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class yP{constructor(e,t,n){E(this,"bucket");E(this,"key");E(this,"sm");this.bucket=e,this.key=t,this.sm=n}get value(){return this.sm.data}get created(){return new Date(hd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var e;return((e=this.sm.headers)==null?void 0:e.get(gc))||"PUT"}get delta(){return this.sm.info.pending}get length(){var t;const e=((t=this.sm.headers)==null?void 0:t.get(en.MessageSizeHdr))||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Ew extends zI{constructor(t,n,i){super(t.nc,n,i);E(this,"js");E(this,"monitor");this.js=t,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(t){this.sub.info=t}get info(){return this.sub.info}_resetOrderedConsumer(t){if(this.info===null||this.sub.isClosed())return;const n=Ei(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,n);const a=this.info;a.config.name=Is.next(),a.ordered_consumer_sequence.delivery_seq=0,a.flow_control.heartbeat_count=0,a.flow_control.fc_count=0,a.flow_control.consumer_restarts++,a.deliver=n,a.config.deliver_subject=n,a.config.deliver_policy=yr.StartSequence,a.config.opt_start_seq=t;const u={};u.stream_name=this.info.stream,u.config=a.config;const c=`${a.api.prefix}.CONSUMER.CREATE.${a.stream}`;this.js._request(c,u,{retries:-1}).then(f=>{const h=f,d=this.sub.info;d.last=h,this.info.config=h.config,this.info.name=h.name}).catch(f=>{const h=new Ce(`unable to recreate ordered consumer ${a.stream} at seq ${t}`,we.RequestError,f);this.sub.callback(h,{})})}_maybeSetupHbMonitoring(){var n,i;const t=((i=(n=this.info)==null?void 0:n.config)==null?void 0:i.idle_heartbeat)||0;t&&this._setupHbMonitoring(hd(t))}_setupHbMonitoring(t,n=0){const i={cancelAfter:0,maxOut:2};n&&(i.cancelAfter=n);const a=this.sub,u=c=>{var d,y,g,m;const f=AI(409,`${qn.IdleHeartbeatMissed}: ${c}`,this.sub.subject);if(!((d=this.info)==null?void 0:d.ordered))this.sub.callback(null,f);else{if(!this.js.nc.protocol.connected)return!1;const b=((g=(y=this.info)==null?void 0:y.ordered_consumer_sequence)==null?void 0:g.stream_seq)||0;return this._resetOrderedConsumer(b+1),(m=this.monitor)==null||m.restart(),!1}return!a.noIterator};this.monitor=new gd(t,u,i)}_checkHbOrderConsumer(t){const n=t.headers.get(en.ConsumerStalledHdr);n!==""&&this.js.nc.publish(n);const i=parseInt(t.headers.get(en.LastConsumerSeqHdr),10),a=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,i!==a.delivery_seq&&this._resetOrderedConsumer(a.stream_seq+1),!1}_checkOrderedConsumer(t){const n=this.info.ordered_consumer_sequence,i=t.info.streamSequence,a=t.info.deliverySequence;return a!=n.delivery_seq+1?(this._resetOrderedConsumer(n.stream_seq+1),!1):(n.delivery_seq=a,n.stream_seq=i,!0)}async destroy(){this.isClosed()||await this.drain();const t=this.sub.info,n=t.config.durable_name||t.name,i=`${t.api.prefix}.CONSUMER.DELETE.${t.stream}.${n}`;await t.api._request(i)}async consumerInfo(){const t=this.sub.info,n=t.config.durable_name||t.name,i=`${t.api.prefix}.CONSUMER.INFO.${t.stream}.${n}`,a=await t.api._request(i);return t.last=a,a}}class gP extends Ew{constructor(e,t,n){super(e,t,n)}pull(e={batch:1}){const{stream:t,config:n,name:i}=this.sub.info,a=n.durable_name??i,u={};if(u.batch=e.batch||1,u.no_wait=e.no_wait||!1,(e.max_bytes??0)>0){const h=this.js.nc.features.get(kt.JS_PULL_MAX_BYTES);if(!h.ok)throw new Error(`max_bytes is only supported on servers ${h.min} or better`);u.max_bytes=e.max_bytes}let c=0;e.expires&&e.expires>0&&(c=e.expires,u.expires=cr(c));let f=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(f=e.idle_heartbeat,u.idle_heartbeat=cr(f)),f&&c===0)throw new Error("idle_heartbeat requires expires");if(f>c)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),c&&f&&(this.monitor?this.monitor._change(f,c):this._setupHbMonitoring(f,c));const h=this.info.api,d=`${h.prefix}.CONSUMER.MSG.NEXT.${t}.${a}`,y=this.sub.subject;h.nc.publish(d,h.jc.encode(u),{reply:y})}}}function vP(r,e){return r?wP(e):bP(e)}function bP(r){return(e,t)=>e?[e,null]:(e=va(t),e?[e,null]:[null,Do(t,r)])}function wP(r){return(e,t)=>{if(e)return[e,null];const n=va(t);return n!==null?[Ow(n),null]:[null,Do(t,r)]}}function Ow(r){if(r!==null)switch(r.code){case we.JetStream404NoMessages:case we.JetStream408RequestTimeout:return null;case we.JetStream409:return kI(r)?r:null;default:return r}return null}function _P(r){r&&r.ack()}function xP(r){const e=r.split(".");if(e.length===9&&e.splice(2,0,"_",""),e.length<11||e[0]!=="$JS"||e[1]!=="ACK")throw new Error("not js message");const t={};return t.domain=e[2]==="_"?"":e[2],t.account_hash=e[3],t.stream=e[4],t.consumer=e[5],t.redeliveryCount=parseInt(e[6],10),t.redelivered=t.redeliveryCount>1,t.streamSequence=parseInt(e[7],10),t.deliverySequence=parseInt(e[8],10),t.timestampNanos=parseInt(e[9],10),t.pending=parseInt(e[10],10),t}class SP{constructor(e,t){E(this,"msg");E(this,"di");E(this,"didAck");E(this,"timeout");this.msg=e,this.didAck=!1,this.timeout=t}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=xP(this.reply)),this.di}get redelivered(){return this.info.redeliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(e){this.didAck||(this.didAck=!this.isWIP(e),this.msg.respond(e))}isWIP(e){return e.length===4&&e[0]===Mo[0]&&e[1]===Mo[1]&&e[2]===Mo[2]&&e[3]===Mo[3]}async ackAck(e){var n;e=e||{},e.timeout=e.timeout||this.timeout;const t=ir();if(this.didAck)t.resolve(!1);else if(this.didAck=!0,this.msg.reply){const a=this.msg.publisher,u=!((n=a.options)!=null&&n.noAsyncTraces),c=new Xb(a.muxSubscriptions,this.msg.reply,{timeout:e.timeout},u);a.request(c);try{a.publish(this.msg.reply,bw,{reply:`${a.muxSubscriptions.baseInbox}${c.token}`})}catch(f){c.cancel(f)}try{await Promise.race([c.timer,c.deferred]),t.resolve(!0)}catch(f){c.cancel(f),t.reject(f)}}else t.resolve(!1);return t}ack(){this.doAck(bw)}nak(e){let t=nP;e&&(t=Bb().encode(`-NAK ${JSON.stringify({delay:cr(e)})}`)),this.doAck(t)}working(){this.doAck(Mo)}next(e,t={batch:1}){const n={};n.batch=t.batch||1,n.no_wait=t.no_wait||!1,t.expires&&t.expires>0&&(n.expires=cr(t.expires));const i=Ln().encode(n),a=_a.concat(iP,aP,i),u=e?{reply:e}:void 0;this.msg.respond(a,u)}term(e=""){let t=sP;(e==null?void 0:e.length)>0&&(t=Bb().encode(`+TERM ${e}`)),this.doAck(t)}json(){return this.msg.json()}string(){return this.msg.string()}}const EP="1.29.2",OP="nats.ws";class TP{constructor(){E(this,"version");E(this,"lang");E(this,"closeError");E(this,"connected");E(this,"done");E(this,"socket");E(this,"options");E(this,"socketClosed");E(this,"encrypted");E(this,"peeked");E(this,"yields");E(this,"signal");E(this,"closedNotification");this.version=EP,this.lang=OP,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=ir(),this.closedNotification=ir()}async connect(e,t){const n=ir();if(t.tls)return n.reject(new Ce("tls",we.InvalidOption)),n;this.options=t;const i=e.src;if(t.wsFactory){const{socket:a,encrypted:u}=await t.wsFactory(e.src,t);this.socket=a,this.encrypted=u}else this.encrypted=i.indexOf("wss://")===0,this.socket=new WebSocket(i);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=a=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(a.data)),this.peeked){this.signal.resolve();return}const u=_a.concat(...this.yields),c=KI(u);if(c!==""){const f=jC.exec(c);if(!f){t.debug&&console.error("!!!",oc(u)),n.reject(new Error("unexpected response from server"));return}try{const h=JSON.parse(f[1]);LC(h,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),n.resolve()}catch(h){n.reject(h);return}}},this.socket.onclose=a=>{if(this.isDiscarded())return;this.socketClosed=!0;let u;this.done||(a.wasClean||(u=new Error(a.reason)),this._closed(u))},this.socket.onerror=a=>{if(this.isDiscarded())return;const u=a,c=new Ce(u.message,we.Unknown,new Error(u.error));n.reject(c)},n}disconnect(){this._closed(void 0,!0)}async _closed(e,t=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=e,!e)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ya(100);this.done=!0;try{this.socket.close(e?1002:1e3,e?e.message:void 0)}catch{}t&&this.closedNotification.resolve(e)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const e=this.yields;this.yields=[];for(let t=0;t<e.length;t++)this.options.debug&&console.info(`> ${oc(e[t])}`),yield e[t];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=ir())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${oc(e)}`);return}catch(t){this.options.debug&&console.error(`!!! ${oc(e)}: ${t}`)}}close(e){return this._closed(e,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var e;this.done=!0;try{(e=this.socket)==null||e.close()}catch{}}}function AP(r,e){/^(.*:\/\/)(.*)/.test(r)||(typeof e=="boolean"?r=`${e===!0?"https":"http"}://${r}`:r=`https://${r}`);let n=new URL(r);const i=n.protocol.toLowerCase();i==="ws:"&&(e=!1),i==="wss:"&&(e=!0),i!=="https:"&&i!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),n=new URL(`http://${r}`));let a,u;const c=n.hostname,f=n.pathname,h=n.search||"";switch(i){case"http:":case"ws:":case"nats:":u=n.port||"80",a="ws:";break;case"https:":case"wss:":case"tls:":u=n.port||"443",a="wss:";break;default:u=n.port||e===!0?"443":"80",a=e===!0?"wss:":"ws:";break}return`${a}//${c}:${u}${f}${h}`}function kP(r={}){return HI({defaultPort:443,urlParseFn:AP,factory:()=>new TP}),Ld.connect(r)}const Tw=["new","last","last_per_subject"],IP=async(r,e)=>(console.info(`Connecting to server ${r}`),await kP({servers:[r],authenticator:NC(new TextEncoder().encode(e))}));async function*CP(r){const e=Ln();for await(const t of r)try{yield e.decode(t.data)}catch(n){console.warn(`Skipping event: ${n}`)}}const Aw=(r,e)=>{r.current&&(r.current=void 0),e.current&&(e.current.close(),e.current=void 0)},kw={scada:"mm.0.[location-ref].[machine-ref].[qualifier].[data-category].[metric-key].[message-type]","machine-service":"mm.2.[location-ref].[machine-ref].[service-name].[qualifier].[data-category].[metric-key].[message-type]","edge-service":"mm.3.[location-ref].[edge-ref].[service-name].[data-category].[metric-key].[message-type]","machine-source-service":"mm.4.[location-ref].[machine-ref].[machine-source-ref].[service-name].[data-category].[metric-key].[message-type]",edge:"mm.7.[location-ref].[edge-ref].[data-category].[metric-key].[message-type]"},PP={undefined:0,event:1,eventset:2,quantity:3,state:4,count:5,info:6,beat:7},NP=(r,e,t)=>{if(!kw[r])throw new Error("Unknown stream name");const n=kw[r].split(".");let i="";return n.forEach((a,u)=>{switch(a){case"[location-ref]":i+="."+e;break;case"[machine-ref]":i+="."+((t==null?void 0:t.machineRef)||"*");break;case"[qualifier]":i+="."+((t==null?void 0:t.qualifier)||"0");break;case"[data-category]":i+="."+(PP[t==null?void 0:t.dataCategory]||"*");break;case"[metric-key]":i+="."+(t!=null&&t.metricKey?t==null?void 0:t.metricKey.toLowerCase().replace(/[^a-zA-Z0-9_\\-]/gi,"-"):"*");break;case"[message-type]":i+="."+((t==null?void 0:t.messageType)||"0");break;case"[edge-ref]":i+="."+((t==null?void 0:t.edgeRef)||"*");break;case"[service-name]":i+="."+((t==null?void 0:t.serviceName)||"*");break;case"[machine-source-ref]":i+="."+((t==null?void 0:t.machineSourceRef)||"*");break;default:u>0&&(i+="."),i+=a;break}}),i},RP=r=>{const{streamName:e,locationRef:t,filters:n,deliverPolicy:i="new",dispatch:a}=r;if(!Tw.includes(i))throw new Error(`Invalid deliverPolicy "${i}" specified. Valid options are: ${Tw.join(", ")}`);n&&n.length>1&&console.warn("Multiple filters are not supported. Only the first filter will be used.");const{urls:u,natsCredsRef:c}=ti(),f=me.useRef(),h=me.useRef();return me.useEffect(()=>!u.natsUrl||!c.current||!e||!t?void 0:((async()=>{try{const y=await IP(u.natsUrl,c.current);f.current=y;const g=NP(e,t,n==null?void 0:n[0]);console.info(`Consuming events from stream ${e} filtering by subject ${g}`);const b=await(await y.jetstream().consumers.get(e,{deliver_policy:i,filterSubjects:g})).consume({max_messages:1e3}),I=CP(b);if(h.current=I,typeof a=="function")for await(const S of I)a(S)}catch(y){console.error(`Error setting up event stream. ${y}`)}})(),()=>Aw(h,f)),[e,t,i,u.natsUrl,c]),[h.current,()=>Aw(h,f)]},MP=me.forwardRef(({href:r,asFlyout:e,flyoutTitle:t,children:n,...i},a)=>{const{isEmbedded:u,navigateParent:c}=me.useContext(fa);return nr.jsx("a",{...i,ref:a,href:r,onClick:f=>{!u||f.metaKey||f.ctrlKey||f.shiftKey||(f.preventDefault(),f.stopPropagation(),c(r,{asFlyout:e,flyoutTitle:t}))},children:n})});Ot.Link=MP,Ot.MMProvider=yI,Ot.PrivateLayout=tk,Ot._useMMApolloLinkContext=ek,Ot.useApiRequest=f0,Ot.useAsyncEffect=bo,Ot.useAsyncInterval=wo,Ot.useDowntimeQuery=GA,Ot.useEventStream=RP,Ot.useMMAppContext=ZA,Ot.useMMAppSetting=XA,Ot.useMMAppTools=KA,Ot.useMMAuth=ti,Ot.useMMEmbeddedApp=YA,Ot.useMMHash=JA,Ot.useMMTemplates=QA,Ot.useProductionQuery=zA,Ot.useQuantityStream=HA,Ot.useSearchParamsState=VA,Ot.useThrottleEffect=WA,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})});
165
+ ${c.stack}`),u.reject(h)):u.resolve(d))}});return f.requestSubject=e,this.protocol.publish(e,t,{reply:a,headers:n.headers}),u}else{const a=new Xb(this.protocol.muxSubscriptions,e,n,i);this.protocol.request(a);try{this.publish(e,t,{reply:`${this.protocol.muxSubscriptions.baseInbox}${a.token}`,headers:n.headers})}catch(c){a.cancel(c)}const u=Promise.race([a.timer,a.deferred]);return u.catch(()=>{a.cancel()}),u}}flush(){return this.isClosed()?Promise.reject(Ce.errorForCode(we.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Ce.errorForCode(we.ConnectionClosed)):this.isDraining()?Promise.reject(Ce.errorForCode(we.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const e=this.protocol.getServer();return e?e.listen:""}status(){const e=new Mr;return e.iterClosed.then(()=>{const t=this.listeners.indexOf(e);this.listeners.splice(t,1)}),this.listeners.push(e),e}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((t,n)=>t==="time"?new Date(Date.parse(n)):n)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(e={}){const t=new lP(this,e);if(e.checkAPI!==!1)try{await t.getAccountInfo()}catch(n){const i=n;throw i.code===we.NoResponders&&(i.code=we.JetStreamNotEnabled),i}return t}jetstream(e={}){return new Fd(this,e)}getServerVersion(){const e=this.info;return e?Cs(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Ce.errorForCode(we.Disconnect);const e=Date.now();return await this.flush(),Date.now()-e}get features(){return this.protocol.features}get services(){return this._services||(this._services=new pP(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Ce.errorForCode(we.ConnectionClosed)):this.isDraining()?Promise.reject(Ce.errorForCode(we.ConnectionDraining)):this.protocol.reconnect()}}class pP{constructor(e){E(this,"nc");this.nc=e}add(e){try{return new No(this.nc,e).start()}catch(t){return Promise.reject(t)}}client(e,t){return new GC(this.nc,e,t)}}class mP{constructor(e,t,n){E(this,"bucket");E(this,"sm");E(this,"prefixLen");this.bucket=e,this.prefixLen=t,this.sm=n}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(gc)||"PUT"}get length(){const e=this.sm.header.get(en.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class yP{constructor(e,t,n){E(this,"bucket");E(this,"key");E(this,"sm");this.bucket=e,this.key=t,this.sm=n}get value(){return this.sm.data}get created(){return new Date(hd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var e;return((e=this.sm.headers)==null?void 0:e.get(gc))||"PUT"}get delta(){return this.sm.info.pending}get length(){var t;const e=((t=this.sm.headers)==null?void 0:t.get(en.MessageSizeHdr))||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Ew extends zI{constructor(t,n,i){super(t.nc,n,i);E(this,"js");E(this,"monitor");this.js=t,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(t){this.sub.info=t}get info(){return this.sub.info}_resetOrderedConsumer(t){if(this.info===null||this.sub.isClosed())return;const n=Ei(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,n);const a=this.info;a.config.name=Is.next(),a.ordered_consumer_sequence.delivery_seq=0,a.flow_control.heartbeat_count=0,a.flow_control.fc_count=0,a.flow_control.consumer_restarts++,a.deliver=n,a.config.deliver_subject=n,a.config.deliver_policy=yr.StartSequence,a.config.opt_start_seq=t;const u={};u.stream_name=this.info.stream,u.config=a.config;const c=`${a.api.prefix}.CONSUMER.CREATE.${a.stream}`;this.js._request(c,u,{retries:-1}).then(f=>{const h=f,d=this.sub.info;d.last=h,this.info.config=h.config,this.info.name=h.name}).catch(f=>{const h=new Ce(`unable to recreate ordered consumer ${a.stream} at seq ${t}`,we.RequestError,f);this.sub.callback(h,{})})}_maybeSetupHbMonitoring(){var n,i;const t=((i=(n=this.info)==null?void 0:n.config)==null?void 0:i.idle_heartbeat)||0;t&&this._setupHbMonitoring(hd(t))}_setupHbMonitoring(t,n=0){const i={cancelAfter:0,maxOut:2};n&&(i.cancelAfter=n);const a=this.sub,u=c=>{var d,y,g,m;const f=AI(409,`${qn.IdleHeartbeatMissed}: ${c}`,this.sub.subject);if(!((d=this.info)==null?void 0:d.ordered))this.sub.callback(null,f);else{if(!this.js.nc.protocol.connected)return!1;const b=((g=(y=this.info)==null?void 0:y.ordered_consumer_sequence)==null?void 0:g.stream_seq)||0;return this._resetOrderedConsumer(b+1),(m=this.monitor)==null||m.restart(),!1}return!a.noIterator};this.monitor=new gd(t,u,i)}_checkHbOrderConsumer(t){const n=t.headers.get(en.ConsumerStalledHdr);n!==""&&this.js.nc.publish(n);const i=parseInt(t.headers.get(en.LastConsumerSeqHdr),10),a=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,i!==a.delivery_seq&&this._resetOrderedConsumer(a.stream_seq+1),!1}_checkOrderedConsumer(t){const n=this.info.ordered_consumer_sequence,i=t.info.streamSequence,a=t.info.deliverySequence;return a!=n.delivery_seq+1?(this._resetOrderedConsumer(n.stream_seq+1),!1):(n.delivery_seq=a,n.stream_seq=i,!0)}async destroy(){this.isClosed()||await this.drain();const t=this.sub.info,n=t.config.durable_name||t.name,i=`${t.api.prefix}.CONSUMER.DELETE.${t.stream}.${n}`;await t.api._request(i)}async consumerInfo(){const t=this.sub.info,n=t.config.durable_name||t.name,i=`${t.api.prefix}.CONSUMER.INFO.${t.stream}.${n}`,a=await t.api._request(i);return t.last=a,a}}class gP extends Ew{constructor(e,t,n){super(e,t,n)}pull(e={batch:1}){const{stream:t,config:n,name:i}=this.sub.info,a=n.durable_name??i,u={};if(u.batch=e.batch||1,u.no_wait=e.no_wait||!1,(e.max_bytes??0)>0){const h=this.js.nc.features.get(kt.JS_PULL_MAX_BYTES);if(!h.ok)throw new Error(`max_bytes is only supported on servers ${h.min} or better`);u.max_bytes=e.max_bytes}let c=0;e.expires&&e.expires>0&&(c=e.expires,u.expires=cr(c));let f=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(f=e.idle_heartbeat,u.idle_heartbeat=cr(f)),f&&c===0)throw new Error("idle_heartbeat requires expires");if(f>c)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),c&&f&&(this.monitor?this.monitor._change(f,c):this._setupHbMonitoring(f,c));const h=this.info.api,d=`${h.prefix}.CONSUMER.MSG.NEXT.${t}.${a}`,y=this.sub.subject;h.nc.publish(d,h.jc.encode(u),{reply:y})}}}function vP(r,e){return r?wP(e):bP(e)}function bP(r){return(e,t)=>e?[e,null]:(e=va(t),e?[e,null]:[null,Do(t,r)])}function wP(r){return(e,t)=>{if(e)return[e,null];const n=va(t);return n!==null?[Ow(n),null]:[null,Do(t,r)]}}function Ow(r){if(r!==null)switch(r.code){case we.JetStream404NoMessages:case we.JetStream408RequestTimeout:return null;case we.JetStream409:return kI(r)?r:null;default:return r}return null}function _P(r){r&&r.ack()}function xP(r){const e=r.split(".");if(e.length===9&&e.splice(2,0,"_",""),e.length<11||e[0]!=="$JS"||e[1]!=="ACK")throw new Error("not js message");const t={};return t.domain=e[2]==="_"?"":e[2],t.account_hash=e[3],t.stream=e[4],t.consumer=e[5],t.redeliveryCount=parseInt(e[6],10),t.redelivered=t.redeliveryCount>1,t.streamSequence=parseInt(e[7],10),t.deliverySequence=parseInt(e[8],10),t.timestampNanos=parseInt(e[9],10),t.pending=parseInt(e[10],10),t}class SP{constructor(e,t){E(this,"msg");E(this,"di");E(this,"didAck");E(this,"timeout");this.msg=e,this.didAck=!1,this.timeout=t}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=xP(this.reply)),this.di}get redelivered(){return this.info.redeliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(e){this.didAck||(this.didAck=!this.isWIP(e),this.msg.respond(e))}isWIP(e){return e.length===4&&e[0]===Mo[0]&&e[1]===Mo[1]&&e[2]===Mo[2]&&e[3]===Mo[3]}async ackAck(e){var n;e=e||{},e.timeout=e.timeout||this.timeout;const t=ir();if(this.didAck)t.resolve(!1);else if(this.didAck=!0,this.msg.reply){const a=this.msg.publisher,u=!((n=a.options)!=null&&n.noAsyncTraces),c=new Xb(a.muxSubscriptions,this.msg.reply,{timeout:e.timeout},u);a.request(c);try{a.publish(this.msg.reply,bw,{reply:`${a.muxSubscriptions.baseInbox}${c.token}`})}catch(f){c.cancel(f)}try{await Promise.race([c.timer,c.deferred]),t.resolve(!0)}catch(f){c.cancel(f),t.reject(f)}}else t.resolve(!1);return t}ack(){this.doAck(bw)}nak(e){let t=nP;e&&(t=Bb().encode(`-NAK ${JSON.stringify({delay:cr(e)})}`)),this.doAck(t)}working(){this.doAck(Mo)}next(e,t={batch:1}){const n={};n.batch=t.batch||1,n.no_wait=t.no_wait||!1,t.expires&&t.expires>0&&(n.expires=cr(t.expires));const i=Ln().encode(n),a=_a.concat(iP,aP,i),u=e?{reply:e}:void 0;this.msg.respond(a,u)}term(e=""){let t=sP;(e==null?void 0:e.length)>0&&(t=Bb().encode(`+TERM ${e}`)),this.doAck(t)}json(){return this.msg.json()}string(){return this.msg.string()}}const EP="1.29.2",OP="nats.ws";class TP{constructor(){E(this,"version");E(this,"lang");E(this,"closeError");E(this,"connected");E(this,"done");E(this,"socket");E(this,"options");E(this,"socketClosed");E(this,"encrypted");E(this,"peeked");E(this,"yields");E(this,"signal");E(this,"closedNotification");this.version=EP,this.lang=OP,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=ir(),this.closedNotification=ir()}async connect(e,t){const n=ir();if(t.tls)return n.reject(new Ce("tls",we.InvalidOption)),n;this.options=t;const i=e.src;if(t.wsFactory){const{socket:a,encrypted:u}=await t.wsFactory(e.src,t);this.socket=a,this.encrypted=u}else this.encrypted=i.indexOf("wss://")===0,this.socket=new WebSocket(i);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=a=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(a.data)),this.peeked){this.signal.resolve();return}const u=_a.concat(...this.yields),c=KI(u);if(c!==""){const f=jC.exec(c);if(!f){t.debug&&console.error("!!!",oc(u)),n.reject(new Error("unexpected response from server"));return}try{const h=JSON.parse(f[1]);LC(h,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),n.resolve()}catch(h){n.reject(h);return}}},this.socket.onclose=a=>{if(this.isDiscarded())return;this.socketClosed=!0;let u;this.done||(a.wasClean||(u=new Error(a.reason)),this._closed(u))},this.socket.onerror=a=>{if(this.isDiscarded())return;const u=a,c=new Ce(u.message,we.Unknown,new Error(u.error));n.reject(c)},n}disconnect(){this._closed(void 0,!0)}async _closed(e,t=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=e,!e)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ya(100);this.done=!0;try{this.socket.close(e?1002:1e3,e?e.message:void 0)}catch{}t&&this.closedNotification.resolve(e)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const e=this.yields;this.yields=[];for(let t=0;t<e.length;t++)this.options.debug&&console.info(`> ${oc(e[t])}`),yield e[t];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=ir())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${oc(e)}`);return}catch(t){this.options.debug&&console.error(`!!! ${oc(e)}: ${t}`)}}close(e){return this._closed(e,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var e;this.done=!0;try{(e=this.socket)==null||e.close()}catch{}}}function AP(r,e){/^(.*:\/\/)(.*)/.test(r)||(typeof e=="boolean"?r=`${e===!0?"https":"http"}://${r}`:r=`https://${r}`);let n=new URL(r);const i=n.protocol.toLowerCase();i==="ws:"&&(e=!1),i==="wss:"&&(e=!0),i!=="https:"&&i!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),n=new URL(`http://${r}`));let a,u;const c=n.hostname,f=n.pathname,h=n.search||"";switch(i){case"http:":case"ws:":case"nats:":u=n.port||"80",a="ws:";break;case"https:":case"wss:":case"tls:":u=n.port||"443",a="wss:";break;default:u=n.port||e===!0?"443":"80",a=e===!0?"wss:":"ws:";break}return`${a}//${c}:${u}${f}${h}`}function kP(r={}){return HI({defaultPort:443,urlParseFn:AP,factory:()=>new TP}),Ld.connect(r)}const Tw=["new","last","last_per_subject"],IP=async(r,e)=>(console.info(`Connecting to server ${r}`),await kP({servers:[r],authenticator:NC(new TextEncoder().encode(e))}));async function*CP(r){const e=Ln();for await(const t of r)try{yield e.decode(t.data)}catch(n){console.warn(`Skipping event: ${n}`)}}const Aw=(r,e)=>{r.current&&(r.current=void 0),e.current&&(e.current.close(),e.current=void 0)},kw={scada:"mm.0.[location-ref].[machine-ref].[qualifier].[data-category].[metric-key].[message-type]","machine-service":"mm.2.[location-ref].[machine-ref].[service-name].[qualifier].[data-category].[metric-key].[message-type]","edge-service":"mm.3.[location-ref].[edge-ref].[service-name].[data-category].[metric-key].[message-type]","machine-source-service":"mm.4.[location-ref].[machine-ref].[machine-source-ref].[service-name].[data-category].[metric-key].[message-type]",edge:"mm.7.[location-ref].[edge-ref].[data-category].[metric-key].[message-type]"},PP={undefined:0,event:1,eventset:2,quantity:3,state:4,count:5,info:6,beat:7},NP=(r,e,t)=>{if(!kw[r])throw new Error("Unknown stream name");const n=kw[r].split(".");let i="";return n.forEach((a,u)=>{switch(a){case"[location-ref]":i+="."+e;break;case"[machine-ref]":i+="."+((t==null?void 0:t.machineRef)||"*");break;case"[qualifier]":i+="."+((t==null?void 0:t.qualifier)||"0");break;case"[data-category]":i+="."+(PP[t==null?void 0:t.dataCategory]||"*");break;case"[metric-key]":i+="."+(t!=null&&t.metricKey?t==null?void 0:t.metricKey.toLowerCase().replace(/[^a-zA-Z0-9_\\-]/gi,"-"):"*");break;case"[message-type]":i+="."+((t==null?void 0:t.messageType)||"0");break;case"[edge-ref]":i+="."+((t==null?void 0:t.edgeRef)||"*");break;case"[service-name]":i+="."+((t==null?void 0:t.serviceName)||"*");break;case"[machine-source-ref]":i+="."+((t==null?void 0:t.machineSourceRef)||"*");break;default:u>0&&(i+="."),i+=a;break}}),i},RP=r=>{const{streamName:e,locationRef:t,filters:n,deliverPolicy:i="new",dispatch:a}=r;if(!Tw.includes(i))throw new Error(`Invalid deliverPolicy "${i}" specified. Valid options are: ${Tw.join(", ")}`);n&&n.length>1&&console.warn("Multiple filters are not supported. Only the first filter will be used.");const{urls:u,natsCredsRef:c}=ti(),f=me.useRef(),h=me.useRef();return me.useEffect(()=>!u.natsUrl||!c.current||!e||!t?void 0:((async()=>{try{const y=await IP(u.natsUrl,c.current);f.current=y;const g=NP(e,t,n==null?void 0:n[0]);console.info(`Consuming events from stream ${e} filtering by subject ${g}`);const b=await(await y.jetstream().consumers.get(e,{deliver_policy:i,filterSubjects:g})).consume({max_messages:1e3}),I=CP(b);if(h.current=I,typeof a=="function")for await(const S of I)a(S)}catch(y){console.error(`Error setting up event stream. ${y}`)}})(),()=>Aw(h,f)),[e,t,i,u.natsUrl,c]),[h.current,()=>Aw(h,f)]},MP=me.forwardRef(({href:r,asFlyout:e,children:t,...n},i)=>{const{isEmbedded:a,navigateParent:u}=me.useContext(fa);return nr.jsx("a",{...n,ref:i,href:r,onClick:c=>{!a||c.metaKey||c.ctrlKey||c.shiftKey||(c.preventDefault(),c.stopPropagation(),u(r,{asFlyout:e}))},children:t})});Ot.Link=MP,Ot.MMProvider=yI,Ot.PrivateLayout=tk,Ot._useMMApolloLinkContext=ek,Ot.useApiRequest=f0,Ot.useAsyncEffect=bo,Ot.useAsyncInterval=wo,Ot.useDowntimeQuery=GA,Ot.useEventStream=RP,Ot.useMMAppContext=ZA,Ot.useMMAppSetting=XA,Ot.useMMAppTools=KA,Ot.useMMAuth=ti,Ot.useMMEmbeddedApp=YA,Ot.useMMHash=JA,Ot.useMMTemplates=QA,Ot.useProductionQuery=zA,Ot.useQuantityStream=HA,Ot.useSearchParamsState=VA,Ot.useThrottleEffect=WA,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@machinemetrics/mm-react-tools",
3
- "version": "3.2.5-0",
3
+ "version": "3.2.5",
4
4
  "description": "Components, hooks, and helper functions for writing React apps using MachineMetrics APIs.",
5
5
  "author": "machinemetrics",
6
6
  "license": "MIT",