@machinemetrics/mm-react-tools 4.0.15 → 4.2.0
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/mm-react-tools.es.js +13447 -12863
- package/dist/mm-react-tools.umd.js +86 -86
- package/package.json +17 -18
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(Tt,be){typeof exports=="object"&&typeof module<"u"?be(exports,require("react"),require("react-router-dom"),require("styled-components")):typeof define=="function"&&define.amd?define(["exports","react","react-router-dom","styled-components"],be):(Tt=typeof globalThis<"u"?globalThis:Tt||self,be(Tt["mm-react-tools"]={},Tt.React,Tt.reactRouterDom,Tt.styled))})(this,function(Tt,be,qi,im){"use strict";function bx(r,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in r)){const a=Object.getOwnPropertyDescriptor(n,i);a&&Object.defineProperty(r,i,a.get?a:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var vs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sm(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function dl(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var e=r.default;if(typeof e=="function"){var t=function n(){var i=!1;try{i=this instanceof n}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var nu={exports:{}},Ba={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var am;function wx(){if(am)return Ba;am=1;var r=be,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(c,f,h){var p,m={},y=null,g=null;h!==void 0&&(y=""+h),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(g=f.ref);for(p in f)n.call(f,p)&&!a.hasOwnProperty(p)&&(m[p]=f[p]);if(c&&c.defaultProps)for(p in f=c.defaultProps,f)m[p]===void 0&&(m[p]=f[p]);return{$$typeof:e,type:c,key:y,ref:g,props:m,_owner:i.current}}return Ba.Fragment=t,Ba.jsx=u,Ba.jsxs=u,Ba}var Va={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,30 +14,30 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var om;function _x(){return om||(om=1,process.env.NODE_ENV!=="production"&&function(){var r=be,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),b=Symbol.iterator,I="@@iterator";function S(M){if(M===null||typeof M!="object")return null;var pe=b&&M[b]||M[I];return typeof pe=="function"?pe:null}var w=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function O(M){{for(var pe=arguments.length,xe=new Array(pe>1?pe-1:0),je=1;je<pe;je++)xe[je-1]=arguments[je];P("error",M,xe)}}function P(M,pe,xe){{var je=w.ReactDebugCurrentFrame,ze=je.getStackAddendum();ze!==""&&(pe+="%s",xe=xe.concat([ze]));var Qe=xe.map(function(et){return String(et)});Qe.unshift("Warning: "+pe),Function.prototype.apply.call(console[M],console,Qe)}}var D=!1,T=!1,N=!1,G=!1,q=!1,$;$=Symbol.for("react.module.reference");function K(M){return!!(typeof M=="string"||typeof M=="function"||M===n||M===a||q||M===i||M===h||M===p||G||M===g||D||T||N||typeof M=="object"&&M!==null&&(M.$$typeof===y||M.$$typeof===m||M.$$typeof===u||M.$$typeof===c||M.$$typeof===f||M.$$typeof===$||M.getModuleId!==void 0))}function oe(M,pe,xe){var je=M.displayName;if(je)return je;var ze=pe.displayName||pe.name||"";return ze!==""?xe+"("+ze+")":xe}function re(M){return M.displayName||"Context"}function Ee(M){if(M==null)return null;if(typeof M.tag=="number"&&O("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof M=="function")return M.displayName||M.name||null;if(typeof M=="string")return M;switch(M){case n:return"Fragment";case t:return"Portal";case a:return"Profiler";case i:return"StrictMode";case h:return"Suspense";case p:return"SuspenseList"}if(typeof M=="object")switch(M.$$typeof){case c:var pe=M;return re(pe)+".Consumer";case u:var xe=M;return re(xe._context)+".Provider";case f:return oe(M,M.render,"ForwardRef");case m:var je=M.displayName||null;return je!==null?je:Ee(M.type)||"Memo";case y:{var ze=M,Qe=ze._payload,et=ze._init;try{return Ee(et(Qe))}catch{return null}}}return null}var ie=Object.assign,me=0,we,Te,ee,ye,fe,Pe,Be;function ht(){}ht.__reactDisabledLog=!0;function It(){{if(me===0){we=console.log,Te=console.info,ee=console.warn,ye=console.error,fe=console.group,Pe=console.groupCollapsed,Be=console.groupEnd;var M={configurable:!0,enumerable:!0,value:ht,writable:!0};Object.defineProperties(console,{info:M,log:M,warn:M,error:M,group:M,groupCollapsed:M,groupEnd:M})}me++}}function ot(){{if(me--,me===0){var M={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ie({},M,{value:we}),info:ie({},M,{value:Te}),warn:ie({},M,{value:ee}),error:ie({},M,{value:ye}),group:ie({},M,{value:fe}),groupCollapsed:ie({},M,{value:Pe}),groupEnd:ie({},M,{value:Be})})}me<0&&O("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var tt=w.ReactCurrentDispatcher,Mt;function St(M,pe,xe){{if(Mt===void 0)try{throw Error()}catch(ze){var je=ze.stack.trim().match(/\n( *(at )?)/);Mt=je&&je[1]||""}return`
|
|
18
|
+
`+Mt+M}}var Fe=!1,Ge;{var W=typeof WeakMap=="function"?WeakMap:Map;Ge=new W}function Y(M,pe){if(!M||Fe)return"";{var xe=Ge.get(M);if(xe!==void 0)return xe}var je;Fe=!0;var ze=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Qe;Qe=tt.current,tt.current=null,It();try{if(pe){var et=function(){throw Error()};if(Object.defineProperty(et.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(et,[])}catch(C){je=C}Reflect.construct(M,[],et)}else{try{et.call()}catch(C){je=C}M.call(et.prototype)}}else{try{throw Error()}catch(C){je=C}M()}}catch(C){if(C&&je&&typeof C.stack=="string"){for(var Ye=C.stack.split(`
|
|
19
|
+
`),Ht=je.stack.split(`
|
|
20
|
+
`),He=Ye.length-1,gt=Ht.length-1;He>=1&>>=0&&Ye[He]!==Ht[gt];)gt--;for(;He>=1&>>=0;He--,gt--)if(Ye[He]!==Ht[gt]){if(He!==1||gt!==1)do if(He--,gt--,gt<0||Ye[He]!==Ht[gt]){var _=`
|
|
21
|
+
`+Ye[He].replace(" at new "," at ");return M.displayName&&_.includes("<anonymous>")&&(_=_.replace("<anonymous>",M.displayName)),typeof M=="function"&&Ge.set(M,_),_}while(He>=1&>>=0);break}}}finally{Fe=!1,tt.current=Qe,ot(),Error.prepareStackTrace=ze}var A=M?M.displayName||M.name:"",k=A?St(A):"";return typeof M=="function"&&Ge.set(M,k),k}function U(M,pe,xe){return Y(M,!1)}function Z(M){var pe=M.prototype;return!!(pe&&pe.isReactComponent)}function ne(M,pe,xe){if(M==null)return"";if(typeof M=="function")return Y(M,Z(M));if(typeof M=="string")return St(M);switch(M){case h:return St("Suspense");case p:return St("SuspenseList")}if(typeof M=="object")switch(M.$$typeof){case f:return U(M.render);case m:return ne(M.type,pe,xe);case y:{var je=M,ze=je._payload,Qe=je._init;try{return ne(Qe(ze),pe,xe)}catch{}}}return""}var z=Object.prototype.hasOwnProperty,Oe={},We=w.ReactDebugCurrentFrame;function $e(M){if(M){var pe=M._owner,xe=ne(M.type,M._source,pe?pe.type:null);We.setExtraStackFrame(xe)}else We.setExtraStackFrame(null)}function ce(M,pe,xe,je,ze){{var Qe=Function.call.bind(z);for(var et in M)if(Qe(M,et)){var Ye=void 0;try{if(typeof M[et]!="function"){var Ht=Error((je||"React class")+": "+xe+" type `"+et+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof M[et]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ht.name="Invariant Violation",Ht}Ye=M[et](pe,et,je,xe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(He){Ye=He}Ye&&!(Ye instanceof Error)&&($e(ze),O("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",je||"React class",xe,et,typeof Ye),$e(null)),Ye instanceof Error&&!(Ye.message in Oe)&&(Oe[Ye.message]=!0,$e(ze),O("Failed %s type: %s",xe,Ye.message),$e(null))}}}var Se=Array.isArray;function Je(M){return Se(M)}function dt(M){{var pe=typeof Symbol=="function"&&Symbol.toStringTag,xe=pe&&M[Symbol.toStringTag]||M.constructor.name||"Object";return xe}}function pt(M){try{return Qt(M),!1}catch{return!0}}function Qt(M){return""+M}function Et(M){if(pt(M))return O("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",dt(M)),Qt(M)}var Xt=w.ReactCurrentOwner,zt={key:!0,ref:!0,__self:!0,__source:!0},xr,Vt;function dr(M){if(z.call(M,"ref")){var pe=Object.getOwnPropertyDescriptor(M,"ref").get;if(pe&&pe.isReactWarning)return!1}return M.ref!==void 0}function pr(M){if(z.call(M,"key")){var pe=Object.getOwnPropertyDescriptor(M,"key").get;if(pe&&pe.isReactWarning)return!1}return M.key!==void 0}function Or(M,pe){typeof M.ref=="string"&&Xt.current}function Wt(M,pe){{var xe=function(){xr||(xr=!0,O("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",pe))};xe.isReactWarning=!0,Object.defineProperty(M,"key",{get:xe,configurable:!0})}}function Q(M,pe){{var xe=function(){Vt||(Vt=!0,O("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",pe))};xe.isReactWarning=!0,Object.defineProperty(M,"ref",{get:xe,configurable:!0})}}var J=function(M,pe,xe,je,ze,Qe,et){var Ye={$$typeof:e,type:M,key:pe,ref:xe,props:et,_owner:Qe};return Ye._store={},Object.defineProperty(Ye._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ye,"_self",{configurable:!1,enumerable:!1,writable:!1,value:je}),Object.defineProperty(Ye,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ze}),Object.freeze&&(Object.freeze(Ye.props),Object.freeze(Ye)),Ye};function it(M,pe,xe,je,ze){{var Qe,et={},Ye=null,Ht=null;xe!==void 0&&(Et(xe),Ye=""+xe),pr(pe)&&(Et(pe.key),Ye=""+pe.key),dr(pe)&&(Ht=pe.ref,Or(pe,ze));for(Qe in pe)z.call(pe,Qe)&&!zt.hasOwnProperty(Qe)&&(et[Qe]=pe[Qe]);if(M&&M.defaultProps){var He=M.defaultProps;for(Qe in He)et[Qe]===void 0&&(et[Qe]=He[Qe])}if(Ye||Ht){var gt=typeof M=="function"?M.displayName||M.name||"Unknown":M;Ye&&Wt(et,gt),Ht&&Q(et,gt)}return J(M,Ye,Ht,ze,je,Xt.current,et)}}var mt=w.ReactCurrentOwner,lt=w.ReactDebugCurrentFrame;function Ve(M){if(M){var pe=M._owner,xe=ne(M.type,M._source,pe?pe.type:null);lt.setExtraStackFrame(xe)}else lt.setExtraStackFrame(null)}var ur;ur=!1;function Jt(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function Yt(){{if(mt.current){var M=Ee(mt.current.type);if(M)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+
|
|
23
|
+
Check the render method of \``+M+"`."}return""}}function Mr(M){return""}var jr={};function Ur(M){{var pe=Yt();if(!pe){var xe=typeof M=="string"?M:M.displayName||M.name;xe&&(pe=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+xe+">.")}return pe}}function qt(M,pe){{if(!M._store||M._store.validated||M.key!=null)return;M._store.validated=!0;var xe=Ur(pe);if(jr[xe])return;jr[xe]=!0;var je="";M&&M._owner&&M._owner!==mt.current&&(je=" It was passed a child from "+Ee(M._owner.type)+"."),Ve(M),O('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',xe,je),Ve(null)}}function Er(M,pe){{if(typeof M!="object")return;if(Je(M))for(var xe=0;xe<M.length;xe++){var je=M[xe];Jt(je)&&qt(je,pe)}else if(Jt(M))M._store&&(M._store.validated=!0);else if(M){var ze=S(M);if(typeof ze=="function"&&ze!==M.entries)for(var Qe=ze.call(M),et;!(et=Qe.next()).done;)Jt(et.value)&&qt(et.value,pe)}}}function zr(M){{var pe=M.type;if(pe==null||typeof pe=="string")return;var xe;if(typeof pe=="function")xe=pe.propTypes;else if(typeof pe=="object"&&(pe.$$typeof===f||pe.$$typeof===m))xe=pe.propTypes;else return;if(xe){var je=Ee(pe);ce(xe,M.props,"prop",je,M)}else if(pe.PropTypes!==void 0&&!ur){ur=!0;var ze=Ee(pe);O("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ze||"Unknown")}typeof pe.getDefaultProps=="function"&&!pe.getDefaultProps.isReactClassApproved&&O("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Dr(M){{for(var pe=Object.keys(M.props),xe=0;xe<pe.length;xe++){var je=pe[xe];if(je!=="children"&&je!=="key"){Ve(M),O("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",je),Ve(null);break}}M.ref!==null&&(Ve(M),O("Invalid attribute `ref` supplied to `React.Fragment`."),Ve(null))}}var er={};function Hr(M,pe,xe,je,ze,Qe){{var et=K(M);if(!et){var Ye="";(M===void 0||typeof M=="object"&&M!==null&&Object.keys(M).length===0)&&(Ye+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ht=Mr();Ht?Ye+=Ht:Ye+=Yt();var He;M===null?He="null":Je(M)?He="array":M!==void 0&&M.$$typeof===e?(He="<"+(Ee(M.type)||"Unknown")+" />",Ye=" Did you accidentally export a JSX literal instead of a component?"):He=typeof M,O("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",He,Ye)}var gt=it(M,pe,xe,ze,Qe);if(gt==null)return gt;if(et){var _=pe.children;if(_!==void 0)if(je)if(Je(_)){for(var A=0;A<_.length;A++)Er(_[A],M);Object.freeze&&Object.freeze(_)}else O("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Er(_,M)}if(z.call(pe,"key")){var k=Ee(M),C=Object.keys(pe).filter(function(ue){return ue!=="key"}),j=C.length>0?"{key: someKey, "+C.join(": ..., ")+": ...}":"{key: someKey}";if(!er[k+j]){var V=C.length>0?"{"+C.join(": ..., ")+": ...}":"{}";O(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,
|
|
31
|
-
`,
|
|
32
|
-
`)}function
|
|
30
|
+
<%s key={someKey} {...props} />`,j,k,V,k),er[k+j]=!0}}return M===n?Dr(gt):zr(gt),gt}}function Tr(M,pe,xe){return Hr(M,pe,xe,!0)}function gr(M,pe,xe){return Hr(M,pe,xe,!1)}var kr=gr,_n=Tr;Va.Fragment=n,Va.jsx=kr,Va.jsxs=_n}()),Va}var um;function Sx(){return um||(um=1,process.env.NODE_ENV==="production"?nu.exports=wx():nu.exports=_x()),nu.exports}var nr=Sx(),pl=function(r,e){return pl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},pl(r,e)};function In(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");pl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var F=function(){return F=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},F.apply(this,arguments)};function an(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function ji(r,e,t,n){function i(a){return a instanceof t?a:new t(function(u){u(a)})}return new(t||(t=Promise))(function(a,u){function c(p){try{h(n.next(p))}catch(m){u(m)}}function f(p){try{h(n.throw(p))}catch(m){u(m)}}function h(p){p.done?a(p.value):i(p.value).then(c,f)}h((n=n.apply(r,e||[])).next())})}function Ui(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,u;return u={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(h){return function(p){return f([h,p])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,h[0]&&(t=0)),t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(p){h=[6,p],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function lr(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;var ml="Invariant Violation",cm=Object.setPrototypeOf,xx=cm===void 0?function(r,e){return r.__proto__=e,r}:cm,lm=function(r){In(e,r);function e(t){t===void 0&&(t=ml);var n=r.call(this,typeof t=="number"?ml+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return n.framesToPop=1,n.name=ml,xx(n,e.prototype),n}return e}(Error);function bs(r,e){if(!r)throw new lm(e)}var iu=["debug","log","warn","error","silent"],yl=iu.indexOf("log");function su(r){return function(){if(iu.indexOf(r)>=yl){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=su("debug"),r.log=su("log"),r.warn=su("warn"),r.error=su("error")})(bs||(bs={}));function fm(r){var e=iu[yl];return yl=Math.max(0,iu.indexOf(r)),e}var gl="3.13.9";function Cn(r){try{return r()}catch{}}const vl=Cn(function(){return globalThis})||Cn(function(){return window})||Cn(function(){return self})||Cn(function(){return global})||Cn(function(){return Cn.constructor("return this")()});var hm=new Map;function au(r){var e=hm.get(r)||1;return hm.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function bl(r,e){e===void 0&&(e=0);var t=au("stringifyForDisplay");return JSON.stringify(r,function(n,i){return i===void 0?t:i},e).split(JSON.stringify(t)).join("<undefined>")}function ou(r){return function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(typeof e=="number"){var i=e;e=wl(i),e||(e=_l(i,t),t=[])}r.apply(void 0,[e].concat(t))}}var Ie=Object.assign(function(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];e||bs(e,wl(t,n)||_l(t,n))},{debug:ou(bs.debug),log:ou(bs.log),warn:ou(bs.warn),error:ou(bs.error)});function Jr(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return new lm(wl(r,e)||_l(r,e))}var dm=Symbol.for("ApolloErrorMessageHandler_"+gl);function pm(r){if(typeof r=="string")return r;try{return bl(r,2).slice(0,1e3)}catch{return"<non-serializable>"}}function wl(r,e){if(e===void 0&&(e=[]),!!r)return vl[dm]&&vl[dm](r,e.map(pm))}function _l(r,e){if(e===void 0&&(e=[]),!!r)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:gl,message:r,args:e.map(pm)})))}var Ex=globalThis.__DEV__!==!1;function uu(r,e){if(!!!r)throw new Error(e)}function Ox(r){return typeof r=="object"&&r!==null}function Tx(r,e){if(!!!r)throw new Error("Unexpected invariant triggered.")}const kx=/\r\n|[\n\r]/g;function Sl(r,e){let t=0,n=1;for(const i of r.body.matchAll(kx)){if(typeof i.index=="number"||Tx(!1),i.index>=e)break;t=i.index+i[0].length,n+=1}return{line:n,column:e+1-t}}function Ax(r){return mm(r.source,Sl(r.source,r.start))}function mm(r,e){const t=r.locationOffset.column-1,n="".padStart(t)+r.body,i=e.line-1,a=r.locationOffset.line-1,u=e.line+a,c=e.line===1?t:0,f=e.column+c,h=`${r.name}:${u}:${f}
|
|
31
|
+
`,p=n.split(/\r\n|[\n\r]/g),m=p[i];if(m.length>120){const y=Math.floor(f/80),g=f%80,b=[];for(let I=0;I<m.length;I+=80)b.push(m.slice(I,I+80));return h+ym([[`${u} |`,b[0]],...b.slice(1,y+1).map(I=>["|",I]),["|","^".padStart(g)],["|",b[y+1]]])}return h+ym([[`${u-1} |`,p[i-1]],[`${u} |`,m],["|","^".padStart(f)],[`${u+1} |`,p[i+1]]])}function ym(r){const e=r.filter(([n,i])=>i!==void 0),t=Math.max(...e.map(([n])=>n.length));return e.map(([n,i])=>n.padStart(t)+(i?" "+i:"")).join(`
|
|
32
|
+
`)}function Ix(r){const e=r[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:r[1],positions:r[2],path:r[3],originalError:r[4],extensions:r[5]}:e}class xl extends Error{constructor(e,...t){var n,i,a;const{nodes:u,source:c,positions:f,path:h,originalError:p,extensions:m}=Ix(t);super(e),this.name="GraphQLError",this.path=h??void 0,this.originalError=p??void 0,this.nodes=gm(Array.isArray(u)?u:u?[u]:void 0);const y=gm((n=this.nodes)===null||n===void 0?void 0:n.map(b=>b.loc).filter(b=>b!=null));this.source=c??(y==null||(i=y[0])===null||i===void 0?void 0:i.source),this.positions=f??y?.map(b=>b.start),this.locations=f&&c?f.map(b=>Sl(c,b)):y?.map(b=>Sl(b.source,b.start));const g=Ox(p?.extensions)?p?.extensions:void 0;this.extensions=(a=m??g)!==null&&a!==void 0?a:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),p!=null&&p.stack?Object.defineProperty(this,"stack",{value:p.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,xl):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const t of this.nodes)t.loc&&(e+=`
|
|
33
33
|
|
|
34
|
-
`+
|
|
34
|
+
`+Ax(t.loc));else if(this.source&&this.locations)for(const t of this.locations)e+=`
|
|
35
35
|
|
|
36
|
-
`+
|
|
37
|
-
`),
|
|
38
|
-
`),'"""'+
|
|
39
|
-
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw
|
|
40
|
-
`));return r.line+=f.length-1,r.lineStart=i,
|
|
36
|
+
`+mm(this.source,t);return e}toJSON(){const e={message:this.message};return this.locations!=null&&(e.locations=this.locations),this.path!=null&&(e.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function gm(r){return r===void 0||r.length===0?void 0:r}function Cr(r,e,t){return new xl(`Syntax Error: ${t}`,{source:r,positions:[e]})}class Cx{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class vm{constructor(e,t,n,i,a,u){this.kind=e,this.start=t,this.end=n,this.line=i,this.column=a,this.value=u,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const bm={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Px=new Set(Object.keys(bm));function wm(r){const e=r?.kind;return typeof e=="string"&&Px.has(e)}var Ws;(function(r){r.QUERY="query",r.MUTATION="mutation",r.SUBSCRIPTION="subscription"})(Ws||(Ws={}));var El;(function(r){r.QUERY="QUERY",r.MUTATION="MUTATION",r.SUBSCRIPTION="SUBSCRIPTION",r.FIELD="FIELD",r.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",r.FRAGMENT_SPREAD="FRAGMENT_SPREAD",r.INLINE_FRAGMENT="INLINE_FRAGMENT",r.VARIABLE_DEFINITION="VARIABLE_DEFINITION",r.SCHEMA="SCHEMA",r.SCALAR="SCALAR",r.OBJECT="OBJECT",r.FIELD_DEFINITION="FIELD_DEFINITION",r.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",r.INTERFACE="INTERFACE",r.UNION="UNION",r.ENUM="ENUM",r.ENUM_VALUE="ENUM_VALUE",r.INPUT_OBJECT="INPUT_OBJECT",r.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(El||(El={}));var Re;(function(r){r.NAME="Name",r.DOCUMENT="Document",r.OPERATION_DEFINITION="OperationDefinition",r.VARIABLE_DEFINITION="VariableDefinition",r.SELECTION_SET="SelectionSet",r.FIELD="Field",r.ARGUMENT="Argument",r.FRAGMENT_SPREAD="FragmentSpread",r.INLINE_FRAGMENT="InlineFragment",r.FRAGMENT_DEFINITION="FragmentDefinition",r.VARIABLE="Variable",r.INT="IntValue",r.FLOAT="FloatValue",r.STRING="StringValue",r.BOOLEAN="BooleanValue",r.NULL="NullValue",r.ENUM="EnumValue",r.LIST="ListValue",r.OBJECT="ObjectValue",r.OBJECT_FIELD="ObjectField",r.DIRECTIVE="Directive",r.NAMED_TYPE="NamedType",r.LIST_TYPE="ListType",r.NON_NULL_TYPE="NonNullType",r.SCHEMA_DEFINITION="SchemaDefinition",r.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",r.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",r.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",r.FIELD_DEFINITION="FieldDefinition",r.INPUT_VALUE_DEFINITION="InputValueDefinition",r.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",r.UNION_TYPE_DEFINITION="UnionTypeDefinition",r.ENUM_TYPE_DEFINITION="EnumTypeDefinition",r.ENUM_VALUE_DEFINITION="EnumValueDefinition",r.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",r.DIRECTIVE_DEFINITION="DirectiveDefinition",r.SCHEMA_EXTENSION="SchemaExtension",r.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",r.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",r.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",r.UNION_TYPE_EXTENSION="UnionTypeExtension",r.ENUM_TYPE_EXTENSION="EnumTypeExtension",r.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(Re||(Re={}));function Ol(r){return r===9||r===32}function Wa(r){return r>=48&&r<=57}function _m(r){return r>=97&&r<=122||r>=65&&r<=90}function Sm(r){return _m(r)||r===95}function Nx(r){return _m(r)||Wa(r)||r===95}function Rx(r){var e;let t=Number.MAX_SAFE_INTEGER,n=null,i=-1;for(let u=0;u<r.length;++u){var a;const c=r[u],f=Mx(c);f!==c.length&&(n=(a=n)!==null&&a!==void 0?a:u,i=u,u!==0&&f<t&&(t=f))}return r.map((u,c)=>c===0?u:u.slice(t)).slice((e=n)!==null&&e!==void 0?e:0,i+1)}function Mx(r){let e=0;for(;e<r.length&&Ol(r.charCodeAt(e));)++e;return e}function Dx(r,e){const t=r.replace(/"""/g,'\\"""'),n=t.split(/\r\n|[\n\r]/g),i=n.length===1,a=n.length>1&&n.slice(1).every(g=>g.length===0||Ol(g.charCodeAt(0))),u=t.endsWith('\\"""'),c=r.endsWith('"')&&!u,f=r.endsWith("\\"),h=c||f,p=!i||r.length>70||h||a||u;let m="";const y=i&&Ol(r.charCodeAt(0));return(p&&!y||a)&&(m+=`
|
|
37
|
+
`),m+=t,(p||h)&&(m+=`
|
|
38
|
+
`),'"""'+m+'"""'}var de;(function(r){r.SOF="<SOF>",r.EOF="<EOF>",r.BANG="!",r.DOLLAR="$",r.AMP="&",r.PAREN_L="(",r.PAREN_R=")",r.SPREAD="...",r.COLON=":",r.EQUALS="=",r.AT="@",r.BRACKET_L="[",r.BRACKET_R="]",r.BRACE_L="{",r.PIPE="|",r.BRACE_R="}",r.NAME="Name",r.INT="Int",r.FLOAT="Float",r.STRING="String",r.BLOCK_STRING="BlockString",r.COMMENT="Comment"})(de||(de={}));class Fx{constructor(e){const t=new vm(de.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==de.EOF)do if(e.next)e=e.next;else{const t=qx(this,e.end);e.next=t,t.prev=e,e=t}while(e.kind===de.COMMENT);return e}}function Lx(r){return r===de.BANG||r===de.DOLLAR||r===de.AMP||r===de.PAREN_L||r===de.PAREN_R||r===de.SPREAD||r===de.COLON||r===de.EQUALS||r===de.AT||r===de.BRACKET_L||r===de.BRACKET_R||r===de.BRACE_L||r===de.PIPE||r===de.BRACE_R}function zs(r){return r>=0&&r<=55295||r>=57344&&r<=1114111}function cu(r,e){return xm(r.charCodeAt(e))&&Em(r.charCodeAt(e+1))}function xm(r){return r>=55296&&r<=56319}function Em(r){return r>=56320&&r<=57343}function ws(r,e){const t=r.source.body.codePointAt(e);if(t===void 0)return de.EOF;if(t>=32&&t<=126){const n=String.fromCodePoint(t);return n==='"'?`'"'`:`"${n}"`}return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function wr(r,e,t,n,i){const a=r.line,u=1+t-r.lineStart;return new vm(e,t,n,a,u,i)}function qx(r,e){const t=r.source.body,n=t.length;let i=e;for(;i<n;){const a=t.charCodeAt(i);switch(a){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++r.line,r.lineStart=i;continue;case 13:t.charCodeAt(i+1)===10?i+=2:++i,++r.line,r.lineStart=i;continue;case 35:return jx(r,i);case 33:return wr(r,de.BANG,i,i+1);case 36:return wr(r,de.DOLLAR,i,i+1);case 38:return wr(r,de.AMP,i,i+1);case 40:return wr(r,de.PAREN_L,i,i+1);case 41:return wr(r,de.PAREN_R,i,i+1);case 46:if(t.charCodeAt(i+1)===46&&t.charCodeAt(i+2)===46)return wr(r,de.SPREAD,i,i+3);break;case 58:return wr(r,de.COLON,i,i+1);case 61:return wr(r,de.EQUALS,i,i+1);case 64:return wr(r,de.AT,i,i+1);case 91:return wr(r,de.BRACKET_L,i,i+1);case 93:return wr(r,de.BRACKET_R,i,i+1);case 123:return wr(r,de.BRACE_L,i,i+1);case 124:return wr(r,de.PIPE,i,i+1);case 125:return wr(r,de.BRACE_R,i,i+1);case 34:return t.charCodeAt(i+1)===34&&t.charCodeAt(i+2)===34?zx(r,i):$x(r,i)}if(Wa(a)||a===45)return Ux(r,i,a);if(Sm(a))return Hx(r,i);throw Cr(r.source,i,a===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:zs(a)||cu(t,i)?`Unexpected character: ${ws(r,i)}.`:`Invalid character: ${ws(r,i)}.`)}return wr(r,de.EOF,n,n)}function jx(r,e){const t=r.source.body,n=t.length;let i=e+1;for(;i<n;){const a=t.charCodeAt(i);if(a===10||a===13)break;if(zs(a))++i;else if(cu(t,i))i+=2;else break}return wr(r,de.COMMENT,e,i,t.slice(e+1,i))}function Ux(r,e,t){const n=r.source.body;let i=e,a=t,u=!1;if(a===45&&(a=n.charCodeAt(++i)),a===48){if(a=n.charCodeAt(++i),Wa(a))throw Cr(r.source,i,`Invalid number, unexpected digit after 0: ${ws(r,i)}.`)}else i=Tl(r,i,a),a=n.charCodeAt(i);if(a===46&&(u=!0,a=n.charCodeAt(++i),i=Tl(r,i,a),a=n.charCodeAt(i)),(a===69||a===101)&&(u=!0,a=n.charCodeAt(++i),(a===43||a===45)&&(a=n.charCodeAt(++i)),i=Tl(r,i,a),a=n.charCodeAt(i)),a===46||Sm(a))throw Cr(r.source,i,`Invalid number, expected digit but got: ${ws(r,i)}.`);return wr(r,u?de.FLOAT:de.INT,e,i,n.slice(e,i))}function Tl(r,e,t){if(!Wa(t))throw Cr(r.source,e,`Invalid number, expected digit but got: ${ws(r,e)}.`);const n=r.source.body;let i=e+1;for(;Wa(n.charCodeAt(i));)++i;return i}function $x(r,e){const t=r.source.body,n=t.length;let i=e+1,a=i,u="";for(;i<n;){const c=t.charCodeAt(i);if(c===34)return u+=t.slice(a,i),wr(r,de.STRING,e,i+1,u);if(c===92){u+=t.slice(a,i);const f=t.charCodeAt(i+1)===117?t.charCodeAt(i+2)===123?Bx(r,i):Vx(r,i):Wx(r,i);u+=f.value,i+=f.size,a=i;continue}if(c===10||c===13)break;if(zs(c))++i;else if(cu(t,i))i+=2;else throw Cr(r.source,i,`Invalid character within String: ${ws(r,i)}.`)}throw Cr(r.source,i,"Unterminated string.")}function Bx(r,e){const t=r.source.body;let n=0,i=3;for(;i<12;){const a=t.charCodeAt(e+i++);if(a===125){if(i<5||!zs(n))break;return{value:String.fromCodePoint(n),size:i}}if(n=n<<4|za(a),n<0)break}throw Cr(r.source,e,`Invalid Unicode escape sequence: "${t.slice(e,e+i)}".`)}function Vx(r,e){const t=r.source.body,n=Om(t,e+2);if(zs(n))return{value:String.fromCodePoint(n),size:6};if(xm(n)&&t.charCodeAt(e+6)===92&&t.charCodeAt(e+7)===117){const i=Om(t,e+8);if(Em(i))return{value:String.fromCodePoint(n,i),size:12}}throw Cr(r.source,e,`Invalid Unicode escape sequence: "${t.slice(e,e+6)}".`)}function Om(r,e){return za(r.charCodeAt(e))<<12|za(r.charCodeAt(e+1))<<8|za(r.charCodeAt(e+2))<<4|za(r.charCodeAt(e+3))}function za(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function Wx(r,e){const t=r.source.body;switch(t.charCodeAt(e+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:`
|
|
39
|
+
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw Cr(r.source,e,`Invalid character escape sequence: "${t.slice(e,e+2)}".`)}function zx(r,e){const t=r.source.body,n=t.length;let i=r.lineStart,a=e+3,u=a,c="";const f=[];for(;a<n;){const h=t.charCodeAt(a);if(h===34&&t.charCodeAt(a+1)===34&&t.charCodeAt(a+2)===34){c+=t.slice(u,a),f.push(c);const p=wr(r,de.BLOCK_STRING,e,a+3,Rx(f).join(`
|
|
40
|
+
`));return r.line+=f.length-1,r.lineStart=i,p}if(h===92&&t.charCodeAt(a+1)===34&&t.charCodeAt(a+2)===34&&t.charCodeAt(a+3)===34){c+=t.slice(u,a),u=a+1,a+=4;continue}if(h===10||h===13){c+=t.slice(u,a),f.push(c),h===13&&t.charCodeAt(a+1)===10?a+=2:++a,c="",u=a,i=a;continue}if(zs(h))++a;else if(cu(t,a))a+=2;else throw Cr(r.source,a,`Invalid character within String: ${ws(r,a)}.`)}throw Cr(r.source,a,"Unterminated string.")}function Hx(r,e){const t=r.source.body,n=t.length;let i=e+1;for(;i<n;){const a=t.charCodeAt(i);if(Nx(a))++i;else break}return wr(r,de.NAME,e,i,t.slice(e,i))}const Gx=10,Tm=2;function kl(r){return lu(r,[])}function lu(r,e){switch(typeof r){case"string":return JSON.stringify(r);case"function":return r.name?`[function ${r.name}]`:"[function]";case"object":return Qx(r,e);default:return String(r)}}function Qx(r,e){if(r===null)return"null";if(e.includes(r))return"[Circular]";const t=[...e,r];if(Jx(r)){const n=r.toJSON();if(n!==r)return typeof n=="string"?n:lu(n,t)}else if(Array.isArray(r))return Kx(r,t);return Yx(r,t)}function Jx(r){return typeof r.toJSON=="function"}function Yx(r,e){const t=Object.entries(r);return t.length===0?"{}":e.length>Tm?"["+Zx(r)+"]":"{ "+t.map(([i,a])=>i+": "+lu(a,e)).join(", ")+" }"}function Kx(r,e){if(r.length===0)return"[]";if(e.length>Tm)return"[Array]";const t=Math.min(Gx,r.length),n=r.length-t,i=[];for(let a=0;a<t;++a)i.push(lu(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push(`... ${n} more items`),"["+i.join(", ")+"]"}function Zx(r){const e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){const t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}const Xx=globalThis.process&&process.env.NODE_ENV==="production"?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if(typeof e=="object"&&e!==null){var n;const i=t.prototype[Symbol.toStringTag],a=Symbol.toStringTag in e?e[Symbol.toStringTag]:(n=e.constructor)===null||n===void 0?void 0:n.name;if(i===a){const u=kl(e);throw new Error(`Cannot use ${i} "${u}" from another module or realm.
|
|
41
41
|
|
|
42
42
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
43
43
|
directory. If different versions of "graphql" are the dependencies of other
|
|
@@ -48,118 +48,118 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
|
48
48
|
Duplicate "graphql" modules cannot be used at the same time since different
|
|
49
49
|
versions may have different capabilities and behavior. The data from one
|
|
50
50
|
version used in the function from another could produce confusing and
|
|
51
|
-
spurious results.`)}}return!1};class ym{constructor(e,t="GraphQL request",n={line:1,column:1}){typeof e=="string"||ru(!1,`Body must be a string. Received: ${xl(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||ru(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ru(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function MS(r){return RS(r,ym)}function DS(r,e){return new FS(r,e).parseDocument()}let FS=class{constructor(e,t={}){const n=MS(e)?e:new ym(e);this._lexer=new yS(n),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(ce.NAME);return this.node(e,{kind:Fe.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:Fe.DOCUMENT,definitions:this.many(ce.SOF,this.parseDefinition,ce.EOF)})}parseDefinition(){if(this.peek(ce.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===ce.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw Nr(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(ce.BRACE_L))return this.node(e,{kind:Fe.OPERATION_DEFINITION,operation:$s.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(ce.NAME)&&(n=this.parseName()),this.node(e,{kind:Fe.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(ce.NAME);switch(e.value){case"query":return $s.QUERY;case"mutation":return $s.MUTATION;case"subscription":return $s.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(ce.PAREN_L,this.parseVariableDefinition,ce.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Fe.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(ce.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(ce.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(ce.DOLLAR),this.node(e,{kind:Fe.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:Fe.SELECTION_SET,selections:this.many(ce.BRACE_L,this.parseSelection,ce.BRACE_R)})}parseSelection(){return this.peek(ce.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,i;return this.expectOptionalToken(ce.COLON)?(n=t,i=this.parseName()):i=t,this.node(e,{kind:Fe.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(ce.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(ce.PAREN_L,t,ce.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(ce.COLON),this.node(t,{kind:Fe.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(ce.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(ce.NAME)?this.node(e,{kind:Fe.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Fe.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:Fe.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:Fe.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case ce.BRACKET_L:return this.parseList(e);case ce.BRACE_L:return this.parseObject(e);case ce.INT:return this.advanceLexer(),this.node(t,{kind:Fe.INT,value:t.value});case ce.FLOAT:return this.advanceLexer(),this.node(t,{kind:Fe.FLOAT,value:t.value});case ce.STRING:case ce.BLOCK_STRING:return this.parseStringLiteral();case ce.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:Fe.BOOLEAN,value:!0});case"false":return this.node(t,{kind:Fe.BOOLEAN,value:!1});case"null":return this.node(t,{kind:Fe.NULL});default:return this.node(t,{kind:Fe.ENUM,value:t.value})}case ce.DOLLAR:if(e)if(this.expectToken(ce.DOLLAR),this._lexer.token.kind===ce.NAME){const n=this._lexer.token.value;throw Nr(this._lexer.source,t.start,`Unexpected variable "$${n}" in constant value.`)}else throw this.unexpected(t);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:Fe.STRING,value:e.value,block:e.kind===ce.BLOCK_STRING})}parseList(e){const t=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:Fe.LIST,values:this.any(ce.BRACKET_L,t,ce.BRACKET_R)})}parseObject(e){const t=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:Fe.OBJECT,fields:this.any(ce.BRACE_L,t,ce.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(ce.COLON),this.node(t,{kind:Fe.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(ce.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(ce.AT),this.node(t,{kind:Fe.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(ce.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(ce.BRACKET_R),t=this.node(e,{kind:Fe.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(ce.BANG)?this.node(e,{kind:Fe.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:Fe.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(ce.STRING)||this.peek(ce.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(ce.BRACE_L,this.parseOperationTypeDefinition,ce.BRACE_R);return this.node(e,{kind:Fe.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(ce.COLON);const n=this.parseNamedType();return this.node(e,{kind:Fe.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:Fe.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),u=this.parseFieldsDefinition();return this.node(e,{kind:Fe.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:a,fields:u})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(ce.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(ce.BRACE_L,this.parseFieldDefinition,ce.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(ce.COLON);const a=this.parseTypeReference(),u=this.parseConstDirectives();return this.node(e,{kind:Fe.FIELD_DEFINITION,description:t,name:n,arguments:i,type:a,directives:u})}parseArgumentDefs(){return this.optionalMany(ce.PAREN_L,this.parseInputValueDef,ce.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(ce.COLON);const i=this.parseTypeReference();let a;this.expectOptionalToken(ce.EQUALS)&&(a=this.parseConstValueLiteral());const u=this.parseConstDirectives();return this.node(e,{kind:Fe.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:a,directives:u})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),u=this.parseFieldsDefinition();return this.node(e,{kind:Fe.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:a,fields:u})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseUnionMemberTypes();return this.node(e,{kind:Fe.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:a})}parseUnionMemberTypes(){return this.expectOptionalToken(ce.EQUALS)?this.delimitedMany(ce.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseEnumValuesDefinition();return this.node(e,{kind:Fe.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:a})}parseEnumValuesDefinition(){return this.optionalMany(ce.BRACE_L,this.parseEnumValueDefinition,ce.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:Fe.ENUM_VALUE_DEFINITION,description:t,name:n,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw Nr(this._lexer.source,this._lexer.token.start,`${su(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseInputFieldsDefinition();return this.node(e,{kind:Fe.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:a})}parseInputFieldsDefinition(){return this.optionalMany(ce.BRACE_L,this.parseInputValueDef,ce.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===ce.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(ce.BRACE_L,this.parseOperationTypeDefinition,ce.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:Fe.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(n.length===0)throw this.unexpected();return this.node(e,{kind:Fe.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:Fe.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:a})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:Fe.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:a})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Fe.UNION_TYPE_EXTENSION,name:t,directives:n,types:i})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Fe.ENUM_TYPE_EXTENSION,name:t,directives:n,values:i})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Fe.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(ce.AT);const n=this.parseName(),i=this.parseArgumentDefs(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const u=this.parseDirectiveLocations();return this.node(e,{kind:Fe.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:a,locations:u})}parseDirectiveLocations(){return this.delimitedMany(ce.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(bl,t.value))return t;throw this.unexpected(e)}node(e,t){return this._options.noLocation!==!0&&(t.loc=new lS(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw Nr(this._lexer.source,t.start,`Expected ${gm(e)}, found ${su(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){const t=this._lexer.token;if(t.kind===ce.NAME&&t.value===e)this.advanceLexer();else throw Nr(this._lexer.source,t.start,`Expected "${e}", found ${su(t)}.`)}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===ce.NAME&&t.value===e?(this.advanceLexer(),!0):!1}unexpected(e){const t=e??this._lexer.token;return Nr(this._lexer.source,t.start,`Unexpected ${su(t)}.`)}any(e,t,n){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(n);)i.push(t.call(this));return i}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const i=[];do i.push(t.call(this));while(!this.expectOptionalToken(n));return i}return[]}many(e,t,n){this.expectToken(e);const i=[];do i.push(t.call(this));while(!this.expectOptionalToken(n));return i}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do n.push(t.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(e!==void 0&&t.kind!==ce.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw Nr(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};function su(r){const e=r.value;return gm(r.kind)+(e!=null?` "${e}"`:"")}function gm(r){return gS(r)?`"${r}"`:r}function LS(r){return`"${r.replace(qS,jS)}"`}const qS=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function jS(r){return US[r.charCodeAt(0)]}const US=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],Sl=Object.freeze({});function Rn(r,e,t=um){const n=new Map;for(const _ of Object.values(Fe))n.set(_,$S(e,_));let i,a=Array.isArray(r),u=[r],c=-1,f=[],h=r,d,y;const g=[],m=[];do{c++;const _=c===u.length,A=_&&f.length!==0;if(_){if(d=m.length===0?void 0:g[g.length-1],h=y,y=m.pop(),A)if(a){h=h.slice();let M=0;for(const[$,j]of f){const K=$-M;j===null?(h.splice(K,1),M++):h[K]=j}}else{h=Object.defineProperties({},Object.getOwnPropertyDescriptors(h));for(const[M,$]of f)h[M]=$}c=i.index,u=i.keys,f=i.edits,a=i.inArray,i=i.prev}else if(y){if(d=a?c:u[c],h=y[d],h==null)continue;g.push(d)}let P;if(!Array.isArray(h)){var b,I;cm(h)||ru(!1,`Invalid AST Node: ${xl(h)}.`);const M=_?(b=n.get(h.kind))===null||b===void 0?void 0:b.leave:(I=n.get(h.kind))===null||I===void 0?void 0:I.enter;if(P=M==null?void 0:M.call(e,h,d,y,g,m),P===Sl)break;if(P===!1){if(!_){g.pop();continue}}else if(P!==void 0&&(f.push([d,P]),!_))if(cm(P))h=P;else{g.pop();continue}}if(P===void 0&&A&&f.push([d,h]),_)g.pop();else{var x;i={inArray:a,index:c,keys:u,edits:f,prev:i},a=Array.isArray(h),u=a?h:(x=t[h.kind])!==null&&x!==void 0?x:[],c=-1,f=[],y&&m.push(y),y=h}}while(i!==void 0);return f.length!==0?f[f.length-1][1]:r}function $S(r,e){const t=r[e];return typeof t=="object"?t:typeof t=="function"?{enter:t,leave:void 0}:{enter:r.enter,leave:r.leave}}function BS(r){return Rn(r,WS)}const VS=80,WS={Name:{leave:r=>r.value},Variable:{leave:r=>"$"+r.name},Document:{leave:r=>je(r.definitions,`
|
|
51
|
+
spurious results.`)}}return!1};class km{constructor(e,t="GraphQL request",n={line:1,column:1}){typeof e=="string"||uu(!1,`Body must be a string. Received: ${kl(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||uu(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||uu(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function eE(r){return Xx(r,km)}function tE(r,e){const t=new rE(r,e),n=t.parseDocument();return Object.defineProperty(n,"tokenCount",{enumerable:!1,value:t.tokenCount}),n}let rE=class{constructor(e,t={}){const n=eE(e)?e:new km(e);this._lexer=new Fx(n),this._options=t,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const e=this.expectToken(de.NAME);return this.node(e,{kind:Re.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:Re.DOCUMENT,definitions:this.many(de.SOF,this.parseDefinition,de.EOF)})}parseDefinition(){if(this.peek(de.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===de.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw Cr(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(de.BRACE_L))return this.node(e,{kind:Re.OPERATION_DEFINITION,operation:Ws.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(de.NAME)&&(n=this.parseName()),this.node(e,{kind:Re.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(de.NAME);switch(e.value){case"query":return Ws.QUERY;case"mutation":return Ws.MUTATION;case"subscription":return Ws.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(de.PAREN_L,this.parseVariableDefinition,de.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Re.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(de.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(de.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(de.DOLLAR),this.node(e,{kind:Re.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:Re.SELECTION_SET,selections:this.many(de.BRACE_L,this.parseSelection,de.BRACE_R)})}parseSelection(){return this.peek(de.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,i;return this.expectOptionalToken(de.COLON)?(n=t,i=this.parseName()):i=t,this.node(e,{kind:Re.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(de.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(de.PAREN_L,t,de.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(de.COLON),this.node(t,{kind:Re.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(de.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(de.NAME)?this.node(e,{kind:Re.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Re.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:Re.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:Re.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case de.BRACKET_L:return this.parseList(e);case de.BRACE_L:return this.parseObject(e);case de.INT:return this.advanceLexer(),this.node(t,{kind:Re.INT,value:t.value});case de.FLOAT:return this.advanceLexer(),this.node(t,{kind:Re.FLOAT,value:t.value});case de.STRING:case de.BLOCK_STRING:return this.parseStringLiteral();case de.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:Re.BOOLEAN,value:!0});case"false":return this.node(t,{kind:Re.BOOLEAN,value:!1});case"null":return this.node(t,{kind:Re.NULL});default:return this.node(t,{kind:Re.ENUM,value:t.value})}case de.DOLLAR:if(e)if(this.expectToken(de.DOLLAR),this._lexer.token.kind===de.NAME){const n=this._lexer.token.value;throw Cr(this._lexer.source,t.start,`Unexpected variable "$${n}" in constant value.`)}else throw this.unexpected(t);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:Re.STRING,value:e.value,block:e.kind===de.BLOCK_STRING})}parseList(e){const t=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:Re.LIST,values:this.any(de.BRACKET_L,t,de.BRACKET_R)})}parseObject(e){const t=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:Re.OBJECT,fields:this.any(de.BRACE_L,t,de.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(de.COLON),this.node(t,{kind:Re.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(de.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(de.AT),this.node(t,{kind:Re.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(de.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(de.BRACKET_R),t=this.node(e,{kind:Re.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(de.BANG)?this.node(e,{kind:Re.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:Re.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(de.STRING)||this.peek(de.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(de.BRACE_L,this.parseOperationTypeDefinition,de.BRACE_R);return this.node(e,{kind:Re.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(de.COLON);const n=this.parseNamedType();return this.node(e,{kind:Re.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:Re.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),u=this.parseFieldsDefinition();return this.node(e,{kind:Re.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:a,fields:u})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(de.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(de.BRACE_L,this.parseFieldDefinition,de.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(de.COLON);const a=this.parseTypeReference(),u=this.parseConstDirectives();return this.node(e,{kind:Re.FIELD_DEFINITION,description:t,name:n,arguments:i,type:a,directives:u})}parseArgumentDefs(){return this.optionalMany(de.PAREN_L,this.parseInputValueDef,de.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(de.COLON);const i=this.parseTypeReference();let a;this.expectOptionalToken(de.EQUALS)&&(a=this.parseConstValueLiteral());const u=this.parseConstDirectives();return this.node(e,{kind:Re.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:a,directives:u})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),u=this.parseFieldsDefinition();return this.node(e,{kind:Re.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:a,fields:u})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseUnionMemberTypes();return this.node(e,{kind:Re.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:a})}parseUnionMemberTypes(){return this.expectOptionalToken(de.EQUALS)?this.delimitedMany(de.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseEnumValuesDefinition();return this.node(e,{kind:Re.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:a})}parseEnumValuesDefinition(){return this.optionalMany(de.BRACE_L,this.parseEnumValueDefinition,de.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:Re.ENUM_VALUE_DEFINITION,description:t,name:n,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw Cr(this._lexer.source,this._lexer.token.start,`${fu(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseInputFieldsDefinition();return this.node(e,{kind:Re.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:a})}parseInputFieldsDefinition(){return this.optionalMany(de.BRACE_L,this.parseInputValueDef,de.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===de.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(de.BRACE_L,this.parseOperationTypeDefinition,de.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:Re.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(n.length===0)throw this.unexpected();return this.node(e,{kind:Re.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:Re.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:a})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:Re.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:a})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Re.UNION_TYPE_EXTENSION,name:t,directives:n,types:i})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Re.ENUM_TYPE_EXTENSION,name:t,directives:n,values:i})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Re.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(de.AT);const n=this.parseName(),i=this.parseArgumentDefs(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const u=this.parseDirectiveLocations();return this.node(e,{kind:Re.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:a,locations:u})}parseDirectiveLocations(){return this.delimitedMany(de.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(El,t.value))return t;throw this.unexpected(e)}node(e,t){return this._options.noLocation!==!0&&(t.loc=new Cx(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw Cr(this._lexer.source,t.start,`Expected ${Am(e)}, found ${fu(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){const t=this._lexer.token;if(t.kind===de.NAME&&t.value===e)this.advanceLexer();else throw Cr(this._lexer.source,t.start,`Expected "${e}", found ${fu(t)}.`)}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===de.NAME&&t.value===e?(this.advanceLexer(),!0):!1}unexpected(e){const t=e??this._lexer.token;return Cr(this._lexer.source,t.start,`Unexpected ${fu(t)}.`)}any(e,t,n){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(n);)i.push(t.call(this));return i}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const i=[];do i.push(t.call(this));while(!this.expectOptionalToken(n));return i}return[]}many(e,t,n){this.expectToken(e);const i=[];do i.push(t.call(this));while(!this.expectOptionalToken(n));return i}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do n.push(t.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(t.kind!==de.EOF&&(++this._tokenCounter,e!==void 0&&this._tokenCounter>e))throw Cr(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};function fu(r){const e=r.value;return Am(r.kind)+(e!=null?` "${e}"`:"")}function Am(r){return Lx(r)?`"${r}"`:r}function nE(r){return`"${r.replace(iE,sE)}"`}const iE=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function sE(r){return aE[r.charCodeAt(0)]}const aE=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],hu=Object.freeze({});function on(r,e,t=bm){const n=new Map;for(const w of Object.values(Re))n.set(w,oE(e,w));let i,a=Array.isArray(r),u=[r],c=-1,f=[],h=r,p,m;const y=[],g=[];do{c++;const w=c===u.length,O=w&&f.length!==0;if(w){if(p=g.length===0?void 0:y[y.length-1],h=m,m=g.pop(),O)if(a){h=h.slice();let D=0;for(const[T,N]of f){const G=T-D;N===null?(h.splice(G,1),D++):h[G]=N}}else{h={...h};for(const[D,T]of f)h[D]=T}c=i.index,u=i.keys,f=i.edits,a=i.inArray,i=i.prev}else if(m){if(p=a?c:u[c],h=m[p],h==null)continue;y.push(p)}let P;if(!Array.isArray(h)){var b,I;wm(h)||uu(!1,`Invalid AST Node: ${kl(h)}.`);const D=w?(b=n.get(h.kind))===null||b===void 0?void 0:b.leave:(I=n.get(h.kind))===null||I===void 0?void 0:I.enter;if(P=D?.call(e,h,p,m,y,g),P===hu)break;if(P===!1){if(!w){y.pop();continue}}else if(P!==void 0&&(f.push([p,P]),!w))if(wm(P))h=P;else{y.pop();continue}}if(P===void 0&&O&&f.push([p,h]),w)y.pop();else{var S;i={inArray:a,index:c,keys:u,edits:f,prev:i},a=Array.isArray(h),u=a?h:(S=t[h.kind])!==null&&S!==void 0?S:[],c=-1,f=[],m&&g.push(m),m=h}}while(i!==void 0);return f.length!==0?f[f.length-1][1]:r}function oE(r,e){const t=r[e];return typeof t=="object"?t:typeof t=="function"?{enter:t,leave:void 0}:{enter:r.enter,leave:r.leave}}function uE(r){return on(r,lE)}const cE=80,lE={Name:{leave:r=>r.value},Variable:{leave:r=>"$"+r.name},Document:{leave:r=>qe(r.definitions,`
|
|
52
52
|
|
|
53
|
-
`)},OperationDefinition:{leave(r){const e=
|
|
54
|
-
`,
|
|
53
|
+
`)},OperationDefinition:{leave(r){const e=wt("(",qe(r.variableDefinitions,", "),")"),t=qe([r.operation,qe([r.name,e]),qe(r.directives," ")]," ");return(t==="query"?"":t+" ")+r.selectionSet}},VariableDefinition:{leave:({variable:r,type:e,defaultValue:t,directives:n})=>r+": "+e+wt(" = ",t)+wt(" ",qe(n," "))},SelectionSet:{leave:({selections:r})=>Gn(r)},Field:{leave({alias:r,name:e,arguments:t,directives:n,selectionSet:i}){const a=wt("",r,": ")+e;let u=a+wt("(",qe(t,", "),")");return u.length>cE&&(u=a+wt(`(
|
|
54
|
+
`,du(qe(t,`
|
|
55
55
|
`)),`
|
|
56
|
-
)`)),
|
|
57
|
-
`)+
|
|
58
|
-
`)+
|
|
59
|
-
`)+
|
|
60
|
-
`)+e+(
|
|
61
|
-
`,
|
|
56
|
+
)`)),qe([u,qe(n," "),i]," ")}},Argument:{leave:({name:r,value:e})=>r+": "+e},FragmentSpread:{leave:({name:r,directives:e})=>"..."+r+wt(" ",qe(e," "))},InlineFragment:{leave:({typeCondition:r,directives:e,selectionSet:t})=>qe(["...",wt("on ",r),qe(e," "),t]," ")},FragmentDefinition:{leave:({name:r,typeCondition:e,variableDefinitions:t,directives:n,selectionSet:i})=>`fragment ${r}${wt("(",qe(t,", "),")")} on ${e} ${wt("",qe(n," ")," ")}`+i},IntValue:{leave:({value:r})=>r},FloatValue:{leave:({value:r})=>r},StringValue:{leave:({value:r,block:e})=>e?Dx(r):nE(r)},BooleanValue:{leave:({value:r})=>r?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:r})=>r},ListValue:{leave:({values:r})=>"["+qe(r,", ")+"]"},ObjectValue:{leave:({fields:r})=>"{"+qe(r,", ")+"}"},ObjectField:{leave:({name:r,value:e})=>r+": "+e},Directive:{leave:({name:r,arguments:e})=>"@"+r+wt("(",qe(e,", "),")")},NamedType:{leave:({name:r})=>r},ListType:{leave:({type:r})=>"["+r+"]"},NonNullType:{leave:({type:r})=>r+"!"},SchemaDefinition:{leave:({description:r,directives:e,operationTypes:t})=>wt("",r,`
|
|
57
|
+
`)+qe(["schema",qe(e," "),Gn(t)]," ")},OperationTypeDefinition:{leave:({operation:r,type:e})=>r+": "+e},ScalarTypeDefinition:{leave:({description:r,name:e,directives:t})=>wt("",r,`
|
|
58
|
+
`)+qe(["scalar",e,qe(t," ")]," ")},ObjectTypeDefinition:{leave:({description:r,name:e,interfaces:t,directives:n,fields:i})=>wt("",r,`
|
|
59
|
+
`)+qe(["type",e,wt("implements ",qe(t," & ")),qe(n," "),Gn(i)]," ")},FieldDefinition:{leave:({description:r,name:e,arguments:t,type:n,directives:i})=>wt("",r,`
|
|
60
|
+
`)+e+(Im(t)?wt(`(
|
|
61
|
+
`,du(qe(t,`
|
|
62
62
|
`)),`
|
|
63
|
-
)`):
|
|
64
|
-
`)+
|
|
65
|
-
`)+
|
|
66
|
-
`)+
|
|
67
|
-
`)+
|
|
68
|
-
`)+
|
|
69
|
-
`)+
|
|
70
|
-
`)+"directive @"+e+(
|
|
71
|
-
`,
|
|
63
|
+
)`):wt("(",qe(t,", "),")"))+": "+n+wt(" ",qe(i," "))},InputValueDefinition:{leave:({description:r,name:e,type:t,defaultValue:n,directives:i})=>wt("",r,`
|
|
64
|
+
`)+qe([e+": "+t,wt("= ",n),qe(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:r,name:e,interfaces:t,directives:n,fields:i})=>wt("",r,`
|
|
65
|
+
`)+qe(["interface",e,wt("implements ",qe(t," & ")),qe(n," "),Gn(i)]," ")},UnionTypeDefinition:{leave:({description:r,name:e,directives:t,types:n})=>wt("",r,`
|
|
66
|
+
`)+qe(["union",e,qe(t," "),wt("= ",qe(n," | "))]," ")},EnumTypeDefinition:{leave:({description:r,name:e,directives:t,values:n})=>wt("",r,`
|
|
67
|
+
`)+qe(["enum",e,qe(t," "),Gn(n)]," ")},EnumValueDefinition:{leave:({description:r,name:e,directives:t})=>wt("",r,`
|
|
68
|
+
`)+qe([e,qe(t," ")]," ")},InputObjectTypeDefinition:{leave:({description:r,name:e,directives:t,fields:n})=>wt("",r,`
|
|
69
|
+
`)+qe(["input",e,qe(t," "),Gn(n)]," ")},DirectiveDefinition:{leave:({description:r,name:e,arguments:t,repeatable:n,locations:i})=>wt("",r,`
|
|
70
|
+
`)+"directive @"+e+(Im(t)?wt(`(
|
|
71
|
+
`,du(qe(t,`
|
|
72
72
|
`)),`
|
|
73
|
-
)`):
|
|
74
|
-
`,
|
|
73
|
+
)`):wt("(",qe(t,", "),")"))+(n?" repeatable":"")+" on "+qe(i," | ")},SchemaExtension:{leave:({directives:r,operationTypes:e})=>qe(["extend schema",qe(r," "),Gn(e)]," ")},ScalarTypeExtension:{leave:({name:r,directives:e})=>qe(["extend scalar",r,qe(e," ")]," ")},ObjectTypeExtension:{leave:({name:r,interfaces:e,directives:t,fields:n})=>qe(["extend type",r,wt("implements ",qe(e," & ")),qe(t," "),Gn(n)]," ")},InterfaceTypeExtension:{leave:({name:r,interfaces:e,directives:t,fields:n})=>qe(["extend interface",r,wt("implements ",qe(e," & ")),qe(t," "),Gn(n)]," ")},UnionTypeExtension:{leave:({name:r,directives:e,types:t})=>qe(["extend union",r,qe(e," "),wt("= ",qe(t," | "))]," ")},EnumTypeExtension:{leave:({name:r,directives:e,values:t})=>qe(["extend enum",r,qe(e," "),Gn(t)]," ")},InputObjectTypeExtension:{leave:({name:r,directives:e,fields:t})=>qe(["extend input",r,qe(e," "),Gn(t)]," ")}};function qe(r,e=""){var t;return(t=r?.filter(n=>n).join(e))!==null&&t!==void 0?t:""}function Gn(r){return wt(`{
|
|
74
|
+
`,du(qe(r,`
|
|
75
75
|
`)),`
|
|
76
|
-
}`)}function
|
|
77
|
-
`))}function
|
|
78
|
-
`)))!==null&&e!==void 0?e:!1}function bm(r){return r.kind===Fe.FIELD||r.kind===Fe.FRAGMENT_SPREAD||r.kind===Fe.INLINE_FRAGMENT}function Vs(r,e){var t=r.directives;return!t||!t.length?!0:_m(t).every(function(n){var i=n.directive,a=n.ifArgument,u=!1;return a.value.kind==="Variable"?(u=e&&e[a.value.name.value],qe(u!==void 0,70,i.name.value)):u=a.value.value,i.name.value==="skip"?!u:u})}function zS(r){var e=[];return Rn(r,{Directive:function(t){e.push(t.name.value)}}),e}var HS=function(r,e){return Ui(r,e,!1)},GS=function(r,e){return Ui(r,e,!0)};function Ui(r,e,t){var n=new Set(r),i=n.size;return Rn(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return Sl}}),t?!n.size:n.size<i}function wm(r){return r&&Ui(["client","export"],r,!0)}function QS(r){var e=r.name.value;return e==="skip"||e==="include"}function _m(r){var e=[];return r&&r.length&&r.forEach(function(t){if(QS(t)){var n=t.arguments,i=t.name.value;qe(n&&n.length===1,71,i);var a=n[0];qe(a.name&&a.name.value==="if",72,i);var u=a.value;qe(u&&(u.kind==="Variable"||u.kind==="BooleanValue"),73,i),e.push({directive:t,ifArgument:a})}}),e}const JS=()=>Object.create(null),{forEach:YS,slice:xm}=Array.prototype,{hasOwnProperty:KS}=Object.prototype;let Ws=class Xx{constructor(e=!0,t=JS){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return YS.call(e,n=>t=t.getChildTrie(n)),KS.call(t,"data")?t.data:t.data=this.makeData(xm.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let n=0,i=e.length;t&&n<i;++n){const a=t.mapFor(e[n],!1);t=a&&a.get(e[n])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){const n=e[0],i=this.mapFor(n,!1),a=i&&i.get(n);a&&(t=a.removeArray(xm.call(e,1)),!a.data&&!a.weak&&!(a.strong&&a.strong.size)&&i.delete(n))}else t=this.data,delete this.data;return t}getChildTrie(e){const t=this.mapFor(e,!0);let n=t.get(e);return n||t.set(e,n=new Xx(this.weakness,this.makeData)),n}mapFor(e,t){return this.weakness&&ZS(e)?this.weak||(t?this.weak=new WeakMap:void 0):this.strong||(t?this.strong=new Map:void 0)}};function ZS(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var Sm=Nn(function(){return navigator.product})=="ReactNative",gs=typeof WeakMap=="function"&&!(Sm&&!global.HermesInternal),El=typeof WeakSet=="function",ou=typeof Symbol=="function"&&typeof Symbol.for=="function",Va=ou&&Symbol.asyncIterator,Ol=typeof Nn(function(){return window.document.createElement})=="function",XS=Nn(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1,Em=(Ol||Sm)&&!XS;function er(r){return r!==null&&typeof r=="object"}function Om(r){return r!==null&&typeof r=="object"&&(Object.getPrototypeOf(r)===Object.prototype||Object.getPrototypeOf(r)===null)}function Tm(r,e){var t=e,n=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw Yr(74,a.operation,a.name?" named '".concat(a.name.value,"'"):"");a.kind==="FragmentDefinition"&&n.push(a)}),typeof t>"u"&&(qe(n.length===1,75,n.length),t=n[0].name.value);var i=L(L({},r),{definitions:wr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function Wa(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function za(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var n=e&&e[t];return qe(n,76,t),n||null}default:return null}}function eE(){}class Tl{constructor(e=1/0,t=eE){this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}get size(){return this.map.size}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:n,newer:i}=t;i&&(i.older=n),n&&(n.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){const t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1}}function Al(){}const tE=Al,rE=typeof WeakRef<"u"?WeakRef:function(r){return{deref:()=>r}},nE=typeof WeakMap<"u"?WeakMap:Map,iE=typeof FinalizationRegistry<"u"?FinalizationRegistry:function(){return{register:Al,unregister:Al}},sE=10024;class uu{constructor(e=1/0,t=tE){this.max=e,this.dispose=t,this.map=new nE,this.newest=null,this.oldest=null,this.unfinalizedNodes=new Set,this.finalizationScheduled=!1,this.size=0,this.finalize=()=>{const n=this.unfinalizedNodes.values();for(let i=0;i<sE;i++){const a=n.next().value;if(!a)break;this.unfinalizedNodes.delete(a);const u=a.key;delete a.key,a.keyRef=new rE(u),this.registry.register(u,a,a)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new iE(this.deleteNode.bind(this))}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:n,newer:i}=t;i&&(i.older=n),n&&(n.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.scheduleFinalization(n),this.map.set(e,n),this.size++,n.value)}clean(){for(;this.oldest&&this.size>this.max;)this.deleteNode(this.oldest)}deleteNode(e){e===this.newest&&(this.newest=e.older),e===this.oldest&&(this.oldest=e.newer),e.newer&&(e.newer.older=e.older),e.older&&(e.older.newer=e.newer),this.size--;const t=e.key||e.keyRef&&e.keyRef.deref();this.dispose(e.value,t),e.keyRef?this.registry.unregister(e):this.unfinalizedNodes.delete(e),t&&this.map.delete(t)}delete(e){const t=this.map.get(e);return t?(this.deleteNode(t),!0):!1}scheduleFinalization(e){this.unfinalizedNodes.add(e),this.finalizationScheduled||(this.finalizationScheduled=!0,queueMicrotask(this.finalize))}}var kl=new WeakSet;function Am(r){r.size<=(r.max||-1)||kl.has(r)||(kl.add(r),setTimeout(function(){r.clean(),kl.delete(r)},100))}var cu=function(r,e){var t=new uu(r,e);return t.set=function(n,i){var a=uu.prototype.set.call(this,n,i);return Am(this),a},t},km=function(r,e){var t=new Tl(r,e);return t.set=function(n,i){var a=Tl.prototype.set.call(this,n,i);return Am(this),a},t},aE=Symbol.for("apollo.cacheSize"),Yn=L({},dl[aE]),vs={};function Il(r,e){vs[r]=e}var oE=globalThis.__DEV__!==!1?fE:void 0,uE=globalThis.__DEV__!==!1?hE:void 0,cE=globalThis.__DEV__!==!1?Im:void 0;function lE(){var r={parser:1e3,canonicalStringify:1e3,print:2e3,"documentTransform.cache":2e3,"queryManager.getDocumentInfo":2e3,"PersistedQueryLink.persistedQueryHashes":2e3,"fragmentRegistry.transform":2e3,"fragmentRegistry.lookup":1e3,"fragmentRegistry.findFragmentSpreads":4e3,"cache.fragmentQueryDocuments":1e3,"removeTypenameFromVariables.getVariableDefinitions":2e3,"inMemoryCache.maybeBroadcastWatch":5e3,"inMemoryCache.executeSelectionSet":5e4,"inMemoryCache.executeSubSelectedArray":1e4};return Object.fromEntries(Object.entries(r).map(function(e){var t=e[0],n=e[1];return[t,Yn[t]||n]}))}function fE(){var r,e,t,n,i;if(globalThis.__DEV__===!1)throw new Error("only supported in development mode");return{limits:lE(),sizes:L({print:(r=vs.print)===null||r===void 0?void 0:r.call(vs),parser:(e=vs.parser)===null||e===void 0?void 0:e.call(vs),canonicalStringify:(t=vs.canonicalStringify)===null||t===void 0?void 0:t.call(vs),links:Pl(this.link),queryManager:{getDocumentInfo:this.queryManager.transformCache.size,documentTransforms:Pm(this.queryManager.documentTransform)}},(i=(n=this.cache).getMemoryInternals)===null||i===void 0?void 0:i.call(n))}}function Im(){return{cache:{fragmentQueryDocuments:$i(this.getFragmentDoc)}}}function hE(){var r=this.config.fragments;return L(L({},Im.apply(this)),{addTypenameDocumentTransform:Pm(this.addTypenameTransform),inMemoryCache:{executeSelectionSet:$i(this.storeReader.executeSelectionSet),executeSubSelectedArray:$i(this.storeReader.executeSubSelectedArray),maybeBroadcastWatch:$i(this.maybeBroadcastWatch)},fragmentRegistry:{findFragmentSpreads:$i(r==null?void 0:r.findFragmentSpreads),lookup:$i(r==null?void 0:r.lookup),transform:$i(r==null?void 0:r.transform)}})}function dE(r){return!!r&&"dirtyKey"in r}function $i(r){return dE(r)?r.size:void 0}function Cm(r){return r!=null}function Pm(r){return Cl(r).map(function(e){return{cache:e}})}function Cl(r){return r?wr(wr([$i(r==null?void 0:r.performWork)],Cl(r==null?void 0:r.left),!0),Cl(r==null?void 0:r.right),!0).filter(Cm):[]}function Pl(r){var e;return r?wr(wr([(e=r==null?void 0:r.getMemoryInternals)===null||e===void 0?void 0:e.call(r)],Pl(r==null?void 0:r.left),!0),Pl(r==null?void 0:r.right),!0).filter(Cm):[]}var mi=Object.assign(function(e){return JSON.stringify(e,pE)},{reset:function(){zs=new km(Yn.canonicalStringify||1e3)}});globalThis.__DEV__!==!1&&Il("canonicalStringify",function(){return zs.size});var zs;mi.reset();function pE(r,e){if(e&&typeof e=="object"){var t=Object.getPrototypeOf(e);if(t===Object.prototype||t===null){var n=Object.keys(e);if(n.every(mE))return e;var i=JSON.stringify(n),a=zs.get(i);if(!a){n.sort();var u=JSON.stringify(n);a=zs.get(u)||n,zs.set(i,a),zs.set(u,a)}var c=Object.create(t);return a.forEach(function(f){c[f]=e[f]}),c}}return e}function mE(r,e,t){return e===0||t[e-1]<=r}function Bi(r){return{__ref:String(r)}}function Nt(r){return!!(r&&typeof r=="object"&&typeof r.__ref=="string")}function Nm(r){return er(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function yE(r){return r.kind==="StringValue"}function gE(r){return r.kind==="BooleanValue"}function vE(r){return r.kind==="IntValue"}function bE(r){return r.kind==="FloatValue"}function wE(r){return r.kind==="Variable"}function _E(r){return r.kind==="ObjectValue"}function xE(r){return r.kind==="ListValue"}function SE(r){return r.kind==="EnumValue"}function EE(r){return r.kind==="NullValue"}function bs(r,e,t,n){if(vE(t)||bE(t))r[e.value]=Number(t.value);else if(gE(t)||yE(t))r[e.value]=t.value;else if(_E(t)){var i={};t.fields.map(function(u){return bs(i,u.name,u.value,n)}),r[e.value]=i}else if(wE(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(xE(t))r[e.value]=t.values.map(function(u){var c={};return bs(c,e,u,n),c[e.value]});else if(SE(t))r[e.value]=t.value;else if(EE(t))r[e.value]=null;else throw Yr(85,e.value,t.kind)}function Rm(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(i){t[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var u=a.name,c=a.value;return bs(t[i.name.value],u,c,e)})}));var n=null;return r.arguments&&r.arguments.length&&(n={},r.arguments.forEach(function(i){var a=i.name,u=i.value;return bs(n,a,u,e)})),Nl(r.name.value,n,t)}var OE=["connection","include","skip","client","rest","export","nonreactive"],Ha=mi,Nl=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var n=t.connection.filter?t.connection.filter:[];n.sort();var i={};return n.forEach(function(c){i[c]=e[c]}),"".concat(t.connection.key,"(").concat(Ha(i),")")}else return t.connection.key;var a=r;if(e){var u=Ha(e);a+="(".concat(u,")")}return t&&Object.keys(t).forEach(function(c){OE.indexOf(c)===-1&&(t[c]&&Object.keys(t[c]).length?a+="@".concat(c,"(").concat(Ha(t[c]),")"):a+="@".concat(c))}),a},{setStringify:function(r){var e=Ha;return Ha=r,e}});function Ga(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return bs(t,i,a,e)}),t}return null}function yi(r){return r.alias?r.alias.value:r.name.value}function lu(r,e,t){for(var n,i=0,a=e.selections;i<a.length;i++){var u=a[i];if(gi(u)){if(u.name.value==="__typename")return r[yi(u)]}else n?n.push(u):n=[u]}if(typeof r.__typename=="string")return r.__typename;if(n)for(var c=0,f=n;c<f.length;c++){var u=f[c],h=lu(r,za(u,t).selectionSet,t);if(typeof h=="string")return h}}function gi(r){return r.kind==="Field"}function Mm(r){return r.kind==="InlineFragment"}function ws(r){qe(r&&r.kind==="Document",77);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw Yr(78,t.kind);return t});return qe(e.length<=1,79,e.length),r}function _s(r){return ws(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function fu(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function Qa(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Rl(r){var e=_s(r);return qe(e&&e.operation==="query",80),e}function Dm(r){qe(r.kind==="Document",81),qe(r.definitions.length<=1,82);var e=r.definitions[0];return qe(e.kind==="FragmentDefinition",83),e}function Vi(r){ws(r);for(var e,t=0,n=r.definitions;t<n.length;t++){var i=n[t];if(i.kind==="OperationDefinition"){var a=i.operation;if(a==="query"||a==="mutation"||a==="subscription")return i}i.kind==="FragmentDefinition"&&!e&&(e=i)}if(e)return e;throw Yr(84)}function hu(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&bs(e,n.variable.name,n.defaultValue)}),e}const TE=()=>Object.create(null),{forEach:AE,slice:kE}=Array.prototype,{hasOwnProperty:IE}=Object.prototype;class Ml{constructor(e=!0,t=TE){this.weakness=e,this.makeData=t}lookup(...e){return this.lookupArray(e)}lookupArray(e){let t=this;return AE.call(e,n=>t=t.getChildTrie(n)),IE.call(t,"data")?t.data:t.data=this.makeData(kE.call(e))}peek(...e){return this.peekArray(e)}peekArray(e){let t=this;for(let n=0,i=e.length;t&&n<i;++n){const a=this.weakness&&Fm(e[n])?t.weak:t.strong;t=a&&a.get(e[n])}return t&&t.data}getChildTrie(e){const t=this.weakness&&Fm(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map);let n=t.get(e);return n||t.set(e,n=new Ml(this.weakness,this.makeData)),n}}function Fm(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}let jr=null;const Lm={};let CE=1;const PE=()=>class{constructor(){this.id=["slot",CE++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=jr;e;e=e.parent)if(this.id in e.slots){const t=e.slots[this.id];if(t===Lm)break;return e!==jr&&(jr.slots[this.id]=t),!0}return jr&&(jr.slots[this.id]=Lm),!1}getValue(){if(this.hasValue())return jr.slots[this.id]}withValue(e,t,n,i){const a={__proto__:null,[this.id]:e},u=jr;jr={parent:u,slots:a};try{return t.apply(i,n)}finally{jr=u}}static bind(e){const t=jr;return function(){const n=jr;try{return jr=t,e.apply(this,arguments)}finally{jr=n}}}static noContext(e,t,n){if(jr){const i=jr;try{return jr=null,e.apply(n,t)}finally{jr=i}}else return e.apply(n,t)}};function qm(r){try{return r()}catch{}}const Dl="@wry/context:Slot",jm=qm(()=>globalThis)||qm(()=>global)||Object.create(null),Um=jm[Dl]||Array[Dl]||function(r){try{Object.defineProperty(jm,Dl,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(PE()),du=new Um,{hasOwnProperty:NE}=Object.prototype,Fl=Array.from||function(r){const e=[];return r.forEach(t=>e.push(t)),e};function Ll(r){const{unsubscribe:e}=r;typeof e=="function"&&(r.unsubscribe=void 0,e())}const Ja=[],RE=100;function Hs(r,e){if(!r)throw new Error(e||"assertion failure")}function $m(r,e){const t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function Bm(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function Vm(r){return r.slice(0)}class pu{constructor(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++pu.count}peek(){if(this.value.length===1&&!Wi(this))return Wm(this),this.value[0]}recompute(e){return Hs(!this.recomputing,"already recomputing"),Wm(this),Wi(this)?ME(this,e):Bm(this.value)}setDirty(){this.dirty||(this.dirty=!0,zm(this),Ll(this))}dispose(){this.setDirty(),Ym(this),ql(this,(e,t)=>{e.setDirty(),Km(e,this)})}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=Ja.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(Fl(this.deps).forEach(e=>e.delete(this)),this.deps.clear(),Ja.push(this.deps),this.deps=null)}}pu.count=0;function Wm(r){const e=du.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Wi(r)?Gm(e,r):Qm(e,r),e}function ME(r,e){return Ym(r),du.withValue(r,DE,[r,e]),LE(r,e)&&FE(r),Bm(r.value)}function DE(r,e){r.recomputing=!0;const{normalizeResult:t}=r;let n;t&&r.value.length===1&&(n=Vm(r.value)),r.value.length=0;try{if(r.value[0]=r.fn.apply(null,e),t&&n&&!$m(n,r.value))try{r.value[0]=t(r.value[0],n[0])}catch{}}catch(i){r.value[1]=i}r.recomputing=!1}function Wi(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function FE(r){r.dirty=!1,!Wi(r)&&Hm(r)}function zm(r){ql(r,Gm)}function Hm(r){ql(r,Qm)}function ql(r,e){const t=r.parents.size;if(t){const n=Fl(r.parents);for(let i=0;i<t;++i)e(n[i],r)}}function Gm(r,e){Hs(r.childValues.has(e)),Hs(Wi(e));const t=!Wi(r);if(!r.dirtyChildren)r.dirtyChildren=Ja.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&zm(r)}function Qm(r,e){Hs(r.childValues.has(e)),Hs(!Wi(e));const t=r.childValues.get(e);t.length===0?r.childValues.set(e,Vm(e.value)):$m(t,e.value)||r.setDirty(),Jm(r,e),!Wi(r)&&Hm(r)}function Jm(r,e){const t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Ja.length<RE&&Ja.push(t),r.dirtyChildren=null))}function Ym(r){r.childValues.size>0&&r.childValues.forEach((e,t)=>{Km(r,t)}),r.forgetDeps(),Hs(r.dirtyChildren===null)}function Km(r,e){e.parents.delete(r),r.childValues.delete(e),Jm(r,e)}function LE(r,e){if(typeof r.subscribe=="function")try{Ll(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}const qE={setDirty:!0,dispose:!0,forget:!0};function Zm(r){const e=new Map;function t(n){const i=du.getValue();if(i){let a=e.get(n);a||e.set(n,a=new Set),i.dependOn(a)}}return t.dirty=function(i,a){const u=e.get(i);if(u){const c=a&&NE.call(qE,a)?a:"setDirty";Fl(u).forEach(f=>f[c]()),e.delete(i),Ll(u)}},t}let Xm;function jE(...r){return(Xm||(Xm=new Ml(typeof WeakMap=="function"))).lookupArray(r)}const jl=new Set;function Ya(r,{max:e=Math.pow(2,16),keyArgs:t,makeCacheKey:n=jE,normalizeResult:i,subscribe:a,cache:u=Tl}=Object.create(null)){const c=typeof u=="function"?new u(e,g=>g.dispose()):u,f=function(){const g=n.apply(null,t?t.apply(null,arguments):arguments);if(g===void 0)return r.apply(null,arguments);let m=c.get(g);m||(c.set(g,m=new pu(r)),m.normalizeResult=i,m.subscribe=a,m.forget=()=>c.delete(g));const b=m.recompute(Array.prototype.slice.call(arguments));return c.set(g,m),jl.add(c),du.hasValue()||(jl.forEach(I=>I.clean()),jl.clear()),b};Object.defineProperty(f,"size",{get:()=>c.size,configurable:!1,enumerable:!1}),Object.freeze(f.options={max:e,keyArgs:t,makeCacheKey:n,normalizeResult:i,subscribe:a,cache:c});function h(g){const m=g&&c.get(g);m&&m.setDirty()}f.dirtyKey=h,f.dirty=function(){h(n.apply(null,arguments))};function d(g){const m=g&&c.get(g);if(m)return m.peek()}f.peekKey=d,f.peek=function(){return d(n.apply(null,arguments))};function y(g){return g?c.delete(g):!1}return f.forgetKey=y,f.forget=function(){return y(n.apply(null,arguments))},f.makeCacheKey=n,f.getKey=t?function(){return n.apply(null,t.apply(null,arguments))}:n,Object.freeze(f)}function UE(r){return r}var mu=function(){function r(e,t){t===void 0&&(t=Object.create(null)),this.resultCache=El?new WeakSet:new Set,this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),this.cached=t.cache!==!1,this.resetCache()}return r.prototype.getCacheKey=function(e){return[e]},r.identity=function(){return new r(UE,{cache:!1})},r.split=function(e,t,n){return n===void 0&&(n=r.identity()),Object.assign(new r(function(i){var a=e(i)?t:n;return a.transformDocument(i)},{cache:!1}),{left:t,right:n})},r.prototype.resetCache=function(){var e=this;if(this.cached){var t=new Ws(gs);this.performWork=Ya(r.prototype.performWork.bind(this),{makeCacheKey:function(n){var i=e.getCacheKey(n);if(i)return qe(Array.isArray(i),69),t.lookupArray(i)},max:Yn["documentTransform.cache"],cache:uu})}},r.prototype.performWork=function(e){return ws(e),this.transform(e)},r.prototype.transformDocument=function(e){if(this.resultCache.has(e))return e;var t=this.performWork(e);return this.resultCache.add(t),t},r.prototype.concat=function(e){var t=this;return Object.assign(new r(function(n){return e.transformDocument(t.transformDocument(n))},{cache:!1}),{left:this,right:e})},r}(),Ka,Gs=Object.assign(function(r){var e=Ka.get(r);return e||(e=BS(r),Ka.set(r,e)),e},{reset:function(){Ka=new cu(Yn.print||2e3)}});Gs.reset(),globalThis.__DEV__!==!1&&Il("print",function(){return Ka?Ka.size:0});var ur=Array.isArray;function mn(r){return Array.isArray(r)&&r.length>0}var ey={kind:Fe.FIELD,name:{kind:Fe.NAME,value:"__typename"}};function ty(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Fe.FRAGMENT_SPREAD&&ty(e[t.name.value],e)})}function Ul(r){return ty(_s(r)||Dm(r),Wa(Qa(r)))?null:r}function $E(r){var e=new Map,t=new Map;return r.forEach(function(n){n&&(n.name?e.set(n.name,n):n.test&&t.set(n.test,n))}),function(n){var i=e.get(n.name.value);return!i&&t.size&&t.forEach(function(a,u){u(n)&&(i=a)}),i}}function ry(r){var e=new Map;return function(n){n===void 0&&(n=r);var i=e.get(n);return i||e.set(n,i={variables:new Set,fragmentSpreads:new Set}),i}}function yu(r,e){ws(e);for(var t=ry(""),n=ry(""),i=function(_){for(var A=0,P=void 0;A<_.length&&(P=_[A]);++A)if(!ur(P)){if(P.kind===Fe.OPERATION_DEFINITION)return t(P.name&&P.name.value);if(P.kind===Fe.FRAGMENT_DEFINITION)return n(P.name.value)}return globalThis.__DEV__!==!1&&qe.error(86),null},a=0,u=e.definitions.length-1;u>=0;--u)e.definitions[u].kind===Fe.OPERATION_DEFINITION&&++a;var c=$E(r),f=function(_){return mn(_)&&_.map(c).some(function(A){return A&&A.remove})},h=new Map,d=!1,y={enter:function(_){if(f(_.directives))return d=!0,null}},g=Rn(e,{Field:y,InlineFragment:y,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(_,A,P,M,$){var j=i($);j&&j.variables.add(_.name.value)}},FragmentSpread:{enter:function(_,A,P,M,$){if(f(_.directives))return d=!0,null;var j=i($);j&&j.fragmentSpreads.add(_.name.value)}},FragmentDefinition:{enter:function(_,A,P,M){h.set(JSON.stringify(M),_)},leave:function(_,A,P,M){var $=h.get(JSON.stringify(M));if(_===$)return _;if(a>0&&_.selectionSet.selections.every(function(j){return j.kind===Fe.FIELD&&j.name.value==="__typename"}))return n(_.name.value).removed=!0,d=!0,null}},Directive:{leave:function(_){if(c(_))return d=!0,null}}});if(!d)return e;var m=function(_){return _.transitiveVars||(_.transitiveVars=new Set(_.variables),_.removed||_.fragmentSpreads.forEach(function(A){m(n(A)).transitiveVars.forEach(function(P){_.transitiveVars.add(P)})})),_},b=new Set;g.definitions.forEach(function(_){_.kind===Fe.OPERATION_DEFINITION?m(t(_.name&&_.name.value)).fragmentSpreads.forEach(function(A){b.add(A)}):_.kind===Fe.FRAGMENT_DEFINITION&&a===0&&!n(_.name.value).removed&&b.add(_.name.value)}),b.forEach(function(_){m(n(_)).fragmentSpreads.forEach(function(A){b.add(A)})});var I=function(_){return!!(!b.has(_)||n(_).removed)},x={enter:function(_){if(I(_.name.value))return null}};return Ul(Rn(g,{FragmentSpread:x,FragmentDefinition:x,OperationDefinition:{leave:function(_){if(_.variableDefinitions){var A=m(t(_.name&&_.name.value)).transitiveVars;if(A.size<_.variableDefinitions.length)return L(L({},_),{variableDefinitions:_.variableDefinitions.filter(function(P){return A.has(P.variable.name.value)})})}}}}))}var gu=Object.assign(function(r){return Rn(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===Fe.OPERATION_DEFINITION)){var i=e.selections;if(i){var a=i.some(function(c){return gi(c)&&(c.name.value==="__typename"||c.name.value.lastIndexOf("__",0)===0)});if(!a){var u=n;if(!(gi(u)&&u.directives&&u.directives.some(function(c){return c.name.value==="export"})))return L(L({},e),{selections:wr(wr([],i,!0),[ey],!1)})}}}}}})},{added:function(r){return r===ey}}),BE={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&globalThis.__DEV__!==!1&&qe.warn(87),e}};function VE(r){return yu([BE],ws(r))}function WE(r){return function(t){return r.some(function(n){return t.value&&t.value.kind===Fe.VARIABLE&&t.value.name&&(n.name===t.value.name.value||n.test&&n.test(t))})}}function zE(r,e){var t=WE(r);return Ul(Rn(e,{OperationDefinition:{enter:function(n){return L(L({},n),{variableDefinitions:n.variableDefinitions?n.variableDefinitions.filter(function(i){return!r.some(function(a){return a.name===i.variable.name.value})}):[]})}},Field:{enter:function(n){var i=r.some(function(u){return u.remove});if(i){var a=0;if(n.arguments&&n.arguments.forEach(function(u){t(u)&&(a+=1)}),a===1)return null}}},Argument:{enter:function(n){if(t(n))return null}}}))}function HE(r,e){function t(n){if(r.some(function(i){return i.name===n.name.value}))return null}return Ul(Rn(e,{FragmentSpread:{enter:t},FragmentDefinition:{enter:t}}))}function ny(r){var e=Vi(r),t=e.operation;if(t==="query")return r;var n=Rn(r,{OperationDefinition:{enter:function(i){return L(L({},i),{operation:"query"})}}});return n}function $l(r){ws(r);var e=yu([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}function Bl(r,e){var t;return((t=_s(r))===null||t===void 0?void 0:t.operation)===e}function GE(r){return Bl(r,"mutation")}function QE(r){return Bl(r,"query")}function JE(r){return Bl(r,"subscription")}var YE=Object.prototype.hasOwnProperty;function Za(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Xa(r)}function Xa(r){var e=r[0]||{},t=r.length;if(t>1)for(var n=new vi,i=1;i<t;++i)e=n.merge(e,r[i]);return e}var KE=function(r,e,t){return this.merge(r[t],e[t])},vi=function(){function r(e){e===void 0&&(e=KE),this.reconciler=e,this.isObject=er,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return er(t)&&er(e)?(Object.keys(t).forEach(function(u){if(YE.call(e,u)){var c=e[u];if(t[u]!==c){var f=n.reconciler.apply(n,wr([e,t,u],i,!1));f!==c&&(e=n.shallowCopyForMerge(e),e[u]=f)}}else e=n.shallowCopyForMerge(e),e[u]=t[u]}),e):t},r.prototype.shallowCopyForMerge=function(e){return er(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=L({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function ZE(r){return r===void 0&&(r=!1),{keyArgs:r,merge:function(e,t){return e?wr(wr([],e,!0),t,!0):t}}}function XE(r){return r===void 0&&(r=!1),{keyArgs:r,merge:function(e,t,n){var i=n.args,a=e?e.slice(0):[];if(t)if(i)for(var u=i.offset,c=u===void 0?0:u,f=0;f<t.length;++f)a[c+f]=t[f];else a.push.apply(a,t);return a}}}function eO(r){return r===void 0&&(r=!1),{keyArgs:r,read:function(e,t){var n=t.canRead,i=t.readField;if(!e)return e;var a=[],u="",c="";e.edges.forEach(function(y){n(i("node",y))&&(a.push(y),y.cursor&&(u=u||y.cursor||"",c=y.cursor||c))}),a.length>1&&u===c&&(u="");var f=e.pageInfo||{},h=f.startCursor,d=f.endCursor;return L(L({},Vl(e)),{edges:a,pageInfo:L(L({},e.pageInfo),{startCursor:h||u,endCursor:d||c})})},merge:function(e,t,n){var i=n.args,a=n.isReference,u=n.readField;if(e||(e=rO()),!t)return e;var c=t.edges?t.edges.map(function(ee){return a(ee=L({},ee))&&(ee.cursor=u("cursor",ee)),ee}):[];if(t.pageInfo){var f=t.pageInfo,h=f.startCursor,d=f.endCursor,y=c[0],g=c[c.length-1];y&&h&&(y.cursor=h),g&&d&&(g.cursor=d);var m=y&&y.cursor;m&&!h&&(t=Za(t,{pageInfo:{startCursor:m}}));var b=g&&g.cursor;b&&!d&&(t=Za(t,{pageInfo:{endCursor:b}}))}var I=e.edges,x=[];if(i&&i.after){var _=I.findIndex(function(ee){return ee.cursor===i.after});_>=0&&(I=I.slice(0,_+1))}else if(i&&i.before){var _=I.findIndex(function(fe){return fe.cursor===i.before});x=_<0?I:I.slice(_),I=[]}else t.edges&&(I=[]);var A=wr(wr(wr([],I,!0),c,!0),x,!0),P=L(L({},t.pageInfo),e.pageInfo);if(t.pageInfo){var M=t.pageInfo,$=M.hasPreviousPage,j=M.hasNextPage,h=M.startCursor,d=M.endCursor,K=on(M,["hasPreviousPage","hasNextPage","startCursor","endCursor"]);Object.assign(P,K),I.length||($!==void 0&&(P.hasPreviousPage=$),h!==void 0&&(P.startCursor=h)),x.length||(j!==void 0&&(P.hasNextPage=j),d!==void 0&&(P.endCursor=d))}return L(L(L({},Vl(e)),Vl(t)),{edges:A,pageInfo:P})}}}var Vl=function(r){return on(r,tO)},tO=["edges","pageInfo"];function rO(){return{edges:[],pageInfo:{hasPreviousPage:!1,hasNextPage:!0,startCursor:"",endCursor:""}}}function nO(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=iO(r))||e){t&&(r=t);var n=0;return function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
79
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iO(r,e){if(r){if(typeof r=="string")return iy(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return iy(r,e)}}function iy(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function sy(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function Wl(r,e,t){return e&&sy(r.prototype,e),t&&sy(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var zl=function(){return typeof Symbol=="function"},Hl=function(r){return zl()&&!!Symbol[r]},Gl=function(r){return Hl(r)?Symbol[r]:"@@"+r};zl()&&!Hl("observable")&&(Symbol.observable=Symbol("observable"));var sO=Gl("iterator"),Ql=Gl("observable"),ay=Gl("species");function vu(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function eo(r){var e=r.constructor;return e!==void 0&&(e=e[ay],e===null&&(e=void 0)),e!==void 0?e:Rt}function aO(r){return r instanceof Rt}function Qs(r){Qs.log?Qs.log(r):setTimeout(function(){throw r})}function bu(r){Promise.resolve().then(function(){try{r()}catch(e){Qs(e)}})}function oy(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=vu(e,"unsubscribe");t&&t.call(e)}}catch(n){Qs(n)}}function Jl(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function oO(r){var e=r._queue;if(e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(uy(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function uy(r,e,t){r._state="running";var n=r._observer;try{var i=vu(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(Jl(r),i)i.call(n,t);else throw t;break;case"complete":Jl(r),i&&i.call(n);break}}catch(a){Qs(a)}r._state==="closed"?oy(r):r._state==="running"&&(r._state="ready")}function Yl(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],bu(function(){return oO(r)});return}uy(r,e,t)}}var uO=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new cO(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(Jl(this),oy(this))},Wl(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),cO=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){Yl(this._subscription,"next",n)},e.error=function(n){Yl(this._subscription,"error",n)},e.complete=function(){Yl(this._subscription,"complete")},Wl(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),Rt=function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new uO(n,this._subscriber)},e.forEach=function(n){var i=this;return new Promise(function(a,u){if(typeof n!="function"){u(new TypeError(n+" is not a function"));return}function c(){f.unsubscribe(),a()}var f=i.subscribe({next:function(h){try{n(h,c)}catch(d){u(d),f.unsubscribe()}},error:u,complete:a})})},e.map=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=eo(this);return new a(function(u){return i.subscribe({next:function(c){try{c=n(c)}catch(f){return u.error(f)}u.next(c)},error:function(c){u.error(c)},complete:function(){u.complete()}})})},e.filter=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=eo(this);return new a(function(u){return i.subscribe({next:function(c){try{if(!n(c))return}catch(f){return u.error(f)}u.next(c)},error:function(c){u.error(c)},complete:function(){u.complete()}})})},e.reduce=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=eo(this),u=arguments.length>1,c=!1,f=arguments[1],h=f;return new a(function(d){return i.subscribe({next:function(y){var g=!c;if(c=!0,!g||u)try{h=n(h,y)}catch(m){return d.error(m)}else h=y},error:function(y){d.error(y)},complete:function(){if(!c&&!u)return d.error(new TypeError("Cannot reduce an empty sequence"));d.next(h),d.complete()}})})},e.concat=function(){for(var n=this,i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];var c=eo(this);return new c(function(f){var h,d=0;function y(g){h=g.subscribe({next:function(m){f.next(m)},error:function(m){f.error(m)},complete:function(){d===a.length?(h=void 0,f.complete()):y(c.from(a[d++]))}})}return y(n),function(){h&&(h.unsubscribe(),h=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=eo(this);return new a(function(u){var c=[],f=i.subscribe({next:function(d){if(n)try{d=n(d)}catch(g){return u.error(g)}var y=a.from(d).subscribe({next:function(g){u.next(g)},error:function(g){u.error(g)},complete:function(){var g=c.indexOf(y);g>=0&&c.splice(g,1),h()}});c.push(y)},error:function(d){u.error(d)},complete:function(){h()}});function h(){f.closed&&c.length===0&&u.complete()}return function(){c.forEach(function(d){return d.unsubscribe()}),f.unsubscribe()}})},e[Ql]=function(){return this},r.from=function(n){var i=typeof this=="function"?this:r;if(n==null)throw new TypeError(n+" is not an object");var a=vu(n,Ql);if(a){var u=a.call(n);if(Object(u)!==u)throw new TypeError(u+" is not an object");return aO(u)&&u.constructor===i?u:new i(function(c){return u.subscribe(c)})}if(Hl("iterator")&&(a=vu(n,sO),a))return new i(function(c){bu(function(){if(!c.closed){for(var f=nO(a.call(n)),h;!(h=f()).done;){var d=h.value;if(c.next(d),c.closed)return}c.complete()}})});if(Array.isArray(n))return new i(function(c){bu(function(){if(!c.closed){for(var f=0;f<n.length;++f)if(c.next(n[f]),c.closed)return;c.complete()}})});throw new TypeError(n+" is not observable")},r.of=function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var u=typeof this=="function"?this:r;return new u(function(c){bu(function(){if(!c.closed){for(var f=0;f<i.length;++f)if(c.next(i[f]),c.closed)return;c.complete()}})})},Wl(r,null,[{key:ay,get:function(){return this}}]),r}();zl()&&Object.defineProperty(Rt,Symbol("extensions"),{value:{symbol:Ql,hostReportError:Qs},configurable:!0});function lO(r){var e=Promise.resolve(r);return e.status="fulfilled",e.value=r,e}function fO(r){var e=Promise.reject(r);return e.catch(function(){}),e.status="rejected",e.reason=r,e}function cy(r){return"status"in r}function hO(r){if(cy(r))return r;var e=r;return e.status="pending",e.then(function(t){if(e.status==="pending"){var n=e;n.status="fulfilled",n.value=t}},function(t){if(e.status==="pending"){var n=e;n.status="rejected",n.reason=t}}),r}var dO=Object.prototype.toString;function Kl(r){return Zl(r)}function Zl(r,e){switch(dO.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(i,a){t[a]=Zl(i,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var n=Object.create(Object.getPrototypeOf(r));return e.set(r,n),Object.keys(r).forEach(function(i){n[i]=Zl(r[i],e)}),n}default:return r}}function pO(r){var e=new Set([r]);return e.forEach(function(t){er(t)&&mO(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){er(t[n])&&e.add(t[n])})}),r}function mO(r){if(globalThis.__DEV__!==!1&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function Js(r){return globalThis.__DEV__!==!1&&pO(r),r}function Ys(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function wu(r,e,t){return new Rt(function(n){var i={then:function(f){return new Promise(function(h){return h(f())})}};function a(f,h){return function(d){if(f){var y=function(){return n.closed?0:f(d)};i=i.then(y,y).then(function(g){return n.next(g)},function(g){return n.error(g)})}else n[h](d)}}var u={next:a(e,"next"),error:a(t,"error"),complete:function(){i.then(function(){return n.complete()})}},c=r.subscribe(u);return function(){return c.unsubscribe()}})}function Xl(r){function e(t){Object.defineProperty(r,t,{value:Rt})}return ou&&Symbol.species&&e(Symbol.species),e("@@species"),r}function ly(r){return r&&typeof r.then=="function"}var xs=function(r){Pn(e,r);function e(t){var n=r.call(this,function(i){return n.addObserver(i),function(){return n.removeObserver(i)}})||this;return n.observers=new Set,n.promise=new Promise(function(i,a){n.resolve=i,n.reject=a}),n.handlers={next:function(i){n.sub!==null&&(n.latest=["next",i],n.notify("next",i),Ys(n.observers,"next",i))},error:function(i){var a=n.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest=["error",i],n.reject(i),n.notify("error",i),Ys(n.observers,"error",i))},complete:function(){var i=n,a=i.sub,u=i.sources,c=u===void 0?[]:u;if(a!==null){var f=c.shift();f?ly(f)?f.then(function(h){return n.sub=h.subscribe(n.handlers)},n.handlers.error):n.sub=f.subscribe(n.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest&&n.latest[0]==="next"?n.resolve(n.latest[1]):n.resolve(),n.notify("complete"),Ys(n.observers,"complete"))}}},n.nextResultListeners=new Set,n.cancel=function(i){n.reject(i),n.sources=[],n.handlers.error(i)},n.promise.catch(function(i){}),typeof t=="function"&&(t=[new Rt(t)]),ly(t)?t.then(function(i){return n.start(i)},n.handlers.error):n.start(t),n}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var n=this.latest[0],i=t[n];i&&i.call(t,this.latest[1]),this.sub===null&&n==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,n){var i=this.nextResultListeners;i.size&&(this.nextResultListeners=new Set,i.forEach(function(a){return a(t,n)}))},e.prototype.beforeNext=function(t){var n=!1;this.nextResultListeners.add(function(i,a){n||(n=!0,t(i,a))})},e}(Rt);Xl(xs);function Ss(r){return"incremental"in r}function fy(r){return"hasNext"in r&&"data"in r}function hy(r){return Ss(r)||fy(r)}function dy(r){return er(r)&&"payload"in r}function ef(r,e){var t=r,n=new vi;return Ss(e)&&mn(e.incremental)&&e.incremental.forEach(function(i){for(var a=i.data,u=i.path,c=u.length-1;c>=0;--c){var f=u[c],h=!isNaN(+f),d=h?[]:{};d[f]=a,a=d}t=n.merge(t,a)}),t}function to(r){var e=_u(r);return mn(e)}function _u(r){var e=mn(r.errors)?r.errors.slice(0):[];return Ss(r)&&mn(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function zi(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(n){n&&Object.keys(n).forEach(function(i){var a=n[i];a!==void 0&&(t[i]=a)})}),t}function Hi(r,e){return zi(r,e,e.variables&&{variables:zi(L(L({},r&&r.variables),e.variables))})}function py(r,e){return tf(r,e)}function tf(r,e,t){if(t===void 0&&(t=new Map),t.has(r))return t.get(r);var n=!1;if(Array.isArray(r)){var i=[];if(t.set(r,i),r.forEach(function(u,c){var f=tf(u,e,t);n||(n=f!==u),i[c]=f}),n)return i}else if(Om(r)){var a=Object.create(Object.getPrototypeOf(r));if(t.set(r,a),Object.keys(r).forEach(function(u){if(u===e){n=!0;return}var c=tf(r[u],e,t);n||(n=c!==r[u]),a[u]=c}),n)return a}return r}function yO(r){return py(r,"__typename")}const gO=Object.freeze(Object.defineProperty({__proto__:null,AutoCleanedStrongCache:km,AutoCleanedWeakCache:cu,Concast:xs,DEV:iS,DeepMerger:vi,DocumentTransform:mu,Observable:Rt,addTypenameToDocument:gu,argumentsObjectFromField:Ga,asyncMap:wu,buildQueryFromSelectionSet:ny,cacheSizes:Yn,canUseAsyncIteratorSymbol:Va,canUseDOM:Ol,canUseLayoutEffect:Em,canUseSymbol:ou,canUseWeakMap:gs,canUseWeakSet:El,canonicalStringify:mi,checkDocument:ws,cloneDeep:Kl,compact:zi,concatPagination:ZE,createFragmentMap:Wa,createFulfilledPromise:lO,createRejectedPromise:fO,fixObservableSubclass:Xl,getDefaultValues:hu,getDirectiveNames:zS,getFragmentDefinition:Dm,getFragmentDefinitions:Qa,getFragmentFromSelection:za,getFragmentQueryDocument:Tm,getGraphQLErrorsFromResult:_u,getInclusionDirectives:_m,getMainDefinition:Vi,getOperationDefinition:_s,getOperationName:fu,getQueryDefinition:Rl,getStoreKeyName:Nl,getTypenameFromResult:lu,graphQLResultHasError:to,hasAllDirectives:GS,hasAnyDirectives:HS,hasClientExports:wm,hasDirectives:Ui,isApolloPayloadResult:dy,isArray:ur,isDocumentNode:Nm,isExecutionPatchIncrementalResult:Ss,isExecutionPatchInitialResult:fy,isExecutionPatchResult:hy,isField:gi,isInlineFragment:Mm,isMutationOperation:GE,isNonEmptyArray:mn,isNonNullObject:er,isPlainObject:Om,isQueryOperation:QE,isReference:Nt,isStatefulPromise:cy,isSubscriptionOperation:JE,iterateObserversSafely:Ys,makeReference:Bi,makeUniqueId:eu,maybe:Nn,maybeDeepFreeze:Js,mergeDeep:Za,mergeDeepArray:Xa,mergeIncrementalData:ef,mergeOptions:Hi,offsetLimitPagination:XE,omitDeep:py,print:Gs,relayStylePagination:eO,removeArgumentsFromDocument:zE,removeClientSetsFromDocument:$l,removeConnectionDirectiveFromDocument:VE,removeDirectivesFromDocument:yu,removeFragmentSpreadFromDocument:HE,resultKeyNameFromField:yi,shouldInclude:Vs,storeKeyNameFromField:Rm,stringifyForDisplay:pl,stripTypename:yO,valueToObjectRepresentation:bs,wrapPromiseWithState:hO},Symbol.toStringTag,{value:"Module"}));function xu(r){return new Rt(function(e){e.error(r)})}function vO(r){var e=!1;return new Promise(function(t,n){r.subscribe({next:function(i){e?globalThis.__DEV__!==!1&&qe.warn(43):(e=!0,t(i))},error:n})})}function bO(r){return new Rt(function(e){r.then(function(t){e.next(t),e.complete()}).catch(e.error.bind(e))})}var rf=function(r,e,t){var n=new Error(t);throw n.name="ServerError",n.response=r,n.statusCode=r.status,n.result=e,n};function wO(r){for(var e=["query","operationName","variables","extensions","context"],t=0,n=Object.keys(r);t<n.length;t++){var i=n[t];if(e.indexOf(i)<0)throw Yr(44,i)}return r}function _O(r,e){var t=L({},r),n=function(a){typeof a=="function"?t=L(L({},t),a(t)):t=L(L({},t),a)},i=function(){return L({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function xO(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?fu(e.query)||void 0:""),e}function SO(r,e){var t=L({},r),n=new Set(Object.keys(r));return Rn(e,{Variable:function(i,a,u){u&&u.kind!=="VariableDefinition"&&n.delete(i.name.value)}}),n.forEach(function(i){delete t[i]}),t}function my(r,e){return e?e(r):Rt.of()}function ro(r){return typeof r=="function"?new Kr(r):r}function Su(r){return r.request.length<=1}var Kr=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return Rt.of()})},r.from=function(e){return e.length===0?r.empty():e.map(ro).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=ro(t),a=ro(n||new r(my)),u;return Su(i)&&Su(a)?u=new r(function(c){return e(c)?i.request(c)||Rt.of():a.request(c)||Rt.of()}):u=new r(function(c,f){return e(c)?i.request(c,f)||Rt.of():a.request(c,f)||Rt.of()}),Object.assign(u,{left:i,right:a})},r.execute=function(e,t){return e.request(_O(t.context,xO(wO(t))))||Rt.of()},r.concat=function(e,t){var n=ro(e);if(Su(n))return globalThis.__DEV__!==!1&&qe.warn(36,n),n;var i=ro(t),a;return Su(i)?a=new r(function(u){return n.request(u,function(c){return i.request(c)||Rt.of()})||Rt.of()}):a=new r(function(u,c){return n.request(u,function(f){return i.request(f,c)||Rt.of()})||Rt.of()}),Object.assign(a,{left:n,right:i})},r.prototype.split=function(e,t,n){return this.concat(r.split(e,t,n||new r(my)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw Yr(37)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}(),EO=Kr.empty,OO=Kr.from,TO=Kr.split,AO=Kr.concat,Eu=Kr.execute;function kO(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function IO(r){var e=null,t=null,n=!1,i=[],a=[];function u(y){if(!t){if(a.length){var g=a.shift();if(Array.isArray(g)&&g[0])return g[0]({value:y,done:!1})}i.push(y)}}function c(y){t=y;var g=a.slice();g.forEach(function(m){m[1](y)}),!e||e()}function f(){n=!0;var y=a.slice();y.forEach(function(g){g[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",u),r.removeListener("error",c),r.removeListener("end",f),r.removeListener("finish",f),r.removeListener("close",f)},r.on("data",u),r.on("error",c),r.on("end",f),r.on("finish",f),r.on("close",f);function h(){return new Promise(function(y,g){if(t)return g(t);if(i.length)return y({value:i.shift(),done:!1});if(n)return y({value:void 0,done:!0});a.push([y,g])})}var d={next:function(){return h()}};return Va&&(d[Symbol.asyncIterator]=function(){return this}),d}function CO(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(n,i){r.then(function(a){n({value:a,done:!1})}).catch(i)}))}};return Va&&(t[Symbol.asyncIterator]=function(){return this}),t}function yy(r){var e={next:function(){return r.read()}};return Va&&(e[Symbol.asyncIterator]=function(){return this}),e}function PO(r){return!!r.body}function NO(r){return!!r.getReader}function RO(r){return!!(Va&&r[Symbol.asyncIterator])}function MO(r){return!!r.stream}function DO(r){return!!r.arrayBuffer}function FO(r){return!!r.pipe}function LO(r){var e=r;if(PO(r)&&(e=r.body),RO(e))return kO(e);if(NO(e))return yy(e.getReader());if(MO(e))return yy(e.stream().getReader());if(DO(e))return CO(e.arrayBuffer());if(FO(e))return IO(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var nf=Symbol();function qO(r){return r.extensions?Array.isArray(r.extensions[nf]):!1}function sf(r){return r.hasOwnProperty("graphQLErrors")}var jO=function(r){var e=wr(wr(wr([],r.graphQLErrors,!0),r.clientErrors,!0),r.protocolErrors,!0);return r.networkError&&e.push(r.networkError),e.map(function(t){return er(t)&&t.message||"Error message not found."}).join(`
|
|
80
|
-
`)},
|
|
81
|
-
--`.concat(a),c="",f=
|
|
76
|
+
}`)}function wt(r,e,t=""){return e!=null&&e!==""?r+e+t:""}function du(r){return wt(" ",r.replace(/\n/g,`
|
|
77
|
+
`))}function Im(r){var e;return(e=r?.some(t=>t.includes(`
|
|
78
|
+
`)))!==null&&e!==void 0?e:!1}function Cm(r){return r.kind===Re.FIELD||r.kind===Re.FRAGMENT_SPREAD||r.kind===Re.INLINE_FRAGMENT}function Hs(r,e){var t=r.directives;return!t||!t.length?!0:Nm(t).every(function(n){var i=n.directive,a=n.ifArgument,u=!1;return a.value.kind==="Variable"?(u=e&&e[a.value.name.value],Ie(u!==void 0,78,i.name.value)):u=a.value.value,i.name.value==="skip"?!u:u})}function fE(r){var e=[];return on(r,{Directive:function(t){e.push(t.name.value)}}),e}var hE=function(r,e){return $i(r,e,!1)},dE=function(r,e){return $i(r,e,!0)};function $i(r,e,t){var n=new Set(r),i=n.size;return on(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return hu}}),t?!n.size:n.size<i}function Pm(r){return r&&$i(["client","export"],r,!0)}function pE(r){var e=r.name.value;return e==="skip"||e==="include"}function Nm(r){var e=[];return r&&r.length&&r.forEach(function(t){if(pE(t)){var n=t.arguments,i=t.name.value;Ie(n&&n.length===1,79,i);var a=n[0];Ie(a.name&&a.name.value==="if",80,i);var u=a.value;Ie(u&&(u.kind==="Variable"||u.kind==="BooleanValue"),81,i),e.push({directive:t,ifArgument:a})}}),e}function Rm(r){var e,t,n=(e=r.directives)===null||e===void 0?void 0:e.find(function(a){var u=a.name;return u.value==="unmask"});if(!n)return"mask";var i=(t=n.arguments)===null||t===void 0?void 0:t.find(function(a){var u=a.name;return u.value==="mode"});return globalThis.__DEV__!==!1&&i&&(i.value.kind===Re.VARIABLE?globalThis.__DEV__!==!1&&Ie.warn(82):i.value.kind!==Re.STRING?globalThis.__DEV__!==!1&&Ie.warn(83):i.value.value!=="migrate"&&globalThis.__DEV__!==!1&&Ie.warn(84,i.value.value)),i&&"value"in i.value&&i.value.value==="migrate"?"migrate":"unmask"}const mE=()=>Object.create(null),{forEach:yE,slice:Mm}=Array.prototype,{hasOwnProperty:gE}=Object.prototype;let Gs=class vx{constructor(e=!0,t=mE){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return yE.call(e,n=>t=t.getChildTrie(n)),gE.call(t,"data")?t.data:t.data=this.makeData(Mm.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let n=0,i=e.length;t&&n<i;++n){const a=t.mapFor(e[n],!1);t=a&&a.get(e[n])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){const n=e[0],i=this.mapFor(n,!1),a=i&&i.get(n);a&&(t=a.removeArray(Mm.call(e,1)),!a.data&&!a.weak&&!(a.strong&&a.strong.size)&&i.delete(n))}else t=this.data,delete this.data;return t}getChildTrie(e){const t=this.mapFor(e,!0);let n=t.get(e);return n||t.set(e,n=new vx(this.weakness,this.makeData)),n}mapFor(e,t){return this.weakness&&vE(e)?this.weak||(t?this.weak=new WeakMap:void 0):this.strong||(t?this.strong=new Map:void 0)}};function vE(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var Dm=Cn(function(){return navigator.product})=="ReactNative",Bi=typeof WeakMap=="function"&&!(Dm&&!global.HermesInternal),pu=typeof WeakSet=="function",mu=typeof Symbol=="function"&&typeof Symbol.for=="function",Ha=mu&&Symbol.asyncIterator,Al=typeof Cn(function(){return window.document.createElement})=="function",bE=Cn(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1,Fm=(Al||Dm)&&!bE;function Zt(r){return r!==null&&typeof r=="object"}function Lm(r){return r!==null&&typeof r=="object"&&(Object.getPrototypeOf(r)===Object.prototype||Object.getPrototypeOf(r)===null)}function qm(r,e){var t=e,n=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw Jr(85,a.operation,a.name?" named '".concat(a.name.value,"'"):"");a.kind==="FragmentDefinition"&&n.push(a)}),typeof t>"u"&&(Ie(n.length===1,86,n.length),t=n[0].name.value);var i=F(F({},r),{definitions:lr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function _s(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function Ga(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var n=e&&e[t];return Ie(n,87,t),n||null}default:return null}}function jm(r){var e=!0;return on(r,{FragmentSpread:function(t){if(e=!!t.directives&&t.directives.some(function(n){return n.name.value==="unmask"}),!e)return hu}}),e}function wE(){}class Il{constructor(e=1/0,t=wE){this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}get size(){return this.map.size}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:n,newer:i}=t;i&&(i.older=n),n&&(n.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){const t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1}}function Cl(){}const _E=Cl,SE=typeof WeakRef<"u"?WeakRef:function(r){return{deref:()=>r}},xE=typeof WeakMap<"u"?WeakMap:Map,EE=typeof FinalizationRegistry<"u"?FinalizationRegistry:function(){return{register:Cl,unregister:Cl}},OE=10024;class yu{constructor(e=1/0,t=_E){this.max=e,this.dispose=t,this.map=new xE,this.newest=null,this.oldest=null,this.unfinalizedNodes=new Set,this.finalizationScheduled=!1,this.size=0,this.finalize=()=>{const n=this.unfinalizedNodes.values();for(let i=0;i<OE;i++){const a=n.next().value;if(!a)break;this.unfinalizedNodes.delete(a);const u=a.key;delete a.key,a.keyRef=new SE(u),this.registry.register(u,a,a)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new EE(this.deleteNode.bind(this))}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:n,newer:i}=t;i&&(i.older=n),n&&(n.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.scheduleFinalization(n),this.map.set(e,n),this.size++,n.value)}clean(){for(;this.oldest&&this.size>this.max;)this.deleteNode(this.oldest)}deleteNode(e){e===this.newest&&(this.newest=e.older),e===this.oldest&&(this.oldest=e.newer),e.newer&&(e.newer.older=e.older),e.older&&(e.older.newer=e.newer),this.size--;const t=e.key||e.keyRef&&e.keyRef.deref();this.dispose(e.value,t),e.keyRef?this.registry.unregister(e):this.unfinalizedNodes.delete(e),t&&this.map.delete(t)}delete(e){const t=this.map.get(e);return t?(this.deleteNode(t),!0):!1}scheduleFinalization(e){this.unfinalizedNodes.add(e),this.finalizationScheduled||(this.finalizationScheduled=!0,queueMicrotask(this.finalize))}}var Pl=new WeakSet;function Um(r){r.size<=(r.max||-1)||Pl.has(r)||(Pl.add(r),setTimeout(function(){r.clean(),Pl.delete(r)},100))}var gu=function(r,e){var t=new yu(r,e);return t.set=function(n,i){var a=yu.prototype.set.call(this,n,i);return Um(this),a},t},$m=function(r,e){var t=new Il(r,e);return t.set=function(n,i){var a=Il.prototype.set.call(this,n,i);return Um(this),a},t},TE=Symbol.for("apollo.cacheSize"),Qn=F({},vl[TE]),Ss={};function Nl(r,e){Ss[r]=e}var kE=globalThis.__DEV__!==!1?PE:void 0,AE=globalThis.__DEV__!==!1?NE:void 0,IE=globalThis.__DEV__!==!1?Bm:void 0;function CE(){var r={parser:1e3,canonicalStringify:1e3,print:2e3,"documentTransform.cache":2e3,"queryManager.getDocumentInfo":2e3,"PersistedQueryLink.persistedQueryHashes":2e3,"fragmentRegistry.transform":2e3,"fragmentRegistry.lookup":1e3,"fragmentRegistry.findFragmentSpreads":4e3,"cache.fragmentQueryDocuments":1e3,"removeTypenameFromVariables.getVariableDefinitions":2e3,"inMemoryCache.maybeBroadcastWatch":5e3,"inMemoryCache.executeSelectionSet":5e4,"inMemoryCache.executeSubSelectedArray":1e4};return Object.fromEntries(Object.entries(r).map(function(e){var t=e[0],n=e[1];return[t,Qn[t]||n]}))}function PE(){var r,e,t,n,i;if(globalThis.__DEV__===!1)throw new Error("only supported in development mode");return{limits:CE(),sizes:F({print:(r=Ss.print)===null||r===void 0?void 0:r.call(Ss),parser:(e=Ss.parser)===null||e===void 0?void 0:e.call(Ss),canonicalStringify:(t=Ss.canonicalStringify)===null||t===void 0?void 0:t.call(Ss),links:Ml(this.link),queryManager:{getDocumentInfo:this.queryManager.transformCache.size,documentTransforms:Wm(this.queryManager.documentTransform)}},(i=(n=this.cache).getMemoryInternals)===null||i===void 0?void 0:i.call(n))}}function Bm(){return{cache:{fragmentQueryDocuments:Vi(this.getFragmentDoc)}}}function NE(){var r=this.config.fragments;return F(F({},Bm.apply(this)),{addTypenameDocumentTransform:Wm(this.addTypenameTransform),inMemoryCache:{executeSelectionSet:Vi(this.storeReader.executeSelectionSet),executeSubSelectedArray:Vi(this.storeReader.executeSubSelectedArray),maybeBroadcastWatch:Vi(this.maybeBroadcastWatch)},fragmentRegistry:{findFragmentSpreads:Vi(r?.findFragmentSpreads),lookup:Vi(r?.lookup),transform:Vi(r?.transform)}})}function RE(r){return!!r&&"dirtyKey"in r}function Vi(r){return RE(r)?r.size:void 0}function Vm(r){return r!=null}function Wm(r){return Rl(r).map(function(e){return{cache:e}})}function Rl(r){return r?lr(lr([Vi(r?.performWork)],Rl(r?.left),!0),Rl(r?.right),!0).filter(Vm):[]}function Ml(r){var e;return r?lr(lr([(e=r?.getMemoryInternals)===null||e===void 0?void 0:e.call(r)],Ml(r?.left),!0),Ml(r?.right),!0).filter(Vm):[]}var pi=Object.assign(function(e){return JSON.stringify(e,ME)},{reset:function(){Qs=new $m(Qn.canonicalStringify||1e3)}});globalThis.__DEV__!==!1&&Nl("canonicalStringify",function(){return Qs.size});var Qs;pi.reset();function ME(r,e){if(e&&typeof e=="object"){var t=Object.getPrototypeOf(e);if(t===Object.prototype||t===null){var n=Object.keys(e);if(n.every(DE))return e;var i=JSON.stringify(n),a=Qs.get(i);if(!a){n.sort();var u=JSON.stringify(n);a=Qs.get(u)||n,Qs.set(i,a),Qs.set(u,a)}var c=Object.create(t);return a.forEach(function(f){c[f]=e[f]}),c}}return e}function DE(r,e,t){return e===0||t[e-1]<=r}function Wi(r){return{__ref:String(r)}}function Ct(r){return!!(r&&typeof r=="object"&&typeof r.__ref=="string")}function zm(r){return Zt(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function FE(r){return r.kind==="StringValue"}function LE(r){return r.kind==="BooleanValue"}function qE(r){return r.kind==="IntValue"}function jE(r){return r.kind==="FloatValue"}function UE(r){return r.kind==="Variable"}function $E(r){return r.kind==="ObjectValue"}function BE(r){return r.kind==="ListValue"}function VE(r){return r.kind==="EnumValue"}function WE(r){return r.kind==="NullValue"}function xs(r,e,t,n){if(qE(t)||jE(t))r[e.value]=Number(t.value);else if(LE(t)||FE(t))r[e.value]=t.value;else if($E(t)){var i={};t.fields.map(function(u){return xs(i,u.name,u.value,n)}),r[e.value]=i}else if(UE(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(BE(t))r[e.value]=t.values.map(function(u){var c={};return xs(c,e,u,n),c[e.value]});else if(VE(t))r[e.value]=t.value;else if(WE(t))r[e.value]=null;else throw Jr(96,e.value,t.kind)}function Hm(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(i){t[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var u=a.name,c=a.value;return xs(t[i.name.value],u,c,e)})}));var n=null;return r.arguments&&r.arguments.length&&(n={},r.arguments.forEach(function(i){var a=i.name,u=i.value;return xs(n,a,u,e)})),Dl(r.name.value,n,t)}var zE=["connection","include","skip","client","rest","export","nonreactive"],Qa=pi,Dl=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var n=t.connection.filter?t.connection.filter:[];n.sort();var i={};return n.forEach(function(c){i[c]=e[c]}),"".concat(t.connection.key,"(").concat(Qa(i),")")}else return t.connection.key;var a=r;if(e){var u=Qa(e);a+="(".concat(u,")")}return t&&Object.keys(t).forEach(function(c){zE.indexOf(c)===-1&&(t[c]&&Object.keys(t[c]).length?a+="@".concat(c,"(").concat(Qa(t[c]),")"):a+="@".concat(c))}),a},{setStringify:function(r){var e=Qa;return Qa=r,e}});function Ja(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return xs(t,i,a,e)}),t}return null}function ai(r){return r.alias?r.alias.value:r.name.value}function vu(r,e,t){for(var n,i=0,a=e.selections;i<a.length;i++){var u=a[i];if(mi(u)){if(u.name.value==="__typename")return r[ai(u)]}else n?n.push(u):n=[u]}if(typeof r.__typename=="string")return r.__typename;if(n)for(var c=0,f=n;c<f.length;c++){var u=f[c],h=vu(r,Ga(u,t).selectionSet,t);if(typeof h=="string")return h}}function mi(r){return r.kind==="Field"}function Gm(r){return r.kind==="InlineFragment"}function zi(r){Ie(r&&r.kind==="Document",88);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw Jr(89,t.kind);return t});return Ie(e.length<=1,90,e.length),r}function yi(r){return zi(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Js(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function Es(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Fl(r){var e=yi(r);return Ie(e&&e.operation==="query",91),e}function Ll(r){Ie(r.kind==="Document",92),Ie(r.definitions.length<=1,93);var e=r.definitions[0];return Ie(e.kind==="FragmentDefinition",94),e}function Hi(r){zi(r);for(var e,t=0,n=r.definitions;t<n.length;t++){var i=n[t];if(i.kind==="OperationDefinition"){var a=i.operation;if(a==="query"||a==="mutation"||a==="subscription")return i}i.kind==="FragmentDefinition"&&!e&&(e=i)}if(e)return e;throw Jr(95)}function bu(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&xs(e,n.variable.name,n.defaultValue)}),e}const HE=()=>Object.create(null),{forEach:GE,slice:QE}=Array.prototype,{hasOwnProperty:JE}=Object.prototype;class ql{constructor(e=!0,t=HE){this.weakness=e,this.makeData=t}lookup(...e){return this.lookupArray(e)}lookupArray(e){let t=this;return GE.call(e,n=>t=t.getChildTrie(n)),JE.call(t,"data")?t.data:t.data=this.makeData(QE.call(e))}peek(...e){return this.peekArray(e)}peekArray(e){let t=this;for(let n=0,i=e.length;t&&n<i;++n){const a=this.weakness&&Qm(e[n])?t.weak:t.strong;t=a&&a.get(e[n])}return t&&t.data}getChildTrie(e){const t=this.weakness&&Qm(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map);let n=t.get(e);return n||t.set(e,n=new ql(this.weakness,this.makeData)),n}}function Qm(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}let Lr=null;const Jm={};let YE=1;const KE=()=>class{constructor(){this.id=["slot",YE++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Lr;e;e=e.parent)if(this.id in e.slots){const t=e.slots[this.id];if(t===Jm)break;return e!==Lr&&(Lr.slots[this.id]=t),!0}return Lr&&(Lr.slots[this.id]=Jm),!1}getValue(){if(this.hasValue())return Lr.slots[this.id]}withValue(e,t,n,i){const a={__proto__:null,[this.id]:e},u=Lr;Lr={parent:u,slots:a};try{return t.apply(i,n)}finally{Lr=u}}static bind(e){const t=Lr;return function(){const n=Lr;try{return Lr=t,e.apply(this,arguments)}finally{Lr=n}}}static noContext(e,t,n){if(Lr){const i=Lr;try{return Lr=null,e.apply(n,t)}finally{Lr=i}}else return e.apply(n,t)}};function Ym(r){try{return r()}catch{}}const jl="@wry/context:Slot",Km=Ym(()=>globalThis)||Ym(()=>global)||Object.create(null),Ya=Km[jl]||Array[jl]||function(r){try{Object.defineProperty(Km,jl,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(KE()),{bind:y6,noContext:g6}=Ya,wu=new Ya,{hasOwnProperty:ZE}=Object.prototype,Ul=Array.from||function(r){const e=[];return r.forEach(t=>e.push(t)),e};function $l(r){const{unsubscribe:e}=r;typeof e=="function"&&(r.unsubscribe=void 0,e())}const Ka=[],XE=100;function Ys(r,e){if(!r)throw new Error(e||"assertion failure")}function Zm(r,e){const t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function Xm(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function ey(r){return r.slice(0)}class _u{constructor(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++_u.count}peek(){if(this.value.length===1&&!Gi(this))return ty(this),this.value[0]}recompute(e){return Ys(!this.recomputing,"already recomputing"),ty(this),Gi(this)?e1(this,e):Xm(this.value)}setDirty(){this.dirty||(this.dirty=!0,ry(this),$l(this))}dispose(){this.setDirty(),oy(this),Bl(this,(e,t)=>{e.setDirty(),uy(e,this)})}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=Ka.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(Ul(this.deps).forEach(e=>e.delete(this)),this.deps.clear(),Ka.push(this.deps),this.deps=null)}}_u.count=0;function ty(r){const e=wu.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Gi(r)?iy(e,r):sy(e,r),e}function e1(r,e){return oy(r),wu.withValue(r,t1,[r,e]),n1(r,e)&&r1(r),Xm(r.value)}function t1(r,e){r.recomputing=!0;const{normalizeResult:t}=r;let n;t&&r.value.length===1&&(n=ey(r.value)),r.value.length=0;try{if(r.value[0]=r.fn.apply(null,e),t&&n&&!Zm(n,r.value))try{r.value[0]=t(r.value[0],n[0])}catch{}}catch(i){r.value[1]=i}r.recomputing=!1}function Gi(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function r1(r){r.dirty=!1,!Gi(r)&&ny(r)}function ry(r){Bl(r,iy)}function ny(r){Bl(r,sy)}function Bl(r,e){const t=r.parents.size;if(t){const n=Ul(r.parents);for(let i=0;i<t;++i)e(n[i],r)}}function iy(r,e){Ys(r.childValues.has(e)),Ys(Gi(e));const t=!Gi(r);if(!r.dirtyChildren)r.dirtyChildren=Ka.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&ry(r)}function sy(r,e){Ys(r.childValues.has(e)),Ys(!Gi(e));const t=r.childValues.get(e);t.length===0?r.childValues.set(e,ey(e.value)):Zm(t,e.value)||r.setDirty(),ay(r,e),!Gi(r)&&ny(r)}function ay(r,e){const t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Ka.length<XE&&Ka.push(t),r.dirtyChildren=null))}function oy(r){r.childValues.size>0&&r.childValues.forEach((e,t)=>{uy(r,t)}),r.forgetDeps(),Ys(r.dirtyChildren===null)}function uy(r,e){e.parents.delete(r),r.childValues.delete(e),ay(r,e)}function n1(r,e){if(typeof r.subscribe=="function")try{$l(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}const i1={setDirty:!0,dispose:!0,forget:!0};function cy(r){const e=new Map;function t(n){const i=wu.getValue();if(i){let a=e.get(n);a||e.set(n,a=new Set),i.dependOn(a)}}return t.dirty=function(i,a){const u=e.get(i);if(u){const c=a&&ZE.call(i1,a)?a:"setDirty";Ul(u).forEach(f=>f[c]()),e.delete(i),$l(u)}},t}let ly;function s1(...r){return(ly||(ly=new ql(typeof WeakMap=="function"))).lookupArray(r)}const Vl=new Set;function Za(r,{max:e=Math.pow(2,16),keyArgs:t,makeCacheKey:n=s1,normalizeResult:i,subscribe:a,cache:u=Il}=Object.create(null)){const c=typeof u=="function"?new u(e,y=>y.dispose()):u,f=function(){const y=n.apply(null,t?t.apply(null,arguments):arguments);if(y===void 0)return r.apply(null,arguments);let g=c.get(y);g||(c.set(y,g=new _u(r)),g.normalizeResult=i,g.subscribe=a,g.forget=()=>c.delete(y));const b=g.recompute(Array.prototype.slice.call(arguments));return c.set(y,g),Vl.add(c),wu.hasValue()||(Vl.forEach(I=>I.clean()),Vl.clear()),b};Object.defineProperty(f,"size",{get:()=>c.size,configurable:!1,enumerable:!1}),Object.freeze(f.options={max:e,keyArgs:t,makeCacheKey:n,normalizeResult:i,subscribe:a,cache:c});function h(y){const g=y&&c.get(y);g&&g.setDirty()}f.dirtyKey=h,f.dirty=function(){h(n.apply(null,arguments))};function p(y){const g=y&&c.get(y);if(g)return g.peek()}f.peekKey=p,f.peek=function(){return p(n.apply(null,arguments))};function m(y){return y?c.delete(y):!1}return f.forgetKey=m,f.forget=function(){return m(n.apply(null,arguments))},f.makeCacheKey=n,f.getKey=t?function(){return n.apply(null,t.apply(null,arguments))}:n,Object.freeze(f)}function a1(r){return r}var Su=function(){function r(e,t){t===void 0&&(t=Object.create(null)),this.resultCache=pu?new WeakSet:new Set,this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),this.cached=t.cache!==!1,this.resetCache()}return r.prototype.getCacheKey=function(e){return[e]},r.identity=function(){return new r(a1,{cache:!1})},r.split=function(e,t,n){return n===void 0&&(n=r.identity()),Object.assign(new r(function(i){var a=e(i)?t:n;return a.transformDocument(i)},{cache:!1}),{left:t,right:n})},r.prototype.resetCache=function(){var e=this;if(this.cached){var t=new Gs(Bi);this.performWork=Za(r.prototype.performWork.bind(this),{makeCacheKey:function(n){var i=e.getCacheKey(n);if(i)return Ie(Array.isArray(i),77),t.lookupArray(i)},max:Qn["documentTransform.cache"],cache:yu})}},r.prototype.performWork=function(e){return zi(e),this.transform(e)},r.prototype.transformDocument=function(e){if(this.resultCache.has(e))return e;var t=this.performWork(e);return this.resultCache.add(t),t},r.prototype.concat=function(e){var t=this;return Object.assign(new r(function(n){return e.transformDocument(t.transformDocument(n))},{cache:!1}),{left:this,right:e})},r}(),Xa,gi=Object.assign(function(r){var e=Xa.get(r);return e||(e=uE(r),Xa.set(r,e)),e},{reset:function(){Xa=new gu(Qn.print||2e3)}});gi.reset(),globalThis.__DEV__!==!1&&Nl("print",function(){return Xa?Xa.size:0});var or=Array.isArray;function pn(r){return Array.isArray(r)&&r.length>0}var fy={kind:Re.FIELD,name:{kind:Re.NAME,value:"__typename"}};function hy(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Re.FRAGMENT_SPREAD&&hy(e[t.name.value],e)})}function Wl(r){return hy(yi(r)||Ll(r),_s(Es(r)))?null:r}function o1(r){var e=new Map,t=new Map;return r.forEach(function(n){n&&(n.name?e.set(n.name,n):n.test&&t.set(n.test,n))}),function(n){var i=e.get(n.name.value);return!i&&t.size&&t.forEach(function(a,u){u(n)&&(i=a)}),i}}function dy(r){var e=new Map;return function(n){n===void 0&&(n=r);var i=e.get(n);return i||e.set(n,i={variables:new Set,fragmentSpreads:new Set}),i}}function xu(r,e){zi(e);for(var t=dy(""),n=dy(""),i=function(w){for(var O=0,P=void 0;O<w.length&&(P=w[O]);++O)if(!or(P)){if(P.kind===Re.OPERATION_DEFINITION)return t(P.name&&P.name.value);if(P.kind===Re.FRAGMENT_DEFINITION)return n(P.name.value)}return globalThis.__DEV__!==!1&&Ie.error(97),null},a=0,u=e.definitions.length-1;u>=0;--u)e.definitions[u].kind===Re.OPERATION_DEFINITION&&++a;var c=o1(r),f=function(w){return pn(w)&&w.map(c).some(function(O){return O&&O.remove})},h=new Map,p=!1,m={enter:function(w){if(f(w.directives))return p=!0,null}},y=on(e,{Field:m,InlineFragment:m,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(w,O,P,D,T){var N=i(T);N&&N.variables.add(w.name.value)}},FragmentSpread:{enter:function(w,O,P,D,T){if(f(w.directives))return p=!0,null;var N=i(T);N&&N.fragmentSpreads.add(w.name.value)}},FragmentDefinition:{enter:function(w,O,P,D){h.set(JSON.stringify(D),w)},leave:function(w,O,P,D){var T=h.get(JSON.stringify(D));if(w===T)return w;if(a>0&&w.selectionSet.selections.every(function(N){return N.kind===Re.FIELD&&N.name.value==="__typename"}))return n(w.name.value).removed=!0,p=!0,null}},Directive:{leave:function(w){if(c(w))return p=!0,null}}});if(!p)return e;var g=function(w){return w.transitiveVars||(w.transitiveVars=new Set(w.variables),w.removed||w.fragmentSpreads.forEach(function(O){g(n(O)).transitiveVars.forEach(function(P){w.transitiveVars.add(P)})})),w},b=new Set;y.definitions.forEach(function(w){w.kind===Re.OPERATION_DEFINITION?g(t(w.name&&w.name.value)).fragmentSpreads.forEach(function(O){b.add(O)}):w.kind===Re.FRAGMENT_DEFINITION&&a===0&&!n(w.name.value).removed&&b.add(w.name.value)}),b.forEach(function(w){g(n(w)).fragmentSpreads.forEach(function(O){b.add(O)})});var I=function(w){return!!(!b.has(w)||n(w).removed)},S={enter:function(w){if(I(w.name.value))return null}};return Wl(on(y,{FragmentSpread:S,FragmentDefinition:S,OperationDefinition:{leave:function(w){if(w.variableDefinitions){var O=g(t(w.name&&w.name.value)).transitiveVars;if(O.size<w.variableDefinitions.length)return F(F({},w),{variableDefinitions:w.variableDefinitions.filter(function(P){return O.has(P.variable.name.value)})})}}}}))}var Eu=Object.assign(function(r){return on(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===Re.OPERATION_DEFINITION)){var i=e.selections;if(i){var a=i.some(function(c){return mi(c)&&(c.name.value==="__typename"||c.name.value.lastIndexOf("__",0)===0)});if(!a){var u=n;if(!(mi(u)&&u.directives&&u.directives.some(function(c){return c.name.value==="export"})))return F(F({},e),{selections:lr(lr([],i,!0),[fy],!1)})}}}}}})},{added:function(r){return r===fy}}),u1={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&globalThis.__DEV__!==!1&&Ie.warn(98),e}};function c1(r){return xu([u1],zi(r))}function l1(r){return function(t){return r.some(function(n){return t.value&&t.value.kind===Re.VARIABLE&&t.value.name&&(n.name===t.value.name.value||n.test&&n.test(t))})}}function f1(r,e){var t=l1(r);return Wl(on(e,{OperationDefinition:{enter:function(n){return F(F({},n),{variableDefinitions:n.variableDefinitions?n.variableDefinitions.filter(function(i){return!r.some(function(a){return a.name===i.variable.name.value})}):[]})}},Field:{enter:function(n){var i=r.some(function(u){return u.remove});if(i){var a=0;if(n.arguments&&n.arguments.forEach(function(u){t(u)&&(a+=1)}),a===1)return null}}},Argument:{enter:function(n){if(t(n))return null}}}))}function h1(r,e){function t(n){if(r.some(function(i){return i.name===n.name.value}))return null}return Wl(on(e,{FragmentSpread:{enter:t},FragmentDefinition:{enter:t}}))}function py(r){var e=Hi(r),t=e.operation;if(t==="query")return r;var n=on(r,{OperationDefinition:{enter:function(i){return F(F({},i),{operation:"query"})}}});return n}function zl(r){zi(r);var e=xu([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}function my(r){return zi(r),on(r,{FragmentSpread:function(e){var t;if(!(!((t=e.directives)===null||t===void 0)&&t.some(function(n){return n.name.value==="unmask"})))return F(F({},e),{directives:lr(lr([],e.directives||[],!0),[{kind:Re.DIRECTIVE,name:{kind:Re.NAME,value:"nonreactive"}}],!1)})}})}function Hl(r,e){var t;return((t=yi(r))===null||t===void 0?void 0:t.operation)===e}function d1(r){return Hl(r,"mutation")}function p1(r){return Hl(r,"query")}function m1(r){return Hl(r,"subscription")}var y1=Object.prototype.hasOwnProperty;function eo(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return to(r)}function to(r){var e=r[0]||{},t=r.length;if(t>1)for(var n=new vi,i=1;i<t;++i)e=n.merge(e,r[i]);return e}var g1=function(r,e,t){return this.merge(r[t],e[t])},vi=function(){function r(e){e===void 0&&(e=g1),this.reconciler=e,this.isObject=Zt,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return Zt(t)&&Zt(e)?(Object.keys(t).forEach(function(u){if(y1.call(e,u)){var c=e[u];if(t[u]!==c){var f=n.reconciler.apply(n,lr([e,t,u],i,!1));f!==c&&(e=n.shallowCopyForMerge(e),e[u]=f)}}else e=n.shallowCopyForMerge(e),e[u]=t[u]}),e):t},r.prototype.shallowCopyForMerge=function(e){return Zt(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=F({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function v1(r){return r===void 0&&(r=!1),{keyArgs:r,merge:function(e,t){return e?lr(lr([],e,!0),t,!0):t}}}function b1(r){return r===void 0&&(r=!1),{keyArgs:r,merge:function(e,t,n){var i=n.args,a=e?e.slice(0):[];if(t)if(i)for(var u=i.offset,c=u===void 0?0:u,f=0;f<t.length;++f)a[c+f]=t[f];else a.push.apply(a,t);return a}}}function w1(r){return r===void 0&&(r=!1),{keyArgs:r,read:function(e,t){var n=t.canRead,i=t.readField;if(!e)return e;var a=[],u="",c="";e.edges.forEach(function(m){n(i("node",m))&&(a.push(m),m.cursor&&(u=u||m.cursor||"",c=m.cursor||c))}),a.length>1&&u===c&&(u="");var f=e.pageInfo||{},h=f.startCursor,p=f.endCursor;return F(F({},Gl(e)),{edges:a,pageInfo:F(F({},e.pageInfo),{startCursor:h||u,endCursor:p||c})})},merge:function(e,t,n){var i=n.args,a=n.isReference,u=n.readField;if(e||(e=S1()),!t)return e;var c=t.edges?t.edges.map(function(q){return a(q=F({},q))&&(q.cursor=u("cursor",q)),q}):[];if(t.pageInfo){var f=t.pageInfo,h=f.startCursor,p=f.endCursor,m=c[0],y=c[c.length-1];m&&h&&(m.cursor=h),y&&p&&(y.cursor=p);var g=m&&m.cursor;g&&!h&&(t=eo(t,{pageInfo:{startCursor:g}}));var b=y&&y.cursor;b&&!p&&(t=eo(t,{pageInfo:{endCursor:b}}))}var I=e.edges,S=[];if(i&&i.after){var w=I.findIndex(function(q){return q.cursor===i.after});w>=0&&(I=I.slice(0,w+1))}else if(i&&i.before){var w=I.findIndex(function($){return $.cursor===i.before});S=w<0?I:I.slice(w),I=[]}else t.edges&&(I=[]);var O=lr(lr(lr([],I,!0),c,!0),S,!0),P=F(F({},t.pageInfo),e.pageInfo);if(t.pageInfo){var D=t.pageInfo,T=D.hasPreviousPage,N=D.hasNextPage,h=D.startCursor,p=D.endCursor,G=an(D,["hasPreviousPage","hasNextPage","startCursor","endCursor"]);Object.assign(P,G),I.length||(T!==void 0&&(P.hasPreviousPage=T),h!==void 0&&(P.startCursor=h)),S.length||(N!==void 0&&(P.hasNextPage=N),p!==void 0&&(P.endCursor=p))}return F(F(F({},Gl(e)),Gl(t)),{edges:O,pageInfo:P})}}}var Gl=function(r){return an(r,_1)},_1=["edges","pageInfo"];function S1(){return{edges:[],pageInfo:{hasPreviousPage:!1,hasNextPage:!0,startCursor:"",endCursor:""}}}function x1(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=E1(r))||e){t&&(r=t);var n=0;return function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
79
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E1(r,e){if(r){if(typeof r=="string")return yy(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return yy(r,e)}}function yy(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function gy(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function Ql(r,e,t){return e&&gy(r.prototype,e),t&&gy(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var Jl=function(){return typeof Symbol=="function"},Yl=function(r){return Jl()&&!!Symbol[r]},Kl=function(r){return Yl(r)?Symbol[r]:"@@"+r};Jl()&&!Yl("observable")&&(Symbol.observable=Symbol("observable"));var O1=Kl("iterator"),Zl=Kl("observable"),vy=Kl("species");function Ou(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function ro(r){var e=r.constructor;return e!==void 0&&(e=e[vy],e===null&&(e=void 0)),e!==void 0?e:Pt}function T1(r){return r instanceof Pt}function Ks(r){Ks.log?Ks.log(r):setTimeout(function(){throw r})}function Tu(r){Promise.resolve().then(function(){try{r()}catch(e){Ks(e)}})}function by(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=Ou(e,"unsubscribe");t&&t.call(e)}}catch(n){Ks(n)}}function Xl(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function k1(r){var e=r._queue;if(e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(wy(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function wy(r,e,t){r._state="running";var n=r._observer;try{var i=Ou(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(Xl(r),i)i.call(n,t);else throw t;break;case"complete":Xl(r),i&&i.call(n);break}}catch(a){Ks(a)}r._state==="closed"?by(r):r._state==="running"&&(r._state="ready")}function ef(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],Tu(function(){return k1(r)});return}wy(r,e,t)}}var A1=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new I1(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(Xl(this),by(this))},Ql(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),I1=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){ef(this._subscription,"next",n)},e.error=function(n){ef(this._subscription,"error",n)},e.complete=function(){ef(this._subscription,"complete")},Ql(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),Pt=function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new A1(n,this._subscriber)},e.forEach=function(n){var i=this;return new Promise(function(a,u){if(typeof n!="function"){u(new TypeError(n+" is not a function"));return}function c(){f.unsubscribe(),a()}var f=i.subscribe({next:function(h){try{n(h,c)}catch(p){u(p),f.unsubscribe()}},error:u,complete:a})})},e.map=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=ro(this);return new a(function(u){return i.subscribe({next:function(c){try{c=n(c)}catch(f){return u.error(f)}u.next(c)},error:function(c){u.error(c)},complete:function(){u.complete()}})})},e.filter=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=ro(this);return new a(function(u){return i.subscribe({next:function(c){try{if(!n(c))return}catch(f){return u.error(f)}u.next(c)},error:function(c){u.error(c)},complete:function(){u.complete()}})})},e.reduce=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=ro(this),u=arguments.length>1,c=!1,f=arguments[1],h=f;return new a(function(p){return i.subscribe({next:function(m){var y=!c;if(c=!0,!y||u)try{h=n(h,m)}catch(g){return p.error(g)}else h=m},error:function(m){p.error(m)},complete:function(){if(!c&&!u)return p.error(new TypeError("Cannot reduce an empty sequence"));p.next(h),p.complete()}})})},e.concat=function(){for(var n=this,i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];var c=ro(this);return new c(function(f){var h,p=0;function m(y){h=y.subscribe({next:function(g){f.next(g)},error:function(g){f.error(g)},complete:function(){p===a.length?(h=void 0,f.complete()):m(c.from(a[p++]))}})}return m(n),function(){h&&(h.unsubscribe(),h=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=ro(this);return new a(function(u){var c=[],f=i.subscribe({next:function(p){if(n)try{p=n(p)}catch(y){return u.error(y)}var m=a.from(p).subscribe({next:function(y){u.next(y)},error:function(y){u.error(y)},complete:function(){var y=c.indexOf(m);y>=0&&c.splice(y,1),h()}});c.push(m)},error:function(p){u.error(p)},complete:function(){h()}});function h(){f.closed&&c.length===0&&u.complete()}return function(){c.forEach(function(p){return p.unsubscribe()}),f.unsubscribe()}})},e[Zl]=function(){return this},r.from=function(n){var i=typeof this=="function"?this:r;if(n==null)throw new TypeError(n+" is not an object");var a=Ou(n,Zl);if(a){var u=a.call(n);if(Object(u)!==u)throw new TypeError(u+" is not an object");return T1(u)&&u.constructor===i?u:new i(function(c){return u.subscribe(c)})}if(Yl("iterator")&&(a=Ou(n,O1),a))return new i(function(c){Tu(function(){if(!c.closed){for(var f=x1(a.call(n)),h;!(h=f()).done;){var p=h.value;if(c.next(p),c.closed)return}c.complete()}})});if(Array.isArray(n))return new i(function(c){Tu(function(){if(!c.closed){for(var f=0;f<n.length;++f)if(c.next(n[f]),c.closed)return;c.complete()}})});throw new TypeError(n+" is not observable")},r.of=function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var u=typeof this=="function"?this:r;return new u(function(c){Tu(function(){if(!c.closed){for(var f=0;f<i.length;++f)if(c.next(i[f]),c.closed)return;c.complete()}})})},Ql(r,null,[{key:vy,get:function(){return this}}]),r}();Jl()&&Object.defineProperty(Pt,Symbol("extensions"),{value:{symbol:Zl,hostReportError:Ks},configurable:!0});function C1(r){var e=Promise.resolve(r);return e.status="fulfilled",e.value=r,e}function P1(r){var e=Promise.reject(r);return e.catch(function(){}),e.status="rejected",e.reason=r,e}function _y(r){return"status"in r}function N1(r){if(_y(r))return r;var e=r;return e.status="pending",e.then(function(t){if(e.status==="pending"){var n=e;n.status="fulfilled",n.value=t}},function(t){if(e.status==="pending"){var n=e;n.status="rejected",n.reason=t}}),r}function Sy(r){return r.catch(function(){}),r}var R1=Object.prototype.toString;function tf(r){return rf(r)}function rf(r,e){switch(R1.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(i,a){t[a]=rf(i,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var n=Object.create(Object.getPrototypeOf(r));return e.set(r,n),Object.keys(r).forEach(function(i){n[i]=rf(r[i],e)}),n}default:return r}}function M1(r){var e=new Set([r]);return e.forEach(function(t){Zt(t)&&D1(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){Zt(t[n])&&e.add(t[n])})}),r}function D1(r){if(globalThis.__DEV__!==!1&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function Os(r){return globalThis.__DEV__!==!1&&M1(r),r}function Zs(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function ku(r,e,t){return new Pt(function(n){var i={then:function(f){return new Promise(function(h){return h(f())})}};function a(f,h){return function(p){if(f){var m=function(){return n.closed?0:f(p)};i=i.then(m,m).then(function(y){return n.next(y)},function(y){return n.error(y)})}else n[h](p)}}var u={next:a(e,"next"),error:a(t,"error"),complete:function(){i.then(function(){return n.complete()})}},c=r.subscribe(u);return function(){return c.unsubscribe()}})}function nf(r){function e(t){Object.defineProperty(r,t,{value:Pt})}return mu&&Symbol.species&&e(Symbol.species),e("@@species"),r}function xy(r){return r&&typeof r.then=="function"}var Ts=function(r){In(e,r);function e(t){var n=r.call(this,function(i){return n.addObserver(i),function(){return n.removeObserver(i)}})||this;return n.observers=new Set,n.promise=new Promise(function(i,a){n.resolve=i,n.reject=a}),n.handlers={next:function(i){n.sub!==null&&(n.latest=["next",i],n.notify("next",i),Zs(n.observers,"next",i))},error:function(i){var a=n.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest=["error",i],n.reject(i),n.notify("error",i),Zs(n.observers,"error",i))},complete:function(){var i=n,a=i.sub,u=i.sources,c=u===void 0?[]:u;if(a!==null){var f=c.shift();f?xy(f)?f.then(function(h){return n.sub=h.subscribe(n.handlers)},n.handlers.error):n.sub=f.subscribe(n.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest&&n.latest[0]==="next"?n.resolve(n.latest[1]):n.resolve(),n.notify("complete"),Zs(n.observers,"complete"))}}},n.nextResultListeners=new Set,n.cancel=function(i){n.reject(i),n.sources=[],n.handlers.error(i)},n.promise.catch(function(i){}),typeof t=="function"&&(t=[new Pt(t)]),xy(t)?t.then(function(i){return n.start(i)},n.handlers.error):n.start(t),n}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var n=this.latest[0],i=t[n];i&&i.call(t,this.latest[1]),this.sub===null&&n==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,n){var i=this.nextResultListeners;i.size&&(this.nextResultListeners=new Set,i.forEach(function(a){return a(t,n)}))},e.prototype.beforeNext=function(t){var n=!1;this.nextResultListeners.add(function(i,a){n||(n=!0,t(i,a))})},e}(Pt);nf(Ts);function ks(r){return"incremental"in r}function Ey(r){return"hasNext"in r&&"data"in r}function Oy(r){return ks(r)||Ey(r)}function Ty(r){return Zt(r)&&"payload"in r}function sf(r,e){var t=r,n=new vi;return ks(e)&&pn(e.incremental)&&e.incremental.forEach(function(i){for(var a=i.data,u=i.path,c=u.length-1;c>=0;--c){var f=u[c],h=!isNaN(+f),p=h?[]:{};p[f]=a,a=p}t=n.merge(t,a)}),t}function no(r){var e=Au(r);return pn(e)}function Au(r){var e=pn(r.errors)?r.errors.slice(0):[];return ks(r)&&pn(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Qi(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(n){n&&Object.keys(n).forEach(function(i){var a=n[i];a!==void 0&&(t[i]=a)})}),t}function Ji(r,e){return Qi(r,e,e.variables&&{variables:Qi(F(F({},r&&r.variables),e.variables))})}function ky(r,e){return af(r,e)}function af(r,e,t){if(t===void 0&&(t=new Map),t.has(r))return t.get(r);var n=!1;if(Array.isArray(r)){var i=[];if(t.set(r,i),r.forEach(function(u,c){var f=af(u,e,t);n||(n=f!==u),i[c]=f}),n)return i}else if(Lm(r)){var a=Object.create(Object.getPrototypeOf(r));if(t.set(r,a),Object.keys(r).forEach(function(u){if(u===e){n=!0;return}var c=af(r[u],e,t);n||(n=c!==r[u]),a[u]=c}),n)return a}return r}function F1(r){return ky(r,"__typename")}const L1=Object.freeze(Object.defineProperty({__proto__:null,AutoCleanedStrongCache:$m,AutoCleanedWeakCache:gu,Concast:Ts,DEV:Ex,DeepMerger:vi,DocumentTransform:Su,Observable:Pt,addNonReactiveToNamedFragments:my,addTypenameToDocument:Eu,argumentsObjectFromField:Ja,asyncMap:ku,buildQueryFromSelectionSet:py,cacheSizes:Qn,canUseAsyncIteratorSymbol:Ha,canUseDOM:Al,canUseLayoutEffect:Fm,canUseSymbol:mu,canUseWeakMap:Bi,canUseWeakSet:pu,canonicalStringify:pi,checkDocument:zi,cloneDeep:tf,compact:Qi,concatPagination:v1,createFragmentMap:_s,createFulfilledPromise:C1,createRejectedPromise:P1,fixObservableSubclass:nf,getDefaultValues:bu,getDirectiveNames:fE,getFragmentDefinition:Ll,getFragmentDefinitions:Es,getFragmentFromSelection:Ga,getFragmentMaskMode:Rm,getFragmentQueryDocument:qm,getGraphQLErrorsFromResult:Au,getInclusionDirectives:Nm,getMainDefinition:Hi,getOperationDefinition:yi,getOperationName:Js,getQueryDefinition:Fl,getStoreKeyName:Dl,getTypenameFromResult:vu,graphQLResultHasError:no,hasAllDirectives:dE,hasAnyDirectives:hE,hasClientExports:Pm,hasDirectives:$i,isApolloPayloadResult:Ty,isArray:or,isDocumentNode:zm,isExecutionPatchIncrementalResult:ks,isExecutionPatchInitialResult:Ey,isExecutionPatchResult:Oy,isField:mi,isFullyUnmaskedOperation:jm,isInlineFragment:Gm,isMutationOperation:d1,isNonEmptyArray:pn,isNonNullObject:Zt,isPlainObject:Lm,isQueryOperation:p1,isReference:Ct,isStatefulPromise:_y,isSubscriptionOperation:m1,iterateObserversSafely:Zs,makeReference:Wi,makeUniqueId:au,maybe:Cn,maybeDeepFreeze:Os,mergeDeep:eo,mergeDeepArray:to,mergeIncrementalData:sf,mergeOptions:Ji,offsetLimitPagination:b1,omitDeep:ky,preventUnhandledRejection:Sy,print:gi,relayStylePagination:w1,removeArgumentsFromDocument:f1,removeClientSetsFromDocument:zl,removeConnectionDirectiveFromDocument:c1,removeDirectivesFromDocument:xu,removeFragmentSpreadFromDocument:h1,resultKeyNameFromField:ai,shouldInclude:Hs,storeKeyNameFromField:Hm,stringifyForDisplay:bl,stripTypename:F1,valueToObjectRepresentation:xs,wrapPromiseWithState:N1},Symbol.toStringTag,{value:"Module"}));function Iu(r){return new Pt(function(e){e.error(r)})}function q1(r){var e=!1;return new Promise(function(t,n){r.subscribe({next:function(i){e?globalThis.__DEV__!==!1&&Ie.warn(45):(e=!0,t(i))},error:n})})}function j1(r){return new Pt(function(e){r.then(function(t){e.next(t),e.complete()}).catch(e.error.bind(e))})}var of=function(r,e,t){var n=new Error(t);throw n.name="ServerError",n.response=r,n.statusCode=r.status,n.result=e,n};function U1(r){for(var e=["query","operationName","variables","extensions","context"],t=0,n=Object.keys(r);t<n.length;t++){var i=n[t];if(e.indexOf(i)<0)throw Jr(46,i)}return r}function $1(r,e){var t=F({},r),n=function(a){typeof a=="function"?t=F(F({},t),a(t)):t=F(F({},t),a)},i=function(){return F({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function B1(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?Js(e.query)||void 0:""),e}function V1(r,e){var t=F({},r),n=new Set(Object.keys(r));return on(e,{Variable:function(i,a,u){u&&u.kind!=="VariableDefinition"&&n.delete(i.name.value)}}),n.forEach(function(i){delete t[i]}),t}function Ay(r,e){return e?e(r):Pt.of()}function io(r){return typeof r=="function"?new Yr(r):r}function Cu(r){return r.request.length<=1}var Yr=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return Pt.of()})},r.from=function(e){return e.length===0?r.empty():e.map(io).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=io(t),a=io(n||new r(Ay)),u;return Cu(i)&&Cu(a)?u=new r(function(c){return e(c)?i.request(c)||Pt.of():a.request(c)||Pt.of()}):u=new r(function(c,f){return e(c)?i.request(c,f)||Pt.of():a.request(c,f)||Pt.of()}),Object.assign(u,{left:i,right:a})},r.execute=function(e,t){return e.request($1(t.context,B1(U1(t))))||Pt.of()},r.concat=function(e,t){var n=io(e);if(Cu(n))return globalThis.__DEV__!==!1&&Ie.warn(38,n),n;var i=io(t),a;return Cu(i)?a=new r(function(u){return n.request(u,function(c){return i.request(c)||Pt.of()})||Pt.of()}):a=new r(function(u,c){return n.request(u,function(f){return i.request(f,c)||Pt.of()})||Pt.of()}),Object.assign(a,{left:n,right:i})},r.prototype.split=function(e,t,n){return this.concat(r.split(e,t,n||new r(Ay)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw Jr(39)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}(),W1=Yr.empty,z1=Yr.from,H1=Yr.split,G1=Yr.concat,Pu=Yr.execute;function Q1(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function J1(r){var e=null,t=null,n=!1,i=[],a=[];function u(m){if(!t){if(a.length){var y=a.shift();if(Array.isArray(y)&&y[0])return y[0]({value:m,done:!1})}i.push(m)}}function c(m){t=m;var y=a.slice();y.forEach(function(g){g[1](m)}),!e||e()}function f(){n=!0;var m=a.slice();m.forEach(function(y){y[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",u),r.removeListener("error",c),r.removeListener("end",f),r.removeListener("finish",f),r.removeListener("close",f)},r.on("data",u),r.on("error",c),r.on("end",f),r.on("finish",f),r.on("close",f);function h(){return new Promise(function(m,y){if(t)return y(t);if(i.length)return m({value:i.shift(),done:!1});if(n)return m({value:void 0,done:!0});a.push([m,y])})}var p={next:function(){return h()}};return Ha&&(p[Symbol.asyncIterator]=function(){return this}),p}function Y1(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(n,i){r.then(function(a){n({value:a,done:!1})}).catch(i)}))}};return Ha&&(t[Symbol.asyncIterator]=function(){return this}),t}function Iy(r){var e={next:function(){return r.read()}};return Ha&&(e[Symbol.asyncIterator]=function(){return this}),e}function K1(r){return!!r.body}function Z1(r){return!!r.getReader}function X1(r){return!!(Ha&&r[Symbol.asyncIterator])}function eO(r){return!!r.stream}function tO(r){return!!r.arrayBuffer}function rO(r){return!!r.pipe}function nO(r){var e=r;if(K1(r)&&(e=r.body),X1(e))return Q1(e);if(Z1(e))return Iy(e.getReader());if(eO(e))return Iy(e.stream().getReader());if(tO(e))return Y1(e.arrayBuffer());if(rO(e))return J1(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Nu=Symbol();function Cy(r){return r.extensions?Array.isArray(r.extensions[Nu]):!1}function uf(r){return r.hasOwnProperty("graphQLErrors")}var iO=function(r){var e=lr(lr(lr([],r.graphQLErrors,!0),r.clientErrors,!0),r.protocolErrors,!0);return r.networkError&&e.push(r.networkError),e.map(function(t){return Zt(t)&&t.message||"Error message not found."}).join(`
|
|
80
|
+
`)},mn=function(r){In(e,r);function e(t){var n=t.graphQLErrors,i=t.protocolErrors,a=t.clientErrors,u=t.networkError,c=t.errorMessage,f=t.extraInfo,h=r.call(this,c)||this;return h.name="ApolloError",h.graphQLErrors=n||[],h.protocolErrors=i||[],h.clientErrors=a||[],h.networkError=u||null,h.message=c||iO(h),h.extraInfo=f,h.cause=lr(lr(lr([u],n||[],!0),i||[],!0),a||[],!0).find(function(p){return!!p})||null,h.__proto__=e.prototype,h}return e}(Error),Py=Object.prototype.hasOwnProperty;function sO(r,e){return ji(this,void 0,void 0,function(){var t,n,i,a,u,c,f,h,p,m,y,g,b,I,S,w,O,P,D,T,N,G,q,$;return Ui(this,function(K){switch(K.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");t=new TextDecoder("utf-8"),n=($=r.headers)===null||$===void 0?void 0:$.get("content-type"),i="boundary=",a=n?.includes(i)?n?.substring(n?.indexOf(i)+i.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u=`\r
|
|
81
|
+
--`.concat(a),c="",f=nO(r),h=!0,K.label=1;case 1:return h?[4,f.next()]:[3,3];case 2:for(p=K.sent(),m=p.value,y=p.done,g=typeof m=="string"?m:t.decode(m),b=c.length-u.length+1,h=!y,c+=g,I=c.indexOf(u,b);I>-1;){if(S=void 0,G=[c.slice(0,I),c.slice(I+u.length)],S=G[0],c=G[1],w=S.indexOf(`\r
|
|
82
82
|
\r
|
|
83
|
-
`),
|
|
84
|
-
`).forEach(function(t){var n=t.indexOf(":");if(n>-1){var i=t.slice(0,n).trim().toLowerCase(),a=t.slice(n+1).trim();e[i]=a}}),e}function vy(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};rf(r,t(),"Response not successful: Received status code ".concat(r.status))}try{return JSON.parse(e)}catch(i){var n=i;throw n.name="ServerParseError",n.response=r,n.statusCode=r.status,n.bodyText=e,n}}function BO(r,e){r.result&&r.result.errors&&r.result.data&&e.next(r.result),e.error(r)}function by(r){return function(e){return e.text().then(function(t){return vy(e,t)}).then(function(t){return!Array.isArray(t)&&!gy.call(t,"data")&&!gy.call(t,"errors")&&rf(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(n){return n.operationName}):r.operationName,"'.")),t})}}var Ou=function(r,e){var t;try{t=JSON.stringify(r)}catch(i){var n=Yr(40,e,i.message);throw n.parseError=i,n}return t},VO={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},WO={accept:"*/*","content-type":"application/json"},zO={method:"POST"},wy={http:VO,headers:WO,options:zO},af=function(r,e){return e(r)};function HO(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return t.unshift(e),of.apply(void 0,wr([r,af],t,!1))}function of(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i={},a={};t.forEach(function(y){i=L(L(L({},i),y.options),{headers:L(L({},i.headers),y.headers)}),y.credentials&&(i.credentials=y.credentials),a=L(L({},a),y.http)}),i.headers&&(i.headers=GO(i.headers,a.preserveHeaderCase));var u=r.operationName,c=r.extensions,f=r.variables,h=r.query,d={operationName:u,variables:f};return a.includeExtensions&&(d.extensions=c),a.includeQuery&&(d.query=e(h,Gs)),{options:i,body:d}}function GO(r,e){if(!e){var t={};return Object.keys(Object(r)).forEach(function(a){t[a.toLowerCase()]=r[a]}),t}var n={};Object.keys(Object(r)).forEach(function(a){n[a.toLowerCase()]={originalName:a,value:r[a]}});var i={};return Object.keys(n).forEach(function(a){i[n[a].originalName]=n[a].value}),i}var _y=function(r){if(!r&&typeof fetch>"u")throw Yr(38)},QO=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}},xy=function(r,e){var t=r.getContext(),n=t.uri;return n||(typeof e=="function"?e(r):e||"/graphql")};function Sy(r,e){var t=[],n=function(y,g){t.push("".concat(y,"=").concat(encodeURIComponent(g)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=Ou(e.variables,"Variables map")}catch(y){return{parseError:y}}n("variables",i)}if(e.extensions){var a=void 0;try{a=Ou(e.extensions,"Extensions map")}catch(y){return{parseError:y}}n("extensions",a)}var u="",c=r,f=r.indexOf("#");f!==-1&&(u=r.substr(f),c=r.substr(0,f));var h=c.indexOf("?")===-1?"?":"&",d=c+h+t.join("&")+u;return{newURI:d}}var Ey=Nn(function(){return fetch}),uf=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,n=r.fetch,i=r.print,a=i===void 0?af:i,u=r.includeExtensions,c=r.preserveHeaderCase,f=r.useGETForQueries,h=r.includeUnusedVariables,d=h===void 0?!1:h,y=on(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);globalThis.__DEV__!==!1&&_y(n||Ey);var g={http:{includeExtensions:u,preserveHeaderCase:c},options:y.fetchOptions,credentials:y.credentials,headers:y.headers};return new Kr(function(m){var b=xy(m,t),I=m.getContext(),x={};if(I.clientAwareness){var _=I.clientAwareness,A=_.name,P=_.version;A&&(x["apollographql-client-name"]=A),P&&(x["apollographql-client-version"]=P)}var M=L(L({},x),I.headers),$={http:I.http,options:I.fetchOptions,credentials:I.credentials,headers:M};if(Ui(["client"],m.query)){var j=$l(m.query);if(!j)return xu(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`."));m.query=j}var K=of(m,a,wy,g,$),ee=K.options,fe=K.body;fe.variables&&!d&&(fe.variables=SO(fe.variables,m.query));var de;!ee.signal&&typeof AbortController<"u"&&(de=new AbortController,ee.signal=de.signal);var Ie=function(ye){return ye.kind==="OperationDefinition"&&ye.operation==="mutation"},pe=function(ye){return ye.kind==="OperationDefinition"&&ye.operation==="subscription"},Ce=pe(Vi(m.query)),Pe=Ui(["defer"],m.query);if(f&&!m.query.definitions.some(Ie)&&(ee.method="GET"),Pe||Ce){ee.headers=ee.headers||{};var ge="multipart/mixed;";Ce&&Pe&&globalThis.__DEV__!==!1&&qe.warn(39),Ce?ge+="boundary=graphql;subscriptionSpec=1.0,application/json":Pe&&(ge+="deferSpec=20220824,application/json"),ee.headers.accept=ge}if(ee.method==="GET"){var We=Sy(b,fe),ke=We.newURI,X=We.parseError;if(X)return xu(X);b=ke}else try{ee.body=Ou(fe,"Payload")}catch(ye){return xu(ye)}return new Rt(function(ye){var xe=n||Nn(function(){return fetch})||Ey,Se=ye.next.bind(ye);return xe(b,ee).then(function(Be){var Ke;m.setContext({response:Be});var Et=(Ke=Be.headers)===null||Ke===void 0?void 0:Ke.get("content-type");return Et!==null&&/^multipart\/mixed/i.test(Et)?UO(Be,Se):by(m)(Be).then(Se)}).then(function(){de=void 0,ye.complete()}).catch(function(Be){de=void 0,BO(Be,ye)}),function(){de&&de.abort()}})})},Oy=function(r){Pn(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,uf(t).request)||this;return n.options=t,n}return e}(Kr);const{toString:Ty,hasOwnProperty:JO}=Object.prototype,Ay=Function.prototype.toString,cf=new Map;function Ft(r,e){try{return lf(r,e)}finally{cf.clear()}}function lf(r,e){if(r===e)return!0;const t=Ty.call(r),n=Ty.call(e);if(t!==n)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(Iy(r,e))return!0;const i=ky(r),a=ky(e),u=i.length;if(u!==a.length)return!1;for(let c=0;c<u;++c)if(!JO.call(e,i[c]))return!1;for(let c=0;c<u;++c){const f=i[c];if(!lf(r[f],e[f]))return!1}return!0}case"[object Error]":return r.name===e.name&&r.message===e.message;case"[object Number]":if(r!==r)return e!==e;case"[object Boolean]":case"[object Date]":return+r==+e;case"[object RegExp]":case"[object String]":return r==`${e}`;case"[object Map]":case"[object Set]":{if(r.size!==e.size)return!1;if(Iy(r,e))return!0;const i=r.entries(),a=t==="[object Map]";for(;;){const u=i.next();if(u.done)break;const[c,f]=u.value;if(!e.has(c)||a&&!lf(f,e.get(c)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":r=new Uint8Array(r),e=new Uint8Array(e);case"[object DataView]":{let i=r.byteLength;if(i===e.byteLength)for(;i--&&r[i]===e[i];);return i===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{const i=Ay.call(r);return i!==Ay.call(e)?!1:!ZO(i,KO)}}return!1}function ky(r){return Object.keys(r).filter(YO,r)}function YO(r){return this[r]!==void 0}const KO="{ [native code] }";function ZO(r,e){const t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function Iy(r,e){let t=cf.get(r);if(t){if(t.has(e))return!0}else cf.set(r,t=new Set);return t.add(e),!1}function Cy(r,e,t,n){var i=e.data,a=on(e,["data"]),u=t.data,c=on(t,["data"]);return Ft(a,c)&&Tu(Vi(r).selectionSet,i,u,{fragmentMap:Wa(Qa(r)),variables:n})}function Tu(r,e,t,n){if(e===t)return!0;var i=new Set;return r.selections.every(function(a){if(i.has(a)||(i.add(a),!Vs(a,n.variables))||Py(a))return!0;if(gi(a)){var u=yi(a),c=e&&e[u],f=t&&t[u],h=a.selectionSet;if(!h)return Ft(c,f);var d=Array.isArray(c),y=Array.isArray(f);if(d!==y)return!1;if(d&&y){var g=c.length;if(f.length!==g)return!1;for(var m=0;m<g;++m)if(!Tu(h,c[m],f[m],n))return!1;return!0}return Tu(h,c,f,n)}else{var b=za(a,n.fragmentMap);if(b)return Py(b)?!0:Tu(b.selectionSet,e,t,n)}})}function Py(r){return!!r.directives&&r.directives.some(XO)}function XO(r){return r.name.value==="nonreactive"}var ff=function(){function r(){this.assumeImmutableResults=!1,this.getFragmentDoc=Ya(Tm,{max:Yn["cache.fragmentQueryDocuments"]||1e3,cache:uu})}return r.prototype.batch=function(e){var t=this,n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,i;return this.performTransaction(function(){return i=e.update(t)},n),i},r.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},r.prototype.transformDocument=function(e){return e},r.prototype.transformForLink=function(e){return e},r.prototype.identify=function(e){},r.prototype.gc=function(){return[]},r.prototype.modify=function(e){return!1},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(L(L({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.watchFragment=function(e){var t=this,n=e.fragment,i=e.fragmentName,a=e.from,u=e.optimistic,c=u===void 0?!0:u,f=on(e,["fragment","fragmentName","from","optimistic"]),h=this.getFragmentDoc(n,i),d=L(L({},f),{returnPartialData:!0,id:typeof a>"u"||typeof a=="string"?a:this.identify(a),query:h,optimistic:c}),y;return new Rt(function(g){return t.watch(L(L({},d),{immediate:!0,callback:function(m){if(!(y&&Cy(h,{data:y==null?void 0:y.result},{data:m.result}))){var b={data:m.result,complete:!!m.complete};m.missing&&(b.missing=Xa(m.missing.map(function(I){return I.missing}))),y=m,g.next(b)}}}))})},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(L(L({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},r.prototype.writeQuery=function(e){var t=e.id,n=e.data,i=on(e,["id","data"]);return this.write(Object.assign(i,{dataId:t||"ROOT_QUERY",result:n}))},r.prototype.writeFragment=function(e){var t=e.id,n=e.data,i=e.fragment,a=e.fragmentName,u=on(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(u,{query:this.getFragmentDoc(i,a),dataId:t,result:n}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(n){var i=n.readQuery(e),a=t(i);return a==null?i:(n.writeQuery(L(L({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(n){var i=n.readFragment(e),a=t(i);return a==null?i:(n.writeFragment(L(L({},e),{data:a})),a)}})},r}();globalThis.__DEV__!==!1&&(ff.prototype.getMemoryInternals=cE);var hf;hf||(hf={});var df=function(r){Pn(e,r);function e(t,n,i,a){var u,c=r.call(this,t)||this;if(c.message=t,c.path=n,c.query=i,c.variables=a,Array.isArray(c.path)){c.missing=c.message;for(var f=c.path.length-1;f>=0;--f)c.missing=(u={},u[c.path[f]]=c.missing,u)}else c.missing=c.path;return c.__proto__=e.prototype,c}return e}(Error),Rr=Object.prototype.hasOwnProperty;function no(r){return r==null}function pf(r,e){var t=r.__typename,n=r.id,i=r._id;if(typeof t=="string"&&(e&&(e.keyObject=no(n)?no(i)?void 0:{_id:i}:{id:n}),no(n)&&!no(i)&&(n=i),!no(n)))return"".concat(t,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Ny={dataIdFromObject:pf,addTypename:!0,resultCaching:!0,canonizeResults:!1};function e1(r){return zi(Ny,r)}function Ry(r){var e=r.canonizeResults;return e===void 0?Ny.canonizeResults:e}function t1(r,e){return Nt(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var My=/^[_a-z][_0-9a-z]*/i;function Gi(r){var e=r.match(My);return e?e[0]:r}function mf(r,e,t){return er(e)?ur(e)?e.every(function(n){return mf(r,n,t)}):r.selections.every(function(n){if(gi(n)&&Vs(n,t)){var i=yi(n);return Rr.call(e,i)&&(!n.selectionSet||mf(n.selectionSet,e[i],t))}return!0}):!1}function Ks(r){return er(r)&&!Nt(r)&&!ur(r)}function r1(){return new vi}function Dy(r,e){var t=Wa(Qa(r));return{fragmentMap:t,lookupFragment:function(n){var i=t[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var Au=Object.create(null),yf=function(){return Au},Fy=Object.create(null),io=function(){function r(e,t){var n=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(i,a){return Js(Nt(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return Nt(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return Bi(i);if(Nt(i))return i;var u=n.policies.identify(i)[0];if(u){var c=Bi(u);return a&&n.merge(u,i),c}}}return r.prototype.toObject=function(){return L({},this.data)},r.prototype.has=function(e){return this.lookup(e,!0)!==void 0},r.prototype.get=function(e,t){if(this.group.depend(e,t),Rr.call(this.data,e)){var n=this.data[e];if(n&&Rr.call(n,t))return n[t]}if(t==="__typename"&&Rr.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Qi)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),Rr.call(this.data,e))return this.data[e];if(this instanceof Qi)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var n=this,i;Nt(e)&&(e=e.__ref),Nt(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(i=e):e,u=typeof t=="string"?this.lookup(i=t):t;if(u){qe(typeof i=="string",1);var c=new vi(i1).merge(a,u);if(this.data[i]=c,c!==a&&(delete this.refs[i],this.group.caching)){var f=Object.create(null);a||(f.__exists=1),Object.keys(u).forEach(function(h){if(!a||a[h]!==c[h]){f[h]=1;var d=Gi(h);d!==h&&!n.policies.hasKeyArgs(c.__typename,d)&&(f[d]=1),c[h]===void 0&&!(n instanceof Qi)&&delete c[h]}}),f.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[i]===c.__typename&&delete f.__typename,Object.keys(f).forEach(function(h){return n.group.dirty(i,h)})}}},r.prototype.modify=function(e,t){var n=this,i=this.lookup(e);if(i){var a=Object.create(null),u=!1,c=!0,f={DELETE:Au,INVALIDATE:Fy,isReference:Nt,toReference:this.toReference,canRead:this.canRead,readField:function(h,d){return n.policies.readField(typeof h=="string"?{fieldName:h,from:d||Bi(e)}:h,{store:n})}};if(Object.keys(i).forEach(function(h){var d=Gi(h),y=i[h];if(y!==void 0){var g=typeof t=="function"?t:t[h]||t[d];if(g){var m=g===yf?Au:g(Js(y),L(L({},f),{fieldName:d,storeFieldName:h,storage:n.getStorage(e,h)}));if(m===Fy)n.group.dirty(e,h);else if(m===Au&&(m=void 0),m!==y&&(a[h]=m,u=!0,y=m,globalThis.__DEV__!==!1)){var b=function($){if(n.lookup($.__ref)===void 0)return globalThis.__DEV__!==!1&&qe.warn(2,$),!0};if(Nt(m))b(m);else if(Array.isArray(m))for(var I=!1,x=void 0,_=0,A=m;_<A.length;_++){var P=A[_];if(Nt(P)){if(I=!0,b(P))break}else if(typeof P=="object"&&P){var M=n.policies.identify(P)[0];M&&(x=P)}if(I&&x!==void 0){globalThis.__DEV__!==!1&&qe.warn(3,x);break}}}}y!==void 0&&(c=!1)}}),u)return this.merge(e,a),c&&(this instanceof Qi?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,n){var i,a=this.lookup(e);if(a){var u=this.getFieldValue(a,"__typename"),c=t&&n?this.policies.getStoreFieldName({typename:u,fieldName:t,args:n}):t;return this.modify(e,c?(i={},i[c]=yf,i):yf)}return!1},r.prototype.evict=function(e,t){var n=!1;return e.id&&(Rr.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Qi&&this!==t&&(n=this.parent.evict(e,t)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),n=[];return this.getRootIdSet().forEach(function(i){Rr.call(e.policies.rootTypenamesById,i)||n.push(i)}),n.length&&(t.__META={extraRootIds:n.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&Rr.call(e,a)||t.delete(a)}),e){var n=e.__META,i=on(e,["__META"]);Object.keys(i).forEach(function(a){t.merge(a,i[a])}),n&&n.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Qi?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),n=this.toObject();t.forEach(function(u){Rr.call(n,u)&&(Object.keys(e.findChildRefIds(u)).forEach(t.add,t),delete n[u])});var i=Object.keys(n);if(i.length){for(var a=this;a instanceof Qi;)a=a.parent;i.forEach(function(u){return a.delete(u)})}return i},r.prototype.findChildRefIds=function(e){if(!Rr.call(this.refs,e)){var t=this.refs[e]=Object.create(null),n=this.data[e];if(!n)return t;var i=new Set([n]);i.forEach(function(a){Nt(a)&&(t[a.__ref]=!0),er(a)&&Object.keys(a).forEach(function(u){var c=a[u];er(c)&&i.add(c)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}(),Ly=function(){function r(e,t){t===void 0&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return r.prototype.resetCaching=function(){this.d=this.caching?Zm():null,this.keyMaker=new Ws(gs)},r.prototype.depend=function(e,t){if(this.d){this.d(gf(e,t));var n=Gi(t);n!==t&&this.d(gf(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(gf(e,t),t==="__exists"?"forget":"setDirty")},r}();function gf(r,e){return e+"#"+r}function qy(r,e){so(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){Pn(n,t);function n(i){var a=i.policies,u=i.resultCaching,c=u===void 0?!0:u,f=i.seed,h=t.call(this,a,new Ly(c))||this;return h.stump=new n1(h),h.storageTrie=new Ws(gs),f&&h.replace(f),h}return n.prototype.addLayer=function(i,a){return this.stump.addLayer(i,a)},n.prototype.removeLayer=function(){return this},n.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},n}(r);r.Root=e})(io||(io={}));var Qi=function(r){Pn(e,r);function e(t,n,i,a){var u=r.call(this,n.policies,a)||this;return u.id=t,u.parent=n,u.replay=i,u.group=a,i(u),u}return e.prototype.addLayer=function(t,n){return new e(t,this,n,this.group)},e.prototype.removeLayer=function(t){var n=this,i=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var u=n.data[a],c=i.lookup(a);c?u?u!==c&&Object.keys(u).forEach(function(f){Ft(u[f],c[f])||n.group.dirty(a,f)}):(n.group.dirty(a,"__exists"),Object.keys(c).forEach(function(f){n.group.dirty(a,f)})):n.delete(a)}),i):i===this.parent?this:i.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return L(L({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var n=this.parent.findChildRefIds(t);return Rr.call(this.data,t)?L(L({},n),r.prototype.findChildRefIds.call(this,t)):n},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(io),n1=function(r){Pn(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new Ly(t.group.caching,t.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(t,n){return this.parent.merge(t,n)},e}(Qi);function i1(r,e,t){var n=r[t],i=e[t];return Ft(n,i)?n:i}function so(r){return!!(r instanceof io&&r.group.caching)}function s1(r){return er(r)?ur(r)?r.slice(0):L({__proto__:Object.getPrototypeOf(r)},r):r}var jy=function(){function r(){this.known=new(El?WeakSet:Set),this.pool=new Ws(gs),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return er(e)&&this.known.has(e)},r.prototype.pass=function(e){if(er(e)){var t=s1(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(er(e)){var n=this.passes.get(e);if(n)return n;var i=Object.getPrototypeOf(e);switch(i){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),u=this.pool.lookupArray(a);return u.array||(this.known.add(u.array=a),globalThis.__DEV__!==!1&&Object.freeze(a)),u.array}case null:case Object.prototype:{if(this.known.has(e))return e;var c=Object.getPrototypeOf(e),f=[c],h=this.sortedKeys(e);f.push(h.json);var d=f.length;h.sorted.forEach(function(m){f.push(t.admit(e[m]))});var u=this.pool.lookupArray(f);if(!u.object){var y=u.object=Object.create(c);this.known.add(y),h.sorted.forEach(function(m,b){y[m]=f[d+b]}),globalThis.__DEV__!==!1&&Object.freeze(y)}return u.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),n=this.pool.lookupArray(t);if(!n.keys){t.sort();var i=JSON.stringify(t);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:t,json:i})}return n.keys},r}();function Uy(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var a1=function(){function r(e){var t=this;this.knownResults=new(gs?WeakMap:Map),this.config=zi(e,{addTypename:e.addTypename!==!1,canonizeResults:Ry(e)}),this.canon=e.canon||new jy,this.executeSelectionSet=Ya(function(n){var i,a=n.context.canonizeResults,u=Uy(n);u[3]=!a;var c=(i=t.executeSelectionSet).peek.apply(i,u);return c?a?L(L({},c),{result:t.canon.admit(c.result)}):c:(qy(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize||Yn["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:Uy,makeCacheKey:function(n,i,a,u){if(so(a.store))return a.store.makeCacheKey(n,Nt(i)?i.__ref:i,a.varString,u)}}),this.executeSubSelectedArray=Ya(function(n){return qy(n.context.store,n.enclosingRef.__ref),t.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize||Yn["inMemoryCache.executeSubSelectedArray"]||1e4,makeCacheKey:function(n){var i=n.field,a=n.array,u=n.context;if(so(u.store))return u.store.makeCacheKey(i,a,u.varString)}})}return r.prototype.resetCanon=function(){this.canon=new jy},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,n=e.query,i=e.rootId,a=i===void 0?"ROOT_QUERY":i,u=e.variables,c=e.returnPartialData,f=c===void 0?!0:c,h=e.canonizeResults,d=h===void 0?this.config.canonizeResults:h,y=this.config.cache.policies;u=L(L({},hu(Rl(n))),u);var g=Bi(a),m=this.executeSelectionSet({selectionSet:Vi(n).selectionSet,objectOrReference:g,enclosingRef:g,context:L({store:t,query:n,policies:y,variables:u,varString:mi(u),canonizeResults:d},Dy(n,this.config.fragments))}),b;if(m.missing&&(b=[new df(o1(m.missing),m.missing,n,u)],!f))throw b[0];return{result:m.result,complete:!b,missing:b}},r.prototype.isFresh=function(e,t,n,i){if(so(i.store)&&this.knownResults.get(e)===n){var a=this.executeSelectionSet.peek(n,t,i,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,n=e.selectionSet,i=e.objectOrReference,a=e.enclosingRef,u=e.context;if(Nt(i)&&!u.policies.rootTypenamesById[i.__ref]&&!u.store.has(i.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(i.__ref," object")};var c=u.variables,f=u.policies,h=u.store,d=h.getFieldValue(i,"__typename"),y=[],g,m=new vi;this.config.addTypename&&typeof d=="string"&&!f.rootIdsByTypename[d]&&y.push({__typename:d});function b(P,M){var $;return P.missing&&(g=m.merge(g,($={},$[M]=P.missing,$))),P.result}var I=new Set(n.selections);I.forEach(function(P){var M,$;if(Vs(P,c))if(gi(P)){var j=f.readField({fieldName:P.name.value,field:P,variables:u.variables,from:i},u),K=yi(P);j===void 0?gu.added(P)||(g=m.merge(g,(M={},M[K]="Can't find field '".concat(P.name.value,"' on ").concat(Nt(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),M))):ur(j)?j.length>0&&(j=b(t.executeSubSelectedArray({field:P,array:j,enclosingRef:a,context:u}),K)):P.selectionSet?j!=null&&(j=b(t.executeSelectionSet({selectionSet:P.selectionSet,objectOrReference:j,enclosingRef:Nt(j)?j:a,context:u}),K)):u.canonizeResults&&(j=t.canon.pass(j)),j!==void 0&&y.push(($={},$[K]=j,$))}else{var ee=za(P,u.lookupFragment);if(!ee&&P.kind===Fe.FRAGMENT_SPREAD)throw Yr(9,P.name.value);ee&&f.fragmentMatches(ee,d)&&ee.selectionSet.selections.forEach(I.add,I)}});var x=Xa(y),_={result:x,missing:g},A=u.canonizeResults?this.canon.admit(_):Js(_);return A.result&&this.knownResults.set(A.result,n),A},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,n=e.field,i=e.array,a=e.enclosingRef,u=e.context,c,f=new vi;function h(d,y){var g;return d.missing&&(c=f.merge(c,(g={},g[y]=d.missing,g))),d.result}return n.selectionSet&&(i=i.filter(u.store.canRead)),i=i.map(function(d,y){return d===null?null:ur(d)?h(t.executeSubSelectedArray({field:n,array:d,enclosingRef:a,context:u}),y):n.selectionSet?h(t.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:d,enclosingRef:Nt(d)?d:a,context:u}),y):(globalThis.__DEV__!==!1&&u1(u.store,n,d),d)}),{result:u.canonizeResults?this.canon.admit(i):i,missing:c}},r}();function o1(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function u1(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){er(i)&&(qe(!Nt(i),10,t1(r,i),e.name.value),Object.values(i).forEach(n.add,n))})}}var vf=new Um,$y=new WeakMap;function ao(r){var e=$y.get(r);return e||$y.set(r,e={vars:new Set,dep:Zm()}),e}function By(r){ao(r).vars.forEach(function(e){return e.forgetCache(r)})}function c1(r){ao(r).vars.forEach(function(e){return e.attachCache(r)})}function Vy(r){var e=new Set,t=new Set,n=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(f){ao(f).dep.dirty(n),l1(f)});var u=Array.from(t);t.clear(),u.forEach(function(f){return f(r)})}}else{var c=vf.getValue();c&&(i(c),ao(c).dep(n))}return r};n.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var i=n.attachCache=function(a){return e.add(a),ao(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function l1(r){r.broadcastWatches&&r.broadcastWatches()}var Wy=Object.create(null);function bf(r){var e=JSON.stringify(r);return Wy[e]||(Wy[e]=Object.create(null))}function zy(r){var e=bf(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,n){var i=function(u,c){return n.readField(c,u)},a=n.keyObject=wf(r,function(u){var c=Zs(n.storeObject,u,i);return c===void 0&&t!==n.storeObject&&Rr.call(t,u[0])&&(c=Zs(t,u,Qy)),qe(c!==void 0,4,u.join("."),t),c});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function Hy(r){var e=bf(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,u=n.fieldName,c=wf(r,function(h){var d=h[0],y=d.charAt(0);if(y==="@"){if(i&&mn(i.directives)){var g=d.slice(1),m=i.directives.find(function(_){return _.name.value===g}),b=m&&Ga(m,a);return b&&Zs(b,h.slice(1))}return}if(y==="$"){var I=d.slice(1);if(a&&Rr.call(a,I)){var x=h.slice(0);return x[0]=I,Zs(a,x)}return}if(t)return Zs(t,h)}),f=JSON.stringify(c);return(t||f!=="{}")&&(u+=":"+f),u})}function wf(r,e){var t=new vi;return Gy(r).reduce(function(n,i){var a,u=e(i);if(u!==void 0){for(var c=i.length-1;c>=0;--c)u=(a={},a[i[c]]=u,a);n=t.merge(n,u)}return n},Object.create(null))}function Gy(r){var e=bf(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){ur(i)?(Gy(i).forEach(function(u){return t.push(n.concat(u))}),n.length=0):(n.push(i),ur(r[a+1])||(t.push(n.slice(0)),n.length=0))})}return e.paths}function Qy(r,e){return r[e]}function Zs(r,e,t){return t=t||Qy,Jy(e.reduce(function n(i,a){return ur(i)?i.map(function(u){return n(u,a)}):i&&t(i,a)},r))}function Jy(r){return er(r)?ur(r)?r.map(Jy):wf(Object.keys(r).sort(),function(e){return Zs(r,e)}):r}function _f(r){return r.args!==void 0?r.args:r.field?Ga(r.field,r.variables):null}var f1=function(){},Yy=function(r,e){return e.fieldName},Ky=function(r,e,t){var n=t.mergeObjects;return n(r,e)},Zy=function(r,e){return e},h1=function(){function r(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=L({dataIdFromObject:pf},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var n,i=this,a=t&&(t.typename||((n=t.storeObject)===null||n===void 0?void 0:n.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var u=t&&t.storeObject||e,c=L(L({},t),{typename:a,storeObject:u,readField:t&&t.readField||function(){var g=xf(arguments,u);return i.readField(g,{store:i.cache.data,variables:g.variables})}}),f,h=a&&this.getTypePolicy(a),d=h&&h.keyFn||this.config.dataIdFromObject;d;){var y=d(L(L({},e),u),c);if(ur(y))d=zy(y);else{f=y;break}}return f=f?String(f):void 0,c.keyObject?[f,c.keyObject]:[f]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(n){var i=e[n],a=i.queryType,u=i.mutationType,c=i.subscriptionType,f=on(i,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",n),u&&t.setRootTypename("Mutation",n),c&&t.setRootTypename("Subscription",n),Rr.call(t.toBeAdded,n)?t.toBeAdded[n].push(f):t.toBeAdded[n]=[f]})},r.prototype.updateTypePolicy=function(e,t){var n=this,i=this.getTypePolicy(e),a=t.keyFields,u=t.fields;function c(f,h){f.merge=typeof h=="function"?h:h===!0?Ky:h===!1?Zy:f.merge}c(i,t.merge),i.keyFn=a===!1?f1:ur(a)?zy(a):typeof a=="function"?a:i.keyFn,u&&Object.keys(u).forEach(function(f){var h=n.getFieldPolicy(e,f,!0),d=u[f];if(typeof d=="function")h.read=d;else{var y=d.keyArgs,g=d.read,m=d.merge;h.keyFn=y===!1?Yy:ur(y)?Hy(y):typeof y=="function"?y:h.keyFn,typeof g=="function"&&(h.read=g),c(h,m)}h.read&&h.merge&&(h.keyFn=h.keyFn||Yy)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==i&&(qe(!i||i===e,5,e),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[t]=n,this.rootTypenamesById[n]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(n){t.getSupertypeSet(n,!0),e[n].forEach(function(i){t.getSupertypeSet(i,!0).add(n);var a=i.match(My);(!a||a[0]!==i)&&t.fuzzySubtypes.set(i,new RegExp(i))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!Rr.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(e);!i&&this.fuzzySubtypes.size&&(i=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach(function(u,c){if(u.test(e)){var f=t.supertypeMap.get(c);f&&f.forEach(function(h){return i.add(h)})}})),i&&i.size&&i.forEach(function(u){var c=t.getTypePolicy(u),f=c.fields,h=on(c,["fields"]);Object.assign(n,h),Object.assign(n.fields,f)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(u){t.updateTypePolicy(e,u)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,n){if(e){var i=this.getTypePolicy(e).fields;return i[t]||n&&(i[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var n=this.supertypeMap.get(e);return!n&&t&&this.supertypeMap.set(e,n=new Set),n},r.prototype.fragmentMatches=function(e,t,n,i){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var u=e.typeCondition.name.value;if(t===u)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(u))for(var c=this.getSupertypeSet(t,!0),f=[c],h=function(b){var I=a.getSupertypeSet(b,!1);I&&I.size&&f.indexOf(I)<0&&f.push(I)},d=!!(n&&this.fuzzySubtypes.size),y=!1,g=0;g<f.length;++g){var m=f[g];if(m.has(u))return c.has(u)||(y&&globalThis.__DEV__!==!1&&qe.warn(6,t,u),c.add(u)),!0;m.forEach(h),d&&g===f.length-1&&mf(e.selectionSet,n,i)&&(d=!1,y=!0,this.fuzzySubtypes.forEach(function(b,I){var x=t.match(b);x&&x[0]===t&&h(I)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var n=this.getFieldPolicy(e,t,!1);return!!(n&&n.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,n=e.fieldName,i=this.getFieldPolicy(t,n,!1),a,u=i&&i.keyFn;if(u&&t)for(var c={typename:t,fieldName:n,field:e.field||null,variables:e.variables},f=_f(e);u;){var h=u(f,c);if(ur(h))u=Hy(h);else{a=h||n;break}}return a===void 0&&(a=e.field?Rm(e.field,e.variables):Nl(n,_f(e))),a===!1?n:n===Gi(a)?a:n+":"+a},r.prototype.readField=function(e,t){var n=e.from;if(n){var i=e.field||e.fieldName;if(i){if(e.typename===void 0){var a=t.store.getFieldValue(n,"__typename");a&&(e.typename=a)}var u=this.getStoreFieldName(e),c=Gi(u),f=t.store.getFieldValue(n,u),h=this.getFieldPolicy(e.typename,c,!1),d=h&&h.read;if(d){var y=Xy(this,n,e,t,t.store.getStorage(Nt(n)?n.__ref:n,u));return vf.withValue(this.cache,d,[f,y])}return f}}},r.prototype.getReadFunction=function(e,t){var n=this.getFieldPolicy(e,t,!1);return n&&n.read},r.prototype.getMergeFunction=function(e,t,n){var i=this.getFieldPolicy(e,t,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},r.prototype.runMergeFunction=function(e,t,n,i,a){var u=n.field,c=n.typename,f=n.merge;return f===Ky?eg(i.store)(e,t):f===Zy?t:(i.overwrite&&(e=void 0),f(e,t,Xy(this,void 0,{typename:c,fieldName:u.name.value,field:u,variables:i.variables},i,a||Object.create(null))))},r}();function Xy(r,e,t,n,i){var a=r.getStoreFieldName(t),u=Gi(a),c=t.variables||n.variables,f=n.store,h=f.toReference,d=f.canRead;return{args:_f(t),field:t.field||null,fieldName:u,storeFieldName:a,variables:c,isReference:Nt,toReference:h,storage:i,cache:r.cache,canRead:d,readField:function(){return r.readField(xf(arguments,e,c),n)},mergeObjects:eg(n.store)}}function xf(r,e,t){var n=r[0],i=r[1],a=r.length,u;return typeof n=="string"?u={fieldName:n,from:a>1?i:e}:(u=L({},n),Rr.call(u,"from")||(u.from=e)),globalThis.__DEV__!==!1&&u.from===void 0&&globalThis.__DEV__!==!1&&qe.warn(7,pl(Array.from(r))),u.variables===void 0&&(u.variables=t),u}function eg(r){return function(t,n){if(ur(t)||ur(n))throw Yr(8);if(er(t)&&er(n)){var i=r.getFieldValue(t,"__typename"),a=r.getFieldValue(n,"__typename"),u=i&&a&&i!==a;if(u)return n;if(Nt(t)&&Ks(n))return r.merge(t.__ref,n),t;if(Ks(t)&&Nt(n))return r.merge(t,n.__ref),n;if(Ks(t)&&Ks(n))return L(L({},t),n)}return n}}function Sf(r,e,t){var n="".concat(e).concat(t),i=r.flavors.get(n);return i||r.flavors.set(n,i=r.clientOnly===e&&r.deferred===t?r:L(L({},r),{clientOnly:e,deferred:t})),i}var d1=function(){function r(e,t,n){this.cache=e,this.reader=t,this.fragments=n}return r.prototype.writeToStore=function(e,t){var n=this,i=t.query,a=t.result,u=t.dataId,c=t.variables,f=t.overwrite,h=_s(i),d=r1();c=L(L({},hu(h)),c);var y=L(L({store:e,written:Object.create(null),merge:function(m,b){return d.merge(m,b)},variables:c,varString:mi(c)},Dy(i,this.fragments)),{overwrite:!!f,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),g=this.processSelectionSet({result:a||Object.create(null),dataId:u,selectionSet:h.selectionSet,mergeTree:{map:new Map},context:y});if(!Nt(g))throw Yr(11,a);return y.incomingById.forEach(function(m,b){var I=m.storeObject,x=m.mergeTree,_=m.fieldNodeSet,A=Bi(b);if(x&&x.map.size){var P=n.applyMerges(x,A,I,y);if(Nt(P))return;I=P}if(globalThis.__DEV__!==!1&&!y.overwrite){var M=Object.create(null);_.forEach(function(K){K.selectionSet&&(M[K.name.value]=!0)});var $=function(K){return M[Gi(K)]===!0},j=function(K){var ee=x&&x.map.get(K);return!!(ee&&ee.info&&ee.info.merge)};Object.keys(I).forEach(function(K){$(K)&&!j(K)&&p1(A,I,K,y.store)})}e.merge(b,I)}),e.retain(g.__ref),g},r.prototype.processSelectionSet=function(e){var t=this,n=e.dataId,i=e.result,a=e.selectionSet,u=e.context,c=e.mergeTree,f=this.cache.policies,h=Object.create(null),d=n&&f.rootTypenamesById[n]||lu(i,a,u.fragmentMap)||n&&u.store.get(n,"__typename");typeof d=="string"&&(h.__typename=d);var y=function(){var P=xf(arguments,h,u.variables);if(Nt(P.from)){var M=u.incomingById.get(P.from.__ref);if(M){var $=f.readField(L(L({},P),{from:M.storeObject}),u);if($!==void 0)return $}}return f.readField(P,u)},g=new Set;this.flattenFields(a,i,u,d).forEach(function(P,M){var $,j=yi(M),K=i[j];if(g.add(M),K!==void 0){var ee=f.getStoreFieldName({typename:d,fieldName:M.name.value,field:M,variables:P.variables}),fe=rg(c,ee),de=t.processFieldValue(K,M,M.selectionSet?Sf(P,!1,!1):P,fe),Ie=void 0;M.selectionSet&&(Nt(de)||Ks(de))&&(Ie=y("__typename",de));var pe=f.getMergeFunction(d,M.name.value,Ie);pe?fe.info={field:M,typename:d,merge:pe}:ng(c,ee),h=P.merge(h,($={},$[ee]=de,$))}else globalThis.__DEV__!==!1&&!P.clientOnly&&!P.deferred&&!gu.added(M)&&!f.getReadFunction(d,M.name.value)&&globalThis.__DEV__!==!1&&qe.error(12,yi(M),i)});try{var m=f.identify(i,{typename:d,selectionSet:a,fragmentMap:u.fragmentMap,storeObject:h,readField:y}),b=m[0],I=m[1];n=n||b,I&&(h=u.merge(h,I))}catch(P){if(!n)throw P}if(typeof n=="string"){var x=Bi(n),_=u.written[n]||(u.written[n]=[]);if(_.indexOf(a)>=0||(_.push(a),this.reader&&this.reader.isFresh(i,x,a,u)))return x;var A=u.incomingById.get(n);return A?(A.storeObject=u.merge(A.storeObject,h),A.mergeTree=Ef(A.mergeTree,c),g.forEach(function(P){return A.fieldNodeSet.add(P)})):u.incomingById.set(n,{storeObject:h,mergeTree:ku(c)?void 0:c,fieldNodeSet:g}),x}return h},r.prototype.processFieldValue=function(e,t,n,i){var a=this;return!t.selectionSet||e===null?globalThis.__DEV__!==!1?Kl(e):e:ur(e)?e.map(function(u,c){var f=a.processFieldValue(u,t,n,rg(i,c));return ng(i,c),f}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:n,mergeTree:i})},r.prototype.flattenFields=function(e,t,n,i){i===void 0&&(i=lu(t,e,n.fragmentMap));var a=new Map,u=this.cache.policies,c=new Ws(!1);return function f(h,d){var y=c.lookup(h,d.clientOnly,d.deferred);y.visited||(y.visited=!0,h.selections.forEach(function(g){if(Vs(g,n.variables)){var m=d.clientOnly,b=d.deferred;if(!(m&&b)&&mn(g.directives)&&g.directives.forEach(function(_){var A=_.name.value;if(A==="client"&&(m=!0),A==="defer"){var P=Ga(_,n.variables);(!P||P.if!==!1)&&(b=!0)}}),gi(g)){var I=a.get(g);I&&(m=m&&I.clientOnly,b=b&&I.deferred),a.set(g,Sf(n,m,b))}else{var x=za(g,n.lookupFragment);if(!x&&g.kind===Fe.FRAGMENT_SPREAD)throw Yr(13,g.name.value);x&&u.fragmentMatches(x,i,t,n.variables)&&f(x.selectionSet,Sf(n,m,b))}}}))}(e,n),a},r.prototype.applyMerges=function(e,t,n,i,a){var u,c=this;if(e.map.size&&!Nt(n)){var f=!ur(n)&&(Nt(t)||Ks(t))?t:void 0,h=n;f&&!a&&(a=[Nt(f)?f.__ref:f]);var d,y=function(g,m){return ur(g)?typeof m=="number"?g[m]:void 0:i.store.getFieldValue(g,String(m))};e.map.forEach(function(g,m){var b=y(f,m),I=y(h,m);if(I!==void 0){a&&a.push(m);var x=c.applyMerges(g,b,I,i,a);x!==I&&(d=d||new Map,d.set(m,x)),a&&qe(a.pop()===m)}}),d&&(n=ur(h)?h.slice(0):L({},h),d.forEach(function(g,m){n[m]=g}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,i,a&&(u=i.store).getStorage.apply(u,a)):n},r}(),tg=[];function rg(r,e){var t=r.map;return t.has(e)||t.set(e,tg.pop()||{map:new Map}),t.get(e)}function Ef(r,e){if(r===e||!e||ku(e))return r;if(!r||ku(r))return e;var t=r.info&&e.info?L(L({},r.info),e.info):r.info||e.info,n=r.map.size&&e.map.size,i=n?new Map:r.map.size?r.map:e.map,a={info:t,map:i};if(n){var u=new Set(e.map.keys());r.map.forEach(function(c,f){a.map.set(f,Ef(c,e.map.get(f))),u.delete(f)}),u.forEach(function(c){a.map.set(c,Ef(e.map.get(c),r.map.get(c)))})}return a}function ku(r){return!r||!(r.info||r.map.size)}function ng(r,e){var t=r.map,n=t.get(e);n&&ku(n)&&(tg.push(n),t.delete(e))}var ig=new Set;function p1(r,e,t,n){var i=function(y){var g=n.getFieldValue(y,t);return typeof g=="object"&&g},a=i(r);if(a){var u=i(e);if(u&&!Nt(a)&&!Ft(a,u)&&!Object.keys(a).every(function(y){return n.getFieldValue(u,y)!==void 0})){var c=n.getFieldValue(r,"__typename")||n.getFieldValue(e,"__typename"),f=Gi(t),h="".concat(c,".").concat(f);if(!ig.has(h)){ig.add(h);var d=[];!ur(a)&&!ur(u)&&[a,u].forEach(function(y){var g=n.getFieldValue(y,"__typename");typeof g=="string"&&!d.includes(g)&&d.push(g)}),globalThis.__DEV__!==!1&&qe.warn(14,f,c,d.length?"either ensure all objects of type "+d.join(" and ")+" have an ID or a custom merge function, or ":"",h,L({},a),L({},u))}}}}var Of=function(r){Pn(e,r);function e(t){t===void 0&&(t={});var n=r.call(this)||this;return n.watches=new Set,n.addTypenameTransform=new mu(gu),n.assumeImmutableResults=!0,n.makeVar=Vy,n.txCount=0,n.config=e1(t),n.addTypename=!!n.config.addTypename,n.policies=new h1({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.init(),n}return e.prototype.init=function(){var t=this.data=new io.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=t.stump,this.resetResultCache()},e.prototype.resetResultCache=function(t){var n=this,i=this.storeReader,a=this.config.fragments;this.storeWriter=new d1(this,this.storeReader=new a1({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:Ry(this.config),canon:t?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=Ya(function(u,c){return n.broadcastWatch(u,c)},{max:this.config.resultCacheMaxSize||Yn["inMemoryCache.maybeBroadcastWatch"]||5e3,makeCacheKey:function(u){var c=u.optimistic?n.optimisticData:n.data;if(so(c)){var f=u.optimistic,h=u.id,d=u.variables;return c.makeCacheKey(u.query,u.callback,mi({optimistic:f,id:h,variables:d}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(u){return u.resetCaching()})},e.prototype.restore=function(t){return this.init(),t&&this.data.replace(t),this},e.prototype.extract=function(t){return t===void 0&&(t=!1),(t?this.optimisticData:this.data).extract()},e.prototype.read=function(t){var n=t.returnPartialData,i=n===void 0?!1:n;try{return this.storeReader.diffQueryAgainstStore(L(L({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof df)return null;throw a}},e.prototype.write=function(t){try{return++this.txCount,this.storeWriter.writeToStore(this.data,t)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(t){if(Rr.call(t,"id")&&!t.id)return!1;var n=t.optimistic?this.optimisticData:this.data;try{return++this.txCount,n.modify(t.id||"ROOT_QUERY",t.fields)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(t){return this.storeReader.diffQueryAgainstStore(L(L({},t),{store:t.optimistic?this.optimisticData:this.data,rootId:t.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(t){var n=this;return this.watches.size||c1(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){n.watches.delete(t)&&!n.watches.size&&By(n),n.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){var n;mi.reset(),Gs.reset(),this.addTypenameTransform.resetCache(),(n=this.config.fragments)===null||n===void 0||n.resetCaches();var i=this.optimisticData.gc();return t&&!this.txCount&&(t.resetResultCache?this.resetResultCache(t.resetResultIdentities):t.resetResultIdentities&&this.storeReader.resetCanon()),i},e.prototype.retain=function(t,n){return(n?this.optimisticData:this.data).retain(t)},e.prototype.release=function(t,n){return(n?this.optimisticData:this.data).release(t)},e.prototype.identify=function(t){if(Nt(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(n){globalThis.__DEV__!==!1&&qe.warn(n)}},e.prototype.evict=function(t){if(!t.id){if(Rr.call(t,"id"))return!1;t=L(L({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t,this.data)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(t){var n=this;return this.init(),mi.reset(),t&&t.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),By(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var n=this.optimisticData.removeLayer(t);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(t){var n=this,i=t.update,a=t.optimistic,u=a===void 0?!0:a,c=t.removeOptimistic,f=t.onWatchUpdated,h,d=function(g){var m=n,b=m.data,I=m.optimisticData;++n.txCount,g&&(n.data=n.optimisticData=g);try{return h=i(n)}finally{--n.txCount,n.data=b,n.optimisticData=I}},y=new Set;return f&&!this.txCount&&this.broadcastWatches(L(L({},t),{onWatchUpdated:function(g){return y.add(g),!1}})),typeof u=="string"?this.optimisticData=this.optimisticData.addLayer(u,d):u===!1?d(this.data):d(),typeof c=="string"&&(this.optimisticData=this.optimisticData.removeLayer(c)),f&&y.size?(this.broadcastWatches(L(L({},t),{onWatchUpdated:function(g,m){var b=f.call(this,g,m);return b!==!1&&y.delete(g),b}})),y.size&&y.forEach(function(g){return n.maybeBroadcastWatch.dirty(g)})):this.broadcastWatches(t),h},e.prototype.performTransaction=function(t,n){return this.batch({update:t,optimistic:n||n!==null})},e.prototype.transformDocument=function(t){return this.addTypenameToDocument(this.addFragmentsToDocument(t))},e.prototype.broadcastWatches=function(t){var n=this;this.txCount||this.watches.forEach(function(i){return n.maybeBroadcastWatch(i,t)})},e.prototype.addFragmentsToDocument=function(t){var n=this.config.fragments;return n?n.transform(t):t},e.prototype.addTypenameToDocument=function(t){return this.addTypename?this.addTypenameTransform.transformDocument(t):t},e.prototype.broadcastWatch=function(t,n){var i=t.lastDiff,a=this.diff(t);n&&(t.optimistic&&typeof n.optimistic=="string"&&(a.fromOptimisticTransaction=!0),n.onWatchUpdated&&n.onWatchUpdated.call(this,t,a,i)===!1)||(!i||!Ft(i.result,a.result))&&t.callback(t.lastDiff=a,i)},e}(ff);globalThis.__DEV__!==!1&&(Of.prototype.getMemoryInternals=uE);var It;(function(r){r[r.loading=1]="loading",r[r.setVariables=2]="setVariables",r[r.fetchMore=3]="fetchMore",r[r.refetch=4]="refetch",r[r.poll=6]="poll",r[r.ready=7]="ready",r[r.error=8]="error"})(It||(It={}));function oo(r){return r?r<7:!1}function m1(r){return r===7||r===8}var sg=Object.assign,y1=Object.hasOwnProperty,Iu=function(r){Pn(e,r);function e(t){var n=t.queryManager,i=t.queryInfo,a=t.options,u=r.call(this,function(x){try{var _=x._subscription._observer;_&&!_.error&&(_.error=g1)}catch{}var A=!u.observers.size;u.observers.add(x);var P=u.last;return P&&P.error?x.error&&x.error(P.error):P&&P.result&&x.next&&x.next(P.result),A&&u.reobserve().catch(function(){}),function(){u.observers.delete(x)&&!u.observers.size&&u.tearDownQuery()}})||this;u.observers=new Set,u.subscriptions=new Set,u.queryInfo=i,u.queryManager=n,u.waitForOwnResult=Tf(a.fetchPolicy),u.isTornDown=!1,u.subscribeToMore=u.subscribeToMore.bind(u);var c=n.defaultOptions.watchQuery,f=c===void 0?{}:c,h=f.fetchPolicy,d=h===void 0?"cache-first":h,y=a.fetchPolicy,g=y===void 0?d:y,m=a.initialFetchPolicy,b=m===void 0?g==="standby"?d:g:m;u.options=L(L({},a),{initialFetchPolicy:b,fetchPolicy:g}),u.queryId=i.queryId||n.generateQueryId();var I=_s(u.query);return u.queryName=I&&I.name&&I.name.value,u}return Object.defineProperty(e.prototype,"query",{get:function(){return this.lastQuery||this.options.query},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var t=this;return new Promise(function(n,i){var a={next:function(c){n(c),t.observers.delete(a),t.observers.size||t.queryManager.removeQuery(t.queryId),setTimeout(function(){u.unsubscribe()},0)},error:i},u=t.subscribe(a)})},e.prototype.resetDiff=function(){this.queryInfo.resetDiff()},e.prototype.getCurrentResult=function(t){t===void 0&&(t=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||It.ready,a=L(L({},n),{loading:oo(i),networkStatus:i}),u=this.options.fetchPolicy,c=u===void 0?"cache-first":u;if(!(Tf(c)||this.queryManager.getDocumentInfo(this.query).hasForcedResolvers))if(this.waitForOwnResult)this.queryInfo.updateWatch();else{var f=this.queryInfo.getDiff();(f.complete||this.options.returnPartialData)&&(a.data=f.result),Ft(a.data,{})&&(a.data=void 0),f.complete?(delete a.partial,f.complete&&a.networkStatus===It.loading&&(c==="cache-first"||c==="cache-only")&&(a.networkStatus=It.ready,a.loading=!1)):a.partial=!0,globalThis.__DEV__!==!1&&!f.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&og(f.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,n){if(!this.last)return!0;var i=this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective?!Cy(this.query,this.last.result,t,this.variables):!Ft(this.last.result,t);return i||n&&!Ft(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||Ft(i.variables,this.variables)))return i[t]},e.prototype.getLastResult=function(t){return this.getLast("result",t)},e.prototype.getLastError=function(t){return this.getLast("error",t)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(t){var n,i={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?i.fetchPolicy=a:a==="no-cache"?i.fetchPolicy="no-cache":i.fetchPolicy="network-only",globalThis.__DEV__!==!1&&t&&y1.call(t,"variables")){var u=Rl(this.query),c=u.variableDefinitions;(!c||!c.some(function(f){return f.variable.name.value==="variables"}))&&globalThis.__DEV__!==!1&&qe.warn(20,t,((n=u.name)===null||n===void 0?void 0:n.value)||u)}return t&&!Ft(this.options.variables,t)&&(i.variables=this.options.variables=L(L({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(i,It.refetch)},e.prototype.fetchMore=function(t){var n=this,i=L(L({},t.query?t:L(L(L(L({},this.options),{query:this.options.query}),t),{variables:L(L({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"});i.query=this.transformDocument(i.query);var a=this.queryManager.generateQueryId();this.lastQuery=t.query?this.transformDocument(this.options.query):i.query;var u=this.queryInfo,c=u.networkStatus;u.networkStatus=It.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var f=new Set,h=t==null?void 0:t.updateQuery,d=this.options.fetchPolicy!=="no-cache";return d||qe(h,21),this.queryManager.fetchQuery(a,i,It.fetchMore).then(function(y){if(n.queryManager.removeQuery(a),u.networkStatus===It.fetchMore&&(u.networkStatus=c),d)n.queryManager.cache.batch({update:function(b){var I=t.updateQuery;I?b.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(x){return I(x,{fetchMoreResult:y.data,variables:i.variables})}):b.writeQuery({query:i.query,variables:i.variables,data:y.data})},onWatchUpdated:function(b){f.add(b.query)}});else{var g=n.getLast("result"),m=h(g.data,{fetchMoreResult:y.data,variables:i.variables});n.reportResult(L(L({},g),{data:m}),n.variables)}return y}).finally(function(){d&&!f.has(n.query)&&ag(n)})},e.prototype.subscribeToMore=function(t){var n=this,i=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var u=t.updateQuery;u&&n.updateQuery(function(c,f){var h=f.variables;return u(c,{subscriptionData:a,variables:h})})},error:function(a){if(t.onError){t.onError(a);return}globalThis.__DEV__!==!1&&qe.error(22,a)}});return this.subscriptions.add(i),function(){n.subscriptions.delete(i)&&i.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.silentSetOptions=function(t){var n=zi(this.options,t||{});sg(this.options,n)},e.prototype.setVariables=function(t){return Ft(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},It.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var n=this.queryManager,i=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(i,{variables:this.variables});a&&(n.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),n.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,n){if(n.nextFetchPolicy){var i=n.fetchPolicy,a=i===void 0?"cache-first":i,u=n.initialFetchPolicy,c=u===void 0?a:u;a==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy(a,{reason:t,options:n,observable:this,initialFetchPolicy:c}):t==="variables-changed"?n.fetchPolicy=c:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(t,n,i){return this.queryManager.setObservableQuery(this),this.queryManager.fetchConcastWithInfo(this.queryId,t,n,i)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var n=this,i=n.pollingInfo,a=n.options.pollInterval;if(!a||!this.hasObservers()){i&&(clearTimeout(i.timeout),delete this.pollingInfo);return}if(!(i&&i.interval===a)){qe(a,23);var u=i||(this.pollingInfo={});u.interval=a;var c=function(){var h,d;t.pollingInfo&&(!oo(t.queryInfo.networkStatus)&&!(!((d=(h=t.options).skipPollAttempt)===null||d===void 0)&&d.call(h))?t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},It.poll).then(f,f):f())},f=function(){var h=t.pollingInfo;h&&(clearTimeout(h.timeout),h.timeout=setTimeout(c,h.interval))};f()}}},e.prototype.updateLastResult=function(t,n){n===void 0&&(n=this.variables);var i=this.getLastError();return i&&this.last&&!Ft(n,this.last.variables)&&(i=void 0),this.last=L({result:this.queryManager.assumeImmutableResults?t:Kl(t),variables:n},i?{error:i}:null)},e.prototype.reobserveAsConcast=function(t,n){var i=this;this.isTornDown=!1;var a=n===It.refetch||n===It.fetchMore||n===It.poll,u=this.options.variables,c=this.options.fetchPolicy,f=zi(this.options,t||{}),h=a?f:sg(this.options,f),d=this.transformDocument(h.query);this.lastQuery=d,a||(this.updatePolling(),t&&t.variables&&!Ft(t.variables,u)&&h.fetchPolicy!=="standby"&&(h.fetchPolicy===c||typeof h.nextFetchPolicy=="function")&&(this.applyNextFetchPolicy("variables-changed",h),n===void 0&&(n=It.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=Tf(h.fetchPolicy));var y=function(){i.concast===b&&(i.waitForOwnResult=!1)},g=h.variables&&L({},h.variables),m=this.fetch(h,n,d),b=m.concast,I=m.fromLink,x={next:function(_){Ft(i.variables,g)&&(y(),i.reportResult(_,g))},error:function(_){Ft(i.variables,g)&&(sf(_)||(_=new yn({networkError:_})),y(),i.reportError(_,g))}};return!a&&(I||!this.concast)&&(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=b,this.observer=x),b.addObserver(x),b},e.prototype.reobserve=function(t,n){return this.reobserveAsConcast(t,n).promise},e.prototype.resubscribeAfterError=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this.last;this.resetLastResults();var a=this.subscribe.apply(this,t);return this.last=i,a},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,n){var i=this.getLastError(),a=this.isDifferentFromLastResult(t,n);(i||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,n),(i||a)&&Ys(this.observers,"next",t)},e.prototype.reportError=function(t,n){var i=L(L({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:It.error,loading:!1});this.updateLastResult(i,n),Ys(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e.prototype.transformDocument=function(t){return this.queryManager.transform(t)},e}(Rt);Xl(Iu);function ag(r){var e=r.options,t=e.fetchPolicy,n=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(i,a){return this.nextFetchPolicy=n,typeof this.nextFetchPolicy=="function"?this.nextFetchPolicy(i,a):t}}):r.reobserve()}function g1(r){globalThis.__DEV__!==!1&&qe.error(24,r.message,r.stack)}function og(r){globalThis.__DEV__!==!1&&r&&globalThis.__DEV__!==!1&&qe.debug(25,r)}function Tf(r){return r==="network-only"||r==="no-cache"||r==="standby"}var Xs=new(gs?WeakMap:Map);function Af(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return Xs.set(r,(Xs.get(r)+1)%1e15),t.apply(this,arguments)})}function ug(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var kf=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var n=this.cache=e.cache;Xs.has(n)||(Xs.set(n,0),Af(n,"evict"),Af(n,"modify"),Af(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||It.loading;return this.variables&&this.networkStatus!==It.loading&&!Ft(this.variables,e.variables)&&(t=It.setVariables),Ft(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){ug(this),this.dirty=!1},r.prototype.resetDiff=function(){this.lastDiff=void 0},r.prototype.getDiff=function(){var e=this.getDiffOptions();if(this.lastDiff&&Ft(e,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables);var t=this.observableQuery;if(t&&t.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(e);return this.updateLastDiff(n,e),n},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t=this,n,i=this.lastDiff&&this.lastDiff.diff;e&&!e.complete&&(!((n=this.observableQuery)===null||n===void 0)&&n.getLastError())||(this.updateLastDiff(e),!this.dirty&&!Ft(i&&i.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0))))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var n=t.getDiff();n.fromOptimisticTransaction?e.observe():ag(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;ug(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(oo(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel;var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var i=L(L({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Ft(i,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=i))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var n=this.lastWrite;return!(n&&n.dmCount===Xs.get(this.cache)&&Ft(t,n.variables)&&Ft(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,u=new vi,c=mn(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&mn(e.incremental)){var f=ef(this.getDiff().result,e);e.data=f}else if("hasNext"in e&&e.hasNext){var h=this.getDiff();e.data=u.merge(h.result,e.data)}this.graphQLErrors=c,n.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(n.variables)):i!==0&&(If(e,n.errorPolicy)?this.cache.performTransaction(function(d){if(a.shouldWrite(e,n.variables))d.writeQuery({query:t,data:e.data,variables:n.variables,overwrite:i===1}),a.lastWrite={result:e,variables:n.variables,dmCount:Xs.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var y=a.getDiffOptions(n.variables),g=d.diff(y);!a.stopped&&Ft(a.variables,n.variables)&&a.updateWatch(n.variables),a.updateLastDiff(g,y),g.complete&&(e.data=g.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=It.ready},r.prototype.markError=function(e){return this.networkStatus=It.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function If(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",n=!to(r);return!n&&t&&r.data&&(n=!0),n}var v1=Object.prototype.hasOwnProperty,cg=Object.create(null),b1=function(){function r(e){var t=this;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new cu(Yn["queryManager.getDocumentInfo"]||2e3),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Ws(!1);var n=new mu(function(a){return t.cache.transformDocument(a)},{cache:!1});this.cache=e.cache,this.link=e.link,this.defaultOptions=e.defaultOptions,this.queryDeduplication=e.queryDeduplication,this.clientAwareness=e.clientAwareness,this.localState=e.localState,this.ssrMode=e.ssrMode,this.assumeImmutableResults=e.assumeImmutableResults;var i=e.documentTransform;this.documentTransform=i?n.concat(i).concat(n):n,this.defaultContext=e.defaultContext||Object.create(null),(this.onBroadcast=e.onBroadcast)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(Yr(26))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){return qi(this,arguments,void 0,function(t){var n,i,a,u,c,f,h,d=t.mutation,y=t.variables,g=t.optimisticResponse,m=t.updateQueries,b=t.refetchQueries,I=b===void 0?[]:b,x=t.awaitRefetchQueries,_=x===void 0?!1:x,A=t.update,P=t.onQueryUpdated,M=t.fetchPolicy,$=M===void 0?((f=this.defaultOptions.mutate)===null||f===void 0?void 0:f.fetchPolicy)||"network-only":M,j=t.errorPolicy,K=j===void 0?((h=this.defaultOptions.mutate)===null||h===void 0?void 0:h.errorPolicy)||"none":j,ee=t.keepRootFields,fe=t.context;return ji(this,function(de){switch(de.label){case 0:return qe(d,27),qe($==="network-only"||$==="no-cache",28),n=this.generateMutationId(),d=this.cache.transformForLink(this.transform(d)),i=this.getDocumentInfo(d).hasClientExports,y=this.getVariables(d,y),i?[4,this.localState.addExportedVariables(d,y,fe)]:[3,2];case 1:y=de.sent(),de.label=2;case 2:return a=this.mutationStore&&(this.mutationStore[n]={mutation:d,variables:y,loading:!0,error:null}),u=g&&this.markMutationOptimistic(g,{mutationId:n,document:d,variables:y,fetchPolicy:$,errorPolicy:K,context:fe,updateQueries:m,update:A,keepRootFields:ee}),this.broadcastQueries(),c=this,[2,new Promise(function(Ie,pe){return wu(c.getObservableFromLink(d,L(L({},fe),{optimisticResponse:u?g:void 0}),y,{},!1),function(Ce){if(to(Ce)&&K==="none")throw new yn({graphQLErrors:_u(Ce)});a&&(a.loading=!1,a.error=null);var Pe=L({},Ce);return typeof I=="function"&&(I=I(Pe)),K==="ignore"&&to(Pe)&&delete Pe.errors,c.markMutationResult({mutationId:n,result:Pe,document:d,variables:y,fetchPolicy:$,errorPolicy:K,context:fe,update:A,updateQueries:m,awaitRefetchQueries:_,refetchQueries:I,removeOptimistic:u?n:void 0,onQueryUpdated:P,keepRootFields:ee})}).subscribe({next:function(Ce){c.broadcastQueries(),(!("hasNext"in Ce)||Ce.hasNext===!1)&&Ie(Ce)},error:function(Ce){a&&(a.loading=!1,a.error=Ce),u&&c.cache.removeOptimistic(n),c.broadcastQueries(),pe(Ce instanceof yn?Ce:new yn({networkError:Ce}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var n=this;t===void 0&&(t=this.cache);var i=e.result,a=[],u=e.fetchPolicy==="no-cache";if(!u&&If(i,e.errorPolicy)){if(Ss(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Ss(i)&&mn(i.incremental)){var c=t.diff({id:"ROOT_MUTATION",query:this.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),f=void 0;c.result&&(f=ef(c.result,i)),typeof f<"u"&&(i.data=f,a.push({result:f,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var h=e.updateQueries;h&&this.queries.forEach(function(y,g){var m=y.observableQuery,b=m&&m.queryName;if(!(!b||!v1.call(h,b))){var I=h[b],x=n.queries.get(g),_=x.document,A=x.variables,P=t.diff({query:_,variables:A,returnPartialData:!0,optimistic:!1}),M=P.result,$=P.complete;if($&&M){var j=I(M,{mutationResult:i,queryName:_&&fu(_)||void 0,queryVariables:A});j&&a.push({result:j,dataId:"ROOT_QUERY",query:_,variables:A})}}})}if(a.length>0||(e.refetchQueries||"").length>0||e.update||e.onQueryUpdated||e.removeOptimistic){var d=[];if(this.refetchQueries({updateCache:function(y){u||a.forEach(function(I){return y.write(I)});var g=e.update,m=!hy(i)||Ss(i)&&!i.hasNext;if(g){if(!u){var b=y.diff({id:"ROOT_MUTATION",query:n.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});b.complete&&(i=L(L({},i),{data:b.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}m&&g(y,i,{context:e.context,variables:e.variables})}!u&&!e.keepRootFields&&m&&y.modify({id:"ROOT_MUTATION",fields:function(I,x){var _=x.fieldName,A=x.DELETE;return _==="__typename"?I:A}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(y){return d.push(y)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(d).then(function(){return i})}return Promise.resolve(i)},r.prototype.markMutationOptimistic=function(e,t){var n=this,i=typeof e=="function"?e(t.variables,{IGNORE:cg}):e;return i===cg?!1:(this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(L(L({},t),{result:{data:i}}),a)}catch(u){globalThis.__DEV__!==!1&&qe.error(u)}},t.mutationId),!0)},r.prototype.fetchQuery=function(e,t,n){return this.fetchConcastWithInfo(e,t,n).concast.promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,n){e[n]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){return this.documentTransform.transformDocument(e)},r.prototype.getDocumentInfo=function(e){var t=this.transformCache;if(!t.has(e)){var n={hasClientExports:wm(e),hasForcedResolvers:this.localState.shouldForceResolvers(e),hasNonreactiveDirective:Ui(["nonreactive"],e),clientQuery:this.localState.clientQuery(e),serverQuery:yu([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"}],e),defaultVars:hu(_s(e)),asQuery:L(L({},e),{definitions:e.definitions.map(function(i){return i.kind==="OperationDefinition"&&i.operation!=="query"?L(L({},i),{operation:"query"}):i})})};t.set(e,n)}return t.get(e)},r.prototype.getVariables=function(e,t){return L(L({},this.getDocumentInfo(e).defaultVars),t)},r.prototype.watchQuery=function(e){var t=this.transform(e.query);e=L(L({},e),{variables:this.getVariables(t,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var n=new kf(this),i=new Iu({queryManager:this,queryInfo:n,options:e});return i.lastQuery=t,this.queries.set(i.queryId,n),n.init({document:t,observableQuery:i,variables:i.variables}),i},r.prototype.query=function(e,t){var n=this;return t===void 0&&(t=this.generateQueryId()),qe(e.query,29),qe(e.query.kind==="Document",30),qe(!e.returnPartialData,31),qe(!e.pollInterval,32),this.fetchQuery(t,L(L({},e),{query:this.transform(e.query)})).finally(function(){return n.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(Yr(33)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=It.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var n=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(u){typeof u=="string"?i.set(u,!1):Nm(u)?i.set(t.transform(u),!1):er(u)&&u.query&&a.add(u)}),this.queries.forEach(function(u,c){var f=u.observableQuery,h=u.document;if(f){if(e==="all"){n.set(c,f);return}var d=f.queryName,y=f.options.fetchPolicy;if(y==="standby"||e==="active"&&!f.hasObservers())return;(e==="active"||d&&i.has(d)||h&&i.has(h))&&(n.set(c,f),d&&i.set(d,!0),h&&i.set(h,!0))}}),a.size&&a.forEach(function(u){var c=eu("legacyOneTimeQuery"),f=t.getQuery(c).init({document:u.query,variables:u.variables}),h=new Iu({queryManager:t,queryInfo:f,options:L(L({},u),{fetchPolicy:"network-only"})});qe(h.queryId===c),f.setObservableQuery(h),n.set(c,h)}),globalThis.__DEV__!==!1&&i.size&&i.forEach(function(u,c){u||globalThis.__DEV__!==!1&&qe.warn(typeof c=="string"?34:35,c)}),n},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var n=[];return this.getObservableQueries(e?"all":"active").forEach(function(i,a){var u=i.options.fetchPolicy;i.resetLastResults(),(e||u!=="standby"&&u!=="cache-only")&&n.push(i.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,n=e.query,i=e.fetchPolicy,a=e.errorPolicy,u=a===void 0?"none":a,c=e.variables,f=e.context,h=f===void 0?{}:f,d=e.extensions,y=d===void 0?{}:d;n=this.transform(n),c=this.getVariables(n,c);var g=function(b){return t.getObservableFromLink(n,h,b,y).map(function(I){i!=="no-cache"&&(If(I,u)&&t.cache.write({query:n,result:I.data,dataId:"ROOT_SUBSCRIPTION",variables:b}),t.broadcastQueries());var x=to(I),_=qO(I);if(x||_){var A={};if(x&&(A.graphQLErrors=I.errors),_&&(A.protocolErrors=I.extensions[nf]),u==="none"||_)throw new yn(A)}return u==="ignore"&&delete I.errors,I})};if(this.getDocumentInfo(n).hasClientExports){var m=this.localState.addExportedVariables(n,c,h).then(g);return new Rt(function(b){var I=null;return m.then(function(x){return I=x.subscribe(b)},b.error),function(){return I&&I.unsubscribe()}})}return g(c)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,n,i,a){var u=this,c;a===void 0&&(a=(c=t==null?void 0:t.queryDeduplication)!==null&&c!==void 0?c:this.queryDeduplication);var f,h=this.getDocumentInfo(e),d=h.serverQuery,y=h.clientQuery;if(d){var g=this,m=g.inFlightLinkObservables,b=g.link,I={query:d,variables:n,operationName:fu(d)||void 0,context:this.prepareContext(L(L({},t),{forceFetch:!a})),extensions:i};if(t=I.context,a){var x=Gs(d),_=mi(n),A=m.lookup(x,_);if(f=A.observable,!f){var P=new xs([Eu(b,I)]);f=A.observable=P,P.beforeNext(function(){m.remove(x,_)})}}else f=new xs([Eu(b,I)])}else f=new xs([Rt.of({data:{}})]),t=this.prepareContext(t);return y&&(f=wu(f,function(M){return u.localState.runResolvers({document:y,remoteResult:M,context:t,variables:n})})),f},r.prototype.getResultsFromLink=function(e,t,n){var i=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(n.query);return wu(this.getObservableFromLink(a,n.context,n.variables),function(u){var c=_u(u),f=c.length>0,h=n.errorPolicy;if(i>=e.lastRequestId){if(f&&h==="none")throw e.markError(new yn({graphQLErrors:c}));e.markResult(u,a,n,t),e.markReady()}var d={data:u.data,loading:!1,networkStatus:It.ready};return f&&h==="none"&&(d.data=void 0),f&&h!=="ignore"&&(d.errors=c,d.networkStatus=It.error),d},function(u){var c=sf(u)?u:new yn({networkError:u});throw i>=e.lastRequestId&&e.markError(c),c})},r.prototype.fetchConcastWithInfo=function(e,t,n,i){var a=this;n===void 0&&(n=It.loading),i===void 0&&(i=t.query);var u=this.getVariables(i,t.variables),c=this.getQuery(e),f=this.defaultOptions.watchQuery,h=t.fetchPolicy,d=h===void 0?f&&f.fetchPolicy||"cache-first":h,y=t.errorPolicy,g=y===void 0?f&&f.errorPolicy||"none":y,m=t.returnPartialData,b=m===void 0?!1:m,I=t.notifyOnNetworkStatusChange,x=I===void 0?!1:I,_=t.context,A=_===void 0?{}:_,P=Object.assign({},t,{query:i,variables:u,fetchPolicy:d,errorPolicy:g,returnPartialData:b,notifyOnNetworkStatusChange:x,context:A}),M=function(fe){P.variables=fe;var de=a.fetchQueryByPolicy(c,P,n);return P.fetchPolicy!=="standby"&&de.sources.length>0&&c.observableQuery&&c.observableQuery.applyNextFetchPolicy("after-fetch",t),de},$=function(){return a.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(fe){$(),setTimeout(function(){return j.cancel(fe)})});var j,K;if(this.getDocumentInfo(P.query).hasClientExports)j=new xs(this.localState.addExportedVariables(P.query,P.variables,P.context).then(M).then(function(fe){return fe.sources})),K=!0;else{var ee=M(P.variables);K=ee.fromLink,j=new xs(ee.sources)}return j.promise.then($,$),{concast:j,fromLink:K}},r.prototype.refetchQueries=function(e){var t=this,n=e.updateCache,i=e.include,a=e.optimistic,u=a===void 0?!1:a,c=e.removeOptimistic,f=c===void 0?u?eu("refetchQueries"):void 0:c,h=e.onQueryUpdated,d=new Map;i&&this.getObservableQueries(i).forEach(function(g,m){d.set(m,{oq:g,lastDiff:t.getQuery(m).getDiff()})});var y=new Map;return n&&this.cache.batch({update:n,optimistic:u&&f||!1,removeOptimistic:f,onWatchUpdated:function(g,m,b){var I=g.watcher instanceof kf&&g.watcher.observableQuery;if(I){if(h){d.delete(I.queryId);var x=h(I,m,b);return x===!0&&(x=I.refetch()),x!==!1&&y.set(I,x),x}h!==null&&d.set(I.queryId,{oq:I,lastDiff:b,diff:m})}}}),d.size&&d.forEach(function(g,m){var b=g.oq,I=g.lastDiff,x=g.diff,_;if(h){if(!x){var A=b.queryInfo;A.reset(),x=A.getDiff()}_=h(b,x,I)}(!h||_===!0)&&(_=b.refetch()),_!==!1&&y.set(b,_),m.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(m)}),f&&this.cache.removeOptimistic(f),y},r.prototype.fetchQueryByPolicy=function(e,t,n){var i=this,a=t.query,u=t.variables,c=t.fetchPolicy,f=t.refetchWritePolicy,h=t.errorPolicy,d=t.returnPartialData,y=t.context,g=t.notifyOnNetworkStatusChange,m=e.networkStatus;e.init({document:a,variables:u,networkStatus:n});var b=function(){return e.getDiff()},I=function(M,$){$===void 0&&($=e.networkStatus||It.loading);var j=M.result;globalThis.__DEV__!==!1&&!d&&!Ft(j,{})&&og(M.missing);var K=function(ee){return Rt.of(L({data:ee,loading:oo($),networkStatus:$},M.complete?null:{partial:!0}))};return j&&i.getDocumentInfo(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:j},context:y,variables:u,onlyRunForcedResolvers:!0}).then(function(ee){return K(ee.data||void 0)}):h==="none"&&$===It.refetch&&Array.isArray(M.missing)?K(void 0):K(j)},x=c==="no-cache"?0:n===It.refetch&&f!=="merge"?1:2,_=function(){return i.getResultsFromLink(e,x,{query:a,variables:u,context:y,fetchPolicy:c,errorPolicy:h})},A=g&&typeof m=="number"&&m!==n&&oo(n);switch(c){default:case"cache-first":{var P=b();return P.complete?{fromLink:!1,sources:[I(P,e.markReady())]}:d||A?{fromLink:!0,sources:[I(P),_()]}:{fromLink:!0,sources:[_()]}}case"cache-and-network":{var P=b();return P.complete||d||A?{fromLink:!0,sources:[I(P),_()]}:{fromLink:!0,sources:[_()]}}case"cache-only":return{fromLink:!1,sources:[I(b(),e.markReady())]};case"network-only":return A?{fromLink:!0,sources:[I(b()),_()]}:{fromLink:!0,sources:[_()]};case"no-cache":return A?{fromLink:!0,sources:[I(e.getDiff()),_()]}:{fromLink:!0,sources:[_()]};case"standby":return{fromLink:!1,sources:[]}}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new kf(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return L(L(L({},this.defaultContext),t),{clientAwareness:this.clientAwareness})},r}(),w1=function(){function r(e){var t=e.cache,n=e.client,i=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,n&&(this.client=n),i&&this.addResolvers(i),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){t.resolvers=Za(t.resolvers,n)}):this.resolvers=Za(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){return qi(this,arguments,void 0,function(t){var n=t.document,i=t.remoteResult,a=t.context,u=t.variables,c=t.onlyRunForcedResolvers,f=c===void 0?!1:c;return ji(this,function(h){return n?[2,this.resolveDocument(n,i.data,a,u,this.fragmentMatcher,f).then(function(d){return L(L({},i),{data:d.result})})]:[2,i]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return Ui(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return $l(e)},r.prototype.prepareContext=function(e){var t=this.cache;return L(L({},e),{cache:t,getCacheKey:function(n){return t.identify(n)}})},r.prototype.addExportedVariables=function(e){return qi(this,arguments,void 0,function(t,n,i){return n===void 0&&(n={}),i===void 0&&(i={}),ji(this,function(a){return t?[2,this.resolveDocument(t,this.buildRootValueFromCache(t,n)||{},this.prepareContext(i),n).then(function(u){return L(L({},n),u.exportedVariables)})]:[2,L({},n)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return Rn(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(t=n.arguments.some(function(i){return i.name.value==="always"&&i.value.kind==="BooleanValue"&&i.value.value===!0}),t))return Sl}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:ny(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t){return qi(this,arguments,void 0,function(n,i,a,u,c,f){var h,d,y,g,m,b,I,x,_,A,P;return a===void 0&&(a={}),u===void 0&&(u={}),c===void 0&&(c=function(){return!0}),f===void 0&&(f=!1),ji(this,function(M){return h=Vi(n),d=Qa(n),y=Wa(d),g=this.collectSelectionsToResolve(h,y),m=h.operation,b=m?m.charAt(0).toUpperCase()+m.slice(1):"Query",I=this,x=I.cache,_=I.client,A={fragmentMap:y,context:L(L({},a),{cache:x,client:_}),variables:u,fragmentMatcher:c,defaultOperationType:b,exportedVariables:{},selectionsToResolve:g,onlyRunForcedResolvers:f},P=!1,[2,this.resolveSelectionSet(h.selectionSet,P,i,A).then(function($){return{result:$,exportedVariables:A.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,n,i){return qi(this,void 0,void 0,function(){var a,u,c,f,h,d=this;return ji(this,function(y){return a=i.fragmentMap,u=i.context,c=i.variables,f=[n],h=function(g){return qi(d,void 0,void 0,function(){var m,b;return ji(this,function(I){return!t&&!i.selectionsToResolve.has(g)?[2]:Vs(g,c)?gi(g)?[2,this.resolveField(g,t,n,i).then(function(x){var _;typeof x<"u"&&f.push((_={},_[yi(g)]=x,_))})]:(Mm(g)?m=g:(m=a[g.name.value],qe(m,18,g.name.value)),m&&m.typeCondition&&(b=m.typeCondition.name.value,i.fragmentMatcher(n,b,u))?[2,this.resolveSelectionSet(m.selectionSet,t,n,i).then(function(x){f.push(x)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(h)).then(function(){return Xa(f)})]})})},r.prototype.resolveField=function(e,t,n,i){return qi(this,void 0,void 0,function(){var a,u,c,f,h,d,y,g,m,b=this;return ji(this,function(I){return n?(a=i.variables,u=e.name.value,c=yi(e),f=u!==c,h=n[c]||n[u],d=Promise.resolve(h),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(y=n.__typename||i.defaultOperationType,g=this.resolvers&&this.resolvers[y],g&&(m=g[f?u:c],m&&(d=Promise.resolve(vf.withValue(this.cache,m,[n,Ga(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,d.then(function(x){var _,A;if(x===void 0&&(x=h),e.directives&&e.directives.forEach(function(M){M.name.value==="export"&&M.arguments&&M.arguments.forEach(function($){$.name.value==="as"&&$.value.kind==="StringValue"&&(i.exportedVariables[$.value.value]=x)})}),!e.selectionSet||x==null)return x;var P=(A=(_=e.directives)===null||_===void 0?void 0:_.some(function(M){return M.name.value==="client"}))!==null&&A!==void 0?A:!1;if(Array.isArray(x))return b.resolveSubSelectedArray(e,t||P,x,i);if(e.selectionSet)return b.resolveSelectionSet(e.selectionSet,t||P,x,i)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,n,i){var a=this;return Promise.all(n.map(function(u){if(u===null)return null;if(Array.isArray(u))return a.resolveSubSelectedArray(e,t,u,i);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,u,i)}))},r.prototype.collectSelectionsToResolve=function(e,t){var n=function(u){return!Array.isArray(u)},i=this.selectionsToResolveCache;function a(u){if(!i.has(u)){var c=new Set;i.set(u,c),Rn(u,{Directive:function(f,h,d,y,g){f.name.value==="client"&&g.forEach(function(m){n(m)&&bm(m)&&c.add(m)})},FragmentSpread:function(f,h,d,y,g){var m=t[f.name.value];qe(m,19,f.name.value);var b=a(m);b.size>0&&(g.forEach(function(I){n(I)&&bm(I)&&c.add(I)}),c.add(f),b.forEach(function(I){c.add(I)}))}})}return i.get(u)}return a(e)},r}(),lg=!1,Cf=function(){function r(e){var t=this;if(this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],!e.cache)throw Yr(15);var n=e.uri,i=e.credentials,a=e.headers,u=e.cache,c=e.documentTransform,f=e.ssrMode,h=f===void 0?!1:f,d=e.ssrForceFetchDelay,y=d===void 0?0:d,g=e.connectToDevTools,m=e.queryDeduplication,b=m===void 0?!0:m,I=e.defaultOptions,x=e.defaultContext,_=e.assumeImmutableResults,A=_===void 0?u.assumeImmutableResults:_,P=e.resolvers,M=e.typeDefs,$=e.fragmentMatcher,j=e.name,K=e.version,ee=e.devtools,fe=e.link;fe||(fe=n?new Oy({uri:n,credentials:i,headers:a}):Kr.empty()),this.link=fe,this.cache=u,this.disableNetworkFetches=h||y>0,this.queryDeduplication=b,this.defaultOptions=I||Object.create(null),this.typeDefs=M,this.devtoolsConfig=L(L({},ee),{enabled:(ee==null?void 0:ee.enabled)||g}),this.devtoolsConfig.enabled===void 0&&(this.devtoolsConfig.enabled=globalThis.__DEV__!==!1),y&&setTimeout(function(){return t.disableNetworkFetches=!1},y),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.watchFragment=this.watchFragment.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),this.version=hl,this.localState=new w1({cache:u,client:this,resolvers:P,fragmentMatcher:$}),this.queryManager=new b1({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,defaultContext:x,documentTransform:c,queryDeduplication:b,ssrMode:h,clientAwareness:{name:j,version:K},localState:this.localState,assumeImmutableResults:A,onBroadcast:this.devtoolsConfig.enabled?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0}),this.devtoolsConfig.enabled&&this.connectToDevTools()}return r.prototype.connectToDevTools=function(){if(!(typeof window>"u")){var e=window,t=Symbol.for("apollo.devtools");(e[t]=e[t]||[]).push(this),e.__APOLLO_CLIENT__=this,!lg&&globalThis.__DEV__!==!1&&(lg=!0,window.document&&window.top===window.self&&/^(https?|file):$/.test(window.location.protocol)&&setTimeout(function(){if(!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__){var n=window.navigator,i=n&&n.userAgent,a=void 0;typeof i=="string"&&(i.indexOf("Chrome/")>-1?a="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":i.indexOf("Firefox/")>-1&&(a="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),a&&globalThis.__DEV__!==!1&&qe.log("Download the Apollo DevTools for a better development experience: %s",a)}},1e4))}},Object.defineProperty(r.prototype,"documentTransform",{get:function(){return this.queryManager.documentTransform},enumerable:!1,configurable:!0}),r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Hi(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=L(L({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Hi(this.defaultOptions.query,e)),qe(e.fetchPolicy!=="cache-and-network",16),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=L(L({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Hi(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.watchFragment=function(e){return this.cache.watchFragment(e)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return Eu(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),n=[],i=[];t.forEach(function(u,c){n.push(c),i.push(u)});var a=Promise.all(i);return a.queries=n,a.results=i,a.catch(function(u){globalThis.__DEV__!==!1&&qe.debug(17,u)}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},Object.defineProperty(r.prototype,"defaultContext",{get:function(){return this.queryManager.defaultContext},enumerable:!1,configurable:!0}),r}();globalThis.__DEV__!==!1&&(Cf.prototype.getMemoryInternals=oE);var Cu=new Map,Pf=new Map,fg=!0,Pu=!1;function hg(r){return r.replace(/[\s,]+/g," ").trim()}function _1(r){return hg(r.source.body.substring(r.start,r.end))}function x1(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=_1(n.loc),u=Pf.get(i);u&&!u.has(a)?fg&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
83
|
+
`),O=aO(S.slice(0,w)),P=O["content-type"],P&&P.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");if(D=S.slice(w),D){if(T=Ny(r,D),Object.keys(T).length>1||"data"in T||"incremental"in T||"errors"in T||"payload"in T)if(Ty(T)){if(N={},"payload"in T){if(Object.keys(T).length===1&&T.payload===null)return[2];N=F({},T.payload)}"errors"in T&&(N=F(F({},N),{extensions:F(F({},"extensions"in N?N.extensions:null),(q={},q[Nu]=T.errors,q))})),e(N)}else e(T);else if(Object.keys(T).length===1&&"hasNext"in T&&!T.hasNext)return[2]}I=c.indexOf(u)}return[3,1];case 3:return[2]}})})}function aO(r){var e={};return r.split(`
|
|
84
|
+
`).forEach(function(t){var n=t.indexOf(":");if(n>-1){var i=t.slice(0,n).trim().toLowerCase(),a=t.slice(n+1).trim();e[i]=a}}),e}function Ny(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};of(r,t(),"Response not successful: Received status code ".concat(r.status))}try{return JSON.parse(e)}catch(i){var n=i;throw n.name="ServerParseError",n.response=r,n.statusCode=r.status,n.bodyText=e,n}}function oO(r,e){r.result&&r.result.errors&&r.result.data&&e.next(r.result),e.error(r)}function Ry(r){return function(e){return e.text().then(function(t){return Ny(e,t)}).then(function(t){return!Array.isArray(t)&&!Py.call(t,"data")&&!Py.call(t,"errors")&&of(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(n){return n.operationName}):r.operationName,"'.")),t})}}var Ru=function(r,e){var t;try{t=JSON.stringify(r)}catch(i){var n=Jr(42,e,i.message);throw n.parseError=i,n}return t},uO={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},cO={accept:"*/*","content-type":"application/json"},lO={method:"POST"},My={http:uO,headers:cO,options:lO},cf=function(r,e){return e(r)};function fO(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return t.unshift(e),lf.apply(void 0,lr([r,cf],t,!1))}function lf(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i={},a={};t.forEach(function(m){i=F(F(F({},i),m.options),{headers:F(F({},i.headers),m.headers)}),m.credentials&&(i.credentials=m.credentials),a=F(F({},a),m.http)}),i.headers&&(i.headers=hO(i.headers,a.preserveHeaderCase));var u=r.operationName,c=r.extensions,f=r.variables,h=r.query,p={operationName:u,variables:f};return a.includeExtensions&&(p.extensions=c),a.includeQuery&&(p.query=e(h,gi)),{options:i,body:p}}function hO(r,e){if(!e){var t={};return Object.keys(Object(r)).forEach(function(a){t[a.toLowerCase()]=r[a]}),t}var n={};Object.keys(Object(r)).forEach(function(a){n[a.toLowerCase()]={originalName:a,value:r[a]}});var i={};return Object.keys(n).forEach(function(a){i[n[a].originalName]=n[a].value}),i}var Dy=function(r){if(!r&&typeof fetch>"u")throw Jr(40)},dO=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}},Fy=function(r,e){var t=r.getContext(),n=t.uri;return n||(typeof e=="function"?e(r):e||"/graphql")};function Ly(r,e){var t=[],n=function(m,y){t.push("".concat(m,"=").concat(encodeURIComponent(y)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=Ru(e.variables,"Variables map")}catch(m){return{parseError:m}}n("variables",i)}if(e.extensions){var a=void 0;try{a=Ru(e.extensions,"Extensions map")}catch(m){return{parseError:m}}n("extensions",a)}var u="",c=r,f=r.indexOf("#");f!==-1&&(u=r.substr(f),c=r.substr(0,f));var h=c.indexOf("?")===-1?"?":"&",p=c+h+t.join("&")+u;return{newURI:p}}var qy=Cn(function(){return fetch}),ff=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,n=r.fetch,i=r.print,a=i===void 0?cf:i,u=r.includeExtensions,c=r.preserveHeaderCase,f=r.useGETForQueries,h=r.includeUnusedVariables,p=h===void 0?!1:h,m=an(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);globalThis.__DEV__!==!1&&Dy(n||qy);var y={http:{includeExtensions:u,preserveHeaderCase:c},options:m.fetchOptions,credentials:m.credentials,headers:m.headers};return new Yr(function(g){var b=Fy(g,t),I=g.getContext(),S={};if(I.clientAwareness){var w=I.clientAwareness,O=w.name,P=w.version;O&&(S["apollographql-client-name"]=O),P&&(S["apollographql-client-version"]=P)}var D=F(F({},S),I.headers),T={http:I.http,options:I.fetchOptions,credentials:I.credentials,headers:D};if($i(["client"],g.query)){var N=zl(g.query);if(!N)return Iu(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`."));g.query=N}var G=lf(g,a,My,y,T),q=G.options,$=G.body;$.variables&&!p&&($.variables=V1($.variables,g.query));var K;!q.signal&&typeof AbortController<"u"&&(K=new AbortController,q.signal=K.signal);var oe=function(ye){return ye.kind==="OperationDefinition"&&ye.operation==="mutation"},re=function(ye){return ye.kind==="OperationDefinition"&&ye.operation==="subscription"},Ee=re(Hi(g.query)),ie=$i(["defer"],g.query);if(f&&!g.query.definitions.some(oe)&&(q.method="GET"),ie||Ee){q.headers=q.headers||{};var me="multipart/mixed;";Ee&&ie&&globalThis.__DEV__!==!1&&Ie.warn(41),Ee?me+="boundary=graphql;subscriptionSpec=1.0,application/json":ie&&(me+="deferSpec=20220824,application/json"),q.headers.accept=me}if(q.method==="GET"){var we=Ly(b,$),Te=we.newURI,ee=we.parseError;if(ee)return Iu(ee);b=Te}else try{q.body=Ru($,"Payload")}catch(ye){return Iu(ye)}return new Pt(function(ye){var fe=n||Cn(function(){return fetch})||qy,Pe=ye.next.bind(ye);return fe(b,q).then(function(Be){var ht;g.setContext({response:Be});var It=(ht=Be.headers)===null||ht===void 0?void 0:ht.get("content-type");return It!==null&&/^multipart\/mixed/i.test(It)?sO(Be,Pe):Ry(g)(Be).then(Pe)}).then(function(){K=void 0,ye.complete()}).catch(function(Be){K=void 0,oO(Be,ye)}),function(){K&&K.abort()}})})},jy=function(r){In(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,ff(t).request)||this;return n.options=t,n}return e}(Yr);const{toString:Uy,hasOwnProperty:pO}=Object.prototype,$y=Function.prototype.toString,hf=new Map;function Nt(r,e){try{return df(r,e)}finally{hf.clear()}}function df(r,e){if(r===e)return!0;const t=Uy.call(r),n=Uy.call(e);if(t!==n)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(Vy(r,e))return!0;const i=By(r),a=By(e),u=i.length;if(u!==a.length)return!1;for(let c=0;c<u;++c)if(!pO.call(e,i[c]))return!1;for(let c=0;c<u;++c){const f=i[c];if(!df(r[f],e[f]))return!1}return!0}case"[object Error]":return r.name===e.name&&r.message===e.message;case"[object Number]":if(r!==r)return e!==e;case"[object Boolean]":case"[object Date]":return+r==+e;case"[object RegExp]":case"[object String]":return r==`${e}`;case"[object Map]":case"[object Set]":{if(r.size!==e.size)return!1;if(Vy(r,e))return!0;const i=r.entries(),a=t==="[object Map]";for(;;){const u=i.next();if(u.done)break;const[c,f]=u.value;if(!e.has(c)||a&&!df(f,e.get(c)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":r=new Uint8Array(r),e=new Uint8Array(e);case"[object DataView]":{let i=r.byteLength;if(i===e.byteLength)for(;i--&&r[i]===e[i];);return i===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{const i=$y.call(r);return i!==$y.call(e)?!1:!gO(i,yO)}}return!1}function By(r){return Object.keys(r).filter(mO,r)}function mO(r){return this[r]!==void 0}const yO="{ [native code] }";function gO(r,e){const t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function Vy(r,e){let t=hf.get(r);if(t){if(t.has(e))return!0}else hf.set(r,t=new Set);return t.add(e),!1}function Wy(r,e,t,n){var i=e.data,a=an(e,["data"]),u=t.data,c=an(t,["data"]);return Nt(a,c)&&Mu(Hi(r).selectionSet,i,u,{fragmentMap:_s(Es(r)),variables:n})}function Mu(r,e,t,n){if(e===t)return!0;var i=new Set;return r.selections.every(function(a){if(i.has(a)||(i.add(a),!Hs(a,n.variables))||zy(a))return!0;if(mi(a)){var u=ai(a),c=e&&e[u],f=t&&t[u],h=a.selectionSet;if(!h)return Nt(c,f);var p=Array.isArray(c),m=Array.isArray(f);if(p!==m)return!1;if(p&&m){var y=c.length;if(f.length!==y)return!1;for(var g=0;g<y;++g)if(!Mu(h,c[g],f[g],n))return!1;return!0}return Mu(h,c,f,n)}else{var b=Ga(a,n.fragmentMap);if(b)return zy(b)?!0:Mu(b.selectionSet,e,t,n)}})}function zy(r){return!!r.directives&&r.directives.some(vO)}function vO(r){return r.name.value==="nonreactive"}var Hy=Bi?WeakMap:Map,Gy=pu?WeakSet:Set,pf=new Ya,Qy=!1;function Jy(){Qy||(Qy=!0,globalThis.__DEV__!==!1&&Ie.warn(52))}function Yy(r,e,t){return pf.withValue(!0,function(){var n=so(r,e,t,!1);return Object.isFrozen(r)&&Os(n),n})}function bO(r,e){if(e.has(r))return e.get(r);var t=Array.isArray(r)?[]:Object.create(null);return e.set(r,t),t}function so(r,e,t,n,i){var a,u=t.knownChanged,c=bO(r,t.mutableTargets);if(Array.isArray(r)){for(var f=0,h=Array.from(r.entries());f<h.length;f++){var p=h[f],m=p[0],y=p[1];if(y===null){c[m]=null;continue}var g=so(y,e,t,n,globalThis.__DEV__!==!1?"".concat(i||"","[").concat(m,"]"):void 0);u.has(g)&&u.add(c),c[m]=g}return u.has(c)?c:r}for(var b=0,I=e.selections;b<I.length;b++){var S=I[b],w=void 0;if(n&&u.add(c),S.kind===Re.FIELD){var O=ai(S),P=S.selectionSet;if(w=c[O]||r[O],w===void 0)continue;if(P&&w!==null){var g=so(r[O],P,t,n,globalThis.__DEV__!==!1?"".concat(i||"",".").concat(O):void 0);u.has(g)&&(w=g)}globalThis.__DEV__===!1&&(c[O]=w),globalThis.__DEV__!==!1&&(n&&O!=="__typename"&&!(!((a=Object.getOwnPropertyDescriptor(c,O))===null||a===void 0)&&a.value)?Object.defineProperty(c,O,wO(O,w,i||"",t.operationName,t.operationType)):(delete c[O],c[O]=w))}if(S.kind===Re.INLINE_FRAGMENT&&(!S.typeCondition||t.cache.fragmentMatches(S,r.__typename))&&(w=so(r,S.selectionSet,t,n,i)),S.kind===Re.FRAGMENT_SPREAD){var D=S.name.value,T=t.fragmentMap[D]||(t.fragmentMap[D]=t.cache.lookupFragment(D));Ie(T,47,D);var N=Rm(S);N!=="mask"&&(w=so(r,T.selectionSet,t,N==="migrate",i))}u.has(w)&&u.add(c)}return"__typename"in r&&!("__typename"in c)&&(c.__typename=r.__typename),Object.keys(c).length!==Object.keys(r).length&&u.add(c),u.has(c)?c:r}function wO(r,e,t,n,i){var a=function(){return pf.getValue()||(globalThis.__DEV__!==!1&&Ie.warn(48,n?"".concat(i," '").concat(n,"'"):"anonymous ".concat(i),"".concat(t,".").concat(r).replace(/^\./,"")),a=function(){return e}),e};return{get:function(){return a()},set:function(u){a=function(){return u}},enumerable:!0,configurable:!0}}function Ky(r,e,t,n){if(!t.fragmentMatches)return globalThis.__DEV__!==!1&&Jy(),r;var i=e.definitions.filter(function(u){return u.kind===Re.FRAGMENT_DEFINITION});typeof n>"u"&&(Ie(i.length===1,49,i.length),n=i[0].name.value);var a=i.find(function(u){return u.name.value===n});return Ie(!!a,50,n),r==null||Nt(r,{})?r:Yy(r,a.selectionSet,{operationType:"fragment",operationName:a.name.value,fragmentMap:_s(Es(e)),cache:t,mutableTargets:new Hy,knownChanged:new Gy})}function _O(r,e,t){var n;if(!t.fragmentMatches)return globalThis.__DEV__!==!1&&Jy(),r;var i=yi(e);return Ie(i,51),r==null?r:Yy(r,i.selectionSet,{operationType:i.operation,operationName:(n=i.name)===null||n===void 0?void 0:n.value,fragmentMap:_s(Es(e)),cache:t,mutableTargets:new Hy,knownChanged:new Gy})}var mf=function(){function r(){this.assumeImmutableResults=!1,this.getFragmentDoc=Za(qm,{max:Qn["cache.fragmentQueryDocuments"]||1e3,cache:yu})}return r.prototype.lookupFragment=function(e){return null},r.prototype.batch=function(e){var t=this,n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,i;return this.performTransaction(function(){return i=e.update(t)},n),i},r.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},r.prototype.transformDocument=function(e){return e},r.prototype.transformForLink=function(e){return e},r.prototype.identify=function(e){},r.prototype.gc=function(){return[]},r.prototype.modify=function(e){return!1},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(F(F({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.watchFragment=function(e){var t=this,n=e.fragment,i=e.fragmentName,a=e.from,u=e.optimistic,c=u===void 0?!0:u,f=an(e,["fragment","fragmentName","from","optimistic"]),h=this.getFragmentDoc(n,i),p=typeof a>"u"||typeof a=="string"?a:this.identify(a),m=!!e[Symbol.for("apollo.dataMasking")];if(globalThis.__DEV__!==!1){var y=i||Ll(n).name.value;p||globalThis.__DEV__!==!1&&Ie.warn(1,y)}var g=F(F({},f),{returnPartialData:!0,id:p,query:h,optimistic:c}),b;return new Pt(function(I){return t.watch(F(F({},g),{immediate:!0,callback:function(S){var w=m?Ky(S.result,n,t,i):S.result;if(!(b&&Wy(h,{data:b.result},{data:w},e.variables))){var O={data:w,complete:!!S.complete};S.missing&&(O.missing=to(S.missing.map(function(P){return P.missing}))),b=F(F({},S),{result:w}),I.next(O)}}}))})},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(F(F({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},r.prototype.writeQuery=function(e){var t=e.id,n=e.data,i=an(e,["id","data"]);return this.write(Object.assign(i,{dataId:t||"ROOT_QUERY",result:n}))},r.prototype.writeFragment=function(e){var t=e.id,n=e.data,i=e.fragment,a=e.fragmentName,u=an(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(u,{query:this.getFragmentDoc(i,a),dataId:t,result:n}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(n){var i=n.readQuery(e),a=t(i);return a==null?i:(n.writeQuery(F(F({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(n){var i=n.readFragment(e),a=t(i);return a==null?i:(n.writeFragment(F(F({},e),{data:a})),a)}})},r}();globalThis.__DEV__!==!1&&(mf.prototype.getMemoryInternals=IE);var yf;yf||(yf={});var gf=function(r){In(e,r);function e(t,n,i,a){var u,c=r.call(this,t)||this;if(c.message=t,c.path=n,c.query=i,c.variables=a,Array.isArray(c.path)){c.missing=c.message;for(var f=c.path.length-1;f>=0;--f)c.missing=(u={},u[c.path[f]]=c.missing,u)}else c.missing=c.path;return c.__proto__=e.prototype,c}return e}(Error),Pr=Object.prototype.hasOwnProperty;function ao(r){return r==null}function vf(r,e){var t=r.__typename,n=r.id,i=r._id;if(typeof t=="string"&&(e&&(e.keyObject=ao(n)?ao(i)?void 0:{_id:i}:{id:n}),ao(n)&&!ao(i)&&(n=i),!ao(n)))return"".concat(t,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Zy={dataIdFromObject:vf,addTypename:!0,resultCaching:!0,canonizeResults:!1};function SO(r){return Qi(Zy,r)}function Xy(r){var e=r.canonizeResults;return e===void 0?Zy.canonizeResults:e}function xO(r,e){return Ct(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var eg=/^[_a-z][_0-9a-z]*/i;function Yi(r){var e=r.match(eg);return e?e[0]:r}function bf(r,e,t){return Zt(e)?or(e)?e.every(function(n){return bf(r,n,t)}):r.selections.every(function(n){if(mi(n)&&Hs(n,t)){var i=ai(n);return Pr.call(e,i)&&(!n.selectionSet||bf(n.selectionSet,e[i],t))}return!0}):!1}function Xs(r){return Zt(r)&&!Ct(r)&&!or(r)}function EO(){return new vi}function tg(r,e){var t=_s(Es(r));return{fragmentMap:t,lookupFragment:function(n){var i=t[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var Du=Object.create(null),wf=function(){return Du},rg=Object.create(null),oo=function(){function r(e,t){var n=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(i,a){return Os(Ct(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return Ct(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return Wi(i);if(Ct(i))return i;var u=n.policies.identify(i)[0];if(u){var c=Wi(u);return a&&n.merge(u,i),c}}}return r.prototype.toObject=function(){return F({},this.data)},r.prototype.has=function(e){return this.lookup(e,!0)!==void 0},r.prototype.get=function(e,t){if(this.group.depend(e,t),Pr.call(this.data,e)){var n=this.data[e];if(n&&Pr.call(n,t))return n[t]}if(t==="__typename"&&Pr.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Ki)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),Pr.call(this.data,e))return this.data[e];if(this instanceof Ki)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var n=this,i;Ct(e)&&(e=e.__ref),Ct(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(i=e):e,u=typeof t=="string"?this.lookup(i=t):t;if(u){Ie(typeof i=="string",2);var c=new vi(TO).merge(a,u);if(this.data[i]=c,c!==a&&(delete this.refs[i],this.group.caching)){var f=Object.create(null);a||(f.__exists=1),Object.keys(u).forEach(function(h){if(!a||a[h]!==c[h]){f[h]=1;var p=Yi(h);p!==h&&!n.policies.hasKeyArgs(c.__typename,p)&&(f[p]=1),c[h]===void 0&&!(n instanceof Ki)&&delete c[h]}}),f.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[i]===c.__typename&&delete f.__typename,Object.keys(f).forEach(function(h){return n.group.dirty(i,h)})}}},r.prototype.modify=function(e,t){var n=this,i=this.lookup(e);if(i){var a=Object.create(null),u=!1,c=!0,f={DELETE:Du,INVALIDATE:rg,isReference:Ct,toReference:this.toReference,canRead:this.canRead,readField:function(h,p){return n.policies.readField(typeof h=="string"?{fieldName:h,from:p||Wi(e)}:h,{store:n})}};if(Object.keys(i).forEach(function(h){var p=Yi(h),m=i[h];if(m!==void 0){var y=typeof t=="function"?t:t[h]||t[p];if(y){var g=y===wf?Du:y(Os(m),F(F({},f),{fieldName:p,storeFieldName:h,storage:n.getStorage(e,h)}));if(g===rg)n.group.dirty(e,h);else if(g===Du&&(g=void 0),g!==m&&(a[h]=g,u=!0,m=g,globalThis.__DEV__!==!1)){var b=function(T){if(n.lookup(T.__ref)===void 0)return globalThis.__DEV__!==!1&&Ie.warn(3,T),!0};if(Ct(g))b(g);else if(Array.isArray(g))for(var I=!1,S=void 0,w=0,O=g;w<O.length;w++){var P=O[w];if(Ct(P)){if(I=!0,b(P))break}else if(typeof P=="object"&&P){var D=n.policies.identify(P)[0];D&&(S=P)}if(I&&S!==void 0){globalThis.__DEV__!==!1&&Ie.warn(4,S);break}}}}m!==void 0&&(c=!1)}}),u)return this.merge(e,a),c&&(this instanceof Ki?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,n){var i,a=this.lookup(e);if(a){var u=this.getFieldValue(a,"__typename"),c=t&&n?this.policies.getStoreFieldName({typename:u,fieldName:t,args:n}):t;return this.modify(e,c?(i={},i[c]=wf,i):wf)}return!1},r.prototype.evict=function(e,t){var n=!1;return e.id&&(Pr.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Ki&&this!==t&&(n=this.parent.evict(e,t)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),n=[];return this.getRootIdSet().forEach(function(i){Pr.call(e.policies.rootTypenamesById,i)||n.push(i)}),n.length&&(t.__META={extraRootIds:n.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&Pr.call(e,a)||t.delete(a)}),e){var n=e.__META,i=an(e,["__META"]);Object.keys(i).forEach(function(a){t.merge(a,i[a])}),n&&n.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Ki?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),n=this.toObject();t.forEach(function(u){Pr.call(n,u)&&(Object.keys(e.findChildRefIds(u)).forEach(t.add,t),delete n[u])});var i=Object.keys(n);if(i.length){for(var a=this;a instanceof Ki;)a=a.parent;i.forEach(function(u){return a.delete(u)})}return i},r.prototype.findChildRefIds=function(e){if(!Pr.call(this.refs,e)){var t=this.refs[e]=Object.create(null),n=this.data[e];if(!n)return t;var i=new Set([n]);i.forEach(function(a){Ct(a)&&(t[a.__ref]=!0),Zt(a)&&Object.keys(a).forEach(function(u){var c=a[u];Zt(c)&&i.add(c)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}(),ng=function(){function r(e,t){t===void 0&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return r.prototype.resetCaching=function(){this.d=this.caching?cy():null,this.keyMaker=new Gs(Bi)},r.prototype.depend=function(e,t){if(this.d){this.d(_f(e,t));var n=Yi(t);n!==t&&this.d(_f(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(_f(e,t),t==="__exists"?"forget":"setDirty")},r}();function _f(r,e){return e+"#"+r}function ig(r,e){uo(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){In(n,t);function n(i){var a=i.policies,u=i.resultCaching,c=u===void 0?!0:u,f=i.seed,h=t.call(this,a,new ng(c))||this;return h.stump=new OO(h),h.storageTrie=new Gs(Bi),f&&h.replace(f),h}return n.prototype.addLayer=function(i,a){return this.stump.addLayer(i,a)},n.prototype.removeLayer=function(){return this},n.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},n}(r);r.Root=e})(oo||(oo={}));var Ki=function(r){In(e,r);function e(t,n,i,a){var u=r.call(this,n.policies,a)||this;return u.id=t,u.parent=n,u.replay=i,u.group=a,i(u),u}return e.prototype.addLayer=function(t,n){return new e(t,this,n,this.group)},e.prototype.removeLayer=function(t){var n=this,i=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var u=n.data[a],c=i.lookup(a);c?u?u!==c&&Object.keys(u).forEach(function(f){Nt(u[f],c[f])||n.group.dirty(a,f)}):(n.group.dirty(a,"__exists"),Object.keys(c).forEach(function(f){n.group.dirty(a,f)})):n.delete(a)}),i):i===this.parent?this:i.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return F(F({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var n=this.parent.findChildRefIds(t);return Pr.call(this.data,t)?F(F({},n),r.prototype.findChildRefIds.call(this,t)):n},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(oo),OO=function(r){In(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new ng(t.group.caching,t.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(t,n){return this.parent.merge(t,n)},e}(Ki);function TO(r,e,t){var n=r[t],i=e[t];return Nt(n,i)?n:i}function uo(r){return!!(r instanceof oo&&r.group.caching)}function kO(r){return Zt(r)?or(r)?r.slice(0):F({__proto__:Object.getPrototypeOf(r)},r):r}var sg=function(){function r(){this.known=new(pu?WeakSet:Set),this.pool=new Gs(Bi),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return Zt(e)&&this.known.has(e)},r.prototype.pass=function(e){if(Zt(e)){var t=kO(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(Zt(e)){var n=this.passes.get(e);if(n)return n;var i=Object.getPrototypeOf(e);switch(i){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),u=this.pool.lookupArray(a);return u.array||(this.known.add(u.array=a),globalThis.__DEV__!==!1&&Object.freeze(a)),u.array}case null:case Object.prototype:{if(this.known.has(e))return e;var c=Object.getPrototypeOf(e),f=[c],h=this.sortedKeys(e);f.push(h.json);var p=f.length;h.sorted.forEach(function(g){f.push(t.admit(e[g]))});var u=this.pool.lookupArray(f);if(!u.object){var m=u.object=Object.create(c);this.known.add(m),h.sorted.forEach(function(g,b){m[g]=f[p+b]}),globalThis.__DEV__!==!1&&Object.freeze(m)}return u.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),n=this.pool.lookupArray(t);if(!n.keys){t.sort();var i=JSON.stringify(t);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:t,json:i})}return n.keys},r}();function ag(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var AO=function(){function r(e){var t=this;this.knownResults=new(Bi?WeakMap:Map),this.config=Qi(e,{addTypename:e.addTypename!==!1,canonizeResults:Xy(e)}),this.canon=e.canon||new sg,this.executeSelectionSet=Za(function(n){var i,a=n.context.canonizeResults,u=ag(n);u[3]=!a;var c=(i=t.executeSelectionSet).peek.apply(i,u);return c?a?F(F({},c),{result:t.canon.admit(c.result)}):c:(ig(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize||Qn["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:ag,makeCacheKey:function(n,i,a,u){if(uo(a.store))return a.store.makeCacheKey(n,Ct(i)?i.__ref:i,a.varString,u)}}),this.executeSubSelectedArray=Za(function(n){return ig(n.context.store,n.enclosingRef.__ref),t.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize||Qn["inMemoryCache.executeSubSelectedArray"]||1e4,makeCacheKey:function(n){var i=n.field,a=n.array,u=n.context;if(uo(u.store))return u.store.makeCacheKey(i,a,u.varString)}})}return r.prototype.resetCanon=function(){this.canon=new sg},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,n=e.query,i=e.rootId,a=i===void 0?"ROOT_QUERY":i,u=e.variables,c=e.returnPartialData,f=c===void 0?!0:c,h=e.canonizeResults,p=h===void 0?this.config.canonizeResults:h,m=this.config.cache.policies;u=F(F({},bu(Fl(n))),u);var y=Wi(a),g=this.executeSelectionSet({selectionSet:Hi(n).selectionSet,objectOrReference:y,enclosingRef:y,context:F({store:t,query:n,policies:m,variables:u,varString:pi(u),canonizeResults:p},tg(n,this.config.fragments))}),b;if(g.missing&&(b=[new gf(IO(g.missing),g.missing,n,u)],!f))throw b[0];return{result:g.result,complete:!b,missing:b}},r.prototype.isFresh=function(e,t,n,i){if(uo(i.store)&&this.knownResults.get(e)===n){var a=this.executeSelectionSet.peek(n,t,i,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,n=e.selectionSet,i=e.objectOrReference,a=e.enclosingRef,u=e.context;if(Ct(i)&&!u.policies.rootTypenamesById[i.__ref]&&!u.store.has(i.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(i.__ref," object")};var c=u.variables,f=u.policies,h=u.store,p=h.getFieldValue(i,"__typename"),m=[],y,g=new vi;this.config.addTypename&&typeof p=="string"&&!f.rootIdsByTypename[p]&&m.push({__typename:p});function b(P,D){var T;return P.missing&&(y=g.merge(y,(T={},T[D]=P.missing,T))),P.result}var I=new Set(n.selections);I.forEach(function(P){var D,T;if(Hs(P,c))if(mi(P)){var N=f.readField({fieldName:P.name.value,field:P,variables:u.variables,from:i},u),G=ai(P);N===void 0?Eu.added(P)||(y=g.merge(y,(D={},D[G]="Can't find field '".concat(P.name.value,"' on ").concat(Ct(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),D))):or(N)?N.length>0&&(N=b(t.executeSubSelectedArray({field:P,array:N,enclosingRef:a,context:u}),G)):P.selectionSet?N!=null&&(N=b(t.executeSelectionSet({selectionSet:P.selectionSet,objectOrReference:N,enclosingRef:Ct(N)?N:a,context:u}),G)):u.canonizeResults&&(N=t.canon.pass(N)),N!==void 0&&m.push((T={},T[G]=N,T))}else{var q=Ga(P,u.lookupFragment);if(!q&&P.kind===Re.FRAGMENT_SPREAD)throw Jr(10,P.name.value);q&&f.fragmentMatches(q,p)&&q.selectionSet.selections.forEach(I.add,I)}});var S=to(m),w={result:S,missing:y},O=u.canonizeResults?this.canon.admit(w):Os(w);return O.result&&this.knownResults.set(O.result,n),O},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,n=e.field,i=e.array,a=e.enclosingRef,u=e.context,c,f=new vi;function h(p,m){var y;return p.missing&&(c=f.merge(c,(y={},y[m]=p.missing,y))),p.result}return n.selectionSet&&(i=i.filter(u.store.canRead)),i=i.map(function(p,m){return p===null?null:or(p)?h(t.executeSubSelectedArray({field:n,array:p,enclosingRef:a,context:u}),m):n.selectionSet?h(t.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:p,enclosingRef:Ct(p)?p:a,context:u}),m):(globalThis.__DEV__!==!1&&CO(u.store,n,p),p)}),{result:u.canonizeResults?this.canon.admit(i):i,missing:c}},r}();function IO(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function CO(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){Zt(i)&&(Ie(!Ct(i),11,xO(r,i),e.name.value),Object.values(i).forEach(n.add,n))})}}var Sf=new Ya,og=new WeakMap;function co(r){var e=og.get(r);return e||og.set(r,e={vars:new Set,dep:cy()}),e}function ug(r){co(r).vars.forEach(function(e){return e.forgetCache(r)})}function PO(r){co(r).vars.forEach(function(e){return e.attachCache(r)})}function cg(r){var e=new Set,t=new Set,n=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(f){co(f).dep.dirty(n),NO(f)});var u=Array.from(t);t.clear(),u.forEach(function(f){return f(r)})}}else{var c=Sf.getValue();c&&(i(c),co(c).dep(n))}return r};n.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var i=n.attachCache=function(a){return e.add(a),co(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function NO(r){r.broadcastWatches&&r.broadcastWatches()}var lg=Object.create(null);function xf(r){var e=JSON.stringify(r);return lg[e]||(lg[e]=Object.create(null))}function fg(r){var e=xf(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,n){var i=function(u,c){return n.readField(c,u)},a=n.keyObject=Ef(r,function(u){var c=ea(n.storeObject,u,i);return c===void 0&&t!==n.storeObject&&Pr.call(t,u[0])&&(c=ea(t,u,pg)),Ie(c!==void 0,5,u.join("."),t),c});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function hg(r){var e=xf(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,u=n.fieldName,c=Ef(r,function(h){var p=h[0],m=p.charAt(0);if(m==="@"){if(i&&pn(i.directives)){var y=p.slice(1),g=i.directives.find(function(w){return w.name.value===y}),b=g&&Ja(g,a);return b&&ea(b,h.slice(1))}return}if(m==="$"){var I=p.slice(1);if(a&&Pr.call(a,I)){var S=h.slice(0);return S[0]=I,ea(a,S)}return}if(t)return ea(t,h)}),f=JSON.stringify(c);return(t||f!=="{}")&&(u+=":"+f),u})}function Ef(r,e){var t=new vi;return dg(r).reduce(function(n,i){var a,u=e(i);if(u!==void 0){for(var c=i.length-1;c>=0;--c)u=(a={},a[i[c]]=u,a);n=t.merge(n,u)}return n},Object.create(null))}function dg(r){var e=xf(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){or(i)?(dg(i).forEach(function(u){return t.push(n.concat(u))}),n.length=0):(n.push(i),or(r[a+1])||(t.push(n.slice(0)),n.length=0))})}return e.paths}function pg(r,e){return r[e]}function ea(r,e,t){return t=t||pg,mg(e.reduce(function n(i,a){return or(i)?i.map(function(u){return n(u,a)}):i&&t(i,a)},r))}function mg(r){return Zt(r)?or(r)?r.map(mg):Ef(Object.keys(r).sort(),function(e){return ea(r,e)}):r}function Of(r){return r.args!==void 0?r.args:r.field?Ja(r.field,r.variables):null}var RO=function(){},yg=function(r,e){return e.fieldName},gg=function(r,e,t){var n=t.mergeObjects;return n(r,e)},vg=function(r,e){return e},MO=function(){function r(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=F({dataIdFromObject:vf},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var n,i=this,a=t&&(t.typename||((n=t.storeObject)===null||n===void 0?void 0:n.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];var u=t&&t.storeObject||e,c=F(F({},t),{typename:a,storeObject:u,readField:t&&t.readField||function(){var m=Tf(arguments,u);return i.readField(m,{store:i.cache.data,variables:m.variables})}}),f,h=a&&this.getTypePolicy(a),p=h&&h.keyFn||this.config.dataIdFromObject;return pf.withValue(!0,function(){for(;p;){var m=p(F(F({},e),u),c);if(or(m))p=fg(m);else{f=m;break}}}),f=f?String(f):void 0,c.keyObject?[f,c.keyObject]:[f]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(n){var i=e[n],a=i.queryType,u=i.mutationType,c=i.subscriptionType,f=an(i,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",n),u&&t.setRootTypename("Mutation",n),c&&t.setRootTypename("Subscription",n),Pr.call(t.toBeAdded,n)?t.toBeAdded[n].push(f):t.toBeAdded[n]=[f]})},r.prototype.updateTypePolicy=function(e,t){var n=this,i=this.getTypePolicy(e),a=t.keyFields,u=t.fields;function c(f,h){f.merge=typeof h=="function"?h:h===!0?gg:h===!1?vg:f.merge}c(i,t.merge),i.keyFn=a===!1?RO:or(a)?fg(a):typeof a=="function"?a:i.keyFn,u&&Object.keys(u).forEach(function(f){var h=n.getFieldPolicy(e,f,!0),p=u[f];if(typeof p=="function")h.read=p;else{var m=p.keyArgs,y=p.read,g=p.merge;h.keyFn=m===!1?yg:or(m)?hg(m):typeof m=="function"?m:h.keyFn,typeof y=="function"&&(h.read=y),c(h,g)}h.read&&h.merge&&(h.keyFn=h.keyFn||yg)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==i&&(Ie(!i||i===e,6,e),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[t]=n,this.rootTypenamesById[n]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(n){t.getSupertypeSet(n,!0),e[n].forEach(function(i){t.getSupertypeSet(i,!0).add(n);var a=i.match(eg);(!a||a[0]!==i)&&t.fuzzySubtypes.set(i,new RegExp(i))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!Pr.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(e);!i&&this.fuzzySubtypes.size&&(i=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach(function(u,c){if(u.test(e)){var f=t.supertypeMap.get(c);f&&f.forEach(function(h){return i.add(h)})}})),i&&i.size&&i.forEach(function(u){var c=t.getTypePolicy(u),f=c.fields,h=an(c,["fields"]);Object.assign(n,h),Object.assign(n.fields,f)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(u){t.updateTypePolicy(e,u)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,n){if(e){var i=this.getTypePolicy(e).fields;return i[t]||n&&(i[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var n=this.supertypeMap.get(e);return!n&&t&&this.supertypeMap.set(e,n=new Set),n},r.prototype.fragmentMatches=function(e,t,n,i){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var u=e.typeCondition.name.value;if(t===u)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(u))for(var c=this.getSupertypeSet(t,!0),f=[c],h=function(b){var I=a.getSupertypeSet(b,!1);I&&I.size&&f.indexOf(I)<0&&f.push(I)},p=!!(n&&this.fuzzySubtypes.size),m=!1,y=0;y<f.length;++y){var g=f[y];if(g.has(u))return c.has(u)||(m&&globalThis.__DEV__!==!1&&Ie.warn(7,t,u),c.add(u)),!0;g.forEach(h),p&&y===f.length-1&&bf(e.selectionSet,n,i)&&(p=!1,m=!0,this.fuzzySubtypes.forEach(function(b,I){var S=t.match(b);S&&S[0]===t&&h(I)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var n=this.getFieldPolicy(e,t,!1);return!!(n&&n.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,n=e.fieldName,i=this.getFieldPolicy(t,n,!1),a,u=i&&i.keyFn;if(u&&t)for(var c={typename:t,fieldName:n,field:e.field||null,variables:e.variables},f=Of(e);u;){var h=u(f,c);if(or(h))u=hg(h);else{a=h||n;break}}return a===void 0&&(a=e.field?Hm(e.field,e.variables):Dl(n,Of(e))),a===!1?n:n===Yi(a)?a:n+":"+a},r.prototype.readField=function(e,t){var n=e.from;if(n){var i=e.field||e.fieldName;if(i){if(e.typename===void 0){var a=t.store.getFieldValue(n,"__typename");a&&(e.typename=a)}var u=this.getStoreFieldName(e),c=Yi(u),f=t.store.getFieldValue(n,u),h=this.getFieldPolicy(e.typename,c,!1),p=h&&h.read;if(p){var m=bg(this,n,e,t,t.store.getStorage(Ct(n)?n.__ref:n,u));return Sf.withValue(this.cache,p,[f,m])}return f}}},r.prototype.getReadFunction=function(e,t){var n=this.getFieldPolicy(e,t,!1);return n&&n.read},r.prototype.getMergeFunction=function(e,t,n){var i=this.getFieldPolicy(e,t,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},r.prototype.runMergeFunction=function(e,t,n,i,a){var u=n.field,c=n.typename,f=n.merge;return f===gg?wg(i.store)(e,t):f===vg?t:(i.overwrite&&(e=void 0),f(e,t,bg(this,void 0,{typename:c,fieldName:u.name.value,field:u,variables:i.variables},i,a||Object.create(null))))},r}();function bg(r,e,t,n,i){var a=r.getStoreFieldName(t),u=Yi(a),c=t.variables||n.variables,f=n.store,h=f.toReference,p=f.canRead;return{args:Of(t),field:t.field||null,fieldName:u,storeFieldName:a,variables:c,isReference:Ct,toReference:h,storage:i,cache:r.cache,canRead:p,readField:function(){return r.readField(Tf(arguments,e,c),n)},mergeObjects:wg(n.store)}}function Tf(r,e,t){var n=r[0],i=r[1],a=r.length,u;return typeof n=="string"?u={fieldName:n,from:a>1?i:e}:(u=F({},n),Pr.call(u,"from")||(u.from=e)),globalThis.__DEV__!==!1&&u.from===void 0&&globalThis.__DEV__!==!1&&Ie.warn(8,bl(Array.from(r))),u.variables===void 0&&(u.variables=t),u}function wg(r){return function(t,n){if(or(t)||or(n))throw Jr(9);if(Zt(t)&&Zt(n)){var i=r.getFieldValue(t,"__typename"),a=r.getFieldValue(n,"__typename"),u=i&&a&&i!==a;if(u)return n;if(Ct(t)&&Xs(n))return r.merge(t.__ref,n),t;if(Xs(t)&&Ct(n))return r.merge(t,n.__ref),n;if(Xs(t)&&Xs(n))return F(F({},t),n)}return n}}function kf(r,e,t){var n="".concat(e).concat(t),i=r.flavors.get(n);return i||r.flavors.set(n,i=r.clientOnly===e&&r.deferred===t?r:F(F({},r),{clientOnly:e,deferred:t})),i}var DO=function(){function r(e,t,n){this.cache=e,this.reader=t,this.fragments=n}return r.prototype.writeToStore=function(e,t){var n=this,i=t.query,a=t.result,u=t.dataId,c=t.variables,f=t.overwrite,h=yi(i),p=EO();c=F(F({},bu(h)),c);var m=F(F({store:e,written:Object.create(null),merge:function(g,b){return p.merge(g,b)},variables:c,varString:pi(c)},tg(i,this.fragments)),{overwrite:!!f,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),y=this.processSelectionSet({result:a||Object.create(null),dataId:u,selectionSet:h.selectionSet,mergeTree:{map:new Map},context:m});if(!Ct(y))throw Jr(12,a);return m.incomingById.forEach(function(g,b){var I=g.storeObject,S=g.mergeTree,w=g.fieldNodeSet,O=Wi(b);if(S&&S.map.size){var P=n.applyMerges(S,O,I,m);if(Ct(P))return;I=P}if(globalThis.__DEV__!==!1&&!m.overwrite){var D=Object.create(null);w.forEach(function(G){G.selectionSet&&(D[G.name.value]=!0)});var T=function(G){return D[Yi(G)]===!0},N=function(G){var q=S&&S.map.get(G);return!!(q&&q.info&&q.info.merge)};Object.keys(I).forEach(function(G){T(G)&&!N(G)&&FO(O,I,G,m.store)})}e.merge(b,I)}),e.retain(y.__ref),y},r.prototype.processSelectionSet=function(e){var t=this,n=e.dataId,i=e.result,a=e.selectionSet,u=e.context,c=e.mergeTree,f=this.cache.policies,h=Object.create(null),p=n&&f.rootTypenamesById[n]||vu(i,a,u.fragmentMap)||n&&u.store.get(n,"__typename");typeof p=="string"&&(h.__typename=p);var m=function(){var P=Tf(arguments,h,u.variables);if(Ct(P.from)){var D=u.incomingById.get(P.from.__ref);if(D){var T=f.readField(F(F({},P),{from:D.storeObject}),u);if(T!==void 0)return T}}return f.readField(P,u)},y=new Set;this.flattenFields(a,i,u,p).forEach(function(P,D){var T,N=ai(D),G=i[N];if(y.add(D),G!==void 0){var q=f.getStoreFieldName({typename:p,fieldName:D.name.value,field:D,variables:P.variables}),$=Sg(c,q),K=t.processFieldValue(G,D,D.selectionSet?kf(P,!1,!1):P,$),oe=void 0;D.selectionSet&&(Ct(K)||Xs(K))&&(oe=m("__typename",K));var re=f.getMergeFunction(p,D.name.value,oe);re?$.info={field:D,typename:p,merge:re}:xg(c,q),h=P.merge(h,(T={},T[q]=K,T))}else globalThis.__DEV__!==!1&&!P.clientOnly&&!P.deferred&&!Eu.added(D)&&!f.getReadFunction(p,D.name.value)&&globalThis.__DEV__!==!1&&Ie.error(13,ai(D),i)});try{var g=f.identify(i,{typename:p,selectionSet:a,fragmentMap:u.fragmentMap,storeObject:h,readField:m}),b=g[0],I=g[1];n=n||b,I&&(h=u.merge(h,I))}catch(P){if(!n)throw P}if(typeof n=="string"){var S=Wi(n),w=u.written[n]||(u.written[n]=[]);if(w.indexOf(a)>=0||(w.push(a),this.reader&&this.reader.isFresh(i,S,a,u)))return S;var O=u.incomingById.get(n);return O?(O.storeObject=u.merge(O.storeObject,h),O.mergeTree=Af(O.mergeTree,c),y.forEach(function(P){return O.fieldNodeSet.add(P)})):u.incomingById.set(n,{storeObject:h,mergeTree:Fu(c)?void 0:c,fieldNodeSet:y}),S}return h},r.prototype.processFieldValue=function(e,t,n,i){var a=this;return!t.selectionSet||e===null?globalThis.__DEV__!==!1?tf(e):e:or(e)?e.map(function(u,c){var f=a.processFieldValue(u,t,n,Sg(i,c));return xg(i,c),f}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:n,mergeTree:i})},r.prototype.flattenFields=function(e,t,n,i){i===void 0&&(i=vu(t,e,n.fragmentMap));var a=new Map,u=this.cache.policies,c=new Gs(!1);return function f(h,p){var m=c.lookup(h,p.clientOnly,p.deferred);m.visited||(m.visited=!0,h.selections.forEach(function(y){if(Hs(y,n.variables)){var g=p.clientOnly,b=p.deferred;if(!(g&&b)&&pn(y.directives)&&y.directives.forEach(function(w){var O=w.name.value;if(O==="client"&&(g=!0),O==="defer"){var P=Ja(w,n.variables);(!P||P.if!==!1)&&(b=!0)}}),mi(y)){var I=a.get(y);I&&(g=g&&I.clientOnly,b=b&&I.deferred),a.set(y,kf(n,g,b))}else{var S=Ga(y,n.lookupFragment);if(!S&&y.kind===Re.FRAGMENT_SPREAD)throw Jr(14,y.name.value);S&&u.fragmentMatches(S,i,t,n.variables)&&f(S.selectionSet,kf(n,g,b))}}}))}(e,n),a},r.prototype.applyMerges=function(e,t,n,i,a){var u,c=this;if(e.map.size&&!Ct(n)){var f=!or(n)&&(Ct(t)||Xs(t))?t:void 0,h=n;f&&!a&&(a=[Ct(f)?f.__ref:f]);var p,m=function(y,g){return or(y)?typeof g=="number"?y[g]:void 0:i.store.getFieldValue(y,String(g))};e.map.forEach(function(y,g){var b=m(f,g),I=m(h,g);if(I!==void 0){a&&a.push(g);var S=c.applyMerges(y,b,I,i,a);S!==I&&(p=p||new Map,p.set(g,S)),a&&Ie(a.pop()===g)}}),p&&(n=or(h)?h.slice(0):F({},h),p.forEach(function(y,g){n[g]=y}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,i,a&&(u=i.store).getStorage.apply(u,a)):n},r}(),_g=[];function Sg(r,e){var t=r.map;return t.has(e)||t.set(e,_g.pop()||{map:new Map}),t.get(e)}function Af(r,e){if(r===e||!e||Fu(e))return r;if(!r||Fu(r))return e;var t=r.info&&e.info?F(F({},r.info),e.info):r.info||e.info,n=r.map.size&&e.map.size,i=n?new Map:r.map.size?r.map:e.map,a={info:t,map:i};if(n){var u=new Set(e.map.keys());r.map.forEach(function(c,f){a.map.set(f,Af(c,e.map.get(f))),u.delete(f)}),u.forEach(function(c){a.map.set(c,Af(e.map.get(c),r.map.get(c)))})}return a}function Fu(r){return!r||!(r.info||r.map.size)}function xg(r,e){var t=r.map,n=t.get(e);n&&Fu(n)&&(_g.push(n),t.delete(e))}var Eg=new Set;function FO(r,e,t,n){var i=function(m){var y=n.getFieldValue(m,t);return typeof y=="object"&&y},a=i(r);if(a){var u=i(e);if(u&&!Ct(a)&&!Nt(a,u)&&!Object.keys(a).every(function(m){return n.getFieldValue(u,m)!==void 0})){var c=n.getFieldValue(r,"__typename")||n.getFieldValue(e,"__typename"),f=Yi(t),h="".concat(c,".").concat(f);if(!Eg.has(h)){Eg.add(h);var p=[];!or(a)&&!or(u)&&[a,u].forEach(function(m){var y=n.getFieldValue(m,"__typename");typeof y=="string"&&!p.includes(y)&&p.push(y)}),globalThis.__DEV__!==!1&&Ie.warn(15,f,c,p.length?"either ensure all objects of type "+p.join(" and ")+" have an ID or a custom merge function, or ":"",h,F({},a),F({},u))}}}}var If=function(r){In(e,r);function e(t){t===void 0&&(t={});var n=r.call(this)||this;return n.watches=new Set,n.addTypenameTransform=new Su(Eu),n.assumeImmutableResults=!0,n.makeVar=cg,n.txCount=0,n.config=SO(t),n.addTypename=!!n.config.addTypename,n.policies=new MO({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.init(),n}return e.prototype.init=function(){var t=this.data=new oo.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=t.stump,this.resetResultCache()},e.prototype.resetResultCache=function(t){var n=this,i=this.storeReader,a=this.config.fragments;this.storeWriter=new DO(this,this.storeReader=new AO({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:Xy(this.config),canon:t?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=Za(function(u,c){return n.broadcastWatch(u,c)},{max:this.config.resultCacheMaxSize||Qn["inMemoryCache.maybeBroadcastWatch"]||5e3,makeCacheKey:function(u){var c=u.optimistic?n.optimisticData:n.data;if(uo(c)){var f=u.optimistic,h=u.id,p=u.variables;return c.makeCacheKey(u.query,u.callback,pi({optimistic:f,id:h,variables:p}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(u){return u.resetCaching()})},e.prototype.restore=function(t){return this.init(),t&&this.data.replace(t),this},e.prototype.extract=function(t){return t===void 0&&(t=!1),(t?this.optimisticData:this.data).extract()},e.prototype.read=function(t){var n=t.returnPartialData,i=n===void 0?!1:n;try{return this.storeReader.diffQueryAgainstStore(F(F({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof gf)return null;throw a}},e.prototype.write=function(t){try{return++this.txCount,this.storeWriter.writeToStore(this.data,t)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(t){if(Pr.call(t,"id")&&!t.id)return!1;var n=t.optimistic?this.optimisticData:this.data;try{return++this.txCount,n.modify(t.id||"ROOT_QUERY",t.fields)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(t){return this.storeReader.diffQueryAgainstStore(F(F({},t),{store:t.optimistic?this.optimisticData:this.data,rootId:t.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(t){var n=this;return this.watches.size||PO(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){n.watches.delete(t)&&!n.watches.size&&ug(n),n.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){var n;pi.reset(),gi.reset(),this.addTypenameTransform.resetCache(),(n=this.config.fragments)===null||n===void 0||n.resetCaches();var i=this.optimisticData.gc();return t&&!this.txCount&&(t.resetResultCache?this.resetResultCache(t.resetResultIdentities):t.resetResultIdentities&&this.storeReader.resetCanon()),i},e.prototype.retain=function(t,n){return(n?this.optimisticData:this.data).retain(t)},e.prototype.release=function(t,n){return(n?this.optimisticData:this.data).release(t)},e.prototype.identify=function(t){if(Ct(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(n){globalThis.__DEV__!==!1&&Ie.warn(n)}},e.prototype.evict=function(t){if(!t.id){if(Pr.call(t,"id"))return!1;t=F(F({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t,this.data)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(t){var n=this;return this.init(),pi.reset(),t&&t.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),ug(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var n=this.optimisticData.removeLayer(t);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(t){var n=this,i=t.update,a=t.optimistic,u=a===void 0?!0:a,c=t.removeOptimistic,f=t.onWatchUpdated,h,p=function(y){var g=n,b=g.data,I=g.optimisticData;++n.txCount,y&&(n.data=n.optimisticData=y);try{return h=i(n)}finally{--n.txCount,n.data=b,n.optimisticData=I}},m=new Set;return f&&!this.txCount&&this.broadcastWatches(F(F({},t),{onWatchUpdated:function(y){return m.add(y),!1}})),typeof u=="string"?this.optimisticData=this.optimisticData.addLayer(u,p):u===!1?p(this.data):p(),typeof c=="string"&&(this.optimisticData=this.optimisticData.removeLayer(c)),f&&m.size?(this.broadcastWatches(F(F({},t),{onWatchUpdated:function(y,g){var b=f.call(this,y,g);return b!==!1&&m.delete(y),b}})),m.size&&m.forEach(function(y){return n.maybeBroadcastWatch.dirty(y)})):this.broadcastWatches(t),h},e.prototype.performTransaction=function(t,n){return this.batch({update:t,optimistic:n||n!==null})},e.prototype.transformDocument=function(t){return this.addTypenameToDocument(this.addFragmentsToDocument(t))},e.prototype.fragmentMatches=function(t,n){return this.policies.fragmentMatches(t,n)},e.prototype.lookupFragment=function(t){var n;return((n=this.config.fragments)===null||n===void 0?void 0:n.lookup(t))||null},e.prototype.broadcastWatches=function(t){var n=this;this.txCount||this.watches.forEach(function(i){return n.maybeBroadcastWatch(i,t)})},e.prototype.addFragmentsToDocument=function(t){var n=this.config.fragments;return n?n.transform(t):t},e.prototype.addTypenameToDocument=function(t){return this.addTypename?this.addTypenameTransform.transformDocument(t):t},e.prototype.broadcastWatch=function(t,n){var i=t.lastDiff,a=this.diff(t);n&&(t.optimistic&&typeof n.optimistic=="string"&&(a.fromOptimisticTransaction=!0),n.onWatchUpdated&&n.onWatchUpdated.call(this,t,a,i)===!1)||(!i||!Nt(i.result,a.result))&&t.callback(t.lastDiff=a,i)},e}(mf);globalThis.__DEV__!==!1&&(If.prototype.getMemoryInternals=AE);var _t;(function(r){r[r.loading=1]="loading",r[r.setVariables=2]="setVariables",r[r.fetchMore=3]="fetchMore",r[r.refetch=4]="refetch",r[r.poll=6]="poll",r[r.ready=7]="ready",r[r.error=8]="error"})(_t||(_t={}));function ta(r){return r?r<7:!1}function LO(r){return r===7||r===8}var Og=Object.assign,qO=Object.hasOwnProperty,ra=function(r){In(e,r);function e(t){var n=t.queryManager,i=t.queryInfo,a=t.options,u=this,c=e.inactiveOnCreation.getValue();u=r.call(this,function(w){u._getOrCreateQuery();try{var O=w._subscription._observer;O&&!O.error&&(O.error=jO)}catch{}var P=!u.observers.size;u.observers.add(w);var D=u.last;return D&&D.error?w.error&&w.error(D.error):D&&D.result&&w.next&&w.next(u.maskResult(D.result)),P&&u.reobserve().catch(function(){}),function(){u.observers.delete(w)&&!u.observers.size&&u.tearDownQuery()}})||this,u.observers=new Set,u.subscriptions=new Set,u.dirty=!1,u._getOrCreateQuery=function(){return c&&(n.queries.set(u.queryId,i),c=!1),u.queryManager.getOrCreateQuery(u.queryId)},u.queryInfo=i,u.queryManager=n,u.waitForOwnResult=Cf(a.fetchPolicy),u.isTornDown=!1,u.subscribeToMore=u.subscribeToMore.bind(u),u.maskResult=u.maskResult.bind(u);var f=n.defaultOptions.watchQuery,h=f===void 0?{}:f,p=h.fetchPolicy,m=p===void 0?"cache-first":p,y=a.fetchPolicy,g=y===void 0?m:y,b=a.initialFetchPolicy,I=b===void 0?g==="standby"?m:g:b;u.options=F(F({},a),{initialFetchPolicy:I,fetchPolicy:g}),u.queryId=i.queryId||n.generateQueryId();var S=yi(u.query);return u.queryName=S&&S.name&&S.name.value,u}return Object.defineProperty(e.prototype,"query",{get:function(){return this.lastQuery||this.options.query},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var t=this;return new Promise(function(n,i){var a={next:function(c){n(c),t.observers.delete(a),t.observers.size||t.queryManager.removeQuery(t.queryId),setTimeout(function(){u.unsubscribe()},0)},error:i},u=t.subscribe(a)})},e.prototype.resetDiff=function(){this.queryInfo.resetDiff()},e.prototype.getCurrentFullResult=function(t){t===void 0&&(t=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||_t.ready,a=F(F({},n),{loading:ta(i),networkStatus:i}),u=this.options.fetchPolicy,c=u===void 0?"cache-first":u;if(!(Cf(c)||this.queryManager.getDocumentInfo(this.query).hasForcedResolvers))if(this.waitForOwnResult)this.queryInfo.updateWatch();else{var f=this.queryInfo.getDiff();(f.complete||this.options.returnPartialData)&&(a.data=f.result),Nt(a.data,{})&&(a.data=void 0),f.complete?(delete a.partial,f.complete&&a.networkStatus===_t.loading&&(c==="cache-first"||c==="cache-only")&&(a.networkStatus=_t.ready,a.loading=!1)):a.partial=!0,a.networkStatus===_t.ready&&(a.error||a.errors)&&(a.networkStatus=_t.error),globalThis.__DEV__!==!1&&!f.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Tg(f.missing)}return t&&this.updateLastResult(a),a},e.prototype.getCurrentResult=function(t){return t===void 0&&(t=!0),this.maskResult(this.getCurrentFullResult(t))},e.prototype.isDifferentFromLastResult=function(t,n){if(!this.last)return!0;var i=this.queryManager.getDocumentInfo(this.query),a=this.queryManager.dataMasking,u=a?i.nonReactiveQuery:this.query,c=a||i.hasNonreactiveDirective?!Wy(u,this.last.result,t,this.variables):!Nt(this.last.result,t);return c||n&&!Nt(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||Nt(i.variables,this.variables)))return i[t]},e.prototype.getLastResult=function(t){return this.getLast("result",t)},e.prototype.getLastError=function(t){return this.getLast("error",t)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(t){var n,i={pollInterval:0},a=this.options.fetchPolicy;if(a==="no-cache"?i.fetchPolicy="no-cache":i.fetchPolicy="network-only",globalThis.__DEV__!==!1&&t&&qO.call(t,"variables")){var u=Fl(this.query),c=u.variableDefinitions;(!c||!c.some(function(f){return f.variable.name.value==="variables"}))&&globalThis.__DEV__!==!1&&Ie.warn(21,t,((n=u.name)===null||n===void 0?void 0:n.value)||u)}return t&&!Nt(this.options.variables,t)&&(i.variables=this.options.variables=F(F({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(i,_t.refetch)},e.prototype.fetchMore=function(t){var n=this,i=F(F({},t.query?t:F(F(F(F({},this.options),{query:this.options.query}),t),{variables:F(F({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"});i.query=this.transformDocument(i.query);var a=this.queryManager.generateQueryId();this.lastQuery=t.query?this.transformDocument(this.options.query):i.query;var u=this.queryInfo,c=u.networkStatus;u.networkStatus=_t.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var f=new Set,h=t?.updateQuery,p=this.options.fetchPolicy!=="no-cache";return p||Ie(h,22),this.queryManager.fetchQuery(a,i,_t.fetchMore).then(function(m){if(n.queryManager.removeQuery(a),u.networkStatus===_t.fetchMore&&(u.networkStatus=c),p)n.queryManager.cache.batch({update:function(b){var I=t.updateQuery;I?b.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(S){return I(S,{fetchMoreResult:m.data,variables:i.variables})}):b.writeQuery({query:i.query,variables:i.variables,data:m.data})},onWatchUpdated:function(b){f.add(b.query)}});else{var y=n.getLast("result"),g=h(y.data,{fetchMoreResult:m.data,variables:i.variables});n.reportResult(F(F({},y),{networkStatus:c,loading:ta(c),data:g}),n.variables)}return n.maskResult(m)}).finally(function(){p&&!f.has(n.query)&&n.reobserveCacheFirst()})},e.prototype.subscribeToMore=function(t){var n=this,i=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var u=t.updateQuery;u&&n.updateQuery(function(c,f){return u(c,F({subscriptionData:a},f))})},error:function(a){if(t.onError){t.onError(a);return}globalThis.__DEV__!==!1&&Ie.error(23,a)}});return this.subscriptions.add(i),function(){n.subscriptions.delete(i)&&i.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.silentSetOptions=function(t){var n=Qi(this.options,t||{});Og(this.options,n)},e.prototype.setVariables=function(t){return Nt(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},_t.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var n=this.queryManager,i=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}),a=i.result,u=i.complete,c=t(a,{variables:this.variables,complete:!!u,previousData:a});c&&(n.cache.writeQuery({query:this.options.query,data:c,variables:this.variables}),n.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,n){if(n.nextFetchPolicy){var i=n.fetchPolicy,a=i===void 0?"cache-first":i,u=n.initialFetchPolicy,c=u===void 0?a:u;a==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy(a,{reason:t,options:n,observable:this,initialFetchPolicy:c}):t==="variables-changed"?n.fetchPolicy=c:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(t,n,i){var a=this._getOrCreateQuery();return a.setObservableQuery(this),this.queryManager.fetchConcastWithInfo(a,t,n,i)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var n=this,i=n.pollingInfo,a=n.options.pollInterval;if(!a||!this.hasObservers()){i&&(clearTimeout(i.timeout),delete this.pollingInfo);return}if(!(i&&i.interval===a)){Ie(a,24);var u=i||(this.pollingInfo={});u.interval=a;var c=function(){var h,p;t.pollingInfo&&(!ta(t.queryInfo.networkStatus)&&!(!((p=(h=t.options).skipPollAttempt)===null||p===void 0)&&p.call(h))?t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},_t.poll).then(f,f):f())},f=function(){var h=t.pollingInfo;h&&(clearTimeout(h.timeout),h.timeout=setTimeout(c,h.interval))};f()}}},e.prototype.updateLastResult=function(t,n){n===void 0&&(n=this.variables);var i=this.getLastError();return i&&this.last&&!Nt(n,this.last.variables)&&(i=void 0),this.last=F({result:this.queryManager.assumeImmutableResults?t:tf(t),variables:n},i?{error:i}:null)},e.prototype.reobserveAsConcast=function(t,n){var i=this;this.isTornDown=!1;var a=n===_t.refetch||n===_t.fetchMore||n===_t.poll,u=this.options.variables,c=this.options.fetchPolicy,f=Qi(this.options,t||{}),h=a?f:Og(this.options,f),p=this.transformDocument(h.query);this.lastQuery=p,a||(this.updatePolling(),t&&t.variables&&!Nt(t.variables,u)&&h.fetchPolicy!=="standby"&&(h.fetchPolicy===c||typeof h.nextFetchPolicy=="function")&&(this.applyNextFetchPolicy("variables-changed",h),n===void 0&&(n=_t.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=Cf(h.fetchPolicy));var m=function(){i.concast===b&&(i.waitForOwnResult=!1)},y=h.variables&&F({},h.variables),g=this.fetch(h,n,p),b=g.concast,I=g.fromLink,S={next:function(w){Nt(i.variables,y)&&(m(),i.reportResult(w,y))},error:function(w){Nt(i.variables,y)&&(uf(w)||(w=new mn({networkError:w})),m(),i.reportError(w,y))}};return!a&&(I||!this.concast)&&(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=b,this.observer=S),b.addObserver(S),b},e.prototype.reobserve=function(t,n){return Sy(this.reobserveAsConcast(t,n).promise.then(this.maskResult))},e.prototype.resubscribeAfterError=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this.last;this.resetLastResults();var a=this.subscribe.apply(this,t);return this.last=i,a},e.prototype.observe=function(){this.reportResult(this.getCurrentFullResult(!1),this.variables)},e.prototype.reportResult=function(t,n){var i=this.getLastError(),a=this.isDifferentFromLastResult(t,n);(i||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,n),(i||a)&&Zs(this.observers,"next",this.maskResult(t))},e.prototype.reportError=function(t,n){var i=F(F({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:_t.error,loading:!1});this.updateLastResult(i,n),Zs(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e.prototype.transformDocument=function(t){return this.queryManager.transform(t)},e.prototype.maskResult=function(t){return t&&"data"in t?F(F({},t),{data:this.queryManager.maskOperation({document:this.query,data:t.data,fetchPolicy:this.options.fetchPolicy,id:this.queryId})}):t},e.prototype.resetNotifications=function(){this.cancelNotifyTimeout(),this.dirty=!1},e.prototype.cancelNotifyTimeout=function(){this.notifyTimeout&&(clearTimeout(this.notifyTimeout),this.notifyTimeout=void 0)},e.prototype.scheduleNotify=function(){var t=this;this.dirty||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},e.prototype.notify=function(){if(this.cancelNotifyTimeout(),this.dirty&&(this.options.fetchPolicy=="cache-only"||this.options.fetchPolicy=="cache-and-network"||!ta(this.queryInfo.networkStatus))){var t=this.queryInfo.getDiff();t.fromOptimisticTransaction?this.observe():this.reobserveCacheFirst()}this.dirty=!1},e.prototype.reobserveCacheFirst=function(){var t=this.options,n=t.fetchPolicy,i=t.nextFetchPolicy;return n==="cache-and-network"||n==="network-only"?this.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(a,u){return this.nextFetchPolicy=i,typeof this.nextFetchPolicy=="function"?this.nextFetchPolicy(a,u):n}}):this.reobserve()},e.inactiveOnCreation=new Ya,e}(Pt);nf(ra);function jO(r){globalThis.__DEV__!==!1&&Ie.error(25,r.message,r.stack)}function Tg(r){globalThis.__DEV__!==!1&&r&&globalThis.__DEV__!==!1&&Ie.debug(26,r)}function Cf(r){return r==="network-only"||r==="no-cache"||r==="standby"}var na=new(Bi?WeakMap:Map);function Pf(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return na.set(r,(na.get(r)+1)%1e15),t.apply(this,arguments)})}var Nf=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.document=null,this.lastRequestId=1,this.stopped=!1,this.observableQuery=null;var n=this.cache=e.cache;na.has(n)||(na.set(n,0),Pf(n,"evict"),Pf(n,"modify"),Pf(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||_t.loading;return this.variables&&this.networkStatus!==_t.loading&&!Nt(this.variables,e.variables)&&(t=_t.setVariables),Nt(e.variables,this.variables)||(this.lastDiff=void 0,this.cancel()),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.resetDiff=function(){this.lastDiff=void 0},r.prototype.getDiff=function(){var e=this.getDiffOptions();if(this.lastDiff&&Nt(e,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables);var t=this.observableQuery;if(t&&t.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(e);return this.updateLastDiff(n,e),n},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t,n,i=this.lastDiff&&this.lastDiff.diff;e&&!e.complete&&(!((t=this.observableQuery)===null||t===void 0)&&t.getLastError())||(this.updateLastDiff(e),Nt(i&&i.result,e&&e.result)||(n=this.observableQuery)===null||n===void 0||n.scheduleNotify())},r.prototype.setObservableQuery=function(e){e!==this.observableQuery&&(this.observableQuery=e,e&&(e.queryInfo=this))},r.prototype.stop=function(){var e;if(!this.stopped){this.stopped=!0,(e=this.observableQuery)===null||e===void 0||e.resetNotifications(),this.cancel();var t=this.observableQuery;t&&t.stopPolling()}},r.prototype.cancel=function(){var e;(e=this.cancelWatch)===null||e===void 0||e.call(this),this.cancelWatch=void 0},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var i=F(F({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Nt(i,this.lastWatch))&&(this.cancel(),this.cancelWatch=this.cache.watch(this.lastWatch=i))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var n=this.lastWrite;return!(n&&n.dmCount===na.get(this.cache)&&Nt(t,n.variables)&&Nt(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,u,c=new vi,f=pn(e.errors)?e.errors.slice(0):[];if((u=this.observableQuery)===null||u===void 0||u.resetNotifications(),"incremental"in e&&pn(e.incremental)){var h=sf(this.getDiff().result,e);e.data=h}else if("hasNext"in e&&e.hasNext){var p=this.getDiff();e.data=c.merge(p.result,e.data)}this.graphQLErrors=f,n.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(n.variables)):i!==0&&(Rf(e,n.errorPolicy)?this.cache.performTransaction(function(m){if(a.shouldWrite(e,n.variables))m.writeQuery({query:t,data:e.data,variables:n.variables,overwrite:i===1}),a.lastWrite={result:e,variables:n.variables,dmCount:na.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var y=a.getDiffOptions(n.variables),g=m.diff(y);!a.stopped&&Nt(a.variables,n.variables)&&a.updateWatch(n.variables),a.updateLastDiff(g,y),g.complete&&(e.data=g.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=_t.ready},r.prototype.markError=function(e){var t;return this.networkStatus=_t.error,this.lastWrite=void 0,(t=this.observableQuery)===null||t===void 0||t.resetNotifications(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function Rf(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",n=!no(r);return!n&&t&&r.data&&(n=!0),n}var UO=Object.prototype.hasOwnProperty,kg=Object.create(null),$O=function(){function r(e){var t=this;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new gu(Qn["queryManager.getDocumentInfo"]||2e3),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Gs(!1),this.noCacheWarningsByQueryId=new Set;var n=new Su(function(a){return t.cache.transformDocument(a)},{cache:!1});this.cache=e.cache,this.link=e.link,this.defaultOptions=e.defaultOptions,this.queryDeduplication=e.queryDeduplication,this.clientAwareness=e.clientAwareness,this.localState=e.localState,this.ssrMode=e.ssrMode,this.assumeImmutableResults=e.assumeImmutableResults,this.dataMasking=e.dataMasking;var i=e.documentTransform;this.documentTransform=i?n.concat(i).concat(n):n,this.defaultContext=e.defaultContext||Object.create(null),(this.onBroadcast=e.onBroadcast)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(Jr(27))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){return ji(this,arguments,void 0,function(t){var n,i,a,u,c,f,h,p=t.mutation,m=t.variables,y=t.optimisticResponse,g=t.updateQueries,b=t.refetchQueries,I=b===void 0?[]:b,S=t.awaitRefetchQueries,w=S===void 0?!1:S,O=t.update,P=t.onQueryUpdated,D=t.fetchPolicy,T=D===void 0?((f=this.defaultOptions.mutate)===null||f===void 0?void 0:f.fetchPolicy)||"network-only":D,N=t.errorPolicy,G=N===void 0?((h=this.defaultOptions.mutate)===null||h===void 0?void 0:h.errorPolicy)||"none":N,q=t.keepRootFields,$=t.context;return Ui(this,function(K){switch(K.label){case 0:return Ie(p,28),Ie(T==="network-only"||T==="no-cache",29),n=this.generateMutationId(),p=this.cache.transformForLink(this.transform(p)),i=this.getDocumentInfo(p).hasClientExports,m=this.getVariables(p,m),i?[4,this.localState.addExportedVariables(p,m,$)]:[3,2];case 1:m=K.sent(),K.label=2;case 2:return a=this.mutationStore&&(this.mutationStore[n]={mutation:p,variables:m,loading:!0,error:null}),u=y&&this.markMutationOptimistic(y,{mutationId:n,document:p,variables:m,fetchPolicy:T,errorPolicy:G,context:$,updateQueries:g,update:O,keepRootFields:q}),this.broadcastQueries(),c=this,[2,new Promise(function(oe,re){return ku(c.getObservableFromLink(p,F(F({},$),{optimisticResponse:u?y:void 0}),m,{},!1),function(Ee){if(no(Ee)&&G==="none")throw new mn({graphQLErrors:Au(Ee)});a&&(a.loading=!1,a.error=null);var ie=F({},Ee);return typeof I=="function"&&(I=I(ie)),G==="ignore"&&no(ie)&&delete ie.errors,c.markMutationResult({mutationId:n,result:ie,document:p,variables:m,fetchPolicy:T,errorPolicy:G,context:$,update:O,updateQueries:g,awaitRefetchQueries:w,refetchQueries:I,removeOptimistic:u?n:void 0,onQueryUpdated:P,keepRootFields:q})}).subscribe({next:function(Ee){c.broadcastQueries(),(!("hasNext"in Ee)||Ee.hasNext===!1)&&oe(F(F({},Ee),{data:c.maskOperation({document:p,data:Ee.data,fetchPolicy:T,id:n})}))},error:function(Ee){a&&(a.loading=!1,a.error=Ee),u&&c.cache.removeOptimistic(n),c.broadcastQueries(),re(Ee instanceof mn?Ee:new mn({networkError:Ee}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var n=this;t===void 0&&(t=this.cache);var i=e.result,a=[],u=e.fetchPolicy==="no-cache";if(!u&&Rf(i,e.errorPolicy)){if(ks(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),ks(i)&&pn(i.incremental)){var c=t.diff({id:"ROOT_MUTATION",query:this.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),f=void 0;c.result&&(f=sf(c.result,i)),typeof f<"u"&&(i.data=f,a.push({result:f,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var h=e.updateQueries;h&&this.queries.forEach(function(m,y){var g=m.observableQuery,b=g&&g.queryName;if(!(!b||!UO.call(h,b))){var I=h[b],S=n.queries.get(y),w=S.document,O=S.variables,P=t.diff({query:w,variables:O,returnPartialData:!0,optimistic:!1}),D=P.result,T=P.complete;if(T&&D){var N=I(D,{mutationResult:i,queryName:w&&Js(w)||void 0,queryVariables:O});N&&a.push({result:N,dataId:"ROOT_QUERY",query:w,variables:O})}}})}if(a.length>0||(e.refetchQueries||"").length>0||e.update||e.onQueryUpdated||e.removeOptimistic){var p=[];if(this.refetchQueries({updateCache:function(m){u||a.forEach(function(I){return m.write(I)});var y=e.update,g=!Oy(i)||ks(i)&&!i.hasNext;if(y){if(!u){var b=m.diff({id:"ROOT_MUTATION",query:n.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});b.complete&&(i=F(F({},i),{data:b.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}g&&y(m,i,{context:e.context,variables:e.variables})}!u&&!e.keepRootFields&&g&&m.modify({id:"ROOT_MUTATION",fields:function(I,S){var w=S.fieldName,O=S.DELETE;return w==="__typename"?I:O}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(m){return p.push(m)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(p).then(function(){return i})}return Promise.resolve(i)},r.prototype.markMutationOptimistic=function(e,t){var n=this,i=typeof e=="function"?e(t.variables,{IGNORE:kg}):e;return i===kg?!1:(this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(F(F({},t),{result:{data:i}}),a)}catch(u){globalThis.__DEV__!==!1&&Ie.error(u)}},t.mutationId),!0)},r.prototype.fetchQuery=function(e,t,n){return this.fetchConcastWithInfo(this.getOrCreateQuery(e),t,n).concast.promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,n){e[n]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){return this.documentTransform.transformDocument(e)},r.prototype.getDocumentInfo=function(e){var t=this.transformCache;if(!t.has(e)){var n={hasClientExports:Pm(e),hasForcedResolvers:this.localState.shouldForceResolvers(e),hasNonreactiveDirective:$i(["nonreactive"],e),nonReactiveQuery:my(e),clientQuery:this.localState.clientQuery(e),serverQuery:xu([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"},{name:"unmask"}],e),defaultVars:bu(yi(e)),asQuery:F(F({},e),{definitions:e.definitions.map(function(i){return i.kind==="OperationDefinition"&&i.operation!=="query"?F(F({},i),{operation:"query"}):i})})};t.set(e,n)}return t.get(e)},r.prototype.getVariables=function(e,t){return F(F({},this.getDocumentInfo(e).defaultVars),t)},r.prototype.watchQuery=function(e){var t=this.transform(e.query);e=F(F({},e),{variables:this.getVariables(t,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var n=new Nf(this),i=new ra({queryManager:this,queryInfo:n,options:e});return i.lastQuery=t,ra.inactiveOnCreation.getValue()||this.queries.set(i.queryId,n),n.init({document:t,observableQuery:i,variables:i.variables}),i},r.prototype.query=function(e,t){var n=this;t===void 0&&(t=this.generateQueryId()),Ie(e.query,30),Ie(e.query.kind==="Document",31),Ie(!e.returnPartialData,32),Ie(!e.pollInterval,33);var i=this.transform(e.query);return this.fetchQuery(t,F(F({},e),{query:i})).then(function(a){return a&&F(F({},a),{data:n.maskOperation({document:i,data:a.data,fetchPolicy:e.fetchPolicy,id:t})})}).finally(function(){return n.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(Jr(34)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=_t.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var n=new Map,i=new Map,a=new Map,u=new Set;return Array.isArray(e)&&e.forEach(function(c){if(typeof c=="string")i.set(c,c),a.set(c,!1);else if(zm(c)){var f=gi(t.transform(c));i.set(f,Js(c)),a.set(f,!1)}else Zt(c)&&c.query&&u.add(c)}),this.queries.forEach(function(c,f){var h=c.observableQuery,p=c.document;if(h){if(e==="all"){n.set(f,h);return}var m=h.queryName,y=h.options.fetchPolicy;if(y==="standby"||e==="active"&&!h.hasObservers())return;(e==="active"||m&&a.has(m)||p&&a.has(gi(p)))&&(n.set(f,h),m&&a.set(m,!0),p&&a.set(gi(p),!0))}}),u.size&&u.forEach(function(c){var f=au("legacyOneTimeQuery"),h=t.getOrCreateQuery(f).init({document:c.query,variables:c.variables}),p=new ra({queryManager:t,queryInfo:h,options:F(F({},c),{fetchPolicy:"network-only"})});Ie(p.queryId===f),h.setObservableQuery(p),n.set(f,p)}),globalThis.__DEV__!==!1&&a.size&&a.forEach(function(c,f){if(!c){var h=i.get(f);h?globalThis.__DEV__!==!1&&Ie.warn(35,h):globalThis.__DEV__!==!1&&Ie.warn(36)}}),n},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var n=[];return this.getObservableQueries(e?"all":"active").forEach(function(i,a){var u=i.options.fetchPolicy;i.resetLastResults(),(e||u!=="standby"&&u!=="cache-only")&&n.push(i.refetch()),(t.queries.get(a)||i.queryInfo).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},r.prototype.startGraphQLSubscription=function(e){var t=this,n=e.query,i=e.variables,a=e.fetchPolicy,u=e.errorPolicy,c=u===void 0?"none":u,f=e.context,h=f===void 0?{}:f,p=e.extensions,m=p===void 0?{}:p;n=this.transform(n),i=this.getVariables(n,i);var y=function(b){return t.getObservableFromLink(n,h,b,m).map(function(I){a!=="no-cache"&&(Rf(I,c)&&t.cache.write({query:n,result:I.data,dataId:"ROOT_SUBSCRIPTION",variables:b}),t.broadcastQueries());var S=no(I),w=Cy(I);if(S||w){var O={};if(S&&(O.graphQLErrors=I.errors),w&&(O.protocolErrors=I.extensions[Nu]),c==="none"||w)throw new mn(O)}return c==="ignore"&&delete I.errors,I})};if(this.getDocumentInfo(n).hasClientExports){var g=this.localState.addExportedVariables(n,i,h).then(y);return new Pt(function(b){var I=null;return g.then(function(S){return I=S.subscribe(b)},b.error),function(){return I&&I.unsubscribe()}})}return y(i)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){var t;this.fetchCancelFns.delete(e),this.queries.has(e)&&((t=this.queries.get(e))===null||t===void 0||t.stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){var t;return(t=e.observableQuery)===null||t===void 0?void 0:t.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,n,i,a){var u=this,c;a===void 0&&(a=(c=t?.queryDeduplication)!==null&&c!==void 0?c:this.queryDeduplication);var f,h=this.getDocumentInfo(e),p=h.serverQuery,m=h.clientQuery;if(p){var y=this,g=y.inFlightLinkObservables,b=y.link,I={query:p,variables:n,operationName:Js(p)||void 0,context:this.prepareContext(F(F({},t),{forceFetch:!a})),extensions:i};if(t=I.context,a){var S=gi(p),w=pi(n),O=g.lookup(S,w);if(f=O.observable,!f){var P=new Ts([Pu(b,I)]);f=O.observable=P,P.beforeNext(function D(T,N){T==="next"&&"hasNext"in N&&N.hasNext?P.beforeNext(D):g.remove(S,w)})}}else f=new Ts([Pu(b,I)])}else f=new Ts([Pt.of({data:{}})]),t=this.prepareContext(t);return m&&(f=ku(f,function(D){return u.localState.runResolvers({document:m,remoteResult:D,context:t,variables:n})})),f},r.prototype.getResultsFromLink=function(e,t,n){var i=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(n.query);return ku(this.getObservableFromLink(a,n.context,n.variables),function(u){var c=Au(u),f=c.length>0,h=n.errorPolicy;if(i>=e.lastRequestId){if(f&&h==="none")throw e.markError(new mn({graphQLErrors:c}));e.markResult(u,a,n,t),e.markReady()}var p={data:u.data,loading:!1,networkStatus:_t.ready};return f&&h==="none"&&(p.data=void 0),f&&h!=="ignore"&&(p.errors=c,p.networkStatus=_t.error),p},function(u){var c=uf(u)?u:new mn({networkError:u});throw i>=e.lastRequestId&&e.markError(c),c})},r.prototype.fetchConcastWithInfo=function(e,t,n,i){var a=this;n===void 0&&(n=_t.loading),i===void 0&&(i=t.query);var u=this.getVariables(i,t.variables),c=this.defaultOptions.watchQuery,f=t.fetchPolicy,h=f===void 0?c&&c.fetchPolicy||"cache-first":f,p=t.errorPolicy,m=p===void 0?c&&c.errorPolicy||"none":p,y=t.returnPartialData,g=y===void 0?!1:y,b=t.notifyOnNetworkStatusChange,I=b===void 0?!1:b,S=t.context,w=S===void 0?{}:S,O=Object.assign({},t,{query:i,variables:u,fetchPolicy:h,errorPolicy:m,returnPartialData:g,notifyOnNetworkStatusChange:I,context:w}),P=function(q){O.variables=q;var $=a.fetchQueryByPolicy(e,O,n);return O.fetchPolicy!=="standby"&&$.sources.length>0&&e.observableQuery&&e.observableQuery.applyNextFetchPolicy("after-fetch",t),$},D=function(){return a.fetchCancelFns.delete(e.queryId)};this.fetchCancelFns.set(e.queryId,function(q){D(),setTimeout(function(){return T.cancel(q)})});var T,N;if(this.getDocumentInfo(O.query).hasClientExports)T=new Ts(this.localState.addExportedVariables(O.query,O.variables,O.context).then(P).then(function(q){return q.sources})),N=!0;else{var G=P(O.variables);N=G.fromLink,T=new Ts(G.sources)}return T.promise.then(D,D),{concast:T,fromLink:N}},r.prototype.refetchQueries=function(e){var t=this,n=e.updateCache,i=e.include,a=e.optimistic,u=a===void 0?!1:a,c=e.removeOptimistic,f=c===void 0?u?au("refetchQueries"):void 0:c,h=e.onQueryUpdated,p=new Map;i&&this.getObservableQueries(i).forEach(function(y,g){p.set(g,{oq:y,lastDiff:(t.queries.get(g)||y.queryInfo).getDiff()})});var m=new Map;return n&&this.cache.batch({update:n,optimistic:u&&f||!1,removeOptimistic:f,onWatchUpdated:function(y,g,b){var I=y.watcher instanceof Nf&&y.watcher.observableQuery;if(I){if(h){p.delete(I.queryId);var S=h(I,g,b);return S===!0&&(S=I.refetch()),S!==!1&&m.set(I,S),S}h!==null&&p.set(I.queryId,{oq:I,lastDiff:b,diff:g})}}}),p.size&&p.forEach(function(y,g){var b=y.oq,I=y.lastDiff,S=y.diff,w;h&&(S||(S=t.cache.diff(b.queryInfo.getDiffOptions())),w=h(b,S,I)),(!h||w===!0)&&(w=b.refetch()),w!==!1&&m.set(b,w),g.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(g)}),f&&this.cache.removeOptimistic(f),m},r.prototype.maskOperation=function(e){var t,n,i,a=e.document,u=e.data;if(globalThis.__DEV__!==!1){var c=e.fetchPolicy,f=e.id,h=(t=yi(a))===null||t===void 0?void 0:t.operation,p=((n=h?.[0])!==null&&n!==void 0?n:"o")+f;this.dataMasking&&c==="no-cache"&&!jm(a)&&!this.noCacheWarningsByQueryId.has(p)&&(this.noCacheWarningsByQueryId.add(p),globalThis.__DEV__!==!1&&Ie.warn(37,(i=Js(a))!==null&&i!==void 0?i:"Unnamed ".concat(h??"operation")))}return this.dataMasking?_O(u,a,this.cache):u},r.prototype.maskFragment=function(e){var t=e.data,n=e.fragment,i=e.fragmentName;return this.dataMasking?Ky(t,n,this.cache,i):t},r.prototype.fetchQueryByPolicy=function(e,t,n){var i=this,a=t.query,u=t.variables,c=t.fetchPolicy,f=t.refetchWritePolicy,h=t.errorPolicy,p=t.returnPartialData,m=t.context,y=t.notifyOnNetworkStatusChange,g=e.networkStatus;e.init({document:a,variables:u,networkStatus:n});var b=function(){return e.getDiff()},I=function(D,T){T===void 0&&(T=e.networkStatus||_t.loading);var N=D.result;globalThis.__DEV__!==!1&&!p&&!Nt(N,{})&&Tg(D.missing);var G=function(q){return Pt.of(F({data:q,loading:ta(T),networkStatus:T},D.complete?null:{partial:!0}))};return N&&i.getDocumentInfo(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:N},context:m,variables:u,onlyRunForcedResolvers:!0}).then(function(q){return G(q.data||void 0)}):h==="none"&&T===_t.refetch&&Array.isArray(D.missing)?G(void 0):G(N)},S=c==="no-cache"?0:n===_t.refetch&&f!=="merge"?1:2,w=function(){return i.getResultsFromLink(e,S,{query:a,variables:u,context:m,fetchPolicy:c,errorPolicy:h})},O=y&&typeof g=="number"&&g!==n&&ta(n);switch(c){default:case"cache-first":{var P=b();return P.complete?{fromLink:!1,sources:[I(P,e.markReady())]}:p||O?{fromLink:!0,sources:[I(P),w()]}:{fromLink:!0,sources:[w()]}}case"cache-and-network":{var P=b();return P.complete||p||O?{fromLink:!0,sources:[I(P),w()]}:{fromLink:!0,sources:[w()]}}case"cache-only":return{fromLink:!1,sources:[I(b(),e.markReady())]};case"network-only":return O?{fromLink:!0,sources:[I(b()),w()]}:{fromLink:!0,sources:[w()]};case"no-cache":return O?{fromLink:!0,sources:[I(e.getDiff()),w()]}:{fromLink:!0,sources:[w()]};case"standby":return{fromLink:!1,sources:[]}}},r.prototype.getOrCreateQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Nf(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return F(F(F({},this.defaultContext),t),{clientAwareness:this.clientAwareness})},r}(),BO=function(){function r(e){var t=e.cache,n=e.client,i=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,n&&(this.client=n),i&&this.addResolvers(i),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){t.resolvers=eo(t.resolvers,n)}):this.resolvers=eo(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){return ji(this,arguments,void 0,function(t){var n=t.document,i=t.remoteResult,a=t.context,u=t.variables,c=t.onlyRunForcedResolvers,f=c===void 0?!1:c;return Ui(this,function(h){return n?[2,this.resolveDocument(n,i.data,a,u,this.fragmentMatcher,f).then(function(p){return F(F({},i),{data:p.result})})]:[2,i]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return $i(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return zl(e)},r.prototype.prepareContext=function(e){var t=this.cache;return F(F({},e),{cache:t,getCacheKey:function(n){return t.identify(n)}})},r.prototype.addExportedVariables=function(e){return ji(this,arguments,void 0,function(t,n,i){return n===void 0&&(n={}),i===void 0&&(i={}),Ui(this,function(a){return t?[2,this.resolveDocument(t,this.buildRootValueFromCache(t,n)||{},this.prepareContext(i),n).then(function(u){return F(F({},n),u.exportedVariables)})]:[2,F({},n)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return on(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(t=n.arguments.some(function(i){return i.name.value==="always"&&i.value.kind==="BooleanValue"&&i.value.value===!0}),t))return hu}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:py(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t){return ji(this,arguments,void 0,function(n,i,a,u,c,f){var h,p,m,y,g,b,I,S,w,O,P;return a===void 0&&(a={}),u===void 0&&(u={}),c===void 0&&(c=function(){return!0}),f===void 0&&(f=!1),Ui(this,function(D){return h=Hi(n),p=Es(n),m=_s(p),y=this.collectSelectionsToResolve(h,m),g=h.operation,b=g?g.charAt(0).toUpperCase()+g.slice(1):"Query",I=this,S=I.cache,w=I.client,O={fragmentMap:m,context:F(F({},a),{cache:S,client:w}),variables:u,fragmentMatcher:c,defaultOperationType:b,exportedVariables:{},selectionsToResolve:y,onlyRunForcedResolvers:f},P=!1,[2,this.resolveSelectionSet(h.selectionSet,P,i,O).then(function(T){return{result:T,exportedVariables:O.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,n,i){return ji(this,void 0,void 0,function(){var a,u,c,f,h,p=this;return Ui(this,function(m){return a=i.fragmentMap,u=i.context,c=i.variables,f=[n],h=function(y){return ji(p,void 0,void 0,function(){var g,b;return Ui(this,function(I){return!t&&!i.selectionsToResolve.has(y)?[2]:Hs(y,c)?mi(y)?[2,this.resolveField(y,t,n,i).then(function(S){var w;typeof S<"u"&&f.push((w={},w[ai(y)]=S,w))})]:(Gm(y)?g=y:(g=a[y.name.value],Ie(g,19,y.name.value)),g&&g.typeCondition&&(b=g.typeCondition.name.value,i.fragmentMatcher(n,b,u))?[2,this.resolveSelectionSet(g.selectionSet,t,n,i).then(function(S){f.push(S)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(h)).then(function(){return to(f)})]})})},r.prototype.resolveField=function(e,t,n,i){return ji(this,void 0,void 0,function(){var a,u,c,f,h,p,m,y,g,b=this;return Ui(this,function(I){return n?(a=i.variables,u=e.name.value,c=ai(e),f=u!==c,h=n[c]||n[u],p=Promise.resolve(h),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(m=n.__typename||i.defaultOperationType,y=this.resolvers&&this.resolvers[m],y&&(g=y[f?u:c],g&&(p=Promise.resolve(Sf.withValue(this.cache,g,[n,Ja(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,p.then(function(S){var w,O;if(S===void 0&&(S=h),e.directives&&e.directives.forEach(function(D){D.name.value==="export"&&D.arguments&&D.arguments.forEach(function(T){T.name.value==="as"&&T.value.kind==="StringValue"&&(i.exportedVariables[T.value.value]=S)})}),!e.selectionSet||S==null)return S;var P=(O=(w=e.directives)===null||w===void 0?void 0:w.some(function(D){return D.name.value==="client"}))!==null&&O!==void 0?O:!1;if(Array.isArray(S))return b.resolveSubSelectedArray(e,t||P,S,i);if(e.selectionSet)return b.resolveSelectionSet(e.selectionSet,t||P,S,i)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,n,i){var a=this;return Promise.all(n.map(function(u){if(u===null)return null;if(Array.isArray(u))return a.resolveSubSelectedArray(e,t,u,i);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,u,i)}))},r.prototype.collectSelectionsToResolve=function(e,t){var n=function(u){return!Array.isArray(u)},i=this.selectionsToResolveCache;function a(u){if(!i.has(u)){var c=new Set;i.set(u,c),on(u,{Directive:function(f,h,p,m,y){f.name.value==="client"&&y.forEach(function(g){n(g)&&Cm(g)&&c.add(g)})},FragmentSpread:function(f,h,p,m,y){var g=t[f.name.value];Ie(g,20,f.name.value);var b=a(g);b.size>0&&(y.forEach(function(I){n(I)&&Cm(I)&&c.add(I)}),c.add(f),b.forEach(function(I){c.add(I)}))}})}return i.get(u)}return a(e)},r}(),Ag=!1,Mf=function(){function r(e){var t=this,n;if(this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],!e.cache)throw Jr(16);var i=e.uri,a=e.credentials,u=e.headers,c=e.cache,f=e.documentTransform,h=e.ssrMode,p=h===void 0?!1:h,m=e.ssrForceFetchDelay,y=m===void 0?0:m,g=e.connectToDevTools,b=e.queryDeduplication,I=b===void 0?!0:b,S=e.defaultOptions,w=e.defaultContext,O=e.assumeImmutableResults,P=O===void 0?c.assumeImmutableResults:O,D=e.resolvers,T=e.typeDefs,N=e.fragmentMatcher,G=e.name,q=e.version,$=e.devtools,K=e.dataMasking,oe=e.link;oe||(oe=i?new jy({uri:i,credentials:a,headers:u}):Yr.empty()),this.link=oe,this.cache=c,this.disableNetworkFetches=p||y>0,this.queryDeduplication=I,this.defaultOptions=S||Object.create(null),this.typeDefs=T,this.devtoolsConfig=F(F({},$),{enabled:(n=$?.enabled)!==null&&n!==void 0?n:g}),this.devtoolsConfig.enabled===void 0&&(this.devtoolsConfig.enabled=globalThis.__DEV__!==!1),y&&setTimeout(function(){return t.disableNetworkFetches=!1},y),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.watchFragment=this.watchFragment.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),this.version=gl,this.localState=new BO({cache:c,client:this,resolvers:D,fragmentMatcher:N}),this.queryManager=new $O({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,defaultContext:w,documentTransform:f,queryDeduplication:I,ssrMode:p,dataMasking:!!K,clientAwareness:{name:G,version:q},localState:this.localState,assumeImmutableResults:P,onBroadcast:this.devtoolsConfig.enabled?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0}),this.devtoolsConfig.enabled&&this.connectToDevTools()}return r.prototype.connectToDevTools=function(){if(!(typeof window>"u")){var e=window,t=Symbol.for("apollo.devtools");(e[t]=e[t]||[]).push(this),e.__APOLLO_CLIENT__=this,!Ag&&globalThis.__DEV__!==!1&&(Ag=!0,window.document&&window.top===window.self&&/^(https?|file):$/.test(window.location.protocol)&&setTimeout(function(){if(!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__){var n=window.navigator,i=n&&n.userAgent,a=void 0;typeof i=="string"&&(i.indexOf("Chrome/")>-1?a="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":i.indexOf("Firefox/")>-1&&(a="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),a&&globalThis.__DEV__!==!1&&Ie.log("Download the Apollo DevTools for a better development experience: %s",a)}},1e4))}},Object.defineProperty(r.prototype,"documentTransform",{get:function(){return this.queryManager.documentTransform},enumerable:!1,configurable:!0}),r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ji(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=F(F({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Ji(this.defaultOptions.query,e)),Ie(e.fetchPolicy!=="cache-and-network",17),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=F(F({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ji(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){var t=this,n=this.queryManager.generateQueryId();return this.queryManager.startGraphQLSubscription(e).map(function(i){return F(F({},i),{data:t.queryManager.maskOperation({document:e.query,data:i.data,fetchPolicy:e.fetchPolicy,id:n})})})},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.watchFragment=function(e){var t;return this.cache.watchFragment(F(F({},e),(t={},t[Symbol.for("apollo.dataMasking")]=this.queryManager.dataMasking,t)))},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return Pu(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),n=[],i=[];t.forEach(function(u,c){n.push(c),i.push(u)});var a=Promise.all(i);return a.queries=n,a.results=i,a.catch(function(u){globalThis.__DEV__!==!1&&Ie.debug(18,u)}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},Object.defineProperty(r.prototype,"defaultContext",{get:function(){return this.queryManager.defaultContext},enumerable:!1,configurable:!0}),r}();globalThis.__DEV__!==!1&&(Mf.prototype.getMemoryInternals=kE);var Lu=new Map,Df=new Map,Ig=!0,qu=!1;function Cg(r){return r.replace(/[\s,]+/g," ").trim()}function VO(r){return Cg(r.source.body.substring(r.start,r.end))}function WO(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=VO(n.loc),u=Df.get(i);u&&!u.has(a)?Ig&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
85
85
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
86
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):u||Pf.set(i,u=new Set),u.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),L(L({},r),{definitions:t})}function S1(r){var e=new Set(r.definitions);e.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function E1(r){var e=hg(r);if(!Cu.has(e)){var t=DS(r,{experimentalFragmentVariables:Pu,allowLegacyFragmentVariables:Pu});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");Cu.set(e,S1(x1(t)))}return Cu.get(e)}function Ji(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof r=="string"&&(r=[r]);var n=r[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=r[a+1]}),E1(n)}function dg(){Cu.clear(),Pf.clear()}function pg(){fg=!1}function mg(){Pu=!0}function yg(){Pu=!1}var uo={gql:Ji,resetCaches:dg,disableFragmentWarnings:pg,enableExperimentalFragmentVariables:mg,disableExperimentalFragmentVariables:yg};(function(r){r.gql=uo.gql,r.resetCaches=uo.resetCaches,r.disableFragmentWarnings=uo.disableFragmentWarnings,r.enableExperimentalFragmentVariables=uo.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=uo.disableExperimentalFragmentVariables})(Ji||(Ji={})),Ji.default=Ji,em(globalThis.__DEV__!==!1?"log":"silent");const O1=Object.freeze(Object.defineProperty({__proto__:null,ApolloCache:ff,ApolloClient:Cf,ApolloError:yn,ApolloLink:Kr,get Cache(){return hf},DocumentTransform:mu,HttpLink:Oy,InMemoryCache:Of,MissingFieldError:df,get NetworkStatus(){return It},Observable:Rt,ObservableQuery:Iu,checkFetcher:_y,concat:AO,createHttpLink:uf,createSignalIfSupported:QO,defaultDataIdFromObject:pf,defaultPrinter:af,disableExperimentalFragmentVariables:yg,disableFragmentWarnings:pg,empty:EO,enableExperimentalFragmentVariables:mg,execute:Eu,fallbackHttpConfig:wy,from:OO,fromError:xu,fromPromise:bO,get gql(){return Ji},isApolloError:sf,isNetworkRequestSettled:m1,isReference:Nt,makeReference:Bi,makeVar:Vy,mergeOptions:Hi,parseAndCheckHttpResponse:by,resetCaches:dg,rewriteURIForGET:Sy,selectHttpOptionsAndBody:HO,selectHttpOptionsAndBodyInternal:of,selectURI:xy,serializeFetchParameter:Ou,setLogVerbosity:em,split:TO,throwServerError:rf,toPromise:vO},Symbol.toStringTag,{value:"Module"}));var gg={exports:{}};(function(r){r.exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=void 0,r.exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=void 0,r.exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=void 0,Object.assign(r.exports,le)})(gg);var lt=gg.exports;const vg=eS({__proto__:null,default:Jp(lt)},[lt]);var bg=ou?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function Nf(){qe("createContext"in vg,46);var r=lt.createContext[bg];return r||(Object.defineProperty(lt.createContext,bg,{value:r=lt.createContext({}),enumerable:!1,writable:!1,configurable:!0}),r.displayName="ApolloContext"),r}var T1=function(r){var e=r.client,t=r.children,n=Nf(),i=lt.useContext(n),a=lt.useMemo(function(){return L(L({},i),{client:e||i.client})},[i,e]);return qe(a.client,47),lt.createElement(n.Provider,{value:a},t)};function wg(r){var e=lt.useContext(Nf()),t=r||e.client;return qe(!!t,50),t}var _g=!1,A1="useSyncExternalStore",k1=vg[A1],xg=k1||function(r,e,t){var n=e();globalThis.__DEV__!==!1&&!_g&&n!==e()&&(_g=!0,globalThis.__DEV__!==!1&&qe.error(60));var i=lt.useState({inst:{value:n,getSnapshot:e}}),a=i[0].inst,u=i[1];return Em?lt.useLayoutEffect(function(){Object.assign(a,{value:n,getSnapshot:e}),Rf(a)&&u({inst:a})},[r,n,e]):Object.assign(a,{value:n,getSnapshot:e}),lt.useEffect(function(){return Rf(a)&&u({inst:a}),r(function(){Rf(a)&&u({inst:a})})},[r]),n};function Rf(r){var e=r.value,t=r.getSnapshot;try{return e!==t()}catch{return!0}}var ui;(function(r){r[r.Query=0]="Query",r[r.Mutation=1]="Mutation",r[r.Subscription=2]="Subscription"})(ui||(ui={}));var Es;function Sg(r){var e;switch(r){case ui.Query:e="Query";break;case ui.Mutation:e="Mutation";break;case ui.Subscription:e="Subscription";break}return e}function Eg(r){Es||(Es=new cu(Yn.parser||1e3));var e=Es.get(r);if(e)return e;var t,n,i;qe(!!r&&!!r.kind,62,r);for(var a=[],u=[],c=[],f=[],h=0,d=r.definitions;h<d.length;h++){var y=d[h];if(y.kind==="FragmentDefinition"){a.push(y);continue}if(y.kind==="OperationDefinition")switch(y.operation){case"query":u.push(y);break;case"mutation":c.push(y);break;case"subscription":f.push(y);break}}qe(!a.length||u.length||c.length||f.length,63),qe(u.length+c.length+f.length<=1,64,r,u.length,f.length,c.length),n=u.length?ui.Query:ui.Mutation,!u.length&&!c.length&&(n=ui.Subscription);var g=u.length?u:c.length?c:f;qe(g.length===1,65,r,g.length);var m=g[0];t=m.variableDefinitions||[],m.name&&m.name.kind==="Name"?i=m.name.value:i="data";var b={name:i,type:n,variables:t};return Es.set(r,b),b}Eg.resetCache=function(){Es=void 0},globalThis.__DEV__!==!1&&Il("parser",function(){return Es?Es.size:0});function Og(r,e){var t=Eg(r),n=Sg(e),i=Sg(t.type);qe(t.type===e,66,n,n,i)}function I1(r,e){var t=lt.useRef();return(!t.current||!Ft(t.current.deps,e))&&(t.current={value:r(),deps:e}),t.current.value}var Mf=Ol?lt.useLayoutEffect:lt.useEffect,C1=Object.prototype.hasOwnProperty;function Tg(){}var Nu=Symbol();function P1(r,e,t,n,i){function a(y){var g;Og(e,ui.Query);var m={client:r,query:e,observable:n&&n.getSSRObservable(i())||r.watchQuery(Df(void 0,r,t,i())),resultData:{previousData:(g=y==null?void 0:y.resultData.current)===null||g===void 0?void 0:g.data}};return m}var u=lt.useState(a),c=u[0],f=u[1];function h(y){var g,m;Object.assign(c.observable,(g={},g[Nu]=y,g));var b=c.resultData;f(L(L({},c),{query:y.query,resultData:Object.assign(b,{previousData:((m=b.current)===null||m===void 0?void 0:m.data)||b.previousData,current:void 0})}))}if(r!==c.client||e!==c.query){var d=a(c);return f(d),[d,h]}return[c,h]}function N1(r,e){var t=wg(e.client),n=lt.useContext(Nf()).renderPromises,i=!!n,a=t.disableNetworkFetches,u=e.ssr!==!1&&!e.skip,c=e.partialRefetch,f=Ag(t,r,e,i),h=P1(t,r,e,n,f),d=h[0],y=d.observable,g=d.resultData,m=h[1],b=f(y);D1(g,y,t,e,b);var I=lt.useMemo(function(){return q1(y)},[y]);M1(y,n,u);var x=R1(g,y,t,e,b,a,c,i,{onCompleted:e.onCompleted||Tg,onError:e.onError||Tg});return{result:x,obsQueryFields:I,observable:y,resultData:g,client:t,onQueryExecuted:m}}function R1(r,e,t,n,i,a,u,c,f){var h=lt.useRef(f);lt.useEffect(function(){h.current=f});var d=(c||a)&&n.ssr===!1&&!n.skip?Cg:n.skip||i.fetchPolicy==="standby"?Pg:void 0,y=r.previousData,g=lt.useMemo(function(){return d&&Ru(d,y,e,t)},[t,e,d,y]);return xg(lt.useCallback(function(m){if(c)return function(){};var b=function(){var _=r.current,A=e.getCurrentResult();_&&_.loading===A.loading&&_.networkStatus===A.networkStatus&&Ft(_.data,A.data)||Ff(A,r,e,t,u,m,h.current)},I=function(_){if(x.current.unsubscribe(),x.current=e.resubscribeAfterError(b,I),!C1.call(_,"graphQLErrors"))throw _;var A=r.current;(!A||A&&A.loading||!Ft(_,A.error))&&Ff({data:A&&A.data,error:_,loading:!1,networkStatus:It.error},r,e,t,u,m,h.current)},x={current:e.subscribe(b,I)};return function(){setTimeout(function(){return x.current.unsubscribe()})}},[a,c,e,r,u,t]),function(){return g||kg(r,e,h.current,u,t)},function(){return g||kg(r,e,h.current,u,t)})}function M1(r,e,t){e&&t&&(e.registerSSRObservable(r),r.getCurrentResult().loading&&e.addObservableQueryPromise(r))}function D1(r,e,t,n,i){var a;e[Nu]&&!Ft(e[Nu],i)&&(e.reobserve(Df(e,t,n,i)),r.previousData=((a=r.current)===null||a===void 0?void 0:a.data)||r.previousData,r.current=void 0),e[Nu]=i}function Ag(r,e,t,n){t===void 0&&(t={});var i=t.skip;t.ssr,t.onCompleted,t.onError;var a=t.defaultOptions,u=on(t,["skip","ssr","onCompleted","onError","defaultOptions"]);return function(c){var f=Object.assign(u,{query:e});return n&&(f.fetchPolicy==="network-only"||f.fetchPolicy==="cache-and-network")&&(f.fetchPolicy="cache-first"),f.variables||(f.variables={}),i?(f.initialFetchPolicy=f.initialFetchPolicy||f.fetchPolicy||Lf(a,r.defaultOptions),f.fetchPolicy="standby"):f.fetchPolicy||(f.fetchPolicy=(c==null?void 0:c.options.initialFetchPolicy)||Lf(a,r.defaultOptions)),f}}function Df(r,e,t,n){var i=[],a=e.defaultOptions.watchQuery;return a&&i.push(a),t.defaultOptions&&i.push(t.defaultOptions),i.push(zi(r&&r.options,n)),i.reduce(Hi)}function Ff(r,e,t,n,i,a,u){var c=e.current;c&&c.data&&(e.previousData=c.data),!r.error&&mn(r.errors)&&(r.error=new yn({graphQLErrors:r.errors})),e.current=Ru(L1(r,t,i),e.previousData,t,n),a(),F1(r,c==null?void 0:c.networkStatus,u)}function F1(r,e,t){if(!r.loading){var n=Ig(r);Promise.resolve().then(function(){n?t.onError(n):r.data&&e!==r.networkStatus&&r.networkStatus===It.ready&&t.onCompleted(r.data)}).catch(function(i){globalThis.__DEV__!==!1&&qe.warn(i)})}}function kg(r,e,t,n,i){return r.current||Ff(e.getCurrentResult(),r,e,i,n,function(){},t),r.current}function Lf(r,e){var t;return(r==null?void 0:r.fetchPolicy)||((t=e==null?void 0:e.watchQuery)===null||t===void 0?void 0:t.fetchPolicy)||"cache-first"}function Ig(r){return mn(r.errors)?new yn({graphQLErrors:r.errors}):r.error}function Ru(r,e,t,n){var i=r.data;r.partial;var a=on(r,["data","partial"]),u=L(L({data:i},a),{client:n,observable:t,variables:t.variables,called:r!==Cg&&r!==Pg,previousData:e});return u}function L1(r,e,t){return r.partial&&t&&!r.loading&&(!r.data||Object.keys(r.data).length===0)&&e.options.fetchPolicy!=="cache-only"?(e.refetch(),L(L({},r),{loading:!0,networkStatus:It.refetch})):r}var Cg=Js({loading:!0,data:void 0,error:void 0,networkStatus:It.loading}),Pg=Js({loading:!1,data:void 0,error:void 0,networkStatus:It.ready});function q1(r){return{refetch:r.refetch.bind(r),reobserve:r.reobserve.bind(r),fetchMore:r.fetchMore.bind(r),updateQuery:r.updateQuery.bind(r),startPolling:r.startPolling.bind(r),stopPolling:r.stopPolling.bind(r),subscribeToMore:r.subscribeToMore.bind(r)}}var j1=["refetch","reobserve","fetchMore","updateQuery","startPolling","stopPolling","subscribeToMore"];function U1(r,e){var t,n=lt.useRef(),i=lt.useRef(),a=lt.useRef(),u=Hi(e,n.current||{}),c=(t=u==null?void 0:u.query)!==null&&t!==void 0?t:r;i.current=e,a.current=c;var f=L(L({},u),{skip:!n.current}),h=N1(c,f),d=h.obsQueryFields,y=h.result,g=h.client,m=h.resultData,b=h.observable,I=h.onQueryExecuted,x=b.options.initialFetchPolicy||Lf(f.defaultOptions,g.defaultOptions),_=lt.useReducer(function(ee){return ee+1},0)[1],A=lt.useMemo(function(){for(var ee={},fe=function(Ce){var Pe=d[Ce];ee[Ce]=function(){return n.current||(n.current=Object.create(null),_()),Pe.apply(this,arguments)}},de=0,Ie=j1;de<Ie.length;de++){var pe=Ie[de];fe(pe)}return ee},[_,d]),P=!!n.current,M=lt.useMemo(function(){return L(L(L({},y),A),{called:P})},[y,A,P]),$=lt.useCallback(function(ee){n.current=ee?L(L({},ee),{fetchPolicy:ee.fetchPolicy||x}):{fetchPolicy:x};var fe=Hi(i.current,L({query:a.current},n.current)),de=$1(m,b,g,c,L(L({},fe),{skip:!1}),I).then(function(Ie){return Object.assign(Ie,A)});return de.catch(function(){}),de},[g,c,A,x,b,m,I]),j=lt.useRef($);Mf(function(){j.current=$});var K=lt.useCallback(function(){for(var ee=[],fe=0;fe<arguments.length;fe++)ee[fe]=arguments[fe];return j.current.apply(j,ee)},[]);return[K,M]}function $1(r,e,t,n,i,a){var u=i.query||n,c=Ag(t,u,i,!1)(e),f=e.reobserveAsConcast(Df(e,t,i,c));return a(c),new Promise(function(h){var d;f.subscribe({next:function(y){d=y},error:function(){h(Ru(e.getCurrentResult(),r.previousData,e,t))},complete:function(){h(Ru(d,r.previousData,e,t))}})})}function B1(r,e){e===void 0&&(e=Object.create(null));var t=lt.useRef(!1),n=wg(e.client);Og(r,ui.Subscription),t.current||(t.current=!0,e.onSubscriptionData&&globalThis.__DEV__!==!1&&qe.warn(e.onData?53:54),e.onSubscriptionComplete&&globalThis.__DEV__!==!1&&qe.warn(e.onComplete?55:56));var i=e.skip,a=e.fetchPolicy,u=e.errorPolicy,c=e.shouldResubscribe,f=e.context,h=e.extensions,d=e.ignoreResults,y=I1(function(){return e.variables},[e.variables]),g=function(){return V1(n,r,y,a,u,f,h)},m=lt.useState(e.skip?null:g),b=m[0],I=m[1],x=lt.useRef(g);Mf(function(){x.current=g}),i?b&&I(b=null):(!b||(n!==b.__.client||r!==b.__.query||a!==b.__.fetchPolicy||u!==b.__.errorPolicy||!Ft(y,b.__.variables))&&(typeof c=="function"?!!c(e):c)!==!1)&&I(b=g());var _=lt.useRef(e);lt.useEffect(function(){_.current=e});var A=!i&&!d,P=lt.useMemo(function(){return{loading:A,error:void 0,data:void 0,variables:y}},[A,y]),M=lt.useRef(d);Mf(function(){M.current=d});var $=xg(lt.useCallback(function(K){if(!b)return function(){};var ee=!1,fe=b.__.variables,de=b.__.client,Ie=b.subscribe({next:function(pe){var Ce,Pe;if(!ee){var ge={loading:!1,data:pe.data,error:Ig(pe),variables:fe};b.__.setResult(ge),M.current||K(),ge.error?(Pe=(Ce=_.current).onError)===null||Pe===void 0||Pe.call(Ce,ge.error):_.current.onData?_.current.onData({client:de,data:ge}):_.current.onSubscriptionData&&_.current.onSubscriptionData({client:de,subscriptionData:ge})}},error:function(pe){var Ce,Pe;pe=pe instanceof yn?pe:new yn({protocolErrors:[pe]}),ee||(b.__.setResult({loading:!1,data:void 0,error:pe,variables:fe}),M.current||K(),(Pe=(Ce=_.current).onError)===null||Pe===void 0||Pe.call(Ce,pe))},complete:function(){ee||(_.current.onComplete?_.current.onComplete():_.current.onSubscriptionComplete&&_.current.onSubscriptionComplete())}});return function(){ee=!0,setTimeout(function(){Ie.unsubscribe()})}},[b]),function(){return b&&!i&&!d?b.__.result:P},function(){return P}),j=lt.useCallback(function(){qe(!_.current.skip,57),I(x.current())},[_,x]);return lt.useMemo(function(){return L(L({},$),{restart:j})},[$,j])}function V1(r,e,t,n,i,a,u){var c={query:e,variables:t,fetchPolicy:n,errorPolicy:i,context:a,extensions:u},f=L(L({},c),{client:r,result:{loading:!0,data:void 0,error:void 0,variables:t},setResult:function(d){f.result=d}}),h=null;return Object.assign(new Rt(function(d){h||(h=r.subscribe(c));var y=h.subscribe(d);return function(){return y.unsubscribe()}}),{__:f})}class Os extends Error{}class W1 extends Os{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class z1 extends Os{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class H1 extends Os{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class ea extends Os{}class Ng extends Os{constructor(e){super(`Invalid unit ${e}`)}}class Wr extends Os{}class Yi extends Os{constructor(){super("Zone is an abstract class")}}const Te="numeric",Kn="short",gn="long",Mu={year:Te,month:Te,day:Te},Rg={year:Te,month:Kn,day:Te},G1={year:Te,month:Kn,day:Te,weekday:Kn},Mg={year:Te,month:gn,day:Te},Dg={year:Te,month:gn,day:Te,weekday:gn},Fg={hour:Te,minute:Te},Lg={hour:Te,minute:Te,second:Te},qg={hour:Te,minute:Te,second:Te,timeZoneName:Kn},jg={hour:Te,minute:Te,second:Te,timeZoneName:gn},Ug={hour:Te,minute:Te,hourCycle:"h23"},$g={hour:Te,minute:Te,second:Te,hourCycle:"h23"},Bg={hour:Te,minute:Te,second:Te,hourCycle:"h23",timeZoneName:Kn},Vg={hour:Te,minute:Te,second:Te,hourCycle:"h23",timeZoneName:gn},Wg={year:Te,month:Te,day:Te,hour:Te,minute:Te},zg={year:Te,month:Te,day:Te,hour:Te,minute:Te,second:Te},Hg={year:Te,month:Kn,day:Te,hour:Te,minute:Te},Gg={year:Te,month:Kn,day:Te,hour:Te,minute:Te,second:Te},Q1={year:Te,month:Kn,day:Te,weekday:Kn,hour:Te,minute:Te},Qg={year:Te,month:gn,day:Te,hour:Te,minute:Te,timeZoneName:Kn},Jg={year:Te,month:gn,day:Te,hour:Te,minute:Te,second:Te,timeZoneName:Kn},Yg={year:Te,month:gn,day:Te,weekday:gn,hour:Te,minute:Te,timeZoneName:gn},Kg={year:Te,month:gn,day:Te,weekday:gn,hour:Te,minute:Te,second:Te,timeZoneName:gn};class co{get type(){throw new Yi}get name(){throw new Yi}get ianaName(){return this.name}get isUniversal(){throw new Yi}offsetName(e,t){throw new Yi}formatOffset(e,t){throw new Yi}offset(e){throw new Yi}equals(e){throw new Yi}get isValid(){throw new Yi}}let qf=null;class Du extends co{static get instance(){return qf===null&&(qf=new Du),qf}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return xv(e,t,n)}formatOffset(e,t){return po(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let Fu={};function J1(r){return Fu[r]||(Fu[r]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),Fu[r]}const Y1={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function K1(r,e){const t=r.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,i,a,u,c,f,h,d]=n;return[u,i,a,c,f,h,d]}function Z1(r,e){const t=r.formatToParts(e),n=[];for(let i=0;i<t.length;i++){const{type:a,value:u}=t[i],c=Y1[a];a==="era"?n[c]=u:it(c)||(n[c]=parseInt(u,10))}return n}let Lu={};class bi extends co{static create(e){return Lu[e]||(Lu[e]=new bi(e)),Lu[e]}static resetCache(){Lu={},Fu={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=bi.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return xv(e,t,n,this.name)}formatOffset(e,t){return po(this.offset(e),t)}offset(e){const t=new Date(e);if(isNaN(t))return NaN;const n=J1(this.name);let[i,a,u,c,f,h,d]=n.formatToParts?Z1(n,t):K1(n,t);c==="BC"&&(i=-Math.abs(i)+1);const g=Bu({year:i,month:a,day:u,hour:f===24?0:f,minute:h,second:d,millisecond:0});let m=+t;const b=m%1e3;return m-=b>=0?b:1e3+b,(g-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let Zg={};function X1(r,e={}){const t=JSON.stringify([r,e]);let n=Zg[t];return n||(n=new Intl.ListFormat(r,e),Zg[t]=n),n}let jf={};function Uf(r,e={}){const t=JSON.stringify([r,e]);let n=jf[t];return n||(n=new Intl.DateTimeFormat(r,e),jf[t]=n),n}let $f={};function eT(r,e={}){const t=JSON.stringify([r,e]);let n=$f[t];return n||(n=new Intl.NumberFormat(r,e),$f[t]=n),n}let Bf={};function tT(r,e={}){const{base:t,...n}=e,i=JSON.stringify([r,n]);let a=Bf[i];return a||(a=new Intl.RelativeTimeFormat(r,e),Bf[i]=a),a}let lo=null;function rT(){return lo||(lo=new Intl.DateTimeFormat().resolvedOptions().locale,lo)}let Xg={};function nT(r){let e=Xg[r];if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,Xg[r]=e}return e}function iT(r){const e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));const t=r.indexOf("-u-");if(t===-1)return[r];{let n,i;try{n=Uf(r).resolvedOptions(),i=r}catch{const f=r.substring(0,t);n=Uf(f).resolvedOptions(),i=f}const{numberingSystem:a,calendar:u}=n;return[i,a,u]}}function sT(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function aT(r){const e=[];for(let t=1;t<=12;t++){const n=st.utc(2009,t,1);e.push(r(n))}return e}function oT(r){const e=[];for(let t=1;t<=7;t++){const n=st.utc(2016,11,13+t);e.push(r(n))}return e}function qu(r,e,t,n){const i=r.listingMode();return i==="error"?null:i==="en"?t(e):n(e)}function uT(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||new Intl.DateTimeFormat(r.intl).resolvedOptions().numberingSystem==="latn"}class cT{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:i,floor:a,...u}=n;if(!t||Object.keys(u).length>0){const c={useGrouping:!1,...n};n.padTo>0&&(c.minimumIntegerDigits=n.padTo),this.inf=eT(e,c)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):Yf(e,3);return xr(t,this.padTo)}}}class lT{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const u=-1*(e.offset/60),c=u>=0?`Etc/GMT+${u}`:`Etc/GMT${u}`;e.offset!==0&&bi.create(c).valid?(i=c,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const a={...this.opts};a.timeZone=a.timeZone||i,this.dtf=Uf(t,a)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:n}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class fT{constructor(e,t,n){this.opts={style:"long",...n},!t&&vv()&&(this.rtf=tT(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):MT(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const hT={firstDay:1,minimalDays:4,weekend:[6,7]};class Lt{static fromOpts(e){return Lt.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,i,a=!1){const u=e||fr.defaultLocale,c=u||(a?"en-US":rT()),f=t||fr.defaultNumberingSystem,h=n||fr.defaultOutputCalendar,d=Qf(i)||fr.defaultWeekSettings;return new Lt(c,f,h,d,u)}static resetCache(){lo=null,jf={},$f={},Bf={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:i}={}){return Lt.create(e,t,n,i)}constructor(e,t,n,i,a){const[u,c,f]=iT(e);this.locale=u,this.numberingSystem=t||c||null,this.outputCalendar=n||f||null,this.weekSettings=i,this.intl=sT(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=a,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=uT(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:Lt.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Qf(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return qu(this,e,Ov,()=>{const n=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=aT(a=>this.extract(a,n,"month"))),this.monthsCache[i][e]})}weekdays(e,t=!1){return qu(this,e,kv,()=>{const n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=t?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=oT(a=>this.extract(a,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return qu(this,void 0,()=>Iv,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[st.utc(2016,11,13,9),st.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return qu(this,e,Cv,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[st.utc(-40,1,1),st.utc(2017,1,1)].map(n=>this.extract(n,t,"era"))),this.eraCache[e]})}extract(e,t,n){const i=this.dtFormatter(e,t),a=i.formatToParts(),u=a.find(c=>c.type.toLowerCase()===n);return u?u.value:null}numberFormatter(e={}){return new cT(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new lT(e,this.intl,t)}relFormatter(e={}){return new fT(this.intl,this.isEnglish(),e)}listFormatter(e={}){return X1(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:bv()?nT(this.locale):hT}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Vf=null;class Zr extends co{static get utcInstance(){return Vf===null&&(Vf=new Zr(0)),Vf}static instance(e){return e===0?Zr.utcInstance:new Zr(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Zr(Vu(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${po(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${po(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return po(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class dT extends co{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function Ki(r,e){if(it(r)||r===null)return e;if(r instanceof co)return r;if(bT(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Du.instance:t==="utc"||t==="gmt"?Zr.utcInstance:Zr.parseSpecifier(t)||bi.create(r)}else return Zi(r)?Zr.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new dT(r)}const Wf={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},ev={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},pT=Wf.hanidec.replace(/[\[|\]]/g,"").split("");function mT(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t<r.length;t++){const n=r.charCodeAt(t);if(r[t].search(Wf.hanidec)!==-1)e+=pT.indexOf(r[t]);else for(const i in ev){const[a,u]=ev[i];n>=a&&n<=u&&(e+=n-a)}}return parseInt(e,10)}else return e}let ta={};function yT(){ta={}}function Zn({numberingSystem:r},e=""){const t=r||"latn";return ta[t]||(ta[t]={}),ta[t][e]||(ta[t][e]=new RegExp(`${Wf[t]}${e}`)),ta[t][e]}let tv=()=>Date.now(),rv="system",nv=null,iv=null,sv=null,av=60,ov,uv=null;class fr{static get now(){return tv}static set now(e){tv=e}static set defaultZone(e){rv=e}static get defaultZone(){return Ki(rv,Du.instance)}static get defaultLocale(){return nv}static set defaultLocale(e){nv=e}static get defaultNumberingSystem(){return iv}static set defaultNumberingSystem(e){iv=e}static get defaultOutputCalendar(){return sv}static set defaultOutputCalendar(e){sv=e}static get defaultWeekSettings(){return uv}static set defaultWeekSettings(e){uv=Qf(e)}static get twoDigitCutoffYear(){return av}static set twoDigitCutoffYear(e){av=e%100}static get throwOnInvalid(){return ov}static set throwOnInvalid(e){ov=e}static resetCaches(){Lt.resetCache(),bi.resetCache(),st.resetCache(),yT()}}class Xn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const cv=[0,31,59,90,120,151,181,212,243,273,304,334],lv=[0,31,60,91,121,152,182,213,244,274,305,335];function Mn(r,e){return new Xn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function zf(r,e,t){const n=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const i=n.getUTCDay();return i===0?7:i}function fv(r,e,t){return t+(fo(r)?lv:cv)[e-1]}function hv(r,e){const t=fo(r)?lv:cv,n=t.findIndex(a=>a<e),i=e-t[n];return{month:n+1,day:i}}function Hf(r,e){return(r-e+7)%7+1}function ju(r,e=4,t=1){const{year:n,month:i,day:a}=r,u=fv(n,i,a),c=Hf(zf(n,i,a),t);let f=Math.floor((u-c+14-e)/7),h;return f<1?(h=n-1,f=ho(h,e,t)):f>ho(n,e,t)?(h=n+1,f=1):h=n,{weekYear:h,weekNumber:f,weekday:c,...zu(r)}}function dv(r,e=4,t=1){const{weekYear:n,weekNumber:i,weekday:a}=r,u=Hf(zf(n,1,e),t),c=na(n);let f=i*7+a-u-7+e,h;f<1?(h=n-1,f+=na(h)):f>c?(h=n+1,f-=na(n)):h=n;const{month:d,day:y}=hv(h,f);return{year:h,month:d,day:y,...zu(r)}}function Gf(r){const{year:e,month:t,day:n}=r,i=fv(e,t,n);return{year:e,ordinal:i,...zu(r)}}function pv(r){const{year:e,ordinal:t}=r,{month:n,day:i}=hv(e,t);return{year:e,month:n,day:i,...zu(r)}}function mv(r,e){if(!it(r.localWeekday)||!it(r.localWeekNumber)||!it(r.localWeekYear)){if(!it(r.weekday)||!it(r.weekNumber)||!it(r.weekYear))throw new ea("Cannot mix locale-based week fields with ISO-based week fields");return it(r.localWeekday)||(r.weekday=r.localWeekday),it(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),it(r.localWeekYear)||(r.weekYear=r.localWeekYear),delete r.localWeekday,delete r.localWeekNumber,delete r.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function gT(r,e=4,t=1){const n=Uu(r.weekYear),i=Dn(r.weekNumber,1,ho(r.weekYear,e,t)),a=Dn(r.weekday,1,7);return n?i?a?!1:Mn("weekday",r.weekday):Mn("week",r.weekNumber):Mn("weekYear",r.weekYear)}function vT(r){const e=Uu(r.year),t=Dn(r.ordinal,1,na(r.year));return e?t?!1:Mn("ordinal",r.ordinal):Mn("year",r.year)}function yv(r){const e=Uu(r.year),t=Dn(r.month,1,12),n=Dn(r.day,1,$u(r.year,r.month));return e?t?n?!1:Mn("day",r.day):Mn("month",r.month):Mn("year",r.year)}function gv(r){const{hour:e,minute:t,second:n,millisecond:i}=r,a=Dn(e,0,23)||e===24&&t===0&&n===0&&i===0,u=Dn(t,0,59),c=Dn(n,0,59),f=Dn(i,0,999);return a?u?c?f?!1:Mn("millisecond",i):Mn("second",n):Mn("minute",t):Mn("hour",e)}function it(r){return typeof r>"u"}function Zi(r){return typeof r=="number"}function Uu(r){return typeof r=="number"&&r%1===0}function bT(r){return typeof r=="string"}function wT(r){return Object.prototype.toString.call(r)==="[object Date]"}function vv(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function bv(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function _T(r){return Array.isArray(r)?r:[r]}function wv(r,e,t){if(r.length!==0)return r.reduce((n,i)=>{const a=[e(i),i];return n&&t(n[0],a[0])===n[0]?n:a},null)[1]}function xT(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function ra(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Qf(r){if(r==null)return null;if(typeof r!="object")throw new Wr("Week settings must be an object");if(!Dn(r.firstDay,1,7)||!Dn(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!Dn(e,1,7)))throw new Wr("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function Dn(r,e,t){return Uu(r)&&r>=e&&r<=t}function ST(r,e){return r-e*Math.floor(r/e)}function xr(r,e=2){const t=r<0;let n;return t?n="-"+(""+-r).padStart(e,"0"):n=(""+r).padStart(e,"0"),n}function Xi(r){if(!(it(r)||r===null||r===""))return parseInt(r,10)}function Ts(r){if(!(it(r)||r===null||r===""))return parseFloat(r)}function Jf(r){if(!(it(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function Yf(r,e,t=!1){const n=10**e;return(t?Math.trunc:Math.round)(r*n)/n}function fo(r){return r%4===0&&(r%100!==0||r%400===0)}function na(r){return fo(r)?366:365}function $u(r,e){const t=ST(e-1,12)+1,n=r+(e-t)/12;return t===2?fo(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Bu(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}function _v(r,e,t){return-Hf(zf(r,1,e),t)+e-1}function ho(r,e=4,t=1){const n=_v(r,e,t),i=_v(r+1,e,t);return(na(r)-n+i)/7}function Kf(r){return r>99?r:r>fr.twoDigitCutoffYear?1900+r:2e3+r}function xv(r,e,t,n=null){const i=new Date(r),a={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(a.timeZone=n);const u={timeZoneName:e,...a},c=new Intl.DateTimeFormat(t,u).formatToParts(i).find(f=>f.type.toLowerCase()==="timezonename");return c?c.value:null}function Vu(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);const n=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-n:n;return t*60+i}function Sv(r){const e=Number(r);if(typeof r=="boolean"||r===""||Number.isNaN(e))throw new Wr(`Invalid unit value ${r}`);return e}function Wu(r,e){const t={};for(const n in r)if(ra(r,n)){const i=r[n];if(i==null)continue;t[e(n)]=Sv(i)}return t}function po(r,e){const t=Math.trunc(Math.abs(r/60)),n=Math.trunc(Math.abs(r%60)),i=r>=0?"+":"-";switch(e){case"short":return`${i}${xr(t,2)}:${xr(n,2)}`;case"narrow":return`${i}${t}${n>0?`:${n}`:""}`;case"techie":return`${i}${xr(t,2)}${xr(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function zu(r){return xT(r,["hour","minute","second","millisecond"])}const ET=["January","February","March","April","May","June","July","August","September","October","November","December"],Ev=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],OT=["J","F","M","A","M","J","J","A","S","O","N","D"];function Ov(r){switch(r){case"narrow":return[...OT];case"short":return[...Ev];case"long":return[...ET];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Tv=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Av=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],TT=["M","T","W","T","F","S","S"];function kv(r){switch(r){case"narrow":return[...TT];case"short":return[...Av];case"long":return[...Tv];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Iv=["AM","PM"],AT=["Before Christ","Anno Domini"],kT=["BC","AD"],IT=["B","A"];function Cv(r){switch(r){case"narrow":return[...IT];case"short":return[...kT];case"long":return[...AT];default:return null}}function CT(r){return Iv[r.hour<12?0:1]}function PT(r,e){return kv(e)[r.weekday-1]}function NT(r,e){return Ov(e)[r.month-1]}function RT(r,e){return Cv(e)[r.year<0?0:1]}function MT(r,e,t="always",n=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},a=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&a){const y=r==="days";switch(e){case 1:return y?"tomorrow":`next ${i[r][0]}`;case-1:return y?"yesterday":`last ${i[r][0]}`;case 0:return y?"today":`this ${i[r][0]}`}}const u=Object.is(e,-0)||e<0,c=Math.abs(e),f=c===1,h=i[r],d=n?f?h[1]:h[2]||h[1]:f?i[r][0]:r;return u?`${c} ${d} ago`:`in ${c} ${d}`}function Pv(r,e){let t="";for(const n of r)n.literal?t+=n.val:t+=e(n.val);return t}const DT={D:Mu,DD:Rg,DDD:Mg,DDDD:Dg,t:Fg,tt:Lg,ttt:qg,tttt:jg,T:Ug,TT:$g,TTT:Bg,TTTT:Vg,f:Wg,ff:Hg,fff:Qg,ffff:Yg,F:zg,FF:Gg,FFF:Jg,FFFF:Kg};class zr{static create(e,t={}){return new zr(e,t)}static parseFormat(e){let t=null,n="",i=!1;const a=[];for(let u=0;u<e.length;u++){const c=e.charAt(u);c==="'"?(n.length>0&&a.push({literal:i||/^\s+$/.test(n),val:n}),t=null,n="",i=!i):i||c===t?n+=c:(n.length>0&&a.push({literal:/^\s+$/.test(n),val:n}),n=c,t=c)}return n.length>0&&a.push({literal:i||/^\s+$/.test(n),val:n}),a}static macroTokenToFormatOpts(e){return DT[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return xr(e,t);const n={...this.opts};return t>0&&(n.padTo=t),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){const n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",a=(m,b)=>this.loc.extract(e,m,b),u=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",c=()=>n?CT(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),f=(m,b)=>n?NT(e,m):a(b?{month:m}:{month:m,day:"numeric"},"month"),h=(m,b)=>n?PT(e,m):a(b?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),d=m=>{const b=zr.macroTokenToFormatOpts(m);return b?this.formatWithSystemDefault(e,b):m},y=m=>n?RT(e,m):a({era:m},"era"),g=m=>{switch(m){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return u({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return u({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return u({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return c();case"d":return i?a({day:"numeric"},"day"):this.num(e.day);case"dd":return i?a({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return h("short",!0);case"cccc":return h("long",!0);case"ccccc":return h("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return h("short",!1);case"EEEE":return h("long",!1);case"EEEEE":return h("narrow",!1);case"L":return i?a({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?a({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return f("short",!0);case"LLLL":return f("long",!0);case"LLLLL":return f("narrow",!0);case"M":return i?a({month:"numeric"},"month"):this.num(e.month);case"MM":return i?a({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return f("short",!1);case"MMMM":return f("long",!1);case"MMMMM":return f("narrow",!1);case"y":return i?a({year:"numeric"},"year"):this.num(e.year);case"yy":return i?a({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?a({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?a({year:"numeric"},"year"):this.num(e.year,6);case"G":return y("short");case"GG":return y("long");case"GGGGG":return y("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return d(m)}};return Pv(zr.parseFormat(t),g)}formatDurationFromString(e,t){const n=f=>{switch(f[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=f=>h=>{const d=n(h);return d?this.num(f.get(d),h.length):h},a=zr.parseFormat(t),u=a.reduce((f,{literal:h,val:d})=>h?f:f.concat(d),[]),c=e.shiftTo(...u.map(n).filter(f=>f));return Pv(a,i(c))}}const Nv=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function ia(...r){const e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function sa(...r){return e=>r.reduce(([t,n,i],a)=>{const[u,c,f]=a(e,i);return[{...t,...u},c||n,f]},[{},null,1]).slice(0,2)}function aa(r,...e){if(r==null)return[null,null];for(const[t,n]of e){const i=t.exec(r);if(i)return n(i)}return[null,null]}function Rv(...r){return(e,t)=>{const n={};let i;for(i=0;i<r.length;i++)n[r[i]]=Xi(e[t+i]);return[n,null,t+i]}}const Mv=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,FT=`(?:${Mv.source}?(?:\\[(${Nv.source})\\])?)?`,Zf=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Dv=RegExp(`${Zf.source}${FT}`),Xf=RegExp(`(?:T${Dv.source})?`),LT=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,qT=/(\d{4})-?W(\d\d)(?:-?(\d))?/,jT=/(\d{4})-?(\d{3})/,UT=Rv("weekYear","weekNumber","weekDay"),$T=Rv("year","ordinal"),BT=/(\d{4})-(\d\d)-(\d\d)/,Fv=RegExp(`${Zf.source} ?(?:${Mv.source}|(${Nv.source}))?`),VT=RegExp(`(?: ${Fv.source})?`);function oa(r,e,t){const n=r[e];return it(n)?t:Xi(n)}function WT(r,e){return[{year:oa(r,e),month:oa(r,e+1,1),day:oa(r,e+2,1)},null,e+3]}function ua(r,e){return[{hours:oa(r,e,0),minutes:oa(r,e+1,0),seconds:oa(r,e+2,0),milliseconds:Jf(r[e+3])},null,e+4]}function mo(r,e){const t=!r[e]&&!r[e+1],n=Vu(r[e+1],r[e+2]),i=t?null:Zr.instance(n);return[{},i,e+3]}function yo(r,e){const t=r[e]?bi.create(r[e]):null;return[{},t,e+1]}const zT=RegExp(`^T?${Zf.source}$`),HT=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function GT(r){const[e,t,n,i,a,u,c,f,h]=r,d=e[0]==="-",y=f&&f[0]==="-",g=(m,b=!1)=>m!==void 0&&(b||m&&d)?-m:m;return[{years:g(Ts(t)),months:g(Ts(n)),weeks:g(Ts(i)),days:g(Ts(a)),hours:g(Ts(u)),minutes:g(Ts(c)),seconds:g(Ts(f),f==="-0"),milliseconds:g(Jf(h),y)}]}const QT={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function eh(r,e,t,n,i,a,u){const c={year:e.length===2?Kf(Xi(e)):Xi(e),month:Ev.indexOf(t)+1,day:Xi(n),hour:Xi(i),minute:Xi(a)};return u&&(c.second=Xi(u)),r&&(c.weekday=r.length>3?Tv.indexOf(r)+1:Av.indexOf(r)+1),c}const JT=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function YT(r){const[,e,t,n,i,a,u,c,f,h,d,y]=r,g=eh(e,i,n,t,a,u,c);let m;return f?m=QT[f]:h?m=0:m=Vu(d,y),[g,new Zr(m)]}function KT(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const ZT=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,XT=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,eA=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Lv(r){const[,e,t,n,i,a,u,c]=r;return[eh(e,i,n,t,a,u,c),Zr.utcInstance]}function tA(r){const[,e,t,n,i,a,u,c]=r;return[eh(e,c,t,n,i,a,u),Zr.utcInstance]}const rA=ia(LT,Xf),nA=ia(qT,Xf),iA=ia(jT,Xf),sA=ia(Dv),qv=sa(WT,ua,mo,yo),aA=sa(UT,ua,mo,yo),oA=sa($T,ua,mo,yo),uA=sa(ua,mo,yo);function cA(r){return aa(r,[rA,qv],[nA,aA],[iA,oA],[sA,uA])}function lA(r){return aa(KT(r),[JT,YT])}function fA(r){return aa(r,[ZT,Lv],[XT,Lv],[eA,tA])}function hA(r){return aa(r,[HT,GT])}const dA=sa(ua);function pA(r){return aa(r,[zT,dA])}const mA=ia(BT,VT),yA=ia(Fv),gA=sa(ua,mo,yo);function vA(r){return aa(r,[mA,qv],[yA,gA])}const jv="Invalid Duration",Uv={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},bA={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...Uv},Fn=146097/400,ca=146097/4800,wA={years:{quarters:4,months:12,weeks:Fn/7,days:Fn,hours:Fn*24,minutes:Fn*24*60,seconds:Fn*24*60*60,milliseconds:Fn*24*60*60*1e3},quarters:{months:3,weeks:Fn/28,days:Fn/4,hours:Fn*24/4,minutes:Fn*24*60/4,seconds:Fn*24*60*60/4,milliseconds:Fn*24*60*60*1e3/4},months:{weeks:ca/7,days:ca,hours:ca*24,minutes:ca*24*60,seconds:ca*24*60*60,milliseconds:ca*24*60*60*1e3},...Uv},As=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],_A=As.slice(0).reverse();function es(r,e,t=!1){const n={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new Ct(n)}function $v(r,e){let t=e.milliseconds??0;for(const n of _A.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function Bv(r,e){const t=$v(r,e)<0?-1:1;As.reduceRight((n,i)=>{if(it(e[i]))return n;if(n){const a=e[n]*t,u=r[i][n],c=Math.floor(a/u);e[i]+=c*t,e[n]-=c*u*t}return i},null),As.reduce((n,i)=>{if(it(e[i]))return n;if(n){const a=e[n]%1;e[n]-=a,e[i]+=a*r[n][i]}return i},null)}function xA(r){const e={};for(const[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}class Ct{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let n=t?wA:bA;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Lt.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return Ct.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new Wr(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new Ct({values:Wu(e,Ct.normalizeUnit),loc:Lt.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(Zi(e))return Ct.fromMillis(e);if(Ct.isDuration(e))return e;if(typeof e=="object")return Ct.fromObject(e);throw new Wr(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=hA(e);return n?Ct.fromObject(n,t):Ct.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=pA(e);return n?Ct.fromObject(n,t):Ct.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Wr("need to specify a reason the Duration is invalid");const n=e instanceof Xn?e:new Xn(e,t);if(fr.throwOnInvalid)throw new H1(n);return new Ct({invalid:n})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Ng(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?zr.create(this.loc,n).formatDurationFromString(this,e):jv}toHuman(e={}){if(!this.isValid)return jv;const t=As.map(n=>{const i=this.values[n];return it(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Yf(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},st.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?$v(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=Ct.fromDurationLike(e),n={};for(const i of As)(ra(t.values,i)||ra(this.values,i))&&(n[i]=t.get(i)+this.get(i));return es(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=Ct.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const n of Object.keys(this.values))t[n]=Sv(e(this.values[n],n));return es(this,{values:t},!0)}get(e){return this[Ct.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Wu(e,Ct.normalizeUnit)};return es(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:i}={}){const u={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:i,conversionAccuracy:n};return es(this,u)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Bv(this.matrix,e),es(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=xA(this.normalize().shiftToAll().toObject());return es(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(u=>Ct.normalizeUnit(u));const t={},n={},i=this.toObject();let a;for(const u of As)if(e.indexOf(u)>=0){a=u;let c=0;for(const h in n)c+=this.matrix[h][u]*n[h],n[h]=0;Zi(i[u])&&(c+=i[u]);const f=Math.trunc(c);t[u]=f,n[u]=(c*1e3-f*1e3)/1e3}else Zi(i[u])&&(n[u]=i[u]);for(const u in n)n[u]!==0&&(t[a]+=u===a?n[u]:n[u]/this.matrix[a][u]);return Bv(this.matrix,t),es(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return es(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(const n of As)if(!t(this.values[n],e.values[n]))return!1;return!0}}const la="Invalid Interval";function SA(r,e){return!r||!r.isValid?hr.invalid("missing or invalid start"):!e||!e.isValid?hr.invalid("missing or invalid end"):e<r?hr.invalid("end before start",`The end of an interval must be after its start, but you had start=${r.toISO()} and end=${e.toISO()}`):null}class hr{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new Wr("need to specify a reason the Interval is invalid");const n=e instanceof Xn?e:new Xn(e,t);if(fr.throwOnInvalid)throw new z1(n);return new hr({invalid:n})}static fromDateTimes(e,t){const n=vo(e),i=vo(t),a=SA(n,i);return a??new hr({start:n,end:i})}static after(e,t){const n=Ct.fromDurationLike(t),i=vo(e);return hr.fromDateTimes(i,i.plus(n))}static before(e,t){const n=Ct.fromDurationLike(t),i=vo(e);return hr.fromDateTimes(i.minus(n),i)}static fromISO(e,t){const[n,i]=(e||"").split("/",2);if(n&&i){let a,u;try{a=st.fromISO(n,t),u=a.isValid}catch{u=!1}let c,f;try{c=st.fromISO(i,t),f=c.isValid}catch{f=!1}if(u&&f)return hr.fromDateTimes(a,c);if(u){const h=Ct.fromISO(i,t);if(h.isValid)return hr.after(a,h)}else if(f){const h=Ct.fromISO(n,t);if(h.isValid)return hr.before(c,h)}}return hr.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const n=this.start.startOf(e,t);let i;return t!=null&&t.useLocaleWeeks?i=this.end.reconfigure({locale:n.locale}):i=this.end,i=i.startOf(e,t),Math.floor(i.diff(n,e).get(e))+(i.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?hr.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(vo).filter(u=>this.contains(u)).sort((u,c)=>u.toMillis()-c.toMillis()),n=[];let{s:i}=this,a=0;for(;i<this.e;){const u=t[a]||this.e,c=+u>+this.e?this.e:u;n.push(hr.fromDateTimes(i,c)),i=c,a+=1}return n}splitBy(e){const t=Ct.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:n}=this,i=1,a;const u=[];for(;n<this.e;){const c=this.start.plus(t.mapUnits(f=>f*i));a=+c>+this.e?this.e:c,u.push(hr.fromDateTimes(n,a)),n=a,i+=1}return u}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return t>=n?null:hr.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return hr.fromDateTimes(t,n)}static merge(e){const[t,n]=e.sort((i,a)=>i.s-a.s).reduce(([i,a],u)=>a?a.overlaps(u)||a.abutsStart(u)?[i,a.union(u)]:[i.concat([a]),u]:[i,u],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0;const i=[],a=e.map(f=>[{time:f.s,type:"s"},{time:f.e,type:"e"}]),u=Array.prototype.concat(...a),c=u.sort((f,h)=>f.time-h.time);for(const f of c)n+=f.type==="s"?1:-1,n===1?t=f.time:(t&&+t!=+f.time&&i.push(hr.fromDateTimes(t,f.time)),t=null);return hr.merge(i)}difference(...e){return hr.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:la}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Mu,t={}){return this.isValid?zr.create(this.s.loc.clone(t),e).formatInterval(this):la}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:la}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:la}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:la}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:la}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Ct.invalid(this.invalidReason)}mapEndpoints(e){return hr.fromDateTimes(e(this.s),e(this.e))}}class Hu{static hasDST(e=fr.defaultZone){const t=st.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return bi.isValidZone(e)}static normalizeZone(e){return Ki(e,fr.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Lt.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Lt.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Lt.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||Lt.create(t,n,a)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||Lt.create(t,n,a)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||Lt.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||Lt.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Lt.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Lt.create(t,null,"gregory").eras(e)}static features(){return{relative:vv(),localeWeek:bv()}}}function Vv(r,e){const t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(Ct.fromMillis(n).as("days"))}function EA(r,e,t){const n=[["years",(f,h)=>h.year-f.year],["quarters",(f,h)=>h.quarter-f.quarter+(h.year-f.year)*4],["months",(f,h)=>h.month-f.month+(h.year-f.year)*12],["weeks",(f,h)=>{const d=Vv(f,h);return(d-d%7)/7}],["days",Vv]],i={},a=r;let u,c;for(const[f,h]of n)t.indexOf(f)>=0&&(u=f,i[f]=h(r,e),c=a.plus(i),c>e?(i[f]--,r=a.plus(i),r>e&&(c=r,i[f]--,r=a.plus(i))):r=c);return[r,i,c,u]}function OA(r,e,t,n){let[i,a,u,c]=EA(r,e,t);const f=e-i,h=t.filter(y=>["hours","minutes","seconds","milliseconds"].indexOf(y)>=0);h.length===0&&(u<e&&(u=i.plus({[c]:1})),u!==i&&(a[c]=(a[c]||0)+f/(u-i)));const d=Ct.fromObject(a,n);return h.length>0?Ct.fromMillis(f,n).shiftTo(...h).plus(d):d}const TA="missing Intl.DateTimeFormat.formatToParts support";function Mt(r,e=t=>t){return{regex:r,deser:([t])=>e(mT(t))}}const Wv="[ ]",zv=new RegExp(Wv,"g");function AA(r){return r.replace(/\./g,"\\.?").replace(zv,Wv)}function Hv(r){return r.replace(/\./g,"").replace(zv," ").toLowerCase()}function ei(r,e){return r===null?null:{regex:RegExp(r.map(AA).join("|")),deser:([t])=>r.findIndex(n=>Hv(t)===Hv(n))+e}}function Gv(r,e){return{regex:r,deser:([,t,n])=>Vu(t,n),groups:e}}function Gu(r){return{regex:r,deser:([e])=>e}}function kA(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function IA(r,e){const t=Zn(e),n=Zn(e,"{2}"),i=Zn(e,"{3}"),a=Zn(e,"{4}"),u=Zn(e,"{6}"),c=Zn(e,"{1,2}"),f=Zn(e,"{1,3}"),h=Zn(e,"{1,6}"),d=Zn(e,"{1,9}"),y=Zn(e,"{2,4}"),g=Zn(e,"{4,6}"),m=x=>({regex:RegExp(kA(x.val)),deser:([_])=>_,literal:!0}),I=(x=>{if(r.literal)return m(x);switch(x.val){case"G":return ei(e.eras("short"),0);case"GG":return ei(e.eras("long"),0);case"y":return Mt(h);case"yy":return Mt(y,Kf);case"yyyy":return Mt(a);case"yyyyy":return Mt(g);case"yyyyyy":return Mt(u);case"M":return Mt(c);case"MM":return Mt(n);case"MMM":return ei(e.months("short",!0),1);case"MMMM":return ei(e.months("long",!0),1);case"L":return Mt(c);case"LL":return Mt(n);case"LLL":return ei(e.months("short",!1),1);case"LLLL":return ei(e.months("long",!1),1);case"d":return Mt(c);case"dd":return Mt(n);case"o":return Mt(f);case"ooo":return Mt(i);case"HH":return Mt(n);case"H":return Mt(c);case"hh":return Mt(n);case"h":return Mt(c);case"mm":return Mt(n);case"m":return Mt(c);case"q":return Mt(c);case"qq":return Mt(n);case"s":return Mt(c);case"ss":return Mt(n);case"S":return Mt(f);case"SSS":return Mt(i);case"u":return Gu(d);case"uu":return Gu(c);case"uuu":return Mt(t);case"a":return ei(e.meridiems(),0);case"kkkk":return Mt(a);case"kk":return Mt(y,Kf);case"W":return Mt(c);case"WW":return Mt(n);case"E":case"c":return Mt(t);case"EEE":return ei(e.weekdays("short",!1),1);case"EEEE":return ei(e.weekdays("long",!1),1);case"ccc":return ei(e.weekdays("short",!0),1);case"cccc":return ei(e.weekdays("long",!0),1);case"Z":case"ZZ":return Gv(new RegExp(`([+-]${c.source})(?::(${n.source}))?`),2);case"ZZZ":return Gv(new RegExp(`([+-]${c.source})(${n.source})?`),2);case"z":return Gu(/[a-z_+-/]{1,256}?/i);case" ":return Gu(/[^\S\n\r]/);default:return m(x)}})(r)||{invalidReason:TA};return I.token=r,I}const CA={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function PA(r,e,t){const{type:n,value:i}=r;if(n==="literal"){const f=/^\s+$/.test(i);return{literal:!f,val:f?" ":i}}const a=e[n];let u=n;n==="hour"&&(e.hour12!=null?u=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?u="hour12":u="hour24":u=t.hour12?"hour12":"hour24");let c=CA[u];if(typeof c=="object"&&(c=c[a]),c)return{literal:!1,val:c}}function NA(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function RA(r,e,t){const n=r.match(e);if(n){const i={};let a=1;for(const u in t)if(ra(t,u)){const c=t[u],f=c.groups?c.groups+1:1;!c.literal&&c.token&&(i[c.token.val[0]]=c.deser(n.slice(a,a+f))),a+=f}return[n,i]}else return[n,{}]}function MA(r){const e=a=>{switch(a){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,n;return it(r.z)||(t=bi.create(r.z)),it(r.Z)||(t||(t=new Zr(r.Z)),n=r.Z),it(r.q)||(r.M=(r.q-1)*3+1),it(r.h)||(r.h<12&&r.a===1?r.h+=12:r.h===12&&r.a===0&&(r.h=0)),r.G===0&&r.y&&(r.y=-r.y),it(r.u)||(r.S=Jf(r.u)),[Object.keys(r).reduce((a,u)=>{const c=e(u);return c&&(a[c]=r[u]),a},{}),t,n]}let th=null;function DA(){return th||(th=st.fromMillis(1555555555555)),th}function FA(r,e){if(r.literal)return r;const t=zr.macroTokenToFormatOpts(r.val),n=Kv(t,e);return n==null||n.includes(void 0)?r:n}function Qv(r,e){return Array.prototype.concat(...r.map(t=>FA(t,e)))}class Jv{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Qv(zr.parseFormat(t),e),this.units=this.tokens.map(n=>IA(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){const[n,i]=NA(this.units);this.regex=RegExp(n,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){const[t,n]=RA(e,this.regex,this.handlers),[i,a,u]=n?MA(n):[null,null,void 0];if(ra(n,"a")&&ra(n,"H"))throw new ea("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:i,zone:a,specificOffset:u}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function Yv(r,e,t){return new Jv(r,t).explainFromTokens(e)}function LA(r,e,t){const{result:n,zone:i,specificOffset:a,invalidReason:u}=Yv(r,e,t);return[n,i,a,u]}function Kv(r,e){if(!r)return null;const n=zr.create(e,r).dtFormatter(DA()),i=n.formatToParts(),a=n.resolvedOptions();return i.map(u=>PA(u,r,a))}const rh="Invalid DateTime",Zv=864e13;function go(r){return new Xn("unsupported zone",`the zone "${r.name}" is not supported`)}function nh(r){return r.weekData===null&&(r.weekData=ju(r.c)),r.weekData}function ih(r){return r.localWeekData===null&&(r.localWeekData=ju(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function ks(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new st({...t,...e,old:t})}function Xv(r,e,t){let n=r-e*60*1e3;const i=t.offset(n);if(e===i)return[n,e];n-=(i-e)*60*1e3;const a=t.offset(n);return i===a?[n,i]:[r-Math.min(i,a)*60*1e3,Math.max(i,a)]}function Qu(r,e){r+=e*60*1e3;const t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Ju(r,e,t){return Xv(Bu(r),e,t)}function e0(r,e){const t=r.o,n=r.c.year+Math.trunc(e.years),i=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,a={...r.c,year:n,month:i,day:Math.min(r.c.day,$u(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},u=Ct.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),c=Bu(a);let[f,h]=Xv(c,t,r.zone);return u!==0&&(f+=u,h=r.zone.offset(f)),{ts:f,o:h}}function fa(r,e,t,n,i,a){const{setZone:u,zone:c}=t;if(r&&Object.keys(r).length!==0||e){const f=e||c,h=st.fromObject(r,{...t,zone:f,specificOffset:a});return u?h:h.setZone(c)}else return st.invalid(new Xn("unparsable",`the input "${i}" can't be parsed as ${n}`))}function Yu(r,e,t=!0){return r.isValid?zr.create(Lt.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function sh(r,e){const t=r.c.year>9999||r.c.year<0;let n="";return t&&r.c.year>=0&&(n+="+"),n+=xr(r.c.year,t?6:4),e?(n+="-",n+=xr(r.c.month),n+="-",n+=xr(r.c.day)):(n+=xr(r.c.month),n+=xr(r.c.day)),n}function t0(r,e,t,n,i,a){let u=xr(r.c.hour);return e?(u+=":",u+=xr(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(u+=":")):u+=xr(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(u+=xr(r.c.second),(r.c.millisecond!==0||!n)&&(u+=".",u+=xr(r.c.millisecond,3))),i&&(r.isOffsetFixed&&r.offset===0&&!a?u+="Z":r.o<0?(u+="-",u+=xr(Math.trunc(-r.o/60)),u+=":",u+=xr(Math.trunc(-r.o%60))):(u+="+",u+=xr(Math.trunc(r.o/60)),u+=":",u+=xr(Math.trunc(r.o%60)))),a&&(u+="["+r.zone.ianaName+"]"),u}const r0={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},qA={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},jA={ordinal:1,hour:0,minute:0,second:0,millisecond:0},n0=["year","month","day","hour","minute","second","millisecond"],UA=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],$A=["year","ordinal","hour","minute","second","millisecond"];function BA(r){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new Ng(r);return e}function i0(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return BA(r)}}function VA(r){return Zu[r]||(Ku===void 0&&(Ku=fr.now()),Zu[r]=r.offset(Ku)),Zu[r]}function s0(r,e){const t=Ki(e.zone,fr.defaultZone);if(!t.isValid)return st.invalid(go(t));const n=Lt.fromObject(e);let i,a;if(it(r.year))i=fr.now();else{for(const f of n0)it(r[f])&&(r[f]=r0[f]);const u=yv(r)||gv(r);if(u)return st.invalid(u);const c=VA(t);[i,a]=Ju(r,c,t)}return new st({ts:i,zone:t,loc:n,o:a})}function a0(r,e,t){const n=it(t.round)?!0:t.round,i=(u,c)=>(u=Yf(u,n||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(u,c)),a=u=>t.calendary?e.hasSame(r,u)?0:e.startOf(u).diff(r.startOf(u),u).get(u):e.diff(r,u).get(u);if(t.unit)return i(a(t.unit),t.unit);for(const u of t.units){const c=a(u);if(Math.abs(c)>=1)return i(c,u)}return i(r>e?-0:0,t.units[t.units.length-1])}function o0(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}let Ku,Zu={};class st{constructor(e){const t=e.zone||fr.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Xn("invalid input"):null)||(t.isValid?null:go(t));this.ts=it(e.ts)?fr.now():e.ts;let i=null,a=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[i,a]=[e.old.c,e.old.o];else{const c=Zi(e.o)&&!e.old?e.o:t.offset(this.ts);i=Qu(this.ts,c),n=Number.isNaN(i.year)?new Xn("invalid input"):null,i=n?null:i,a=n?null:c}this._zone=t,this.loc=e.loc||Lt.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=a,this.isLuxonDateTime=!0}static now(){return new st({})}static local(){const[e,t]=o0(arguments),[n,i,a,u,c,f,h]=t;return s0({year:n,month:i,day:a,hour:u,minute:c,second:f,millisecond:h},e)}static utc(){const[e,t]=o0(arguments),[n,i,a,u,c,f,h]=t;return e.zone=Zr.utcInstance,s0({year:n,month:i,day:a,hour:u,minute:c,second:f,millisecond:h},e)}static fromJSDate(e,t={}){const n=wT(e)?e.valueOf():NaN;if(Number.isNaN(n))return st.invalid("invalid input");const i=Ki(t.zone,fr.defaultZone);return i.isValid?new st({ts:n,zone:i,loc:Lt.fromObject(t)}):st.invalid(go(i))}static fromMillis(e,t={}){if(Zi(e))return e<-Zv||e>Zv?st.invalid("Timestamp out of range"):new st({ts:e,zone:Ki(t.zone,fr.defaultZone),loc:Lt.fromObject(t)});throw new Wr(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(Zi(e))return new st({ts:e*1e3,zone:Ki(t.zone,fr.defaultZone),loc:Lt.fromObject(t)});throw new Wr("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=Ki(t.zone,fr.defaultZone);if(!n.isValid)return st.invalid(go(n));const i=Lt.fromObject(t),a=Wu(e,i0),{minDaysInFirstWeek:u,startOfWeek:c}=mv(a,i),f=fr.now(),h=it(t.specificOffset)?n.offset(f):t.specificOffset,d=!it(a.ordinal),y=!it(a.year),g=!it(a.month)||!it(a.day),m=y||g,b=a.weekYear||a.weekNumber;if((m||d)&&b)throw new ea("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(g&&d)throw new ea("Can't mix ordinal dates with month/day");const I=b||a.weekday&&!m;let x,_,A=Qu(f,h);I?(x=UA,_=qA,A=ju(A,u,c)):d?(x=$A,_=jA,A=Gf(A)):(x=n0,_=r0);let P=!1;for(const de of x){const Ie=a[de];it(Ie)?P?a[de]=_[de]:a[de]=A[de]:P=!0}const M=I?gT(a,u,c):d?vT(a):yv(a),$=M||gv(a);if($)return st.invalid($);const j=I?dv(a,u,c):d?pv(a):a,[K,ee]=Ju(j,h,n),fe=new st({ts:K,zone:n,o:ee,loc:i});return a.weekday&&m&&e.weekday!==fe.weekday?st.invalid("mismatched weekday",`you can't specify both a weekday of ${a.weekday} and a date of ${fe.toISO()}`):fe.isValid?fe:st.invalid(fe.invalid)}static fromISO(e,t={}){const[n,i]=cA(e);return fa(n,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,i]=lA(e);return fa(n,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,i]=fA(e);return fa(n,i,t,"HTTP",t)}static fromFormat(e,t,n={}){if(it(e)||it(t))throw new Wr("fromFormat requires an input string and a format");const{locale:i=null,numberingSystem:a=null}=n,u=Lt.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),[c,f,h,d]=LA(u,e,t);return d?st.invalid(d):fa(c,f,n,`format ${t}`,e,h)}static fromString(e,t,n={}){return st.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,i]=vA(e);return fa(n,i,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Wr("need to specify a reason the DateTime is invalid");const n=e instanceof Xn?e:new Xn(e,t);if(fr.throwOnInvalid)throw new W1(n);return new st({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=Kv(e,Lt.fromObject(t));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return Qv(zr.parseFormat(e),Lt.fromObject(t)).map(i=>i.val).join("")}static resetCache(){Ku=void 0,Zu={}}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?nh(this).weekYear:NaN}get weekNumber(){return this.isValid?nh(this).weekNumber:NaN}get weekday(){return this.isValid?nh(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?ih(this).weekday:NaN}get localWeekNumber(){return this.isValid?ih(this).weekNumber:NaN}get localWeekYear(){return this.isValid?ih(this).weekYear:NaN}get ordinal(){return this.isValid?Gf(this.c).ordinal:NaN}get monthShort(){return this.isValid?Hu.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Hu.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Hu.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Hu.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,n=Bu(this.c),i=this.zone.offset(n-e),a=this.zone.offset(n+e),u=this.zone.offset(n-i*t),c=this.zone.offset(n-a*t);if(u===c)return[this];const f=n-u*t,h=n-c*t,d=Qu(f,u),y=Qu(h,c);return d.hour===y.hour&&d.minute===y.minute&&d.second===y.second&&d.millisecond===y.millisecond?[ks(this,{ts:f}),ks(this,{ts:h})]:[this]}get isInLeapYear(){return fo(this.year)}get daysInMonth(){return $u(this.year,this.month)}get daysInYear(){return this.isValid?na(this.year):NaN}get weeksInWeekYear(){return this.isValid?ho(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?ho(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:i}=zr.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:i}}toUTC(e=0,t={}){return this.setZone(Zr.instance(e),t)}toLocal(){return this.setZone(fr.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=Ki(e,fr.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(t||n){const a=e.offset(this.ts),u=this.toObject();[i]=Ju(u,a,e)}return ks(this,{ts:i,zone:e})}else return st.invalid(go(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){const i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return ks(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Wu(e,i0),{minDaysInFirstWeek:n,startOfWeek:i}=mv(t,this.loc),a=!it(t.weekYear)||!it(t.weekNumber)||!it(t.weekday),u=!it(t.ordinal),c=!it(t.year),f=!it(t.month)||!it(t.day),h=c||f,d=t.weekYear||t.weekNumber;if((h||u)&&d)throw new ea("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&u)throw new ea("Can't mix ordinal dates with month/day");let y;a?y=dv({...ju(this.c,n,i),...t},n,i):it(t.ordinal)?(y={...this.toObject(),...t},it(t.day)&&(y.day=Math.min($u(y.year,y.month),y.day))):y=pv({...Gf(this.c),...t});const[g,m]=Ju(y,this.o,this.zone);return ks(this,{ts:g,o:m})}plus(e){if(!this.isValid)return this;const t=Ct.fromDurationLike(e);return ks(this,e0(this,t))}minus(e){if(!this.isValid)return this;const t=Ct.fromDurationLike(e).negate();return ks(this,e0(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},i=Ct.normalizeUnit(e);switch(i){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(i==="weeks")if(t){const a=this.loc.getStartOfWeek(),{weekday:u}=this;u<a&&(n.weekNumber=this.weekNumber-1),n.weekday=a}else n.weekday=1;if(i==="quarters"){const a=Math.ceil(this.month/3);n.month=(a-1)*3+1}return this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?zr.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):rh}toLocaleString(e=Mu,t={}){return this.isValid?zr.create(this.loc.clone(t),e).formatDateTime(this):rh}toLocaleParts(e={}){return this.isValid?zr.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:a=!1}={}){if(!this.isValid)return null;const u=e==="extended";let c=sh(this,u);return c+="T",c+=t0(this,u,t,n,i,a),c}toISODate({format:e="extended"}={}){return this.isValid?sh(this,e==="extended"):null}toISOWeekDate(){return Yu(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:a=!1,format:u="extended"}={}){return this.isValid?(i?"T":"")+t0(this,u==="extended",t,e,n,a):null}toRFC2822(){return Yu(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Yu(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?sh(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(t||e)&&(n&&(i+=" "),t?i+="z":e&&(i+="ZZ")),Yu(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():rh}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return Ct.invalid("created by diffing an invalid DateTime");const i={locale:this.locale,numberingSystem:this.numberingSystem,...n},a=_T(t).map(Ct.normalizeUnit),u=e.valueOf()>this.valueOf(),c=u?this:e,f=u?e:this,h=OA(c,f,a,i);return u?h.negate():h}diffNow(e="milliseconds",t={}){return this.diff(st.now(),e,t)}until(e){return this.isValid?hr.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;const i=e.valueOf(),a=this.setZone(e.zone,{keepLocalTime:!0});return a.startOf(t,n)<=i&&i<=a.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||st.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0;let i=["years","months","days","hours","minutes","seconds"],a=e.unit;return Array.isArray(e.unit)&&(i=e.unit,a=void 0),a0(t,this.plus(n),{...e,numeric:"always",units:i,unit:a})}toRelativeCalendar(e={}){return this.isValid?a0(e.base||st.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(st.isDateTime))throw new Wr("min requires all arguments be DateTimes");return wv(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(st.isDateTime))throw new Wr("max requires all arguments be DateTimes");return wv(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:i=null,numberingSystem:a=null}=n,u=Lt.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});return Yv(u,e,t)}static fromStringExplain(e,t,n={}){return st.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:i=null}=t,a=Lt.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return new Jv(a,e)}static fromFormatParser(e,t,n={}){if(it(e)||it(t))throw new Wr("fromFormatParser requires an input string and a format parser");const{locale:i=null,numberingSystem:a=null}=n,u=Lt.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});if(!u.equals(t.locale))throw new Wr(`fromFormatParser called with a locale of ${u}, but the format parser was created for ${t.locale}`);const{result:c,zone:f,specificOffset:h,invalidReason:d}=t.explainFromTokens(e);return d?st.invalid(d):fa(c,f,n,`format ${t.format}`,e,h)}static get DATE_SHORT(){return Mu}static get DATE_MED(){return Rg}static get DATE_MED_WITH_WEEKDAY(){return G1}static get DATE_FULL(){return Mg}static get DATE_HUGE(){return Dg}static get TIME_SIMPLE(){return Fg}static get TIME_WITH_SECONDS(){return Lg}static get TIME_WITH_SHORT_OFFSET(){return qg}static get TIME_WITH_LONG_OFFSET(){return jg}static get TIME_24_SIMPLE(){return Ug}static get TIME_24_WITH_SECONDS(){return $g}static get TIME_24_WITH_SHORT_OFFSET(){return Bg}static get TIME_24_WITH_LONG_OFFSET(){return Vg}static get DATETIME_SHORT(){return Wg}static get DATETIME_SHORT_WITH_SECONDS(){return zg}static get DATETIME_MED(){return Hg}static get DATETIME_MED_WITH_SECONDS(){return Gg}static get DATETIME_MED_WITH_WEEKDAY(){return Q1}static get DATETIME_FULL(){return Qg}static get DATETIME_FULL_WITH_SECONDS(){return Jg}static get DATETIME_HUGE(){return Yg}static get DATETIME_HUGE_WITH_SECONDS(){return Kg}}function vo(r){if(st.isDateTime(r))return r;if(r&&r.valueOf&&Zi(r.valueOf()))return st.fromJSDate(r);if(r&&typeof r=="object")return st.fromObject(r);throw new Wr(`Unknown datetime argument: ${r}, of type ${typeof r}`)}var Xu={exports:{}};/**
|
|
86
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):u||Df.set(i,u=new Set),u.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),F(F({},r),{definitions:t})}function zO(r){var e=new Set(r.definitions);e.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function HO(r){var e=Cg(r);if(!Lu.has(e)){var t=tE(r,{experimentalFragmentVariables:qu,allowLegacyFragmentVariables:qu});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");Lu.set(e,zO(WO(t)))}return Lu.get(e)}function Zi(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof r=="string"&&(r=[r]);var n=r[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=r[a+1]}),HO(n)}function Pg(){Lu.clear(),Df.clear()}function Ng(){Ig=!1}function Rg(){qu=!0}function Mg(){qu=!1}var lo={gql:Zi,resetCaches:Pg,disableFragmentWarnings:Ng,enableExperimentalFragmentVariables:Rg,disableExperimentalFragmentVariables:Mg};(function(r){r.gql=lo.gql,r.resetCaches=lo.resetCaches,r.disableFragmentWarnings=lo.disableFragmentWarnings,r.enableExperimentalFragmentVariables=lo.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=lo.disableExperimentalFragmentVariables})(Zi||(Zi={})),Zi.default=Zi,fm(globalThis.__DEV__!==!1?"log":"silent");const GO=Object.freeze(Object.defineProperty({__proto__:null,ApolloCache:mf,ApolloClient:Mf,ApolloError:mn,ApolloLink:Yr,get Cache(){return yf},DocumentTransform:Su,HttpLink:jy,InMemoryCache:If,MissingFieldError:gf,get NetworkStatus(){return _t},Observable:Pt,ObservableQuery:ra,checkFetcher:Dy,concat:G1,createHttpLink:ff,createSignalIfSupported:dO,defaultDataIdFromObject:vf,defaultPrinter:cf,disableExperimentalFragmentVariables:Mg,disableFragmentWarnings:Ng,empty:W1,enableExperimentalFragmentVariables:Rg,execute:Pu,fallbackHttpConfig:My,from:z1,fromError:Iu,fromPromise:j1,get gql(){return Zi},isApolloError:uf,isNetworkRequestSettled:LO,isReference:Ct,makeReference:Wi,makeVar:cg,mergeOptions:Ji,parseAndCheckHttpResponse:Ry,resetCaches:Pg,rewriteURIForGET:Ly,selectHttpOptionsAndBody:fO,selectHttpOptionsAndBodyInternal:lf,selectURI:Fy,serializeFetchParameter:Ru,setLogVerbosity:fm,split:H1,throwServerError:of,toPromise:q1},Symbol.toStringTag,{value:"Module"}));var Ff={exports:{}},Dg;function QO(){return Dg||(Dg=1,function(r){r.exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=void 0,r.exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=void 0,r.exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=void 0,Object.assign(r.exports,be)}(Ff)),Ff.exports}var ut=QO();const JO=bx({__proto__:null,default:sm(ut)},[ut]);var Fg=mu?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function Lf(){Ie(!0,54);var r=ut.createContext[Fg];return r||(Object.defineProperty(ut.createContext,Fg,{value:r=ut.createContext({}),enumerable:!1,writable:!1,configurable:!0}),r.displayName="ApolloContext"),r}var YO=function(r){var e=r.client,t=r.children,n=Lf(),i=ut.useContext(n),a=ut.useMemo(function(){return F(F({},i),{client:e||i.client})},[i,e]);return Ie(a.client,55),ut.createElement(n.Provider,{value:a},t)};function Lg(r){var e=ut.useContext(Lf()),t=r||e.client;return Ie(!!t,58),t}var qg=!1,KO="useSyncExternalStore",ZO=JO[KO],jg=ZO||function(r,e,t){var n=e();globalThis.__DEV__!==!1&&!qg&&n!==e()&&(qg=!0,globalThis.__DEV__!==!1&&Ie.error(68));var i=ut.useState({inst:{value:n,getSnapshot:e}}),a=i[0].inst,u=i[1];return Fm?ut.useLayoutEffect(function(){Object.assign(a,{value:n,getSnapshot:e}),qf(a)&&u({inst:a})},[r,n,e]):Object.assign(a,{value:n,getSnapshot:e}),ut.useEffect(function(){return qf(a)&&u({inst:a}),r(function(){qf(a)&&u({inst:a})})},[r]),n};function qf(r){var e=r.value,t=r.getSnapshot;try{return e!==t()}catch{return!0}}var oi;(function(r){r[r.Query=0]="Query",r[r.Mutation=1]="Mutation",r[r.Subscription=2]="Subscription"})(oi||(oi={}));var As;function Ug(r){var e;switch(r){case oi.Query:e="Query";break;case oi.Mutation:e="Mutation";break;case oi.Subscription:e="Subscription";break}return e}function $g(r){As||(As=new gu(Qn.parser||1e3));var e=As.get(r);if(e)return e;var t,n,i;Ie(!!r&&!!r.kind,70,r);for(var a=[],u=[],c=[],f=[],h=0,p=r.definitions;h<p.length;h++){var m=p[h];if(m.kind==="FragmentDefinition"){a.push(m);continue}if(m.kind==="OperationDefinition")switch(m.operation){case"query":u.push(m);break;case"mutation":c.push(m);break;case"subscription":f.push(m);break}}Ie(!a.length||u.length||c.length||f.length,71),Ie(u.length+c.length+f.length<=1,72,r,u.length,f.length,c.length),n=u.length?oi.Query:oi.Mutation,!u.length&&!c.length&&(n=oi.Subscription);var y=u.length?u:c.length?c:f;Ie(y.length===1,73,r,y.length);var g=y[0];t=g.variableDefinitions||[],g.name&&g.name.kind==="Name"?i=g.name.value:i="data";var b={name:i,type:n,variables:t};return As.set(r,b),b}$g.resetCache=function(){As=void 0},globalThis.__DEV__!==!1&&Nl("parser",function(){return As?As.size:0});function Bg(r,e){var t=$g(r),n=Ug(e),i=Ug(t.type);Ie(t.type===e,74,n,n,i)}function XO(r,e){var t=ut.useRef(void 0);return(!t.current||!Nt(t.current.deps,e))&&(t.current={value:r(),deps:e}),t.current.value}var jf=Al?ut.useLayoutEffect:ut.useEffect,eT=Object.prototype.hasOwnProperty;function Vg(){}var ju=Symbol();function tT(r,e,t,n,i){function a(m){var y;Bg(e,oi.Query);var g={client:r,query:e,observable:n&&n.getSSRObservable(i())||ra.inactiveOnCreation.withValue(!n,function(){return r.watchQuery(Uf(void 0,r,t,i()))}),resultData:{previousData:(y=m?.resultData.current)===null||y===void 0?void 0:y.data}};return g}var u=ut.useState(a),c=u[0],f=u[1];function h(m){var y,g;Object.assign(c.observable,(y={},y[ju]=m,y));var b=c.resultData;f(F(F({},c),{query:m.query,resultData:Object.assign(b,{previousData:((g=b.current)===null||g===void 0?void 0:g.data)||b.previousData,current:void 0})}))}if(r!==c.client||e!==c.query){var p=a(c);return f(p),[p,h]}return[c,h]}function rT(r,e){var t=Lg(e.client),n=ut.useContext(Lf()).renderPromises,i=!!n,a=t.disableNetworkFetches,u=e.ssr!==!1&&!e.skip,c=e.partialRefetch,f=Wg(t,r,e,i),h=tT(t,r,e,n,f),p=h[0],m=p.observable,y=p.resultData,g=h[1],b=f(m);sT(y,m,t,e,b);var I=ut.useMemo(function(){return uT(m)},[m]);iT(m,n,u);var S=nT(y,m,t,e,b,a,c,i,{onCompleted:e.onCompleted||Vg,onError:e.onError||Vg});return{result:S,obsQueryFields:I,observable:m,resultData:y,client:t,onQueryExecuted:g}}function nT(r,e,t,n,i,a,u,c,f){var h=ut.useRef(f);ut.useEffect(function(){h.current=f});var p=(c||a)&&n.ssr===!1&&!n.skip?Gg:n.skip||i.fetchPolicy==="standby"?Qg:void 0,m=r.previousData,y=ut.useMemo(function(){return p&&Uu(p,m,e,t)},[t,e,p,m]);return jg(ut.useCallback(function(g){if(c)return function(){};var b=function(){var w=r.current,O=e.getCurrentResult();w&&w.loading===O.loading&&w.networkStatus===O.networkStatus&&Nt(w.data,O.data)||$f(O,r,e,t,u,g,h.current)},I=function(w){if(S.current.unsubscribe(),S.current=e.resubscribeAfterError(b,I),!eT.call(w,"graphQLErrors"))throw w;var O=r.current;(!O||O&&O.loading||!Nt(w,O.error))&&$f({data:O&&O.data,error:w,loading:!1,networkStatus:_t.error},r,e,t,u,g,h.current)},S={current:e.subscribe(b,I)};return function(){setTimeout(function(){return S.current.unsubscribe()})}},[a,c,e,r,u,t]),function(){return y||zg(r,e,h.current,u,t)},function(){return y||zg(r,e,h.current,u,t)})}function iT(r,e,t){e&&t&&(e.registerSSRObservable(r),r.getCurrentResult().loading&&e.addObservableQueryPromise(r))}function sT(r,e,t,n,i){var a;e[ju]&&!Nt(e[ju],i)&&(e.reobserve(Uf(e,t,n,i)),r.previousData=((a=r.current)===null||a===void 0?void 0:a.data)||r.previousData,r.current=void 0),e[ju]=i}function Wg(r,e,t,n){t===void 0&&(t={});var i=t.skip;t.ssr,t.onCompleted,t.onError;var a=t.defaultOptions,u=an(t,["skip","ssr","onCompleted","onError","defaultOptions"]);return function(c){var f=Object.assign(u,{query:e});return n&&(f.fetchPolicy==="network-only"||f.fetchPolicy==="cache-and-network")&&(f.fetchPolicy="cache-first"),f.variables||(f.variables={}),i?(f.initialFetchPolicy=f.initialFetchPolicy||f.fetchPolicy||Bf(a,r.defaultOptions),f.fetchPolicy="standby"):f.fetchPolicy||(f.fetchPolicy=c?.options.initialFetchPolicy||Bf(a,r.defaultOptions)),f}}function Uf(r,e,t,n){var i=[],a=e.defaultOptions.watchQuery;return a&&i.push(a),t.defaultOptions&&i.push(t.defaultOptions),i.push(Qi(r&&r.options,n)),i.reduce(Ji)}function $f(r,e,t,n,i,a,u){var c=e.current;c&&c.data&&(e.previousData=c.data),!r.error&&pn(r.errors)&&(r.error=new mn({graphQLErrors:r.errors})),e.current=Uu(oT(r,t,i),e.previousData,t,n),a(),aT(r,c?.networkStatus,u)}function aT(r,e,t){if(!r.loading){var n=Hg(r);Promise.resolve().then(function(){n?t.onError(n):r.data&&e!==r.networkStatus&&r.networkStatus===_t.ready&&t.onCompleted(r.data)}).catch(function(i){globalThis.__DEV__!==!1&&Ie.warn(i)})}}function zg(r,e,t,n,i){return r.current||$f(e.getCurrentResult(),r,e,i,n,function(){},t),r.current}function Bf(r,e){var t;return r?.fetchPolicy||((t=e?.watchQuery)===null||t===void 0?void 0:t.fetchPolicy)||"cache-first"}function Hg(r){return pn(r.errors)?new mn({graphQLErrors:r.errors}):r.error}function Uu(r,e,t,n){var i=r.data;r.partial;var a=an(r,["data","partial"]),u=F(F({data:i},a),{client:n,observable:t,variables:t.variables,called:r!==Gg&&r!==Qg,previousData:e});return u}function oT(r,e,t){return r.partial&&t&&!r.loading&&(!r.data||Object.keys(r.data).length===0)&&e.options.fetchPolicy!=="cache-only"?(e.refetch(),F(F({},r),{loading:!0,networkStatus:_t.refetch})):r}var Gg=Os({loading:!0,data:void 0,error:void 0,networkStatus:_t.loading}),Qg=Os({loading:!1,data:void 0,error:void 0,networkStatus:_t.ready});function uT(r){return{refetch:r.refetch.bind(r),reobserve:r.reobserve.bind(r),fetchMore:r.fetchMore.bind(r),updateQuery:r.updateQuery.bind(r),startPolling:r.startPolling.bind(r),stopPolling:r.stopPolling.bind(r),subscribeToMore:r.subscribeToMore.bind(r)}}var cT=["refetch","reobserve","fetchMore","updateQuery","startPolling","stopPolling","subscribeToMore"];function lT(r,e){var t,n=ut.useRef(void 0),i=ut.useRef(void 0),a=ut.useRef(void 0),u=Ji(e,n.current||{}),c=(t=u?.query)!==null&&t!==void 0?t:r;i.current=e,a.current=c;var f=F(F({},u),{skip:!n.current}),h=rT(c,f),p=h.obsQueryFields,m=h.result,y=h.client,g=h.resultData,b=h.observable,I=h.onQueryExecuted,S=b.options.initialFetchPolicy||Bf(f.defaultOptions,y.defaultOptions),w=ut.useReducer(function(q){return q+1},0)[1],O=ut.useMemo(function(){for(var q={},$=function(Ee){var ie=p[Ee];q[Ee]=function(){return n.current||(n.current=Object.create(null),w()),ie.apply(this,arguments)}},K=0,oe=cT;K<oe.length;K++){var re=oe[K];$(re)}return q},[w,p]),P=!!n.current,D=ut.useMemo(function(){return F(F(F({},m),O),{called:P})},[m,O,P]),T=ut.useCallback(function(q){n.current=q?F(F({},q),{fetchPolicy:q.fetchPolicy||S}):{fetchPolicy:S};var $=Ji(i.current,F({query:a.current},n.current)),K=fT(g,b,y,c,F(F({},$),{skip:!1}),I).then(function(oe){return Object.assign(oe,O)});return K.catch(function(){}),K},[y,c,O,S,b,g,I]),N=ut.useRef(T);jf(function(){N.current=T});var G=ut.useCallback(function(){for(var q=[],$=0;$<arguments.length;$++)q[$]=arguments[$];return N.current.apply(N,q)},[]);return[G,D]}function fT(r,e,t,n,i,a){var u=i.query||n,c=Wg(t,u,i,!1)(e),f=e.reobserveAsConcast(Uf(e,t,i,c));return a(c),new Promise(function(h){var p;f.subscribe({next:function(m){p=m},error:function(){h(Uu(e.getCurrentResult(),r.previousData,e,t))},complete:function(){h(Uu(e.maskResult(p),r.previousData,e,t))}})})}function hT(r,e){e===void 0&&(e=Object.create(null));var t=ut.useRef(!1),n=Lg(e.client);Bg(r,oi.Subscription),t.current||(t.current=!0,e.onSubscriptionData&&globalThis.__DEV__!==!1&&Ie.warn(e.onData?61:62),e.onSubscriptionComplete&&globalThis.__DEV__!==!1&&Ie.warn(e.onComplete?63:64));var i=e.skip,a=e.fetchPolicy,u=e.errorPolicy,c=e.shouldResubscribe,f=e.context,h=e.extensions,p=e.ignoreResults,m=XO(function(){return e.variables},[e.variables]),y=function(){return dT(n,r,m,a,u,f,h)},g=ut.useState(e.skip?null:y),b=g[0],I=g[1],S=ut.useRef(y);jf(function(){S.current=y}),i?b&&I(b=null):(!b||(n!==b.__.client||r!==b.__.query||a!==b.__.fetchPolicy||u!==b.__.errorPolicy||!Nt(m,b.__.variables))&&(typeof c=="function"?!!c(e):c)!==!1)&&I(b=y());var w=ut.useRef(e);ut.useEffect(function(){w.current=e});var O=!i&&!p,P=ut.useMemo(function(){return{loading:O,error:void 0,data:void 0,variables:m}},[O,m]),D=ut.useRef(p);jf(function(){D.current=p});var T=jg(ut.useCallback(function(G){if(!b)return function(){};var q=!1,$=b.__.variables,K=b.__.client,oe=b.subscribe({next:function(re){var Ee,ie;if(!q){var me={loading:!1,data:re.data,error:Hg(re),variables:$};b.__.setResult(me),D.current||G(),me.error?(ie=(Ee=w.current).onError)===null||ie===void 0||ie.call(Ee,me.error):w.current.onData?w.current.onData({client:K,data:me}):w.current.onSubscriptionData&&w.current.onSubscriptionData({client:K,subscriptionData:me})}},error:function(re){var Ee,ie;re=re instanceof mn?re:new mn({protocolErrors:[re]}),q||(b.__.setResult({loading:!1,data:void 0,error:re,variables:$}),D.current||G(),(ie=(Ee=w.current).onError)===null||ie===void 0||ie.call(Ee,re))},complete:function(){q||(w.current.onComplete?w.current.onComplete():w.current.onSubscriptionComplete&&w.current.onSubscriptionComplete())}});return function(){q=!0,setTimeout(function(){oe.unsubscribe()})}},[b]),function(){return b&&!i&&!p?b.__.result:P},function(){return P}),N=ut.useCallback(function(){Ie(!w.current.skip,65),I(S.current())},[w,S]);return ut.useMemo(function(){return F(F({},T),{restart:N})},[T,N])}function dT(r,e,t,n,i,a,u){var c={query:e,variables:t,fetchPolicy:n,errorPolicy:i,context:a,extensions:u},f=F(F({},c),{client:r,result:{loading:!0,data:void 0,error:void 0,variables:t},setResult:function(p){f.result=p}}),h=null;return Object.assign(new Pt(function(p){h||(h=r.subscribe(c));var m=h.subscribe(p);return function(){return m.unsubscribe()}}),{__:f})}class Is extends Error{}class pT extends Is{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class mT extends Is{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class yT extends Is{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class ia extends Is{}class Jg extends Is{constructor(e){super(`Invalid unit ${e}`)}}class Vr extends Is{}class Xi extends Is{constructor(){super("Zone is an abstract class")}}const Ce="numeric",Jn="short",yn="long",$u={year:Ce,month:Ce,day:Ce},Yg={year:Ce,month:Jn,day:Ce},gT={year:Ce,month:Jn,day:Ce,weekday:Jn},Kg={year:Ce,month:yn,day:Ce},Zg={year:Ce,month:yn,day:Ce,weekday:yn},Xg={hour:Ce,minute:Ce},ev={hour:Ce,minute:Ce,second:Ce},tv={hour:Ce,minute:Ce,second:Ce,timeZoneName:Jn},rv={hour:Ce,minute:Ce,second:Ce,timeZoneName:yn},nv={hour:Ce,minute:Ce,hourCycle:"h23"},iv={hour:Ce,minute:Ce,second:Ce,hourCycle:"h23"},sv={hour:Ce,minute:Ce,second:Ce,hourCycle:"h23",timeZoneName:Jn},av={hour:Ce,minute:Ce,second:Ce,hourCycle:"h23",timeZoneName:yn},ov={year:Ce,month:Ce,day:Ce,hour:Ce,minute:Ce},uv={year:Ce,month:Ce,day:Ce,hour:Ce,minute:Ce,second:Ce},cv={year:Ce,month:Jn,day:Ce,hour:Ce,minute:Ce},lv={year:Ce,month:Jn,day:Ce,hour:Ce,minute:Ce,second:Ce},vT={year:Ce,month:Jn,day:Ce,weekday:Jn,hour:Ce,minute:Ce},fv={year:Ce,month:yn,day:Ce,hour:Ce,minute:Ce,timeZoneName:Jn},hv={year:Ce,month:yn,day:Ce,hour:Ce,minute:Ce,second:Ce,timeZoneName:Jn},dv={year:Ce,month:yn,day:Ce,weekday:yn,hour:Ce,minute:Ce,timeZoneName:yn},pv={year:Ce,month:yn,day:Ce,weekday:yn,hour:Ce,minute:Ce,second:Ce,timeZoneName:yn};class fo{get type(){throw new Xi}get name(){throw new Xi}get ianaName(){return this.name}get isUniversal(){throw new Xi}offsetName(e,t){throw new Xi}formatOffset(e,t){throw new Xi}offset(e){throw new Xi}equals(e){throw new Xi}get isValid(){throw new Xi}}let Vf=null;class Bu extends fo{static get instance(){return Vf===null&&(Vf=new Bu),Vf}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Uv(e,t,n)}formatOffset(e,t){return yo(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const Wf=new Map;function bT(r){let e=Wf.get(r);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Wf.set(r,e)),e}const wT={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function _T(r,e){const t=r.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,i,a,u,c,f,h,p]=n;return[u,i,a,c,f,h,p]}function ST(r,e){const t=r.formatToParts(e),n=[];for(let i=0;i<t.length;i++){const{type:a,value:u}=t[i],c=wT[a];a==="era"?n[c]=u:rt(c)||(n[c]=parseInt(u,10))}return n}const zf=new Map;class bi extends fo{static create(e){let t=zf.get(e);return t===void 0&&zf.set(e,t=new bi(e)),t}static resetCache(){zf.clear(),Wf.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=bi.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Uv(e,t,n,this.name)}formatOffset(e,t){return yo(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const n=bT(this.name);let[i,a,u,c,f,h,p]=n.formatToParts?ST(n,t):_T(n,t);c==="BC"&&(i=-Math.abs(i)+1);const y=Gu({year:i,month:a,day:u,hour:f===24?0:f,minute:h,second:p,millisecond:0});let g=+t;const b=g%1e3;return g-=b>=0?b:1e3+b,(y-g)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let mv={};function xT(r,e={}){const t=JSON.stringify([r,e]);let n=mv[t];return n||(n=new Intl.ListFormat(r,e),mv[t]=n),n}const Hf=new Map;function Gf(r,e={}){const t=JSON.stringify([r,e]);let n=Hf.get(t);return n===void 0&&(n=new Intl.DateTimeFormat(r,e),Hf.set(t,n)),n}const Qf=new Map;function ET(r,e={}){const t=JSON.stringify([r,e]);let n=Qf.get(t);return n===void 0&&(n=new Intl.NumberFormat(r,e),Qf.set(t,n)),n}const Jf=new Map;function OT(r,e={}){const{base:t,...n}=e,i=JSON.stringify([r,n]);let a=Jf.get(i);return a===void 0&&(a=new Intl.RelativeTimeFormat(r,e),Jf.set(i,a)),a}let ho=null;function TT(){return ho||(ho=new Intl.DateTimeFormat().resolvedOptions().locale,ho)}const Yf=new Map;function yv(r){let e=Yf.get(r);return e===void 0&&(e=new Intl.DateTimeFormat(r).resolvedOptions(),Yf.set(r,e)),e}const Kf=new Map;function kT(r){let e=Kf.get(r);if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...gv,...e}),Kf.set(r,e)}return e}function AT(r){const e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));const t=r.indexOf("-u-");if(t===-1)return[r];{let n,i;try{n=Gf(r).resolvedOptions(),i=r}catch{const f=r.substring(0,t);n=Gf(f).resolvedOptions(),i=f}const{numberingSystem:a,calendar:u}=n;return[i,a,u]}}function IT(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function CT(r){const e=[];for(let t=1;t<=12;t++){const n=nt.utc(2009,t,1);e.push(r(n))}return e}function PT(r){const e=[];for(let t=1;t<=7;t++){const n=nt.utc(2016,11,13+t);e.push(r(n))}return e}function Vu(r,e,t,n){const i=r.listingMode();return i==="error"?null:i==="en"?t(e):n(e)}function NT(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||yv(r.locale).numberingSystem==="latn"}class RT{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:i,floor:a,...u}=n;if(!t||Object.keys(u).length>0){const c={useGrouping:!1,...n};n.padTo>0&&(c.minimumIntegerDigits=n.padTo),this.inf=ET(e,c)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):ah(e,3);return _r(t,this.padTo)}}}class MT{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const u=-1*(e.offset/60),c=u>=0?`Etc/GMT+${u}`:`Etc/GMT${u}`;e.offset!==0&&bi.create(c).valid?(i=c,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const a={...this.opts};a.timeZone=a.timeZone||i,this.dtf=Gf(t,a)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:n}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class DT{constructor(e,t,n){this.opts={style:"long",...n},!t&&Fv()&&(this.rtf=OT(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):nk(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const gv={firstDay:1,minimalDays:4,weekend:[6,7]};class Ft{static fromOpts(e){return Ft.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,i,a=!1){const u=e||fr.defaultLocale,c=u||(a?"en-US":TT()),f=t||fr.defaultNumberingSystem,h=n||fr.defaultOutputCalendar,p=ih(i)||fr.defaultWeekSettings;return new Ft(c,f,h,p,u)}static resetCache(){ho=null,Hf.clear(),Qf.clear(),Jf.clear(),Yf.clear(),Kf.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:i}={}){return Ft.create(e,t,n,i)}constructor(e,t,n,i,a){const[u,c,f]=AT(e);this.locale=u,this.numberingSystem=t||c||null,this.outputCalendar=n||f||null,this.weekSettings=i,this.intl=IT(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=a,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=NT(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:Ft.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,ih(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Vu(this,e,Vv,()=>{const n=this.intl==="ja"||this.intl.startsWith("ja-");t&=!n;const i=t?{month:e,day:"numeric"}:{month:e},a=t?"format":"standalone";if(!this.monthsCache[a][e]){const u=n?c=>this.dtFormatter(c,i).format():c=>this.extract(c,i,"month");this.monthsCache[a][e]=CT(u)}return this.monthsCache[a][e]})}weekdays(e,t=!1){return Vu(this,e,Hv,()=>{const n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=t?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=PT(a=>this.extract(a,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return Vu(this,void 0,()=>Gv,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[nt.utc(2016,11,13,9),nt.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Vu(this,e,Qv,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[nt.utc(-40,1,1),nt.utc(2017,1,1)].map(n=>this.extract(n,t,"era"))),this.eraCache[e]})}extract(e,t,n){const i=this.dtFormatter(e,t),a=i.formatToParts(),u=a.find(c=>c.type.toLowerCase()===n);return u?u.value:null}numberFormatter(e={}){return new RT(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new MT(e,this.intl,t)}relFormatter(e={}){return new DT(this.intl,this.isEnglish(),e)}listFormatter(e={}){return xT(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||yv(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Lv()?kT(this.locale):gv}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Zf=null;class Kr extends fo{static get utcInstance(){return Zf===null&&(Zf=new Kr(0)),Zf}static instance(e){return e===0?Kr.utcInstance:new Kr(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Kr(Qu(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${yo(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${yo(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return yo(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class FT extends fo{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function es(r,e){if(rt(r)||r===null)return e;if(r instanceof fo)return r;if(BT(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Bu.instance:t==="utc"||t==="gmt"?Kr.utcInstance:Kr.parseSpecifier(t)||bi.create(r)}else return ts(r)?Kr.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new FT(r)}const Xf={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},vv={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},LT=Xf.hanidec.replace(/[\[|\]]/g,"").split("");function qT(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t<r.length;t++){const n=r.charCodeAt(t);if(r[t].search(Xf.hanidec)!==-1)e+=LT.indexOf(r[t]);else for(const i in vv){const[a,u]=vv[i];n>=a&&n<=u&&(e+=n-a)}}return parseInt(e,10)}else return e}const eh=new Map;function jT(){eh.clear()}function Yn({numberingSystem:r},e=""){const t=r||"latn";let n=eh.get(t);n===void 0&&(n=new Map,eh.set(t,n));let i=n.get(e);return i===void 0&&(i=new RegExp(`${Xf[t]}${e}`),n.set(e,i)),i}let bv=()=>Date.now(),wv="system",_v=null,Sv=null,xv=null,Ev=60,Ov,Tv=null;class fr{static get now(){return bv}static set now(e){bv=e}static set defaultZone(e){wv=e}static get defaultZone(){return es(wv,Bu.instance)}static get defaultLocale(){return _v}static set defaultLocale(e){_v=e}static get defaultNumberingSystem(){return Sv}static set defaultNumberingSystem(e){Sv=e}static get defaultOutputCalendar(){return xv}static set defaultOutputCalendar(e){xv=e}static get defaultWeekSettings(){return Tv}static set defaultWeekSettings(e){Tv=ih(e)}static get twoDigitCutoffYear(){return Ev}static set twoDigitCutoffYear(e){Ev=e%100}static get throwOnInvalid(){return Ov}static set throwOnInvalid(e){Ov=e}static resetCaches(){Ft.resetCache(),bi.resetCache(),nt.resetCache(),jT()}}class Kn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const kv=[0,31,59,90,120,151,181,212,243,273,304,334],Av=[0,31,60,91,121,152,182,213,244,274,305,335];function Pn(r,e){return new Kn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function th(r,e,t){const n=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const i=n.getUTCDay();return i===0?7:i}function Iv(r,e,t){return t+(po(r)?Av:kv)[e-1]}function Cv(r,e){const t=po(r)?Av:kv,n=t.findIndex(a=>a<e),i=e-t[n];return{month:n+1,day:i}}function rh(r,e){return(r-e+7)%7+1}function Wu(r,e=4,t=1){const{year:n,month:i,day:a}=r,u=Iv(n,i,a),c=rh(th(n,i,a),t);let f=Math.floor((u-c+14-e)/7),h;return f<1?(h=n-1,f=mo(h,e,t)):f>mo(n,e,t)?(h=n+1,f=1):h=n,{weekYear:h,weekNumber:f,weekday:c,...Yu(r)}}function Pv(r,e=4,t=1){const{weekYear:n,weekNumber:i,weekday:a}=r,u=rh(th(n,1,e),t),c=aa(n);let f=i*7+a-u-7+e,h;f<1?(h=n-1,f+=aa(h)):f>c?(h=n+1,f-=aa(n)):h=n;const{month:p,day:m}=Cv(h,f);return{year:h,month:p,day:m,...Yu(r)}}function nh(r){const{year:e,month:t,day:n}=r,i=Iv(e,t,n);return{year:e,ordinal:i,...Yu(r)}}function Nv(r){const{year:e,ordinal:t}=r,{month:n,day:i}=Cv(e,t);return{year:e,month:n,day:i,...Yu(r)}}function Rv(r,e){if(!rt(r.localWeekday)||!rt(r.localWeekNumber)||!rt(r.localWeekYear)){if(!rt(r.weekday)||!rt(r.weekNumber)||!rt(r.weekYear))throw new ia("Cannot mix locale-based week fields with ISO-based week fields");return rt(r.localWeekday)||(r.weekday=r.localWeekday),rt(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),rt(r.localWeekYear)||(r.weekYear=r.localWeekYear),delete r.localWeekday,delete r.localWeekNumber,delete r.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function UT(r,e=4,t=1){const n=zu(r.weekYear),i=Nn(r.weekNumber,1,mo(r.weekYear,e,t)),a=Nn(r.weekday,1,7);return n?i?a?!1:Pn("weekday",r.weekday):Pn("week",r.weekNumber):Pn("weekYear",r.weekYear)}function $T(r){const e=zu(r.year),t=Nn(r.ordinal,1,aa(r.year));return e?t?!1:Pn("ordinal",r.ordinal):Pn("year",r.year)}function Mv(r){const e=zu(r.year),t=Nn(r.month,1,12),n=Nn(r.day,1,Hu(r.year,r.month));return e?t?n?!1:Pn("day",r.day):Pn("month",r.month):Pn("year",r.year)}function Dv(r){const{hour:e,minute:t,second:n,millisecond:i}=r,a=Nn(e,0,23)||e===24&&t===0&&n===0&&i===0,u=Nn(t,0,59),c=Nn(n,0,59),f=Nn(i,0,999);return a?u?c?f?!1:Pn("millisecond",i):Pn("second",n):Pn("minute",t):Pn("hour",e)}function rt(r){return typeof r>"u"}function ts(r){return typeof r=="number"}function zu(r){return typeof r=="number"&&r%1===0}function BT(r){return typeof r=="string"}function VT(r){return Object.prototype.toString.call(r)==="[object Date]"}function Fv(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Lv(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function WT(r){return Array.isArray(r)?r:[r]}function qv(r,e,t){if(r.length!==0)return r.reduce((n,i)=>{const a=[e(i),i];return n&&t(n[0],a[0])===n[0]?n:a},null)[1]}function zT(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function sa(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function ih(r){if(r==null)return null;if(typeof r!="object")throw new Vr("Week settings must be an object");if(!Nn(r.firstDay,1,7)||!Nn(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!Nn(e,1,7)))throw new Vr("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function Nn(r,e,t){return zu(r)&&r>=e&&r<=t}function HT(r,e){return r-e*Math.floor(r/e)}function _r(r,e=2){const t=r<0;let n;return t?n="-"+(""+-r).padStart(e,"0"):n=(""+r).padStart(e,"0"),n}function rs(r){if(!(rt(r)||r===null||r===""))return parseInt(r,10)}function Cs(r){if(!(rt(r)||r===null||r===""))return parseFloat(r)}function sh(r){if(!(rt(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function ah(r,e,t="round"){const n=10**e;switch(t){case"expand":return r>0?Math.ceil(r*n)/n:Math.floor(r*n)/n;case"trunc":return Math.trunc(r*n)/n;case"round":return Math.round(r*n)/n;case"floor":return Math.floor(r*n)/n;case"ceil":return Math.ceil(r*n)/n;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function po(r){return r%4===0&&(r%100!==0||r%400===0)}function aa(r){return po(r)?366:365}function Hu(r,e){const t=HT(e-1,12)+1,n=r+(e-t)/12;return t===2?po(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Gu(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}function jv(r,e,t){return-rh(th(r,1,e),t)+e-1}function mo(r,e=4,t=1){const n=jv(r,e,t),i=jv(r+1,e,t);return(aa(r)-n+i)/7}function oh(r){return r>99?r:r>fr.twoDigitCutoffYear?1900+r:2e3+r}function Uv(r,e,t,n=null){const i=new Date(r),a={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(a.timeZone=n);const u={timeZoneName:e,...a},c=new Intl.DateTimeFormat(t,u).formatToParts(i).find(f=>f.type.toLowerCase()==="timezonename");return c?c.value:null}function Qu(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);const n=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-n:n;return t*60+i}function $v(r){const e=Number(r);if(typeof r=="boolean"||r===""||!Number.isFinite(e))throw new Vr(`Invalid unit value ${r}`);return e}function Ju(r,e){const t={};for(const n in r)if(sa(r,n)){const i=r[n];if(i==null)continue;t[e(n)]=$v(i)}return t}function yo(r,e){const t=Math.trunc(Math.abs(r/60)),n=Math.trunc(Math.abs(r%60)),i=r>=0?"+":"-";switch(e){case"short":return`${i}${_r(t,2)}:${_r(n,2)}`;case"narrow":return`${i}${t}${n>0?`:${n}`:""}`;case"techie":return`${i}${_r(t,2)}${_r(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Yu(r){return zT(r,["hour","minute","second","millisecond"])}const GT=["January","February","March","April","May","June","July","August","September","October","November","December"],Bv=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],QT=["J","F","M","A","M","J","J","A","S","O","N","D"];function Vv(r){switch(r){case"narrow":return[...QT];case"short":return[...Bv];case"long":return[...GT];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Wv=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],zv=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],JT=["M","T","W","T","F","S","S"];function Hv(r){switch(r){case"narrow":return[...JT];case"short":return[...zv];case"long":return[...Wv];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Gv=["AM","PM"],YT=["Before Christ","Anno Domini"],KT=["BC","AD"],ZT=["B","A"];function Qv(r){switch(r){case"narrow":return[...ZT];case"short":return[...KT];case"long":return[...YT];default:return null}}function XT(r){return Gv[r.hour<12?0:1]}function ek(r,e){return Hv(e)[r.weekday-1]}function tk(r,e){return Vv(e)[r.month-1]}function rk(r,e){return Qv(e)[r.year<0?0:1]}function nk(r,e,t="always",n=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},a=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&a){const m=r==="days";switch(e){case 1:return m?"tomorrow":`next ${i[r][0]}`;case-1:return m?"yesterday":`last ${i[r][0]}`;case 0:return m?"today":`this ${i[r][0]}`}}const u=Object.is(e,-0)||e<0,c=Math.abs(e),f=c===1,h=i[r],p=n?f?h[1]:h[2]||h[1]:f?i[r][0]:r;return u?`${c} ${p} ago`:`in ${c} ${p}`}function Jv(r,e){let t="";for(const n of r)n.literal?t+=n.val:t+=e(n.val);return t}const ik={D:$u,DD:Yg,DDD:Kg,DDDD:Zg,t:Xg,tt:ev,ttt:tv,tttt:rv,T:nv,TT:iv,TTT:sv,TTTT:av,f:ov,ff:cv,fff:fv,ffff:dv,F:uv,FF:lv,FFF:hv,FFFF:pv};class Wr{static create(e,t={}){return new Wr(e,t)}static parseFormat(e){let t=null,n="",i=!1;const a=[];for(let u=0;u<e.length;u++){const c=e.charAt(u);c==="'"?((n.length>0||i)&&a.push({literal:i||/^\s+$/.test(n),val:n===""?"'":n}),t=null,n="",i=!i):i||c===t?n+=c:(n.length>0&&a.push({literal:/^\s+$/.test(n),val:n}),n=c,t=c)}return n.length>0&&a.push({literal:i||/^\s+$/.test(n),val:n}),a}static macroTokenToFormatOpts(e){return ik[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n=void 0){if(this.opts.forceSimple)return _r(e,t);const i={...this.opts};return t>0&&(i.padTo=t),n&&(i.signDisplay=n),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,t){const n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",a=(g,b)=>this.loc.extract(e,g,b),u=g=>e.isOffsetFixed&&e.offset===0&&g.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,g.format):"",c=()=>n?XT(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),f=(g,b)=>n?tk(e,g):a(b?{month:g}:{month:g,day:"numeric"},"month"),h=(g,b)=>n?ek(e,g):a(b?{weekday:g}:{weekday:g,month:"long",day:"numeric"},"weekday"),p=g=>{const b=Wr.macroTokenToFormatOpts(g);return b?this.formatWithSystemDefault(e,b):g},m=g=>n?rk(e,g):a({era:g},"era"),y=g=>{switch(g){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return u({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return u({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return u({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return c();case"d":return i?a({day:"numeric"},"day"):this.num(e.day);case"dd":return i?a({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return h("short",!0);case"cccc":return h("long",!0);case"ccccc":return h("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return h("short",!1);case"EEEE":return h("long",!1);case"EEEEE":return h("narrow",!1);case"L":return i?a({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?a({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return f("short",!0);case"LLLL":return f("long",!0);case"LLLLL":return f("narrow",!0);case"M":return i?a({month:"numeric"},"month"):this.num(e.month);case"MM":return i?a({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return f("short",!1);case"MMMM":return f("long",!1);case"MMMMM":return f("narrow",!1);case"y":return i?a({year:"numeric"},"year"):this.num(e.year);case"yy":return i?a({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?a({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?a({year:"numeric"},"year"):this.num(e.year,6);case"G":return m("short");case"GG":return m("long");case"GGGGG":return m("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return p(g)}};return Jv(Wr.parseFormat(t),y)}formatDurationFromString(e,t){const n=this.opts.signMode==="negativeLargestOnly"?-1:1,i=p=>{switch(p[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},a=(p,m)=>y=>{const g=i(y);if(g){const b=m.isNegativeDuration&&g!==m.largestUnit?n:1;let I;return this.opts.signMode==="negativeLargestOnly"&&g!==m.largestUnit?I="never":this.opts.signMode==="all"?I="always":I="auto",this.num(p.get(g)*b,y.length,I)}else return y},u=Wr.parseFormat(t),c=u.reduce((p,{literal:m,val:y})=>m?p:p.concat(y),[]),f=e.shiftTo(...c.map(i).filter(p=>p)),h={isNegativeDuration:f<0,largestUnit:Object.keys(f.values)[0]};return Jv(u,a(f,h))}}const Yv=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function oa(...r){const e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function ua(...r){return e=>r.reduce(([t,n,i],a)=>{const[u,c,f]=a(e,i);return[{...t,...u},c||n,f]},[{},null,1]).slice(0,2)}function ca(r,...e){if(r==null)return[null,null];for(const[t,n]of e){const i=t.exec(r);if(i)return n(i)}return[null,null]}function Kv(...r){return(e,t)=>{const n={};let i;for(i=0;i<r.length;i++)n[r[i]]=rs(e[t+i]);return[n,null,t+i]}}const Zv=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,sk=`(?:${Zv.source}?(?:\\[(${Yv.source})\\])?)?`,uh=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Xv=RegExp(`${uh.source}${sk}`),ch=RegExp(`(?:[Tt]${Xv.source})?`),ak=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,ok=/(\d{4})-?W(\d\d)(?:-?(\d))?/,uk=/(\d{4})-?(\d{3})/,ck=Kv("weekYear","weekNumber","weekDay"),lk=Kv("year","ordinal"),fk=/(\d{4})-(\d\d)-(\d\d)/,e0=RegExp(`${uh.source} ?(?:${Zv.source}|(${Yv.source}))?`),hk=RegExp(`(?: ${e0.source})?`);function la(r,e,t){const n=r[e];return rt(n)?t:rs(n)}function dk(r,e){return[{year:la(r,e),month:la(r,e+1,1),day:la(r,e+2,1)},null,e+3]}function fa(r,e){return[{hours:la(r,e,0),minutes:la(r,e+1,0),seconds:la(r,e+2,0),milliseconds:sh(r[e+3])},null,e+4]}function go(r,e){const t=!r[e]&&!r[e+1],n=Qu(r[e+1],r[e+2]),i=t?null:Kr.instance(n);return[{},i,e+3]}function vo(r,e){const t=r[e]?bi.create(r[e]):null;return[{},t,e+1]}const pk=RegExp(`^T?${uh.source}$`),mk=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function yk(r){const[e,t,n,i,a,u,c,f,h]=r,p=e[0]==="-",m=f&&f[0]==="-",y=(g,b=!1)=>g!==void 0&&(b||g&&p)?-g:g;return[{years:y(Cs(t)),months:y(Cs(n)),weeks:y(Cs(i)),days:y(Cs(a)),hours:y(Cs(u)),minutes:y(Cs(c)),seconds:y(Cs(f),f==="-0"),milliseconds:y(sh(h),m)}]}const gk={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function lh(r,e,t,n,i,a,u){const c={year:e.length===2?oh(rs(e)):rs(e),month:Bv.indexOf(t)+1,day:rs(n),hour:rs(i),minute:rs(a)};return u&&(c.second=rs(u)),r&&(c.weekday=r.length>3?Wv.indexOf(r)+1:zv.indexOf(r)+1),c}const vk=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function bk(r){const[,e,t,n,i,a,u,c,f,h,p,m]=r,y=lh(e,i,n,t,a,u,c);let g;return f?g=gk[f]:h?g=0:g=Qu(p,m),[y,new Kr(g)]}function wk(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const _k=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Sk=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,xk=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function t0(r){const[,e,t,n,i,a,u,c]=r;return[lh(e,i,n,t,a,u,c),Kr.utcInstance]}function Ek(r){const[,e,t,n,i,a,u,c]=r;return[lh(e,c,t,n,i,a,u),Kr.utcInstance]}const Ok=oa(ak,ch),Tk=oa(ok,ch),kk=oa(uk,ch),Ak=oa(Xv),r0=ua(dk,fa,go,vo),Ik=ua(ck,fa,go,vo),Ck=ua(lk,fa,go,vo),Pk=ua(fa,go,vo);function Nk(r){return ca(r,[Ok,r0],[Tk,Ik],[kk,Ck],[Ak,Pk])}function Rk(r){return ca(wk(r),[vk,bk])}function Mk(r){return ca(r,[_k,t0],[Sk,t0],[xk,Ek])}function Dk(r){return ca(r,[mk,yk])}const Fk=ua(fa);function Lk(r){return ca(r,[pk,Fk])}const qk=oa(fk,hk),jk=oa(e0),Uk=ua(fa,go,vo);function $k(r){return ca(r,[qk,r0],[jk,Uk])}const n0="Invalid Duration",i0={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Bk={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...i0},Rn=146097/400,ha=146097/4800,Vk={years:{quarters:4,months:12,weeks:Rn/7,days:Rn,hours:Rn*24,minutes:Rn*24*60,seconds:Rn*24*60*60,milliseconds:Rn*24*60*60*1e3},quarters:{months:3,weeks:Rn/28,days:Rn/4,hours:Rn*24/4,minutes:Rn*24*60/4,seconds:Rn*24*60*60/4,milliseconds:Rn*24*60*60*1e3/4},months:{weeks:ha/7,days:ha,hours:ha*24,minutes:ha*24*60,seconds:ha*24*60*60,milliseconds:ha*24*60*60*1e3},...i0},Ps=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Wk=Ps.slice(0).reverse();function wi(r,e,t=!1){const n={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new kt(n)}function s0(r,e){let t=e.milliseconds??0;for(const n of Wk.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function a0(r,e){const t=s0(r,e)<0?-1:1;Ps.reduceRight((n,i)=>{if(rt(e[i]))return n;if(n){const a=e[n]*t,u=r[i][n],c=Math.floor(a/u);e[i]+=c*t,e[n]-=c*u*t}return i},null),Ps.reduce((n,i)=>{if(rt(e[i]))return n;if(n){const a=e[n]%1;e[n]-=a,e[i]+=a*r[n][i]}return i},null)}function o0(r){const e={};for(const[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}class kt{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let n=t?Vk:Bk;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Ft.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return kt.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new Vr(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new kt({values:Ju(e,kt.normalizeUnit),loc:Ft.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(ts(e))return kt.fromMillis(e);if(kt.isDuration(e))return e;if(typeof e=="object")return kt.fromObject(e);throw new Vr(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=Dk(e);return n?kt.fromObject(n,t):kt.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=Lk(e);return n?kt.fromObject(n,t):kt.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Vr("need to specify a reason the Duration is invalid");const n=e instanceof Kn?e:new Kn(e,t);if(fr.throwOnInvalid)throw new yT(n);return new kt({invalid:n})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Jg(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?Wr.create(this.loc,n).formatDurationFromString(this,e):n0}toHuman(e={}){if(!this.isValid)return n0;const t=e.showZeros!==!1,n=Ps.map(i=>{const a=this.values[i];return rt(a)||a===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(a)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=ah(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},nt.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?s0(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=kt.fromDurationLike(e),n={};for(const i of Ps)(sa(t.values,i)||sa(this.values,i))&&(n[i]=t.get(i)+this.get(i));return wi(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=kt.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const n of Object.keys(this.values))t[n]=$v(e(this.values[n],n));return wi(this,{values:t},!0)}get(e){return this[kt.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Ju(e,kt.normalizeUnit)};return wi(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:i}={}){const u={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:i,conversionAccuracy:n};return wi(this,u)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return a0(this.matrix,e),wi(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=o0(this.normalize().shiftToAll().toObject());return wi(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(u=>kt.normalizeUnit(u));const t={},n={},i=this.toObject();let a;for(const u of Ps)if(e.indexOf(u)>=0){a=u;let c=0;for(const h in n)c+=this.matrix[h][u]*n[h],n[h]=0;ts(i[u])&&(c+=i[u]);const f=Math.trunc(c);t[u]=f,n[u]=(c*1e3-f*1e3)/1e3}else ts(i[u])&&(n[u]=i[u]);for(const u in n)n[u]!==0&&(t[a]+=u===a?n[u]:n[u]/this.matrix[a][u]);return a0(this.matrix,t),wi(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return wi(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=o0(this.values);return wi(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(const n of Ps)if(!t(this.values[n],e.values[n]))return!1;return!0}}const da="Invalid Interval";function zk(r,e){return!r||!r.isValid?hr.invalid("missing or invalid start"):!e||!e.isValid?hr.invalid("missing or invalid end"):e<r?hr.invalid("end before start",`The end of an interval must be after its start, but you had start=${r.toISO()} and end=${e.toISO()}`):null}class hr{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new Vr("need to specify a reason the Interval is invalid");const n=e instanceof Kn?e:new Kn(e,t);if(fr.throwOnInvalid)throw new mT(n);return new hr({invalid:n})}static fromDateTimes(e,t){const n=_o(e),i=_o(t),a=zk(n,i);return a??new hr({start:n,end:i})}static after(e,t){const n=kt.fromDurationLike(t),i=_o(e);return hr.fromDateTimes(i,i.plus(n))}static before(e,t){const n=kt.fromDurationLike(t),i=_o(e);return hr.fromDateTimes(i.minus(n),i)}static fromISO(e,t){const[n,i]=(e||"").split("/",2);if(n&&i){let a,u;try{a=nt.fromISO(n,t),u=a.isValid}catch{u=!1}let c,f;try{c=nt.fromISO(i,t),f=c.isValid}catch{f=!1}if(u&&f)return hr.fromDateTimes(a,c);if(u){const h=kt.fromISO(i,t);if(h.isValid)return hr.after(a,h)}else if(f){const h=kt.fromISO(n,t);if(h.isValid)return hr.before(c,h)}}return hr.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const n=this.start.startOf(e,t);let i;return t?.useLocaleWeeks?i=this.end.reconfigure({locale:n.locale}):i=this.end,i=i.startOf(e,t),Math.floor(i.diff(n,e).get(e))+(i.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?hr.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(_o).filter(u=>this.contains(u)).sort((u,c)=>u.toMillis()-c.toMillis()),n=[];let{s:i}=this,a=0;for(;i<this.e;){const u=t[a]||this.e,c=+u>+this.e?this.e:u;n.push(hr.fromDateTimes(i,c)),i=c,a+=1}return n}splitBy(e){const t=kt.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:n}=this,i=1,a;const u=[];for(;n<this.e;){const c=this.start.plus(t.mapUnits(f=>f*i));a=+c>+this.e?this.e:c,u.push(hr.fromDateTimes(n,a)),n=a,i+=1}return u}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return t>=n?null:hr.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return hr.fromDateTimes(t,n)}static merge(e){const[t,n]=e.sort((i,a)=>i.s-a.s).reduce(([i,a],u)=>a?a.overlaps(u)||a.abutsStart(u)?[i,a.union(u)]:[i.concat([a]),u]:[i,u],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0;const i=[],a=e.map(f=>[{time:f.s,type:"s"},{time:f.e,type:"e"}]),u=Array.prototype.concat(...a),c=u.sort((f,h)=>f.time-h.time);for(const f of c)n+=f.type==="s"?1:-1,n===1?t=f.time:(t&&+t!=+f.time&&i.push(hr.fromDateTimes(t,f.time)),t=null);return hr.merge(i)}difference(...e){return hr.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:da}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=$u,t={}){return this.isValid?Wr.create(this.s.loc.clone(t),e).formatInterval(this):da}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:da}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:da}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:da}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:da}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):kt.invalid(this.invalidReason)}mapEndpoints(e){return hr.fromDateTimes(e(this.s),e(this.e))}}class Ku{static hasDST(e=fr.defaultZone){const t=nt.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return bi.isValidZone(e)}static normalizeZone(e){return es(e,fr.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Ft.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Ft.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Ft.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||Ft.create(t,n,a)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||Ft.create(t,n,a)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||Ft.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||Ft.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Ft.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Ft.create(t,null,"gregory").eras(e)}static features(){return{relative:Fv(),localeWeek:Lv()}}}function u0(r,e){const t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(kt.fromMillis(n).as("days"))}function Hk(r,e,t){const n=[["years",(f,h)=>h.year-f.year],["quarters",(f,h)=>h.quarter-f.quarter+(h.year-f.year)*4],["months",(f,h)=>h.month-f.month+(h.year-f.year)*12],["weeks",(f,h)=>{const p=u0(f,h);return(p-p%7)/7}],["days",u0]],i={},a=r;let u,c;for(const[f,h]of n)t.indexOf(f)>=0&&(u=f,i[f]=h(r,e),c=a.plus(i),c>e?(i[f]--,r=a.plus(i),r>e&&(c=r,i[f]--,r=a.plus(i))):r=c);return[r,i,c,u]}function Gk(r,e,t,n){let[i,a,u,c]=Hk(r,e,t);const f=e-i,h=t.filter(m=>["hours","minutes","seconds","milliseconds"].indexOf(m)>=0);h.length===0&&(u<e&&(u=i.plus({[c]:1})),u!==i&&(a[c]=(a[c]||0)+f/(u-i)));const p=kt.fromObject(a,n);return h.length>0?kt.fromMillis(f,n).shiftTo(...h).plus(p):p}const Qk="missing Intl.DateTimeFormat.formatToParts support";function Rt(r,e=t=>t){return{regex:r,deser:([t])=>e(qT(t))}}const c0="[ ]",l0=new RegExp(c0,"g");function Jk(r){return r.replace(/\./g,"\\.?").replace(l0,c0)}function f0(r){return r.replace(/\./g,"").replace(l0," ").toLowerCase()}function Zn(r,e){return r===null?null:{regex:RegExp(r.map(Jk).join("|")),deser:([t])=>r.findIndex(n=>f0(t)===f0(n))+e}}function h0(r,e){return{regex:r,deser:([,t,n])=>Qu(t,n),groups:e}}function Zu(r){return{regex:r,deser:([e])=>e}}function Yk(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Kk(r,e){const t=Yn(e),n=Yn(e,"{2}"),i=Yn(e,"{3}"),a=Yn(e,"{4}"),u=Yn(e,"{6}"),c=Yn(e,"{1,2}"),f=Yn(e,"{1,3}"),h=Yn(e,"{1,6}"),p=Yn(e,"{1,9}"),m=Yn(e,"{2,4}"),y=Yn(e,"{4,6}"),g=S=>({regex:RegExp(Yk(S.val)),deser:([w])=>w,literal:!0}),I=(S=>{if(r.literal)return g(S);switch(S.val){case"G":return Zn(e.eras("short"),0);case"GG":return Zn(e.eras("long"),0);case"y":return Rt(h);case"yy":return Rt(m,oh);case"yyyy":return Rt(a);case"yyyyy":return Rt(y);case"yyyyyy":return Rt(u);case"M":return Rt(c);case"MM":return Rt(n);case"MMM":return Zn(e.months("short",!0),1);case"MMMM":return Zn(e.months("long",!0),1);case"L":return Rt(c);case"LL":return Rt(n);case"LLL":return Zn(e.months("short",!1),1);case"LLLL":return Zn(e.months("long",!1),1);case"d":return Rt(c);case"dd":return Rt(n);case"o":return Rt(f);case"ooo":return Rt(i);case"HH":return Rt(n);case"H":return Rt(c);case"hh":return Rt(n);case"h":return Rt(c);case"mm":return Rt(n);case"m":return Rt(c);case"q":return Rt(c);case"qq":return Rt(n);case"s":return Rt(c);case"ss":return Rt(n);case"S":return Rt(f);case"SSS":return Rt(i);case"u":return Zu(p);case"uu":return Zu(c);case"uuu":return Rt(t);case"a":return Zn(e.meridiems(),0);case"kkkk":return Rt(a);case"kk":return Rt(m,oh);case"W":return Rt(c);case"WW":return Rt(n);case"E":case"c":return Rt(t);case"EEE":return Zn(e.weekdays("short",!1),1);case"EEEE":return Zn(e.weekdays("long",!1),1);case"ccc":return Zn(e.weekdays("short",!0),1);case"cccc":return Zn(e.weekdays("long",!0),1);case"Z":case"ZZ":return h0(new RegExp(`([+-]${c.source})(?::(${n.source}))?`),2);case"ZZZ":return h0(new RegExp(`([+-]${c.source})(${n.source})?`),2);case"z":return Zu(/[a-z_+-/]{1,256}?/i);case" ":return Zu(/[^\S\n\r]/);default:return g(S)}})(r)||{invalidReason:Qk};return I.token=r,I}const Zk={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Xk(r,e,t){const{type:n,value:i}=r;if(n==="literal"){const f=/^\s+$/.test(i);return{literal:!f,val:f?" ":i}}const a=e[n];let u=n;n==="hour"&&(e.hour12!=null?u=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?u="hour12":u="hour24":u=t.hour12?"hour12":"hour24");let c=Zk[u];if(typeof c=="object"&&(c=c[a]),c)return{literal:!1,val:c}}function eA(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function tA(r,e,t){const n=r.match(e);if(n){const i={};let a=1;for(const u in t)if(sa(t,u)){const c=t[u],f=c.groups?c.groups+1:1;!c.literal&&c.token&&(i[c.token.val[0]]=c.deser(n.slice(a,a+f))),a+=f}return[n,i]}else return[n,{}]}function rA(r){const e=a=>{switch(a){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,n;return rt(r.z)||(t=bi.create(r.z)),rt(r.Z)||(t||(t=new Kr(r.Z)),n=r.Z),rt(r.q)||(r.M=(r.q-1)*3+1),rt(r.h)||(r.h<12&&r.a===1?r.h+=12:r.h===12&&r.a===0&&(r.h=0)),r.G===0&&r.y&&(r.y=-r.y),rt(r.u)||(r.S=sh(r.u)),[Object.keys(r).reduce((a,u)=>{const c=e(u);return c&&(a[c]=r[u]),a},{}),t,n]}let fh=null;function nA(){return fh||(fh=nt.fromMillis(1555555555555)),fh}function iA(r,e){if(r.literal)return r;const t=Wr.macroTokenToFormatOpts(r.val),n=y0(t,e);return n==null||n.includes(void 0)?r:n}function d0(r,e){return Array.prototype.concat(...r.map(t=>iA(t,e)))}class p0{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=d0(Wr.parseFormat(t),e),this.units=this.tokens.map(n=>Kk(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){const[n,i]=eA(this.units);this.regex=RegExp(n,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){const[t,n]=tA(e,this.regex,this.handlers),[i,a,u]=n?rA(n):[null,null,void 0];if(sa(n,"a")&&sa(n,"H"))throw new ia("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:i,zone:a,specificOffset:u}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function m0(r,e,t){return new p0(r,t).explainFromTokens(e)}function sA(r,e,t){const{result:n,zone:i,specificOffset:a,invalidReason:u}=m0(r,e,t);return[n,i,a,u]}function y0(r,e){if(!r)return null;const n=Wr.create(e,r).dtFormatter(nA()),i=n.formatToParts(),a=n.resolvedOptions();return i.map(u=>Xk(u,r,a))}const hh="Invalid DateTime",g0=864e13;function bo(r){return new Kn("unsupported zone",`the zone "${r.name}" is not supported`)}function dh(r){return r.weekData===null&&(r.weekData=Wu(r.c)),r.weekData}function ph(r){return r.localWeekData===null&&(r.localWeekData=Wu(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function Ns(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new nt({...t,...e,old:t})}function v0(r,e,t){let n=r-e*60*1e3;const i=t.offset(n);if(e===i)return[n,e];n-=(i-e)*60*1e3;const a=t.offset(n);return i===a?[n,i]:[r-Math.min(i,a)*60*1e3,Math.max(i,a)]}function Xu(r,e){r+=e*60*1e3;const t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function ec(r,e,t){return v0(Gu(r),e,t)}function b0(r,e){const t=r.o,n=r.c.year+Math.trunc(e.years),i=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,a={...r.c,year:n,month:i,day:Math.min(r.c.day,Hu(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},u=kt.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),c=Gu(a);let[f,h]=v0(c,t,r.zone);return u!==0&&(f+=u,h=r.zone.offset(f)),{ts:f,o:h}}function pa(r,e,t,n,i,a){const{setZone:u,zone:c}=t;if(r&&Object.keys(r).length!==0||e){const f=e||c,h=nt.fromObject(r,{...t,zone:f,specificOffset:a});return u?h:h.setZone(c)}else return nt.invalid(new Kn("unparsable",`the input "${i}" can't be parsed as ${n}`))}function tc(r,e,t=!0){return r.isValid?Wr.create(Ft.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function mh(r,e,t){const n=r.c.year>9999||r.c.year<0;let i="";if(n&&r.c.year>=0&&(i+="+"),i+=_r(r.c.year,n?6:4),t==="year")return i;if(e){if(i+="-",i+=_r(r.c.month),t==="month")return i;i+="-"}else if(i+=_r(r.c.month),t==="month")return i;return i+=_r(r.c.day),i}function w0(r,e,t,n,i,a,u){let c=!t||r.c.millisecond!==0||r.c.second!==0,f="";switch(u){case"day":case"month":case"year":break;default:if(f+=_r(r.c.hour),u==="hour")break;if(e){if(f+=":",f+=_r(r.c.minute),u==="minute")break;c&&(f+=":",f+=_r(r.c.second))}else{if(f+=_r(r.c.minute),u==="minute")break;c&&(f+=_r(r.c.second))}if(u==="second")break;c&&(!n||r.c.millisecond!==0)&&(f+=".",f+=_r(r.c.millisecond,3))}return i&&(r.isOffsetFixed&&r.offset===0&&!a?f+="Z":r.o<0?(f+="-",f+=_r(Math.trunc(-r.o/60)),f+=":",f+=_r(Math.trunc(-r.o%60))):(f+="+",f+=_r(Math.trunc(r.o/60)),f+=":",f+=_r(Math.trunc(r.o%60)))),a&&(f+="["+r.zone.ianaName+"]"),f}const _0={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},aA={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},oA={ordinal:1,hour:0,minute:0,second:0,millisecond:0},rc=["year","month","day","hour","minute","second","millisecond"],uA=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],cA=["year","ordinal","hour","minute","second","millisecond"];function nc(r){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new Jg(r);return e}function S0(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return nc(r)}}function lA(r){if(wo===void 0&&(wo=fr.now()),r.type!=="iana")return r.offset(wo);const e=r.name;let t=yh.get(e);return t===void 0&&(t=r.offset(wo),yh.set(e,t)),t}function x0(r,e){const t=es(e.zone,fr.defaultZone);if(!t.isValid)return nt.invalid(bo(t));const n=Ft.fromObject(e);let i,a;if(rt(r.year))i=fr.now();else{for(const f of rc)rt(r[f])&&(r[f]=_0[f]);const u=Mv(r)||Dv(r);if(u)return nt.invalid(u);const c=lA(t);[i,a]=ec(r,c,t)}return new nt({ts:i,zone:t,loc:n,o:a})}function E0(r,e,t){const n=rt(t.round)?!0:t.round,i=rt(t.rounding)?"trunc":t.rounding,a=(c,f)=>(c=ah(c,n||t.calendary?0:2,t.calendary?"round":i),e.loc.clone(t).relFormatter(t).format(c,f)),u=c=>t.calendary?e.hasSame(r,c)?0:e.startOf(c).diff(r.startOf(c),c).get(c):e.diff(r,c).get(c);if(t.unit)return a(u(t.unit),t.unit);for(const c of t.units){const f=u(c);if(Math.abs(f)>=1)return a(f,c)}return a(r>e?-0:0,t.units[t.units.length-1])}function O0(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}let wo;const yh=new Map;class nt{constructor(e){const t=e.zone||fr.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Kn("invalid input"):null)||(t.isValid?null:bo(t));this.ts=rt(e.ts)?fr.now():e.ts;let i=null,a=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[i,a]=[e.old.c,e.old.o];else{const c=ts(e.o)&&!e.old?e.o:t.offset(this.ts);i=Xu(this.ts,c),n=Number.isNaN(i.year)?new Kn("invalid input"):null,i=n?null:i,a=n?null:c}this._zone=t,this.loc=e.loc||Ft.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=a,this.isLuxonDateTime=!0}static now(){return new nt({})}static local(){const[e,t]=O0(arguments),[n,i,a,u,c,f,h]=t;return x0({year:n,month:i,day:a,hour:u,minute:c,second:f,millisecond:h},e)}static utc(){const[e,t]=O0(arguments),[n,i,a,u,c,f,h]=t;return e.zone=Kr.utcInstance,x0({year:n,month:i,day:a,hour:u,minute:c,second:f,millisecond:h},e)}static fromJSDate(e,t={}){const n=VT(e)?e.valueOf():NaN;if(Number.isNaN(n))return nt.invalid("invalid input");const i=es(t.zone,fr.defaultZone);return i.isValid?new nt({ts:n,zone:i,loc:Ft.fromObject(t)}):nt.invalid(bo(i))}static fromMillis(e,t={}){if(ts(e))return e<-g0||e>g0?nt.invalid("Timestamp out of range"):new nt({ts:e,zone:es(t.zone,fr.defaultZone),loc:Ft.fromObject(t)});throw new Vr(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(ts(e))return new nt({ts:e*1e3,zone:es(t.zone,fr.defaultZone),loc:Ft.fromObject(t)});throw new Vr("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=es(t.zone,fr.defaultZone);if(!n.isValid)return nt.invalid(bo(n));const i=Ft.fromObject(t),a=Ju(e,S0),{minDaysInFirstWeek:u,startOfWeek:c}=Rv(a,i),f=fr.now(),h=rt(t.specificOffset)?n.offset(f):t.specificOffset,p=!rt(a.ordinal),m=!rt(a.year),y=!rt(a.month)||!rt(a.day),g=m||y,b=a.weekYear||a.weekNumber;if((g||p)&&b)throw new ia("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(y&&p)throw new ia("Can't mix ordinal dates with month/day");const I=b||a.weekday&&!g;let S,w,O=Xu(f,h);I?(S=uA,w=aA,O=Wu(O,u,c)):p?(S=cA,w=oA,O=nh(O)):(S=rc,w=_0);let P=!1;for(const K of S){const oe=a[K];rt(oe)?P?a[K]=w[K]:a[K]=O[K]:P=!0}const D=I?UT(a,u,c):p?$T(a):Mv(a),T=D||Dv(a);if(T)return nt.invalid(T);const N=I?Pv(a,u,c):p?Nv(a):a,[G,q]=ec(N,h,n),$=new nt({ts:G,zone:n,o:q,loc:i});return a.weekday&&g&&e.weekday!==$.weekday?nt.invalid("mismatched weekday",`you can't specify both a weekday of ${a.weekday} and a date of ${$.toISO()}`):$.isValid?$:nt.invalid($.invalid)}static fromISO(e,t={}){const[n,i]=Nk(e);return pa(n,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,i]=Rk(e);return pa(n,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,i]=Mk(e);return pa(n,i,t,"HTTP",t)}static fromFormat(e,t,n={}){if(rt(e)||rt(t))throw new Vr("fromFormat requires an input string and a format");const{locale:i=null,numberingSystem:a=null}=n,u=Ft.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),[c,f,h,p]=sA(u,e,t);return p?nt.invalid(p):pa(c,f,n,`format ${t}`,e,h)}static fromString(e,t,n={}){return nt.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,i]=$k(e);return pa(n,i,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Vr("need to specify a reason the DateTime is invalid");const n=e instanceof Kn?e:new Kn(e,t);if(fr.throwOnInvalid)throw new pT(n);return new nt({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=y0(e,Ft.fromObject(t));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return d0(Wr.parseFormat(e),Ft.fromObject(t)).map(i=>i.val).join("")}static resetCache(){wo=void 0,yh.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?dh(this).weekYear:NaN}get weekNumber(){return this.isValid?dh(this).weekNumber:NaN}get weekday(){return this.isValid?dh(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?ph(this).weekday:NaN}get localWeekNumber(){return this.isValid?ph(this).weekNumber:NaN}get localWeekYear(){return this.isValid?ph(this).weekYear:NaN}get ordinal(){return this.isValid?nh(this.c).ordinal:NaN}get monthShort(){return this.isValid?Ku.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Ku.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Ku.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Ku.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,n=Gu(this.c),i=this.zone.offset(n-e),a=this.zone.offset(n+e),u=this.zone.offset(n-i*t),c=this.zone.offset(n-a*t);if(u===c)return[this];const f=n-u*t,h=n-c*t,p=Xu(f,u),m=Xu(h,c);return p.hour===m.hour&&p.minute===m.minute&&p.second===m.second&&p.millisecond===m.millisecond?[Ns(this,{ts:f}),Ns(this,{ts:h})]:[this]}get isInLeapYear(){return po(this.year)}get daysInMonth(){return Hu(this.year,this.month)}get daysInYear(){return this.isValid?aa(this.year):NaN}get weeksInWeekYear(){return this.isValid?mo(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?mo(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:i}=Wr.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:i}}toUTC(e=0,t={}){return this.setZone(Kr.instance(e),t)}toLocal(){return this.setZone(fr.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=es(e,fr.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(t||n){const a=e.offset(this.ts),u=this.toObject();[i]=ec(u,a,e)}return Ns(this,{ts:i,zone:e})}else return nt.invalid(bo(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){const i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return Ns(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Ju(e,S0),{minDaysInFirstWeek:n,startOfWeek:i}=Rv(t,this.loc),a=!rt(t.weekYear)||!rt(t.weekNumber)||!rt(t.weekday),u=!rt(t.ordinal),c=!rt(t.year),f=!rt(t.month)||!rt(t.day),h=c||f,p=t.weekYear||t.weekNumber;if((h||u)&&p)throw new ia("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&u)throw new ia("Can't mix ordinal dates with month/day");let m;a?m=Pv({...Wu(this.c,n,i),...t},n,i):rt(t.ordinal)?(m={...this.toObject(),...t},rt(t.day)&&(m.day=Math.min(Hu(m.year,m.month),m.day))):m=Nv({...nh(this.c),...t});const[y,g]=ec(m,this.o,this.zone);return Ns(this,{ts:y,o:g})}plus(e){if(!this.isValid)return this;const t=kt.fromDurationLike(e);return Ns(this,b0(this,t))}minus(e){if(!this.isValid)return this;const t=kt.fromDurationLike(e).negate();return Ns(this,b0(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},i=kt.normalizeUnit(e);switch(i){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(i==="weeks")if(t){const a=this.loc.getStartOfWeek(),{weekday:u}=this;u<a&&(n.weekNumber=this.weekNumber-1),n.weekday=a}else n.weekday=1;if(i==="quarters"){const a=Math.ceil(this.month/3);n.month=(a-1)*3+1}return this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?Wr.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):hh}toLocaleString(e=$u,t={}){return this.isValid?Wr.create(this.loc.clone(t),e).formatDateTime(this):hh}toLocaleParts(e={}){return this.isValid?Wr.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:a=!1,precision:u="milliseconds"}={}){if(!this.isValid)return null;u=nc(u);const c=e==="extended";let f=mh(this,c,u);return rc.indexOf(u)>=3&&(f+="T"),f+=w0(this,c,t,n,i,a,u),f}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?mh(this,e==="extended",nc(t)):null}toISOWeekDate(){return tc(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:a=!1,format:u="extended",precision:c="milliseconds"}={}){return this.isValid?(c=nc(c),(i&&rc.indexOf(c)>=3?"T":"")+w0(this,u==="extended",t,e,n,a,c)):null}toRFC2822(){return tc(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return tc(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?mh(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(t||e)&&(n&&(i+=" "),t?i+="z":e&&(i+="ZZ")),tc(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():hh}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return kt.invalid("created by diffing an invalid DateTime");const i={locale:this.locale,numberingSystem:this.numberingSystem,...n},a=WT(t).map(kt.normalizeUnit),u=e.valueOf()>this.valueOf(),c=u?this:e,f=u?e:this,h=Gk(c,f,a,i);return u?h.negate():h}diffNow(e="milliseconds",t={}){return this.diff(nt.now(),e,t)}until(e){return this.isValid?hr.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;const i=e.valueOf(),a=this.setZone(e.zone,{keepLocalTime:!0});return a.startOf(t,n)<=i&&i<=a.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||nt.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0;let i=["years","months","days","hours","minutes","seconds"],a=e.unit;return Array.isArray(e.unit)&&(i=e.unit,a=void 0),E0(t,this.plus(n),{...e,numeric:"always",units:i,unit:a})}toRelativeCalendar(e={}){return this.isValid?E0(e.base||nt.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(nt.isDateTime))throw new Vr("min requires all arguments be DateTimes");return qv(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(nt.isDateTime))throw new Vr("max requires all arguments be DateTimes");return qv(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:i=null,numberingSystem:a=null}=n,u=Ft.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});return m0(u,e,t)}static fromStringExplain(e,t,n={}){return nt.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:i=null}=t,a=Ft.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return new p0(a,e)}static fromFormatParser(e,t,n={}){if(rt(e)||rt(t))throw new Vr("fromFormatParser requires an input string and a format parser");const{locale:i=null,numberingSystem:a=null}=n,u=Ft.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});if(!u.equals(t.locale))throw new Vr(`fromFormatParser called with a locale of ${u}, but the format parser was created for ${t.locale}`);const{result:c,zone:f,specificOffset:h,invalidReason:p}=t.explainFromTokens(e);return p?nt.invalid(p):pa(c,f,n,`format ${t.format}`,e,h)}static get DATE_SHORT(){return $u}static get DATE_MED(){return Yg}static get DATE_MED_WITH_WEEKDAY(){return gT}static get DATE_FULL(){return Kg}static get DATE_HUGE(){return Zg}static get TIME_SIMPLE(){return Xg}static get TIME_WITH_SECONDS(){return ev}static get TIME_WITH_SHORT_OFFSET(){return tv}static get TIME_WITH_LONG_OFFSET(){return rv}static get TIME_24_SIMPLE(){return nv}static get TIME_24_WITH_SECONDS(){return iv}static get TIME_24_WITH_SHORT_OFFSET(){return sv}static get TIME_24_WITH_LONG_OFFSET(){return av}static get DATETIME_SHORT(){return ov}static get DATETIME_SHORT_WITH_SECONDS(){return uv}static get DATETIME_MED(){return cv}static get DATETIME_MED_WITH_SECONDS(){return lv}static get DATETIME_MED_WITH_WEEKDAY(){return vT}static get DATETIME_FULL(){return fv}static get DATETIME_FULL_WITH_SECONDS(){return hv}static get DATETIME_HUGE(){return dv}static get DATETIME_HUGE_WITH_SECONDS(){return pv}}function _o(r){if(nt.isDateTime(r))return r;if(r&&r.valueOf&&ts(r.valueOf()))return nt.fromJSDate(r);if(r&&typeof r=="object")return nt.fromObject(r);throw new Vr(`Unknown datetime argument: ${r}, of type ${typeof r}`)}var So={exports:{}};/**
|
|
87
87
|
* @license
|
|
88
88
|
* Lodash <https://lodash.com/>
|
|
89
89
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
90
90
|
* Released under MIT license <https://lodash.com/license>
|
|
91
91
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
92
92
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
93
|
-
*/Xu.exports,function(r,e){(function(){var t,n="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",u="Expected a function",c="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,d="__lodash_placeholder__",y=1,g=2,m=4,b=1,I=2,x=1,_=2,A=4,P=8,M=16,$=32,j=64,K=128,ee=256,fe=512,de=30,Ie="...",pe=800,Ce=16,Pe=1,ge=2,We=3,ke=1/0,X=9007199254740991,ye=17976931348623157e292,xe=NaN,Se=4294967295,Be=Se-1,Ke=Se>>>1,Et=[["ary",K],["bind",x],["bindKey",_],["curry",P],["curryRight",M],["flip",fe],["partial",$],["partialRight",j],["rearg",ee]],Tt="[object Arguments]",Ze="[object Array]",Je="[object AsyncFunction]",vt="[object Boolean]",De="[object Date]",Ge="[object DOMException]",V="[object Error]",Q="[object Function]",q="[object GeneratorFunction]",J="[object Map]",te="[object Number]",W="[object Null]",_e="[object Object]",ze="[object Promise]",$e="[object Proxy]",se="[object RegExp]",we="[object Set]",Qe="[object String]",mt="[object Symbol]",yt="[object Undefined]",Yt="[object WeakMap]",At="[object WeakSet]",Wt="[object ArrayBuffer]",Gt="[object DataView]",Er="[object Float32Array]",zt="[object Float64Array]",sr="[object Int8Array]",dr="[object Int16Array]",Ar="[object Int32Array]",Ht="[object Uint8Array]",H="[object Uint8ClampedArray]",G="[object Uint16Array]",at="[object Uint32Array]",wt=/\b__p \+= '';/g,ft=/\b(__p \+=) '' \+/g,He=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Kt=/&(?:amp|lt|gt|quot|#39);/g,Zt=/[&<>"']/g,Qt=RegExp(Kt.source),kr=RegExp(Zt.source),Hr=/<%-([\s\S]+?)%>/g,Fr=/<%([\s\S]+?)%>/g,Ut=/<%=([\s\S]+?)%>/g,Or=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$r=/^\w*$/,Lr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ar=/[\\^$.*+?()[\]{}|]/g,Gr=RegExp(ar.source),Tr=/^\s+/,gr=/\s/,Ir=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Sn=/\{\n\/\* \[wrapped with (.+)\] \*/,Un=/,? & /,R=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oe=/[()=,{}\[\]\/\s]/,ve=/\\(\\)?/g,Ne=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ve=/\w*$/,ct=/^[-+]0x[0-9a-f]+$/i,Xe=/^0b[01]+$/i,rt=/^\[object .+?Constructor\]$/,nt=/^0o[0-7]+$/i,bt=/^(?:0|[1-9]\d*)$/,w=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,k=/($^)/,T=/['\n\r\u2028\u2029\\]/g,C="\\ud800-\\udfff",D="\\u0300-\\u036f",B="\\ufe20-\\ufe2f",ie="\\u20d0-\\u20ff",he=D+B+ie,Y="\\u2700-\\u27bf",ne="a-z\\xdf-\\xf6\\xf8-\\xff",Le="\\xac\\xb1\\xd7\\xf7",_t="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",tr="\\u2000-\\u206f",En=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ki="A-Z\\xc0-\\xd6\\xd8-\\xde",Nw="\\ufe0e\\ufe0f",Rw=Le+_t+tr+En,qd="['’]",$P="["+C+"]",Mw="["+Rw+"]",_c="["+he+"]",Dw="\\d+",BP="["+Y+"]",Fw="["+ne+"]",Lw="[^"+C+Rw+Dw+Y+ne+ki+"]",jd="\\ud83c[\\udffb-\\udfff]",VP="(?:"+_c+"|"+jd+")",qw="[^"+C+"]",Ud="(?:\\ud83c[\\udde6-\\uddff]){2}",$d="[\\ud800-\\udbff][\\udc00-\\udfff]",Oa="["+ki+"]",jw="\\u200d",Uw="(?:"+Fw+"|"+Lw+")",WP="(?:"+Oa+"|"+Lw+")",$w="(?:"+qd+"(?:d|ll|m|re|s|t|ve))?",Bw="(?:"+qd+"(?:D|LL|M|RE|S|T|VE))?",Vw=VP+"?",Ww="["+Nw+"]?",zP="(?:"+jw+"(?:"+[qw,Ud,$d].join("|")+")"+Ww+Vw+")*",HP="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",GP="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",zw=Ww+Vw+zP,QP="(?:"+[BP,Ud,$d].join("|")+")"+zw,JP="(?:"+[qw+_c+"?",_c,Ud,$d,$P].join("|")+")",YP=RegExp(qd,"g"),KP=RegExp(_c,"g"),Bd=RegExp(jd+"(?="+jd+")|"+JP+zw,"g"),ZP=RegExp([Oa+"?"+Fw+"+"+$w+"(?="+[Mw,Oa,"$"].join("|")+")",WP+"+"+Bw+"(?="+[Mw,Oa+Uw,"$"].join("|")+")",Oa+"?"+Uw+"+"+$w,Oa+"+"+Bw,GP,HP,Dw,QP].join("|"),"g"),XP=RegExp("["+jw+C+he+Nw+"]"),eN=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,tN=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rN=-1,rr={};rr[Er]=rr[zt]=rr[sr]=rr[dr]=rr[Ar]=rr[Ht]=rr[H]=rr[G]=rr[at]=!0,rr[Tt]=rr[Ze]=rr[Wt]=rr[vt]=rr[Gt]=rr[De]=rr[V]=rr[Q]=rr[J]=rr[te]=rr[_e]=rr[se]=rr[we]=rr[Qe]=rr[Yt]=!1;var Xt={};Xt[Tt]=Xt[Ze]=Xt[Wt]=Xt[Gt]=Xt[vt]=Xt[De]=Xt[Er]=Xt[zt]=Xt[sr]=Xt[dr]=Xt[Ar]=Xt[J]=Xt[te]=Xt[_e]=Xt[se]=Xt[we]=Xt[Qe]=Xt[mt]=Xt[Ht]=Xt[H]=Xt[G]=Xt[at]=!0,Xt[V]=Xt[Q]=Xt[Yt]=!1;var nN={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},iN={"&":"&","<":"<",">":">",'"':""","'":"'"},sN={"&":"&","<":"<",">":">",""":'"',"'":"'"},aN={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},oN=parseFloat,uN=parseInt,Hw=typeof pi=="object"&&pi&&pi.Object===Object&&pi,cN=typeof self=="object"&&self&&self.Object===Object&&self,Br=Hw||cN||Function("return this")(),Vd=e&&!e.nodeType&&e,Ns=Vd&&!0&&r&&!r.nodeType&&r,Gw=Ns&&Ns.exports===Vd,Wd=Gw&&Hw.process,$n=function(){try{var U=Ns&&Ns.require&&Ns.require("util").types;return U||Wd&&Wd.binding&&Wd.binding("util")}catch{}}(),Qw=$n&&$n.isArrayBuffer,Jw=$n&&$n.isDate,Yw=$n&&$n.isMap,Kw=$n&&$n.isRegExp,Zw=$n&&$n.isSet,Xw=$n&&$n.isTypedArray;function On(U,re,Z){switch(Z.length){case 0:return U.call(re);case 1:return U.call(re,Z[0]);case 2:return U.call(re,Z[0],Z[1]);case 3:return U.call(re,Z[0],Z[1],Z[2])}return U.apply(re,Z)}function lN(U,re,Z,Me){for(var ot=-1,Dt=U==null?0:U.length;++ot<Dt;){var Cr=U[ot];re(Me,Cr,Z(Cr),U)}return Me}function Bn(U,re){for(var Z=-1,Me=U==null?0:U.length;++Z<Me&&re(U[Z],Z,U)!==!1;);return U}function fN(U,re){for(var Z=U==null?0:U.length;Z--&&re(U[Z],Z,U)!==!1;);return U}function e_(U,re){for(var Z=-1,Me=U==null?0:U.length;++Z<Me;)if(!re(U[Z],Z,U))return!1;return!0}function as(U,re){for(var Z=-1,Me=U==null?0:U.length,ot=0,Dt=[];++Z<Me;){var Cr=U[Z];re(Cr,Z,U)&&(Dt[ot++]=Cr)}return Dt}function xc(U,re){var Z=U==null?0:U.length;return!!Z&&Ta(U,re,0)>-1}function zd(U,re,Z){for(var Me=-1,ot=U==null?0:U.length;++Me<ot;)if(Z(re,U[Me]))return!0;return!1}function or(U,re){for(var Z=-1,Me=U==null?0:U.length,ot=Array(Me);++Z<Me;)ot[Z]=re(U[Z],Z,U);return ot}function os(U,re){for(var Z=-1,Me=re.length,ot=U.length;++Z<Me;)U[ot+Z]=re[Z];return U}function Hd(U,re,Z,Me){var ot=-1,Dt=U==null?0:U.length;for(Me&&Dt&&(Z=U[++ot]);++ot<Dt;)Z=re(Z,U[ot],ot,U);return Z}function hN(U,re,Z,Me){var ot=U==null?0:U.length;for(Me&&ot&&(Z=U[--ot]);ot--;)Z=re(Z,U[ot],ot,U);return Z}function Gd(U,re){for(var Z=-1,Me=U==null?0:U.length;++Z<Me;)if(re(U[Z],Z,U))return!0;return!1}var dN=Qd("length");function pN(U){return U.split("")}function mN(U){return U.match(R)||[]}function t_(U,re,Z){var Me;return Z(U,function(ot,Dt,Cr){if(re(ot,Dt,Cr))return Me=Dt,!1}),Me}function Sc(U,re,Z,Me){for(var ot=U.length,Dt=Z+(Me?1:-1);Me?Dt--:++Dt<ot;)if(re(U[Dt],Dt,U))return Dt;return-1}function Ta(U,re,Z){return re===re?AN(U,re,Z):Sc(U,r_,Z)}function yN(U,re,Z,Me){for(var ot=Z-1,Dt=U.length;++ot<Dt;)if(Me(U[ot],re))return ot;return-1}function r_(U){return U!==U}function n_(U,re){var Z=U==null?0:U.length;return Z?Yd(U,re)/Z:xe}function Qd(U){return function(re){return re==null?t:re[U]}}function Jd(U){return function(re){return U==null?t:U[re]}}function i_(U,re,Z,Me,ot){return ot(U,function(Dt,Cr,Jt){Z=Me?(Me=!1,Dt):re(Z,Dt,Cr,Jt)}),Z}function gN(U,re){var Z=U.length;for(U.sort(re);Z--;)U[Z]=U[Z].value;return U}function Yd(U,re){for(var Z,Me=-1,ot=U.length;++Me<ot;){var Dt=re(U[Me]);Dt!==t&&(Z=Z===t?Dt:Z+Dt)}return Z}function Kd(U,re){for(var Z=-1,Me=Array(U);++Z<U;)Me[Z]=re(Z);return Me}function vN(U,re){return or(re,function(Z){return[Z,U[Z]]})}function s_(U){return U&&U.slice(0,c_(U)+1).replace(Tr,"")}function Tn(U){return function(re){return U(re)}}function Zd(U,re){return or(re,function(Z){return U[Z]})}function Lo(U,re){return U.has(re)}function a_(U,re){for(var Z=-1,Me=U.length;++Z<Me&&Ta(re,U[Z],0)>-1;);return Z}function o_(U,re){for(var Z=U.length;Z--&&Ta(re,U[Z],0)>-1;);return Z}function bN(U,re){for(var Z=U.length,Me=0;Z--;)U[Z]===re&&++Me;return Me}var wN=Jd(nN),_N=Jd(iN);function xN(U){return"\\"+aN[U]}function SN(U,re){return U==null?t:U[re]}function Aa(U){return XP.test(U)}function EN(U){return eN.test(U)}function ON(U){for(var re,Z=[];!(re=U.next()).done;)Z.push(re.value);return Z}function Xd(U){var re=-1,Z=Array(U.size);return U.forEach(function(Me,ot){Z[++re]=[ot,Me]}),Z}function u_(U,re){return function(Z){return U(re(Z))}}function us(U,re){for(var Z=-1,Me=U.length,ot=0,Dt=[];++Z<Me;){var Cr=U[Z];(Cr===re||Cr===d)&&(U[Z]=d,Dt[ot++]=Z)}return Dt}function Ec(U){var re=-1,Z=Array(U.size);return U.forEach(function(Me){Z[++re]=Me}),Z}function TN(U){var re=-1,Z=Array(U.size);return U.forEach(function(Me){Z[++re]=[Me,Me]}),Z}function AN(U,re,Z){for(var Me=Z-1,ot=U.length;++Me<ot;)if(U[Me]===re)return Me;return-1}function kN(U,re,Z){for(var Me=Z+1;Me--;)if(U[Me]===re)return Me;return Me}function ka(U){return Aa(U)?CN(U):dN(U)}function ii(U){return Aa(U)?PN(U):pN(U)}function c_(U){for(var re=U.length;re--&&gr.test(U.charAt(re)););return re}var IN=Jd(sN);function CN(U){for(var re=Bd.lastIndex=0;Bd.test(U);)++re;return re}function PN(U){return U.match(Bd)||[]}function NN(U){return U.match(ZP)||[]}var RN=function U(re){re=re==null?Br:Ia.defaults(Br.Object(),re,Ia.pick(Br,tN));var Z=re.Array,Me=re.Date,ot=re.Error,Dt=re.Function,Cr=re.Math,Jt=re.Object,ep=re.RegExp,MN=re.String,Vn=re.TypeError,Oc=Z.prototype,DN=Dt.prototype,Ca=Jt.prototype,Tc=re["__core-js_shared__"],Ac=DN.toString,$t=Ca.hasOwnProperty,FN=0,l_=function(){var s=/[^.]+$/.exec(Tc&&Tc.keys&&Tc.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),kc=Ca.toString,LN=Ac.call(Jt),qN=Br._,jN=ep("^"+Ac.call($t).replace(ar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ic=Gw?re.Buffer:t,cs=re.Symbol,Cc=re.Uint8Array,f_=Ic?Ic.allocUnsafe:t,Pc=u_(Jt.getPrototypeOf,Jt),h_=Jt.create,d_=Ca.propertyIsEnumerable,Nc=Oc.splice,p_=cs?cs.isConcatSpreadable:t,qo=cs?cs.iterator:t,Rs=cs?cs.toStringTag:t,Rc=function(){try{var s=qs(Jt,"defineProperty");return s({},"",{}),s}catch{}}(),UN=re.clearTimeout!==Br.clearTimeout&&re.clearTimeout,$N=Me&&Me.now!==Br.Date.now&&Me.now,BN=re.setTimeout!==Br.setTimeout&&re.setTimeout,Mc=Cr.ceil,Dc=Cr.floor,tp=Jt.getOwnPropertySymbols,VN=Ic?Ic.isBuffer:t,m_=re.isFinite,WN=Oc.join,zN=u_(Jt.keys,Jt),Pr=Cr.max,Qr=Cr.min,HN=Me.now,GN=re.parseInt,y_=Cr.random,QN=Oc.reverse,rp=qs(re,"DataView"),jo=qs(re,"Map"),np=qs(re,"Promise"),Pa=qs(re,"Set"),Uo=qs(re,"WeakMap"),$o=qs(Jt,"create"),Fc=Uo&&new Uo,Na={},JN=js(rp),YN=js(jo),KN=js(np),ZN=js(Pa),XN=js(Uo),Lc=cs?cs.prototype:t,Bo=Lc?Lc.valueOf:t,g_=Lc?Lc.toString:t;function S(s){if(pr(s)&&!ut(s)&&!(s instanceof Ot)){if(s instanceof Wn)return s;if($t.call(s,"__wrapped__"))return vx(s)}return new Wn(s)}var Ra=function(){function s(){}return function(o){if(!lr(o))return{};if(h_)return h_(o);s.prototype=o;var l=new s;return s.prototype=t,l}}();function qc(){}function Wn(s,o){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=t}S.templateSettings={escape:Hr,evaluate:Fr,interpolate:Ut,variable:"",imports:{_:S}},S.prototype=qc.prototype,S.prototype.constructor=S,Wn.prototype=Ra(qc.prototype),Wn.prototype.constructor=Wn;function Ot(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Se,this.__views__=[]}function eR(){var s=new Ot(this.__wrapped__);return s.__actions__=ln(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=ln(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=ln(this.__views__),s}function tR(){if(this.__filtered__){var s=new Ot(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function rR(){var s=this.__wrapped__.value(),o=this.__dir__,l=ut(s),p=o<0,v=l?s.length:0,O=pM(0,v,this.__views__),N=O.start,F=O.end,z=F-N,ae=p?F:N-1,ue=this.__iteratees__,me=ue.length,Ae=0,Ue=Qr(z,this.__takeCount__);if(!l||!p&&v==z&&Ue==z)return $_(s,this.__actions__);var et=[];e:for(;z--&&Ae<Ue;){ae+=o;for(var pt=-1,tt=s[ae];++pt<me;){var xt=ue[pt],kt=xt.iteratee,In=xt.type,an=kt(tt);if(In==ge)tt=an;else if(!an){if(In==Pe)continue e;break e}}et[Ae++]=tt}return et}Ot.prototype=Ra(qc.prototype),Ot.prototype.constructor=Ot;function Ms(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function nR(){this.__data__=$o?$o(null):{},this.size=0}function iR(s){var o=this.has(s)&&delete this.__data__[s];return this.size-=o?1:0,o}function sR(s){var o=this.__data__;if($o){var l=o[s];return l===f?t:l}return $t.call(o,s)?o[s]:t}function aR(s){var o=this.__data__;return $o?o[s]!==t:$t.call(o,s)}function oR(s,o){var l=this.__data__;return this.size+=this.has(s)?0:1,l[s]=$o&&o===t?f:o,this}Ms.prototype.clear=nR,Ms.prototype.delete=iR,Ms.prototype.get=sR,Ms.prototype.has=aR,Ms.prototype.set=oR;function Ii(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function uR(){this.__data__=[],this.size=0}function cR(s){var o=this.__data__,l=jc(o,s);if(l<0)return!1;var p=o.length-1;return l==p?o.pop():Nc.call(o,l,1),--this.size,!0}function lR(s){var o=this.__data__,l=jc(o,s);return l<0?t:o[l][1]}function fR(s){return jc(this.__data__,s)>-1}function hR(s,o){var l=this.__data__,p=jc(l,s);return p<0?(++this.size,l.push([s,o])):l[p][1]=o,this}Ii.prototype.clear=uR,Ii.prototype.delete=cR,Ii.prototype.get=lR,Ii.prototype.has=fR,Ii.prototype.set=hR;function Ci(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function dR(){this.size=0,this.__data__={hash:new Ms,map:new(jo||Ii),string:new Ms}}function pR(s){var o=Kc(this,s).delete(s);return this.size-=o?1:0,o}function mR(s){return Kc(this,s).get(s)}function yR(s){return Kc(this,s).has(s)}function gR(s,o){var l=Kc(this,s),p=l.size;return l.set(s,o),this.size+=l.size==p?0:1,this}Ci.prototype.clear=dR,Ci.prototype.delete=pR,Ci.prototype.get=mR,Ci.prototype.has=yR,Ci.prototype.set=gR;function Ds(s){var o=-1,l=s==null?0:s.length;for(this.__data__=new Ci;++o<l;)this.add(s[o])}function vR(s){return this.__data__.set(s,f),this}function bR(s){return this.__data__.has(s)}Ds.prototype.add=Ds.prototype.push=vR,Ds.prototype.has=bR;function si(s){var o=this.__data__=new Ii(s);this.size=o.size}function wR(){this.__data__=new Ii,this.size=0}function _R(s){var o=this.__data__,l=o.delete(s);return this.size=o.size,l}function xR(s){return this.__data__.get(s)}function SR(s){return this.__data__.has(s)}function ER(s,o){var l=this.__data__;if(l instanceof Ii){var p=l.__data__;if(!jo||p.length<i-1)return p.push([s,o]),this.size=++l.size,this;l=this.__data__=new Ci(p)}return l.set(s,o),this.size=l.size,this}si.prototype.clear=wR,si.prototype.delete=_R,si.prototype.get=xR,si.prototype.has=SR,si.prototype.set=ER;function v_(s,o){var l=ut(s),p=!l&&Us(s),v=!l&&!p&&ps(s),O=!l&&!p&&!v&&La(s),N=l||p||v||O,F=N?Kd(s.length,MN):[],z=F.length;for(var ae in s)(o||$t.call(s,ae))&&!(N&&(ae=="length"||v&&(ae=="offset"||ae=="parent")||O&&(ae=="buffer"||ae=="byteLength"||ae=="byteOffset")||Mi(ae,z)))&&F.push(ae);return F}function b_(s){var o=s.length;return o?s[pp(0,o-1)]:t}function OR(s,o){return Zc(ln(s),Fs(o,0,s.length))}function TR(s){return Zc(ln(s))}function ip(s,o,l){(l!==t&&!ai(s[o],l)||l===t&&!(o in s))&&Pi(s,o,l)}function Vo(s,o,l){var p=s[o];(!($t.call(s,o)&&ai(p,l))||l===t&&!(o in s))&&Pi(s,o,l)}function jc(s,o){for(var l=s.length;l--;)if(ai(s[l][0],o))return l;return-1}function AR(s,o,l,p){return ls(s,function(v,O,N){o(p,v,l(v),N)}),p}function w_(s,o){return s&&hi(o,qr(o),s)}function kR(s,o){return s&&hi(o,hn(o),s)}function Pi(s,o,l){o=="__proto__"&&Rc?Rc(s,o,{configurable:!0,enumerable:!0,value:l,writable:!0}):s[o]=l}function sp(s,o){for(var l=-1,p=o.length,v=Z(p),O=s==null;++l<p;)v[l]=O?t:jp(s,o[l]);return v}function Fs(s,o,l){return s===s&&(l!==t&&(s=s<=l?s:l),o!==t&&(s=s>=o?s:o)),s}function zn(s,o,l,p,v,O){var N,F=o&y,z=o&g,ae=o&m;if(l&&(N=v?l(s,p,v,O):l(s)),N!==t)return N;if(!lr(s))return s;var ue=ut(s);if(ue){if(N=yM(s),!F)return ln(s,N)}else{var me=Jr(s),Ae=me==Q||me==q;if(ps(s))return W_(s,F);if(me==_e||me==Tt||Ae&&!v){if(N=z||Ae?{}:cx(s),!F)return z?sM(s,kR(N,s)):iM(s,w_(N,s))}else{if(!Xt[me])return v?s:{};N=gM(s,me,F)}}O||(O=new si);var Ue=O.get(s);if(Ue)return Ue;O.set(s,N),qx(s)?s.forEach(function(tt){N.add(zn(tt,o,l,tt,s,O))}):Fx(s)&&s.forEach(function(tt,xt){N.set(xt,zn(tt,o,l,xt,s,O))});var et=ae?z?Op:Ep:z?hn:qr,pt=ue?t:et(s);return Bn(pt||s,function(tt,xt){pt&&(xt=tt,tt=s[xt]),Vo(N,xt,zn(tt,o,l,xt,s,O))}),N}function IR(s){var o=qr(s);return function(l){return __(l,s,o)}}function __(s,o,l){var p=l.length;if(s==null)return!p;for(s=Jt(s);p--;){var v=l[p],O=o[v],N=s[v];if(N===t&&!(v in s)||!O(N))return!1}return!0}function x_(s,o,l){if(typeof s!="function")throw new Vn(u);return Yo(function(){s.apply(t,l)},o)}function Wo(s,o,l,p){var v=-1,O=xc,N=!0,F=s.length,z=[],ae=o.length;if(!F)return z;l&&(o=or(o,Tn(l))),p?(O=zd,N=!1):o.length>=i&&(O=Lo,N=!1,o=new Ds(o));e:for(;++v<F;){var ue=s[v],me=l==null?ue:l(ue);if(ue=p||ue!==0?ue:0,N&&me===me){for(var Ae=ae;Ae--;)if(o[Ae]===me)continue e;z.push(ue)}else O(o,me,p)||z.push(ue)}return z}var ls=J_(fi),S_=J_(op,!0);function CR(s,o){var l=!0;return ls(s,function(p,v,O){return l=!!o(p,v,O),l}),l}function Uc(s,o,l){for(var p=-1,v=s.length;++p<v;){var O=s[p],N=o(O);if(N!=null&&(F===t?N===N&&!kn(N):l(N,F)))var F=N,z=O}return z}function PR(s,o,l,p){var v=s.length;for(l=ht(l),l<0&&(l=-l>v?0:v+l),p=p===t||p>v?v:ht(p),p<0&&(p+=v),p=l>p?0:Ux(p);l<p;)s[l++]=o;return s}function E_(s,o){var l=[];return ls(s,function(p,v,O){o(p,v,O)&&l.push(p)}),l}function Vr(s,o,l,p,v){var O=-1,N=s.length;for(l||(l=bM),v||(v=[]);++O<N;){var F=s[O];o>0&&l(F)?o>1?Vr(F,o-1,l,p,v):os(v,F):p||(v[v.length]=F)}return v}var ap=Y_(),O_=Y_(!0);function fi(s,o){return s&&ap(s,o,qr)}function op(s,o){return s&&O_(s,o,qr)}function $c(s,o){return as(o,function(l){return Di(s[l])})}function Ls(s,o){o=hs(o,s);for(var l=0,p=o.length;s!=null&&l<p;)s=s[di(o[l++])];return l&&l==p?s:t}function T_(s,o,l){var p=o(s);return ut(s)?p:os(p,l(s))}function nn(s){return s==null?s===t?yt:W:Rs&&Rs in Jt(s)?dM(s):TM(s)}function up(s,o){return s>o}function NR(s,o){return s!=null&&$t.call(s,o)}function RR(s,o){return s!=null&&o in Jt(s)}function MR(s,o,l){return s>=Qr(o,l)&&s<Pr(o,l)}function cp(s,o,l){for(var p=l?zd:xc,v=s[0].length,O=s.length,N=O,F=Z(O),z=1/0,ae=[];N--;){var ue=s[N];N&&o&&(ue=or(ue,Tn(o))),z=Qr(ue.length,z),F[N]=!l&&(o||v>=120&&ue.length>=120)?new Ds(N&&ue):t}ue=s[0];var me=-1,Ae=F[0];e:for(;++me<v&&ae.length<z;){var Ue=ue[me],et=o?o(Ue):Ue;if(Ue=l||Ue!==0?Ue:0,!(Ae?Lo(Ae,et):p(ae,et,l))){for(N=O;--N;){var pt=F[N];if(!(pt?Lo(pt,et):p(s[N],et,l)))continue e}Ae&&Ae.push(et),ae.push(Ue)}}return ae}function DR(s,o,l,p){return fi(s,function(v,O,N){o(p,l(v),O,N)}),p}function zo(s,o,l){o=hs(o,s),s=dx(s,o);var p=s==null?s:s[di(Gn(o))];return p==null?t:On(p,s,l)}function A_(s){return pr(s)&&nn(s)==Tt}function FR(s){return pr(s)&&nn(s)==Wt}function LR(s){return pr(s)&&nn(s)==De}function Ho(s,o,l,p,v){return s===o?!0:s==null||o==null||!pr(s)&&!pr(o)?s!==s&&o!==o:qR(s,o,l,p,Ho,v)}function qR(s,o,l,p,v,O){var N=ut(s),F=ut(o),z=N?Ze:Jr(s),ae=F?Ze:Jr(o);z=z==Tt?_e:z,ae=ae==Tt?_e:ae;var ue=z==_e,me=ae==_e,Ae=z==ae;if(Ae&&ps(s)){if(!ps(o))return!1;N=!0,ue=!1}if(Ae&&!ue)return O||(O=new si),N||La(s)?ax(s,o,l,p,v,O):fM(s,o,z,l,p,v,O);if(!(l&b)){var Ue=ue&&$t.call(s,"__wrapped__"),et=me&&$t.call(o,"__wrapped__");if(Ue||et){var pt=Ue?s.value():s,tt=et?o.value():o;return O||(O=new si),v(pt,tt,l,p,O)}}return Ae?(O||(O=new si),hM(s,o,l,p,v,O)):!1}function jR(s){return pr(s)&&Jr(s)==J}function lp(s,o,l,p){var v=l.length,O=v,N=!p;if(s==null)return!O;for(s=Jt(s);v--;){var F=l[v];if(N&&F[2]?F[1]!==s[F[0]]:!(F[0]in s))return!1}for(;++v<O;){F=l[v];var z=F[0],ae=s[z],ue=F[1];if(N&&F[2]){if(ae===t&&!(z in s))return!1}else{var me=new si;if(p)var Ae=p(ae,ue,z,s,o,me);if(!(Ae===t?Ho(ue,ae,b|I,p,me):Ae))return!1}}return!0}function k_(s){if(!lr(s)||_M(s))return!1;var o=Di(s)?jN:rt;return o.test(js(s))}function UR(s){return pr(s)&&nn(s)==se}function $R(s){return pr(s)&&Jr(s)==we}function BR(s){return pr(s)&&il(s.length)&&!!rr[nn(s)]}function I_(s){return typeof s=="function"?s:s==null?dn:typeof s=="object"?ut(s)?N_(s[0],s[1]):P_(s):Kx(s)}function fp(s){if(!Jo(s))return zN(s);var o=[];for(var l in Jt(s))$t.call(s,l)&&l!="constructor"&&o.push(l);return o}function VR(s){if(!lr(s))return OM(s);var o=Jo(s),l=[];for(var p in s)p=="constructor"&&(o||!$t.call(s,p))||l.push(p);return l}function hp(s,o){return s<o}function C_(s,o){var l=-1,p=fn(s)?Z(s.length):[];return ls(s,function(v,O,N){p[++l]=o(v,O,N)}),p}function P_(s){var o=Ap(s);return o.length==1&&o[0][2]?fx(o[0][0],o[0][1]):function(l){return l===s||lp(l,s,o)}}function N_(s,o){return Ip(s)&&lx(o)?fx(di(s),o):function(l){var p=jp(l,s);return p===t&&p===o?Up(l,s):Ho(o,p,b|I)}}function Bc(s,o,l,p,v){s!==o&&ap(o,function(O,N){if(v||(v=new si),lr(O))WR(s,o,N,l,Bc,p,v);else{var F=p?p(Pp(s,N),O,N+"",s,o,v):t;F===t&&(F=O),ip(s,N,F)}},hn)}function WR(s,o,l,p,v,O,N){var F=Pp(s,l),z=Pp(o,l),ae=N.get(z);if(ae){ip(s,l,ae);return}var ue=O?O(F,z,l+"",s,o,N):t,me=ue===t;if(me){var Ae=ut(z),Ue=!Ae&&ps(z),et=!Ae&&!Ue&&La(z);ue=z,Ae||Ue||et?ut(F)?ue=F:vr(F)?ue=ln(F):Ue?(me=!1,ue=W_(z,!0)):et?(me=!1,ue=z_(z,!0)):ue=[]:Ko(z)||Us(z)?(ue=F,Us(F)?ue=$x(F):(!lr(F)||Di(F))&&(ue=cx(z))):me=!1}me&&(N.set(z,ue),v(ue,z,p,O,N),N.delete(z)),ip(s,l,ue)}function R_(s,o){var l=s.length;if(l)return o+=o<0?l:0,Mi(o,l)?s[o]:t}function M_(s,o,l){o.length?o=or(o,function(O){return ut(O)?function(N){return Ls(N,O.length===1?O[0]:O)}:O}):o=[dn];var p=-1;o=or(o,Tn(Ye()));var v=C_(s,function(O,N,F){var z=or(o,function(ae){return ae(O)});return{criteria:z,index:++p,value:O}});return gN(v,function(O,N){return nM(O,N,l)})}function zR(s,o){return D_(s,o,function(l,p){return Up(s,p)})}function D_(s,o,l){for(var p=-1,v=o.length,O={};++p<v;){var N=o[p],F=Ls(s,N);l(F,N)&&Go(O,hs(N,s),F)}return O}function HR(s){return function(o){return Ls(o,s)}}function dp(s,o,l,p){var v=p?yN:Ta,O=-1,N=o.length,F=s;for(s===o&&(o=ln(o)),l&&(F=or(s,Tn(l)));++O<N;)for(var z=0,ae=o[O],ue=l?l(ae):ae;(z=v(F,ue,z,p))>-1;)F!==s&&Nc.call(F,z,1),Nc.call(s,z,1);return s}function F_(s,o){for(var l=s?o.length:0,p=l-1;l--;){var v=o[l];if(l==p||v!==O){var O=v;Mi(v)?Nc.call(s,v,1):gp(s,v)}}return s}function pp(s,o){return s+Dc(y_()*(o-s+1))}function GR(s,o,l,p){for(var v=-1,O=Pr(Mc((o-s)/(l||1)),0),N=Z(O);O--;)N[p?O:++v]=s,s+=l;return N}function mp(s,o){var l="";if(!s||o<1||o>X)return l;do o%2&&(l+=s),o=Dc(o/2),o&&(s+=s);while(o);return l}function gt(s,o){return Np(hx(s,o,dn),s+"")}function QR(s){return b_(qa(s))}function JR(s,o){var l=qa(s);return Zc(l,Fs(o,0,l.length))}function Go(s,o,l,p){if(!lr(s))return s;o=hs(o,s);for(var v=-1,O=o.length,N=O-1,F=s;F!=null&&++v<O;){var z=di(o[v]),ae=l;if(z==="__proto__"||z==="constructor"||z==="prototype")return s;if(v!=N){var ue=F[z];ae=p?p(ue,z,F):t,ae===t&&(ae=lr(ue)?ue:Mi(o[v+1])?[]:{})}Vo(F,z,ae),F=F[z]}return s}var L_=Fc?function(s,o){return Fc.set(s,o),s}:dn,YR=Rc?function(s,o){return Rc(s,"toString",{configurable:!0,enumerable:!1,value:Bp(o),writable:!0})}:dn;function KR(s){return Zc(qa(s))}function Hn(s,o,l){var p=-1,v=s.length;o<0&&(o=-o>v?0:v+o),l=l>v?v:l,l<0&&(l+=v),v=o>l?0:l-o>>>0,o>>>=0;for(var O=Z(v);++p<v;)O[p]=s[p+o];return O}function ZR(s,o){var l;return ls(s,function(p,v,O){return l=o(p,v,O),!l}),!!l}function Vc(s,o,l){var p=0,v=s==null?p:s.length;if(typeof o=="number"&&o===o&&v<=Ke){for(;p<v;){var O=p+v>>>1,N=s[O];N!==null&&!kn(N)&&(l?N<=o:N<o)?p=O+1:v=O}return v}return yp(s,o,dn,l)}function yp(s,o,l,p){var v=0,O=s==null?0:s.length;if(O===0)return 0;o=l(o);for(var N=o!==o,F=o===null,z=kn(o),ae=o===t;v<O;){var ue=Dc((v+O)/2),me=l(s[ue]),Ae=me!==t,Ue=me===null,et=me===me,pt=kn(me);if(N)var tt=p||et;else ae?tt=et&&(p||Ae):F?tt=et&&Ae&&(p||!Ue):z?tt=et&&Ae&&!Ue&&(p||!pt):Ue||pt?tt=!1:tt=p?me<=o:me<o;tt?v=ue+1:O=ue}return Qr(O,Be)}function q_(s,o){for(var l=-1,p=s.length,v=0,O=[];++l<p;){var N=s[l],F=o?o(N):N;if(!l||!ai(F,z)){var z=F;O[v++]=N===0?0:N}}return O}function j_(s){return typeof s=="number"?s:kn(s)?xe:+s}function An(s){if(typeof s=="string")return s;if(ut(s))return or(s,An)+"";if(kn(s))return g_?g_.call(s):"";var o=s+"";return o=="0"&&1/s==-ke?"-0":o}function fs(s,o,l){var p=-1,v=xc,O=s.length,N=!0,F=[],z=F;if(l)N=!1,v=zd;else if(O>=i){var ae=o?null:cM(s);if(ae)return Ec(ae);N=!1,v=Lo,z=new Ds}else z=o?[]:F;e:for(;++p<O;){var ue=s[p],me=o?o(ue):ue;if(ue=l||ue!==0?ue:0,N&&me===me){for(var Ae=z.length;Ae--;)if(z[Ae]===me)continue e;o&&z.push(me),F.push(ue)}else v(z,me,l)||(z!==F&&z.push(me),F.push(ue))}return F}function gp(s,o){return o=hs(o,s),s=dx(s,o),s==null||delete s[di(Gn(o))]}function U_(s,o,l,p){return Go(s,o,l(Ls(s,o)),p)}function Wc(s,o,l,p){for(var v=s.length,O=p?v:-1;(p?O--:++O<v)&&o(s[O],O,s););return l?Hn(s,p?0:O,p?O+1:v):Hn(s,p?O+1:0,p?v:O)}function $_(s,o){var l=s;return l instanceof Ot&&(l=l.value()),Hd(o,function(p,v){return v.func.apply(v.thisArg,os([p],v.args))},l)}function vp(s,o,l){var p=s.length;if(p<2)return p?fs(s[0]):[];for(var v=-1,O=Z(p);++v<p;)for(var N=s[v],F=-1;++F<p;)F!=v&&(O[v]=Wo(O[v]||N,s[F],o,l));return fs(Vr(O,1),o,l)}function B_(s,o,l){for(var p=-1,v=s.length,O=o.length,N={};++p<v;){var F=p<O?o[p]:t;l(N,s[p],F)}return N}function bp(s){return vr(s)?s:[]}function wp(s){return typeof s=="function"?s:dn}function hs(s,o){return ut(s)?s:Ip(s,o)?[s]:gx(jt(s))}var XR=gt;function ds(s,o,l){var p=s.length;return l=l===t?p:l,!o&&l>=p?s:Hn(s,o,l)}var V_=UN||function(s){return Br.clearTimeout(s)};function W_(s,o){if(o)return s.slice();var l=s.length,p=f_?f_(l):new s.constructor(l);return s.copy(p),p}function _p(s){var o=new s.constructor(s.byteLength);return new Cc(o).set(new Cc(s)),o}function eM(s,o){var l=o?_p(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.byteLength)}function tM(s){var o=new s.constructor(s.source,Ve.exec(s));return o.lastIndex=s.lastIndex,o}function rM(s){return Bo?Jt(Bo.call(s)):{}}function z_(s,o){var l=o?_p(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.length)}function H_(s,o){if(s!==o){var l=s!==t,p=s===null,v=s===s,O=kn(s),N=o!==t,F=o===null,z=o===o,ae=kn(o);if(!F&&!ae&&!O&&s>o||O&&N&&z&&!F&&!ae||p&&N&&z||!l&&z||!v)return 1;if(!p&&!O&&!ae&&s<o||ae&&l&&v&&!p&&!O||F&&l&&v||!N&&v||!z)return-1}return 0}function nM(s,o,l){for(var p=-1,v=s.criteria,O=o.criteria,N=v.length,F=l.length;++p<N;){var z=H_(v[p],O[p]);if(z){if(p>=F)return z;var ae=l[p];return z*(ae=="desc"?-1:1)}}return s.index-o.index}function G_(s,o,l,p){for(var v=-1,O=s.length,N=l.length,F=-1,z=o.length,ae=Pr(O-N,0),ue=Z(z+ae),me=!p;++F<z;)ue[F]=o[F];for(;++v<N;)(me||v<O)&&(ue[l[v]]=s[v]);for(;ae--;)ue[F++]=s[v++];return ue}function Q_(s,o,l,p){for(var v=-1,O=s.length,N=-1,F=l.length,z=-1,ae=o.length,ue=Pr(O-F,0),me=Z(ue+ae),Ae=!p;++v<ue;)me[v]=s[v];for(var Ue=v;++z<ae;)me[Ue+z]=o[z];for(;++N<F;)(Ae||v<O)&&(me[Ue+l[N]]=s[v++]);return me}function ln(s,o){var l=-1,p=s.length;for(o||(o=Z(p));++l<p;)o[l]=s[l];return o}function hi(s,o,l,p){var v=!l;l||(l={});for(var O=-1,N=o.length;++O<N;){var F=o[O],z=p?p(l[F],s[F],F,l,s):t;z===t&&(z=s[F]),v?Pi(l,F,z):Vo(l,F,z)}return l}function iM(s,o){return hi(s,kp(s),o)}function sM(s,o){return hi(s,ox(s),o)}function zc(s,o){return function(l,p){var v=ut(l)?lN:AR,O=o?o():{};return v(l,s,Ye(p,2),O)}}function Ma(s){return gt(function(o,l){var p=-1,v=l.length,O=v>1?l[v-1]:t,N=v>2?l[2]:t;for(O=s.length>3&&typeof O=="function"?(v--,O):t,N&&sn(l[0],l[1],N)&&(O=v<3?t:O,v=1),o=Jt(o);++p<v;){var F=l[p];F&&s(o,F,p,O)}return o})}function J_(s,o){return function(l,p){if(l==null)return l;if(!fn(l))return s(l,p);for(var v=l.length,O=o?v:-1,N=Jt(l);(o?O--:++O<v)&&p(N[O],O,N)!==!1;);return l}}function Y_(s){return function(o,l,p){for(var v=-1,O=Jt(o),N=p(o),F=N.length;F--;){var z=N[s?F:++v];if(l(O[z],z,O)===!1)break}return o}}function aM(s,o,l){var p=o&x,v=Qo(s);function O(){var N=this&&this!==Br&&this instanceof O?v:s;return N.apply(p?l:this,arguments)}return O}function K_(s){return function(o){o=jt(o);var l=Aa(o)?ii(o):t,p=l?l[0]:o.charAt(0),v=l?ds(l,1).join(""):o.slice(1);return p[s]()+v}}function Da(s){return function(o){return Hd(Jx(Qx(o).replace(YP,"")),s,"")}}function Qo(s){return function(){var o=arguments;switch(o.length){case 0:return new s;case 1:return new s(o[0]);case 2:return new s(o[0],o[1]);case 3:return new s(o[0],o[1],o[2]);case 4:return new s(o[0],o[1],o[2],o[3]);case 5:return new s(o[0],o[1],o[2],o[3],o[4]);case 6:return new s(o[0],o[1],o[2],o[3],o[4],o[5]);case 7:return new s(o[0],o[1],o[2],o[3],o[4],o[5],o[6])}var l=Ra(s.prototype),p=s.apply(l,o);return lr(p)?p:l}}function oM(s,o,l){var p=Qo(s);function v(){for(var O=arguments.length,N=Z(O),F=O,z=Fa(v);F--;)N[F]=arguments[F];var ae=O<3&&N[0]!==z&&N[O-1]!==z?[]:us(N,z);if(O-=ae.length,O<l)return rx(s,o,Hc,v.placeholder,t,N,ae,t,t,l-O);var ue=this&&this!==Br&&this instanceof v?p:s;return On(ue,this,N)}return v}function Z_(s){return function(o,l,p){var v=Jt(o);if(!fn(o)){var O=Ye(l,3);o=qr(o),l=function(F){return O(v[F],F,v)}}var N=s(o,l,p);return N>-1?v[O?o[N]:N]:t}}function X_(s){return Ri(function(o){var l=o.length,p=l,v=Wn.prototype.thru;for(s&&o.reverse();p--;){var O=o[p];if(typeof O!="function")throw new Vn(u);if(v&&!N&&Yc(O)=="wrapper")var N=new Wn([],!0)}for(p=N?p:l;++p<l;){O=o[p];var F=Yc(O),z=F=="wrapper"?Tp(O):t;z&&Cp(z[0])&&z[1]==(K|P|$|ee)&&!z[4].length&&z[9]==1?N=N[Yc(z[0])].apply(N,z[3]):N=O.length==1&&Cp(O)?N[F]():N.thru(O)}return function(){var ae=arguments,ue=ae[0];if(N&&ae.length==1&&ut(ue))return N.plant(ue).value();for(var me=0,Ae=l?o[me].apply(this,ae):ue;++me<l;)Ae=o[me].call(this,Ae);return Ae}})}function Hc(s,o,l,p,v,O,N,F,z,ae){var ue=o&K,me=o&x,Ae=o&_,Ue=o&(P|M),et=o&fe,pt=Ae?t:Qo(s);function tt(){for(var xt=arguments.length,kt=Z(xt),In=xt;In--;)kt[In]=arguments[In];if(Ue)var an=Fa(tt),Cn=bN(kt,an);if(p&&(kt=G_(kt,p,v,Ue)),O&&(kt=Q_(kt,O,N,Ue)),xt-=Cn,Ue&&xt<ae){var br=us(kt,an);return rx(s,o,Hc,tt.placeholder,l,kt,br,F,z,ae-xt)}var oi=me?l:this,Li=Ae?oi[s]:s;return xt=kt.length,F?kt=AM(kt,F):et&&xt>1&&kt.reverse(),ue&&z<xt&&(kt.length=z),this&&this!==Br&&this instanceof tt&&(Li=pt||Qo(Li)),Li.apply(oi,kt)}return tt}function ex(s,o){return function(l,p){return DR(l,s,o(p),{})}}function Gc(s,o){return function(l,p){var v;if(l===t&&p===t)return o;if(l!==t&&(v=l),p!==t){if(v===t)return p;typeof l=="string"||typeof p=="string"?(l=An(l),p=An(p)):(l=j_(l),p=j_(p)),v=s(l,p)}return v}}function xp(s){return Ri(function(o){return o=or(o,Tn(Ye())),gt(function(l){var p=this;return s(o,function(v){return On(v,p,l)})})})}function Qc(s,o){o=o===t?" ":An(o);var l=o.length;if(l<2)return l?mp(o,s):o;var p=mp(o,Mc(s/ka(o)));return Aa(o)?ds(ii(p),0,s).join(""):p.slice(0,s)}function uM(s,o,l,p){var v=o&x,O=Qo(s);function N(){for(var F=-1,z=arguments.length,ae=-1,ue=p.length,me=Z(ue+z),Ae=this&&this!==Br&&this instanceof N?O:s;++ae<ue;)me[ae]=p[ae];for(;z--;)me[ae++]=arguments[++F];return On(Ae,v?l:this,me)}return N}function tx(s){return function(o,l,p){return p&&typeof p!="number"&&sn(o,l,p)&&(l=p=t),o=Fi(o),l===t?(l=o,o=0):l=Fi(l),p=p===t?o<l?1:-1:Fi(p),GR(o,l,p,s)}}function Jc(s){return function(o,l){return typeof o=="string"&&typeof l=="string"||(o=Qn(o),l=Qn(l)),s(o,l)}}function rx(s,o,l,p,v,O,N,F,z,ae){var ue=o&P,me=ue?N:t,Ae=ue?t:N,Ue=ue?O:t,et=ue?t:O;o|=ue?$:j,o&=~(ue?j:$),o&A||(o&=~(x|_));var pt=[s,o,v,Ue,me,et,Ae,F,z,ae],tt=l.apply(t,pt);return Cp(s)&&px(tt,pt),tt.placeholder=p,mx(tt,s,o)}function Sp(s){var o=Cr[s];return function(l,p){if(l=Qn(l),p=p==null?0:Qr(ht(p),292),p&&m_(l)){var v=(jt(l)+"e").split("e"),O=o(v[0]+"e"+(+v[1]+p));return v=(jt(O)+"e").split("e"),+(v[0]+"e"+(+v[1]-p))}return o(l)}}var cM=Pa&&1/Ec(new Pa([,-0]))[1]==ke?function(s){return new Pa(s)}:zp;function nx(s){return function(o){var l=Jr(o);return l==J?Xd(o):l==we?TN(o):vN(o,s(o))}}function Ni(s,o,l,p,v,O,N,F){var z=o&_;if(!z&&typeof s!="function")throw new Vn(u);var ae=p?p.length:0;if(ae||(o&=~($|j),p=v=t),N=N===t?N:Pr(ht(N),0),F=F===t?F:ht(F),ae-=v?v.length:0,o&j){var ue=p,me=v;p=v=t}var Ae=z?t:Tp(s),Ue=[s,o,l,p,v,ue,me,O,N,F];if(Ae&&EM(Ue,Ae),s=Ue[0],o=Ue[1],l=Ue[2],p=Ue[3],v=Ue[4],F=Ue[9]=Ue[9]===t?z?0:s.length:Pr(Ue[9]-ae,0),!F&&o&(P|M)&&(o&=~(P|M)),!o||o==x)var et=aM(s,o,l);else o==P||o==M?et=oM(s,o,F):(o==$||o==(x|$))&&!v.length?et=uM(s,o,l,p):et=Hc.apply(t,Ue);var pt=Ae?L_:px;return mx(pt(et,Ue),s,o)}function ix(s,o,l,p){return s===t||ai(s,Ca[l])&&!$t.call(p,l)?o:s}function sx(s,o,l,p,v,O){return lr(s)&&lr(o)&&(O.set(o,s),Bc(s,o,t,sx,O),O.delete(o)),s}function lM(s){return Ko(s)?t:s}function ax(s,o,l,p,v,O){var N=l&b,F=s.length,z=o.length;if(F!=z&&!(N&&z>F))return!1;var ae=O.get(s),ue=O.get(o);if(ae&&ue)return ae==o&&ue==s;var me=-1,Ae=!0,Ue=l&I?new Ds:t;for(O.set(s,o),O.set(o,s);++me<F;){var et=s[me],pt=o[me];if(p)var tt=N?p(pt,et,me,o,s,O):p(et,pt,me,s,o,O);if(tt!==t){if(tt)continue;Ae=!1;break}if(Ue){if(!Gd(o,function(xt,kt){if(!Lo(Ue,kt)&&(et===xt||v(et,xt,l,p,O)))return Ue.push(kt)})){Ae=!1;break}}else if(!(et===pt||v(et,pt,l,p,O))){Ae=!1;break}}return O.delete(s),O.delete(o),Ae}function fM(s,o,l,p,v,O,N){switch(l){case Gt:if(s.byteLength!=o.byteLength||s.byteOffset!=o.byteOffset)return!1;s=s.buffer,o=o.buffer;case Wt:return!(s.byteLength!=o.byteLength||!O(new Cc(s),new Cc(o)));case vt:case De:case te:return ai(+s,+o);case V:return s.name==o.name&&s.message==o.message;case se:case Qe:return s==o+"";case J:var F=Xd;case we:var z=p&b;if(F||(F=Ec),s.size!=o.size&&!z)return!1;var ae=N.get(s);if(ae)return ae==o;p|=I,N.set(s,o);var ue=ax(F(s),F(o),p,v,O,N);return N.delete(s),ue;case mt:if(Bo)return Bo.call(s)==Bo.call(o)}return!1}function hM(s,o,l,p,v,O){var N=l&b,F=Ep(s),z=F.length,ae=Ep(o),ue=ae.length;if(z!=ue&&!N)return!1;for(var me=z;me--;){var Ae=F[me];if(!(N?Ae in o:$t.call(o,Ae)))return!1}var Ue=O.get(s),et=O.get(o);if(Ue&&et)return Ue==o&&et==s;var pt=!0;O.set(s,o),O.set(o,s);for(var tt=N;++me<z;){Ae=F[me];var xt=s[Ae],kt=o[Ae];if(p)var In=N?p(kt,xt,Ae,o,s,O):p(xt,kt,Ae,s,o,O);if(!(In===t?xt===kt||v(xt,kt,l,p,O):In)){pt=!1;break}tt||(tt=Ae=="constructor")}if(pt&&!tt){var an=s.constructor,Cn=o.constructor;an!=Cn&&"constructor"in s&&"constructor"in o&&!(typeof an=="function"&&an instanceof an&&typeof Cn=="function"&&Cn instanceof Cn)&&(pt=!1)}return O.delete(s),O.delete(o),pt}function Ri(s){return Np(hx(s,t,_x),s+"")}function Ep(s){return T_(s,qr,kp)}function Op(s){return T_(s,hn,ox)}var Tp=Fc?function(s){return Fc.get(s)}:zp;function Yc(s){for(var o=s.name+"",l=Na[o],p=$t.call(Na,o)?l.length:0;p--;){var v=l[p],O=v.func;if(O==null||O==s)return v.name}return o}function Fa(s){var o=$t.call(S,"placeholder")?S:s;return o.placeholder}function Ye(){var s=S.iteratee||Vp;return s=s===Vp?I_:s,arguments.length?s(arguments[0],arguments[1]):s}function Kc(s,o){var l=s.__data__;return wM(o)?l[typeof o=="string"?"string":"hash"]:l.map}function Ap(s){for(var o=qr(s),l=o.length;l--;){var p=o[l],v=s[p];o[l]=[p,v,lx(v)]}return o}function qs(s,o){var l=SN(s,o);return k_(l)?l:t}function dM(s){var o=$t.call(s,Rs),l=s[Rs];try{s[Rs]=t;var p=!0}catch{}var v=kc.call(s);return p&&(o?s[Rs]=l:delete s[Rs]),v}var kp=tp?function(s){return s==null?[]:(s=Jt(s),as(tp(s),function(o){return d_.call(s,o)}))}:Hp,ox=tp?function(s){for(var o=[];s;)os(o,kp(s)),s=Pc(s);return o}:Hp,Jr=nn;(rp&&Jr(new rp(new ArrayBuffer(1)))!=Gt||jo&&Jr(new jo)!=J||np&&Jr(np.resolve())!=ze||Pa&&Jr(new Pa)!=we||Uo&&Jr(new Uo)!=Yt)&&(Jr=function(s){var o=nn(s),l=o==_e?s.constructor:t,p=l?js(l):"";if(p)switch(p){case JN:return Gt;case YN:return J;case KN:return ze;case ZN:return we;case XN:return Yt}return o});function pM(s,o,l){for(var p=-1,v=l.length;++p<v;){var O=l[p],N=O.size;switch(O.type){case"drop":s+=N;break;case"dropRight":o-=N;break;case"take":o=Qr(o,s+N);break;case"takeRight":s=Pr(s,o-N);break}}return{start:s,end:o}}function mM(s){var o=s.match(Sn);return o?o[1].split(Un):[]}function ux(s,o,l){o=hs(o,s);for(var p=-1,v=o.length,O=!1;++p<v;){var N=di(o[p]);if(!(O=s!=null&&l(s,N)))break;s=s[N]}return O||++p!=v?O:(v=s==null?0:s.length,!!v&&il(v)&&Mi(N,v)&&(ut(s)||Us(s)))}function yM(s){var o=s.length,l=new s.constructor(o);return o&&typeof s[0]=="string"&&$t.call(s,"index")&&(l.index=s.index,l.input=s.input),l}function cx(s){return typeof s.constructor=="function"&&!Jo(s)?Ra(Pc(s)):{}}function gM(s,o,l){var p=s.constructor;switch(o){case Wt:return _p(s);case vt:case De:return new p(+s);case Gt:return eM(s,l);case Er:case zt:case sr:case dr:case Ar:case Ht:case H:case G:case at:return z_(s,l);case J:return new p;case te:case Qe:return new p(s);case se:return tM(s);case we:return new p;case mt:return rM(s)}}function vM(s,o){var l=o.length;if(!l)return s;var p=l-1;return o[p]=(l>1?"& ":"")+o[p],o=o.join(l>2?", ":" "),s.replace(Ir,`{
|
|
93
|
+
*/var fA=So.exports,T0;function hA(){return T0||(T0=1,function(r,e){(function(){var t,n="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",u="Expected a function",c="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,p="__lodash_placeholder__",m=1,y=2,g=4,b=1,I=2,S=1,w=2,O=4,P=8,D=16,T=32,N=64,G=128,q=256,$=512,K=30,oe="...",re=800,Ee=16,ie=1,me=2,we=3,Te=1/0,ee=9007199254740991,ye=17976931348623157e292,fe=NaN,Pe=4294967295,Be=Pe-1,ht=Pe>>>1,It=[["ary",G],["bind",S],["bindKey",w],["curry",P],["curryRight",D],["flip",$],["partial",T],["partialRight",N],["rearg",q]],ot="[object Arguments]",tt="[object Array]",Mt="[object AsyncFunction]",St="[object Boolean]",Fe="[object Date]",Ge="[object DOMException]",W="[object Error]",Y="[object Function]",U="[object GeneratorFunction]",Z="[object Map]",ne="[object Number]",z="[object Null]",Oe="[object Object]",We="[object Promise]",$e="[object Proxy]",ce="[object RegExp]",Se="[object Set]",Je="[object String]",dt="[object Symbol]",pt="[object Undefined]",Qt="[object WeakMap]",Et="[object WeakSet]",Xt="[object ArrayBuffer]",zt="[object DataView]",xr="[object Float32Array]",Vt="[object Float64Array]",dr="[object Int8Array]",pr="[object Int16Array]",Or="[object Int32Array]",Wt="[object Uint8Array]",Q="[object Uint8ClampedArray]",J="[object Uint16Array]",it="[object Uint32Array]",mt=/\b__p \+= '';/g,lt=/\b(__p \+=) '' \+/g,Ve=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ur=/&(?:amp|lt|gt|quot|#39);/g,Jt=/[&<>"']/g,Yt=RegExp(ur.source),Mr=RegExp(Jt.source),jr=/<%-([\s\S]+?)%>/g,Ur=/<%([\s\S]+?)%>/g,qt=/<%=([\s\S]+?)%>/g,Er=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zr=/^\w*$/,Dr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,er=/[\\^$.*+?()[\]{}|]/g,Hr=RegExp(er.source),Tr=/^\s+/,gr=/\s/,kr=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,_n=/\{\n\/\* \[wrapped with (.+)\] \*/,M=/,? & /,pe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,xe=/[()=,{}\[\]\/\s]/,je=/\\(\\)?/g,ze=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Qe=/\w*$/,et=/^[-+]0x[0-9a-f]+$/i,Ye=/^0b[01]+$/i,Ht=/^\[object .+?Constructor\]$/,He=/^0o[0-7]+$/i,gt=/^(?:0|[1-9]\d*)$/,_=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,A=/($^)/,k=/['\n\r\u2028\u2029\\]/g,C="\\ud800-\\udfff",j="\\u0300-\\u036f",V="\\ufe20-\\ufe2f",ue="\\u20d0-\\u20ff",ge=j+V+ue,X="\\u2700-\\u27bf",ae="a-z\\xdf-\\xf6\\xf8-\\xff",Le="\\xac\\xb1\\xd7\\xf7",vt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",tr="\\u2000-\\u206f",Sn=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ai="A-Z\\xc0-\\xd6\\xd8-\\xde",Kw="\\ufe0e\\ufe0f",Zw=Le+vt+tr+Sn,Qd="['’]",pN="["+C+"]",Xw="["+Zw+"]",kc="["+ge+"]",e_="\\d+",mN="["+X+"]",t_="["+ae+"]",r_="[^"+C+Zw+e_+X+ae+Ai+"]",Jd="\\ud83c[\\udffb-\\udfff]",yN="(?:"+kc+"|"+Jd+")",n_="[^"+C+"]",Yd="(?:\\ud83c[\\udde6-\\uddff]){2}",Kd="[\\ud800-\\udbff][\\udc00-\\udfff]",Aa="["+Ai+"]",i_="\\u200d",s_="(?:"+t_+"|"+r_+")",gN="(?:"+Aa+"|"+r_+")",a_="(?:"+Qd+"(?:d|ll|m|re|s|t|ve))?",o_="(?:"+Qd+"(?:D|LL|M|RE|S|T|VE))?",u_=yN+"?",c_="["+Kw+"]?",vN="(?:"+i_+"(?:"+[n_,Yd,Kd].join("|")+")"+c_+u_+")*",bN="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",wN="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",l_=c_+u_+vN,_N="(?:"+[mN,Yd,Kd].join("|")+")"+l_,SN="(?:"+[n_+kc+"?",kc,Yd,Kd,pN].join("|")+")",xN=RegExp(Qd,"g"),EN=RegExp(kc,"g"),Zd=RegExp(Jd+"(?="+Jd+")|"+SN+l_,"g"),ON=RegExp([Aa+"?"+t_+"+"+a_+"(?="+[Xw,Aa,"$"].join("|")+")",gN+"+"+o_+"(?="+[Xw,Aa+s_,"$"].join("|")+")",Aa+"?"+s_+"+"+a_,Aa+"+"+o_,wN,bN,e_,_N].join("|"),"g"),TN=RegExp("["+i_+C+ge+Kw+"]"),kN=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,AN=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],IN=-1,rr={};rr[xr]=rr[Vt]=rr[dr]=rr[pr]=rr[Or]=rr[Wt]=rr[Q]=rr[J]=rr[it]=!0,rr[ot]=rr[tt]=rr[Xt]=rr[St]=rr[zt]=rr[Fe]=rr[W]=rr[Y]=rr[Z]=rr[ne]=rr[Oe]=rr[ce]=rr[Se]=rr[Je]=rr[Qt]=!1;var Kt={};Kt[ot]=Kt[tt]=Kt[Xt]=Kt[zt]=Kt[St]=Kt[Fe]=Kt[xr]=Kt[Vt]=Kt[dr]=Kt[pr]=Kt[Or]=Kt[Z]=Kt[ne]=Kt[Oe]=Kt[ce]=Kt[Se]=Kt[Je]=Kt[dt]=Kt[Wt]=Kt[Q]=Kt[J]=Kt[it]=!0,Kt[W]=Kt[Y]=Kt[Qt]=!1;var CN={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},PN={"&":"&","<":"<",">":">",'"':""","'":"'"},NN={"&":"&","<":"<",">":">",""":'"',"'":"'"},RN={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},MN=parseFloat,DN=parseInt,f_=typeof vs=="object"&&vs&&vs.Object===Object&&vs,FN=typeof self=="object"&&self&&self.Object===Object&&self,$r=f_||FN||Function("return this")(),Xd=e&&!e.nodeType&&e,Ds=Xd&&!0&&r&&!r.nodeType&&r,h_=Ds&&Ds.exports===Xd,ep=h_&&f_.process,jn=function(){try{var B=Ds&&Ds.require&&Ds.require("util").types;return B||ep&&ep.binding&&ep.binding("util")}catch{}}(),d_=jn&&jn.isArrayBuffer,p_=jn&&jn.isDate,m_=jn&&jn.isMap,y_=jn&&jn.isRegExp,g_=jn&&jn.isSet,v_=jn&&jn.isTypedArray;function xn(B,se,te){switch(te.length){case 0:return B.call(se);case 1:return B.call(se,te[0]);case 2:return B.call(se,te[0],te[1]);case 3:return B.call(se,te[0],te[1],te[2])}return B.apply(se,te)}function LN(B,se,te,De){for(var st=-1,Dt=B==null?0:B.length;++st<Dt;){var Ar=B[st];se(De,Ar,te(Ar),B)}return De}function Un(B,se){for(var te=-1,De=B==null?0:B.length;++te<De&&se(B[te],te,B)!==!1;);return B}function qN(B,se){for(var te=B==null?0:B.length;te--&&se(B[te],te,B)!==!1;);return B}function b_(B,se){for(var te=-1,De=B==null?0:B.length;++te<De;)if(!se(B[te],te,B))return!1;return!0}function cs(B,se){for(var te=-1,De=B==null?0:B.length,st=0,Dt=[];++te<De;){var Ar=B[te];se(Ar,te,B)&&(Dt[st++]=Ar)}return Dt}function Ac(B,se){var te=B==null?0:B.length;return!!te&&Ia(B,se,0)>-1}function tp(B,se,te){for(var De=-1,st=B==null?0:B.length;++De<st;)if(te(se,B[De]))return!0;return!1}function ar(B,se){for(var te=-1,De=B==null?0:B.length,st=Array(De);++te<De;)st[te]=se(B[te],te,B);return st}function ls(B,se){for(var te=-1,De=se.length,st=B.length;++te<De;)B[st+te]=se[te];return B}function rp(B,se,te,De){var st=-1,Dt=B==null?0:B.length;for(De&&Dt&&(te=B[++st]);++st<Dt;)te=se(te,B[st],st,B);return te}function jN(B,se,te,De){var st=B==null?0:B.length;for(De&&st&&(te=B[--st]);st--;)te=se(te,B[st],st,B);return te}function np(B,se){for(var te=-1,De=B==null?0:B.length;++te<De;)if(se(B[te],te,B))return!0;return!1}var UN=ip("length");function $N(B){return B.split("")}function BN(B){return B.match(pe)||[]}function w_(B,se,te){var De;return te(B,function(st,Dt,Ar){if(se(st,Dt,Ar))return De=Dt,!1}),De}function Ic(B,se,te,De){for(var st=B.length,Dt=te+(De?1:-1);De?Dt--:++Dt<st;)if(se(B[Dt],Dt,B))return Dt;return-1}function Ia(B,se,te){return se===se?e2(B,se,te):Ic(B,__,te)}function VN(B,se,te,De){for(var st=te-1,Dt=B.length;++st<Dt;)if(De(B[st],se))return st;return-1}function __(B){return B!==B}function S_(B,se){var te=B==null?0:B.length;return te?ap(B,se)/te:fe}function ip(B){return function(se){return se==null?t:se[B]}}function sp(B){return function(se){return B==null?t:B[se]}}function x_(B,se,te,De,st){return st(B,function(Dt,Ar,Gt){te=De?(De=!1,Dt):se(te,Dt,Ar,Gt)}),te}function WN(B,se){var te=B.length;for(B.sort(se);te--;)B[te]=B[te].value;return B}function ap(B,se){for(var te,De=-1,st=B.length;++De<st;){var Dt=se(B[De]);Dt!==t&&(te=te===t?Dt:te+Dt)}return te}function op(B,se){for(var te=-1,De=Array(B);++te<B;)De[te]=se(te);return De}function zN(B,se){return ar(se,function(te){return[te,B[te]]})}function E_(B){return B&&B.slice(0,A_(B)+1).replace(Tr,"")}function En(B){return function(se){return B(se)}}function up(B,se){return ar(se,function(te){return B[te]})}function Bo(B,se){return B.has(se)}function O_(B,se){for(var te=-1,De=B.length;++te<De&&Ia(se,B[te],0)>-1;);return te}function T_(B,se){for(var te=B.length;te--&&Ia(se,B[te],0)>-1;);return te}function HN(B,se){for(var te=B.length,De=0;te--;)B[te]===se&&++De;return De}var GN=sp(CN),QN=sp(PN);function JN(B){return"\\"+RN[B]}function YN(B,se){return B==null?t:B[se]}function Ca(B){return TN.test(B)}function KN(B){return kN.test(B)}function ZN(B){for(var se,te=[];!(se=B.next()).done;)te.push(se.value);return te}function cp(B){var se=-1,te=Array(B.size);return B.forEach(function(De,st){te[++se]=[st,De]}),te}function k_(B,se){return function(te){return B(se(te))}}function fs(B,se){for(var te=-1,De=B.length,st=0,Dt=[];++te<De;){var Ar=B[te];(Ar===se||Ar===p)&&(B[te]=p,Dt[st++]=te)}return Dt}function Cc(B){var se=-1,te=Array(B.size);return B.forEach(function(De){te[++se]=De}),te}function XN(B){var se=-1,te=Array(B.size);return B.forEach(function(De){te[++se]=[De,De]}),te}function e2(B,se,te){for(var De=te-1,st=B.length;++De<st;)if(B[De]===se)return De;return-1}function t2(B,se,te){for(var De=te+1;De--;)if(B[De]===se)return De;return De}function Pa(B){return Ca(B)?n2(B):UN(B)}function ri(B){return Ca(B)?i2(B):$N(B)}function A_(B){for(var se=B.length;se--&&gr.test(B.charAt(se)););return se}var r2=sp(NN);function n2(B){for(var se=Zd.lastIndex=0;Zd.test(B);)++se;return se}function i2(B){return B.match(Zd)||[]}function s2(B){return B.match(ON)||[]}var a2=function B(se){se=se==null?$r:Na.defaults($r.Object(),se,Na.pick($r,AN));var te=se.Array,De=se.Date,st=se.Error,Dt=se.Function,Ar=se.Math,Gt=se.Object,lp=se.RegExp,o2=se.String,$n=se.TypeError,Pc=te.prototype,u2=Dt.prototype,Ra=Gt.prototype,Nc=se["__core-js_shared__"],Rc=u2.toString,Ut=Ra.hasOwnProperty,c2=0,I_=function(){var s=/[^.]+$/.exec(Nc&&Nc.keys&&Nc.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),Mc=Ra.toString,l2=Rc.call(Gt),f2=$r._,h2=lp("^"+Rc.call(Ut).replace(er,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Dc=h_?se.Buffer:t,hs=se.Symbol,Fc=se.Uint8Array,C_=Dc?Dc.allocUnsafe:t,Lc=k_(Gt.getPrototypeOf,Gt),P_=Gt.create,N_=Ra.propertyIsEnumerable,qc=Pc.splice,R_=hs?hs.isConcatSpreadable:t,Vo=hs?hs.iterator:t,Fs=hs?hs.toStringTag:t,jc=function(){try{var s=$s(Gt,"defineProperty");return s({},"",{}),s}catch{}}(),d2=se.clearTimeout!==$r.clearTimeout&&se.clearTimeout,p2=De&&De.now!==$r.Date.now&&De.now,m2=se.setTimeout!==$r.setTimeout&&se.setTimeout,Uc=Ar.ceil,$c=Ar.floor,fp=Gt.getOwnPropertySymbols,y2=Dc?Dc.isBuffer:t,M_=se.isFinite,g2=Pc.join,v2=k_(Gt.keys,Gt),Ir=Ar.max,Gr=Ar.min,b2=De.now,w2=se.parseInt,D_=Ar.random,_2=Pc.reverse,hp=$s(se,"DataView"),Wo=$s(se,"Map"),dp=$s(se,"Promise"),Ma=$s(se,"Set"),zo=$s(se,"WeakMap"),Ho=$s(Gt,"create"),Bc=zo&&new zo,Da={},S2=Bs(hp),x2=Bs(Wo),E2=Bs(dp),O2=Bs(Ma),T2=Bs(zo),Vc=hs?hs.prototype:t,Go=Vc?Vc.valueOf:t,F_=Vc?Vc.toString:t;function x(s){if(mr(s)&&!at(s)&&!(s instanceof xt)){if(s instanceof Bn)return s;if(Ut.call(s,"__wrapped__"))return LS(s)}return new Bn(s)}var Fa=function(){function s(){}return function(o){if(!cr(o))return{};if(P_)return P_(o);s.prototype=o;var l=new s;return s.prototype=t,l}}();function Wc(){}function Bn(s,o){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=t}x.templateSettings={escape:jr,evaluate:Ur,interpolate:qt,variable:"",imports:{_:x}},x.prototype=Wc.prototype,x.prototype.constructor=x,Bn.prototype=Fa(Wc.prototype),Bn.prototype.constructor=Bn;function xt(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Pe,this.__views__=[]}function k2(){var s=new xt(this.__wrapped__);return s.__actions__=ln(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=ln(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=ln(this.__views__),s}function A2(){if(this.__filtered__){var s=new xt(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function I2(){var s=this.__wrapped__.value(),o=this.__dir__,l=at(s),d=o<0,v=l?s.length:0,E=$R(0,v,this.__views__),R=E.start,L=E.end,H=L-R,le=d?L:R-1,he=this.__iteratees__,ve=he.length,Ne=0,Ue=Gr(H,this.__takeCount__);if(!l||!d&&v==H&&Ue==H)return aS(s,this.__actions__);var Ze=[];e:for(;H--&&Ne<Ue;){le+=o;for(var ft=-1,Xe=s[le];++ft<ve;){var bt=he[ft],Ot=bt.iteratee,kn=bt.type,sn=Ot(Xe);if(kn==me)Xe=sn;else if(!sn){if(kn==ie)continue e;break e}}Ze[Ne++]=Xe}return Ze}xt.prototype=Fa(Wc.prototype),xt.prototype.constructor=xt;function Ls(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var d=s[o];this.set(d[0],d[1])}}function C2(){this.__data__=Ho?Ho(null):{},this.size=0}function P2(s){var o=this.has(s)&&delete this.__data__[s];return this.size-=o?1:0,o}function N2(s){var o=this.__data__;if(Ho){var l=o[s];return l===f?t:l}return Ut.call(o,s)?o[s]:t}function R2(s){var o=this.__data__;return Ho?o[s]!==t:Ut.call(o,s)}function M2(s,o){var l=this.__data__;return this.size+=this.has(s)?0:1,l[s]=Ho&&o===t?f:o,this}Ls.prototype.clear=C2,Ls.prototype.delete=P2,Ls.prototype.get=N2,Ls.prototype.has=R2,Ls.prototype.set=M2;function Ii(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var d=s[o];this.set(d[0],d[1])}}function D2(){this.__data__=[],this.size=0}function F2(s){var o=this.__data__,l=zc(o,s);if(l<0)return!1;var d=o.length-1;return l==d?o.pop():qc.call(o,l,1),--this.size,!0}function L2(s){var o=this.__data__,l=zc(o,s);return l<0?t:o[l][1]}function q2(s){return zc(this.__data__,s)>-1}function j2(s,o){var l=this.__data__,d=zc(l,s);return d<0?(++this.size,l.push([s,o])):l[d][1]=o,this}Ii.prototype.clear=D2,Ii.prototype.delete=F2,Ii.prototype.get=L2,Ii.prototype.has=q2,Ii.prototype.set=j2;function Ci(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var d=s[o];this.set(d[0],d[1])}}function U2(){this.size=0,this.__data__={hash:new Ls,map:new(Wo||Ii),string:new Ls}}function $2(s){var o=nl(this,s).delete(s);return this.size-=o?1:0,o}function B2(s){return nl(this,s).get(s)}function V2(s){return nl(this,s).has(s)}function W2(s,o){var l=nl(this,s),d=l.size;return l.set(s,o),this.size+=l.size==d?0:1,this}Ci.prototype.clear=U2,Ci.prototype.delete=$2,Ci.prototype.get=B2,Ci.prototype.has=V2,Ci.prototype.set=W2;function qs(s){var o=-1,l=s==null?0:s.length;for(this.__data__=new Ci;++o<l;)this.add(s[o])}function z2(s){return this.__data__.set(s,f),this}function H2(s){return this.__data__.has(s)}qs.prototype.add=qs.prototype.push=z2,qs.prototype.has=H2;function ni(s){var o=this.__data__=new Ii(s);this.size=o.size}function G2(){this.__data__=new Ii,this.size=0}function Q2(s){var o=this.__data__,l=o.delete(s);return this.size=o.size,l}function J2(s){return this.__data__.get(s)}function Y2(s){return this.__data__.has(s)}function K2(s,o){var l=this.__data__;if(l instanceof Ii){var d=l.__data__;if(!Wo||d.length<i-1)return d.push([s,o]),this.size=++l.size,this;l=this.__data__=new Ci(d)}return l.set(s,o),this.size=l.size,this}ni.prototype.clear=G2,ni.prototype.delete=Q2,ni.prototype.get=J2,ni.prototype.has=Y2,ni.prototype.set=K2;function L_(s,o){var l=at(s),d=!l&&Vs(s),v=!l&&!d&&gs(s),E=!l&&!d&&!v&&Ua(s),R=l||d||v||E,L=R?op(s.length,o2):[],H=L.length;for(var le in s)(o||Ut.call(s,le))&&!(R&&(le=="length"||v&&(le=="offset"||le=="parent")||E&&(le=="buffer"||le=="byteLength"||le=="byteOffset")||Mi(le,H)))&&L.push(le);return L}function q_(s){var o=s.length;return o?s[Ep(0,o-1)]:t}function Z2(s,o){return il(ln(s),js(o,0,s.length))}function X2(s){return il(ln(s))}function pp(s,o,l){(l!==t&&!ii(s[o],l)||l===t&&!(o in s))&&Pi(s,o,l)}function Qo(s,o,l){var d=s[o];(!(Ut.call(s,o)&&ii(d,l))||l===t&&!(o in s))&&Pi(s,o,l)}function zc(s,o){for(var l=s.length;l--;)if(ii(s[l][0],o))return l;return-1}function eR(s,o,l,d){return ds(s,function(v,E,R){o(d,v,l(v),R)}),d}function j_(s,o){return s&&hi(o,Fr(o),s)}function tR(s,o){return s&&hi(o,hn(o),s)}function Pi(s,o,l){o=="__proto__"&&jc?jc(s,o,{configurable:!0,enumerable:!0,value:l,writable:!0}):s[o]=l}function mp(s,o){for(var l=-1,d=o.length,v=te(d),E=s==null;++l<d;)v[l]=E?t:Jp(s,o[l]);return v}function js(s,o,l){return s===s&&(l!==t&&(s=s<=l?s:l),o!==t&&(s=s>=o?s:o)),s}function Vn(s,o,l,d,v,E){var R,L=o&m,H=o&y,le=o&g;if(l&&(R=v?l(s,d,v,E):l(s)),R!==t)return R;if(!cr(s))return s;var he=at(s);if(he){if(R=VR(s),!L)return ln(s,R)}else{var ve=Qr(s),Ne=ve==Y||ve==U;if(gs(s))return cS(s,L);if(ve==Oe||ve==ot||Ne&&!v){if(R=H||Ne?{}:AS(s),!L)return H?NR(s,tR(R,s)):PR(s,j_(R,s))}else{if(!Kt[ve])return v?s:{};R=WR(s,ve,L)}}E||(E=new ni);var Ue=E.get(s);if(Ue)return Ue;E.set(s,R),nx(s)?s.forEach(function(Xe){R.add(Vn(Xe,o,l,Xe,s,E))}):tx(s)&&s.forEach(function(Xe,bt){R.set(bt,Vn(Xe,o,l,bt,s,E))});var Ze=le?H?Dp:Mp:H?hn:Fr,ft=he?t:Ze(s);return Un(ft||s,function(Xe,bt){ft&&(bt=Xe,Xe=s[bt]),Qo(R,bt,Vn(Xe,o,l,bt,s,E))}),R}function rR(s){var o=Fr(s);return function(l){return U_(l,s,o)}}function U_(s,o,l){var d=l.length;if(s==null)return!d;for(s=Gt(s);d--;){var v=l[d],E=o[v],R=s[v];if(R===t&&!(v in s)||!E(R))return!1}return!0}function $_(s,o,l){if(typeof s!="function")throw new $n(u);return tu(function(){s.apply(t,l)},o)}function Jo(s,o,l,d){var v=-1,E=Ac,R=!0,L=s.length,H=[],le=o.length;if(!L)return H;l&&(o=ar(o,En(l))),d?(E=tp,R=!1):o.length>=i&&(E=Bo,R=!1,o=new qs(o));e:for(;++v<L;){var he=s[v],ve=l==null?he:l(he);if(he=d||he!==0?he:0,R&&ve===ve){for(var Ne=le;Ne--;)if(o[Ne]===ve)continue e;H.push(he)}else E(o,ve,d)||H.push(he)}return H}var ds=pS(fi),B_=pS(gp,!0);function nR(s,o){var l=!0;return ds(s,function(d,v,E){return l=!!o(d,v,E),l}),l}function Hc(s,o,l){for(var d=-1,v=s.length;++d<v;){var E=s[d],R=o(E);if(R!=null&&(L===t?R===R&&!Tn(R):l(R,L)))var L=R,H=E}return H}function iR(s,o,l,d){var v=s.length;for(l=ct(l),l<0&&(l=-l>v?0:v+l),d=d===t||d>v?v:ct(d),d<0&&(d+=v),d=l>d?0:sx(d);l<d;)s[l++]=o;return s}function V_(s,o){var l=[];return ds(s,function(d,v,E){o(d,v,E)&&l.push(d)}),l}function Br(s,o,l,d,v){var E=-1,R=s.length;for(l||(l=HR),v||(v=[]);++E<R;){var L=s[E];o>0&&l(L)?o>1?Br(L,o-1,l,d,v):ls(v,L):d||(v[v.length]=L)}return v}var yp=mS(),W_=mS(!0);function fi(s,o){return s&&yp(s,o,Fr)}function gp(s,o){return s&&W_(s,o,Fr)}function Gc(s,o){return cs(o,function(l){return Di(s[l])})}function Us(s,o){o=ms(o,s);for(var l=0,d=o.length;s!=null&&l<d;)s=s[di(o[l++])];return l&&l==d?s:t}function z_(s,o,l){var d=o(s);return at(s)?d:ls(d,l(s))}function rn(s){return s==null?s===t?pt:z:Fs&&Fs in Gt(s)?UR(s):XR(s)}function vp(s,o){return s>o}function sR(s,o){return s!=null&&Ut.call(s,o)}function aR(s,o){return s!=null&&o in Gt(s)}function oR(s,o,l){return s>=Gr(o,l)&&s<Ir(o,l)}function bp(s,o,l){for(var d=l?tp:Ac,v=s[0].length,E=s.length,R=E,L=te(E),H=1/0,le=[];R--;){var he=s[R];R&&o&&(he=ar(he,En(o))),H=Gr(he.length,H),L[R]=!l&&(o||v>=120&&he.length>=120)?new qs(R&&he):t}he=s[0];var ve=-1,Ne=L[0];e:for(;++ve<v&&le.length<H;){var Ue=he[ve],Ze=o?o(Ue):Ue;if(Ue=l||Ue!==0?Ue:0,!(Ne?Bo(Ne,Ze):d(le,Ze,l))){for(R=E;--R;){var ft=L[R];if(!(ft?Bo(ft,Ze):d(s[R],Ze,l)))continue e}Ne&&Ne.push(Ze),le.push(Ue)}}return le}function uR(s,o,l,d){return fi(s,function(v,E,R){o(d,l(v),E,R)}),d}function Yo(s,o,l){o=ms(o,s),s=NS(s,o);var d=s==null?s:s[di(zn(o))];return d==null?t:xn(d,s,l)}function H_(s){return mr(s)&&rn(s)==ot}function cR(s){return mr(s)&&rn(s)==Xt}function lR(s){return mr(s)&&rn(s)==Fe}function Ko(s,o,l,d,v){return s===o?!0:s==null||o==null||!mr(s)&&!mr(o)?s!==s&&o!==o:fR(s,o,l,d,Ko,v)}function fR(s,o,l,d,v,E){var R=at(s),L=at(o),H=R?tt:Qr(s),le=L?tt:Qr(o);H=H==ot?Oe:H,le=le==ot?Oe:le;var he=H==Oe,ve=le==Oe,Ne=H==le;if(Ne&&gs(s)){if(!gs(o))return!1;R=!0,he=!1}if(Ne&&!he)return E||(E=new ni),R||Ua(s)?OS(s,o,l,d,v,E):qR(s,o,H,l,d,v,E);if(!(l&b)){var Ue=he&&Ut.call(s,"__wrapped__"),Ze=ve&&Ut.call(o,"__wrapped__");if(Ue||Ze){var ft=Ue?s.value():s,Xe=Ze?o.value():o;return E||(E=new ni),v(ft,Xe,l,d,E)}}return Ne?(E||(E=new ni),jR(s,o,l,d,v,E)):!1}function hR(s){return mr(s)&&Qr(s)==Z}function wp(s,o,l,d){var v=l.length,E=v,R=!d;if(s==null)return!E;for(s=Gt(s);v--;){var L=l[v];if(R&&L[2]?L[1]!==s[L[0]]:!(L[0]in s))return!1}for(;++v<E;){L=l[v];var H=L[0],le=s[H],he=L[1];if(R&&L[2]){if(le===t&&!(H in s))return!1}else{var ve=new ni;if(d)var Ne=d(le,he,H,s,o,ve);if(!(Ne===t?Ko(he,le,b|I,d,ve):Ne))return!1}}return!0}function G_(s){if(!cr(s)||QR(s))return!1;var o=Di(s)?h2:Ht;return o.test(Bs(s))}function dR(s){return mr(s)&&rn(s)==ce}function pR(s){return mr(s)&&Qr(s)==Se}function mR(s){return mr(s)&&ll(s.length)&&!!rr[rn(s)]}function Q_(s){return typeof s=="function"?s:s==null?dn:typeof s=="object"?at(s)?K_(s[0],s[1]):Y_(s):yx(s)}function _p(s){if(!eu(s))return v2(s);var o=[];for(var l in Gt(s))Ut.call(s,l)&&l!="constructor"&&o.push(l);return o}function yR(s){if(!cr(s))return ZR(s);var o=eu(s),l=[];for(var d in s)d=="constructor"&&(o||!Ut.call(s,d))||l.push(d);return l}function Sp(s,o){return s<o}function J_(s,o){var l=-1,d=fn(s)?te(s.length):[];return ds(s,function(v,E,R){d[++l]=o(v,E,R)}),d}function Y_(s){var o=Lp(s);return o.length==1&&o[0][2]?CS(o[0][0],o[0][1]):function(l){return l===s||wp(l,s,o)}}function K_(s,o){return jp(s)&&IS(o)?CS(di(s),o):function(l){var d=Jp(l,s);return d===t&&d===o?Yp(l,s):Ko(o,d,b|I)}}function Qc(s,o,l,d,v){s!==o&&yp(o,function(E,R){if(v||(v=new ni),cr(E))gR(s,o,R,l,Qc,d,v);else{var L=d?d($p(s,R),E,R+"",s,o,v):t;L===t&&(L=E),pp(s,R,L)}},hn)}function gR(s,o,l,d,v,E,R){var L=$p(s,l),H=$p(o,l),le=R.get(H);if(le){pp(s,l,le);return}var he=E?E(L,H,l+"",s,o,R):t,ve=he===t;if(ve){var Ne=at(H),Ue=!Ne&&gs(H),Ze=!Ne&&!Ue&&Ua(H);he=H,Ne||Ue||Ze?at(L)?he=L:vr(L)?he=ln(L):Ue?(ve=!1,he=cS(H,!0)):Ze?(ve=!1,he=lS(H,!0)):he=[]:ru(H)||Vs(H)?(he=L,Vs(L)?he=ax(L):(!cr(L)||Di(L))&&(he=AS(H))):ve=!1}ve&&(R.set(H,he),v(he,H,d,E,R),R.delete(H)),pp(s,l,he)}function Z_(s,o){var l=s.length;if(l)return o+=o<0?l:0,Mi(o,l)?s[o]:t}function X_(s,o,l){o.length?o=ar(o,function(E){return at(E)?function(R){return Us(R,E.length===1?E[0]:E)}:E}):o=[dn];var d=-1;o=ar(o,En(Ke()));var v=J_(s,function(E,R,L){var H=ar(o,function(le){return le(E)});return{criteria:H,index:++d,value:E}});return WN(v,function(E,R){return CR(E,R,l)})}function vR(s,o){return eS(s,o,function(l,d){return Yp(s,d)})}function eS(s,o,l){for(var d=-1,v=o.length,E={};++d<v;){var R=o[d],L=Us(s,R);l(L,R)&&Zo(E,ms(R,s),L)}return E}function bR(s){return function(o){return Us(o,s)}}function xp(s,o,l,d){var v=d?VN:Ia,E=-1,R=o.length,L=s;for(s===o&&(o=ln(o)),l&&(L=ar(s,En(l)));++E<R;)for(var H=0,le=o[E],he=l?l(le):le;(H=v(L,he,H,d))>-1;)L!==s&&qc.call(L,H,1),qc.call(s,H,1);return s}function tS(s,o){for(var l=s?o.length:0,d=l-1;l--;){var v=o[l];if(l==d||v!==E){var E=v;Mi(v)?qc.call(s,v,1):kp(s,v)}}return s}function Ep(s,o){return s+$c(D_()*(o-s+1))}function wR(s,o,l,d){for(var v=-1,E=Ir(Uc((o-s)/(l||1)),0),R=te(E);E--;)R[d?E:++v]=s,s+=l;return R}function Op(s,o){var l="";if(!s||o<1||o>ee)return l;do o%2&&(l+=s),o=$c(o/2),o&&(s+=s);while(o);return l}function yt(s,o){return Bp(PS(s,o,dn),s+"")}function _R(s){return q_($a(s))}function SR(s,o){var l=$a(s);return il(l,js(o,0,l.length))}function Zo(s,o,l,d){if(!cr(s))return s;o=ms(o,s);for(var v=-1,E=o.length,R=E-1,L=s;L!=null&&++v<E;){var H=di(o[v]),le=l;if(H==="__proto__"||H==="constructor"||H==="prototype")return s;if(v!=R){var he=L[H];le=d?d(he,H,L):t,le===t&&(le=cr(he)?he:Mi(o[v+1])?[]:{})}Qo(L,H,le),L=L[H]}return s}var rS=Bc?function(s,o){return Bc.set(s,o),s}:dn,xR=jc?function(s,o){return jc(s,"toString",{configurable:!0,enumerable:!1,value:Zp(o),writable:!0})}:dn;function ER(s){return il($a(s))}function Wn(s,o,l){var d=-1,v=s.length;o<0&&(o=-o>v?0:v+o),l=l>v?v:l,l<0&&(l+=v),v=o>l?0:l-o>>>0,o>>>=0;for(var E=te(v);++d<v;)E[d]=s[d+o];return E}function OR(s,o){var l;return ds(s,function(d,v,E){return l=o(d,v,E),!l}),!!l}function Jc(s,o,l){var d=0,v=s==null?d:s.length;if(typeof o=="number"&&o===o&&v<=ht){for(;d<v;){var E=d+v>>>1,R=s[E];R!==null&&!Tn(R)&&(l?R<=o:R<o)?d=E+1:v=E}return v}return Tp(s,o,dn,l)}function Tp(s,o,l,d){var v=0,E=s==null?0:s.length;if(E===0)return 0;o=l(o);for(var R=o!==o,L=o===null,H=Tn(o),le=o===t;v<E;){var he=$c((v+E)/2),ve=l(s[he]),Ne=ve!==t,Ue=ve===null,Ze=ve===ve,ft=Tn(ve);if(R)var Xe=d||Ze;else le?Xe=Ze&&(d||Ne):L?Xe=Ze&&Ne&&(d||!Ue):H?Xe=Ze&&Ne&&!Ue&&(d||!ft):Ue||ft?Xe=!1:Xe=d?ve<=o:ve<o;Xe?v=he+1:E=he}return Gr(E,Be)}function nS(s,o){for(var l=-1,d=s.length,v=0,E=[];++l<d;){var R=s[l],L=o?o(R):R;if(!l||!ii(L,H)){var H=L;E[v++]=R===0?0:R}}return E}function iS(s){return typeof s=="number"?s:Tn(s)?fe:+s}function On(s){if(typeof s=="string")return s;if(at(s))return ar(s,On)+"";if(Tn(s))return F_?F_.call(s):"";var o=s+"";return o=="0"&&1/s==-Te?"-0":o}function ps(s,o,l){var d=-1,v=Ac,E=s.length,R=!0,L=[],H=L;if(l)R=!1,v=tp;else if(E>=i){var le=o?null:FR(s);if(le)return Cc(le);R=!1,v=Bo,H=new qs}else H=o?[]:L;e:for(;++d<E;){var he=s[d],ve=o?o(he):he;if(he=l||he!==0?he:0,R&&ve===ve){for(var Ne=H.length;Ne--;)if(H[Ne]===ve)continue e;o&&H.push(ve),L.push(he)}else v(H,ve,l)||(H!==L&&H.push(ve),L.push(he))}return L}function kp(s,o){return o=ms(o,s),s=NS(s,o),s==null||delete s[di(zn(o))]}function sS(s,o,l,d){return Zo(s,o,l(Us(s,o)),d)}function Yc(s,o,l,d){for(var v=s.length,E=d?v:-1;(d?E--:++E<v)&&o(s[E],E,s););return l?Wn(s,d?0:E,d?E+1:v):Wn(s,d?E+1:0,d?v:E)}function aS(s,o){var l=s;return l instanceof xt&&(l=l.value()),rp(o,function(d,v){return v.func.apply(v.thisArg,ls([d],v.args))},l)}function Ap(s,o,l){var d=s.length;if(d<2)return d?ps(s[0]):[];for(var v=-1,E=te(d);++v<d;)for(var R=s[v],L=-1;++L<d;)L!=v&&(E[v]=Jo(E[v]||R,s[L],o,l));return ps(Br(E,1),o,l)}function oS(s,o,l){for(var d=-1,v=s.length,E=o.length,R={};++d<v;){var L=d<E?o[d]:t;l(R,s[d],L)}return R}function Ip(s){return vr(s)?s:[]}function Cp(s){return typeof s=="function"?s:dn}function ms(s,o){return at(s)?s:jp(s,o)?[s]:FS(jt(s))}var TR=yt;function ys(s,o,l){var d=s.length;return l=l===t?d:l,!o&&l>=d?s:Wn(s,o,l)}var uS=d2||function(s){return $r.clearTimeout(s)};function cS(s,o){if(o)return s.slice();var l=s.length,d=C_?C_(l):new s.constructor(l);return s.copy(d),d}function Pp(s){var o=new s.constructor(s.byteLength);return new Fc(o).set(new Fc(s)),o}function kR(s,o){var l=o?Pp(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.byteLength)}function AR(s){var o=new s.constructor(s.source,Qe.exec(s));return o.lastIndex=s.lastIndex,o}function IR(s){return Go?Gt(Go.call(s)):{}}function lS(s,o){var l=o?Pp(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.length)}function fS(s,o){if(s!==o){var l=s!==t,d=s===null,v=s===s,E=Tn(s),R=o!==t,L=o===null,H=o===o,le=Tn(o);if(!L&&!le&&!E&&s>o||E&&R&&H&&!L&&!le||d&&R&&H||!l&&H||!v)return 1;if(!d&&!E&&!le&&s<o||le&&l&&v&&!d&&!E||L&&l&&v||!R&&v||!H)return-1}return 0}function CR(s,o,l){for(var d=-1,v=s.criteria,E=o.criteria,R=v.length,L=l.length;++d<R;){var H=fS(v[d],E[d]);if(H){if(d>=L)return H;var le=l[d];return H*(le=="desc"?-1:1)}}return s.index-o.index}function hS(s,o,l,d){for(var v=-1,E=s.length,R=l.length,L=-1,H=o.length,le=Ir(E-R,0),he=te(H+le),ve=!d;++L<H;)he[L]=o[L];for(;++v<R;)(ve||v<E)&&(he[l[v]]=s[v]);for(;le--;)he[L++]=s[v++];return he}function dS(s,o,l,d){for(var v=-1,E=s.length,R=-1,L=l.length,H=-1,le=o.length,he=Ir(E-L,0),ve=te(he+le),Ne=!d;++v<he;)ve[v]=s[v];for(var Ue=v;++H<le;)ve[Ue+H]=o[H];for(;++R<L;)(Ne||v<E)&&(ve[Ue+l[R]]=s[v++]);return ve}function ln(s,o){var l=-1,d=s.length;for(o||(o=te(d));++l<d;)o[l]=s[l];return o}function hi(s,o,l,d){var v=!l;l||(l={});for(var E=-1,R=o.length;++E<R;){var L=o[E],H=d?d(l[L],s[L],L,l,s):t;H===t&&(H=s[L]),v?Pi(l,L,H):Qo(l,L,H)}return l}function PR(s,o){return hi(s,qp(s),o)}function NR(s,o){return hi(s,TS(s),o)}function Kc(s,o){return function(l,d){var v=at(l)?LN:eR,E=o?o():{};return v(l,s,Ke(d,2),E)}}function La(s){return yt(function(o,l){var d=-1,v=l.length,E=v>1?l[v-1]:t,R=v>2?l[2]:t;for(E=s.length>3&&typeof E=="function"?(v--,E):t,R&&nn(l[0],l[1],R)&&(E=v<3?t:E,v=1),o=Gt(o);++d<v;){var L=l[d];L&&s(o,L,d,E)}return o})}function pS(s,o){return function(l,d){if(l==null)return l;if(!fn(l))return s(l,d);for(var v=l.length,E=o?v:-1,R=Gt(l);(o?E--:++E<v)&&d(R[E],E,R)!==!1;);return l}}function mS(s){return function(o,l,d){for(var v=-1,E=Gt(o),R=d(o),L=R.length;L--;){var H=R[s?L:++v];if(l(E[H],H,E)===!1)break}return o}}function RR(s,o,l){var d=o&S,v=Xo(s);function E(){var R=this&&this!==$r&&this instanceof E?v:s;return R.apply(d?l:this,arguments)}return E}function yS(s){return function(o){o=jt(o);var l=Ca(o)?ri(o):t,d=l?l[0]:o.charAt(0),v=l?ys(l,1).join(""):o.slice(1);return d[s]()+v}}function qa(s){return function(o){return rp(px(dx(o).replace(xN,"")),s,"")}}function Xo(s){return function(){var o=arguments;switch(o.length){case 0:return new s;case 1:return new s(o[0]);case 2:return new s(o[0],o[1]);case 3:return new s(o[0],o[1],o[2]);case 4:return new s(o[0],o[1],o[2],o[3]);case 5:return new s(o[0],o[1],o[2],o[3],o[4]);case 6:return new s(o[0],o[1],o[2],o[3],o[4],o[5]);case 7:return new s(o[0],o[1],o[2],o[3],o[4],o[5],o[6])}var l=Fa(s.prototype),d=s.apply(l,o);return cr(d)?d:l}}function MR(s,o,l){var d=Xo(s);function v(){for(var E=arguments.length,R=te(E),L=E,H=ja(v);L--;)R[L]=arguments[L];var le=E<3&&R[0]!==H&&R[E-1]!==H?[]:fs(R,H);if(E-=le.length,E<l)return _S(s,o,Zc,v.placeholder,t,R,le,t,t,l-E);var he=this&&this!==$r&&this instanceof v?d:s;return xn(he,this,R)}return v}function gS(s){return function(o,l,d){var v=Gt(o);if(!fn(o)){var E=Ke(l,3);o=Fr(o),l=function(L){return E(v[L],L,v)}}var R=s(o,l,d);return R>-1?v[E?o[R]:R]:t}}function vS(s){return Ri(function(o){var l=o.length,d=l,v=Bn.prototype.thru;for(s&&o.reverse();d--;){var E=o[d];if(typeof E!="function")throw new $n(u);if(v&&!R&&rl(E)=="wrapper")var R=new Bn([],!0)}for(d=R?d:l;++d<l;){E=o[d];var L=rl(E),H=L=="wrapper"?Fp(E):t;H&&Up(H[0])&&H[1]==(G|P|T|q)&&!H[4].length&&H[9]==1?R=R[rl(H[0])].apply(R,H[3]):R=E.length==1&&Up(E)?R[L]():R.thru(E)}return function(){var le=arguments,he=le[0];if(R&&le.length==1&&at(he))return R.plant(he).value();for(var ve=0,Ne=l?o[ve].apply(this,le):he;++ve<l;)Ne=o[ve].call(this,Ne);return Ne}})}function Zc(s,o,l,d,v,E,R,L,H,le){var he=o&G,ve=o&S,Ne=o&w,Ue=o&(P|D),Ze=o&$,ft=Ne?t:Xo(s);function Xe(){for(var bt=arguments.length,Ot=te(bt),kn=bt;kn--;)Ot[kn]=arguments[kn];if(Ue)var sn=ja(Xe),An=HN(Ot,sn);if(d&&(Ot=hS(Ot,d,v,Ue)),E&&(Ot=dS(Ot,E,R,Ue)),bt-=An,Ue&&bt<le){var br=fs(Ot,sn);return _S(s,o,Zc,Xe.placeholder,l,Ot,br,L,H,le-bt)}var si=ve?l:this,Li=Ne?si[s]:s;return bt=Ot.length,L?Ot=eM(Ot,L):Ze&&bt>1&&Ot.reverse(),he&&H<bt&&(Ot.length=H),this&&this!==$r&&this instanceof Xe&&(Li=ft||Xo(Li)),Li.apply(si,Ot)}return Xe}function bS(s,o){return function(l,d){return uR(l,s,o(d),{})}}function Xc(s,o){return function(l,d){var v;if(l===t&&d===t)return o;if(l!==t&&(v=l),d!==t){if(v===t)return d;typeof l=="string"||typeof d=="string"?(l=On(l),d=On(d)):(l=iS(l),d=iS(d)),v=s(l,d)}return v}}function Np(s){return Ri(function(o){return o=ar(o,En(Ke())),yt(function(l){var d=this;return s(o,function(v){return xn(v,d,l)})})})}function el(s,o){o=o===t?" ":On(o);var l=o.length;if(l<2)return l?Op(o,s):o;var d=Op(o,Uc(s/Pa(o)));return Ca(o)?ys(ri(d),0,s).join(""):d.slice(0,s)}function DR(s,o,l,d){var v=o&S,E=Xo(s);function R(){for(var L=-1,H=arguments.length,le=-1,he=d.length,ve=te(he+H),Ne=this&&this!==$r&&this instanceof R?E:s;++le<he;)ve[le]=d[le];for(;H--;)ve[le++]=arguments[++L];return xn(Ne,v?l:this,ve)}return R}function wS(s){return function(o,l,d){return d&&typeof d!="number"&&nn(o,l,d)&&(l=d=t),o=Fi(o),l===t?(l=o,o=0):l=Fi(l),d=d===t?o<l?1:-1:Fi(d),wR(o,l,d,s)}}function tl(s){return function(o,l){return typeof o=="string"&&typeof l=="string"||(o=Hn(o),l=Hn(l)),s(o,l)}}function _S(s,o,l,d,v,E,R,L,H,le){var he=o&P,ve=he?R:t,Ne=he?t:R,Ue=he?E:t,Ze=he?t:E;o|=he?T:N,o&=~(he?N:T),o&O||(o&=-4);var ft=[s,o,v,Ue,ve,Ze,Ne,L,H,le],Xe=l.apply(t,ft);return Up(s)&&RS(Xe,ft),Xe.placeholder=d,MS(Xe,s,o)}function Rp(s){var o=Ar[s];return function(l,d){if(l=Hn(l),d=d==null?0:Gr(ct(d),292),d&&M_(l)){var v=(jt(l)+"e").split("e"),E=o(v[0]+"e"+(+v[1]+d));return v=(jt(E)+"e").split("e"),+(v[0]+"e"+(+v[1]-d))}return o(l)}}var FR=Ma&&1/Cc(new Ma([,-0]))[1]==Te?function(s){return new Ma(s)}:tm;function SS(s){return function(o){var l=Qr(o);return l==Z?cp(o):l==Se?XN(o):zN(o,s(o))}}function Ni(s,o,l,d,v,E,R,L){var H=o&w;if(!H&&typeof s!="function")throw new $n(u);var le=d?d.length:0;if(le||(o&=-97,d=v=t),R=R===t?R:Ir(ct(R),0),L=L===t?L:ct(L),le-=v?v.length:0,o&N){var he=d,ve=v;d=v=t}var Ne=H?t:Fp(s),Ue=[s,o,l,d,v,he,ve,E,R,L];if(Ne&&KR(Ue,Ne),s=Ue[0],o=Ue[1],l=Ue[2],d=Ue[3],v=Ue[4],L=Ue[9]=Ue[9]===t?H?0:s.length:Ir(Ue[9]-le,0),!L&&o&(P|D)&&(o&=-25),!o||o==S)var Ze=RR(s,o,l);else o==P||o==D?Ze=MR(s,o,L):(o==T||o==(S|T))&&!v.length?Ze=DR(s,o,l,d):Ze=Zc.apply(t,Ue);var ft=Ne?rS:RS;return MS(ft(Ze,Ue),s,o)}function xS(s,o,l,d){return s===t||ii(s,Ra[l])&&!Ut.call(d,l)?o:s}function ES(s,o,l,d,v,E){return cr(s)&&cr(o)&&(E.set(o,s),Qc(s,o,t,ES,E),E.delete(o)),s}function LR(s){return ru(s)?t:s}function OS(s,o,l,d,v,E){var R=l&b,L=s.length,H=o.length;if(L!=H&&!(R&&H>L))return!1;var le=E.get(s),he=E.get(o);if(le&&he)return le==o&&he==s;var ve=-1,Ne=!0,Ue=l&I?new qs:t;for(E.set(s,o),E.set(o,s);++ve<L;){var Ze=s[ve],ft=o[ve];if(d)var Xe=R?d(ft,Ze,ve,o,s,E):d(Ze,ft,ve,s,o,E);if(Xe!==t){if(Xe)continue;Ne=!1;break}if(Ue){if(!np(o,function(bt,Ot){if(!Bo(Ue,Ot)&&(Ze===bt||v(Ze,bt,l,d,E)))return Ue.push(Ot)})){Ne=!1;break}}else if(!(Ze===ft||v(Ze,ft,l,d,E))){Ne=!1;break}}return E.delete(s),E.delete(o),Ne}function qR(s,o,l,d,v,E,R){switch(l){case zt:if(s.byteLength!=o.byteLength||s.byteOffset!=o.byteOffset)return!1;s=s.buffer,o=o.buffer;case Xt:return!(s.byteLength!=o.byteLength||!E(new Fc(s),new Fc(o)));case St:case Fe:case ne:return ii(+s,+o);case W:return s.name==o.name&&s.message==o.message;case ce:case Je:return s==o+"";case Z:var L=cp;case Se:var H=d&b;if(L||(L=Cc),s.size!=o.size&&!H)return!1;var le=R.get(s);if(le)return le==o;d|=I,R.set(s,o);var he=OS(L(s),L(o),d,v,E,R);return R.delete(s),he;case dt:if(Go)return Go.call(s)==Go.call(o)}return!1}function jR(s,o,l,d,v,E){var R=l&b,L=Mp(s),H=L.length,le=Mp(o),he=le.length;if(H!=he&&!R)return!1;for(var ve=H;ve--;){var Ne=L[ve];if(!(R?Ne in o:Ut.call(o,Ne)))return!1}var Ue=E.get(s),Ze=E.get(o);if(Ue&&Ze)return Ue==o&&Ze==s;var ft=!0;E.set(s,o),E.set(o,s);for(var Xe=R;++ve<H;){Ne=L[ve];var bt=s[Ne],Ot=o[Ne];if(d)var kn=R?d(Ot,bt,Ne,o,s,E):d(bt,Ot,Ne,s,o,E);if(!(kn===t?bt===Ot||v(bt,Ot,l,d,E):kn)){ft=!1;break}Xe||(Xe=Ne=="constructor")}if(ft&&!Xe){var sn=s.constructor,An=o.constructor;sn!=An&&"constructor"in s&&"constructor"in o&&!(typeof sn=="function"&&sn instanceof sn&&typeof An=="function"&&An instanceof An)&&(ft=!1)}return E.delete(s),E.delete(o),ft}function Ri(s){return Bp(PS(s,t,US),s+"")}function Mp(s){return z_(s,Fr,qp)}function Dp(s){return z_(s,hn,TS)}var Fp=Bc?function(s){return Bc.get(s)}:tm;function rl(s){for(var o=s.name+"",l=Da[o],d=Ut.call(Da,o)?l.length:0;d--;){var v=l[d],E=v.func;if(E==null||E==s)return v.name}return o}function ja(s){var o=Ut.call(x,"placeholder")?x:s;return o.placeholder}function Ke(){var s=x.iteratee||Xp;return s=s===Xp?Q_:s,arguments.length?s(arguments[0],arguments[1]):s}function nl(s,o){var l=s.__data__;return GR(o)?l[typeof o=="string"?"string":"hash"]:l.map}function Lp(s){for(var o=Fr(s),l=o.length;l--;){var d=o[l],v=s[d];o[l]=[d,v,IS(v)]}return o}function $s(s,o){var l=YN(s,o);return G_(l)?l:t}function UR(s){var o=Ut.call(s,Fs),l=s[Fs];try{s[Fs]=t;var d=!0}catch{}var v=Mc.call(s);return d&&(o?s[Fs]=l:delete s[Fs]),v}var qp=fp?function(s){return s==null?[]:(s=Gt(s),cs(fp(s),function(o){return N_.call(s,o)}))}:rm,TS=fp?function(s){for(var o=[];s;)ls(o,qp(s)),s=Lc(s);return o}:rm,Qr=rn;(hp&&Qr(new hp(new ArrayBuffer(1)))!=zt||Wo&&Qr(new Wo)!=Z||dp&&Qr(dp.resolve())!=We||Ma&&Qr(new Ma)!=Se||zo&&Qr(new zo)!=Qt)&&(Qr=function(s){var o=rn(s),l=o==Oe?s.constructor:t,d=l?Bs(l):"";if(d)switch(d){case S2:return zt;case x2:return Z;case E2:return We;case O2:return Se;case T2:return Qt}return o});function $R(s,o,l){for(var d=-1,v=l.length;++d<v;){var E=l[d],R=E.size;switch(E.type){case"drop":s+=R;break;case"dropRight":o-=R;break;case"take":o=Gr(o,s+R);break;case"takeRight":s=Ir(s,o-R);break}}return{start:s,end:o}}function BR(s){var o=s.match(_n);return o?o[1].split(M):[]}function kS(s,o,l){o=ms(o,s);for(var d=-1,v=o.length,E=!1;++d<v;){var R=di(o[d]);if(!(E=s!=null&&l(s,R)))break;s=s[R]}return E||++d!=v?E:(v=s==null?0:s.length,!!v&&ll(v)&&Mi(R,v)&&(at(s)||Vs(s)))}function VR(s){var o=s.length,l=new s.constructor(o);return o&&typeof s[0]=="string"&&Ut.call(s,"index")&&(l.index=s.index,l.input=s.input),l}function AS(s){return typeof s.constructor=="function"&&!eu(s)?Fa(Lc(s)):{}}function WR(s,o,l){var d=s.constructor;switch(o){case Xt:return Pp(s);case St:case Fe:return new d(+s);case zt:return kR(s,l);case xr:case Vt:case dr:case pr:case Or:case Wt:case Q:case J:case it:return lS(s,l);case Z:return new d;case ne:case Je:return new d(s);case ce:return AR(s);case Se:return new d;case dt:return IR(s)}}function zR(s,o){var l=o.length;if(!l)return s;var d=l-1;return o[d]=(l>1?"& ":"")+o[d],o=o.join(l>2?", ":" "),s.replace(kr,`{
|
|
94
94
|
/* [wrapped with `+o+`] */
|
|
95
|
-
`)}function bM(s){return ut(s)||Us(s)||!!(p_&&s&&s[p_])}function Mi(s,o){var l=typeof s;return o=o??X,!!o&&(l=="number"||l!="symbol"&&bt.test(s))&&s>-1&&s%1==0&&s<o}function sn(s,o,l){if(!lr(l))return!1;var p=typeof o;return(p=="number"?fn(l)&&Mi(o,l.length):p=="string"&&o in l)?ai(l[o],s):!1}function Ip(s,o){if(ut(s))return!1;var l=typeof s;return l=="number"||l=="symbol"||l=="boolean"||s==null||kn(s)?!0:$r.test(s)||!Or.test(s)||o!=null&&s in Jt(o)}function wM(s){var o=typeof s;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?s!=="__proto__":s===null}function Cp(s){var o=Yc(s),l=S[o];if(typeof l!="function"||!(o in Ot.prototype))return!1;if(s===l)return!0;var p=Tp(l);return!!p&&s===p[0]}function _M(s){return!!l_&&l_ in s}var xM=Tc?Di:Gp;function Jo(s){var o=s&&s.constructor,l=typeof o=="function"&&o.prototype||Ca;return s===l}function lx(s){return s===s&&!lr(s)}function fx(s,o){return function(l){return l==null?!1:l[s]===o&&(o!==t||s in Jt(l))}}function SM(s){var o=rl(s,function(p){return l.size===h&&l.clear(),p}),l=o.cache;return o}function EM(s,o){var l=s[1],p=o[1],v=l|p,O=v<(x|_|K),N=p==K&&l==P||p==K&&l==ee&&s[7].length<=o[8]||p==(K|ee)&&o[7].length<=o[8]&&l==P;if(!(O||N))return s;p&x&&(s[2]=o[2],v|=l&x?0:A);var F=o[3];if(F){var z=s[3];s[3]=z?G_(z,F,o[4]):F,s[4]=z?us(s[3],d):o[4]}return F=o[5],F&&(z=s[5],s[5]=z?Q_(z,F,o[6]):F,s[6]=z?us(s[5],d):o[6]),F=o[7],F&&(s[7]=F),p&K&&(s[8]=s[8]==null?o[8]:Qr(s[8],o[8])),s[9]==null&&(s[9]=o[9]),s[0]=o[0],s[1]=v,s}function OM(s){var o=[];if(s!=null)for(var l in Jt(s))o.push(l);return o}function TM(s){return kc.call(s)}function hx(s,o,l){return o=Pr(o===t?s.length-1:o,0),function(){for(var p=arguments,v=-1,O=Pr(p.length-o,0),N=Z(O);++v<O;)N[v]=p[o+v];v=-1;for(var F=Z(o+1);++v<o;)F[v]=p[v];return F[o]=l(N),On(s,this,F)}}function dx(s,o){return o.length<2?s:Ls(s,Hn(o,0,-1))}function AM(s,o){for(var l=s.length,p=Qr(o.length,l),v=ln(s);p--;){var O=o[p];s[p]=Mi(O,l)?v[O]:t}return s}function Pp(s,o){if(!(o==="constructor"&&typeof s[o]=="function")&&o!="__proto__")return s[o]}var px=yx(L_),Yo=BN||function(s,o){return Br.setTimeout(s,o)},Np=yx(YR);function mx(s,o,l){var p=o+"";return Np(s,vM(p,kM(mM(p),l)))}function yx(s){var o=0,l=0;return function(){var p=HN(),v=Ce-(p-l);if(l=p,v>0){if(++o>=pe)return arguments[0]}else o=0;return s.apply(t,arguments)}}function Zc(s,o){var l=-1,p=s.length,v=p-1;for(o=o===t?p:o;++l<o;){var O=pp(l,v),N=s[O];s[O]=s[l],s[l]=N}return s.length=o,s}var gx=SM(function(s){var o=[];return s.charCodeAt(0)===46&&o.push(""),s.replace(Lr,function(l,p,v,O){o.push(v?O.replace(ve,"$1"):p||l)}),o});function di(s){if(typeof s=="string"||kn(s))return s;var o=s+"";return o=="0"&&1/s==-ke?"-0":o}function js(s){if(s!=null){try{return Ac.call(s)}catch{}try{return s+""}catch{}}return""}function kM(s,o){return Bn(Et,function(l){var p="_."+l[0];o&l[1]&&!xc(s,p)&&s.push(p)}),s.sort()}function vx(s){if(s instanceof Ot)return s.clone();var o=new Wn(s.__wrapped__,s.__chain__);return o.__actions__=ln(s.__actions__),o.__index__=s.__index__,o.__values__=s.__values__,o}function IM(s,o,l){(l?sn(s,o,l):o===t)?o=1:o=Pr(ht(o),0);var p=s==null?0:s.length;if(!p||o<1)return[];for(var v=0,O=0,N=Z(Mc(p/o));v<p;)N[O++]=Hn(s,v,v+=o);return N}function CM(s){for(var o=-1,l=s==null?0:s.length,p=0,v=[];++o<l;){var O=s[o];O&&(v[p++]=O)}return v}function PM(){var s=arguments.length;if(!s)return[];for(var o=Z(s-1),l=arguments[0],p=s;p--;)o[p-1]=arguments[p];return os(ut(l)?ln(l):[l],Vr(o,1))}var NM=gt(function(s,o){return vr(s)?Wo(s,Vr(o,1,vr,!0)):[]}),RM=gt(function(s,o){var l=Gn(o);return vr(l)&&(l=t),vr(s)?Wo(s,Vr(o,1,vr,!0),Ye(l,2)):[]}),MM=gt(function(s,o){var l=Gn(o);return vr(l)&&(l=t),vr(s)?Wo(s,Vr(o,1,vr,!0),t,l):[]});function DM(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:ht(o),Hn(s,o<0?0:o,p)):[]}function FM(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:ht(o),o=p-o,Hn(s,0,o<0?0:o)):[]}function LM(s,o){return s&&s.length?Wc(s,Ye(o,3),!0,!0):[]}function qM(s,o){return s&&s.length?Wc(s,Ye(o,3),!0):[]}function jM(s,o,l,p){var v=s==null?0:s.length;return v?(l&&typeof l!="number"&&sn(s,o,l)&&(l=0,p=v),PR(s,o,l,p)):[]}function bx(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:ht(l);return v<0&&(v=Pr(p+v,0)),Sc(s,Ye(o,3),v)}function wx(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=p-1;return l!==t&&(v=ht(l),v=l<0?Pr(p+v,0):Qr(v,p-1)),Sc(s,Ye(o,3),v,!0)}function _x(s){var o=s==null?0:s.length;return o?Vr(s,1):[]}function UM(s){var o=s==null?0:s.length;return o?Vr(s,ke):[]}function $M(s,o){var l=s==null?0:s.length;return l?(o=o===t?1:ht(o),Vr(s,o)):[]}function BM(s){for(var o=-1,l=s==null?0:s.length,p={};++o<l;){var v=s[o];p[v[0]]=v[1]}return p}function xx(s){return s&&s.length?s[0]:t}function VM(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:ht(l);return v<0&&(v=Pr(p+v,0)),Ta(s,o,v)}function WM(s){var o=s==null?0:s.length;return o?Hn(s,0,-1):[]}var zM=gt(function(s){var o=or(s,bp);return o.length&&o[0]===s[0]?cp(o):[]}),HM=gt(function(s){var o=Gn(s),l=or(s,bp);return o===Gn(l)?o=t:l.pop(),l.length&&l[0]===s[0]?cp(l,Ye(o,2)):[]}),GM=gt(function(s){var o=Gn(s),l=or(s,bp);return o=typeof o=="function"?o:t,o&&l.pop(),l.length&&l[0]===s[0]?cp(l,t,o):[]});function QM(s,o){return s==null?"":WN.call(s,o)}function Gn(s){var o=s==null?0:s.length;return o?s[o-1]:t}function JM(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=p;return l!==t&&(v=ht(l),v=v<0?Pr(p+v,0):Qr(v,p-1)),o===o?kN(s,o,v):Sc(s,r_,v,!0)}function YM(s,o){return s&&s.length?R_(s,ht(o)):t}var KM=gt(Sx);function Sx(s,o){return s&&s.length&&o&&o.length?dp(s,o):s}function ZM(s,o,l){return s&&s.length&&o&&o.length?dp(s,o,Ye(l,2)):s}function XM(s,o,l){return s&&s.length&&o&&o.length?dp(s,o,t,l):s}var eD=Ri(function(s,o){var l=s==null?0:s.length,p=sp(s,o);return F_(s,or(o,function(v){return Mi(v,l)?+v:v}).sort(H_)),p});function tD(s,o){var l=[];if(!(s&&s.length))return l;var p=-1,v=[],O=s.length;for(o=Ye(o,3);++p<O;){var N=s[p];o(N,p,s)&&(l.push(N),v.push(p))}return F_(s,v),l}function Rp(s){return s==null?s:QN.call(s)}function rD(s,o,l){var p=s==null?0:s.length;return p?(l&&typeof l!="number"&&sn(s,o,l)?(o=0,l=p):(o=o==null?0:ht(o),l=l===t?p:ht(l)),Hn(s,o,l)):[]}function nD(s,o){return Vc(s,o)}function iD(s,o,l){return yp(s,o,Ye(l,2))}function sD(s,o){var l=s==null?0:s.length;if(l){var p=Vc(s,o);if(p<l&&ai(s[p],o))return p}return-1}function aD(s,o){return Vc(s,o,!0)}function oD(s,o,l){return yp(s,o,Ye(l,2),!0)}function uD(s,o){var l=s==null?0:s.length;if(l){var p=Vc(s,o,!0)-1;if(ai(s[p],o))return p}return-1}function cD(s){return s&&s.length?q_(s):[]}function lD(s,o){return s&&s.length?q_(s,Ye(o,2)):[]}function fD(s){var o=s==null?0:s.length;return o?Hn(s,1,o):[]}function hD(s,o,l){return s&&s.length?(o=l||o===t?1:ht(o),Hn(s,0,o<0?0:o)):[]}function dD(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:ht(o),o=p-o,Hn(s,o<0?0:o,p)):[]}function pD(s,o){return s&&s.length?Wc(s,Ye(o,3),!1,!0):[]}function mD(s,o){return s&&s.length?Wc(s,Ye(o,3)):[]}var yD=gt(function(s){return fs(Vr(s,1,vr,!0))}),gD=gt(function(s){var o=Gn(s);return vr(o)&&(o=t),fs(Vr(s,1,vr,!0),Ye(o,2))}),vD=gt(function(s){var o=Gn(s);return o=typeof o=="function"?o:t,fs(Vr(s,1,vr,!0),t,o)});function bD(s){return s&&s.length?fs(s):[]}function wD(s,o){return s&&s.length?fs(s,Ye(o,2)):[]}function _D(s,o){return o=typeof o=="function"?o:t,s&&s.length?fs(s,t,o):[]}function Mp(s){if(!(s&&s.length))return[];var o=0;return s=as(s,function(l){if(vr(l))return o=Pr(l.length,o),!0}),Kd(o,function(l){return or(s,Qd(l))})}function Ex(s,o){if(!(s&&s.length))return[];var l=Mp(s);return o==null?l:or(l,function(p){return On(o,t,p)})}var xD=gt(function(s,o){return vr(s)?Wo(s,o):[]}),SD=gt(function(s){return vp(as(s,vr))}),ED=gt(function(s){var o=Gn(s);return vr(o)&&(o=t),vp(as(s,vr),Ye(o,2))}),OD=gt(function(s){var o=Gn(s);return o=typeof o=="function"?o:t,vp(as(s,vr),t,o)}),TD=gt(Mp);function AD(s,o){return B_(s||[],o||[],Vo)}function kD(s,o){return B_(s||[],o||[],Go)}var ID=gt(function(s){var o=s.length,l=o>1?s[o-1]:t;return l=typeof l=="function"?(s.pop(),l):t,Ex(s,l)});function Ox(s){var o=S(s);return o.__chain__=!0,o}function CD(s,o){return o(s),s}function Xc(s,o){return o(s)}var PD=Ri(function(s){var o=s.length,l=o?s[0]:0,p=this.__wrapped__,v=function(O){return sp(O,s)};return o>1||this.__actions__.length||!(p instanceof Ot)||!Mi(l)?this.thru(v):(p=p.slice(l,+l+(o?1:0)),p.__actions__.push({func:Xc,args:[v],thisArg:t}),new Wn(p,this.__chain__).thru(function(O){return o&&!O.length&&O.push(t),O}))});function ND(){return Ox(this)}function RD(){return new Wn(this.value(),this.__chain__)}function MD(){this.__values__===t&&(this.__values__=jx(this.value()));var s=this.__index__>=this.__values__.length,o=s?t:this.__values__[this.__index__++];return{done:s,value:o}}function DD(){return this}function FD(s){for(var o,l=this;l instanceof qc;){var p=vx(l);p.__index__=0,p.__values__=t,o?v.__wrapped__=p:o=p;var v=p;l=l.__wrapped__}return v.__wrapped__=s,o}function LD(){var s=this.__wrapped__;if(s instanceof Ot){var o=s;return this.__actions__.length&&(o=new Ot(this)),o=o.reverse(),o.__actions__.push({func:Xc,args:[Rp],thisArg:t}),new Wn(o,this.__chain__)}return this.thru(Rp)}function qD(){return $_(this.__wrapped__,this.__actions__)}var jD=zc(function(s,o,l){$t.call(s,l)?++s[l]:Pi(s,l,1)});function UD(s,o,l){var p=ut(s)?e_:CR;return l&&sn(s,o,l)&&(o=t),p(s,Ye(o,3))}function $D(s,o){var l=ut(s)?as:E_;return l(s,Ye(o,3))}var BD=Z_(bx),VD=Z_(wx);function WD(s,o){return Vr(el(s,o),1)}function zD(s,o){return Vr(el(s,o),ke)}function HD(s,o,l){return l=l===t?1:ht(l),Vr(el(s,o),l)}function Tx(s,o){var l=ut(s)?Bn:ls;return l(s,Ye(o,3))}function Ax(s,o){var l=ut(s)?fN:S_;return l(s,Ye(o,3))}var GD=zc(function(s,o,l){$t.call(s,l)?s[l].push(o):Pi(s,l,[o])});function QD(s,o,l,p){s=fn(s)?s:qa(s),l=l&&!p?ht(l):0;var v=s.length;return l<0&&(l=Pr(v+l,0)),sl(s)?l<=v&&s.indexOf(o,l)>-1:!!v&&Ta(s,o,l)>-1}var JD=gt(function(s,o,l){var p=-1,v=typeof o=="function",O=fn(s)?Z(s.length):[];return ls(s,function(N){O[++p]=v?On(o,N,l):zo(N,o,l)}),O}),YD=zc(function(s,o,l){Pi(s,l,o)});function el(s,o){var l=ut(s)?or:C_;return l(s,Ye(o,3))}function KD(s,o,l,p){return s==null?[]:(ut(o)||(o=o==null?[]:[o]),l=p?t:l,ut(l)||(l=l==null?[]:[l]),M_(s,o,l))}var ZD=zc(function(s,o,l){s[l?0:1].push(o)},function(){return[[],[]]});function XD(s,o,l){var p=ut(s)?Hd:i_,v=arguments.length<3;return p(s,Ye(o,4),l,v,ls)}function eF(s,o,l){var p=ut(s)?hN:i_,v=arguments.length<3;return p(s,Ye(o,4),l,v,S_)}function tF(s,o){var l=ut(s)?as:E_;return l(s,nl(Ye(o,3)))}function rF(s){var o=ut(s)?b_:QR;return o(s)}function nF(s,o,l){(l?sn(s,o,l):o===t)?o=1:o=ht(o);var p=ut(s)?OR:JR;return p(s,o)}function iF(s){var o=ut(s)?TR:KR;return o(s)}function sF(s){if(s==null)return 0;if(fn(s))return sl(s)?ka(s):s.length;var o=Jr(s);return o==J||o==we?s.size:fp(s).length}function aF(s,o,l){var p=ut(s)?Gd:ZR;return l&&sn(s,o,l)&&(o=t),p(s,Ye(o,3))}var oF=gt(function(s,o){if(s==null)return[];var l=o.length;return l>1&&sn(s,o[0],o[1])?o=[]:l>2&&sn(o[0],o[1],o[2])&&(o=[o[0]]),M_(s,Vr(o,1),[])}),tl=$N||function(){return Br.Date.now()};function uF(s,o){if(typeof o!="function")throw new Vn(u);return s=ht(s),function(){if(--s<1)return o.apply(this,arguments)}}function kx(s,o,l){return o=l?t:o,o=s&&o==null?s.length:o,Ni(s,K,t,t,t,t,o)}function Ix(s,o){var l;if(typeof o!="function")throw new Vn(u);return s=ht(s),function(){return--s>0&&(l=o.apply(this,arguments)),s<=1&&(o=t),l}}var Dp=gt(function(s,o,l){var p=x;if(l.length){var v=us(l,Fa(Dp));p|=$}return Ni(s,p,o,l,v)}),Cx=gt(function(s,o,l){var p=x|_;if(l.length){var v=us(l,Fa(Cx));p|=$}return Ni(o,p,s,l,v)});function Px(s,o,l){o=l?t:o;var p=Ni(s,P,t,t,t,t,t,o);return p.placeholder=Px.placeholder,p}function Nx(s,o,l){o=l?t:o;var p=Ni(s,M,t,t,t,t,t,o);return p.placeholder=Nx.placeholder,p}function Rx(s,o,l){var p,v,O,N,F,z,ae=0,ue=!1,me=!1,Ae=!0;if(typeof s!="function")throw new Vn(u);o=Qn(o)||0,lr(l)&&(ue=!!l.leading,me="maxWait"in l,O=me?Pr(Qn(l.maxWait)||0,o):O,Ae="trailing"in l?!!l.trailing:Ae);function Ue(br){var oi=p,Li=v;return p=v=t,ae=br,N=s.apply(Li,oi),N}function et(br){return ae=br,F=Yo(xt,o),ue?Ue(br):N}function pt(br){var oi=br-z,Li=br-ae,Zx=o-oi;return me?Qr(Zx,O-Li):Zx}function tt(br){var oi=br-z,Li=br-ae;return z===t||oi>=o||oi<0||me&&Li>=O}function xt(){var br=tl();if(tt(br))return kt(br);F=Yo(xt,pt(br))}function kt(br){return F=t,Ae&&p?Ue(br):(p=v=t,N)}function In(){F!==t&&V_(F),ae=0,p=z=v=F=t}function an(){return F===t?N:kt(tl())}function Cn(){var br=tl(),oi=tt(br);if(p=arguments,v=this,z=br,oi){if(F===t)return et(z);if(me)return V_(F),F=Yo(xt,o),Ue(z)}return F===t&&(F=Yo(xt,o)),N}return Cn.cancel=In,Cn.flush=an,Cn}var cF=gt(function(s,o){return x_(s,1,o)}),lF=gt(function(s,o,l){return x_(s,Qn(o)||0,l)});function fF(s){return Ni(s,fe)}function rl(s,o){if(typeof s!="function"||o!=null&&typeof o!="function")throw new Vn(u);var l=function(){var p=arguments,v=o?o.apply(this,p):p[0],O=l.cache;if(O.has(v))return O.get(v);var N=s.apply(this,p);return l.cache=O.set(v,N)||O,N};return l.cache=new(rl.Cache||Ci),l}rl.Cache=Ci;function nl(s){if(typeof s!="function")throw new Vn(u);return function(){var o=arguments;switch(o.length){case 0:return!s.call(this);case 1:return!s.call(this,o[0]);case 2:return!s.call(this,o[0],o[1]);case 3:return!s.call(this,o[0],o[1],o[2])}return!s.apply(this,o)}}function hF(s){return Ix(2,s)}var dF=XR(function(s,o){o=o.length==1&&ut(o[0])?or(o[0],Tn(Ye())):or(Vr(o,1),Tn(Ye()));var l=o.length;return gt(function(p){for(var v=-1,O=Qr(p.length,l);++v<O;)p[v]=o[v].call(this,p[v]);return On(s,this,p)})}),Fp=gt(function(s,o){var l=us(o,Fa(Fp));return Ni(s,$,t,o,l)}),Mx=gt(function(s,o){var l=us(o,Fa(Mx));return Ni(s,j,t,o,l)}),pF=Ri(function(s,o){return Ni(s,ee,t,t,t,o)});function mF(s,o){if(typeof s!="function")throw new Vn(u);return o=o===t?o:ht(o),gt(s,o)}function yF(s,o){if(typeof s!="function")throw new Vn(u);return o=o==null?0:Pr(ht(o),0),gt(function(l){var p=l[o],v=ds(l,0,o);return p&&os(v,p),On(s,this,v)})}function gF(s,o,l){var p=!0,v=!0;if(typeof s!="function")throw new Vn(u);return lr(l)&&(p="leading"in l?!!l.leading:p,v="trailing"in l?!!l.trailing:v),Rx(s,o,{leading:p,maxWait:o,trailing:v})}function vF(s){return kx(s,1)}function bF(s,o){return Fp(wp(o),s)}function wF(){if(!arguments.length)return[];var s=arguments[0];return ut(s)?s:[s]}function _F(s){return zn(s,m)}function xF(s,o){return o=typeof o=="function"?o:t,zn(s,m,o)}function SF(s){return zn(s,y|m)}function EF(s,o){return o=typeof o=="function"?o:t,zn(s,y|m,o)}function OF(s,o){return o==null||__(s,o,qr(o))}function ai(s,o){return s===o||s!==s&&o!==o}var TF=Jc(up),AF=Jc(function(s,o){return s>=o}),Us=A_(function(){return arguments}())?A_:function(s){return pr(s)&&$t.call(s,"callee")&&!d_.call(s,"callee")},ut=Z.isArray,kF=Qw?Tn(Qw):FR;function fn(s){return s!=null&&il(s.length)&&!Di(s)}function vr(s){return pr(s)&&fn(s)}function IF(s){return s===!0||s===!1||pr(s)&&nn(s)==vt}var ps=VN||Gp,CF=Jw?Tn(Jw):LR;function PF(s){return pr(s)&&s.nodeType===1&&!Ko(s)}function NF(s){if(s==null)return!0;if(fn(s)&&(ut(s)||typeof s=="string"||typeof s.splice=="function"||ps(s)||La(s)||Us(s)))return!s.length;var o=Jr(s);if(o==J||o==we)return!s.size;if(Jo(s))return!fp(s).length;for(var l in s)if($t.call(s,l))return!1;return!0}function RF(s,o){return Ho(s,o)}function MF(s,o,l){l=typeof l=="function"?l:t;var p=l?l(s,o):t;return p===t?Ho(s,o,t,l):!!p}function Lp(s){if(!pr(s))return!1;var o=nn(s);return o==V||o==Ge||typeof s.message=="string"&&typeof s.name=="string"&&!Ko(s)}function DF(s){return typeof s=="number"&&m_(s)}function Di(s){if(!lr(s))return!1;var o=nn(s);return o==Q||o==q||o==Je||o==$e}function Dx(s){return typeof s=="number"&&s==ht(s)}function il(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=X}function lr(s){var o=typeof s;return s!=null&&(o=="object"||o=="function")}function pr(s){return s!=null&&typeof s=="object"}var Fx=Yw?Tn(Yw):jR;function FF(s,o){return s===o||lp(s,o,Ap(o))}function LF(s,o,l){return l=typeof l=="function"?l:t,lp(s,o,Ap(o),l)}function qF(s){return Lx(s)&&s!=+s}function jF(s){if(xM(s))throw new ot(a);return k_(s)}function UF(s){return s===null}function $F(s){return s==null}function Lx(s){return typeof s=="number"||pr(s)&&nn(s)==te}function Ko(s){if(!pr(s)||nn(s)!=_e)return!1;var o=Pc(s);if(o===null)return!0;var l=$t.call(o,"constructor")&&o.constructor;return typeof l=="function"&&l instanceof l&&Ac.call(l)==LN}var qp=Kw?Tn(Kw):UR;function BF(s){return Dx(s)&&s>=-X&&s<=X}var qx=Zw?Tn(Zw):$R;function sl(s){return typeof s=="string"||!ut(s)&&pr(s)&&nn(s)==Qe}function kn(s){return typeof s=="symbol"||pr(s)&&nn(s)==mt}var La=Xw?Tn(Xw):BR;function VF(s){return s===t}function WF(s){return pr(s)&&Jr(s)==Yt}function zF(s){return pr(s)&&nn(s)==At}var HF=Jc(hp),GF=Jc(function(s,o){return s<=o});function jx(s){if(!s)return[];if(fn(s))return sl(s)?ii(s):ln(s);if(qo&&s[qo])return ON(s[qo]());var o=Jr(s),l=o==J?Xd:o==we?Ec:qa;return l(s)}function Fi(s){if(!s)return s===0?s:0;if(s=Qn(s),s===ke||s===-ke){var o=s<0?-1:1;return o*ye}return s===s?s:0}function ht(s){var o=Fi(s),l=o%1;return o===o?l?o-l:o:0}function Ux(s){return s?Fs(ht(s),0,Se):0}function Qn(s){if(typeof s=="number")return s;if(kn(s))return xe;if(lr(s)){var o=typeof s.valueOf=="function"?s.valueOf():s;s=lr(o)?o+"":o}if(typeof s!="string")return s===0?s:+s;s=s_(s);var l=Xe.test(s);return l||nt.test(s)?uN(s.slice(2),l?2:8):ct.test(s)?xe:+s}function $x(s){return hi(s,hn(s))}function QF(s){return s?Fs(ht(s),-X,X):s===0?s:0}function jt(s){return s==null?"":An(s)}var JF=Ma(function(s,o){if(Jo(o)||fn(o)){hi(o,qr(o),s);return}for(var l in o)$t.call(o,l)&&Vo(s,l,o[l])}),Bx=Ma(function(s,o){hi(o,hn(o),s)}),al=Ma(function(s,o,l,p){hi(o,hn(o),s,p)}),YF=Ma(function(s,o,l,p){hi(o,qr(o),s,p)}),KF=Ri(sp);function ZF(s,o){var l=Ra(s);return o==null?l:w_(l,o)}var XF=gt(function(s,o){s=Jt(s);var l=-1,p=o.length,v=p>2?o[2]:t;for(v&&sn(o[0],o[1],v)&&(p=1);++l<p;)for(var O=o[l],N=hn(O),F=-1,z=N.length;++F<z;){var ae=N[F],ue=s[ae];(ue===t||ai(ue,Ca[ae])&&!$t.call(s,ae))&&(s[ae]=O[ae])}return s}),e2=gt(function(s){return s.push(t,sx),On(Vx,t,s)});function t2(s,o){return t_(s,Ye(o,3),fi)}function r2(s,o){return t_(s,Ye(o,3),op)}function n2(s,o){return s==null?s:ap(s,Ye(o,3),hn)}function i2(s,o){return s==null?s:O_(s,Ye(o,3),hn)}function s2(s,o){return s&&fi(s,Ye(o,3))}function a2(s,o){return s&&op(s,Ye(o,3))}function o2(s){return s==null?[]:$c(s,qr(s))}function u2(s){return s==null?[]:$c(s,hn(s))}function jp(s,o,l){var p=s==null?t:Ls(s,o);return p===t?l:p}function c2(s,o){return s!=null&&ux(s,o,NR)}function Up(s,o){return s!=null&&ux(s,o,RR)}var l2=ex(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=kc.call(o)),s[o]=l},Bp(dn)),f2=ex(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=kc.call(o)),$t.call(s,o)?s[o].push(l):s[o]=[l]},Ye),h2=gt(zo);function qr(s){return fn(s)?v_(s):fp(s)}function hn(s){return fn(s)?v_(s,!0):VR(s)}function d2(s,o){var l={};return o=Ye(o,3),fi(s,function(p,v,O){Pi(l,o(p,v,O),p)}),l}function p2(s,o){var l={};return o=Ye(o,3),fi(s,function(p,v,O){Pi(l,v,o(p,v,O))}),l}var m2=Ma(function(s,o,l){Bc(s,o,l)}),Vx=Ma(function(s,o,l,p){Bc(s,o,l,p)}),y2=Ri(function(s,o){var l={};if(s==null)return l;var p=!1;o=or(o,function(O){return O=hs(O,s),p||(p=O.length>1),O}),hi(s,Op(s),l),p&&(l=zn(l,y|g|m,lM));for(var v=o.length;v--;)gp(l,o[v]);return l});function g2(s,o){return Wx(s,nl(Ye(o)))}var v2=Ri(function(s,o){return s==null?{}:zR(s,o)});function Wx(s,o){if(s==null)return{};var l=or(Op(s),function(p){return[p]});return o=Ye(o),D_(s,l,function(p,v){return o(p,v[0])})}function b2(s,o,l){o=hs(o,s);var p=-1,v=o.length;for(v||(v=1,s=t);++p<v;){var O=s==null?t:s[di(o[p])];O===t&&(p=v,O=l),s=Di(O)?O.call(s):O}return s}function w2(s,o,l){return s==null?s:Go(s,o,l)}function _2(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:Go(s,o,l,p)}var zx=nx(qr),Hx=nx(hn);function x2(s,o,l){var p=ut(s),v=p||ps(s)||La(s);if(o=Ye(o,4),l==null){var O=s&&s.constructor;v?l=p?new O:[]:lr(s)?l=Di(O)?Ra(Pc(s)):{}:l={}}return(v?Bn:fi)(s,function(N,F,z){return o(l,N,F,z)}),l}function S2(s,o){return s==null?!0:gp(s,o)}function E2(s,o,l){return s==null?s:U_(s,o,wp(l))}function O2(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:U_(s,o,wp(l),p)}function qa(s){return s==null?[]:Zd(s,qr(s))}function T2(s){return s==null?[]:Zd(s,hn(s))}function A2(s,o,l){return l===t&&(l=o,o=t),l!==t&&(l=Qn(l),l=l===l?l:0),o!==t&&(o=Qn(o),o=o===o?o:0),Fs(Qn(s),o,l)}function k2(s,o,l){return o=Fi(o),l===t?(l=o,o=0):l=Fi(l),s=Qn(s),MR(s,o,l)}function I2(s,o,l){if(l&&typeof l!="boolean"&&sn(s,o,l)&&(o=l=t),l===t&&(typeof o=="boolean"?(l=o,o=t):typeof s=="boolean"&&(l=s,s=t)),s===t&&o===t?(s=0,o=1):(s=Fi(s),o===t?(o=s,s=0):o=Fi(o)),s>o){var p=s;s=o,o=p}if(l||s%1||o%1){var v=y_();return Qr(s+v*(o-s+oN("1e-"+((v+"").length-1))),o)}return pp(s,o)}var C2=Da(function(s,o,l){return o=o.toLowerCase(),s+(l?Gx(o):o)});function Gx(s){return $p(jt(s).toLowerCase())}function Qx(s){return s=jt(s),s&&s.replace(w,wN).replace(KP,"")}function P2(s,o,l){s=jt(s),o=An(o);var p=s.length;l=l===t?p:Fs(ht(l),0,p);var v=l;return l-=o.length,l>=0&&s.slice(l,v)==o}function N2(s){return s=jt(s),s&&kr.test(s)?s.replace(Zt,_N):s}function R2(s){return s=jt(s),s&&Gr.test(s)?s.replace(ar,"\\$&"):s}var M2=Da(function(s,o,l){return s+(l?"-":"")+o.toLowerCase()}),D2=Da(function(s,o,l){return s+(l?" ":"")+o.toLowerCase()}),F2=K_("toLowerCase");function L2(s,o,l){s=jt(s),o=ht(o);var p=o?ka(s):0;if(!o||p>=o)return s;var v=(o-p)/2;return Qc(Dc(v),l)+s+Qc(Mc(v),l)}function q2(s,o,l){s=jt(s),o=ht(o);var p=o?ka(s):0;return o&&p<o?s+Qc(o-p,l):s}function j2(s,o,l){s=jt(s),o=ht(o);var p=o?ka(s):0;return o&&p<o?Qc(o-p,l)+s:s}function U2(s,o,l){return l||o==null?o=0:o&&(o=+o),GN(jt(s).replace(Tr,""),o||0)}function $2(s,o,l){return(l?sn(s,o,l):o===t)?o=1:o=ht(o),mp(jt(s),o)}function B2(){var s=arguments,o=jt(s[0]);return s.length<3?o:o.replace(s[1],s[2])}var V2=Da(function(s,o,l){return s+(l?"_":"")+o.toLowerCase()});function W2(s,o,l){return l&&typeof l!="number"&&sn(s,o,l)&&(o=l=t),l=l===t?Se:l>>>0,l?(s=jt(s),s&&(typeof o=="string"||o!=null&&!qp(o))&&(o=An(o),!o&&Aa(s))?ds(ii(s),0,l):s.split(o,l)):[]}var z2=Da(function(s,o,l){return s+(l?" ":"")+$p(o)});function H2(s,o,l){return s=jt(s),l=l==null?0:Fs(ht(l),0,s.length),o=An(o),s.slice(l,l+o.length)==o}function G2(s,o,l){var p=S.templateSettings;l&&sn(s,o,l)&&(o=t),s=jt(s),o=al({},o,p,ix);var v=al({},o.imports,p.imports,ix),O=qr(v),N=Zd(v,O),F,z,ae=0,ue=o.interpolate||k,me="__p += '",Ae=ep((o.escape||k).source+"|"+ue.source+"|"+(ue===Ut?Ne:k).source+"|"+(o.evaluate||k).source+"|$","g"),Ue="//# sourceURL="+($t.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++rN+"]")+`
|
|
96
|
-
`;s.replace(
|
|
97
|
-
__e(`+
|
|
98
|
-
'`),
|
|
99
|
-
`+
|
|
100
|
-
__p += '`),
|
|
101
|
-
((__t = (`+
|
|
102
|
-
'`),
|
|
103
|
-
`;var
|
|
104
|
-
`+
|
|
95
|
+
`)}function HR(s){return at(s)||Vs(s)||!!(R_&&s&&s[R_])}function Mi(s,o){var l=typeof s;return o=o??ee,!!o&&(l=="number"||l!="symbol"&>.test(s))&&s>-1&&s%1==0&&s<o}function nn(s,o,l){if(!cr(l))return!1;var d=typeof o;return(d=="number"?fn(l)&&Mi(o,l.length):d=="string"&&o in l)?ii(l[o],s):!1}function jp(s,o){if(at(s))return!1;var l=typeof s;return l=="number"||l=="symbol"||l=="boolean"||s==null||Tn(s)?!0:zr.test(s)||!Er.test(s)||o!=null&&s in Gt(o)}function GR(s){var o=typeof s;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?s!=="__proto__":s===null}function Up(s){var o=rl(s),l=x[o];if(typeof l!="function"||!(o in xt.prototype))return!1;if(s===l)return!0;var d=Fp(l);return!!d&&s===d[0]}function QR(s){return!!I_&&I_ in s}var JR=Nc?Di:nm;function eu(s){var o=s&&s.constructor,l=typeof o=="function"&&o.prototype||Ra;return s===l}function IS(s){return s===s&&!cr(s)}function CS(s,o){return function(l){return l==null?!1:l[s]===o&&(o!==t||s in Gt(l))}}function YR(s){var o=ul(s,function(d){return l.size===h&&l.clear(),d}),l=o.cache;return o}function KR(s,o){var l=s[1],d=o[1],v=l|d,E=v<(S|w|G),R=d==G&&l==P||d==G&&l==q&&s[7].length<=o[8]||d==(G|q)&&o[7].length<=o[8]&&l==P;if(!(E||R))return s;d&S&&(s[2]=o[2],v|=l&S?0:O);var L=o[3];if(L){var H=s[3];s[3]=H?hS(H,L,o[4]):L,s[4]=H?fs(s[3],p):o[4]}return L=o[5],L&&(H=s[5],s[5]=H?dS(H,L,o[6]):L,s[6]=H?fs(s[5],p):o[6]),L=o[7],L&&(s[7]=L),d&G&&(s[8]=s[8]==null?o[8]:Gr(s[8],o[8])),s[9]==null&&(s[9]=o[9]),s[0]=o[0],s[1]=v,s}function ZR(s){var o=[];if(s!=null)for(var l in Gt(s))o.push(l);return o}function XR(s){return Mc.call(s)}function PS(s,o,l){return o=Ir(o===t?s.length-1:o,0),function(){for(var d=arguments,v=-1,E=Ir(d.length-o,0),R=te(E);++v<E;)R[v]=d[o+v];v=-1;for(var L=te(o+1);++v<o;)L[v]=d[v];return L[o]=l(R),xn(s,this,L)}}function NS(s,o){return o.length<2?s:Us(s,Wn(o,0,-1))}function eM(s,o){for(var l=s.length,d=Gr(o.length,l),v=ln(s);d--;){var E=o[d];s[d]=Mi(E,l)?v[E]:t}return s}function $p(s,o){if(!(o==="constructor"&&typeof s[o]=="function")&&o!="__proto__")return s[o]}var RS=DS(rS),tu=m2||function(s,o){return $r.setTimeout(s,o)},Bp=DS(xR);function MS(s,o,l){var d=o+"";return Bp(s,zR(d,tM(BR(d),l)))}function DS(s){var o=0,l=0;return function(){var d=b2(),v=Ee-(d-l);if(l=d,v>0){if(++o>=re)return arguments[0]}else o=0;return s.apply(t,arguments)}}function il(s,o){var l=-1,d=s.length,v=d-1;for(o=o===t?d:o;++l<o;){var E=Ep(l,v),R=s[E];s[E]=s[l],s[l]=R}return s.length=o,s}var FS=YR(function(s){var o=[];return s.charCodeAt(0)===46&&o.push(""),s.replace(Dr,function(l,d,v,E){o.push(v?E.replace(je,"$1"):d||l)}),o});function di(s){if(typeof s=="string"||Tn(s))return s;var o=s+"";return o=="0"&&1/s==-Te?"-0":o}function Bs(s){if(s!=null){try{return Rc.call(s)}catch{}try{return s+""}catch{}}return""}function tM(s,o){return Un(It,function(l){var d="_."+l[0];o&l[1]&&!Ac(s,d)&&s.push(d)}),s.sort()}function LS(s){if(s instanceof xt)return s.clone();var o=new Bn(s.__wrapped__,s.__chain__);return o.__actions__=ln(s.__actions__),o.__index__=s.__index__,o.__values__=s.__values__,o}function rM(s,o,l){(l?nn(s,o,l):o===t)?o=1:o=Ir(ct(o),0);var d=s==null?0:s.length;if(!d||o<1)return[];for(var v=0,E=0,R=te(Uc(d/o));v<d;)R[E++]=Wn(s,v,v+=o);return R}function nM(s){for(var o=-1,l=s==null?0:s.length,d=0,v=[];++o<l;){var E=s[o];E&&(v[d++]=E)}return v}function iM(){var s=arguments.length;if(!s)return[];for(var o=te(s-1),l=arguments[0],d=s;d--;)o[d-1]=arguments[d];return ls(at(l)?ln(l):[l],Br(o,1))}var sM=yt(function(s,o){return vr(s)?Jo(s,Br(o,1,vr,!0)):[]}),aM=yt(function(s,o){var l=zn(o);return vr(l)&&(l=t),vr(s)?Jo(s,Br(o,1,vr,!0),Ke(l,2)):[]}),oM=yt(function(s,o){var l=zn(o);return vr(l)&&(l=t),vr(s)?Jo(s,Br(o,1,vr,!0),t,l):[]});function uM(s,o,l){var d=s==null?0:s.length;return d?(o=l||o===t?1:ct(o),Wn(s,o<0?0:o,d)):[]}function cM(s,o,l){var d=s==null?0:s.length;return d?(o=l||o===t?1:ct(o),o=d-o,Wn(s,0,o<0?0:o)):[]}function lM(s,o){return s&&s.length?Yc(s,Ke(o,3),!0,!0):[]}function fM(s,o){return s&&s.length?Yc(s,Ke(o,3),!0):[]}function hM(s,o,l,d){var v=s==null?0:s.length;return v?(l&&typeof l!="number"&&nn(s,o,l)&&(l=0,d=v),iR(s,o,l,d)):[]}function qS(s,o,l){var d=s==null?0:s.length;if(!d)return-1;var v=l==null?0:ct(l);return v<0&&(v=Ir(d+v,0)),Ic(s,Ke(o,3),v)}function jS(s,o,l){var d=s==null?0:s.length;if(!d)return-1;var v=d-1;return l!==t&&(v=ct(l),v=l<0?Ir(d+v,0):Gr(v,d-1)),Ic(s,Ke(o,3),v,!0)}function US(s){var o=s==null?0:s.length;return o?Br(s,1):[]}function dM(s){var o=s==null?0:s.length;return o?Br(s,Te):[]}function pM(s,o){var l=s==null?0:s.length;return l?(o=o===t?1:ct(o),Br(s,o)):[]}function mM(s){for(var o=-1,l=s==null?0:s.length,d={};++o<l;){var v=s[o];d[v[0]]=v[1]}return d}function $S(s){return s&&s.length?s[0]:t}function yM(s,o,l){var d=s==null?0:s.length;if(!d)return-1;var v=l==null?0:ct(l);return v<0&&(v=Ir(d+v,0)),Ia(s,o,v)}function gM(s){var o=s==null?0:s.length;return o?Wn(s,0,-1):[]}var vM=yt(function(s){var o=ar(s,Ip);return o.length&&o[0]===s[0]?bp(o):[]}),bM=yt(function(s){var o=zn(s),l=ar(s,Ip);return o===zn(l)?o=t:l.pop(),l.length&&l[0]===s[0]?bp(l,Ke(o,2)):[]}),wM=yt(function(s){var o=zn(s),l=ar(s,Ip);return o=typeof o=="function"?o:t,o&&l.pop(),l.length&&l[0]===s[0]?bp(l,t,o):[]});function _M(s,o){return s==null?"":g2.call(s,o)}function zn(s){var o=s==null?0:s.length;return o?s[o-1]:t}function SM(s,o,l){var d=s==null?0:s.length;if(!d)return-1;var v=d;return l!==t&&(v=ct(l),v=v<0?Ir(d+v,0):Gr(v,d-1)),o===o?t2(s,o,v):Ic(s,__,v,!0)}function xM(s,o){return s&&s.length?Z_(s,ct(o)):t}var EM=yt(BS);function BS(s,o){return s&&s.length&&o&&o.length?xp(s,o):s}function OM(s,o,l){return s&&s.length&&o&&o.length?xp(s,o,Ke(l,2)):s}function TM(s,o,l){return s&&s.length&&o&&o.length?xp(s,o,t,l):s}var kM=Ri(function(s,o){var l=s==null?0:s.length,d=mp(s,o);return tS(s,ar(o,function(v){return Mi(v,l)?+v:v}).sort(fS)),d});function AM(s,o){var l=[];if(!(s&&s.length))return l;var d=-1,v=[],E=s.length;for(o=Ke(o,3);++d<E;){var R=s[d];o(R,d,s)&&(l.push(R),v.push(d))}return tS(s,v),l}function Vp(s){return s==null?s:_2.call(s)}function IM(s,o,l){var d=s==null?0:s.length;return d?(l&&typeof l!="number"&&nn(s,o,l)?(o=0,l=d):(o=o==null?0:ct(o),l=l===t?d:ct(l)),Wn(s,o,l)):[]}function CM(s,o){return Jc(s,o)}function PM(s,o,l){return Tp(s,o,Ke(l,2))}function NM(s,o){var l=s==null?0:s.length;if(l){var d=Jc(s,o);if(d<l&&ii(s[d],o))return d}return-1}function RM(s,o){return Jc(s,o,!0)}function MM(s,o,l){return Tp(s,o,Ke(l,2),!0)}function DM(s,o){var l=s==null?0:s.length;if(l){var d=Jc(s,o,!0)-1;if(ii(s[d],o))return d}return-1}function FM(s){return s&&s.length?nS(s):[]}function LM(s,o){return s&&s.length?nS(s,Ke(o,2)):[]}function qM(s){var o=s==null?0:s.length;return o?Wn(s,1,o):[]}function jM(s,o,l){return s&&s.length?(o=l||o===t?1:ct(o),Wn(s,0,o<0?0:o)):[]}function UM(s,o,l){var d=s==null?0:s.length;return d?(o=l||o===t?1:ct(o),o=d-o,Wn(s,o<0?0:o,d)):[]}function $M(s,o){return s&&s.length?Yc(s,Ke(o,3),!1,!0):[]}function BM(s,o){return s&&s.length?Yc(s,Ke(o,3)):[]}var VM=yt(function(s){return ps(Br(s,1,vr,!0))}),WM=yt(function(s){var o=zn(s);return vr(o)&&(o=t),ps(Br(s,1,vr,!0),Ke(o,2))}),zM=yt(function(s){var o=zn(s);return o=typeof o=="function"?o:t,ps(Br(s,1,vr,!0),t,o)});function HM(s){return s&&s.length?ps(s):[]}function GM(s,o){return s&&s.length?ps(s,Ke(o,2)):[]}function QM(s,o){return o=typeof o=="function"?o:t,s&&s.length?ps(s,t,o):[]}function Wp(s){if(!(s&&s.length))return[];var o=0;return s=cs(s,function(l){if(vr(l))return o=Ir(l.length,o),!0}),op(o,function(l){return ar(s,ip(l))})}function VS(s,o){if(!(s&&s.length))return[];var l=Wp(s);return o==null?l:ar(l,function(d){return xn(o,t,d)})}var JM=yt(function(s,o){return vr(s)?Jo(s,o):[]}),YM=yt(function(s){return Ap(cs(s,vr))}),KM=yt(function(s){var o=zn(s);return vr(o)&&(o=t),Ap(cs(s,vr),Ke(o,2))}),ZM=yt(function(s){var o=zn(s);return o=typeof o=="function"?o:t,Ap(cs(s,vr),t,o)}),XM=yt(Wp);function eD(s,o){return oS(s||[],o||[],Qo)}function tD(s,o){return oS(s||[],o||[],Zo)}var rD=yt(function(s){var o=s.length,l=o>1?s[o-1]:t;return l=typeof l=="function"?(s.pop(),l):t,VS(s,l)});function WS(s){var o=x(s);return o.__chain__=!0,o}function nD(s,o){return o(s),s}function sl(s,o){return o(s)}var iD=Ri(function(s){var o=s.length,l=o?s[0]:0,d=this.__wrapped__,v=function(E){return mp(E,s)};return o>1||this.__actions__.length||!(d instanceof xt)||!Mi(l)?this.thru(v):(d=d.slice(l,+l+(o?1:0)),d.__actions__.push({func:sl,args:[v],thisArg:t}),new Bn(d,this.__chain__).thru(function(E){return o&&!E.length&&E.push(t),E}))});function sD(){return WS(this)}function aD(){return new Bn(this.value(),this.__chain__)}function oD(){this.__values__===t&&(this.__values__=ix(this.value()));var s=this.__index__>=this.__values__.length,o=s?t:this.__values__[this.__index__++];return{done:s,value:o}}function uD(){return this}function cD(s){for(var o,l=this;l instanceof Wc;){var d=LS(l);d.__index__=0,d.__values__=t,o?v.__wrapped__=d:o=d;var v=d;l=l.__wrapped__}return v.__wrapped__=s,o}function lD(){var s=this.__wrapped__;if(s instanceof xt){var o=s;return this.__actions__.length&&(o=new xt(this)),o=o.reverse(),o.__actions__.push({func:sl,args:[Vp],thisArg:t}),new Bn(o,this.__chain__)}return this.thru(Vp)}function fD(){return aS(this.__wrapped__,this.__actions__)}var hD=Kc(function(s,o,l){Ut.call(s,l)?++s[l]:Pi(s,l,1)});function dD(s,o,l){var d=at(s)?b_:nR;return l&&nn(s,o,l)&&(o=t),d(s,Ke(o,3))}function pD(s,o){var l=at(s)?cs:V_;return l(s,Ke(o,3))}var mD=gS(qS),yD=gS(jS);function gD(s,o){return Br(al(s,o),1)}function vD(s,o){return Br(al(s,o),Te)}function bD(s,o,l){return l=l===t?1:ct(l),Br(al(s,o),l)}function zS(s,o){var l=at(s)?Un:ds;return l(s,Ke(o,3))}function HS(s,o){var l=at(s)?qN:B_;return l(s,Ke(o,3))}var wD=Kc(function(s,o,l){Ut.call(s,l)?s[l].push(o):Pi(s,l,[o])});function _D(s,o,l,d){s=fn(s)?s:$a(s),l=l&&!d?ct(l):0;var v=s.length;return l<0&&(l=Ir(v+l,0)),fl(s)?l<=v&&s.indexOf(o,l)>-1:!!v&&Ia(s,o,l)>-1}var SD=yt(function(s,o,l){var d=-1,v=typeof o=="function",E=fn(s)?te(s.length):[];return ds(s,function(R){E[++d]=v?xn(o,R,l):Yo(R,o,l)}),E}),xD=Kc(function(s,o,l){Pi(s,l,o)});function al(s,o){var l=at(s)?ar:J_;return l(s,Ke(o,3))}function ED(s,o,l,d){return s==null?[]:(at(o)||(o=o==null?[]:[o]),l=d?t:l,at(l)||(l=l==null?[]:[l]),X_(s,o,l))}var OD=Kc(function(s,o,l){s[l?0:1].push(o)},function(){return[[],[]]});function TD(s,o,l){var d=at(s)?rp:x_,v=arguments.length<3;return d(s,Ke(o,4),l,v,ds)}function kD(s,o,l){var d=at(s)?jN:x_,v=arguments.length<3;return d(s,Ke(o,4),l,v,B_)}function AD(s,o){var l=at(s)?cs:V_;return l(s,cl(Ke(o,3)))}function ID(s){var o=at(s)?q_:_R;return o(s)}function CD(s,o,l){(l?nn(s,o,l):o===t)?o=1:o=ct(o);var d=at(s)?Z2:SR;return d(s,o)}function PD(s){var o=at(s)?X2:ER;return o(s)}function ND(s){if(s==null)return 0;if(fn(s))return fl(s)?Pa(s):s.length;var o=Qr(s);return o==Z||o==Se?s.size:_p(s).length}function RD(s,o,l){var d=at(s)?np:OR;return l&&nn(s,o,l)&&(o=t),d(s,Ke(o,3))}var MD=yt(function(s,o){if(s==null)return[];var l=o.length;return l>1&&nn(s,o[0],o[1])?o=[]:l>2&&nn(o[0],o[1],o[2])&&(o=[o[0]]),X_(s,Br(o,1),[])}),ol=p2||function(){return $r.Date.now()};function DD(s,o){if(typeof o!="function")throw new $n(u);return s=ct(s),function(){if(--s<1)return o.apply(this,arguments)}}function GS(s,o,l){return o=l?t:o,o=s&&o==null?s.length:o,Ni(s,G,t,t,t,t,o)}function QS(s,o){var l;if(typeof o!="function")throw new $n(u);return s=ct(s),function(){return--s>0&&(l=o.apply(this,arguments)),s<=1&&(o=t),l}}var zp=yt(function(s,o,l){var d=S;if(l.length){var v=fs(l,ja(zp));d|=T}return Ni(s,d,o,l,v)}),JS=yt(function(s,o,l){var d=S|w;if(l.length){var v=fs(l,ja(JS));d|=T}return Ni(o,d,s,l,v)});function YS(s,o,l){o=l?t:o;var d=Ni(s,P,t,t,t,t,t,o);return d.placeholder=YS.placeholder,d}function KS(s,o,l){o=l?t:o;var d=Ni(s,D,t,t,t,t,t,o);return d.placeholder=KS.placeholder,d}function ZS(s,o,l){var d,v,E,R,L,H,le=0,he=!1,ve=!1,Ne=!0;if(typeof s!="function")throw new $n(u);o=Hn(o)||0,cr(l)&&(he=!!l.leading,ve="maxWait"in l,E=ve?Ir(Hn(l.maxWait)||0,o):E,Ne="trailing"in l?!!l.trailing:Ne);function Ue(br){var si=d,Li=v;return d=v=t,le=br,R=s.apply(Li,si),R}function Ze(br){return le=br,L=tu(bt,o),he?Ue(br):R}function ft(br){var si=br-H,Li=br-le,gx=o-si;return ve?Gr(gx,E-Li):gx}function Xe(br){var si=br-H,Li=br-le;return H===t||si>=o||si<0||ve&&Li>=E}function bt(){var br=ol();if(Xe(br))return Ot(br);L=tu(bt,ft(br))}function Ot(br){return L=t,Ne&&d?Ue(br):(d=v=t,R)}function kn(){L!==t&&uS(L),le=0,d=H=v=L=t}function sn(){return L===t?R:Ot(ol())}function An(){var br=ol(),si=Xe(br);if(d=arguments,v=this,H=br,si){if(L===t)return Ze(H);if(ve)return uS(L),L=tu(bt,o),Ue(H)}return L===t&&(L=tu(bt,o)),R}return An.cancel=kn,An.flush=sn,An}var FD=yt(function(s,o){return $_(s,1,o)}),LD=yt(function(s,o,l){return $_(s,Hn(o)||0,l)});function qD(s){return Ni(s,$)}function ul(s,o){if(typeof s!="function"||o!=null&&typeof o!="function")throw new $n(u);var l=function(){var d=arguments,v=o?o.apply(this,d):d[0],E=l.cache;if(E.has(v))return E.get(v);var R=s.apply(this,d);return l.cache=E.set(v,R)||E,R};return l.cache=new(ul.Cache||Ci),l}ul.Cache=Ci;function cl(s){if(typeof s!="function")throw new $n(u);return function(){var o=arguments;switch(o.length){case 0:return!s.call(this);case 1:return!s.call(this,o[0]);case 2:return!s.call(this,o[0],o[1]);case 3:return!s.call(this,o[0],o[1],o[2])}return!s.apply(this,o)}}function jD(s){return QS(2,s)}var UD=TR(function(s,o){o=o.length==1&&at(o[0])?ar(o[0],En(Ke())):ar(Br(o,1),En(Ke()));var l=o.length;return yt(function(d){for(var v=-1,E=Gr(d.length,l);++v<E;)d[v]=o[v].call(this,d[v]);return xn(s,this,d)})}),Hp=yt(function(s,o){var l=fs(o,ja(Hp));return Ni(s,T,t,o,l)}),XS=yt(function(s,o){var l=fs(o,ja(XS));return Ni(s,N,t,o,l)}),$D=Ri(function(s,o){return Ni(s,q,t,t,t,o)});function BD(s,o){if(typeof s!="function")throw new $n(u);return o=o===t?o:ct(o),yt(s,o)}function VD(s,o){if(typeof s!="function")throw new $n(u);return o=o==null?0:Ir(ct(o),0),yt(function(l){var d=l[o],v=ys(l,0,o);return d&&ls(v,d),xn(s,this,v)})}function WD(s,o,l){var d=!0,v=!0;if(typeof s!="function")throw new $n(u);return cr(l)&&(d="leading"in l?!!l.leading:d,v="trailing"in l?!!l.trailing:v),ZS(s,o,{leading:d,maxWait:o,trailing:v})}function zD(s){return GS(s,1)}function HD(s,o){return Hp(Cp(o),s)}function GD(){if(!arguments.length)return[];var s=arguments[0];return at(s)?s:[s]}function QD(s){return Vn(s,g)}function JD(s,o){return o=typeof o=="function"?o:t,Vn(s,g,o)}function YD(s){return Vn(s,m|g)}function KD(s,o){return o=typeof o=="function"?o:t,Vn(s,m|g,o)}function ZD(s,o){return o==null||U_(s,o,Fr(o))}function ii(s,o){return s===o||s!==s&&o!==o}var XD=tl(vp),eF=tl(function(s,o){return s>=o}),Vs=H_(function(){return arguments}())?H_:function(s){return mr(s)&&Ut.call(s,"callee")&&!N_.call(s,"callee")},at=te.isArray,tF=d_?En(d_):cR;function fn(s){return s!=null&&ll(s.length)&&!Di(s)}function vr(s){return mr(s)&&fn(s)}function rF(s){return s===!0||s===!1||mr(s)&&rn(s)==St}var gs=y2||nm,nF=p_?En(p_):lR;function iF(s){return mr(s)&&s.nodeType===1&&!ru(s)}function sF(s){if(s==null)return!0;if(fn(s)&&(at(s)||typeof s=="string"||typeof s.splice=="function"||gs(s)||Ua(s)||Vs(s)))return!s.length;var o=Qr(s);if(o==Z||o==Se)return!s.size;if(eu(s))return!_p(s).length;for(var l in s)if(Ut.call(s,l))return!1;return!0}function aF(s,o){return Ko(s,o)}function oF(s,o,l){l=typeof l=="function"?l:t;var d=l?l(s,o):t;return d===t?Ko(s,o,t,l):!!d}function Gp(s){if(!mr(s))return!1;var o=rn(s);return o==W||o==Ge||typeof s.message=="string"&&typeof s.name=="string"&&!ru(s)}function uF(s){return typeof s=="number"&&M_(s)}function Di(s){if(!cr(s))return!1;var o=rn(s);return o==Y||o==U||o==Mt||o==$e}function ex(s){return typeof s=="number"&&s==ct(s)}function ll(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=ee}function cr(s){var o=typeof s;return s!=null&&(o=="object"||o=="function")}function mr(s){return s!=null&&typeof s=="object"}var tx=m_?En(m_):hR;function cF(s,o){return s===o||wp(s,o,Lp(o))}function lF(s,o,l){return l=typeof l=="function"?l:t,wp(s,o,Lp(o),l)}function fF(s){return rx(s)&&s!=+s}function hF(s){if(JR(s))throw new st(a);return G_(s)}function dF(s){return s===null}function pF(s){return s==null}function rx(s){return typeof s=="number"||mr(s)&&rn(s)==ne}function ru(s){if(!mr(s)||rn(s)!=Oe)return!1;var o=Lc(s);if(o===null)return!0;var l=Ut.call(o,"constructor")&&o.constructor;return typeof l=="function"&&l instanceof l&&Rc.call(l)==l2}var Qp=y_?En(y_):dR;function mF(s){return ex(s)&&s>=-ee&&s<=ee}var nx=g_?En(g_):pR;function fl(s){return typeof s=="string"||!at(s)&&mr(s)&&rn(s)==Je}function Tn(s){return typeof s=="symbol"||mr(s)&&rn(s)==dt}var Ua=v_?En(v_):mR;function yF(s){return s===t}function gF(s){return mr(s)&&Qr(s)==Qt}function vF(s){return mr(s)&&rn(s)==Et}var bF=tl(Sp),wF=tl(function(s,o){return s<=o});function ix(s){if(!s)return[];if(fn(s))return fl(s)?ri(s):ln(s);if(Vo&&s[Vo])return ZN(s[Vo]());var o=Qr(s),l=o==Z?cp:o==Se?Cc:$a;return l(s)}function Fi(s){if(!s)return s===0?s:0;if(s=Hn(s),s===Te||s===-Te){var o=s<0?-1:1;return o*ye}return s===s?s:0}function ct(s){var o=Fi(s),l=o%1;return o===o?l?o-l:o:0}function sx(s){return s?js(ct(s),0,Pe):0}function Hn(s){if(typeof s=="number")return s;if(Tn(s))return fe;if(cr(s)){var o=typeof s.valueOf=="function"?s.valueOf():s;s=cr(o)?o+"":o}if(typeof s!="string")return s===0?s:+s;s=E_(s);var l=Ye.test(s);return l||He.test(s)?DN(s.slice(2),l?2:8):et.test(s)?fe:+s}function ax(s){return hi(s,hn(s))}function _F(s){return s?js(ct(s),-ee,ee):s===0?s:0}function jt(s){return s==null?"":On(s)}var SF=La(function(s,o){if(eu(o)||fn(o)){hi(o,Fr(o),s);return}for(var l in o)Ut.call(o,l)&&Qo(s,l,o[l])}),ox=La(function(s,o){hi(o,hn(o),s)}),hl=La(function(s,o,l,d){hi(o,hn(o),s,d)}),xF=La(function(s,o,l,d){hi(o,Fr(o),s,d)}),EF=Ri(mp);function OF(s,o){var l=Fa(s);return o==null?l:j_(l,o)}var TF=yt(function(s,o){s=Gt(s);var l=-1,d=o.length,v=d>2?o[2]:t;for(v&&nn(o[0],o[1],v)&&(d=1);++l<d;)for(var E=o[l],R=hn(E),L=-1,H=R.length;++L<H;){var le=R[L],he=s[le];(he===t||ii(he,Ra[le])&&!Ut.call(s,le))&&(s[le]=E[le])}return s}),kF=yt(function(s){return s.push(t,ES),xn(ux,t,s)});function AF(s,o){return w_(s,Ke(o,3),fi)}function IF(s,o){return w_(s,Ke(o,3),gp)}function CF(s,o){return s==null?s:yp(s,Ke(o,3),hn)}function PF(s,o){return s==null?s:W_(s,Ke(o,3),hn)}function NF(s,o){return s&&fi(s,Ke(o,3))}function RF(s,o){return s&&gp(s,Ke(o,3))}function MF(s){return s==null?[]:Gc(s,Fr(s))}function DF(s){return s==null?[]:Gc(s,hn(s))}function Jp(s,o,l){var d=s==null?t:Us(s,o);return d===t?l:d}function FF(s,o){return s!=null&&kS(s,o,sR)}function Yp(s,o){return s!=null&&kS(s,o,aR)}var LF=bS(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=Mc.call(o)),s[o]=l},Zp(dn)),qF=bS(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=Mc.call(o)),Ut.call(s,o)?s[o].push(l):s[o]=[l]},Ke),jF=yt(Yo);function Fr(s){return fn(s)?L_(s):_p(s)}function hn(s){return fn(s)?L_(s,!0):yR(s)}function UF(s,o){var l={};return o=Ke(o,3),fi(s,function(d,v,E){Pi(l,o(d,v,E),d)}),l}function $F(s,o){var l={};return o=Ke(o,3),fi(s,function(d,v,E){Pi(l,v,o(d,v,E))}),l}var BF=La(function(s,o,l){Qc(s,o,l)}),ux=La(function(s,o,l,d){Qc(s,o,l,d)}),VF=Ri(function(s,o){var l={};if(s==null)return l;var d=!1;o=ar(o,function(E){return E=ms(E,s),d||(d=E.length>1),E}),hi(s,Dp(s),l),d&&(l=Vn(l,m|y|g,LR));for(var v=o.length;v--;)kp(l,o[v]);return l});function WF(s,o){return cx(s,cl(Ke(o)))}var zF=Ri(function(s,o){return s==null?{}:vR(s,o)});function cx(s,o){if(s==null)return{};var l=ar(Dp(s),function(d){return[d]});return o=Ke(o),eS(s,l,function(d,v){return o(d,v[0])})}function HF(s,o,l){o=ms(o,s);var d=-1,v=o.length;for(v||(v=1,s=t);++d<v;){var E=s==null?t:s[di(o[d])];E===t&&(d=v,E=l),s=Di(E)?E.call(s):E}return s}function GF(s,o,l){return s==null?s:Zo(s,o,l)}function QF(s,o,l,d){return d=typeof d=="function"?d:t,s==null?s:Zo(s,o,l,d)}var lx=SS(Fr),fx=SS(hn);function JF(s,o,l){var d=at(s),v=d||gs(s)||Ua(s);if(o=Ke(o,4),l==null){var E=s&&s.constructor;v?l=d?new E:[]:cr(s)?l=Di(E)?Fa(Lc(s)):{}:l={}}return(v?Un:fi)(s,function(R,L,H){return o(l,R,L,H)}),l}function YF(s,o){return s==null?!0:kp(s,o)}function KF(s,o,l){return s==null?s:sS(s,o,Cp(l))}function ZF(s,o,l,d){return d=typeof d=="function"?d:t,s==null?s:sS(s,o,Cp(l),d)}function $a(s){return s==null?[]:up(s,Fr(s))}function XF(s){return s==null?[]:up(s,hn(s))}function eL(s,o,l){return l===t&&(l=o,o=t),l!==t&&(l=Hn(l),l=l===l?l:0),o!==t&&(o=Hn(o),o=o===o?o:0),js(Hn(s),o,l)}function tL(s,o,l){return o=Fi(o),l===t?(l=o,o=0):l=Fi(l),s=Hn(s),oR(s,o,l)}function rL(s,o,l){if(l&&typeof l!="boolean"&&nn(s,o,l)&&(o=l=t),l===t&&(typeof o=="boolean"?(l=o,o=t):typeof s=="boolean"&&(l=s,s=t)),s===t&&o===t?(s=0,o=1):(s=Fi(s),o===t?(o=s,s=0):o=Fi(o)),s>o){var d=s;s=o,o=d}if(l||s%1||o%1){var v=D_();return Gr(s+v*(o-s+MN("1e-"+((v+"").length-1))),o)}return Ep(s,o)}var nL=qa(function(s,o,l){return o=o.toLowerCase(),s+(l?hx(o):o)});function hx(s){return Kp(jt(s).toLowerCase())}function dx(s){return s=jt(s),s&&s.replace(_,GN).replace(EN,"")}function iL(s,o,l){s=jt(s),o=On(o);var d=s.length;l=l===t?d:js(ct(l),0,d);var v=l;return l-=o.length,l>=0&&s.slice(l,v)==o}function sL(s){return s=jt(s),s&&Mr.test(s)?s.replace(Jt,QN):s}function aL(s){return s=jt(s),s&&Hr.test(s)?s.replace(er,"\\$&"):s}var oL=qa(function(s,o,l){return s+(l?"-":"")+o.toLowerCase()}),uL=qa(function(s,o,l){return s+(l?" ":"")+o.toLowerCase()}),cL=yS("toLowerCase");function lL(s,o,l){s=jt(s),o=ct(o);var d=o?Pa(s):0;if(!o||d>=o)return s;var v=(o-d)/2;return el($c(v),l)+s+el(Uc(v),l)}function fL(s,o,l){s=jt(s),o=ct(o);var d=o?Pa(s):0;return o&&d<o?s+el(o-d,l):s}function hL(s,o,l){s=jt(s),o=ct(o);var d=o?Pa(s):0;return o&&d<o?el(o-d,l)+s:s}function dL(s,o,l){return l||o==null?o=0:o&&(o=+o),w2(jt(s).replace(Tr,""),o||0)}function pL(s,o,l){return(l?nn(s,o,l):o===t)?o=1:o=ct(o),Op(jt(s),o)}function mL(){var s=arguments,o=jt(s[0]);return s.length<3?o:o.replace(s[1],s[2])}var yL=qa(function(s,o,l){return s+(l?"_":"")+o.toLowerCase()});function gL(s,o,l){return l&&typeof l!="number"&&nn(s,o,l)&&(o=l=t),l=l===t?Pe:l>>>0,l?(s=jt(s),s&&(typeof o=="string"||o!=null&&!Qp(o))&&(o=On(o),!o&&Ca(s))?ys(ri(s),0,l):s.split(o,l)):[]}var vL=qa(function(s,o,l){return s+(l?" ":"")+Kp(o)});function bL(s,o,l){return s=jt(s),l=l==null?0:js(ct(l),0,s.length),o=On(o),s.slice(l,l+o.length)==o}function wL(s,o,l){var d=x.templateSettings;l&&nn(s,o,l)&&(o=t),s=jt(s),o=hl({},o,d,xS);var v=hl({},o.imports,d.imports,xS),E=Fr(v),R=up(v,E),L,H,le=0,he=o.interpolate||A,ve="__p += '",Ne=lp((o.escape||A).source+"|"+he.source+"|"+(he===qt?ze:A).source+"|"+(o.evaluate||A).source+"|$","g"),Ue="//# sourceURL="+(Ut.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++IN+"]")+`
|
|
96
|
+
`;s.replace(Ne,function(Xe,bt,Ot,kn,sn,An){return Ot||(Ot=kn),ve+=s.slice(le,An).replace(k,JN),bt&&(L=!0,ve+=`' +
|
|
97
|
+
__e(`+bt+`) +
|
|
98
|
+
'`),sn&&(H=!0,ve+=`';
|
|
99
|
+
`+sn+`;
|
|
100
|
+
__p += '`),Ot&&(ve+=`' +
|
|
101
|
+
((__t = (`+Ot+`)) == null ? '' : __t) +
|
|
102
|
+
'`),le=An+Xe.length,Xe}),ve+=`';
|
|
103
|
+
`;var Ze=Ut.call(o,"variable")&&o.variable;if(!Ze)ve=`with (obj) {
|
|
104
|
+
`+ve+`
|
|
105
105
|
}
|
|
106
|
-
`;else if(
|
|
107
|
-
`+(
|
|
108
|
-
`)+"var __t, __p = ''"+(
|
|
106
|
+
`;else if(xe.test(Ze))throw new st(c);ve=(H?ve.replace(mt,""):ve).replace(lt,"$1").replace(Ve,"$1;"),ve="function("+(Ze||"obj")+`) {
|
|
107
|
+
`+(Ze?"":`obj || (obj = {});
|
|
108
|
+
`)+"var __t, __p = ''"+(L?", __e = _.escape":"")+(H?`, __j = Array.prototype.join;
|
|
109
109
|
function print() { __p += __j.call(arguments, '') }
|
|
110
110
|
`:`;
|
|
111
|
-
`)+
|
|
112
|
-
}`;var pt=Yx(function(){return Dt(O,Ue+"return "+me).apply(t,N)});if(pt.source=me,Lp(pt))throw pt;return pt}function Q2(s){return jt(s).toLowerCase()}function J2(s){return jt(s).toUpperCase()}function Y2(s,o,l){if(s=jt(s),s&&(l||o===t))return s_(s);if(!s||!(o=An(o)))return s;var p=ii(s),v=ii(o),O=a_(p,v),N=o_(p,v)+1;return ds(p,O,N).join("")}function K2(s,o,l){if(s=jt(s),s&&(l||o===t))return s.slice(0,c_(s)+1);if(!s||!(o=An(o)))return s;var p=ii(s),v=o_(p,ii(o))+1;return ds(p,0,v).join("")}function Z2(s,o,l){if(s=jt(s),s&&(l||o===t))return s.replace(Tr,"");if(!s||!(o=An(o)))return s;var p=ii(s),v=a_(p,ii(o));return ds(p,v).join("")}function X2(s,o){var l=de,p=Ie;if(lr(o)){var v="separator"in o?o.separator:v;l="length"in o?ht(o.length):l,p="omission"in o?An(o.omission):p}s=jt(s);var O=s.length;if(Aa(s)){var N=ii(s);O=N.length}if(l>=O)return s;var F=l-ka(p);if(F<1)return p;var z=N?ds(N,0,F).join(""):s.slice(0,F);if(v===t)return z+p;if(N&&(F+=z.length-F),qp(v)){if(s.slice(F).search(v)){var ae,ue=z;for(v.global||(v=ep(v.source,jt(Ve.exec(v))+"g")),v.lastIndex=0;ae=v.exec(ue);)var me=ae.index;z=z.slice(0,me===t?F:me)}}else if(s.indexOf(An(v),F)!=F){var Ae=z.lastIndexOf(v);Ae>-1&&(z=z.slice(0,Ae))}return z+p}function eL(s){return s=jt(s),s&&Qt.test(s)?s.replace(Kt,IN):s}var tL=Da(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),$p=K_("toUpperCase");function Jx(s,o,l){return s=jt(s),o=l?t:o,o===t?EN(s)?NN(s):mN(s):s.match(o)||[]}var Yx=gt(function(s,o){try{return On(s,t,o)}catch(l){return Lp(l)?l:new ot(l)}}),rL=Ri(function(s,o){return Bn(o,function(l){l=di(l),Pi(s,l,Dp(s[l],s))}),s});function nL(s){var o=s==null?0:s.length,l=Ye();return s=o?or(s,function(p){if(typeof p[1]!="function")throw new Vn(u);return[l(p[0]),p[1]]}):[],gt(function(p){for(var v=-1;++v<o;){var O=s[v];if(On(O[0],this,p))return On(O[1],this,p)}})}function iL(s){return IR(zn(s,y))}function Bp(s){return function(){return s}}function sL(s,o){return s==null||s!==s?o:s}var aL=X_(),oL=X_(!0);function dn(s){return s}function Vp(s){return I_(typeof s=="function"?s:zn(s,y))}function uL(s){return P_(zn(s,y))}function cL(s,o){return N_(s,zn(o,y))}var lL=gt(function(s,o){return function(l){return zo(l,s,o)}}),fL=gt(function(s,o){return function(l){return zo(s,l,o)}});function Wp(s,o,l){var p=qr(o),v=$c(o,p);l==null&&!(lr(o)&&(v.length||!p.length))&&(l=o,o=s,s=this,v=$c(o,qr(o)));var O=!(lr(l)&&"chain"in l)||!!l.chain,N=Di(s);return Bn(v,function(F){var z=o[F];s[F]=z,N&&(s.prototype[F]=function(){var ae=this.__chain__;if(O||ae){var ue=s(this.__wrapped__),me=ue.__actions__=ln(this.__actions__);return me.push({func:z,args:arguments,thisArg:s}),ue.__chain__=ae,ue}return z.apply(s,os([this.value()],arguments))})}),s}function hL(){return Br._===this&&(Br._=qN),this}function zp(){}function dL(s){return s=ht(s),gt(function(o){return R_(o,s)})}var pL=xp(or),mL=xp(e_),yL=xp(Gd);function Kx(s){return Ip(s)?Qd(di(s)):HR(s)}function gL(s){return function(o){return s==null?t:Ls(s,o)}}var vL=tx(),bL=tx(!0);function Hp(){return[]}function Gp(){return!1}function wL(){return{}}function _L(){return""}function xL(){return!0}function SL(s,o){if(s=ht(s),s<1||s>X)return[];var l=Se,p=Qr(s,Se);o=Ye(o),s-=Se;for(var v=Kd(p,o);++l<s;)o(l);return v}function EL(s){return ut(s)?or(s,di):kn(s)?[s]:ln(gx(jt(s)))}function OL(s){var o=++FN;return jt(s)+o}var TL=Gc(function(s,o){return s+o},0),AL=Sp("ceil"),kL=Gc(function(s,o){return s/o},1),IL=Sp("floor");function CL(s){return s&&s.length?Uc(s,dn,up):t}function PL(s,o){return s&&s.length?Uc(s,Ye(o,2),up):t}function NL(s){return n_(s,dn)}function RL(s,o){return n_(s,Ye(o,2))}function ML(s){return s&&s.length?Uc(s,dn,hp):t}function DL(s,o){return s&&s.length?Uc(s,Ye(o,2),hp):t}var FL=Gc(function(s,o){return s*o},1),LL=Sp("round"),qL=Gc(function(s,o){return s-o},0);function jL(s){return s&&s.length?Yd(s,dn):0}function UL(s,o){return s&&s.length?Yd(s,Ye(o,2)):0}return S.after=uF,S.ary=kx,S.assign=JF,S.assignIn=Bx,S.assignInWith=al,S.assignWith=YF,S.at=KF,S.before=Ix,S.bind=Dp,S.bindAll=rL,S.bindKey=Cx,S.castArray=wF,S.chain=Ox,S.chunk=IM,S.compact=CM,S.concat=PM,S.cond=nL,S.conforms=iL,S.constant=Bp,S.countBy=jD,S.create=ZF,S.curry=Px,S.curryRight=Nx,S.debounce=Rx,S.defaults=XF,S.defaultsDeep=e2,S.defer=cF,S.delay=lF,S.difference=NM,S.differenceBy=RM,S.differenceWith=MM,S.drop=DM,S.dropRight=FM,S.dropRightWhile=LM,S.dropWhile=qM,S.fill=jM,S.filter=$D,S.flatMap=WD,S.flatMapDeep=zD,S.flatMapDepth=HD,S.flatten=_x,S.flattenDeep=UM,S.flattenDepth=$M,S.flip=fF,S.flow=aL,S.flowRight=oL,S.fromPairs=BM,S.functions=o2,S.functionsIn=u2,S.groupBy=GD,S.initial=WM,S.intersection=zM,S.intersectionBy=HM,S.intersectionWith=GM,S.invert=l2,S.invertBy=f2,S.invokeMap=JD,S.iteratee=Vp,S.keyBy=YD,S.keys=qr,S.keysIn=hn,S.map=el,S.mapKeys=d2,S.mapValues=p2,S.matches=uL,S.matchesProperty=cL,S.memoize=rl,S.merge=m2,S.mergeWith=Vx,S.method=lL,S.methodOf=fL,S.mixin=Wp,S.negate=nl,S.nthArg=dL,S.omit=y2,S.omitBy=g2,S.once=hF,S.orderBy=KD,S.over=pL,S.overArgs=dF,S.overEvery=mL,S.overSome=yL,S.partial=Fp,S.partialRight=Mx,S.partition=ZD,S.pick=v2,S.pickBy=Wx,S.property=Kx,S.propertyOf=gL,S.pull=KM,S.pullAll=Sx,S.pullAllBy=ZM,S.pullAllWith=XM,S.pullAt=eD,S.range=vL,S.rangeRight=bL,S.rearg=pF,S.reject=tF,S.remove=tD,S.rest=mF,S.reverse=Rp,S.sampleSize=nF,S.set=w2,S.setWith=_2,S.shuffle=iF,S.slice=rD,S.sortBy=oF,S.sortedUniq=cD,S.sortedUniqBy=lD,S.split=W2,S.spread=yF,S.tail=fD,S.take=hD,S.takeRight=dD,S.takeRightWhile=pD,S.takeWhile=mD,S.tap=CD,S.throttle=gF,S.thru=Xc,S.toArray=jx,S.toPairs=zx,S.toPairsIn=Hx,S.toPath=EL,S.toPlainObject=$x,S.transform=x2,S.unary=vF,S.union=yD,S.unionBy=gD,S.unionWith=vD,S.uniq=bD,S.uniqBy=wD,S.uniqWith=_D,S.unset=S2,S.unzip=Mp,S.unzipWith=Ex,S.update=E2,S.updateWith=O2,S.values=qa,S.valuesIn=T2,S.without=xD,S.words=Jx,S.wrap=bF,S.xor=SD,S.xorBy=ED,S.xorWith=OD,S.zip=TD,S.zipObject=AD,S.zipObjectDeep=kD,S.zipWith=ID,S.entries=zx,S.entriesIn=Hx,S.extend=Bx,S.extendWith=al,Wp(S,S),S.add=TL,S.attempt=Yx,S.camelCase=C2,S.capitalize=Gx,S.ceil=AL,S.clamp=A2,S.clone=_F,S.cloneDeep=SF,S.cloneDeepWith=EF,S.cloneWith=xF,S.conformsTo=OF,S.deburr=Qx,S.defaultTo=sL,S.divide=kL,S.endsWith=P2,S.eq=ai,S.escape=N2,S.escapeRegExp=R2,S.every=UD,S.find=BD,S.findIndex=bx,S.findKey=t2,S.findLast=VD,S.findLastIndex=wx,S.findLastKey=r2,S.floor=IL,S.forEach=Tx,S.forEachRight=Ax,S.forIn=n2,S.forInRight=i2,S.forOwn=s2,S.forOwnRight=a2,S.get=jp,S.gt=TF,S.gte=AF,S.has=c2,S.hasIn=Up,S.head=xx,S.identity=dn,S.includes=QD,S.indexOf=VM,S.inRange=k2,S.invoke=h2,S.isArguments=Us,S.isArray=ut,S.isArrayBuffer=kF,S.isArrayLike=fn,S.isArrayLikeObject=vr,S.isBoolean=IF,S.isBuffer=ps,S.isDate=CF,S.isElement=PF,S.isEmpty=NF,S.isEqual=RF,S.isEqualWith=MF,S.isError=Lp,S.isFinite=DF,S.isFunction=Di,S.isInteger=Dx,S.isLength=il,S.isMap=Fx,S.isMatch=FF,S.isMatchWith=LF,S.isNaN=qF,S.isNative=jF,S.isNil=$F,S.isNull=UF,S.isNumber=Lx,S.isObject=lr,S.isObjectLike=pr,S.isPlainObject=Ko,S.isRegExp=qp,S.isSafeInteger=BF,S.isSet=qx,S.isString=sl,S.isSymbol=kn,S.isTypedArray=La,S.isUndefined=VF,S.isWeakMap=WF,S.isWeakSet=zF,S.join=QM,S.kebabCase=M2,S.last=Gn,S.lastIndexOf=JM,S.lowerCase=D2,S.lowerFirst=F2,S.lt=HF,S.lte=GF,S.max=CL,S.maxBy=PL,S.mean=NL,S.meanBy=RL,S.min=ML,S.minBy=DL,S.stubArray=Hp,S.stubFalse=Gp,S.stubObject=wL,S.stubString=_L,S.stubTrue=xL,S.multiply=FL,S.nth=YM,S.noConflict=hL,S.noop=zp,S.now=tl,S.pad=L2,S.padEnd=q2,S.padStart=j2,S.parseInt=U2,S.random=I2,S.reduce=XD,S.reduceRight=eF,S.repeat=$2,S.replace=B2,S.result=b2,S.round=LL,S.runInContext=U,S.sample=rF,S.size=sF,S.snakeCase=V2,S.some=aF,S.sortedIndex=nD,S.sortedIndexBy=iD,S.sortedIndexOf=sD,S.sortedLastIndex=aD,S.sortedLastIndexBy=oD,S.sortedLastIndexOf=uD,S.startCase=z2,S.startsWith=H2,S.subtract=qL,S.sum=jL,S.sumBy=UL,S.template=G2,S.times=SL,S.toFinite=Fi,S.toInteger=ht,S.toLength=Ux,S.toLower=Q2,S.toNumber=Qn,S.toSafeInteger=QF,S.toString=jt,S.toUpper=J2,S.trim=Y2,S.trimEnd=K2,S.trimStart=Z2,S.truncate=X2,S.unescape=eL,S.uniqueId=OL,S.upperCase=tL,S.upperFirst=$p,S.each=Tx,S.eachRight=Ax,S.first=xx,Wp(S,function(){var s={};return fi(S,function(o,l){$t.call(S.prototype,l)||(s[l]=o)}),s}(),{chain:!1}),S.VERSION=n,Bn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){S[s].placeholder=S}),Bn(["drop","take"],function(s,o){Ot.prototype[s]=function(l){l=l===t?1:Pr(ht(l),0);var p=this.__filtered__&&!o?new Ot(this):this.clone();return p.__filtered__?p.__takeCount__=Qr(l,p.__takeCount__):p.__views__.push({size:Qr(l,Se),type:s+(p.__dir__<0?"Right":"")}),p},Ot.prototype[s+"Right"]=function(l){return this.reverse()[s](l).reverse()}}),Bn(["filter","map","takeWhile"],function(s,o){var l=o+1,p=l==Pe||l==We;Ot.prototype[s]=function(v){var O=this.clone();return O.__iteratees__.push({iteratee:Ye(v,3),type:l}),O.__filtered__=O.__filtered__||p,O}}),Bn(["head","last"],function(s,o){var l="take"+(o?"Right":"");Ot.prototype[s]=function(){return this[l](1).value()[0]}}),Bn(["initial","tail"],function(s,o){var l="drop"+(o?"":"Right");Ot.prototype[s]=function(){return this.__filtered__?new Ot(this):this[l](1)}}),Ot.prototype.compact=function(){return this.filter(dn)},Ot.prototype.find=function(s){return this.filter(s).head()},Ot.prototype.findLast=function(s){return this.reverse().find(s)},Ot.prototype.invokeMap=gt(function(s,o){return typeof s=="function"?new Ot(this):this.map(function(l){return zo(l,s,o)})}),Ot.prototype.reject=function(s){return this.filter(nl(Ye(s)))},Ot.prototype.slice=function(s,o){s=ht(s);var l=this;return l.__filtered__&&(s>0||o<0)?new Ot(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=ht(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},Ot.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},Ot.prototype.toArray=function(){return this.take(Se)},fi(Ot.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),p=/^(?:head|last)$/.test(o),v=S[p?"take"+(o=="last"?"Right":""):o],O=p||/^find/.test(o);v&&(S.prototype[o]=function(){var N=this.__wrapped__,F=p?[1]:arguments,z=N instanceof Ot,ae=F[0],ue=z||ut(N),me=function(xt){var kt=v.apply(S,os([xt],F));return p&&Ae?kt[0]:kt};ue&&l&&typeof ae=="function"&&ae.length!=1&&(z=ue=!1);var Ae=this.__chain__,Ue=!!this.__actions__.length,et=O&&!Ae,pt=z&&!Ue;if(!O&&ue){N=pt?N:new Ot(this);var tt=s.apply(N,F);return tt.__actions__.push({func:Xc,args:[me],thisArg:t}),new Wn(tt,Ae)}return et&&pt?s.apply(this,F):(tt=this.thru(me),et?p?tt.value()[0]:tt.value():tt)})}),Bn(["pop","push","shift","sort","splice","unshift"],function(s){var o=Oc[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",p=/^(?:pop|shift)$/.test(s);S.prototype[s]=function(){var v=arguments;if(p&&!this.__chain__){var O=this.value();return o.apply(ut(O)?O:[],v)}return this[l](function(N){return o.apply(ut(N)?N:[],v)})}}),fi(Ot.prototype,function(s,o){var l=S[o];if(l){var p=l.name+"";$t.call(Na,p)||(Na[p]=[]),Na[p].push({name:o,func:l})}}),Na[Hc(t,_).name]=[{name:"wrapper",func:t}],Ot.prototype.clone=eR,Ot.prototype.reverse=tR,Ot.prototype.value=rR,S.prototype.at=PD,S.prototype.chain=ND,S.prototype.commit=RD,S.prototype.next=MD,S.prototype.plant=FD,S.prototype.reverse=LD,S.prototype.toJSON=S.prototype.valueOf=S.prototype.value=qD,S.prototype.first=S.prototype.head,qo&&(S.prototype[qo]=DD),S},Ia=RN();Ns?((Ns.exports=Ia)._=Ia,Vd._=Ia):Br._=Ia}).call(pi)}(Xu,Xu.exports);var WA=Xu.exports;const ci=Jp(WA),u0=le.createContext(),c0=le.createContext(),l0=le.createContext(),zA=({children:r})=>{const[e,t]=pn.useSearchParams(),[n,i]=le.useState({});le.useEffect(()=>{Object.keys(n).length>0&&(t(c=>{const f=new URLSearchParams(c);return Object.entries(n).forEach(([h,d])=>{d==null||d===""?f.delete(h):f.set(h,d)}),f}),i({}))},[n,t]);const a=c=>{i(f=>({...f,...c}))},u=le.useMemo(()=>[Object.fromEntries(e.entries()),a],[e]);return nr.jsx(l0.Provider,{value:u,children:r})},wi=le.createContext(),HA=(r,e,t=i=>i,n=i=>i)=>{const[i,a]=le.useContext(l0),u=i[r];return[u?t(u):e,h=>{if(typeof h=="function"){const y=i[r];h=h(y?t(y):e)}const d=n(h);a({[r]:d})}]},bo=async(r,e,t)=>{le.useEffect(()=>{const n=new window.AbortController;async function i(){return await r(n.signal)}return i(),()=>{n.abort(),t&&t()}},[...e])},GA=(r,e,t)=>{const n=le.useRef(r);le.useEffect(()=>{n.current=r},[r]);const i=le.useCallback(ci.throttle(()=>{n.current()},e),[]);le.useEffect(i,[...t])},wo=(r,e=null,t)=>{const n=le.useRef(r);le.useEffect(()=>{n.current=r},[r]),bo(async i=>{let a;const u=async()=>{await n.current(i),e!==null&&(a=setTimeout(u,e))};return u(),()=>a&&clearTimeout(a)},[e,...t])},f0=(r,e,t)=>{const[n,i]=le.useState(),[a,u]=le.useState(!0),[c,f]=le.useState(),{urls:h,request:d}=ti();return wo(async y=>{try{const g={signal:y,...e||{}};if(g.skip)return;const m=await d(`${h.apiUrl}${r}`,g);i(m)}catch(g){f(g)}u(!1)},t,[r,e]),{data:n,error:c,loading:a}},QA=(r,e)=>{const[t,n]=le.useState(),[i,a]=le.useState(!0),[u,c]=le.useState(null),[f,h]=le.useState(),{urls:d,request:y}=ti();return le.useEffect(()=>{a(u===null||u>0)},[u]),wo(async g=>{try{if(!r)return;c(b=>(b||0)+1);const m=await y(`${d.apiUrl}/reports/production`,{method:"POST",body:r,signal:g});h(null),n(m)}catch(m){m.name!=="AbortError"&&h(m)}c(m=>m-1)},e,[r]),{data:t,error:f,loading:i}},JA=({machineRef:r,key:e,skip:t})=>{const[n,i]=le.useState(),[a,u]=le.useState(),[c,f]=le.useState(),[h,d]=le.useState(),[y,g]=le.useState(),[m,b]=le.useState(),I=Ji`
|
|
111
|
+
`)+ve+`return __p
|
|
112
|
+
}`;var ft=mx(function(){return Dt(E,Ue+"return "+ve).apply(t,R)});if(ft.source=ve,Gp(ft))throw ft;return ft}function _L(s){return jt(s).toLowerCase()}function SL(s){return jt(s).toUpperCase()}function xL(s,o,l){if(s=jt(s),s&&(l||o===t))return E_(s);if(!s||!(o=On(o)))return s;var d=ri(s),v=ri(o),E=O_(d,v),R=T_(d,v)+1;return ys(d,E,R).join("")}function EL(s,o,l){if(s=jt(s),s&&(l||o===t))return s.slice(0,A_(s)+1);if(!s||!(o=On(o)))return s;var d=ri(s),v=T_(d,ri(o))+1;return ys(d,0,v).join("")}function OL(s,o,l){if(s=jt(s),s&&(l||o===t))return s.replace(Tr,"");if(!s||!(o=On(o)))return s;var d=ri(s),v=O_(d,ri(o));return ys(d,v).join("")}function TL(s,o){var l=K,d=oe;if(cr(o)){var v="separator"in o?o.separator:v;l="length"in o?ct(o.length):l,d="omission"in o?On(o.omission):d}s=jt(s);var E=s.length;if(Ca(s)){var R=ri(s);E=R.length}if(l>=E)return s;var L=l-Pa(d);if(L<1)return d;var H=R?ys(R,0,L).join(""):s.slice(0,L);if(v===t)return H+d;if(R&&(L+=H.length-L),Qp(v)){if(s.slice(L).search(v)){var le,he=H;for(v.global||(v=lp(v.source,jt(Qe.exec(v))+"g")),v.lastIndex=0;le=v.exec(he);)var ve=le.index;H=H.slice(0,ve===t?L:ve)}}else if(s.indexOf(On(v),L)!=L){var Ne=H.lastIndexOf(v);Ne>-1&&(H=H.slice(0,Ne))}return H+d}function kL(s){return s=jt(s),s&&Yt.test(s)?s.replace(ur,r2):s}var AL=qa(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),Kp=yS("toUpperCase");function px(s,o,l){return s=jt(s),o=l?t:o,o===t?KN(s)?s2(s):BN(s):s.match(o)||[]}var mx=yt(function(s,o){try{return xn(s,t,o)}catch(l){return Gp(l)?l:new st(l)}}),IL=Ri(function(s,o){return Un(o,function(l){l=di(l),Pi(s,l,zp(s[l],s))}),s});function CL(s){var o=s==null?0:s.length,l=Ke();return s=o?ar(s,function(d){if(typeof d[1]!="function")throw new $n(u);return[l(d[0]),d[1]]}):[],yt(function(d){for(var v=-1;++v<o;){var E=s[v];if(xn(E[0],this,d))return xn(E[1],this,d)}})}function PL(s){return rR(Vn(s,m))}function Zp(s){return function(){return s}}function NL(s,o){return s==null||s!==s?o:s}var RL=vS(),ML=vS(!0);function dn(s){return s}function Xp(s){return Q_(typeof s=="function"?s:Vn(s,m))}function DL(s){return Y_(Vn(s,m))}function FL(s,o){return K_(s,Vn(o,m))}var LL=yt(function(s,o){return function(l){return Yo(l,s,o)}}),qL=yt(function(s,o){return function(l){return Yo(s,l,o)}});function em(s,o,l){var d=Fr(o),v=Gc(o,d);l==null&&!(cr(o)&&(v.length||!d.length))&&(l=o,o=s,s=this,v=Gc(o,Fr(o)));var E=!(cr(l)&&"chain"in l)||!!l.chain,R=Di(s);return Un(v,function(L){var H=o[L];s[L]=H,R&&(s.prototype[L]=function(){var le=this.__chain__;if(E||le){var he=s(this.__wrapped__),ve=he.__actions__=ln(this.__actions__);return ve.push({func:H,args:arguments,thisArg:s}),he.__chain__=le,he}return H.apply(s,ls([this.value()],arguments))})}),s}function jL(){return $r._===this&&($r._=f2),this}function tm(){}function UL(s){return s=ct(s),yt(function(o){return Z_(o,s)})}var $L=Np(ar),BL=Np(b_),VL=Np(np);function yx(s){return jp(s)?ip(di(s)):bR(s)}function WL(s){return function(o){return s==null?t:Us(s,o)}}var zL=wS(),HL=wS(!0);function rm(){return[]}function nm(){return!1}function GL(){return{}}function QL(){return""}function JL(){return!0}function YL(s,o){if(s=ct(s),s<1||s>ee)return[];var l=Pe,d=Gr(s,Pe);o=Ke(o),s-=Pe;for(var v=op(d,o);++l<s;)o(l);return v}function KL(s){return at(s)?ar(s,di):Tn(s)?[s]:ln(FS(jt(s)))}function ZL(s){var o=++c2;return jt(s)+o}var XL=Xc(function(s,o){return s+o},0),e6=Rp("ceil"),t6=Xc(function(s,o){return s/o},1),r6=Rp("floor");function n6(s){return s&&s.length?Hc(s,dn,vp):t}function i6(s,o){return s&&s.length?Hc(s,Ke(o,2),vp):t}function s6(s){return S_(s,dn)}function a6(s,o){return S_(s,Ke(o,2))}function o6(s){return s&&s.length?Hc(s,dn,Sp):t}function u6(s,o){return s&&s.length?Hc(s,Ke(o,2),Sp):t}var c6=Xc(function(s,o){return s*o},1),l6=Rp("round"),f6=Xc(function(s,o){return s-o},0);function h6(s){return s&&s.length?ap(s,dn):0}function d6(s,o){return s&&s.length?ap(s,Ke(o,2)):0}return x.after=DD,x.ary=GS,x.assign=SF,x.assignIn=ox,x.assignInWith=hl,x.assignWith=xF,x.at=EF,x.before=QS,x.bind=zp,x.bindAll=IL,x.bindKey=JS,x.castArray=GD,x.chain=WS,x.chunk=rM,x.compact=nM,x.concat=iM,x.cond=CL,x.conforms=PL,x.constant=Zp,x.countBy=hD,x.create=OF,x.curry=YS,x.curryRight=KS,x.debounce=ZS,x.defaults=TF,x.defaultsDeep=kF,x.defer=FD,x.delay=LD,x.difference=sM,x.differenceBy=aM,x.differenceWith=oM,x.drop=uM,x.dropRight=cM,x.dropRightWhile=lM,x.dropWhile=fM,x.fill=hM,x.filter=pD,x.flatMap=gD,x.flatMapDeep=vD,x.flatMapDepth=bD,x.flatten=US,x.flattenDeep=dM,x.flattenDepth=pM,x.flip=qD,x.flow=RL,x.flowRight=ML,x.fromPairs=mM,x.functions=MF,x.functionsIn=DF,x.groupBy=wD,x.initial=gM,x.intersection=vM,x.intersectionBy=bM,x.intersectionWith=wM,x.invert=LF,x.invertBy=qF,x.invokeMap=SD,x.iteratee=Xp,x.keyBy=xD,x.keys=Fr,x.keysIn=hn,x.map=al,x.mapKeys=UF,x.mapValues=$F,x.matches=DL,x.matchesProperty=FL,x.memoize=ul,x.merge=BF,x.mergeWith=ux,x.method=LL,x.methodOf=qL,x.mixin=em,x.negate=cl,x.nthArg=UL,x.omit=VF,x.omitBy=WF,x.once=jD,x.orderBy=ED,x.over=$L,x.overArgs=UD,x.overEvery=BL,x.overSome=VL,x.partial=Hp,x.partialRight=XS,x.partition=OD,x.pick=zF,x.pickBy=cx,x.property=yx,x.propertyOf=WL,x.pull=EM,x.pullAll=BS,x.pullAllBy=OM,x.pullAllWith=TM,x.pullAt=kM,x.range=zL,x.rangeRight=HL,x.rearg=$D,x.reject=AD,x.remove=AM,x.rest=BD,x.reverse=Vp,x.sampleSize=CD,x.set=GF,x.setWith=QF,x.shuffle=PD,x.slice=IM,x.sortBy=MD,x.sortedUniq=FM,x.sortedUniqBy=LM,x.split=gL,x.spread=VD,x.tail=qM,x.take=jM,x.takeRight=UM,x.takeRightWhile=$M,x.takeWhile=BM,x.tap=nD,x.throttle=WD,x.thru=sl,x.toArray=ix,x.toPairs=lx,x.toPairsIn=fx,x.toPath=KL,x.toPlainObject=ax,x.transform=JF,x.unary=zD,x.union=VM,x.unionBy=WM,x.unionWith=zM,x.uniq=HM,x.uniqBy=GM,x.uniqWith=QM,x.unset=YF,x.unzip=Wp,x.unzipWith=VS,x.update=KF,x.updateWith=ZF,x.values=$a,x.valuesIn=XF,x.without=JM,x.words=px,x.wrap=HD,x.xor=YM,x.xorBy=KM,x.xorWith=ZM,x.zip=XM,x.zipObject=eD,x.zipObjectDeep=tD,x.zipWith=rD,x.entries=lx,x.entriesIn=fx,x.extend=ox,x.extendWith=hl,em(x,x),x.add=XL,x.attempt=mx,x.camelCase=nL,x.capitalize=hx,x.ceil=e6,x.clamp=eL,x.clone=QD,x.cloneDeep=YD,x.cloneDeepWith=KD,x.cloneWith=JD,x.conformsTo=ZD,x.deburr=dx,x.defaultTo=NL,x.divide=t6,x.endsWith=iL,x.eq=ii,x.escape=sL,x.escapeRegExp=aL,x.every=dD,x.find=mD,x.findIndex=qS,x.findKey=AF,x.findLast=yD,x.findLastIndex=jS,x.findLastKey=IF,x.floor=r6,x.forEach=zS,x.forEachRight=HS,x.forIn=CF,x.forInRight=PF,x.forOwn=NF,x.forOwnRight=RF,x.get=Jp,x.gt=XD,x.gte=eF,x.has=FF,x.hasIn=Yp,x.head=$S,x.identity=dn,x.includes=_D,x.indexOf=yM,x.inRange=tL,x.invoke=jF,x.isArguments=Vs,x.isArray=at,x.isArrayBuffer=tF,x.isArrayLike=fn,x.isArrayLikeObject=vr,x.isBoolean=rF,x.isBuffer=gs,x.isDate=nF,x.isElement=iF,x.isEmpty=sF,x.isEqual=aF,x.isEqualWith=oF,x.isError=Gp,x.isFinite=uF,x.isFunction=Di,x.isInteger=ex,x.isLength=ll,x.isMap=tx,x.isMatch=cF,x.isMatchWith=lF,x.isNaN=fF,x.isNative=hF,x.isNil=pF,x.isNull=dF,x.isNumber=rx,x.isObject=cr,x.isObjectLike=mr,x.isPlainObject=ru,x.isRegExp=Qp,x.isSafeInteger=mF,x.isSet=nx,x.isString=fl,x.isSymbol=Tn,x.isTypedArray=Ua,x.isUndefined=yF,x.isWeakMap=gF,x.isWeakSet=vF,x.join=_M,x.kebabCase=oL,x.last=zn,x.lastIndexOf=SM,x.lowerCase=uL,x.lowerFirst=cL,x.lt=bF,x.lte=wF,x.max=n6,x.maxBy=i6,x.mean=s6,x.meanBy=a6,x.min=o6,x.minBy=u6,x.stubArray=rm,x.stubFalse=nm,x.stubObject=GL,x.stubString=QL,x.stubTrue=JL,x.multiply=c6,x.nth=xM,x.noConflict=jL,x.noop=tm,x.now=ol,x.pad=lL,x.padEnd=fL,x.padStart=hL,x.parseInt=dL,x.random=rL,x.reduce=TD,x.reduceRight=kD,x.repeat=pL,x.replace=mL,x.result=HF,x.round=l6,x.runInContext=B,x.sample=ID,x.size=ND,x.snakeCase=yL,x.some=RD,x.sortedIndex=CM,x.sortedIndexBy=PM,x.sortedIndexOf=NM,x.sortedLastIndex=RM,x.sortedLastIndexBy=MM,x.sortedLastIndexOf=DM,x.startCase=vL,x.startsWith=bL,x.subtract=f6,x.sum=h6,x.sumBy=d6,x.template=wL,x.times=YL,x.toFinite=Fi,x.toInteger=ct,x.toLength=sx,x.toLower=_L,x.toNumber=Hn,x.toSafeInteger=_F,x.toString=jt,x.toUpper=SL,x.trim=xL,x.trimEnd=EL,x.trimStart=OL,x.truncate=TL,x.unescape=kL,x.uniqueId=ZL,x.upperCase=AL,x.upperFirst=Kp,x.each=zS,x.eachRight=HS,x.first=$S,em(x,function(){var s={};return fi(x,function(o,l){Ut.call(x.prototype,l)||(s[l]=o)}),s}(),{chain:!1}),x.VERSION=n,Un(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){x[s].placeholder=x}),Un(["drop","take"],function(s,o){xt.prototype[s]=function(l){l=l===t?1:Ir(ct(l),0);var d=this.__filtered__&&!o?new xt(this):this.clone();return d.__filtered__?d.__takeCount__=Gr(l,d.__takeCount__):d.__views__.push({size:Gr(l,Pe),type:s+(d.__dir__<0?"Right":"")}),d},xt.prototype[s+"Right"]=function(l){return this.reverse()[s](l).reverse()}}),Un(["filter","map","takeWhile"],function(s,o){var l=o+1,d=l==ie||l==we;xt.prototype[s]=function(v){var E=this.clone();return E.__iteratees__.push({iteratee:Ke(v,3),type:l}),E.__filtered__=E.__filtered__||d,E}}),Un(["head","last"],function(s,o){var l="take"+(o?"Right":"");xt.prototype[s]=function(){return this[l](1).value()[0]}}),Un(["initial","tail"],function(s,o){var l="drop"+(o?"":"Right");xt.prototype[s]=function(){return this.__filtered__?new xt(this):this[l](1)}}),xt.prototype.compact=function(){return this.filter(dn)},xt.prototype.find=function(s){return this.filter(s).head()},xt.prototype.findLast=function(s){return this.reverse().find(s)},xt.prototype.invokeMap=yt(function(s,o){return typeof s=="function"?new xt(this):this.map(function(l){return Yo(l,s,o)})}),xt.prototype.reject=function(s){return this.filter(cl(Ke(s)))},xt.prototype.slice=function(s,o){s=ct(s);var l=this;return l.__filtered__&&(s>0||o<0)?new xt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=ct(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},xt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},xt.prototype.toArray=function(){return this.take(Pe)},fi(xt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),d=/^(?:head|last)$/.test(o),v=x[d?"take"+(o=="last"?"Right":""):o],E=d||/^find/.test(o);v&&(x.prototype[o]=function(){var R=this.__wrapped__,L=d?[1]:arguments,H=R instanceof xt,le=L[0],he=H||at(R),ve=function(bt){var Ot=v.apply(x,ls([bt],L));return d&&Ne?Ot[0]:Ot};he&&l&&typeof le=="function"&&le.length!=1&&(H=he=!1);var Ne=this.__chain__,Ue=!!this.__actions__.length,Ze=E&&!Ne,ft=H&&!Ue;if(!E&&he){R=ft?R:new xt(this);var Xe=s.apply(R,L);return Xe.__actions__.push({func:sl,args:[ve],thisArg:t}),new Bn(Xe,Ne)}return Ze&&ft?s.apply(this,L):(Xe=this.thru(ve),Ze?d?Xe.value()[0]:Xe.value():Xe)})}),Un(["pop","push","shift","sort","splice","unshift"],function(s){var o=Pc[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",d=/^(?:pop|shift)$/.test(s);x.prototype[s]=function(){var v=arguments;if(d&&!this.__chain__){var E=this.value();return o.apply(at(E)?E:[],v)}return this[l](function(R){return o.apply(at(R)?R:[],v)})}}),fi(xt.prototype,function(s,o){var l=x[o];if(l){var d=l.name+"";Ut.call(Da,d)||(Da[d]=[]),Da[d].push({name:o,func:l})}}),Da[Zc(t,w).name]=[{name:"wrapper",func:t}],xt.prototype.clone=k2,xt.prototype.reverse=A2,xt.prototype.value=I2,x.prototype.at=iD,x.prototype.chain=sD,x.prototype.commit=aD,x.prototype.next=oD,x.prototype.plant=cD,x.prototype.reverse=lD,x.prototype.toJSON=x.prototype.valueOf=x.prototype.value=fD,x.prototype.first=x.prototype.head,Vo&&(x.prototype[Vo]=uD),x},Na=a2();Ds?((Ds.exports=Na)._=Na,Xd._=Na):$r._=Na}).call(fA)}(So,So.exports)),So.exports}var dA=hA();const ui=sm(dA),k0=be.createContext(),A0=be.createContext(),I0=be.createContext(),pA=({children:r})=>{const[e,t]=qi.useSearchParams(),[n,i]=be.useState({});be.useEffect(()=>{Object.keys(n).length>0&&(t(c=>{const f=new URLSearchParams(c);return Object.entries(n).forEach(([h,p])=>{p==null||p===""?f.delete(h):f.set(h,p)}),f}),i({}))},[n,t]);const a=c=>{i(f=>({...f,...c}))},u=be.useMemo(()=>[Object.fromEntries(e.entries()),a],[e]);return nr.jsx(I0.Provider,{value:u,children:r})},_i=be.createContext(),mA=(r,e,t=i=>i,n=i=>i)=>{const[i,a]=be.useContext(I0),u=i[r];return[u?t(u):e,h=>{if(typeof h=="function"){const m=i[r];h=h(m?t(m):e)}const p=n(h);a({[r]:p})}]},xo=async(r,e,t)=>{be.useEffect(()=>{const n=new window.AbortController;async function i(){return await r(n.signal)}return i(),()=>{n.abort(),t&&t()}},[...e])},yA=(r,e,t)=>{const n=be.useRef(r);be.useEffect(()=>{n.current=r},[r]);const i=be.useCallback(ui.throttle(()=>{n.current()},e),[]);be.useEffect(i,[...t])},Eo=(r,e=null,t)=>{const n=be.useRef(r);be.useEffect(()=>{n.current=r},[r]),xo(async i=>{let a;const u=async()=>{await n.current(i),e!==null&&(a=setTimeout(u,e))};return u(),()=>a&&clearTimeout(a)},[e,...t])},C0=(r,e,t)=>{const[n,i]=be.useState(),[a,u]=be.useState(!0),[c,f]=be.useState(),{urls:h,request:p}=Xn();return Eo(async m=>{try{const y={signal:m,...e||{}};if(y.skip)return;const g=await p(`${h.apiUrl}${r}`,y);i(g)}catch(y){f(y)}u(!1)},t,[r,e]),{data:n,error:c,loading:a}},gA=(r,e)=>{const[t,n]=be.useState(),[i,a]=be.useState(!0),[u,c]=be.useState(null),[f,h]=be.useState(),{urls:p,request:m}=Xn();return be.useEffect(()=>{a(u===null||u>0)},[u]),Eo(async y=>{try{if(!r)return;c(b=>(b||0)+1);const g=await m(`${p.apiUrl}/reports/production`,{method:"POST",body:r,signal:y});h(null),n(g)}catch(g){g.name!=="AbortError"&&h(g)}c(g=>g-1)},e,[r]),{data:t,error:f,loading:i}},vA=({machineRef:r,key:e,skip:t})=>{const[n,i]=be.useState(),[a,u]=be.useState(),[c,f]=be.useState(),[h,p]=be.useState(),[m,y]=be.useState(),[g,b]=be.useState(),I=Zi`
|
|
113
113
|
subscription MMToolsQuantityStreamSubscription {
|
|
114
114
|
currentQuantities(
|
|
115
|
-
where: { machineRef: { _eq: ${
|
|
115
|
+
where: { machineRef: { _eq: ${m} }, key: { _eq: "${g}" } }
|
|
116
116
|
) {
|
|
117
117
|
value
|
|
118
118
|
eventTime
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
`,{data:
|
|
121
|
+
`,{data:S}=hT(I,{skip:t}),[w,O]=be.useState();be.useEffect(()=>{r!==m&&y(r),e!==g&&b(e),p(),i(),f(),u()},[r,e,g,m]),be.useEffect(()=>{if(T||!r||!e)return;const N=h||nt.utc().minus({hours:1}).format(),G=Zi`
|
|
122
122
|
query MMToolsQuantityStreamQuery {
|
|
123
|
-
quantities(args:{machineRef:${
|
|
123
|
+
quantities(args:{machineRef:${m}, metricKey:"${g}", windowStart:"${N}"}, order_by:{eventTime:asc}) {
|
|
124
124
|
value
|
|
125
125
|
eventTime
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
`;A(K)},[y,m,h]),le.useEffect(()=>{_&&P()},[_,x]);const[P,{data:M,loading:$}]=U1(_,{fetchPolicy:"no-cache"});return le.useEffect(()=>{if(!M||!M.quantities)return;const j=ci.last(M.quantities);if(j&&d(j.eventTime),!n)i(M.quantities);else{const K=ci.drop(M.quantities);i([...n,...K])}},[M]),{data:n,error:c,loading:a}},YA=r=>{const[e,t]=le.useState(),[n,i]=le.useState(!0),[a,u]=le.useState(),{urls:c,request:f}=ti();return bo(async h=>{try{i(!0);const d=await f(`${c.apiUrl}/reports/downtime`,{method:"POST",body:r,signal:h});u(null),t(d)}catch(d){u(d)}i(!1)},[r]),{data:e,error:a,loading:n}},KA=r=>{const[e,t]=le.useState(),{urls:n,request:i,clientId:a}=ti(),u=`lab:${a}:${r}`,{data:c,loading:f,error:h}=f0("/templates");return le.useEffect(()=>{if(!c)return;const m=ci.filter(c.templates,{namespace:u});t(m)},[c]),[async({name:m,public:b,config:I})=>{const x={name:m,public:b,namespace:u,config:JSON.stringify(I)},_=JSON.stringify(x),A=await i(`${n.apiUrl}/templates`,{method:"POST",body:_});return t([...e,A.template]),A.template},async(m,{name:b,public:I,config:x})=>{const _={name:b,public:I,namespace:u,config:JSON.stringify(x)},A=JSON.stringify(_),P=await i(`${n.apiUrl}/templates/${m}`,{method:"PUT",body:A}),M=ci.findIndex(e,{id:m}),$=e.slice(0,M),j=e.slice(M+1);return t([...$,P.template,...j]),P.template},async m=>{await i(`${n.apiUrl}/templates/${m}`,{method:"DELETE"}),t(ci.reject(e,{id:m}))},{templates:e,loading:f,error:h}]},ZA=()=>{const[r,e]=le.useState(),[t,n]=le.useState(),{urls:i}=ti();return le.useEffect(()=>{window===window.top?(n(window.location.hash.substring(1)),e(!0)):(window.addEventListener("message",a=>{switch(a.data.event){case"init":n(a.data.hash.substring(1)),e(!0);break}}),window.top.postMessage({event:"ready"},i.appUrl))},[i]),le.useEffect(()=>{r&&(window===window.top?window.location.hash=t:window.top.postMessage({event:"set-hash",hash:t},i.appUrl))},[r,t,i]),[n,{ready:r,hash:t}]},ti=()=>le.useContext(c0),XA=()=>{throw new Error("useMMEmbeddedApp is deprecated. Use useMMAppTools and useMMAppContext.")},ek=()=>{throw new Error("useMMAppTools is deprecated. Use useMMAppParams and useMMAppCommands.")},tk=()=>{const{context:r}=le.useContext(wi);return r},h0=()=>{const{params:r}=le.useContext(wi);return r},d0=()=>{const{commands:r}=le.useContext(wi);return r},rk=(r,e,t=[])=>{const{addSetting:n}=le.useContext(wi);le.useEffect(()=>{n(r,e)},[...t])},nk=(r,e=[])=>{const{registerHandler:t}=le.useContext(wi);le.useEffect(()=>t({requestType:"set-claims",func:r}),[...e])},ik=(r,e=[])=>{const{registerHandler:t}=le.useContext(wi);le.useEffect(()=>t({requestType:"custom-input-open",func:r}),[...e])},sk=(r,e=[])=>{const{registerHandler:t}=le.useContext(wi);le.useEffect(()=>t({requestType:"custom-input-save",func:r}),[...e])},ak=(r,e=[])=>{const{registerHandler:t}=le.useContext(wi);le.useEffect(()=>t({requestType:"custom-input-label",func:r}),[...e])},ok=()=>le.useContext(u0),uk=()=>{const{login:r,isAuthenticated:e}=ti();return bo(async()=>{e===!1&&await r()},[e]),e?nr.jsx(pn.Outlet,{}):nr.jsx("div",{})},p0="%[a-f0-9]{2}",m0=new RegExp("("+p0+")|([^%]+?)","gi"),y0=new RegExp("("+p0+")+","gi");function ah(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;const t=r.slice(0,e),n=r.slice(e);return Array.prototype.concat.call([],ah(t),ah(n))}function ck(r){try{return decodeURIComponent(r)}catch{let e=r.match(m0)||[];for(let t=1;t<e.length;t++)r=ah(e,t).join(""),e=r.match(m0)||[];return r}}function lk(r){const e={"%FE%FF":"��","%FF%FE":"��"};let t=y0.exec(r);for(;t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{const i=ck(t[0]);i!==t[0]&&(e[t[0]]=i)}t=y0.exec(r)}e["%C2"]="�";const n=Object.keys(e);for(const i of n)r=r.replace(new RegExp(i,"g"),e[i]);return r}function fk(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return decodeURIComponent(r)}catch{return lk(r)}}function hk(r,e){const t={};if(Array.isArray(e))for(const n of e){const i=Object.getOwnPropertyDescriptor(r,n);i!=null&&i.enumerable&&Object.defineProperty(t,n,i)}else for(const n of Reflect.ownKeys(r)){const i=Object.getOwnPropertyDescriptor(r,n);if(i.enumerable){const a=r[n];e(n,a,r)&&Object.defineProperty(t,n,i)}}return t}function g0(r,e){if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r===""||e==="")return[];const t=r.indexOf(e);return t===-1?[]:[r.slice(0,t),r.slice(t+e.length)]}const dk=r=>r==null,pk=r=>encodeURIComponent(r).replaceAll(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),oh=Symbol("encodeFragmentIdentifier");function mk(r){switch(r.arrayFormat){case"index":return e=>(t,n)=>{const i=t.length;return n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[Sr(e,r),"[",i,"]"].join("")]:[...t,[Sr(e,r),"[",Sr(i,r),"]=",Sr(n,r)].join("")]};case"bracket":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[Sr(e,r),"[]"].join("")]:[...t,[Sr(e,r),"[]=",Sr(n,r)].join("")];case"colon-list-separator":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[Sr(e,r),":list="].join("")]:[...t,[Sr(e,r),":list=",Sr(n,r)].join("")];case"comma":case"separator":case"bracket-separator":{const e=r.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(n,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[Sr(t,r),e,Sr(i,r)].join("")]:[[n,Sr(i,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,Sr(e,r)]:[...t,[Sr(e,r),"=",Sr(n,r)].join("")]}}function yk(r){let e;switch(r.arrayFormat){case"index":return(t,n,i)=>{if(e=/\[(\d*)]$/.exec(t),t=t.replace(/\[\d*]$/,""),!e){i[t]=n;return}i[t]===void 0&&(i[t]={}),i[t][e[1]]=n};case"bracket":return(t,n,i)=>{if(e=/(\[])$/.exec(t),t=t.replace(/\[]$/,""),!e){i[t]=n;return}if(i[t]===void 0){i[t]=[n];return}i[t]=[...i[t],n]};case"colon-list-separator":return(t,n,i)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){i[t]=n;return}if(i[t]===void 0){i[t]=[n];return}i[t]=[...i[t],n]};case"comma":case"separator":return(t,n,i)=>{const a=typeof n=="string"&&n.includes(r.arrayFormatSeparator),u=typeof n=="string"&&!a&&_i(n,r).includes(r.arrayFormatSeparator);n=u?_i(n,r):n;const c=a||u?n.split(r.arrayFormatSeparator).map(f=>_i(f,r)):n===null?n:_i(n,r);i[t]=c};case"bracket-separator":return(t,n,i)=>{const a=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!a){i[t]=n&&_i(n,r);return}const u=n===null?[]:_i(n,r).split(r.arrayFormatSeparator);if(i[t]===void 0){i[t]=u;return}i[t]=[...i[t],...u]};default:return(t,n,i)=>{if(i[t]===void 0){i[t]=n;return}i[t]=[...[i[t]].flat(),n]}}}function v0(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Sr(r,e){return e.encode?e.strict?pk(r):encodeURIComponent(r):r}function _i(r,e){return e.decode?fk(r):r}function b0(r){return Array.isArray(r)?r.sort():typeof r=="object"?b0(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}function w0(r){const e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function gk(r){let e="";const t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}function _0(r,e,t){return t==="string"&&typeof r=="string"?r:typeof t=="function"&&typeof r=="string"?t(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":t==="number"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""||e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):r}function uh(r){r=w0(r);const e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function ch(r,e){e={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...e},v0(e.arrayFormatSeparator);const t=yk(e),n=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return n;for(const i of r.split("&")){if(i==="")continue;const a=e.decode?i.replaceAll("+"," "):i;let[u,c]=g0(a,"=");u===void 0&&(u=a),c=c===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?c:_i(c,e),t(_i(u,e),c,n)}for(const[i,a]of Object.entries(n))if(typeof a=="object"&&a!==null&&e.types[i]!=="string")for(const[u,c]of Object.entries(a)){const f=e.types[i]?e.types[i].replace("[]",""):void 0;a[u]=_0(c,e,f)}else typeof a=="object"&&a!==null&&e.types[i]==="string"?n[i]=Object.values(a).join(e.arrayFormatSeparator):n[i]=_0(a,e,e.types[i]);return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,a)=>{const u=n[a];return i[a]=u&&typeof u=="object"&&!Array.isArray(u)?b0(u):u,i},Object.create(null))}function x0(r,e){if(!r)return"";e={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...e},v0(e.arrayFormatSeparator);const t=u=>e.skipNull&&dk(r[u])||e.skipEmptyString&&r[u]==="",n=mk(e),i={};for(const[u,c]of Object.entries(r))t(u)||(i[u]=c);const a=Object.keys(i);return e.sort!==!1&&a.sort(e.sort),a.map(u=>{const c=r[u];return c===void 0?"":c===null?Sr(u,e):Array.isArray(c)?c.length===0&&e.arrayFormat==="bracket-separator"?Sr(u,e)+"[]":c.reduce(n(u),[]).join("&"):Sr(u,e)+"="+Sr(c,e)}).filter(u=>u.length>0).join("&")}function S0(r,e){var i;e={decode:!0,...e};let[t,n]=g0(r,"#");return t===void 0&&(t=r),{url:((i=t==null?void 0:t.split("?"))==null?void 0:i[0])??"",query:ch(uh(r),e),...e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:_i(n,e)}:{}}}function E0(r,e){e={encode:!0,strict:!0,[oh]:!0,...e};const t=w0(r.url).split("?")[0]||"",n=uh(r.url),i={...ch(n,{sort:!1}),...r.query};let a=x0(i,e);a&&(a=`?${a}`);let u=gk(r.url);if(typeof r.fragmentIdentifier=="string"){const c=new URL(t);c.hash=r.fragmentIdentifier,u=e[oh]?c.hash:`#${r.fragmentIdentifier}`}return`${t}${a}${u}`}function O0(r,e,t){t={parseFragmentIdentifier:!0,[oh]:!1,...t};const{url:n,query:i,fragmentIdentifier:a}=S0(r,t);return E0({url:n,query:hk(i,e),fragmentIdentifier:a},t)}function vk(r,e,t){const n=Array.isArray(e)?i=>!e.includes(i):(i,a)=>!e(i,a);return O0(r,n,t)}const bk=Object.freeze(Object.defineProperty({__proto__:null,exclude:vk,extract:uh,parse:ch,parseUrl:S0,pick:O0,stringify:x0,stringifyUrl:E0},Symbol.toStringTag,{value:"Module"})),Ur=[];for(let r=0;r<256;++r)Ur.push((r+256).toString(16).slice(1));function wk(r,e=0){return(Ur[r[e+0]]+Ur[r[e+1]]+Ur[r[e+2]]+Ur[r[e+3]]+"-"+Ur[r[e+4]]+Ur[r[e+5]]+"-"+Ur[r[e+6]]+Ur[r[e+7]]+"-"+Ur[r[e+8]]+Ur[r[e+9]]+"-"+Ur[r[e+10]]+Ur[r[e+11]]+Ur[r[e+12]]+Ur[r[e+13]]+Ur[r[e+14]]+Ur[r[e+15]]).toLowerCase()}let lh;const _k=new Uint8Array(16);function xk(){if(!lh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");lh=crypto.getRandomValues.bind(crypto)}return lh(_k)}const T0={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function A0(r,e,t){if(T0.randomUUID&&!e&&!r)return T0.randomUUID();r=r||{};const n=r.random||(r.rng||xk)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,wk(n)}const fh="mm-auth-state",hh="mm-auth-destination",dh="mm-auth-access-token",xi=window.localStorage,Sk=()=>xi.getItem(dh),Ek=r=>{r?xi.setItem(dh,r):xi.removeItem(dh)},Ok=()=>xi.getItem(hh),k0=r=>{r?xi.setItem(hh,r):xi.removeItem(hh)},Tk=()=>xi.getItem(fh),I0=r=>{r?xi.setItem(fh,r):xi.removeItem(fh)},C0=async(r,e)=>{const t=await window.fetch(r,e),n=await t.text(),i=n&&JSON.parse(n);return t.status>=200&&t.status<300?i:{...i,error:{message:t.statusText,status:t.status}}};function Ak(r){return er(r)&&"code"in r&&"reason"in r}function kk(r){var e;return er(r)&&((e=r.target)===null||e===void 0?void 0:e.readyState)===WebSocket.CLOSED}var Ik=function(r){Pn(e,r);function e(t){var n=r.call(this)||this;return n.client=t,n}return e.prototype.request=function(t){var n=this;return new Rt(function(i){return n.client.subscribe(L(L({},t),{query:Gs(t.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){if(a instanceof Error)return i.error(a);var u=Ak(a);return u||kk(a)?i.error(new Error("Socket closed".concat(u?" with event ".concat(a.code):"").concat(u?" ".concat(a.reason):""))):i.error(new yn({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Kr);function un(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function Is(r){return un(r)==="object"}function Ck(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function P0(r,e){return r.length<124?r:e}const Pk="graphql-transport-ws";var vn;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(vn||(vn={}));var mr;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(mr||(mr={}));function N0(r){if(!Is(r))throw new Error(`Message is expected to be an object, but got ${un(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${un(r.type)}`);switch(r.type){case mr.ConnectionInit:case mr.ConnectionAck:case mr.Ping:case mr.Pong:{if(r.payload!=null&&!Is(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case mr.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${un(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Is(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${un(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${un(r.payload.query)}`);if(r.payload.variables!=null&&!Is(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${un(r.payload.variables)}`);if(r.payload.operationName!=null&&un(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${un(r.payload.operationName)}`);if(r.payload.extensions!=null&&!Is(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${un(r.payload.extensions)}`);break}case mr.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${un(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Is(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${un(r.payload)}`);break}case mr.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${un(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ck(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case mr.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${un(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function Nk(r,e){return N0(typeof r=="string"?JSON.parse(r,e):r)}function _o(r,e){return N0(r),JSON.stringify(r,e)}var ha=function(r){return this instanceof ha?(this.v=r,this):new ha(r)},Rk=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},u("next"),u("throw"),u("return"),i[Symbol.asyncIterator]=function(){return this},i;function u(g){n[g]&&(i[g]=function(m){return new Promise(function(b,I){a.push([g,m,b,I])>1||c(g,m)})})}function c(g,m){try{f(n[g](m))}catch(b){y(a[0][3],b)}}function f(g){g.value instanceof ha?Promise.resolve(g.value.v).then(h,d):y(a[0][2],g)}function h(g){c("next",g)}function d(g){c("throw",g)}function y(g,m){g(m),a.shift(),a.length&&c(a[0][0],a[0][1])}};function Mk(r){const{url:e,connectionParams:t,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:u=0,disablePong:c,connectionAckWaitTimeout:f=0,retryAttempts:h=5,retryWait:d=async function(We){let ke=1e3;for(let X=0;X<We;X++)ke*=2;await new Promise(X=>setTimeout(X,ke+Math.floor(Math.random()*2700+300)))},shouldRetry:y=ph,isFatalConnectionProblem:g,on:m,webSocketImpl:b,generateID:I=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,We=>{const ke=Math.random()*16|0;return(We=="x"?ke:ke&3|8).toString(16)})},jsonMessageReplacer:x,jsonMessageReviver:_}=r;let A;if(b){if(!Fk(b))throw new Error("Invalid WebSocket implementation provided");A=b}else typeof WebSocket<"u"?A=WebSocket:typeof global<"u"?A=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(A=window.WebSocket||window.MozWebSocket);if(!A)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const P=A,M=(()=>{const ge=(()=>{const ke={};return{on(X,ye){return ke[X]=ye,()=>{delete ke[X]}},emit(X){var ye;"id"in X&&((ye=ke[X.id])===null||ye===void 0||ye.call(ke,X))}}})(),We={connecting:m!=null&&m.connecting?[m.connecting]:[],opened:m!=null&&m.opened?[m.opened]:[],connected:m!=null&&m.connected?[m.connected]:[],ping:m!=null&&m.ping?[m.ping]:[],pong:m!=null&&m.pong?[m.pong]:[],message:m!=null&&m.message?[ge.emit,m.message]:[ge.emit],closed:m!=null&&m.closed?[m.closed]:[],error:m!=null&&m.error?[m.error]:[]};return{onMessage:ge.on,on(ke,X){const ye=We[ke];return ye.push(X),()=>{ye.splice(ye.indexOf(X),1)}},emit(ke,...X){for(const ye of[...We[ke]])ye(...X)}}})();function $(ge){const We=[M.on("error",ke=>{We.forEach(X=>X()),ge(ke)}),M.on("closed",ke=>{We.forEach(X=>X()),ge(ke)})]}let j,K=0,ee,fe=!1,de=0,Ie=!1;async function pe(){clearTimeout(ee);const[ge,We]=await(j??(j=new Promise((ye,xe)=>(async()=>{if(fe){if(await d(de),!K)return j=void 0,xe({code:1e3,reason:"All Subscriptions Gone"});de++}M.emit("connecting",fe);const Se=new P(typeof e=="function"?await e():e,Pk);let Be,Ke;function Et(){isFinite(u)&&u>0&&(clearTimeout(Ke),Ke=setTimeout(()=>{Se.readyState===P.OPEN&&(Se.send(_o({type:mr.Ping})),M.emit("ping",!1,void 0))},u))}$(Ze=>{j=void 0,clearTimeout(Be),clearTimeout(Ke),xe(Ze),Ze instanceof R0&&(Se.close(4499,"Terminated"),Se.onerror=null,Se.onclose=null)}),Se.onerror=Ze=>M.emit("error",Ze),Se.onclose=Ze=>M.emit("closed",Ze),Se.onopen=async()=>{try{M.emit("opened",Se);const Ze=typeof t=="function"?await t():t;if(Se.readyState!==P.OPEN)return;Se.send(_o(Ze?{type:mr.ConnectionInit,payload:Ze}:{type:mr.ConnectionInit},x)),isFinite(f)&&f>0&&(Be=setTimeout(()=>{Se.close(vn.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},f)),Et()}catch(Ze){M.emit("error",Ze),Se.close(vn.InternalClientError,P0(Ze instanceof Error?Ze.message:new Error(Ze).message,"Internal client error"))}};let Tt=!1;Se.onmessage=({data:Ze})=>{try{const Je=Nk(Ze,_);if(M.emit("message",Je),Je.type==="ping"||Je.type==="pong"){M.emit(Je.type,!0,Je.payload),Je.type==="pong"?Et():c||(Se.send(_o(Je.payload?{type:mr.Pong,payload:Je.payload}:{type:mr.Pong})),M.emit("pong",!1,Je.payload));return}if(Tt)return;if(Je.type!==mr.ConnectionAck)throw new Error(`First message cannot be of type ${Je.type}`);clearTimeout(Be),Tt=!0,M.emit("connected",Se,Je.payload,fe),fe=!1,de=0,ye([Se,new Promise((vt,De)=>$(De))])}catch(Je){Se.onmessage=null,M.emit("error",Je),Se.close(vn.BadResponse,P0(Je instanceof Error?Je.message:new Error(Je).message,"Bad response"))}}})())));ge.readyState===P.CLOSING&&await We;let ke=()=>{};const X=new Promise(ye=>ke=ye);return[ge,ke,Promise.race([X.then(()=>{if(!K){const ye=()=>ge.close(1e3,"Normal Closure");isFinite(a)&&a>0?ee=setTimeout(()=>{ge.readyState===P.OPEN&&ye()},a):ye()}}),We])]}function Ce(ge){if(ph(ge)&&(Dk(ge.code)||[vn.InternalServerError,vn.InternalClientError,vn.BadRequest,vn.BadResponse,vn.Unauthorized,vn.SubprotocolNotAcceptable,vn.SubscriberAlreadyExists,vn.TooManyInitialisationRequests].includes(ge.code)))throw ge;if(Ie)return!1;if(ph(ge)&&ge.code===1e3)return K>0;if(!h||de>=h||!y(ge)||g!=null&&g(ge))throw ge;return fe=!0}n||(async()=>{for(K++;;)try{const[,,ge]=await pe();await ge}catch(ge){try{if(!Ce(ge))return}catch(We){return i==null?void 0:i(We)}}})();function Pe(ge,We){const ke=I(ge);let X=!1,ye=!1,xe=()=>{K--,X=!0};return(async()=>{for(K++;;)try{const[Se,Be,Ke]=await pe();if(X)return Be();const Et=M.onMessage(ke,Tt=>{switch(Tt.type){case mr.Next:{We.next(Tt.payload);return}case mr.Error:{ye=!0,X=!0,We.error(Tt.payload),xe();return}case mr.Complete:{X=!0,xe();return}}});Se.send(_o({id:ke,type:mr.Subscribe,payload:ge},x)),xe=()=>{!X&&Se.readyState===P.OPEN&&Se.send(_o({id:ke,type:mr.Complete},x)),K--,X=!0,Be()},await Ke.finally(Et);return}catch(Se){if(!Ce(Se))return}})().then(()=>{ye||We.complete()}).catch(Se=>{We.error(Se)}),()=>{X||xe()}}return{on:M.on,subscribe:Pe,iterate(ge){const We=[],ke={done:!1,error:null,resolve:()=>{}},X=Pe(ge,{next(xe){We.push(xe),ke.resolve()},error(xe){ke.done=!0,ke.error=xe,ke.resolve()},complete(){ke.done=!0,ke.resolve()}}),ye=function(){return Rk(this,arguments,function*(){for(;;){for(We.length||(yield ha(new Promise(Be=>ke.resolve=Be)));We.length;)yield yield ha(We.shift());if(ke.error)throw ke.error;if(ke.done)return yield ha(void 0)}})}();return ye.throw=async xe=>(ke.done||(ke.done=!0,ke.error=xe,ke.resolve()),{done:!0,value:void 0}),ye.return=async()=>(X(),{done:!0,value:void 0}),ye},async dispose(){if(Ie=!0,j){const[ge]=await j;ge.close(1e3,"Normal Closure")}},terminate(){j&&M.emit("closed",new R0)}}}class R0 extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function ph(r){return Is(r)&&"code"in r&&"reason"in r}function Dk(r){return[1e3,1001,1006,1005,1012,1013,1014].includes(r)?!1:r>=1e3&&r<=1999}function Fk(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function M0(r){return new Kr(function(e,t){var n=on(e,[]);return new Rt(function(i){var a,u=!1;return Promise.resolve(n).then(function(c){return r(c,e.getContext())}).then(e.setContext).then(function(){u||(a=t(e).subscribe({next:i.next.bind(i),error:i.error.bind(i),complete:i.complete.bind(i)}))}).catch(i.error.bind(i)),function(){u=!0,a&&a.unsubscribe()}})})}function D0(r){return new Kr(function(e,t){return new Rt(function(n){var i,a,u;try{i=t(e).subscribe({next:function(c){if(c.errors&&(u=r({graphQLErrors:c.errors,response:c,operation:e,forward:t}),u)){a=u.subscribe({next:n.next.bind(n),error:n.error.bind(n),complete:n.complete.bind(n)});return}n.next(c)},error:function(c){if(u=r({operation:e,networkError:c,graphQLErrors:c&&c.result&&c.result.errors||void 0,forward:t}),u){a=u.subscribe({next:n.next.bind(n),error:n.error.bind(n),complete:n.complete.bind(n)});return}n.error(c)},complete:function(){u||n.complete.bind(n)()}})}catch(c){r({networkError:c,operation:e,forward:t}),n.error(c)}return function(){i&&i.unsubscribe(),a&&i.unsubscribe()}})})}(function(r){Pn(e,r);function e(t){var n=r.call(this)||this;return n.link=D0(t),n}return e.prototype.request=function(t,n){return this.link.request(t,n)},e})(Kr);var mh={exports:{}};const Lk=ol(O1),qk=ol(gO);var yh,F0;function da(){return F0||(F0=1,yh=TypeError),yh}const jk=ol(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var gh,L0;function ec(){if(L0)return gh;L0=1;var r=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=r&&e&&typeof e.get=="function"?e.get:null,n=r&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,a=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,u=i&&a&&typeof a.get=="function"?a.get:null,c=i&&Set.prototype.forEach,f=typeof WeakMap=="function"&&WeakMap.prototype,h=f?WeakMap.prototype.has:null,d=typeof WeakSet=="function"&&WeakSet.prototype,y=d?WeakSet.prototype.has:null,g=typeof WeakRef=="function"&&WeakRef.prototype,m=g?WeakRef.prototype.deref:null,b=Boolean.prototype.valueOf,I=Object.prototype.toString,x=Function.prototype.toString,_=String.prototype.match,A=String.prototype.slice,P=String.prototype.replace,M=String.prototype.toUpperCase,$=String.prototype.toLowerCase,j=RegExp.prototype.test,K=Array.prototype.concat,ee=Array.prototype.join,fe=Array.prototype.slice,de=Math.floor,Ie=typeof BigInt=="function"?BigInt.prototype.valueOf:null,pe=Object.getOwnPropertySymbols,Ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Pe=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ge=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Pe||!0)?Symbol.toStringTag:null,We=Object.prototype.propertyIsEnumerable,ke=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(H){return H.__proto__}:null);function X(H,G){if(H===1/0||H===-1/0||H!==H||H&&H>-1e3&&H<1e3||j.call(/e/,G))return G;var at=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof H=="number"){var wt=H<0?-de(-H):de(H);if(wt!==H){var ft=String(wt),He=A.call(G,ft.length+1);return P.call(ft,at,"$&_")+"."+P.call(P.call(He,/([0-9]{3})/g,"$&_"),/_$/,"")}}return P.call(G,at,"$&_")}var ye=jk,xe=ye.custom,Se=q(xe)?xe:null,Be={__proto__:null,double:'"',single:"'"},Ke={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};gh=function H(G,at,wt,ft){var He=at||{};if(W(He,"quoteStyle")&&!W(Be,He.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(W(He,"maxStringLength")&&(typeof He.maxStringLength=="number"?He.maxStringLength<0&&He.maxStringLength!==1/0:He.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Kt=W(He,"customInspect")?He.customInspect:!0;if(typeof Kt!="boolean"&&Kt!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(W(He,"indent")&&He.indent!==null&&He.indent!==" "&&!(parseInt(He.indent,10)===He.indent&&He.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(W(He,"numericSeparator")&&typeof He.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Zt=He.numericSeparator;if(typeof G>"u")return"undefined";if(G===null)return"null";if(typeof G=="boolean")return G?"true":"false";if(typeof G=="string")return At(G,He);if(typeof G=="number"){if(G===0)return 1/0/G>0?"0":"-0";var Qt=String(G);return Zt?X(G,Qt):Qt}if(typeof G=="bigint"){var kr=String(G)+"n";return Zt?X(G,kr):kr}var Hr=typeof He.depth>"u"?5:He.depth;if(typeof wt>"u"&&(wt=0),wt>=Hr&&Hr>0&&typeof G=="object")return Ze(G)?"[Array]":"[Object]";var Fr=dr(He,wt);if(typeof ft>"u")ft=[];else if($e(ft,G)>=0)return"[Circular]";function Ut(Xe,rt,nt){if(rt&&(ft=fe.call(ft),ft.push(rt)),nt){var bt={depth:He.depth};return W(He,"quoteStyle")&&(bt.quoteStyle=He.quoteStyle),H(Xe,bt,wt+1,ft)}return H(Xe,He,wt+1,ft)}if(typeof G=="function"&&!vt(G)){var Or=ze(G),$r=Ht(G,Ut);return"[Function"+(Or?": "+Or:" (anonymous)")+"]"+($r.length>0?" { "+ee.call($r,", ")+" }":"")}if(q(G)){var Lr=Pe?P.call(String(G),/^(Symbol\(.*\))_[^)]*$/,"$1"):Ce.call(G);return typeof G=="object"&&!Pe?Gt(Lr):Lr}if(Yt(G)){for(var ar="<"+$.call(String(G.nodeName)),Gr=G.attributes||[],Tr=0;Tr<Gr.length;Tr++)ar+=" "+Gr[Tr].name+"="+Et(Tt(Gr[Tr].value),"double",He);return ar+=">",G.childNodes&&G.childNodes.length&&(ar+="..."),ar+="</"+$.call(String(G.nodeName))+">",ar}if(Ze(G)){if(G.length===0)return"[]";var gr=Ht(G,Ut);return Fr&&!sr(gr)?"["+Ar(gr,Fr)+"]":"[ "+ee.call(gr,", ")+" ]"}if(De(G)){var Ir=Ht(G,Ut);return!("cause"in Error.prototype)&&"cause"in G&&!We.call(G,"cause")?"{ ["+String(G)+"] "+ee.call(K.call("[cause]: "+Ut(G.cause),Ir),", ")+" }":Ir.length===0?"["+String(G)+"]":"{ ["+String(G)+"] "+ee.call(Ir,", ")+" }"}if(typeof G=="object"&&Kt){if(Se&&typeof G[Se]=="function"&&ye)return ye(G,{depth:Hr-wt});if(Kt!=="symbol"&&typeof G.inspect=="function")return G.inspect()}if(se(G)){var Sn=[];return n&&n.call(G,function(Xe,rt){Sn.push(Ut(rt,G,!0)+" => "+Ut(Xe,G))}),zt("Map",t.call(G),Sn,Fr)}if(mt(G)){var Un=[];return c&&c.call(G,function(Xe){Un.push(Ut(Xe,G))}),zt("Set",u.call(G),Un,Fr)}if(we(G))return Er("WeakMap");if(yt(G))return Er("WeakSet");if(Qe(G))return Er("WeakRef");if(V(G))return Gt(Ut(Number(G)));if(J(G))return Gt(Ut(Ie.call(G)));if(Q(G))return Gt(b.call(G));if(Ge(G))return Gt(Ut(String(G)));if(typeof window<"u"&&G===window)return"{ [object Window] }";if(typeof globalThis<"u"&&G===globalThis||typeof pi<"u"&&G===pi)return"{ [object globalThis] }";if(!Je(G)&&!vt(G)){var R=Ht(G,Ut),oe=ke?ke(G)===Object.prototype:G instanceof Object||G.constructor===Object,ve=G instanceof Object?"":"null prototype",Ne=!oe&&ge&&Object(G)===G&&ge in G?A.call(_e(G),8,-1):ve?"Object":"",Ve=oe||typeof G.constructor!="function"?"":G.constructor.name?G.constructor.name+" ":"",ct=Ve+(Ne||ve?"["+ee.call(K.call([],Ne||[],ve||[]),": ")+"] ":"");return R.length===0?ct+"{}":Fr?ct+"{"+Ar(R,Fr)+"}":ct+"{ "+ee.call(R,", ")+" }"}return String(G)};function Et(H,G,at){var wt=at.quoteStyle||G,ft=Be[wt];return ft+H+ft}function Tt(H){return P.call(String(H),/"/g,""")}function Ze(H){return _e(H)==="[object Array]"&&(!ge||!(typeof H=="object"&&ge in H))}function Je(H){return _e(H)==="[object Date]"&&(!ge||!(typeof H=="object"&&ge in H))}function vt(H){return _e(H)==="[object RegExp]"&&(!ge||!(typeof H=="object"&&ge in H))}function De(H){return _e(H)==="[object Error]"&&(!ge||!(typeof H=="object"&&ge in H))}function Ge(H){return _e(H)==="[object String]"&&(!ge||!(typeof H=="object"&&ge in H))}function V(H){return _e(H)==="[object Number]"&&(!ge||!(typeof H=="object"&&ge in H))}function Q(H){return _e(H)==="[object Boolean]"&&(!ge||!(typeof H=="object"&&ge in H))}function q(H){if(Pe)return H&&typeof H=="object"&&H instanceof Symbol;if(typeof H=="symbol")return!0;if(!H||typeof H!="object"||!Ce)return!1;try{return Ce.call(H),!0}catch{}return!1}function J(H){if(!H||typeof H!="object"||!Ie)return!1;try{return Ie.call(H),!0}catch{}return!1}var te=Object.prototype.hasOwnProperty||function(H){return H in this};function W(H,G){return te.call(H,G)}function _e(H){return I.call(H)}function ze(H){if(H.name)return H.name;var G=_.call(x.call(H),/^function\s*([\w$]+)/);return G?G[1]:null}function $e(H,G){if(H.indexOf)return H.indexOf(G);for(var at=0,wt=H.length;at<wt;at++)if(H[at]===G)return at;return-1}function se(H){if(!t||!H||typeof H!="object")return!1;try{t.call(H);try{u.call(H)}catch{return!0}return H instanceof Map}catch{}return!1}function we(H){if(!h||!H||typeof H!="object")return!1;try{h.call(H,h);try{y.call(H,y)}catch{return!0}return H instanceof WeakMap}catch{}return!1}function Qe(H){if(!m||!H||typeof H!="object")return!1;try{return m.call(H),!0}catch{}return!1}function mt(H){if(!u||!H||typeof H!="object")return!1;try{u.call(H);try{t.call(H)}catch{return!0}return H instanceof Set}catch{}return!1}function yt(H){if(!y||!H||typeof H!="object")return!1;try{y.call(H,y);try{h.call(H,h)}catch{return!0}return H instanceof WeakSet}catch{}return!1}function Yt(H){return!H||typeof H!="object"?!1:typeof HTMLElement<"u"&&H instanceof HTMLElement?!0:typeof H.nodeName=="string"&&typeof H.getAttribute=="function"}function At(H,G){if(H.length>G.maxStringLength){var at=H.length-G.maxStringLength,wt="... "+at+" more character"+(at>1?"s":"");return At(A.call(H,0,G.maxStringLength),G)+wt}var ft=Ke[G.quoteStyle||"single"];ft.lastIndex=0;var He=P.call(P.call(H,ft,"\\$1"),/[\x00-\x1f]/g,Wt);return Et(He,"single",G)}function Wt(H){var G=H.charCodeAt(0),at={8:"b",9:"t",10:"n",12:"f",13:"r"}[G];return at?"\\"+at:"\\x"+(G<16?"0":"")+M.call(G.toString(16))}function Gt(H){return"Object("+H+")"}function Er(H){return H+" { ? }"}function zt(H,G,at,wt){var ft=wt?Ar(at,wt):ee.call(at,", ");return H+" ("+G+") {"+ft+"}"}function sr(H){for(var G=0;G<H.length;G++)if($e(H[G],`
|
|
129
|
-
`)>=0)return!1;return!0}function
|
|
130
|
-
`+
|
|
131
|
-
`+G.prev}function Ht(H,G){var at=Ze(H),wt=[];if(at){wt.length=H.length;for(var ft=0;ft<H.length;ft++)wt[ft]=W(H,ft)?G(H[ft],H):""}var He=typeof pe=="function"?pe(H):[],Kt;if(Pe){Kt={};for(var Zt=0;Zt<He.length;Zt++)Kt["$"+He[Zt]]=He[Zt]}for(var Qt in H)W(H,Qt)&&(at&&String(Number(Qt))===Qt&&Qt<H.length||Pe&&Kt["$"+Qt]instanceof Symbol||(j.call(/[^\w$]/,Qt)?wt.push(G(Qt,H)+": "+G(H[Qt],H)):wt.push(Qt+": "+G(H[Qt],H))));if(typeof pe=="function")for(var kr=0;kr<He.length;kr++)We.call(H,He[kr])&&wt.push("["+G(He[kr])+"]: "+G(H[He[kr]],H));return wt}return gh}var vh,q0;function Uk(){if(q0)return vh;q0=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,j0;function U0(){return j0||(j0=1,bh=Object),bh}var wh,$0;function $k(){return $0||($0=1,wh=Error),wh}var _h,B0;function Bk(){return B0||(B0=1,_h=EvalError),_h}var xh,V0;function Vk(){return V0||(V0=1,xh=RangeError),xh}var Sh,W0;function Wk(){return W0||(W0=1,Sh=ReferenceError),Sh}var Eh,z0;function zk(){return z0||(z0=1,Eh=SyntaxError),Eh}var Oh,H0;function Hk(){return H0||(H0=1,Oh=URIError),Oh}var Th,G0;function Gk(){return G0||(G0=1,Th=Math.abs),Th}var Ah,Q0;function Qk(){return Q0||(Q0=1,Ah=Math.floor),Ah}var kh,J0;function Jk(){return J0||(J0=1,kh=Math.max),kh}var Ih,Y0;function Yk(){return Y0||(Y0=1,Ih=Math.min),Ih}var Ch,K0;function Kk(){return K0||(K0=1,Ch=Math.pow),Ch}var Ph,Z0;function Zk(){return Z0||(Z0=1,Ph=Math.round),Ph}var Nh,X0;function Xk(){return X0||(X0=1,Nh=Number.isNaN||function(e){return e!==e}),Nh}var Rh,eb;function eI(){if(eb)return Rh;eb=1;var r=Xk();return Rh=function(t){return r(t)||t===0?t:t<0?-1:1},Rh}var Mh,tb;function tI(){return tb||(tb=1,Mh=Object.getOwnPropertyDescriptor),Mh}var Dh,rb;function nb(){if(rb)return Dh;rb=1;var r=tI();if(r)try{r([],"length")}catch{r=null}return Dh=r,Dh}var Fh,ib;function rI(){if(ib)return Fh;ib=1;var r=Object.defineProperty||!1;if(r)try{r({},"a",{value:1})}catch{r=!1}return Fh=r,Fh}var Lh,sb;function nI(){return sb||(sb=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,ab;function iI(){if(ab)return qh;ab=1;var r=typeof Symbol<"u"&&Symbol,e=nI();return qh=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},qh}var jh,ob;function ub(){return ob||(ob=1,jh=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),jh}var Uh,cb;function lb(){if(cb)return Uh;cb=1;var r=U0();return Uh=r.getPrototypeOf||null,Uh}var $h,fb;function sI(){if(fb)return $h;fb=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 x=function(){};x.prototype=h.prototype,y.prototype=new x,x.prototype=null}return y},$h}var Bh,hb;function tc(){if(hb)return Bh;hb=1;var r=sI();return Bh=Function.prototype.bind||r,Bh}var Vh,db;function Wh(){return db||(db=1,Vh=Function.prototype.call),Vh}var zh,pb;function mb(){return pb||(pb=1,zh=Function.prototype.apply),zh}var Hh,yb;function aI(){return yb||(yb=1,Hh=typeof Reflect<"u"&&Reflect&&Reflect.apply),Hh}var Gh,gb;function oI(){if(gb)return Gh;gb=1;var r=tc(),e=mb(),t=Wh(),n=aI();return Gh=n||r.call(t,e),Gh}var Qh,vb;function bb(){if(vb)return Qh;vb=1;var r=tc(),e=da(),t=Wh(),n=oI();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,wb;function uI(){if(wb)return Jh;wb=1;var r=bb(),e=nb(),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,_b;function cI(){if(_b)return Yh;_b=1;var r=ub(),e=lb(),t=uI();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,xb;function lI(){if(xb)return Kh;xb=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=tc();return Kh=t.call(r,e),Kh}var Zh,Sb;function Xh(){if(Sb)return Zh;Sb=1;var r,e=U0(),t=$k(),n=Bk(),i=Vk(),a=Wk(),u=zk(),c=da(),f=Hk(),h=Gk(),d=Qk(),y=Jk(),g=Yk(),m=Kk(),b=Zk(),I=eI(),x=Function,_=function(De){try{return x('"use strict"; return ('+De+").constructor;")()}catch{}},A=nb(),P=rI(),M=function(){throw new c},$=A?function(){try{return arguments.callee,M}catch{try{return A(arguments,"callee").get}catch{return M}}}():M,j=iI()(),K=cI(),ee=lb(),fe=ub(),de=mb(),Ie=Wh(),pe={},Ce=typeof Uint8Array>"u"||!K?r:K(Uint8Array),Pe={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":j&&K?K([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":pe,"%AsyncGenerator%":pe,"%AsyncGeneratorFunction%":pe,"%AsyncIteratorPrototype%":pe,"%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%":x,"%GeneratorFunction%":pe,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":j&&K?K(K([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!j||!K?r:K(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":A,"%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"||!j||!K?r:K(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":j&&K?K(""[Symbol.iterator]()):r,"%Symbol%":j?Symbol:r,"%SyntaxError%":u,"%ThrowTypeError%":$,"%TypedArray%":Ce,"%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%":Ie,"%Function.prototype.apply%":de,"%Object.defineProperty%":P,"%Object.getPrototypeOf%":ee,"%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(De){var ge=K(K(De));Pe["%Error.prototype%"]=ge}var We=function De(Ge){var V;if(Ge==="%AsyncFunction%")V=_("async function () {}");else if(Ge==="%GeneratorFunction%")V=_("function* () {}");else if(Ge==="%AsyncGeneratorFunction%")V=_("async function* () {}");else if(Ge==="%AsyncGenerator%"){var Q=De("%AsyncGeneratorFunction%");Q&&(V=Q.prototype)}else if(Ge==="%AsyncIteratorPrototype%"){var q=De("%AsyncGenerator%");q&&K&&(V=K(q.prototype))}return Pe[Ge]=V,V},ke={__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"]},X=tc(),ye=lI(),xe=X.call(Ie,Array.prototype.concat),Se=X.call(de,Array.prototype.splice),Be=X.call(Ie,String.prototype.replace),Ke=X.call(Ie,String.prototype.slice),Et=X.call(Ie,RegExp.prototype.exec),Tt=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ze=/\\(\\)?/g,Je=function(Ge){var V=Ke(Ge,0,1),Q=Ke(Ge,-1);if(V==="%"&&Q!=="%")throw new u("invalid intrinsic syntax, expected closing `%`");if(Q==="%"&&V!=="%")throw new u("invalid intrinsic syntax, expected opening `%`");var q=[];return Be(Ge,Tt,function(J,te,W,_e){q[q.length]=W?Be(_e,Ze,"$1"):te||J}),q},vt=function(Ge,V){var Q=Ge,q;if(ye(ke,Q)&&(q=ke[Q],Q="%"+q[0]+"%"),ye(Pe,Q)){var J=Pe[Q];if(J===pe&&(J=We(Q)),typeof J>"u"&&!V)throw new c("intrinsic "+Ge+" exists, but is not available. Please file an issue!");return{alias:q,name:Q,value:J}}throw new u("intrinsic "+Ge+" does not exist!")};return Zh=function(Ge,V){if(typeof Ge!="string"||Ge.length===0)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof V!="boolean")throw new c('"allowMissing" argument must be a boolean');if(Et(/^%?[^%]*%?$/,Ge)===null)throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Q=Je(Ge),q=Q.length>0?Q[0]:"",J=vt("%"+q+"%",V),te=J.name,W=J.value,_e=!1,ze=J.alias;ze&&(q=ze[0],Se(Q,xe([0,1],ze)));for(var $e=1,se=!0;$e<Q.length;$e+=1){var we=Q[$e],Qe=Ke(we,0,1),mt=Ke(we,-1);if((Qe==='"'||Qe==="'"||Qe==="`"||mt==='"'||mt==="'"||mt==="`")&&Qe!==mt)throw new u("property names with quotes must have matching quotes");if((we==="constructor"||!se)&&(_e=!0),q+="."+we,te="%"+q+"%",ye(Pe,te))W=Pe[te];else if(W!=null){if(!(we in W)){if(!V)throw new c("base intrinsic for "+Ge+" exists, but the property is not available.");return}if(A&&$e+1>=Q.length){var yt=A(W,we);se=!!yt,se&&"get"in yt&&!("originalValue"in yt.get)?W=yt.get:W=W[we]}else se=ye(W,we),W=W[we];se&&!_e&&(Pe[te]=W)}}return W},Zh}var ed,Eb;function Ob(){if(Eb)return ed;Eb=1;var r=Xh(),e=bb(),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,Tb;function Ab(){if(Tb)return td;Tb=1;var r=Xh(),e=Ob(),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,kb;function fI(){if(kb)return rd;kb=1;var r=Xh(),e=Ob(),t=ec(),n=Ab(),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,Ib;function hI(){if(Ib)return nd;Ib=1;var r=da(),e=ec(),t=Uk(),n=Ab(),i=fI(),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,Cb;function sd(){if(Cb)return id;Cb=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,Pb;function Nb(){if(Pb)return ad;Pb=1;var r=sd(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n=function(){for(var x=[],_=0;_<256;++_)x.push("%"+((_<16?"0":"")+_.toString(16)).toUpperCase());return x}(),i=function(_){for(;_.length>1;){var A=_.pop(),P=A.obj[A.prop];if(t(P)){for(var M=[],$=0;$<P.length;++$)typeof P[$]<"u"&&M.push(P[$]);A.obj[A.prop]=M}}},a=function(_,A){for(var P=A&&A.plainObjects?Object.create(null):{},M=0;M<_.length;++M)typeof _[M]<"u"&&(P[M]=_[M]);return P},u=function x(_,A,P){if(!A)return _;if(typeof A!="object"){if(t(_))_.push(A);else if(_&&typeof _=="object")(P&&(P.plainObjects||P.allowPrototypes)||!e.call(Object.prototype,A))&&(_[A]=!0);else return[_,A];return _}if(!_||typeof _!="object")return[_].concat(A);var M=_;return t(_)&&!t(A)&&(M=a(_,P)),t(_)&&t(A)?(A.forEach(function($,j){if(e.call(_,j)){var K=_[j];K&&typeof K=="object"&&$&&typeof $=="object"?_[j]=x(K,$,P):_.push($)}else _[j]=$}),_):Object.keys(A).reduce(function($,j){var K=A[j];return e.call($,j)?$[j]=x($[j],K,P):$[j]=K,$},M)},c=function(_,A){return Object.keys(A).reduce(function(P,M){return P[M]=A[M],P},_)},f=function(x,_,A){var P=x.replace(/\+/g," ");if(A==="iso-8859-1")return P.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(P)}catch{return P}},h=1024,d=function(_,A,P,M,$){if(_.length===0)return _;var j=_;if(typeof _=="symbol"?j=Symbol.prototype.toString.call(_):typeof _!="string"&&(j=String(_)),P==="iso-8859-1")return escape(j).replace(/%u[0-9a-f]{4}/gi,function(Ce){return"%26%23"+parseInt(Ce.slice(2),16)+"%3B"});for(var K="",ee=0;ee<j.length;ee+=h){for(var fe=j.length>=h?j.slice(ee,ee+h):j,de=[],Ie=0;Ie<fe.length;++Ie){var pe=fe.charCodeAt(Ie);if(pe===45||pe===46||pe===95||pe===126||pe>=48&&pe<=57||pe>=65&&pe<=90||pe>=97&&pe<=122||$===r.RFC1738&&(pe===40||pe===41)){de[de.length]=fe.charAt(Ie);continue}if(pe<128){de[de.length]=n[pe];continue}if(pe<2048){de[de.length]=n[192|pe>>6]+n[128|pe&63];continue}if(pe<55296||pe>=57344){de[de.length]=n[224|pe>>12]+n[128|pe>>6&63]+n[128|pe&63];continue}Ie+=1,pe=65536+((pe&1023)<<10|fe.charCodeAt(Ie)&1023),de[de.length]=n[240|pe>>18]+n[128|pe>>12&63]+n[128|pe>>6&63]+n[128|pe&63]}K+=de.join("")}return K},y=function(_){for(var A=[{obj:{o:_},prop:"o"}],P=[],M=0;M<A.length;++M)for(var $=A[M],j=$.obj[$.prop],K=Object.keys(j),ee=0;ee<K.length;++ee){var fe=K[ee],de=j[fe];typeof de=="object"&&de!==null&&P.indexOf(de)===-1&&(A.push({obj:j,prop:fe}),P.push(de))}return i(A),_},g=function(_){return Object.prototype.toString.call(_)==="[object RegExp]"},m=function(_){return!_||typeof _!="object"?!1:!!(_.constructor&&_.constructor.isBuffer&&_.constructor.isBuffer(_))},b=function(_,A){return[].concat(_,A)},I=function(_,A){if(t(_)){for(var P=[],M=0;M<_.length;M+=1)P.push(A(_[M]));return P}return A(_)};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,Rb;function dI(){if(Rb)return od;Rb=1;var r=hI(),e=Nb(),t=sd(),n=Object.prototype.hasOwnProperty,i={brackets:function(x){return x+"[]"},comma:"comma",indices:function(x,_){return x+"["+_+"]"},repeat:function(x){return x}},a=Array.isArray,u=Array.prototype.push,c=function(I,x){u.apply(I,a(x)?x:[x])},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(x){return f.call(x)},skipNulls:!1,strictNullHandling:!1},y=function(x){return typeof x=="string"||typeof x=="number"||typeof x=="boolean"||typeof x=="symbol"||typeof x=="bigint"},g={},m=function I(x,_,A,P,M,$,j,K,ee,fe,de,Ie,pe,Ce,Pe,ge,We,ke){for(var X=x,ye=ke,xe=0,Se=!1;(ye=ye.get(g))!==void 0&&!Se;){var Be=ye.get(x);if(xe+=1,typeof Be<"u"){if(Be===xe)throw new RangeError("Cyclic object value");Se=!0}typeof ye.get(g)>"u"&&(xe=0)}if(typeof fe=="function"?X=fe(_,X):X instanceof Date?X=pe(X):A==="comma"&&a(X)&&(X=e.maybeMap(X,function(te){return te instanceof Date?pe(te):te})),X===null){if($)return ee&&!ge?ee(_,d.encoder,We,"key",Ce):_;X=""}if(y(X)||e.isBuffer(X)){if(ee){var Ke=ge?_:ee(_,d.encoder,We,"key",Ce);return[Pe(Ke)+"="+Pe(ee(X,d.encoder,We,"value",Ce))]}return[Pe(_)+"="+Pe(String(X))]}var Et=[];if(typeof X>"u")return Et;var Tt;if(A==="comma"&&a(X))ge&&ee&&(X=e.maybeMap(X,ee)),Tt=[{value:X.length>0?X.join(",")||null:void 0}];else if(a(fe))Tt=fe;else{var Ze=Object.keys(X);Tt=de?Ze.sort(de):Ze}var Je=K?_.replace(/\./g,"%2E"):_,vt=P&&a(X)&&X.length===1?Je+"[]":Je;if(M&&a(X)&&X.length===0)return vt+"[]";for(var De=0;De<Tt.length;++De){var Ge=Tt[De],V=typeof Ge=="object"&&typeof Ge.value<"u"?Ge.value:X[Ge];if(!(j&&V===null)){var Q=Ie&&K?Ge.replace(/\./g,"%2E"):Ge,q=a(X)?typeof A=="function"?A(vt,Q):vt:vt+(Ie?"."+Q:"["+Q+"]");ke.set(x,xe);var J=r();J.set(g,ke),c(Et,I(V,q,A,P,M,$,j,K,A==="comma"&&ge&&a(X)?null:ee,fe,de,Ie,pe,Ce,Pe,ge,We,J))}}return Et},b=function(x){if(!x)return d;if(typeof x.allowEmptyArrays<"u"&&typeof x.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof x.encodeDotInKeys<"u"&&typeof x.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(x.encoder!==null&&typeof x.encoder<"u"&&typeof x.encoder!="function")throw new TypeError("Encoder has to be a function.");var _=x.charset||d.charset;if(typeof x.charset<"u"&&x.charset!=="utf-8"&&x.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var A=t.default;if(typeof x.format<"u"){if(!n.call(t.formatters,x.format))throw new TypeError("Unknown format option provided.");A=x.format}var P=t.formatters[A],M=d.filter;(typeof x.filter=="function"||a(x.filter))&&(M=x.filter);var $;if(x.arrayFormat in i?$=x.arrayFormat:"indices"in x?$=x.indices?"indices":"repeat":$=d.arrayFormat,"commaRoundTrip"in x&&typeof x.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var j=typeof x.allowDots>"u"?x.encodeDotInKeys===!0?!0:d.allowDots:!!x.allowDots;return{addQueryPrefix:typeof x.addQueryPrefix=="boolean"?x.addQueryPrefix:d.addQueryPrefix,allowDots:j,allowEmptyArrays:typeof x.allowEmptyArrays=="boolean"?!!x.allowEmptyArrays:d.allowEmptyArrays,arrayFormat:$,charset:_,charsetSentinel:typeof x.charsetSentinel=="boolean"?x.charsetSentinel:d.charsetSentinel,commaRoundTrip:x.commaRoundTrip,delimiter:typeof x.delimiter>"u"?d.delimiter:x.delimiter,encode:typeof x.encode=="boolean"?x.encode:d.encode,encodeDotInKeys:typeof x.encodeDotInKeys=="boolean"?x.encodeDotInKeys:d.encodeDotInKeys,encoder:typeof x.encoder=="function"?x.encoder:d.encoder,encodeValuesOnly:typeof x.encodeValuesOnly=="boolean"?x.encodeValuesOnly:d.encodeValuesOnly,filter:M,format:A,formatter:P,serializeDate:typeof x.serializeDate=="function"?x.serializeDate:d.serializeDate,skipNulls:typeof x.skipNulls=="boolean"?x.skipNulls:d.skipNulls,sort:typeof x.sort=="function"?x.sort:null,strictNullHandling:typeof x.strictNullHandling=="boolean"?x.strictNullHandling:d.strictNullHandling}};return od=function(I,x){var _=I,A=b(x),P,M;typeof A.filter=="function"?(M=A.filter,_=M("",_)):a(A.filter)&&(M=A.filter,P=M);var $=[];if(typeof _!="object"||_===null)return"";var j=i[A.arrayFormat],K=j==="comma"&&A.commaRoundTrip;P||(P=Object.keys(_)),A.sort&&P.sort(A.sort);for(var ee=r(),fe=0;fe<P.length;++fe){var de=P[fe];A.skipNulls&&_[de]===null||c($,m(_[de],de,j,K,A.allowEmptyArrays,A.strictNullHandling,A.skipNulls,A.encodeDotInKeys,A.encode?A.encoder:null,A.filter,A.sort,A.allowDots,A.serializeDate,A.format,A.formatter,A.encodeValuesOnly,A.charset,ee))}var Ie=$.join(A.delimiter),pe=A.addQueryPrefix===!0?"?":"";return A.charsetSentinel&&(A.charset==="iso-8859-1"?pe+="utf8=%26%2310003%3B&":pe+="utf8=%E2%9C%93&"),Ie.length>0?pe+Ie:""},od}var ud,Mb;function pI(){if(Mb)return ud;Mb=1;var r=Nb(),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},x=b.ignoreQueryPrefix?m.replace(/^\?/,""):m;x=x.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var _=b.parameterLimit===1/0?void 0:b.parameterLimit,A=x.split(b.delimiter,_),P=-1,M,$=b.charset;if(b.charsetSentinel)for(M=0;M<A.length;++M)A[M].indexOf("utf8=")===0&&(A[M]===c?$="utf-8":A[M]===u&&($="iso-8859-1"),P=M,M=A.length);for(M=0;M<A.length;++M)if(M!==P){var j=A[M],K=j.indexOf("]="),ee=K===-1?j.indexOf("="):K+1,fe,de;ee===-1?(fe=b.decoder(j,n.decoder,$,"key"),de=b.strictNullHandling?null:""):(fe=b.decoder(j.slice(0,ee),n.decoder,$,"key"),de=r.maybeMap(a(j.slice(ee+1),b),function(pe){return b.decoder(pe,n.decoder,$,"value")})),de&&b.interpretNumericEntities&&$==="iso-8859-1"&&(de=i(de)),j.indexOf("[]=")>-1&&(de=t(de)?[de]:de);var Ie=e.call(I,fe);Ie&&b.duplicates==="combine"?I[fe]=r.combine(I[fe],de):(!Ie||b.duplicates==="last")&&(I[fe]=de)}return I},h=function(g,m,b,I){for(var x=I?m:a(m,b),_=g.length-1;_>=0;--_){var A,P=g[_];if(P==="[]"&&b.parseArrays)A=b.allowEmptyArrays&&(x===""||b.strictNullHandling&&x===null)?[]:[].concat(x);else{A=b.plainObjects?Object.create(null):{};var M=P.charAt(0)==="["&&P.charAt(P.length-1)==="]"?P.slice(1,-1):P,$=b.decodeDotInKeys?M.replace(/%2E/g,"."):M,j=parseInt($,10);!b.parseArrays&&$===""?A={0:x}:!isNaN(j)&&P!==$&&String(j)===$&&j>=0&&b.parseArrays&&j<=b.arrayLimit?(A=[],A[j]=x):$!=="__proto__"&&(A[$]=x)}x=A}return x},d=function(m,b,I,x){if(m){var _=I.allowDots?m.replace(/\.([^.[]+)/g,"[$1]"):m,A=/(\[[^[\]]*])/,P=/(\[[^[\]]*])/g,M=I.depth>0&&A.exec(_),$=M?_.slice(0,M.index):_,j=[];if($){if(!I.plainObjects&&e.call(Object.prototype,$)&&!I.allowPrototypes)return;j.push($)}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;j.push(M[1])}if(M){if(I.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+I.depth+" and strictDepth is true");j.push("["+_.slice(M.index)+"]")}return h(j,b,I,x)}},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 x=typeof m.allowDots>"u"?m.decodeDotInKeys===!0?!0:n.allowDots:!!m.allowDots;return{allowDots:x,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,x=b.plainObjects?Object.create(null):{},_=Object.keys(I),A=0;A<_.length;++A){var P=_[A],M=d(P,I[P],b,typeof g=="string");x=r.merge(x,M,b)}return b.allowSparse===!0?x:r.compact(x)},ud}var cd,Db;function mI(){if(Db)return cd;Db=1;var r=dI(),e=pI(),t=sd();return cd={formats:t,parse:e,stringify:r},cd}(function(r,e){(function(t,n){n(e,Lk,qk,mI())})(pi,function(t,n,i,a){var u=function(V,Q,q,J){function te(W){return W instanceof q?W:new q(function(_e){_e(W)})}return new(q||(q=Promise))(function(W,_e){function ze(we){try{se(J.next(we))}catch(Qe){_e(Qe)}}function $e(we){try{se(J.throw(we))}catch(Qe){_e(Qe)}}function se(we){we.done?W(we.value):te(we.value).then(ze,$e)}se((J=J.apply(V,Q||[])).next())})},c=function(V,Q){var q={label:0,sent:function(){if(W[0]&1)throw W[1];return W[1]},trys:[],ops:[]},J,te,W,_e;return _e={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(_e[Symbol.iterator]=function(){return this}),_e;function ze(se){return function(we){return $e([se,we])}}function $e(se){if(J)throw new TypeError("Generator is already executing.");for(;q;)try{if(J=1,te&&(W=se[0]&2?te.return:se[0]?te.throw||((W=te.return)&&W.call(te),0):te.next)&&!(W=W.call(te,se[1])).done)return W;switch(te=0,W&&(se=[se[0]&2,W.value]),se[0]){case 0:case 1:W=se;break;case 4:return q.label++,{value:se[1],done:!1};case 5:q.label++,te=se[1],se=[0];continue;case 7:se=q.ops.pop(),q.trys.pop();continue;default:if(W=q.trys,!(W=W.length>0&&W[W.length-1])&&(se[0]===6||se[0]===2)){q=0;continue}if(se[0]===3&&(!W||se[1]>W[0]&&se[1]<W[3])){q.label=se[1];break}if(se[0]===6&&q.label<W[1]){q.label=W[1],W=se;break}if(W&&q.label<W[2]){q.label=W[2],q.ops.push(se);break}W[2]&&q.ops.pop(),q.trys.pop();continue}se=Q.call(V,q)}catch(we){se=[6,we],te=0}finally{J=W=0}if(se[0]&5)throw se[1];return{value:se[0]?se[1]:void 0,done:!0}}};function f(V,Q){if(V.directives&&V.directives.length){var q={};return V.directives.forEach(function(J){q[J.name.value]=i.argumentsObjectFromField(J,Q)}),q}return null}var h=Object.prototype.hasOwnProperty;function d(V,Q){Q!==null&&typeof Q=="object"&&Object.keys(Q).forEach(function(q){var J=Q[q];h.call(V,q)?d(V[q],J):V[q]=J})}function y(V,Q,q,J,te,W){W===void 0&&(W={});var _e=i.getMainDefinition(Q),ze=i.getFragmentDefinitions(Q),$e=i.createFragmentMap(ze),se=W.resultMapper,we=W.fragmentMatcher||function(){return!0},Qe={fragmentMap:$e,contextValue:J,variableValues:te,resultMapper:se,resolver:V,fragmentMatcher:we};return g(_e.selectionSet,q,Qe)}function g(V,Q,q){return u(this,void 0,void 0,function(){var J,te,W,_e,ze,$e=this;return c(this,function(se){switch(se.label){case 0:return J=q.fragmentMap,te=q.contextValue,W=q.variableValues,_e={},ze=function(we){return u($e,void 0,void 0,function(){var Qe,mt,yt,Yt,At;return c(this,function(Wt){switch(Wt.label){case 0:return i.shouldInclude(we,W)?i.isField(we)?[4,m(we,Q,q)]:[3,2]:[2];case 1:return Qe=Wt.sent(),mt=i.resultKeyNameFromField(we),Qe!==void 0&&(_e[mt]===void 0?_e[mt]=Qe:d(_e[mt],Qe)),[2];case 2:if(i.isInlineFragment(we))yt=we;else if(yt=J[we.name.value],!yt)throw new Error("No fragment named "+we.name.value);return Yt=yt.typeCondition.name.value,q.fragmentMatcher(Q,Yt,te)?[4,g(yt.selectionSet,Q,q)]:[3,4];case 3:At=Wt.sent(),d(_e,At),Wt.label=4;case 4:return[2]}})})},[4,Promise.all(V.selections.map(ze))];case 1:return se.sent(),q.resultMapper?[2,q.resultMapper(_e,Q)]:[2,_e]}})})}function m(V,Q,q){return u(this,void 0,void 0,function(){var J,te,W,_e,ze,$e,se;return c(this,function(we){switch(we.label){case 0:return J=q.variableValues,te=q.contextValue,W=q.resolver,_e=V.name.value,ze=i.argumentsObjectFromField(V,J),$e={isLeaf:!V.selectionSet,resultKey:i.resultKeyNameFromField(V),directives:f(V,J),field:V},[4,W(_e,Q,ze,te,$e)];case 1:return se=we.sent(),V.selectionSet?se==null?[2,se]:Array.isArray(se)?[2,b(V,se,q)]:[2,g(V.selectionSet,se,q)]:[2,se]}})})}function b(V,Q,q){return Promise.all(Q.map(function(J){return J===null?null:Array.isArray(J)?b(V,J,q):g(V.selectionSet,J,q)}))}var I=function(){var V=function(Q,q){return V=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(J,te){J.__proto__=te}||function(J,te){for(var W in te)te.hasOwnProperty(W)&&(J[W]=te[W])},V(Q,q)};return function(Q,q){V(Q,q);function J(){this.constructor=Q}Q.prototype=q===null?Object.create(q):(J.prototype=q.prototype,new J)}}(),x=function(){return x=Object.assign||function(V){for(var Q,q=1,J=arguments.length;q<J;q++){Q=arguments[q];for(var te in Q)Object.prototype.hasOwnProperty.call(Q,te)&&(V[te]=Q[te])}return V},x.apply(this,arguments)},_=function(V,Q,q,J){function te(W){return W instanceof q?W:new q(function(_e){_e(W)})}return new(q||(q=Promise))(function(W,_e){function ze(we){try{se(J.next(we))}catch(Qe){_e(Qe)}}function $e(we){try{se(J.throw(we))}catch(Qe){_e(Qe)}}function se(we){we.done?W(we.value):te(we.value).then(ze,$e)}se((J=J.apply(V,Q||[])).next())})},A=function(V,Q){var q={label:0,sent:function(){if(W[0]&1)throw W[1];return W[1]},trys:[],ops:[]},J,te,W,_e;return _e={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(_e[Symbol.iterator]=function(){return this}),_e;function ze(se){return function(we){return $e([se,we])}}function $e(se){if(J)throw new TypeError("Generator is already executing.");for(;q;)try{if(J=1,te&&(W=se[0]&2?te.return:se[0]?te.throw||((W=te.return)&&W.call(te),0):te.next)&&!(W=W.call(te,se[1])).done)return W;switch(te=0,W&&(se=[se[0]&2,W.value]),se[0]){case 0:case 1:W=se;break;case 4:return q.label++,{value:se[1],done:!1};case 5:q.label++,te=se[1],se=[0];continue;case 7:se=q.ops.pop(),q.trys.pop();continue;default:if(W=q.trys,!(W=W.length>0&&W[W.length-1])&&(se[0]===6||se[0]===2)){q=0;continue}if(se[0]===3&&(!W||se[1]>W[0]&&se[1]<W[3])){q.label=se[1];break}if(se[0]===6&&q.label<W[1]){q.label=W[1],W=se;break}if(W&&q.label<W[2]){q.label=W[2],q.ops.push(se);break}W[2]&&q.ops.pop(),q.trys.pop();continue}se=Q.call(V,q)}catch(we){se=[6,we],te=0}finally{J=W=0}if(se[0]&5)throw se[1];return{value:se[0]?se[1]:void 0,done:!0}}},P=function(){for(var V=0,Q=0,q=arguments.length;Q<q;Q++)V+=arguments[Q].length;for(var J=Array(V),te=0,Q=0;Q<q;Q++)for(var W=arguments[Q],_e=0,ze=W.length;_e<ze;_e++,te++)J[te]=W[_e];return J},M=function(V){var Q=V.replace(/\s/g,""),q=Q.replace(/\[(.*)\]/,function(J,te,W,_e){return((te!=null&&te.length)>0?te:null)||Q});return q},$=function(V,Q,q,J){if(Array.isArray(V)){var te=M(Q);return V.map(function(W){return $(W,te,q,J)})}return V==null||typeof V=="number"||typeof V=="boolean"||typeof V=="string"?V:q(V,Q,q,J)},j=function(V){return V.directives&&V.directives.length?V.directives.find(function(Q){return Q.name.value==="rest"}):null};function K(V,Q,q,J,te){return te==null||Q==null||typeof Q=="number"||typeof Q=="boolean"||typeof Q=="string"||te.selections.forEach(function(W){if(i.isInlineFragment(W))K(V,Q,q,J,W.selectionSet);else if(W.kind==="FragmentSpread"){var _e=J[W.name.value];K(V,Q,q,J,_e.selectionSet)}else if(i.isField(W)){var ze=i.resultKeyNameFromField(W);ze===V&&j(W)!=null?ee(Q,q,J,W.selectionSet):K(V,Q,q,J,W.selectionSet)}else return function($e){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()}),Q}function ee(V,Q,q,J){if(!(V==null||typeof V=="number"||typeof V=="boolean"||typeof V=="string")){if(Array.isArray(V)){V.forEach(function(te){return ee(te,Q,q,J)});return}J.selections.forEach(function(te){if(i.isInlineFragment(te))ee(V,Q,q,te.selectionSet);else if(te.kind==="FragmentSpread"){var W=q[te.name.value];ee(V,Q,q,W.selectionSet)}else if(i.isField(te)){var _e=V[te.name.value];te.name.value==="__typename"||(typeof _e>"u"?V[te.name.value]=null:_e!=null&&typeof _e=="object"&&te.selectionSet!=null&&ee(_e,Q,q,te.selectionSet))}else return function(ze){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()})}}var fe=function(V,Q){var q=V[Q||Ze]||V[Ze];return typeof q=="string"?{uri:q}:x({responseTransformer:null},q)},de=function(V,Q,q){return q===void 0||Q===void 0?V:V.replace(":"+Q,q)},Ie=function(){function V(){}return V.replacerForPath=function(Q){if(Q in V.cache)return V.cache[Q];var q=Q.indexOf("?"),J=Q.split(V.argReplacement),te=[],W=!1;J.reduce(function(ze,$e){if($e===""||$e==="{}")return ze+$e.length;var se=ze+$e.length;if($e[0]==="{"&&$e[$e.length-1]==="}"){var we=$e.slice(1,$e.length-1).split(".");te.push(function(Qe,mt){try{var yt=pe(Qe,we);return!mt||typeof yt!="object"||yt==null?String(yt):a.stringify(yt)}catch{var Yt=[Q,we.join(".")].join("|");return Yt in V.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."),V.warnTable[Yt]=!0),""}})}else te.push($e),!W&&se>=q&&(W=!0,te.push(!0));return se},0);var _e=function(ze){var $e=!1,se=te.reduce(function(we,Qe){return typeof Qe=="string"?we+Qe:typeof Qe=="boolean"?($e=!0,we):we+Qe(ze,$e)},"");return se};return V.cache[Q]=_e},V.cache={},V.warnTable={},V.argReplacement=/({[._a-zA-Z0-9]*})/,V}();function pe(V,Q){if(Q.length===0)return V;var q=P(Q),J=q.shift();return pe(V[J],q)}var Ce=["__typename"],Pe=typeof globalThis=="object"&&globalThis||pi,ge=function(V,Q,q){q===void 0&&(q=[]);var J=null;return Q.length!=2?J=function(te,W){return Q(te)}:J=Q,Array.isArray(V)?V.map(function(te,W){return ge(te,J,P(q,[String(W)]))}):V==null||typeof V!="object"||V.constructor!==Object||Pe.FileList&&V instanceof FileList||Pe.File&&V instanceof File?V:Object.keys(V).reduce(function(te,W){var _e=V[W];if(Ce.indexOf(W)!==-1)return te[W]=_e,te;var ze=P(q,[W]);return te[J(W,ze)]=ge(_e,J,ze),te},{})},We=function(V){return V},ke=function(V){return V instanceof Headers?V:new Headers(V||{})},X=function(){for(var V=[],Q=0;Q<arguments.length;Q++)V[Q]=arguments[Q];return V.reduce(function(q,J){return J&&(J.forEach||(J=ke(J)),J.forEach(function(te,W){q.append(W,te)})),q},new Headers)},ye=function(V,Q,q){var J=new Headers;return V.forEach(function(te,W){Q.indexOf(W)===-1&&J.append(W,te)}),X(J,q||new Headers)},xe=function(V){return function(Q,q){return ye(Q,V,q)}},Se=["GET","POST","PUT","PATCH","DELETE"],Be=function(V,Q){switch(Q){case"query":if(Se.indexOf(V.toUpperCase())!==-1)return;throw new Error('A "query" operation can only support "GET" requests but got "'+V+'".');case"mutation":if(Se.indexOf(V.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}},Ke=function(V,Q,q){var J=new Error(q);throw J.response=V,J.statusCode=V.status,J.result=Q,J},Et=function(V,Q){return V==null||typeof V!="object"?V:Array.isArray(V)?V.map(function(q){return Et(q,Q)}):(V.__typename=Q,V)},Tt=function(V,Q,q,J,te){return _(void 0,void 0,void 0,function(){var W,_e,ze,$e,se,we,Qe,mt,yt,Yt,At,Wt,Gt,Er,zt,sr,dr,Ar,Ht,H,G,at,wt,ft,He,Kt,Zt,Qt,kr,Hr,Fr,Ut,Or,$r,Lr,ar,Gr,Tr,gr,Ir,Sn,Un,R,oe,ve,Ne,Ve,ct,Xe,rt;return A(this,function(nt){switch(nt.label){case 0:if(W=te.directives,_e=te.isLeaf,ze=te.resultKey,$e=J.exportVariablesByNode,se=$e.get(Q)||{},we=function(bt){return bt instanceof Array?bt.forEach(we):$e.set(bt,x({},se)),bt},Qe=(Q||{})[ze],mt=(Q||{})[V],Q&&W&&W.export&&(se[W.export.as]=mt),yt=W&&W.type,!_e&&yt){if(W.rest)throw new Error("Invalid use of @type(name: ...) directive on a call that also has @rest(...)");return we(mt),[2,Et(mt,W.type.name)]}if(Yt=!W||!W.rest,Yt)return[2,we(Qe||mt)];if(At=J.credentials,Wt=J.endpoints,Gt=J.headers,Er=J.customFetch,zt=J.operationType,sr=J.typePatcher,dr=J.mainDefinition,Ar=J.fragmentDefinitions,Ht=J.fieldNameNormalizer,H=J.fieldNameDenormalizer,G=J.serializers,at=J.responseTransformer,wt=i.createFragmentMap(Ar),ft=W.rest,He=ft.path,Kt=ft.endpoint,Zt=ft.pathBuilder,Qt=fe(Wt,Kt),kr=He==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||(He.includes(":")?(console.warn("Deprecated: '@rest(path:' contains a ':' colon, this format will be removed in future versions"),Zt=function(bt){var w=bt.args,k=bt.exportVariables,T=x(x({},w),k),C=Object.keys(T).reduce(function(D,B){return de(D,B,T[B])},He);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=Ie.replacerForPath(He)),Hr={args:q,exportVariables:se,context:J,"@rest":W.rest,replacer:Zt},Fr=Zt(Hr),Ut=W.rest,Or=Ut.method,$r=Ut.type,Lr=Ut.bodyBuilder,ar=Ut.bodyKey,Gr=Ut.fieldNameDenormalizer,Tr=Ut.fieldNameNormalizer,gr=Ut.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+" "+zt+" using a REST call without a body]. No `"+ar+"` was detected. Pass bodyKey, or bodyBuilder to the @rest() directive to resolve this.");Lr=function(bt){return Un}}if(Ir=ge(Lr(Hr),Gr||H||We),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,Gt)}else R=gr?gr(Ir,Gt):G[Je](Ir,Gt);Ir=R.body,Sn=new Headers(R.headers)}return Be(Or,zt||"query"),oe=x({method:Or,headers:Sn||Gt,body:Ir},At?{credentials:At}:{}),ve=""+Qt.uri+Fr,[4,(Er||fetch)(ve,oe)];case 1:return Ne=nt.sent(),J.responses.push(Ne),Ne.ok?(Ne.status===204||Ne.headers.get("Content-Length")==="0"?Ve={}:Ve=Ne,[3,9]):[3,2];case 2:return Ne.status!==404?[3,3]:(Ve=null,[3,9]);case 3:ct=void 0,nt.label=4;case 4:return nt.trys.push([4,6,,8]),[4,Ne.clone().json()];case 5:return ct=nt.sent(),[3,8];case 6:return nt.sent(),[4,Ne.clone().text()];case 7:return ct=nt.sent(),[3,8];case 8:Ke(Ne,ct,"Response not successful: Received status code "+Ne.status),nt.label=9;case 9:if(Xe=Qt.responseTransformer||at,!Xe)return[3,14];nt.label=10;case 10:return nt.trys.push([10,12,,13]),[4,Xe(Ve,$r)];case 11:return Ve=nt.sent(),[3,13];case 12:throw rt=nt.sent(),console.warn("An error occurred in a responseTransformer:"),rt;case 13:return[3,16];case 14:return Ve&&Ve.json?[4,Ve.json()]:[3,16];case 15:Ve=nt.sent(),nt.label=16;case 16:return Ve=ge(Ve,Tr||Ht||We),Ve=K(ze,Ve,dr,wt,dr.selectionSet),Ve=$(Ve,$r,sr,{resolverParams:{fieldName:V,root:Q,args:q,context:J,info:te}}),[2,we(Ve)]}})})},Ze="",Je="",vt=function(V,Q){return Q.has("content-type")||Q.append("Content-Type","application/json"),{body:JSON.stringify(V),headers:Q}},De={test:function(V){return V.name.value==="rest"},remove:!0},Ge=function(V){I(Q,V);function Q(q){var J,te=q.uri,W=q.endpoints,_e=q.headers,ze=q.fieldNameNormalizer,$e=q.fieldNameDenormalizer,se=q.typePatcher,we=q.customFetch,Qe=q.credentials,mt=q.bodySerializers,yt=q.defaultSerializer,Yt=q.responseTransformer,At=V.call(this)||this,Wt={};if(Wt[Ze]=te||"",At.endpoints=Object.assign({},W||Wt),te==null&&W==null)throw new Error("A RestLink must be initialized with either 1 uri, or a map of keyed-endpoints");if(te!=null){var Gt=(W||{})[Ze];if(Gt!=null&&Gt!=te)throw new Error("RestLink was configured with a default uri that doesn't match what's passed in to the endpoints map.");At.endpoints[Ze]=te}if(At.endpoints[Ze]==null&&console.warn("RestLink configured without a default URI. All @rest(…) directives must provide an endpoint key!"),se==null)At.typePatcher=function(zt,sr,dr){return x({__typename:sr},zt)};else if(!Array.isArray(se)&&typeof se=="object"&&Object.keys(se).map(function(zt){return se[zt]}).reduce(function(zt,sr){return zt&&typeof sr=="function"},!0)){var Er=se;At.typePatcher=function(zt,sr,dr,Ar){var Ht=zt.__typename||sr;if(Array.isArray(zt))return zt.map(function(G){return dr(G,Ht,dr,Ar)});var H=Er[Ht]||function(G){return G};return x({__typename:Ht},H(zt,Ht,dr,Ar))}}else throw new Error("RestLink was configured with a typePatcher of invalid type!");return mt&&mt.hasOwnProperty(Je)&&console.warn("RestLink was configured to override the default serializer! This may result in unexpected behavior"),At.responseTransformer=Yt||null,At.fieldNameNormalizer=ze||null,At.fieldNameDenormalizer=$e||null,At.headers=ke(_e),At.credentials=Qe||null,At.customFetch=we,At.serializers=x((J={},J[Je]=yt||vt,J),mt||{}),At.processedDocuments=new Map,At}return Q.prototype.removeRestSetsFromDocument=function(q){var J=this.processedDocuments.get(q);if(J)return J;i.checkDocument(q);var te=i.removeDirectivesFromDocument([De],q);return this.processedDocuments.set(q,te),te},Q.prototype.request=function(q,J){var te=q.query,W=q.variables,_e=q.getContext,ze=q.setContext,$e=_e(),se=i.hasDirectives(["rest"],te);if(!se)return J(q);var we=this.removeRestSetsFromDocument(te),Qe=$e.headersMergePolicy;Qe==null&&Array.isArray($e.headersToOverride)?Qe=xe($e.headersToOverride):Qe==null&&(Qe=X);var mt=Qe(this.headers,$e.headers);mt.has("Accept")||mt.append("Accept","application/json");var yt=$e.credentials||this.credentials,Yt=i.addTypenameToDocument(te),At=i.getMainDefinition(te),Wt=i.getFragmentDefinitions(te),Gt=(At||{}).operation||"query",Er={headers:mt,endpoints:this.endpoints,exportVariablesByNode:new Map,credentials:yt,customFetch:this.customFetch,operationType:Gt,fieldNameNormalizer:this.fieldNameNormalizer,fieldNameDenormalizer:this.fieldNameDenormalizer,mainDefinition:At,fragmentDefinitions:Wt,typePatcher:this.typePatcher,serializers:this.serializers,responses:[],responseTransformer:this.responseTransformer},zt={},sr;return we&&J?(q.query=we,sr=J(q)):sr=n.Observable.of({data:{}}),sr.flatMap(function(dr){var Ar=dr.data,Ht=dr.errors;return new n.Observable(function(H){y(Tt,Yt,Ar,Er,W,zt).then(function(G){ze({restResponses:($e.restResponses||[]).concat(Er.responses)}),H.next({data:G,errors:Ht}),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=Ge,t.PathBuilder=Ie,Object.defineProperty(t,"__esModule",{value:!0})})})(mh,mh.exports);var yI=mh.exports;const rc=le.createContext(),gI=()=>{const{isAuthenticated:r,login:e}=ti(),{children:t,isEmbedded:n,setIsEmbedded:i,authError:a}=le.useContext(rc),u=pn.useNavigate(),c=pn.useLocation(),[f,h]=le.useState(!1),[d,y]=le.useState(),[g,m]=le.useState(),[b,I]=le.useState({}),x=le.useRef({}),_=le.useRef({}),[A,P]=le.useState(!1),[M,$]=le.useState({}),j=(X,ye={})=>{f&&window.parent.postMessage({type:X,instanceId:g,...ye},d)},K=(X,ye,xe={})=>{if(!X)throw new Error("Namespace is required for sendMessage");j(`${X}:${ye}`,xe)};le.useEffect(()=>{var X;if(!(!c||c.pathname!=="/mm-embedded-login")){if(r||a)if(((X=new URL(origin))==null?void 0:X.protocol)==="http:"){window.close();return}else{const xe=new URLSearchParams(c.search),Se=xe.get("id"),Be=xe.get("origin");a?window.parent.postMessage({type:"authorize-failed",instanceId:Se,error:a,authUrl:window.location.href},Be):window.parent.postMessage({type:"authorized",instanceId:Se,authUrl:window.location.href},Be);return}r===!1&&e()}},[c]),le.useEffect(()=>{var Se,Be;if(r===null||!c||c.pathname!=="/mm-embedded-interop")return;const X=new URLSearchParams(c.search),ye=X.get("id"),xe=X.get("origin");if(xe){const Ke=(Se=new URL(xe))==null?void 0:Se.hostname;if(/^(?:[\w-]+\.)*(?:machinemetrics\.com|machinemetrics-us-gov\.com|m12s\.com)$/.test(Ke))y(xe);else{alert("Invalid Embeddable Zone Host");return}}if(r===!1){if(xe){const Ke={instanceId:ye,authUrl:`${window.location.protocol}//${window.location.host}/mm-embedded-login?id=${ye}&origin=${xe}`,origin:xe};if(((Be=new URL(xe))==null?void 0:Be.protocol)==="http:"){window.parent.postMessage({type:"login",...Ke},xe);return}e({mm_instanceId:Ke.instanceId,mm_authUrl:encodeURIComponent(Ke.authUrl),mm_origin:Ke.origin});return}e();return}ye&&m(ye),ye&&xe&&i(!0)},[c,r]),pn.useBlocker(({nextLocation:X})=>{var ye;return n?(ye=X.state)!=null&&ye.fromParent?(h(!0),!1):(ee(`${X.pathname}${X.search}`),!0):!1}),le.useEffect(()=>{if(!n||!d)return;const X=ye=>{ye.metaKey&&ye.key==="k"&&window.parent.postMessage({type:"open-search",instanceId:g},d)};return window.addEventListener("keydown",X),()=>{window.removeEventListener("keydown",X)}},[n,d]),le.useEffect(()=>{if(!n||!d)return;const X=({origin:ye,data:xe})=>{var Se,Be,Ke,Et,Tt,Ze,Je,vt;if(ye===d)switch(xe.type){case"navigate":u(xe.path,{replace:!0,state:{fromParent:!0}});break;case"set-context":I(xe.context||{});break;case"set-configuring":P(xe.isConfiguring);break;case"set-params":$(xe.params);break;case"load-options":(Be=(Se=x.current)[`option-${xe.name}`])==null||Be.call(Se,{filter:xe.filter||""});break;case"validate":(Et=(Ke=x.current)[`validate-${xe.name}`])==null||Et.call(Ke,{value:xe.value});break;case"request":(Ze=(Tt=_.current)[xe.requestType])==null||Ze.call(Tt,xe);break;case"response":(vt=(Je=x.current)[xe.callbackId])==null||vt.call(Je,xe.response);break}};return window.addEventListener("message",X),!f&&r&&window.parent.postMessage({type:"ready",instanceId:g},d),()=>{window.removeEventListener("message",X)}},[u,f,n,r,d]);const ee=(X,ye)=>{!f&&!r||j("set-path",{path:X,...ye})},fe=X=>{j("set-summary",{summary:X})},de=X=>{j("toast",{message:X})},Ie=X=>{j("popup",{message:X})},pe=()=>{j("loaded")},Ce=async({header:X,body:ye,choices:xe})=>f?new Promise(Se=>{const Be=A0(),Ke=async Et=>{delete x.current[Be],Se(Et)};x.current[Be]=Ke,j("confirm",{header:X,body:ye,choices:xe,callbackId:Be})}):Promise.reject(new Error("Not ready")),Pe=({requestType:X,func:ye})=>{const xe=async({callbackId:Se,data:Be})=>{try{const Ke=await ye(Be);j("response",{callbackId:Se,response:Ke})}catch(Ke){j("response",{callbackId:Se,error:Ke.message})}};return _.current[X]=xe,j("mark-registered",{requestType:X}),()=>{delete _.current[X]}},ge=({callbackId:X,func:ye,responseType:xe="response",responseKey:Se="response",props:Be={},callOnRegister:Ke=!1})=>{const Et=async Ze=>{const Je=await ye(Ze);j(xe,{...Be,[Se]:Je,callbackId:X})},Tt=x.current[X];x.current[X]=Et,Tt&&Ke&&Et(Be)},We=(X,ye)=>{if(f){if(ye.validate&&typeof ye.validate=="function"&&ge({callbackId:`validate-${X}`,func:ye.validate,responseType:"set-validation",responseKey:"validation",props:{name:X}}),ye.options){const xe=typeof ye.options=="function"?ye.options:()=>ye.options;ge({callbackId:`option-${X}`,func:xe,responseType:"set-options",responseKey:"options",props:{name:X},callOnRegister:!0})}j("add-setting",{setting:{name:X,...ye,options:void 0,validate:void 0}})}},ke=le.useMemo(()=>({commands:{navigateParent:ee,setSummary:fe,toast:de,popup:Ie,confirm:Ce,setLoaded:pe,sendMessage:K},context:{...b,get colorMode(){throw new Error("colorMode has been moved to useMMAppParams")},get isFullScreen(){throw new Error("isFullScreen has been moved to useMMAppParams")}},params:{isEmbedded:n,isConfiguring:A,colorMode:b.colorMode,isFullScreen:b.isFullScreen,...M},addSetting:We,registerHandler:Pe}),[n,A,ee,fe,de,Ie,Ce,pe,K,b,M,We,Pe]);return nr.jsx(wi.Provider,{value:ke,children:c.pathname!=="/mm-embedded-interop"&&c.pathname!=="/mm-embedded-login"&&c.pathname!=="/mm-embedded-print"?t:nr.jsx(nr.Fragment,{})})},vI=()=>{const{urls:r,jwtRef:e,accessToken:t}=ti(),{graphQLRoleOverride:n,children:i}=le.useContext(rc),[a,u]=le.useState(),[c,f]=le.useState(),h=()=>{const g=new URL(r.graphQLUrl);return`//${g.host}${g.pathname}`},d=()=>n?{"X-Hasura-Role":n}:{};le.useEffect(()=>{const g=new Ik(Mk({url:`wss:${h()}`,lazy:!0,reconnect:!0,connectionParams:async()=>({headers:{Authorization:`Bearer ${e.current}`,...d()}})})),m=D0(({operation:P,networkError:M,forward:$})=>(Vi(P.query).operation==="subscription"&&M&&g.client.terminate(),$(P))),I=M0(async(P,{headers:M})=>({headers:{...M,Authorization:`Bearer ${e.current}`,...d()}})).concat(uf({uri:`https:${h()}`,fetch:window.fetch})),x=m.split(({query:P})=>{const M=Vi(P);return M.kind==="OperationDefinition"&&M.operation==="subscription"},g,I),A=M0(async(P,{headers:M})=>({headers:{...M,Authorization:`Bearer ${t}`}})).concat(new yI.RestLink({uri:r.apiUrl}));f(Kr.from([A,x]))},[]),le.useEffect(()=>{c&&u(new Cf({link:c,cache:new Of}))},[c]);const y=le.useMemo(()=>({link:c}),[c]);return nr.jsx(u0.Provider,{value:y,children:a?nr.jsx(T1,{client:a,children:nr.jsx(zA,{children:nr.jsx(gI,{children:i})})}):nr.jsx(nr.Fragment,{})})},bI=Qp.div`
|
|
128
|
+
`;O(G)},[m,g,h]),be.useEffect(()=>{w&&P()},[w,S]);const[P,{data:D,loading:T}]=lT(w,{fetchPolicy:"no-cache"});return be.useEffect(()=>{if(!D||!D.quantities)return;const N=ui.last(D.quantities);if(N&&p(N.eventTime),!n)i(D.quantities);else{const G=ui.drop(D.quantities);i([...n,...G])}},[D]),{data:n,error:c,loading:a}},bA=r=>{const[e,t]=be.useState(),[n,i]=be.useState(!0),[a,u]=be.useState(),{urls:c,request:f}=Xn();return xo(async h=>{try{i(!0);const p=await f(`${c.apiUrl}/reports/downtime`,{method:"POST",body:r,signal:h});u(null),t(p)}catch(p){u(p)}i(!1)},[r]),{data:e,error:a,loading:n}},wA=r=>{const[e,t]=be.useState(),{urls:n,request:i,clientId:a}=Xn(),u=`lab:${a}:${r}`,{data:c,loading:f,error:h}=C0("/templates");return be.useEffect(()=>{if(!c)return;const g=ui.filter(c.templates,{namespace:u});t(g)},[c]),[async({name:g,public:b,config:I})=>{const S={name:g,public:b,namespace:u,config:JSON.stringify(I)},w=JSON.stringify(S),O=await i(`${n.apiUrl}/templates`,{method:"POST",body:w});return t([...e,O.template]),O.template},async(g,{name:b,public:I,config:S})=>{const w={name:b,public:I,namespace:u,config:JSON.stringify(S)},O=JSON.stringify(w),P=await i(`${n.apiUrl}/templates/${g}`,{method:"PUT",body:O}),D=ui.findIndex(e,{id:g}),T=e.slice(0,D),N=e.slice(D+1);return t([...T,P.template,...N]),P.template},async g=>{await i(`${n.apiUrl}/templates/${g}`,{method:"DELETE"}),t(ui.reject(e,{id:g}))},{templates:e,loading:f,error:h}]},_A=()=>{const[r,e]=be.useState(),[t,n]=be.useState(),{urls:i}=Xn();return be.useEffect(()=>{window===window.top?(n(window.location.hash.substring(1)),e(!0)):(window.addEventListener("message",a=>{switch(a.data.event){case"init":n(a.data.hash.substring(1)),e(!0);break}}),window.top.postMessage({event:"ready"},i.appUrl))},[i]),be.useEffect(()=>{r&&(window===window.top?window.location.hash=t:window.top.postMessage({event:"set-hash",hash:t},i.appUrl))},[r,t,i]),[n,{ready:r,hash:t}]},Xn=()=>be.useContext(A0),SA=()=>{throw new Error("useMMEmbeddedApp is deprecated. Use useMMAppTools and useMMAppContext.")},xA=()=>{throw new Error("useMMAppTools is deprecated. Use useMMAppParams and useMMAppCommands.")},EA=()=>{const{context:r}=be.useContext(_i);return r},P0=()=>{const{params:r}=be.useContext(_i);return r},N0=()=>{const{commands:r}=be.useContext(_i);return r},OA=(r,e,t=[])=>{const{addSetting:n}=be.useContext(_i);be.useEffect(()=>{n(r,e)},[...t])},TA=(r,e=[])=>{const{registerHandler:t}=be.useContext(_i);be.useEffect(()=>t({requestType:"set-claims",func:r}),[...e])},kA=(r,e=[])=>{const{registerHandler:t}=be.useContext(_i);be.useEffect(()=>t({requestType:"custom-input-open",func:r}),[...e])},AA=(r,e=[])=>{const{registerHandler:t}=be.useContext(_i);be.useEffect(()=>t({requestType:"custom-input-save",func:r}),[...e])},IA=(r,e=[])=>{const{registerHandler:t}=be.useContext(_i);be.useEffect(()=>t({requestType:"custom-input-label",func:r}),[...e])},CA=()=>be.useContext(k0),PA=()=>{const{login:r,isAuthenticated:e}=Xn();return xo(async()=>{e===!1&&await r()},[e]),e?nr.jsx(qi.Outlet,{}):nr.jsx("div",{})},R0="%[a-f0-9]{2}",M0=new RegExp("("+R0+")|([^%]+?)","gi"),D0=new RegExp("("+R0+")+","gi");function gh(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;const t=r.slice(0,e),n=r.slice(e);return Array.prototype.concat.call([],gh(t),gh(n))}function NA(r){try{return decodeURIComponent(r)}catch{let e=r.match(M0)||[];for(let t=1;t<e.length;t++)r=gh(e,t).join(""),e=r.match(M0)||[];return r}}function RA(r){const e={"%FE%FF":"��","%FF%FE":"��"};let t=D0.exec(r);for(;t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{const i=NA(t[0]);i!==t[0]&&(e[t[0]]=i)}t=D0.exec(r)}e["%C2"]="�";const n=Object.keys(e);for(const i of n)r=r.replace(new RegExp(i,"g"),e[i]);return r}function MA(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return decodeURIComponent(r)}catch{return RA(r)}}function DA(r,e){const t={};if(Array.isArray(e))for(const n of e){const i=Object.getOwnPropertyDescriptor(r,n);i?.enumerable&&Object.defineProperty(t,n,i)}else for(const n of Reflect.ownKeys(r)){const i=Object.getOwnPropertyDescriptor(r,n);if(i.enumerable){const a=r[n];e(n,a,r)&&Object.defineProperty(t,n,i)}}return t}function F0(r,e){if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r===""||e==="")return[];const t=r.indexOf(e);return t===-1?[]:[r.slice(0,t),r.slice(t+e.length)]}const FA=r=>r==null,LA=r=>encodeURIComponent(r).replaceAll(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),vh=Symbol("encodeFragmentIdentifier");function qA(r){switch(r.arrayFormat){case"index":return e=>(t,n)=>{const i=t.length;return n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[Sr(e,r),"[",i,"]"].join("")]:[...t,[Sr(e,r),"[",Sr(i,r),"]=",Sr(n,r)].join("")]};case"bracket":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[Sr(e,r),"[]"].join("")]:[...t,[Sr(e,r),"[]=",Sr(n,r)].join("")];case"colon-list-separator":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[Sr(e,r),":list="].join("")]:[...t,[Sr(e,r),":list=",Sr(n,r)].join("")];case"comma":case"separator":case"bracket-separator":{const e=r.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(n,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[Sr(t,r),e,Sr(i,r)].join("")]:[[n,Sr(i,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,Sr(e,r)]:[...t,[Sr(e,r),"=",Sr(n,r)].join("")]}}function jA(r){let e;switch(r.arrayFormat){case"index":return(t,n,i)=>{if(e=/\[(\d*)]$/.exec(t),t=t.replace(/\[\d*]$/,""),!e){i[t]=n;return}i[t]===void 0&&(i[t]={}),i[t][e[1]]=n};case"bracket":return(t,n,i)=>{if(e=/(\[])$/.exec(t),t=t.replace(/\[]$/,""),!e){i[t]=n;return}if(i[t]===void 0){i[t]=[n];return}i[t]=[...i[t],n]};case"colon-list-separator":return(t,n,i)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){i[t]=n;return}if(i[t]===void 0){i[t]=[n];return}i[t]=[...i[t],n]};case"comma":case"separator":return(t,n,i)=>{const a=typeof n=="string"&&n.includes(r.arrayFormatSeparator),u=typeof n=="string"&&!a&&Si(n,r).includes(r.arrayFormatSeparator);n=u?Si(n,r):n;const c=a||u?n.split(r.arrayFormatSeparator).map(f=>Si(f,r)):n===null?n:Si(n,r);i[t]=c};case"bracket-separator":return(t,n,i)=>{const a=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!a){i[t]=n&&Si(n,r);return}const u=n===null?[]:Si(n,r).split(r.arrayFormatSeparator);if(i[t]===void 0){i[t]=u;return}i[t]=[...i[t],...u]};default:return(t,n,i)=>{if(i[t]===void 0){i[t]=n;return}i[t]=[...[i[t]].flat(),n]}}}function L0(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Sr(r,e){return e.encode?e.strict?LA(r):encodeURIComponent(r):r}function Si(r,e){return e.decode?MA(r):r}function q0(r){return Array.isArray(r)?r.sort():typeof r=="object"?q0(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}function j0(r){const e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function UA(r){let e="";const t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}function U0(r,e,t){return t==="string"&&typeof r=="string"?r:typeof t=="function"&&typeof r=="string"?t(r):t==="boolean"&&r===null?!0:t==="boolean"&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":t==="boolean"&&r!==null&&(r.toLowerCase()==="1"||r.toLowerCase()==="0")?r.toLowerCase()==="1":t==="string[]"&&e.arrayFormat!=="none"&&typeof r=="string"?[r]:t==="number[]"&&e.arrayFormat!=="none"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?[Number(r)]:t==="number"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):r}function bh(r){r=j0(r);const e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function wh(r,e){e={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...e},L0(e.arrayFormatSeparator);const t=jA(e),n=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return n;for(const i of r.split("&")){if(i==="")continue;const a=e.decode?i.replaceAll("+"," "):i;let[u,c]=F0(a,"=");u===void 0&&(u=a),c=c===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?c:Si(c,e),t(Si(u,e),c,n)}for(const[i,a]of Object.entries(n))if(typeof a=="object"&&a!==null&&e.types[i]!=="string")for(const[u,c]of Object.entries(a)){const f=e.types[i]?e.types[i].replace("[]",""):void 0;a[u]=U0(c,e,f)}else typeof a=="object"&&a!==null&&e.types[i]==="string"?n[i]=Object.values(a).join(e.arrayFormatSeparator):n[i]=U0(a,e,e.types[i]);return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,a)=>{const u=n[a];return i[a]=u&&typeof u=="object"&&!Array.isArray(u)?q0(u):u,i},Object.create(null))}function $0(r,e){if(!r)return"";e={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...e},L0(e.arrayFormatSeparator);const t=u=>e.skipNull&&FA(r[u])||e.skipEmptyString&&r[u]==="",n=qA(e),i={};for(const[u,c]of Object.entries(r))t(u)||(i[u]=c);const a=Object.keys(i);return e.sort!==!1&&a.sort(e.sort),a.map(u=>{const c=r[u];return c===void 0?"":c===null?Sr(u,e):Array.isArray(c)?c.length===0&&e.arrayFormat==="bracket-separator"?Sr(u,e)+"[]":c.reduce(n(u),[]).join("&"):Sr(u,e)+"="+Sr(c,e)}).filter(u=>u.length>0).join("&")}function B0(r,e){e={decode:!0,...e};let[t,n]=F0(r,"#");return t===void 0&&(t=r),{url:t?.split("?")?.[0]??"",query:wh(bh(r),e),...e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:Si(n,e)}:{}}}function V0(r,e){e={encode:!0,strict:!0,[vh]:!0,...e};const t=j0(r.url).split("?")[0]||"",n=bh(r.url),i={...wh(n,{sort:!1,...e}),...r.query};let a=$0(i,e);a&&=`?${a}`;let u=UA(r.url);if(typeof r.fragmentIdentifier=="string"){const c=new URL(t);c.hash=r.fragmentIdentifier,u=e[vh]?c.hash:`#${r.fragmentIdentifier}`}return`${t}${a}${u}`}function W0(r,e,t){t={parseFragmentIdentifier:!0,[vh]:!1,...t};const{url:n,query:i,fragmentIdentifier:a}=B0(r,t);return V0({url:n,query:DA(i,e),fragmentIdentifier:a},t)}function $A(r,e,t){const n=Array.isArray(e)?i=>!e.includes(i):(i,a)=>!e(i,a);return W0(r,n,t)}const BA=Object.freeze(Object.defineProperty({__proto__:null,exclude:$A,extract:bh,parse:wh,parseUrl:B0,pick:W0,stringify:$0,stringifyUrl:V0},Symbol.toStringTag,{value:"Module"})),qr=[];for(let r=0;r<256;++r)qr.push((r+256).toString(16).slice(1));function VA(r,e=0){return(qr[r[e+0]]+qr[r[e+1]]+qr[r[e+2]]+qr[r[e+3]]+"-"+qr[r[e+4]]+qr[r[e+5]]+"-"+qr[r[e+6]]+qr[r[e+7]]+"-"+qr[r[e+8]]+qr[r[e+9]]+"-"+qr[r[e+10]]+qr[r[e+11]]+qr[r[e+12]]+qr[r[e+13]]+qr[r[e+14]]+qr[r[e+15]]).toLowerCase()}let _h;const WA=new Uint8Array(16);function zA(){if(!_h){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");_h=crypto.getRandomValues.bind(crypto)}return _h(WA)}const z0={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function H0(r,e,t){if(z0.randomUUID&&!r)return z0.randomUUID();r=r||{};const n=r.random??r.rng?.()??zA();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,VA(n)}const Sh="mm-auth-state",xh="mm-auth-destination",Eh="mm-auth-access-token",xi=window.localStorage,HA=()=>xi.getItem(Eh),GA=r=>{r?xi.setItem(Eh,r):xi.removeItem(Eh)},QA=()=>xi.getItem(xh),G0=r=>{r?xi.setItem(xh,r):xi.removeItem(xh)},JA=()=>xi.getItem(Sh),Q0=r=>{r?xi.setItem(Sh,r):xi.removeItem(Sh)},J0=async(r,e)=>{const t=await window.fetch(r,e),n=await t.text(),i=n&&JSON.parse(n);return t.status>=200&&t.status<300?i:{...i,error:{message:t.statusText,status:t.status}}};function YA(r){return Zt(r)&&"code"in r&&"reason"in r}function KA(r){var e;return Zt(r)&&((e=r.target)===null||e===void 0?void 0:e.readyState)===WebSocket.CLOSED}var ZA=function(r){In(e,r);function e(t){var n=r.call(this)||this;return n.client=t,n}return e.prototype.request=function(t){var n=this;return new Pt(function(i){return n.client.subscribe(F(F({},t),{query:gi(t.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){if(a instanceof Error)return i.error(a);var u=YA(a);return u||KA(a)?i.error(new Error("Socket closed".concat(u?" with event ".concat(a.code):"").concat(u?" ".concat(a.reason):""))):i.error(new mn({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Yr);function un(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function Rs(r){return un(r)==="object"}function XA(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function Y0(r,e){return r.length<124?r:e}const eI="graphql-transport-ws";var Mn=(r=>(r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests",r))(Mn||{}),Dn=(r=>(r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete",r))(Dn||{});function K0(r){if(!Rs(r))throw new Error(`Message is expected to be an object, but got ${un(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${un(r.type)}`);switch(r.type){case"connection_init":case"connection_ack":case"ping":case"pong":{if(r.payload!=null&&!Rs(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case"subscribe":{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${un(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Rs(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${un(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${un(r.payload.query)}`);if(r.payload.variables!=null&&!Rs(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${un(r.payload.variables)}`);if(r.payload.operationName!=null&&un(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${un(r.payload.operationName)}`);if(r.payload.extensions!=null&&!Rs(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${un(r.payload.extensions)}`);break}case"next":{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${un(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Rs(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${un(r.payload)}`);break}case"error":{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${un(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!XA(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case"complete":{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${un(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function tI(r,e){return K0(typeof r=="string"?JSON.parse(r,e):r)}function Oo(r,e){return K0(r),JSON.stringify(r,e)}function rI(r){const{url:e,connectionParams:t,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:u=0,disablePong:c,connectionAckWaitTimeout:f=0,retryAttempts:h=5,retryWait:p=async function(me){const we=Math.pow(2,me);await new Promise(Te=>setTimeout(Te,we*1e3+Math.floor(Math.random()*2700+300)))},shouldRetry:m=Oh,on:y,webSocketImpl:g,generateID:b=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,me=>{const we=Math.random()*16|0;return(me=="x"?we:we&3|8).toString(16)})},jsonMessageReplacer:I,jsonMessageReviver:S}=r;let w;if(g){if(!iI(g))throw new Error("Invalid WebSocket implementation provided");w=g}else typeof WebSocket<"u"?w=WebSocket:typeof global<"u"?w=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(w=window.WebSocket||window.MozWebSocket);if(!w)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const O=w,P=(()=>{const ie=(()=>{const we={};return{on(Te,ee){return we[Te]=ee,()=>{delete we[Te]}},emit(Te){"id"in Te&&we[Te.id]?.(Te)}}})(),me={connecting:y?.connecting?[y.connecting]:[],opened:y?.opened?[y.opened]:[],connected:y?.connected?[y.connected]:[],ping:y?.ping?[y.ping]:[],pong:y?.pong?[y.pong]:[],message:y?.message?[ie.emit,y.message]:[ie.emit],closed:y?.closed?[y.closed]:[],error:y?.error?[y.error]:[]};return{onMessage:ie.on,on(we,Te){const ee=me[we];return ee.push(Te),()=>{ee.splice(ee.indexOf(Te),1)}},emit(we,...Te){for(const ee of[...me[we]])ee(...Te)}}})();function D(ie){const me=[P.on("error",we=>{me.forEach(Te=>Te()),ie(we)}),P.on("closed",we=>{me.forEach(Te=>Te()),ie(we)})]}let T,N=0,G,q=!1,$=0,K=!1;async function oe(){clearTimeout(G);const[ie,me]=await(T??(T=new Promise((ee,ye)=>(async()=>{if(q){if(await p($),!N)return T=void 0,ye({code:1e3,reason:"All Subscriptions Gone"});$++}P.emit("connecting",q);const fe=new O(typeof e=="function"?await e():e,eI);let Pe,Be;function ht(){isFinite(u)&&u>0&&(clearTimeout(Be),Be=setTimeout(()=>{fe.readyState===O.OPEN&&(fe.send(Oo({type:Dn.Ping})),P.emit("ping",!1,void 0))},u))}D(ot=>{T=void 0,clearTimeout(Pe),clearTimeout(Be),ye(ot),ot instanceof Z0&&(fe.close(4499,"Terminated"),fe.onerror=null,fe.onclose=null)}),fe.onerror=ot=>P.emit("error",ot),fe.onclose=ot=>P.emit("closed",ot),fe.onopen=async()=>{try{P.emit("opened",fe);const ot=typeof t=="function"?await t():t;if(fe.readyState!==O.OPEN)return;fe.send(Oo(ot?{type:Dn.ConnectionInit,payload:ot}:{type:Dn.ConnectionInit},I)),isFinite(f)&&f>0&&(Pe=setTimeout(()=>{fe.close(Mn.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},f)),ht()}catch(ot){P.emit("error",ot),fe.close(Mn.InternalClientError,Y0(ot instanceof Error?ot.message:String(ot),"Internal client error"))}};let It=!1;fe.onmessage=({data:ot})=>{try{const tt=tI(ot,S);if(P.emit("message",tt),tt.type==="ping"||tt.type==="pong"){P.emit(tt.type,!0,tt.payload),tt.type==="pong"?ht():c||(fe.send(Oo(tt.payload?{type:Dn.Pong,payload:tt.payload}:{type:Dn.Pong})),P.emit("pong",!1,tt.payload));return}if(It)return;if(tt.type!==Dn.ConnectionAck)throw new Error(`First message cannot be of type ${tt.type}`);clearTimeout(Pe),It=!0,P.emit("connected",fe,tt.payload,q),q=!1,$=0,ee([fe,new Promise((Mt,St)=>D(St))])}catch(tt){fe.onmessage=null,P.emit("error",tt),fe.close(Mn.BadResponse,Y0(tt instanceof Error?tt.message:String(tt),"Bad response"))}}})())));ie.readyState===O.CLOSING&&await me;let we=()=>{};const Te=new Promise(ee=>we=ee);return[ie,we,Promise.race([Te.then(()=>{if(!N){const ee=()=>ie.close(1e3,"Normal Closure");isFinite(a)&&a>0?G=setTimeout(()=>{ie.readyState===O.OPEN&&ee()},a):ee()}}),me])]}function re(ie){if(Oh(ie)&&(nI(ie.code)||[Mn.InternalServerError,Mn.InternalClientError,Mn.BadRequest,Mn.BadResponse,Mn.Unauthorized,Mn.SubprotocolNotAcceptable,Mn.SubscriberAlreadyExists,Mn.TooManyInitialisationRequests].includes(ie.code)))throw ie;if(K)return!1;if(Oh(ie)&&ie.code===1e3)return N>0;if(!h||$>=h||!m(ie))throw ie;return q=!0}n||(async()=>{for(N++;;)try{const[,,ie]=await oe();await ie}catch(ie){try{if(!re(ie))return}catch(me){return i?.(me)}}})();function Ee(ie,me){const we=b(ie);let Te=!1,ee=!1,ye=()=>{N--,Te=!0};return(async()=>{for(N++;;)try{const[fe,Pe,Be]=await oe();if(Te)return Pe();const ht=P.onMessage(we,It=>{switch(It.type){case Dn.Next:{me.next(It.payload);return}case Dn.Error:{ee=!0,Te=!0,me.error(It.payload),ye();return}case Dn.Complete:{Te=!0,ye();return}}});fe.send(Oo({id:we,type:Dn.Subscribe,payload:ie},I)),ye=()=>{!Te&&fe.readyState===O.OPEN&&fe.send(Oo({id:we,type:Dn.Complete},I)),N--,Te=!0,Pe()},await Be.finally(ht);return}catch(fe){if(!re(fe))return}})().then(()=>{ee||me.complete()}).catch(fe=>{me.error(fe)}),()=>{Te||ye()}}return{on:P.on,subscribe:Ee,iterate(ie){const me=[],we={done:!1,error:null,resolve:()=>{}},Te=Ee(ie,{next(ye){me.push(ye),we.resolve()},error(ye){we.done=!0,we.error=ye,we.resolve()},complete(){we.done=!0,we.resolve()}}),ee=async function*(){for(;;){for(me.length||await new Promise(fe=>we.resolve=fe);me.length;)yield me.shift();if(we.error)throw we.error;if(we.done)return}}();return ee.throw=async ye=>(we.done||(we.done=!0,we.error=ye,we.resolve()),{done:!0,value:void 0}),ee.return=async()=>(Te(),{done:!0,value:void 0}),ee},async dispose(){if(K=!0,T){const[ie]=await T;ie.close(1e3,"Normal Closure")}},terminate(){T&&P.emit("closed",new Z0)}}}class Z0 extends Error{name="TerminatedCloseEvent";message="4499: Terminated";code=4499;reason="Terminated";wasClean=!1}function Oh(r){return Rs(r)&&"code"in r&&"reason"in r}function nI(r){return[1e3,1001,1006,1005,1012,1013,1014].includes(r)?!1:r>=1e3&&r<=1999}function iI(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function X0(r){return new Yr(function(e,t){var n=an(e,[]);return new Pt(function(i){var a,u=!1;return Promise.resolve(n).then(function(c){return r(c,e.getContext())}).then(e.setContext).then(function(){u||(a=t(e).subscribe({next:i.next.bind(i),error:i.error.bind(i),complete:i.complete.bind(i)}))}).catch(i.error.bind(i)),function(){u=!0,a&&a.unsubscribe()}})})}function eb(r){return new Yr(function(e,t){return new Pt(function(n){var i,a,u;try{i=t(e).subscribe({next:function(c){if(c.errors?u=r({graphQLErrors:c.errors,response:c,operation:e,forward:t}):Cy(c)&&(u=r({protocolErrors:c.extensions[Nu],response:c,operation:e,forward:t})),u){a=u.subscribe({next:n.next.bind(n),error:n.error.bind(n),complete:n.complete.bind(n)});return}n.next(c)},error:function(c){if(u=r({operation:e,networkError:c,graphQLErrors:c&&c.result&&c.result.errors||void 0,forward:t}),u){a=u.subscribe({next:n.next.bind(n),error:n.error.bind(n),complete:n.complete.bind(n)});return}n.error(c)},complete:function(){u||n.complete.bind(n)()}})}catch(c){r({networkError:c,operation:e,forward:t}),n.error(c)}return function(){i&&i.unsubscribe(),a&&i.unsubscribe()}})})}(function(r){In(e,r);function e(t){var n=r.call(this)||this;return n.link=eb(t),n}return e.prototype.request=function(t,n){return this.link.request(t,n)},e})(Yr);var To={exports:{}};const sI=dl(GO),aI=dl(L1);var Th,tb;function ma(){return tb||(tb=1,Th=TypeError),Th}const oI=dl(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var kh,rb;function ic(){if(rb)return kh;rb=1;var r=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=r&&e&&typeof e.get=="function"?e.get:null,n=r&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,a=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,u=i&&a&&typeof a.get=="function"?a.get:null,c=i&&Set.prototype.forEach,f=typeof WeakMap=="function"&&WeakMap.prototype,h=f?WeakMap.prototype.has:null,p=typeof WeakSet=="function"&&WeakSet.prototype,m=p?WeakSet.prototype.has:null,y=typeof WeakRef=="function"&&WeakRef.prototype,g=y?WeakRef.prototype.deref:null,b=Boolean.prototype.valueOf,I=Object.prototype.toString,S=Function.prototype.toString,w=String.prototype.match,O=String.prototype.slice,P=String.prototype.replace,D=String.prototype.toUpperCase,T=String.prototype.toLowerCase,N=RegExp.prototype.test,G=Array.prototype.concat,q=Array.prototype.join,$=Array.prototype.slice,K=Math.floor,oe=typeof BigInt=="function"?BigInt.prototype.valueOf:null,re=Object.getOwnPropertySymbols,Ee=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ie=typeof Symbol=="function"&&typeof Symbol.iterator=="object",me=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ie||!0)?Symbol.toStringTag:null,we=Object.prototype.propertyIsEnumerable,Te=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(Q){return Q.__proto__}:null);function ee(Q,J){if(Q===1/0||Q===-1/0||Q!==Q||Q&&Q>-1e3&&Q<1e3||N.call(/e/,J))return J;var it=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof Q=="number"){var mt=Q<0?-K(-Q):K(Q);if(mt!==Q){var lt=String(mt),Ve=O.call(J,lt.length+1);return P.call(lt,it,"$&_")+"."+P.call(P.call(Ve,/([0-9]{3})/g,"$&_"),/_$/,"")}}return P.call(J,it,"$&_")}var ye=oI,fe=ye.custom,Pe=U(fe)?fe:null,Be={__proto__:null,double:'"',single:"'"},ht={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};kh=function Q(J,it,mt,lt){var Ve=it||{};if(z(Ve,"quoteStyle")&&!z(Be,Ve.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(z(Ve,"maxStringLength")&&(typeof Ve.maxStringLength=="number"?Ve.maxStringLength<0&&Ve.maxStringLength!==1/0:Ve.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var ur=z(Ve,"customInspect")?Ve.customInspect:!0;if(typeof ur!="boolean"&&ur!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(z(Ve,"indent")&&Ve.indent!==null&&Ve.indent!==" "&&!(parseInt(Ve.indent,10)===Ve.indent&&Ve.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(z(Ve,"numericSeparator")&&typeof Ve.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Jt=Ve.numericSeparator;if(typeof J>"u")return"undefined";if(J===null)return"null";if(typeof J=="boolean")return J?"true":"false";if(typeof J=="string")return Et(J,Ve);if(typeof J=="number"){if(J===0)return 1/0/J>0?"0":"-0";var Yt=String(J);return Jt?ee(J,Yt):Yt}if(typeof J=="bigint"){var Mr=String(J)+"n";return Jt?ee(J,Mr):Mr}var jr=typeof Ve.depth>"u"?5:Ve.depth;if(typeof mt>"u"&&(mt=0),mt>=jr&&jr>0&&typeof J=="object")return tt(J)?"[Array]":"[Object]";var Ur=pr(Ve,mt);if(typeof lt>"u")lt=[];else if($e(lt,J)>=0)return"[Circular]";function qt(Ye,Ht,He){if(Ht&&(lt=$.call(lt),lt.push(Ht)),He){var gt={depth:Ve.depth};return z(Ve,"quoteStyle")&&(gt.quoteStyle=Ve.quoteStyle),Q(Ye,gt,mt+1,lt)}return Q(Ye,Ve,mt+1,lt)}if(typeof J=="function"&&!St(J)){var Er=We(J),zr=Wt(J,qt);return"[Function"+(Er?": "+Er:" (anonymous)")+"]"+(zr.length>0?" { "+q.call(zr,", ")+" }":"")}if(U(J)){var Dr=ie?P.call(String(J),/^(Symbol\(.*\))_[^)]*$/,"$1"):Ee.call(J);return typeof J=="object"&&!ie?zt(Dr):Dr}if(Qt(J)){for(var er="<"+T.call(String(J.nodeName)),Hr=J.attributes||[],Tr=0;Tr<Hr.length;Tr++)er+=" "+Hr[Tr].name+"="+It(ot(Hr[Tr].value),"double",Ve);return er+=">",J.childNodes&&J.childNodes.length&&(er+="..."),er+="</"+T.call(String(J.nodeName))+">",er}if(tt(J)){if(J.length===0)return"[]";var gr=Wt(J,qt);return Ur&&!dr(gr)?"["+Or(gr,Ur)+"]":"[ "+q.call(gr,", ")+" ]"}if(Fe(J)){var kr=Wt(J,qt);return!("cause"in Error.prototype)&&"cause"in J&&!we.call(J,"cause")?"{ ["+String(J)+"] "+q.call(G.call("[cause]: "+qt(J.cause),kr),", ")+" }":kr.length===0?"["+String(J)+"]":"{ ["+String(J)+"] "+q.call(kr,", ")+" }"}if(typeof J=="object"&&ur){if(Pe&&typeof J[Pe]=="function"&&ye)return ye(J,{depth:jr-mt});if(ur!=="symbol"&&typeof J.inspect=="function")return J.inspect()}if(ce(J)){var _n=[];return n&&n.call(J,function(Ye,Ht){_n.push(qt(Ht,J,!0)+" => "+qt(Ye,J))}),Vt("Map",t.call(J),_n,Ur)}if(dt(J)){var M=[];return c&&c.call(J,function(Ye){M.push(qt(Ye,J))}),Vt("Set",u.call(J),M,Ur)}if(Se(J))return xr("WeakMap");if(pt(J))return xr("WeakSet");if(Je(J))return xr("WeakRef");if(W(J))return zt(qt(Number(J)));if(Z(J))return zt(qt(oe.call(J)));if(Y(J))return zt(b.call(J));if(Ge(J))return zt(qt(String(J)));if(typeof window<"u"&&J===window)return"{ [object Window] }";if(typeof globalThis<"u"&&J===globalThis||typeof vs<"u"&&J===vs)return"{ [object globalThis] }";if(!Mt(J)&&!St(J)){var pe=Wt(J,qt),xe=Te?Te(J)===Object.prototype:J instanceof Object||J.constructor===Object,je=J instanceof Object?"":"null prototype",ze=!xe&&me&&Object(J)===J&&me in J?O.call(Oe(J),8,-1):je?"Object":"",Qe=xe||typeof J.constructor!="function"?"":J.constructor.name?J.constructor.name+" ":"",et=Qe+(ze||je?"["+q.call(G.call([],ze||[],je||[]),": ")+"] ":"");return pe.length===0?et+"{}":Ur?et+"{"+Or(pe,Ur)+"}":et+"{ "+q.call(pe,", ")+" }"}return String(J)};function It(Q,J,it){var mt=it.quoteStyle||J,lt=Be[mt];return lt+Q+lt}function ot(Q){return P.call(String(Q),/"/g,""")}function tt(Q){return Oe(Q)==="[object Array]"&&(!me||!(typeof Q=="object"&&me in Q))}function Mt(Q){return Oe(Q)==="[object Date]"&&(!me||!(typeof Q=="object"&&me in Q))}function St(Q){return Oe(Q)==="[object RegExp]"&&(!me||!(typeof Q=="object"&&me in Q))}function Fe(Q){return Oe(Q)==="[object Error]"&&(!me||!(typeof Q=="object"&&me in Q))}function Ge(Q){return Oe(Q)==="[object String]"&&(!me||!(typeof Q=="object"&&me in Q))}function W(Q){return Oe(Q)==="[object Number]"&&(!me||!(typeof Q=="object"&&me in Q))}function Y(Q){return Oe(Q)==="[object Boolean]"&&(!me||!(typeof Q=="object"&&me in Q))}function U(Q){if(ie)return Q&&typeof Q=="object"&&Q instanceof Symbol;if(typeof Q=="symbol")return!0;if(!Q||typeof Q!="object"||!Ee)return!1;try{return Ee.call(Q),!0}catch{}return!1}function Z(Q){if(!Q||typeof Q!="object"||!oe)return!1;try{return oe.call(Q),!0}catch{}return!1}var ne=Object.prototype.hasOwnProperty||function(Q){return Q in this};function z(Q,J){return ne.call(Q,J)}function Oe(Q){return I.call(Q)}function We(Q){if(Q.name)return Q.name;var J=w.call(S.call(Q),/^function\s*([\w$]+)/);return J?J[1]:null}function $e(Q,J){if(Q.indexOf)return Q.indexOf(J);for(var it=0,mt=Q.length;it<mt;it++)if(Q[it]===J)return it;return-1}function ce(Q){if(!t||!Q||typeof Q!="object")return!1;try{t.call(Q);try{u.call(Q)}catch{return!0}return Q instanceof Map}catch{}return!1}function Se(Q){if(!h||!Q||typeof Q!="object")return!1;try{h.call(Q,h);try{m.call(Q,m)}catch{return!0}return Q instanceof WeakMap}catch{}return!1}function Je(Q){if(!g||!Q||typeof Q!="object")return!1;try{return g.call(Q),!0}catch{}return!1}function dt(Q){if(!u||!Q||typeof Q!="object")return!1;try{u.call(Q);try{t.call(Q)}catch{return!0}return Q instanceof Set}catch{}return!1}function pt(Q){if(!m||!Q||typeof Q!="object")return!1;try{m.call(Q,m);try{h.call(Q,h)}catch{return!0}return Q instanceof WeakSet}catch{}return!1}function Qt(Q){return!Q||typeof Q!="object"?!1:typeof HTMLElement<"u"&&Q instanceof HTMLElement?!0:typeof Q.nodeName=="string"&&typeof Q.getAttribute=="function"}function Et(Q,J){if(Q.length>J.maxStringLength){var it=Q.length-J.maxStringLength,mt="... "+it+" more character"+(it>1?"s":"");return Et(O.call(Q,0,J.maxStringLength),J)+mt}var lt=ht[J.quoteStyle||"single"];lt.lastIndex=0;var Ve=P.call(P.call(Q,lt,"\\$1"),/[\x00-\x1f]/g,Xt);return It(Ve,"single",J)}function Xt(Q){var J=Q.charCodeAt(0),it={8:"b",9:"t",10:"n",12:"f",13:"r"}[J];return it?"\\"+it:"\\x"+(J<16?"0":"")+D.call(J.toString(16))}function zt(Q){return"Object("+Q+")"}function xr(Q){return Q+" { ? }"}function Vt(Q,J,it,mt){var lt=mt?Or(it,mt):q.call(it,", ");return Q+" ("+J+") {"+lt+"}"}function dr(Q){for(var J=0;J<Q.length;J++)if($e(Q[J],`
|
|
129
|
+
`)>=0)return!1;return!0}function pr(Q,J){var it;if(Q.indent===" ")it=" ";else if(typeof Q.indent=="number"&&Q.indent>0)it=q.call(Array(Q.indent+1)," ");else return null;return{base:it,prev:q.call(Array(J+1),it)}}function Or(Q,J){if(Q.length===0)return"";var it=`
|
|
130
|
+
`+J.prev+J.base;return it+q.call(Q,","+it)+`
|
|
131
|
+
`+J.prev}function Wt(Q,J){var it=tt(Q),mt=[];if(it){mt.length=Q.length;for(var lt=0;lt<Q.length;lt++)mt[lt]=z(Q,lt)?J(Q[lt],Q):""}var Ve=typeof re=="function"?re(Q):[],ur;if(ie){ur={};for(var Jt=0;Jt<Ve.length;Jt++)ur["$"+Ve[Jt]]=Ve[Jt]}for(var Yt in Q)z(Q,Yt)&&(it&&String(Number(Yt))===Yt&&Yt<Q.length||ie&&ur["$"+Yt]instanceof Symbol||(N.call(/[^\w$]/,Yt)?mt.push(J(Yt,Q)+": "+J(Q[Yt],Q)):mt.push(Yt+": "+J(Q[Yt],Q))));if(typeof re=="function")for(var Mr=0;Mr<Ve.length;Mr++)we.call(Q,Ve[Mr])&&mt.push("["+J(Ve[Mr])+"]: "+J(Q[Ve[Mr]],Q));return mt}return kh}var Ah,nb;function uI(){if(nb)return Ah;nb=1;var r=ic(),e=ma(),t=function(c,f,h){for(var p=c,m;(m=p.next)!=null;p=m)if(m.key===f)return p.next=m.next,h||(m.next=c.next,c.next=m),m},n=function(c,f){if(c){var h=t(c,f);return h&&h.value}},i=function(c,f,h){var p=t(c,f);p?p.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 Ah=function(){var f,h={assert:function(p){if(!h.has(p))throw new e("Side channel does not contain "+r(p))},delete:function(p){var m=f&&f.next,y=u(f,p);return y&&m&&m===y&&(f=void 0),!!y},get:function(p){return n(f,p)},has:function(p){return a(f,p)},set:function(p,m){f||(f={next:void 0}),i(f,p,m)}};return h},Ah}var Ih,ib;function sb(){return ib||(ib=1,Ih=Object),Ih}var Ch,ab;function cI(){return ab||(ab=1,Ch=Error),Ch}var Ph,ob;function lI(){return ob||(ob=1,Ph=EvalError),Ph}var Nh,ub;function fI(){return ub||(ub=1,Nh=RangeError),Nh}var Rh,cb;function hI(){return cb||(cb=1,Rh=ReferenceError),Rh}var Mh,lb;function dI(){return lb||(lb=1,Mh=SyntaxError),Mh}var Dh,fb;function pI(){return fb||(fb=1,Dh=URIError),Dh}var Fh,hb;function mI(){return hb||(hb=1,Fh=Math.abs),Fh}var Lh,db;function yI(){return db||(db=1,Lh=Math.floor),Lh}var qh,pb;function gI(){return pb||(pb=1,qh=Math.max),qh}var jh,mb;function vI(){return mb||(mb=1,jh=Math.min),jh}var Uh,yb;function bI(){return yb||(yb=1,Uh=Math.pow),Uh}var $h,gb;function wI(){return gb||(gb=1,$h=Math.round),$h}var Bh,vb;function _I(){return vb||(vb=1,Bh=Number.isNaN||function(e){return e!==e}),Bh}var Vh,bb;function SI(){if(bb)return Vh;bb=1;var r=_I();return Vh=function(t){return r(t)||t===0?t:t<0?-1:1},Vh}var Wh,wb;function xI(){return wb||(wb=1,Wh=Object.getOwnPropertyDescriptor),Wh}var zh,_b;function Sb(){if(_b)return zh;_b=1;var r=xI();if(r)try{r([],"length")}catch{r=null}return zh=r,zh}var Hh,xb;function EI(){if(xb)return Hh;xb=1;var r=Object.defineProperty||!1;if(r)try{r({},"a",{value:1})}catch{r=!1}return Hh=r,Hh}var Gh,Eb;function OI(){return Eb||(Eb=1,Gh=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}),Gh}var Qh,Ob;function TI(){if(Ob)return Qh;Ob=1;var r=typeof Symbol<"u"&&Symbol,e=OI();return Qh=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Qh}var Jh,Tb;function kb(){return Tb||(Tb=1,Jh=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Jh}var Yh,Ab;function Ib(){if(Ab)return Yh;Ab=1;var r=sb();return Yh=r.getPrototypeOf||null,Yh}var Kh,Cb;function kI(){if(Cb)return Kh;Cb=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 p=[],m=0;m<f.length;m+=1)p[m]=f[m];for(var y=0;y<h.length;y+=1)p[y+f.length]=h[y];return p},a=function(f,h){for(var p=[],m=h,y=0;m<f.length;m+=1,y+=1)p[y]=f[m];return p},u=function(c,f){for(var h="",p=0;p<c.length;p+=1)h+=c[p],p+1<c.length&&(h+=f);return h};return Kh=function(f){var h=this;if(typeof h!="function"||e.apply(h)!==n)throw new TypeError(r+h);for(var p=a(arguments,1),m,y=function(){if(this instanceof m){var w=h.apply(this,i(p,arguments));return Object(w)===w?w:this}return h.apply(f,i(p,arguments))},g=t(0,h.length-p.length),b=[],I=0;I<g;I++)b[I]="$"+I;if(m=Function("binder","return function ("+u(b,",")+"){ return binder.apply(this,arguments); }")(y),h.prototype){var S=function(){};S.prototype=h.prototype,m.prototype=new S,S.prototype=null}return m},Kh}var Zh,Pb;function sc(){if(Pb)return Zh;Pb=1;var r=kI();return Zh=Function.prototype.bind||r,Zh}var Xh,Nb;function ed(){return Nb||(Nb=1,Xh=Function.prototype.call),Xh}var td,Rb;function Mb(){return Rb||(Rb=1,td=Function.prototype.apply),td}var rd,Db;function AI(){return Db||(Db=1,rd=typeof Reflect<"u"&&Reflect&&Reflect.apply),rd}var nd,Fb;function II(){if(Fb)return nd;Fb=1;var r=sc(),e=Mb(),t=ed(),n=AI();return nd=n||r.call(t,e),nd}var id,Lb;function qb(){if(Lb)return id;Lb=1;var r=sc(),e=ma(),t=ed(),n=II();return id=function(a){if(a.length<1||typeof a[0]!="function")throw new e("a function is required");return n(r,t,a)},id}var sd,jb;function CI(){if(jb)return sd;jb=1;var r=qb(),e=Sb(),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 sd=n&&typeof n.get=="function"?r([n.get]):typeof a=="function"?function(c){return a(c==null?c:i(c))}:!1,sd}var ad,Ub;function PI(){if(Ub)return ad;Ub=1;var r=kb(),e=Ib(),t=CI();return ad=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,ad}var od,$b;function NI(){if($b)return od;$b=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=sc();return od=t.call(r,e),od}var ud,Bb;function cd(){if(Bb)return ud;Bb=1;var r,e=sb(),t=cI(),n=lI(),i=fI(),a=hI(),u=dI(),c=ma(),f=pI(),h=mI(),p=yI(),m=gI(),y=vI(),g=bI(),b=wI(),I=SI(),S=Function,w=function(Fe){try{return S('"use strict"; return ('+Fe+").constructor;")()}catch{}},O=Sb(),P=EI(),D=function(){throw new c},T=O?function(){try{return arguments.callee,D}catch{try{return O(arguments,"callee").get}catch{return D}}}():D,N=TI()(),G=PI(),q=Ib(),$=kb(),K=Mb(),oe=ed(),re={},Ee=typeof Uint8Array>"u"||!G?r:G(Uint8Array),ie={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":N&&G?G([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":re,"%AsyncGenerator%":re,"%AsyncGeneratorFunction%":re,"%AsyncIteratorPrototype%":re,"%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%":re,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":N&&G?G(G([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!N||!G?r:G(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":O,"%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"||!N||!G?r:G(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":N&&G?G(""[Symbol.iterator]()):r,"%Symbol%":N?Symbol:r,"%SyntaxError%":u,"%ThrowTypeError%":T,"%TypedArray%":Ee,"%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%":oe,"%Function.prototype.apply%":K,"%Object.defineProperty%":P,"%Object.getPrototypeOf%":q,"%Math.abs%":h,"%Math.floor%":p,"%Math.max%":m,"%Math.min%":y,"%Math.pow%":g,"%Math.round%":b,"%Math.sign%":I,"%Reflect.getPrototypeOf%":$};if(G)try{null.error}catch(Fe){var me=G(G(Fe));ie["%Error.prototype%"]=me}var we=function Fe(Ge){var W;if(Ge==="%AsyncFunction%")W=w("async function () {}");else if(Ge==="%GeneratorFunction%")W=w("function* () {}");else if(Ge==="%AsyncGeneratorFunction%")W=w("async function* () {}");else if(Ge==="%AsyncGenerator%"){var Y=Fe("%AsyncGeneratorFunction%");Y&&(W=Y.prototype)}else if(Ge==="%AsyncIteratorPrototype%"){var U=Fe("%AsyncGenerator%");U&&G&&(W=G(U.prototype))}return ie[Ge]=W,W},Te={__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"]},ee=sc(),ye=NI(),fe=ee.call(oe,Array.prototype.concat),Pe=ee.call(K,Array.prototype.splice),Be=ee.call(oe,String.prototype.replace),ht=ee.call(oe,String.prototype.slice),It=ee.call(oe,RegExp.prototype.exec),ot=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,tt=/\\(\\)?/g,Mt=function(Ge){var W=ht(Ge,0,1),Y=ht(Ge,-1);if(W==="%"&&Y!=="%")throw new u("invalid intrinsic syntax, expected closing `%`");if(Y==="%"&&W!=="%")throw new u("invalid intrinsic syntax, expected opening `%`");var U=[];return Be(Ge,ot,function(Z,ne,z,Oe){U[U.length]=z?Be(Oe,tt,"$1"):ne||Z}),U},St=function(Ge,W){var Y=Ge,U;if(ye(Te,Y)&&(U=Te[Y],Y="%"+U[0]+"%"),ye(ie,Y)){var Z=ie[Y];if(Z===re&&(Z=we(Y)),typeof Z>"u"&&!W)throw new c("intrinsic "+Ge+" exists, but is not available. Please file an issue!");return{alias:U,name:Y,value:Z}}throw new u("intrinsic "+Ge+" does not exist!")};return ud=function(Ge,W){if(typeof Ge!="string"||Ge.length===0)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof W!="boolean")throw new c('"allowMissing" argument must be a boolean');if(It(/^%?[^%]*%?$/,Ge)===null)throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Y=Mt(Ge),U=Y.length>0?Y[0]:"",Z=St("%"+U+"%",W),ne=Z.name,z=Z.value,Oe=!1,We=Z.alias;We&&(U=We[0],Pe(Y,fe([0,1],We)));for(var $e=1,ce=!0;$e<Y.length;$e+=1){var Se=Y[$e],Je=ht(Se,0,1),dt=ht(Se,-1);if((Je==='"'||Je==="'"||Je==="`"||dt==='"'||dt==="'"||dt==="`")&&Je!==dt)throw new u("property names with quotes must have matching quotes");if((Se==="constructor"||!ce)&&(Oe=!0),U+="."+Se,ne="%"+U+"%",ye(ie,ne))z=ie[ne];else if(z!=null){if(!(Se in z)){if(!W)throw new c("base intrinsic for "+Ge+" exists, but the property is not available.");return}if(O&&$e+1>=Y.length){var pt=O(z,Se);ce=!!pt,ce&&"get"in pt&&!("originalValue"in pt.get)?z=pt.get:z=z[Se]}else ce=ye(z,Se),z=z[Se];ce&&!Oe&&(ie[ne]=z)}}return z},ud}var ld,Vb;function Wb(){if(Vb)return ld;Vb=1;var r=cd(),e=qb(),t=e([r("%String.prototype.indexOf%")]);return ld=function(i,a){var u=r(i,!!a);return typeof u=="function"&&t(i,".prototype.")>-1?e([u]):u},ld}var fd,zb;function Hb(){if(zb)return fd;zb=1;var r=cd(),e=Wb(),t=ic(),n=ma(),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 fd=!!i&&function(){var m,y={assert:function(g){if(!y.has(g))throw new n("Side channel does not contain "+t(g))},delete:function(g){if(m){var b=f(m,g);return h(m)===0&&(m=void 0),b}return!1},get:function(g){if(m)return a(m,g)},has:function(g){return m?c(m,g):!1},set:function(g,b){m||(m=new i),u(m,g,b)}};return y},fd}var hd,Gb;function RI(){if(Gb)return hd;Gb=1;var r=cd(),e=Wb(),t=ic(),n=Hb(),i=ma(),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 hd=a?function(){var m,y,g={assert:function(b){if(!g.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(m)return h(m,b)}else if(n&&y)return y.delete(b);return!1},get:function(b){return a&&b&&(typeof b=="object"||typeof b=="function")&&m?u(m,b):y&&y.get(b)},has:function(b){return a&&b&&(typeof b=="object"||typeof b=="function")&&m?f(m,b):!!y&&y.has(b)},set:function(b,I){a&&b&&(typeof b=="object"||typeof b=="function")?(m||(m=new a),c(m,b,I)):n&&(y||(y=n()),y.set(b,I))}};return g}:n,hd}var dd,Qb;function MI(){if(Qb)return dd;Qb=1;var r=ma(),e=ic(),t=uI(),n=Hb(),i=RI(),a=i||n||t;return dd=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,p){c||(c=a()),c.set(h,p)}};return f},dd}var pd,Jb;function md(){if(Jb)return pd;Jb=1;var r=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return pd={default:t.RFC3986,formatters:{RFC1738:function(n){return r.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},pd}var yd,Yb;function Kb(){if(Yb)return yd;Yb=1;var r=md(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n=function(){for(var S=[],w=0;w<256;++w)S.push("%"+((w<16?"0":"")+w.toString(16)).toUpperCase());return S}(),i=function(w){for(;w.length>1;){var O=w.pop(),P=O.obj[O.prop];if(t(P)){for(var D=[],T=0;T<P.length;++T)typeof P[T]<"u"&&D.push(P[T]);O.obj[O.prop]=D}}},a=function(w,O){for(var P=O&&O.plainObjects?Object.create(null):{},D=0;D<w.length;++D)typeof w[D]<"u"&&(P[D]=w[D]);return P},u=function S(w,O,P){if(!O)return w;if(typeof O!="object"){if(t(w))w.push(O);else if(w&&typeof w=="object")(P&&(P.plainObjects||P.allowPrototypes)||!e.call(Object.prototype,O))&&(w[O]=!0);else return[w,O];return w}if(!w||typeof w!="object")return[w].concat(O);var D=w;return t(w)&&!t(O)&&(D=a(w,P)),t(w)&&t(O)?(O.forEach(function(T,N){if(e.call(w,N)){var G=w[N];G&&typeof G=="object"&&T&&typeof T=="object"?w[N]=S(G,T,P):w.push(T)}else w[N]=T}),w):Object.keys(O).reduce(function(T,N){var G=O[N];return e.call(T,N)?T[N]=S(T[N],G,P):T[N]=G,T},D)},c=function(w,O){return Object.keys(O).reduce(function(P,D){return P[D]=O[D],P},w)},f=function(S,w,O){var P=S.replace(/\+/g," ");if(O==="iso-8859-1")return P.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(P)}catch{return P}},h=1024,p=function(w,O,P,D,T){if(w.length===0)return w;var N=w;if(typeof w=="symbol"?N=Symbol.prototype.toString.call(w):typeof w!="string"&&(N=String(w)),P==="iso-8859-1")return escape(N).replace(/%u[0-9a-f]{4}/gi,function(Ee){return"%26%23"+parseInt(Ee.slice(2),16)+"%3B"});for(var G="",q=0;q<N.length;q+=h){for(var $=N.length>=h?N.slice(q,q+h):N,K=[],oe=0;oe<$.length;++oe){var re=$.charCodeAt(oe);if(re===45||re===46||re===95||re===126||re>=48&&re<=57||re>=65&&re<=90||re>=97&&re<=122||T===r.RFC1738&&(re===40||re===41)){K[K.length]=$.charAt(oe);continue}if(re<128){K[K.length]=n[re];continue}if(re<2048){K[K.length]=n[192|re>>6]+n[128|re&63];continue}if(re<55296||re>=57344){K[K.length]=n[224|re>>12]+n[128|re>>6&63]+n[128|re&63];continue}oe+=1,re=65536+((re&1023)<<10|$.charCodeAt(oe)&1023),K[K.length]=n[240|re>>18]+n[128|re>>12&63]+n[128|re>>6&63]+n[128|re&63]}G+=K.join("")}return G},m=function(w){for(var O=[{obj:{o:w},prop:"o"}],P=[],D=0;D<O.length;++D)for(var T=O[D],N=T.obj[T.prop],G=Object.keys(N),q=0;q<G.length;++q){var $=G[q],K=N[$];typeof K=="object"&&K!==null&&P.indexOf(K)===-1&&(O.push({obj:N,prop:$}),P.push(K))}return i(O),w},y=function(w){return Object.prototype.toString.call(w)==="[object RegExp]"},g=function(w){return!w||typeof w!="object"?!1:!!(w.constructor&&w.constructor.isBuffer&&w.constructor.isBuffer(w))},b=function(w,O){return[].concat(w,O)},I=function(w,O){if(t(w)){for(var P=[],D=0;D<w.length;D+=1)P.push(O(w[D]));return P}return O(w)};return yd={arrayToObject:a,assign:c,combine:b,compact:m,decode:f,encode:p,isBuffer:g,isRegExp:y,maybeMap:I,merge:u},yd}var gd,Zb;function DI(){if(Zb)return gd;Zb=1;var r=MI(),e=Kb(),t=md(),n=Object.prototype.hasOwnProperty,i={brackets:function(S){return S+"[]"},comma:"comma",indices:function(S,w){return S+"["+w+"]"},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,p={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},m=function(S){return typeof S=="string"||typeof S=="number"||typeof S=="boolean"||typeof S=="symbol"||typeof S=="bigint"},y={},g=function I(S,w,O,P,D,T,N,G,q,$,K,oe,re,Ee,ie,me,we,Te){for(var ee=S,ye=Te,fe=0,Pe=!1;(ye=ye.get(y))!==void 0&&!Pe;){var Be=ye.get(S);if(fe+=1,typeof Be<"u"){if(Be===fe)throw new RangeError("Cyclic object value");Pe=!0}typeof ye.get(y)>"u"&&(fe=0)}if(typeof $=="function"?ee=$(w,ee):ee instanceof Date?ee=re(ee):O==="comma"&&a(ee)&&(ee=e.maybeMap(ee,function(ne){return ne instanceof Date?re(ne):ne})),ee===null){if(T)return q&&!me?q(w,p.encoder,we,"key",Ee):w;ee=""}if(m(ee)||e.isBuffer(ee)){if(q){var ht=me?w:q(w,p.encoder,we,"key",Ee);return[ie(ht)+"="+ie(q(ee,p.encoder,we,"value",Ee))]}return[ie(w)+"="+ie(String(ee))]}var It=[];if(typeof ee>"u")return It;var ot;if(O==="comma"&&a(ee))me&&q&&(ee=e.maybeMap(ee,q)),ot=[{value:ee.length>0?ee.join(",")||null:void 0}];else if(a($))ot=$;else{var tt=Object.keys(ee);ot=K?tt.sort(K):tt}var Mt=G?w.replace(/\./g,"%2E"):w,St=P&&a(ee)&&ee.length===1?Mt+"[]":Mt;if(D&&a(ee)&&ee.length===0)return St+"[]";for(var Fe=0;Fe<ot.length;++Fe){var Ge=ot[Fe],W=typeof Ge=="object"&&typeof Ge.value<"u"?Ge.value:ee[Ge];if(!(N&&W===null)){var Y=oe&&G?Ge.replace(/\./g,"%2E"):Ge,U=a(ee)?typeof O=="function"?O(St,Y):St:St+(oe?"."+Y:"["+Y+"]");Te.set(S,fe);var Z=r();Z.set(y,Te),c(It,I(W,U,O,P,D,T,N,G,O==="comma"&&me&&a(ee)?null:q,$,K,oe,re,Ee,ie,me,we,Z))}}return It},b=function(S){if(!S)return p;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 w=S.charset||p.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 O=t.default;if(typeof S.format<"u"){if(!n.call(t.formatters,S.format))throw new TypeError("Unknown format option provided.");O=S.format}var P=t.formatters[O],D=p.filter;(typeof S.filter=="function"||a(S.filter))&&(D=S.filter);var T;if(S.arrayFormat in i?T=S.arrayFormat:"indices"in S?T=S.indices?"indices":"repeat":T=p.arrayFormat,"commaRoundTrip"in S&&typeof S.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var N=typeof S.allowDots>"u"?S.encodeDotInKeys===!0?!0:p.allowDots:!!S.allowDots;return{addQueryPrefix:typeof S.addQueryPrefix=="boolean"?S.addQueryPrefix:p.addQueryPrefix,allowDots:N,allowEmptyArrays:typeof S.allowEmptyArrays=="boolean"?!!S.allowEmptyArrays:p.allowEmptyArrays,arrayFormat:T,charset:w,charsetSentinel:typeof S.charsetSentinel=="boolean"?S.charsetSentinel:p.charsetSentinel,commaRoundTrip:S.commaRoundTrip,delimiter:typeof S.delimiter>"u"?p.delimiter:S.delimiter,encode:typeof S.encode=="boolean"?S.encode:p.encode,encodeDotInKeys:typeof S.encodeDotInKeys=="boolean"?S.encodeDotInKeys:p.encodeDotInKeys,encoder:typeof S.encoder=="function"?S.encoder:p.encoder,encodeValuesOnly:typeof S.encodeValuesOnly=="boolean"?S.encodeValuesOnly:p.encodeValuesOnly,filter:D,format:O,formatter:P,serializeDate:typeof S.serializeDate=="function"?S.serializeDate:p.serializeDate,skipNulls:typeof S.skipNulls=="boolean"?S.skipNulls:p.skipNulls,sort:typeof S.sort=="function"?S.sort:null,strictNullHandling:typeof S.strictNullHandling=="boolean"?S.strictNullHandling:p.strictNullHandling}};return gd=function(I,S){var w=I,O=b(S),P,D;typeof O.filter=="function"?(D=O.filter,w=D("",w)):a(O.filter)&&(D=O.filter,P=D);var T=[];if(typeof w!="object"||w===null)return"";var N=i[O.arrayFormat],G=N==="comma"&&O.commaRoundTrip;P||(P=Object.keys(w)),O.sort&&P.sort(O.sort);for(var q=r(),$=0;$<P.length;++$){var K=P[$];O.skipNulls&&w[K]===null||c(T,g(w[K],K,N,G,O.allowEmptyArrays,O.strictNullHandling,O.skipNulls,O.encodeDotInKeys,O.encode?O.encoder:null,O.filter,O.sort,O.allowDots,O.serializeDate,O.format,O.formatter,O.encodeValuesOnly,O.charset,q))}var oe=T.join(O.delimiter),re=O.addQueryPrefix===!0?"?":"";return O.charsetSentinel&&(O.charset==="iso-8859-1"?re+="utf8=%26%2310003%3B&":re+="utf8=%E2%9C%93&"),oe.length>0?re+oe:""},gd}var vd,Xb;function FI(){if(Xb)return vd;Xb=1;var r=Kb(),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(y){return y.replace(/&#(\d+);/g,function(g,b){return String.fromCharCode(parseInt(b,10))})},a=function(y,g){return y&&typeof y=="string"&&g.comma&&y.indexOf(",")>-1?y.split(","):y},u="utf8=%26%2310003%3B",c="utf8=%E2%9C%93",f=function(g,b){var I={__proto__:null},S=b.ignoreQueryPrefix?g.replace(/^\?/,""):g;S=S.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var w=b.parameterLimit===1/0?void 0:b.parameterLimit,O=S.split(b.delimiter,w),P=-1,D,T=b.charset;if(b.charsetSentinel)for(D=0;D<O.length;++D)O[D].indexOf("utf8=")===0&&(O[D]===c?T="utf-8":O[D]===u&&(T="iso-8859-1"),P=D,D=O.length);for(D=0;D<O.length;++D)if(D!==P){var N=O[D],G=N.indexOf("]="),q=G===-1?N.indexOf("="):G+1,$,K;q===-1?($=b.decoder(N,n.decoder,T,"key"),K=b.strictNullHandling?null:""):($=b.decoder(N.slice(0,q),n.decoder,T,"key"),K=r.maybeMap(a(N.slice(q+1),b),function(re){return b.decoder(re,n.decoder,T,"value")})),K&&b.interpretNumericEntities&&T==="iso-8859-1"&&(K=i(K)),N.indexOf("[]=")>-1&&(K=t(K)?[K]:K);var oe=e.call(I,$);oe&&b.duplicates==="combine"?I[$]=r.combine(I[$],K):(!oe||b.duplicates==="last")&&(I[$]=K)}return I},h=function(y,g,b,I){for(var S=I?g:a(g,b),w=y.length-1;w>=0;--w){var O,P=y[w];if(P==="[]"&&b.parseArrays)O=b.allowEmptyArrays&&(S===""||b.strictNullHandling&&S===null)?[]:[].concat(S);else{O=b.plainObjects?Object.create(null):{};var D=P.charAt(0)==="["&&P.charAt(P.length-1)==="]"?P.slice(1,-1):P,T=b.decodeDotInKeys?D.replace(/%2E/g,"."):D,N=parseInt(T,10);!b.parseArrays&&T===""?O={0:S}:!isNaN(N)&&P!==T&&String(N)===T&&N>=0&&b.parseArrays&&N<=b.arrayLimit?(O=[],O[N]=S):T!=="__proto__"&&(O[T]=S)}S=O}return S},p=function(g,b,I,S){if(g){var w=I.allowDots?g.replace(/\.([^.[]+)/g,"[$1]"):g,O=/(\[[^[\]]*])/,P=/(\[[^[\]]*])/g,D=I.depth>0&&O.exec(w),T=D?w.slice(0,D.index):w,N=[];if(T){if(!I.plainObjects&&e.call(Object.prototype,T)&&!I.allowPrototypes)return;N.push(T)}for(var G=0;I.depth>0&&(D=P.exec(w))!==null&&G<I.depth;){if(G+=1,!I.plainObjects&&e.call(Object.prototype,D[1].slice(1,-1))&&!I.allowPrototypes)return;N.push(D[1])}if(D){if(I.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+I.depth+" and strictDepth is true");N.push("["+w.slice(D.index)+"]")}return h(N,b,I,S)}},m=function(g){if(!g)return n;if(typeof g.allowEmptyArrays<"u"&&typeof g.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof g.decodeDotInKeys<"u"&&typeof g.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(g.decoder!==null&&typeof g.decoder<"u"&&typeof g.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof g.charset<"u"&&g.charset!=="utf-8"&&g.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var b=typeof g.charset>"u"?n.charset:g.charset,I=typeof g.duplicates>"u"?n.duplicates:g.duplicates;if(I!=="combine"&&I!=="first"&&I!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var S=typeof g.allowDots>"u"?g.decodeDotInKeys===!0?!0:n.allowDots:!!g.allowDots;return{allowDots:S,allowEmptyArrays:typeof g.allowEmptyArrays=="boolean"?!!g.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof g.allowPrototypes=="boolean"?g.allowPrototypes:n.allowPrototypes,allowSparse:typeof g.allowSparse=="boolean"?g.allowSparse:n.allowSparse,arrayLimit:typeof g.arrayLimit=="number"?g.arrayLimit:n.arrayLimit,charset:b,charsetSentinel:typeof g.charsetSentinel=="boolean"?g.charsetSentinel:n.charsetSentinel,comma:typeof g.comma=="boolean"?g.comma:n.comma,decodeDotInKeys:typeof g.decodeDotInKeys=="boolean"?g.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof g.decoder=="function"?g.decoder:n.decoder,delimiter:typeof g.delimiter=="string"||r.isRegExp(g.delimiter)?g.delimiter:n.delimiter,depth:typeof g.depth=="number"||g.depth===!1?+g.depth:n.depth,duplicates:I,ignoreQueryPrefix:g.ignoreQueryPrefix===!0,interpretNumericEntities:typeof g.interpretNumericEntities=="boolean"?g.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof g.parameterLimit=="number"?g.parameterLimit:n.parameterLimit,parseArrays:g.parseArrays!==!1,plainObjects:typeof g.plainObjects=="boolean"?g.plainObjects:n.plainObjects,strictDepth:typeof g.strictDepth=="boolean"?!!g.strictDepth:n.strictDepth,strictNullHandling:typeof g.strictNullHandling=="boolean"?g.strictNullHandling:n.strictNullHandling}};return vd=function(y,g){var b=m(g);if(y===""||y===null||typeof y>"u")return b.plainObjects?Object.create(null):{};for(var I=typeof y=="string"?f(y,b):y,S=b.plainObjects?Object.create(null):{},w=Object.keys(I),O=0;O<w.length;++O){var P=w[O],D=p(P,I[P],b,typeof y=="string");S=r.merge(S,D,b)}return b.allowSparse===!0?S:r.compact(S)},vd}var bd,ew;function LI(){if(ew)return bd;ew=1;var r=DI(),e=FI(),t=md();return bd={formats:t,parse:e,stringify:r},bd}var qI=To.exports,tw;function jI(){return tw||(tw=1,function(r,e){(function(t,n){n(e,sI,aI,LI())})(qI,function(t,n,i,a){var u=function(W,Y,U,Z){function ne(z){return z instanceof U?z:new U(function(Oe){Oe(z)})}return new(U||(U=Promise))(function(z,Oe){function We(Se){try{ce(Z.next(Se))}catch(Je){Oe(Je)}}function $e(Se){try{ce(Z.throw(Se))}catch(Je){Oe(Je)}}function ce(Se){Se.done?z(Se.value):ne(Se.value).then(We,$e)}ce((Z=Z.apply(W,Y||[])).next())})},c=function(W,Y){var U={label:0,sent:function(){if(z[0]&1)throw z[1];return z[1]},trys:[],ops:[]},Z,ne,z,Oe;return Oe={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(Oe[Symbol.iterator]=function(){return this}),Oe;function We(ce){return function(Se){return $e([ce,Se])}}function $e(ce){if(Z)throw new TypeError("Generator is already executing.");for(;U;)try{if(Z=1,ne&&(z=ce[0]&2?ne.return:ce[0]?ne.throw||((z=ne.return)&&z.call(ne),0):ne.next)&&!(z=z.call(ne,ce[1])).done)return z;switch(ne=0,z&&(ce=[ce[0]&2,z.value]),ce[0]){case 0:case 1:z=ce;break;case 4:return U.label++,{value:ce[1],done:!1};case 5:U.label++,ne=ce[1],ce=[0];continue;case 7:ce=U.ops.pop(),U.trys.pop();continue;default:if(z=U.trys,!(z=z.length>0&&z[z.length-1])&&(ce[0]===6||ce[0]===2)){U=0;continue}if(ce[0]===3&&(!z||ce[1]>z[0]&&ce[1]<z[3])){U.label=ce[1];break}if(ce[0]===6&&U.label<z[1]){U.label=z[1],z=ce;break}if(z&&U.label<z[2]){U.label=z[2],U.ops.push(ce);break}z[2]&&U.ops.pop(),U.trys.pop();continue}ce=Y.call(W,U)}catch(Se){ce=[6,Se],ne=0}finally{Z=z=0}if(ce[0]&5)throw ce[1];return{value:ce[0]?ce[1]:void 0,done:!0}}};function f(W,Y){if(W.directives&&W.directives.length){var U={};return W.directives.forEach(function(Z){U[Z.name.value]=i.argumentsObjectFromField(Z,Y)}),U}return null}var h=Object.prototype.hasOwnProperty;function p(W,Y){Y!==null&&typeof Y=="object"&&Object.keys(Y).forEach(function(U){var Z=Y[U];h.call(W,U)?p(W[U],Z):W[U]=Z})}function m(W,Y,U,Z,ne,z){z===void 0&&(z={});var Oe=i.getMainDefinition(Y),We=i.getFragmentDefinitions(Y),$e=i.createFragmentMap(We),ce=z.resultMapper,Se=z.fragmentMatcher||function(){return!0},Je={fragmentMap:$e,contextValue:Z,variableValues:ne,resultMapper:ce,resolver:W,fragmentMatcher:Se};return y(Oe.selectionSet,U,Je)}function y(W,Y,U){return u(this,void 0,void 0,function(){var Z,ne,z,Oe,We,$e=this;return c(this,function(ce){switch(ce.label){case 0:return Z=U.fragmentMap,ne=U.contextValue,z=U.variableValues,Oe={},We=function(Se){return u($e,void 0,void 0,function(){var Je,dt,pt,Qt,Et;return c(this,function(Xt){switch(Xt.label){case 0:return i.shouldInclude(Se,z)?i.isField(Se)?[4,g(Se,Y,U)]:[3,2]:[2];case 1:return Je=Xt.sent(),dt=i.resultKeyNameFromField(Se),Je!==void 0&&(Oe[dt]===void 0?Oe[dt]=Je:p(Oe[dt],Je)),[2];case 2:if(i.isInlineFragment(Se))pt=Se;else if(pt=Z[Se.name.value],!pt)throw new Error("No fragment named "+Se.name.value);return Qt=pt.typeCondition.name.value,U.fragmentMatcher(Y,Qt,ne)?[4,y(pt.selectionSet,Y,U)]:[3,4];case 3:Et=Xt.sent(),p(Oe,Et),Xt.label=4;case 4:return[2]}})})},[4,Promise.all(W.selections.map(We))];case 1:return ce.sent(),U.resultMapper?[2,U.resultMapper(Oe,Y)]:[2,Oe]}})})}function g(W,Y,U){return u(this,void 0,void 0,function(){var Z,ne,z,Oe,We,$e,ce;return c(this,function(Se){switch(Se.label){case 0:return Z=U.variableValues,ne=U.contextValue,z=U.resolver,Oe=W.name.value,We=i.argumentsObjectFromField(W,Z),$e={isLeaf:!W.selectionSet,resultKey:i.resultKeyNameFromField(W),directives:f(W,Z),field:W},[4,z(Oe,Y,We,ne,$e)];case 1:return ce=Se.sent(),W.selectionSet?ce==null?[2,ce]:Array.isArray(ce)?[2,b(W,ce,U)]:[2,y(W.selectionSet,ce,U)]:[2,ce]}})})}function b(W,Y,U){return Promise.all(Y.map(function(Z){return Z===null?null:Array.isArray(Z)?b(W,Z,U):y(W.selectionSet,Z,U)}))}var I=function(){var W=function(Y,U){return W=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Z,ne){Z.__proto__=ne}||function(Z,ne){for(var z in ne)ne.hasOwnProperty(z)&&(Z[z]=ne[z])},W(Y,U)};return function(Y,U){W(Y,U);function Z(){this.constructor=Y}Y.prototype=U===null?Object.create(U):(Z.prototype=U.prototype,new Z)}}(),S=function(){return S=Object.assign||function(W){for(var Y,U=1,Z=arguments.length;U<Z;U++){Y=arguments[U];for(var ne in Y)Object.prototype.hasOwnProperty.call(Y,ne)&&(W[ne]=Y[ne])}return W},S.apply(this,arguments)},w=function(W,Y,U,Z){function ne(z){return z instanceof U?z:new U(function(Oe){Oe(z)})}return new(U||(U=Promise))(function(z,Oe){function We(Se){try{ce(Z.next(Se))}catch(Je){Oe(Je)}}function $e(Se){try{ce(Z.throw(Se))}catch(Je){Oe(Je)}}function ce(Se){Se.done?z(Se.value):ne(Se.value).then(We,$e)}ce((Z=Z.apply(W,Y||[])).next())})},O=function(W,Y){var U={label:0,sent:function(){if(z[0]&1)throw z[1];return z[1]},trys:[],ops:[]},Z,ne,z,Oe;return Oe={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(Oe[Symbol.iterator]=function(){return this}),Oe;function We(ce){return function(Se){return $e([ce,Se])}}function $e(ce){if(Z)throw new TypeError("Generator is already executing.");for(;U;)try{if(Z=1,ne&&(z=ce[0]&2?ne.return:ce[0]?ne.throw||((z=ne.return)&&z.call(ne),0):ne.next)&&!(z=z.call(ne,ce[1])).done)return z;switch(ne=0,z&&(ce=[ce[0]&2,z.value]),ce[0]){case 0:case 1:z=ce;break;case 4:return U.label++,{value:ce[1],done:!1};case 5:U.label++,ne=ce[1],ce=[0];continue;case 7:ce=U.ops.pop(),U.trys.pop();continue;default:if(z=U.trys,!(z=z.length>0&&z[z.length-1])&&(ce[0]===6||ce[0]===2)){U=0;continue}if(ce[0]===3&&(!z||ce[1]>z[0]&&ce[1]<z[3])){U.label=ce[1];break}if(ce[0]===6&&U.label<z[1]){U.label=z[1],z=ce;break}if(z&&U.label<z[2]){U.label=z[2],U.ops.push(ce);break}z[2]&&U.ops.pop(),U.trys.pop();continue}ce=Y.call(W,U)}catch(Se){ce=[6,Se],ne=0}finally{Z=z=0}if(ce[0]&5)throw ce[1];return{value:ce[0]?ce[1]:void 0,done:!0}}},P=function(){for(var W=0,Y=0,U=arguments.length;Y<U;Y++)W+=arguments[Y].length;for(var Z=Array(W),ne=0,Y=0;Y<U;Y++)for(var z=arguments[Y],Oe=0,We=z.length;Oe<We;Oe++,ne++)Z[ne]=z[Oe];return Z},D=function(W){var Y=W.replace(/\s/g,""),U=Y.replace(/\[(.*)\]/,function(Z,ne,z,Oe){return((ne!=null&&ne.length)>0?ne:null)||Y});return U},T=function(W,Y,U,Z){if(Array.isArray(W)){var ne=D(Y);return W.map(function(z){return T(z,ne,U,Z)})}return W==null||typeof W=="number"||typeof W=="boolean"||typeof W=="string"?W:U(W,Y,U,Z)},N=function(W){return W.directives&&W.directives.length?W.directives.find(function(Y){return Y.name.value==="rest"}):null};function G(W,Y,U,Z,ne){return ne==null||Y==null||typeof Y=="number"||typeof Y=="boolean"||typeof Y=="string"||ne.selections.forEach(function(z){if(i.isInlineFragment(z))G(W,Y,U,Z,z.selectionSet);else if(z.kind==="FragmentSpread"){var Oe=Z[z.name.value];G(W,Y,U,Z,Oe.selectionSet)}else if(i.isField(z)){var We=i.resultKeyNameFromField(z);We===W&&N(z)!=null?q(Y,U,Z,z.selectionSet):G(W,Y,U,Z,z.selectionSet)}else return function($e){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()}),Y}function q(W,Y,U,Z){if(!(W==null||typeof W=="number"||typeof W=="boolean"||typeof W=="string")){if(Array.isArray(W)){W.forEach(function(ne){return q(ne,Y,U,Z)});return}Z.selections.forEach(function(ne){if(i.isInlineFragment(ne))q(W,Y,U,ne.selectionSet);else if(ne.kind==="FragmentSpread"){var z=U[ne.name.value];q(W,Y,U,z.selectionSet)}else if(i.isField(ne)){var Oe=W[ne.name.value];ne.name.value==="__typename"||(typeof Oe>"u"?W[ne.name.value]=null:Oe!=null&&typeof Oe=="object"&&ne.selectionSet!=null&&q(Oe,Y,U,ne.selectionSet))}else return function(We){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()})}}var $=function(W,Y){var U=W[Y||tt]||W[tt];return typeof U=="string"?{uri:U}:S({responseTransformer:null},U)},K=function(W,Y,U){return U===void 0||Y===void 0?W:W.replace(":"+Y,U)},oe=function(){function W(){}return W.replacerForPath=function(Y){if(Y in W.cache)return W.cache[Y];var U=Y.indexOf("?"),Z=Y.split(W.argReplacement),ne=[],z=!1;Z.reduce(function(We,$e){if($e===""||$e==="{}")return We+$e.length;var ce=We+$e.length;if($e[0]==="{"&&$e[$e.length-1]==="}"){var Se=$e.slice(1,$e.length-1).split(".");ne.push(function(Je,dt){try{var pt=re(Je,Se);return!dt||typeof pt!="object"||pt==null?String(pt):a.stringify(pt)}catch{var Qt=[Y,Se.join(".")].join("|");return Qt in W.warnTable||(console.warn("Warning: RestLink caught an error while unpacking",Qt,"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."),W.warnTable[Qt]=!0),""}})}else ne.push($e),!z&&ce>=U&&(z=!0,ne.push(!0));return ce},0);var Oe=function(We){var $e=!1,ce=ne.reduce(function(Se,Je){return typeof Je=="string"?Se+Je:typeof Je=="boolean"?($e=!0,Se):Se+Je(We,$e)},"");return ce};return W.cache[Y]=Oe},W.cache={},W.warnTable={},W.argReplacement=/({[._a-zA-Z0-9]*})/,W}();function re(W,Y){if(Y.length===0)return W;var U=P(Y),Z=U.shift();return re(W[Z],U)}var Ee=["__typename"],ie=typeof globalThis=="object"&&globalThis||vs,me=function(W,Y,U){U===void 0&&(U=[]);var Z=null;return Y.length!=2?Z=function(ne,z){return Y(ne)}:Z=Y,Array.isArray(W)?W.map(function(ne,z){return me(ne,Z,P(U,[String(z)]))}):W==null||typeof W!="object"||W.constructor!==Object||ie.FileList&&W instanceof FileList||ie.File&&W instanceof File?W:Object.keys(W).reduce(function(ne,z){var Oe=W[z];if(Ee.indexOf(z)!==-1)return ne[z]=Oe,ne;var We=P(U,[z]);return ne[Z(z,We)]=me(Oe,Z,We),ne},{})},we=function(W){return W},Te=function(W){return W instanceof Headers?W:new Headers(W||{})},ee=function(){for(var W=[],Y=0;Y<arguments.length;Y++)W[Y]=arguments[Y];return W.reduce(function(U,Z){return Z&&(Z.forEach||(Z=Te(Z)),Z.forEach(function(ne,z){U.append(z,ne)})),U},new Headers)},ye=function(W,Y,U){var Z=new Headers;return W.forEach(function(ne,z){Y.indexOf(z)===-1&&Z.append(z,ne)}),ee(Z,U||new Headers)},fe=function(W){return function(Y,U){return ye(Y,W,U)}},Pe=["GET","POST","PUT","PATCH","DELETE"],Be=function(W,Y){switch(Y){case"query":if(Pe.indexOf(W.toUpperCase())!==-1)return;throw new Error('A "query" operation can only support "GET" requests but got "'+W+'".');case"mutation":if(Pe.indexOf(W.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 U=Y;return U}},ht=function(W,Y,U){var Z=new Error(U);throw Z.response=W,Z.statusCode=W.status,Z.result=Y,Z},It=function(W,Y){return W==null||typeof W!="object"?W:Array.isArray(W)?W.map(function(U){return It(U,Y)}):(W.__typename=Y,W)},ot=function(W,Y,U,Z,ne){return w(void 0,void 0,void 0,function(){var z,Oe,We,$e,ce,Se,Je,dt,pt,Qt,Et,Xt,zt,xr,Vt,dr,pr,Or,Wt,Q,J,it,mt,lt,Ve,ur,Jt,Yt,Mr,jr,Ur,qt,Er,zr,Dr,er,Hr,Tr,gr,kr,_n,M,pe,xe,je,ze,Qe,et,Ye,Ht;return O(this,function(He){switch(He.label){case 0:if(z=ne.directives,Oe=ne.isLeaf,We=ne.resultKey,$e=Z.exportVariablesByNode,ce=$e.get(Y)||{},Se=function(gt){return gt instanceof Array?gt.forEach(Se):$e.set(gt,S({},ce)),gt},Je=(Y||{})[We],dt=(Y||{})[W],Y&&z&&z.export&&(ce[z.export.as]=dt),pt=z&&z.type,!Oe&&pt){if(z.rest)throw new Error("Invalid use of @type(name: ...) directive on a call that also has @rest(...)");return Se(dt),[2,It(dt,z.type.name)]}if(Qt=!z||!z.rest,Qt)return[2,Se(Je||dt)];if(Et=Z.credentials,Xt=Z.endpoints,zt=Z.headers,xr=Z.customFetch,Vt=Z.operationType,dr=Z.typePatcher,pr=Z.mainDefinition,Or=Z.fragmentDefinitions,Wt=Z.fieldNameNormalizer,Q=Z.fieldNameDenormalizer,J=Z.serializers,it=Z.responseTransformer,mt=i.createFragmentMap(Or),lt=z.rest,Ve=lt.path,ur=lt.endpoint,Jt=lt.pathBuilder,Yt=$(Xt,ur),Mr=Ve==null&&Jt==null,Mr)throw new Error('One of ("path" | "pathBuilder") must be set in the @rest() directive. This request had neither, please add one');if(Jt||(Ve.includes(":")?(console.warn("Deprecated: '@rest(path:' contains a ':' colon, this format will be removed in future versions"),Jt=function(gt){var _=gt.args,A=gt.exportVariables,k=S(S({},_),A),C=Object.keys(k).reduce(function(j,V){return K(j,V,k[V])},Ve);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}):Jt=oe.replacerForPath(Ve)),jr={args:U,exportVariables:ce,context:Z,"@rest":z.rest,replacer:Jt},Ur=Jt(jr),qt=z.rest,Er=qt.method,zr=qt.type,Dr=qt.bodyBuilder,er=qt.bodyKey,Hr=qt.fieldNameDenormalizer,Tr=qt.fieldNameNormalizer,gr=qt.bodySerializer,Er||(Er="GET"),er||(er="input"),kr=void 0,_n=void 0,["GET","DELETE"].indexOf(Er)===-1){if(!Dr){if(M=jr.exportVariables[er]||jr.args&&jr.args[er],!M)throw new Error("[GraphQL "+Er+" "+Vt+" using a REST call without a body]. No `"+er+"` was detected. Pass bodyKey, or bodyBuilder to the @rest() directive to resolve this.");Dr=function(gt){return M}}if(kr=me(Dr(jr),Hr||Q||we),pe=void 0,typeof gr=="string"){if(!J.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.'));pe=J[gr](kr,zt)}else pe=gr?gr(kr,zt):J[Mt](kr,zt);kr=pe.body,_n=new Headers(pe.headers)}return Be(Er,Vt||"query"),xe=S({method:Er,headers:_n||zt,body:kr},Et?{credentials:Et}:{}),je=""+Yt.uri+Ur,[4,(xr||fetch)(je,xe)];case 1:return ze=He.sent(),Z.responses.push(ze),ze.ok?(ze.status===204||ze.headers.get("Content-Length")==="0"?Qe={}:Qe=ze,[3,9]):[3,2];case 2:return ze.status!==404?[3,3]:(Qe=null,[3,9]);case 3:et=void 0,He.label=4;case 4:return He.trys.push([4,6,,8]),[4,ze.clone().json()];case 5:return et=He.sent(),[3,8];case 6:return He.sent(),[4,ze.clone().text()];case 7:return et=He.sent(),[3,8];case 8:ht(ze,et,"Response not successful: Received status code "+ze.status),He.label=9;case 9:if(Ye=Yt.responseTransformer||it,!Ye)return[3,14];He.label=10;case 10:return He.trys.push([10,12,,13]),[4,Ye(Qe,zr)];case 11:return Qe=He.sent(),[3,13];case 12:throw Ht=He.sent(),console.warn("An error occurred in a responseTransformer:"),Ht;case 13:return[3,16];case 14:return Qe&&Qe.json?[4,Qe.json()]:[3,16];case 15:Qe=He.sent(),He.label=16;case 16:return Qe=me(Qe,Tr||Wt||we),Qe=G(We,Qe,pr,mt,pr.selectionSet),Qe=T(Qe,zr,dr,{resolverParams:{fieldName:W,root:Y,args:U,context:Z,info:ne}}),[2,Se(Qe)]}})})},tt="",Mt="",St=function(W,Y){return Y.has("content-type")||Y.append("Content-Type","application/json"),{body:JSON.stringify(W),headers:Y}},Fe={test:function(W){return W.name.value==="rest"},remove:!0},Ge=function(W){I(Y,W);function Y(U){var Z,ne=U.uri,z=U.endpoints,Oe=U.headers,We=U.fieldNameNormalizer,$e=U.fieldNameDenormalizer,ce=U.typePatcher,Se=U.customFetch,Je=U.credentials,dt=U.bodySerializers,pt=U.defaultSerializer,Qt=U.responseTransformer,Et=W.call(this)||this,Xt={};if(Xt[tt]=ne||"",Et.endpoints=Object.assign({},z||Xt),ne==null&&z==null)throw new Error("A RestLink must be initialized with either 1 uri, or a map of keyed-endpoints");if(ne!=null){var zt=(z||{})[tt];if(zt!=null&&zt!=ne)throw new Error("RestLink was configured with a default uri that doesn't match what's passed in to the endpoints map.");Et.endpoints[tt]=ne}if(Et.endpoints[tt]==null&&console.warn("RestLink configured without a default URI. All @rest(…) directives must provide an endpoint key!"),ce==null)Et.typePatcher=function(Vt,dr,pr){return S({__typename:dr},Vt)};else if(!Array.isArray(ce)&&typeof ce=="object"&&Object.keys(ce).map(function(Vt){return ce[Vt]}).reduce(function(Vt,dr){return Vt&&typeof dr=="function"},!0)){var xr=ce;Et.typePatcher=function(Vt,dr,pr,Or){var Wt=Vt.__typename||dr;if(Array.isArray(Vt))return Vt.map(function(J){return pr(J,Wt,pr,Or)});var Q=xr[Wt]||function(J){return J};return S({__typename:Wt},Q(Vt,Wt,pr,Or))}}else throw new Error("RestLink was configured with a typePatcher of invalid type!");return dt&&dt.hasOwnProperty(Mt)&&console.warn("RestLink was configured to override the default serializer! This may result in unexpected behavior"),Et.responseTransformer=Qt||null,Et.fieldNameNormalizer=We||null,Et.fieldNameDenormalizer=$e||null,Et.headers=Te(Oe),Et.credentials=Je||null,Et.customFetch=Se,Et.serializers=S((Z={},Z[Mt]=pt||St,Z),dt||{}),Et.processedDocuments=new Map,Et}return Y.prototype.removeRestSetsFromDocument=function(U){var Z=this.processedDocuments.get(U);if(Z)return Z;i.checkDocument(U);var ne=i.removeDirectivesFromDocument([Fe],U);return this.processedDocuments.set(U,ne),ne},Y.prototype.request=function(U,Z){var ne=U.query,z=U.variables,Oe=U.getContext,We=U.setContext,$e=Oe(),ce=i.hasDirectives(["rest"],ne);if(!ce)return Z(U);var Se=this.removeRestSetsFromDocument(ne),Je=$e.headersMergePolicy;Je==null&&Array.isArray($e.headersToOverride)?Je=fe($e.headersToOverride):Je==null&&(Je=ee);var dt=Je(this.headers,$e.headers);dt.has("Accept")||dt.append("Accept","application/json");var pt=$e.credentials||this.credentials,Qt=i.addTypenameToDocument(ne),Et=i.getMainDefinition(ne),Xt=i.getFragmentDefinitions(ne),zt=(Et||{}).operation||"query",xr={headers:dt,endpoints:this.endpoints,exportVariablesByNode:new Map,credentials:pt,customFetch:this.customFetch,operationType:zt,fieldNameNormalizer:this.fieldNameNormalizer,fieldNameDenormalizer:this.fieldNameDenormalizer,mainDefinition:Et,fragmentDefinitions:Xt,typePatcher:this.typePatcher,serializers:this.serializers,responses:[],responseTransformer:this.responseTransformer},Vt={},dr;return Se&&Z?(U.query=Se,dr=Z(U)):dr=n.Observable.of({data:{}}),dr.flatMap(function(pr){var Or=pr.data,Wt=pr.errors;return new n.Observable(function(Q){m(ot,Qt,Or,xr,z,Vt).then(function(J){We({restResponses:($e.restResponses||[]).concat(xr.responses)}),Q.next({data:J,errors:Wt}),Q.complete()}).catch(function(J){J.name!=="AbortError"&&(J.result&&J.result.errors&&Q.next(J.result),Q.error(J))})})})},Y}(n.ApolloLink);t.RestLink=Ge,t.PathBuilder=oe,Object.defineProperty(t,"__esModule",{value:!0})})}(To,To.exports)),To.exports}var UI=jI();const ac=be.createContext(),$I=()=>{const{isAuthenticated:r,login:e}=Xn(),{children:t,isEmbedded:n,setIsEmbedded:i,authError:a}=be.useContext(ac),u=qi.useNavigate(),c=qi.useLocation(),[f,h]=be.useState(!1),[p,m]=be.useState(),[y,g]=be.useState(),[b,I]=be.useState({}),S=be.useRef({}),w=be.useRef({}),[O,P]=be.useState(!1),[D,T]=be.useState({}),N=(ee,ye={})=>{f&&window.parent.postMessage({type:ee,instanceId:y,...ye},p)},G=(ee,ye,fe={})=>{if(!ee)throw new Error("Namespace is required for sendMessage");N(`${ee}:${ye}`,fe)};be.useEffect(()=>{if(!(!c||c.pathname!=="/mm-embedded-login")){if(r||a)if(new URL(origin)?.protocol==="http:"){window.close();return}else{const ye=new URLSearchParams(c.search),fe=ye.get("id"),Pe=ye.get("origin");a?window.parent.postMessage({type:"authorize-failed",instanceId:fe,error:a,authUrl:window.location.href},Pe):window.parent.postMessage({type:"authorized",instanceId:fe,authUrl:window.location.href},Pe);return}r===!1&&e()}},[c]),be.useEffect(()=>{if(r===null||!c||c.pathname!=="/mm-embedded-interop")return;const ee=new URLSearchParams(c.search),ye=ee.get("id"),fe=ee.get("origin");if(fe){const Pe=new URL(fe)?.hostname;if(/^(?:[\w-]+\.)*(?:machinemetrics\.com|machinemetrics-us-gov\.com|m12s\.com)$/.test(Pe))m(fe);else{alert("Invalid Embeddable Zone Host");return}}if(r===!1){if(fe){const Pe={instanceId:ye,authUrl:`${window.location.protocol}//${window.location.host}/mm-embedded-login?id=${ye}&origin=${fe}`,origin:fe};if(new URL(fe)?.protocol==="http:"){window.parent.postMessage({type:"login",...Pe},fe);return}e({mm_instanceId:Pe.instanceId,mm_authUrl:encodeURIComponent(Pe.authUrl),mm_origin:Pe.origin});return}e();return}ye&&g(ye),ye&&fe&&i(!0)},[c,r]),qi.useBlocker(({nextLocation:ee})=>n?ee.state?.fromParent?(h(!0),!1):(q(`${ee.pathname}${ee.search}`),!0):!1),be.useEffect(()=>{if(!n||!p)return;const ee=ye=>{ye.metaKey&&ye.key==="k"&&window.parent.postMessage({type:"open-search",instanceId:y},p)};return window.addEventListener("keydown",ee),()=>{window.removeEventListener("keydown",ee)}},[n,p]),be.useEffect(()=>{if(!n||!p)return;const ee=({origin:ye,data:fe})=>{if(ye===p)switch(fe.type){case"navigate":u(fe.path,{replace:!0,state:{fromParent:!0}});break;case"set-context":I(fe.context||{});break;case"set-configuring":P(fe.isConfiguring);break;case"set-params":T(fe.params);break;case"load-options":S.current[`option-${fe.name}`]?.({filter:fe.filter||""});break;case"validate":S.current[`validate-${fe.name}`]?.({value:fe.value});break;case"request":w.current[fe.requestType]?.(fe);break;case"response":S.current[fe.callbackId]?.(fe.response);break}};return window.addEventListener("message",ee),!f&&r&&window.parent.postMessage({type:"ready",instanceId:y},p),()=>{window.removeEventListener("message",ee)}},[u,f,n,r,p]);const q=(ee,ye)=>{!f&&!r||N("set-path",{path:ee,...ye})},$=ee=>{N("set-summary",{summary:ee})},K=ee=>{N("toast",{message:ee})},oe=ee=>{N("popup",{message:ee})},re=()=>{N("loaded")},Ee=async({header:ee,body:ye,choices:fe})=>f?new Promise(Pe=>{const Be=H0(),ht=async It=>{delete S.current[Be],Pe(It)};S.current[Be]=ht,N("confirm",{header:ee,body:ye,choices:fe,callbackId:Be})}):Promise.reject(new Error("Not ready")),ie=({requestType:ee,func:ye})=>{const fe=async({callbackId:Pe,data:Be})=>{try{const ht=await ye(Be);N("response",{callbackId:Pe,response:ht})}catch(ht){N("response",{callbackId:Pe,error:ht.message})}};return w.current[ee]=fe,N("mark-registered",{requestType:ee}),()=>{delete w.current[ee]}},me=({callbackId:ee,func:ye,responseType:fe="response",responseKey:Pe="response",props:Be={},callOnRegister:ht=!1})=>{const It=async tt=>{const Mt=await ye(tt);N(fe,{...Be,[Pe]:Mt,callbackId:ee})},ot=S.current[ee];S.current[ee]=It,ot&&ht&&It(Be)},we=(ee,ye)=>{if(f){if(ye.validate&&typeof ye.validate=="function"&&me({callbackId:`validate-${ee}`,func:ye.validate,responseType:"set-validation",responseKey:"validation",props:{name:ee}}),ye.options){const fe=typeof ye.options=="function"?ye.options:()=>ye.options;me({callbackId:`option-${ee}`,func:fe,responseType:"set-options",responseKey:"options",props:{name:ee},callOnRegister:!0})}N("add-setting",{setting:{name:ee,...ye,options:void 0,validate:void 0}})}},Te=be.useMemo(()=>({commands:{navigateParent:q,setSummary:$,toast:K,popup:oe,confirm:Ee,setLoaded:re,sendMessage:G},context:{...b,get colorMode(){throw new Error("colorMode has been moved to useMMAppParams")},get isFullScreen(){throw new Error("isFullScreen has been moved to useMMAppParams")}},params:{isEmbedded:n,isConfiguring:O,colorMode:b.colorMode,isFullScreen:b.isFullScreen,...D},addSetting:we,registerHandler:ie}),[n,O,q,$,K,oe,Ee,re,G,b,D,we,ie]);return nr.jsx(_i.Provider,{value:Te,children:c.pathname!=="/mm-embedded-interop"&&c.pathname!=="/mm-embedded-login"&&c.pathname!=="/mm-embedded-print"?t:nr.jsx(nr.Fragment,{})})},BI=()=>{const{urls:r,jwtRef:e,accessToken:t}=Xn(),{graphQLRoleOverride:n,children:i}=be.useContext(ac),[a,u]=be.useState(),[c,f]=be.useState(),h=()=>{const y=new URL(r.graphQLUrl);return`//${y.host}${y.pathname}`},p=()=>n?{"X-Hasura-Role":n}:{};be.useEffect(()=>{const y=new ZA(rI({url:`wss:${h()}`,lazy:!0,connectionParams:async()=>({headers:{Authorization:`Bearer ${e.current}`,...p()}})})),g=eb(({operation:P,networkError:D,forward:T})=>(Hi(P.query).operation==="subscription"&&D&&y.client.terminate(),T(P))),I=X0(async(P,{headers:D})=>({headers:{...D,Authorization:`Bearer ${e.current}`,...p()}})).concat(ff({uri:`https:${h()}`,fetch:window.fetch})),S=g.split(({query:P})=>{const D=Hi(P);return D.kind==="OperationDefinition"&&D.operation==="subscription"},y,I),O=X0(async(P,{headers:D})=>({headers:{...D,Authorization:`Bearer ${t}`}})).concat(new UI.RestLink({uri:r.apiUrl}));f(Yr.from([O,S]))},[]),be.useEffect(()=>{c&&u(new Mf({link:c,cache:new If}))},[c]);const m=be.useMemo(()=>({link:c}),[c]);return nr.jsx(k0.Provider,{value:m,children:a?nr.jsx(YO,{client:a,children:nr.jsx(pA,{children:nr.jsx($I,{children:i})})}):nr.jsx(nr.Fragment,{})})},VI=im.div`
|
|
132
132
|
text-align: center;
|
|
133
133
|
padding-top: 200px;
|
|
134
|
-
`,
|
|
134
|
+
`,rw=({loadError:r})=>{const e=QA();return r&&(!e||e.indexOf("mm-embedded-login")===-1)?nr.jsx(VI,{children:r}):(G0(),nr.jsx(qi.Navigate,{replace:!0,to:e||"/"}))};im.div`
|
|
135
135
|
font-size: 20px;
|
|
136
136
|
text-align: center;
|
|
137
137
|
margin-top: 300px;
|
|
138
|
-
`;const wI=()=>{const{isAuthenticated:r}=ti(),{authorize:e,authError:t,setAuthError:n}=le.useContext(rc);return bo(async i=>{try{await e(i)}catch(a){console.log(a),n("Login Failed. Try again.")}},[]),t?nr.jsx(Fb,{loadError:t}):r?nr.jsx(Fb,{}):nr.jsx(nr.Fragment,{})},xo={production:{loginUrl:"https://login.machinemetrics.com",appUrl:"https://app.machinemetrics.com",apiUrl:"https://api.machinemetrics.com",graphQLUrl:"https://graphql.machinemetrics.com/v1/graphql",natsUrl:"https://stream.machinemetrics.com"},staging:{loginUrl:"https://login-staging.machinemetrics.com",appUrl:"https://staging.machinemetrics.com",apiUrl:"https://api-staging.machinemetrics.com",graphQLUrl:"https://hasura.tsdb.perlman.m12s.com/v1/graphql",natsUrl:"https://stream.data.dev.m12s.com"},development:{loginUrl:"https://login.development.machinemetrics.com",appUrl:"https://app.development.machinemetrics.com",apiUrl:"https://api.development.machinemetrics.com",graphQLUrl:"https://hasura.tsdb.perlman.m12s.com/v1/graphql",natsUrl:"https://stream.data.dev.m12s.com"}},_I=pn.createBrowserRouter([{path:"/authorize/mm/callback",element:nr.jsx(wI,{})},{path:"/*",element:nr.jsx(vI,{})}]),xI=({domain:r,children:e,scope:t,clientId:n,clientSecret:i,releaseStage:a,device:u,graphQLRoleOverride:c,urls:f})=>{r&&console.warn("MMProvider domain is no longer used. It is inferred from the url.");const[h,d]=le.useState(),[y,g]=le.useState(!1);let m;if(xo[a])m=xo[a];else if(!m){const Ie=ci.keys(xo).join(", "),pe=ci.keys(xo[Object.keys(xo)[0]]);throw Error(`MMProvider releaseStage must be one of the following: ${Ie}, or the following urls need to be provided: ${pe}.`)}m=ci.merge(m,f);const[b,I]=le.useState(Sk());le.useEffect(()=>{Ek(b)},[b]);const x=Ie=>{const pe=A0();I0(pe),k0(window.location.pathname+window.location.search);const Pe=(We=>ci.map(We,(ke,X)=>`${X}=${ke}`).join("&"))({response_type:"code",state:pe,scope:t,ttl:1209600,client_id:n,...u!==void 0&&{device:u},redirect_uri:`${window.location.origin}/authorize/mm/callback`,...Ie}),ge=`${m.loginUrl}/oauth/authorize?${Pe}`;window.location=ge},_=async Ie=>{const pe=bk.parse(window.location.search),Ce=pe.code;if(pe.error)throw Error(pe.error_description);if(pe.state!==Tk())throw Error("Oops");const Pe={grant_type:"authorization_code",client_id:n,client_secret:i,code:Ce,redirect_uri:`${window.location.origin}/authorize/mm/callback`},ge=await C0(`${m.loginUrl}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:new URLSearchParams(Pe),signal:Ie});I(ge.access_token),I0()},A=()=>{I()},P=async(Ie,pe={})=>{pe.headers={...pe.headers,"Content-Type":"application/json",Authorization:`Bearer ${b}`};const Ce=await C0(Ie,pe);if(Ce.error&&Ce.error.status===401)throw await M(),Error("UNAUTHORIZED");return Ce},M=async()=>{await P(`${m.loginUrl}/logout`,{method:"DELETE"}),A()},[$,j]=le.useState(),K=le.useRef(),ee=le.useRef();wo(async()=>{if(!b){K.current=null,j(!1);return}try{const Ie=await P(`${m.apiUrl}/user-token?graphql=1`);K.current=Ie,j(!0)}catch{}},1e3*60*4.5,[b]),wo(async()=>{if(!b){ee.current=null;return}try{const Ie=await P(`${m.apiUrl}/nats-token`);ee.current=Ie}catch{}},1e3*60*9.5,[b]);const fe=le.useMemo(()=>({clientId:n,accessToken:b,jwtRef:K,natsCredsRef:ee,isAuthenticated:$,login:x,logout:M,request:P,urls:m}),[b,n,$,K,x,M,ee,P,m]),de=le.useMemo(()=>({children:e,graphQLRoleOverride:c,authorize:_,isEmbedded:y,setIsEmbedded:g,authError:h,setAuthError:d}),[e,c,_,y,g,h,d]);return nr.jsx(c0.Provider,{value:fe,children:nr.jsx(rc.Provider,{value:de,children:nr.jsx(pn.RouterProvider,{router:_I})})})},bn=new Uint8Array(0),Si=new TextEncoder,cn=new TextDecoder;function SI(...r){let e=0;for(let i=0;i<r.length;i++)e+=r[i].length;const t=new Uint8Array(e);let n=0;for(let i=0;i<r.length;i++)t.set(r[i],n),n+=r[i].length;return t}function So(...r){const e=[];for(let t=0;t<r.length;t++)e.push(Si.encode(r[t]));return e.length===0?bn:e.length===1?e[0]:SI(...e)}function Lb(r){return!r||r.length===0?"":cn.decode(r)}const qb="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",jb=36,EI=0xcfd41b9100000,Ub=33,OI=333,$b=22;function TI(r){for(let e=0;e<r.length;e++)r[e]=Math.floor(Math.random()*255)}function AI(r){var e;(e=globalThis==null?void 0:globalThis.crypto)!=null&&e.getRandomValues?globalThis.crypto.getRandomValues(r):TI(r)}class kI{constructor(){E(this,"buf");E(this,"seq");E(this,"inc");E(this,"inited");this.buf=new Uint8Array($b),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*EI),this.inc=Math.floor(Math.random()*(OI-Ub)+Ub)}setPre(){const e=new Uint8Array(12);AI(e);for(let t=0;t<12;t++){const n=e[t]%36;this.buf[t]=qb.charCodeAt(n)}}fillSeq(){let e=this.seq;for(let t=$b-1;t>=12;t--)this.buf[t]=qb.charCodeAt(e%jb),e=Math.floor(e/jb)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Cs=new kI;var Ei;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(Ei||(Ei={}));var pa;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(pa||(pa={}));var be;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(be||(be={}));function II(r){return typeof r.code=="string"}class Bb{constructor(){E(this,"messages");this.messages=new Map,this.messages.set(be.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(be.BadJson,"Bad JSON"),this.messages.set(be.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(e){return CI.getMessage(e)}getMessage(e){return this.messages.get(e)||e}}const CI=new Bb;class Re extends Error{constructor(t,n,i){super(t);E(this,"name");E(this,"message");E(this,"code");E(this,"permissionContext");E(this,"chainedError");E(this,"api_error");this.name="NatsError",this.message=t,this.code=n,this.chainedError=i}static errorForCode(t,n){const i=Bb.getMessage(t);return new Re(i,t,n)}isAuthError(){return this.code===be.AuthenticationExpired||this.code===be.AuthorizationViolation||this.code===be.AccountExpired}isAuthTimeout(){return this.code===be.AuthenticationTimeout}isPermissionError(){return this.code===be.PermissionsViolation}isProtocolError(){return this.code===be.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var wn;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(wn||(wn={}));var ri;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(ri||(ri={}));var Eo;(function(r){r.STATS="io.nats.micro.v1.stats_response",r.INFO="io.nats.micro.v1.info_response",r.PING="io.nats.micro.v1.ping_response"})(Eo||(Eo={}));const nc="Nats-Service-Error",ic="Nats-Service-Error-Code";class sc extends Error{constructor(t,n){super(n);E(this,"code");this.code=t}static isServiceError(t){return sc.toServiceError(t)!==null}static toServiceError(t){var i,a;const n=((i=t==null?void 0:t.headers)==null?void 0:i.get(ic))||"";if(n!==""){const u=parseInt(n)||400,c=((a=t==null?void 0:t.headers)==null?void 0:a.get(nc))||"";return new sc(u,c.length?c:n)}return null}}function Oi(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(e=>{if(e==="*"||e===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${Cs.next()}`}const ld="127.0.0.1";var ts;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(ts||(ts={}));function ac(r,...e){for(let t=0;t<e.length;t++){const n=e[t];Object.keys(n).forEach(function(i){r[i]=n[i]})}return r}function oc(r){return cn.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ma(r,e=!0){const t=e?Re.errorForCode(be.Timeout):null;let n,i;const a=new Promise((u,c)=>{n={cancel:()=>{i&&clearTimeout(i)}},i=setTimeout(()=>{c(t===null?Re.errorForCode(be.Timeout):t)},r)});return Object.assign(a,n)}function ya(r=0){let e;const t=new Promise(n=>{const i=setTimeout(()=>{n()},r);e={cancel:()=>{i&&clearTimeout(i)}}});return Object.assign(t,e)}function ir(){let r={};const e=new Promise((t,n)=>{r={resolve:t,reject:n}});return Object.assign(e,r)}function Vb(r){for(let e=r.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1));[r[e],r[t]]=[r[t],r[e]]}return r}function PI(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function fd(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const e=r.length-1;return{backoff(t){return PI(t>e?r[e]:r[t])}}}function cr(r){return r*1e6}function hd(r){return Math.floor(r/1e6)}function Wb(r){let n=!0;const i=new Array(r.length);for(let a=0;a<r.length;a++){let u=r.charCodeAt(a);if(u===58||u<33||u>126)throw new Re(`'${r[a]}' is not a valid character for a header key`,be.BadHeader);n&&97<=u&&u<=122?u-=32:!n&&65<=u&&u<=90&&(u+=32),i[a]=u,n=u==45}return String.fromCharCode(...i)}function Ti(r=0,e=""){if(r===0&&e!==""||r>0&&e==="")throw new Error("setting status requires both code and description");return new rs(r,e)}const dd="NATS/1.0";class rs{constructor(e=0,t=""){E(this,"_code");E(this,"headers");E(this,"_description");this._code=e,this._description=t,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(e){if(e&&this.headers.size===e.headers.size&&this._code===e._code){for(const[t,n]of this.headers){const i=e.values(t);if(n.length!==i.length)return!1;const a=[...n].sort(),u=[...i].sort();for(let c=0;c<a.length;c++)if(a[c]!==u[c])return!1}return!0}return!1}static decode(e){const t=new rs,i=cn.decode(e).split(`\r
|
|
139
|
-
`),a=i[0];if(a!==
|
|
138
|
+
`;const WI=()=>{const{isAuthenticated:r}=Xn(),{authorize:e,authError:t,setAuthError:n}=be.useContext(ac);return xo(async i=>{try{await e(i)}catch(a){console.log(a),n("Login Failed. Try again.")}},[]),t?nr.jsx(rw,{loadError:t}):r?nr.jsx(rw,{}):nr.jsx(nr.Fragment,{})},ko={production:{loginUrl:"https://login.machinemetrics.com",appUrl:"https://app.machinemetrics.com",apiUrl:"https://api.machinemetrics.com",graphQLUrl:"https://graphql.machinemetrics.com/v1/graphql",natsUrl:"https://stream.machinemetrics.com"},staging:{loginUrl:"https://login-staging.machinemetrics.com",appUrl:"https://staging.machinemetrics.com",apiUrl:"https://api-staging.machinemetrics.com",graphQLUrl:"https://hasura.tsdb.perlman.m12s.com/v1/graphql",natsUrl:"https://stream.data.dev.m12s.com"},development:{loginUrl:"https://login.development.machinemetrics.com",appUrl:"https://app.development.machinemetrics.com",apiUrl:"https://api.development.machinemetrics.com",graphQLUrl:"https://hasura.tsdb.perlman.m12s.com/v1/graphql",natsUrl:"https://stream.data.dev.m12s.com"}},zI=qi.createBrowserRouter([{path:"/authorize/mm/callback",element:nr.jsx(WI,{})},{path:"/*",element:nr.jsx(BI,{})}]),HI=({domain:r,children:e,scope:t,clientId:n,clientSecret:i,releaseStage:a,device:u,graphQLRoleOverride:c,urls:f})=>{r&&console.warn("MMProvider domain is no longer used. It is inferred from the url.");const[h,p]=be.useState(),[m,y]=be.useState(!1);let g;if(ko[a])g=ko[a];else if(!g){const ie=ui.keys(ko).join(", "),me=ui.keys(ko[Object.keys(ko)[0]]);throw Error(`MMProvider releaseStage must be one of the following: ${ie}, or the following urls need to be provided: ${me}.`)}g=ui.merge(g,f);const[b,I]=be.useState(HA());be.useEffect(()=>{GA(b)},[b]);const S=ie=>{const me=H0();Q0(me),G0(window.location.pathname+window.location.search);const Te=(ye=>ui.map(ye,(fe,Pe)=>`${Pe}=${fe}`).join("&"))({response_type:"code",state:me,scope:t,ttl:1209600,client_id:n,...u!==void 0&&{device:u},redirect_uri:`${window.location.origin}/authorize/mm/callback`,...ie}),ee=`${g.loginUrl}/oauth/authorize?${Te}`;window.location=ee},w=async ie=>{const me=BA.parse(window.location.search),we=me.code;if(me.error)throw Error(me.error_description);if(me.state!==JA())throw Error("Oops");const Te={grant_type:"authorization_code",client_id:n,client_secret:i,code:we,redirect_uri:`${window.location.origin}/authorize/mm/callback`},ee=await J0(`${g.loginUrl}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:new URLSearchParams(Te),signal:ie});I(ee.access_token),Q0()},O=()=>{I()},P=async(ie,me={})=>{me.headers={...me.headers,"Content-Type":"application/json",Authorization:`Bearer ${b}`};const we=await J0(ie,me);if(we.error&&we.error.status===401)throw await D(),Error("UNAUTHORIZED");return we},D=async()=>{await P(`${g.loginUrl}/logout`,{method:"DELETE"}),O()},[T,N]=be.useState(),[G,q]=be.useState(0),$=be.useRef(),K=be.useRef(),oe=()=>{q(ie=>ie+1)};Eo(async()=>{if(!b){$.current=null,N(!1);return}try{const ie=await P(`${g.apiUrl}/user-token?graphql=1`);$.current=ie,N(!0)}catch{}},1e3*60*4.5,[b,G]),Eo(async()=>{if(!b){K.current=null;return}try{const ie=await P(`${g.apiUrl}/nats-token`);K.current=ie}catch{}},1e3*60*9.5,[b]);const re=be.useMemo(()=>({clientId:n,accessToken:b,jwtRef:$,natsCredsRef:K,isAuthenticated:T,login:S,logout:D,request:P,refreshJwt:oe,urls:g}),[n,b,$,K,T,S,D,P,oe,g]),Ee=be.useMemo(()=>({children:e,graphQLRoleOverride:c,authorize:w,isEmbedded:m,setIsEmbedded:y,authError:h,setAuthError:p}),[e,c,w,m,y,h,p]);return nr.jsx(A0.Provider,{value:re,children:nr.jsx(ac.Provider,{value:Ee,children:nr.jsx(qi.RouterProvider,{router:zI})})})},gn=new Uint8Array(0),Ei=new TextEncoder,cn=new TextDecoder;function GI(...r){let e=0;for(let i=0;i<r.length;i++)e+=r[i].length;const t=new Uint8Array(e);let n=0;for(let i=0;i<r.length;i++)t.set(r[i],n),n+=r[i].length;return t}function Ao(...r){const e=[];for(let t=0;t<r.length;t++)e.push(Ei.encode(r[t]));return e.length===0?gn:e.length===1?e[0]:GI(...e)}function nw(r){return!r||r.length===0?"":cn.decode(r)}const iw="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",sw=36,QI=0xcfd41b9100000,aw=33,JI=333,ow=22;function YI(r){for(let e=0;e<r.length;e++)r[e]=Math.floor(Math.random()*255)}function KI(r){globalThis?.crypto?.getRandomValues?globalThis.crypto.getRandomValues(r):YI(r)}class ZI{buf;seq;inc;inited;constructor(){this.buf=new Uint8Array(ow),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*QI),this.inc=Math.floor(Math.random()*(JI-aw)+aw)}setPre(){const e=new Uint8Array(12);KI(e);for(let t=0;t<12;t++){const n=e[t]%36;this.buf[t]=iw.charCodeAt(n)}}fillSeq(){let e=this.seq;for(let t=ow-1;t>=12;t--)this.buf[t]=iw.charCodeAt(e%sw),e=Math.floor(e/sw)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const ns=new ZI;var Oi;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(Oi||(Oi={}));var ya;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(ya||(ya={}));var _e;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(_e||(_e={}));function XI(r){return typeof r.code=="string"}class uw{messages;constructor(){this.messages=new Map,this.messages.set(_e.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(_e.BadJson,"Bad JSON"),this.messages.set(_e.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(e){return eC.getMessage(e)}getMessage(e){return this.messages.get(e)||e}}const eC=new uw;class Me extends Error{name;message;code;permissionContext;chainedError;api_error;constructor(e,t,n){super(e),this.name="NatsError",this.message=e,this.code=t,this.chainedError=n}static errorForCode(e,t){const n=uw.getMessage(e);return new Me(n,e,t)}isAuthError(){return this.code===_e.AuthenticationExpired||this.code===_e.AuthorizationViolation||this.code===_e.AccountExpired}isAuthTimeout(){return this.code===_e.AuthenticationTimeout}isPermissionError(){return this.code===_e.PermissionsViolation}isProtocolError(){return this.code===_e.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var vn;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(vn||(vn={}));var ei;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(ei||(ei={}));var Io;(function(r){r.STATS="io.nats.micro.v1.stats_response",r.INFO="io.nats.micro.v1.info_response",r.PING="io.nats.micro.v1.ping_response"})(Io||(Io={}));const oc="Nats-Service-Error",uc="Nats-Service-Error-Code";class cc extends Error{code;constructor(e,t){super(t),this.code=e}static isServiceError(e){return cc.toServiceError(e)!==null}static toServiceError(e){const t=e?.headers?.get(uc)||"";if(t!==""){const n=parseInt(t)||400,i=e?.headers?.get(oc)||"";return new cc(n,i.length?i:t)}return null}}function Ti(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(e=>{if(e==="*"||e===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${ns.next()}`}const wd="127.0.0.1";var is;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(is||(is={}));function lc(r,...e){for(let t=0;t<e.length;t++){const n=e[t];Object.keys(n).forEach(function(i){r[i]=n[i]})}return r}function fc(r){return cn.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ga(r,e=!0){const t=e?Me.errorForCode(_e.Timeout):null;let n,i;const a=new Promise((u,c)=>{n={cancel:()=>{i&&clearTimeout(i)}},i=setTimeout(()=>{c(t===null?Me.errorForCode(_e.Timeout):t)},r)});return Object.assign(a,n)}function va(r=0){let e;const t=new Promise(n=>{const i=setTimeout(()=>{n()},r);e={cancel:()=>{i&&clearTimeout(i)}}});return Object.assign(t,e)}function ir(){let r={};const e=new Promise((t,n)=>{r={resolve:t,reject:n}});return Object.assign(e,r)}function cw(r){for(let e=r.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1));[r[e],r[t]]=[r[t],r[e]]}return r}function tC(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function _d(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const e=r.length-1;return{backoff(t){return tC(t>e?r[e]:r[t])}}}function sr(r){return r*1e6}function Sd(r){return Math.floor(r/1e6)}function lw(r){let n=!0;const i=new Array(r.length);for(let a=0;a<r.length;a++){let u=r.charCodeAt(a);if(u===58||u<33||u>126)throw new Me(`'${r[a]}' is not a valid character for a header key`,_e.BadHeader);n&&97<=u&&u<=122?u-=32:!n&&65<=u&&u<=90&&(u+=32),i[a]=u,n=u==45}return String.fromCharCode(...i)}function ki(r=0,e=""){if(r===0&&e!==""||r>0&&e==="")throw new Error("setting status requires both code and description");return new ss(r,e)}const xd="NATS/1.0";class ss{_code;headers;_description;constructor(e=0,t=""){this._code=e,this._description=t,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(e){if(e&&this.headers.size===e.headers.size&&this._code===e._code){for(const[t,n]of this.headers){const i=e.values(t);if(n.length!==i.length)return!1;const a=[...n].sort(),u=[...i].sort();for(let c=0;c<a.length;c++)if(a[c]!==u[c])return!1}return!0}return!1}static decode(e){const t=new ss,i=cn.decode(e).split(`\r
|
|
139
|
+
`),a=i[0];if(a!==xd){let u=a.replace(xd,"").trim();if(u.length>0){t._code=parseInt(u,10),isNaN(t._code)&&(t._code=0);const c=t._code.toString();u=u.replace(c,""),t._description=u.trim()}}return i.length>=1&&i.slice(1).map(u=>{if(u){const c=u.indexOf(":");if(c>-1){const f=u.slice(0,c),h=u.slice(c+1).trim();t.append(f,h)}}}),t}toString(){if(this.headers.size===0&&this._code===0)return"";let e=xd;this._code>0&&this._description!==""&&(e+=` ${this._code} ${this._description}`);for(const[t,n]of this.headers)for(let i=0;i<n.length;i++)e=`${e}\r
|
|
140
140
|
${t}: ${n[i]}`;return`${e}\r
|
|
141
141
|
\r
|
|
142
|
-
`}encode(){return
|
|
142
|
+
`}encode(){return Ei.encode(this.toString())}static validHeaderValue(e){if(/[\r\n]/.test(e))throw new Me("invalid header value - \\r and \\n are not allowed.",_e.BadHeader);return e.trim()}keys(){const e=[];for(const t of this.headers.keys())e.push(t);return e}findKeys(e,t=vn.Exact){const n=this.keys();switch(t){case vn.Exact:return n.filter(i=>i===e);case vn.CanonicalMIME:return e=lw(e),n.filter(i=>i===e);default:{const i=e.toLowerCase();return n.filter(a=>i===a.toLowerCase())}}}get(e,t=vn.Exact){const n=this.findKeys(e,t);if(n.length){const i=this.headers.get(n[0]);if(i)return Array.isArray(i)?i[0]:i}return""}last(e,t=vn.Exact){const n=this.findKeys(e,t);if(n.length){const i=this.headers.get(n[0]);if(i)return Array.isArray(i)?i[i.length-1]:i}return""}has(e,t=vn.Exact){return this.findKeys(e,t).length>0}set(e,t,n=vn.Exact){this.delete(e,n),this.append(e,t,n)}append(e,t,n=vn.Exact){const i=lw(e);n===vn.CanonicalMIME&&(e=i);const a=this.findKeys(e,n);e=a.length>0?a[0]:e;const u=ss.validHeaderValue(t);let c=this.headers.get(e);c||(c=[],this.headers.set(e,c)),c.push(u)}values(e,t=vn.Exact){const n=[];return this.findKeys(e,t).forEach(a=>{const u=this.headers.get(a);u&&n.push(...u)}),n}delete(e,t=vn.Exact){this.findKeys(e,t).forEach(i=>{this.headers.delete(i)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const e={};return this.keys().forEach(t=>{e[t]=this.values(t)}),e}get code(){return this._code}get description(){return this._description}static fromRecord(e){const t=new ss;for(const n in e)t.headers.set(n,e[n]);return t}}function fw(){return{encode(r){return Ei.encode(r)},decode(r){return cn.decode(r)}}}function Fn(r){return{encode(e){try{return e===void 0&&(e=null),Ei.encode(JSON.stringify(e))}catch(t){throw Me.errorForCode(_e.BadJson,t)}},decode(e){try{return JSON.parse(cn.decode(e),r)}catch(t){throw Me.errorForCode(_e.BadJson,t)}}}}function hw(r){return r&&r.data.length===0&&r.headers?.code===503?Me.errorForCode(_e.NoResponders):null}class dw{_headers;_msg;_rdata;_reply;_subject;publisher;static jc;constructor(e,t,n){this._msg=e,this._rdata=t,this.publisher=n}get subject(){return this._subject?this._subject:(this._subject=cn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=cn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const e=this._rdata.subarray(0,this._msg.hdr);this._headers=ss.decode(e)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(e=gn,t){return this.reply?(this.publisher.publish(this.reply,e,t),!0):!1}size(){const e=this._msg.subject.length,t=this._msg.reply?.length||0,n=this._msg.size===-1?0:this._msg.size;return e+t+n}json(e){return Fn(e).decode(this.data)}string(){return cn.decode(this.data)}requestInfo(){const e=this.headers?.get("Nats-Request-Info");return e?JSON.parse(e,function(t,n){return(t==="start"||t==="stop")&&n!==""?new Date(Date.parse(n)):n}):null}}function ba(r){return hc("durable",r)}function Zr(r){return hc("stream",r)}function hc(r,e=""){if(e==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
|
|
143
143
|
`,"\r"].forEach(n=>{if(e.indexOf(n)!==-1){switch(n){case`
|
|
144
|
-
`:n="\\n";break;case"\r":n="\\r";break;case" ":n="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${n}'`)}}),""}function Oo(r,e=""){if(e==="")throw Error(`${r} name required`);const t=NI(e);if(t.length)throw new Error(`invalid ${r} name - ${r} name ${t}`)}function NI(r=""){if(r==="")throw Error("name required");const e=/^[-\w]+$/g;if(r.match(e)===null){for(const n of r.split(""))if(n.match(e)===null)return`cannot contain '${n}'`}return""}function md(r){if(r.data.length>0)return!1;const e=r.headers;return e?e.code>=100&&e.code<200:!1}function yd(r){var e;return md(r)&&((e=r.headers)==null?void 0:e.description)==="Idle Heartbeat"}function RI(r,e,t){const n=Ti(r,e),i={hdr:1,sid:0,size:0},a=new pd(i,bn,{});return a._headers=n,a._subject=t,a}function va(r){if(r.data.length!==0)return null;const e=r.headers;return e?Gb(e.code,e.description):null}var qn;(function(r){r.MaxBatchExceeded="exceeded maxrequestbatch of",r.MaxExpiresExceeded="exceeded maxrequestexpires of",r.MaxBytesExceeded="exceeded maxrequestmaxbytes of",r.MaxMessageSizeExceeded="message size exceeds maxbytes",r.PushConsumer="consumer is push based",r.MaxWaitingExceeded="exceeded maxwaiting",r.IdleHeartbeatMissed="idle heartbeats missed",r.ConsumerDeleted="consumer deleted"})(qn||(qn={}));function MI(r){return r.code!==be.JetStream409?!1:[qn.MaxBatchExceeded,qn.MaxExpiresExceeded,qn.MaxBytesExceeded,qn.MaxMessageSizeExceeded,qn.PushConsumer,qn.IdleHeartbeatMissed,qn.ConsumerDeleted].find(t=>r.message.indexOf(t)!==-1)!==void 0}function Gb(r,e=""){if(r<300)return null;switch(e=e.toLowerCase(),r){case 404:return new Re(e,be.JetStream404NoMessages);case 408:return new Re(e,be.JetStream408RequestTimeout);case 409:{const t=e.startsWith(qn.IdleHeartbeatMissed)?be.JetStreamIdleHeartBeat:be.JetStream409;return new Re(e,t)}case 503:return Re.errorForCode(be.JetStreamNotEnabled,new Error(e));default:return e===""&&(e=be.Unknown),new Re(e,`${r}`)}}class Mr{constructor(){E(this,"inflight");E(this,"processed");E(this,"received");E(this,"noIterator");E(this,"iterClosed");E(this,"done");E(this,"signal");E(this,"yields");E(this,"filtered");E(this,"pendingFiltered");E(this,"ingestionFilterFn");E(this,"protocolFilterFn");E(this,"dispatchedFn");E(this,"ctx");E(this,"_data");E(this,"err");E(this,"time");E(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=ir(),this.yields=[],this.iterClosed=ir(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(e){if(this.done)return;if(typeof e=="function"){this.yields.push(e),this.signal.resolve();return}const{ingest:t,protocol:n}=this.ingestionFilterFn?this.ingestionFilterFn(e,this.ctx||this):{ingest:!0,protocol:!1};t&&(n&&(this.filtered++,this.pendingFiltered++),this.yields.push(e),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new Re("unsupported iterator",be.ApiError);if(this.yielding)throw new Re("already yielding",be.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const e=this.yields;this.inflight=e.length,this.yields=[];for(let t=0;t<e.length;t++){if(typeof e[t]=="function"){const i=e[t];try{i()}catch(a){throw a}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(e[t]):!0){this.processed++;const i=Date.now();yield e[t],this.time=Date.now()-i,this.dispatchedFn&&e[t]&&this.dispatchedFn(e[t])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=ir())}}finally{this.stop()}}stop(e){this.done||(this.err=e,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(e))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class gd{constructor(e,t,n={maxOut:2}){E(this,"interval");E(this,"maxOut");E(this,"cancelAfter");E(this,"timer");E(this,"autoCancelTimer");E(this,"last");E(this,"missed");E(this,"count");E(this,"callback");this.interval=e,this.maxOut=(n==null?void 0:n.maxOut)||2,this.cancelAfter=(n==null?void 0:n.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=t,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(e,t=0,n=2){this.interval=e,this.maxOut=n,this.cancelAfter=t,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(e){console.log(e)}},this.interval)}}var vd;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(vd||(vd={}));var To;(function(r){r.Old="old",r.New="new"})(To||(To={}));var bd;(function(r){r.File="file",r.Memory="memory"})(bd||(bd={}));var yr;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(yr||(yr={}));var Dr;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(Dr||(Dr={}));var ba;(function(r){r.Instant="instant",r.Original="original"})(ba||(ba={}));var ns;(function(r){r.None="none",r.S2="s2"})(ns||(ns={}));var cc;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(cc||(cc={}));function DI(r,e={}){return Object.assign({name:r,deliver_policy:yr.All,ack_policy:Dr.Explicit,ack_wait:cr(30*1e3),replay_policy:ba.Instant},e)}var Qb;(function(r){r.API="api_audit",r.StreamAction="stream_action",r.ConsumerAction="consumer_action",r.SnapshotCreate="snapshot_create",r.SnapshotComplete="snapshot_complete",r.RestoreCreate="restore_create",r.RestoreComplete="restore_complete",r.MaxDeliver="max_deliver",r.Terminated="terminated",r.Ack="consumer_ack",r.StreamLeaderElected="stream_leader_elected",r.StreamQuorumLost="stream_quorum_lost",r.ConsumerLeaderElected="consumer_leader_elected",r.ConsumerQuorumLost="consumer_quorum_lost"})(Qb||(Qb={}));var en;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(en||(en={}));var ni;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(ni||(ni={}));var wa;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(wa||(wa={}));var Jb;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(Jb||(Jb={}));const _n="KV_";class FI{constructor(e){E(this,"config");E(this,"ordered");E(this,"mack");E(this,"stream");E(this,"callbackFn");E(this,"max");E(this,"qname");E(this,"isBind");E(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=DI("",e||{})}getOpts(){var t;const e={};if(e.config=Object.assign({},this.config),e.config.filter_subject&&(this.filterSubject(e.config.filter_subject),e.config.filter_subject=void 0),e.config.filter_subjects&&((t=e.config.filter_subjects)==null||t.forEach(n=>{this.filterSubject(n)}),e.config.filter_subjects=void 0),e.mack=this.mack,e.stream=this.stream,e.callbackFn=this.callbackFn,e.max=this.max,e.queue=this.qname,e.ordered=this.ordered,e.config.ack_policy=e.ordered?Dr.None:e.config.ack_policy,e.isBind=e.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:e.config.filter_subject=this.filters[0];break;default:e.config.filter_subjects=this.filters}return e}description(e){return this.config.description=e,this}deliverTo(e){return this.config.deliver_subject=e,this}durable(e){return ga(e),this.config.durable_name=e,this}startSequence(e){if(e<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=yr.StartSequence,this.config.opt_start_seq=e,this}startTime(e){return this.config.deliver_policy=yr.StartTime,this.config.opt_start_time=e.toISOString(),this}deliverAll(){return this.config.deliver_policy=yr.All,this}deliverLastPerSubject(){return this.config.deliver_policy=yr.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=yr.Last,this}deliverNew(){return this.config.deliver_policy=yr.New,this}startAtTimeDelta(e){return this.startTime(new Date(Date.now()-e)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=Dr.None,this}ackAll(){return this.config.ack_policy=Dr.All,this}ackExplicit(){return this.config.ack_policy=Dr.Explicit,this}ackWait(e){return this.config.ack_wait=cr(e),this}maxDeliver(e){return this.config.max_deliver=e,this}filterSubject(e){return this.filters=this.filters||[],this.filters.push(e),this}replayInstantly(){return this.config.replay_policy=ba.Instant,this}replayOriginal(){return this.config.replay_policy=ba.Original,this}sample(e){if(e=Math.trunc(e),e<0||e>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${e}%`,this}limit(e){return this.config.rate_limit_bps=e,this}maxWaiting(e){return this.config.max_waiting=e,this}maxAckPending(e){return this.config.max_ack_pending=e,this}idleHeartbeat(e){return this.config.idle_heartbeat=cr(e),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(e){return this.queue(e),this}manualAck(){return this.mack=!0,this}maxMessages(e){return this.max=e,this}callback(e){return this.callbackFn=e,this}queue(e){return this.qname=e,this.config.deliver_group=e,this}orderedConsumer(){return this.ordered=!0,this}bind(e,t){return this.stream=e,this.config.durable_name=t,this.isBind=!0,this}bindStream(e){return this.stream=e,this}inactiveEphemeralThreshold(e){return this.config.inactive_threshold=cr(e),this}maxPullBatch(e){return this.config.max_batch=e,this}maxPullRequestExpires(e){return this.config.max_expires=cr(e),this}memory(){return this.config.mem_storage=!0,this}numReplicas(e){return this.config.num_replicas=e,this}consumerName(e){return this.config.name=e,this}}function is(r){return new FI(r)}function Yb(r){return typeof r.getOpts=="function"}class LI{static encode(e){if(typeof e=="string")return btoa(e);const t=Array.from(e);return btoa(String.fromCharCode(...t))}static decode(e,t=!1){const n=atob(e);return t?Uint8Array.from(n,i=>i.charCodeAt(0)):n}}class Ao{static encode(e){return Ao.toB64URLEncoding(LI.encode(e))}static decode(e,t=!1){return Ao.decode(Ao.fromB64URLEncoding(e),t)}static toB64URLEncoding(e){return e.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(e){return e.replace(/_/g,"/").replace(/-/g,"+")}}class _a{constructor(){E(this,"buffers");E(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...e){let t=0;for(let a=0;a<e.length;a++)t+=e[a].length;const n=new Uint8Array(t);let i=0;for(let a=0;a<e.length;a++)n.set(e[a],i),i+=e[a].length;return n}static fromAscii(e){return e||(e=""),Si.encode(e)}static toAscii(e){return cn.decode(e)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const e=new Uint8Array(this.byteLength);let t=0;for(let n=0;n<this.buffers.length;n++)e.set(this.buffers[n],t),t+=this.buffers[n].length;this.buffers.length=0,this.buffers.push(e)}}shift(){if(this.buffers.length){const e=this.buffers.shift();if(e)return this.byteLength-=e.length,e}return new Uint8Array(0)}drain(e){if(this.buffers.length){this.pack();const t=this.buffers.pop();if(t){const n=this.byteLength;(e===void 0||e>n)&&(e=n);const i=t.subarray(0,e);return n>e&&this.buffers.push(t.subarray(e)),this.byteLength=n-e,i}}return new Uint8Array(0)}fill(e,...t){e&&(this.buffers.push(e),this.byteLength+=e.length);for(let n=0;n<t.length;n++)t[n]&&t[n].length&&(this.buffers.push(t[n]),this.byteLength+=t[n].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function Kb(r){const e=r.length;let t=r.indexOf("=");t===-1&&(t=e);const n=t===e?0:4-t%4;return[t,n]}function qI(r,e,t=!1){function n(u,c){return Math.floor((u+c)*3/4-c)}function i(u){return r[u>>18&63]+r[u>>12&63]+r[u>>6&63]+r[u&63]}function a(u,c,f){const h=new Array((f-c)/3);for(let d=c,y=0;d<f;d+=3)h[y++]=i((u[d]<<16)+(u[d+1]<<8)+u[d+2]);return h.join("")}return{byteLength(u){return n.apply(null,Kb(u))},toUint8Array(u){const[c,f]=Kb(u),h=new Uint8Array(n(c,f)),d=f?c-4:c;let y,g=0,m;for(m=0;m<d;m+=4)y=e[u.charCodeAt(m)]<<18|e[u.charCodeAt(m+1)]<<12|e[u.charCodeAt(m+2)]<<6|e[u.charCodeAt(m+3)],h[g++]=y>>16&255,h[g++]=y>>8&255,h[g++]=y&255;return f===2?(y=e[u.charCodeAt(m)]<<2|e[u.charCodeAt(m+1)]>>4,h[g++]=y&255):f===1&&(y=e[u.charCodeAt(m)]<<10|e[u.charCodeAt(m+1)]<<4|e[u.charCodeAt(m+2)]>>2,h[g++]=y>>8&255,h[g++]=y&255),h},fromUint8Array(u){const f=u.length,h=f%3,d=f-h,y=new Array(Math.ceil(d/16383)+(h?1:0));let g=0,m;for(let I=0;I<d;I+=16383)m=I+16383,y[g++]=a(u,I,m>d?d:m);let b;return h===1?(b=u[d],y[g]=r[b>>2]+r[b<<4&63],t||(y[g]+="==")):h===2&&(b=u[d]<<8|u[d+1]&255,y[g]=r[b>>10]+r[b>>4&63]+r[b<<2&63],t||(y[g]+="=")),y.join("")}}}const Zb=[],Xb=[],wd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";for(let r=0,e=wd.length;r<e;++r)Zb[r]=wd[r],Xb[wd.charCodeAt(r)]=r;const{byteLength:YL,toUint8Array:jI,fromUint8Array:UI}=qI(Zb,Xb,!0),$I=new TextDecoder,BI=new TextEncoder;function VI(r){return r.reduce((e,t)=>`${e}${t<16?"0":""}${t.toString(16)}`,"")}function WI(r){const e=r.length;if(e%2||!/^[0-9a-fA-F]+$/.test(r))throw new TypeError("Invalid hex string.");r=r.toLowerCase();const t=new Uint8Array(Math.floor(e/2)),n=e/2;for(let i=0;i<n;++i)t[i]=parseInt(r.substr(i*2,2),16);return t}function zI(r,e="utf8"){if(/^utf-?8$/i.test(e))return $I.decode(r);if(/^base64$/i.test(e))return UI(r);if(/^hex(?:adecimal)?$/i.test(e))return VI(r);throw new TypeError("Unsupported string encoding.")}function HI(r,e="utf8"){if(/^utf-?8$/i.test(e))return BI.encode(r);if(/^base64$/i.test(e))return jI(r);if(/^hex(?:adecimal)?$/i.test(e))return WI(r);throw new TypeError("Unsupported string encoding.")}class ew{constructor(){E(this,"hashSize",32);E(this,"_buf");E(this,"_bufIdx");E(this,"_count");E(this,"_K");E(this,"_H");E(this,"_finalized");this._buf=new Uint8Array(64),this._K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),this.init()}init(){return this._H=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),this._bufIdx=0,this._count=new Uint32Array(2),this._buf.fill(0),this._finalized=!1,this}update(e,t){if(e===null)throw new TypeError("msg must be a string or Uint8Array.");typeof e=="string"&&(e=HI(e,t));for(let i=0,a=e.length;i<a;i++)this._buf[this._bufIdx++]=e[i],this._bufIdx===64&&(this._transform(),this._bufIdx=0);const n=this._count;return(n[0]+=e.length<<3)<e.length<<3&&n[1]++,n[1]+=e.length>>>29,this}digest(e){if(this._finalized)throw new Error("digest has already been called.");this._finalized=!0;const t=this._buf;let n=this._bufIdx;for(t[n++]=128;n!==56;)n===64&&(this._transform(),n=0),t[n++]=0;const i=this._count;t[56]=i[1]>>>24&255,t[57]=i[1]>>>16&255,t[58]=i[1]>>>8&255,t[59]=i[1]>>>0&255,t[60]=i[0]>>>24&255,t[61]=i[0]>>>16&255,t[62]=i[0]>>>8&255,t[63]=i[0]>>>0&255,this._transform();const a=new Uint8Array(32);for(let u=0;u<8;u++)a[(u<<2)+0]=this._H[u]>>>24&255,a[(u<<2)+1]=this._H[u]>>>16&255,a[(u<<2)+2]=this._H[u]>>>8&255,a[(u<<2)+3]=this._H[u]>>>0&255;return this.init(),e?zI(a,e):a}_transform(){const e=this._H;let t=e[0],n=e[1],i=e[2],a=e[3],u=e[4],c=e[5],f=e[6],h=e[7];const d=new Uint32Array(16);let y;for(y=0;y<16;y++)d[y]=this._buf[(y<<2)+3]|this._buf[(y<<2)+2]<<8|this._buf[(y<<2)+1]<<16|this._buf[y<<2]<<24;for(y=0;y<64;y++){let g;if(y<16)g=d[y];else{let m=d[y+1&15],b=d[y+14&15];g=d[y&15]=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(b>>>17^b>>>19^b>>>10^b<<15^b<<13)+d[y&15]+d[y+9&15]|0}g=g+h+(u>>>6^u>>>11^u>>>25^u<<26^u<<21^u<<7)+(f^u&(c^f))+this._K[y]|0,h=f,f=c,c=u,u=a+g,a=i,i=n,n=t,t=g+(n&i^a&(n^i))+(n>>>2^n>>>13^n>>>22^n<<30^n<<19^n<<10)|0}e[0]=e[0]+t|0,e[1]=e[1]+n|0,e[2]=e[2]+i|0,e[3]=e[3]+a|0,e[4]=e[4]+u|0,e[5]=e[5]+c|0,e[6]=e[6]+f|0,e[7]=e[7]+h|0}}class tw{constructor(e,t,n=!0){E(this,"token");E(this,"received");E(this,"ctx");E(this,"requestSubject");E(this,"mux");this.mux=e,this.requestSubject=t,this.received=0,this.token=Cs.next(),n&&(this.ctx=new Error)}}class GI extends tw{constructor(t,n,i={maxWait:1e3}){super(t,n);E(this,"callback");E(this,"done");E(this,"timer");E(this,"max");E(this,"opts");if(this.opts=i,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof i.maxMessages=="number"&&i.maxMessages>0?i.maxMessages:-1,this.done=ir(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},i.maxWait)}cancel(t){t&&this.callback(t,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(t,n){t?(this.ctx&&(t.stack+=`
|
|
144
|
+
`:n="\\n";break;case"\r":n="\\r";break;case" ":n="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${n}'`)}}),""}function Co(r,e=""){if(e==="")throw Error(`${r} name required`);const t=rC(e);if(t.length)throw new Error(`invalid ${r} name - ${r} name ${t}`)}function rC(r=""){if(r==="")throw Error("name required");const e=/^[-\w]+$/g;if(r.match(e)===null){for(const n of r.split(""))if(n.match(e)===null)return`cannot contain '${n}'`}return""}function Ed(r){if(r.data.length>0)return!1;const e=r.headers;return e?e.code>=100&&e.code<200:!1}function Od(r){return Ed(r)&&r.headers?.description==="Idle Heartbeat"}function nC(r,e,t){const n=ki(r,e),i={hdr:1,sid:0,size:0},a=new dw(i,gn,{});return a._headers=n,a._subject=t,a}function wa(r){if(r.data.length!==0)return null;const e=r.headers;return e?pw(e.code,e.description):null}var Ln;(function(r){r.MaxBatchExceeded="exceeded maxrequestbatch of",r.MaxExpiresExceeded="exceeded maxrequestexpires of",r.MaxBytesExceeded="exceeded maxrequestmaxbytes of",r.MaxMessageSizeExceeded="message size exceeds maxbytes",r.PushConsumer="consumer is push based",r.MaxWaitingExceeded="exceeded maxwaiting",r.IdleHeartbeatMissed="idle heartbeats missed",r.ConsumerDeleted="consumer deleted"})(Ln||(Ln={}));function iC(r){return r.code!==_e.JetStream409?!1:[Ln.MaxBatchExceeded,Ln.MaxExpiresExceeded,Ln.MaxBytesExceeded,Ln.MaxMessageSizeExceeded,Ln.PushConsumer,Ln.IdleHeartbeatMissed,Ln.ConsumerDeleted].find(t=>r.message.indexOf(t)!==-1)!==void 0}function pw(r,e=""){if(r<300)return null;switch(e=e.toLowerCase(),r){case 404:return new Me(e,_e.JetStream404NoMessages);case 408:return new Me(e,_e.JetStream408RequestTimeout);case 409:{const t=e.startsWith(Ln.IdleHeartbeatMissed)?_e.JetStreamIdleHeartBeat:_e.JetStream409;return new Me(e,t)}case 503:return Me.errorForCode(_e.JetStreamNotEnabled,new Error(e));default:return e===""&&(e=_e.Unknown),new Me(e,`${r}`)}}class Nr{inflight;processed;received;noIterator;iterClosed;done;signal;yields;filtered;pendingFiltered;ingestionFilterFn;protocolFilterFn;dispatchedFn;ctx;_data;err;time;yielding;constructor(){this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=ir(),this.yields=[],this.iterClosed=ir(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(e){if(this.done)return;if(typeof e=="function"){this.yields.push(e),this.signal.resolve();return}const{ingest:t,protocol:n}=this.ingestionFilterFn?this.ingestionFilterFn(e,this.ctx||this):{ingest:!0,protocol:!1};t&&(n&&(this.filtered++,this.pendingFiltered++),this.yields.push(e),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new Me("unsupported iterator",_e.ApiError);if(this.yielding)throw new Me("already yielding",_e.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const e=this.yields;this.inflight=e.length,this.yields=[];for(let t=0;t<e.length;t++){if(typeof e[t]=="function"){const i=e[t];try{i()}catch(a){throw a}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(e[t]):!0){this.processed++;const i=Date.now();yield e[t],this.time=Date.now()-i,this.dispatchedFn&&e[t]&&this.dispatchedFn(e[t])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=ir())}}finally{this.stop()}}stop(e){this.done||(this.err=e,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(e))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Td{interval;maxOut;cancelAfter;timer;autoCancelTimer;last;missed;count;callback;constructor(e,t,n={maxOut:2}){this.interval=e,this.maxOut=n?.maxOut||2,this.cancelAfter=n?.cancelAfter||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=t,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(e,t=0,n=2){this.interval=e,this.maxOut=n,this.cancelAfter=t,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(e){console.log(e)}},this.interval)}}var kd;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(kd||(kd={}));var Po;(function(r){r.Old="old",r.New="new"})(Po||(Po={}));var Ad;(function(r){r.File="file",r.Memory="memory"})(Ad||(Ad={}));var yr;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(yr||(yr={}));var Rr;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(Rr||(Rr={}));var _a;(function(r){r.Instant="instant",r.Original="original"})(_a||(_a={}));var as;(function(r){r.None="none",r.S2="s2"})(as||(as={}));var dc;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(dc||(dc={}));function sC(r,e={}){return Object.assign({name:r,deliver_policy:yr.All,ack_policy:Rr.Explicit,ack_wait:sr(30*1e3),replay_policy:_a.Instant},e)}var mw;(function(r){r.API="api_audit",r.StreamAction="stream_action",r.ConsumerAction="consumer_action",r.SnapshotCreate="snapshot_create",r.SnapshotComplete="snapshot_complete",r.RestoreCreate="restore_create",r.RestoreComplete="restore_complete",r.MaxDeliver="max_deliver",r.Terminated="terminated",r.Ack="consumer_ack",r.StreamLeaderElected="stream_leader_elected",r.StreamQuorumLost="stream_quorum_lost",r.ConsumerLeaderElected="consumer_leader_elected",r.ConsumerQuorumLost="consumer_quorum_lost"})(mw||(mw={}));var Xr;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Xr||(Xr={}));var ti;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(ti||(ti={}));var Sa;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(Sa||(Sa={}));var yw;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(yw||(yw={}));const bn="KV_";class aC{config;ordered;mack;stream;callbackFn;max;qname;isBind;filters;constructor(e){this.stream="",this.mack=!1,this.ordered=!1,this.config=sC("",e||{})}getOpts(){const e={};if(e.config=Object.assign({},this.config),e.config.filter_subject&&(this.filterSubject(e.config.filter_subject),e.config.filter_subject=void 0),e.config.filter_subjects&&(e.config.filter_subjects?.forEach(t=>{this.filterSubject(t)}),e.config.filter_subjects=void 0),e.mack=this.mack,e.stream=this.stream,e.callbackFn=this.callbackFn,e.max=this.max,e.queue=this.qname,e.ordered=this.ordered,e.config.ack_policy=e.ordered?Rr.None:e.config.ack_policy,e.isBind=e.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:e.config.filter_subject=this.filters[0];break;default:e.config.filter_subjects=this.filters}return e}description(e){return this.config.description=e,this}deliverTo(e){return this.config.deliver_subject=e,this}durable(e){return ba(e),this.config.durable_name=e,this}startSequence(e){if(e<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=yr.StartSequence,this.config.opt_start_seq=e,this}startTime(e){return this.config.deliver_policy=yr.StartTime,this.config.opt_start_time=e.toISOString(),this}deliverAll(){return this.config.deliver_policy=yr.All,this}deliverLastPerSubject(){return this.config.deliver_policy=yr.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=yr.Last,this}deliverNew(){return this.config.deliver_policy=yr.New,this}startAtTimeDelta(e){return this.startTime(new Date(Date.now()-e)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=Rr.None,this}ackAll(){return this.config.ack_policy=Rr.All,this}ackExplicit(){return this.config.ack_policy=Rr.Explicit,this}ackWait(e){return this.config.ack_wait=sr(e),this}maxDeliver(e){return this.config.max_deliver=e,this}filterSubject(e){return this.filters=this.filters||[],this.filters.push(e),this}replayInstantly(){return this.config.replay_policy=_a.Instant,this}replayOriginal(){return this.config.replay_policy=_a.Original,this}sample(e){if(e=Math.trunc(e),e<0||e>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${e}%`,this}limit(e){return this.config.rate_limit_bps=e,this}maxWaiting(e){return this.config.max_waiting=e,this}maxAckPending(e){return this.config.max_ack_pending=e,this}idleHeartbeat(e){return this.config.idle_heartbeat=sr(e),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(e){return this.queue(e),this}manualAck(){return this.mack=!0,this}maxMessages(e){return this.max=e,this}callback(e){return this.callbackFn=e,this}queue(e){return this.qname=e,this.config.deliver_group=e,this}orderedConsumer(){return this.ordered=!0,this}bind(e,t){return this.stream=e,this.config.durable_name=t,this.isBind=!0,this}bindStream(e){return this.stream=e,this}inactiveEphemeralThreshold(e){return this.config.inactive_threshold=sr(e),this}maxPullBatch(e){return this.config.max_batch=e,this}maxPullRequestExpires(e){return this.config.max_expires=sr(e),this}memory(){return this.config.mem_storage=!0,this}numReplicas(e){return this.config.num_replicas=e,this}consumerName(e){return this.config.name=e,this}}function os(r){return new aC(r)}function gw(r){return typeof r.getOpts=="function"}class oC{static encode(e){if(typeof e=="string")return btoa(e);const t=Array.from(e);return btoa(String.fromCharCode(...t))}static decode(e,t=!1){const n=atob(e);return t?Uint8Array.from(n,i=>i.charCodeAt(0)):n}}class xa{static encode(e){return xa.toB64URLEncoding(oC.encode(e))}static decode(e,t=!1){return xa.decode(xa.fromB64URLEncoding(e),t)}static toB64URLEncoding(e){return e.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(e){return e.replace(/_/g,"/").replace(/-/g,"+")}}class Ea{buffers;byteLength;constructor(){this.buffers=[],this.byteLength=0}static concat(...e){let t=0;for(let a=0;a<e.length;a++)t+=e[a].length;const n=new Uint8Array(t);let i=0;for(let a=0;a<e.length;a++)n.set(e[a],i),i+=e[a].length;return n}static fromAscii(e){return e||(e=""),Ei.encode(e)}static toAscii(e){return cn.decode(e)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const e=new Uint8Array(this.byteLength);let t=0;for(let n=0;n<this.buffers.length;n++)e.set(this.buffers[n],t),t+=this.buffers[n].length;this.buffers.length=0,this.buffers.push(e)}}shift(){if(this.buffers.length){const e=this.buffers.shift();if(e)return this.byteLength-=e.length,e}return new Uint8Array(0)}drain(e){if(this.buffers.length){this.pack();const t=this.buffers.pop();if(t){const n=this.byteLength;(e===void 0||e>n)&&(e=n);const i=t.subarray(0,e);return n>e&&this.buffers.push(t.subarray(e)),this.byteLength=n-e,i}}return new Uint8Array(0)}fill(e,...t){e&&(this.buffers.push(e),this.byteLength+=e.length);for(let n=0;n<t.length;n++)t[n]&&t[n].length&&(this.buffers.push(t[n]),this.byteLength+=t[n].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function uC(r,e){return e.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if(n!=="default"&&!(n in r)){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(r)}var cC=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},No=cC.performance||{};No.now||No.mozNow||No.msNow||No.oNow||No.webkitNow;var vw={versions:{}},lC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fC(r){if(r.__esModule)return r;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(t){var n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:function(){return r[t]}})}),e}var Id,pc={exports:{}},bw={},ww=fC(uC({__proto__:null,default:bw},[bw]));Id=pc,function(){var r="input is invalid type",e=typeof window=="object",t=e?window:{};t.JS_SHA256_NO_WINDOW&&(e=!1);var n=!e&&typeof self=="object",i=!t.JS_SHA256_NO_NODE_JS&&vw.versions&&vw.versions.node;i?t=lC:n&&(t=self);var a=!t.JS_SHA256_NO_COMMON_JS&&Id.exports,u=!t.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),f=[-2147483648,8388608,32768,128],h=[24,16,8,0],p=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],m=["hex","array","digest","arrayBuffer"],y=[];!t.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(T){return Object.prototype.toString.call(T)==="[object Array]"}),!u||!t.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(T){return typeof T=="object"&&T.buffer&&T.buffer.constructor===ArrayBuffer});var g=function(T,N){return function(G){return new O(N,!0).update(G)[T]()}},b=function(T){var N=g("hex",T);i&&(N=I(N,T)),N.create=function(){return new O(T)},N.update=function($){return N.create().update($)};for(var G=0;G<m.length;++G){var q=m[G];N[q]=g(q,T)}return N},I=function(T,N){var G,q=ww,$=ww.Buffer,K=N?"sha224":"sha256";return G=$.from&&!t.JS_SHA256_NO_BUFFER_FROM?$.from:function(oe){return new $(oe)},function(oe){if(typeof oe=="string")return q.createHash(K).update(oe,"utf8").digest("hex");if(oe==null)throw new Error(r);return oe.constructor===ArrayBuffer&&(oe=new Uint8Array(oe)),Array.isArray(oe)||ArrayBuffer.isView(oe)||oe.constructor===$?q.createHash(K).update(G(oe)).digest("hex"):T(oe)}},S=function(T,N){return function(G,q){return new P(G,N,!0).update(q)[T]()}},w=function(T){var N=S("hex",T);N.create=function($){return new P($,T)},N.update=function($,K){return N.create($).update(K)};for(var G=0;G<m.length;++G){var q=m[G];N[q]=S(q,T)}return N};function O(T,N){N?(y[0]=y[16]=y[1]=y[2]=y[3]=y[4]=y[5]=y[6]=y[7]=y[8]=y[9]=y[10]=y[11]=y[12]=y[13]=y[14]=y[15]=0,this.blocks=y):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],T?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=T}function P(T,N,G){var q,$=typeof T;if($==="string"){var K,oe=[],re=T.length,Ee=0;for(q=0;q<re;++q)(K=T.charCodeAt(q))<128?oe[Ee++]=K:K<2048?(oe[Ee++]=192|K>>>6,oe[Ee++]=128|63&K):K<55296||K>=57344?(oe[Ee++]=224|K>>>12,oe[Ee++]=128|K>>>6&63,oe[Ee++]=128|63&K):(K=65536+((1023&K)<<10|1023&T.charCodeAt(++q)),oe[Ee++]=240|K>>>18,oe[Ee++]=128|K>>>12&63,oe[Ee++]=128|K>>>6&63,oe[Ee++]=128|63&K);T=oe}else{if($!=="object")throw new Error(r);if(T===null)throw new Error(r);if(u&&T.constructor===ArrayBuffer)T=new Uint8Array(T);else if(!(Array.isArray(T)||u&&ArrayBuffer.isView(T)))throw new Error(r)}T.length>64&&(T=new O(N,!0).update(T).array());var ie=[],me=[];for(q=0;q<64;++q){var we=T[q]||0;ie[q]=92^we,me[q]=54^we}O.call(this,N,G),this.update(me),this.oKeyPad=ie,this.inner=!0,this.sharedMemory=G}O.prototype.update=function(T){if(!this.finalized){var N,G=typeof T;if(G!=="string"){if(G!=="object")throw new Error(r);if(T===null)throw new Error(r);if(u&&T.constructor===ArrayBuffer)T=new Uint8Array(T);else if(!(Array.isArray(T)||u&&ArrayBuffer.isView(T)))throw new Error(r);N=!0}for(var q,$,K=0,oe=T.length,re=this.blocks;K<oe;){if(this.hashed&&(this.hashed=!1,re[0]=this.block,this.block=re[16]=re[1]=re[2]=re[3]=re[4]=re[5]=re[6]=re[7]=re[8]=re[9]=re[10]=re[11]=re[12]=re[13]=re[14]=re[15]=0),N)for($=this.start;K<oe&&$<64;++K)re[$>>>2]|=T[K]<<h[3&$++];else for($=this.start;K<oe&&$<64;++K)(q=T.charCodeAt(K))<128?re[$>>>2]|=q<<h[3&$++]:q<2048?(re[$>>>2]|=(192|q>>>6)<<h[3&$++],re[$>>>2]|=(128|63&q)<<h[3&$++]):q<55296||q>=57344?(re[$>>>2]|=(224|q>>>12)<<h[3&$++],re[$>>>2]|=(128|q>>>6&63)<<h[3&$++],re[$>>>2]|=(128|63&q)<<h[3&$++]):(q=65536+((1023&q)<<10|1023&T.charCodeAt(++K)),re[$>>>2]|=(240|q>>>18)<<h[3&$++],re[$>>>2]|=(128|q>>>12&63)<<h[3&$++],re[$>>>2]|=(128|q>>>6&63)<<h[3&$++],re[$>>>2]|=(128|63&q)<<h[3&$++]);this.lastByteIndex=$,this.bytes+=$-this.start,$>=64?(this.block=re[16],this.start=$-64,this.hash(),this.hashed=!0):this.start=$}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},O.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var T=this.blocks,N=this.lastByteIndex;T[16]=this.block,T[N>>>2]|=f[3&N],this.block=T[16],N>=56&&(this.hashed||this.hash(),T[0]=this.block,T[16]=T[1]=T[2]=T[3]=T[4]=T[5]=T[6]=T[7]=T[8]=T[9]=T[10]=T[11]=T[12]=T[13]=T[14]=T[15]=0),T[14]=this.hBytes<<3|this.bytes>>>29,T[15]=this.bytes<<3,this.hash()}},O.prototype.hash=function(){var T,N,G,q,$,K,oe,re,Ee,ie=this.h0,me=this.h1,we=this.h2,Te=this.h3,ee=this.h4,ye=this.h5,fe=this.h6,Pe=this.h7,Be=this.blocks;for(T=16;T<64;++T)N=(($=Be[T-15])>>>7|$<<25)^($>>>18|$<<14)^$>>>3,G=(($=Be[T-2])>>>17|$<<15)^($>>>19|$<<13)^$>>>10,Be[T]=Be[T-16]+N+Be[T-7]+G|0;for(Ee=me&we,T=0;T<64;T+=4)this.first?(this.is224?(K=300032,Pe=($=Be[0]-1413257819)-150054599|0,Te=$+24177077|0):(K=704751109,Pe=($=Be[0]-210244248)-1521486534|0,Te=$+143694565|0),this.first=!1):(N=(ie>>>2|ie<<30)^(ie>>>13|ie<<19)^(ie>>>22|ie<<10),q=(K=ie&me)^ie&we^Ee,Pe=Te+($=Pe+(G=(ee>>>6|ee<<26)^(ee>>>11|ee<<21)^(ee>>>25|ee<<7))+(ee&ye^~ee&fe)+p[T]+Be[T])|0,Te=$+(N+q)|0),N=(Te>>>2|Te<<30)^(Te>>>13|Te<<19)^(Te>>>22|Te<<10),q=(oe=Te&ie)^Te&me^K,fe=we+($=fe+(G=(Pe>>>6|Pe<<26)^(Pe>>>11|Pe<<21)^(Pe>>>25|Pe<<7))+(Pe&ee^~Pe&ye)+p[T+1]+Be[T+1])|0,N=((we=$+(N+q)|0)>>>2|we<<30)^(we>>>13|we<<19)^(we>>>22|we<<10),q=(re=we&Te)^we&ie^oe,ye=me+($=ye+(G=(fe>>>6|fe<<26)^(fe>>>11|fe<<21)^(fe>>>25|fe<<7))+(fe&Pe^~fe&ee)+p[T+2]+Be[T+2])|0,N=((me=$+(N+q)|0)>>>2|me<<30)^(me>>>13|me<<19)^(me>>>22|me<<10),q=(Ee=me&we)^me&Te^re,ee=ie+($=ee+(G=(ye>>>6|ye<<26)^(ye>>>11|ye<<21)^(ye>>>25|ye<<7))+(ye&fe^~ye&Pe)+p[T+3]+Be[T+3])|0,ie=$+(N+q)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+ie|0,this.h1=this.h1+me|0,this.h2=this.h2+we|0,this.h3=this.h3+Te|0,this.h4=this.h4+ee|0,this.h5=this.h5+ye|0,this.h6=this.h6+fe|0,this.h7=this.h7+Pe|0},O.prototype.hex=function(){this.finalize();var T=this.h0,N=this.h1,G=this.h2,q=this.h3,$=this.h4,K=this.h5,oe=this.h6,re=this.h7,Ee=c[T>>>28&15]+c[T>>>24&15]+c[T>>>20&15]+c[T>>>16&15]+c[T>>>12&15]+c[T>>>8&15]+c[T>>>4&15]+c[15&T]+c[N>>>28&15]+c[N>>>24&15]+c[N>>>20&15]+c[N>>>16&15]+c[N>>>12&15]+c[N>>>8&15]+c[N>>>4&15]+c[15&N]+c[G>>>28&15]+c[G>>>24&15]+c[G>>>20&15]+c[G>>>16&15]+c[G>>>12&15]+c[G>>>8&15]+c[G>>>4&15]+c[15&G]+c[q>>>28&15]+c[q>>>24&15]+c[q>>>20&15]+c[q>>>16&15]+c[q>>>12&15]+c[q>>>8&15]+c[q>>>4&15]+c[15&q]+c[$>>>28&15]+c[$>>>24&15]+c[$>>>20&15]+c[$>>>16&15]+c[$>>>12&15]+c[$>>>8&15]+c[$>>>4&15]+c[15&$]+c[K>>>28&15]+c[K>>>24&15]+c[K>>>20&15]+c[K>>>16&15]+c[K>>>12&15]+c[K>>>8&15]+c[K>>>4&15]+c[15&K]+c[oe>>>28&15]+c[oe>>>24&15]+c[oe>>>20&15]+c[oe>>>16&15]+c[oe>>>12&15]+c[oe>>>8&15]+c[oe>>>4&15]+c[15&oe];return this.is224||(Ee+=c[re>>>28&15]+c[re>>>24&15]+c[re>>>20&15]+c[re>>>16&15]+c[re>>>12&15]+c[re>>>8&15]+c[re>>>4&15]+c[15&re]),Ee},O.prototype.toString=O.prototype.hex,O.prototype.digest=function(){this.finalize();var T=this.h0,N=this.h1,G=this.h2,q=this.h3,$=this.h4,K=this.h5,oe=this.h6,re=this.h7,Ee=[T>>>24&255,T>>>16&255,T>>>8&255,255&T,N>>>24&255,N>>>16&255,N>>>8&255,255&N,G>>>24&255,G>>>16&255,G>>>8&255,255&G,q>>>24&255,q>>>16&255,q>>>8&255,255&q,$>>>24&255,$>>>16&255,$>>>8&255,255&$,K>>>24&255,K>>>16&255,K>>>8&255,255&K,oe>>>24&255,oe>>>16&255,oe>>>8&255,255&oe];return this.is224||Ee.push(re>>>24&255,re>>>16&255,re>>>8&255,255&re),Ee},O.prototype.array=O.prototype.digest,O.prototype.arrayBuffer=function(){this.finalize();var T=new ArrayBuffer(this.is224?28:32),N=new DataView(T);return N.setUint32(0,this.h0),N.setUint32(4,this.h1),N.setUint32(8,this.h2),N.setUint32(12,this.h3),N.setUint32(16,this.h4),N.setUint32(20,this.h5),N.setUint32(24,this.h6),this.is224||N.setUint32(28,this.h7),T},P.prototype=new O,P.prototype.finalize=function(){if(O.prototype.finalize.call(this),this.inner){this.inner=!1;var T=this.array();O.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(T),O.prototype.finalize.call(this)}};var D=b();D.sha256=D,D.sha224=b(!0),D.sha256.hmac=w(),D.sha224.hmac=w(!0),a?Id.exports=D:(t.sha256=D.sha256,t.sha224=D.sha224)}(),pc.exports,pc.exports.sha224;var _w=pc.exports.sha256;function Cd(r){return gC(r)}function hC(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const t=/^[0-9A-F]+$/.test(r),n=/^[0-9a-f]+$/.test(r);return t||n?r.length%2===0:!1}function dC(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function pC(r){return hC(r)?"hex":dC(r)?"b64":""}function mC(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const e=new Uint8Array(r.length/2);for(let t=0;t<r.length;t+=2)e[t/2]=parseInt(r.substring(t,t+2),16);return e}function yC(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const e=atob(r);return Uint8Array.from(e,t=>t.charCodeAt(0))}function gC(r){switch(pC(r)){case"hex":return mC(r);case"b64":return yC(r)}return null}function vC(r,e){const t=typeof r=="string"?Cd(r):r,n=typeof e=="string"?Cd(e):e;if(t===null||n===null||t.length!==n.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==n[i])return!1;return!0}class Sw{token;received;ctx;requestSubject;mux;constructor(e,t,n=!0){this.mux=e,this.requestSubject=t,this.received=0,this.token=ns.next(),n&&(this.ctx=new Error)}}class bC extends Sw{callback;done;timer;max;opts;constructor(e,t,n={maxWait:1e3}){if(super(e,t),this.opts=n,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof n.maxMessages=="number"&&n.maxMessages>0?n.maxMessages:-1,this.done=ir(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},n.maxWait)}cancel(e){e&&this.callback(e,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(e,t){e?(this.ctx&&(e.stack+=`
|
|
145
145
|
|
|
146
|
-
${this.ctx.stack}`),this.cancel(
|
|
146
|
+
${this.ctx.stack}`),this.cancel(e)):(this.callback(null,t),this.opts.strategy===ei.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===ei.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===ei.SentinelMsg&&t&&t.data.length===0&&this.cancel())}}class xw extends Sw{deferred;timer;constructor(e,t,n={timeout:1e3},i=!0){super(e,t,i),this.deferred=ir(),this.timer=ga(n.timeout,i)}resolver(e,t){this.timer&&this.timer.cancel(),e?(this.ctx&&(e.stack+=`
|
|
147
147
|
|
|
148
|
-
${this.ctx.stack}`),this.deferred.reject(
|
|
149
|
-
`,fc=_a.fromAscii(lc),eC=new Uint8Array(fc)[0],tC=new Uint8Array(fc)[1];function rC(r){for(let e=0;e<r.length;e++){const t=e+1;if(r.byteLength>t&&r[e]===eC&&r[t]===tC)return t+1}return 0}function nC(r){const e=rC(r);if(e>0){const n=new Uint8Array(r).slice(0,e);return cn.decode(n)}return""}const iC=4,iw=48,sC=65,aC=97;function oC(r,e,t,n){const i=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((u,c)=>{i[c]=u}),i[12]=r,i[13]=e,i[14]=t,i[15]=n,i}function Od(r){return uC(r)!==void 0}function uC(r){for(let e=0;e<r.length;e++)switch(r[e]){case".":return sw(r);case":":return cC(r)}}function sw(r){const e=new Uint8Array(4);for(let t=0;t<4;t++){if(r.length===0)return;if(t>0){if(r[0]!==".")return;r=r.substring(1)}const{n,c:i,ok:a}=lC(r);if(!a||n>255)return;r=r.substring(i),e[t]=n}return oC(e[0],e[1],e[2],e[3])}function cC(r){const e=new Uint8Array(16);let t=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(t=0,r=r.substring(2),r.length===0))return e;let n=0;for(;n<16;){const{n:i,c:a,ok:u}=fC(r);if(!u||i>65535)return;if(a<r.length&&r[a]==="."){if(t<0&&n!=12||n+4>16)return;const c=sw(r);if(c===void 0)return;e[n]=c[12],e[n+1]=c[13],e[n+2]=c[14],e[n+3]=c[15],r="",n+=iC;break}if(e[n]=i>>8,e[n+1]=i,n+=2,r=r.substring(a),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(t>=0)return;if(t=n,r=r.substring(1),r.length===0)break}}if(r.length===0){if(n<16){if(t<0)return;const i=16-n;for(let a=n-1;a>=t;a--)e[a+i]=e[a];for(let a=t+i-1;a>=t;a--)e[a]=0}else if(t>=0)return;return e}}function lC(r){let e=0,t=0;for(e=0;e<r.length&&48<=r.charCodeAt(e)&&r.charCodeAt(e)<=57;e++)if(t=t*10+(r.charCodeAt(e)-iw),t>=16777215)return{n:16777215,c:e,ok:!1};return e===0?{n:0,c:0,ok:!1}:{n:t,c:e,ok:!0}}function fC(r){let e=0,t=0;for(t=0;t<r.length;t++){if(48<=r.charCodeAt(t)&&r.charCodeAt(t)<=57)e*=16,e+=r.charCodeAt(t)-iw;else if(97<=r.charCodeAt(t)&&r.charCodeAt(t)<=102)e*=16,e+=r.charCodeAt(t)-aC+10;else if(65<=r.charCodeAt(t)&&r.charCodeAt(t)<=70)e*=16,e+=r.charCodeAt(t)-sC+10;else break;if(e>=16777215)return{n:0,c:t,ok:!1}}return t===0?{n:0,c:t,ok:!1}:{n:e,c:t,ok:!0}}function hC(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Td(r){return!hC(r)}function dC(r){const e="::FFFF:",t=r.toUpperCase().indexOf(e);if(t!==-1&&r.indexOf(".")!==-1){let n=r.substring(t+e.length);return n=n.replace("[",""),n.replace("]","")}return r}function pC(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=dC(r),Td(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const e=Td(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),t=e&&e.length===3&&e[1]&&e[2]?parseInt(e[2]):4222,n=t===80?"https":"http",i=new URL(`${n}://${r}`);i.port=`${t}`;let a=i.hostname;return a.charAt(0)==="["&&(a=a.substring(1,a.length-1)),{listen:i.host,hostname:a,port:t}}class Co{constructor(e,t=!1){E(this,"src");E(this,"listen");E(this,"hostname");E(this,"port");E(this,"didConnect");E(this,"reconnects");E(this,"lastConnect");E(this,"gossiped");E(this,"tlsName");E(this,"resolves");this.src=e,this.tlsName="";const n=pC(e);this.listen=n.listen,this.hostname=n.hostname,this.port=n.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=t}toString(){return this.listen}async resolve(e){if(!e.fn||e.resolve===!1)return[this];const t=[];if(Od(this.hostname))return[this];{const n=await e.fn(this.hostname);e.debug&&console.log(`resolve ${this.hostname} = ${n.join(",")}`);for(const i of n){const a=this.port===80?"https":"http",u=new URL(`${a}://${Td(i)?"["+i+"]":i}`);u.port=`${this.port}`;const c=new Co(u.host,!1);c.tlsName=this.hostname,t.push(c)}}return e.randomize&&Vb(t),this.resolves=t,t}}class mC{constructor(e=[],t={}){E(this,"firstSelect");E(this,"servers");E(this,"currentServer");E(this,"tlsName");E(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=t.randomize||!1;const n=Sd();e&&(e.forEach(i=>{i=n?n(i):i,this.servers.push(new Co(i))}),this.randomize&&(this.servers=Vb(this.servers))),this.servers.length===0&&this.addServer(`${ld}:${nw()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const e=this.getCurrentServer();Od(e.hostname)||(this.tlsName=e.hostname,this.servers.forEach(t=>{t.gossiped&&(t.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(e,t=!1){const n=Sd();e=n?n(e):e;const i=new Co(e,t);Od(i.hostname)&&(i.tlsName=this.tlsName),this.servers.push(i)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const e=this.servers.shift();return e&&(this.servers.push(e),this.currentServer=e),e}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(e){if(e){const t=this.servers.indexOf(e);this.servers.splice(t,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(e,t){const n=[];let i=[];const a=Sd(),u=new Map;e.connect_urls&&e.connect_urls.length>0&&e.connect_urls.forEach(f=>{f=a?a(f,t):f;const h=new Co(f,!0);u.set(f,h)});const c=[];return this.servers.forEach((f,h)=>{const d=f.listen;f.gossiped&&this.currentServer.listen!==d&&u.get(d)===void 0&&c.push(h),u.delete(d)}),c.reverse(),c.forEach(f=>{const h=this.servers.splice(f,1);i=i.concat(h[0].listen)}),u.forEach((f,h)=>{this.servers.push(f),n.push(h)}),{added:n,deleted:i}}}class yC{constructor(){E(this,"baseInbox");E(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${Oi(e)}.`,this.baseInbox}add(e){isNaN(e.received)||(e.received=0),this.reqs.set(e.token,e)}get(e){return this.reqs.get(e)}cancel(e){this.reqs.delete(e.token)}getToken(e){const t=e.subject||"";return t.indexOf(this.baseInbox)===0?t.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(e,t){if(t&&t.permissionContext){if(e)return this.all().forEach(i=>{i.resolver(t,{})}),!0;const n=t.permissionContext;if(n.operation==="publish"){const i=this.all().find(a=>a.requestSubject===n.subject);if(i)return i.resolver(t,{}),!0}}return!1}dispatcher(){return(e,t)=>{const n=this.getToken(t);if(n){const i=this.get(n);i&&(e===null&&t.headers&&(e=Hb(t)),i.resolver(e,t))}}}close(){const e=Re.errorForCode(be.Timeout);this.reqs.forEach(t=>{t.resolver(e,{})})}}class gC{constructor(e,t,n){E(this,"ph");E(this,"interval");E(this,"maxOut");E(this,"timer");E(this,"pendings");this.ph=e,this.interval=t,this.maxOut=n,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(e){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),e&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:pa.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const e=ir();this.ph.flush(e).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(e),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(e=>(e.resolve(),!1))}}class vC extends Error{constructor(e){super(e),this.name="AssertionError"}}function bC(r,e="Assertion failed."){if(!r)throw new vC(e)}const aw=32*1024,Ad=2**32-2;function hc(r,e,t=0){const n=e.byteLength-t;return r.byteLength>n&&(r=r.subarray(0,n)),e.set(r,t),r.byteLength}class kd{constructor(e){E(this,"_buf");E(this,"_off");if(this._off=0,e==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(e)}bytes(e={copy:!0}){return e.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(e){if(e===0){this.reset();return}if(e<0||e>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+e)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(e){const t=this._buf.byteLength;return e<=this.capacity-t?(this._reslice(t+e),t):-1}_reslice(e){bC(e<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,e)}readByte(){const e=new Uint8Array(1);return this.read(e)?e[0]:null}read(e){if(this.empty())return this.reset(),e.byteLength===0?0:null;const t=hc(this._buf.subarray(this._off),e);return this._off+=t,t}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(Si.encode(e))}write(e){const t=this._grow(e.byteLength);return hc(e,this._buf,t)}_grow(e){const t=this.length;t===0&&this._off!==0&&this.reset();const n=this._tryGrowByReslice(e);if(n>=0)return n;const i=this.capacity;if(e<=Math.floor(i/2)-t)hc(this._buf.subarray(this._off),this._buf);else{if(i+e>Ad)throw new Error("The buffer cannot be grown beyond the maximum size.");{const a=new Uint8Array(Math.min(2*i+e,Ad));hc(this._buf.subarray(this._off),a),this._buf=a}}return this._off=0,this._reslice(Math.min(t+e,Ad)),t}grow(e){if(e<0)throw Error("Buffer._grow: negative count");const t=this._grow(e);this._reslice(t)}readFrom(e){let t=0;const n=new Uint8Array(aw);for(;;){const i=this.capacity-this.length<aw,a=i?n:new Uint8Array(this._buf.buffer,this.length),u=e.read(a);if(u===null)return t;i?this.write(a.subarray(0,u)):this._reslice(this.length+u),t+=u}}}var tn;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(tn||(tn={}));function ow(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const wC=48;class uw{constructor(e){E(this,"dispatcher");E(this,"state");E(this,"as");E(this,"drop");E(this,"hdr");E(this,"ma");E(this,"argBuf");E(this,"msgBuf");this.dispatcher=e,this.state=Ee.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(e){let t;for(t=0;t<e.length;t++){const n=e[t];switch(this.state){case Ee.OP_START:switch(n){case Oe.M:case Oe.m:this.state=Ee.OP_M,this.hdr=-1,this.ma=ow();break;case Oe.H:case Oe.h:this.state=Ee.OP_H,this.hdr=0,this.ma=ow();break;case Oe.P:case Oe.p:this.state=Ee.OP_P;break;case Oe.PLUS:this.state=Ee.OP_PLUS;break;case Oe.MINUS:this.state=Ee.OP_MINUS;break;case Oe.I:case Oe.i:this.state=Ee.OP_I;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_H:switch(n){case Oe.M:case Oe.m:this.state=Ee.OP_M;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_M:switch(n){case Oe.S:case Oe.s:this.state=Ee.OP_MS;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_MS:switch(n){case Oe.G:case Oe.g:this.state=Ee.OP_MSG;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_MSG:switch(n){case Oe.SPACE:case Oe.TAB:this.state=Ee.OP_MSG_SPC;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_MSG_SPC:switch(n){case Oe.SPACE:case Oe.TAB:continue;default:this.state=Ee.MSG_ARG,this.as=t}break;case Ee.MSG_ARG:switch(n){case Oe.CR:this.drop=1;break;case Oe.NL:{const i=this.argBuf?this.argBuf.bytes():e.subarray(this.as,t-this.drop);this.processMsgArgs(i),this.drop=0,this.as=t+1,this.state=Ee.MSG_PAYLOAD,t=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;case Ee.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const i=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:tn.MSG,msg:this.ma,data:i}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ee.MSG_END}else{let i=this.ma.size-this.msgBuf.length;const a=e.length-t;a<i&&(i=a),i>0?(this.msgBuf.write(e.subarray(t,t+i)),t=t+i-1):this.msgBuf.writeByte(n)}else t-this.as>=this.ma.size&&(this.dispatcher.push({kind:tn.MSG,msg:this.ma,data:e.subarray(this.as,t)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ee.MSG_END);break;case Ee.MSG_END:switch(n){case Oe.NL:this.drop=0,this.as=t+1,this.state=Ee.OP_START;break;default:continue}break;case Ee.OP_PLUS:switch(n){case Oe.O:case Oe.o:this.state=Ee.OP_PLUS_O;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_PLUS_O:switch(n){case Oe.K:case Oe.k:this.state=Ee.OP_PLUS_OK;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_PLUS_OK:switch(n){case Oe.NL:this.dispatcher.push({kind:tn.OK}),this.drop=0,this.state=Ee.OP_START;break}break;case Ee.OP_MINUS:switch(n){case Oe.E:case Oe.e:this.state=Ee.OP_MINUS_E;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_MINUS_E:switch(n){case Oe.R:case Oe.r:this.state=Ee.OP_MINUS_ER;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_MINUS_ER:switch(n){case Oe.R:case Oe.r:this.state=Ee.OP_MINUS_ERR;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_MINUS_ERR:switch(n){case Oe.SPACE:case Oe.TAB:this.state=Ee.OP_MINUS_ERR_SPC;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_MINUS_ERR_SPC:switch(n){case Oe.SPACE:case Oe.TAB:continue;default:this.state=Ee.MINUS_ERR_ARG,this.as=t}break;case Ee.MINUS_ERR_ARG:switch(n){case Oe.CR:this.drop=1;break;case Oe.NL:{let i;this.argBuf?(i=this.argBuf.bytes(),this.argBuf=void 0):i=e.subarray(this.as,t-this.drop),this.dispatcher.push({kind:tn.ERR,data:i}),this.drop=0,this.as=t+1,this.state=Ee.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(n))}break;case Ee.OP_P:switch(n){case Oe.I:case Oe.i:this.state=Ee.OP_PI;break;case Oe.O:case Oe.o:this.state=Ee.OP_PO;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_PO:switch(n){case Oe.N:case Oe.n:this.state=Ee.OP_PON;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_PON:switch(n){case Oe.G:case Oe.g:this.state=Ee.OP_PONG;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_PONG:switch(n){case Oe.NL:this.dispatcher.push({kind:tn.PONG}),this.drop=0,this.state=Ee.OP_START;break}break;case Ee.OP_PI:switch(n){case Oe.N:case Oe.n:this.state=Ee.OP_PIN;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_PIN:switch(n){case Oe.G:case Oe.g:this.state=Ee.OP_PING;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_PING:switch(n){case Oe.NL:this.dispatcher.push({kind:tn.PING}),this.drop=0,this.state=Ee.OP_START;break}break;case Ee.OP_I:switch(n){case Oe.N:case Oe.n:this.state=Ee.OP_IN;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_IN:switch(n){case Oe.F:case Oe.f:this.state=Ee.OP_INF;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_INF:switch(n){case Oe.O:case Oe.o:this.state=Ee.OP_INFO;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_INFO:switch(n){case Oe.SPACE:case Oe.TAB:this.state=Ee.OP_INFO_SPC;break;default:throw this.fail(e.subarray(t))}break;case Ee.OP_INFO_SPC:switch(n){case Oe.SPACE:case Oe.TAB:continue;default:this.state=Ee.INFO_ARG,this.as=t}break;case Ee.INFO_ARG:switch(n){case Oe.CR:this.drop=1;break;case Oe.NL:{let i;this.argBuf?(i=this.argBuf.bytes(),this.argBuf=void 0):i=e.subarray(this.as,t-this.drop),this.dispatcher.push({kind:tn.INFO,data:i}),this.drop=0,this.as=t+1,this.state=Ee.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;default:throw this.fail(e.subarray(t))}}(this.state===Ee.MSG_ARG||this.state===Ee.MINUS_ERR_ARG||this.state===Ee.INFO_ARG)&&!this.argBuf&&(this.argBuf=new kd(e.subarray(this.as,t-this.drop))),this.state===Ee.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new kd(e.subarray(this.as)))}cloneMsgArg(){const e=this.ma.subject.length,t=this.ma.reply?this.ma.reply.length:0,n=new Uint8Array(e+t);n.set(this.ma.subject),this.ma.reply&&n.set(this.ma.reply,e),this.argBuf=new kd(n),this.ma.subject=n.subarray(0,e),this.ma.reply&&(this.ma.reply=n.subarray(e))}processMsgArgs(e){if(this.hdr>=0)return this.processHeaderMsgArgs(e);const t=[];let n=-1;for(let i=0;i<e.length;i++)switch(e[i]){case Oe.SPACE:case Oe.TAB:case Oe.CR:case Oe.NL:n>=0&&(t.push(e.subarray(n,i)),n=-1);break;default:n<0&&(n=i)}switch(n>=0&&t.push(e.subarray(n)),t.length){case 3:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(t[2]);break;case 4:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=t[2],this.ma.size=this.protoParseInt(t[3]);break;default:throw this.fail(e,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(e,"processMsgArgs Bad or Missing Size Error")}fail(e,t=""){return t?t=`${t} [${this.state}]`:t=`parse error [${this.state}]`,new Error(`${t}: ${cn.decode(e)}`)}processHeaderMsgArgs(e){const t=[];let n=-1;for(let i=0;i<e.length;i++)switch(e[i]){case Oe.SPACE:case Oe.TAB:case Oe.CR:case Oe.NL:n>=0&&(t.push(e.subarray(n,i)),n=-1);break;default:n<0&&(n=i)}switch(n>=0&&t.push(e.subarray(n)),t.length){case 4:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(t[2]),this.ma.size=this.protoParseInt(t[3]);break;case 5:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=t[2],this.ma.hdr=this.protoParseInt(t[3]),this.ma.size=this.protoParseInt(t[4]);break;default:throw this.fail(e,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(e){if(e.length===0)return-1;let t=0;for(let n=0;n<e.length;n++){if(e[n]<48||e[n]>57)return-1;t=t*10+(e[n]-wC)}return t}}var Ee;(function(r){r[r.OP_START=0]="OP_START",r[r.OP_PLUS=1]="OP_PLUS",r[r.OP_PLUS_O=2]="OP_PLUS_O",r[r.OP_PLUS_OK=3]="OP_PLUS_OK",r[r.OP_MINUS=4]="OP_MINUS",r[r.OP_MINUS_E=5]="OP_MINUS_E",r[r.OP_MINUS_ER=6]="OP_MINUS_ER",r[r.OP_MINUS_ERR=7]="OP_MINUS_ERR",r[r.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",r[r.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",r[r.OP_M=10]="OP_M",r[r.OP_MS=11]="OP_MS",r[r.OP_MSG=12]="OP_MSG",r[r.OP_MSG_SPC=13]="OP_MSG_SPC",r[r.MSG_ARG=14]="MSG_ARG",r[r.MSG_PAYLOAD=15]="MSG_PAYLOAD",r[r.MSG_END=16]="MSG_END",r[r.OP_H=17]="OP_H",r[r.OP_P=18]="OP_P",r[r.OP_PI=19]="OP_PI",r[r.OP_PIN=20]="OP_PIN",r[r.OP_PING=21]="OP_PING",r[r.OP_PO=22]="OP_PO",r[r.OP_PON=23]="OP_PON",r[r.OP_PONG=24]="OP_PONG",r[r.OP_I=25]="OP_I",r[r.OP_IN=26]="OP_IN",r[r.OP_INF=27]="OP_INF",r[r.OP_INFO=28]="OP_INFO",r[r.OP_INFO_SPC=29]="OP_INFO_SPC",r[r.INFO_ARG=30]="INFO_ARG"})(Ee||(Ee={}));var Oe;(function(r){r[r.CR=13]="CR",r[r.E=69]="E",r[r.e=101]="e",r[r.F=70]="F",r[r.f=102]="f",r[r.G=71]="G",r[r.g=103]="g",r[r.H=72]="H",r[r.h=104]="h",r[r.I=73]="I",r[r.i=105]="i",r[r.K=75]="K",r[r.k=107]="k",r[r.M=77]="M",r[r.m=109]="m",r[r.MINUS=45]="MINUS",r[r.N=78]="N",r[r.n=110]="n",r[r.NL=10]="NL",r[r.O=79]="O",r[r.o=111]="o",r[r.P=80]="P",r[r.p=112]="p",r[r.PLUS=43]="PLUS",r[r.R=82]="R",r[r.r=114]="r",r[r.S=83]="S",r[r.s=115]="s",r[r.SPACE=32]="SPACE",r[r.TAB=9]="TAB"})(Oe||(Oe={})),function(r){var e=function(w,k){this.hi=w|0,this.lo=k|0},t=function(w){var k,T=new Float64Array(16);if(w)for(k=0;k<w.length;k++)T[k]=w[k];return T},n=function(){throw new Error("no PRNG")},i=new Uint8Array(16),a=new Uint8Array(32);a[0]=9;var u=t(),c=t([1]),f=t([56129,1]),h=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),y=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),g=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),m=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function b(w,k){return w<<k|w>>>32-k}function I(w,k){var T=w[k+3]&255;return T=T<<8|w[k+2]&255,T=T<<8|w[k+1]&255,T<<8|w[k+0]&255}function x(w,k){var T=w[k]<<24|w[k+1]<<16|w[k+2]<<8|w[k+3],C=w[k+4]<<24|w[k+5]<<16|w[k+6]<<8|w[k+7];return new e(T,C)}function _(w,k,T){var C;for(C=0;C<4;C++)w[k+C]=T&255,T>>>=8}function A(w,k,T){w[k]=T.hi>>24&255,w[k+1]=T.hi>>16&255,w[k+2]=T.hi>>8&255,w[k+3]=T.hi&255,w[k+4]=T.lo>>24&255,w[k+5]=T.lo>>16&255,w[k+6]=T.lo>>8&255,w[k+7]=T.lo&255}function P(w,k,T,C,D){var B,ie=0;for(B=0;B<D;B++)ie|=w[k+B]^T[C+B];return(1&ie-1>>>8)-1}function M(w,k,T,C){return P(w,k,T,C,16)}function $(w,k,T,C){return P(w,k,T,C,32)}function j(w,k,T,C,D){var B=new Uint32Array(16),ie=new Uint32Array(16),he=new Uint32Array(16),Y=new Uint32Array(4),ne,Le,_t;for(ne=0;ne<4;ne++)ie[5*ne]=I(C,4*ne),ie[1+ne]=I(T,4*ne),ie[6+ne]=I(k,4*ne),ie[11+ne]=I(T,16+4*ne);for(ne=0;ne<16;ne++)he[ne]=ie[ne];for(ne=0;ne<20;ne++){for(Le=0;Le<4;Le++){for(_t=0;_t<4;_t++)Y[_t]=ie[(5*Le+4*_t)%16];for(Y[1]^=b(Y[0]+Y[3]|0,7),Y[2]^=b(Y[1]+Y[0]|0,9),Y[3]^=b(Y[2]+Y[1]|0,13),Y[0]^=b(Y[3]+Y[2]|0,18),_t=0;_t<4;_t++)B[4*Le+(Le+_t)%4]=Y[_t]}for(_t=0;_t<16;_t++)ie[_t]=B[_t]}if(D){for(ne=0;ne<16;ne++)ie[ne]=ie[ne]+he[ne]|0;for(ne=0;ne<4;ne++)ie[5*ne]=ie[5*ne]-I(C,4*ne)|0,ie[6+ne]=ie[6+ne]-I(k,4*ne)|0;for(ne=0;ne<4;ne++)_(w,4*ne,ie[5*ne]),_(w,16+4*ne,ie[6+ne])}else for(ne=0;ne<16;ne++)_(w,4*ne,ie[ne]+he[ne]|0)}function K(w,k,T,C){return j(w,k,T,C,!1),0}function ee(w,k,T,C){return j(w,k,T,C,!0),0}var fe=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function de(w,k,T,C,D,B,ie){var he=new Uint8Array(16),Y=new Uint8Array(64),ne,Le;if(!D)return 0;for(Le=0;Le<16;Le++)he[Le]=0;for(Le=0;Le<8;Le++)he[Le]=B[Le];for(;D>=64;){for(K(Y,he,ie,fe),Le=0;Le<64;Le++)w[k+Le]=(T?T[C+Le]:0)^Y[Le];for(ne=1,Le=8;Le<16;Le++)ne=ne+(he[Le]&255)|0,he[Le]=ne&255,ne>>>=8;D-=64,k+=64,T&&(C+=64)}if(D>0)for(K(Y,he,ie,fe),Le=0;Le<D;Le++)w[k+Le]=(T?T[C+Le]:0)^Y[Le];return 0}function Ie(w,k,T,C,D){return de(w,k,null,0,T,C,D)}function pe(w,k,T,C,D){var B=new Uint8Array(32);return ee(B,C,D,fe),Ie(w,k,T,C.subarray(16),B)}function Ce(w,k,T,C,D,B,ie){var he=new Uint8Array(32);return ee(he,B,ie,fe),de(w,k,T,C,D,B.subarray(16),he)}function Pe(w,k){var T,C=0;for(T=0;T<17;T++)C=C+(w[T]+k[T]|0)|0,w[T]=C&255,C>>>=8}var ge=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function We(w,k,T,C,D,B){var ie,he,Y,ne,Le=new Uint32Array(17),_t=new Uint32Array(17),tr=new Uint32Array(17),En=new Uint32Array(17),ki=new Uint32Array(17);for(Y=0;Y<17;Y++)_t[Y]=tr[Y]=0;for(Y=0;Y<16;Y++)_t[Y]=B[Y];for(_t[3]&=15,_t[4]&=252,_t[7]&=15,_t[8]&=252,_t[11]&=15,_t[12]&=252,_t[15]&=15;D>0;){for(Y=0;Y<17;Y++)En[Y]=0;for(Y=0;Y<16&&Y<D;++Y)En[Y]=T[C+Y];for(En[Y]=1,C+=Y,D-=Y,Pe(tr,En),he=0;he<17;he++)for(Le[he]=0,Y=0;Y<17;Y++)Le[he]=Le[he]+tr[Y]*(Y<=he?_t[he-Y]:320*_t[he+17-Y]|0)|0|0;for(he=0;he<17;he++)tr[he]=Le[he];for(ne=0,Y=0;Y<16;Y++)ne=ne+tr[Y]|0,tr[Y]=ne&255,ne>>>=8;for(ne=ne+tr[16]|0,tr[16]=ne&3,ne=5*(ne>>>2)|0,Y=0;Y<16;Y++)ne=ne+tr[Y]|0,tr[Y]=ne&255,ne>>>=8;ne=ne+tr[16]|0,tr[16]=ne}for(Y=0;Y<17;Y++)ki[Y]=tr[Y];for(Pe(tr,ge),ie=-(tr[16]>>>7)|0,Y=0;Y<17;Y++)tr[Y]^=ie&(ki[Y]^tr[Y]);for(Y=0;Y<16;Y++)En[Y]=B[Y+16];for(En[16]=0,Pe(tr,En),Y=0;Y<16;Y++)w[k+Y]=tr[Y];return 0}function ke(w,k,T,C,D,B){var ie=new Uint8Array(16);return We(ie,0,T,C,D,B),M(w,k,ie,0)}function X(w,k,T,C,D){var B;if(T<32)return-1;for(Ce(w,0,k,0,T,C,D),We(w,16,w,32,T-32,w),B=0;B<16;B++)w[B]=0;return 0}function ye(w,k,T,C,D){var B,ie=new Uint8Array(32);if(T<32||(pe(ie,0,32,C,D),ke(k,16,k,32,T-32,ie)!==0))return-1;for(Ce(w,0,k,0,T,C,D),B=0;B<32;B++)w[B]=0;return 0}function xe(w,k){var T;for(T=0;T<16;T++)w[T]=k[T]|0}function Se(w){var k,T;for(T=0;T<16;T++)w[T]+=65536,k=Math.floor(w[T]/65536),w[(T+1)*(T<15?1:0)]+=k-1+37*(k-1)*(T===15?1:0),w[T]-=k*65536}function Be(w,k,T){for(var C,D=~(T-1),B=0;B<16;B++)C=D&(w[B]^k[B]),w[B]^=C,k[B]^=C}function Ke(w,k){var T,C,D,B=t(),ie=t();for(T=0;T<16;T++)ie[T]=k[T];for(Se(ie),Se(ie),Se(ie),C=0;C<2;C++){for(B[0]=ie[0]-65517,T=1;T<15;T++)B[T]=ie[T]-65535-(B[T-1]>>16&1),B[T-1]&=65535;B[15]=ie[15]-32767-(B[14]>>16&1),D=B[15]>>16&1,B[14]&=65535,Be(ie,B,1-D)}for(T=0;T<16;T++)w[2*T]=ie[T]&255,w[2*T+1]=ie[T]>>8}function Et(w,k){var T=new Uint8Array(32),C=new Uint8Array(32);return Ke(T,w),Ke(C,k),$(T,0,C,0)}function Tt(w){var k=new Uint8Array(32);return Ke(k,w),k[0]&1}function Ze(w,k){var T;for(T=0;T<16;T++)w[T]=k[2*T]+(k[2*T+1]<<8);w[15]&=32767}function Je(w,k,T){var C;for(C=0;C<16;C++)w[C]=k[C]+T[C]|0}function vt(w,k,T){var C;for(C=0;C<16;C++)w[C]=k[C]-T[C]|0}function De(w,k,T){var C,D,B=new Float64Array(31);for(C=0;C<31;C++)B[C]=0;for(C=0;C<16;C++)for(D=0;D<16;D++)B[C+D]+=k[C]*T[D];for(C=0;C<15;C++)B[C]+=38*B[C+16];for(C=0;C<16;C++)w[C]=B[C];Se(w),Se(w)}function Ge(w,k){De(w,k,k)}function V(w,k){var T=t(),C;for(C=0;C<16;C++)T[C]=k[C];for(C=253;C>=0;C--)Ge(T,T),C!==2&&C!==4&&De(T,T,k);for(C=0;C<16;C++)w[C]=T[C]}function Q(w,k){var T=t(),C;for(C=0;C<16;C++)T[C]=k[C];for(C=250;C>=0;C--)Ge(T,T),C!==1&&De(T,T,k);for(C=0;C<16;C++)w[C]=T[C]}function q(w,k,T){var C=new Uint8Array(32),D=new Float64Array(80),B,ie,he=t(),Y=t(),ne=t(),Le=t(),_t=t(),tr=t();for(ie=0;ie<31;ie++)C[ie]=k[ie];for(C[31]=k[31]&127|64,C[0]&=248,Ze(D,T),ie=0;ie<16;ie++)Y[ie]=D[ie],Le[ie]=he[ie]=ne[ie]=0;for(he[0]=Le[0]=1,ie=254;ie>=0;--ie)B=C[ie>>>3]>>>(ie&7)&1,Be(he,Y,B),Be(ne,Le,B),Je(_t,he,ne),vt(he,he,ne),Je(ne,Y,Le),vt(Y,Y,Le),Ge(Le,_t),Ge(tr,he),De(he,ne,he),De(ne,Y,_t),Je(_t,he,ne),vt(he,he,ne),Ge(Y,he),vt(ne,Le,tr),De(he,ne,f),Je(he,he,Le),De(ne,ne,he),De(he,Le,tr),De(Le,Y,D),Ge(Y,_t),Be(he,Y,B),Be(ne,Le,B);for(ie=0;ie<16;ie++)D[ie+16]=he[ie],D[ie+32]=ne[ie],D[ie+48]=Y[ie],D[ie+64]=Le[ie];var En=D.subarray(32),ki=D.subarray(16);return V(En,En),De(ki,ki,En),Ke(w,ki),0}function J(w,k){return q(w,k,a)}function te(w,k){return n(k,32),J(w,k)}function W(w,k,T){var C=new Uint8Array(32);return q(C,T,k),ee(w,i,C,fe)}var _e=X,ze=ye;function $e(w,k,T,C,D,B){var ie=new Uint8Array(32);return W(ie,D,B),_e(w,k,T,C,ie)}function se(w,k,T,C,D,B){var ie=new Uint8Array(32);return W(ie,D,B),ze(w,k,T,C,ie)}function we(){var w=0,k=0,T=0,C=0,D=65535,B,ie,he;for(he=0;he<arguments.length;he++)B=arguments[he].lo,ie=arguments[he].hi,w+=B&D,k+=B>>>16,T+=ie&D,C+=ie>>>16;return k+=w>>>16,T+=k>>>16,C+=T>>>16,new e(T&D|C<<16,w&D|k<<16)}function Qe(w,k){return new e(w.hi>>>k,w.lo>>>k|w.hi<<32-k)}function mt(){var w=0,k=0,T;for(T=0;T<arguments.length;T++)w^=arguments[T].lo,k^=arguments[T].hi;return new e(k,w)}function yt(w,k){var T,C,D=32-k;return k<32?(T=w.hi>>>k|w.lo<<D,C=w.lo>>>k|w.hi<<D):k<64&&(T=w.lo>>>k|w.hi<<D,C=w.hi>>>k|w.lo<<D),new e(T,C)}function Yt(w,k,T){var C=w.hi&k.hi^~w.hi&T.hi,D=w.lo&k.lo^~w.lo&T.lo;return new e(C,D)}function At(w,k,T){var C=w.hi&k.hi^w.hi&T.hi^k.hi&T.hi,D=w.lo&k.lo^w.lo&T.lo^k.lo&T.lo;return new e(C,D)}function Wt(w){return mt(yt(w,28),yt(w,34),yt(w,39))}function Gt(w){return mt(yt(w,14),yt(w,18),yt(w,41))}function Er(w){return mt(yt(w,1),yt(w,8),Qe(w,7))}function zt(w){return mt(yt(w,19),yt(w,61),Qe(w,6))}var sr=[new e(1116352408,3609767458),new e(1899447441,602891725),new e(3049323471,3964484399),new e(3921009573,2173295548),new e(961987163,4081628472),new e(1508970993,3053834265),new e(2453635748,2937671579),new e(2870763221,3664609560),new e(3624381080,2734883394),new e(310598401,1164996542),new e(607225278,1323610764),new e(1426881987,3590304994),new e(1925078388,4068182383),new e(2162078206,991336113),new e(2614888103,633803317),new e(3248222580,3479774868),new e(3835390401,2666613458),new e(4022224774,944711139),new e(264347078,2341262773),new e(604807628,2007800933),new e(770255983,1495990901),new e(1249150122,1856431235),new e(1555081692,3175218132),new e(1996064986,2198950837),new e(2554220882,3999719339),new e(2821834349,766784016),new e(2952996808,2566594879),new e(3210313671,3203337956),new e(3336571891,1034457026),new e(3584528711,2466948901),new e(113926993,3758326383),new e(338241895,168717936),new e(666307205,1188179964),new e(773529912,1546045734),new e(1294757372,1522805485),new e(1396182291,2643833823),new e(1695183700,2343527390),new e(1986661051,1014477480),new e(2177026350,1206759142),new e(2456956037,344077627),new e(2730485921,1290863460),new e(2820302411,3158454273),new e(3259730800,3505952657),new e(3345764771,106217008),new e(3516065817,3606008344),new e(3600352804,1432725776),new e(4094571909,1467031594),new e(275423344,851169720),new e(430227734,3100823752),new e(506948616,1363258195),new e(659060556,3750685593),new e(883997877,3785050280),new e(958139571,3318307427),new e(1322822218,3812723403),new e(1537002063,2003034995),new e(1747873779,3602036899),new e(1955562222,1575990012),new e(2024104815,1125592928),new e(2227730452,2716904306),new e(2361852424,442776044),new e(2428436474,593698344),new e(2756734187,3733110249),new e(3204031479,2999351573),new e(3329325298,3815920427),new e(3391569614,3928383900),new e(3515267271,566280711),new e(3940187606,3454069534),new e(4118630271,4000239992),new e(116418474,1914138554),new e(174292421,2731055270),new e(289380356,3203993006),new e(460393269,320620315),new e(685471733,587496836),new e(852142971,1086792851),new e(1017036298,365543100),new e(1126000580,2618297676),new e(1288033470,3409855158),new e(1501505948,4234509866),new e(1607167915,987167468),new e(1816402316,1246189591)];function dr(w,k,T){var C=[],D=[],B=[],ie=[],he,Y,ne;for(Y=0;Y<8;Y++)C[Y]=B[Y]=x(w,8*Y);for(var Le=0;T>=128;){for(Y=0;Y<16;Y++)ie[Y]=x(k,8*Y+Le);for(Y=0;Y<80;Y++){for(ne=0;ne<8;ne++)D[ne]=B[ne];for(he=we(B[7],Gt(B[4]),Yt(B[4],B[5],B[6]),sr[Y],ie[Y%16]),D[7]=we(he,Wt(B[0]),At(B[0],B[1],B[2])),D[3]=we(D[3],he),ne=0;ne<8;ne++)B[(ne+1)%8]=D[ne];if(Y%16===15)for(ne=0;ne<16;ne++)ie[ne]=we(ie[ne],ie[(ne+9)%16],Er(ie[(ne+1)%16]),zt(ie[(ne+14)%16]))}for(Y=0;Y<8;Y++)B[Y]=we(B[Y],C[Y]),C[Y]=B[Y];Le+=128,T-=128}for(Y=0;Y<8;Y++)A(w,8*Y,C[Y]);return T}var Ar=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function Ht(w,k,T){var C=new Uint8Array(64),D=new Uint8Array(256),B,ie=T;for(B=0;B<64;B++)C[B]=Ar[B];for(dr(C,k,T),T%=128,B=0;B<256;B++)D[B]=0;for(B=0;B<T;B++)D[B]=k[ie-T+B];for(D[T]=128,T=256-128*(T<112?1:0),D[T-9]=0,A(D,T-8,new e(ie/536870912|0,ie<<3)),dr(C,D,T),B=0;B<64;B++)w[B]=C[B];return 0}function H(w,k){var T=t(),C=t(),D=t(),B=t(),ie=t(),he=t(),Y=t(),ne=t(),Le=t();vt(T,w[1],w[0]),vt(Le,k[1],k[0]),De(T,T,Le),Je(C,w[0],w[1]),Je(Le,k[0],k[1]),De(C,C,Le),De(D,w[3],k[3]),De(D,D,d),De(B,w[2],k[2]),Je(B,B,B),vt(ie,C,T),vt(he,B,D),Je(Y,B,D),Je(ne,C,T),De(w[0],ie,he),De(w[1],ne,Y),De(w[2],Y,he),De(w[3],ie,ne)}function G(w,k,T){var C;for(C=0;C<4;C++)Be(w[C],k[C],T)}function at(w,k){var T=t(),C=t(),D=t();V(D,k[2]),De(T,k[0],D),De(C,k[1],D),Ke(w,C),w[31]^=Tt(T)<<7}function wt(w,k,T){var C,D;for(xe(w[0],u),xe(w[1],c),xe(w[2],c),xe(w[3],u),D=255;D>=0;--D)C=T[D/8|0]>>(D&7)&1,G(w,k,C),H(k,w),H(w,w),G(w,k,C)}function ft(w,k){var T=[t(),t(),t(),t()];xe(T[0],y),xe(T[1],g),xe(T[2],c),De(T[3],y,g),wt(w,T,k)}function He(w,k,T){var C=new Uint8Array(64),D=[t(),t(),t(),t()],B;for(T||n(k,32),Ht(C,k,32),C[0]&=248,C[31]&=127,C[31]|=64,ft(D,C),at(w,D),B=0;B<32;B++)k[B+32]=w[B];return 0}var Kt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Zt(w,k){var T,C,D,B;for(C=63;C>=32;--C){for(T=0,D=C-32,B=C-12;D<B;++D)k[D]+=T-16*k[C]*Kt[D-(C-32)],T=Math.floor((k[D]+128)/256),k[D]-=T*256;k[D]+=T,k[C]=0}for(T=0,D=0;D<32;D++)k[D]+=T-(k[31]>>4)*Kt[D],T=k[D]>>8,k[D]&=255;for(D=0;D<32;D++)k[D]-=T*Kt[D];for(C=0;C<32;C++)k[C+1]+=k[C]>>8,w[C]=k[C]&255}function Qt(w){var k=new Float64Array(64),T;for(T=0;T<64;T++)k[T]=w[T];for(T=0;T<64;T++)w[T]=0;Zt(w,k)}function kr(w,k,T,C){var D=new Uint8Array(64),B=new Uint8Array(64),ie=new Uint8Array(64),he,Y,ne=new Float64Array(64),Le=[t(),t(),t(),t()];Ht(D,C,32),D[0]&=248,D[31]&=127,D[31]|=64;var _t=T+64;for(he=0;he<T;he++)w[64+he]=k[he];for(he=0;he<32;he++)w[32+he]=D[32+he];for(Ht(ie,w.subarray(32),T+32),Qt(ie),ft(Le,ie),at(w,Le),he=32;he<64;he++)w[he]=C[he];for(Ht(B,w,T+64),Qt(B),he=0;he<64;he++)ne[he]=0;for(he=0;he<32;he++)ne[he]=ie[he];for(he=0;he<32;he++)for(Y=0;Y<32;Y++)ne[he+Y]+=B[he]*D[Y];return Zt(w.subarray(32),ne),_t}function Hr(w,k){var T=t(),C=t(),D=t(),B=t(),ie=t(),he=t(),Y=t();return xe(w[2],c),Ze(w[1],k),Ge(D,w[1]),De(B,D,h),vt(D,D,w[2]),Je(B,w[2],B),Ge(ie,B),Ge(he,ie),De(Y,he,ie),De(T,Y,D),De(T,T,B),Q(T,T),De(T,T,D),De(T,T,B),De(T,T,B),De(w[0],T,B),Ge(C,w[0]),De(C,C,B),Et(C,D)&&De(w[0],w[0],m),Ge(C,w[0]),De(C,C,B),Et(C,D)?-1:(Tt(w[0])===k[31]>>7&&vt(w[0],u,w[0]),De(w[3],w[0],w[1]),0)}function Fr(w,k,T,C){var D,B=new Uint8Array(32),ie=new Uint8Array(64),he=[t(),t(),t(),t()],Y=[t(),t(),t(),t()];if(T<64||Hr(Y,C))return-1;for(D=0;D<T;D++)w[D]=k[D];for(D=0;D<32;D++)w[D+32]=C[D];if(Ht(ie,w,T),Qt(ie),wt(he,Y,ie),ft(Y,k.subarray(32)),H(he,Y),at(B,he),T-=64,$(k,0,B,0)){for(D=0;D<T;D++)w[D]=0;return-1}for(D=0;D<T;D++)w[D]=k[D+64];return T}var Ut=32,Or=24,$r=32,Lr=16,ar=32,Gr=32,Tr=32,gr=32,Ir=32,Sn=Or,Un=$r,R=Lr,oe=64,ve=32,Ne=64,Ve=32,ct=64;r.lowlevel={crypto_core_hsalsa20:ee,crypto_stream_xor:Ce,crypto_stream:pe,crypto_stream_salsa20_xor:de,crypto_stream_salsa20:Ie,crypto_onetimeauth:We,crypto_onetimeauth_verify:ke,crypto_verify_16:M,crypto_verify_32:$,crypto_secretbox:X,crypto_secretbox_open:ye,crypto_scalarmult:q,crypto_scalarmult_base:J,crypto_box_beforenm:W,crypto_box_afternm:_e,crypto_box:$e,crypto_box_open:se,crypto_box_keypair:te,crypto_hash:Ht,crypto_sign:kr,crypto_sign_keypair:He,crypto_sign_open:Fr,crypto_secretbox_KEYBYTES:Ut,crypto_secretbox_NONCEBYTES:Or,crypto_secretbox_ZEROBYTES:$r,crypto_secretbox_BOXZEROBYTES:Lr,crypto_scalarmult_BYTES:ar,crypto_scalarmult_SCALARBYTES:Gr,crypto_box_PUBLICKEYBYTES:Tr,crypto_box_SECRETKEYBYTES:gr,crypto_box_BEFORENMBYTES:Ir,crypto_box_NONCEBYTES:Sn,crypto_box_ZEROBYTES:Un,crypto_box_BOXZEROBYTES:R,crypto_sign_BYTES:oe,crypto_sign_PUBLICKEYBYTES:ve,crypto_sign_SECRETKEYBYTES:Ne,crypto_sign_SEEDBYTES:Ve,crypto_hash_BYTES:ct,gf:t,D:h,L:Kt,pack25519:Ke,unpack25519:Ze,M:De,A:Je,S:Ge,Z:vt,pow2523:Q,add:H,set25519:xe,modL:Zt,scalarmult:wt,scalarbase:ft};function Xe(w,k){if(w.length!==Ut)throw new Error("bad key size");if(k.length!==Or)throw new Error("bad nonce size")}function rt(w,k){if(w.length!==Tr)throw new Error("bad public key size");if(k.length!==gr)throw new Error("bad secret key size")}function nt(){for(var w=0;w<arguments.length;w++)if(!(arguments[w]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function bt(w){for(var k=0;k<w.length;k++)w[k]=0}r.randomBytes=function(w){var k=new Uint8Array(w);return n(k,w),k},r.secretbox=function(w,k,T){nt(w,k,T),Xe(T,k);for(var C=new Uint8Array($r+w.length),D=new Uint8Array(C.length),B=0;B<w.length;B++)C[B+$r]=w[B];return X(D,C,C.length,k,T),D.subarray(Lr)},r.secretbox.open=function(w,k,T){nt(w,k,T),Xe(T,k);for(var C=new Uint8Array(Lr+w.length),D=new Uint8Array(C.length),B=0;B<w.length;B++)C[B+Lr]=w[B];return C.length<32||ye(D,C,C.length,k,T)!==0?null:D.subarray($r)},r.secretbox.keyLength=Ut,r.secretbox.nonceLength=Or,r.secretbox.overheadLength=Lr,r.scalarMult=function(w,k){if(nt(w,k),w.length!==Gr)throw new Error("bad n size");if(k.length!==ar)throw new Error("bad p size");var T=new Uint8Array(ar);return q(T,w,k),T},r.scalarMult.base=function(w){if(nt(w),w.length!==Gr)throw new Error("bad n size");var k=new Uint8Array(ar);return J(k,w),k},r.scalarMult.scalarLength=Gr,r.scalarMult.groupElementLength=ar,r.box=function(w,k,T,C){var D=r.box.before(T,C);return r.secretbox(w,k,D)},r.box.before=function(w,k){nt(w,k),rt(w,k);var T=new Uint8Array(Ir);return W(T,w,k),T},r.box.after=r.secretbox,r.box.open=function(w,k,T,C){var D=r.box.before(T,C);return r.secretbox.open(w,k,D)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var w=new Uint8Array(Tr),k=new Uint8Array(gr);return te(w,k),{publicKey:w,secretKey:k}},r.box.keyPair.fromSecretKey=function(w){if(nt(w),w.length!==gr)throw new Error("bad secret key size");var k=new Uint8Array(Tr);return J(k,w),{publicKey:k,secretKey:new Uint8Array(w)}},r.box.publicKeyLength=Tr,r.box.secretKeyLength=gr,r.box.sharedKeyLength=Ir,r.box.nonceLength=Sn,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(w,k){if(nt(w,k),k.length!==Ne)throw new Error("bad secret key size");var T=new Uint8Array(oe+w.length);return kr(T,w,w.length,k),T},r.sign.open=function(w,k){if(nt(w,k),k.length!==ve)throw new Error("bad public key size");var T=new Uint8Array(w.length),C=Fr(T,w,w.length,k);if(C<0)return null;for(var D=new Uint8Array(C),B=0;B<D.length;B++)D[B]=T[B];return D},r.sign.detached=function(w,k){for(var T=r.sign(w,k),C=new Uint8Array(oe),D=0;D<C.length;D++)C[D]=T[D];return C},r.sign.detached.verify=function(w,k,T){if(nt(w,k,T),k.length!==oe)throw new Error("bad signature size");if(T.length!==ve)throw new Error("bad public key size");var C=new Uint8Array(oe+w.length),D=new Uint8Array(oe+w.length),B;for(B=0;B<oe;B++)C[B]=k[B];for(B=0;B<w.length;B++)C[B+oe]=w[B];return Fr(D,C,C.length,T)>=0},r.sign.keyPair=function(){var w=new Uint8Array(ve),k=new Uint8Array(Ne);return He(w,k),{publicKey:w,secretKey:k}},r.sign.keyPair.fromSecretKey=function(w){if(nt(w),w.length!==Ne)throw new Error("bad secret key size");for(var k=new Uint8Array(ve),T=0;T<k.length;T++)k[T]=w[32+T];return{publicKey:k,secretKey:new Uint8Array(w)}},r.sign.keyPair.fromSeed=function(w){if(nt(w),w.length!==Ve)throw new Error("bad seed size");for(var k=new Uint8Array(ve),T=new Uint8Array(Ne),C=0;C<32;C++)T[C]=w[C];return He(k,T,!0),{publicKey:k,secretKey:T}},r.sign.publicKeyLength=ve,r.sign.secretKeyLength=Ne,r.sign.seedLength=Ve,r.sign.signatureLength=oe,r.hash=function(w){nt(w);var k=new Uint8Array(ct);return Ht(k,w,w.length),k},r.hash.hashLength=ct,r.verify=function(w,k){return nt(w,k),w.length===0||k.length===0||w.length!==k.length?!1:P(w,0,k,0,w.length)===0},r.setPRNG=function(w){n=w},function(){var w=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(w&&w.getRandomValues){var k=65536;r.setPRNG(function(T,C){var D,B=new Uint8Array(C);for(D=0;D<C;D+=k)w.getRandomValues(B.subarray(D,D+Math.min(C-D,k)));for(D=0;D<C;D++)T[D]=B[D];bt(B)})}else typeof require<"u"&&(w=require("crypto"),w&&w.randomBytes&&r.setPRNG(function(T,C){var D,B=w.randomBytes(C);for(D=0;D<C;D++)T[D]=B[D];bt(B)}))}()}(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const dc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,_C={fromSeed:dc.sign.keyPair.fromSeed,sign:dc.sign.detached,verify:dc.sign.detached.verify,randomBytes:dc.randomBytes};let cw;function xC(r){cw=r}function ss(){return cw}const SC=new Uint16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);class pc{static checksum(e){let t=0;for(let n=0;n<e.byteLength;n++){let i=e[n];t=t<<8&65535^SC[(t>>8^i)&255]}return t}static validate(e,t){return pc.checksum(e)==t}}const Id="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class lw{static encode(e){let t=0,n=0,i=new Uint8Array(e),a=new Uint8Array(e.byteLength*2),u=0;for(let c=0;c<i.byteLength;c++)for(n=n<<8|i[c],t+=8;t>=5;){let f=n>>>t-5&31;a[u++]=Id.charAt(f).charCodeAt(0),t-=5}if(t>0){let c=n<<5-t&31;a[u++]=Id.charAt(c).charCodeAt(0)}return a.slice(0,u)}static decode(e){let t=0,n=0,i=0,a=new Uint8Array(e),u=new Uint8Array(a.byteLength*5/8|0);for(let c=0;c<a.byteLength;c++){let f=String.fromCharCode(a[c]),h=Id.indexOf(f);if(h===-1)throw new Error("Illegal Base32 character: "+a[c]);n=n<<5|h,t+=5,t>=8&&(u[i++]=n>>>t-8&255,t-=8)}return u.slice(0,i)}}class Bt extends Error{constructor(t,n){super(t);E(this,"name");E(this,"code");E(this,"chainedError");this.name="NKeysError",this.code=t,this.chainedError=n}}function EC(){return mc(Vt.Operator)}function OC(){return mc(Vt.Account)}function TC(){return mc(Vt.User)}var qt;(function(r){r.InvalidPrefixByte="nkeys: invalid prefix byte",r.InvalidKey="nkeys: invalid key",r.InvalidPublicKey="nkeys: invalid public key",r.InvalidSeedLen="nkeys: invalid seed length",r.InvalidSeed="nkeys: invalid seed",r.InvalidEncoding="nkeys: invalid encoded key",r.InvalidSignature="nkeys: signature verification failed",r.CannotSign="nkeys: cannot sign, no private key available",r.PublicKeyOnly="nkeys: no seed or private key available",r.InvalidChecksum="nkeys: invalid checksum",r.SerializationError="nkeys: serialization error",r.ApiError="nkeys: api error",r.ClearedPair="nkeys: pair is cleared"})(qt||(qt={}));var Vt;(function(r){r[r.Seed=144]="Seed",r[r.Private=120]="Private",r[r.Operator=112]="Operator",r[r.Server=104]="Server",r[r.Cluster=16]="Cluster",r[r.Account=0]="Account",r[r.User=160]="User"})(Vt||(Vt={}));class Sa{static isValidPublicPrefix(e){return e==Vt.Server||e==Vt.Operator||e==Vt.Cluster||e==Vt.Account||e==Vt.User}static startsWithValidPrefix(e){let t=e[0];return t=="S"||t=="P"||t=="O"||t=="N"||t=="C"||t=="A"||t=="U"}static isValidPrefix(e){return this.parsePrefix(e)!=-1}static parsePrefix(e){switch(e){case Vt.Seed:return Vt.Seed;case Vt.Private:return Vt.Private;case Vt.Operator:return Vt.Operator;case Vt.Server:return Vt.Server;case Vt.Cluster:return Vt.Cluster;case Vt.Account:return Vt.Account;case Vt.User:return Vt.User;default:return-1}}}class rn{static encode(e,t){if(!t||!(t instanceof Uint8Array))throw new Bt(qt.SerializationError);if(!Sa.isValidPrefix(e))throw new Bt(qt.InvalidPrefixByte);return rn._encode(!1,e,t)}static encodeSeed(e,t){if(!t)throw new Bt(qt.ApiError);if(!Sa.isValidPublicPrefix(e))throw new Bt(qt.InvalidPrefixByte);if(t.byteLength!==32)throw new Bt(qt.InvalidSeedLen);return rn._encode(!0,e,t)}static decode(e,t){if(!Sa.isValidPrefix(e))throw new Bt(qt.InvalidPrefixByte);const n=rn._decode(t);if(n[0]!==e)throw new Bt(qt.InvalidPrefixByte);return n.slice(1)}static decodeSeed(e){const t=rn._decode(e),n=rn._decodePrefix(t);if(n[0]!=Vt.Seed)throw new Bt(qt.InvalidSeed);if(!Sa.isValidPublicPrefix(n[1]))throw new Bt(qt.InvalidPrefixByte);return{buf:t.slice(2),prefix:n[1]}}static _encode(e,t,n){const i=e?2:1,a=n.byteLength,u=i+a+2,c=i+a,f=new Uint8Array(u);if(e){const y=rn._encodePrefix(Vt.Seed,t);f.set(y)}else f[0]=t;f.set(n,i);const h=pc.checksum(f.slice(0,c));return new DataView(f.buffer).setUint16(c,h,!0),lw.encode(f)}static _decode(e){if(e.byteLength<4)throw new Bt(qt.InvalidEncoding);let t;try{t=lw.decode(e)}catch(c){throw new Bt(qt.InvalidEncoding,c)}const n=t.byteLength-2,a=new DataView(t.buffer).getUint16(n,!0),u=t.slice(0,n);if(!pc.validate(u,a))throw new Bt(qt.InvalidChecksum);return u}static _encodePrefix(e,t){const n=e|t>>5,i=(t&31)<<3;return new Uint8Array([n,i])}static _decodePrefix(e){const t=e[0]&248,n=(e[0]&7)<<5|(e[1]&248)>>3;return new Uint8Array([t,n])}}class fw{constructor(e){E(this,"seed");this.seed=e}getRawSeed(){if(!this.seed)throw new Bt(qt.ClearedPair);return rn.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Bt(qt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Bt(qt.ClearedPair);const e=rn.decodeSeed(this.seed),t=ss().fromSeed(this.getRawSeed()),n=rn.encode(e.prefix,t.publicKey);return new TextDecoder().decode(n)}getPrivateKey(){if(!this.seed)throw new Bt(qt.ClearedPair);const e=ss().fromSeed(this.getRawSeed());return rn.encode(Vt.Private,e.secretKey)}sign(e){if(!this.seed)throw new Bt(qt.ClearedPair);const t=ss().fromSeed(this.getRawSeed());return ss().sign(e,t.secretKey)}verify(e,t){if(!this.seed)throw new Bt(qt.ClearedPair);const n=ss().fromSeed(this.getRawSeed());return ss().verify(e,t,n.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function mc(r){const e=ss().randomBytes(32);let t=rn.encodeSeed(r,new Uint8Array(e));return new fw(t)}class AC{constructor(e){E(this,"publicKey");this.publicKey=e}getPublicKey(){if(!this.publicKey)throw new Bt(qt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Bt(qt.PublicKeyOnly):new Bt(qt.ClearedPair)}getSeed(){throw this.publicKey?new Bt(qt.PublicKeyOnly):new Bt(qt.ClearedPair)}sign(e){throw this.publicKey?new Bt(qt.CannotSign):new Bt(qt.ClearedPair)}verify(e,t){if(!this.publicKey)throw new Bt(qt.ClearedPair);let n=rn._decode(this.publicKey);return ss().verify(e,t,n.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function kC(r){const e=new TextEncoder().encode(r),t=rn._decode(e),n=Sa.parsePrefix(t[0]);if(Sa.isValidPublicPrefix(n))return new AC(e);throw new Bt(qt.InvalidPublicKey)}function IC(r){return rn.decodeSeed(r),new fw(r)}function CC(r){return btoa(String.fromCharCode(...r))}function PC(r){const e=atob(r),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}xC(_C);const hw={createAccount:OC,createOperator:EC,createPair:mc,createUser:TC,fromPublic:kC,fromSeed:IC,NKeysError:Bt,NKeysErrorCode:qt,Prefix:Vt,decode:PC,encode:CC};function NC(r){return e=>{let t={};return r.forEach(n=>{const i=n(e)||{};t=Object.assign(t,i)}),t}}function RC(){return()=>{}}function MC(r,e){return()=>{const t=typeof r=="function"?r():r,n=typeof e=="function"?e():e;return{user:t,pass:n}}}function DC(r){return()=>({auth_token:typeof r=="function"?r():r})}function FC(r){return e=>{const t=typeof r=="function"?r():r,n=t?hw.fromSeed(t):void 0,i=n?n.getPublicKey():"",a=Si.encode(e||""),u=n!==void 0&&e?n.sign(a):void 0,c=u?hw.encode(u):"";return{nkey:i,sig:c}}}function LC(r,e){return t=>{const n=typeof r=="function"?r():r,i=FC(e),{nkey:a,sig:u}=i(t);return{jwt:n,nkey:a,sig:u}}}function qC(r){const e=typeof r!="function"?()=>r:r,t=()=>{const a=/\s*(?:(?:[-]{3,}[^\n]*[-]{3,}\n)(.+)(?:\n\s*[-]{3,}[^\n]*[-]{3,}\n))/ig,u=cn.decode(e());let c=a.exec(u);if(!c)throw Re.errorForCode(be.BadCreds);const f=c[1].trim();if(c=a.exec(u),!c||!c)throw Re.errorForCode(be.BadCreds);const h=Si.encode(c[1].trim());return{jwt:f,seed:h}};return LC(()=>{const{jwt:a}=t();return a},()=>{const{seed:a}=t();return a})}const dw=2*60*1e3,jC=2,pw=2*1e3;function UC(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:dw,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:pw,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function $C(r){const e=[];return typeof r.authenticator=="function"&&e.push(r.authenticator),Array.isArray(r.authenticator)&&e.push(...r.authenticator),r.token&&e.push(DC(r.token)),r.user&&e.push(MC(r.user,r.pass)),e.length===0?RC():NC(e)}function BC(r){const e=`${ld}:${nw()}`;if(r=r||{servers:[e]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new Re("port and servers options are mutually exclusive",be.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${ld}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[e]);const t=ac(UC(),r);if(t.authenticator=$C(t),["reconnectDelayHandler","authenticator"].forEach(n=>{if(t[n]&&typeof t[n]!="function")throw new Re(`${n} option should be a function`,be.NotFunction)}),t.reconnectDelayHandler||(t.reconnectDelayHandler=()=>{let n=t.tls?t.reconnectJitterTLS:t.reconnectJitter;return n&&(n++,n=Math.floor(Math.random()*n)),t.reconnectTimeWait+n}),t.inboxPrefix)try{Oi(t.inboxPrefix)}catch(n){throw new Re(n.message,be.ApiError)}if(t.resolve===void 0&&(t.resolve=typeof Ed()=="function"),t.resolve&&typeof Ed()!="function")throw new Re("'resolve' is not supported on this client",be.InvalidOption);return t}function VC(r,e){const{proto:t,tls_required:n,tls_available:i}=r;if((t===void 0||t<1)&&e.noEcho)throw new Re("noEcho",be.ServerOptionNotAvailable);const a=n||i||!1;if(e.tls&&!a)throw new Re("tls",be.ServerOptionNotAvailable)}const WC=1024*32,zC=/^INFO\s+([^\r\n]+)\r\n/i,HC=So(`PONG\r
|
|
150
|
-
`),
|
|
151
|
-
`);class GC{constructor(e,t,n){E(this,"echo");E(this,"no_responders");E(this,"protocol");E(this,"verbose");E(this,"pedantic");E(this,"jwt");E(this,"nkey");E(this,"sig");E(this,"user");E(this,"pass");E(this,"auth_token");E(this,"tls_required");E(this,"name");E(this,"lang");E(this,"version");E(this,"headers");this.protocol=1,this.version=e.version,this.lang=e.lang,this.echo=t.noEcho?!1:void 0,this.verbose=t.verbose,this.pedantic=t.pedantic,this.tls_required=t.tls?!0:void 0,this.name=t.name;const i=(t&&typeof t.authenticator=="function"?t.authenticator(n):{})||{};ac(this,i)}}class yw extends Mr{constructor(t,n,i={}){var u;super();E(this,"sid");E(this,"queue");E(this,"draining");E(this,"max");E(this,"subject");E(this,"drained");E(this,"protocol");E(this,"timer");E(this,"info");E(this,"cleanupFn");E(this,"closed");E(this,"requestSubject");ac(this,i),this.protocol=t,this.subject=n,this.draining=!1,this.noIterator=typeof i.callback=="function",this.closed=ir();const a=!((u=t.options)!=null&&u.noAsyncTraces);i.timeout&&(this.timer=ma(i.timeout,a),this.timer.then(()=>{this.timer=void 0}).catch(c=>{this.stop(c),this.noIterator&&this.callback(c,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(t){if(this.noIterator){const n=this.callback,i=t.ingestionFilterFn?t.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),a=t.protocolFilterFn?t.protocolFilterFn:()=>!0,u=t.dispatchedFn?t.dispatchedFn:()=>{};this.callback=(c,f)=>{const{ingest:h}=i(f);h&&a(f)&&(n(c,f),u(f))}}else this.protocolFilterFn=t.protocolFilterFn,this.dispatchedFn=t.dispatchedFn}callback(t,n){this.cancelTimeout(),t?this.stop(t):this.push(n)}close(){if(!this.isClosed()){this.cancelTimeout();const t=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?t():this.push(t)}}unsubscribe(t){this.protocol.unsubscribe(this,t)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(Re.errorForCode(be.ConnectionClosed)):this.isClosed()?Promise.reject(Re.errorForCode(be.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(ir()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class QC{constructor(){E(this,"mux");E(this,"subs");E(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(e){return this.sidCounter++,e.sid=this.sidCounter,this.subs.set(e.sid,e),e}setMux(e){return this.mux=e,e}getMux(){return this.mux}get(e){return this.subs.get(e)}resub(e){return this.sidCounter++,this.subs.delete(e.sid),e.sid=this.sidCounter,this.subs.set(e.sid,e),e}all(){return Array.from(this.subs.values())}cancel(e){e&&(e.close(),this.subs.delete(e.sid))}handleError(e){if(e&&e.permissionContext){const t=e.permissionContext,n=this.all();let i;if(t.operation==="subscription"&&(i=n.find(a=>a.subject===t.subject&&a.queue===t.queue)),t.operation==="publish"&&(i=n.find(a=>a.requestSubject===t.subject)),i)return i.callback(e,{}),i.close(),this.subs.delete(i.sid),i!==this.mux}return!1}close(){this.subs.forEach(e=>{e.close()})}}class yc{constructor(e,t){E(this,"connected");E(this,"connectedOnce");E(this,"infoReceived");E(this,"info");E(this,"muxSubscriptions");E(this,"options");E(this,"outbound");E(this,"pongs");E(this,"subscriptions");E(this,"transport");E(this,"noMorePublishing");E(this,"connectError");E(this,"publisher");E(this,"_closed");E(this,"closed");E(this,"listeners");E(this,"heartbeats");E(this,"parser");E(this,"outMsgs");E(this,"inMsgs");E(this,"outBytes");E(this,"inBytes");E(this,"pendingLimit");E(this,"lastError");E(this,"abortReconnect");E(this,"whyClosed");E(this,"servers");E(this,"server");E(this,"features");E(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=WC,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=e,this.publisher=t,this.subscriptions=new QC,this.muxSubscriptions=new yC,this.outbound=new _a,this.pongs=[],this.whyClosed="",this.pendingLimit=e.pendingLimit||this.pendingLimit,this.features=new YI({major:0,minor:0,micro:0}),this.connectPromise=null;const n=typeof e.servers=="string"?[e.servers]:e.servers;this.servers=new mC(n,{randomize:!e.noRandomize}),this.closed=ir(),this.parser=new uw(this),this.heartbeats=new gC(this,this.options.pingInterval||dw,this.options.maxPingOut||jC)}resetOutbound(){this.outbound.reset();const e=this.pongs;this.pongs=[];const t=Re.errorForCode(be.Disconnect);t.stack="",e.forEach(n=>{n.reject(t)}),this.parser=new uw(this),this.infoReceived=!1}dispatchStatus(e){this.listeners.forEach(t=>{t.push(e)})}status(){const e=new Mr;return this.listeners.push(e),e}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const e=ir();return e.catch(()=>{}),this.pongs.unshift(e),this.connectError=t=>{e.reject(t)},this.transport=XI(),this.transport.closed().then(async t=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),e}disconnect(){this.dispatchStatus({type:pa.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:pa.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(e){this.dispatchStatus({type:Ei.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var t;this.dispatchStatus({type:Ei.Reconnect,data:this.servers.getCurrentServer().toString()}),((t=this.lastError)==null?void 0:t.code)===be.AuthenticationExpired&&(this.lastError=void 0)}).catch(t=>{this._close(t)}):await this._close(e)}async dial(e){const t=this.prepare();let n;try{n=ma(this.options.timeout||2e4);const i=this.transport.connect(e,this.options);await Promise.race([i,n]),(async()=>{try{for await(const a of this.transport)this.parser.parse(a)}catch(a){console.log("reader closed",a)}})().then()}catch(i){t.reject(i)}try{await Promise.race([n,t]),n&&n.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(i){throw n&&n.cancel(),await this.transport.close(i),i}}async _doDial(e){const{resolve:t}=this.options,n=await e.resolve({fn:Ed(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:t});let i=null;for(const a of n)try{i=null,this.dispatchStatus({type:pa.Reconnecting,data:a.toString()}),await this.dial(a);return}catch(u){i=u}throw i}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let e;for(;;){this._closed&&this.servers.clear();const t=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():pw;let n=t;const i=this.selectServer();if(!i||this.abortReconnect)throw e||(this.lastError?this.lastError:Re.errorForCode(be.ConnectionRefused));const a=Date.now();if(i.lastConnect===0||i.lastConnect+t<=a){i.lastConnect=Date.now();try{await this._doDial(i);break}catch(u){if(e=u,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}i.reconnects++;const c=this.options.maxReconnectAttempts||0;c!==-1&&i.reconnects>=c&&this.servers.removeCurrentServer()}}else n=Math.min(n,i.lastConnect+t-a),await ya(n)}}static async connect(e,t){const n=new yc(e,t);return await n.dialLoop(),n}static toError(e){const t=e?e.toLowerCase():"";if(t.indexOf("permissions violation")!==-1){const n=new Re(e,be.PermissionsViolation),i=e.match(/(Publish|Subscription) to "(\S+)"/);if(i){n.permissionContext={operation:i[1].toLowerCase(),subject:i[2],queue:void 0};const a=e.match(/using queue "(\S+)"/);a&&(n.permissionContext.queue=a[1])}return n}else return t.indexOf("authorization violation")!==-1?new Re(e,be.AuthorizationViolation):t.indexOf("user authentication expired")!==-1?new Re(e,be.AuthenticationExpired):t.indexOf("account authentication expired")!=-1?new Re(e,be.AccountExpired):t.indexOf("authentication timeout")!==-1?new Re(e,be.AuthenticationTimeout):new Re(e,be.ProtocolError)}processMsg(e,t){if(this.inMsgs++,this.inBytes+=t.length,!this.subscriptions.sidCounter)return;const n=this.subscriptions.get(e.sid);n&&(n.received+=1,n.callback&&n.callback(null,new pd(e,t,this)),n.max!==void 0&&n.received>=n.max&&n.unsubscribe())}processError(e){const t=Lb(e),n=yc.toError(t),i={type:Ei.Error,data:n.code};if(n.isPermissionError()){let a=!1;if(n.permissionContext){i.permissionContext=n.permissionContext;const u=this.subscriptions.getMux();a=(u==null?void 0:u.subject)===n.permissionContext.subject}this.subscriptions.handleError(n),this.muxSubscriptions.handleError(a,n),a&&this.subscriptions.setMux(null)}this.dispatchStatus(i),this.handleError(n)}handleError(e){e.isAuthError()?this.handleAuthError(e):e.isProtocolError()?this.lastError=e:e.isAuthTimeout()&&(this.lastError=e),e.isPermissionError()||(this.lastError=e)}handleAuthError(e){this.lastError&&e.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(e):this.disconnect()}processPing(){this.transport.send(HC)}processPong(){const e=this.pongs.shift();e&&e.resolve()}processInfo(e){const t=JSON.parse(Lb(e));this.info=t;const n=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(t,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Ps(t.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:a,lang:u}=this.transport;try{const c=new GC({version:a,lang:u},this.options,t.nonce);t.headers&&(c.headers=!0,c.no_responders=!0);const f=JSON.stringify(c);this.transport.send(So(`CONNECT ${f}${lc}`)),this.transport.send(mw)}catch(c){this._close(c)}}n&&this.dispatchStatus({type:Ei.Update,data:n}),(t.ldm!==void 0?t.ldm:!1)&&this.dispatchStatus({type:Ei.LDM,data:this.servers.getCurrentServer().toString()})}push(e){switch(e.kind){case tn.MSG:{const{msg:t,data:n}=e;this.processMsg(t,n);break}case tn.OK:break;case tn.ERR:this.processError(e.data);break;case tn.PING:this.processPing();break;case tn.PONG:this.processPong();break;case tn.INFO:this.processInfo(e.data);break}}sendCommand(e,...t){const n=this.outbound.length();let i;typeof e=="string"?i=So(e):i=e,this.outbound.fill(i,...t),n===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(e,t=bn,n){let i;if(t instanceof Uint8Array)i=t;else if(typeof t=="string")i=Si.encode(t);else throw Re.errorForCode(be.BadPayload);let a=i.length;n=n||{},n.reply=n.reply||"";let u=bn,c=0;if(n.headers){if(this.info&&!this.info.headers)throw new Re("headers",be.ServerOptionNotAvailable);u=n.headers.encode(),c=u.length,a=i.length+c}if(this.info&&a>this.info.max_payload)throw Re.errorForCode(be.MaxPayloadExceeded);this.outBytes+=a,this.outMsgs++;let f;n.headers?(n.reply?f=`HPUB ${e} ${n.reply} ${c} ${a}\r
|
|
148
|
+
${this.ctx.stack}`),this.deferred.reject(e)):this.deferred.resolve(t),this.cancel()}cancel(e){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(e||Me.errorForCode(_e.Cancelled))}}const wC="$JS.API";function _C(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),lc({apiPrefix:wC,timeout:5e3},r)}class Ro{nc;opts;prefix;timeout;jc;constructor(e,t){this.nc=e,this.opts=_C(t),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Fn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let e=this.opts.apiPrefix;if(!e||e.length===0)throw new Error("invalid empty prefix");e[e.length-1]==="."&&(e=e.substr(0,e.length-1)),this.opts.apiPrefix=e}async _request(e,t=null,n){n=n||{},n.timeout=this.timeout;let i=gn;t&&(i=this.jc.encode(t));let{retries:a}=n;a=a||1,a=a===-1?Number.MAX_SAFE_INTEGER:a;const u=_d();for(let c=0;c<a;c++)try{const f=await this.nc.request(e,i,n);return this.parseJsResponse(f)}catch(f){const h=f;if((h.code==="503"||h.code===_e.Timeout)&&c+1<a)await va(u.backoff(c));else throw f}}async findStream(e){const t={subject:e},i=await this._request(`${this.prefix}.STREAM.NAMES`,t);if(!i.streams||i.streams.length!==1)throw new Error("no stream matches subject");return i.streams[0]}getConnection(){return this.nc}parseJsResponse(e){const t=this.jc.decode(e.data),n=t;if(n.error){const i=pw(n.error.code,n.error.description);if(i!==null)throw i.api_error=n.error,i}return t}}class Mo{err;offset;pageInfo;subject;jsm;filter;payload;constructor(e,t,n,i){if(!e)throw new Error("subject is required");this.subject=e,this.jsm=n,this.offset=0,this.pageInfo={},this.filter=t,this.payload=i||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const e={offset:this.offset};this.payload&&Object.assign(e,this.payload);try{const t=await this.jsm._request(this.subject,e,{timeout:this.jsm.timeout});this.pageInfo=t;const n=this.countResponse(t);return n===0?[]:(this.offset+=n,this.filter(t))}catch(t){throw this.err=t,t}}countResponse(e){switch(e?.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return e.streams?.length||0;case"io.nats.jetstream.api.v1.consumer_list_response":return e.consumers?.length||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${e?.type}`),e.streams?.length||0}return 0}async*[Symbol.asyncIterator](){let e=await this.next();for(;e.length>0;){for(const t of e)yield t;e=await this.next()}}}function Ms(r=""){const e=r.match(/(\d+).(\d+).(\d+)/);if(e)return{major:parseInt(e[1]),minor:parseInt(e[2]),micro:parseInt(e[3])};throw new Error(`'${r}' is not a semver value`)}function Pd(r,e){return r.major<e.major?-1:r.major>e.major?1:r.minor<e.minor?-1:r.minor>e.minor?1:r.micro<e.micro?-1:r.micro>e.micro?1:0}var At;(function(r){r.JS_KV="js_kv",r.JS_OBJECTSTORE="js_objectstore",r.JS_PULL_MAX_BYTES="js_pull_max_bytes",r.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",r.JS_ALLOW_DIRECT="js_allow_direct",r.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",r.JS_SIMPLIFICATION="js_simplification",r.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",r.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",r.JS_STREAM_FIRST_SEQ="js_stream_first_seq",r.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",r.JS_STREAM_COMPRESSION="js_stream_compression",r.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",r.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(At||(At={}));class SC{server;features;disabled;constructor(e){this.features=new Map,this.disabled=[],this.update(e)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(e){this.disabled.push(e),this.update(this.server)}isDisabled(e){return this.disabled.indexOf(e)!==-1}update(e){typeof e=="string"&&(e=Ms(e)),this.server=e,this.set(At.JS_KV,"2.6.2"),this.set(At.JS_OBJECTSTORE,"2.6.3"),this.set(At.JS_PULL_MAX_BYTES,"2.8.3"),this.set(At.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(At.JS_ALLOW_DIRECT,"2.9.0"),this.set(At.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(At.JS_SIMPLIFICATION,"2.9.4"),this.set(At.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(At.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(At.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(At.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(At.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(At.JS_STREAM_COMPRESSION,"2.10.0"),this.set(At.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(At.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(t=>{this.features.delete(t)})}set(e,t){this.features.set(e,{min:t,ok:Pd(this.server,Ms(t))>=0})}get(e){return this.features.get(e)||{min:"unknown",ok:!1}}supports(e){return this.get(e)?.ok||!1}require(e){return typeof e=="string"&&(e=Ms(e)),Pd(this.server,e)>=0}}class mc extends Ro{constructor(e,t){super(e,t)}async add(e,t,n=dc.Create){if(Zr(e),t.deliver_group&&t.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(t.deliver_group&&t.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const i={};i.config=t,i.stream_name=e,i.action=n,i.config.durable_name&&ba(i.config.durable_name);const a=this.nc;let{min:u,ok:c}=a.features.get(At.JS_NEW_CONSUMER_CREATE_API);const f=t.name===""?void 0:t.name;if(f&&!c)throw new Error(`consumer 'name' requires server ${u}`);if(f)try{hc("name",f)}catch(y){const g=y.message,b=g.indexOf("cannot contain");throw b!==-1?new Error(`consumer 'name' ${g.substring(b)}`):y}let h,p="";if(Array.isArray(t.filter_subjects)){const{min:y,ok:g}=a.features.get(At.JS_MULTIPLE_CONSUMER_FILTER);if(!g)throw new Error(`consumer 'filter_subjects' requires server ${y}`);c=!1}if(t.metadata){const{min:y,ok:g}=a.features.get(At.JS_STREAM_CONSUMER_METADATA);if(!g)throw new Error(`consumer 'metadata' requires server ${y}`)}if(c&&(p=t.name??t.durable_name??""),p!==""){let y=t.filter_subject??void 0;y===">"&&(y=void 0),h=y!==void 0?`${this.prefix}.CONSUMER.CREATE.${e}.${p}.${y}`:`${this.prefix}.CONSUMER.CREATE.${e}.${p}`}else h=t.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${e}.${t.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${e}`;return await this._request(h,i)}async update(e,t,n){const i=await this.info(e,t),a=n;return this.add(e,Object.assign(i.config,a),dc.Update)}async info(e,t){return Zr(e),ba(t),await this._request(`${this.prefix}.CONSUMER.INFO.${e}.${t}`)}async delete(e,t){return Zr(e),ba(t),(await this._request(`${this.prefix}.CONSUMER.DELETE.${e}.${t}`)).success}list(e){Zr(e);const t=i=>i.consumers,n=`${this.prefix}.CONSUMER.LIST.${e}`;return new Mo(n,t,this)}pause(e,t,n){const i=`${this.prefix}.CONSUMER.PAUSE.${e}.${t}`,a={pause_until:n.toISOString()};return this._request(i,a)}resume(e,t){return this.pause(e,t,new Date(0))}}function Oa(r,e,t=!1){if(t===!0&&!r)throw Me.errorForCode(_e.ApiError,new Error(`${e} is not a function`));if(r&&typeof r!="function")throw Me.errorForCode(_e.ApiError,new Error(`${e} is not a function`))}class xC extends Nr{sub;adapter;subIterDone;constructor(e,t,n){super(),Oa(n.adapter,"adapter",!0),this.adapter=n.adapter,n.callback&&Oa(n.callback,"callback"),this.noIterator=typeof n.callback=="function",n.ingestionFilterFn&&(Oa(n.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=n.ingestionFilterFn),n.protocolFilterFn&&(Oa(n.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=n.protocolFilterFn),n.dispatchedFn&&(Oa(n.dispatchedFn,"dispatchedFn"),this.dispatchedFn=n.dispatchedFn),n.cleanupFn&&Oa(n.cleanupFn,"cleanupFn");let i=(h,p)=>{this.callback(h,p)};if(n.callback){const h=n.callback;i=(p,m)=>{const[y,g]=this.adapter(p,m);if(y){h(y,null);return}const{ingest:b}=this.ingestionFilterFn?this.ingestionFilterFn(g,this):{ingest:!0};b&&(!this.protocolFilterFn||this.protocolFilterFn(g))&&(h(y,g),this.dispatchedFn&&g&&this.dispatchedFn(g))}}const{max:a,queue:u,timeout:c}=n,f={queue:u,timeout:c,callback:i};a&&a>0&&(f.max=a),this.sub=e.subscribe(t,f),n.cleanupFn&&(this.sub.cleanupFn=n.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=ir(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async h=>{await h.closed,this.stop()})(this.sub).then().catch()}unsubscribe(e){this.sub.unsubscribe(e)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(e,t){this.sub.cancelTimeout();const[n,i]=this.adapter(e,t);n&&this.stop(n),i&&this.push(i)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let wn;function EC(r){wn=r}function Ew(){return wn!==void 0&&wn.defaultPort!==void 0?wn.defaultPort:4222}function Nd(){return wn!==void 0&&wn.urlParseFn?wn.urlParseFn:void 0}function OC(){if(!wn||typeof wn.factory!="function")throw new Error("transport fn is not set");return wn.factory()}function Rd(){return wn!==void 0&&wn.dnsResolveFn?wn.dnsResolveFn:void 0}const yc=`\r
|
|
149
|
+
`,gc=Ea.fromAscii(yc),TC=new Uint8Array(gc)[0],kC=new Uint8Array(gc)[1];function AC(r){for(let e=0;e<r.length;e++){const t=e+1;if(r.byteLength>t&&r[e]===TC&&r[t]===kC)return t+1}return 0}function IC(r){const e=AC(r);if(e>0){const n=new Uint8Array(r).slice(0,e);return cn.decode(n)}return""}const CC=4,Ow=48,PC=65,NC=97;function RC(r,e,t,n){const i=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((u,c)=>{i[c]=u}),i[12]=r,i[13]=e,i[14]=t,i[15]=n,i}function Md(r){return MC(r)!==void 0}function MC(r){for(let e=0;e<r.length;e++)switch(r[e]){case".":return Tw(r);case":":return DC(r)}}function Tw(r){const e=new Uint8Array(4);for(let t=0;t<4;t++){if(r.length===0)return;if(t>0){if(r[0]!==".")return;r=r.substring(1)}const{n,c:i,ok:a}=FC(r);if(!a||n>255)return;r=r.substring(i),e[t]=n}return RC(e[0],e[1],e[2],e[3])}function DC(r){const e=new Uint8Array(16);let t=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(t=0,r=r.substring(2),r.length===0))return e;let n=0;for(;n<16;){const{n:i,c:a,ok:u}=LC(r);if(!u||i>65535)return;if(a<r.length&&r[a]==="."){if(t<0&&n!=12||n+4>16)return;const c=Tw(r);if(c===void 0)return;e[n]=c[12],e[n+1]=c[13],e[n+2]=c[14],e[n+3]=c[15],r="",n+=CC;break}if(e[n]=i>>8,e[n+1]=i,n+=2,r=r.substring(a),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(t>=0)return;if(t=n,r=r.substring(1),r.length===0)break}}if(r.length===0){if(n<16){if(t<0)return;const i=16-n;for(let a=n-1;a>=t;a--)e[a+i]=e[a];for(let a=t+i-1;a>=t;a--)e[a]=0}else if(t>=0)return;return e}}function FC(r){let e=0,t=0;for(e=0;e<r.length&&48<=r.charCodeAt(e)&&r.charCodeAt(e)<=57;e++)if(t=t*10+(r.charCodeAt(e)-Ow),t>=16777215)return{n:16777215,c:e,ok:!1};return e===0?{n:0,c:0,ok:!1}:{n:t,c:e,ok:!0}}function LC(r){let e=0,t=0;for(t=0;t<r.length;t++){if(48<=r.charCodeAt(t)&&r.charCodeAt(t)<=57)e*=16,e+=r.charCodeAt(t)-Ow;else if(97<=r.charCodeAt(t)&&r.charCodeAt(t)<=102)e*=16,e+=r.charCodeAt(t)-NC+10;else if(65<=r.charCodeAt(t)&&r.charCodeAt(t)<=70)e*=16,e+=r.charCodeAt(t)-PC+10;else break;if(e>=16777215)return{n:0,c:t,ok:!1}}return t===0?{n:0,c:t,ok:!1}:{n:e,c:t,ok:!0}}function qC(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Dd(r){return!qC(r)}function jC(r){const e="::FFFF:",t=r.toUpperCase().indexOf(e);if(t!==-1&&r.indexOf(".")!==-1){let n=r.substring(t+e.length);return n=n.replace("[",""),n.replace("]","")}return r}function UC(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=jC(r),Dd(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const e=Dd(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),t=e&&e.length===3&&e[1]&&e[2]?parseInt(e[2]):4222,n=t===80?"https":"http",i=new URL(`${n}://${r}`);i.port=`${t}`;let a=i.hostname;return a.charAt(0)==="["&&(a=a.substring(1,a.length-1)),{listen:i.host,hostname:a,port:t}}class Do{src;listen;hostname;port;didConnect;reconnects;lastConnect;gossiped;tlsName;resolves;constructor(e,t=!1){this.src=e,this.tlsName="";const n=UC(e);this.listen=n.listen,this.hostname=n.hostname,this.port=n.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=t}toString(){return this.listen}async resolve(e){if(!e.fn||e.resolve===!1)return[this];const t=[];if(Md(this.hostname))return[this];{const n=await e.fn(this.hostname);e.debug&&console.log(`resolve ${this.hostname} = ${n.join(",")}`);for(const i of n){const a=this.port===80?"https":"http",u=new URL(`${a}://${Dd(i)?"["+i+"]":i}`);u.port=`${this.port}`;const c=new Do(u.host,!1);c.tlsName=this.hostname,t.push(c)}}return e.randomize&&cw(t),this.resolves=t,t}}class $C{firstSelect;servers;currentServer;tlsName;randomize;constructor(e=[],t={}){this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=t.randomize||!1;const n=Nd();e&&(e.forEach(i=>{i=n?n(i):i,this.servers.push(new Do(i))}),this.randomize&&(this.servers=cw(this.servers))),this.servers.length===0&&this.addServer(`${wd}:${Ew()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const e=this.getCurrentServer();Md(e.hostname)||(this.tlsName=e.hostname,this.servers.forEach(t=>{t.gossiped&&(t.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(e,t=!1){const n=Nd();e=n?n(e):e;const i=new Do(e,t);Md(i.hostname)&&(i.tlsName=this.tlsName),this.servers.push(i)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const e=this.servers.shift();return e&&(this.servers.push(e),this.currentServer=e),e}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(e){if(e){const t=this.servers.indexOf(e);this.servers.splice(t,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(e,t){const n=[];let i=[];const a=Nd(),u=new Map;e.connect_urls&&e.connect_urls.length>0&&e.connect_urls.forEach(f=>{f=a?a(f,t):f;const h=new Do(f,!0);u.set(f,h)});const c=[];return this.servers.forEach((f,h)=>{const p=f.listen;f.gossiped&&this.currentServer.listen!==p&&u.get(p)===void 0&&c.push(h),u.delete(p)}),c.reverse(),c.forEach(f=>{const h=this.servers.splice(f,1);i=i.concat(h[0].listen)}),u.forEach((f,h)=>{this.servers.push(f),n.push(h)}),{added:n,deleted:i}}}class BC{baseInbox;reqs;constructor(){this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${Ti(e)}.`,this.baseInbox}add(e){isNaN(e.received)||(e.received=0),this.reqs.set(e.token,e)}get(e){return this.reqs.get(e)}cancel(e){this.reqs.delete(e.token)}getToken(e){const t=e.subject||"";return t.indexOf(this.baseInbox)===0?t.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(e,t){if(t&&t.permissionContext){if(e)return this.all().forEach(i=>{i.resolver(t,{})}),!0;const n=t.permissionContext;if(n.operation==="publish"){const i=this.all().find(a=>a.requestSubject===n.subject);if(i)return i.resolver(t,{}),!0}}return!1}dispatcher(){return(e,t)=>{const n=this.getToken(t);if(n){const i=this.get(n);i&&(e===null&&t.headers&&(e=hw(t)),i.resolver(e,t))}}}close(){const e=Me.errorForCode(_e.Timeout);this.reqs.forEach(t=>{t.resolver(e,{})})}}class VC{ph;interval;maxOut;timer;pendings;constructor(e,t,n){this.ph=e,this.interval=t,this.maxOut=n,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(e){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),e&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:ya.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const e=ir();this.ph.flush(e).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(e),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(e=>(e.resolve(),!1))}}class WC extends Error{constructor(e){super(e),this.name="AssertionError"}}function zC(r,e="Assertion failed."){if(!r)throw new WC(e)}const kw=32*1024,Fd=2**32-2;function vc(r,e,t=0){const n=e.byteLength-t;return r.byteLength>n&&(r=r.subarray(0,n)),e.set(r,t),r.byteLength}class Ld{_buf;_off;constructor(e){if(this._off=0,e==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(e)}bytes(e={copy:!0}){return e.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(e){if(e===0){this.reset();return}if(e<0||e>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+e)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(e){const t=this._buf.byteLength;return e<=this.capacity-t?(this._reslice(t+e),t):-1}_reslice(e){zC(e<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,e)}readByte(){const e=new Uint8Array(1);return this.read(e)?e[0]:null}read(e){if(this.empty())return this.reset(),e.byteLength===0?0:null;const t=vc(this._buf.subarray(this._off),e);return this._off+=t,t}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(Ei.encode(e))}write(e){const t=this._grow(e.byteLength);return vc(e,this._buf,t)}_grow(e){const t=this.length;t===0&&this._off!==0&&this.reset();const n=this._tryGrowByReslice(e);if(n>=0)return n;const i=this.capacity;if(e<=Math.floor(i/2)-t)vc(this._buf.subarray(this._off),this._buf);else{if(i+e>Fd)throw new Error("The buffer cannot be grown beyond the maximum size.");{const a=new Uint8Array(Math.min(2*i+e,Fd));vc(this._buf.subarray(this._off),a),this._buf=a}}return this._off=0,this._reslice(Math.min(t+e,Fd)),t}grow(e){if(e<0)throw Error("Buffer._grow: negative count");const t=this._grow(e);this._reslice(t)}readFrom(e){let t=0;const n=new Uint8Array(kw);for(;;){const i=this.capacity-this.length<kw,a=i?n:new Uint8Array(this._buf.buffer,this.length),u=e.read(a);if(u===null)return t;i?this.write(a.subarray(0,u)):this._reslice(this.length+u),t+=u}}}var en;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(en||(en={}));function Aw(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const HC=48;class Iw{dispatcher;state;as;drop;hdr;ma;argBuf;msgBuf;constructor(e){this.dispatcher=e,this.state=ke.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(e){let t;for(t=0;t<e.length;t++){const n=e[t];switch(this.state){case ke.OP_START:switch(n){case Ae.M:case Ae.m:this.state=ke.OP_M,this.hdr=-1,this.ma=Aw();break;case Ae.H:case Ae.h:this.state=ke.OP_H,this.hdr=0,this.ma=Aw();break;case Ae.P:case Ae.p:this.state=ke.OP_P;break;case Ae.PLUS:this.state=ke.OP_PLUS;break;case Ae.MINUS:this.state=ke.OP_MINUS;break;case Ae.I:case Ae.i:this.state=ke.OP_I;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_H:switch(n){case Ae.M:case Ae.m:this.state=ke.OP_M;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_M:switch(n){case Ae.S:case Ae.s:this.state=ke.OP_MS;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_MS:switch(n){case Ae.G:case Ae.g:this.state=ke.OP_MSG;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_MSG:switch(n){case Ae.SPACE:case Ae.TAB:this.state=ke.OP_MSG_SPC;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_MSG_SPC:switch(n){case Ae.SPACE:case Ae.TAB:continue;default:this.state=ke.MSG_ARG,this.as=t}break;case ke.MSG_ARG:switch(n){case Ae.CR:this.drop=1;break;case Ae.NL:{const i=this.argBuf?this.argBuf.bytes():e.subarray(this.as,t-this.drop);this.processMsgArgs(i),this.drop=0,this.as=t+1,this.state=ke.MSG_PAYLOAD,t=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;case ke.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const i=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:en.MSG,msg:this.ma,data:i}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ke.MSG_END}else{let i=this.ma.size-this.msgBuf.length;const a=e.length-t;a<i&&(i=a),i>0?(this.msgBuf.write(e.subarray(t,t+i)),t=t+i-1):this.msgBuf.writeByte(n)}else t-this.as>=this.ma.size&&(this.dispatcher.push({kind:en.MSG,msg:this.ma,data:e.subarray(this.as,t)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ke.MSG_END);break;case ke.MSG_END:switch(n){case Ae.NL:this.drop=0,this.as=t+1,this.state=ke.OP_START;break;default:continue}break;case ke.OP_PLUS:switch(n){case Ae.O:case Ae.o:this.state=ke.OP_PLUS_O;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_PLUS_O:switch(n){case Ae.K:case Ae.k:this.state=ke.OP_PLUS_OK;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_PLUS_OK:switch(n){case Ae.NL:this.dispatcher.push({kind:en.OK}),this.drop=0,this.state=ke.OP_START;break}break;case ke.OP_MINUS:switch(n){case Ae.E:case Ae.e:this.state=ke.OP_MINUS_E;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_MINUS_E:switch(n){case Ae.R:case Ae.r:this.state=ke.OP_MINUS_ER;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_MINUS_ER:switch(n){case Ae.R:case Ae.r:this.state=ke.OP_MINUS_ERR;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_MINUS_ERR:switch(n){case Ae.SPACE:case Ae.TAB:this.state=ke.OP_MINUS_ERR_SPC;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_MINUS_ERR_SPC:switch(n){case Ae.SPACE:case Ae.TAB:continue;default:this.state=ke.MINUS_ERR_ARG,this.as=t}break;case ke.MINUS_ERR_ARG:switch(n){case Ae.CR:this.drop=1;break;case Ae.NL:{let i;this.argBuf?(i=this.argBuf.bytes(),this.argBuf=void 0):i=e.subarray(this.as,t-this.drop),this.dispatcher.push({kind:en.ERR,data:i}),this.drop=0,this.as=t+1,this.state=ke.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(n))}break;case ke.OP_P:switch(n){case Ae.I:case Ae.i:this.state=ke.OP_PI;break;case Ae.O:case Ae.o:this.state=ke.OP_PO;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_PO:switch(n){case Ae.N:case Ae.n:this.state=ke.OP_PON;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_PON:switch(n){case Ae.G:case Ae.g:this.state=ke.OP_PONG;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_PONG:switch(n){case Ae.NL:this.dispatcher.push({kind:en.PONG}),this.drop=0,this.state=ke.OP_START;break}break;case ke.OP_PI:switch(n){case Ae.N:case Ae.n:this.state=ke.OP_PIN;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_PIN:switch(n){case Ae.G:case Ae.g:this.state=ke.OP_PING;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_PING:switch(n){case Ae.NL:this.dispatcher.push({kind:en.PING}),this.drop=0,this.state=ke.OP_START;break}break;case ke.OP_I:switch(n){case Ae.N:case Ae.n:this.state=ke.OP_IN;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_IN:switch(n){case Ae.F:case Ae.f:this.state=ke.OP_INF;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_INF:switch(n){case Ae.O:case Ae.o:this.state=ke.OP_INFO;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_INFO:switch(n){case Ae.SPACE:case Ae.TAB:this.state=ke.OP_INFO_SPC;break;default:throw this.fail(e.subarray(t))}break;case ke.OP_INFO_SPC:switch(n){case Ae.SPACE:case Ae.TAB:continue;default:this.state=ke.INFO_ARG,this.as=t}break;case ke.INFO_ARG:switch(n){case Ae.CR:this.drop=1;break;case Ae.NL:{let i;this.argBuf?(i=this.argBuf.bytes(),this.argBuf=void 0):i=e.subarray(this.as,t-this.drop),this.dispatcher.push({kind:en.INFO,data:i}),this.drop=0,this.as=t+1,this.state=ke.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;default:throw this.fail(e.subarray(t))}}(this.state===ke.MSG_ARG||this.state===ke.MINUS_ERR_ARG||this.state===ke.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Ld(e.subarray(this.as,t-this.drop))),this.state===ke.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Ld(e.subarray(this.as)))}cloneMsgArg(){const e=this.ma.subject.length,t=this.ma.reply?this.ma.reply.length:0,n=new Uint8Array(e+t);n.set(this.ma.subject),this.ma.reply&&n.set(this.ma.reply,e),this.argBuf=new Ld(n),this.ma.subject=n.subarray(0,e),this.ma.reply&&(this.ma.reply=n.subarray(e))}processMsgArgs(e){if(this.hdr>=0)return this.processHeaderMsgArgs(e);const t=[];let n=-1;for(let i=0;i<e.length;i++)switch(e[i]){case Ae.SPACE:case Ae.TAB:case Ae.CR:case Ae.NL:n>=0&&(t.push(e.subarray(n,i)),n=-1);break;default:n<0&&(n=i)}switch(n>=0&&t.push(e.subarray(n)),t.length){case 3:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(t[2]);break;case 4:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=t[2],this.ma.size=this.protoParseInt(t[3]);break;default:throw this.fail(e,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(e,"processMsgArgs Bad or Missing Size Error")}fail(e,t=""){return t?t=`${t} [${this.state}]`:t=`parse error [${this.state}]`,new Error(`${t}: ${cn.decode(e)}`)}processHeaderMsgArgs(e){const t=[];let n=-1;for(let i=0;i<e.length;i++)switch(e[i]){case Ae.SPACE:case Ae.TAB:case Ae.CR:case Ae.NL:n>=0&&(t.push(e.subarray(n,i)),n=-1);break;default:n<0&&(n=i)}switch(n>=0&&t.push(e.subarray(n)),t.length){case 4:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(t[2]),this.ma.size=this.protoParseInt(t[3]);break;case 5:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=t[2],this.ma.hdr=this.protoParseInt(t[3]),this.ma.size=this.protoParseInt(t[4]);break;default:throw this.fail(e,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(e){if(e.length===0)return-1;let t=0;for(let n=0;n<e.length;n++){if(e[n]<48||e[n]>57)return-1;t=t*10+(e[n]-HC)}return t}}var ke;(function(r){r[r.OP_START=0]="OP_START",r[r.OP_PLUS=1]="OP_PLUS",r[r.OP_PLUS_O=2]="OP_PLUS_O",r[r.OP_PLUS_OK=3]="OP_PLUS_OK",r[r.OP_MINUS=4]="OP_MINUS",r[r.OP_MINUS_E=5]="OP_MINUS_E",r[r.OP_MINUS_ER=6]="OP_MINUS_ER",r[r.OP_MINUS_ERR=7]="OP_MINUS_ERR",r[r.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",r[r.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",r[r.OP_M=10]="OP_M",r[r.OP_MS=11]="OP_MS",r[r.OP_MSG=12]="OP_MSG",r[r.OP_MSG_SPC=13]="OP_MSG_SPC",r[r.MSG_ARG=14]="MSG_ARG",r[r.MSG_PAYLOAD=15]="MSG_PAYLOAD",r[r.MSG_END=16]="MSG_END",r[r.OP_H=17]="OP_H",r[r.OP_P=18]="OP_P",r[r.OP_PI=19]="OP_PI",r[r.OP_PIN=20]="OP_PIN",r[r.OP_PING=21]="OP_PING",r[r.OP_PO=22]="OP_PO",r[r.OP_PON=23]="OP_PON",r[r.OP_PONG=24]="OP_PONG",r[r.OP_I=25]="OP_I",r[r.OP_IN=26]="OP_IN",r[r.OP_INF=27]="OP_INF",r[r.OP_INFO=28]="OP_INFO",r[r.OP_INFO_SPC=29]="OP_INFO_SPC",r[r.INFO_ARG=30]="INFO_ARG"})(ke||(ke={}));var Ae;(function(r){r[r.CR=13]="CR",r[r.E=69]="E",r[r.e=101]="e",r[r.F=70]="F",r[r.f=102]="f",r[r.G=71]="G",r[r.g=103]="g",r[r.H=72]="H",r[r.h=104]="h",r[r.I=73]="I",r[r.i=105]="i",r[r.K=75]="K",r[r.k=107]="k",r[r.M=77]="M",r[r.m=109]="m",r[r.MINUS=45]="MINUS",r[r.N=78]="N",r[r.n=110]="n",r[r.NL=10]="NL",r[r.O=79]="O",r[r.o=111]="o",r[r.P=80]="P",r[r.p=112]="p",r[r.PLUS=43]="PLUS",r[r.R=82]="R",r[r.r=114]="r",r[r.S=83]="S",r[r.s=115]="s",r[r.SPACE=32]="SPACE",r[r.TAB=9]="TAB"})(Ae||(Ae={})),function(r){var e=function(_,A){this.hi=_|0,this.lo=A|0},t=function(_){var A,k=new Float64Array(16);if(_)for(A=0;A<_.length;A++)k[A]=_[A];return k},n=function(){throw new Error("no PRNG")},i=new Uint8Array(16),a=new Uint8Array(32);a[0]=9;var u=t(),c=t([1]),f=t([56129,1]),h=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),p=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),m=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),g=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function b(_,A){return _<<A|_>>>32-A}function I(_,A){var k=_[A+3]&255;return k=k<<8|_[A+2]&255,k=k<<8|_[A+1]&255,k<<8|_[A+0]&255}function S(_,A){var k=_[A]<<24|_[A+1]<<16|_[A+2]<<8|_[A+3],C=_[A+4]<<24|_[A+5]<<16|_[A+6]<<8|_[A+7];return new e(k,C)}function w(_,A,k){var C;for(C=0;C<4;C++)_[A+C]=k&255,k>>>=8}function O(_,A,k){_[A]=k.hi>>24&255,_[A+1]=k.hi>>16&255,_[A+2]=k.hi>>8&255,_[A+3]=k.hi&255,_[A+4]=k.lo>>24&255,_[A+5]=k.lo>>16&255,_[A+6]=k.lo>>8&255,_[A+7]=k.lo&255}function P(_,A,k,C,j){var V,ue=0;for(V=0;V<j;V++)ue|=_[A+V]^k[C+V];return(1&ue-1>>>8)-1}function D(_,A,k,C){return P(_,A,k,C,16)}function T(_,A,k,C){return P(_,A,k,C,32)}function N(_,A,k,C,j){var V=new Uint32Array(16),ue=new Uint32Array(16),ge=new Uint32Array(16),X=new Uint32Array(4),ae,Le,vt;for(ae=0;ae<4;ae++)ue[5*ae]=I(C,4*ae),ue[1+ae]=I(k,4*ae),ue[6+ae]=I(A,4*ae),ue[11+ae]=I(k,16+4*ae);for(ae=0;ae<16;ae++)ge[ae]=ue[ae];for(ae=0;ae<20;ae++){for(Le=0;Le<4;Le++){for(vt=0;vt<4;vt++)X[vt]=ue[(5*Le+4*vt)%16];for(X[1]^=b(X[0]+X[3]|0,7),X[2]^=b(X[1]+X[0]|0,9),X[3]^=b(X[2]+X[1]|0,13),X[0]^=b(X[3]+X[2]|0,18),vt=0;vt<4;vt++)V[4*Le+(Le+vt)%4]=X[vt]}for(vt=0;vt<16;vt++)ue[vt]=V[vt]}if(j){for(ae=0;ae<16;ae++)ue[ae]=ue[ae]+ge[ae]|0;for(ae=0;ae<4;ae++)ue[5*ae]=ue[5*ae]-I(C,4*ae)|0,ue[6+ae]=ue[6+ae]-I(A,4*ae)|0;for(ae=0;ae<4;ae++)w(_,4*ae,ue[5*ae]),w(_,16+4*ae,ue[6+ae])}else for(ae=0;ae<16;ae++)w(_,4*ae,ue[ae]+ge[ae]|0)}function G(_,A,k,C){return N(_,A,k,C,!1),0}function q(_,A,k,C){return N(_,A,k,C,!0),0}var $=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(_,A,k,C,j,V,ue){var ge=new Uint8Array(16),X=new Uint8Array(64),ae,Le;if(!j)return 0;for(Le=0;Le<16;Le++)ge[Le]=0;for(Le=0;Le<8;Le++)ge[Le]=V[Le];for(;j>=64;){for(G(X,ge,ue,$),Le=0;Le<64;Le++)_[A+Le]=(k?k[C+Le]:0)^X[Le];for(ae=1,Le=8;Le<16;Le++)ae=ae+(ge[Le]&255)|0,ge[Le]=ae&255,ae>>>=8;j-=64,A+=64,k&&(C+=64)}if(j>0)for(G(X,ge,ue,$),Le=0;Le<j;Le++)_[A+Le]=(k?k[C+Le]:0)^X[Le];return 0}function oe(_,A,k,C,j){return K(_,A,null,0,k,C,j)}function re(_,A,k,C,j){var V=new Uint8Array(32);return q(V,C,j,$),oe(_,A,k,C.subarray(16),V)}function Ee(_,A,k,C,j,V,ue){var ge=new Uint8Array(32);return q(ge,V,ue,$),K(_,A,k,C,j,V.subarray(16),ge)}function ie(_,A){var k,C=0;for(k=0;k<17;k++)C=C+(_[k]+A[k]|0)|0,_[k]=C&255,C>>>=8}var me=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function we(_,A,k,C,j,V){var ue,ge,X,ae,Le=new Uint32Array(17),vt=new Uint32Array(17),tr=new Uint32Array(17),Sn=new Uint32Array(17),Ai=new Uint32Array(17);for(X=0;X<17;X++)vt[X]=tr[X]=0;for(X=0;X<16;X++)vt[X]=V[X];for(vt[3]&=15,vt[4]&=252,vt[7]&=15,vt[8]&=252,vt[11]&=15,vt[12]&=252,vt[15]&=15;j>0;){for(X=0;X<17;X++)Sn[X]=0;for(X=0;X<16&&X<j;++X)Sn[X]=k[C+X];for(Sn[X]=1,C+=X,j-=X,ie(tr,Sn),ge=0;ge<17;ge++)for(Le[ge]=0,X=0;X<17;X++)Le[ge]=Le[ge]+tr[X]*(X<=ge?vt[ge-X]:320*vt[ge+17-X]|0)|0|0;for(ge=0;ge<17;ge++)tr[ge]=Le[ge];for(ae=0,X=0;X<16;X++)ae=ae+tr[X]|0,tr[X]=ae&255,ae>>>=8;for(ae=ae+tr[16]|0,tr[16]=ae&3,ae=5*(ae>>>2)|0,X=0;X<16;X++)ae=ae+tr[X]|0,tr[X]=ae&255,ae>>>=8;ae=ae+tr[16]|0,tr[16]=ae}for(X=0;X<17;X++)Ai[X]=tr[X];for(ie(tr,me),ue=-(tr[16]>>>7)|0,X=0;X<17;X++)tr[X]^=ue&(Ai[X]^tr[X]);for(X=0;X<16;X++)Sn[X]=V[X+16];for(Sn[16]=0,ie(tr,Sn),X=0;X<16;X++)_[A+X]=tr[X];return 0}function Te(_,A,k,C,j,V){var ue=new Uint8Array(16);return we(ue,0,k,C,j,V),D(_,A,ue,0)}function ee(_,A,k,C,j){var V;if(k<32)return-1;for(Ee(_,0,A,0,k,C,j),we(_,16,_,32,k-32,_),V=0;V<16;V++)_[V]=0;return 0}function ye(_,A,k,C,j){var V,ue=new Uint8Array(32);if(k<32||(re(ue,0,32,C,j),Te(A,16,A,32,k-32,ue)!==0))return-1;for(Ee(_,0,A,0,k,C,j),V=0;V<32;V++)_[V]=0;return 0}function fe(_,A){var k;for(k=0;k<16;k++)_[k]=A[k]|0}function Pe(_){var A,k;for(k=0;k<16;k++)_[k]+=65536,A=Math.floor(_[k]/65536),_[(k+1)*(k<15?1:0)]+=A-1+37*(A-1)*(k===15?1:0),_[k]-=A*65536}function Be(_,A,k){for(var C,j=~(k-1),V=0;V<16;V++)C=j&(_[V]^A[V]),_[V]^=C,A[V]^=C}function ht(_,A){var k,C,j,V=t(),ue=t();for(k=0;k<16;k++)ue[k]=A[k];for(Pe(ue),Pe(ue),Pe(ue),C=0;C<2;C++){for(V[0]=ue[0]-65517,k=1;k<15;k++)V[k]=ue[k]-65535-(V[k-1]>>16&1),V[k-1]&=65535;V[15]=ue[15]-32767-(V[14]>>16&1),j=V[15]>>16&1,V[14]&=65535,Be(ue,V,1-j)}for(k=0;k<16;k++)_[2*k]=ue[k]&255,_[2*k+1]=ue[k]>>8}function It(_,A){var k=new Uint8Array(32),C=new Uint8Array(32);return ht(k,_),ht(C,A),T(k,0,C,0)}function ot(_){var A=new Uint8Array(32);return ht(A,_),A[0]&1}function tt(_,A){var k;for(k=0;k<16;k++)_[k]=A[2*k]+(A[2*k+1]<<8);_[15]&=32767}function Mt(_,A,k){var C;for(C=0;C<16;C++)_[C]=A[C]+k[C]|0}function St(_,A,k){var C;for(C=0;C<16;C++)_[C]=A[C]-k[C]|0}function Fe(_,A,k){var C,j,V=new Float64Array(31);for(C=0;C<31;C++)V[C]=0;for(C=0;C<16;C++)for(j=0;j<16;j++)V[C+j]+=A[C]*k[j];for(C=0;C<15;C++)V[C]+=38*V[C+16];for(C=0;C<16;C++)_[C]=V[C];Pe(_),Pe(_)}function Ge(_,A){Fe(_,A,A)}function W(_,A){var k=t(),C;for(C=0;C<16;C++)k[C]=A[C];for(C=253;C>=0;C--)Ge(k,k),C!==2&&C!==4&&Fe(k,k,A);for(C=0;C<16;C++)_[C]=k[C]}function Y(_,A){var k=t(),C;for(C=0;C<16;C++)k[C]=A[C];for(C=250;C>=0;C--)Ge(k,k),C!==1&&Fe(k,k,A);for(C=0;C<16;C++)_[C]=k[C]}function U(_,A,k){var C=new Uint8Array(32),j=new Float64Array(80),V,ue,ge=t(),X=t(),ae=t(),Le=t(),vt=t(),tr=t();for(ue=0;ue<31;ue++)C[ue]=A[ue];for(C[31]=A[31]&127|64,C[0]&=248,tt(j,k),ue=0;ue<16;ue++)X[ue]=j[ue],Le[ue]=ge[ue]=ae[ue]=0;for(ge[0]=Le[0]=1,ue=254;ue>=0;--ue)V=C[ue>>>3]>>>(ue&7)&1,Be(ge,X,V),Be(ae,Le,V),Mt(vt,ge,ae),St(ge,ge,ae),Mt(ae,X,Le),St(X,X,Le),Ge(Le,vt),Ge(tr,ge),Fe(ge,ae,ge),Fe(ae,X,vt),Mt(vt,ge,ae),St(ge,ge,ae),Ge(X,ge),St(ae,Le,tr),Fe(ge,ae,f),Mt(ge,ge,Le),Fe(ae,ae,ge),Fe(ge,Le,tr),Fe(Le,X,j),Ge(X,vt),Be(ge,X,V),Be(ae,Le,V);for(ue=0;ue<16;ue++)j[ue+16]=ge[ue],j[ue+32]=ae[ue],j[ue+48]=X[ue],j[ue+64]=Le[ue];var Sn=j.subarray(32),Ai=j.subarray(16);return W(Sn,Sn),Fe(Ai,Ai,Sn),ht(_,Ai),0}function Z(_,A){return U(_,A,a)}function ne(_,A){return n(A,32),Z(_,A)}function z(_,A,k){var C=new Uint8Array(32);return U(C,k,A),q(_,i,C,$)}var Oe=ee,We=ye;function $e(_,A,k,C,j,V){var ue=new Uint8Array(32);return z(ue,j,V),Oe(_,A,k,C,ue)}function ce(_,A,k,C,j,V){var ue=new Uint8Array(32);return z(ue,j,V),We(_,A,k,C,ue)}function Se(){var _=0,A=0,k=0,C=0,j=65535,V,ue,ge;for(ge=0;ge<arguments.length;ge++)V=arguments[ge].lo,ue=arguments[ge].hi,_+=V&j,A+=V>>>16,k+=ue&j,C+=ue>>>16;return A+=_>>>16,k+=A>>>16,C+=k>>>16,new e(k&j|C<<16,_&j|A<<16)}function Je(_,A){return new e(_.hi>>>A,_.lo>>>A|_.hi<<32-A)}function dt(){var _=0,A=0,k;for(k=0;k<arguments.length;k++)_^=arguments[k].lo,A^=arguments[k].hi;return new e(A,_)}function pt(_,A){var k,C,j=32-A;return A<32?(k=_.hi>>>A|_.lo<<j,C=_.lo>>>A|_.hi<<j):A<64&&(k=_.lo>>>A|_.hi<<j,C=_.hi>>>A|_.lo<<j),new e(k,C)}function Qt(_,A,k){var C=_.hi&A.hi^~_.hi&k.hi,j=_.lo&A.lo^~_.lo&k.lo;return new e(C,j)}function Et(_,A,k){var C=_.hi&A.hi^_.hi&k.hi^A.hi&k.hi,j=_.lo&A.lo^_.lo&k.lo^A.lo&k.lo;return new e(C,j)}function Xt(_){return dt(pt(_,28),pt(_,34),pt(_,39))}function zt(_){return dt(pt(_,14),pt(_,18),pt(_,41))}function xr(_){return dt(pt(_,1),pt(_,8),Je(_,7))}function Vt(_){return dt(pt(_,19),pt(_,61),Je(_,6))}var dr=[new e(1116352408,3609767458),new e(1899447441,602891725),new e(3049323471,3964484399),new e(3921009573,2173295548),new e(961987163,4081628472),new e(1508970993,3053834265),new e(2453635748,2937671579),new e(2870763221,3664609560),new e(3624381080,2734883394),new e(310598401,1164996542),new e(607225278,1323610764),new e(1426881987,3590304994),new e(1925078388,4068182383),new e(2162078206,991336113),new e(2614888103,633803317),new e(3248222580,3479774868),new e(3835390401,2666613458),new e(4022224774,944711139),new e(264347078,2341262773),new e(604807628,2007800933),new e(770255983,1495990901),new e(1249150122,1856431235),new e(1555081692,3175218132),new e(1996064986,2198950837),new e(2554220882,3999719339),new e(2821834349,766784016),new e(2952996808,2566594879),new e(3210313671,3203337956),new e(3336571891,1034457026),new e(3584528711,2466948901),new e(113926993,3758326383),new e(338241895,168717936),new e(666307205,1188179964),new e(773529912,1546045734),new e(1294757372,1522805485),new e(1396182291,2643833823),new e(1695183700,2343527390),new e(1986661051,1014477480),new e(2177026350,1206759142),new e(2456956037,344077627),new e(2730485921,1290863460),new e(2820302411,3158454273),new e(3259730800,3505952657),new e(3345764771,106217008),new e(3516065817,3606008344),new e(3600352804,1432725776),new e(4094571909,1467031594),new e(275423344,851169720),new e(430227734,3100823752),new e(506948616,1363258195),new e(659060556,3750685593),new e(883997877,3785050280),new e(958139571,3318307427),new e(1322822218,3812723403),new e(1537002063,2003034995),new e(1747873779,3602036899),new e(1955562222,1575990012),new e(2024104815,1125592928),new e(2227730452,2716904306),new e(2361852424,442776044),new e(2428436474,593698344),new e(2756734187,3733110249),new e(3204031479,2999351573),new e(3329325298,3815920427),new e(3391569614,3928383900),new e(3515267271,566280711),new e(3940187606,3454069534),new e(4118630271,4000239992),new e(116418474,1914138554),new e(174292421,2731055270),new e(289380356,3203993006),new e(460393269,320620315),new e(685471733,587496836),new e(852142971,1086792851),new e(1017036298,365543100),new e(1126000580,2618297676),new e(1288033470,3409855158),new e(1501505948,4234509866),new e(1607167915,987167468),new e(1816402316,1246189591)];function pr(_,A,k){var C=[],j=[],V=[],ue=[],ge,X,ae;for(X=0;X<8;X++)C[X]=V[X]=S(_,8*X);for(var Le=0;k>=128;){for(X=0;X<16;X++)ue[X]=S(A,8*X+Le);for(X=0;X<80;X++){for(ae=0;ae<8;ae++)j[ae]=V[ae];for(ge=Se(V[7],zt(V[4]),Qt(V[4],V[5],V[6]),dr[X],ue[X%16]),j[7]=Se(ge,Xt(V[0]),Et(V[0],V[1],V[2])),j[3]=Se(j[3],ge),ae=0;ae<8;ae++)V[(ae+1)%8]=j[ae];if(X%16===15)for(ae=0;ae<16;ae++)ue[ae]=Se(ue[ae],ue[(ae+9)%16],xr(ue[(ae+1)%16]),Vt(ue[(ae+14)%16]))}for(X=0;X<8;X++)V[X]=Se(V[X],C[X]),C[X]=V[X];Le+=128,k-=128}for(X=0;X<8;X++)O(_,8*X,C[X]);return k}var Or=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function Wt(_,A,k){var C=new Uint8Array(64),j=new Uint8Array(256),V,ue=k;for(V=0;V<64;V++)C[V]=Or[V];for(pr(C,A,k),k%=128,V=0;V<256;V++)j[V]=0;for(V=0;V<k;V++)j[V]=A[ue-k+V];for(j[k]=128,k=256-128*(k<112?1:0),j[k-9]=0,O(j,k-8,new e(ue/536870912|0,ue<<3)),pr(C,j,k),V=0;V<64;V++)_[V]=C[V];return 0}function Q(_,A){var k=t(),C=t(),j=t(),V=t(),ue=t(),ge=t(),X=t(),ae=t(),Le=t();St(k,_[1],_[0]),St(Le,A[1],A[0]),Fe(k,k,Le),Mt(C,_[0],_[1]),Mt(Le,A[0],A[1]),Fe(C,C,Le),Fe(j,_[3],A[3]),Fe(j,j,p),Fe(V,_[2],A[2]),Mt(V,V,V),St(ue,C,k),St(ge,V,j),Mt(X,V,j),Mt(ae,C,k),Fe(_[0],ue,ge),Fe(_[1],ae,X),Fe(_[2],X,ge),Fe(_[3],ue,ae)}function J(_,A,k){var C;for(C=0;C<4;C++)Be(_[C],A[C],k)}function it(_,A){var k=t(),C=t(),j=t();W(j,A[2]),Fe(k,A[0],j),Fe(C,A[1],j),ht(_,C),_[31]^=ot(k)<<7}function mt(_,A,k){var C,j;for(fe(_[0],u),fe(_[1],c),fe(_[2],c),fe(_[3],u),j=255;j>=0;--j)C=k[j/8|0]>>(j&7)&1,J(_,A,C),Q(A,_),Q(_,_),J(_,A,C)}function lt(_,A){var k=[t(),t(),t(),t()];fe(k[0],m),fe(k[1],y),fe(k[2],c),Fe(k[3],m,y),mt(_,k,A)}function Ve(_,A,k){var C=new Uint8Array(64),j=[t(),t(),t(),t()],V;for(k||n(A,32),Wt(C,A,32),C[0]&=248,C[31]&=127,C[31]|=64,lt(j,C),it(_,j),V=0;V<32;V++)A[V+32]=_[V];return 0}var ur=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Jt(_,A){var k,C,j,V;for(C=63;C>=32;--C){for(k=0,j=C-32,V=C-12;j<V;++j)A[j]+=k-16*A[C]*ur[j-(C-32)],k=Math.floor((A[j]+128)/256),A[j]-=k*256;A[j]+=k,A[C]=0}for(k=0,j=0;j<32;j++)A[j]+=k-(A[31]>>4)*ur[j],k=A[j]>>8,A[j]&=255;for(j=0;j<32;j++)A[j]-=k*ur[j];for(C=0;C<32;C++)A[C+1]+=A[C]>>8,_[C]=A[C]&255}function Yt(_){var A=new Float64Array(64),k;for(k=0;k<64;k++)A[k]=_[k];for(k=0;k<64;k++)_[k]=0;Jt(_,A)}function Mr(_,A,k,C){var j=new Uint8Array(64),V=new Uint8Array(64),ue=new Uint8Array(64),ge,X,ae=new Float64Array(64),Le=[t(),t(),t(),t()];Wt(j,C,32),j[0]&=248,j[31]&=127,j[31]|=64;var vt=k+64;for(ge=0;ge<k;ge++)_[64+ge]=A[ge];for(ge=0;ge<32;ge++)_[32+ge]=j[32+ge];for(Wt(ue,_.subarray(32),k+32),Yt(ue),lt(Le,ue),it(_,Le),ge=32;ge<64;ge++)_[ge]=C[ge];for(Wt(V,_,k+64),Yt(V),ge=0;ge<64;ge++)ae[ge]=0;for(ge=0;ge<32;ge++)ae[ge]=ue[ge];for(ge=0;ge<32;ge++)for(X=0;X<32;X++)ae[ge+X]+=V[ge]*j[X];return Jt(_.subarray(32),ae),vt}function jr(_,A){var k=t(),C=t(),j=t(),V=t(),ue=t(),ge=t(),X=t();return fe(_[2],c),tt(_[1],A),Ge(j,_[1]),Fe(V,j,h),St(j,j,_[2]),Mt(V,_[2],V),Ge(ue,V),Ge(ge,ue),Fe(X,ge,ue),Fe(k,X,j),Fe(k,k,V),Y(k,k),Fe(k,k,j),Fe(k,k,V),Fe(k,k,V),Fe(_[0],k,V),Ge(C,_[0]),Fe(C,C,V),It(C,j)&&Fe(_[0],_[0],g),Ge(C,_[0]),Fe(C,C,V),It(C,j)?-1:(ot(_[0])===A[31]>>7&&St(_[0],u,_[0]),Fe(_[3],_[0],_[1]),0)}function Ur(_,A,k,C){var j,V=new Uint8Array(32),ue=new Uint8Array(64),ge=[t(),t(),t(),t()],X=[t(),t(),t(),t()];if(k<64||jr(X,C))return-1;for(j=0;j<k;j++)_[j]=A[j];for(j=0;j<32;j++)_[j+32]=C[j];if(Wt(ue,_,k),Yt(ue),mt(ge,X,ue),lt(X,A.subarray(32)),Q(ge,X),it(V,ge),k-=64,T(A,0,V,0)){for(j=0;j<k;j++)_[j]=0;return-1}for(j=0;j<k;j++)_[j]=A[j+64];return k}var qt=32,Er=24,zr=32,Dr=16,er=32,Hr=32,Tr=32,gr=32,kr=32,_n=Er,M=zr,pe=Dr,xe=64,je=32,ze=64,Qe=32,et=64;r.lowlevel={crypto_core_hsalsa20:q,crypto_stream_xor:Ee,crypto_stream:re,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:oe,crypto_onetimeauth:we,crypto_onetimeauth_verify:Te,crypto_verify_16:D,crypto_verify_32:T,crypto_secretbox:ee,crypto_secretbox_open:ye,crypto_scalarmult:U,crypto_scalarmult_base:Z,crypto_box_beforenm:z,crypto_box_afternm:Oe,crypto_box:$e,crypto_box_open:ce,crypto_box_keypair:ne,crypto_hash:Wt,crypto_sign:Mr,crypto_sign_keypair:Ve,crypto_sign_open:Ur,crypto_secretbox_KEYBYTES:qt,crypto_secretbox_NONCEBYTES:Er,crypto_secretbox_ZEROBYTES:zr,crypto_secretbox_BOXZEROBYTES:Dr,crypto_scalarmult_BYTES:er,crypto_scalarmult_SCALARBYTES:Hr,crypto_box_PUBLICKEYBYTES:Tr,crypto_box_SECRETKEYBYTES:gr,crypto_box_BEFORENMBYTES:kr,crypto_box_NONCEBYTES:_n,crypto_box_ZEROBYTES:M,crypto_box_BOXZEROBYTES:pe,crypto_sign_BYTES:xe,crypto_sign_PUBLICKEYBYTES:je,crypto_sign_SECRETKEYBYTES:ze,crypto_sign_SEEDBYTES:Qe,crypto_hash_BYTES:et,gf:t,D:h,L:ur,pack25519:ht,unpack25519:tt,M:Fe,A:Mt,S:Ge,Z:St,pow2523:Y,add:Q,set25519:fe,modL:Jt,scalarmult:mt,scalarbase:lt};function Ye(_,A){if(_.length!==qt)throw new Error("bad key size");if(A.length!==Er)throw new Error("bad nonce size")}function Ht(_,A){if(_.length!==Tr)throw new Error("bad public key size");if(A.length!==gr)throw new Error("bad secret key size")}function He(){for(var _=0;_<arguments.length;_++)if(!(arguments[_]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function gt(_){for(var A=0;A<_.length;A++)_[A]=0}r.randomBytes=function(_){var A=new Uint8Array(_);return n(A,_),A},r.secretbox=function(_,A,k){He(_,A,k),Ye(k,A);for(var C=new Uint8Array(zr+_.length),j=new Uint8Array(C.length),V=0;V<_.length;V++)C[V+zr]=_[V];return ee(j,C,C.length,A,k),j.subarray(Dr)},r.secretbox.open=function(_,A,k){He(_,A,k),Ye(k,A);for(var C=new Uint8Array(Dr+_.length),j=new Uint8Array(C.length),V=0;V<_.length;V++)C[V+Dr]=_[V];return C.length<32||ye(j,C,C.length,A,k)!==0?null:j.subarray(zr)},r.secretbox.keyLength=qt,r.secretbox.nonceLength=Er,r.secretbox.overheadLength=Dr,r.scalarMult=function(_,A){if(He(_,A),_.length!==Hr)throw new Error("bad n size");if(A.length!==er)throw new Error("bad p size");var k=new Uint8Array(er);return U(k,_,A),k},r.scalarMult.base=function(_){if(He(_),_.length!==Hr)throw new Error("bad n size");var A=new Uint8Array(er);return Z(A,_),A},r.scalarMult.scalarLength=Hr,r.scalarMult.groupElementLength=er,r.box=function(_,A,k,C){var j=r.box.before(k,C);return r.secretbox(_,A,j)},r.box.before=function(_,A){He(_,A),Ht(_,A);var k=new Uint8Array(kr);return z(k,_,A),k},r.box.after=r.secretbox,r.box.open=function(_,A,k,C){var j=r.box.before(k,C);return r.secretbox.open(_,A,j)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var _=new Uint8Array(Tr),A=new Uint8Array(gr);return ne(_,A),{publicKey:_,secretKey:A}},r.box.keyPair.fromSecretKey=function(_){if(He(_),_.length!==gr)throw new Error("bad secret key size");var A=new Uint8Array(Tr);return Z(A,_),{publicKey:A,secretKey:new Uint8Array(_)}},r.box.publicKeyLength=Tr,r.box.secretKeyLength=gr,r.box.sharedKeyLength=kr,r.box.nonceLength=_n,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(_,A){if(He(_,A),A.length!==ze)throw new Error("bad secret key size");var k=new Uint8Array(xe+_.length);return Mr(k,_,_.length,A),k},r.sign.open=function(_,A){if(He(_,A),A.length!==je)throw new Error("bad public key size");var k=new Uint8Array(_.length),C=Ur(k,_,_.length,A);if(C<0)return null;for(var j=new Uint8Array(C),V=0;V<j.length;V++)j[V]=k[V];return j},r.sign.detached=function(_,A){for(var k=r.sign(_,A),C=new Uint8Array(xe),j=0;j<C.length;j++)C[j]=k[j];return C},r.sign.detached.verify=function(_,A,k){if(He(_,A,k),A.length!==xe)throw new Error("bad signature size");if(k.length!==je)throw new Error("bad public key size");var C=new Uint8Array(xe+_.length),j=new Uint8Array(xe+_.length),V;for(V=0;V<xe;V++)C[V]=A[V];for(V=0;V<_.length;V++)C[V+xe]=_[V];return Ur(j,C,C.length,k)>=0},r.sign.keyPair=function(){var _=new Uint8Array(je),A=new Uint8Array(ze);return Ve(_,A),{publicKey:_,secretKey:A}},r.sign.keyPair.fromSecretKey=function(_){if(He(_),_.length!==ze)throw new Error("bad secret key size");for(var A=new Uint8Array(je),k=0;k<A.length;k++)A[k]=_[32+k];return{publicKey:A,secretKey:new Uint8Array(_)}},r.sign.keyPair.fromSeed=function(_){if(He(_),_.length!==Qe)throw new Error("bad seed size");for(var A=new Uint8Array(je),k=new Uint8Array(ze),C=0;C<32;C++)k[C]=_[C];return Ve(A,k,!0),{publicKey:A,secretKey:k}},r.sign.publicKeyLength=je,r.sign.secretKeyLength=ze,r.sign.seedLength=Qe,r.sign.signatureLength=xe,r.hash=function(_){He(_);var A=new Uint8Array(et);return Wt(A,_,_.length),A},r.hash.hashLength=et,r.verify=function(_,A){return He(_,A),_.length===0||A.length===0||_.length!==A.length?!1:P(_,0,A,0,_.length)===0},r.setPRNG=function(_){n=_},function(){var _=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(_&&_.getRandomValues){var A=65536;r.setPRNG(function(k,C){var j,V=new Uint8Array(C);for(j=0;j<C;j+=A)_.getRandomValues(V.subarray(j,j+Math.min(C-j,A)));for(j=0;j<C;j++)k[j]=V[j];gt(V)})}else typeof require<"u"&&(_=require("crypto"),_&&_.randomBytes&&r.setPRNG(function(k,C){var j,V=_.randomBytes(C);for(j=0;j<C;j++)k[j]=V[j];gt(V)}))}()}(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const bc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,GC={fromSeed:bc.sign.keyPair.fromSeed,sign:bc.sign.detached,verify:bc.sign.detached.verify,randomBytes:bc.randomBytes};let Cw;function QC(r){Cw=r}function us(){return Cw}const JC=new Uint16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);class wc{static checksum(e){let t=0;for(let n=0;n<e.byteLength;n++){let i=e[n];t=t<<8&65535^JC[(t>>8^i)&255]}return t}static validate(e,t){return wc.checksum(e)==t}}const qd="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class Pw{static encode(e){let t=0,n=0,i=new Uint8Array(e),a=new Uint8Array(e.byteLength*2),u=0;for(let c=0;c<i.byteLength;c++)for(n=n<<8|i[c],t+=8;t>=5;){let f=n>>>t-5&31;a[u++]=qd.charAt(f).charCodeAt(0),t-=5}if(t>0){let c=n<<5-t&31;a[u++]=qd.charAt(c).charCodeAt(0)}return a.slice(0,u)}static decode(e){let t=0,n=0,i=0,a=new Uint8Array(e),u=new Uint8Array(a.byteLength*5/8|0);for(let c=0;c<a.byteLength;c++){let f=String.fromCharCode(a[c]),h=qd.indexOf(f);if(h===-1)throw new Error("Illegal Base32 character: "+a[c]);n=n<<5|h,t+=5,t>=8&&(u[i++]=n>>>t-8&255,t-=8)}return u.slice(0,i)}}class $t extends Error{name;code;chainedError;constructor(e,t){super(e),this.name="NKeysError",this.code=e,this.chainedError=t}}function YC(){return _c(Bt.Operator)}function KC(){return _c(Bt.Account)}function ZC(){return _c(Bt.User)}var Lt;(function(r){r.InvalidPrefixByte="nkeys: invalid prefix byte",r.InvalidKey="nkeys: invalid key",r.InvalidPublicKey="nkeys: invalid public key",r.InvalidSeedLen="nkeys: invalid seed length",r.InvalidSeed="nkeys: invalid seed",r.InvalidEncoding="nkeys: invalid encoded key",r.InvalidSignature="nkeys: signature verification failed",r.CannotSign="nkeys: cannot sign, no private key available",r.PublicKeyOnly="nkeys: no seed or private key available",r.InvalidChecksum="nkeys: invalid checksum",r.SerializationError="nkeys: serialization error",r.ApiError="nkeys: api error",r.ClearedPair="nkeys: pair is cleared"})(Lt||(Lt={}));var Bt;(function(r){r[r.Seed=144]="Seed",r[r.Private=120]="Private",r[r.Operator=112]="Operator",r[r.Server=104]="Server",r[r.Cluster=16]="Cluster",r[r.Account=0]="Account",r[r.User=160]="User"})(Bt||(Bt={}));class Ta{static isValidPublicPrefix(e){return e==Bt.Server||e==Bt.Operator||e==Bt.Cluster||e==Bt.Account||e==Bt.User}static startsWithValidPrefix(e){let t=e[0];return t=="S"||t=="P"||t=="O"||t=="N"||t=="C"||t=="A"||t=="U"}static isValidPrefix(e){return this.parsePrefix(e)!=-1}static parsePrefix(e){switch(e){case Bt.Seed:return Bt.Seed;case Bt.Private:return Bt.Private;case Bt.Operator:return Bt.Operator;case Bt.Server:return Bt.Server;case Bt.Cluster:return Bt.Cluster;case Bt.Account:return Bt.Account;case Bt.User:return Bt.User;default:return-1}}}class tn{static encode(e,t){if(!t||!(t instanceof Uint8Array))throw new $t(Lt.SerializationError);if(!Ta.isValidPrefix(e))throw new $t(Lt.InvalidPrefixByte);return tn._encode(!1,e,t)}static encodeSeed(e,t){if(!t)throw new $t(Lt.ApiError);if(!Ta.isValidPublicPrefix(e))throw new $t(Lt.InvalidPrefixByte);if(t.byteLength!==32)throw new $t(Lt.InvalidSeedLen);return tn._encode(!0,e,t)}static decode(e,t){if(!Ta.isValidPrefix(e))throw new $t(Lt.InvalidPrefixByte);const n=tn._decode(t);if(n[0]!==e)throw new $t(Lt.InvalidPrefixByte);return n.slice(1)}static decodeSeed(e){const t=tn._decode(e),n=tn._decodePrefix(t);if(n[0]!=Bt.Seed)throw new $t(Lt.InvalidSeed);if(!Ta.isValidPublicPrefix(n[1]))throw new $t(Lt.InvalidPrefixByte);return{buf:t.slice(2),prefix:n[1]}}static _encode(e,t,n){const i=e?2:1,a=n.byteLength,u=i+a+2,c=i+a,f=new Uint8Array(u);if(e){const m=tn._encodePrefix(Bt.Seed,t);f.set(m)}else f[0]=t;f.set(n,i);const h=wc.checksum(f.slice(0,c));return new DataView(f.buffer).setUint16(c,h,!0),Pw.encode(f)}static _decode(e){if(e.byteLength<4)throw new $t(Lt.InvalidEncoding);let t;try{t=Pw.decode(e)}catch(c){throw new $t(Lt.InvalidEncoding,c)}const n=t.byteLength-2,a=new DataView(t.buffer).getUint16(n,!0),u=t.slice(0,n);if(!wc.validate(u,a))throw new $t(Lt.InvalidChecksum);return u}static _encodePrefix(e,t){const n=e|t>>5,i=(t&31)<<3;return new Uint8Array([n,i])}static _decodePrefix(e){const t=e[0]&248,n=(e[0]&7)<<5|(e[1]&248)>>3;return new Uint8Array([t,n])}}class Nw{seed;constructor(e){this.seed=e}getRawSeed(){if(!this.seed)throw new $t(Lt.ClearedPair);return tn.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new $t(Lt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new $t(Lt.ClearedPair);const e=tn.decodeSeed(this.seed),t=us().fromSeed(this.getRawSeed()),n=tn.encode(e.prefix,t.publicKey);return new TextDecoder().decode(n)}getPrivateKey(){if(!this.seed)throw new $t(Lt.ClearedPair);const e=us().fromSeed(this.getRawSeed());return tn.encode(Bt.Private,e.secretKey)}sign(e){if(!this.seed)throw new $t(Lt.ClearedPair);const t=us().fromSeed(this.getRawSeed());return us().sign(e,t.secretKey)}verify(e,t){if(!this.seed)throw new $t(Lt.ClearedPair);const n=us().fromSeed(this.getRawSeed());return us().verify(e,t,n.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function _c(r){const e=us().randomBytes(32);let t=tn.encodeSeed(r,new Uint8Array(e));return new Nw(t)}class XC{publicKey;constructor(e){this.publicKey=e}getPublicKey(){if(!this.publicKey)throw new $t(Lt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new $t(Lt.PublicKeyOnly):new $t(Lt.ClearedPair)}getSeed(){throw this.publicKey?new $t(Lt.PublicKeyOnly):new $t(Lt.ClearedPair)}sign(e){throw this.publicKey?new $t(Lt.CannotSign):new $t(Lt.ClearedPair)}verify(e,t){if(!this.publicKey)throw new $t(Lt.ClearedPair);let n=tn._decode(this.publicKey);return us().verify(e,t,n.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function eP(r){const e=new TextEncoder().encode(r),t=tn._decode(e),n=Ta.parsePrefix(t[0]);if(Ta.isValidPublicPrefix(n))return new XC(e);throw new $t(Lt.InvalidPublicKey)}function tP(r){return tn.decodeSeed(r),new Nw(r)}function rP(r){return btoa(String.fromCharCode(...r))}function nP(r){const e=atob(r),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}QC(GC);const Rw={createAccount:KC,createOperator:YC,createPair:_c,createUser:ZC,fromPublic:eP,fromSeed:tP,NKeysError:$t,NKeysErrorCode:Lt,Prefix:Bt,decode:nP,encode:rP};function iP(r){return e=>{let t={};return r.forEach(n=>{const i=n(e)||{};t=Object.assign(t,i)}),t}}function sP(){return()=>{}}function aP(r,e){return()=>{const t=typeof r=="function"?r():r,n=typeof e=="function"?e():e;return{user:t,pass:n}}}function oP(r){return()=>({auth_token:typeof r=="function"?r():r})}function uP(r){return e=>{const t=typeof r=="function"?r():r,n=t?Rw.fromSeed(t):void 0,i=n?n.getPublicKey():"",a=Ei.encode(e||""),u=n!==void 0&&e?n.sign(a):void 0,c=u?Rw.encode(u):"";return{nkey:i,sig:c}}}function cP(r,e){return t=>{const n=typeof r=="function"?r():r,i=uP(e),{nkey:a,sig:u}=i(t);return{jwt:n,nkey:a,sig:u}}}function lP(r){const e=typeof r!="function"?()=>r:r,t=()=>{const a=/\s*(?:(?:[-]{3,}[^\n]*[-]{3,}\n)(.+)(?:\n\s*[-]{3,}[^\n]*[-]{3,}\n))/ig,u=cn.decode(e());let c=a.exec(u);if(!c)throw Me.errorForCode(_e.BadCreds);const f=c[1].trim();if(c=a.exec(u),!c||!c)throw Me.errorForCode(_e.BadCreds);const h=Ei.encode(c[1].trim());return{jwt:f,seed:h}};return cP(()=>{const{jwt:a}=t();return a},()=>{const{seed:a}=t();return a})}const Mw=120*1e3,fP=2,Dw=2*1e3;function hP(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Mw,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Dw,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function dP(r){const e=[];return typeof r.authenticator=="function"&&e.push(r.authenticator),Array.isArray(r.authenticator)&&e.push(...r.authenticator),r.token&&e.push(oP(r.token)),r.user&&e.push(aP(r.user,r.pass)),e.length===0?sP():iP(e)}function pP(r){const e=`${wd}:${Ew()}`;if(r=r||{servers:[e]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new Me("port and servers options are mutually exclusive",_e.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${wd}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[e]);const t=lc(hP(),r);if(t.authenticator=dP(t),["reconnectDelayHandler","authenticator"].forEach(n=>{if(t[n]&&typeof t[n]!="function")throw new Me(`${n} option should be a function`,_e.NotFunction)}),t.reconnectDelayHandler||(t.reconnectDelayHandler=()=>{let n=t.tls?t.reconnectJitterTLS:t.reconnectJitter;return n&&(n++,n=Math.floor(Math.random()*n)),t.reconnectTimeWait+n}),t.inboxPrefix)try{Ti(t.inboxPrefix)}catch(n){throw new Me(n.message,_e.ApiError)}if(t.resolve===void 0&&(t.resolve=typeof Rd()=="function"),t.resolve&&typeof Rd()!="function")throw new Me("'resolve' is not supported on this client",_e.InvalidOption);return t}function mP(r,e){const{proto:t,tls_required:n,tls_available:i}=r;if((t===void 0||t<1)&&e.noEcho)throw new Me("noEcho",_e.ServerOptionNotAvailable);const a=n||i||!1;if(e.tls&&!a)throw new Me("tls",_e.ServerOptionNotAvailable)}const yP=1024*32,gP=/^INFO\s+([^\r\n]+)\r\n/i,vP=Ao(`PONG\r
|
|
150
|
+
`),Fw=Ao(`PING\r
|
|
151
|
+
`);class bP{echo;no_responders;protocol;verbose;pedantic;jwt;nkey;sig;user;pass;auth_token;tls_required;name;lang;version;headers;constructor(e,t,n){this.protocol=1,this.version=e.version,this.lang=e.lang,this.echo=t.noEcho?!1:void 0,this.verbose=t.verbose,this.pedantic=t.pedantic,this.tls_required=t.tls?!0:void 0,this.name=t.name;const i=(t&&typeof t.authenticator=="function"?t.authenticator(n):{})||{};lc(this,i)}}class Lw extends Nr{sid;queue;draining;max;subject;drained;protocol;timer;info;cleanupFn;closed;requestSubject;constructor(e,t,n={}){super(),lc(this,n),this.protocol=e,this.subject=t,this.draining=!1,this.noIterator=typeof n.callback=="function",this.closed=ir();const i=!e.options?.noAsyncTraces;n.timeout&&(this.timer=ga(n.timeout,i),this.timer.then(()=>{this.timer=void 0}).catch(a=>{this.stop(a),this.noIterator&&this.callback(a,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(e){if(this.noIterator){const t=this.callback,n=e.ingestionFilterFn?e.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),i=e.protocolFilterFn?e.protocolFilterFn:()=>!0,a=e.dispatchedFn?e.dispatchedFn:()=>{};this.callback=(u,c)=>{const{ingest:f}=n(c);f&&i(c)&&(t(u,c),a(c))}}else this.protocolFilterFn=e.protocolFilterFn,this.dispatchedFn=e.dispatchedFn}callback(e,t){this.cancelTimeout(),e?this.stop(e):this.push(t)}close(){if(!this.isClosed()){this.cancelTimeout();const e=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?e():this.push(e)}}unsubscribe(e){this.protocol.unsubscribe(this,e)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(Me.errorForCode(_e.ConnectionClosed)):this.isClosed()?Promise.reject(Me.errorForCode(_e.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(ir()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class wP{mux;subs;sidCounter;constructor(){this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(e){return this.sidCounter++,e.sid=this.sidCounter,this.subs.set(e.sid,e),e}setMux(e){return this.mux=e,e}getMux(){return this.mux}get(e){return this.subs.get(e)}resub(e){return this.sidCounter++,this.subs.delete(e.sid),e.sid=this.sidCounter,this.subs.set(e.sid,e),e}all(){return Array.from(this.subs.values())}cancel(e){e&&(e.close(),this.subs.delete(e.sid))}handleError(e){if(e&&e.permissionContext){const t=e.permissionContext,n=this.all();let i;if(t.operation==="subscription"&&(i=n.find(a=>a.subject===t.subject&&a.queue===t.queue)),t.operation==="publish"&&(i=n.find(a=>a.requestSubject===t.subject)),i)return i.callback(e,{}),i.close(),this.subs.delete(i.sid),i!==this.mux}return!1}close(){this.subs.forEach(e=>{e.close()})}}class Sc{connected;connectedOnce;infoReceived;info;muxSubscriptions;options;outbound;pongs;subscriptions;transport;noMorePublishing;connectError;publisher;_closed;closed;listeners;heartbeats;parser;outMsgs;inMsgs;outBytes;inBytes;pendingLimit;lastError;abortReconnect;whyClosed;servers;server;features;connectPromise;constructor(e,t){this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=yP,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=e,this.publisher=t,this.subscriptions=new wP,this.muxSubscriptions=new BC,this.outbound=new Ea,this.pongs=[],this.whyClosed="",this.pendingLimit=e.pendingLimit||this.pendingLimit,this.features=new SC({major:0,minor:0,micro:0}),this.connectPromise=null;const n=typeof e.servers=="string"?[e.servers]:e.servers;this.servers=new $C(n,{randomize:!e.noRandomize}),this.closed=ir(),this.parser=new Iw(this),this.heartbeats=new VC(this,this.options.pingInterval||Mw,this.options.maxPingOut||fP)}resetOutbound(){this.outbound.reset();const e=this.pongs;this.pongs=[];const t=Me.errorForCode(_e.Disconnect);t.stack="",e.forEach(n=>{n.reject(t)}),this.parser=new Iw(this),this.infoReceived=!1}dispatchStatus(e){this.listeners.forEach(t=>{t.push(e)})}status(){const e=new Nr;return this.listeners.push(e),e}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const e=ir();return e.catch(()=>{}),this.pongs.unshift(e),this.connectError=t=>{e.reject(t)},this.transport=OC(),this.transport.closed().then(async t=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),e}disconnect(){this.dispatchStatus({type:ya.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:ya.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(e){this.dispatchStatus({type:Oi.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{this.dispatchStatus({type:Oi.Reconnect,data:this.servers.getCurrentServer().toString()}),this.lastError?.code===_e.AuthenticationExpired&&(this.lastError=void 0)}).catch(t=>{this._close(t)}):await this._close(e)}async dial(e){const t=this.prepare();let n;try{n=ga(this.options.timeout||2e4);const i=this.transport.connect(e,this.options);await Promise.race([i,n]),(async()=>{try{for await(const a of this.transport)this.parser.parse(a)}catch(a){console.log("reader closed",a)}})().then()}catch(i){t.reject(i)}try{await Promise.race([n,t]),n&&n.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(i){throw n&&n.cancel(),await this.transport.close(i),i}}async _doDial(e){const{resolve:t}=this.options,n=await e.resolve({fn:Rd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:t});let i=null;for(const a of n)try{i=null,this.dispatchStatus({type:ya.Reconnecting,data:a.toString()}),await this.dial(a);return}catch(u){i=u}throw i}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let e;for(;;){this._closed&&this.servers.clear();const t=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Dw;let n=t;const i=this.selectServer();if(!i||this.abortReconnect)throw e||(this.lastError?this.lastError:Me.errorForCode(_e.ConnectionRefused));const a=Date.now();if(i.lastConnect===0||i.lastConnect+t<=a){i.lastConnect=Date.now();try{await this._doDial(i);break}catch(u){if(e=u,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}i.reconnects++;const c=this.options.maxReconnectAttempts||0;c!==-1&&i.reconnects>=c&&this.servers.removeCurrentServer()}}else n=Math.min(n,i.lastConnect+t-a),await va(n)}}static async connect(e,t){const n=new Sc(e,t);return await n.dialLoop(),n}static toError(e){const t=e?e.toLowerCase():"";if(t.indexOf("permissions violation")!==-1){const n=new Me(e,_e.PermissionsViolation),i=e.match(/(Publish|Subscription) to "(\S+)"/);if(i){n.permissionContext={operation:i[1].toLowerCase(),subject:i[2],queue:void 0};const a=e.match(/using queue "(\S+)"/);a&&(n.permissionContext.queue=a[1])}return n}else return t.indexOf("authorization violation")!==-1?new Me(e,_e.AuthorizationViolation):t.indexOf("user authentication expired")!==-1?new Me(e,_e.AuthenticationExpired):t.indexOf("account authentication expired")!=-1?new Me(e,_e.AccountExpired):t.indexOf("authentication timeout")!==-1?new Me(e,_e.AuthenticationTimeout):new Me(e,_e.ProtocolError)}processMsg(e,t){if(this.inMsgs++,this.inBytes+=t.length,!this.subscriptions.sidCounter)return;const n=this.subscriptions.get(e.sid);n&&(n.received+=1,n.callback&&n.callback(null,new dw(e,t,this)),n.max!==void 0&&n.received>=n.max&&n.unsubscribe())}processError(e){const t=nw(e),n=Sc.toError(t),i={type:Oi.Error,data:n.code};if(n.isPermissionError()){let a=!1;n.permissionContext&&(i.permissionContext=n.permissionContext,a=this.subscriptions.getMux()?.subject===n.permissionContext.subject),this.subscriptions.handleError(n),this.muxSubscriptions.handleError(a,n),a&&this.subscriptions.setMux(null)}this.dispatchStatus(i),this.handleError(n)}handleError(e){e.isAuthError()?this.handleAuthError(e):e.isProtocolError()?this.lastError=e:e.isAuthTimeout()&&(this.lastError=e),e.isPermissionError()||(this.lastError=e)}handleAuthError(e){this.lastError&&e.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(e):this.disconnect()}processPing(){this.transport.send(vP)}processPong(){const e=this.pongs.shift();e&&e.resolve()}processInfo(e){const t=JSON.parse(nw(e));this.info=t;const n=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(t,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Ms(t.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:a,lang:u}=this.transport;try{const c=new bP({version:a,lang:u},this.options,t.nonce);t.headers&&(c.headers=!0,c.no_responders=!0);const f=JSON.stringify(c);this.transport.send(Ao(`CONNECT ${f}${yc}`)),this.transport.send(Fw)}catch(c){this._close(c)}}n&&this.dispatchStatus({type:Oi.Update,data:n}),(t.ldm!==void 0?t.ldm:!1)&&this.dispatchStatus({type:Oi.LDM,data:this.servers.getCurrentServer().toString()})}push(e){switch(e.kind){case en.MSG:{const{msg:t,data:n}=e;this.processMsg(t,n);break}case en.OK:break;case en.ERR:this.processError(e.data);break;case en.PING:this.processPing();break;case en.PONG:this.processPong();break;case en.INFO:this.processInfo(e.data);break}}sendCommand(e,...t){const n=this.outbound.length();let i;typeof e=="string"?i=Ao(e):i=e,this.outbound.fill(i,...t),n===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(e,t=gn,n){let i;if(t instanceof Uint8Array)i=t;else if(typeof t=="string")i=Ei.encode(t);else throw Me.errorForCode(_e.BadPayload);let a=i.length;n=n||{},n.reply=n.reply||"";let u=gn,c=0;if(n.headers){if(this.info&&!this.info.headers)throw new Me("headers",_e.ServerOptionNotAvailable);u=n.headers.encode(),c=u.length,a=i.length+c}if(this.info&&a>this.info.max_payload)throw Me.errorForCode(_e.MaxPayloadExceeded);this.outBytes+=a,this.outMsgs++;let f;n.headers?(n.reply?f=`HPUB ${e} ${n.reply} ${c} ${a}\r
|
|
152
152
|
`:f=`HPUB ${e} ${c} ${a}\r
|
|
153
|
-
`,this.sendCommand(f,u,i,
|
|
153
|
+
`,this.sendCommand(f,u,i,gc)):(n.reply?f=`PUB ${e} ${n.reply} ${a}\r
|
|
154
154
|
`:f=`PUB ${e} ${a}\r
|
|
155
|
-
`,this.sendCommand(f,i,
|
|
155
|
+
`,this.sendCommand(f,i,gc))}request(e){return this.initMux(),this.muxSubscriptions.add(e),e}subscribe(e){return this.subscriptions.add(e),this._subunsub(e),e}_sub(e){e.queue?this.sendCommand(`SUB ${e.subject} ${e.queue} ${e.sid}\r
|
|
156
156
|
`):this.sendCommand(`SUB ${e.subject} ${e.sid}\r
|
|
157
157
|
`)}_subunsub(e){return this._sub(e),e.max&&this.unsubscribe(e,e.max),e}unsubscribe(e,t){this.unsub(e,t),(e.max===void 0||e.received>=e.max)&&this.subscriptions.cancel(e)}unsub(e,t){!e||this.isClosed()||(t?this.sendCommand(`UNSUB ${e.sid} ${t}\r
|
|
158
158
|
`):this.sendCommand(`UNSUB ${e.sid}\r
|
|
159
|
-
`),e.max=t)}resub(e,t){!e||this.isClosed()||(this.unsub(e),e.subject=t,this.subscriptions.resub(e),this._sub(e))}flush(e){return e||(e=ir()),this.pongs.push(e),this.outbound.fill(mw),this.flushPending(),e}sendSubscriptions(){const e=[];this.subscriptions.all().forEach(t=>{const n=t;n.queue?e.push(`SUB ${n.subject} ${n.queue} ${n.sid}${lc}`):e.push(`SUB ${n.subject} ${n.sid}${lc}`)}),e.length&&this.transport.send(So(e.join("")))}async _close(e){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(e),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(t=>{t.stop()}),this._closed=!0,await this.transport.close(e),await this.closed.resolve(e))}close(){return this._close()}isClosed(){return this._closed}drain(){const e=this.subscriptions.all(),t=[];return e.forEach(n=>{t.push(n.drain())}),Promise.all(t).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const e=this.outbound.drain();this.transport.send(e)}}initMux(){if(!this.subscriptions.getMux()){const t=this.muxSubscriptions.init(this.options.inboxPrefix),n=new yw(this,`${t}*`);n.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(n),this.subscribe(n)}}selectServer(){const e=this.servers.selectServer();if(e!==void 0)return this.server=e,this.server}getServer(){return this.server}}const JC="$SRV";class gw{constructor(e){E(this,"msg");this.msg=e}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(e,t){return this.msg.respond(e,t)}respondError(e,t,n,i){var a,u;return i=i||{},i.headers=i.headers||Ti(),(a=i.headers)==null||a.set(ic,`${e}`),(u=i.headers)==null||u.set(nc,t),this.msg.respond(n,i)}json(e){return this.msg.json(e)}string(){return this.msg.string()}}class Po{constructor(e,t="",n=""){E(this,"subject");E(this,"queue");E(this,"srv");t!==""&&KC("service group",t);let i="";if(e instanceof No)this.srv=e,i="";else if(e instanceof Po){const a=e;this.srv=a.srv,n===""&&a.queue!==""&&(n=a.queue),i=a.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(i,t),this.queue=n}calcSubject(e,t=""){return t===""?e:e!==""?`${e}.${t}`:t}addEndpoint(e="",t){t=t||{subject:e};const n=typeof t=="function"?{handler:t,subject:e}:t;Oo("endpoint",e);let{subject:i,handler:a,metadata:u,queue:c}=n;i=i||e,c=c||this.queue,YC("endpoint subject",i),i=this.calcSubject(this.subject,i);const f={name:e,subject:i,queue:c,handler:a,metadata:u};return this.srv._addEndpoint(f)}addGroup(e="",t=""){return new Po(this,e,t)}}function YC(r,e){if(e==="")throw new Error(`${r} cannot be empty`);if(e.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${e}'`);const t=e.split(".");t.forEach((n,i)=>{if(n===">"&&i!==t.length-1)throw new Error(`${r} cannot have internal '>': '${e}'`)})}function KC(r,e){if(e.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${e}'`);e.split(".").forEach(n=>{if(n===">")throw new Error(`${r} name cannot contain internal '>': '${e}'`)})}class No{constructor(e,t={name:"",version:""}){E(this,"nc");E(this,"_id");E(this,"config");E(this,"handlers");E(this,"internal");E(this,"_stopped");E(this,"_done");E(this,"started");this.nc=e,this.config=Object.assign({},t),this.config.queue||(this.config.queue="q"),Oo("name",this.config.name),Oo("queue",this.config.queue),Ps(this.config.version),this._id=Cs.next(),this.internal=[],this._done=ir(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(n=>{this.close(n).catch()})}static controlSubject(e,t="",n="",i){const a=i??JC;return t===""&&n===""?`${a}.${e}`:(Oo("control subject name",t),n!==""?(Oo("control subject id",n),`${a}.${e}.${t}.${n}`):`${a}.${e}.${t}`)}get subjects(){return this.handlers.filter(e=>e.internal===!1).map(e=>e.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(e){const t=Ti();if(e instanceof sc){const n=e;t.set(nc,n.message),t.set(ic,`${n.code}`)}else t.set(nc,e.message),t.set(ic,"500");return t}setupHandler(e,t=!1){const n=t?"":e.queue?e.queue:this.config.queue,{name:i,subject:a,handler:u}=e,c=e;c.internal=t,t&&this.internal.push(c),c.stats=new ZC(i,a,n),c.queue=n;const f=u?(h,d)=>{if(h){this.close(h);return}const y=Date.now();try{u(h,new gw(d))}catch(g){c.stats.countError(g),d==null||d.respond(bn,{headers:this.errorToHeader(g)})}finally{c.stats.countLatency(y)}}:void 0;return c.sub=this.nc.subscribe(a,{callback:f,queue:n}),c.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${e.subject} stopped`)).catch()}).catch(h=>{if(!this._stopped){const d=new Error(`required subscription ${e.subject} errored: ${h.message}`);d.stack=h.stack,this.close(d).catch()}}),c}info(){return{type:Eo.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(e=>{const{subject:t,metadata:n,name:i,queue:a}=e;return{subject:t,metadata:n,name:i,queue_group:a}})}async stats(){const e=[];for(const t of this.handlers){if(typeof this.config.statsHandler=="function")try{t.stats.data=await this.config.statsHandler(t)}catch(n){t.stats.countError(n)}e.push(t.stats.stats(t.qi))}return{type:Eo.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:e}}addInternalHandler(e,t){const n=`${e}`.toUpperCase();this._doAddInternalHandler(`${n}-all`,e,t),this._doAddInternalHandler(`${n}-kind`,e,t,this.name),this._doAddInternalHandler(`${n}`,e,t,this.name,this.id)}_doAddInternalHandler(e,t,n,i="",a=""){const u={};u.name=e,u.subject=No.controlSubject(t,i,a),u.handler=n,this.setupHandler(u,!0)}start(){const e=Ln(),t=(u,c)=>u?(this.close(u),Promise.reject(u)):this.stats().then(f=>(c==null||c.respond(e.encode(f)),Promise.resolve())),n=(u,c)=>u?(this.close(u),Promise.reject(u)):(c==null||c.respond(e.encode(this.info())),Promise.resolve()),i=e.encode(this.ping()),a=(u,c)=>u?(this.close(u).then().catch(),Promise.reject(u)):(c.respond(i),Promise.resolve());return this.addInternalHandler(ts.PING,a),this.addInternalHandler(ts.STATS,t),this.addInternalHandler(ts.INFO,n),this.handlers.forEach(u=>{const{subject:c}=u;typeof c=="string"&&u.handler!==null&&this.setupHandler(u)}),Promise.resolve(this)}close(e){if(this._stopped)return this._done;this._stopped=!0;let t=[];return this.nc.isClosed()||(t=this.handlers.concat(this.internal).map(n=>n.sub.drain())),Promise.allSettled(t).then(()=>{this._done.resolve(e||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(e){return this.close(e)}ping(){return{type:Eo.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const e of this.handlers)e.stats.reset(e.qi)}addGroup(e,t){return new Po(this,e,t)}addEndpoint(e,t){return new Po(this).addEndpoint(e,t)}_addEndpoint(e){const t=new Mr;t.noIterator=typeof e.handler=="function",t.noIterator||(e.handler=(i,a)=>{i?this.stop(i).catch():t.push(new gw(a))},t.iterClosed.then(()=>{this.close().catch()}));const n=this.setupHandler(e,!1);return n.qi=t,this.handlers.push(n),t}}class ZC{constructor(e,t,n=""){E(this,"name");E(this,"subject");E(this,"average_processing_time");E(this,"num_requests");E(this,"processing_time");E(this,"num_errors");E(this,"last_error");E(this,"data");E(this,"metadata");E(this,"queue");this.name=e,this.subject=t,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=n}reset(e){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const t=e;t&&(t.time=0,t.processed=0)}countLatency(e){this.num_requests++,this.processing_time+=cr(Date.now()-e),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(e){this.num_errors++,this.last_error=e.message}_stats(){const{name:e,subject:t,average_processing_time:n,num_errors:i,num_requests:a,processing_time:u,last_error:c,data:f,queue:h}=this;return{name:e,subject:t,average_processing_time:n,num_errors:i,num_requests:a,processing_time:u,last_error:c,data:f,queue_group:h}}stats(e){const t=e;return(t==null?void 0:t.noIterator)===!1&&(this.processing_time=t.time,this.num_requests=t.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class XC{constructor(e,t={strategy:ri.JitterTimer,maxWait:2e3},n){E(this,"nc");E(this,"prefix");E(this,"opts");this.nc=e,this.prefix=n,this.opts=t}ping(e="",t=""){return this.q(ts.PING,e,t)}stats(e="",t=""){return this.q(ts.STATS,e,t)}info(e="",t=""){return this.q(ts.INFO,e,t)}async q(e,t="",n=""){const i=new Mr,a=Ln(),u=No.controlSubject(e,t,n,this.prefix),c=await this.nc.requestMany(u,bn,this.opts);return(async()=>{for await(const f of c)try{const h=a.decode(f.data);i.push(h)}catch(h){i.push(()=>{i.stop(h)})}i.push(()=>{i.stop()})})().catch(f=>{i.stop(f)}),i}}function vw(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function eP(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:vw(),storage:bd.File}}const gc="KV-Operation",bw="$KV",tP=/^[-/=.\w]+$/,rP=/^[-/=.>*\w]+$/,nP=/^[-\w]+$/;function iP(r){if(r.startsWith(".")||r.endsWith(".")||!tP.test(r))throw new Error(`invalid key: ${r}`)}function sP(r){if(r.startsWith(".")||r.endsWith(".")||!rP.test(r))throw new Error(`invalid key: ${r}`)}function aP(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const e=r.split(".");let t=!1;for(let n=0;n<e.length;n++)switch(e[n]){case"*":t=!0;break;case">":if(n!==e.length-1)throw new Error(`invalid key: ${r}`);t=!0;break}return t}function vc(r){if(!nP.test(r))throw new Error(`invalid bucket name: ${r}`)}var li;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(li||(li={}));class Ro{constructor(e,t,n){E(this,"js");E(this,"jsm");E(this,"stream");E(this,"bucket");E(this,"direct");E(this,"codec");E(this,"prefix");E(this,"editPrefix");E(this,"useJsPrefix");E(this,"_prefixLen");E(this,"validateKey",iP);E(this,"validateSearchKey",sP);E(this,"hasWildcards",aP);vc(e),this.js=t,this.jsm=n,this.bucket=e,this.prefix=bw,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(e,t,n={}){vc(t);const i=await e.jetstreamManager(),a=new Ro(t,e,i);return await a.init(n),a}static async bind(e,t,n={}){const i=await e.jetstreamManager(),a={config:{allow_direct:n.allow_direct}};vc(t);const u=new Ro(t,e,i);return a.config.name=n.streamName??u.bucketName(),Object.assign(u,a),u.stream=a.config.name,u.codec=n.codec||vw(),u.direct=a.config.allow_direct??!1,u.initializePrefixes(a),u}async init(e={}){const t=Object.assign(eP(),e);this.codec=t.codec;const n={};this.stream=n.name=e.streamName??this.bucketName(),n.retention=vd.Limits,n.max_msgs_per_subject=t.history,t.maxBucketSize&&(t.max_bytes=t.maxBucketSize),t.max_bytes&&(n.max_bytes=t.max_bytes),n.max_msg_size=t.maxValueSize,n.storage=t.storage;const i=e.placementCluster??"";if(i&&(e.placement={},e.placement.cluster=i,e.placement.tags=[]),e.placement&&(n.placement=e.placement),e.republish&&(n.republish=e.republish),e.description&&(n.description=e.description),e.mirror){const y=Object.assign({},e.mirror);y.name.startsWith(_n)||(y.name=`${_n}${y.name}`),n.mirror=y,n.mirror_direct=!0}else if(e.sources){const y=e.sources.map(g=>{const m=Object.assign({},g),b=m.name.startsWith(_n)?m.name.substring(_n.length):m.name;return m.name.startsWith(_n)||(m.name=`${_n}${m.name}`),!g.external&&b!==this.bucket&&(m.subject_transforms=[{src:`$KV.${b}.>`,dest:`$KV.${this.bucket}.>`}]),m});n.sources=y,n.subjects=[this.subjectForBucket()]}else n.subjects=[this.subjectForBucket()];e.metadata&&(n.metadata=e.metadata),typeof e.compression=="boolean"&&(n.compression=e.compression?ns.S2:ns.None);const a=this.js.nc,u=a.getServerVersion(),c=u?_d(u,Ps("2.7.2"))>=0:!1;n.discard=c?To.New:To.Old;const{ok:f,min:h}=a.features.get(Pt.JS_ALLOW_DIRECT);if(!f&&e.allow_direct===!0){const y=u?`${u.major}.${u.minor}.${u.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${y} - requires ${h}`))}e.allow_direct=typeof e.allow_direct=="boolean"?e.allow_direct:f,n.allow_direct=e.allow_direct,this.direct=n.allow_direct,n.num_replicas=t.replicas,t.ttl&&(n.max_age=cr(t.ttl)),n.allow_rollup_hdrs=!0;let d;try{d=await this.jsm.streams.info(n.name),!d.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(y){if(y.message==="stream not found")d=await this.jsm.streams.add(n);else throw y}this.initializePrefixes(d)}initializePrefixes(e){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:t}=e.config;if(t){let n=t.name;if(n.startsWith(_n)&&(n=n.substring(_n.length)),t.external&&t.external.api!==""){const i=t.name.substring(_n.length);this.useJsPrefix=!1,this.prefix=`$KV.${i}`,this.editPrefix=`${t.external.api}.$KV.${n}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${_n}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(e,t=!1){const n=[];return t?(this.useJsPrefix&&n.push(this.js.apiPrefix),this.editPrefix!==""?n.push(this.editPrefix):n.push(this.prefix)):this.prefix&&n.push(this.prefix),n.push(e),n.join(".")}fullKeyName(e){return this.prefix!==""?`${this.prefix}.${e}`:`${bw}.${this.bucket}.${e}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(e){const t=[];for(const n of e.split("."))switch(n){case">":case"*":t.push(n);break;default:t.push(this.codec.key.encode(n));break}return t.join(".")}decodeKey(e){const t=[];for(const n of e.split("."))switch(n){case">":case"*":t.push(n);break;default:t.push(this.codec.key.decode(n));break}return t.join(".")}close(){return Promise.resolve()}dataLen(e,t){const n=t&&t.get(en.MessageSizeHdr)||"";return n!==""?parseInt(n,10):e.length}smToEntry(e){return new _P(this.bucket,this.prefixLen,e)}jmToEntry(e){const t=this.decodeKey(e.subject.substring(this.prefixLen));return new xP(this.bucket,t,e)}async create(e,t){var a;let n;try{const u=await this.put(e,t,{previousSeq:0});return Promise.resolve(u)}catch(u){if(n=u,((a=u==null?void 0:u.api_error)==null?void 0:a.err_code)!==10071)return Promise.reject(u)}let i=0;try{const u=await this.get(e);return(u==null?void 0:u.operation)==="DEL"||(u==null?void 0:u.operation)==="PURGE"?(i=u!==null?u.revision:0,this.update(e,t,i)):Promise.reject(n)}catch(u){return Promise.reject(u)}}update(e,t,n){if(n<=0)throw new Error("version must be greater than 0");return this.put(e,t,{previousSeq:n})}async put(e,t,n={}){var u,c;const i=this.encodeKey(e);this.validateKey(i);const a={};if(n.previousSeq!==void 0){const f=Ti();a.headers=f,f.set(li.ExpectedLastSubjectSequenceHdr,`${n.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(i,!0),t,a)).seq}catch(f){const h=f;return h.isJetStreamError()?(h.message=(u=h.api_error)==null?void 0:u.description,h.code=`${(c=h.api_error)==null?void 0:c.code}`,Promise.reject(h)):Promise.reject(f)}}async get(e,t){const n=this.encodeKey(e);this.validateKey(n);let i={last_by_subj:this.subjectForKey(n)};t&&t.revision>0&&(i={seq:t.revision});let a;try{this.direct?a=await this.jsm.direct.getMessage(this.bucketName(),i):a=await this.jsm.streams.getMessage(this.bucketName(),i);const u=this.smToEntry(a);return u.key!==n?null:u}catch(u){if(u.code===be.JetStream404NoMessages)return null;throw u}}purge(e,t){return this._deleteOrPurge(e,"PURGE",t)}delete(e,t){return this._deleteOrPurge(e,"DEL",t)}async purgeDeletes(e=30*60*1e3){const t=ir(),n=[],i=await this.watch({key:">",initializedFn:()=>{t.resolve()}});(async()=>{for await(const f of i)(f.operation==="DEL"||f.operation==="PURGE")&&n.push(f)})().then(),await t,i.stop();const a=Date.now()-e,u=n.map(f=>{const h=this.subjectForKey(f.key);return f.created.getTime()>=a?this.jsm.streams.purge(this.stream,{filter:h,keep:1}):this.jsm.streams.purge(this.stream,{filter:h,keep:0})}),c=await Promise.all(u);return c.unshift({success:!0,purged:0}),c.reduce((f,h)=>(f.purged+=h.purged,f))}async _deleteOrPurge(e,t,n){if(!this.hasWildcards(e))return this._doDeleteOrPurge(e,t,n);const i=await this.keys(e),a=[];for await(const u of i)a.push(this._doDeleteOrPurge(u,t)),a.length===100&&(await Promise.all(a),a.length=0);a.length>0&&await Promise.all(a)}async _doDeleteOrPurge(e,t,n){const i=this.encodeKey(e);this.validateKey(i);const a=Ti();a.set(gc,t),t==="PURGE"&&a.set(en.RollupHdr,en.RollupValueSubject),n!=null&&n.previousSeq&&a.set(li.ExpectedLastSubjectSequenceHdr,`${n.previousSeq}`),await this.js.publish(this.subjectForKey(i,!0),bn,{headers:a})}_buildCC(e,t,n={}){let a=(Array.isArray(e)?e:[e]).map(f=>{const h=this.encodeKey(f);return this.validateSearchKey(f),this.fullKeyName(h)}),u=yr.LastPerSubject;t===ni.AllHistory&&(u=yr.All),t===ni.UpdatesOnly&&(u=yr.New);let c;return a.length===1&&(c=a[0],a=void 0),Object.assign({deliver_policy:u,ack_policy:Dr.None,filter_subjects:a,filter_subject:c,flow_control:!0,idle_heartbeat:cr(5*1e3)},n)}remove(e){return this.purge(e)}async history(e={}){const t=e.key??">",n=new Mr,i={};i.headers_only=e.headers_only||!1;let a;a=()=>{n.stop()};let u=0;const c=this._buildCC(t,ni.AllHistory,i),f=c.filter_subject,h=is(c);h.bindStream(this.stream),h.orderedConsumer(),h.callback((y,g)=>{if(y){n.stop(y);return}if(g){const m=this.jmToEntry(g);n.push(m),n.received++,(a&&u>0&&n.received>=u||g.info.pending===0)&&(n.push(a),a=void 0)}});const d=await this.js.subscribe(f,h);if(a){const{info:{last:y}}=d,g=y.num_pending+y.delivered.consumer_seq;if(g===0||n.received>=g)try{a()}catch(m){n.stop(m)}finally{a=void 0}else u=g}return n._data=d,n.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{n.stop()}).catch(y=>{n.stop(y)}),n}canSetWatcherName(){const t=this.js.nc,{ok:n}=t.features.get(Pt.JS_NEW_CONSUMER_CREATE_API);return n}async watch(e={}){const t=e.key??">",n=new Mr,i={};i.headers_only=e.headers_only||!1;let a=ni.LastValue;e.include===ni.AllHistory?a=ni.AllHistory:e.include===ni.UpdatesOnly&&(a=ni.UpdatesOnly);const u=e.ignoreDeletes===!0;let c=e.initializedFn,f=0;const h=this._buildCC(t,a,i),d=h.filter_subject,y=is(h);this.canSetWatcherName()&&y.consumerName(Cs.next()),y.bindStream(this.stream),e.resumeFromRevision&&e.resumeFromRevision>0&&y.startSequence(e.resumeFromRevision),y.orderedConsumer(),y.callback((m,b)=>{if(m){n.stop(m);return}if(b){const I=this.jmToEntry(b);if(u&&I.operation==="DEL")return;n.push(I),n.received++,c&&(f>0&&n.received>=f||b.info.pending===0)&&(n.push(c),c=void 0)}});const g=await this.js.subscribe(d,y);if(c){const{info:{last:m}}=g,b=m.num_pending+m.delivered.consumer_seq;if(b===0||n.received>=b)try{c()}catch(I){n.stop(I)}finally{c=void 0}else f=b}return n._data=g,n.iterClosed.then(()=>{g.unsubscribe()}),g.closed.then(()=>{n.stop()}).catch(m=>{n.stop(m)}),n}async keys(e=">"){const t=new Mr,n=this._buildCC(e,ni.LastValue,{headers_only:!0}),i=Array.isArray(e)?">":n.filter_subject,a=is(n);a.bindStream(this.stream),a.orderedConsumer();const u=await this.js.subscribe(i,a);return(async()=>{var f;for await(const h of u){const d=(f=h.headers)==null?void 0:f.get(gc);if(d!=="DEL"&&d!=="PURGE"){const y=this.decodeKey(h.subject.substring(this.prefixLen));t.push(y)}h.info.pending===0&&u.unsubscribe()}})().then(()=>{t.stop()}).catch(f=>{t.stop(f)}),u.info.last.num_pending===0&&u.unsubscribe(),t}purgeBucket(e){return this.jsm.streams.purge(this.bucketName(),e)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var a;const t=((a=this.js.nc.info)==null?void 0:a.cluster)??"",n=this.bucketName(),i=await this.jsm.streams.info(n);return new ww(i,t)}}class ww{constructor(e,t=""){E(this,"si");E(this,"cluster");this.si=e,this.cluster=t}get bucket(){return this.si.config.name.startsWith(_n)?this.si.config.name.substring(_n.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return hd(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var e;return((e=this.si.config.placement)==null?void 0:e.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==ns.None:!1}}const Cd="OBJ_",_w="SHA-256=";function oP(r){return vc(r),`${Cd}${r}`}function uP(r){return r.startsWith(Cd)?r.substring(4):r}class Pd{constructor(e){E(this,"si");E(this,"backingStore");this.si=e,this.backingStore="JetStream"}get bucket(){return uP(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==ns.None:!1}}function bc(r){if(r===void 0)return;const{domain:e}=r;if(e===void 0)return r;const t=Object.assign({},r);if(delete t.domain,e==="")return t;if(t.external)throw new Error("domain and external are both set");return t.external={api:`$JS.${e}.API`},t}var jn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(jn||(jn={}));var Ai;(function(r){r.HeartbeatsMissed="heartbeats_missed",r.ConsumerNotFound="consumer_not_found",r.StreamNotFound="stream_not_found",r.ConsumerDeleted="consumer_deleted",r.OrderedConsumerRecreated="ordered_consumer_recreated"})(Ai||(Ai={}));var Ea;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(Ea||(Ea={}));const xw=Uint8Array.of(43,65,67,75),cP=Uint8Array.of(45,78,65,75),Mo=Uint8Array.of(43,87,80,73),lP=Uint8Array.of(43,78,88,84),fP=Uint8Array.of(43,84,69,82,77),hP=Uint8Array.of(32);function Do(r,e=5e3){return new IP(r,e)}class Nd extends Mr{constructor(t,n,i=!1){super();E(this,"consumer");E(this,"opts");E(this,"sub");E(this,"monitor");E(this,"pending");E(this,"inbox");E(this,"refilling");E(this,"pong");E(this,"callback");E(this,"timeout");E(this,"cleanupHandler");E(this,"listeners");E(this,"statusIterator");E(this,"forOrderedConsumer");E(this,"resetHandler");E(this,"abortOnMissingResource");E(this,"bind");this.consumer=t;const a=n;this.opts=this.parseOptions(n,i),this.callback=a.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=i,this.timeout=null,this.inbox=Oi(t.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=a.abort_on_missing_resource===!0,this.bind=a.bind===!0,this.start()}start(){const{max_messages:t,max_bytes:n,idle_heartbeat:i,threshold_bytes:a,threshold_messages:u}=this.opts;this.closed().then(f=>{if(this.cleanupHandler)try{this.cleanupHandler(f)}catch{}});const{sub:c}=this;c&&c.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(f,h)=>{var y,g,m,b;if(f){this.stop(f);return}if((y=this.monitor)==null||y.work(),h.subject===this.inbox){if(yd(h))return;const I=(g=h.headers)==null?void 0:g.code,x=((b=(m=h.headers)==null?void 0:m.description)==null?void 0:b.toLowerCase())||"unknown",{msgsLeft:_,bytesLeft:A}=this.parseDiscard(h.headers);if(_>0||A>0)this.pending.msgs-=_,this.pending.bytes-=A,this.pending.requests--,this.notify(Ea.Discard,{msgsLeft:_,bytesLeft:A});else if(I===400){this.stop(new Re(x,`${I}`));return}else if(I===409&&x==="consumer deleted"){if(this.notify(Ai.ConsumerDeleted,`${I} ${x}`),!this.refilling||this.abortOnMissingResource){const P=new Re(x,`${I}`);this.stop(P);return}}else this.notify(Ea.DebugEvent,`${I} ${x}`)}else this._push(Do(h,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=h.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(t&&this.pending.msgs<=u||n&&this.pending.bytes<=a){const I=this.pullOptions();this.pull(I)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),i&&(this.monitor=new gd(i,f=>(this.notify(Ai.HeartbeatsMissed,f),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var h;const f=this.consumer.api.nc.status();this.statusIterator=f;for await(const d of f)switch(d.type){case Ei.Disconnect:(h=this.monitor)==null||h.cancel();break;case Ei.Reconnect:this.resetPending().then(y=>{var g;y&&((g=this.monitor)==null||g.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(t){if(!this.callback)super.push(t);else{const n=typeof t=="function"?t:null;try{n?n():this.callback(t)}catch(i){this.stop(i)}}}notify(t,n){this.listeners.length>0&&this.listeners.forEach(i=>{i.done||i.push({type:t,data:n})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){let t=0,n=0;const i=fd();let a=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),t=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(u){if(u.message==="stream not found"){if(n++,this.notify(Ai.StreamNotFound,n),!this.refilling||this.abortOnMissingResource)return this.stop(u),!1}else if(u.message==="consumer not found"){if(t++,this.notify(Ai.ConsumerNotFound,t),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(u),!1;if(this.forOrderedConsumer)return!1}else t=0,n=0;const c=i.backoff(a),f=ya(c);await Promise.race([f,this.consumer.api.nc.closed()]),f.cancel(),a++}}}pull(t){this.pending.bytes+=t.max_bytes??0,this.pending.msgs+=t.batch??0,this.pending.requests++;const n=this.consumer.api.nc;this._push(()=>{n.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(t),{reply:this.inbox}),this.notify(Ea.Next,t)})}pullOptions(){const t=this.opts.max_messages-this.pending.msgs,n=this.opts.max_bytes-this.pending.bytes,i=cr(this.opts.idle_heartbeat),a=cr(this.opts.expires);return{batch:t,max_bytes:n,idle_heartbeat:i,expires:a}}parseDiscard(t){const n={msgsLeft:0,bytesLeft:0},i=t==null?void 0:t.get(en.PendingMessagesHdr);i&&(n.msgsLeft=parseInt(i));const a=t==null?void 0:t.get(en.PendingBytesHdr);return a&&(n.bytesLeft=parseInt(a)),n}trackTimeout(t){this.timeout=t}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var t,n;(t=this.monitor)==null||t.cancel(),this.monitor=null,(n=this.timeout)==null||n.cancel(),this.timeout=null}setCleanupHandler(t){this.cleanupHandler=t}stop(t){var n,i;this.done||((n=this.sub)==null||n.unsubscribe(),this.clearTimers(),(i=this.statusIterator)==null||i.stop(),this._push(()=>{super.stop(t),this.listeners.forEach(a=>{a.stop()})}))}parseOptions(t,n=!1){const i=t||{};if(i.max_messages=i.max_messages||0,i.max_bytes=i.max_bytes||0,i.max_messages!==0&&i.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(i.max_messages===0&&(i.max_messages=100),i.expires=i.expires||3e4,i.expires<1e3)throw new Error("expires should be at least 1000ms");if(i.idle_heartbeat=i.idle_heartbeat||i.expires/2,i.idle_heartbeat=i.idle_heartbeat>3e4?3e4:i.idle_heartbeat,n){const a=Math.round(i.max_messages*.75)||1;i.threshold_messages=i.threshold_messages||a;const u=Math.round(i.max_bytes*.75)||1;i.threshold_bytes=i.threshold_bytes||u}return i}status(){const t=new Mr;return this.listeners.push(t),Promise.resolve(t)}}class dP extends Mr{constructor(){super();E(this,"src");E(this,"listeners");this.listeners=[]}setSource(t){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=t,this.src.setCleanupHandler(n=>{this.stop(n||void 0)}),(async()=>{const n=await this.src.status();for await(const i of n)this.notify(i.type,i.data)})().catch(()=>{})}notify(t,n){this.listeners.length>0&&this.listeners.forEach(i=>{i.done||i.push({type:t,data:n})})}stop(t){var n;this.done||((n=this.src)==null||n.stop(t),super.stop(t),this.listeners.forEach(i=>{i.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const t=new Mr;return this.listeners.push(t),Promise.resolve(t)}}class Sw{constructor(e,t){E(this,"api");E(this,"_info");E(this,"stream");E(this,"name");this.api=e,this._info=t,this.stream=t.stream_name,this.name=t.name}consume(e={max_messages:100,expires:3e4}){return Promise.resolve(new Nd(this,e,!0))}fetch(e={max_messages:100,expires:3e4}){const t=new Nd(this,e,!1),n=Math.round(t.opts.expires*1.05),i=ma(n);return t.closed().catch(()=>{}).finally(()=>{i.cancel()}),i.catch(()=>{t.close().catch()}),t.trackTimeout(i),Promise.resolve(t)}next(e={expires:3e4}){const t=ir(),n=e;n.max_messages=1;const i=new Nd(this,n,!1),a=Math.round(i.opts.expires*1.05);a>=6e4&&(async()=>{for await(const c of await i.status())if(c.type===Ai.HeartbeatsMissed&&c.data>=2){t.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const c of i){t.resolve(c);break}})().catch(()=>{});const u=ma(a);return i.closed().then(c=>{c?t.reject(c):t.resolve(null)}).catch(c=>{t.reject(c)}).finally(()=>{u.cancel()}),u.catch(c=>{t.resolve(null),i.close().catch()}),i.trackTimeout(u),t}delete(){const{stream_name:e,name:t}=this._info;return this.api.delete(e,t)}info(e=!1){if(e)return Promise.resolve(this._info);const{stream_name:t,name:n}=this._info;return this.api.info(t,n).then(i=>(this._info=i,this._info))}}class pP{constructor(e,t,n={}){E(this,"api");E(this,"consumerOpts");E(this,"consumer");E(this,"opts");E(this,"cursor");E(this,"stream");E(this,"namePrefix");E(this,"serial");E(this,"currentConsumer");E(this,"userCallback");E(this,"iter");E(this,"type");E(this,"startSeq");this.api=e,this.stream=t,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Cs.next(),typeof n.name_prefix=="string"&&(uc("name_prefix",n.name_prefix),this.namePrefix=n.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=jn.Unset,this.consumerOpts=n,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(e){this.serial++;const t=`${this.namePrefix}_${this.serial}`;e=e===0?1:e;const n={name:t,deliver_policy:yr.StartSequence,opt_start_seq:e,ack_policy:Dr.None,inactive_threshold:cr(5*60*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(n.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(n.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(n.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(n.replay_policy=this.consumerOpts.replay_policy),e===this.startSeq+1&&(n.deliver_policy=this.consumerOpts.deliver_policy||yr.StartSequence,(this.consumerOpts.deliver_policy===yr.LastPerSubject||this.consumerOpts.deliver_policy===yr.New||this.consumerOpts.deliver_policy===yr.Last)&&(delete n.opt_start_seq,n.deliver_policy=this.consumerOpts.deliver_policy),n.deliver_policy===yr.LastPerSubject&&typeof n.filter_subjects>"u"&&typeof n.filter_subject>"u"&&(n.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete n.opt_start_seq,n.deliver_policy=yr.StartTime,n.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(n.inactive_threshold=cr(this.consumerOpts.inactive_threshold))),n}async resetConsumer(e=0){var a,u,c,f;(a=this.consumer)==null||a.delete().catch(()=>{}),e=e===0?1:e,this.cursor.deliver_seq=0;const t=this.getConsumerOpts(e);t.max_deliver=1,t.mem_storage=!0;const n=fd();let i;for(let h=0;;h++)try{i=await this.api.add(this.stream,t),(u=this.iter)==null||u.notify(Ai.OrderedConsumerRecreated,i.name);break}catch(d){if(d.message==="stream not found"&&((c=this.iter)==null||c.notify(Ai.StreamNotFound,h),this.type===jn.Fetch||this.opts.abort_on_missing_resource===!0))return(f=this.iter)==null||f.stop(d),Promise.reject(d);if(e===0&&h>=30)throw d;await ya(n.backoff(h+1))}return i}internalHandler(e){return t=>{var i;if(this.serial!==e)return;const n=t.info.deliverySequence;if(n!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=n,this.cursor.stream_seq=t.info.streamSequence,this.userCallback?this.userCallback(t):(i=this.iter)==null||i.push(t)}}async reset(e={max_messages:100,expires:3e4},t){var f,h;t=t||{};const n=t.fromFetch||!1,i=t.orderedReset||!1;if(this.type===jn.Fetch&&i){(f=this.iter)==null||f.src.stop(),await((h=this.iter)==null?void 0:h.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||i)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||n)&&(this.iter=new dP),this.consumer=new Sw(this.api,this.currentConsumer);const a=e;a.callback=this.internalHandler(this.serial);let u=null;this.type===jn.Fetch&&n?u=await this.consumer.fetch(e):this.type===jn.Consume&&(u=await this.consumer.consume(e));const c=u;c.forOrderedConsumer=!0,c.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(c)}notifyOrderedResetAndReset(){var e;(e=this.iter)==null||e.notify(Ea.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(e={max_messages:100,expires:3e4}){if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===jn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===jn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:n}=e;return n&&(this.userCallback=n),this.type=jn.Consume,this.opts=e,await this.reset(e),this.iter}async fetch(e={max_messages:100,expires:3e4}){var i;if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===jn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((i=this.iter)==null?void 0:i.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:n}=e;return n&&(this.userCallback=n),this.type=jn.Fetch,this.opts=e,await this.reset(e,{fromFetch:!0}),this.iter}async next(e={expires:3e4}){const t=e;if(t.bind)return Promise.reject(new Error("bind is not supported"));t.max_messages=1;const n=ir();return t.callback=a=>{this.userCallback=null,n.resolve(a)},(await this.fetch(t)).iterClosed.then(a=>{a&&n.reject(a),n.resolve(null)}).catch(a=>{n.reject(a)}),n}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(e=>Promise.resolve(e)).catch(e=>Promise.reject(e)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(e){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.serial),Promise.resolve(this.currentConsumer)):e&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Ew{constructor(e){E(this,"api");E(this,"notified");this.api=e,this.notified=!1}checkVersion(){const e=this.api.nc.features.get(Pt.JS_SIMPLIFICATION);return e.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${e.min} or better`))}async get(e,t={}){return typeof t=="object"?this.ordered(e,t):(await this.checkVersion(),this.api.info(e,t).then(n=>n.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Sw(this.api,n)).catch(n=>Promise.reject(n)))}async ordered(e,t){await this.checkVersion();const n=this.api;return new Rd(n.nc,n.opts).info(e).then(a=>Promise.resolve(new pP(this.api,e,t))).catch(a=>Promise.reject(a))}}class wc{constructor(e,t){E(this,"api");E(this,"_info");this.api=e,this._info=t}get name(){return this._info.config.name}alternates(){return this.info().then(e=>e.alternates?e.alternates:[])}async best(){if(await this.info(),this._info.alternates){const e=await this.api.info(this._info.alternates[0].name);return new wc(this.api,e)}else return this}info(e=!1,t){return e?Promise.resolve(this._info):this.api.info(this.name,t).then(n=>(this._info=n,this._info))}getConsumer(e){return new Ew(new xd(this.api.nc,this.api.opts)).get(this.name,e)}getMessage(e){return this.api.getMessage(this.name,e)}deleteMessage(e,t){return this.api.deleteMessage(this.name,e,t)}}class Rd extends ko{constructor(e,t){super(e,t)}checkStreamConfigVersions(e){const t=this.nc;if(e.metadata){const{min:i,ok:a}=t.features.get(Pt.JS_STREAM_CONSUMER_METADATA);if(!a)throw new Error(`stream 'metadata' requires server ${i}`)}if(e.first_seq){const{min:i,ok:a}=t.features.get(Pt.JS_STREAM_FIRST_SEQ);if(!a)throw new Error(`stream 'first_seq' requires server ${i}`)}if(e.subject_transform){const{min:i,ok:a}=t.features.get(Pt.JS_STREAM_SUBJECT_TRANSFORM);if(!a)throw new Error(`stream 'subject_transform' requires server ${i}`)}if(e.compression){const{min:i,ok:a}=t.features.get(Pt.JS_STREAM_COMPRESSION);if(!a)throw new Error(`stream 'compression' requires server ${i}`)}if(e.consumer_limits){const{min:i,ok:a}=t.features.get(Pt.JS_DEFAULT_CONSUMER_LIMITS);if(!a)throw new Error(`stream 'consumer_limits' requires server ${i}`)}function n(i,a){var c;if((((c=a==null?void 0:a.subject_transforms)==null?void 0:c.length)||0)>0){const{min:f,ok:h}=t.features.get(Pt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!h)throw new Error(`${i} 'subject_transforms' requires server ${f}`)}}e.sources&&e.sources.forEach(i=>{n("stream sources",i)}),e.mirror&&n("stream mirror",e.mirror)}async add(e={}){var i;this.checkStreamConfigVersions(e),Xr(e.name),e.mirror=bc(e.mirror),e.sources=(i=e.sources)==null?void 0:i.map(bc);const n=await this._request(`${this.prefix}.STREAM.CREATE.${e.name}`,e);return this._fixInfo(n),n}async delete(e){return Xr(e),(await this._request(`${this.prefix}.STREAM.DELETE.${e}`)).success}async update(e,t={}){var c;if(typeof e=="object"){const f=e;e=f.name,t=f,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(t),Xr(e);const n=await this.info(e),i=Object.assign(n.config,t);i.mirror=bc(i.mirror),i.sources=(c=i.sources)==null?void 0:c.map(bc);const u=await this._request(`${this.prefix}.STREAM.UPDATE.${e}`,i);return this._fixInfo(u),u}async info(e,t){Xr(e);const n=`${this.prefix}.STREAM.INFO.${e}`;let a=await this._request(n,t),{total:u,limit:c}=a,f=a.state.subjects?Object.getOwnPropertyNames(a.state.subjects).length:1;if(u&&u>f){const h=[a],d=t||{};let y=0;for(;u>f;){y++,d.offset=c*y;const m=await this._request(n,d);u=m.total,h.push(m);const b=Object.getOwnPropertyNames(m.state.subjects).length;if(f+=b,b<c)break}let g={};for(let m=0;m<h.length;m++)a=h[m],a.state.subjects&&(g=Object.assign(g,a.state.subjects));a.offset=0,a.total=0,a.limit=0,a.state.subjects=g}return this._fixInfo(a),a}list(e=""){const t=e!=null&&e.length?{subject:e}:{},n=a=>{const u=a;return u.streams.forEach(c=>{this._fixInfo(c)}),u.streams},i=`${this.prefix}.STREAM.LIST`;return new Io(i,n,this,t)}_fixInfo(e){e.config.sealed=e.config.sealed||!1,e.config.deny_delete=e.config.deny_delete||!1,e.config.deny_purge=e.config.deny_purge||!1,e.config.allow_rollup_hdrs=e.config.allow_rollup_hdrs||!1}async purge(e,t){if(t){const{keep:i,seq:a}=t;if(typeof i=="number"&&typeof a=="number")throw new Error("can specify one of keep or seq")}return Xr(e),await this._request(`${this.prefix}.STREAM.PURGE.${e}`,t)}async deleteMessage(e,t,n=!0){Xr(e);const i={seq:t};return n||(i.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${e}`,i)).success}async getMessage(e,t){Xr(e);const i=await this._request(`${this.prefix}.STREAM.MSG.GET.${e}`,t);return new Ow(i)}find(e){return this.findStream(e)}listKvs(){const e=n=>{var f;const a=n.streams.filter(h=>h.config.name.startsWith(_n));a.forEach(h=>{this._fixInfo(h)});let u="";return a.length&&(u=((f=this.nc.info)==null?void 0:f.cluster)??""),a.map(h=>new ww(h,u))},t=`${this.prefix}.STREAM.LIST`;return new Io(t,e,this)}listObjectStores(){const e=n=>{const a=n.streams.filter(c=>c.config.name.startsWith(Cd));return a.forEach(c=>{this._fixInfo(c)}),a.map(c=>new Pd(c))},t=`${this.prefix}.STREAM.LIST`;return new Io(t,e,this)}names(e=""){const t=e!=null&&e.length?{subject:e}:{},n=a=>a.streams,i=`${this.prefix}.STREAM.NAMES`;return new Io(i,n,this,t)}async get(e){const t=await this.info(e);return Promise.resolve(new wc(this,t))}}class mP extends ko{constructor(e,t){super(e,t)}async getMessage(e,t){Xr(e);let n=t;const{last_by_subj:i}=n;i&&(n=null);const a=n?this.jc.encode(n):bn,u=this.opts.apiPrefix||"$JS.API",c=i?`${u}.DIRECT.GET.${e}.${i}`:`${u}.DIRECT.GET.${e}`,f=await this.nc.request(c,a),h=va(f);if(h)return Promise.reject(h);const d=new Md(f);return Promise.resolve(d)}async getBatch(e,t){Xr(e);const i=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${e}`;if(!Array.isArray(t.multi_last)||t.multi_last.length===0)return Promise.reject("multi_last is required");const a=JSON.stringify(t,(f,h)=>f==="up_to_time"&&h instanceof Date?h.toISOString():h),u=new Mr,c=await this.nc.requestMany(i,a,{strategy:ri.SentinelMsg});return(async()=>{var y,g,m;let f=!1,h=!1,d;for await(const b of c){if(!f){f=!0;const I=((y=b.headers)==null?void 0:y.code)||0;if(I!==0&&I<200||I>299){d=(g=b.headers)==null?void 0:g.description.toLowerCase();break}if(((m=b.headers)==null?void 0:m.get("Nats-Num-Pending"))===""){h=!0;break}}if(b.data.length===0)break;u.push(new Md(b))}u.push(()=>{if(h)throw new Error("batch direct get not supported by the server");if(d)throw new Error(`bad request: ${d}`);u.stop()})})(),Promise.resolve(u)}}class Md{constructor(e){E(this,"data");E(this,"header");if(!e.headers)throw new Error("headers expected");this.data=e.data,this.header=e.headers}get subject(){return this.header.last(wa.Subject)}get seq(){const e=this.header.last(wa.Sequence);return typeof e=="string"?parseInt(e):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(wa.TimeStamp)}get stream(){return this.header.last(wa.Stream)}json(e){return Ln(e).decode(this.data)}string(){return cn.decode(this.data)}}E(Md,"jc");class yP extends ko{constructor(t,n){super(t,n);E(this,"streams");E(this,"consumers");E(this,"direct");this.streams=new Rd(t,n),this.consumers=new xd(t,n),this.direct=new mP(t,n)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const t=new Mr;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(n,i)=>{if(n)throw n;try{const a=this.parseJsResponse(i),u=a.type.split("."),c=u[u.length-1];t.push({kind:c,data:a})}catch(a){t.stop(a)}}}),t}}class Ow{constructor(e){E(this,"_header");E(this,"smr");this.smr=e}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):bn}get header(){if(!this._header)if(this.smr.message.hdrs){const e=this._parse(this.smr.message.hdrs);this._header=rs.decode(e)}else this._header=Ti();return this._header}_parse(e){const t=atob(e),n=t.length,i=new Uint8Array(n);for(let a=0;a<n;a++)i[a]=t.charCodeAt(a);return i}json(e){return Ln(e).decode(this.data)}string(){return cn.decode(this.data)}}E(Ow,"jc");class gP{constructor(e){E(this,"api");this.api=e}get(e){return this.api.info(e).then(t=>new wc(this.api,t))}}class Dd{constructor(e){E(this,"info");E(this,"hdrs");this.info=e}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=rs.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var e,t;return((e=this.info.options)==null?void 0:e.link)!==void 0&&((t=this.info.options)==null?void 0:t.link)!==null}}function Tw(r){const e={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const t=r.headers;e.headers=t.toRecord()}return e}function vP(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class Fo{constructor(e,t,n){E(this,"jsm");E(this,"js");E(this,"stream");E(this,"name");this.name=e,this.jsm=t,this.js=n}_checkNotEmpty(e){return!e||e.length===0?{name:e,error:new Error("name cannot be empty")}:{name:e}}async info(e){const t=await this.rawInfo(e);return t?new Dd(t):null}async list(){const e=[],t=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const n of t){if(n===null)break;e.push(n)}return Promise.resolve(e)}async rawInfo(e){const{name:t,error:n}=this._checkNotEmpty(e);if(n)return Promise.reject(n);const i=this._metaSubject(t);try{const a=await this.jsm.streams.getMessage(this.stream,{last_by_subj:i}),c=Ln().decode(a.data);return c.revision=a.seq,c}catch(a){return a.code==="404"?null:Promise.reject(a)}}async _si(e){try{return await this.jsm.streams.info(this.stream,e)}catch(t){return t.code==="404"?null:Promise.reject(t)}}async seal(){let e=await this._si();return e===null?Promise.reject(new Error("object store not found")):(e.config.sealed=!0,e=await this.jsm.streams.update(this.stream,e.config),Promise.resolve(new Pd(e)))}async status(e){const t=await this._si(e);return t===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Pd(t))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(e,t,n){var M;const i=this.js.getOptions();n=n||{timeout:i.timeout},n.timeout=n.timeout||i.timeout,n.previousRevision=n.previousRevision??void 0;const{timeout:a,previousRevision:u}=n,c=this.js.nc.info,f=(c==null?void 0:c.max_payload)||1024;e=e||{},e.options=e.options||{};let h=((M=e.options)==null?void 0:M.max_chunk_size)||128*1024;h=h>f?f:h,e.options.max_chunk_size=h;const d=await this.info(e.name),{name:y,error:g}=this._checkNotEmpty(e.name);if(g)return Promise.reject(g);const m=Cs.next(),b=this._chunkSubject(m),I=this._metaSubject(y),x=Object.assign({bucket:this.name,nuid:m,size:0,chunks:0},Tw(e)),_=ir(),A=[],P=new _a;try{const $=t?t.getReader():null,j=new ew;for(;;){const{done:K,value:ee}=$?await $.read():{done:!0,value:void 0};if(K){if(P.size()>0){const Pe=P.drain();j.update(Pe),x.chunks++,x.size+=Pe.length,A.push(this.js.publish(b,Pe,{timeout:a}))}await Promise.all(A),A.length=0,x.mtime=new Date().toISOString();const fe=j.digest("base64"),de=fe.length%3,Ie=de>0?"=".repeat(de):"";x.digest=`${_w}${fe}${Ie}`,x.deleted=!1;const pe=Ti();typeof u=="number"&&pe.set(li.ExpectedLastSubjectSequenceHdr,`${u}`),pe.set(en.RollupHdr,en.RollupValueSubject);const Ce=await this.js.publish(I,Ln().encode(x),{headers:pe,timeout:a});if(x.revision=Ce.seq,d)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${d.nuid}`})}catch{}_.resolve(new Dd(x));break}if(ee)for(P.fill(ee);P.size()>h;){x.chunks++,x.size+=h;const fe=P.drain(e.options.max_chunk_size);j.update(fe),A.push(this.js.publish(b,fe,{timeout:a}))}}}catch($){await this.jsm.streams.purge(this.stream,{filter:b}),_.reject($)}return _}putBlob(e,t,n){function i(a){return new ReadableStream({pull(u){u.enqueue(a),u.close()}})}return t===null&&(t=new Uint8Array(0)),this.put(e,i(t),n)}put(e,t,n){var i;return(i=e==null?void 0:e.options)!=null&&i.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(e,t,n)}async getBlob(e){async function t(a){const u=new _a,c=a.getReader();for(;;){const{done:f,value:h}=await c.read();if(f)return u.drain();h&&h.length&&u.fill(h)}}const n=await this.get(e);if(n===null)return Promise.resolve(null);const i=await Promise.all([n.error,t(n.data)]);return i[0]?Promise.reject(i[0]):Promise.resolve(i[1])}async get(e){const t=await this.rawInfo(e);if(t===null||t.deleted)return Promise.resolve(null);if(t.options&&t.options.link){const d=t.options.link.name||"";if(d==="")throw new Error("link is a bucket");return(t.options.link.bucket!==this.name?await Fo.create(this.js,t.options.link.bucket):this).get(d)}const n=ir(),i={info:new Dd(t),error:n};if(t.size===0)return i.data=vP(),n.resolve(null),Promise.resolve(i);let a;const u=is();u.orderedConsumer();const c=new ew,f=`$O.${this.name}.C.${t.nuid}`,h=await this.js.subscribe(f,u);return(async()=>{for await(const d of h)if(d.data.length>0&&(c.update(d.data),a.enqueue(d.data)),d.info.pending===0){const y=c.digest("base64"),g=y.length%3,m=g>0?"=".repeat(g):"",b=`${_w}${y}${m}`;b!==t.digest?a.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${b}`)):a.close(),h.unsubscribe()}})().then(()=>{n.resolve()}).catch(d=>{a.error(d),n.reject(d)}),i.data=new ReadableStream({start(d){a=d},cancel(){h.unsubscribe()}}),i}linkStore(e,t){if(!(t instanceof Fo))return Promise.reject("bucket required");const n=t,{name:i,error:a}=this._checkNotEmpty(e);if(a)return Promise.reject(a);const u={name:i,options:{link:{bucket:n.name}}};return this._put(u,null)}async link(e,t){const{name:n,error:i}=this._checkNotEmpty(e);if(i)return Promise.reject(i);if(t.deleted)return Promise.reject(new Error("src object is deleted"));if(t.isLink())return Promise.reject(new Error("src object is a link"));const a=await this.rawInfo(e);if(a!==null&&!a.deleted)return Promise.reject(new Error("an object already exists with that name"));const u={bucket:t.bucket,name:t.name},c={name:n,bucket:t.bucket,options:{link:u}};await this.js.publish(this._metaSubject(e),JSON.stringify(c));const f=await this.info(e);return Promise.resolve(f)}async delete(e){const t=await this.rawInfo(e);if(t===null)return Promise.resolve({purged:0,success:!1});t.deleted=!0,t.size=0,t.chunks=0,t.digest="";const n=Ln(),i=Ti();return i.set(en.RollupHdr,en.RollupValueSubject),await this.js.publish(this._metaSubject(t.name),n.encode(t),{headers:i}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(t.nuid)})}async update(e,t={}){const n=await this.rawInfo(e);if(n===null)return Promise.reject(new Error("object not found"));if(n.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));t.name=t.name??n.name;const{name:i,error:a}=this._checkNotEmpty(t.name);if(a)return Promise.reject(a);if(e!==t.name){const f=await this.info(t.name);if(f&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"))}t.name=i;const u=Object.assign({},n,Tw(t)),c=await this.js.publish(this._metaSubject(u.name),JSON.stringify(u));return e!==t.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(e)}),Promise.resolve(c)}async watch(e={}){e.includeHistory=e.includeHistory??!1,e.ignoreDeletes=e.ignoreDeletes??!1;let t=!1;const n=new Mr,i=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:i})}catch(f){f.code==="404"?(n.push(null),t=!0):n.stop(f)}const a=Ln(),u=is();u.orderedConsumer(),e.includeHistory?u.deliverLastPerSubject():(t=!0,u.deliverNew()),u.callback((f,h)=>{var d;if(f){n.stop(f);return}if(h!==null){const y=a.decode(h.data);y.deleted&&e.ignoreDeletes===!0||n.push(y),((d=h.info)==null?void 0:d.pending)===0&&!t&&(t=!0,n.push(null))}});const c=await this.js.subscribe(i,u);return n._data=c,n.iterClosed.then(()=>{c.unsubscribe()}),c.closed.then(()=>{n.stop()}).catch(f=>{n.stop(f)}),n}_chunkSubject(e){return`$O.${this.name}.C.${e}`}_metaSubject(e){return`$O.${this.name}.M.${Ao.encode(e)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(e={}){try{this.stream=oP(this.name)}catch(i){return Promise.reject(i)}const t=(e==null?void 0:e.ttl)||0;delete e.ttl;const n=Object.assign({max_age:t},e);n.name=this.stream,n.num_replicas=e.replicas??1,n.allow_direct=!0,n.allow_rollup_hdrs=!0,n.discard=To.New,n.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],e.placement&&(n.placement=e.placement),e.metadata&&(n.metadata=e.metadata),typeof e.compression=="boolean"&&(n.compression=e.compression?ns.S2:ns.None);try{await this.jsm.streams.info(n.name)}catch(i){i.message==="stream not found"&&await this.jsm.streams.add(n)}}static async create(e,t,n={}){const i=await e.jetstreamManager(),a=new Fo(t,i,e);return await a.init(n),Promise.resolve(a)}}class bP{constructor(e){E(this,"js");this.js=e}kv(e,t={}){const n=this.js,{ok:i,min:a}=n.nc.features.get(Pt.JS_KV);return i?t.bindOnly?Ro.bind(this.js,e,t):Ro.create(this.js,e,t):Promise.reject(new Error(`kv is only supported on servers ${a} or better`))}os(e,t={}){var u;if(typeof((u=crypto==null?void 0:crypto.subtle)==null?void 0:u.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const n=this.js,{ok:i,min:a}=n.nc.features.get(Pt.JS_OBJECTSTORE);return i?Fo.create(this.js,e,t):Promise.reject(new Error(`objectstore is only supported on servers ${a} or better`))}}class Fd extends ko{constructor(t,n){super(t,n);E(this,"consumers");E(this,"streams");E(this,"consumerAPI");E(this,"streamAPI");this.consumerAPI=new xd(t,n),this.streamAPI=new Rd(t,n),this.consumers=new Ew(this.consumerAPI),this.streams=new gP(this.streamAPI)}jetstreamManager(t){t===void 0&&(t=this.opts.checkAPI);const n=Object.assign({},this.opts,{checkAPI:t});return this.nc.jetstreamManager(n)}get apiPrefix(){return this.prefix}get views(){return new bP(this)}async publish(t,n=bn,i){i=i||{},i.expect=i.expect||{};const a=(i==null?void 0:i.headers)||Ti();i&&(i.msgID&&a.set(li.MsgIdHdr,i.msgID),i.expect.lastMsgID&&a.set(li.ExpectedLastMsgIdHdr,i.expect.lastMsgID),i.expect.streamName&&a.set(li.ExpectedStreamHdr,i.expect.streamName),typeof i.expect.lastSequence=="number"&&a.set(li.ExpectedLastSeqHdr,`${i.expect.lastSequence}`),typeof i.expect.lastSubjectSequence=="number"&&a.set(li.ExpectedLastSubjectSequenceHdr,`${i.expect.lastSubjectSequence}`));const u=i.timeout||this.timeout,c={};u&&(c.timeout=u),i&&(c.headers=a);let{retries:f,retry_delay:h}=i;f=f||1,h=h||250;let d;for(let g=0;g<f;g++)try{d=await this.nc.request(t,n,c);break}catch(m){if(m.code==="503"&&g+1<f)await ya(h);else throw m}const y=this.parseJsResponse(d);if(y.stream==="")throw Re.errorForCode(be.JetStreamInvalidAck);return y.duplicate=y.duplicate?y.duplicate:!1,y}async pull(t,n,i=0){Xr(t),ga(n);let a=this.timeout;i>a&&(a=i),i=i<0?0:cr(i);const u={batch:1,no_wait:i===0,expires:i},c=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`,this.jc.encode(u),{noMux:!0,timeout:a}),f=va(c);if(f)throw f;return Do(c,this.timeout)}fetch(t,n,i={}){Xr(t),ga(n);let a=null;const u=(i.max_bytes??0)>0;let c=0;const f=u?i.max_bytes:0;let h=null;const d={};if(d.batch=i.batch||1,f){const A=this.nc.features.get(Pt.JS_PULL_MAX_BYTES);if(!A.ok)throw new Error(`max_bytes is only supported on servers ${A.min} or better`);d.max_bytes=f}d.no_wait=i.no_wait||!1,d.no_wait&&d.expires&&(d.expires=0);const y=i.expires||0;if(y&&(d.expires=cr(y)),y===0&&d.no_wait===!1)throw new Error("expires or no_wait is required");const g=i.idle_heartbeat||0;g&&(d.idle_heartbeat=cr(g),i.delay_heartbeat===!0&&(d.idle_heartbeat=cr(g*4)));const m=new Mr,b=d.batch;let I=0;m.protocolFilterFn=(A,P=!1)=>yd(A.msg)?(h==null||h.work(),!1):!0,m.dispatchedFn=A=>{if(A){if(u&&(c+=A.data.length),I++,a&&A.info.pending===0)return;(m.getPending()===1&&A.info.pending===0||b===I||f>0&&c>=f)&&m.stop()}};const x=Oi(this.nc.options.inboxPrefix),_=this.nc.subscribe(x,{max:i.batch,callback:(A,P)=>{A===null&&(A=va(P)),A!==null?(a&&(a.cancel(),a=null),II(A)?m.stop(kw(A)===null?void 0:A):m.stop(A)):(h==null||h.work(),m.received++,m.push(Do(P,this.timeout)))}});return y&&(a=ma(y),a.catch(()=>{_.isClosed()||(_.drain().catch(()=>{}),a=null),h&&h.cancel()})),(async()=>{try{g&&(h=new gd(g,A=>(m.push(()=>{m.err=new Re(`${qn.IdleHeartbeatMissed}: ${A}`,be.JetStreamIdleHeartBeat)}),!0)))}catch{}await _.closed,a!==null&&(a.cancel(),a=null),h&&h.cancel(),m.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`,this.jc.encode(d),{reply:x}),m}async pullSubscribe(t,n=is()){const i=await this._processOptions(t,n);if(i.ordered)throw new Error("pull subscribers cannot be be ordered");if(i.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const a=i.config.ack_policy;if(a===Dr.None||a===Dr.All)throw new Error("ack policy for pull consumers must be explicit");const u=this._buildTypedSubscriptionOpts(i),c=new SP(this,i.deliver,u);c.info=i;try{await this._maybeCreateConsumer(i)}catch(f){throw c.unsubscribe(),f}return c}async subscribe(t,n=is()){const i=await this._processOptions(t,n);if(!i.isBind&&!i.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const a=this._buildTypedSubscriptionOpts(i),u=new Aw(this,i.deliver,a);u.info=i;try{await this._maybeCreateConsumer(i)}catch(c){throw u.unsubscribe(),c}return u._maybeSetupHbMonitoring(),u}async _processOptions(t,n=is()){const i=Yb(n)?n.getOpts():n;if(i.isBind=Yb(n)?n.isBind:!1,i.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},i.ordered){if(i.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},i.config.ack_policy!==Dr.NotSet&&i.config.ack_policy!==Dr.None)throw new Re("ordered consumer: ack_policy can only be set to 'none'",be.ApiError);if(i.config.durable_name&&i.config.durable_name.length>0)throw new Re("ordered consumer: durable_name cannot be set",be.ApiError);if(i.config.deliver_subject&&i.config.deliver_subject.length>0)throw new Re("ordered consumer: deliver_subject cannot be set",be.ApiError);if(i.config.max_deliver!==void 0&&i.config.max_deliver>1)throw new Re("ordered consumer: max_deliver cannot be set",be.ApiError);if(i.config.deliver_group&&i.config.deliver_group.length>0)throw new Re("ordered consumer: deliver_group cannot be set",be.ApiError);i.config.deliver_subject=Oi(this.nc.options.inboxPrefix),i.config.ack_policy=Dr.None,i.config.max_deliver=1,i.config.flow_control=!0,i.config.idle_heartbeat=i.config.idle_heartbeat||cr(5e3),i.config.ack_wait=cr(22*60*60*1e3),i.config.mem_storage=!0,i.config.num_replicas=1}if(i.config.ack_policy===Dr.NotSet&&(i.config.ack_policy=Dr.All),i.api=this,i.config=i.config||{},i.stream=i.stream?i.stream:await this.findStream(t),i.attached=!1,i.config.durable_name)try{const a=await this.consumerAPI.info(i.stream,i.config.durable_name);if(a){if(a.config.filter_subject&&a.config.filter_subject!==t)throw new Error("subject does not match consumer");const u=i.config.deliver_group??"";if(u===""&&a.push_bound===!0)throw new Error("duplicate subscription");const c=a.config.deliver_group??"";if(u!==c)throw c===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${c}'`);i.last=a,i.config=a.config,i.attached=!0,i.config.durable_name||(i.name=a.name)}}catch(a){if(a.code!=="404")throw a}return!i.attached&&i.config.filter_subject===void 0&&i.config.filter_subjects===void 0&&(i.config.filter_subject=t),i.deliver=i.config.deliver_subject||Oi(this.nc.options.inboxPrefix),i}_buildTypedSubscriptionOpts(t){const n={};return n.adapter=EP(t.callbackFn===void 0,this.timeout),n.ingestionFilterFn=Fd.ingestionFn(t.ordered),n.protocolFilterFn=(i,a=!1)=>{const u=i;return md(u.msg)?(a||u.msg.respond(),!1):!0},!t.mack&&t.config.ack_policy!==Dr.None&&(n.dispatchedFn=AP),t.callbackFn&&(n.callback=t.callbackFn),n.max=t.max||0,n.queue=t.queue,n}async _maybeCreateConsumer(t){if(t.attached)return;if(t.isBind)throw new Error(`unable to bind - durable consumer ${t.config.durable_name} doesn't exist in ${t.stream}`);t.config=Object.assign({deliver_policy:yr.All,ack_policy:Dr.Explicit,ack_wait:cr(30*1e3),replay_policy:ba.Instant},t.config);const n=await this.consumerAPI.add(t.stream,t.config);if(Array.isArray(t.config.filter_subjects&&!Array.isArray(n.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");t.name=n.name,t.config=n.config,t.last=n}static ingestionFn(t){return(n,i)=>{var f;const a=i;if(!n)return{ingest:!1,protocol:!1};const u=n;if(va(u.msg)||(f=a.monitor)==null||f.work(),yd(u.msg)){const h=t?a._checkHbOrderConsumer(u.msg):!0;return t||a.info.flow_control.heartbeat_count++,{ingest:h,protocol:!0}}else if(md(u.msg))return a.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:t?a._checkOrderedConsumer(n):!0,protocol:!1}}}}class Ld{constructor(e){E(this,"options");E(this,"protocol");E(this,"draining");E(this,"listeners");E(this,"_services");this.draining=!1,this.options=BC(e),this.listeners=[]}static connect(e={}){return new Promise((t,n)=>{const i=new Ld(e);yc.connect(i.options,i).then(a=>{i.protocol=a,async function(){for await(const u of a.status())i.listeners.forEach(c=>{c.push(u)})}(),t(i)}).catch(a=>{n(a)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(e,t,n){if(this.isClosed())throw Re.errorForCode(be.ConnectionClosed);if(t&&this.isDraining()||n&&this.protocol.noMorePublishing)throw Re.errorForCode(be.ConnectionDraining);if(e=e||"",e.length===0)throw Re.errorForCode(be.BadSubject)}publish(e,t,n){this._check(e,!1,!0),this.protocol.publish(e,t,n)}publishMessage(e){return this.publish(e.subject,e.data,{reply:e.reply,headers:e.headers})}respondMessage(e){return e.reply?(this.publish(e.reply,e.data,{reply:e.reply,headers:e.headers}),!0):!1}subscribe(e,t={}){this._check(e,!0,!1);const n=new yw(this.protocol,e,t);return this.protocol.subscribe(n),n}_resub(e,t,n){this._check(t,!0,!1);const i=e;i.max=n,n&&(i.max=n+i.received),this.protocol.resub(i,t)}requestMany(e,t=bn,n={maxWait:1e3,maxMessages:-1}){const i=!this.protocol.options.noAsyncTraces;try{this._check(e,!0,!0)}catch(f){return Promise.reject(f)}if(n.strategy=n.strategy||ri.Timer,n.maxWait=n.maxWait||1e3,n.maxWait<1)return Promise.reject(new Re("timeout",be.InvalidOption));const a=new Mr;function u(f){a.push(()=>{a.stop(f)})}function c(f,h){f||h===null?u(f===null?void 0:f):a.push(h)}if(n.noMux){const f=i?new Error().stack:null;let h=typeof n.maxMessages=="number"&&n.maxMessages>0?n.maxMessages:-1;const d=this.subscribe(Oi(this.options.inboxPrefix),{callback:(b,I)=>{var x,_;if(((x=I==null?void 0:I.data)==null?void 0:x.length)===0&&((_=I==null?void 0:I.headers)==null?void 0:_.status)===be.NoResponders&&(b=Re.errorForCode(be.NoResponders)),b){f&&(b.stack+=`
|
|
159
|
+
`),e.max=t)}resub(e,t){!e||this.isClosed()||(this.unsub(e),e.subject=t,this.subscriptions.resub(e),this._sub(e))}flush(e){return e||(e=ir()),this.pongs.push(e),this.outbound.fill(Fw),this.flushPending(),e}sendSubscriptions(){const e=[];this.subscriptions.all().forEach(t=>{const n=t;n.queue?e.push(`SUB ${n.subject} ${n.queue} ${n.sid}${yc}`):e.push(`SUB ${n.subject} ${n.sid}${yc}`)}),e.length&&this.transport.send(Ao(e.join("")))}async _close(e){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(e),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(t=>{t.stop()}),this._closed=!0,await this.transport.close(e),await this.closed.resolve(e))}close(){return this._close()}isClosed(){return this._closed}drain(){const e=this.subscriptions.all(),t=[];return e.forEach(n=>{t.push(n.drain())}),Promise.all(t).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const e=this.outbound.drain();this.transport.send(e)}}initMux(){if(!this.subscriptions.getMux()){const t=this.muxSubscriptions.init(this.options.inboxPrefix),n=new Lw(this,`${t}*`);n.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(n),this.subscribe(n)}}selectServer(){const e=this.servers.selectServer();if(e!==void 0)return this.server=e,this.server}getServer(){return this.server}}const _P="$SRV";class qw{msg;constructor(e){this.msg=e}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(e,t){return this.msg.respond(e,t)}respondError(e,t,n,i){return i=i||{},i.headers=i.headers||ki(),i.headers?.set(uc,`${e}`),i.headers?.set(oc,t),this.msg.respond(n,i)}json(e){return this.msg.json(e)}string(){return this.msg.string()}}class Fo{subject;queue;srv;constructor(e,t="",n=""){t!==""&&xP("service group",t);let i="";if(e instanceof Lo)this.srv=e,i="";else if(e instanceof Fo){const a=e;this.srv=a.srv,n===""&&a.queue!==""&&(n=a.queue),i=a.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(i,t),this.queue=n}calcSubject(e,t=""){return t===""?e:e!==""?`${e}.${t}`:t}addEndpoint(e="",t){t=t||{subject:e};const n=typeof t=="function"?{handler:t,subject:e}:t;Co("endpoint",e);let{subject:i,handler:a,metadata:u,queue:c}=n;i=i||e,c=c||this.queue,SP("endpoint subject",i),i=this.calcSubject(this.subject,i);const f={name:e,subject:i,queue:c,handler:a,metadata:u};return this.srv._addEndpoint(f)}addGroup(e="",t=""){return new Fo(this,e,t)}}function SP(r,e){if(e==="")throw new Error(`${r} cannot be empty`);if(e.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${e}'`);const t=e.split(".");t.forEach((n,i)=>{if(n===">"&&i!==t.length-1)throw new Error(`${r} cannot have internal '>': '${e}'`)})}function xP(r,e){if(e.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${e}'`);e.split(".").forEach(n=>{if(n===">")throw new Error(`${r} name cannot contain internal '>': '${e}'`)})}class Lo{nc;_id;config;handlers;internal;_stopped;_done;started;static controlSubject(e,t="",n="",i){const a=i??_P;return t===""&&n===""?`${a}.${e}`:(Co("control subject name",t),n!==""?(Co("control subject id",n),`${a}.${e}.${t}.${n}`):`${a}.${e}.${t}`)}constructor(e,t={name:"",version:""}){this.nc=e,this.config=Object.assign({},t),this.config.queue||(this.config.queue="q"),Co("name",this.config.name),Co("queue",this.config.queue),Ms(this.config.version),this._id=ns.next(),this.internal=[],this._done=ir(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(n=>{this.close(n).catch()})}get subjects(){return this.handlers.filter(e=>e.internal===!1).map(e=>e.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(e){const t=ki();if(e instanceof cc){const n=e;t.set(oc,n.message),t.set(uc,`${n.code}`)}else t.set(oc,e.message),t.set(uc,"500");return t}setupHandler(e,t=!1){const n=t?"":e.queue?e.queue:this.config.queue,{name:i,subject:a,handler:u}=e,c=e;c.internal=t,t&&this.internal.push(c),c.stats=new EP(i,a,n),c.queue=n;const f=u?(h,p)=>{if(h){this.close(h);return}const m=Date.now();try{u(h,new qw(p))}catch(y){c.stats.countError(y),p?.respond(gn,{headers:this.errorToHeader(y)})}finally{c.stats.countLatency(m)}}:void 0;return c.sub=this.nc.subscribe(a,{callback:f,queue:n}),c.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${e.subject} stopped`)).catch()}).catch(h=>{if(!this._stopped){const p=new Error(`required subscription ${e.subject} errored: ${h.message}`);p.stack=h.stack,this.close(p).catch()}}),c}info(){return{type:Io.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(e=>{const{subject:t,metadata:n,name:i,queue:a}=e;return{subject:t,metadata:n,name:i,queue_group:a}})}async stats(){const e=[];for(const t of this.handlers){if(typeof this.config.statsHandler=="function")try{t.stats.data=await this.config.statsHandler(t)}catch(n){t.stats.countError(n)}e.push(t.stats.stats(t.qi))}return{type:Io.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:e}}addInternalHandler(e,t){const n=`${e}`.toUpperCase();this._doAddInternalHandler(`${n}-all`,e,t),this._doAddInternalHandler(`${n}-kind`,e,t,this.name),this._doAddInternalHandler(`${n}`,e,t,this.name,this.id)}_doAddInternalHandler(e,t,n,i="",a=""){const u={};u.name=e,u.subject=Lo.controlSubject(t,i,a),u.handler=n,this.setupHandler(u,!0)}start(){const e=Fn(),t=(u,c)=>u?(this.close(u),Promise.reject(u)):this.stats().then(f=>(c?.respond(e.encode(f)),Promise.resolve())),n=(u,c)=>u?(this.close(u),Promise.reject(u)):(c?.respond(e.encode(this.info())),Promise.resolve()),i=e.encode(this.ping()),a=(u,c)=>u?(this.close(u).then().catch(),Promise.reject(u)):(c.respond(i),Promise.resolve());return this.addInternalHandler(is.PING,a),this.addInternalHandler(is.STATS,t),this.addInternalHandler(is.INFO,n),this.handlers.forEach(u=>{const{subject:c}=u;typeof c=="string"&&u.handler!==null&&this.setupHandler(u)}),Promise.resolve(this)}close(e){if(this._stopped)return this._done;this._stopped=!0;let t=[];return this.nc.isClosed()||(t=this.handlers.concat(this.internal).map(n=>n.sub.drain())),Promise.allSettled(t).then(()=>{this._done.resolve(e||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(e){return this.close(e)}ping(){return{type:Io.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const e of this.handlers)e.stats.reset(e.qi)}addGroup(e,t){return new Fo(this,e,t)}addEndpoint(e,t){return new Fo(this).addEndpoint(e,t)}_addEndpoint(e){const t=new Nr;t.noIterator=typeof e.handler=="function",t.noIterator||(e.handler=(i,a)=>{i?this.stop(i).catch():t.push(new qw(a))},t.iterClosed.then(()=>{this.close().catch()}));const n=this.setupHandler(e,!1);return n.qi=t,this.handlers.push(n),t}}class EP{name;subject;average_processing_time;num_requests;processing_time;num_errors;last_error;data;metadata;queue;constructor(e,t,n=""){this.name=e,this.subject=t,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=n}reset(e){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const t=e;t&&(t.time=0,t.processed=0)}countLatency(e){this.num_requests++,this.processing_time+=sr(Date.now()-e),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(e){this.num_errors++,this.last_error=e.message}_stats(){const{name:e,subject:t,average_processing_time:n,num_errors:i,num_requests:a,processing_time:u,last_error:c,data:f,queue:h}=this;return{name:e,subject:t,average_processing_time:n,num_errors:i,num_requests:a,processing_time:u,last_error:c,data:f,queue_group:h}}stats(e){const t=e;return t?.noIterator===!1&&(this.processing_time=sr(t.time),this.num_requests=t.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class OP{nc;prefix;opts;constructor(e,t={strategy:ei.JitterTimer,maxWait:2e3},n){this.nc=e,this.prefix=n,this.opts=t}ping(e="",t=""){return this.q(is.PING,e,t)}stats(e="",t=""){return this.q(is.STATS,e,t)}info(e="",t=""){return this.q(is.INFO,e,t)}async q(e,t="",n=""){const i=new Nr,a=Fn(),u=Lo.controlSubject(e,t,n,this.prefix),c=await this.nc.requestMany(u,gn,this.opts);return(async()=>{for await(const f of c)try{const h=a.decode(f.data);i.push(h)}catch(h){i.push(()=>{i.stop(h)})}i.push(()=>{i.stop()})})().catch(f=>{i.stop(f)}),i}}function jw(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function TP(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:jw(),storage:Ad.File}}const xc="KV-Operation",Uw="$KV",kP=/^[-/=.\w]+$/,AP=/^[-/=.>*\w]+$/,IP=/^[-\w]+$/;function CP(r){if(r.startsWith(".")||r.endsWith(".")||!kP.test(r))throw new Error(`invalid key: ${r}`)}function PP(r){if(r.startsWith(".")||r.endsWith(".")||!AP.test(r))throw new Error(`invalid key: ${r}`)}function NP(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const e=r.split(".");let t=!1;for(let n=0;n<e.length;n++)switch(e[n]){case"*":t=!0;break;case">":if(n!==e.length-1)throw new Error(`invalid key: ${r}`);t=!0;break}return t}function Ec(r){if(!IP.test(r))throw new Error(`invalid bucket name: ${r}`)}var ci;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(ci||(ci={}));class qo{js;jsm;stream;bucket;direct;codec;prefix;editPrefix;useJsPrefix;_prefixLen;constructor(e,t,n){Ec(e),this.js=t,this.jsm=n,this.bucket=e,this.prefix=Uw,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(e,t,n={}){Ec(t);const i=await e.jetstreamManager(),a=new qo(t,e,i);return await a.init(n),a}static async bind(e,t,n={}){const i=await e.jetstreamManager(),a={config:{allow_direct:n.allow_direct}};Ec(t);const u=new qo(t,e,i);return a.config.name=n.streamName??u.bucketName(),Object.assign(u,a),u.stream=a.config.name,u.codec=n.codec||jw(),u.direct=a.config.allow_direct??!1,u.initializePrefixes(a),u}async init(e={}){const t=Object.assign(TP(),e);this.codec=t.codec;const n={};this.stream=n.name=e.streamName??this.bucketName(),n.retention=kd.Limits,n.max_msgs_per_subject=t.history,t.maxBucketSize&&(t.max_bytes=t.maxBucketSize),t.max_bytes&&(n.max_bytes=t.max_bytes),n.max_msg_size=t.maxValueSize,n.storage=t.storage;const i=e.placementCluster??"";if(i&&(e.placement={},e.placement.cluster=i,e.placement.tags=[]),e.placement&&(n.placement=e.placement),e.republish&&(n.republish=e.republish),e.description&&(n.description=e.description),e.mirror){const m=Object.assign({},e.mirror);m.name.startsWith(bn)||(m.name=`${bn}${m.name}`),n.mirror=m,n.mirror_direct=!0}else if(e.sources){const m=e.sources.map(y=>{const g=Object.assign({},y),b=g.name.startsWith(bn)?g.name.substring(bn.length):g.name;return g.name.startsWith(bn)||(g.name=`${bn}${g.name}`),!y.external&&b!==this.bucket&&(g.subject_transforms=[{src:`$KV.${b}.>`,dest:`$KV.${this.bucket}.>`}]),g});n.sources=m,n.subjects=[this.subjectForBucket()]}else n.subjects=[this.subjectForBucket()];e.metadata&&(n.metadata=e.metadata),typeof e.compression=="boolean"&&(n.compression=e.compression?as.S2:as.None);const a=this.js.nc,u=a.getServerVersion(),c=u?Pd(u,Ms("2.7.2"))>=0:!1;n.discard=c?Po.New:Po.Old;const{ok:f,min:h}=a.features.get(At.JS_ALLOW_DIRECT);if(!f&&e.allow_direct===!0){const m=u?`${u.major}.${u.minor}.${u.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${m} - requires ${h}`))}e.allow_direct=typeof e.allow_direct=="boolean"?e.allow_direct:f,n.allow_direct=e.allow_direct,this.direct=n.allow_direct,n.num_replicas=t.replicas,t.ttl&&(n.max_age=sr(t.ttl)),n.allow_rollup_hdrs=!0;let p;try{p=await this.jsm.streams.info(n.name),!p.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(m){if(m.message==="stream not found")p=await this.jsm.streams.add(n);else throw m}this.initializePrefixes(p)}initializePrefixes(e){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:t}=e.config;if(t){let n=t.name;if(n.startsWith(bn)&&(n=n.substring(bn.length)),t.external&&t.external.api!==""){const i=t.name.substring(bn.length);this.useJsPrefix=!1,this.prefix=`$KV.${i}`,this.editPrefix=`${t.external.api}.$KV.${n}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${bn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(e,t=!1){const n=[];return t?(this.useJsPrefix&&n.push(this.js.apiPrefix),this.editPrefix!==""?n.push(this.editPrefix):n.push(this.prefix)):this.prefix&&n.push(this.prefix),n.push(e),n.join(".")}fullKeyName(e){return this.prefix!==""?`${this.prefix}.${e}`:`${Uw}.${this.bucket}.${e}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(e){const t=[];for(const n of e.split("."))switch(n){case">":case"*":t.push(n);break;default:t.push(this.codec.key.encode(n));break}return t.join(".")}decodeKey(e){const t=[];for(const n of e.split("."))switch(n){case">":case"*":t.push(n);break;default:t.push(this.codec.key.decode(n));break}return t.join(".")}validateKey=CP;validateSearchKey=PP;hasWildcards=NP;close(){return Promise.resolve()}dataLen(e,t){const n=t&&t.get(Xr.MessageSizeHdr)||"";return n!==""?parseInt(n,10):e.length}smToEntry(e){return new QP(this.bucket,this.prefixLen,e)}jmToEntry(e){const t=this.decodeKey(e.subject.substring(this.prefixLen));return new JP(this.bucket,t,e)}async create(e,t){let n;try{const a=await this.put(e,t,{previousSeq:0});return Promise.resolve(a)}catch(a){if(n=a,a?.api_error?.err_code!==10071)return Promise.reject(a)}let i=0;try{const a=await this.get(e);return a?.operation==="DEL"||a?.operation==="PURGE"?(i=a!==null?a.revision:0,this.update(e,t,i)):Promise.reject(n)}catch(a){return Promise.reject(a)}}update(e,t,n){if(n<=0)throw new Error("version must be greater than 0");return this.put(e,t,{previousSeq:n})}async put(e,t,n={}){const i=this.encodeKey(e);this.validateKey(i);const a={};if(n.previousSeq!==void 0){const u=ki();a.headers=u,u.set(ci.ExpectedLastSubjectSequenceHdr,`${n.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(i,!0),t,a)).seq}catch(u){const c=u;return c.isJetStreamError()?(c.message=c.api_error?.description,c.code=`${c.api_error?.code}`,Promise.reject(c)):Promise.reject(u)}}async get(e,t){const n=this.encodeKey(e);this.validateKey(n);let i={last_by_subj:this.subjectForKey(n)};t&&t.revision>0&&(i={seq:t.revision});let a;try{this.direct?a=await this.jsm.direct.getMessage(this.bucketName(),i):a=await this.jsm.streams.getMessage(this.bucketName(),i);const u=this.smToEntry(a);return u.key!==n?null:u}catch(u){if(u.code===_e.JetStream404NoMessages)return null;throw u}}purge(e,t){return this._deleteOrPurge(e,"PURGE",t)}delete(e,t){return this._deleteOrPurge(e,"DEL",t)}async purgeDeletes(e=1800*1e3){const t=ir(),n=[],i=await this.watch({key:">",initializedFn:()=>{t.resolve()}});(async()=>{for await(const f of i)(f.operation==="DEL"||f.operation==="PURGE")&&n.push(f)})().then(),await t,i.stop();const a=Date.now()-e,u=n.map(f=>{const h=this.subjectForKey(f.key);return f.created.getTime()>=a?this.jsm.streams.purge(this.stream,{filter:h,keep:1}):this.jsm.streams.purge(this.stream,{filter:h,keep:0})}),c=await Promise.all(u);return c.unshift({success:!0,purged:0}),c.reduce((f,h)=>(f.purged+=h.purged,f))}async _deleteOrPurge(e,t,n){if(!this.hasWildcards(e))return this._doDeleteOrPurge(e,t,n);const i=await this.keys(e),a=[];for await(const u of i)a.push(this._doDeleteOrPurge(u,t)),a.length===100&&(await Promise.all(a),a.length=0);a.length>0&&await Promise.all(a)}async _doDeleteOrPurge(e,t,n){const i=this.encodeKey(e);this.validateKey(i);const a=ki();a.set(xc,t),t==="PURGE"&&a.set(Xr.RollupHdr,Xr.RollupValueSubject),n?.previousSeq&&a.set(ci.ExpectedLastSubjectSequenceHdr,`${n.previousSeq}`),await this.js.publish(this.subjectForKey(i,!0),gn,{headers:a})}_buildCC(e,t,n={}){let a=(Array.isArray(e)?e:[e]).map(f=>{const h=this.encodeKey(f);return this.validateSearchKey(f),this.fullKeyName(h)}),u=yr.LastPerSubject;t===ti.AllHistory&&(u=yr.All),t===ti.UpdatesOnly&&(u=yr.New);let c;return a.length===1&&(c=a[0],a=void 0),Object.assign({deliver_policy:u,ack_policy:Rr.None,filter_subjects:a,filter_subject:c,flow_control:!0,idle_heartbeat:sr(5*1e3)},n)}remove(e){return this.purge(e)}async history(e={}){const t=e.key??">",n=new Nr,i={};i.headers_only=e.headers_only||!1;let a;a=()=>{n.stop()};let u=0;const c=this._buildCC(t,ti.AllHistory,i),f=c.filter_subject,h=os(c);h.bindStream(this.stream),h.orderedConsumer(),h.callback((m,y)=>{if(m){n.stop(m);return}if(y){const g=this.jmToEntry(y);n.push(g),n.received++,(a&&u>0&&n.received>=u||y.info.pending===0)&&(n.push(a),a=void 0)}});const p=await this.js.subscribe(f,h);if(a){const{info:{last:m}}=p,y=m.num_pending+m.delivered.consumer_seq;if(y===0||n.received>=y)try{a()}catch(g){n.stop(g)}finally{a=void 0}else u=y}return n._data=p,n.iterClosed.then(()=>{p.unsubscribe()}),p.closed.then(()=>{n.stop()}).catch(m=>{n.stop(m)}),n}canSetWatcherName(){const t=this.js.nc,{ok:n}=t.features.get(At.JS_NEW_CONSUMER_CREATE_API);return n}async watch(e={}){const t=e.key??">",n=new Nr,i={};i.headers_only=e.headers_only||!1;let a=ti.LastValue;e.include===ti.AllHistory?a=ti.AllHistory:e.include===ti.UpdatesOnly&&(a=ti.UpdatesOnly);const u=e.ignoreDeletes===!0;let c=e.initializedFn,f=0;const h=this._buildCC(t,a,i),p=h.filter_subject,m=os(h);this.canSetWatcherName()&&m.consumerName(ns.next()),m.bindStream(this.stream),e.resumeFromRevision&&e.resumeFromRevision>0&&m.startSequence(e.resumeFromRevision),m.orderedConsumer(),m.callback((g,b)=>{if(g){n.stop(g);return}if(b){const I=this.jmToEntry(b);if(u&&I.operation==="DEL")return;n.push(I),n.received++,c&&(f>0&&n.received>=f||b.info.pending===0)&&(n.push(c),c=void 0)}});const y=await this.js.subscribe(p,m);if(c){const{info:{last:g}}=y,b=g.num_pending+g.delivered.consumer_seq;if(b===0||n.received>=b)try{c()}catch(I){n.stop(I)}finally{c=void 0}else f=b}return n._data=y,n.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{n.stop()}).catch(g=>{n.stop(g)}),n}async keys(e=">"){const t=new Nr,n=this._buildCC(e,ti.LastValue,{headers_only:!0}),i=Array.isArray(e)?">":n.filter_subject,a=os(n);a.bindStream(this.stream),a.orderedConsumer();const u=await this.js.subscribe(i,a);return(async()=>{for await(const f of u){const h=f.headers?.get(xc);if(h!=="DEL"&&h!=="PURGE"){const p=this.decodeKey(f.subject.substring(this.prefixLen));t.push(p)}f.info.pending===0&&u.unsubscribe()}})().then(()=>{t.stop()}).catch(f=>{t.stop(f)}),u.info.last.num_pending===0&&u.unsubscribe(),t}purgeBucket(e){return this.jsm.streams.purge(this.bucketName(),e)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){const t=this.js.nc.info?.cluster??"",n=this.bucketName(),i=await this.jsm.streams.info(n);return new $w(i,t)}}class $w{si;cluster;constructor(e,t=""){this.si=e,this.cluster=t}get bucket(){return this.si.config.name.startsWith(bn)?this.si.config.name.substring(bn.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Sd(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){return this.si.config.placement?.cluster??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==as.None:!1}}const jd="OBJ_",Bw="SHA-256=";function RP(r){return Ec(r),`${jd}${r}`}function MP(r){return r.startsWith(jd)?r.substring(4):r}class Ud{si;backingStore;constructor(e){this.si=e,this.backingStore="JetStream"}get bucket(){return MP(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==as.None:!1}}function Oc(r){if(r===void 0)return;const{domain:e}=r;if(e===void 0)return r;const t=Object.assign({},r);if(delete t.domain,e==="")return t;if(t.external)throw new Error("domain and external are both set");return t.external={api:`$JS.${e}.API`},t}var qn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(qn||(qn={}));var li;(function(r){r.HeartbeatsMissed="heartbeats_missed",r.ConsumerNotFound="consumer_not_found",r.StreamNotFound="stream_not_found",r.ConsumerDeleted="consumer_deleted",r.OrderedConsumerRecreated="ordered_consumer_recreated",r.NoResponders="no_responders"})(li||(li={}));var ka;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(ka||(ka={}));const Vw=Uint8Array.of(43,65,67,75),DP=Uint8Array.of(45,78,65,75),jo=Uint8Array.of(43,87,80,73),FP=Uint8Array.of(43,78,88,84),LP=Uint8Array.of(43,84,69,82,77),qP=Uint8Array.of(32);function Uo(r,e=5e3){return new rN(r,e)}class $d extends Nr{consumer;opts;sub;monitor;pending;inbox;refilling;pong;callback;timeout;cleanupHandler;listeners;statusIterator;forOrderedConsumer;resetHandler;abortOnMissingResource;bind;inBackOff;constructor(e,t,n=!1){super(),this.consumer=e;const i=t;this.opts=this.parseOptions(t,n),this.callback=i.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=n,this.timeout=null,this.inbox=Ti(e.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=i.abort_on_missing_resource===!0,this.bind=i.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:e,max_bytes:t,idle_heartbeat:n,threshold_bytes:i,threshold_messages:a}=this.opts;this.closed().then(c=>{if(this.cleanupHandler)try{this.cleanupHandler(c)}catch{}});const{sub:u}=this;u&&u.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(c,f)=>{if(c){this.stop(c);return}if(this.monitor?.work(),f.subject===this.inbox){if(Od(f))return;const p=f.headers?.code,m=f.headers?.description?.toLowerCase()||"unknown",{msgsLeft:y,bytesLeft:g}=this.parseDiscard(f.headers);if(y>0||g>0)this.pending.msgs-=y,this.pending.bytes-=g,this.pending.requests--,this.notify(ka.Discard,{msgsLeft:y,bytesLeft:g});else if(p===400){this.stop(new Me(m,`${p}`));return}else if(p===409&&m==="consumer deleted"){if(this.notify(li.ConsumerDeleted,`${p} ${m}`),!this.refilling||this.abortOnMissingResource){const b=new Me(m,`${p}`);this.stop(b);return}}else if(p===503){if(this.notify(li.NoResponders,`${p} No Responders`),!this.refilling||this.abortOnMissingResource){const b=new Me("no responders",`${p}`);this.stop(b);return}}else this.notify(ka.DebugEvent,`${p} ${m}`)}else this._push(Uo(f,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=f.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(e&&this.pending.msgs<=a||t&&this.pending.bytes<=i){const p=this.pullOptions();this.pull(p)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),n&&(this.monitor=new Td(n,c=>(this.notify(li.HeartbeatsMissed,c),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{const c=this.consumer.api.nc.status();this.statusIterator=c;for await(const f of c)switch(f.type){case Oi.Disconnect:this.monitor?.cancel();break;case Oi.Reconnect:this.resetPending().then(h=>{h&&this.monitor?.restart()}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(e){if(!this.callback)super.push(e);else{const t=typeof e=="function"?e:null;try{t?t():this.callback(e)}catch(n){this.stop(n)}}}notify(e,t){this.listeners.length>0&&this.listeners.forEach(n=>{n.done||n.push({type:e,data:t})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let e=0,t=0;const n=_d([this.opts.expires]);let i=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,e=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(a){if(a.message==="stream not found"){if(t++,this.notify(li.StreamNotFound,t),!this.refilling||this.abortOnMissingResource)return this.stop(a),!1}else if(a.message==="consumer not found"){if(e++,this.notify(li.ConsumerNotFound,e),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(a),!1;if(this.forOrderedConsumer)return!1}else e=0,t=0;this.inBackOff=!0;const u=n.backoff(i),c=va(u);await Promise.race([c,this.consumer.api.nc.closed()]),c.cancel(),i++}}}pull(e){this.pending.bytes+=e.max_bytes??0,this.pending.msgs+=e.batch??0,this.pending.requests++;const t=this.consumer.api.nc;this._push(()=>{t.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(e),{reply:this.inbox}),this.notify(ka.Next,e)})}pullOptions(){const e=this.opts.max_messages-this.pending.msgs,t=this.opts.max_bytes-this.pending.bytes,n=sr(this.opts.idle_heartbeat),i=sr(this.opts.expires);return{batch:e,max_bytes:t,idle_heartbeat:n,expires:i}}parseDiscard(e){const t={msgsLeft:0,bytesLeft:0},n=e?.get(Xr.PendingMessagesHdr);n&&(t.msgsLeft=parseInt(n));const i=e?.get(Xr.PendingBytesHdr);return i&&(t.bytesLeft=parseInt(i)),t}trackTimeout(e){this.timeout=e}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){this.monitor?.cancel(),this.monitor=null,this.timeout?.cancel(),this.timeout=null}setCleanupHandler(e){this.cleanupHandler=e}stop(e){this.done||(this.sub?.unsubscribe(),this.clearTimers(),this.statusIterator?.stop(),this._push(()=>{super.stop(e),this.listeners.forEach(t=>{t.stop()})}))}parseOptions(e,t=!1){const n=e||{};if(n.max_messages=n.max_messages||0,n.max_bytes=n.max_bytes||0,n.max_messages!==0&&n.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(n.max_messages===0&&(n.max_messages=100),n.expires=n.expires||3e4,n.expires<1e3)throw new Error("expires should be at least 1000ms");if(n.idle_heartbeat=n.idle_heartbeat||n.expires/2,n.idle_heartbeat=n.idle_heartbeat>3e4?3e4:n.idle_heartbeat,t){const i=Math.round(n.max_messages*.75)||1;n.threshold_messages=n.threshold_messages||i;const a=Math.round(n.max_bytes*.75)||1;n.threshold_bytes=n.threshold_bytes||a}return n}status(){const e=new Nr;return this.listeners.push(e),Promise.resolve(e)}}class jP extends Nr{src;listeners;constructor(){super(),this.listeners=[]}setSource(e){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=e,this.src.setCleanupHandler(t=>{this.stop(t||void 0)}),(async()=>{const t=await this.src.status();for await(const n of t)this.notify(n.type,n.data)})().catch(()=>{})}notify(e,t){this.listeners.length>0&&this.listeners.forEach(n=>{n.done||n.push({type:e,data:t})})}stop(e){this.done||(this.src?.stop(e),super.stop(e),this.listeners.forEach(t=>{t.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const e=new Nr;return this.listeners.push(e),Promise.resolve(e)}}class Bd{api;_info;stream;name;constructor(e,t){this.api=e,this._info=t,this.stream=t.stream_name,this.name=t.name}consume(e={max_messages:100,expires:3e4}){return Promise.resolve(new $d(this,e,!0))}fetch(e={max_messages:100,expires:3e4}){const t=new $d(this,e,!1),n=Math.round(t.opts.expires*1.05),i=ga(n);return t.closed().catch(()=>{}).finally(()=>{i.cancel()}),i.catch(()=>{t.close().catch()}),t.trackTimeout(i),Promise.resolve(t)}next(e={expires:3e4}){const t=ir(),n=e;n.max_messages=1;const i=new $d(this,n,!1),a=Math.round(i.opts.expires*1.05);a>=6e4&&(async()=>{for await(const c of await i.status())if(c.type===li.HeartbeatsMissed&&c.data>=2){t.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const c of i){t.resolve(c);break}})().catch(()=>{});const u=ga(a);return i.closed().then(c=>{c?t.reject(c):t.resolve(null)}).catch(c=>{t.reject(c)}).finally(()=>{u.cancel()}),u.catch(c=>{t.resolve(null),i.close().catch()}),i.trackTimeout(u),t}delete(){const{stream_name:e,name:t}=this._info;return this.api.delete(e,t)}info(e=!1){if(e)return Promise.resolve(this._info);const{stream_name:t,name:n}=this._info;return this.api.info(t,n).then(i=>(this._info=i,this._info))}}class UP{api;consumerOpts;consumer;opts;cursor;stream;namePrefix;serial;currentConsumer;userCallback;iter;type;startSeq;maxInitialReset;constructor(e,t,n={}){this.api=e,this.stream=t,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=ns.next(),typeof n.name_prefix=="string"&&(hc("name_prefix",n.name_prefix),this.namePrefix=n.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=qn.Unset,this.consumerOpts=n,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(e){this.serial++;const t=`${this.namePrefix}_${this.serial}`;e=e===0?1:e;const n={name:t,deliver_policy:yr.StartSequence,opt_start_seq:e,ack_policy:Rr.None,inactive_threshold:sr(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(n.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(n.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(n.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(n.replay_policy=this.consumerOpts.replay_policy),e===this.startSeq+1&&(n.deliver_policy=this.consumerOpts.deliver_policy||yr.StartSequence,(this.consumerOpts.deliver_policy===yr.LastPerSubject||this.consumerOpts.deliver_policy===yr.New||this.consumerOpts.deliver_policy===yr.Last)&&(delete n.opt_start_seq,n.deliver_policy=this.consumerOpts.deliver_policy),n.deliver_policy===yr.LastPerSubject&&typeof n.filter_subjects>"u"&&typeof n.filter_subject>"u"&&(n.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete n.opt_start_seq,n.deliver_policy=yr.StartTime,n.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(n.inactive_threshold=sr(this.consumerOpts.inactive_threshold))),n}async resetConsumer(e=0){ns.next();const t=this.serial===0;this.consumer?.delete().catch(()=>{}),e=e===0?1:e,this.cursor.deliver_seq=0;const n=this.getConsumerOpts(e);n.max_deliver=1,n.mem_storage=!0;const i=_d([this.opts?.expires||3e4]);let a;for(let u=0;;u++)try{a=await this.api.add(this.stream,n),this.iter?.notify(li.OrderedConsumerRecreated,a.name);break}catch(c){if(c.message==="stream not found"&&(this.iter?.notify(li.StreamNotFound,u),this.type===qn.Fetch||this.opts.abort_on_missing_resource===!0))return this.iter?.stop(c),Promise.reject(c);if(t&&u>=this.maxInitialReset)throw c;await va(i.backoff(u+1))}return a}internalHandler(e){return t=>{if(this.serial!==e)return;const n=t.info.deliverySequence;if(n!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=n,this.cursor.stream_seq=t.info.streamSequence,this.userCallback?this.userCallback(t):this.iter?.push(t)}}async reset(e={max_messages:100,expires:3e4},t){t=t||{};const n=t.fromFetch||!1,i=t.orderedReset||!1;if(this.type===qn.Fetch&&i){this.iter?.src.stop(),await this.iter?.closed(),this.currentConsumer=null;return}(this.currentConsumer===null||i)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||n)&&(this.iter=new jP),this.consumer=new Bd(this.api,this.currentConsumer);const a=e;a.callback=this.internalHandler(this.serial);let u=null;this.type===qn.Fetch&&n?u=await this.consumer.fetch(e):this.type===qn.Consume&&(u=await this.consumer.consume(e));const c=u;c.forOrderedConsumer=!0,c.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(c)}notifyOrderedResetAndReset(){this.iter?.notify(ka.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(e={max_messages:100,expires:3e4}){if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===qn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===qn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:n}=e;return n&&(this.userCallback=n),this.type=qn.Consume,this.opts=e,await this.reset(e),this.iter}async fetch(e={max_messages:100,expires:3e4}){if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===qn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(this.iter?.done===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:n}=e;return n&&(this.userCallback=n),this.type=qn.Fetch,this.opts=e,await this.reset(e,{fromFetch:!0}),this.iter}async next(e={expires:3e4}){const t=e;if(t.bind)return Promise.reject(new Error("bind is not supported"));t.max_messages=1;const n=ir();return t.callback=a=>{this.userCallback=null,n.resolve(a)},(await this.fetch(t)).iterClosed.then(a=>{a&&n.reject(a),n.resolve(null)}).catch(a=>{n.reject(a)}),n}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(e=>Promise.resolve(e)).catch(e=>Promise.reject(e)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(e){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):e&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Vd{api;notified;constructor(e){this.api=e,this.notified=!1}checkVersion(){const e=this.api.nc.features.get(At.JS_SIMPLIFICATION);return e.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${e.min} or better`))}getPullConsumerFor(e){if(e.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Bd(this.api,e)}async get(e,t={}){return typeof t=="object"?this.ordered(e,t):(await this.checkVersion(),this.api.info(e,t).then(n=>n.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Bd(this.api,n)).catch(n=>Promise.reject(n)))}async ordered(e,t){await this.checkVersion();const n=this.api;return new Wd(n.nc,n.opts).info(e).then(a=>Promise.resolve(new UP(this.api,e,t))).catch(a=>Promise.reject(a))}}class Tc{api;_info;constructor(e,t){this.api=e,this._info=t}get name(){return this._info.config.name}alternates(){return this.info().then(e=>e.alternates?e.alternates:[])}async best(){if(await this.info(),this._info.alternates){const e=await this.api.info(this._info.alternates[0].name);return new Tc(this.api,e)}else return this}info(e=!1,t){return e?Promise.resolve(this._info):this.api.info(this.name,t).then(n=>(this._info=n,this._info))}getConsumerFromInfo(e){return new Vd(new mc(this.api.nc,this.api.opts)).getPullConsumerFor(e)}getConsumer(e){return new Vd(new mc(this.api.nc,this.api.opts)).get(this.name,e)}getMessage(e){return this.api.getMessage(this.name,e)}deleteMessage(e,t){return this.api.deleteMessage(this.name,e,t)}}class Wd extends Ro{constructor(e,t){super(e,t)}checkStreamConfigVersions(e){const t=this.nc;if(e.metadata){const{min:i,ok:a}=t.features.get(At.JS_STREAM_CONSUMER_METADATA);if(!a)throw new Error(`stream 'metadata' requires server ${i}`)}if(e.first_seq){const{min:i,ok:a}=t.features.get(At.JS_STREAM_FIRST_SEQ);if(!a)throw new Error(`stream 'first_seq' requires server ${i}`)}if(e.subject_transform){const{min:i,ok:a}=t.features.get(At.JS_STREAM_SUBJECT_TRANSFORM);if(!a)throw new Error(`stream 'subject_transform' requires server ${i}`)}if(e.compression){const{min:i,ok:a}=t.features.get(At.JS_STREAM_COMPRESSION);if(!a)throw new Error(`stream 'compression' requires server ${i}`)}if(e.consumer_limits){const{min:i,ok:a}=t.features.get(At.JS_DEFAULT_CONSUMER_LIMITS);if(!a)throw new Error(`stream 'consumer_limits' requires server ${i}`)}function n(i,a){if((a?.subject_transforms?.length||0)>0){const{min:c,ok:f}=t.features.get(At.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!f)throw new Error(`${i} 'subject_transforms' requires server ${c}`)}}e.sources&&e.sources.forEach(i=>{n("stream sources",i)}),e.mirror&&n("stream mirror",e.mirror)}async add(e={}){this.checkStreamConfigVersions(e),Zr(e.name),e.mirror=Oc(e.mirror),e.sources=e.sources?.map(Oc);const n=await this._request(`${this.prefix}.STREAM.CREATE.${e.name}`,e);return this._fixInfo(n),n}async delete(e){return Zr(e),(await this._request(`${this.prefix}.STREAM.DELETE.${e}`)).success}async update(e,t={}){if(typeof e=="object"){const c=e;e=c.name,t=c,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(t),Zr(e);const n=await this.info(e),i=Object.assign(n.config,t);i.mirror=Oc(i.mirror),i.sources=i.sources?.map(Oc);const u=await this._request(`${this.prefix}.STREAM.UPDATE.${e}`,i);return this._fixInfo(u),u}async info(e,t){Zr(e);const n=`${this.prefix}.STREAM.INFO.${e}`;let a=await this._request(n,t),{total:u,limit:c}=a,f=a.state.subjects?Object.getOwnPropertyNames(a.state.subjects).length:1;if(u&&u>f){const h=[a],p=t||{};let m=0;for(;u>f;){m++,p.offset=c*m;const g=await this._request(n,p);u=g.total,h.push(g);const b=Object.getOwnPropertyNames(g.state.subjects).length;if(f+=b,b<c)break}let y={};for(let g=0;g<h.length;g++)a=h[g],a.state.subjects&&(y=Object.assign(y,a.state.subjects));a.offset=0,a.total=0,a.limit=0,a.state.subjects=y}return this._fixInfo(a),a}list(e=""){const t=e?.length?{subject:e}:{},n=a=>{const u=a;return u.streams.forEach(c=>{this._fixInfo(c)}),u.streams},i=`${this.prefix}.STREAM.LIST`;return new Mo(i,n,this,t)}_fixInfo(e){e.config.sealed=e.config.sealed||!1,e.config.deny_delete=e.config.deny_delete||!1,e.config.deny_purge=e.config.deny_purge||!1,e.config.allow_rollup_hdrs=e.config.allow_rollup_hdrs||!1}async purge(e,t){if(t){const{keep:i,seq:a}=t;if(typeof i=="number"&&typeof a=="number")throw new Error("can specify one of keep or seq")}return Zr(e),await this._request(`${this.prefix}.STREAM.PURGE.${e}`,t)}async deleteMessage(e,t,n=!0){Zr(e);const i={seq:t};return n||(i.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${e}`,i)).success}async getMessage(e,t){Zr(e);const i=await this._request(`${this.prefix}.STREAM.MSG.GET.${e}`,t);return new VP(i)}find(e){return this.findStream(e)}listKvs(){const e=n=>{const a=n.streams.filter(f=>f.config.name.startsWith(bn));a.forEach(f=>{this._fixInfo(f)});let u="";return a.length&&(u=this.nc.info?.cluster??""),a.map(f=>new $w(f,u))},t=`${this.prefix}.STREAM.LIST`;return new Mo(t,e,this)}listObjectStores(){const e=n=>{const a=n.streams.filter(c=>c.config.name.startsWith(jd));return a.forEach(c=>{this._fixInfo(c)}),a.map(c=>new Ud(c))},t=`${this.prefix}.STREAM.LIST`;return new Mo(t,e,this)}names(e=""){const t=e?.length?{subject:e}:{},n=a=>a.streams,i=`${this.prefix}.STREAM.NAMES`;return new Mo(i,n,this,t)}async get(e){const t=await this.info(e);return Promise.resolve(new Tc(this,t))}}class $P extends Ro{constructor(e,t){super(e,t)}async getMessage(e,t){Zr(e);let n=t;const{last_by_subj:i}=n;i&&(n=null);const a=n?this.jc.encode(n):gn,u=this.opts.apiPrefix||"$JS.API",c=i?`${u}.DIRECT.GET.${e}.${i}`:`${u}.DIRECT.GET.${e}`,f=await this.nc.request(c,a,{timeout:this.timeout}),h=wa(f);if(h)return Promise.reject(h);const p=new Ww(f);return Promise.resolve(p)}async getBatch(e,t){Zr(e);const i=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${e}`;if(!Array.isArray(t.multi_last)||t.multi_last.length===0)return Promise.reject("multi_last is required");const a=JSON.stringify(t,(f,h)=>f==="up_to_time"&&h instanceof Date?h.toISOString():h),u=new Nr,c=await this.nc.requestMany(i,a,{strategy:ei.SentinelMsg});return(async()=>{let f=!1,h=!1,p;for await(const m of c){if(!f){f=!0;const y=m.headers?.code||0;if(y!==0&&y<200||y>299){p=m.headers?.description.toLowerCase();break}if(m.headers?.get("Nats-Num-Pending")===""){h=!0;break}}if(m.data.length===0)break;u.push(new Ww(m))}u.push(()=>{if(h)throw new Error("batch direct get not supported by the server");if(p)throw new Error(`bad request: ${p}`);u.stop()})})(),Promise.resolve(u)}}class Ww{data;header;static jc;constructor(e){if(!e.headers)throw new Error("headers expected");this.data=e.data,this.header=e.headers}get subject(){return this.header.last(Sa.Subject)}get seq(){const e=this.header.last(Sa.Sequence);return typeof e=="string"?parseInt(e):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Sa.TimeStamp)}get stream(){return this.header.last(Sa.Stream)}json(e){return Fn(e).decode(this.data)}string(){return cn.decode(this.data)}}class BP extends Ro{streams;consumers;direct;constructor(e,t){super(e,t),this.streams=new Wd(e,t),this.consumers=new mc(e,t),this.direct=new $P(e,t)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const e=new Nr;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(t,n)=>{if(t)throw t;try{const i=this.parseJsResponse(n),a=i.type.split("."),u=a[a.length-1];e.push({kind:u,data:i})}catch(i){e.stop(i)}}}),e}}class VP{_header;smr;static jc;constructor(e){this.smr=e}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):gn}get header(){if(!this._header)if(this.smr.message.hdrs){const e=this._parse(this.smr.message.hdrs);this._header=ss.decode(e)}else this._header=ki();return this._header}_parse(e){const t=atob(e),n=t.length,i=new Uint8Array(n);for(let a=0;a<n;a++)i[a]=t.charCodeAt(a);return i}json(e){return Fn(e).decode(this.data)}string(){return cn.decode(this.data)}}class WP{api;constructor(e){this.api=e}get(e){return this.api.info(e).then(t=>new Tc(this.api,t))}}class zd{info;hdrs;constructor(e){this.info=e}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=ss.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){return this.info.options?.link!==void 0&&this.info.options?.link!==null}}function zw(r){const e={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const t=r.headers;e.headers=t.toRecord()}return e}function zP(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class $o{jsm;js;stream;name;constructor(e,t,n){this.name=e,this.jsm=t,this.js=n}_checkNotEmpty(e){return!e||e.length===0?{name:e,error:new Error("name cannot be empty")}:{name:e}}async info(e){const t=await this.rawInfo(e);return t?new zd(t):null}async list(){const e=[],t=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const n of t){if(n===null)break;e.push(n)}return Promise.resolve(e)}async rawInfo(e){const{name:t,error:n}=this._checkNotEmpty(e);if(n)return Promise.reject(n);const i=this._metaSubject(t);try{const a=await this.jsm.streams.getMessage(this.stream,{last_by_subj:i}),c=Fn().decode(a.data);return c.revision=a.seq,c}catch(a){return a.code==="404"?null:Promise.reject(a)}}async _si(e){try{return await this.jsm.streams.info(this.stream,e)}catch(t){return t.code==="404"?null:Promise.reject(t)}}async seal(){let e=await this._si();return e===null?Promise.reject(new Error("object store not found")):(e.config.sealed=!0,e=await this.jsm.streams.update(this.stream,e.config),Promise.resolve(new Ud(e)))}async status(e){const t=await this._si(e);return t===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Ud(t))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(e,t,n){const i=this.js.getOptions();n=n||{timeout:i.timeout},n.timeout=n.timeout||i.timeout,n.previousRevision=n.previousRevision??void 0;const{timeout:a,previousRevision:u}=n,f=this.js.nc.info?.max_payload||1024;e=e||{},e.options=e.options||{};let h=e.options?.max_chunk_size||128*1024;h=h>f?f:h,e.options.max_chunk_size=h;const p=await this.info(e.name),{name:m,error:y}=this._checkNotEmpty(e.name);if(y)return Promise.reject(y);const g=ns.next(),b=this._chunkSubject(g),I=this._metaSubject(m),S=Object.assign({bucket:this.name,nuid:g,size:0,chunks:0},zw(e)),w=ir(),O=[],P=new Ea;try{const D=t?t.getReader():null,T=_w.create();for(;;){const{done:N,value:G}=D?await D.read():{done:!0,value:void 0};if(N){if(P.size()>0){const oe=P.drain();T.update(oe),S.chunks++,S.size+=oe.length,O.push(this.js.publish(b,oe,{timeout:a}))}await Promise.all(O),O.length=0,S.mtime=new Date().toISOString();const q=xa.encode(T.digest());S.digest=`${Bw}${q}`,S.deleted=!1;const $=ki();typeof u=="number"&&$.set(ci.ExpectedLastSubjectSequenceHdr,`${u}`),$.set(Xr.RollupHdr,Xr.RollupValueSubject);const K=await this.js.publish(I,Fn().encode(S),{headers:$,timeout:a});if(S.revision=K.seq,p)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${p.nuid}`})}catch{}w.resolve(new zd(S));break}if(G)for(P.fill(G);P.size()>h;){S.chunks++,S.size+=h;const q=P.drain(e.options.max_chunk_size);T.update(q),O.push(this.js.publish(b,q,{timeout:a}))}}}catch(D){await this.jsm.streams.purge(this.stream,{filter:b}),w.reject(D)}return w}putBlob(e,t,n){function i(a){return new ReadableStream({pull(u){u.enqueue(a),u.close()}})}return t===null&&(t=new Uint8Array(0)),this.put(e,i(t),n)}put(e,t,n){return e?.options?.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(e,t,n)}async getBlob(e){async function t(a){const u=new Ea,c=a.getReader();for(;;){const{done:f,value:h}=await c.read();if(f)return u.drain();h&&h.length&&u.fill(h)}}const n=await this.get(e);if(n===null)return Promise.resolve(null);const i=await Promise.all([n.error,t(n.data)]);return i[0]?Promise.reject(i[0]):Promise.resolve(i[1])}async get(e){const t=await this.rawInfo(e);if(t===null||t.deleted)return Promise.resolve(null);if(t.options&&t.options.link){const m=t.options.link.name||"";if(m==="")throw new Error("link is a bucket");return(t.options.link.bucket!==this.name?await $o.create(this.js,t.options.link.bucket):this).get(m)}if(!t.digest.startsWith(Bw))return Promise.reject(new Error(`unknown digest type: ${t.digest}`));const n=Cd(t.digest.substring(8));if(n===null)return Promise.reject(new Error(`unable to parse digest: ${t.digest}`));const i=ir(),a={info:new zd(t),error:i};if(t.size===0)return a.data=zP(),i.resolve(null),Promise.resolve(a);let u;const c=os();c.orderedConsumer();const f=_w.create(),h=`$O.${this.name}.C.${t.nuid}`,p=await this.js.subscribe(h,c);return(async()=>{for await(const m of p)m.data.length>0&&(f.update(m.data),u.enqueue(m.data)),m.info.pending===0&&(vC(n,f.digest())?u.close():u.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${n}`)),p.unsubscribe())})().then(()=>{i.resolve()}).catch(m=>{u.error(m),i.reject(m)}),a.data=new ReadableStream({start(m){u=m},cancel(){p.unsubscribe()}}),a}linkStore(e,t){if(!(t instanceof $o))return Promise.reject("bucket required");const n=t,{name:i,error:a}=this._checkNotEmpty(e);if(a)return Promise.reject(a);const u={name:i,options:{link:{bucket:n.name}}};return this._put(u,null)}async link(e,t){const{name:n,error:i}=this._checkNotEmpty(e);if(i)return Promise.reject(i);if(t.deleted)return Promise.reject(new Error("src object is deleted"));if(t.isLink())return Promise.reject(new Error("src object is a link"));const a=await this.rawInfo(e);if(a!==null&&!a.deleted)return Promise.reject(new Error("an object already exists with that name"));const u={bucket:t.bucket,name:t.name},c={name:n,bucket:t.bucket,options:{link:u}};await this.js.publish(this._metaSubject(e),JSON.stringify(c));const f=await this.info(e);return Promise.resolve(f)}async delete(e){const t=await this.rawInfo(e);if(t===null)return Promise.resolve({purged:0,success:!1});t.deleted=!0,t.size=0,t.chunks=0,t.digest="";const n=Fn(),i=ki();return i.set(Xr.RollupHdr,Xr.RollupValueSubject),await this.js.publish(this._metaSubject(t.name),n.encode(t),{headers:i}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(t.nuid)})}async update(e,t={}){const n=await this.rawInfo(e);if(n===null)return Promise.reject(new Error("object not found"));if(n.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));t.name=t.name??n.name;const{name:i,error:a}=this._checkNotEmpty(t.name);if(a)return Promise.reject(a);if(e!==t.name){const f=await this.info(t.name);if(f&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"))}t.name=i;const u=Object.assign({},n,zw(t)),c=await this.js.publish(this._metaSubject(u.name),JSON.stringify(u));return e!==t.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(e)}),Promise.resolve(c)}async watch(e={}){e.includeHistory=e.includeHistory??!1,e.ignoreDeletes=e.ignoreDeletes??!1;let t=!1;const n=new Nr,i=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:i})}catch(f){f.code==="404"?(n.push(null),t=!0):n.stop(f)}const a=Fn(),u=os();u.orderedConsumer(),e.includeHistory?u.deliverLastPerSubject():(t=!0,u.deliverNew()),u.callback((f,h)=>{if(f){n.stop(f);return}if(h!==null){const p=a.decode(h.data);p.deleted&&e.ignoreDeletes===!0||n.push(p),h.info?.pending===0&&!t&&(t=!0,n.push(null))}});const c=await this.js.subscribe(i,u);return n._data=c,n.iterClosed.then(()=>{c.unsubscribe()}),c.closed.then(()=>{n.stop()}).catch(f=>{n.stop(f)}),n}_chunkSubject(e){return`$O.${this.name}.C.${e}`}_metaSubject(e){return`$O.${this.name}.M.${xa.encode(e)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(e={}){try{this.stream=RP(this.name)}catch(i){return Promise.reject(i)}const t=e?.ttl||0;delete e.ttl;const n=Object.assign({max_age:t},e);n.name=this.stream,n.num_replicas=e.replicas??1,n.allow_direct=!0,n.allow_rollup_hdrs=!0,n.discard=Po.New,n.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],e.placement&&(n.placement=e.placement),e.metadata&&(n.metadata=e.metadata),typeof e.compression=="boolean"&&(n.compression=e.compression?as.S2:as.None);try{await this.jsm.streams.info(n.name)}catch(i){i.message==="stream not found"&&await this.jsm.streams.add(n)}}static async create(e,t,n={}){const i=await e.jetstreamManager(),a=new $o(t,i,e);return await a.init(n),Promise.resolve(a)}}class HP{js;constructor(e){this.js=e}kv(e,t={}){const n=this.js,{ok:i,min:a}=n.nc.features.get(At.JS_KV);return i?t.bindOnly?qo.bind(this.js,e,t):qo.create(this.js,e,t):Promise.reject(new Error(`kv is only supported on servers ${a} or better`))}os(e,t={}){if(typeof crypto?.subtle?.digest!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const n=this.js,{ok:i,min:a}=n.nc.features.get(At.JS_OBJECTSTORE);return i?$o.create(this.js,e,t):Promise.reject(new Error(`objectstore is only supported on servers ${a} or better`))}}class Hd extends Ro{consumers;streams;consumerAPI;streamAPI;constructor(e,t){super(e,t),this.consumerAPI=new mc(e,t),this.streamAPI=new Wd(e,t),this.consumers=new Vd(this.consumerAPI),this.streams=new WP(this.streamAPI)}jetstreamManager(e){e===void 0&&(e=this.opts.checkAPI);const t=Object.assign({},this.opts,{checkAPI:e});return this.nc.jetstreamManager(t)}get apiPrefix(){return this.prefix}get views(){return new HP(this)}async publish(e,t=gn,n){n=n||{},n.expect=n.expect||{};const i=n?.headers||ki();n&&(n.msgID&&i.set(ci.MsgIdHdr,n.msgID),n.expect.lastMsgID&&i.set(ci.ExpectedLastMsgIdHdr,n.expect.lastMsgID),n.expect.streamName&&i.set(ci.ExpectedStreamHdr,n.expect.streamName),typeof n.expect.lastSequence=="number"&&i.set(ci.ExpectedLastSeqHdr,`${n.expect.lastSequence}`),typeof n.expect.lastSubjectSequence=="number"&&i.set(ci.ExpectedLastSubjectSequenceHdr,`${n.expect.lastSubjectSequence}`));const a=n.timeout||this.timeout,u={};a&&(u.timeout=a),n&&(u.headers=i);let{retries:c,retry_delay:f}=n;c=c||1,f=f||250;let h;for(let m=0;m<c;m++)try{h=await this.nc.request(e,t,u);break}catch(y){if(y.code==="503"&&m+1<c)await va(f);else throw y}const p=this.parseJsResponse(h);if(p.stream==="")throw Me.errorForCode(_e.JetStreamInvalidAck);return p.duplicate=p.duplicate?p.duplicate:!1,p}async pull(e,t,n=0){Zr(e),ba(t);let i=this.timeout;n>i&&(i=n),n=n<0?0:sr(n);const a={batch:1,no_wait:n===0,expires:n},u=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${e}.${t}`,this.jc.encode(a),{noMux:!0,timeout:i}),c=wa(u);if(c)throw c;return Uo(u,this.timeout)}fetch(e,t,n={}){Zr(e),ba(t);let i=null;const a=(n.max_bytes??0)>0;let u=0;const c=a?n.max_bytes:0;let f=null;const h={};if(h.batch=n.batch||1,c){const w=this.nc.features.get(At.JS_PULL_MAX_BYTES);if(!w.ok)throw new Error(`max_bytes is only supported on servers ${w.min} or better`);h.max_bytes=c}h.no_wait=n.no_wait||!1,h.no_wait&&h.expires&&(h.expires=0);const p=n.expires||0;if(p&&(h.expires=sr(p)),p===0&&h.no_wait===!1)throw new Error("expires or no_wait is required");const m=n.idle_heartbeat||0;m&&(h.idle_heartbeat=sr(m),n.delay_heartbeat===!0&&(h.idle_heartbeat=sr(m*4)));const y=new Nr,g=h.batch;let b=0;y.protocolFilterFn=(w,O=!1)=>Od(w.msg)?(f?.work(),!1):!0,y.dispatchedFn=w=>{if(w){if(a&&(u+=w.data.length),b++,i&&w.info.pending===0)return;(y.getPending()===1&&w.info.pending===0||g===b||c>0&&u>=c)&&y.stop()}};const I=Ti(this.nc.options.inboxPrefix),S=this.nc.subscribe(I,{max:n.batch,callback:(w,O)=>{w===null&&(w=wa(O)),w!==null?(i&&(i.cancel(),i=null),XI(w)?y.stop(Gw(w)===null?void 0:w):y.stop(w)):(f?.work(),y.received++,y.push(Uo(O,this.timeout)))}});return p&&(i=ga(p),i.catch(()=>{S.isClosed()||(S.drain().catch(()=>{}),i=null),f&&f.cancel()})),(async()=>{try{m&&(f=new Td(m,w=>(y.push(()=>{y.err=new Me(`${Ln.IdleHeartbeatMissed}: ${w}`,_e.JetStreamIdleHeartBeat)}),!0)))}catch{}await S.closed,i!==null&&(i.cancel(),i=null),f&&f.cancel(),y.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${e}.${t}`,this.jc.encode(h),{reply:I}),y}async pullSubscribe(e,t=os()){const n=await this._processOptions(e,t);if(n.ordered)throw new Error("pull subscribers cannot be be ordered");if(n.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const i=n.config.ack_policy;if(i===Rr.None||i===Rr.All)throw new Error("ack policy for pull consumers must be explicit");const a=this._buildTypedSubscriptionOpts(n),u=new YP(this,n.deliver,a);u.info=n;try{await this._maybeCreateConsumer(n)}catch(c){throw u.unsubscribe(),c}return u}async subscribe(e,t=os()){const n=await this._processOptions(e,t);if(!n.isBind&&!n.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const i=this._buildTypedSubscriptionOpts(n),a=new Hw(this,n.deliver,i);a.info=n;try{await this._maybeCreateConsumer(n)}catch(u){throw a.unsubscribe(),u}return a._maybeSetupHbMonitoring(),a}async _processOptions(e,t=os()){const n=gw(t)?t.getOpts():t;if(n.isBind=gw(t)?t.isBind:!1,n.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},n.ordered){if(n.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},n.config.ack_policy!==Rr.NotSet&&n.config.ack_policy!==Rr.None)throw new Me("ordered consumer: ack_policy can only be set to 'none'",_e.ApiError);if(n.config.durable_name&&n.config.durable_name.length>0)throw new Me("ordered consumer: durable_name cannot be set",_e.ApiError);if(n.config.deliver_subject&&n.config.deliver_subject.length>0)throw new Me("ordered consumer: deliver_subject cannot be set",_e.ApiError);if(n.config.max_deliver!==void 0&&n.config.max_deliver>1)throw new Me("ordered consumer: max_deliver cannot be set",_e.ApiError);if(n.config.deliver_group&&n.config.deliver_group.length>0)throw new Me("ordered consumer: deliver_group cannot be set",_e.ApiError);n.config.deliver_subject=Ti(this.nc.options.inboxPrefix),n.config.ack_policy=Rr.None,n.config.max_deliver=1,n.config.flow_control=!0,n.config.idle_heartbeat=n.config.idle_heartbeat||sr(5e3),n.config.ack_wait=sr(1320*60*1e3),n.config.mem_storage=!0,n.config.num_replicas=1}if(n.config.ack_policy===Rr.NotSet&&(n.config.ack_policy=Rr.All),n.api=this,n.config=n.config||{},n.stream=n.stream?n.stream:await this.findStream(e),n.attached=!1,n.config.durable_name)try{const i=await this.consumerAPI.info(n.stream,n.config.durable_name);if(i){if(i.config.filter_subject&&i.config.filter_subject!==e)throw new Error("subject does not match consumer");const a=n.config.deliver_group??"";if(a===""&&i.push_bound===!0)throw new Error("duplicate subscription");const u=i.config.deliver_group??"";if(a!==u)throw u===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${u}'`);n.last=i,n.config=i.config,n.attached=!0,n.config.durable_name||(n.name=i.name)}}catch(i){if(i.code!=="404")throw i}return!n.attached&&n.config.filter_subject===void 0&&n.config.filter_subjects===void 0&&(n.config.filter_subject=e),n.deliver=n.config.deliver_subject||Ti(this.nc.options.inboxPrefix),n}_buildTypedSubscriptionOpts(e){const t={};return t.adapter=KP(e.callbackFn===void 0,this.timeout),t.ingestionFilterFn=Hd.ingestionFn(e.ordered),t.protocolFilterFn=(n,i=!1)=>{const a=n;return Ed(a.msg)?(i||a.msg.respond(),!1):!0},!e.mack&&e.config.ack_policy!==Rr.None&&(t.dispatchedFn=eN),e.callbackFn&&(t.callback=e.callbackFn),t.max=e.max||0,t.queue=e.queue,t}async _maybeCreateConsumer(e){if(e.attached)return;if(e.isBind)throw new Error(`unable to bind - durable consumer ${e.config.durable_name} doesn't exist in ${e.stream}`);e.config=Object.assign({deliver_policy:yr.All,ack_policy:Rr.Explicit,ack_wait:sr(30*1e3),replay_policy:_a.Instant},e.config);const t=await this.consumerAPI.add(e.stream,e.config);if(Array.isArray(e.config.filter_subjects&&!Array.isArray(t.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");e.name=t.name,e.config=t.config,e.last=t}static ingestionFn(e){return(t,n)=>{const i=n;if(!t)return{ingest:!1,protocol:!1};const a=t;if(wa(a.msg)||i.monitor?.work(),Od(a.msg)){const c=e?i._checkHbOrderConsumer(a.msg):!0;return e||i.info.flow_control.heartbeat_count++,{ingest:c,protocol:!0}}else if(Ed(a.msg))return i.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:e?i._checkOrderedConsumer(t):!0,protocol:!1}}}}class Gd{options;protocol;draining;listeners;_services;constructor(e){this.draining=!1,this.options=pP(e),this.listeners=[]}static connect(e={}){return new Promise((t,n)=>{const i=new Gd(e);Sc.connect(i.options,i).then(a=>{i.protocol=a,async function(){for await(const u of a.status())i.listeners.forEach(c=>{c.push(u)})}(),t(i)}).catch(a=>{n(a)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(e,t,n){if(this.isClosed())throw Me.errorForCode(_e.ConnectionClosed);if(t&&this.isDraining()||n&&this.protocol.noMorePublishing)throw Me.errorForCode(_e.ConnectionDraining);if(e=e||"",e.length===0)throw Me.errorForCode(_e.BadSubject)}publish(e,t,n){this._check(e,!1,!0),this.protocol.publish(e,t,n)}publishMessage(e){return this.publish(e.subject,e.data,{reply:e.reply,headers:e.headers})}respondMessage(e){return e.reply?(this.publish(e.reply,e.data,{reply:e.reply,headers:e.headers}),!0):!1}subscribe(e,t={}){this._check(e,!0,!1);const n=new Lw(this.protocol,e,t);return this.protocol.subscribe(n),n}_resub(e,t,n){this._check(t,!0,!1);const i=e;i.max=n,n&&(i.max=n+i.received),this.protocol.resub(i,t)}requestMany(e,t=gn,n={maxWait:1e3,maxMessages:-1}){const i=!this.protocol.options.noAsyncTraces;try{this._check(e,!0,!0)}catch(f){return Promise.reject(f)}if(n.strategy=n.strategy||ei.Timer,n.maxWait=n.maxWait||1e3,n.maxWait<1)return Promise.reject(new Me("timeout",_e.InvalidOption));const a=new Nr;function u(f){a.push(()=>{a.stop(f)})}function c(f,h){f||h===null?u(f===null?void 0:f):a.push(h)}if(n.noMux){const f=i?new Error().stack:null;let h=typeof n.maxMessages=="number"&&n.maxMessages>0?n.maxMessages:-1;const p=this.subscribe(Ti(this.options.inboxPrefix),{callback:(b,I)=>{if(I?.data?.length===0&&I?.headers?.status===_e.NoResponders&&(b=Me.errorForCode(_e.NoResponders)),b){f&&(b.stack+=`
|
|
160
160
|
|
|
161
|
-
${f}`),
|
|
161
|
+
${f}`),m(b);return}c(null,I),n.strategy===ei.Count&&(h--,h===0&&m()),n.strategy===ei.JitterTimer&&(g(),y=setTimeout(()=>{m()},300)),n.strategy===ei.SentinelMsg&&I&&I.data.length===0&&m()}});p.requestSubject=e,p.closed.then(()=>{u()}).catch(b=>{a.stop(b)});const m=b=>{b&&a.push(()=>{throw b}),g(),p.drain().then(()=>{u()}).catch(I=>{u()})};a.iterClosed.then(()=>{g(),p?.unsubscribe()}).catch(b=>{g(),p?.unsubscribe()});try{this.publish(e,t,{reply:p.getSubject()})}catch(b){m(b)}let y=setTimeout(()=>{m()},n.maxWait);const g=()=>{y&&clearTimeout(y)}}else{const f=n;f.callback=c,a.iterClosed.then(()=>{h.cancel()}).catch(p=>{h.cancel(p)});const h=new bC(this.protocol.muxSubscriptions,e,f);this.protocol.request(h);try{this.publish(e,t,{reply:`${this.protocol.muxSubscriptions.baseInbox}${h.token}`,headers:n.headers})}catch(p){h.cancel(p)}}return Promise.resolve(a)}request(e,t,n={timeout:1e3,noMux:!1}){try{this._check(e,!0,!0)}catch(a){return Promise.reject(a)}const i=!this.protocol.options.noAsyncTraces;if(n.timeout=n.timeout||1e3,n.timeout<1)return Promise.reject(new Me("timeout",_e.InvalidOption));if(!n.noMux&&n.reply)return Promise.reject(new Me("reply can only be used with noMux",_e.InvalidOption));if(n.noMux){const a=n.reply?n.reply:Ti(this.options.inboxPrefix),u=ir(),c=i?new Error:null,f=this.subscribe(a,{max:1,timeout:n.timeout,callback:(h,p)=>{h?(c&&h.code!==_e.Timeout&&(h.stack+=`
|
|
162
162
|
|
|
163
|
-
${c.stack}`),f.unsubscribe(),u.reject(h)):(h=
|
|
163
|
+
${c.stack}`),f.unsubscribe(),u.reject(h)):(h=hw(p),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 rw(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(Re.errorForCode(be.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Re.errorForCode(be.ConnectionClosed)):this.isDraining()?Promise.reject(Re.errorForCode(be.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 yP(this,e);if(e.checkAPI!==!1)try{await t.getAccountInfo()}catch(n){const i=n;throw i.code===be.NoResponders&&(i.code=be.JetStreamNotEnabled),i}return t}jetstream(e={}){return new Fd(this,e)}getServerVersion(){const e=this.info;return e?Ps(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Re.errorForCode(be.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 wP(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Re.errorForCode(be.ConnectionClosed)):this.isDraining()?Promise.reject(Re.errorForCode(be.ConnectionDraining)):this.protocol.reconnect()}}class wP{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 XC(this.nc,e,t)}}class _P{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 xP{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 Aw extends KI{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=Oi(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,n);const a=this.info;a.config.name=Cs.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 Re(`unable to recreate ordered consumer ${a.stream} at seq ${t}`,be.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=RI(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 SP extends Aw{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(Pt.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 EP(r,e){return r?TP(e):OP(e)}function OP(r){return(e,t)=>e?[e,null]:(e=va(t),e?[e,null]:[null,Do(t,r)])}function TP(r){return(e,t)=>{if(e)return[e,null];const n=va(t);return n!==null?[kw(n),null]:[null,Do(t,r)]}}function kw(r){if(r!==null)switch(r.code){case be.JetStream404NoMessages:case be.JetStream408RequestTimeout:return null;case be.JetStream409:return MI(r)?r:null;default:return r}return null}function AP(r){r&&r.ack()}function kP(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 IP{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=kP(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 rw(a.muxSubscriptions,this.msg.reply,{timeout:e.timeout},u);a.request(c);try{a.publish(this.msg.reply,xw,{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(xw)}nak(e){let t=cP;e&&(t=zb().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(lP,hP,i),u=e?{reply:e}:void 0;this.msg.respond(a,u)}term(e=""){let t=fP;(e==null?void 0:e.length)>0&&(t=zb().encode(`+TERM ${e}`)),this.doAck(t)}json(){return this.msg.json()}string(){return this.msg.string()}}const CP="1.29.2",PP="nats.ws";class NP{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=CP,this.lang=PP,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 Re("tls",be.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=nC(u);if(c!==""){const f=zC.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]);VC(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 Re(u.message,be.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 RP(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 MP(r={}){return ZI({defaultPort:443,urlParseFn:RP,factory:()=>new NP}),Ld.connect(r)}const Iw=["new","last","last_per_subject"],DP=async(r,e)=>(console.info(`Connecting to server ${r}`),await MP({servers:[r],authenticator:qC(new TextEncoder().encode(e))}));async function*FP(r){const e=Ln();for await(const t of r)try{yield e.decode(t.data)}catch(n){console.warn(`Skipping event: ${n}`)}}const Cw=(r,e)=>{r.current&&(r.current=void 0),e.current&&(e.current.close(),e.current=void 0)},Pw={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]"},LP={undefined:0,event:1,eventset:2,quantity:3,state:4,count:5,info:6,beat:7},qP=(r,e,t)=>{if(!Pw[r])throw new Error("Unknown stream name");const n=Pw[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+="."+(LP[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},jP=r=>{const{streamName:e,locationRef:t,filters:n,deliverPolicy:i="new",dispatch:a}=r;if(!Iw.includes(i))throw new Error(`Invalid deliverPolicy "${i}" specified. Valid options are: ${Iw.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=le.useRef(),h=le.useRef();return le.useEffect(()=>!u.natsUrl||!c.current||!e||!t?void 0:((async()=>{try{const y=await DP(u.natsUrl,c.current);f.current=y;const g=qP(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=FP(b);if(h.current=I,typeof a=="function")for await(const x of I)a(x)}catch(y){console.error(`Error setting up event stream. ${y}`)}})(),()=>Cw(h,f)),[e,t,i,u.natsUrl,c]),[h.current,()=>Cw(h,f)]},UP=le.forwardRef(({href:r,asFlyout:e,children:t,...n},i)=>{const{isEmbedded:a}=h0(),{navigateParent:u}=d0();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})});dt.Link=UP,dt.MMProvider=xI,dt.PrivateLayout=uk,dt._useMMApolloLinkContext=ok,dt.useApiRequest=f0,dt.useAsyncEffect=bo,dt.useAsyncInterval=wo,dt.useDowntimeQuery=YA,dt.useEventStream=jP,dt.useMMAppCommands=d0,dt.useMMAppContext=tk,dt.useMMAppCustomInputLabel=ak,dt.useMMAppCustomInputOpen=ik,dt.useMMAppCustomInputSave=sk,dt.useMMAppParams=h0,dt.useMMAppSetClaims=nk,dt.useMMAppSetting=rk,dt.useMMAppTools=ek,dt.useMMAuth=ti,dt.useMMEmbeddedApp=XA,dt.useMMHash=ZA,dt.useMMTemplates=KA,dt.useProductionQuery=QA,dt.useQuantityStream=JA,dt.useSearchParamsState=HA,dt.useThrottleEffect=GA,Object.defineProperty(dt,Symbol.toStringTag,{value:"Module"})});
|
|
165
|
+
${c.stack}`),u.reject(h)):u.resolve(p))}});return f.requestSubject=e,this.protocol.publish(e,t,{reply:a,headers:n.headers}),u}else{const a=new xw(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(Me.errorForCode(_e.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Me.errorForCode(_e.ConnectionClosed)):this.isDraining()?Promise.reject(Me.errorForCode(_e.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 Nr;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 BP(this,e);if(e.checkAPI!==!1)try{await t.getAccountInfo()}catch(n){const i=n;throw i.code===_e.NoResponders&&(i.code=_e.JetStreamNotEnabled),i}return t}jetstream(e={}){return new Hd(this,e)}getServerVersion(){const e=this.info;return e?Ms(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Me.errorForCode(_e.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 GP(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Me.errorForCode(_e.ConnectionClosed)):this.isDraining()?Promise.reject(Me.errorForCode(_e.ConnectionDraining)):this.protocol.reconnect()}}class GP{nc;constructor(e){this.nc=e}add(e){try{return new Lo(this.nc,e).start()}catch(t){return Promise.reject(t)}}client(e,t){return new OP(this.nc,e,t)}}class QP{bucket;sm;prefixLen;constructor(e,t,n){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(xc)||"PUT"}get length(){const e=this.sm.header.get(Xr.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class JP{bucket;key;sm;constructor(e,t,n){this.bucket=e,this.key=t,this.sm=n}get value(){return this.sm.data}get created(){return new Date(Sd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){return this.sm.headers?.get(xc)||"PUT"}get delta(){return this.sm.info.pending}get length(){const e=this.sm.headers?.get(Xr.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Hw extends xC{js;monitor;constructor(e,t,n){super(e.nc,t,n),this.js=e,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(e){this.sub.info=e}get info(){return this.sub.info}_resetOrderedConsumer(e){if(this.info===null||this.sub.isClosed())return;const t=Ti(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,t);const i=this.info;i.config.name=ns.next(),i.ordered_consumer_sequence.delivery_seq=0,i.flow_control.heartbeat_count=0,i.flow_control.fc_count=0,i.flow_control.consumer_restarts++,i.deliver=t,i.config.deliver_subject=t,i.config.deliver_policy=yr.StartSequence,i.config.opt_start_seq=e;const a={};a.stream_name=this.info.stream,a.config=i.config;const u=`${i.api.prefix}.CONSUMER.CREATE.${i.stream}`;this.js._request(u,a,{retries:-1}).then(c=>{const f=c,h=this.sub.info;h.last=f,this.info.config=f.config,this.info.name=f.name}).catch(c=>{const f=new Me(`unable to recreate ordered consumer ${i.stream} at seq ${e}`,_e.RequestError,c);this.sub.callback(f,{})})}_maybeSetupHbMonitoring(){const e=this.info?.config?.idle_heartbeat||0;e&&this._setupHbMonitoring(Sd(e))}_setupHbMonitoring(e,t=0){const n={cancelAfter:0,maxOut:2};t&&(n.cancelAfter=t);const i=this.sub,a=u=>{const c=nC(409,`${Ln.IdleHeartbeatMissed}: ${u}`,this.sub.subject);if(!this.info?.ordered)this.sub.callback(null,c);else{if(!this.js.nc.protocol.connected)return!1;const h=this.info?.ordered_consumer_sequence?.stream_seq||0;return this._resetOrderedConsumer(h+1),this.monitor?.restart(),!1}return!i.noIterator};this.monitor=new Td(e,a,n)}_checkHbOrderConsumer(e){const t=e.headers.get(Xr.ConsumerStalledHdr);t!==""&&this.js.nc.publish(t);const n=parseInt(e.headers.get(Xr.LastConsumerSeqHdr),10),i=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,n!==i.delivery_seq&&this._resetOrderedConsumer(i.stream_seq+1),!1}_checkOrderedConsumer(e){const t=this.info.ordered_consumer_sequence,n=e.info.streamSequence,i=e.info.deliverySequence;return i!=t.delivery_seq+1?(this._resetOrderedConsumer(t.stream_seq+1),!1):(t.delivery_seq=i,t.stream_seq=n,!0)}async destroy(){this.isClosed()||await this.drain();const e=this.sub.info,t=e.config.durable_name||e.name,n=`${e.api.prefix}.CONSUMER.DELETE.${e.stream}.${t}`;await e.api._request(n)}async consumerInfo(){const e=this.sub.info,t=e.config.durable_name||e.name,n=`${e.api.prefix}.CONSUMER.INFO.${e.stream}.${t}`,i=await e.api._request(n);return e.last=i,i}}class YP extends Hw{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(At.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=sr(c));let f=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(f=e.idle_heartbeat,u.idle_heartbeat=sr(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,p=`${h.prefix}.CONSUMER.MSG.NEXT.${t}.${a}`,m=this.sub.subject;h.nc.publish(p,h.jc.encode(u),{reply:m})}}}function KP(r,e){return r?XP(e):ZP(e)}function ZP(r){return(e,t)=>e?[e,null]:(e=wa(t),e?[e,null]:[null,Uo(t,r)])}function XP(r){return(e,t)=>{if(e)return[e,null];const n=wa(t);return n!==null?[Gw(n),null]:[null,Uo(t,r)]}}function Gw(r){if(r!==null)switch(r.code){case _e.JetStream404NoMessages:case _e.JetStream408RequestTimeout:return null;case _e.JetStream409:return iC(r)?r:null;default:return r}return null}function eN(r){r&&r.ack()}function tN(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.deliveryCount=parseInt(e[6],10),t.redeliveryCount=t.deliveryCount,t.redelivered=t.deliveryCount>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 rN{msg;di;didAck;timeout;constructor(e,t){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=tN(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>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]===jo[0]&&e[1]===jo[1]&&e[2]===jo[2]&&e[3]===jo[3]}async ackAck(e){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 i=this.msg.publisher,a=!i.options?.noAsyncTraces,u=new xw(i.muxSubscriptions,this.msg.reply,{timeout:e.timeout},a);i.request(u);try{i.publish(this.msg.reply,Vw,{reply:`${i.muxSubscriptions.baseInbox}${u.token}`})}catch(c){u.cancel(c)}try{await Promise.race([u.timer,u.deferred]),t.resolve(!0)}catch(c){u.cancel(c),t.reject(c)}}else t.resolve(!1);return t}ack(){this.doAck(Vw)}nak(e){let t=DP;e&&(t=fw().encode(`-NAK ${JSON.stringify({delay:sr(e)})}`)),this.doAck(t)}working(){this.doAck(jo)}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=sr(t.expires));const i=Fn().encode(n),a=Ea.concat(FP,qP,i),u=e?{reply:e}:void 0;this.msg.respond(a,u)}term(e=""){let t=LP;e?.length>0&&(t=fw().encode(`+TERM ${e}`)),this.doAck(t)}json(){return this.msg.json()}string(){return this.msg.string()}}const nN="1.30.3",iN="nats.ws";class sN{version;lang;closeError;connected;done;socket;options;socketClosed;encrypted;peeked;yields;signal;closedNotification;constructor(){this.version=nN,this.lang=iN,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 Me("tls",_e.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=Ea.concat(...this.yields),c=IC(u);if(c!==""){const f=gP.exec(c);if(!f){t.debug&&console.error("!!!",fc(u)),n.reject(new Error("unexpected response from server"));return}try{const h=JSON.parse(f[1]);mP(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 Me(u.message,_e.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 va(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(`> ${fc(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(`< ${fc(e)}`);return}catch(t){this.options.debug&&console.error(`!!! ${fc(e)}: ${t}`)}}close(e){return this._closed(e,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){this.done=!0;try{this.socket?.close()}catch{}}}function aN(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 oN(r={}){return EC({defaultPort:443,urlParseFn:aN,factory:()=>new sN}),Gd.connect(r)}const Qw=["new","last","last_per_subject"],uN=async(r,e)=>(console.info(`Connecting to server ${r}`),await oN({servers:[r],authenticator:lP(new TextEncoder().encode(e))}));async function*cN(r){const e=Fn();for await(const t of r)try{yield e.decode(t.data)}catch(n){console.warn(`Skipping event: ${n}`)}}const Jw=(r,e)=>{r.current&&(r.current=void 0),e.current&&(e.current.close(),e.current=void 0)},Yw={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]"},lN={undefined:0,event:1,eventset:2,quantity:3,state:4,count:5,info:6,beat:7},fN=(r,e,t)=>{if(!Yw[r])throw new Error("Unknown stream name");const n=Yw[r].split(".");let i="";return n.forEach((a,u)=>{switch(a){case"[location-ref]":i+="."+e;break;case"[machine-ref]":i+="."+(t?.machineRef||"*");break;case"[qualifier]":i+="."+(t?.qualifier||"0");break;case"[data-category]":i+="."+(lN[t?.dataCategory]||"*");break;case"[metric-key]":i+="."+(t?.metricKey?t?.metricKey.toLowerCase().replace(/[^a-zA-Z0-9_\\-]/gi,"-"):"*");break;case"[message-type]":i+="."+(t?.messageType||"0");break;case"[edge-ref]":i+="."+(t?.edgeRef||"*");break;case"[service-name]":i+="."+(t?.serviceName||"*");break;case"[machine-source-ref]":i+="."+(t?.machineSourceRef||"*");break;default:u>0&&(i+="."),i+=a;break}}),i},hN=r=>{const{streamName:e,locationRef:t,filters:n,deliverPolicy:i="new",dispatch:a}=r;if(!Qw.includes(i))throw new Error(`Invalid deliverPolicy "${i}" specified. Valid options are: ${Qw.join(", ")}`);n&&n.length>1&&console.warn("Multiple filters are not supported. Only the first filter will be used.");const{urls:u,natsCredsRef:c}=Xn(),f=be.useRef(),h=be.useRef();return be.useEffect(()=>!u.natsUrl||!c.current||!e||!t?void 0:((async()=>{try{const m=await uN(u.natsUrl,c.current);f.current=m;const y=fN(e,t,n?.[0]);console.info(`Consuming events from stream ${e} filtering by subject ${y}`);const b=await(await m.jetstream().consumers.get(e,{deliver_policy:i,filterSubjects:y})).consume({max_messages:1e3}),I=cN(b);if(h.current=I,typeof a=="function")for await(const S of I)a(S)}catch(m){console.error(`Error setting up event stream. ${m}`)}})(),()=>Jw(h,f)),[e,t,i,u.natsUrl,c]),[h.current,()=>Jw(h,f)]},dN=be.forwardRef(({href:r,asFlyout:e,children:t,...n},i)=>{const{isEmbedded:a}=P0(),{navigateParent:u}=N0();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})});Tt.Link=dN,Tt.MMProvider=HI,Tt.PrivateLayout=PA,Tt._useMMApolloLinkContext=CA,Tt.useApiRequest=C0,Tt.useAsyncEffect=xo,Tt.useAsyncInterval=Eo,Tt.useDowntimeQuery=bA,Tt.useEventStream=hN,Tt.useMMAppCommands=N0,Tt.useMMAppContext=EA,Tt.useMMAppCustomInputLabel=IA,Tt.useMMAppCustomInputOpen=kA,Tt.useMMAppCustomInputSave=AA,Tt.useMMAppParams=P0,Tt.useMMAppSetClaims=TA,Tt.useMMAppSetting=OA,Tt.useMMAppTools=xA,Tt.useMMAuth=Xn,Tt.useMMEmbeddedApp=SA,Tt.useMMHash=_A,Tt.useMMTemplates=wA,Tt.useProductionQuery=gA,Tt.useQuantityStream=vA,Tt.useSearchParamsState=mA,Tt.useThrottleEffect=yA,Object.defineProperty(Tt,Symbol.toStringTag,{value:"Module"})});
|